Skip to content

Commit

Permalink
sctp: retran_path update bug fix
Browse files Browse the repository at this point in the history
If the current retran_path is the only active one, it should
update it to the the next inactive one.

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gui Jianfeng authored and David S. Miller committed Jun 4, 2008
1 parent aed5a83 commit 4141ddc
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions net/sctp/associola.c
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,9 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
struct list_head *head = &asoc->peer.transport_addr_list;
struct list_head *pos;

if (asoc->peer.transport_count == 1)
return;

/* Find the next transport in a round-robin fashion. */
t = asoc->peer.retran_path;
pos = &t->transports;
Expand All @@ -1217,6 +1220,15 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)

t = list_entry(pos, struct sctp_transport, transports);

/* We have exhausted the list, but didn't find any
* other active transports. If so, use the next
* transport.
*/
if (t == asoc->peer.retran_path) {
t = next;
break;
}

/* Try to find an active transport. */

if ((t->state == SCTP_ACTIVE) ||
Expand All @@ -1229,15 +1241,6 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
if (!next)
next = t;
}

/* We have exhausted the list, but didn't find any
* other active transports. If so, use the next
* transport.
*/
if (t == asoc->peer.retran_path) {
t = next;
break;
}
}

asoc->peer.retran_path = t;
Expand Down

0 comments on commit 4141ddc

Please sign in to comment.