Lines Matching full:chunk

54 					struct sctp_chunk *chunk,
57 struct sctp_chunk *chunk,
62 const struct sctp_chunk *chunk);
66 const struct sctp_chunk *chunk,
97 static struct sctp_sackhdr *sctp_sm_pull_sack(struct sctp_chunk *chunk);
149 struct sctp_chunk *chunk);
165 /* Small helper function that checks if the chunk length
167 * is set to be the size of a specific chunk we are testing.
172 static inline bool sctp_chunk_length_valid(struct sctp_chunk *chunk, in sctp_chunk_length_valid() argument
175 __u16 chunk_length = ntohs(chunk->chunk_hdr->length); in sctp_chunk_length_valid()
178 if (unlikely(chunk->pdiscard)) in sctp_chunk_length_valid()
186 /* Check for format error in an ABORT chunk */
187 static inline bool sctp_err_chunk_valid(struct sctp_chunk *chunk) in sctp_err_chunk_valid() argument
191 sctp_walk_errors(err, chunk->chunk_hdr); in sctp_err_chunk_valid()
193 return (void *)err == (void *)chunk->chunk_end; in sctp_err_chunk_valid()
197 * These are the state functions for handling chunk events.
204 * Upon reception of the SHUTDOWN COMPLETE chunk the endpoint will verify
205 * that it is in SHUTDOWN-ACK-SENT state, if it is not the chunk should be
217 * it is set to its peer's tag and the T bit is set in the Chunk
224 * (endpoint, asoc, chunk)
229 * The return value is the disposition of the chunk.
237 struct sctp_chunk *chunk = arg; in sctp_sf_do_4_C() local
240 if (!sctp_vtag_verify_either(chunk, asoc)) in sctp_sf_do_4_C()
248 if (!chunk->singleton) in sctp_sf_do_4_C()
251 /* Make sure that the SHUTDOWN_COMPLETE chunk has a valid length. */ in sctp_sf_do_4_C()
252 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_do_4_C()
269 /* Upon reception of the SHUTDOWN COMPLETE chunk the endpoint in sctp_sf_do_4_C()
271 * not the chunk should be discarded. If the endpoint is in in sctp_sf_do_4_C()
295 * Respond to a normal INIT chunk.
299 * B) "Z" shall respond immediately with an INIT ACK chunk. The
309 * (endpoint, asoc, chunk)
314 * The return value is the disposition of the chunk.
323 struct sctp_chunk *chunk = arg, *repl, *err_chunk; in sctp_sf_do_5_1B_init() local
334 * Furthermore, we require that the receiver of an INIT chunk MUST in sctp_sf_do_5_1B_init()
336 * with an INIT chunk that is bundled with other chunks. in sctp_sf_do_5_1B_init()
338 if (!chunk->singleton) in sctp_sf_do_5_1B_init()
341 /* Make sure that the INIT chunk has a valid length. in sctp_sf_do_5_1B_init()
346 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_init_chunk))) in sctp_sf_do_5_1B_init()
357 /* 3.1 A packet containing an INIT chunk MUST have a zero Verification in sctp_sf_do_5_1B_init()
360 if (chunk->sctp_hdr->vtag != 0) in sctp_sf_do_5_1B_init()
372 /* Verify the INIT chunk before processing it. */ in sctp_sf_do_5_1B_init()
374 if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, in sctp_sf_do_5_1B_init()
375 (struct sctp_init_chunk *)chunk->chunk_hdr, chunk, in sctp_sf_do_5_1B_init()
377 /* This chunk contains fatal error. It is to be discarded. in sctp_sf_do_5_1B_init()
404 chunk->subh.init_hdr = (struct sctp_inithdr *)chunk->skb->data; in sctp_sf_do_5_1B_init()
407 chunk->param_hdr.v = skb_pull(chunk->skb, sizeof(struct sctp_inithdr)); in sctp_sf_do_5_1B_init()
409 new_asoc = sctp_make_temp_asoc(ep, chunk, GFP_ATOMIC); in sctp_sf_do_5_1B_init()
414 if (security_sctp_assoc_request(new_asoc, chunk->skb)) { in sctp_sf_do_5_1B_init()
420 sctp_scope(sctp_source(chunk)), in sctp_sf_do_5_1B_init()
425 if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), in sctp_sf_do_5_1B_init()
426 (struct sctp_init_chunk *)chunk->chunk_hdr, in sctp_sf_do_5_1B_init()
430 /* B) "Z" shall respond immediately with an INIT ACK chunk. */ in sctp_sf_do_5_1B_init()
440 repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); in sctp_sf_do_5_1B_init()
450 * ERROR chunk generated by sctp_verify_init(). Since the in sctp_sf_do_5_1B_init()
489 * Respond to a normal INIT ACK chunk.
495 * Cookie received in the INIT ACK chunk in a COOKIE ECHO chunk, start
498 * Note: The COOKIE ECHO chunk can be bundled with any pending outbound
499 * DATA chunks, but it MUST be the first chunk in the packet and
504 * If the value of the Initiate Tag in a received INIT ACK chunk is
509 * (endpoint, asoc, chunk)
514 * The return value is the disposition of the chunk.
524 struct sctp_chunk *chunk = arg; in sctp_sf_do_5_1C_ack() local
528 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_5_1C_ack()
535 if (!chunk->singleton) in sctp_sf_do_5_1C_ack()
538 /* Make sure that the INIT-ACK chunk has a valid length */ in sctp_sf_do_5_1C_ack()
539 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_initack_chunk))) in sctp_sf_do_5_1C_ack()
543 chunk->subh.init_hdr = (struct sctp_inithdr *)chunk->skb->data; in sctp_sf_do_5_1C_ack()
545 /* Verify the INIT chunk before processing it. */ in sctp_sf_do_5_1C_ack()
547 if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, in sctp_sf_do_5_1C_ack()
548 (struct sctp_init_chunk *)chunk->chunk_hdr, chunk, in sctp_sf_do_5_1C_ack()
553 /* This chunk contains fatal error. It is to be discarded. in sctp_sf_do_5_1C_ack()
591 asoc, chunk->transport); in sctp_sf_do_5_1C_ack()
595 * convert the parameters in an INIT chunk. in sctp_sf_do_5_1C_ack()
597 chunk->param_hdr.v = skb_pull(chunk->skb, sizeof(struct sctp_inithdr)); in sctp_sf_do_5_1C_ack()
599 initchunk = (struct sctp_init_chunk *)chunk->chunk_hdr; in sctp_sf_do_5_1C_ack()
624 * INIT ACK chunk in a COOKIE ECHO chunk, ... in sctp_sf_do_5_1C_ack()
626 /* If there is any errors to report, send the ERROR chunk generated in sctp_sf_do_5_1C_ack()
635 static bool sctp_auth_chunk_verify(struct net *net, struct sctp_chunk *chunk, in sctp_auth_chunk_verify() argument
640 if (!chunk->auth_chunk) in sctp_auth_chunk_verify()
654 /* set-up our fake chunk so that we can process it */ in sctp_auth_chunk_verify()
655 auth.skb = chunk->auth_chunk; in sctp_auth_chunk_verify()
656 auth.asoc = chunk->asoc; in sctp_auth_chunk_verify()
657 auth.sctp_hdr = chunk->sctp_hdr; in sctp_auth_chunk_verify()
659 skb_push(chunk->auth_chunk, in sctp_auth_chunk_verify()
661 skb_pull(chunk->auth_chunk, sizeof(struct sctp_chunkhdr)); in sctp_auth_chunk_verify()
662 auth.transport = chunk->transport; in sctp_auth_chunk_verify()
668 * Respond to a normal COOKIE ECHO chunk.
672 * D) Upon reception of the COOKIE ECHO chunk, Endpoint "Z" will reply
673 * with a COOKIE ACK chunk after building a TCB and moving to
674 * the ESTABLISHED state. A COOKIE ACK chunk may be bundled with
676 * chunk MUST be the first chunk in the packet.
680 * of a valid COOKIE ECHO chunk.
691 * (endpoint, asoc, chunk)
696 * The return value is the disposition of the chunk.
708 struct sctp_chunk *chunk = arg; in sctp_sf_do_5_1D_ce() local
714 if (asoc && !sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_5_1D_ce()
725 /* Make sure that the COOKIE_ECHO chunk has a valid length. in sctp_sf_do_5_1D_ce()
727 * chunk header. More detailed verification is done in sctp_sf_do_5_1D_ce()
730 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_do_5_1D_ce()
743 /* "Decode" the chunk. We have no optional parameters so we in sctp_sf_do_5_1D_ce()
746 chunk->subh.cookie_hdr = in sctp_sf_do_5_1D_ce()
747 (struct sctp_signed_cookie *)chunk->skb->data; in sctp_sf_do_5_1D_ce()
748 if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - in sctp_sf_do_5_1D_ce()
752 /* 5.1 D) Upon reception of the COOKIE ECHO chunk, Endpoint in sctp_sf_do_5_1D_ce()
753 * "Z" will reply with a COOKIE ACK chunk after building a TCB in sctp_sf_do_5_1D_ce()
756 new_asoc = sctp_unpack_cookie(ep, asoc, chunk, GFP_ATOMIC, &error, in sctp_sf_do_5_1D_ce()
774 sctp_send_stale_cookie_err(net, ep, asoc, chunk, commands, in sctp_sf_do_5_1D_ce()
784 if (security_sctp_assoc_request(new_asoc, chunk->head_skb ?: chunk->skb)) { in sctp_sf_do_5_1D_ce()
797 peer_init = (struct sctp_init_chunk *)(chunk->subh.cookie_hdr + 1); in sctp_sf_do_5_1D_ce()
798 if (!sctp_process_init(new_asoc, chunk, in sctp_sf_do_5_1D_ce()
799 &chunk->subh.cookie_hdr->c.peer_addr, in sctp_sf_do_5_1D_ce()
811 if (!sctp_auth_chunk_verify(net, chunk, new_asoc)) { in sctp_sf_do_5_1D_ce()
816 repl = sctp_make_cookie_ack(new_asoc, chunk); in sctp_sf_do_5_1D_ce()
824 * upon reception of a valid COOKIE ECHO chunk. in sctp_sf_do_5_1D_ce()
899 * Respond to a normal COOKIE ACK chunk.
912 * (endpoint, asoc, chunk)
917 * The return value is the disposition of the chunk.
926 struct sctp_chunk *chunk = arg; in sctp_sf_do_5_1E_ca() local
929 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_5_1E_ca()
934 chunk->head_skb ?: chunk->skb)) in sctp_sf_do_5_1E_ca()
937 /* Verify that the chunk length for the COOKIE-ACK is OK. in sctp_sf_do_5_1E_ca()
940 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_do_5_1E_ca()
1028 * is started with this heartbeat chunk. in sctp_sf_heartbeat()
1061 * chunk is sent and the destination transport address to which this in sctp_sf_sendbeat_8_3()
1114 /* send hb chunk with padding for PLPMUTD. */
1145 * from the received HEARTBEAT chunk.
1156 * (endpoint, asoc, chunk)
1161 * The return value is the disposition of the chunk.
1170 struct sctp_chunk *chunk = arg; in sctp_sf_beat_8_3() local
1174 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_beat_8_3()
1177 /* Make sure that the HEARTBEAT chunk has a valid length. */ in sctp_sf_beat_8_3()
1178 if (!sctp_chunk_length_valid(chunk, in sctp_sf_beat_8_3()
1185 * Information field copied from the received HEARTBEAT chunk. in sctp_sf_beat_8_3()
1187 chunk->subh.hb_hdr = (struct sctp_heartbeathdr *)chunk->skb->data; in sctp_sf_beat_8_3()
1188 param_hdr = (struct sctp_paramhdr *)chunk->subh.hb_hdr; in sctp_sf_beat_8_3()
1189 paylen = ntohs(chunk->chunk_hdr->length) - sizeof(struct sctp_chunkhdr); in sctp_sf_beat_8_3()
1195 if (!pskb_pull(chunk->skb, paylen)) in sctp_sf_beat_8_3()
1198 reply = sctp_make_heartbeat_ack(asoc, chunk, param_hdr, paylen); in sctp_sf_beat_8_3()
1225 * value carried in the HEARTBEAT ACK chunk.
1230 * (endpoint, asoc, chunk)
1235 * The return value is the disposition of the chunk.
1245 struct sctp_chunk *chunk = arg; in sctp_sf_backbeat_8_3() local
1250 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_backbeat_8_3()
1253 /* Make sure that the HEARTBEAT-ACK chunk has a valid length. */ in sctp_sf_backbeat_8_3()
1254 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr) + in sctp_sf_backbeat_8_3()
1259 hbinfo = (struct sctp_sender_hb_info *)chunk->skb->data; in sctp_sf_backbeat_8_3()
1508 * chunk handling.
1518 struct sctp_chunk *chunk = arg, *repl, *err_chunk; in sctp_sf_do_unexpected_init() local
1530 * Furthermore, we require that the receiver of an INIT chunk MUST in sctp_sf_do_unexpected_init()
1532 * with an INIT chunk that is bundled with other chunks. in sctp_sf_do_unexpected_init()
1534 if (!chunk->singleton) in sctp_sf_do_unexpected_init()
1537 /* Make sure that the INIT chunk has a valid length. */ in sctp_sf_do_unexpected_init()
1538 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_init_chunk))) in sctp_sf_do_unexpected_init()
1541 /* 3.1 A packet containing an INIT chunk MUST have a zero Verification in sctp_sf_do_unexpected_init()
1544 if (chunk->sctp_hdr->vtag != 0) in sctp_sf_do_unexpected_init()
1547 if (SCTP_INPUT_CB(chunk->skb)->encap_port != chunk->transport->encap_port) in sctp_sf_do_unexpected_init()
1551 chunk->subh.init_hdr = (struct sctp_inithdr *)chunk->skb->data; in sctp_sf_do_unexpected_init()
1554 chunk->param_hdr.v = skb_pull(chunk->skb, sizeof(struct sctp_inithdr)); in sctp_sf_do_unexpected_init()
1556 /* Verify the INIT chunk before processing it. */ in sctp_sf_do_unexpected_init()
1558 if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, in sctp_sf_do_unexpected_init()
1559 (struct sctp_init_chunk *)chunk->chunk_hdr, chunk, in sctp_sf_do_unexpected_init()
1561 /* This chunk contains fatal error. It is to be discarded. in sctp_sf_do_unexpected_init()
1593 new_asoc = sctp_make_temp_asoc(ep, chunk, GFP_ATOMIC); in sctp_sf_do_unexpected_init()
1598 if (security_sctp_assoc_request(new_asoc, chunk->skb)) { in sctp_sf_do_unexpected_init()
1604 sctp_scope(sctp_source(chunk)), GFP_ATOMIC) < 0) in sctp_sf_do_unexpected_init()
1611 if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), in sctp_sf_do_unexpected_init()
1612 (struct sctp_init_chunk *)chunk->chunk_hdr, in sctp_sf_do_unexpected_init()
1622 if (!sctp_sf_check_restart_addrs(new_asoc, asoc, chunk, in sctp_sf_do_unexpected_init()
1631 /* B) "Z" shall respond immediately with an INIT ACK chunk. */ in sctp_sf_do_unexpected_init()
1642 repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); in sctp_sf_do_unexpected_init()
1652 * ERROR chunk generated by sctp_verify_init(). Since the in sctp_sf_do_unexpected_init()
1703 * sent in its original INIT chunk (including its Verification Tag,
1705 * newly received INIT chunk. The endpoint shall also generate a State
1722 * (endpoint, asoc, chunk)
1727 * The return value is the disposition of the chunk.
1738 * duplicate INIT chunk handling. in sctp_sf_do_5_2_1_siminit()
1777 * (endpoint, asoc, chunk)
1782 * The return value is the disposition of the chunk.
1793 * duplicate INIT chunk handling. in sctp_sf_do_5_2_2_dupinit()
1804 * COOKIE-WAIT state, the endpoint should discard the INIT ACK chunk.
1806 * duplicated INIT chunk.
1816 /* Per the above section, we'll discard the chunk if we have an in sctp_sf_do_5_2_3_initack()
1858 struct sctp_chunk *chunk, in sctp_sf_do_dupcook_a() argument
1871 peer_init = (struct sctp_init_chunk *)(chunk->subh.cookie_hdr + 1); in sctp_sf_do_dupcook_a()
1872 if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), peer_init, in sctp_sf_do_dupcook_a()
1879 if (!sctp_auth_chunk_verify(net, chunk, new_asoc)) in sctp_sf_do_dupcook_a()
1886 if (!sctp_sf_check_restart_addrs(new_asoc, asoc, chunk, commands)) in sctp_sf_do_dupcook_a()
1892 * chunk with a "Cookie Received while Shutting Down" error cause to in sctp_sf_do_dupcook_a()
1897 SCTP_ST_CHUNK(chunk->chunk_hdr->type), in sctp_sf_do_dupcook_a()
1898 chunk, commands); in sctp_sf_do_dupcook_a()
1902 err = sctp_make_op_error(asoc, chunk, in sctp_sf_do_dupcook_a()
1931 repl = sctp_make_cookie_ack(asoc, chunk); in sctp_sf_do_dupcook_a()
1981 struct sctp_chunk *chunk, in sctp_sf_do_dupcook_b() argument
1991 peer_init = (struct sctp_init_chunk *)(chunk->subh.cookie_hdr + 1); in sctp_sf_do_dupcook_b()
1992 if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), peer_init, in sctp_sf_do_dupcook_b()
1999 if (!sctp_auth_chunk_verify(net, chunk, new_asoc)) in sctp_sf_do_dupcook_b()
2012 repl = sctp_make_cookie_ack(asoc, chunk); in sctp_sf_do_dupcook_b()
2022 * upon reception of a valid COOKIE ECHO chunk. in sctp_sf_do_dupcook_b()
2065 struct sctp_chunk *chunk, in sctp_sf_do_dupcook_c() argument
2076 /* Unexpected COOKIE-ECHO handler lost chunk (Table 2, action 'D')
2088 struct sctp_chunk *chunk, in sctp_sf_do_dupcook_d() argument
2102 if (!sctp_auth_chunk_verify(net, chunk, asoc)) in sctp_sf_do_dupcook_d()
2120 * ECHO chunk. in sctp_sf_do_dupcook_d()
2152 repl = sctp_make_cookie_ack(asoc, chunk); in sctp_sf_do_dupcook_d()
2182 * chunk was retransmitted and then delayed in the network.
2189 * (endpoint, asoc, chunk)
2194 * The return value is the disposition of the chunk.
2205 struct sctp_chunk *chunk = arg; in sctp_sf_do_5_2_4_dupcook() local
2211 /* Make sure that the chunk has a valid length from the protocol in sctp_sf_do_5_2_4_dupcook()
2213 * enough for the chunk header. Cookie length verification is in sctp_sf_do_5_2_4_dupcook()
2216 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) { in sctp_sf_do_5_2_4_dupcook()
2217 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_5_2_4_dupcook()
2222 /* "Decode" the chunk. We have no optional parameters so we in sctp_sf_do_5_2_4_dupcook()
2225 chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; in sctp_sf_do_5_2_4_dupcook()
2226 if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - in sctp_sf_do_5_2_4_dupcook()
2235 new_asoc = sctp_unpack_cookie(ep, asoc, chunk, GFP_ATOMIC, &error, in sctp_sf_do_5_2_4_dupcook()
2253 sctp_send_stale_cookie_err(net, ep, asoc, chunk, commands, in sctp_sf_do_5_2_4_dupcook()
2279 chunk->head_skb ?: chunk->skb)) { in sctp_sf_do_5_2_4_dupcook()
2288 retval = sctp_sf_do_dupcook_a(net, ep, asoc, chunk, commands, in sctp_sf_do_5_2_4_dupcook()
2293 retval = sctp_sf_do_dupcook_b(net, ep, asoc, chunk, commands, in sctp_sf_do_5_2_4_dupcook()
2298 retval = sctp_sf_do_dupcook_c(net, ep, asoc, chunk, commands, in sctp_sf_do_5_2_4_dupcook()
2303 retval = sctp_sf_do_dupcook_d(net, ep, asoc, chunk, commands, in sctp_sf_do_5_2_4_dupcook()
2341 struct sctp_chunk *chunk = arg; in sctp_sf_shutdown_pending_abort() local
2343 if (!sctp_vtag_verify_either(chunk, asoc)) in sctp_sf_shutdown_pending_abort()
2346 /* Make sure that the ABORT chunk has a valid length. in sctp_sf_shutdown_pending_abort()
2347 * Since this is an ABORT chunk, we have to discard it in sctp_sf_shutdown_pending_abort()
2356 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_abort_chunk))) in sctp_sf_shutdown_pending_abort()
2365 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest)) in sctp_sf_shutdown_pending_abort()
2368 if (!sctp_err_chunk_valid(chunk)) in sctp_sf_shutdown_pending_abort()
2387 struct sctp_chunk *chunk = arg; in sctp_sf_shutdown_sent_abort() local
2389 if (!sctp_vtag_verify_either(chunk, asoc)) in sctp_sf_shutdown_sent_abort()
2392 /* Make sure that the ABORT chunk has a valid length. in sctp_sf_shutdown_sent_abort()
2393 * Since this is an ABORT chunk, we have to discard it in sctp_sf_shutdown_sent_abort()
2402 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_abort_chunk))) in sctp_sf_shutdown_sent_abort()
2411 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest)) in sctp_sf_shutdown_sent_abort()
2414 if (!sctp_err_chunk_valid(chunk)) in sctp_sf_shutdown_sent_abort()
2454 * (endpoint, asoc, chunk)
2459 * The return value is the disposition of the chunk.
2469 struct sctp_chunk *chunk = arg; in sctp_sf_cookie_echoed_err() local
2472 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_cookie_echoed_err()
2475 /* Make sure that the ERROR chunk has a valid length. in sctp_sf_cookie_echoed_err()
2478 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_operr_chunk))) in sctp_sf_cookie_echoed_err()
2487 sctp_walk_errors(err, chunk->chunk_hdr) { in sctp_sf_cookie_echoed_err()
2508 * 3) Send a new INIT chunk to the endpoint, adding a Cookie
2519 * (endpoint, asoc, chunk)
2524 * The return value is the disposition of the chunk.
2535 struct sctp_chunk *chunk = arg, *reply; in sctp_sf_do_5_2_6_stale() local
2549 err = (struct sctp_errhdr *)(chunk->skb->data); in sctp_sf_do_5_2_6_stale()
2572 /* Build that new INIT chunk. */ in sctp_sf_do_5_2_6_stale()
2642 * (endpoint, asoc, chunk)
2647 * The return value is the disposition of the chunk.
2657 struct sctp_chunk *chunk = arg; in sctp_sf_do_9_1_abort() local
2659 if (!sctp_vtag_verify_either(chunk, asoc)) in sctp_sf_do_9_1_abort()
2662 /* Make sure that the ABORT chunk has a valid length. in sctp_sf_do_9_1_abort()
2663 * Since this is an ABORT chunk, we have to discard it in sctp_sf_do_9_1_abort()
2672 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_abort_chunk))) in sctp_sf_do_9_1_abort()
2681 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest)) in sctp_sf_do_9_1_abort()
2684 if (!sctp_err_chunk_valid(chunk)) in sctp_sf_do_9_1_abort()
2699 struct sctp_chunk *chunk = arg; in __sctp_sf_do_9_1_abort() local
2702 /* See if we have an error cause code in the chunk. */ in __sctp_sf_do_9_1_abort()
2703 len = ntohs(chunk->chunk_hdr->length); in __sctp_sf_do_9_1_abort()
2705 error = ((struct sctp_errhdr *)chunk->skb->data)->cause; in __sctp_sf_do_9_1_abort()
2730 struct sctp_chunk *chunk = arg; in sctp_sf_cookie_wait_abort() local
2733 if (!sctp_vtag_verify_either(chunk, asoc)) in sctp_sf_cookie_wait_abort()
2736 /* Make sure that the ABORT chunk has a valid length. in sctp_sf_cookie_wait_abort()
2737 * Since this is an ABORT chunk, we have to discard it in sctp_sf_cookie_wait_abort()
2746 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_abort_chunk))) in sctp_sf_cookie_wait_abort()
2749 /* See if we have an error cause code in the chunk. */ in sctp_sf_cookie_wait_abort()
2750 len = ntohs(chunk->chunk_hdr->length); in sctp_sf_cookie_wait_abort()
2752 error = ((struct sctp_errhdr *)chunk->skb->data)->cause; in sctp_sf_cookie_wait_abort()
2755 chunk->transport); in sctp_sf_cookie_wait_abort()
2827 * - verify, by checking the Cumulative TSN Ack field of the chunk,
2844 * (endpoint, asoc, chunk)
2849 * The return value is the disposition of the chunk.
2860 struct sctp_chunk *chunk = arg; in sctp_sf_do_9_2_shutdown() local
2865 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_9_2_shutdown()
2868 /* Make sure that the SHUTDOWN chunk has a valid length. */ in sctp_sf_do_9_2_shutdown()
2869 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_shutdown_chunk))) in sctp_sf_do_9_2_shutdown()
2874 sdh = (struct sctp_shutdownhdr *)chunk->skb->data; in sctp_sf_do_9_2_shutdown()
2875 skb_pull(chunk->skb, sizeof(*sdh)); in sctp_sf_do_9_2_shutdown()
2876 chunk->subh.shutdown_hdr = sdh; in sctp_sf_do_9_2_shutdown()
2923 * chunk, that all its outstanding DATA chunks have been in sctp_sf_do_9_2_shutdown()
2927 SCTP_BE32(chunk->subh.shutdown_hdr->cum_tsn_ack)); in sctp_sf_do_9_2_shutdown()
2938 * The Cumulative TSN Ack of the received SHUTDOWN chunk
2949 struct sctp_chunk *chunk = arg; in sctp_sf_do_9_2_shut_ctsn() local
2953 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_9_2_shut_ctsn()
2956 /* Make sure that the SHUTDOWN chunk has a valid length. */ in sctp_sf_do_9_2_shut_ctsn()
2957 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_shutdown_chunk))) in sctp_sf_do_9_2_shut_ctsn()
2961 sdh = (struct sctp_shutdownhdr *)chunk->skb->data; in sctp_sf_do_9_2_shut_ctsn()
2979 * chunk, that all its outstanding DATA chunks have been in sctp_sf_do_9_2_shut_ctsn()
2989 * If an endpoint is in SHUTDOWN-ACK-SENT state and receives an INIT chunk
2991 * transport addresses (either in the IP addresses or in the INIT chunk)
2992 * that belong to this association, it should discard the INIT chunk and
2993 * retransmit the SHUTDOWN ACK chunk.
3001 struct sctp_chunk *chunk = arg; in __sctp_sf_do_9_2_reshutack() local
3004 /* Make sure that the chunk has a valid length */ in __sctp_sf_do_9_2_reshutack()
3005 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in __sctp_sf_do_9_2_reshutack()
3010 * is no point in verifying chunk boundaries. Just generate in __sctp_sf_do_9_2_reshutack()
3013 reply = sctp_make_shutdown_ack(asoc, chunk); in __sctp_sf_do_9_2_reshutack()
3017 /* Set the transport for the SHUTDOWN ACK chunk and the timeout for in __sctp_sf_do_9_2_reshutack()
3039 struct sctp_chunk *chunk = arg; in sctp_sf_do_9_2_reshutack() local
3041 if (!chunk->singleton) in sctp_sf_do_9_2_reshutack()
3044 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_init_chunk))) in sctp_sf_do_9_2_reshutack()
3047 if (chunk->sctp_hdr->vtag != 0) in sctp_sf_do_9_2_reshutack()
3063 * SCTP the same indication is made by including the CWR chunk.
3064 * This chunk contains one data element, i.e. the TSN number that
3065 * was sent in the ECNE chunk. This element represents the lowest
3071 * (endpoint, asoc, chunk)
3076 * The return value is the disposition of the chunk.
3085 struct sctp_chunk *chunk = arg; in sctp_sf_do_ecn_cwr() local
3089 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_ecn_cwr()
3092 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_ecne_chunk))) in sctp_sf_do_ecn_cwr()
3096 cwr = (struct sctp_cwrhdr *)chunk->skb->data; in sctp_sf_do_ecn_cwr()
3097 skb_pull(chunk->skb, sizeof(*cwr)); in sctp_sf_do_ecn_cwr()
3121 * same indication is made by including the ECNE chunk. This chunk
3127 * (endpoint, asoc, chunk)
3132 * The return value is the disposition of the chunk.
3140 struct sctp_chunk *chunk = arg; in sctp_sf_do_ecne() local
3143 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_ecne()
3146 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_ecne_chunk))) in sctp_sf_do_ecne()
3150 ecne = (struct sctp_ecnehdr *)chunk->skb->data; in sctp_sf_do_ecne()
3151 skb_pull(chunk->skb, sizeof(*ecne)); in sctp_sf_do_ecne()
3164 * DATA chunk.
3169 * (not every second DATA chunk) received, and SHOULD be generated within
3170 * 200 ms of the arrival of any unacknowledged DATA chunk. In some
3183 * (endpoint, asoc, chunk)
3188 * The return value is the disposition of the chunk.
3198 struct sctp_chunk *chunk = arg; in sctp_sf_eat_data_6_2() local
3201 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_eat_data_6_2()
3207 if (!sctp_chunk_length_valid(chunk, sctp_datachk_len(&asoc->stream))) in sctp_sf_eat_data_6_2()
3211 error = sctp_eat_data(asoc, chunk, commands); in sctp_sf_eat_data_6_2()
3226 return sctp_sf_abort_violation(net, ep, asoc, chunk, commands, in sctp_sf_eat_data_6_2()
3227 (u8 *)chunk->subh.data_hdr, in sctp_sf_eat_data_6_2()
3233 if (chunk->chunk_hdr->flags & SCTP_DATA_SACK_IMM) in sctp_sf_eat_data_6_2()
3241 /* If this is the last chunk in a packet, we need to count it in sctp_sf_eat_data_6_2()
3244 * THEM. We elect to NOT generate SACK's if the chunk fails in sctp_sf_eat_data_6_2()
3250 * each valid DATA chunk. in sctp_sf_eat_data_6_2()
3255 * least every second packet (not every second DATA chunk) in sctp_sf_eat_data_6_2()
3257 * arrival of any unacknowledged DATA chunk. In some in sctp_sf_eat_data_6_2()
3263 if (chunk->end_of_packet) in sctp_sf_eat_data_6_2()
3271 * When a packet arrives with duplicate DATA chunk(s) and with in sctp_sf_eat_data_6_2()
3272 * no new DATA chunk(s), the endpoint MUST immediately send a in sctp_sf_eat_data_6_2()
3274 * DATA chunk(s) bundled with new DATA chunks, the endpoint in sctp_sf_eat_data_6_2()
3276 * DATA chunks will occur when the original SACK chunk was lost in sctp_sf_eat_data_6_2()
3281 * the last chunk is a duplicate.' in sctp_sf_eat_data_6_2()
3283 if (chunk->end_of_packet) in sctp_sf_eat_data_6_2()
3288 if (chunk->end_of_packet) in sctp_sf_eat_data_6_2()
3303 * (endpoint, asoc, chunk)
3308 * The return value is the disposition of the chunk.
3318 struct sctp_chunk *chunk = arg; in sctp_sf_eat_data_fast_4_4() local
3321 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_eat_data_fast_4_4()
3327 if (!sctp_chunk_length_valid(chunk, sctp_datachk_len(&asoc->stream))) in sctp_sf_eat_data_fast_4_4()
3331 error = sctp_eat_data(asoc, chunk, commands); in sctp_sf_eat_data_fast_4_4()
3342 return sctp_sf_abort_violation(net, ep, asoc, chunk, commands, in sctp_sf_eat_data_fast_4_4()
3343 (u8 *)chunk->subh.data_hdr, in sctp_sf_eat_data_fast_4_4()
3354 * respond to each received packet containing one or more DATA chunk(s) in sctp_sf_eat_data_fast_4_4()
3355 * with a SACK, a SHUTDOWN chunk, and restart the T2-shutdown timer in sctp_sf_eat_data_fast_4_4()
3357 if (chunk->end_of_packet) { in sctp_sf_eat_data_fast_4_4()
3358 /* We must delay the chunk creation since the cumulative in sctp_sf_eat_data_fast_4_4()
3385 * reneged on the data), then mark the corresponding DATA chunk
3389 * chunk was originally transmitted, then T3-rtx is started for
3395 * (endpoint, asoc, chunk)
3400 * The return value is the disposition of the chunk.
3409 struct sctp_chunk *chunk = arg; in sctp_sf_eat_sack_6_2() local
3413 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_eat_sack_6_2()
3416 /* Make sure that the SACK chunk has a valid length. */ in sctp_sf_eat_sack_6_2()
3417 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_sack_chunk))) in sctp_sf_eat_sack_6_2()
3421 /* Pull the SACK chunk from the data buffer */ in sctp_sf_eat_sack_6_2()
3422 sackh = sctp_sm_pull_sack(chunk); in sctp_sf_eat_sack_6_2()
3426 chunk->subh.sack_hdr = sackh; in sctp_sf_eat_sack_6_2()
3436 trace_sctp_probe(ep, asoc, chunk); in sctp_sf_eat_sack_6_2()
3452 sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK, SCTP_CHUNK(chunk)); in sctp_sf_eat_sack_6_2()
3469 * packet and set the T-bit in the Chunk Flags to indicate that the
3476 * The return value is the disposition of the chunk.
3487 struct sctp_chunk *chunk = arg; in sctp_sf_tabort_8_4_8() local
3490 packet = sctp_ootb_pkt_new(net, asoc, chunk); in sctp_sf_tabort_8_4_8()
3497 abort = sctp_make_abort(asoc, chunk, 0); in sctp_sf_tabort_8_4_8()
3505 packet->vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_sf_tabort_8_4_8()
3520 /* Handling of SCTP Packets Containing an INIT Chunk Matching an
3534 struct sctp_chunk *chunk = arg; in sctp_sf_new_encap_port() local
3537 packet = sctp_ootb_pkt_new(net, asoc, chunk); in sctp_sf_new_encap_port()
3541 abort = sctp_make_new_encap_port(asoc, chunk); in sctp_sf_new_encap_port()
3561 * Received an ERROR chunk from peer. Generate SCTP_REMOTE_ERROR
3562 * event as ULP notification for each cause included in the chunk.
3566 * The return value is the disposition of the chunk.
3575 struct sctp_chunk *chunk = arg; in sctp_sf_operr_notify() local
3578 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_operr_notify()
3581 /* Make sure that the ERROR chunk has a valid length. */ in sctp_sf_operr_notify()
3582 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_operr_chunk))) in sctp_sf_operr_notify()
3585 sctp_walk_errors(err, chunk->chunk_hdr); in sctp_sf_operr_notify()
3586 if ((void *)err != (void *)chunk->chunk_end) in sctp_sf_operr_notify()
3591 SCTP_CHUNK(chunk)); in sctp_sf_operr_notify()
3601 * stop the T2-shutdown timer, send a SHUTDOWN COMPLETE chunk to its
3613 struct sctp_chunk *chunk = arg; in sctp_sf_do_9_2_final() local
3617 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_9_2_final()
3620 /* Make sure that the SHUTDOWN_ACK chunk has a valid length. */ in sctp_sf_do_9_2_final()
3621 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_do_9_2_final()
3634 /* ...send a SHUTDOWN COMPLETE chunk to its peer, */ in sctp_sf_do_9_2_final()
3635 reply = sctp_make_shutdown_complete(asoc, chunk); in sctp_sf_do_9_2_final()
3672 * 5) If the packet contains a SHUTDOWN ACK chunk, the receiver should
3677 * set the T-bit in the Chunk Flags to indicate that the Verification
3684 * packet and set the T-bit in the Chunk Flags to indicate that the
3695 struct sctp_chunk *chunk = arg; in sctp_sf_ootb() local
3696 struct sk_buff *skb = chunk->skb; in sctp_sf_ootb()
3705 if (asoc && !sctp_vtag_verify(chunk, asoc)) in sctp_sf_ootb()
3708 ch = (struct sctp_chunkhdr *)chunk->chunk_hdr; in sctp_sf_ootb()
3710 /* Report violation if the chunk is less then minimal */ in sctp_sf_ootb()
3715 /* Report violation if chunk len overflows */ in sctp_sf_ootb()
3721 /* Now that we know we at least have a chunk header, in sctp_sf_ootb()
3768 * 5) If the packet contains a SHUTDOWN ACK chunk, the receiver should
3773 * set the T-bit in the Chunk Flags to indicate that the Verification
3782 * The return value is the disposition of the chunk.
3793 struct sctp_chunk *chunk = arg; in sctp_sf_shut_8_4_5() local
3796 packet = sctp_ootb_pkt_new(net, asoc, chunk); in sctp_sf_shut_8_4_5()
3803 shut = sctp_make_shutdown_complete(asoc, chunk); in sctp_sf_shut_8_4_5()
3811 packet->vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_sf_shut_8_4_5()
3848 struct sctp_chunk *chunk = arg; in sctp_sf_do_8_5_1_E_sa() local
3850 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_8_5_1_E_sa()
3853 /* Make sure that the SHUTDOWN_ACK chunk has a valid length. */ in sctp_sf_do_8_5_1_E_sa()
3854 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_do_8_5_1_E_sa()
3868 /* ADDIP Section 4.2 Upon reception of an ASCONF Chunk. */
3878 struct sctp_chunk *chunk = arg; in sctp_sf_do_asconf() local
3882 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_do_asconf()
3888 /* Make sure that the ASCONF ADDIP chunk has a valid length. */ in sctp_sf_do_asconf()
3889 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_addip_chunk))) in sctp_sf_do_asconf()
3894 * This chunk MUST be sent in an authenticated way by using in sctp_sf_do_asconf()
3895 * the mechanism defined in [I-D.ietf-tsvwg-sctp-auth]. If this chunk in sctp_sf_do_asconf()
3900 (!net->sctp.addip_noauth && !chunk->auth)) in sctp_sf_do_asconf()
3903 hdr = (struct sctp_addiphdr *)chunk->skb->data; in sctp_sf_do_asconf()
3906 /* Verify the ASCONF chunk before processing it. */ in sctp_sf_do_asconf()
3907 if (!sctp_verify_asconf(asoc, chunk, true, &err_param)) in sctp_sf_do_asconf()
3919 if (!chunk->has_asconf) in sctp_sf_do_asconf()
3924 * processing the ASCONF Chunk, append an ASCONF-ACK Chunk to in sctp_sf_do_asconf()
3931 asoc, chunk); in sctp_sf_do_asconf()
3942 * Chunk exists. This will occur when an older ASCONF in sctp_sf_do_asconf()
3944 * should skip the ASCONF Chunk and not include ASCONF-ACK in sctp_sf_do_asconf()
3945 * Chunk for that chunk. in sctp_sf_do_asconf()
3957 /* ADDIP 5.2 E5) Otherwise, the ASCONF Chunk is discarded since in sctp_sf_do_asconf()
3967 * To do this properly, we'll set the destination address of the chunk in sctp_sf_do_asconf()
3972 asconf_ack->dest = chunk->source; in sctp_sf_do_asconf()
4007 * When building TLV parameters for the ASCONF Chunk that will add or
4030 /* Make sure that the ADDIP chunk has a valid length. */ in sctp_sf_do_asconf_ack()
4037 * This chunk MUST be sent in an authenticated way by using in sctp_sf_do_asconf_ack()
4038 * the mechanism defined in [I-D.ietf-tsvwg-sctp-auth]. If this chunk in sctp_sf_do_asconf_ack()
4049 /* Verify the ASCONF-ACK chunk before processing it. */ in sctp_sf_do_asconf_ack()
4062 * equal to the next serial number to be used but no ASCONF chunk is in sctp_sf_do_asconf_ack()
4124 /* RE-CONFIG Section 5.2 Upon reception of an RECONF Chunk. */
4133 struct sctp_chunk *chunk = arg; in sctp_sf_do_reconf() local
4137 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_do_reconf()
4143 /* Make sure that the RECONF chunk has a valid length. */ in sctp_sf_do_reconf()
4144 if (!sctp_chunk_length_valid(chunk, sizeof(*hdr))) in sctp_sf_do_reconf()
4148 if (!sctp_verify_reconf(asoc, chunk, &err_param)) in sctp_sf_do_reconf()
4152 hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr; in sctp_sf_do_reconf()
4191 * When a FORWARD TSN chunk arrives, the data receiver MUST first update
4193 * chunk, and then MUST further advance its cumulative TSN point locally
4200 * The return value is the disposition of the chunk.
4210 struct sctp_chunk *chunk = arg; in sctp_sf_eat_fwd_tsn() local
4214 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_eat_fwd_tsn()
4223 /* Make sure that the FORWARD_TSN chunk has valid length. */ in sctp_sf_eat_fwd_tsn()
4224 if (!sctp_chunk_length_valid(chunk, sctp_ftsnchk_len(&asoc->stream))) in sctp_sf_eat_fwd_tsn()
4228 fwdtsn_hdr = (struct sctp_fwdtsn_hdr *)chunk->skb->data; in sctp_sf_eat_fwd_tsn()
4229 chunk->subh.fwdtsn_hdr = fwdtsn_hdr; in sctp_sf_eat_fwd_tsn()
4230 len = ntohs(chunk->chunk_hdr->length); in sctp_sf_eat_fwd_tsn()
4232 skb_pull(chunk->skb, len); in sctp_sf_eat_fwd_tsn()
4237 /* The TSN is too high--silently discard the chunk and count on it in sctp_sf_eat_fwd_tsn()
4243 if (!asoc->stream.si->validate_ftsn(chunk)) in sctp_sf_eat_fwd_tsn()
4249 SCTP_CHUNK(chunk)); in sctp_sf_eat_fwd_tsn()
4277 struct sctp_chunk *chunk = arg; in sctp_sf_eat_fwd_tsn_fast() local
4281 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_eat_fwd_tsn_fast()
4290 /* Make sure that the FORWARD_TSN chunk has a valid length. */ in sctp_sf_eat_fwd_tsn_fast()
4291 if (!sctp_chunk_length_valid(chunk, sctp_ftsnchk_len(&asoc->stream))) in sctp_sf_eat_fwd_tsn_fast()
4295 fwdtsn_hdr = (struct sctp_fwdtsn_hdr *)chunk->skb->data; in sctp_sf_eat_fwd_tsn_fast()
4296 chunk->subh.fwdtsn_hdr = fwdtsn_hdr; in sctp_sf_eat_fwd_tsn_fast()
4297 len = ntohs(chunk->chunk_hdr->length); in sctp_sf_eat_fwd_tsn_fast()
4299 skb_pull(chunk->skb, len); in sctp_sf_eat_fwd_tsn_fast()
4304 /* The TSN is too high--silently discard the chunk and count on it in sctp_sf_eat_fwd_tsn_fast()
4310 if (!asoc->stream.si->validate_ftsn(chunk)) in sctp_sf_eat_fwd_tsn_fast()
4316 SCTP_CHUNK(chunk)); in sctp_sf_eat_fwd_tsn_fast()
4323 * respond to each received packet containing one or more DATA chunk(s) in sctp_sf_eat_fwd_tsn_fast()
4324 * with a SACK, a SHUTDOWN chunk, and restart the T2-shutdown timer in sctp_sf_eat_fwd_tsn_fast()
4339 * receiver in the HMAC-ALGO parameter in the INIT or INIT-ACK chunk
4340 * during association setup, the AUTH chunk and all chunks after it MUST
4341 * be discarded and an ERROR chunk SHOULD be sent with the error cause
4354 * The return value is the disposition of the chunk.
4358 struct sctp_chunk *chunk) in sctp_sf_authenticate() argument
4368 auth_hdr = (struct sctp_authhdr *)chunk->skb->data; in sctp_sf_authenticate()
4369 chunk->subh.auth_hdr = auth_hdr; in sctp_sf_authenticate()
4370 skb_pull(chunk->skb, sizeof(*auth_hdr)); in sctp_sf_authenticate()
4373 * chunk. in sctp_sf_authenticate()
4391 sig_len = ntohs(chunk->chunk_hdr->length) - in sctp_sf_authenticate()
4399 * 1. Save the digest from the chunk. in sctp_sf_authenticate()
4400 * 2. Zero out the digest in the chunk. in sctp_sf_authenticate()
4405 skb_pull(chunk->skb, sig_len); in sctp_sf_authenticate()
4413 sctp_auth_calculate_hmac(asoc, chunk->skb, in sctp_sf_authenticate()
4414 (struct sctp_auth_chunk *)chunk->chunk_hdr, in sctp_sf_authenticate()
4424 chunk->auth = 1; in sctp_sf_authenticate()
4437 struct sctp_chunk *chunk = arg; in sctp_sf_eat_auth() local
4446 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_eat_auth()
4452 /* Make sure that the AUTH chunk has valid length. */ in sctp_sf_eat_auth()
4453 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_auth_chunk))) in sctp_sf_eat_auth()
4457 auth_hdr = (struct sctp_authhdr *)chunk->skb->data; in sctp_sf_eat_auth()
4458 error = sctp_sf_authenticate(asoc, chunk); in sctp_sf_eat_auth()
4461 /* Generate the ERROR chunk and discard the rest in sctp_sf_eat_auth()
4464 err_chunk = sctp_make_op_error(asoc, chunk, in sctp_sf_eat_auth()
4505 * Process an unknown chunk.
4509 * Chunk Types are encoded such that the highest-order two bits specify
4511 * recognize the Chunk Type.
4518 * chunk in an 'Unrecognized Chunk Type'.
4520 * 10 - Skip this chunk and continue processing.
4522 * 11 - Skip this chunk and continue processing, but report in an ERROR
4523 * Chunk using the 'Unrecognized Chunk Type' cause of error.
4525 * The return value is the disposition of the chunk.
4538 pr_debug("%s: processing unknown chunk id:%d\n", __func__, type.chunk); in sctp_sf_unk_chunk()
4543 /* Make sure that the chunk has a valid length. in sctp_sf_unk_chunk()
4544 * Since we don't know the chunk type, we use a general in sctp_sf_unk_chunk()
4551 switch (type.chunk & SCTP_CID_ACTION_MASK) { in sctp_sf_unk_chunk()
4556 /* Generate an ERROR chunk as response. */ in sctp_sf_unk_chunk()
4571 /* Skip the chunk. */ in sctp_sf_unk_chunk()
4574 /* Generate an ERROR chunk as response. */ in sctp_sf_unk_chunk()
4584 /* Skip the chunk. */ in sctp_sf_unk_chunk()
4594 * Discard the chunk.
4600 * (endpoint, asoc, chunk)
4605 * The return value is the disposition of the chunk.
4614 struct sctp_chunk *chunk = arg; in sctp_sf_discard_chunk() local
4616 if (asoc && !sctp_vtag_verify(chunk, asoc)) in sctp_sf_discard_chunk()
4619 /* Make sure that the chunk has a valid length. in sctp_sf_discard_chunk()
4620 * Since we don't know the chunk type, we use a general in sctp_sf_discard_chunk()
4623 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_discard_chunk()
4627 pr_debug("%s: chunk:%d is discarded\n", __func__, type.chunk); in sctp_sf_discard_chunk()
4637 * 2) If the OOTB packet contains an ABORT chunk, the receiver MUST
4643 * (endpoint, asoc, chunk)
4648 * The return value is the disposition of the chunk.
4669 * (endpoint, asoc, chunk)
4674 * We simply tag the chunk as a violation. The state machine will log
4684 struct sctp_chunk *chunk = arg; in sctp_sf_violation() local
4686 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_violation()
4689 /* Make sure that the chunk has a valid length. */ in sctp_sf_violation()
4690 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_violation()
4710 struct sctp_chunk *chunk = arg; in sctp_sf_abort_violation() local
4727 /* Make the abort chunk. */ in sctp_sf_abort_violation()
4728 abort = sctp_make_abort_violation(asoc, chunk, payload, paylen); in sctp_sf_abort_violation()
4734 if (chunk->chunk_hdr->type == SCTP_CID_INIT_ACK && in sctp_sf_abort_violation()
4738 initack = (struct sctp_initack_chunk *)chunk->chunk_hdr; in sctp_sf_abort_violation()
4739 if (!sctp_chunk_length_valid(chunk, sizeof(*initack))) in sctp_sf_abort_violation()
4768 packet = sctp_ootb_pkt_new(net, asoc, chunk); in sctp_sf_abort_violation()
4774 packet->vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_sf_abort_violation()
4799 * Handle a protocol violation when the chunk length is invalid.
4801 * given chunk can be. For example, a SACK chunk has invalid length
4810 * (endpoint, asoc, chunk)
4815 * Generate an ABORT chunk and terminate the association.
4825 static const char err_str[] = "The following chunk had invalid length:"; in sctp_sf_violation_chunklen()
4834 * or accumulated length in multi parameters exceeds the end of the chunk,
4847 struct sctp_chunk *chunk = arg; in sctp_sf_violation_paramlen() local
4852 /* Make the abort chunk. */ in sctp_sf_violation_paramlen()
4853 abort = sctp_make_violation_paramlen(asoc, chunk, param); in sctp_sf_violation_paramlen()
4894 /* Handle protocol violation of an invalid chunk bundling. For example,
4908 static const char err_str[] = "The following chunk violates protocol:"; in sctp_sf_violation_chunk()
4992 * A) "A" first sends an INIT chunk to "Z". In the INIT, "A" in sctp_sf_do_prm_asoc()
5062 * chunk before the life time expired.
5164 * will be discarded and an ABORT chunk is sent to the peer. A success code
5483 * chunk to the destination address is successful.
5521 * ADDIP Section 4.1 ASCONF Chunk Procedures
5532 struct sctp_chunk *chunk = arg; in sctp_sf_do_prm_asconf() local
5534 sctp_add_cmd_sf(commands, SCTP_CMD_SETUP_T4, SCTP_CHUNK(chunk)); in sctp_sf_do_prm_asconf()
5537 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(chunk)); in sctp_sf_do_prm_asconf()
5541 /* RE-CONFIG Section 5.1 RECONF Chunk Procedures */
5549 struct sctp_chunk *chunk = arg; in sctp_sf_do_prm_reconf() local
5551 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(chunk)); in sctp_sf_do_prm_reconf()
5608 * shall send a SHUTDOWN chunk to its peer including in the Cumulative
5627 * endpoint shall send a SHUTDOWN chunk to its peer including in sctp_sf_do_9_2_start_shutdown()
5635 /* Set the transport for the SHUTDOWN chunk and the timeout for the in sctp_sf_do_9_2_start_shutdown()
5694 struct sctp_chunk *chunk = arg; in sctp_sf_do_9_2_shutdown_ack() local
5698 * 1) called in response to a SHUTDOWN chunk in sctp_sf_do_9_2_shutdown_ack()
5702 * to check that we have a chunk before accessing it's fields. in sctp_sf_do_9_2_shutdown_ack()
5704 if (chunk) { in sctp_sf_do_9_2_shutdown_ack()
5705 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_9_2_shutdown_ack()
5709 /* Make sure that the SHUTDOWN chunk has a valid length. */ in sctp_sf_do_9_2_shutdown_ack()
5711 chunk, sizeof(struct sctp_shutdown_chunk))) in sctp_sf_do_9_2_shutdown_ack()
5719 reply = sctp_make_shutdown_ack(asoc, chunk); in sctp_sf_do_9_2_shutdown_ack()
5723 /* Set the transport for the SHUTDOWN ACK chunk and the timeout for in sctp_sf_do_9_2_shutdown_ack()
5786 * The return value is the disposition of the chunk.
5869 * (not every second DATA chunk) received, and SHOULD be generated
5870 * within 200 ms of the arrival of any unacknowledged DATA chunk. In
6014 * SHUTDOWN chunk to the protocol parameter 'Association.Max.Retrans'.
6075 /* Set the transport for the SHUTDOWN/ACK chunk and the timeout for in sctp_sf_t2_timer_expire()
6091 * ADDIP Section 4.1 ASCONF Chunk Procedures
6102 struct sctp_chunk *chunk = asoc->addip_last_asconf; in sctp_sf_t4_timer_expire() local
6103 struct sctp_transport *transport = chunk->transport; in sctp_sf_t4_timer_expire()
6116 sctp_add_cmd_sf(commands, SCTP_CMD_SETUP_T4, SCTP_CHUNK(chunk)); in sctp_sf_t4_timer_expire()
6136 * the ASCONF chunk was sent by doubling the RTO timer value. in sctp_sf_t4_timer_expire()
6140 /* ADDIP 4.1 B4) Re-transmit the ASCONF Chunk last sent and if possible in sctp_sf_t4_timer_expire()
6143 * chunk, it MUST be the same (including its serial number) as the last in sctp_sf_t4_timer_expire()
6164 * by sending an ABORT chunk.
6243 * (endpoint, asoc, chunk)
6245 * The return value is the disposition of the chunk.
6260 * (endpoint, asoc, chunk)
6262 * The return value is the disposition of the chunk.
6280 * (endpoint, asoc, chunk)
6282 * The return value is the disposition of the chunk.
6291 pr_debug("%s: timer %d ignored\n", __func__, type.chunk); in sctp_sf_timer_ignore()
6300 /* Pull the SACK chunk based on the SACK header. */
6301 static struct sctp_sackhdr *sctp_sm_pull_sack(struct sctp_chunk *chunk) in sctp_sm_pull_sack() argument
6311 sack = (struct sctp_sackhdr *) chunk->skb->data; in sctp_sm_pull_sack()
6317 if (len > chunk->skb->len) in sctp_sm_pull_sack()
6320 skb_pull(chunk->skb, len); in sctp_sm_pull_sack()
6332 struct sctp_chunk *chunk, in sctp_abort_pkt_new() argument
6338 packet = sctp_ootb_pkt_new(net, asoc, chunk); in sctp_abort_pkt_new()
6344 abort = sctp_make_abort(asoc, chunk, paylen); in sctp_abort_pkt_new()
6352 packet->vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_abort_pkt_new()
6355 * end of the chunk. in sctp_abort_pkt_new()
6373 const struct sctp_chunk *chunk) in sctp_ootb_pkt_new() argument
6381 sport = ntohs(chunk->sctp_hdr->dest); in sctp_ootb_pkt_new()
6382 dport = ntohs(chunk->sctp_hdr->source); in sctp_ootb_pkt_new()
6391 switch (chunk->chunk_hdr->type) { in sctp_ootb_pkt_new()
6397 initack = (struct sctp_initack_chunk *)chunk->chunk_hdr; in sctp_ootb_pkt_new()
6409 switch (chunk->chunk_hdr->type) { in sctp_ootb_pkt_new()
6414 init = (struct sctp_init_chunk *)chunk->chunk_hdr; in sctp_ootb_pkt_new()
6419 vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_ootb_pkt_new()
6425 transport = sctp_transport_new(net, sctp_source(chunk), GFP_ATOMIC); in sctp_ootb_pkt_new()
6429 transport->encap_port = SCTP_INPUT_CB(chunk->skb)->encap_port; in sctp_ootb_pkt_new()
6431 /* Cache a route for the transport with the chunk's destination as in sctp_ootb_pkt_new()
6434 sctp_transport_route(transport, (union sctp_addr *)&chunk->dest, in sctp_ootb_pkt_new()
6453 /* Send a stale cookie error when a invalid COOKIE ECHO chunk is found */
6457 const struct sctp_chunk *chunk, in sctp_send_stale_cookie_err() argument
6464 packet = sctp_ootb_pkt_new(net, asoc, chunk); in sctp_send_stale_cookie_err()
6469 cookie = chunk->subh.cookie_hdr; in sctp_send_stale_cookie_err()
6484 /* Process a data chunk */
6486 struct sctp_chunk *chunk, in sctp_eat_data() argument
6499 data_hdr = (struct sctp_datahdr *)chunk->skb->data; in sctp_eat_data()
6500 chunk->subh.data_hdr = data_hdr; in sctp_eat_data()
6501 skb_pull(chunk->skb, sctp_datahdr_len(&asoc->stream)); in sctp_eat_data()
6510 * Since the chunk structure is reused for all chunks within in sctp_eat_data()
6515 * chunk later. in sctp_eat_data()
6518 if (asoc->peer.ecn_capable && !chunk->ecn_ce_done) { in sctp_eat_data()
6519 struct sctp_af *af = SCTP_INPUT_CB(chunk->skb)->af; in sctp_eat_data()
6520 chunk->ecn_ce_done = 1; in sctp_eat_data()
6522 if (af->is_ce(sctp_gso_headskb(chunk->skb))) { in sctp_eat_data()
6531 /* The TSN is too high--silently discard the chunk and in sctp_eat_data()
6534 if (chunk->asoc) in sctp_eat_data()
6535 chunk->asoc->stats.outofseqtsns++; in sctp_eat_data()
6548 datalen = ntohs(chunk->chunk_hdr->length); in sctp_eat_data()
6556 /* Even if we don't accept this chunk there is in sctp_eat_data()
6567 if ((!chunk->data_accepted) && (!asoc->rwnd || asoc->rwnd_over || in sctp_eat_data()
6610 * DATA chunk if a received DATA chunk has no user data. in sctp_eat_data()
6613 err = sctp_make_abort_no_data(asoc, chunk, tsn); in sctp_eat_data()
6631 chunk->data_accepted = 1; in sctp_eat_data()
6634 * if we renege and the chunk arrives again. in sctp_eat_data()
6636 if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) { in sctp_eat_data()
6638 if (chunk->asoc) in sctp_eat_data()
6639 chunk->asoc->stats.iuodchunks++; in sctp_eat_data()
6642 if (chunk->asoc) in sctp_eat_data()
6643 chunk->asoc->stats.iodchunks++; in sctp_eat_data()
6648 * If an endpoint receive a DATA chunk with an invalid stream in sctp_eat_data()
6649 * identifier, it shall acknowledge the reception of the DATA chunk in sctp_eat_data()
6650 * following the normal procedure, immediately send an ERROR chunk in sctp_eat_data()
6652 * and discard the DATA chunk. in sctp_eat_data()
6658 err = sctp_make_op_error(asoc, chunk, SCTP_ERROR_INV_STRM, in sctp_eat_data()
6675 if (!asoc->stream.si->validate_data(chunk)) in sctp_eat_data()
6680 * chunk needs the updated rwnd. in sctp_eat_data()
6682 sctp_add_cmd_sf(commands, deliver, SCTP_CHUNK(chunk)); in sctp_eat_data()