Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5ccd496 authored by Max Matveev's avatar Max Matveev Committed by David S. Miller
Browse files

sctp: deal with multiple COOKIE_ECHO chunks



Attempt to reduce the number of IP packets emitted in response to single
SCTP packet (2e3216cd) 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: default avatarMax Matveev <makc@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fb82fd20
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -109,6 +109,7 @@ typedef enum {
	SCTP_CMD_SEND_MSG,	 /* Send the whole use message */
	SCTP_CMD_SEND_MSG,	 /* Send the whole use message */
	SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */
	SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */
	SCTP_CMD_PURGE_ASCONF_QUEUE, /* Purge all asconf queues.*/
	SCTP_CMD_PURGE_ASCONF_QUEUE, /* Purge all asconf queues.*/
	SCTP_CMD_SET_ASOC,	 /* Restore association context */
	SCTP_CMD_LAST
	SCTP_CMD_LAST
} sctp_verb_t;
} sctp_verb_t;


+5 −0
Original line number Original line Diff line number Diff line
@@ -1689,6 +1689,11 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
		case SCTP_CMD_PURGE_ASCONF_QUEUE:
		case SCTP_CMD_PURGE_ASCONF_QUEUE:
			sctp_asconf_queue_teardown(asoc);
			sctp_asconf_queue_teardown(asoc);
			break;
			break;

		case SCTP_CMD_SET_ASOC:
			asoc = cmd->obj.asoc;
			break;

		default:
		default:
			pr_warn("Impossible command: %u, %p\n",
			pr_warn("Impossible command: %u, %p\n",
				cmd->verb, cmd->obj.ptr);
				cmd->verb, cmd->obj.ptr);
+6 −0
Original line number Original line Diff line number Diff line
@@ -2047,6 +2047,12 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const struct sctp_endpoint *ep,
	sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc));
	sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc));
	sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());
	sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());


	/* Restore association pointer to provide SCTP command interpeter
	 * with a valid context in case it needs to manipulate
	 * the queues */
	sctp_add_cmd_sf(commands, SCTP_CMD_SET_ASOC,
			 SCTP_ASOC((struct sctp_association *)asoc));

	return retval;
	return retval;


nomem:
nomem: