Commit Graph

5735 Commits

Author SHA1 Message Date
zzz
0449589406 SSU2: Fix hashcode function to detect dup acks
Arrays.hashCode() interacted badly with it,
causing numerous false positives
2022-04-05 14:13:23 -04:00
zzz
cc85df19aa SSU2: Fragmented Session Confirmed
Revert related parts of "Prep for fragmented RI",
we are now fragmenting Session Confirmed instead.
Fragment and send multiple Session Confirmed packets if required
Reassemble Session Confirmed packets

Don't process ack block identical to previous received
Log tweaks
bump -12
2022-04-05 09:26:42 -04:00
zzz
75492514ca SSU: Fix packet-too-large check in UDPSender 2022-04-05 07:55:28 -04:00
zzz
e43810f182 SSU2: Don't send our RI after outbound handshake, it's in the handshake already 2022-04-05 07:49:43 -04:00
zzz
9d49dc7af7 SSU2: Fix NPE in PeerState.loadFrom() 2022-04-05 07:47:56 -04:00
zzz
680320dede SSU2: Add termination reason codes 2022-04-05 07:45:02 -04:00
zzz
7cf9895908 Transport: Add util methods for AddressType
WIP, not hooked in
2022-03-28 06:38:18 -04:00
zzz
b1852c127b SSU2: Prep for fragmented RI (WIP)
Fix IES2 not being removed from pending after complete
Don't send DSM after handshake
Validate conn ID before pkt type for data pkts
More log tweaks

SSU: Increase min pending establish states limit (unless slow)
Reduce IB establish timeout to 15s
Log pending inbound establish states when limit exceeded
Log tweaks to add establish state lifetime
Bump -11
2022-03-27 12:36:12 -04:00
zzz
8c59c514b2 Router: Validate family sig at startup
when loaded from router.info, and discard if invalid or when family changed.
This fixes some routers out there with bad sigs.
Don't loop forever through LoadRouterInfoJob.
2022-03-27 08:21:22 -04:00
zzz
826bf3c24f SSU2: Hook in IMF Bloom filter to detect dups
Call messagePartiallyReceived() even for dups or expired messages
so an ack is generated.
2022-03-26 11:39:10 -04:00
zzz
68273cd256 SSU2: Reduce ack delay, see MR !57
See previous checkin for SSU 1.
This change dramatically reduces the measured RTT to get it much closer to the real RTT by reducing the ack delay.
With the ack delay dependent on the measured RTT, the measured RTT will increase.

Simulation results: For a denominator D in the ack delay calculation (currently 2) and a true RTT = TRTT:
For D <= about 2, measured RTT -> TRTT + 2 * TRTT/D For D >= about 4, measured RTT -> TRTT + TRTT/D

In other words, for D == 2, measured RTT -> 2 * TRTT. For a TRTT of 50, the measured RTT is 100.
D == 2 is too small. It's been like that since 2005.
Testnet results: measured RTT 80-90

This changes D to 6. measured RTT -> 6/5 * TRTT.
Simulation results: For a TRTT of 50, the measured RTT is 58.
Testnet results: measured RTT 60
2022-03-26 07:04:49 -04:00
zzz
e130f85a65 Merge branch 'ssuackdelay' into 'master'
SSU: Reduce ack delay to minimize addition to measured RTT

