diff options
author | Sridhar Samudrala <sri@us.ibm.com> | 2006-07-21 17:48:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-07-21 17:48:50 -0400 |
commit | ad8fec1720e000ba2384de6408076a60fc92a981 (patch) | |
tree | 52fd2f7af583b95db6db369c6b3ea3d6adc26d69 /net/sctp/associola.c | |
parent | cfdeef3282705a4b872d3559c4e7d2561251363c (diff) |
[SCTP]: Verify all the paths to a peer via heartbeat before using them.
This patch implements Path Initialization procedure as described in
Sec 2.36 of RFC4460.
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r-- | net/sctp/associola.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 9d05e13e92f6..27329ce9c311 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -441,7 +441,8 @@ void sctp_assoc_set_primary(struct sctp_association *asoc, | |||
441 | /* If the primary path is changing, assume that the | 441 | /* If the primary path is changing, assume that the |
442 | * user wants to use this new path. | 442 | * user wants to use this new path. |
443 | */ | 443 | */ |
444 | if (transport->state != SCTP_INACTIVE) | 444 | if ((transport->state == SCTP_ACTIVE) || |
445 | (transport->state == SCTP_UNKNOWN)) | ||
445 | asoc->peer.active_path = transport; | 446 | asoc->peer.active_path = transport; |
446 | 447 | ||
447 | /* | 448 | /* |
@@ -532,11 +533,11 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, | |||
532 | port = addr->v4.sin_port; | 533 | port = addr->v4.sin_port; |
533 | 534 | ||
534 | SCTP_DEBUG_PRINTK_IPADDR("sctp_assoc_add_peer:association %p addr: ", | 535 | SCTP_DEBUG_PRINTK_IPADDR("sctp_assoc_add_peer:association %p addr: ", |
535 | " port: %d state:%s\n", | 536 | " port: %d state:%d\n", |
536 | asoc, | 537 | asoc, |
537 | addr, | 538 | addr, |
538 | addr->v4.sin_port, | 539 | addr->v4.sin_port, |
539 | peer_state == SCTP_UNKNOWN?"UNKNOWN":"ACTIVE"); | 540 | peer_state); |
540 | 541 | ||
541 | /* Set the port if it has not been set yet. */ | 542 | /* Set the port if it has not been set yet. */ |
542 | if (0 == asoc->peer.port) | 543 | if (0 == asoc->peer.port) |
@@ -545,9 +546,12 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, | |||
545 | /* Check to see if this is a duplicate. */ | 546 | /* Check to see if this is a duplicate. */ |
546 | peer = sctp_assoc_lookup_paddr(asoc, addr); | 547 | peer = sctp_assoc_lookup_paddr(asoc, addr); |
547 | if (peer) { | 548 | if (peer) { |
548 | if (peer_state == SCTP_ACTIVE && | 549 | if (peer->state == SCTP_UNKNOWN) { |
549 | peer->state == SCTP_UNKNOWN) | 550 | if (peer_state == SCTP_ACTIVE) |
550 | peer->state = SCTP_ACTIVE; | 551 | peer->state = SCTP_ACTIVE; |
552 | if (peer_state == SCTP_UNCONFIRMED) | ||
553 | peer->state = SCTP_UNCONFIRMED; | ||
554 | } | ||
551 | return peer; | 555 | return peer; |
552 | } | 556 | } |
553 | 557 | ||
@@ -739,7 +743,8 @@ void sctp_assoc_control_transport(struct sctp_association *asoc, | |||
739 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 743 | list_for_each(pos, &asoc->peer.transport_addr_list) { |
740 | t = list_entry(pos, struct sctp_transport, transports); | 744 | t = list_entry(pos, struct sctp_transport, transports); |
741 | 745 | ||
742 | if (t->state == SCTP_INACTIVE) | 746 | if ((t->state == SCTP_INACTIVE) || |
747 | (t->state == SCTP_UNCONFIRMED)) | ||
743 | continue; | 748 | continue; |
744 | if (!first || t->last_time_heard > first->last_time_heard) { | 749 | if (!first || t->last_time_heard > first->last_time_heard) { |
745 | second = first; | 750 | second = first; |
@@ -759,7 +764,8 @@ void sctp_assoc_control_transport(struct sctp_association *asoc, | |||
759 | * [If the primary is active but not most recent, bump the most | 764 | * [If the primary is active but not most recent, bump the most |
760 | * recently used transport.] | 765 | * recently used transport.] |
761 | */ | 766 | */ |
762 | if (asoc->peer.primary_path->state != SCTP_INACTIVE && | 767 | if (((asoc->peer.primary_path->state == SCTP_ACTIVE) || |
768 | (asoc->peer.primary_path->state == SCTP_UNKNOWN)) && | ||
763 | first != asoc->peer.primary_path) { | 769 | first != asoc->peer.primary_path) { |
764 | second = first; | 770 | second = first; |
765 | first = asoc->peer.primary_path; | 771 | first = asoc->peer.primary_path; |
@@ -1054,7 +1060,7 @@ void sctp_assoc_update(struct sctp_association *asoc, | |||
1054 | transports); | 1060 | transports); |
1055 | if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr)) | 1061 | if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr)) |
1056 | sctp_assoc_add_peer(asoc, &trans->ipaddr, | 1062 | sctp_assoc_add_peer(asoc, &trans->ipaddr, |
1057 | GFP_ATOMIC, SCTP_ACTIVE); | 1063 | GFP_ATOMIC, trans->state); |
1058 | } | 1064 | } |
1059 | 1065 | ||
1060 | asoc->ctsn_ack_point = asoc->next_tsn - 1; | 1066 | asoc->ctsn_ack_point = asoc->next_tsn - 1; |
@@ -1094,7 +1100,8 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc) | |||
1094 | 1100 | ||
1095 | /* Try to find an active transport. */ | 1101 | /* Try to find an active transport. */ |
1096 | 1102 | ||
1097 | if (t->state != SCTP_INACTIVE) { | 1103 | if ((t->state == SCTP_ACTIVE) || |
1104 | (t->state == SCTP_UNKNOWN)) { | ||
1098 | break; | 1105 | break; |
1099 | } else { | 1106 | } else { |
1100 | /* Keep track of the next transport in case | 1107 | /* Keep track of the next transport in case |