• Home
  • Raw
  • Download

Lines Matching +full:tsn +full:- +full:capable

3  * Copyright (c) 1999-2000 Cisco, Inc.
4 * Copyright (c) 1999-2001 Motorola, Inc.
5 * Copyright (c) 2001-2002 Intel Corp.
30 * lksctp developers <linux-sctp@vger.kernel.org>
177 __u16 chunk_length = ntohs(chunk->chunk_hdr->length); in sctp_chunk_length_valid()
180 if (unlikely(chunk->pdiscard)) in sctp_chunk_length_valid()
193 sctp_walk_errors(err, chunk->chunk_hdr); in sctp_err_chunk_valid()
195 return (void *)err == (void *)chunk->chunk_end; in sctp_err_chunk_valid()
207 * that it is in SHUTDOWN-ACK-SENT state, if it is not the chunk should be
208 * discarded. If the endpoint is in the SHUTDOWN-ACK-SENT state the endpoint
209 * should stop the T2-shutdown timer and remove all knowledge of the
215 * - The receiver of a SHUTDOWN COMPLETE shall accept the packet
223 * SHUTDOWN COMPLETE if it is not in the SHUTDOWN-ACK-SENT state.
250 if (!chunk->singleton) in sctp_sf_do_4_C()
258 /* RFC 2960 10.2 SCTP-to-ULP in sctp_sf_do_4_C()
272 * will verify that it is in SHUTDOWN-ACK-SENT state, if it is in sctp_sf_do_4_C()
274 * the SHUTDOWN-ACK-SENT state the endpoint should stop the in sctp_sf_do_4_C()
275 * T2-shutdown timer and remove all knowledge of the in sctp_sf_do_4_C()
333 chunk->skb)) in sctp_sf_do_5_1B_init()
345 if (!chunk->singleton) in sctp_sf_do_5_1B_init()
351 if (ep == sctp_sk(net->sctp.ctl_sock)->ep) { in sctp_sf_do_5_1B_init()
359 if (chunk->sctp_hdr->vtag != 0) in sctp_sf_do_5_1B_init()
376 if (sctp_sstate(ep->base.sk, CLOSING)) in sctp_sf_do_5_1B_init()
381 if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, in sctp_sf_do_5_1B_init()
382 (struct sctp_init_chunk *)chunk->chunk_hdr, chunk, in sctp_sf_do_5_1B_init()
389 (__u8 *)(err_chunk->chunk_hdr) + in sctp_sf_do_5_1B_init()
391 ntohs(err_chunk->chunk_hdr->length) - in sctp_sf_do_5_1B_init()
411 chunk->subh.init_hdr = (struct sctp_inithdr *)chunk->skb->data; in sctp_sf_do_5_1B_init()
414 chunk->param_hdr.v = skb_pull(chunk->skb, sizeof(struct sctp_inithdr)); in sctp_sf_do_5_1B_init()
427 (struct sctp_init_chunk *)chunk->chunk_hdr, in sctp_sf_do_5_1B_init()
438 len = ntohs(err_chunk->chunk_hdr->length) - in sctp_sf_do_5_1B_init()
458 ((__u8 *)(err_chunk->chunk_hdr) + in sctp_sf_do_5_1B_init()
494 * C) Upon reception of the INIT ACK from "Z", "A" shall stop the T1-init
495 * timer and leave COOKIE-WAIT state. "A" shall then send the State
497 * the T1-cookie timer, and enter the COOKIE-ECHOED state.
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()
544 chunk->subh.init_hdr = (struct sctp_inithdr *)chunk->skb->data; 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()
561 (__u8 *)(err_chunk->chunk_hdr) + in sctp_sf_do_5_1C_ack()
563 ntohs(err_chunk->chunk_hdr->length) - in sctp_sf_do_5_1C_ack()
576 /* SCTP-AUTH, Section 6.3: in sctp_sf_do_5_1C_ack()
592 asoc, chunk->transport); 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()
605 /* Reset init error count upon receipt of INIT-ACK. */ in sctp_sf_do_5_1C_ack()
608 /* 5.1 C) "A" shall stop the T1-init timer and leave in sctp_sf_do_5_1C_ack()
609 * COOKIE-WAIT state. "A" shall then ... start the T1-cookie in sctp_sf_do_5_1C_ack()
610 * timer, and enter the COOKIE-ECHOED state. in sctp_sf_do_5_1C_ack()
619 /* SCTP-AUTH: genereate the assocition shared keys so that in sctp_sf_do_5_1C_ack()
620 * we can potentially signe the COOKIE-ECHO. in sctp_sf_do_5_1C_ack()
641 if (!chunk->auth_chunk) in sctp_auth_chunk_verify()
644 /* SCTP-AUTH: auth_chunk pointer is only set when the cookie-echo in sctp_auth_chunk_verify()
651 /* Make sure that we and the peer are AUTH capable */ in sctp_auth_chunk_verify()
652 if (!net->sctp.auth_enable || !asoc->peer.auth_capable) 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()
686 * - When sending a COOKIE ECHO, the endpoint MUST use the value of the
689 * - The receiver of a COOKIE ECHO follows the procedures in Section 5.
718 if (ep == sctp_sk(net->sctp.ctl_sock)->ep) { in sctp_sf_do_5_1D_ce()
732 * on the TCP-style socket exceed the max backlog, respond with an in sctp_sf_do_5_1D_ce()
735 sk = ep->base.sk; in sctp_sf_do_5_1D_ce()
743 chunk->subh.cookie_hdr = in sctp_sf_do_5_1D_ce()
744 (struct sctp_signed_cookie *)chunk->skb->data; in sctp_sf_do_5_1D_ce()
745 if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - in sctp_sf_do_5_1D_ce()
757 * If the re-build failed, what is the proper error path in sctp_sf_do_5_1D_ce()
760 * [We should abort the association. --piggy] in sctp_sf_do_5_1D_ce()
767 case -SCTP_IERROR_NOMEM: in sctp_sf_do_5_1D_ce()
770 case -SCTP_IERROR_STALE_COOKIE: in sctp_sf_do_5_1D_ce()
775 case -SCTP_IERROR_BAD_SIG: in sctp_sf_do_5_1D_ce()
784 * Re-build the bind address for the association is done in in sctp_sf_do_5_1D_ce()
787 /* This is a brand-new association, so these are not yet side in sctp_sf_do_5_1D_ce()
788 * effects--it is safe to run them here. in sctp_sf_do_5_1D_ce()
790 peer_init = &chunk->subh.cookie_hdr->c.peer_init[0]; in sctp_sf_do_5_1D_ce()
793 &chunk->subh.cookie_hdr->c.peer_addr, in sctp_sf_do_5_1D_ce()
797 /* SCTP-AUTH: Now that we've populate required fields in in sctp_sf_do_5_1D_ce()
821 new_asoc->c.sinit_num_ostreams, in sctp_sf_do_5_1D_ce()
822 new_asoc->c.sinit_max_instreams, in sctp_sf_do_5_1D_ce()
832 if (new_asoc->peer.adaptation_ind) { in sctp_sf_do_5_1D_ce()
839 if (!new_asoc->peer.auth_capable) { in sctp_sf_do_5_1D_ce()
849 * during side-effect processing and correclty count established in sctp_sf_do_5_1D_ce()
859 if (new_asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) in sctp_sf_do_5_1D_ce()
899 * COOKIE-ECHOED state to the ESTABLISHED state, stopping the T1-cookie
926 /* Verify that the chunk length for the COOKIE-ACK is OK. in sctp_sf_do_5_1E_ca()
933 /* Reset init error count upon receipt of COOKIE-ACK, in sctp_sf_do_5_1E_ca()
936 * from the COOKIE-ECHOED state to the COOKIE-WAIT in sctp_sf_do_5_1E_ca()
942 security_inet_conn_established(ep->base.sk, chunk->skb); in sctp_sf_do_5_1E_ca()
947 * from the COOKIE-ECHOED state to the ESTABLISHED state, in sctp_sf_do_5_1E_ca()
948 * stopping the T1-cookie timer. in sctp_sf_do_5_1E_ca()
957 if (asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) in sctp_sf_do_5_1E_ca()
966 0, asoc->c.sinit_num_ostreams, in sctp_sf_do_5_1E_ca()
967 asoc->c.sinit_max_instreams, in sctp_sf_do_5_1E_ca()
980 if (asoc->peer.adaptation_ind) { in sctp_sf_do_5_1E_ca()
989 if (!asoc->peer.auth_capable) { in sctp_sf_do_5_1E_ca()
1039 if (asoc->overall_error_count >= asoc->max_retrans) { in sctp_sf_sendbeat_8_3()
1051 * The Sender-specific Heartbeat Info field should normally include in sctp_sf_sendbeat_8_3()
1057 if (transport->param_flags & SPP_HB_ENABLE) { in sctp_sf_sendbeat_8_3()
1087 if (asoc->overall_error_count >= asoc->max_retrans) { in sctp_sf_send_reconf()
1098 sctp_chunk_hold(asoc->strreset_chunk); in sctp_sf_send_reconf()
1100 SCTP_CHUNK(asoc->strreset_chunk)); in sctp_sf_send_reconf()
1154 chunk->subh.hb_hdr = (struct sctp_heartbeathdr *)chunk->skb->data; in sctp_sf_beat_8_3()
1155 param_hdr = (struct sctp_paramhdr *)chunk->subh.hb_hdr; in sctp_sf_beat_8_3()
1156 paylen = ntohs(chunk->chunk_hdr->length) - sizeof(struct sctp_chunkhdr); in sctp_sf_beat_8_3()
1158 if (ntohs(param_hdr->length) > paylen) in sctp_sf_beat_8_3()
1162 if (!pskb_pull(chunk->skb, paylen)) in sctp_sf_beat_8_3()
1220 /* Make sure that the HEARTBEAT-ACK chunk has a valid length. */ in sctp_sf_backbeat_8_3()
1226 hbinfo = (struct sctp_sender_hb_info *)chunk->skb->data; in sctp_sf_backbeat_8_3()
1228 if (ntohs(hbinfo->param_hdr.length) != sizeof(*hbinfo)) in sctp_sf_backbeat_8_3()
1231 from_addr = hbinfo->daddr; in sctp_sf_backbeat_8_3()
1250 /* Validate the 64-bit random nonce. */ in sctp_sf_backbeat_8_3()
1251 if (hbinfo->hb_nonce != link->hb_nonce) in sctp_sf_backbeat_8_3()
1254 max_interval = link->hbinterval + link->rto; in sctp_sf_backbeat_8_3()
1257 if (time_after(hbinfo->sent_at, jiffies) || in sctp_sf_backbeat_8_3()
1258 time_after(jiffies, hbinfo->sent_at + max_interval)) { in sctp_sf_backbeat_8_3()
1283 struct sctp_af *af = sctp_get_af_specific(ssa->v4.sin_family); in sctp_sf_send_restart_abort()
1295 addrparm = (union sctp_addr_param *)errhdr->variable; in sctp_sf_send_restart_abort()
1298 len = af->to_addr_param(ssa, addrparm); in sctp_sf_send_restart_abort()
1301 errhdr->cause = SCTP_ERROR_RESTART; in sctp_sf_send_restart_abort()
1302 errhdr->length = htons(len); in sctp_sf_send_restart_abort()
1305 ep = sctp_sk(net->sctp.ctl_sock)->ep; in sctp_sf_send_restart_abort()
1334 if (sctp_cmp_addr_exact(ipaddr, &addr->ipaddr)) in list_has_sctp_addr()
1348 struct net *net = sock_net(new_asoc->base.sk); in sctp_sf_check_restart_addrs()
1352 /* Implementor's Guide - Section 5.2.2 in sctp_sf_check_restart_addrs()
1363 list_for_each_entry(new_addr, &new_asoc->peer.transport_addr_list, in sctp_sf_check_restart_addrs()
1365 if (!list_has_sctp_addr(&asoc->peer.transport_addr_list, in sctp_sf_check_restart_addrs()
1366 &new_addr->ipaddr)) { in sctp_sf_check_restart_addrs()
1367 sctp_sf_send_restart_abort(net, &new_addr->ipaddr, init, in sctp_sf_check_restart_addrs()
1381 * Note: Do not use in CLOSED or SHUTDOWN-ACK-SENT state.
1386 switch (asoc->state) { in sctp_tietags_populate()
1388 /* 5.2.1 INIT received in COOKIE-WAIT or COOKIE-ECHOED State */ in sctp_tietags_populate()
1391 new_asoc->c.my_vtag = asoc->c.my_vtag; in sctp_tietags_populate()
1392 new_asoc->c.my_ttag = asoc->c.my_vtag; in sctp_tietags_populate()
1393 new_asoc->c.peer_ttag = 0; in sctp_tietags_populate()
1397 new_asoc->c.my_vtag = asoc->c.my_vtag; in sctp_tietags_populate()
1398 new_asoc->c.my_ttag = asoc->c.my_vtag; in sctp_tietags_populate()
1399 new_asoc->c.peer_ttag = asoc->c.peer_vtag; in sctp_tietags_populate()
1402 /* 5.2.2 Unexpected INIT in States Other than CLOSED, COOKIE-ECHOED, in sctp_tietags_populate()
1403 * COOKIE-WAIT and SHUTDOWN-ACK-SENT in sctp_tietags_populate()
1406 new_asoc->c.my_ttag = asoc->c.my_vtag; in sctp_tietags_populate()
1407 new_asoc->c.peer_ttag = asoc->c.peer_vtag; in sctp_tietags_populate()
1415 new_asoc->rwnd = asoc->rwnd; in sctp_tietags_populate()
1416 new_asoc->c.sinit_num_ostreams = asoc->c.sinit_num_ostreams; in sctp_tietags_populate()
1417 new_asoc->c.sinit_max_instreams = asoc->c.sinit_max_instreams; in sctp_tietags_populate()
1418 new_asoc->c.initial_tsn = asoc->c.initial_tsn; in sctp_tietags_populate()
1422 * Compare vtag/tietag values to determine unexpected COOKIE-ECHO
1434 if ((asoc->c.my_vtag != new_asoc->c.my_vtag) && in sctp_tietags_compare()
1435 (asoc->c.peer_vtag != new_asoc->c.peer_vtag) && in sctp_tietags_compare()
1436 (asoc->c.my_vtag == new_asoc->c.my_ttag) && in sctp_tietags_compare()
1437 (asoc->c.peer_vtag == new_asoc->c.peer_ttag)) in sctp_tietags_compare()
1441 if ((asoc->c.my_vtag == new_asoc->c.my_vtag) && in sctp_tietags_compare()
1442 ((asoc->c.peer_vtag != new_asoc->c.peer_vtag) || in sctp_tietags_compare()
1443 (0 == asoc->c.peer_vtag))) { in sctp_tietags_compare()
1448 if ((asoc->c.my_vtag == new_asoc->c.my_vtag) && in sctp_tietags_compare()
1449 (asoc->c.peer_vtag == new_asoc->c.peer_vtag)) in sctp_tietags_compare()
1453 if ((asoc->c.my_vtag != new_asoc->c.my_vtag) && in sctp_tietags_compare()
1454 (asoc->c.peer_vtag == new_asoc->c.peer_vtag) && in sctp_tietags_compare()
1455 (0 == new_asoc->c.my_ttag) && in sctp_tietags_compare()
1456 (0 == new_asoc->c.peer_ttag)) in sctp_tietags_compare()
1483 chunk->skb)) in sctp_sf_do_unexpected_init()
1495 if (!chunk->singleton) in sctp_sf_do_unexpected_init()
1501 if (chunk->sctp_hdr->vtag != 0) in sctp_sf_do_unexpected_init()
1512 chunk->subh.init_hdr = (struct sctp_inithdr *)chunk->skb->data; in sctp_sf_do_unexpected_init()
1515 chunk->param_hdr.v = skb_pull(chunk->skb, sizeof(struct sctp_inithdr)); in sctp_sf_do_unexpected_init()
1519 if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, in sctp_sf_do_unexpected_init()
1520 (struct sctp_init_chunk *)chunk->chunk_hdr, chunk, in sctp_sf_do_unexpected_init()
1527 (__u8 *)(err_chunk->chunk_hdr) + in sctp_sf_do_unexpected_init()
1529 ntohs(err_chunk->chunk_hdr->length) - in sctp_sf_do_unexpected_init()
1564 * place (local tie-tag and per tie-tag) within the state cookie. in sctp_sf_do_unexpected_init()
1567 (struct sctp_init_chunk *)chunk->chunk_hdr, in sctp_sf_do_unexpected_init()
1572 * restart. Do not do this check for COOKIE-WAIT state, in sctp_sf_do_unexpected_init()
1593 len = ntohs(err_chunk->chunk_hdr->length) - in sctp_sf_do_unexpected_init()
1614 ((__u8 *)(err_chunk->chunk_hdr) + in sctp_sf_do_unexpected_init()
1651 * Section: 5.2.1 INIT received in COOKIE-WAIT or COOKIE-ECHOED State (Item B)
1656 * Upon receipt of an INIT in the COOKIE-WAIT or COOKIE-ECHOED state, an
1664 * After that, the endpoint MUST NOT change its state, the T1-init
1669 * For an endpoint that is in the COOKIE-ECHOED state it MUST populate
1670 * its Tie-Tags with the Tag information of itself and its peer (see
1671 * section 5.2.2 for a description of the Tie-Tags).
1703 * COOKIE-ECHOED and COOKIE-WAIT
1710 * the Peer's-Tie-Tag and the Local-Tie-Tag. The outbound SCTP packet
1722 * Note: Only when a TCB exists and the association is not in a COOKIE-
1723 * WAIT state are the Tie-Tags populated. For a normal association INIT
1724 * (i.e. the endpoint is in a COOKIE-WAIT state), the Tie-Tags MUST be
1755 * Unexpected INIT-ACK handler.
1759 * COOKIE-WAIT state, the endpoint should discard the INIT ACK chunk.
1772 * endpoint. If this is an OOTB INIT-ACK, treat it as such. in sctp_sf_do_5_2_3_initack()
1774 if (ep == sctp_sk(net->sctp.ctl_sock)->ep) in sctp_sf_do_5_2_3_initack()
1780 /* Unexpected COOKIE-ECHO handler for peer restart (Table 2, action 'A')
1799 /* new_asoc is a brand-new association, so these are not yet in sctp_sf_do_dupcook_a()
1800 * side effects--it is safe to run them here. in sctp_sf_do_dupcook_a()
1802 peer_init = &chunk->subh.cookie_hdr->c.peer_init[0]; in sctp_sf_do_dupcook_a()
1821 /* If the endpoint is in the SHUTDOWN-ACK-SENT state and recognizes in sctp_sf_do_dupcook_a()
1829 SCTP_ST_CHUNK(chunk->chunk_hdr->type), in sctp_sf_do_dupcook_a()
1844 /* For now, stop pending T3-rtx and SACK timers, fail any unsent/unacked in sctp_sf_do_dupcook_a()
1852 /* Stop pending T4-rto timer, teardown ASCONF queue, ASCONF-ACK queue in sctp_sf_do_dupcook_a()
1853 * and ASCONF-ACK cache. in sctp_sf_do_dupcook_a()
1865 new_asoc->c.sinit_num_ostreams, in sctp_sf_do_dupcook_a()
1866 new_asoc->c.sinit_max_instreams, in sctp_sf_do_dupcook_a()
1876 (sctp_sstate(asoc->base.sk, CLOSING) || in sctp_sf_do_dupcook_a()
1877 sock_flag(asoc->base.sk, SOCK_DEAD))) { in sctp_sf_do_dupcook_a()
1899 /* Unexpected COOKIE-ECHO handler for setup collision (Table 2, action 'B')
1918 /* new_asoc is a brand-new association, so these are not yet in sctp_sf_do_dupcook_b()
1919 * side effects--it is safe to run them here. in sctp_sf_do_dupcook_b()
1921 peer_init = &chunk->subh.cookie_hdr->c.peer_init[0]; in sctp_sf_do_dupcook_b()
1951 * Sadly, this needs to be implemented as a side-effect, because in sctp_sf_do_dupcook_b()
1967 if (asoc->peer.adaptation_ind) in sctp_sf_do_dupcook_b()
1970 if (!asoc->peer.auth_capable) in sctp_sf_do_dupcook_b()
1979 /* Unexpected COOKIE-ECHO handler for setup collision (Table 2, action 'C')
1984 * INIT-ACK and finally sent a COOKIE ECHO with the peer's same tag
2003 /* Unexpected COOKIE-ECHO handler lost chunk (Table 2, action 'D')
2024 * enter the ESTABLISHED state, if it is in the COOKIE-ECHOED state. in sctp_sf_do_dupcook_d()
2033 if (asoc->state < SCTP_STATE_ESTABLISHED) { in sctp_sf_do_dupcook_d()
2051 asoc->c.sinit_num_ostreams, in sctp_sf_do_dupcook_d()
2052 asoc->c.sinit_max_instreams, in sctp_sf_do_dupcook_d()
2062 if (asoc->peer.adaptation_ind) { in sctp_sf_do_dupcook_d()
2070 if (!asoc->peer.auth_capable) { in sctp_sf_do_dupcook_d()
2108 * Handle a duplicate COOKIE-ECHO. This usually means a cookie-carrying
2150 chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; in sctp_sf_do_5_2_4_dupcook()
2151 if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - in sctp_sf_do_5_2_4_dupcook()
2164 * If the re-build failed, what is the proper error path in sctp_sf_do_5_2_4_dupcook()
2167 * [We should abort the association. --piggy] in sctp_sf_do_5_2_4_dupcook()
2174 case -SCTP_IERROR_NOMEM: in sctp_sf_do_5_2_4_dupcook()
2177 case -SCTP_IERROR_STALE_COOKIE: in sctp_sf_do_5_2_4_dupcook()
2181 case -SCTP_IERROR_BAD_SIG: in sctp_sf_do_5_2_4_dupcook()
2189 chunk->skb)) { in sctp_sf_do_5_2_4_dupcook()
2195 new_asoc->temp = 1; in sctp_sf_do_5_2_4_dupcook()
2245 * Process an ABORT. (SHUTDOWN-PENDING state)
2275 /* ADD-IP: Special case for ABORT chunks in sctp_sf_shutdown_pending_abort()
2281 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest)) in sctp_sf_shutdown_pending_abort()
2291 * Process an ABORT. (SHUTDOWN-SENT state)
2321 /* ADD-IP: Special case for ABORT chunks in sctp_sf_shutdown_sent_abort()
2327 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest)) in sctp_sf_shutdown_sent_abort()
2333 /* Stop the T2-shutdown timer. */ in sctp_sf_shutdown_sent_abort()
2337 /* Stop the T5-shutdown guard timer. */ in sctp_sf_shutdown_sent_abort()
2345 * Process an ABORT. (SHUTDOWN-ACK-SENT state)
2358 * common function with the SHUTDOWN-SENT state. in sctp_sf_shutdown_ack_sent_abort()
2399 /* FUTURE FIXME: When PR-SCTP related and other optional in sctp_sf_cookie_echoed_err()
2403 sctp_walk_errors(err, chunk->chunk_hdr) { in sctp_sf_cookie_echoed_err()
2404 if (SCTP_ERROR_STALE_COOKIE == err->cause) in sctp_sf_cookie_echoed_err()
2421 * If the association is in the COOKIE-ECHOED state, the endpoint may elect
2450 int attempts = asoc->init_err_counter + 1; in sctp_sf_do_5_2_6_stale()
2457 if (attempts > asoc->max_init_attempts) { in sctp_sf_do_5_2_6_stale()
2465 err = (struct sctp_errhdr *)(chunk->skb->data); in sctp_sf_do_5_2_6_stale()
2474 * Suggested Cookie Life-span Increment's unit is msec. in sctp_sf_do_5_2_6_stale()
2489 bp = (struct sctp_bind_addr *) &asoc->base.bind_addr; in sctp_sf_do_5_2_6_stale()
2499 /* Stop pending T3-rtx and heartbeat timers */ in sctp_sf_do_5_2_6_stale()
2503 /* Delete non-primary peer ip addresses since we are transitioning in sctp_sf_do_5_2_6_stale()
2504 * back to the COOKIE-WAIT state in sctp_sf_do_5_2_6_stale()
2508 /* If we've sent any data bundled with COOKIE-ECHO we will need to in sctp_sf_do_5_2_6_stale()
2512 SCTP_TRANSPORT(asoc->peer.primary_path)); in sctp_sf_do_5_2_6_stale()
2545 * - The endpoint shall always fill in the Verification Tag field of the
2549 * - If the ABORT is sent in response to an OOTB packet, the endpoint
2552 * - The receiver MUST accept the packet if the Verification Tag
2591 /* ADD-IP: Special case for ABORT chunks in sctp_sf_do_9_1_abort()
2597 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest)) in sctp_sf_do_9_1_abort()
2619 len = ntohs(chunk->chunk_hdr->length); in __sctp_sf_do_9_1_abort()
2621 error = ((struct sctp_errhdr *)chunk->skb->data)->cause; in __sctp_sf_do_9_1_abort()
2633 * Process an ABORT. (COOKIE-WAIT state)
2666 len = ntohs(chunk->chunk_hdr->length); in sctp_sf_cookie_wait_abort()
2668 error = ((struct sctp_errhdr *)chunk->skb->data)->cause; in sctp_sf_cookie_wait_abort()
2671 chunk->transport); in sctp_sf_cookie_wait_abort()
2675 * Process an incoming ICMP as an ABORT. (COOKIE-WAIT state)
2691 * Process an ABORT. (COOKIE-ECHOED state)
2702 * common function with the COOKIE-WAIT state. in sctp_sf_cookie_echoed_abort()
2739 * - enter the SHUTDOWN-RECEIVED state,
2741 * - stop accepting new data from its SCTP user
2743 * - verify, by checking the Cumulative TSN Ack field of the chunk,
2747 * Once an endpoint as reached the SHUTDOWN-RECEIVED state it MUST NOT
2790 sdh = (struct sctp_shutdownhdr *)chunk->skb->data; in sctp_sf_do_9_2_shutdown()
2791 skb_pull(chunk->skb, sizeof(*sdh)); in sctp_sf_do_9_2_shutdown()
2792 chunk->subh.shutdown_hdr = sdh; in sctp_sf_do_9_2_shutdown()
2793 ctsn = ntohl(sdh->cum_tsn_ack); in sctp_sf_do_9_2_shutdown()
2795 if (TSN_lt(ctsn, asoc->ctsn_ack_point)) { in sctp_sf_do_9_2_shutdown()
2797 asoc->ctsn_ack_point); in sctp_sf_do_9_2_shutdown()
2802 /* If Cumulative TSN Ack beyond the max tsn currently in sctp_sf_do_9_2_shutdown()
2806 if (!TSN_lt(ctsn, asoc->next_tsn)) in sctp_sf_do_9_2_shutdown()
2821 * - enter the SHUTDOWN-RECEIVED state, in sctp_sf_do_9_2_shutdown()
2822 * - stop accepting new data from its SCTP user in sctp_sf_do_9_2_shutdown()
2830 if (sctp_outq_is_empty(&asoc->outqueue)) { in sctp_sf_do_9_2_shutdown()
2838 /* - verify, by checking the Cumulative TSN Ack field of the in sctp_sf_do_9_2_shutdown()
2843 SCTP_BE32(chunk->subh.shutdown_hdr->cum_tsn_ack)); in sctp_sf_do_9_2_shutdown()
2852 * Once an endpoint has reached the SHUTDOWN-RECEIVED state,
2854 * The Cumulative TSN Ack of the received SHUTDOWN chunk
2877 sdh = (struct sctp_shutdownhdr *)chunk->skb->data; in sctp_sf_do_9_2_shut_ctsn()
2878 ctsn = ntohl(sdh->cum_tsn_ack); in sctp_sf_do_9_2_shut_ctsn()
2880 if (TSN_lt(ctsn, asoc->ctsn_ack_point)) { in sctp_sf_do_9_2_shut_ctsn()
2882 asoc->ctsn_ack_point); in sctp_sf_do_9_2_shut_ctsn()
2887 /* If Cumulative TSN Ack beyond the max tsn currently in sctp_sf_do_9_2_shut_ctsn()
2891 if (!TSN_lt(ctsn, asoc->next_tsn)) in sctp_sf_do_9_2_shut_ctsn()
2894 /* verify, by checking the Cumulative TSN Ack field of the in sctp_sf_do_9_2_shut_ctsn()
2899 SCTP_BE32(sdh->cum_tsn_ack)); in sctp_sf_do_9_2_shut_ctsn()
2905 * If an endpoint is in SHUTDOWN-ACK-SENT state and receives an INIT chunk
2936 * the T2-SHUTDOWN timer. in sctp_sf_do_9_2_reshutack()
2940 /* and restart the T2-shutdown timer. */ in sctp_sf_do_9_2_reshutack()
2962 * This chunk contains one data element, i.e. the TSN number that
2964 * TSN number in the datagram that was originally marked with the
2994 cwr = (struct sctp_cwrhdr *)chunk->skb->data; in sctp_sf_do_ecn_cwr()
2995 skb_pull(chunk->skb, sizeof(*cwr)); in sctp_sf_do_ecn_cwr()
2997 lowest_tsn = ntohl(cwr->lowest_tsn); in sctp_sf_do_ecn_cwr()
3000 if (TSN_lte(asoc->last_ecne_tsn, lowest_tsn)) { in sctp_sf_do_ecn_cwr()
3014 * ECN-Echo
3020 * contains one data element, i.e. the lowest TSN associated with the IP
3048 ecne = (struct sctp_ecnehdr *)chunk->skb->data; in sctp_sf_do_ecne()
3049 skb_pull(chunk->skb, sizeof(*ecne)); in sctp_sf_do_ecne()
3053 SCTP_U32(ntohl(ecne->lowest_tsn))); in sctp_sf_do_ecne()
3105 if (!sctp_chunk_length_valid(chunk, sctp_datachk_len(&asoc->stream))) in sctp_sf_eat_data_6_2()
3125 (u8 *)chunk->subh.data_hdr, in sctp_sf_eat_data_6_2()
3126 sctp_datahdr_len(&asoc->stream)); in sctp_sf_eat_data_6_2()
3131 if (chunk->chunk_hdr->flags & SCTP_DATA_SACK_IMM) in sctp_sf_eat_data_6_2()
3134 if (asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) { in sctp_sf_eat_data_6_2()
3161 if (chunk->end_of_packet) in sctp_sf_eat_data_6_2()
3175 * and the peer's RTO has expired. The duplicate TSN number(s) in sctp_sf_eat_data_6_2()
3181 if (chunk->end_of_packet) in sctp_sf_eat_data_6_2()
3186 if (chunk->end_of_packet) in sctp_sf_eat_data_6_2()
3196 * (4) In SHUTDOWN-SENT state the endpoint MUST acknowledge any received
3225 if (!sctp_chunk_length_valid(chunk, sctp_datachk_len(&asoc->stream))) in sctp_sf_eat_data_fast_4_4()
3241 (u8 *)chunk->subh.data_hdr, in sctp_sf_eat_data_fast_4_4()
3242 sctp_datahdr_len(&asoc->stream)); in sctp_sf_eat_data_fast_4_4()
3251 * While in SHUTDOWN-SENT state, the SHUTDOWN sender MUST immediately in sctp_sf_eat_data_fast_4_4()
3253 * with a SACK, a SHUTDOWN chunk, and restart the T2-shutdown timer in sctp_sf_eat_data_fast_4_4()
3255 if (chunk->end_of_packet) { in sctp_sf_eat_data_fast_4_4()
3257 * TSN has not been updated yet. in sctp_sf_eat_data_fast_4_4()
3272 * i) If Cumulative TSN Ack is less than the Cumulative TSN Ack Point,
3273 * then drop the SACK. Since Cumulative TSN Ack is monotonically
3274 * increasing, a SACK whose Cumulative TSN Ack is less than the
3275 * Cumulative TSN Ack Point indicates an out-of-order SACK.
3278 * of bytes still outstanding after processing the Cumulative TSN Ack
3281 * iii) If the SACK is missing a TSN that was previously
3287 * chunk was originally transmitted, then T3-rtx is started for
3326 chunk->subh.sack_hdr = sackh; in sctp_sf_eat_sack_6_2()
3327 ctsn = ntohl(sackh->cum_tsn_ack); in sctp_sf_eat_sack_6_2()
3329 /* i) If Cumulative TSN Ack is less than the Cumulative TSN in sctp_sf_eat_sack_6_2()
3330 * Ack Point, then drop the SACK. Since Cumulative TSN in sctp_sf_eat_sack_6_2()
3332 * Cumulative TSN Ack is less than the Cumulative TSN Ack in sctp_sf_eat_sack_6_2()
3333 * Point indicates an out-of-order SACK. in sctp_sf_eat_sack_6_2()
3335 if (TSN_lt(ctsn, asoc->ctsn_ack_point)) { in sctp_sf_eat_sack_6_2()
3337 asoc->ctsn_ack_point); in sctp_sf_eat_sack_6_2()
3342 /* If Cumulative TSN Ack beyond the max tsn currently in sctp_sf_eat_sack_6_2()
3346 if (!TSN_lt(ctsn, asoc->next_tsn)) in sctp_sf_eat_sack_6_2()
3367 * packet and set the T-bit in the Chunk Flags to indicate that the
3401 /* Reflect vtag if T-Bit is set */ in sctp_sf_tabort_8_4_8()
3403 packet->vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_sf_tabort_8_4_8()
3406 abort->skb->sk = ep->base.sk; in sctp_sf_tabort_8_4_8()
3423 * API 5.3.1.3 - SCTP_REMOTE_ERROR
3444 sctp_walk_errors(err, chunk->chunk_hdr); in sctp_sf_operr_notify()
3445 if ((void *)err != (void *)chunk->chunk_end) in sctp_sf_operr_notify()
3460 * stop the T2-shutdown timer, send a SHUTDOWN COMPLETE chunk to its
3504 * stop the T2-shutdown timer, in sctp_sf_do_9_2_final()
3529 * RFC 2960, 8.4 - Handle "Out of the blue" Packets, sctpimpguide 2.41.
3536 * set the T-bit in the Chunk Flags to indicate that the Verification
3543 * packet and set the T-bit in the Chunk Flags to indicate that the
3555 struct sk_buff *skb = chunk->skb; in sctp_sf_ootb()
3564 ch = (struct sctp_chunkhdr *)chunk->chunk_hdr; in sctp_sf_ootb()
3567 if (ntohs(ch->length) < sizeof(*ch)) in sctp_sf_ootb()
3572 ch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length)); in sctp_sf_ootb()
3580 if (SCTP_CID_SHUTDOWN_ACK == ch->type) in sctp_sf_ootb()
3588 if (SCTP_CID_ABORT == ch->type) in sctp_sf_ootb()
3596 if (SCTP_CID_COOKIE_ACK == ch->type) in sctp_sf_ootb()
3599 if (SCTP_CID_ERROR == ch->type) { in sctp_sf_ootb()
3601 if (SCTP_ERROR_STALE_COOKIE == err->cause) { in sctp_sf_ootb()
3629 * set the T-bit in the Chunk Flags to indicate that the Verification
3665 /* Reflect vtag if T-Bit is set */ in sctp_sf_shut_8_4_5()
3667 packet->vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_sf_shut_8_4_5()
3670 shut->skb->sk = ep->base.sk; in sctp_sf_shut_8_4_5()
3696 * If the receiver is in COOKIE-ECHOED or COOKIE-WAIT state the
3700 * chunks. --piggy ]
3747 /* ADD-IP: Section 4.1.1 in sctp_sf_do_asconf()
3749 * the mechanism defined in [I-D.ietf-tsvwg-sctp-auth]. If this chunk in sctp_sf_do_asconf()
3751 * described in [I-D.ietf-tsvwg-sctp-auth]. in sctp_sf_do_asconf()
3753 if (!net->sctp.addip_noauth && !chunk->auth) in sctp_sf_do_asconf()
3762 hdr = (struct sctp_addiphdr *)chunk->skb->data; in sctp_sf_do_asconf()
3763 serial = ntohl(hdr->serial); in sctp_sf_do_asconf()
3772 * 'Peer-Serial-Number'. in sctp_sf_do_asconf()
3774 if (serial == asoc->peer.addip_serial + 1) { in sctp_sf_do_asconf()
3776 * we can clean our old ASCONF-ACKs. in sctp_sf_do_asconf()
3778 if (!chunk->has_asconf) in sctp_sf_do_asconf()
3783 * processing the ASCONF Chunk, append an ASCONF-ACK Chunk to in sctp_sf_do_asconf()
3787 * Essentially, do V1-V5. in sctp_sf_do_asconf()
3793 } else if (serial < asoc->peer.addip_serial + 1) { in sctp_sf_do_asconf()
3796 * ('Peer- Sequence-Number' + 1), simply skip to the next in sctp_sf_do_asconf()
3798 * any previously cached ASCONF-ACK response that was in sctp_sf_do_asconf()
3800 * ASCONF. Note: It is possible that no cached ASCONF-ACK in sctp_sf_do_asconf()
3803 * should skip the ASCONF Chunk and not include ASCONF-ACK in sctp_sf_do_asconf()
3806 asconf_ack = sctp_assoc_lookup_asconf_ack(asoc, hdr->serial); in sctp_sf_do_asconf()
3814 asconf_ack->transport = NULL; in sctp_sf_do_asconf()
3823 * containing the ASCONF-ACK Chunks MUST be the source address of in sctp_sf_do_asconf()
3831 asconf_ack->dest = chunk->source; in sctp_sf_do_asconf()
3833 if (asoc->new_transport) { in sctp_sf_do_asconf()
3834 sctp_sf_heartbeat(ep, asoc, type, asoc->new_transport, commands); in sctp_sf_do_asconf()
3835 ((struct sctp_association *)asoc)->new_transport = NULL; in sctp_sf_do_asconf()
3851 if (list_empty(&asoc->addip_chunk_list)) in sctp_send_next_asconf()
3854 entry = asoc->addip_chunk_list.next; in sctp_send_next_asconf()
3859 asoc->addip_last_asconf = asconf; in sctp_send_next_asconf()
3876 struct sctp_chunk *last_asconf = asoc->addip_last_asconf; in sctp_sf_do_asconf_ack()
3889 /* ADD-IP, Section 4.1.2: in sctp_sf_do_asconf_ack()
3891 * the mechanism defined in [I-D.ietf-tsvwg-sctp-auth]. If this chunk in sctp_sf_do_asconf_ack()
3893 * described in [I-D.ietf-tsvwg-sctp-auth]. in sctp_sf_do_asconf_ack()
3895 if (!net->sctp.addip_noauth && !asconf_ack->auth) in sctp_sf_do_asconf_ack()
3905 addip_hdr = (struct sctp_addiphdr *)asconf_ack->skb->data; in sctp_sf_do_asconf_ack()
3906 rcvd_serial = ntohl(addip_hdr->serial); in sctp_sf_do_asconf_ack()
3908 /* Verify the ASCONF-ACK chunk before processing it. */ in sctp_sf_do_asconf_ack()
3914 addip_hdr = (struct sctp_addiphdr *)last_asconf->subh.addip_hdr; in sctp_sf_do_asconf_ack()
3915 sent_serial = ntohl(addip_hdr->serial); in sctp_sf_do_asconf_ack()
3917 sent_serial = asoc->addip_serial - 1; in sctp_sf_do_asconf_ack()
3920 /* D0) If an endpoint receives an ASCONF-ACK that is greater than or in sctp_sf_do_asconf_ack()
3923 * sequence number is greater than if it is no more than 2^^31-1 in sctp_sf_do_asconf_ack()
3927 !(asoc->addip_last_asconf)) { in sctp_sf_do_asconf_ack()
3950 if ((rcvd_serial == sent_serial) && asoc->addip_last_asconf) { in sctp_sf_do_asconf_ack()
3983 /* RE-CONFIG Section 5.2 Upon reception of an RECONF Chunk. */
4011 hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr; in sctp_sf_do_reconf()
4016 if (param.p->type == SCTP_PARAM_RESET_OUT_REQUEST) in sctp_sf_do_reconf()
4019 else if (param.p->type == SCTP_PARAM_RESET_IN_REQUEST) in sctp_sf_do_reconf()
4022 else if (param.p->type == SCTP_PARAM_RESET_TSN_REQUEST) in sctp_sf_do_reconf()
4025 else if (param.p->type == SCTP_PARAM_RESET_ADD_OUT_STREAMS) in sctp_sf_do_reconf()
4028 else if (param.p->type == SCTP_PARAM_RESET_ADD_IN_STREAMS) in sctp_sf_do_reconf()
4031 else if (param.p->type == SCTP_PARAM_RESET_RESPONSE) in sctp_sf_do_reconf()
4048 * PR-SCTP Section 3.6 Receiver Side Implementation of PR-SCTP
4050 * When a FORWARD TSN chunk arrives, the data receiver MUST first update
4051 * its cumulative TSN point to the value carried in the FORWARD TSN
4052 * chunk, and then MUST further advance its cumulative TSN point locally
4055 * missing TSNs earlier than or equal to the new cumulative TSN point.
4071 __u32 tsn; in sctp_sf_eat_fwd_tsn() local
4079 if (!asoc->peer.prsctp_capable) in sctp_sf_eat_fwd_tsn()
4083 if (!sctp_chunk_length_valid(chunk, sctp_ftsnchk_len(&asoc->stream))) in sctp_sf_eat_fwd_tsn()
4087 fwdtsn_hdr = (struct sctp_fwdtsn_hdr *)chunk->skb->data; in sctp_sf_eat_fwd_tsn()
4088 chunk->subh.fwdtsn_hdr = fwdtsn_hdr; in sctp_sf_eat_fwd_tsn()
4089 len = ntohs(chunk->chunk_hdr->length); in sctp_sf_eat_fwd_tsn()
4090 len -= sizeof(struct sctp_chunkhdr); in sctp_sf_eat_fwd_tsn()
4091 skb_pull(chunk->skb, len); in sctp_sf_eat_fwd_tsn()
4093 tsn = ntohl(fwdtsn_hdr->new_cum_tsn); in sctp_sf_eat_fwd_tsn()
4094 pr_debug("%s: TSN 0x%x\n", __func__, tsn); in sctp_sf_eat_fwd_tsn()
4096 /* The TSN is too high--silently discard the chunk and count on it in sctp_sf_eat_fwd_tsn()
4099 if (sctp_tsnmap_check(&asoc->peer.tsn_map, tsn) < 0) in sctp_sf_eat_fwd_tsn()
4102 if (!asoc->stream.si->validate_ftsn(chunk)) in sctp_sf_eat_fwd_tsn()
4105 sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_FWDTSN, SCTP_U32(tsn)); in sctp_sf_eat_fwd_tsn()
4106 if (len > sctp_ftsnhdr_len(&asoc->stream)) in sctp_sf_eat_fwd_tsn()
4111 if (asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) { in sctp_sf_eat_fwd_tsn()
4138 __u32 tsn; in sctp_sf_eat_fwd_tsn_fast() local
4146 if (!asoc->peer.prsctp_capable) in sctp_sf_eat_fwd_tsn_fast()
4150 if (!sctp_chunk_length_valid(chunk, sctp_ftsnchk_len(&asoc->stream))) in sctp_sf_eat_fwd_tsn_fast()
4154 fwdtsn_hdr = (struct sctp_fwdtsn_hdr *)chunk->skb->data; in sctp_sf_eat_fwd_tsn_fast()
4155 chunk->subh.fwdtsn_hdr = fwdtsn_hdr; in sctp_sf_eat_fwd_tsn_fast()
4156 len = ntohs(chunk->chunk_hdr->length); in sctp_sf_eat_fwd_tsn_fast()
4157 len -= sizeof(struct sctp_chunkhdr); in sctp_sf_eat_fwd_tsn_fast()
4158 skb_pull(chunk->skb, len); in sctp_sf_eat_fwd_tsn_fast()
4160 tsn = ntohl(fwdtsn_hdr->new_cum_tsn); in sctp_sf_eat_fwd_tsn_fast()
4161 pr_debug("%s: TSN 0x%x\n", __func__, tsn); in sctp_sf_eat_fwd_tsn_fast()
4163 /* The TSN is too high--silently discard the chunk and count on it in sctp_sf_eat_fwd_tsn_fast()
4166 if (sctp_tsnmap_check(&asoc->peer.tsn_map, tsn) < 0) in sctp_sf_eat_fwd_tsn_fast()
4169 if (!asoc->stream.si->validate_ftsn(chunk)) in sctp_sf_eat_fwd_tsn_fast()
4172 sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_FWDTSN, SCTP_U32(tsn)); in sctp_sf_eat_fwd_tsn_fast()
4173 if (len > sctp_ftsnhdr_len(&asoc->stream)) in sctp_sf_eat_fwd_tsn_fast()
4181 * While in SHUTDOWN-SENT state, the SHUTDOWN sender MUST immediately in sctp_sf_eat_fwd_tsn_fast()
4183 * with a SACK, a SHUTDOWN chunk, and restart the T2-shutdown timer in sctp_sf_eat_fwd_tsn_fast()
4194 * SCTP-AUTH Section 6.3 Receiving authenticated chukns
4198 * receiver in the HMAC-ALGO parameter in the INIT or INIT-ACK chunk
4227 auth_hdr = (struct sctp_authhdr *)chunk->skb->data; in sctp_sf_authenticate()
4228 chunk->subh.auth_hdr = auth_hdr; in sctp_sf_authenticate()
4229 skb_pull(chunk->skb, sizeof(*auth_hdr)); in sctp_sf_authenticate()
4234 if (!sctp_auth_asoc_verify_hmac_id(asoc, auth_hdr->hmac_id)) in sctp_sf_authenticate()
4240 key_id = ntohs(auth_hdr->shkey_id); in sctp_sf_authenticate()
4241 if (key_id != asoc->active_key_id) { in sctp_sf_authenticate()
4250 sig_len = ntohs(chunk->chunk_hdr->length) - in sctp_sf_authenticate()
4252 hmac = sctp_auth_get_hmac(ntohs(auth_hdr->hmac_id)); in sctp_sf_authenticate()
4253 if (sig_len != hmac->hmac_len) in sctp_sf_authenticate()
4263 digest = auth_hdr->hmac; in sctp_sf_authenticate()
4264 skb_pull(chunk->skb, sig_len); in sctp_sf_authenticate()
4272 sctp_auth_calculate_hmac(asoc, chunk->skb, in sctp_sf_authenticate()
4273 (struct sctp_auth_chunk *)chunk->chunk_hdr, in sctp_sf_authenticate()
4283 chunk->auth = 1; in sctp_sf_authenticate()
4301 /* Make sure that the peer has AUTH capable */ in sctp_sf_eat_auth()
4302 if (!asoc->peer.auth_capable) in sctp_sf_eat_auth()
4316 auth_hdr = (struct sctp_authhdr *)chunk->skb->data; in sctp_sf_eat_auth()
4325 &auth_hdr->hmac_id, in sctp_sf_eat_auth()
4347 if (asoc->active_key_id != ntohs(auth_hdr->shkey_id)) { in sctp_sf_eat_auth()
4350 ev = sctp_ulpevent_make_authkey(asoc, ntohs(auth_hdr->shkey_id), in sctp_sf_eat_auth()
4354 return -ENOMEM; in sctp_sf_eat_auth()
4368 * Chunk Types are encoded such that the highest-order two bits specify
4372 * 00 - Stop processing this SCTP packet and discard it, do not process
4375 * 01 - Stop processing this SCTP packet and discard it, do not process
4379 * 10 - Skip this chunk and continue processing.
4381 * 11 - Skip this chunk and continue processing, but report in an ERROR
4416 hdr = unk_chunk->chunk_hdr; in sctp_sf_unk_chunk()
4419 SCTP_PAD4(ntohs(hdr->length)), in sctp_sf_unk_chunk()
4434 hdr = unk_chunk->chunk_hdr; in sctp_sf_unk_chunk()
4437 SCTP_PAD4(ntohs(hdr->length)), in sctp_sf_unk_chunk()
4566 /* SCTP-AUTH, Section 6.3: in sctp_sf_abort_violation()
4586 /* Treat INIT-ACK as a special case during COOKIE-WAIT. */ in sctp_sf_abort_violation()
4587 if (chunk->chunk_hdr->type == SCTP_CID_INIT_ACK && in sctp_sf_abort_violation()
4588 !asoc->peer.i.init_tag) { in sctp_sf_abort_violation()
4591 initack = (struct sctp_initack_chunk *)chunk->chunk_hdr; in sctp_sf_abort_violation()
4593 abort->chunk_hdr->flags |= SCTP_CHUNK_FLAG_T; in sctp_sf_abort_violation()
4597 inittag = ntohl(initack->init_hdr.init_tag); in sctp_sf_abort_violation()
4606 if (asoc->state <= SCTP_STATE_COOKIE_ECHOED) { in sctp_sf_abort_violation()
4627 packet->vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_sf_abort_violation()
4629 abort->skb->sk = ep->base.sk; in sctp_sf_abort_violation()
4728 * cumulative tsn ack to a point beyond the max tsn currently sent.
4741 static const char err_str[] = "The cumulative tsn ack beyond the max tsn currently sent:"; in sctp_sf_violation_ctsn()
4748 * when we have an association and we receive bundled INIT-ACK, or
4749 * SHUDOWN-COMPLETE, our peer is clearly violationg the "MUST NOT bundle"
4775 * Section: 10.1 ULP-to-SCTP
4780 * -> association id [,destination transport addr list] [,outbound stream
4809 * stuff happens when the INIT ACK arrives. This is a NON-BLOCKING
4814 * o local SCTP instance name - obtained from the INITIALIZE operation.
4816 * o destination transport addr - specified as one of the transport
4819 * [This is asoc->peer.active_path.]
4820 * o outbound stream count - the number of outbound streams the ULP
4839 /* The comment below says that we enter COOKIE-WAIT AFTER in sctp_sf_do_prm_asoc()
4854 repl = sctp_make_init(asoc, &asoc->base.bind_addr, GFP_ATOMIC, 0); in sctp_sf_do_prm_asoc()
4868 /* After sending the INIT, "A" starts the T1-init timer and in sctp_sf_do_prm_asoc()
4869 * enters the COOKIE-WAIT state. in sctp_sf_do_prm_asoc()
4883 * Section: 10.1 ULP-to-SCTP
4888 * [,unorder flag] [,no-bundle flag] [,payload protocol-id] )
4889 * -> result
4895 * o association id - local handle to the SCTP association
4897 * o buffer address - the location where the user message to be
4900 * o byte count - The size of the user data in number of bytes;
4904 * o context - an optional 32 bit integer that will be carried in the
4908 * o stream id - to indicate which stream to send the data on. If not
4911 * o life time - specifies the life time of the user data. The user data
4920 * o destination transport address - specified as one of the destination
4926 * o unorder flag - this flag, if present, indicates that the user
4931 * o no-bundle flag - instructs SCTP not to bundle this user data with
4935 * o payload protocol-id - A 32 bit unsigned integer that is to be
4961 * -> result
4972 * o association id - local handle to the SCTP association
4992 * layer, the endpoint enters SHUTDOWN-PENDING state and in sctp_sf_do_9_2_prm_shutdown()
5002 if (sctp_outq_is_empty(&asoc->outqueue)) { in sctp_sf_do_9_2_prm_shutdown()
5017 * -> result
5027 * o association id - local handle to the SCTP association
5031 * o cause code - reason of the abort to be passed to the peer
5082 sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_ERROR, SCTP_ERROR(-EINVAL)); in sctp_sf_error_closed()
5098 SCTP_ERROR(-ESHUTDOWN)); in sctp_sf_error_shutdown()
5160 * common function with the COOKIE-WAIT state. in sctp_sf_cookie_echoed_prm_shutdown()
5189 /* Stop T1-init timer */ in sctp_sf_cookie_wait_prm_abort()
5237 * common function with the COOKIE-WAIT state. in sctp_sf_cookie_echoed_prm_abort()
5249 * state table when someone issues an abort while in SHUTDOWN-PENDING state.
5262 /* Stop the T5-shutdown guard timer. */ in sctp_sf_shutdown_pending_prm_abort()
5276 * state table when someone issues an abort while in SHUTDOWN-SENT state.
5289 /* Stop the T2-shutdown timer. */ in sctp_sf_shutdown_sent_prm_abort()
5293 /* Stop the T5-shutdown guard timer. */ in sctp_sf_shutdown_sent_prm_abort()
5321 * common function with the SHUTDOWN-SENT state. in sctp_sf_shutdown_ack_sent_prm_abort()
5329 * 10.1 ULP-to-SCTP
5334 * -> result
5343 * o association id - local handle to the SCTP association
5345 * o destination transport address - the transport address of the
5363 * D) Request an on-demand HEARTBEAT on a specific destination in sctp_sf_do_prm_requestheartbeat()
5397 /* RE-CONFIG Section 5.1 RECONF Chunk Procedures */
5465 * TSN Ack field the last sequential TSN it has received from the peer.
5466 * It shall then start the T2-shutdown timer and enter the SHUTDOWN-SENT
5467 * state. If the timer expires, the endpoint must re-send the SHUTDOWN
5468 * with the updated last sequential TSN received from its peer.
5484 * in the Cumulative TSN Ack field the last sequential TSN it in sctp_sf_do_9_2_start_shutdown()
5492 * T2-shutdown timer. in sctp_sf_do_9_2_start_shutdown()
5496 /* It shall then start the T2-shutdown timer */ in sctp_sf_do_9_2_start_shutdown()
5502 * 'T5-shutdown-guard' to bound the overall time for shutdown sequence. in sctp_sf_do_9_2_start_shutdown()
5507 if (asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) in sctp_sf_do_9_2_start_shutdown()
5511 /* and enter the SHUTDOWN-SENT state. */ in sctp_sf_do_9_2_start_shutdown()
5515 /* sctp-implguide 2.10 Issues with Heartbeating and failover in sctp_sf_do_9_2_start_shutdown()
5518 * or SHUTDOWN-ACK. in sctp_sf_do_9_2_start_shutdown()
5536 * shall send a SHUTDOWN ACK and start a T2-shutdown timer of its own,
5537 * entering the SHUTDOWN-ACK-SENT state. If the timer expires, the
5538 * endpoint must re-send the SHUTDOWN ACK.
5580 * the T2-shutdown timer. in sctp_sf_do_9_2_shutdown_ack()
5584 /* and start/restart a T2-shutdown timer of its own, */ in sctp_sf_do_9_2_shutdown_ack()
5588 if (asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) in sctp_sf_do_9_2_shutdown_ack()
5592 /* Enter the SHUTDOWN-ACK-SENT state. */ in sctp_sf_do_9_2_shutdown_ack()
5596 /* sctp-implguide 2.10 Issues with Heartbeating and failover in sctp_sf_do_9_2_shutdown_ack()
5599 * or SHUTDOWN-ACK. in sctp_sf_do_9_2_shutdown_ack()
5636 * Section: 6.3.3 Handle T3-rtx Expiration
5638 * Whenever the retransmission timer T3-rtx expires for a destination
5655 if (asoc->overall_error_count >= asoc->max_retrans) { in sctp_sf_do_6_3_3_rtx()
5656 if (asoc->peer.zero_window_announced && in sctp_sf_do_6_3_3_rtx()
5657 asoc->state == SCTP_STATE_SHUTDOWN_PENDING) { in sctp_sf_do_6_3_3_rtx()
5683 * 7.2.3 and set the cwnd <- MTU. in sctp_sf_do_6_3_3_rtx()
5687 * expires, set RTO <- RTO * 2 ("back off the timer"). The in sctp_sf_do_6_3_3_rtx()
5692 /* E3) Determine how many of the earliest (i.e., lowest TSN) in sctp_sf_do_6_3_3_rtx()
5694 * T3-rtx has expired will fit into a single packet, subject in sctp_sf_do_6_3_3_rtx()
5703 * which the T3-rtx timer expired but did not fit in one MTU in sctp_sf_do_6_3_3_rtx()
5753 * 2) If the T1-init timer expires, the endpoint MUST retransmit INIT
5754 * and re-start the T1-init timer without changing state. This MUST
5771 int attempts = asoc->init_err_counter + 1; in sctp_sf_t1_init_timer_expire()
5779 if (attempts <= asoc->max_init_attempts) { in sctp_sf_t1_init_timer_expire()
5780 bp = (struct sctp_bind_addr *) &asoc->base.bind_addr; in sctp_sf_t1_init_timer_expire()
5797 asoc->max_init_attempts); in sctp_sf_t1_init_timer_expire()
5818 * 3) If the T1-cookie timer expires, the endpoint MUST retransmit
5819 * COOKIE ECHO and re-start the T1-cookie timer without changing
5836 int attempts = asoc->init_err_counter + 1; in sctp_sf_t1_cookie_timer_expire()
5839 pr_debug("%s: timer T1 expired (COOKIE-ECHO)\n", __func__); in sctp_sf_t1_cookie_timer_expire()
5843 if (attempts <= asoc->max_init_attempts) { in sctp_sf_t1_cookie_timer_expire()
5866 /* RFC2960 9.2 If the timer expires, the endpoint must re-send the SHUTDOWN
5867 * with the updated last sequential TSN received from its peer.
5876 * the T2-Shutdown timer, giving its peer ample opportunity to transmit
5893 ((struct sctp_association *)asoc)->shutdown_retries++; in sctp_sf_t2_timer_expire()
5895 if (asoc->overall_error_count >= asoc->max_retrans) { in sctp_sf_t2_timer_expire()
5906 switch (asoc->state) { in sctp_sf_t2_timer_expire()
5927 if (asoc->shutdown_last_sent_to) in sctp_sf_t2_timer_expire()
5929 SCTP_TRANSPORT(asoc->shutdown_last_sent_to)); in sctp_sf_t2_timer_expire()
5932 * the T2-shutdown timer. in sctp_sf_t2_timer_expire()
5936 /* Restart the T2-shutdown timer. */ in sctp_sf_t2_timer_expire()
5958 struct sctp_chunk *chunk = asoc->addip_last_asconf; in sctp_sf_t4_timer_expire()
5959 struct sctp_transport *transport = chunk->transport; in sctp_sf_t4_timer_expire()
5979 if (asoc->overall_error_count >= asoc->max_retrans) { in sctp_sf_t4_timer_expire()
5991 /* ADDIP 4.1 B3) Back-off the destination address RTO value to which in sctp_sf_t4_timer_expire()
5996 /* ADDIP 4.1 B4) Re-transmit the ASCONF Chunk last sent and if possible in sctp_sf_t4_timer_expire()
6002 sctp_chunk_hold(asoc->addip_last_asconf); in sctp_sf_t4_timer_expire()
6004 SCTP_CHUNK(asoc->addip_last_asconf)); in sctp_sf_t4_timer_expire()
6006 /* ADDIP 4.1 B5) Restart the T-4 RTO timer. Note that if a different in sctp_sf_t4_timer_expire()
6016 /* sctpimpguide-05 Section 2.12.2
6018 * 'T5-shutdown-guard' to bound the overall time for shutdown sequence.
6073 * layer, the endpoint enters SHUTDOWN-PENDING state and in sctp_sf_autoclose_timer_expire()
6083 if (sctp_outq_is_empty(&asoc->outqueue)) { in sctp_sf_autoclose_timer_expire()
6167 sack = (struct sctp_sackhdr *) chunk->skb->data; in sctp_sm_pull_sack()
6169 num_blocks = ntohs(sack->num_gap_ack_blocks); in sctp_sm_pull_sack()
6170 num_dup_tsns = ntohs(sack->num_dup_tsns); in sctp_sm_pull_sack()
6173 if (len > chunk->skb->len) in sctp_sm_pull_sack()
6176 skb_pull(chunk->skb, len); in sctp_sm_pull_sack()
6206 /* Reflect vtag if T-Bit is set */ in sctp_abort_pkt_new()
6208 packet->vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_abort_pkt_new()
6216 abort->skb->sk = ep->base.sk; in sctp_abort_pkt_new()
6237 sport = ntohs(chunk->sctp_hdr->dest); in sctp_ootb_pkt_new()
6238 dport = ntohs(chunk->sctp_hdr->source); in sctp_ootb_pkt_new()
6240 /* The V-tag is going to be the same as the inbound packet if no in sctp_ootb_pkt_new()
6244 /* Special case the INIT-ACK as there is no peer's vtag in sctp_ootb_pkt_new()
6247 switch (chunk->chunk_hdr->type) { in sctp_ootb_pkt_new()
6252 initack = (struct sctp_initack_chunk *)chunk->chunk_hdr; in sctp_ootb_pkt_new()
6253 vtag = ntohl(initack->init_hdr.init_tag); in sctp_ootb_pkt_new()
6257 vtag = asoc->peer.i.init_tag; in sctp_ootb_pkt_new()
6264 switch (chunk->chunk_hdr->type) { in sctp_ootb_pkt_new()
6269 init = (struct sctp_init_chunk *)chunk->chunk_hdr; in sctp_ootb_pkt_new()
6270 vtag = ntohl(init->init_hdr.init_tag); in sctp_ootb_pkt_new()
6274 vtag = ntohl(chunk->sctp_hdr->vtag); in sctp_ootb_pkt_new()
6287 sctp_transport_route(transport, (union sctp_addr *)&chunk->dest, in sctp_ootb_pkt_new()
6288 sctp_sk(net->sctp.ctl_sock)); in sctp_ootb_pkt_new()
6290 packet = &transport->packet; in sctp_ootb_pkt_new()
6303 sctp_transport_free(packet->transport); in sctp_ootb_pkt_free()
6322 cookie = chunk->subh.cookie_hdr; in sctp_send_stale_cookie_err()
6323 packet->vtag = cookie->c.peer_vtag; in sctp_send_stale_cookie_err()
6326 err_chunk->skb->sk = ep->base.sk; in sctp_send_stale_cookie_err()
6342 struct sctp_tsnmap *map = (struct sctp_tsnmap *)&asoc->peer.tsn_map; in sctp_eat_data()
6343 struct sock *sk = asoc->base.sk; in sctp_eat_data()
6349 __u32 tsn; in sctp_eat_data() local
6352 data_hdr = (struct sctp_datahdr *)chunk->skb->data; in sctp_eat_data()
6353 chunk->subh.data_hdr = data_hdr; in sctp_eat_data()
6354 skb_pull(chunk->skb, sctp_datahdr_len(&asoc->stream)); in sctp_eat_data()
6356 tsn = ntohl(data_hdr->tsn); in sctp_eat_data()
6357 pr_debug("%s: TSN 0x%x\n", __func__, tsn); in sctp_eat_data()
6359 /* ASSERT: Now skb->data is really the user data. */ in sctp_eat_data()
6371 if (asoc->peer.ecn_capable && !chunk->ecn_ce_done) { in sctp_eat_data()
6372 struct sctp_af *af = SCTP_INPUT_CB(chunk->skb)->af; in sctp_eat_data()
6373 chunk->ecn_ce_done = 1; in sctp_eat_data()
6375 if (af->is_ce(sctp_gso_headskb(chunk->skb))) { in sctp_eat_data()
6378 SCTP_U32(tsn)); in sctp_eat_data()
6382 tmp = sctp_tsnmap_check(&asoc->peer.tsn_map, tsn); in sctp_eat_data()
6384 /* The TSN is too high--silently discard the chunk and in sctp_eat_data()
6387 if (chunk->asoc) in sctp_eat_data()
6388 chunk->asoc->stats.outofseqtsns++; in sctp_eat_data()
6392 sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_DUP, SCTP_U32(tsn)); in sctp_eat_data()
6396 /* This is a new TSN. */ in sctp_eat_data()
6401 datalen = ntohs(chunk->chunk_hdr->length); in sctp_eat_data()
6402 datalen -= sctp_datachk_len(&asoc->stream); in sctp_eat_data()
6407 if ((datalen >= asoc->rwnd) && (!asoc->ulpq.pd_mode)) { in sctp_eat_data()
6420 if ((!chunk->data_accepted) && (!asoc->rwnd || asoc->rwnd_over || in sctp_eat_data()
6421 (datalen > asoc->rwnd + asoc->frag_point))) { in sctp_eat_data()
6423 /* If this is the next TSN, consider reneging to make in sctp_eat_data()
6430 (sctp_tsnmap_get_ctsn(map) + 1) == tsn) { in sctp_eat_data()
6431 pr_debug("%s: reneging for tsn:%u\n", __func__, tsn); in sctp_eat_data()
6434 pr_debug("%s: discard tsn:%u len:%zu, rwnd:%d\n", in sctp_eat_data()
6435 __func__, tsn, datalen, asoc->rwnd); in sctp_eat_data()
6450 (sctp_tsnmap_get_ctsn(map) + 1) == tsn) { in sctp_eat_data()
6451 pr_debug("%s: under pressure, reneging for tsn:%u\n", in sctp_eat_data()
6452 __func__, tsn); in sctp_eat_data()
6463 * --------------- in sctp_eat_data()
6468 err = sctp_make_abort_no_data(asoc, chunk, tsn); in sctp_eat_data()
6486 chunk->data_accepted = 1; in sctp_eat_data()
6491 if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) { in sctp_eat_data()
6493 if (chunk->asoc) in sctp_eat_data()
6494 chunk->asoc->stats.iuodchunks++; in sctp_eat_data()
6497 if (chunk->asoc) in sctp_eat_data()
6498 chunk->asoc->stats.iodchunks++; in sctp_eat_data()
6509 if (ntohs(data_hdr->stream) >= asoc->stream.incnt) { in sctp_eat_data()
6510 /* Mark tsn as received even though we drop it */ in sctp_eat_data()
6511 sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_TSN, SCTP_U32(tsn)); in sctp_eat_data()
6514 &data_hdr->stream, in sctp_eat_data()
6515 sizeof(data_hdr->stream), in sctp_eat_data()
6523 /* Check to see if the SSN is possible for this TSN. in sctp_eat_data()
6526 * wrap and for a valid TSN. We can simply check if the current in sctp_eat_data()
6530 if (!asoc->stream.si->validate_data(chunk)) in sctp_eat_data()