Never let SSU1 test result be symmetric NAT, it's probably charlie
Don't use SSU1 test if we think we are symmetric NAT
Cleanup two places to call new fail() method
- Send msg 6 even if msg 5 is not received, after a short delay, to detect symmetric NAT
- Prevent test result of symmetric NAT if Charlie is the one that appears to be symmetric natted.
- Mark if Charlie unreachable if apparently symmetric natted.
- Do not treat a different IP but same port as symmetric NAT
- Increase msg 6 retransmission frequency
- Ignore msg 5 received after sending msg 6
- Call externalAddressReceived() on reception of msg 7
- Add javadoc for testComplete() state machine
Most changes only affect SSU2; some SSU1 changes to follow.
ref: http://zzz.i2p/topics/3489
Rename isSnatted() to isSymNatted()
Minor rewrite in PeerState2.gotTermination()
Remove dead peer when pinging fails in intro manager
Cleanup ip length check in externalAddressReceived()
Log tweaks
Primarily for Peer Test and Relay, so the test or relay can be aborted.
Previously, sends on a dead PeerState2 were not detected or prevented.
Catch IOE throughout where necessary around all build() calls.
Add a fail() method in PeerTestManager
which could be different, esp. with temporary IPv6 addresses.
Could result in an erroneous SNAT result.
Add logging if different when starting test.
Check address block received in msg 6, use in logging only for now
Add logging of address block received in msg 7 if different than expected (possible SNAT)
Remove isValidPort() check in msg 5 recently added, already checked in code above
Add notes about possible externalAddressReceived() calls from peer test
Add notes about our address in PeerState2
Simplify check in EstablishmentManager.sendConfirmation(), we don't need to validate
RemoteHostId IP again, we did it before connecting.
Add check that received port is >= 1024.
Check for dup msg 5
Store the time msg 6 sent
Ignore msg 5 after sending msg 6
Ignore msg 7 before receiving msg 4
Validate ip/port in msg 7
Update rcv times for dups
Log tweaks
- Return OK as Alice when only receiving msg 5, unless snatted (SSU 1 also)
- Allow and handle firewalled Charlie as Alice
- Only create peer test data once as Alice
- Store test status and send-to-Alice time in test state to support retransmission
- Don't delete state after sending msg 4 as Bob, for possible retransmission
- Check for IP mismatch from Charlie as Alice, abort test and assume good
- Check for port mismatch from Charlie as Alice and validate
- Skip unroutable addresses when searching through RI for the right one
- Respond to retransmitted msg 1 as Bob
- Respond to retransmitted msg 2 as Charlie
- Update Charlie timer to retransmit msg 5
- Only send Charlie RI to Alice (as Bob) if test was accepted
- Convert timers to SimpleTimer2 (SSU 1 also)
- Log tweaks
Most changes are relevant only if NTP is disabled or failed at startup.
- Require two peers that agree for transports to initialize time
- Briefly ban skewed peer when not initialized, so another peer will be the second sample
- Allow SSU2 to initialize time even for large skews
- Do not allow NTCP2 inbound to initialize time for large skews
- Disable SSU1 time initialization when SSU2 is enabled
- When SSU2 is disabled, allow SSU1 time initialization even for large skews
- Don't adjust to large inbound NTCP2 skews when not initialized
- Round time sent in NTCP2 DateTime block
- Adjust SSU2 skew for RTT
- Don't sort by absolute skew on SSU /peers tab so we can find median
- Only call System.currentTimeMillis() once in RouterClock.setOffset()
- Log tweaks
as Bob, to send to Charlie, if it fits.
Otherwise, delay sending relay intro, so the RI DSM gets there first.
This makes relay faster and more reliable.
Periodically clean _nonceToAlice
Log tweaks
containing a specific termination reason,
and create a post-termination handler directly from IES2 for any additional packets.
Don't do this unless we get intro key and validate static key in RI.
Don't blocklist the IP for a banned router unless we have validated
the static key to prevent spoofing.
Don't queue data packet after failure
Don't send additional terminations after receiving termination ack
Also removes the rebuildIfNecessary() call claimed to be removed in previous checkin.
Since we aren't thrashing any more, reschedule test after UNKNOWN results,
with the delay depending on current state.
log tweaks
to prevent thrashing.
Only rebuild in dropPeer() if the peer was a published introducer.
Only rebuild in addPeer() if the peer offered to relay and we need introducers.
COWAL caused problems because replaceAddress() was removing the wrong address,
since RouterAddress.equals() does not compare caps, so empty '4' and '6' addresses would be equal.
So we could temporarily end up with multiple v4/v6 addresses.
COWAL wasn't really buying us anything anyway.
Fix removeAddress() that called the listener even if no change.