[SCTP]: Implement SCTP_ADDR_CONFIRMED state for ADDR_CHNAGE event
authorVlad Yasevich <vladislav.yasevich@hp.com>
Fri, 23 Mar 2007 18:32:26 +0000 (11:32 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:28:01 +0000 (22:28 -0700)
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sctp/user.h
net/sctp/associola.c

index 9a8352710631351cae83e69092fecb12c11825bb..4ed752119bbc1485b480c8006cfd6eeac5229e50 100644 (file)
@@ -265,6 +265,7 @@ enum sctp_spc_state {
        SCTP_ADDR_REMOVED,
        SCTP_ADDR_ADDED,
        SCTP_ADDR_MADE_PRIM,
+       SCTP_ADDR_CONFIRMED,
 };
 
 
index 78d2ddb5ca183fcb43c3f8b8651ebf4cc08df420..85af1cb70fe806c6b4ac9a8af714cf5954923ebd 100644 (file)
@@ -714,8 +714,16 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
        /* Record the transition on the transport.  */
        switch (command) {
        case SCTP_TRANSPORT_UP:
+               /* If we are moving from UNCONFIRMED state due
+                * to heartbeat success, report the SCTP_ADDR_CONFIRMED
+                * state to the user, otherwise report SCTP_ADDR_AVAILABLE.
+                */
+               if (SCTP_UNCONFIRMED == transport->state &&
+                   SCTP_HEARTBEAT_SUCCESS == error)
+                       spc_state = SCTP_ADDR_CONFIRMED;
+               else
+                       spc_state = SCTP_ADDR_AVAILABLE;
                transport->state = SCTP_ACTIVE;
-               spc_state = SCTP_ADDR_AVAILABLE;
                break;
 
        case SCTP_TRANSPORT_DOWN: