aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/sm_statefuns.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/sm_statefuns.c')
-rw-r--r--net/sctp/sm_statefuns.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index aa51d190bfb2..fce1f602cde2 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -440,7 +440,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
440{ 440{
441 struct sctp_chunk *chunk = arg; 441 struct sctp_chunk *chunk = arg;
442 sctp_init_chunk_t *initchunk; 442 sctp_init_chunk_t *initchunk;
443 __u32 init_tag;
444 struct sctp_chunk *err_chunk; 443 struct sctp_chunk *err_chunk;
445 struct sctp_packet *packet; 444 struct sctp_packet *packet;
446 sctp_error_t error; 445 sctp_error_t error;
@@ -462,24 +461,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
462 /* Grab the INIT header. */ 461 /* Grab the INIT header. */
463 chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data; 462 chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data;
464 463
465 init_tag = ntohl(chunk->subh.init_hdr->init_tag);
466
467 /* Verification Tag: 3.3.3
468 * If the value of the Initiate Tag in a received INIT ACK
469 * chunk is found to be 0, the receiver MUST treat it as an
470 * error and close the association by transmitting an ABORT.
471 */
472 if (!init_tag) {
473 struct sctp_chunk *reply = sctp_make_abort(asoc, chunk, 0);
474 if (!reply)
475 goto nomem;
476
477 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply));
478 return sctp_stop_t1_and_abort(commands, SCTP_ERROR_INV_PARAM,
479 ECONNREFUSED, asoc,
480 chunk->transport);
481 }
482
483 /* Verify the INIT chunk before processing it. */ 464 /* Verify the INIT chunk before processing it. */
484 err_chunk = NULL; 465 err_chunk = NULL;
485 if (!sctp_verify_init(asoc, chunk->chunk_hdr->type, 466 if (!sctp_verify_init(asoc, chunk->chunk_hdr->type,
@@ -1553,6 +1534,28 @@ sctp_disposition_t sctp_sf_do_5_2_2_dupinit(const struct sctp_endpoint *ep,
1553} 1534}
1554 1535
1555 1536
1537/*
1538 * Unexpected INIT-ACK handler.
1539 *
1540 * Section 5.2.3
1541 * If an INIT ACK received by an endpoint in any state other than the
1542 * COOKIE-WAIT state, the endpoint should discard the INIT ACK chunk.
1543 * An unexpected INIT ACK usually indicates the processing of an old or
1544 * duplicated INIT chunk.
1545*/
1546sctp_disposition_t sctp_sf_do_5_2_3_initack(const struct sctp_endpoint *ep,
1547 const struct sctp_association *asoc,
1548 const sctp_subtype_t type,
1549 void *arg, sctp_cmd_seq_t *commands)
1550{
1551 /* Per the above section, we'll discard the chunk if we have an
1552 * endpoint. If this is an OOTB INIT-ACK, treat it as such.
1553 */
1554 if (ep == sctp_sk((sctp_get_ctl_sock()))->ep)
1555 return sctp_sf_ootb(ep, asoc, type, arg, commands);
1556 else
1557 return sctp_sf_discard_chunk(ep, asoc, type, arg, commands);
1558}
1556 1559
1557/* Unexpected COOKIE-ECHO handler for peer restart (Table 2, action 'A') 1560/* Unexpected COOKIE-ECHO handler for peer restart (Table 2, action 'A')
1558 * 1561 *