diff --git a/i2p2www/spec/proposals/159-ssu2.rst b/i2p2www/spec/proposals/159-ssu2.rst index e89f5dfb..0731ca88 100644 --- a/i2p2www/spec/proposals/159-ssu2.rst +++ b/i2p2www/spec/proposals/159-ssu2.rst @@ -2317,6 +2317,7 @@ There are two header types, long and short. Long Header ````````````` The long header is 32 bytes. It is used before a session is created, for SessionRequest, SessionCreated, and Retry. +Note that the first 9 bytes (Destination Connection ID and type) are the same for both headers. Before header obfuscation and protection: @@ -2327,7 +2328,7 @@ Before header obfuscation and protection: +----+----+----+----+----+----+----+----+ | Destination Connection ID | +----+----+----+----+----+----+----+----+ - |type ver| id |flag| Packet Number | + |type| ver| id |flag| Packet Number | +----+----+----+----+----+----+----+----+ | Source Connection ID | +----+----+----+----+----+----+----+----+ @@ -3562,11 +3563,11 @@ Unencrypted data (Poly1305 authentication tag not shown): Destination Connection ID :: Randomly generated by Alice - id :: 1 byte, the network ID (currently 2, except for test networks) + type :: 9 ver :: 2 - type :: 0 + id :: 1 byte, the network ID (currently 2, except for test networks) flag :: 1 byte, unused, set to 0 for future compatibility @@ -3574,7 +3575,7 @@ Unencrypted data (Poly1305 authentication tag not shown): Source Connection ID :: Randomly generated by Alice - Retry Token :: 8 byte unsigned integer + Retry Token :: 8 byte unsigned integer, nonzero options :: options block, 16 bytes, see below @@ -4009,18 +4010,64 @@ RelayRequest {% highlight lang='dataspec' %} +----+----+----+----+----+----+----+----+ - | 7 | size | TBD | - +----+----+----+ + - | | - ~ . . . ~ + | 7 | size | relay tag | asz| + +----+----+----+----+----+----+----+----+ + | Alice IP address | APort | csz| | + +----+----+----+----+----+----+----+ + + | challenge to be delivered to Charlie | + + + | | +----+----+----+----+----+----+----+----+ + | Alice's intro key | + + + + | | + + + + | | + + + + | | + +----+----+----+----+----+----+----+----+ + | nonce | + +----+----+----+----+ blk :: 7 size :: 2 bytes, big endian, size of data to follow + relay tag :: 4 byte relay (introduction) tag, nonzero, as received by + Alice in the SessionCreated_ message from Bob + asz :: 1 byte IP address size + Alice IP :: Alice's IP address, network byte order, asz bytes + APort :: 2 byte port number of Alice, network byte order + csz :: 1 byte challenge size + challenge :: if csz is nonzero, that many bytes to be relayed to Charlie in the intro + intro : Alice's 32-byte introduction key (so Bob can reply with + Charlie's info) + nonce :: 4 byte nonce of Alice's relay request {% endhighlight %} +Notes +````` +* The IP address is only included if it is be different than the packet's + source address and port. + +* This message may be sent via IPv4 or IPv6. + If the message is over IPv6 for an IPv4 introduction, + or (as of release 0.9.50) over IPv4 for an IPv6 introduction, + Alice must include her introduction address and port. + This is supported as of release 0.9.50. + +* If Alice includes her address/port, Bob may perform additional validation + before continuing. + +* Challenge is unimplemented, challenge size is always zero + +* Relaying for IPv6 is supported as of release 0.9.50. + +* Prior to release 0.9.12, Bob's intro key was always used. As of release + 0.9.12, the session key is used if there is an established session between + Alice and Bob. In practice, there must be an established session, as Alice + will only get the nonce (introduction tag) from the session created message, + and Bob will mark the introduction tag invalid once the session is destroyed. + RelayResponse `````````````` @@ -4028,18 +4075,44 @@ RelayResponse {% highlight lang='dataspec' %} +----+----+----+----+----+----+----+----+ - | 8 | size | TBD | - +----+----+----+ + - | | - ~ . . . ~ - | | + | 8 | size | csz| Charlie IP | +----+----+----+----+----+----+----+----+ + | CPort | asz| Alice IP |Aprt + +----+----+----+----+----+----+----+----+ + Aprt| nonce | + +----+----+----+----+----+ blk :: 8 size :: 2 bytes, big endian, size of data to follow + csz :: 1 byte Charlie IP address size + Charlie IP :: Charlie's IP address, network byte order, csz bytes + CPort :: 2 byte Charlie's port number, network byte order + asz :: 1 byte Alice IP address size + Alice IP :: Alice's IP address, network byte order, asz bytes + Aprt :: 2 byte Alice's port number, network byte order + nonce :: 4 byte nonce sent by Alice {% endhighlight %} +Notes +````` +* This message may be sent via IPv4 or IPv6. + +* Alice's IP address/port are the apparent IP/port that Bob received the + RelayRequest on (not necessarily the IP Alice included in the RelayRequest), + and may be IPv4 or IPv6. Alice currently ignores these on receive. + +* Charlie's IP address may be IPv4, or, as of release 0.9.50, IPv6. + as that is the address that Alice will + send the SessionRequest to after the Hole Punch. + +* Relaying for IPv6 is supported as of release 0.9.50. + +* Prior to release 0.9.12, Alice's intro key was always used. As of release + 0.9.12, the session key is used if there is an established session between + Alice and Bob. + + RelayIntro `````````````` @@ -4047,9 +4120,13 @@ RelayIntro {% highlight lang='dataspec' %} +----+----+----+----+----+----+----+----+ - | 9 | size | TBD | + | 9 | size | asz| Alice IP | + +----+----+----+----+----+----+----+----+ + | APort | csz| | +----+----+----+ + - | | + | that many bytes of challenge | + + + + | data relayed from Alice | ~ . . . ~ | | +----+----+----+----+----+----+----+----+ @@ -4059,6 +4136,23 @@ RelayIntro {% endhighlight %} +Notes +````` +* For IPv4, Alice's IP address is always 4 bytes, because Alice is trying to connect to Charlie via IPv4. + As of release 0.9.xx, IPv6 is supported, and Alice's IP address may be 16 bytes. + +* This message must be sent via an established IPv4 connection, as that's the + only way that Bob knows Charlie's IPv4 address to return to Alice in the + RelayResponse_. + +* For IPv4, this message must be sent via an established IPv4 connection, + as that's the only way that Bob knows Charlie's IPv4 address to return to Alice in the RelayResponse_. + As of release 0.9.50, IPv6 is supported, and this message may be sent via an established IPv6 connection. + +* As of release 0.9.50, any SSU address published with introducers must contain "4" or "6" in the "caps" option. + +* Challenge is unimplemented, challenge size is always zero + PeerTest ``````````````