Skip to content

Commit 2222a78

Browse files
lxinkuba-moo
authored andcommitted
sctp: update transport state when processing a dupcook packet
During the 4-way handshake, the transport's state is set to ACTIVE in sctp_process_init() when processing INIT_ACK chunk on client or COOKIE_ECHO chunk on server. In the collision scenario below: 192.168.1.2 > 192.168.1.1: sctp (1) [INIT] [init tag: 3922216408] 192.168.1.1 > 192.168.1.2: sctp (1) [INIT] [init tag: 144230885] 192.168.1.2 > 192.168.1.1: sctp (1) [INIT ACK] [init tag: 3922216408] 192.168.1.1 > 192.168.1.2: sctp (1) [COOKIE ECHO] 192.168.1.2 > 192.168.1.1: sctp (1) [COOKIE ACK] 192.168.1.1 > 192.168.1.2: sctp (1) [INIT ACK] [init tag: 3914796021] when processing COOKIE_ECHO on 192.168.1.2, as it's in COOKIE_WAIT state, sctp_sf_do_dupcook_b() is called by sctp_sf_do_5_2_4_dupcook() where it creates a new association and sets its transport to ACTIVE then updates to the old association in sctp_assoc_update(). However, in sctp_assoc_update(), it will skip the transport update if it finds a transport with the same ipaddr already existing in the old asoc, and this causes the old asoc's transport state not to move to ACTIVE after the handshake. This means if DATA retransmission happens at this moment, it won't be able to enter PF state because of the check 'transport->state == SCTP_ACTIVE' in sctp_do_8_2_transport_strike(). This patch fixes it by updating the transport in sctp_assoc_update() with sctp_assoc_add_peer() where it updates the transport state if there is already a transport with the same ipaddr exists in the old asoc. Signed-off-by: Xin Long <[email protected]> Reviewed-by: Simon Horman <[email protected]> Fixes: 1da177e ("Linux-2.6.12-rc2") Link: https://lore.kernel.org/r/fd17356abe49713ded425250cc1ae51e9f5846c6.1696172325.git.lucien.xin@gmail.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4720852 commit 2222a78

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

net/sctp/associola.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,8 +1159,7 @@ int sctp_assoc_update(struct sctp_association *asoc,
11591159
/* Add any peer addresses from the new association. */
11601160
list_for_each_entry(trans, &new->peer.transport_addr_list,
11611161
transports)
1162-
if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr) &&
1163-
!sctp_assoc_add_peer(asoc, &trans->ipaddr,
1162+
if (!sctp_assoc_add_peer(asoc, &trans->ipaddr,
11641163
GFP_ATOMIC, trans->state))
11651164
return -ENOMEM;
11661165

0 commit comments

Comments
 (0)