Skip to content

Commit d5ccd49

Browse files
Max Matveevdavem330
authored andcommitted
sctp: deal with multiple COOKIE_ECHO chunks
Attempt to reduce the number of IP packets emitted in response to single SCTP packet (2e3216c) introduced a complication - if a packet contains two COOKIE_ECHO chunks and nothing else then SCTP state machine corks the socket while processing first COOKIE_ECHO and then loses the association and forgets to uncork the socket. To deal with the issue add new SCTP command which can be used to set association explictly. Use this new command when processing second COOKIE_ECHO chunk to restore the context for SCTP state machine. Signed-off-by: Max Matveev <makc@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fb82fd2 commit d5ccd49

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

include/net/sctp/command.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ typedef enum {
109109
SCTP_CMD_SEND_MSG, /* Send the whole use message */
110110
SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */
111111
SCTP_CMD_PURGE_ASCONF_QUEUE, /* Purge all asconf queues.*/
112+
SCTP_CMD_SET_ASOC, /* Restore association context */
112113
SCTP_CMD_LAST
113114
} sctp_verb_t;
114115

net/sctp/sm_sideeffect.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,6 +1689,11 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
16891689
case SCTP_CMD_PURGE_ASCONF_QUEUE:
16901690
sctp_asconf_queue_teardown(asoc);
16911691
break;
1692+
1693+
case SCTP_CMD_SET_ASOC:
1694+
asoc = cmd->obj.asoc;
1695+
break;
1696+
16921697
default:
16931698
pr_warn("Impossible command: %u, %p\n",
16941699
cmd->verb, cmd->obj.ptr);

net/sctp/sm_statefuns.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,12 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const struct sctp_endpoint *ep,
20472047
sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc));
20482048
sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());
20492049

2050+
/* Restore association pointer to provide SCTP command interpeter
2051+
* with a valid context in case it needs to manipulate
2052+
* the queues */
2053+
sctp_add_cmd_sf(commands, SCTP_CMD_SET_ASOC,
2054+
SCTP_ASOC((struct sctp_association *)asoc));
2055+
20502056
return retval;
20512057

20522058
nomem:

0 commit comments

Comments
 (0)