Skip to content

Commit

Permalink
sctp: Fix SHUTDOWN CTSN Ack in the peer restart case
Browse files Browse the repository at this point in the history
When starting shutdown in sctp_sf_do_dupcook_a(), get the value for
SHUTDOWN Cumulative TSN Ack from the new association, which is
reconstructed from the cookie, instead of the old association, which
the peer doesn't have anymore.

Otherwise the SHUTDOWN is either ignored or replied to with an ABORT
by the peer because CTSN Ack doesn't match the peer's Initial TSN.

Fixes: bdf6fa5 ("sctp: handle association restarts when the socket is closed.")
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jere Leppänen authored and David S. Miller committed Apr 23, 2020
1 parent 145cb2f commit 12dfd78
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/sctp/sm_make_chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,11 @@ struct sctp_chunk *sctp_make_shutdown(const struct sctp_association *asoc,
struct sctp_chunk *retval;
__u32 ctsn;

ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map);
if (chunk && chunk->asoc)
ctsn = sctp_tsnmap_get_ctsn(&chunk->asoc->peer.tsn_map);
else
ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map);

shut.cum_tsn_ack = htonl(ctsn);

retval = sctp_make_control(asoc, SCTP_CID_SHUTDOWN, 0,
Expand Down

0 comments on commit 12dfd78

Please sign in to comment.