Lines Matching full:chunk

55 					struct sctp_chunk *chunk,
58 struct sctp_chunk *chunk,
63 const struct sctp_chunk *chunk);
67 const struct sctp_chunk *chunk,
98 static struct sctp_sackhdr *sctp_sm_pull_sack(struct sctp_chunk *chunk);
150 struct sctp_chunk *chunk);
166 /* Small helper function that checks if the chunk length
168 * is set to be the size of a specific chunk we are testing.
173 static inline bool sctp_chunk_length_valid(struct sctp_chunk *chunk, in sctp_chunk_length_valid() argument
176 __u16 chunk_length = ntohs(chunk->chunk_hdr->length); in sctp_chunk_length_valid()
179 if (unlikely(chunk->pdiscard)) in sctp_chunk_length_valid()
187 /* Check for format error in an ABORT chunk */
188 static inline bool sctp_err_chunk_valid(struct sctp_chunk *chunk) in sctp_err_chunk_valid() argument
192 sctp_walk_errors(err, chunk->chunk_hdr); in sctp_err_chunk_valid()
194 return (void *)err == (void *)chunk->chunk_end; in sctp_err_chunk_valid()
198 * These are the state functions for handling chunk events.
205 * Upon reception of the SHUTDOWN COMPLETE chunk the endpoint will verify
206 * that it is in SHUTDOWN-ACK-SENT state, if it is not the chunk should be
218 * it is set to its peer's tag and the T bit is set in the Chunk
225 * (endpoint, asoc, chunk)
230 * The return value is the disposition of the chunk.
238 struct sctp_chunk *chunk = arg; in sctp_sf_do_4_C() local
241 if (!sctp_vtag_verify_either(chunk, asoc)) in sctp_sf_do_4_C()
249 if (!chunk->singleton) in sctp_sf_do_4_C()
252 /* Make sure that the SHUTDOWN_COMPLETE chunk has a valid length. */ in sctp_sf_do_4_C()
253 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_do_4_C()
270 /* Upon reception of the SHUTDOWN COMPLETE chunk the endpoint in sctp_sf_do_4_C()
272 * not the chunk should be discarded. If the endpoint is in in sctp_sf_do_4_C()
296 * Respond to a normal INIT chunk.
300 * B) "Z" shall respond immediately with an INIT ACK chunk. The
310 * (endpoint, asoc, chunk)
315 * The return value is the disposition of the chunk.
324 struct sctp_chunk *chunk = arg, *repl, *err_chunk; in sctp_sf_do_5_1B_init() local
335 * Furthermore, we require that the receiver of an INIT chunk MUST in sctp_sf_do_5_1B_init()
337 * with an INIT chunk that is bundled with other chunks. in sctp_sf_do_5_1B_init()
339 if (!chunk->singleton) in sctp_sf_do_5_1B_init()
342 /* Make sure that the INIT chunk has a valid length. in sctp_sf_do_5_1B_init()
347 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_init_chunk))) in sctp_sf_do_5_1B_init()
358 /* 3.1 A packet containing an INIT chunk MUST have a zero Verification in sctp_sf_do_5_1B_init()
361 if (chunk->sctp_hdr->vtag != 0) in sctp_sf_do_5_1B_init()
373 /* Verify the INIT chunk before processing it. */ in sctp_sf_do_5_1B_init()
375 if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, in sctp_sf_do_5_1B_init()
376 (struct sctp_init_chunk *)chunk->chunk_hdr, chunk, in sctp_sf_do_5_1B_init()
378 /* This chunk contains fatal error. It is to be discarded. in sctp_sf_do_5_1B_init()
405 chunk->subh.init_hdr = (struct sctp_inithdr *)chunk->skb->data; in sctp_sf_do_5_1B_init()
408 chunk->param_hdr.v = skb_pull(chunk->skb, sizeof(struct sctp_inithdr)); in sctp_sf_do_5_1B_init()
410 new_asoc = sctp_make_temp_asoc(ep, chunk, GFP_ATOMIC); in sctp_sf_do_5_1B_init()
415 if (security_sctp_assoc_request(new_asoc, chunk->skb)) { in sctp_sf_do_5_1B_init()
421 sctp_scope(sctp_source(chunk)), in sctp_sf_do_5_1B_init()
426 if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), in sctp_sf_do_5_1B_init()
427 (struct sctp_init_chunk *)chunk->chunk_hdr, in sctp_sf_do_5_1B_init()
431 /* B) "Z" shall respond immediately with an INIT ACK chunk. */ in sctp_sf_do_5_1B_init()
441 repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); in sctp_sf_do_5_1B_init()
451 * ERROR chunk generated by sctp_verify_init(). Since the in sctp_sf_do_5_1B_init()
490 * Respond to a normal INIT ACK chunk.
496 * Cookie received in the INIT ACK chunk in a COOKIE ECHO chunk, start
499 * Note: The COOKIE ECHO chunk can be bundled with any pending outbound
500 * DATA chunks, but it MUST be the first chunk in the packet and
505 * If the value of the Initiate Tag in a received INIT ACK chunk is
510 * (endpoint, asoc, chunk)
515 * The return value is the disposition of the chunk.
525 struct sctp_chunk *chunk = arg; in sctp_sf_do_5_1C_ack() local
529 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_5_1C_ack()
536 if (!chunk->singleton) in sctp_sf_do_5_1C_ack()
539 /* Make sure that the INIT-ACK chunk has a valid length */ in sctp_sf_do_5_1C_ack()
540 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_initack_chunk))) in sctp_sf_do_5_1C_ack()
544 chunk->subh.init_hdr = (struct sctp_inithdr *)chunk->skb->data; in sctp_sf_do_5_1C_ack()
546 /* Verify the INIT chunk before processing it. */ in sctp_sf_do_5_1C_ack()
548 if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, in sctp_sf_do_5_1C_ack()
549 (struct sctp_init_chunk *)chunk->chunk_hdr, chunk, in sctp_sf_do_5_1C_ack()
554 /* This chunk contains fatal error. It is to be discarded. in sctp_sf_do_5_1C_ack()
592 asoc, chunk->transport); in sctp_sf_do_5_1C_ack()
596 * convert the parameters in an INIT chunk. in sctp_sf_do_5_1C_ack()
598 chunk->param_hdr.v = skb_pull(chunk->skb, sizeof(struct sctp_inithdr)); in sctp_sf_do_5_1C_ack()
600 initchunk = (struct sctp_init_chunk *)chunk->chunk_hdr; in sctp_sf_do_5_1C_ack()
625 * INIT ACK chunk in a COOKIE ECHO chunk, ... in sctp_sf_do_5_1C_ack()
627 /* If there is any errors to report, send the ERROR chunk generated in sctp_sf_do_5_1C_ack()
636 static bool sctp_auth_chunk_verify(struct net *net, struct sctp_chunk *chunk, in sctp_auth_chunk_verify() argument
641 if (!chunk->auth_chunk) in sctp_auth_chunk_verify()
655 /* set-up our fake chunk so that we can process it */ in sctp_auth_chunk_verify()
656 auth.skb = chunk->auth_chunk; in sctp_auth_chunk_verify()
657 auth.asoc = chunk->asoc; in sctp_auth_chunk_verify()
658 auth.sctp_hdr = chunk->sctp_hdr; in sctp_auth_chunk_verify()
660 skb_push(chunk->auth_chunk, in sctp_auth_chunk_verify()
662 skb_pull(chunk->auth_chunk, sizeof(struct sctp_chunkhdr)); in sctp_auth_chunk_verify()
663 auth.transport = chunk->transport; in sctp_auth_chunk_verify()
669 * Respond to a normal COOKIE ECHO chunk.
673 * D) Upon reception of the COOKIE ECHO chunk, Endpoint "Z" will reply
674 * with a COOKIE ACK chunk after building a TCB and moving to
675 * the ESTABLISHED state. A COOKIE ACK chunk may be bundled with
677 * chunk MUST be the first chunk in the packet.
681 * of a valid COOKIE ECHO chunk.
692 * (endpoint, asoc, chunk)
697 * The return value is the disposition of the chunk.
709 struct sctp_chunk *chunk = arg; in sctp_sf_do_5_1D_ce() local
715 if (asoc && !sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_5_1D_ce()
726 /* Make sure that the COOKIE_ECHO chunk has a valid length. in sctp_sf_do_5_1D_ce()
728 * chunk header. More detailed verification is done in sctp_sf_do_5_1D_ce()
731 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_do_5_1D_ce()
744 /* "Decode" the chunk. We have no optional parameters so we in sctp_sf_do_5_1D_ce()
747 chunk->subh.cookie_hdr = in sctp_sf_do_5_1D_ce()
748 (struct sctp_signed_cookie *)chunk->skb->data; in sctp_sf_do_5_1D_ce()
749 if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - in sctp_sf_do_5_1D_ce()
753 /* 5.1 D) Upon reception of the COOKIE ECHO chunk, Endpoint in sctp_sf_do_5_1D_ce()
754 * "Z" will reply with a COOKIE ACK chunk after building a TCB in sctp_sf_do_5_1D_ce()
757 new_asoc = sctp_unpack_cookie(ep, asoc, chunk, GFP_ATOMIC, &error, in sctp_sf_do_5_1D_ce()
775 sctp_send_stale_cookie_err(net, ep, asoc, chunk, commands, in sctp_sf_do_5_1D_ce()
785 if (security_sctp_assoc_request(new_asoc, chunk->head_skb ?: chunk->skb)) { in sctp_sf_do_5_1D_ce()
798 peer_init = (struct sctp_init_chunk *)(chunk->subh.cookie_hdr + 1); in sctp_sf_do_5_1D_ce()
799 if (!sctp_process_init(new_asoc, chunk, in sctp_sf_do_5_1D_ce()
800 &chunk->subh.cookie_hdr->c.peer_addr, in sctp_sf_do_5_1D_ce()
812 if (!sctp_auth_chunk_verify(net, chunk, new_asoc)) { in sctp_sf_do_5_1D_ce()
817 repl = sctp_make_cookie_ack(new_asoc, chunk); in sctp_sf_do_5_1D_ce()
825 * upon reception of a valid COOKIE ECHO chunk. in sctp_sf_do_5_1D_ce()
900 * Respond to a normal COOKIE ACK chunk.
913 * (endpoint, asoc, chunk)
918 * The return value is the disposition of the chunk.
927 struct sctp_chunk *chunk = arg; in sctp_sf_do_5_1E_ca() local
930 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_5_1E_ca()
935 chunk->head_skb ?: chunk->skb)) in sctp_sf_do_5_1E_ca()
938 /* Verify that the chunk length for the COOKIE-ACK is OK. in sctp_sf_do_5_1E_ca()
941 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_do_5_1E_ca()
1029 * is started with this heartbeat chunk. in sctp_sf_heartbeat()
1062 * chunk is sent and the destination transport address to which this in sctp_sf_sendbeat_8_3()
1115 /* send hb chunk with padding for PLPMUTD. */
1146 * from the received HEARTBEAT chunk.
1157 * (endpoint, asoc, chunk)
1162 * The return value is the disposition of the chunk.
1171 struct sctp_chunk *chunk = arg; in sctp_sf_beat_8_3() local
1175 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_beat_8_3()
1178 /* Make sure that the HEARTBEAT chunk has a valid length. */ in sctp_sf_beat_8_3()
1179 if (!sctp_chunk_length_valid(chunk, in sctp_sf_beat_8_3()
1186 * Information field copied from the received HEARTBEAT chunk. in sctp_sf_beat_8_3()
1188 chunk->subh.hb_hdr = (struct sctp_heartbeathdr *)chunk->skb->data; in sctp_sf_beat_8_3()
1189 param_hdr = (struct sctp_paramhdr *)chunk->subh.hb_hdr; in sctp_sf_beat_8_3()
1190 paylen = ntohs(chunk->chunk_hdr->length) - sizeof(struct sctp_chunkhdr); in sctp_sf_beat_8_3()
1196 if (!pskb_pull(chunk->skb, paylen)) in sctp_sf_beat_8_3()
1199 reply = sctp_make_heartbeat_ack(asoc, chunk, param_hdr, paylen); in sctp_sf_beat_8_3()
1226 * value carried in the HEARTBEAT ACK chunk.
1231 * (endpoint, asoc, chunk)
1236 * The return value is the disposition of the chunk.
1246 struct sctp_chunk *chunk = arg; in sctp_sf_backbeat_8_3() local
1251 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_backbeat_8_3()
1254 /* Make sure that the HEARTBEAT-ACK chunk has a valid length. */ in sctp_sf_backbeat_8_3()
1255 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr) + in sctp_sf_backbeat_8_3()
1260 hbinfo = (struct sctp_sender_hb_info *)chunk->skb->data; in sctp_sf_backbeat_8_3()
1509 * chunk handling.
1519 struct sctp_chunk *chunk = arg, *repl, *err_chunk; in sctp_sf_do_unexpected_init() local
1531 * Furthermore, we require that the receiver of an INIT chunk MUST in sctp_sf_do_unexpected_init()
1533 * with an INIT chunk that is bundled with other chunks. in sctp_sf_do_unexpected_init()
1535 if (!chunk->singleton) in sctp_sf_do_unexpected_init()
1538 /* Make sure that the INIT chunk has a valid length. */ in sctp_sf_do_unexpected_init()
1539 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_init_chunk))) in sctp_sf_do_unexpected_init()
1542 /* 3.1 A packet containing an INIT chunk MUST have a zero Verification in sctp_sf_do_unexpected_init()
1545 if (chunk->sctp_hdr->vtag != 0) in sctp_sf_do_unexpected_init()
1548 if (SCTP_INPUT_CB(chunk->skb)->encap_port != chunk->transport->encap_port) in sctp_sf_do_unexpected_init()
1552 chunk->subh.init_hdr = (struct sctp_inithdr *)chunk->skb->data; in sctp_sf_do_unexpected_init()
1555 chunk->param_hdr.v = skb_pull(chunk->skb, sizeof(struct sctp_inithdr)); in sctp_sf_do_unexpected_init()
1557 /* Verify the INIT chunk before processing it. */ in sctp_sf_do_unexpected_init()
1559 if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, in sctp_sf_do_unexpected_init()
1560 (struct sctp_init_chunk *)chunk->chunk_hdr, chunk, in sctp_sf_do_unexpected_init()
1562 /* This chunk contains fatal error. It is to be discarded. in sctp_sf_do_unexpected_init()
1594 new_asoc = sctp_make_temp_asoc(ep, chunk, GFP_ATOMIC); in sctp_sf_do_unexpected_init()
1599 if (security_sctp_assoc_request(new_asoc, chunk->skb)) { in sctp_sf_do_unexpected_init()
1605 sctp_scope(sctp_source(chunk)), GFP_ATOMIC) < 0) in sctp_sf_do_unexpected_init()
1612 if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), in sctp_sf_do_unexpected_init()
1613 (struct sctp_init_chunk *)chunk->chunk_hdr, in sctp_sf_do_unexpected_init()
1623 if (!sctp_sf_check_restart_addrs(new_asoc, asoc, chunk, in sctp_sf_do_unexpected_init()
1632 /* B) "Z" shall respond immediately with an INIT ACK chunk. */ in sctp_sf_do_unexpected_init()
1643 repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); in sctp_sf_do_unexpected_init()
1653 * ERROR chunk generated by sctp_verify_init(). Since the in sctp_sf_do_unexpected_init()
1704 * sent in its original INIT chunk (including its Verification Tag,
1706 * newly received INIT chunk. The endpoint shall also generate a State
1723 * (endpoint, asoc, chunk)
1728 * The return value is the disposition of the chunk.
1739 * duplicate INIT chunk handling. in sctp_sf_do_5_2_1_siminit()
1778 * (endpoint, asoc, chunk)
1783 * The return value is the disposition of the chunk.
1794 * duplicate INIT chunk handling. in sctp_sf_do_5_2_2_dupinit()
1805 * COOKIE-WAIT state, the endpoint should discard the INIT ACK chunk.
1807 * duplicated INIT chunk.
1817 /* Per the above section, we'll discard the chunk if we have an in sctp_sf_do_5_2_3_initack()
1859 struct sctp_chunk *chunk, in sctp_sf_do_dupcook_a() argument
1872 peer_init = (struct sctp_init_chunk *)(chunk->subh.cookie_hdr + 1); in sctp_sf_do_dupcook_a()
1873 if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), peer_init, in sctp_sf_do_dupcook_a()
1880 if (!sctp_auth_chunk_verify(net, chunk, new_asoc)) in sctp_sf_do_dupcook_a()
1887 if (!sctp_sf_check_restart_addrs(new_asoc, asoc, chunk, commands)) in sctp_sf_do_dupcook_a()
1893 * chunk with a "Cookie Received while Shutting Down" error cause to in sctp_sf_do_dupcook_a()
1898 SCTP_ST_CHUNK(chunk->chunk_hdr->type), in sctp_sf_do_dupcook_a()
1899 chunk, commands); in sctp_sf_do_dupcook_a()
1903 err = sctp_make_op_error(asoc, chunk, in sctp_sf_do_dupcook_a()
1932 repl = sctp_make_cookie_ack(asoc, chunk); in sctp_sf_do_dupcook_a()
1982 struct sctp_chunk *chunk, in sctp_sf_do_dupcook_b() argument
1992 peer_init = (struct sctp_init_chunk *)(chunk->subh.cookie_hdr + 1); in sctp_sf_do_dupcook_b()
1993 if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), peer_init, in sctp_sf_do_dupcook_b()
2000 if (!sctp_auth_chunk_verify(net, chunk, new_asoc)) in sctp_sf_do_dupcook_b()
2013 repl = sctp_make_cookie_ack(asoc, chunk); in sctp_sf_do_dupcook_b()
2023 * upon reception of a valid COOKIE ECHO chunk. in sctp_sf_do_dupcook_b()
2066 struct sctp_chunk *chunk, in sctp_sf_do_dupcook_c() argument
2077 /* Unexpected COOKIE-ECHO handler lost chunk (Table 2, action 'D')
2089 struct sctp_chunk *chunk, in sctp_sf_do_dupcook_d() argument
2103 if (!sctp_auth_chunk_verify(net, chunk, asoc)) in sctp_sf_do_dupcook_d()
2121 * ECHO chunk. in sctp_sf_do_dupcook_d()
2153 repl = sctp_make_cookie_ack(asoc, chunk); in sctp_sf_do_dupcook_d()
2183 * chunk was retransmitted and then delayed in the network.
2190 * (endpoint, asoc, chunk)
2195 * The return value is the disposition of the chunk.
2206 struct sctp_chunk *chunk = arg; in sctp_sf_do_5_2_4_dupcook() local
2212 /* Make sure that the chunk has a valid length from the protocol in sctp_sf_do_5_2_4_dupcook()
2214 * enough for the chunk header. Cookie length verification is in sctp_sf_do_5_2_4_dupcook()
2217 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) { in sctp_sf_do_5_2_4_dupcook()
2218 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_5_2_4_dupcook()
2223 /* "Decode" the chunk. We have no optional parameters so we in sctp_sf_do_5_2_4_dupcook()
2226 chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; in sctp_sf_do_5_2_4_dupcook()
2227 if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - in sctp_sf_do_5_2_4_dupcook()
2236 new_asoc = sctp_unpack_cookie(ep, asoc, chunk, GFP_ATOMIC, &error, in sctp_sf_do_5_2_4_dupcook()
2254 sctp_send_stale_cookie_err(net, ep, asoc, chunk, commands, in sctp_sf_do_5_2_4_dupcook()
2280 chunk->head_skb ?: chunk->skb)) { in sctp_sf_do_5_2_4_dupcook()
2289 retval = sctp_sf_do_dupcook_a(net, ep, asoc, chunk, commands, in sctp_sf_do_5_2_4_dupcook()
2294 retval = sctp_sf_do_dupcook_b(net, ep, asoc, chunk, commands, in sctp_sf_do_5_2_4_dupcook()
2299 retval = sctp_sf_do_dupcook_c(net, ep, asoc, chunk, commands, in sctp_sf_do_5_2_4_dupcook()
2304 retval = sctp_sf_do_dupcook_d(net, ep, asoc, chunk, commands, in sctp_sf_do_5_2_4_dupcook()
2342 struct sctp_chunk *chunk = arg; in sctp_sf_shutdown_pending_abort() local
2344 if (!sctp_vtag_verify_either(chunk, asoc)) in sctp_sf_shutdown_pending_abort()
2347 /* Make sure that the ABORT chunk has a valid length. in sctp_sf_shutdown_pending_abort()
2348 * Since this is an ABORT chunk, we have to discard it in sctp_sf_shutdown_pending_abort()
2357 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_abort_chunk))) in sctp_sf_shutdown_pending_abort()
2366 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest)) in sctp_sf_shutdown_pending_abort()
2369 if (!sctp_err_chunk_valid(chunk)) in sctp_sf_shutdown_pending_abort()
2388 struct sctp_chunk *chunk = arg; in sctp_sf_shutdown_sent_abort() local
2390 if (!sctp_vtag_verify_either(chunk, asoc)) in sctp_sf_shutdown_sent_abort()
2393 /* Make sure that the ABORT chunk has a valid length. in sctp_sf_shutdown_sent_abort()
2394 * Since this is an ABORT chunk, we have to discard it in sctp_sf_shutdown_sent_abort()
2403 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_abort_chunk))) in sctp_sf_shutdown_sent_abort()
2412 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest)) in sctp_sf_shutdown_sent_abort()
2415 if (!sctp_err_chunk_valid(chunk)) in sctp_sf_shutdown_sent_abort()
2455 * (endpoint, asoc, chunk)
2460 * The return value is the disposition of the chunk.
2470 struct sctp_chunk *chunk = arg; in sctp_sf_cookie_echoed_err() local
2473 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_cookie_echoed_err()
2476 /* Make sure that the ERROR chunk has a valid length. in sctp_sf_cookie_echoed_err()
2479 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_operr_chunk))) in sctp_sf_cookie_echoed_err()
2488 sctp_walk_errors(err, chunk->chunk_hdr) { in sctp_sf_cookie_echoed_err()
2509 * 3) Send a new INIT chunk to the endpoint, adding a Cookie
2520 * (endpoint, asoc, chunk)
2525 * The return value is the disposition of the chunk.
2536 struct sctp_chunk *chunk = arg, *reply; in sctp_sf_do_5_2_6_stale() local
2550 err = (struct sctp_errhdr *)(chunk->skb->data); in sctp_sf_do_5_2_6_stale()
2573 /* Build that new INIT chunk. */ in sctp_sf_do_5_2_6_stale()
2643 * (endpoint, asoc, chunk)
2648 * The return value is the disposition of the chunk.
2658 struct sctp_chunk *chunk = arg; in sctp_sf_do_9_1_abort() local
2660 if (!sctp_vtag_verify_either(chunk, asoc)) in sctp_sf_do_9_1_abort()
2663 /* Make sure that the ABORT chunk has a valid length. in sctp_sf_do_9_1_abort()
2664 * Since this is an ABORT chunk, we have to discard it in sctp_sf_do_9_1_abort()
2673 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_abort_chunk))) in sctp_sf_do_9_1_abort()
2682 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest)) in sctp_sf_do_9_1_abort()
2685 if (!sctp_err_chunk_valid(chunk)) in sctp_sf_do_9_1_abort()
2700 struct sctp_chunk *chunk = arg; in __sctp_sf_do_9_1_abort() local
2703 /* See if we have an error cause code in the chunk. */ in __sctp_sf_do_9_1_abort()
2704 len = ntohs(chunk->chunk_hdr->length); in __sctp_sf_do_9_1_abort()
2706 error = ((struct sctp_errhdr *)chunk->skb->data)->cause; in __sctp_sf_do_9_1_abort()
2731 struct sctp_chunk *chunk = arg; in sctp_sf_cookie_wait_abort() local
2734 if (!sctp_vtag_verify_either(chunk, asoc)) in sctp_sf_cookie_wait_abort()
2737 /* Make sure that the ABORT chunk has a valid length. in sctp_sf_cookie_wait_abort()
2738 * Since this is an ABORT chunk, we have to discard it in sctp_sf_cookie_wait_abort()
2747 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_abort_chunk))) in sctp_sf_cookie_wait_abort()
2750 /* See if we have an error cause code in the chunk. */ in sctp_sf_cookie_wait_abort()
2751 len = ntohs(chunk->chunk_hdr->length); in sctp_sf_cookie_wait_abort()
2753 error = ((struct sctp_errhdr *)chunk->skb->data)->cause; in sctp_sf_cookie_wait_abort()
2756 chunk->transport); in sctp_sf_cookie_wait_abort()
2828 * - verify, by checking the Cumulative TSN Ack field of the chunk,
2845 * (endpoint, asoc, chunk)
2850 * The return value is the disposition of the chunk.
2861 struct sctp_chunk *chunk = arg; in sctp_sf_do_9_2_shutdown() local
2866 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_9_2_shutdown()
2869 /* Make sure that the SHUTDOWN chunk has a valid length. */ in sctp_sf_do_9_2_shutdown()
2870 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_shutdown_chunk))) in sctp_sf_do_9_2_shutdown()
2875 sdh = (struct sctp_shutdownhdr *)chunk->skb->data; in sctp_sf_do_9_2_shutdown()
2876 skb_pull(chunk->skb, sizeof(*sdh)); in sctp_sf_do_9_2_shutdown()
2877 chunk->subh.shutdown_hdr = sdh; in sctp_sf_do_9_2_shutdown()
2924 * chunk, that all its outstanding DATA chunks have been in sctp_sf_do_9_2_shutdown()
2928 SCTP_BE32(chunk->subh.shutdown_hdr->cum_tsn_ack)); in sctp_sf_do_9_2_shutdown()
2939 * The Cumulative TSN Ack of the received SHUTDOWN chunk
2950 struct sctp_chunk *chunk = arg; in sctp_sf_do_9_2_shut_ctsn() local
2954 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_9_2_shut_ctsn()
2957 /* Make sure that the SHUTDOWN chunk has a valid length. */ in sctp_sf_do_9_2_shut_ctsn()
2958 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_shutdown_chunk))) in sctp_sf_do_9_2_shut_ctsn()
2962 sdh = (struct sctp_shutdownhdr *)chunk->skb->data; in sctp_sf_do_9_2_shut_ctsn()
2980 * chunk, that all its outstanding DATA chunks have been in sctp_sf_do_9_2_shut_ctsn()
2990 * If an endpoint is in SHUTDOWN-ACK-SENT state and receives an INIT chunk
2992 * transport addresses (either in the IP addresses or in the INIT chunk)
2993 * that belong to this association, it should discard the INIT chunk and
2994 * retransmit the SHUTDOWN ACK chunk.
3002 struct sctp_chunk *chunk = arg; in __sctp_sf_do_9_2_reshutack() local
3005 /* Make sure that the chunk has a valid length */ in __sctp_sf_do_9_2_reshutack()
3006 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in __sctp_sf_do_9_2_reshutack()
3011 * is no point in verifying chunk boundaries. Just generate in __sctp_sf_do_9_2_reshutack()
3014 reply = sctp_make_shutdown_ack(asoc, chunk); in __sctp_sf_do_9_2_reshutack()
3018 /* Set the transport for the SHUTDOWN ACK chunk and the timeout for in __sctp_sf_do_9_2_reshutack()
3040 struct sctp_chunk *chunk = arg; in sctp_sf_do_9_2_reshutack() local
3042 if (!chunk->singleton) in sctp_sf_do_9_2_reshutack()
3045 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_init_chunk))) in sctp_sf_do_9_2_reshutack()
3048 if (chunk->sctp_hdr->vtag != 0) in sctp_sf_do_9_2_reshutack()
3064 * SCTP the same indication is made by including the CWR chunk.
3065 * This chunk contains one data element, i.e. the TSN number that
3066 * was sent in the ECNE chunk. This element represents the lowest
3072 * (endpoint, asoc, chunk)
3077 * The return value is the disposition of the chunk.
3086 struct sctp_chunk *chunk = arg; in sctp_sf_do_ecn_cwr() local
3090 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_ecn_cwr()
3093 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_ecne_chunk))) in sctp_sf_do_ecn_cwr()
3097 cwr = (struct sctp_cwrhdr *)chunk->skb->data; in sctp_sf_do_ecn_cwr()
3098 skb_pull(chunk->skb, sizeof(*cwr)); in sctp_sf_do_ecn_cwr()
3122 * same indication is made by including the ECNE chunk. This chunk
3128 * (endpoint, asoc, chunk)
3133 * The return value is the disposition of the chunk.
3141 struct sctp_chunk *chunk = arg; in sctp_sf_do_ecne() local
3144 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_ecne()
3147 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_ecne_chunk))) in sctp_sf_do_ecne()
3151 ecne = (struct sctp_ecnehdr *)chunk->skb->data; in sctp_sf_do_ecne()
3152 skb_pull(chunk->skb, sizeof(*ecne)); in sctp_sf_do_ecne()
3165 * DATA chunk.
3170 * (not every second DATA chunk) received, and SHOULD be generated within
3171 * 200 ms of the arrival of any unacknowledged DATA chunk. In some
3184 * (endpoint, asoc, chunk)
3189 * The return value is the disposition of the chunk.
3199 struct sctp_chunk *chunk = arg; in sctp_sf_eat_data_6_2() local
3202 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_eat_data_6_2()
3208 if (!sctp_chunk_length_valid(chunk, sctp_datachk_len(&asoc->stream))) in sctp_sf_eat_data_6_2()
3212 error = sctp_eat_data(asoc, chunk, commands); in sctp_sf_eat_data_6_2()
3227 return sctp_sf_abort_violation(net, ep, asoc, chunk, commands, in sctp_sf_eat_data_6_2()
3228 (u8 *)chunk->subh.data_hdr, in sctp_sf_eat_data_6_2()
3234 if (chunk->chunk_hdr->flags & SCTP_DATA_SACK_IMM) in sctp_sf_eat_data_6_2()
3242 /* If this is the last chunk in a packet, we need to count it in sctp_sf_eat_data_6_2()
3245 * THEM. We elect to NOT generate SACK's if the chunk fails in sctp_sf_eat_data_6_2()
3251 * each valid DATA chunk. in sctp_sf_eat_data_6_2()
3256 * least every second packet (not every second DATA chunk) in sctp_sf_eat_data_6_2()
3258 * arrival of any unacknowledged DATA chunk. In some in sctp_sf_eat_data_6_2()
3264 if (chunk->end_of_packet) in sctp_sf_eat_data_6_2()
3272 * When a packet arrives with duplicate DATA chunk(s) and with in sctp_sf_eat_data_6_2()
3273 * no new DATA chunk(s), the endpoint MUST immediately send a in sctp_sf_eat_data_6_2()
3275 * DATA chunk(s) bundled with new DATA chunks, the endpoint in sctp_sf_eat_data_6_2()
3277 * DATA chunks will occur when the original SACK chunk was lost in sctp_sf_eat_data_6_2()
3282 * the last chunk is a duplicate.' in sctp_sf_eat_data_6_2()
3284 if (chunk->end_of_packet) in sctp_sf_eat_data_6_2()
3289 if (chunk->end_of_packet) in sctp_sf_eat_data_6_2()
3304 * (endpoint, asoc, chunk)
3309 * The return value is the disposition of the chunk.
3319 struct sctp_chunk *chunk = arg; in sctp_sf_eat_data_fast_4_4() local
3322 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_eat_data_fast_4_4()
3328 if (!sctp_chunk_length_valid(chunk, sctp_datachk_len(&asoc->stream))) in sctp_sf_eat_data_fast_4_4()
3332 error = sctp_eat_data(asoc, chunk, commands); in sctp_sf_eat_data_fast_4_4()
3343 return sctp_sf_abort_violation(net, ep, asoc, chunk, commands, in sctp_sf_eat_data_fast_4_4()
3344 (u8 *)chunk->subh.data_hdr, in sctp_sf_eat_data_fast_4_4()
3355 * respond to each received packet containing one or more DATA chunk(s) in sctp_sf_eat_data_fast_4_4()
3356 * with a SACK, a SHUTDOWN chunk, and restart the T2-shutdown timer in sctp_sf_eat_data_fast_4_4()
3358 if (chunk->end_of_packet) { in sctp_sf_eat_data_fast_4_4()
3359 /* We must delay the chunk creation since the cumulative in sctp_sf_eat_data_fast_4_4()
3386 * reneged on the data), then mark the corresponding DATA chunk
3390 * chunk was originally transmitted, then T3-rtx is started for
3396 * (endpoint, asoc, chunk)
3401 * The return value is the disposition of the chunk.
3410 struct sctp_chunk *chunk = arg; in sctp_sf_eat_sack_6_2() local
3414 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_eat_sack_6_2()
3417 /* Make sure that the SACK chunk has a valid length. */ in sctp_sf_eat_sack_6_2()
3418 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_sack_chunk))) in sctp_sf_eat_sack_6_2()
3422 /* Pull the SACK chunk from the data buffer */ in sctp_sf_eat_sack_6_2()
3423 sackh = sctp_sm_pull_sack(chunk); in sctp_sf_eat_sack_6_2()
3427 chunk->subh.sack_hdr = sackh; in sctp_sf_eat_sack_6_2()
3437 trace_sctp_probe(ep, asoc, chunk); in sctp_sf_eat_sack_6_2()
3453 sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK, SCTP_CHUNK(chunk)); in sctp_sf_eat_sack_6_2()
3470 * packet and set the T-bit in the Chunk Flags to indicate that the
3477 * The return value is the disposition of the chunk.
3488 struct sctp_chunk *chunk = arg; in sctp_sf_tabort_8_4_8() local
3491 packet = sctp_ootb_pkt_new(net, asoc, chunk); in sctp_sf_tabort_8_4_8()
3498 abort = sctp_make_abort(asoc, chunk, 0); in sctp_sf_tabort_8_4_8()
3506 packet->vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_sf_tabort_8_4_8()
3521 /* Handling of SCTP Packets Containing an INIT Chunk Matching an
3535 struct sctp_chunk *chunk = arg; in sctp_sf_new_encap_port() local
3538 packet = sctp_ootb_pkt_new(net, asoc, chunk); in sctp_sf_new_encap_port()
3542 abort = sctp_make_new_encap_port(asoc, chunk); in sctp_sf_new_encap_port()
3562 * Received an ERROR chunk from peer. Generate SCTP_REMOTE_ERROR
3563 * event as ULP notification for each cause included in the chunk.
3567 * The return value is the disposition of the chunk.
3576 struct sctp_chunk *chunk = arg; in sctp_sf_operr_notify() local
3579 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_operr_notify()
3582 /* Make sure that the ERROR chunk has a valid length. */ in sctp_sf_operr_notify()
3583 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_operr_chunk))) in sctp_sf_operr_notify()
3586 sctp_walk_errors(err, chunk->chunk_hdr); in sctp_sf_operr_notify()
3587 if ((void *)err != (void *)chunk->chunk_end) in sctp_sf_operr_notify()
3592 SCTP_CHUNK(chunk)); in sctp_sf_operr_notify()
3602 * stop the T2-shutdown timer, send a SHUTDOWN COMPLETE chunk to its
3614 struct sctp_chunk *chunk = arg; in sctp_sf_do_9_2_final() local
3618 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_9_2_final()
3621 /* Make sure that the SHUTDOWN_ACK chunk has a valid length. */ in sctp_sf_do_9_2_final()
3622 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_do_9_2_final()
3635 /* ...send a SHUTDOWN COMPLETE chunk to its peer, */ in sctp_sf_do_9_2_final()
3636 reply = sctp_make_shutdown_complete(asoc, chunk); in sctp_sf_do_9_2_final()
3673 * 5) If the packet contains a SHUTDOWN ACK chunk, the receiver should
3678 * set the T-bit in the Chunk Flags to indicate that the Verification
3685 * packet and set the T-bit in the Chunk Flags to indicate that the
3696 struct sctp_chunk *chunk = arg; in sctp_sf_ootb() local
3697 struct sk_buff *skb = chunk->skb; in sctp_sf_ootb()
3706 if (asoc && !sctp_vtag_verify(chunk, asoc)) in sctp_sf_ootb()
3709 ch = (struct sctp_chunkhdr *)chunk->chunk_hdr; in sctp_sf_ootb()
3711 /* Report violation if the chunk is less then minimal */ in sctp_sf_ootb()
3716 /* Report violation if chunk len overflows */ in sctp_sf_ootb()
3722 /* Now that we know we at least have a chunk header, in sctp_sf_ootb()
3769 * 5) If the packet contains a SHUTDOWN ACK chunk, the receiver should
3774 * set the T-bit in the Chunk Flags to indicate that the Verification
3783 * The return value is the disposition of the chunk.
3794 struct sctp_chunk *chunk = arg; in sctp_sf_shut_8_4_5() local
3797 packet = sctp_ootb_pkt_new(net, asoc, chunk); in sctp_sf_shut_8_4_5()
3804 shut = sctp_make_shutdown_complete(asoc, chunk); in sctp_sf_shut_8_4_5()
3812 packet->vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_sf_shut_8_4_5()
3849 struct sctp_chunk *chunk = arg; in sctp_sf_do_8_5_1_E_sa() local
3851 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_8_5_1_E_sa()
3854 /* Make sure that the SHUTDOWN_ACK chunk has a valid length. */ in sctp_sf_do_8_5_1_E_sa()
3855 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_do_8_5_1_E_sa()
3869 /* ADDIP Section 4.2 Upon reception of an ASCONF Chunk. */
3879 struct sctp_chunk *chunk = arg; in sctp_sf_do_asconf() local
3883 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_do_asconf()
3889 /* Make sure that the ASCONF ADDIP chunk has a valid length. */ in sctp_sf_do_asconf()
3890 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_addip_chunk))) in sctp_sf_do_asconf()
3895 * This chunk MUST be sent in an authenticated way by using in sctp_sf_do_asconf()
3896 * the mechanism defined in [I-D.ietf-tsvwg-sctp-auth]. If this chunk in sctp_sf_do_asconf()
3901 (!net->sctp.addip_noauth && !chunk->auth)) in sctp_sf_do_asconf()
3904 hdr = (struct sctp_addiphdr *)chunk->skb->data; in sctp_sf_do_asconf()
3907 /* Verify the ASCONF chunk before processing it. */ in sctp_sf_do_asconf()
3908 if (!sctp_verify_asconf(asoc, chunk, true, &err_param)) in sctp_sf_do_asconf()
3920 if (!chunk->has_asconf) in sctp_sf_do_asconf()
3925 * processing the ASCONF Chunk, append an ASCONF-ACK Chunk to in sctp_sf_do_asconf()
3932 asoc, chunk); in sctp_sf_do_asconf()
3943 * Chunk exists. This will occur when an older ASCONF in sctp_sf_do_asconf()
3945 * should skip the ASCONF Chunk and not include ASCONF-ACK in sctp_sf_do_asconf()
3946 * Chunk for that chunk. in sctp_sf_do_asconf()
3958 /* ADDIP 5.2 E5) Otherwise, the ASCONF Chunk is discarded since in sctp_sf_do_asconf()
3968 * To do this properly, we'll set the destination address of the chunk in sctp_sf_do_asconf()
3973 asconf_ack->dest = chunk->source; in sctp_sf_do_asconf()
4008 * When building TLV parameters for the ASCONF Chunk that will add or
4031 /* Make sure that the ADDIP chunk has a valid length. */ in sctp_sf_do_asconf_ack()
4038 * This chunk MUST be sent in an authenticated way by using in sctp_sf_do_asconf_ack()
4039 * the mechanism defined in [I-D.ietf-tsvwg-sctp-auth]. If this chunk in sctp_sf_do_asconf_ack()
4050 /* Verify the ASCONF-ACK chunk before processing it. */ in sctp_sf_do_asconf_ack()
4063 * equal to the next serial number to be used but no ASCONF chunk is in sctp_sf_do_asconf_ack()
4125 /* RE-CONFIG Section 5.2 Upon reception of an RECONF Chunk. */
4134 struct sctp_chunk *chunk = arg; in sctp_sf_do_reconf() local
4138 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_do_reconf()
4144 /* Make sure that the RECONF chunk has a valid length. */ in sctp_sf_do_reconf()
4145 if (!sctp_chunk_length_valid(chunk, sizeof(*hdr))) in sctp_sf_do_reconf()
4149 if (!sctp_verify_reconf(asoc, chunk, &err_param)) in sctp_sf_do_reconf()
4153 hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr; in sctp_sf_do_reconf()
4192 * When a FORWARD TSN chunk arrives, the data receiver MUST first update
4194 * chunk, and then MUST further advance its cumulative TSN point locally
4201 * The return value is the disposition of the chunk.
4211 struct sctp_chunk *chunk = arg; in sctp_sf_eat_fwd_tsn() local
4215 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_eat_fwd_tsn()
4224 /* Make sure that the FORWARD_TSN chunk has valid length. */ in sctp_sf_eat_fwd_tsn()
4225 if (!sctp_chunk_length_valid(chunk, sctp_ftsnchk_len(&asoc->stream))) in sctp_sf_eat_fwd_tsn()
4229 fwdtsn_hdr = (struct sctp_fwdtsn_hdr *)chunk->skb->data; in sctp_sf_eat_fwd_tsn()
4230 chunk->subh.fwdtsn_hdr = fwdtsn_hdr; in sctp_sf_eat_fwd_tsn()
4231 len = ntohs(chunk->chunk_hdr->length); in sctp_sf_eat_fwd_tsn()
4233 skb_pull(chunk->skb, len); in sctp_sf_eat_fwd_tsn()
4238 /* The TSN is too high--silently discard the chunk and count on it in sctp_sf_eat_fwd_tsn()
4244 if (!asoc->stream.si->validate_ftsn(chunk)) in sctp_sf_eat_fwd_tsn()
4250 SCTP_CHUNK(chunk)); in sctp_sf_eat_fwd_tsn()
4278 struct sctp_chunk *chunk = arg; in sctp_sf_eat_fwd_tsn_fast() local
4282 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_eat_fwd_tsn_fast()
4291 /* Make sure that the FORWARD_TSN chunk has a valid length. */ in sctp_sf_eat_fwd_tsn_fast()
4292 if (!sctp_chunk_length_valid(chunk, sctp_ftsnchk_len(&asoc->stream))) in sctp_sf_eat_fwd_tsn_fast()
4296 fwdtsn_hdr = (struct sctp_fwdtsn_hdr *)chunk->skb->data; in sctp_sf_eat_fwd_tsn_fast()
4297 chunk->subh.fwdtsn_hdr = fwdtsn_hdr; in sctp_sf_eat_fwd_tsn_fast()
4298 len = ntohs(chunk->chunk_hdr->length); in sctp_sf_eat_fwd_tsn_fast()
4300 skb_pull(chunk->skb, len); in sctp_sf_eat_fwd_tsn_fast()
4305 /* The TSN is too high--silently discard the chunk and count on it in sctp_sf_eat_fwd_tsn_fast()
4311 if (!asoc->stream.si->validate_ftsn(chunk)) in sctp_sf_eat_fwd_tsn_fast()
4317 SCTP_CHUNK(chunk)); in sctp_sf_eat_fwd_tsn_fast()
4324 * respond to each received packet containing one or more DATA chunk(s) in sctp_sf_eat_fwd_tsn_fast()
4325 * with a SACK, a SHUTDOWN chunk, and restart the T2-shutdown timer in sctp_sf_eat_fwd_tsn_fast()
4340 * receiver in the HMAC-ALGO parameter in the INIT or INIT-ACK chunk
4341 * during association setup, the AUTH chunk and all chunks after it MUST
4342 * be discarded and an ERROR chunk SHOULD be sent with the error cause
4355 * The return value is the disposition of the chunk.
4359 struct sctp_chunk *chunk) in sctp_sf_authenticate() argument
4369 auth_hdr = (struct sctp_authhdr *)chunk->skb->data; in sctp_sf_authenticate()
4370 chunk->subh.auth_hdr = auth_hdr; in sctp_sf_authenticate()
4371 skb_pull(chunk->skb, sizeof(*auth_hdr)); in sctp_sf_authenticate()
4374 * chunk. in sctp_sf_authenticate()
4392 sig_len = ntohs(chunk->chunk_hdr->length) - in sctp_sf_authenticate()
4400 * 1. Save the digest from the chunk. in sctp_sf_authenticate()
4401 * 2. Zero out the digest in the chunk. in sctp_sf_authenticate()
4406 skb_pull(chunk->skb, sig_len); in sctp_sf_authenticate()
4414 sctp_auth_calculate_hmac(asoc, chunk->skb, in sctp_sf_authenticate()
4415 (struct sctp_auth_chunk *)chunk->chunk_hdr, in sctp_sf_authenticate()
4425 chunk->auth = 1; in sctp_sf_authenticate()
4438 struct sctp_chunk *chunk = arg; in sctp_sf_eat_auth() local
4447 if (!sctp_vtag_verify(chunk, asoc)) { in sctp_sf_eat_auth()
4453 /* Make sure that the AUTH chunk has valid length. */ in sctp_sf_eat_auth()
4454 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_auth_chunk))) in sctp_sf_eat_auth()
4458 auth_hdr = (struct sctp_authhdr *)chunk->skb->data; in sctp_sf_eat_auth()
4459 error = sctp_sf_authenticate(asoc, chunk); in sctp_sf_eat_auth()
4462 /* Generate the ERROR chunk and discard the rest in sctp_sf_eat_auth()
4465 err_chunk = sctp_make_op_error(asoc, chunk, in sctp_sf_eat_auth()
4506 * Process an unknown chunk.
4510 * Chunk Types are encoded such that the highest-order two bits specify
4512 * recognize the Chunk Type.
4519 * chunk in an 'Unrecognized Chunk Type'.
4521 * 10 - Skip this chunk and continue processing.
4523 * 11 - Skip this chunk and continue processing, but report in an ERROR
4524 * Chunk using the 'Unrecognized Chunk Type' cause of error.
4526 * The return value is the disposition of the chunk.
4539 pr_debug("%s: processing unknown chunk id:%d\n", __func__, type.chunk); in sctp_sf_unk_chunk()
4544 /* Make sure that the chunk has a valid length. in sctp_sf_unk_chunk()
4545 * Since we don't know the chunk type, we use a general in sctp_sf_unk_chunk()
4552 switch (type.chunk & SCTP_CID_ACTION_MASK) { in sctp_sf_unk_chunk()
4557 /* Generate an ERROR chunk as response. */ in sctp_sf_unk_chunk()
4572 /* Skip the chunk. */ in sctp_sf_unk_chunk()
4575 /* Generate an ERROR chunk as response. */ in sctp_sf_unk_chunk()
4585 /* Skip the chunk. */ in sctp_sf_unk_chunk()
4595 * Discard the chunk.
4601 * (endpoint, asoc, chunk)
4606 * The return value is the disposition of the chunk.
4615 struct sctp_chunk *chunk = arg; in sctp_sf_discard_chunk() local
4617 if (asoc && !sctp_vtag_verify(chunk, asoc)) in sctp_sf_discard_chunk()
4620 /* Make sure that the chunk has a valid length. in sctp_sf_discard_chunk()
4621 * Since we don't know the chunk type, we use a general in sctp_sf_discard_chunk()
4624 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_discard_chunk()
4628 pr_debug("%s: chunk:%d is discarded\n", __func__, type.chunk); in sctp_sf_discard_chunk()
4638 * 2) If the OOTB packet contains an ABORT chunk, the receiver MUST
4644 * (endpoint, asoc, chunk)
4649 * The return value is the disposition of the chunk.
4670 * (endpoint, asoc, chunk)
4675 * We simply tag the chunk as a violation. The state machine will log
4685 struct sctp_chunk *chunk = arg; in sctp_sf_violation() local
4687 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_violation()
4690 /* Make sure that the chunk has a valid length. */ in sctp_sf_violation()
4691 if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) in sctp_sf_violation()
4711 struct sctp_chunk *chunk = arg; in sctp_sf_abort_violation() local
4728 /* Make the abort chunk. */ in sctp_sf_abort_violation()
4729 abort = sctp_make_abort_violation(asoc, chunk, payload, paylen); in sctp_sf_abort_violation()
4735 if (chunk->chunk_hdr->type == SCTP_CID_INIT_ACK && in sctp_sf_abort_violation()
4739 initack = (struct sctp_initack_chunk *)chunk->chunk_hdr; in sctp_sf_abort_violation()
4740 if (!sctp_chunk_length_valid(chunk, sizeof(*initack))) in sctp_sf_abort_violation()
4769 packet = sctp_ootb_pkt_new(net, asoc, chunk); in sctp_sf_abort_violation()
4775 packet->vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_sf_abort_violation()
4800 * Handle a protocol violation when the chunk length is invalid.
4802 * given chunk can be. For example, a SACK chunk has invalid length
4811 * (endpoint, asoc, chunk)
4816 * Generate an ABORT chunk and terminate the association.
4826 static const char err_str[] = "The following chunk had invalid length:"; in sctp_sf_violation_chunklen()
4835 * or accumulated length in multi parameters exceeds the end of the chunk,
4848 struct sctp_chunk *chunk = arg; in sctp_sf_violation_paramlen() local
4853 /* Make the abort chunk. */ in sctp_sf_violation_paramlen()
4854 abort = sctp_make_violation_paramlen(asoc, chunk, param); in sctp_sf_violation_paramlen()
4895 /* Handle protocol violation of an invalid chunk bundling. For example,
4909 static const char err_str[] = "The following chunk violates protocol:"; in sctp_sf_violation_chunk()
4993 * A) "A" first sends an INIT chunk to "Z". In the INIT, "A" in sctp_sf_do_prm_asoc()
5063 * chunk before the life time expired.
5165 * will be discarded and an ABORT chunk is sent to the peer. A success code
5484 * chunk to the destination address is successful.
5522 * ADDIP Section 4.1 ASCONF Chunk Procedures
5533 struct sctp_chunk *chunk = arg; in sctp_sf_do_prm_asconf() local
5535 sctp_add_cmd_sf(commands, SCTP_CMD_SETUP_T4, SCTP_CHUNK(chunk)); in sctp_sf_do_prm_asconf()
5538 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(chunk)); in sctp_sf_do_prm_asconf()
5542 /* RE-CONFIG Section 5.1 RECONF Chunk Procedures */
5550 struct sctp_chunk *chunk = arg; in sctp_sf_do_prm_reconf() local
5552 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(chunk)); in sctp_sf_do_prm_reconf()
5609 * shall send a SHUTDOWN chunk to its peer including in the Cumulative
5628 * endpoint shall send a SHUTDOWN chunk to its peer including in sctp_sf_do_9_2_start_shutdown()
5636 /* Set the transport for the SHUTDOWN chunk and the timeout for the in sctp_sf_do_9_2_start_shutdown()
5695 struct sctp_chunk *chunk = arg; in sctp_sf_do_9_2_shutdown_ack() local
5699 * 1) called in response to a SHUTDOWN chunk in sctp_sf_do_9_2_shutdown_ack()
5703 * to check that we have a chunk before accessing it's fields. in sctp_sf_do_9_2_shutdown_ack()
5705 if (chunk) { in sctp_sf_do_9_2_shutdown_ack()
5706 if (!sctp_vtag_verify(chunk, asoc)) in sctp_sf_do_9_2_shutdown_ack()
5710 /* Make sure that the SHUTDOWN chunk has a valid length. */ in sctp_sf_do_9_2_shutdown_ack()
5712 chunk, sizeof(struct sctp_shutdown_chunk))) in sctp_sf_do_9_2_shutdown_ack()
5720 reply = sctp_make_shutdown_ack(asoc, chunk); in sctp_sf_do_9_2_shutdown_ack()
5724 /* Set the transport for the SHUTDOWN ACK chunk and the timeout for in sctp_sf_do_9_2_shutdown_ack()
5787 * The return value is the disposition of the chunk.
5870 * (not every second DATA chunk) received, and SHOULD be generated
5871 * within 200 ms of the arrival of any unacknowledged DATA chunk. In
6015 * SHUTDOWN chunk to the protocol parameter 'Association.Max.Retrans'.
6076 /* Set the transport for the SHUTDOWN/ACK chunk and the timeout for in sctp_sf_t2_timer_expire()
6092 * ADDIP Section 4.1 ASCONF Chunk Procedures
6103 struct sctp_chunk *chunk = asoc->addip_last_asconf; in sctp_sf_t4_timer_expire() local
6104 struct sctp_transport *transport = chunk->transport; in sctp_sf_t4_timer_expire()
6117 sctp_add_cmd_sf(commands, SCTP_CMD_SETUP_T4, SCTP_CHUNK(chunk)); in sctp_sf_t4_timer_expire()
6137 * the ASCONF chunk was sent by doubling the RTO timer value. in sctp_sf_t4_timer_expire()
6141 /* ADDIP 4.1 B4) Re-transmit the ASCONF Chunk last sent and if possible in sctp_sf_t4_timer_expire()
6144 * chunk, it MUST be the same (including its serial number) as the last in sctp_sf_t4_timer_expire()
6165 * by sending an ABORT chunk.
6244 * (endpoint, asoc, chunk)
6246 * The return value is the disposition of the chunk.
6261 * (endpoint, asoc, chunk)
6263 * The return value is the disposition of the chunk.
6281 * (endpoint, asoc, chunk)
6283 * The return value is the disposition of the chunk.
6292 pr_debug("%s: timer %d ignored\n", __func__, type.chunk); in sctp_sf_timer_ignore()
6301 /* Pull the SACK chunk based on the SACK header. */
6302 static struct sctp_sackhdr *sctp_sm_pull_sack(struct sctp_chunk *chunk) in sctp_sm_pull_sack() argument
6312 sack = (struct sctp_sackhdr *) chunk->skb->data; in sctp_sm_pull_sack()
6318 if (len > chunk->skb->len) in sctp_sm_pull_sack()
6321 skb_pull(chunk->skb, len); in sctp_sm_pull_sack()
6333 struct sctp_chunk *chunk, in sctp_abort_pkt_new() argument
6339 packet = sctp_ootb_pkt_new(net, asoc, chunk); in sctp_abort_pkt_new()
6345 abort = sctp_make_abort(asoc, chunk, paylen); in sctp_abort_pkt_new()
6353 packet->vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_abort_pkt_new()
6356 * end of the chunk. in sctp_abort_pkt_new()
6374 const struct sctp_chunk *chunk) in sctp_ootb_pkt_new() argument
6382 sport = ntohs(chunk->sctp_hdr->dest); in sctp_ootb_pkt_new()
6383 dport = ntohs(chunk->sctp_hdr->source); in sctp_ootb_pkt_new()
6392 switch (chunk->chunk_hdr->type) { in sctp_ootb_pkt_new()
6398 initack = (struct sctp_initack_chunk *)chunk->chunk_hdr; in sctp_ootb_pkt_new()
6410 switch (chunk->chunk_hdr->type) { in sctp_ootb_pkt_new()
6415 init = (struct sctp_init_chunk *)chunk->chunk_hdr; in sctp_ootb_pkt_new()
6420 vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_ootb_pkt_new()
6426 transport = sctp_transport_new(net, sctp_source(chunk), GFP_ATOMIC); in sctp_ootb_pkt_new()
6430 transport->encap_port = SCTP_INPUT_CB(chunk->skb)->encap_port; in sctp_ootb_pkt_new()
6432 /* Cache a route for the transport with the chunk's destination as in sctp_ootb_pkt_new()
6435 sctp_transport_route(transport, (union sctp_addr *)&chunk->dest, in sctp_ootb_pkt_new()
6454 /* Send a stale cookie error when a invalid COOKIE ECHO chunk is found */
6458 const struct sctp_chunk *chunk, in sctp_send_stale_cookie_err() argument
6465 packet = sctp_ootb_pkt_new(net, asoc, chunk); in sctp_send_stale_cookie_err()
6470 cookie = chunk->subh.cookie_hdr; in sctp_send_stale_cookie_err()
6485 /* Process a data chunk */
6487 struct sctp_chunk *chunk, in sctp_eat_data() argument
6500 data_hdr = (struct sctp_datahdr *)chunk->skb->data; in sctp_eat_data()
6501 chunk->subh.data_hdr = data_hdr; in sctp_eat_data()
6502 skb_pull(chunk->skb, sctp_datahdr_len(&asoc->stream)); in sctp_eat_data()
6511 * Since the chunk structure is reused for all chunks within in sctp_eat_data()
6516 * chunk later. in sctp_eat_data()
6519 if (asoc->peer.ecn_capable && !chunk->ecn_ce_done) { in sctp_eat_data()
6520 struct sctp_af *af = SCTP_INPUT_CB(chunk->skb)->af; in sctp_eat_data()
6521 chunk->ecn_ce_done = 1; in sctp_eat_data()
6523 if (af->is_ce(sctp_gso_headskb(chunk->skb))) { in sctp_eat_data()
6532 /* The TSN is too high--silently discard the chunk and in sctp_eat_data()
6535 if (chunk->asoc) in sctp_eat_data()
6536 chunk->asoc->stats.outofseqtsns++; in sctp_eat_data()
6549 datalen = ntohs(chunk->chunk_hdr->length); in sctp_eat_data()
6557 /* Even if we don't accept this chunk there is in sctp_eat_data()
6568 if ((!chunk->data_accepted) && (!asoc->rwnd || asoc->rwnd_over || in sctp_eat_data()
6611 * DATA chunk if a received DATA chunk has no user data. in sctp_eat_data()
6614 err = sctp_make_abort_no_data(asoc, chunk, tsn); in sctp_eat_data()
6632 chunk->data_accepted = 1; in sctp_eat_data()
6635 * if we renege and the chunk arrives again. in sctp_eat_data()
6637 if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) { in sctp_eat_data()
6639 if (chunk->asoc) in sctp_eat_data()
6640 chunk->asoc->stats.iuodchunks++; in sctp_eat_data()
6643 if (chunk->asoc) in sctp_eat_data()
6644 chunk->asoc->stats.iodchunks++; in sctp_eat_data()
6649 * If an endpoint receive a DATA chunk with an invalid stream in sctp_eat_data()
6650 * identifier, it shall acknowledge the reception of the DATA chunk in sctp_eat_data()
6651 * following the normal procedure, immediately send an ERROR chunk in sctp_eat_data()
6653 * and discard the DATA chunk. in sctp_eat_data()
6659 err = sctp_make_op_error(asoc, chunk, SCTP_ERROR_INV_STRM, in sctp_eat_data()
6676 if (!asoc->stream.si->validate_data(chunk)) in sctp_eat_data()
6681 * chunk needs the updated rwnd. in sctp_eat_data()
6683 sctp_add_cmd_sf(commands, deliver, SCTP_CHUNK(chunk)); in sctp_eat_data()