Commit Graph

6193 Commits

Author SHA1 Message Date
zzz
150a68a3e0 SSU: Peer Test scheduling fixes
At startup, and for IPv6 so it doesn't lose out to IPv4
PeerTestEvent logging cleanup
2022-12-22 08:20:32 -05:00
zzz
d73be206e5 SSU2: Remove ENABLE_xxx feature flags used in early development 2022-12-21 16:19:30 -05:00
zzz
4e174df746 Router: Add IPv6 analysis to Sybil checker
Add to console sybil page
Fix links for IPs close to us
Header and reason tweaks
Increase verified family credit
2022-12-21 07:00:38 -05:00
zzz
fd58472cc5 Sybil: Pass reason to the blocklist, for logging only 2022-12-20 14:54:35 -05:00
zzz
e9c74c7c45 bump -10 2022-12-20 08:54:55 -05:00
zzz
903477e905 Change calls from Addresses.getIP() to Addresses.getIPOnly() for peer IPs
getIPOnly() is more efficient for pure IP addresses (no hostnames)
2022-12-20 08:51:29 -05:00
zzz
fd2af4d89c log typo 2022-12-20 08:46:04 -05:00
zzz
ccb01ccf7f SSU2: Bundle RI with peer test messages 2 and 4 if possible
similar to previous checkin for relay intro
2022-12-20 08:44:55 -05:00
zzz
4d65024977 SSU2: Peer test improvements
- 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
2022-12-20 06:12:38 -05:00
zzz
6092e35b65 Router: Time initialization fixes and cleanups
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
2022-12-19 06:45:30 -05:00
zzz
51d567ecb4 SSU2: Compress and bundle Alice RI with relay intro
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
2022-12-18 07:06:52 -05:00
zzz
33f9bd8156 Transport: Fix NPE at shutdown caused by _currentAddresses change 2022-12-17 13:54:37 -05:00
zzz
73d226e7d7 bump -9 2022-12-17 11:59:34 -05:00
zzz
f26c616fdc SSU: Rewrite isTooClose()
to use actual local IP rather than iterating through getCurrentAddresses(),
more efficient and works even when firewalled
2022-12-17 11:56:12 -05:00
zzz
ef542d8898 SSU2: split() and send in-session termination after certain session confirmed errors
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
2022-12-17 10:04:18 -05:00
zzz
58e95dc353 SSU: Don't call test forceRunSoon() in addPeer() to prevent test thrashing.
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
2022-12-17 09:41:41 -05:00
zzz
cdc61ee6ea Add change required for previous commit 2022-12-17 09:36:32 -05:00
zzz
2d2c8fdc96 SSU: Don't call rebuildIfNecessary() from dropPeer() and addPeer() every time
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.
2022-12-17 09:33:47 -05:00
zzz
d9bb3d0b96 SSU2: log tweaks 2022-12-17 09:29:09 -05:00
zzz
05d60d70e2 SSU2: Immediately remove establish state from EstablishmentManager on fatal error
to free up space and prevent problems handling additional packets
2022-12-17 09:17:55 -05:00
zzz
67d20d4af5 Transport: Change _currentAddresses from COWAL to standard ArrayList and lock
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.
2022-12-17 08:43:25 -05:00
zzz
95bf6be670 SSU2: PacketHandler log tweaks 2022-12-16 08:40:36 -05:00
zzz
bbbc127193 bump -8 2022-12-15 15:08:58 -05:00
zzz
21c7ad4a89 SSU2: Enhance PeerTestState logging
avoid dup previous charlies on list
2022-12-15 15:05:10 -05:00
zzz
af5456b846 add javadocs for banlist return values 2022-12-15 15:03:06 -05:00
zzz
2c955e300f SSU: Check banlist after session confirmed
blocklist IP if banned
2022-12-15 15:01:52 -05:00
zzz
138d674662 SSU2: Reduce log level of 'new ack not found' 2022-12-15 14:59:46 -05:00
zzz
9b0ace19c1 Router: Change transient IPv4 blocklist to LHMCache
Reduce transient blocklist sizes if slow
Improve logging of block source
2022-12-15 14:57:20 -05:00
zzz
3eb4083cb3 SSU2: Fix retransmission of session confirmed
Was setting packet length to number of packets.
Add check and log in UDPSender
Add notes where length is checked
2022-12-15 14:50:38 -05:00
zzz
799944b23b SSU2: Don't attempt to connect to ourselves as an introducer
reported by drzed
2022-12-15 14:17:24 -05:00
zzz
8bda9bf804 SSU2: Update activity on path challenge/response 2022-12-14 17:23:31 -05:00
zzz
232586c709 bump -7 2022-12-14 16:11:16 -05:00
zzz
32a9f47375 Tunnels: Reduce log level of can't-decrypt build messages 2022-12-14 16:09:30 -05:00
zzz
9d50e4d5ed NTCP: Log source of clock adjustment at startup 2022-12-14 14:58:44 -05:00
zzz
e71ba76d98 SSU2: Catch "shift too big" IAE from acked bitfield while sending termination
Add preliminary code to terminate session before
there are too many unacked messages to cause the IAE
(untested)
log tweaks