See merge request i2p-hackers/i2p.i2p!57
2022-03-26 10:53:49 +00:00
zzz
da190cc24f SSU2 cleanups
Remove padding and unknown block callbacks
Remove handshake state logging in IES2 now that i2pd works
2022-03-25 08:27:53 -04:00
zzz
2a6dc58659 SSU: Reduce ack delay to minimize addition to measured RTT 2022-03-25 05:59:33 -04:00
zzz
f4eda0551d Router: Change quick address check for introducers
from ihost0 to itag0, because SSU2 probably won't use ihost
2022-03-24 17:31:48 -04:00
zzz
0560b3221d SSU2: Flush tokens on ip/port change
both inbound and outbound
2022-03-24 05:21:58 -04:00
zzz
631a6dd2b2 I2CP: Synch fixes
Synch fields in the data messages both directions,
after one report of zero session ID in MessagePayloadMessage
to an external client on fast hardware with Java 18.
Add new constructors for efficiency.
Deprecated setters, unit tests not changed, TODO.
Should fix all the other messages also, TODO.
2022-03-23 07:25:01 -04:00
zzz
0154a87cbf SSU2: Refactor tokens
Store OB tokens by IP/port
Centralize token generation and expiration in Establishment Manager
Add methods to flush OB tokens on IP/port change
Log tweaks
Javadoc fix
2022-03-23 06:46:01 -04:00
zzz
4f8ad3b6cb Router family fixes
Don't overwrite an existing family keystore file
Don't allow starting a new family with an existing family keystore file
Don't add family to RI until we have restarted and have a keystore file
Don't fail a netdb store for no family sig
Don't ever fail our own netdb store for family errors, to avoid rekey/restart
2022-03-22 08:03:18 -04:00
zzz
458e980e2f bump -10, javadoc typo 2022-03-20 07:59:32 -04:00
zzz
e08d2f354a File missed in previous netdb checkin 2022-03-20 07:57:43 -04:00
zzz
037e6940a9 SSU2: More work on peer test
generate msgs 1,5-7
handle msgs 5-7
log tweaks
2022-03-20 07:53:41 -04:00
zzz
b3055feff6 NetDB: Remove duplicate store in FloodOnlyLookupMatchJob
which bypassed all the checks in HandleFloodfillDatabaseStoreMessageJob
Don't store an entry which is older
2022-03-20 07:45:33 -04:00
zzz
c520dcb0f6 NetDB: Refactor family validation
Return a result code from verify()
Load all known certs at startup rather than continually reloading them
Only give full verified status to known keys
Enforce signatures in netdb store when key is available
Show family verification status on /netdb
Export our cert to disk if missing
Add stormycloud family cert
Bypass /24 Sybil penalty
2022-03-20 07:41:49 -04:00
zzz
c62884ef85 SSU2: Implement peer test state machine
msgs 5-7 still TODO
WIP, untested
2022-03-18 10:21:30 -04:00
zzz
d9c629a6b1 SSU2: Log tweaks 2022-03-17 16:45:16 -04:00
zzz
70b7d1204b SSU2: Still more prep for Peer Test (WIP) 2022-03-17 16:43:24 -04:00
zzz
a90bbc3554 SSU2: More prep for Peer Test (WIP) 2022-03-17 16:10:26 -04:00
zzz
c2ec6cdeff SSU2: Set _lastACKSend 2022-03-17 16:08:15 -04:00
zzz
f57abe84bd SSU: Peer Test refactor
to store Bob's PeerState directly in PeerTestState
prep for SSU2
2022-03-17 16:04:28 -04:00
zzz
a1ee8220bb SSU2: Relay and Peer Test WIP
Packet building, fix peer test block
Not hooked in
2022-03-17 10:48:10 -04:00
zzz
8961009292 SSU2: Minor cleanups
Add min packet size constants and notes
Don't attempt to decrypt a packet as a new inbound session if too small
Remove unused payload[] in IES2, now decrypted in-place
Log level tweaks in Establisher
2022-03-16 07:28:22 -04:00
zzz
e8afbc5b92 Transport: Don't use HE addresses for GeoIP
Limit max MTU for HE addresses
2022-03-15 14:30:04 -04:00
zzz
587409daa7 SSU2: Compress large RIs in Session Confirmed
even if they would fit in the MTU uncompressed,
to save bandwidth and room for other blocks
2022-03-15 07:23:53 -04:00
zzz
af5019c8dd SSU2: Fixes part 11
Save data messages received before or immediately after session confirmed
by queueing them for processing after the PeerState2 is created.
The fragments for the first I2NP message from Alice to Bob are frequently lost,
this will hopefully fix it.
Not fully tested, needs wider network testing.
2022-03-15 07:20:23 -04:00
zzz
46bba0fe71 SSU2: Fixes part 10
Avoid relaying until it's implemented:
Don't use SSU2 for an SSU address with introducers (fixes NPE)
Don't connect to SSU2 address without host/port
Don't ask for relay tag
Log tweaks
2022-03-15 07:12:25 -04:00
zzz
049456493f SSU2: Stubs for relay and peer test (phase 2) 2022-03-13 12:42:13 -04:00
zzz
2f63762c80 SSU2: Fixes part 9
Fix length calculation to see if new token block will fit in session confirmed
Extend timeout after sending retry
Fix retx timer for sess req after sending token req
Remove dup call to confirmedPacketsSent()
Cancel ack timer when sending acks
Include intro key in firewalled addresses too
Use SSU2 version of ping packet for SSU2 peers
Reduce max padding
Log tweaks
2022-03-13 07:33:36 -04:00
zzz
ca0d9f5a26 Tunnels: Reduce build reply timeout 2022-03-12 11:37:29 -05:00
zzz
aa620f5ed3 SSU2: Fixes part 8
Fix packet length for retransmitted handshake messages
Expire pending acks
2022-03-12 11:08:20 -05:00
zzz
15bb157126 NTCP: Encrypt handshake options in-place
round timestamp in Session Created
2022-03-12 09:48:33 -05:00
zzz
7e3e42ce42 i2psnark standalone: Add DTG and notifications 2022-03-11 07:23:46 -05:00
zzz
393ee71ad9 SSU2: Fixes part 7
Clean up and optimize ack handling
Log tweaks and javadocs
2022-03-10 10:27:19 -05:00
zzz
97736cef1c SSU2: Fixes part 6
MTU and related fixes:
Fix max fragment size
Fix max space for acks
Fix max packet size
Pull MTU from best address in Session Confirmed
Pass MTU from establish state to peer state
Use SSU2 min/default/max MTU in PeerState
Stop looping when out of space in OMF (SSU 1 too)
2022-03-09 13:53:16 -05:00
zzz
25af51faf9 SSU2: Fixes part 5
Correctly calculate skew after retry in establish state
Pass calculated skew from establish state to peer state
Round time in DateTime block
Periodically send DateTime block
Handle DateTime block in peer state
2022-03-09 07:04:31 -05:00
zzz
e594b9532c SSU2: Track dup packets received
Log tweaks
2022-03-09 04:37:36 -05:00
zzz
a7a5b06b5c I2NP: Fix TunnelGatewayMessage.calculateWrittenLength()
so it doesn't null out the contained message.
Required for SSU2.
Unrelated TunnelDispatcher cleanup done while trying to find the problem.
2022-03-08 05:39:47 -05:00
zzz
eb72e97c03 SSU2: Fixes part 4
Fix deadlock in AckTimer
Enforce token in IES2
Increase bitfield sizes in PS2
Log tweaks
2022-03-07 10:44:17 -05:00
zzz
25cdc988e1 SSU2: Fixes part 3
Handle acks
Set ack timer
Retransmit session confirmed
Fix bitfield constructor when no ranges
2022-03-07 09:55:10 -05:00
zzz
3ce669575f SSU2: Fixes part 2
Add method to put additional blocks in data messages
Send and handle termination blocks
2022-03-06 07:31:16 -05:00