Skip to content

Commit 609120c

Browse files
committed
Merge branch 'sctp-fixes'
Jere Leppänen says: ==================== sctp: Fix problems with peer restart when in SHUTDOWN-PENDING state and socket is closed These patches are related to the scenario described in commit bdf6fa5 ("sctp: handle association restarts when the socket is closed."). To recap, when our association is in SHUTDOWN-PENDING state and we've closed our one-to-one socket, while the peer crashes without being detected, restarts and reconnects using the same addresses and ports, we start association shutdown. In this case, Cumulative TSN Ack in the SHUTDOWN that we send has always been incorrect. Additionally, bundling of the SHUTDOWN with the COOKIE-ACK was broken by a later commit. This series fixes both of these issues. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 72579e1 + 12dfd78 commit 609120c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

net/sctp/sm_make_chunk.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,11 @@ struct sctp_chunk *sctp_make_shutdown(const struct sctp_association *asoc,
858858
struct sctp_chunk *retval;
859859
__u32 ctsn;
860860

861-
ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map);
861+
if (chunk && chunk->asoc)
862+
ctsn = sctp_tsnmap_get_ctsn(&chunk->asoc->peer.tsn_map);
863+
else
864+
ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map);
865+
862866
shut.cum_tsn_ack = htonl(ctsn);
863867

864868
retval = sctp_make_control(asoc, SCTP_CID_SHUTDOWN, 0,

net/sctp/sm_statefuns.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(
18651865
*/
18661866
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
18671867
return sctp_sf_do_9_2_start_shutdown(net, ep, asoc,
1868-
SCTP_ST_CHUNK(0), NULL,
1868+
SCTP_ST_CHUNK(0), repl,
18691869
commands);
18701870
} else {
18711871
sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
@@ -5470,7 +5470,7 @@ enum sctp_disposition sctp_sf_do_9_2_start_shutdown(
54705470
* in the Cumulative TSN Ack field the last sequential TSN it
54715471
* has received from the peer.
54725472
*/
5473-
reply = sctp_make_shutdown(asoc, NULL);
5473+
reply = sctp_make_shutdown(asoc, arg);
54745474
if (!reply)
54755475
goto nomem;
54765476

@@ -6068,7 +6068,7 @@ enum sctp_disposition sctp_sf_autoclose_timer_expire(
60686068
disposition = SCTP_DISPOSITION_CONSUME;
60696069
if (sctp_outq_is_empty(&asoc->outqueue)) {
60706070
disposition = sctp_sf_do_9_2_start_shutdown(net, ep, asoc, type,
6071-
arg, commands);
6071+
NULL, commands);
60726072
}
60736073

60746074
return disposition;

0 commit comments

Comments
 (0)