reported by drzed
2022-12-14 14:42:12 -05:00
zzz
4aa6d15933 SSU2: Another consolidation of keys for building retry 2022-12-14 14:35:12 -05:00
zzz
980276b966 SSU2: Preliminary fixes for handling retransmitted retries
and storing session request packet for retransmission
Previously, we would regenerate handshake state on every retry,
and we would not re-save the new session request packet after a retry.
Check for wrong token received in additional retries.
2022-12-14 14:32:08 -05:00
zzz
cf32b7844b SSU2: Reject peer test or relay as Charlie if snatted
remove dup peer test 6 logging
2022-12-14 14:23:22 -05:00
zzz
a112c3a1ed SSU2: Consolidate dup encrypt header keys in IES2/OES2 2022-12-14 14:15:56 -05:00
zzz
9f9a88cf32 SSU2: Drop short session request messages in packet handler
both before and after retry, before passing to IES2
log tweaks
2022-12-14 14:06:18 -05:00
zzz
28a79def5a NTCP: Fix rare NPE sending termination
reported by drzed
2022-12-14 10:51:34 -05:00
zzz
4443fb464a Router: Add stack trace to log error
to catch the message-to-ourselves culprit
2022-12-13 16:27:48 -05:00
zzz
08c31aa6f6 Tunnels: Tighten the hop throttle more
after further testing, thx obscuratus + drzed
2022-12-13 12:39:02 -05:00
zzz
20f414c7fa SSU: Don't publish B cap when snatted
as suggested by orignal
2022-12-13 06:27:41 -05:00
zzz
580f954254 SSU2 Peer Test: Bob asks another Charlie on rejection 2022-12-12 12:22:22 -05:00
zzz
3472871e35 SSU: now() call reduction 2022-12-12 05:53:40 -05:00
zzz
803265660e SSU2: Destroy PS2 cipher states when done 2022-12-11 15:12:15 -05:00
zzz
4a4ca0cdf0 SSU2: Handle retransmitted token request
and resend retry.
Previously failed to decrypt it.
2022-12-11 15:11:12 -05:00
zzz
415e31e560 SSU2: Allow termination in retry
Handle skew reason in termination, possibly ban peer
Adjust clock at startup when terminated with skew reason
Don't send immediate termination to a too-close address
Javadoc fixes
Log tweaks
2022-12-11 11:35:31 -05:00
zzz
dc400c652a SSU2: Send termination on inbound session/token request
(rate limited) at conn limits or when alice is banned.
Process retry payload even if token is 0, to get termination reason
Wait longer for session request after retry, allowing for at least 2 retransmissions, to reduce IES2 failures
Ban peer if he bans us in retry
Remove unused writePayload()
Javadoc fixes
Log tweaks
2022-12-11 09:18:51 -05:00