Subject: Re: Matching addresses in INIT and INIT ACK

From: <[email-masked]>
Date: Tue, 4 Mar 2003 17:47:26 +0200

Hi!

	So this is the example of INIT collision. It is the typical one, when both peers start about at the same time. This is the notation used:

	- For all the chunks:
		o In capital letters the NAME OF CHUNK.
		o VT is the Verification Tag included in the SCTP header.
		o Source Address:Port->Destination Address:Port.

	- For INIT and INIT ACK:
		o IT is the Initiation Tag included in the header of the chunk.

	- For INIT ACK and COOKIE ECHO:
		o VTloc and VTpeer are the values of the local Verification Tag (the one the INIT ACK sender expects in the SCTP headers of the peer) and the peer's Verification Tag (the one the INIT ACK senders includes in its SCTP headers) as included in the State Cookie. Note that those values are directly copied from the INIT ACK and included in the COOKIE ECHO.
		o TTloc and TTpeer are the values of the local Tie Tag (the value of VTloc at the moment of sending the INIT ACK) and the peer's Tie Tag (the value of VTpeer at the moment of sending the INIT ACK) as included in the State Cookie. Note that those values are directly copied from the INIT ACK and included in the COOKIE ECHO.

	The TCBs are only shown when there is a change. They show:
	- Source address/es:Source Port.
	- Destination address/es: Destination Port.
	- Local Verification Tag.
	- Peers Verification Tag.
	- State.

	Let's see the scenario.

Host A                                                              Host B/C
                                                                    
TCB     \   INIT VT:0 IT:W                      INIT VT:0 IT:X   /  TCB
A:1000   \  A:1000->B:1000                      ?:1000->A:1000  /   B,C:1000
B:1000    \                                                    /    A:1000
VTloc:W    \                                                  /     VTloc:X
VTpeer:0    \                                                /      VTpeer:0
C-WAIT       \                                              /       C-WAIT
              \--------------------\  /--------------------/
                                    \/
                                    /\
                                   /  \
   (1)  <-------------------------/    \------------------------->

        \   INIT ACK VT:X IT:Y              INIT ACK VT:W IT:X   /
         \  A:1000->C:1000                      B:1000->A:1000  /
          \ VTloc:Y VTpeer:X                  VTloc:X VTpeer:W /
           \TTloc:0 TTpeer:0                  TTloc:X TTpeer:0/
            \                                                /
             \                                              /
              \--------------------\  /--------------------/
                                    \/
                                    /\
                                   /  \
        <-------------------------/    \------------------------->

TCB     \   COOKIE ECHO VT:X                  COOKIE ECHO VT:Y   /  TCB
A:1000   \  A:1000->B:1000                      C:1000->A:1000  /   B,C:1000
B,C:1000  \ VTloc:X VTpeer:W                  VTloc:Y VTpeer:W /    A:1000
VTloc:W    \TTloc:X TTpeer:0                  TTloc:0 TTpeer:0/     VTloc:X
VTpeer:X    \                                                /      VTpeer:Y
C-ECHOED     \                                              /       C-ECHOED
              \--------------------\  /--------------------/
                                    \/
                                    /\
                                   /  \
   (2) X<-------------------------/    \------------------------->  (3)

                                               COOKIE ACK VT:W   /  TCB
                                                                /   B,C:1000
                                                               /    A:1000
                                                              /     VTloc:X
                                                             /      VTpeer:W
                                                            /       ESTABLISH
                                      /--------------------/
                                     /                     
                                    / 
                                   /   
   (4) X<-------------------------/                               

	Some remarks:

	(1) At this point, Host A doesn't recognize the INIT as coming from the same association it is trying to establish. The VT is completely different. Thus, it goes in the normal (and wrong) establishment procedure, creates a new IT and set the Tie Tags to 0.

	(2) The received COOKIE ECHO is discarded, since the VT is wrong (Host A is expecting VT set to W).

	(3) Host B,C recognizes the collision due to the Tie Tags, recognize it as situation B of section 5.2.4 and updates the VTpeer to W.

	(4) The COOKIE ACK is discarded, since Host A is in the C-ECHOED state.

	And now?

	Host A will retransmit the COOKIE ECHO, Host B,C will answer again, and the COOKIE ACK is discarded again.

	Conclusion: Host A cannot establish an association with Host B,C in this situation.

	Brian, did I make any mistake? I hope I didn't... :-/

	BR Iván Arias Rodríguez

---

From: "Brian F. G. Bidulock" <[email-masked]>
Date: Tue, 4 Mar 2003 13:19:03 -0700

Ivan.Arias-Rodriguez,

On Tue, 04 Mar 2003, [email-masked] wrote:

> 	Hi!
> 
> 	So this is the example of INIT collision. It is the typical one, when
> 	both peers start about at the same time. This is the notation used:
> 
> 	- For all the chunks:
> 		o VTloc and VTpeer are the values of the local Verification
> 		Tag (the one the INIT ACK sender expects in the SCTP headers
> 		of the peer) and the peer's Verification Tag (the one the INIT
> 		ACK senders includes in its SCTP headers) as included in the
> 		State Cookie. Note that those values are directly copied from
> 		the INIT ACK and included in the COOKIE ECHO.

> 		o TTloc and TTpeer are the values of the local Tie Tag (the
> 		value of VTloc at the moment of sending the INIT ACK) and the
> 		peer's Tie Tag (the value of VTpeer at the moment of sending
> 		the INIT ACK) as included in the State Cookie. Note that those
> 		values are directly copied from the INIT ACK and included in
> 		the COOKIE ECHO.
> 
> 	(1) At this point, Host A doesn't recognize the INIT as coming from
> 	the same association it is trying to establish. The VT is completely
> 	different. Thus, it goes in the normal (and wrong) establishment
> 	procedure, creates a new IT and set the Tie Tags to 0.
> 
> 	(3) Host B,C recognizes the collision due to the Tie Tags, recognize
> 	it as situation B of section 5.2.4 and updates the VTpeer to W.
> 

In both our STREAMS and Sockets implementations you cannot bind to a
static port when another STREAM/Socket is bound to that port as a
listener.  That's just how STREAMS/Socket semantics work.
	
If Host A is our implementation, the INIT from Host B/C for A:1000
will be refused because there is no STREAM/Socket listening on that
port and only one association will form.

If Host B/C is our implemenataion, the INIT from Host A for B/C:1000
will be refused because there is no listening socket.

This is no different in TCP/Sockets.  TCP sockets do not allow you
to bind to a static port and address if there is a socket listening
on that port.  You cannot even make two TCP sockets implementations
do what you describe here.

Because our implementation follows standard XTI/XNS and Sockets
semantics at most one association will form and there will be none of
the problems you describe.

You seem to focus on collisions (which are not possible using Sockets)
and Caitlin focusses on two ULPs launching from the same static address
(which is heavily discouraged in Sockets with SO_REUSEADDR and is not
possible unless the flag is set on ALL sockets using the address and
NO listening sockets).

You both dig down into the little unused corner case of static port
assignment to justify a SHOULD on "how to search"?

--brian

-- 
Brian F. G. Bidulock    ¦ The reasonable man adapts himself to the ¦
[email-masked]    ¦ world; the unreasonable one persists in  ¦
http://www.openss7.org/ ¦ trying  to adapt the  world  to himself. ¦
                        ¦ Therefore  all  progress  depends on the ¦
                        ¦ unreasonable man. -- George Bernard Shaw ¦