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.
31 * lksctp developers <linux-sctp@vger.kernel.org>
88 struct sctp_chunk *chunk = skb_shinfo(skb)->destructor_arg; in sctp_control_release_owner()
90 if (chunk->shkey) { in sctp_control_release_owner()
91 struct sctp_shared_key *shkey = chunk->shkey; in sctp_control_release_owner()
92 struct sctp_association *asoc = chunk->asoc; in sctp_control_release_owner()
98 if (shkey->deactivated && !list_empty(&shkey->key_list) && in sctp_control_release_owner()
99 refcount_read(&shkey->refcnt) == 2) { in sctp_control_release_owner()
102 ev = sctp_ulpevent_make_authkey(asoc, shkey->key_id, in sctp_control_release_owner()
106 asoc->stream.si->enqueue_event(&asoc->ulpq, ev); in sctp_control_release_owner()
108 sctp_auth_shkey_release(chunk->shkey); in sctp_control_release_owner()
114 struct sctp_association *asoc = chunk->asoc; in sctp_control_set_owner_w()
115 struct sk_buff *skb = chunk->skb; in sctp_control_set_owner_w()
124 if (chunk->auth) { in sctp_control_set_owner_w()
125 chunk->shkey = asoc->shkey; in sctp_control_set_owner_w()
126 sctp_auth_shkey_hold(chunk->shkey); in sctp_control_set_owner_w()
128 skb->sk = asoc ? asoc->base.sk : NULL; in sctp_control_set_owner_w()
129 skb_shinfo(skb)->destructor_arg = chunk; in sctp_control_set_owner_w()
130 skb->destructor = sctp_control_release_owner; in sctp_control_set_owner_w()
136 struct sk_buff *skb = chunk->skb; in sctp_chunk_iif()
138 return SCTP_INPUT_CB(skb)->af->skb_iif(skb); in sctp_chunk_iif()
143 * Note 2: The ECN capable field is reserved for future use of
169 if (skb_tailroom(chunk->skb) < len) in sctp_init_cause()
170 return -ENOSPC; in sctp_init_cause()
172 chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(err), &err); in sctp_init_cause()
184 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
186 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
188 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
190 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
192 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
193 * | Initial TSN |
194 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
196 * / Optional/Variable-Length Parameters /
198 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
205 * ----------------------------------------------
210 * Initial TSN Mandatory
213 * -------------------------------------------------------------
217 * Reserved for ECN Capable (Note 2) Optional 32768 (0x8000)
225 struct net *net = sock_net(asoc->base.sk); in sctp_make_init()
231 struct sctp_endpoint *ep = asoc->ep; in sctp_make_init()
251 init.init_tag = htonl(asoc->c.my_vtag); in sctp_make_init()
252 init.a_rwnd = htonl(asoc->rwnd); in sctp_make_init()
253 init.num_outbound_streams = htons(asoc->c.sinit_num_ostreams); in sctp_make_init()
254 init.num_inbound_streams = htons(asoc->c.sinit_max_instreams); in sctp_make_init()
255 init.initial_tsn = htonl(asoc->c.initial_tsn); in sctp_make_init()
258 sp = sctp_sk(asoc->base.sk); in sctp_make_init()
259 num_types = sp->pf->supported_addrs(sp, types); in sctp_make_init()
265 if (asoc->prsctp_enable) in sctp_make_init()
270 * the ASCONF,the ASCONF-ACK, and the AUTH chunks in its INIT and in sctp_make_init()
271 * INIT-ACK parameters. in sctp_make_init()
273 if (net->sctp.addip_enable) { in sctp_make_init()
279 if (asoc->reconf_enable) { in sctp_make_init()
284 if (sp->adaptation_ind) in sctp_make_init()
287 if (sp->strm_interleave) { in sctp_make_init()
295 if (ep->auth_enable) { in sctp_make_init()
297 chunksize += sizeof(asoc->c.auth_random); in sctp_make_init()
300 auth_hmacs = (struct sctp_paramhdr *)asoc->c.auth_hmacs; in sctp_make_init()
301 if (auth_hmacs->length) in sctp_make_init()
302 chunksize += SCTP_PAD4(ntohs(auth_hmacs->length)); in sctp_make_init()
307 auth_chunks = (struct sctp_paramhdr *)asoc->c.auth_chunks; in sctp_make_init()
308 if (auth_chunks->length) in sctp_make_init()
309 chunksize += SCTP_PAD4(ntohs(auth_chunks->length)); in sctp_make_init()
337 retval->subh.init_hdr = in sctp_make_init()
339 retval->param_hdr.v = in sctp_make_init()
366 if (asoc->prsctp_enable) in sctp_make_init()
369 if (sp->adaptation_ind) { in sctp_make_init()
372 aiparam.adaptation_ind = htonl(sp->adaptation_ind); in sctp_make_init()
376 /* Add SCTP-AUTH chunks to the parameter list */ in sctp_make_init()
377 if (ep->auth_enable) { in sctp_make_init()
378 sctp_addto_chunk(retval, sizeof(asoc->c.auth_random), in sctp_make_init()
379 asoc->c.auth_random); in sctp_make_init()
381 sctp_addto_chunk(retval, ntohs(auth_hmacs->length), in sctp_make_init()
384 sctp_addto_chunk(retval, ntohs(auth_chunks->length), in sctp_make_init()
413 addrs = sctp_bind_addrs_to_raw(&asoc->base.bind_addr, &addrs_len, gfp); in sctp_make_init_ack()
415 initack.init_tag = htonl(asoc->c.my_vtag); in sctp_make_init_ack()
416 initack.a_rwnd = htonl(asoc->rwnd); in sctp_make_init_ack()
417 initack.num_outbound_streams = htons(asoc->c.sinit_num_ostreams); in sctp_make_init_ack()
418 initack.num_inbound_streams = htons(asoc->c.sinit_max_instreams); in sctp_make_init_ack()
419 initack.initial_tsn = htonl(asoc->c.initial_tsn); in sctp_make_init_ack()
424 cookie = sctp_pack_cookie(asoc->ep, asoc, chunk, &cookie_len, in sctp_make_init_ack()
432 sp = sctp_sk(asoc->base.sk); in sctp_make_init_ack()
436 if (asoc->peer.ecn_capable) in sctp_make_init_ack()
439 if (asoc->peer.prsctp_capable) in sctp_make_init_ack()
442 if (asoc->peer.asconf_capable) { in sctp_make_init_ack()
448 if (asoc->peer.reconf_capable) { in sctp_make_init_ack()
453 if (sp->adaptation_ind) in sctp_make_init_ack()
456 if (asoc->intl_enable) { in sctp_make_init_ack()
461 if (asoc->peer.auth_capable) { in sctp_make_init_ack()
462 auth_random = (struct sctp_paramhdr *)asoc->c.auth_random; in sctp_make_init_ack()
463 chunksize += ntohs(auth_random->length); in sctp_make_init_ack()
465 auth_hmacs = (struct sctp_paramhdr *)asoc->c.auth_hmacs; in sctp_make_init_ack()
466 if (auth_hmacs->length) in sctp_make_init_ack()
467 chunksize += SCTP_PAD4(ntohs(auth_hmacs->length)); in sctp_make_init_ack()
471 auth_chunks = (struct sctp_paramhdr *)asoc->c.auth_chunks; in sctp_make_init_ack()
472 if (auth_chunks->length) in sctp_make_init_ack()
473 chunksize += SCTP_PAD4(ntohs(auth_chunks->length)); in sctp_make_init_ack()
489 /* RFC 2960 6.4 Multi-homed SCTP Endpoints in sctp_make_init_ack()
498 if (chunk->transport) in sctp_make_init_ack()
499 retval->transport = in sctp_make_init_ack()
501 &chunk->transport->ipaddr); in sctp_make_init_ack()
503 retval->subh.init_hdr = in sctp_make_init_ack()
505 retval->param_hdr.v = sctp_addto_chunk(retval, addrs_len, addrs.v); in sctp_make_init_ack()
507 if (asoc->peer.ecn_capable) in sctp_make_init_ack()
515 if (asoc->peer.prsctp_capable) in sctp_make_init_ack()
518 if (sp->adaptation_ind) { in sctp_make_init_ack()
521 aiparam.adaptation_ind = htonl(sp->adaptation_ind); in sctp_make_init_ack()
525 if (asoc->peer.auth_capable) { in sctp_make_init_ack()
526 sctp_addto_chunk(retval, ntohs(auth_random->length), in sctp_make_init_ack()
529 sctp_addto_chunk(retval, ntohs(auth_hmacs->length), in sctp_make_init_ack()
532 sctp_addto_chunk(retval, ntohs(auth_chunks->length), in sctp_make_init_ack()
537 retval->asoc = (struct sctp_association *) asoc; in sctp_make_init_ack()
556 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
558 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
561 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
587 cookie = asoc->peer.cookie; in sctp_make_cookie_echo()
588 cookie_len = asoc->peer.cookie_len; in sctp_make_cookie_echo()
595 retval->subh.cookie_hdr = in sctp_make_cookie_echo()
598 /* RFC 2960 6.4 Multi-homed SCTP Endpoints in sctp_make_cookie_echo()
608 retval->transport = chunk->transport; in sctp_make_cookie_echo()
624 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
626 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
639 /* RFC 2960 6.4 Multi-homed SCTP Endpoints in sctp_make_cookie_ack()
648 if (retval && chunk && chunk->transport) in sctp_make_cookie_ack()
649 retval->transport = in sctp_make_cookie_ack()
651 &chunk->transport->ipaddr); in sctp_make_cookie_ack()
664 * This chunk contains one data element, i.e. the TSN number that
666 * TSN number in the datagram that was originally marked with the
671 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
673 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
674 * | Lowest TSN Number |
675 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
693 retval->subh.ecn_cwr_hdr = in sctp_make_cwr()
696 /* RFC 2960 6.4 Multi-homed SCTP Endpoints in sctp_make_cwr()
707 retval->transport = chunk->transport; in sctp_make_cwr()
725 retval->subh.ecne_hdr = in sctp_make_ecne()
742 /* We assign the TSN as LATE as possible, not here when in sctp_make_datafrag_empty()
746 dp.ppid = sinfo->sinfo_ppid; in sctp_make_datafrag_empty()
747 dp.stream = htons(sinfo->sinfo_stream); in sctp_make_datafrag_empty()
750 if (sinfo->sinfo_flags & SCTP_UNORDERED) in sctp_make_datafrag_empty()
757 retval->subh.data_hdr = sctp_addto_chunk(retval, sizeof(dp), &dp); in sctp_make_datafrag_empty()
758 memcpy(&retval->sinfo, sinfo, sizeof(struct sctp_sndrcvinfo)); in sctp_make_datafrag_empty()
764 * association. This reports on which TSN's we've seen to date,
769 struct sctp_tsnmap *map = (struct sctp_tsnmap *)&asoc->peer.tsn_map; in sctp_make_sack()
789 sack.a_rwnd = htonl(asoc->a_rwnd); in sctp_make_sack()
802 /* RFC 2960 6.4 Multi-homed SCTP Endpoints in sctp_make_sack()
820 * duplicates. --piggy] in sctp_make_sack()
823 * multi- homed endpoint it MAY be beneficial to vary the in sctp_make_sack()
826 * from a multi-homed endpoint might indicate that the return in sctp_make_sack()
832 retval->transport = asoc->peer.last_data_from; in sctp_make_sack()
834 retval->subh.sack_hdr = in sctp_make_sack()
842 /* Add the duplicate TSN information. */ in sctp_make_sack()
844 asoc->stats.idupchunks += num_dup_tsns; in sctp_make_sack()
856 if (++asoc->peer.sack_generation == 0) { in sctp_make_sack()
857 list_for_each_entry(trans, &asoc->peer.transport_addr_list, in sctp_make_sack()
859 trans->sack_generation = 0; in sctp_make_sack()
860 asoc->peer.sack_generation = 1; in sctp_make_sack()
874 if (chunk && chunk->asoc) in sctp_make_shutdown()
875 ctsn = sctp_tsnmap_get_ctsn(&chunk->asoc->peer.tsn_map); in sctp_make_shutdown()
877 ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map); in sctp_make_shutdown()
886 retval->subh.shutdown_hdr = in sctp_make_shutdown()
890 retval->transport = chunk->transport; in sctp_make_shutdown()
903 /* RFC 2960 6.4 Multi-homed SCTP Endpoints in sctp_make_shutdown_ack()
913 retval->transport = chunk->transport; in sctp_make_shutdown_ack()
925 /* Set the T-bit if we have no association (vtag will be in sctp_make_shutdown_complete()
933 /* RFC 2960 6.4 Multi-homed SCTP Endpoints in sctp_make_shutdown_complete()
944 retval->transport = chunk->transport; in sctp_make_shutdown_complete()
959 /* Set the T-bit if we have no association and 'chunk' is not in sctp_make_abort()
963 if (chunk && chunk->chunk_hdr && in sctp_make_abort()
964 chunk->chunk_hdr->type == SCTP_CID_INIT) in sctp_make_abort()
973 /* RFC 2960 6.4 Multi-homed SCTP Endpoints in sctp_make_abort()
983 retval->transport = chunk->transport; in sctp_make_abort()
992 __u32 tsn) in sctp_make_abort_no_data() argument
998 sizeof(struct sctp_errhdr) + sizeof(tsn)); in sctp_make_abort_no_data()
1003 /* Put the tsn back into network byte order. */ in sctp_make_abort_no_data()
1004 payload = htonl(tsn); in sctp_make_abort_no_data()
1008 /* RFC 2960 6.4 Multi-homed SCTP Endpoints in sctp_make_abort_no_data()
1018 retval->transport = chunk->transport; in sctp_make_abort_no_data()
1072 int chunklen = ntohs(chunk->chunk_hdr->length); in sctp_addto_param()
1075 target = skb_put(chunk->skb, len); in sctp_addto_param()
1083 chunk->chunk_hdr->length = htons(chunklen + len); in sctp_addto_param()
1084 chunk->chunk_end = skb_tail_pointer(chunk->skb); in sctp_addto_param()
1107 phdr.type = htons(chunk->chunk_hdr->type); in sctp_make_abort_violation()
1108 phdr.length = chunk->chunk_hdr->length; in sctp_make_abort_violation()
1173 hbinfo.daddr = transport->ipaddr; in sctp_make_heartbeat()
1175 hbinfo.hb_nonce = transport->hb_nonce; in sctp_make_heartbeat()
1180 retval->transport = (struct sctp_transport *) transport; in sctp_make_heartbeat()
1181 retval->subh.hbs_hdr = sctp_addto_chunk(retval, sizeof(hbinfo), in sctp_make_heartbeat()
1200 retval->subh.hbs_hdr = sctp_addto_chunk(retval, paylen, payload); in sctp_make_heartbeat_ack()
1202 /* RFC 2960 6.4 Multi-homed SCTP Endpoints in sctp_make_heartbeat_ack()
1212 retval->transport = chunk->transport; in sctp_make_heartbeat_ack()
1234 /* RFC 2960 6.4 Multi-homed SCTP Endpoints in sctp_make_op_error_space()
1243 retval->transport = chunk->transport; in sctp_make_op_error_space()
1250 * min(asoc->pathmtu, SCTP_DEFAULT_MAXSEGMENT) - overheads.
1264 size = min_t(size_t, size, asoc->pathmtu); in sctp_make_op_error_limited()
1265 sp = sctp_sk(asoc->base.sk); in sctp_make_op_error_limited()
1307 hmac_desc->hmac_len + sizeof(auth_hdr), in sctp_make_auth()
1312 auth_hdr.hmac_id = htons(hmac_desc->hmac_id); in sctp_make_auth()
1315 retval->subh.auth_hdr = sctp_addto_chunk(retval, sizeof(auth_hdr), in sctp_make_auth()
1318 skb_put_zero(retval->skb, hmac_desc->hmac_len); in sctp_make_auth()
1321 retval->chunk_hdr->length = in sctp_make_auth()
1322 htons(ntohs(retval->chunk_hdr->length) + hmac_desc->hmac_len); in sctp_make_auth()
1323 retval->chunk_end = skb_tail_pointer(retval->skb); in sctp_make_auth()
1334 * FIXME: Eventually move the structure directly inside the skb->cb[].
1336 * sctpimpguide-05.txt Section 2.8.2
1338 * set the 'TSN.Missing.Report' count for that TSN to 0. The
1339 * 'TSN.Missing.Report' count will be used to determine missing chunks
1356 INIT_LIST_HEAD(&retval->list); in sctp_chunkify()
1357 retval->skb = skb; in sctp_chunkify()
1358 retval->asoc = (struct sctp_association *)asoc; in sctp_chunkify()
1359 retval->singleton = 1; in sctp_chunkify()
1361 retval->fast_retransmit = SCTP_CAN_FRTX; in sctp_chunkify()
1364 INIT_LIST_HEAD(&retval->transmitted_list); in sctp_chunkify()
1365 INIT_LIST_HEAD(&retval->frag_list); in sctp_chunkify()
1367 refcount_set(&retval->refcnt, 1); in sctp_chunkify()
1373 /* Set chunk->source and dest based on the IP header in chunk->skb. */
1377 memcpy(&chunk->source, src, sizeof(union sctp_addr)); in sctp_init_addrs()
1378 memcpy(&chunk->dest, dest, sizeof(union sctp_addr)); in sctp_init_addrs()
1385 if (chunk->transport) { in sctp_source()
1386 return &chunk->transport->ipaddr; in sctp_source()
1389 return &chunk->source; in sctp_source()
1417 chunk_hdr->type = type; in _sctp_make_chunk()
1418 chunk_hdr->flags = flags; in _sctp_make_chunk()
1419 chunk_hdr->length = htons(sizeof(*chunk_hdr)); in _sctp_make_chunk()
1421 sk = asoc ? asoc->base.sk : NULL; in _sctp_make_chunk()
1428 retval->chunk_hdr = chunk_hdr; in _sctp_make_chunk()
1429 retval->chunk_end = ((__u8 *)chunk_hdr) + sizeof(*chunk_hdr); in _sctp_make_chunk()
1433 retval->auth = 1; in _sctp_make_chunk()
1468 BUG_ON(!list_empty(&chunk->list)); in sctp_chunk_destroy()
1469 list_del_init(&chunk->transmitted_list); in sctp_chunk_destroy()
1471 consume_skb(chunk->skb); in sctp_chunk_destroy()
1472 consume_skb(chunk->auth_chunk); in sctp_chunk_destroy()
1482 if (chunk->msg) in sctp_chunk_free()
1483 sctp_datamsg_put(chunk->msg); in sctp_chunk_free()
1491 refcount_inc(&ch->refcnt); in sctp_chunk_hold()
1497 if (refcount_dec_and_test(&ch->refcnt)) in sctp_chunk_put()
1506 int chunklen = ntohs(chunk->chunk_hdr->length); in sctp_addto_chunk()
1507 int padlen = SCTP_PAD4(chunklen) - chunklen; in sctp_addto_chunk()
1510 skb_put_zero(chunk->skb, padlen); in sctp_addto_chunk()
1511 target = skb_put_data(chunk->skb, data, len); in sctp_addto_chunk()
1514 chunk->chunk_hdr->length = htons(chunklen + padlen + len); in sctp_addto_chunk()
1515 chunk->chunk_end = skb_tail_pointer(chunk->skb); in sctp_addto_chunk()
1530 target = skb_put(chunk->skb, len); in sctp_user_addto_chunk()
1534 return -EFAULT; in sctp_user_addto_chunk()
1537 chunk->chunk_hdr->length = in sctp_user_addto_chunk()
1538 htons(ntohs(chunk->chunk_hdr->length) + len); in sctp_user_addto_chunk()
1539 chunk->chunk_end = skb_tail_pointer(chunk->skb); in sctp_user_addto_chunk()
1544 /* Helper function to assign a TSN if needed. This assumes that both
1554 if (chunk->has_ssn) in sctp_chunk_assign_ssn()
1558 sid = ntohs(chunk->subh.data_hdr->stream); in sctp_chunk_assign_ssn()
1559 stream = &chunk->asoc->stream; in sctp_chunk_assign_ssn()
1564 msg = chunk->msg; in sctp_chunk_assign_ssn()
1565 list_for_each_entry(lchunk, &msg->chunks, frag_list) { in sctp_chunk_assign_ssn()
1566 if (lchunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) { in sctp_chunk_assign_ssn()
1569 if (lchunk->chunk_hdr->flags & SCTP_DATA_LAST_FRAG) in sctp_chunk_assign_ssn()
1575 lchunk->subh.data_hdr->ssn = htons(ssn); in sctp_chunk_assign_ssn()
1576 lchunk->has_ssn = 1; in sctp_chunk_assign_ssn()
1580 /* Helper function to assign a TSN if needed. This assumes that both
1585 if (!chunk->has_tsn) { in sctp_chunk_assign_tsn()
1587 * assign a TSN. in sctp_chunk_assign_tsn()
1589 chunk->subh.data_hdr->tsn = in sctp_chunk_assign_tsn()
1590 htonl(sctp_association_get_next_tsn(chunk->asoc)); in sctp_chunk_assign_tsn()
1591 chunk->has_tsn = 1; in sctp_chunk_assign_tsn()
1606 asoc = sctp_association_new(ep, ep->base.sk, scope, gfp); in sctp_make_temp_asoc()
1609 asoc->temp = 1; in sctp_make_temp_asoc()
1610 skb = chunk->skb; in sctp_make_temp_asoc()
1612 SCTP_INPUT_CB(skb)->af->from_skb(&asoc->c.peer_addr, skb, 1); in sctp_make_temp_asoc()
1636 (sizeof(struct sctp_signed_cookie) - in sctp_pack_cookie()
1639 + ntohs(init_chunk->chunk_hdr->length) + addrs_len; in sctp_pack_cookie()
1646 - (bodysize % SCTP_COOKIE_MULTIPLE); in sctp_pack_cookie()
1656 cookie = (struct sctp_signed_cookie *) retval->body; in sctp_pack_cookie()
1659 retval->p.type = SCTP_PARAM_STATE_COOKIE; in sctp_pack_cookie()
1660 retval->p.length = htons(*cookie_len); in sctp_pack_cookie()
1663 cookie->c = asoc->c; in sctp_pack_cookie()
1665 cookie->c.raw_addr_list_len = addrs_len; in sctp_pack_cookie()
1667 /* Remember PR-SCTP capability. */ in sctp_pack_cookie()
1668 cookie->c.prsctp_capable = asoc->peer.prsctp_capable; in sctp_pack_cookie()
1671 cookie->c.adaptation_ind = asoc->peer.adaptation_ind; in sctp_pack_cookie()
1674 cookie->c.expiration = ktime_add(asoc->cookie_life, in sctp_pack_cookie()
1678 memcpy(&cookie->c.peer_init[0], init_chunk->chunk_hdr, in sctp_pack_cookie()
1679 ntohs(init_chunk->chunk_hdr->length)); in sctp_pack_cookie()
1682 memcpy((__u8 *)&cookie->c.peer_init[0] + in sctp_pack_cookie()
1683 ntohs(init_chunk->chunk_hdr->length), raw_addrs, addrs_len); in sctp_pack_cookie()
1685 if (sctp_sk(ep->base.sk)->hmac) { in sctp_pack_cookie()
1686 SHASH_DESC_ON_STACK(desc, sctp_sk(ep->base.sk)->hmac); in sctp_pack_cookie()
1690 desc->tfm = sctp_sk(ep->base.sk)->hmac; in sctp_pack_cookie()
1691 desc->flags = 0; in sctp_pack_cookie()
1693 err = crypto_shash_setkey(desc->tfm, ep->secret_key, in sctp_pack_cookie()
1694 sizeof(ep->secret_key)) ?: in sctp_pack_cookie()
1695 crypto_shash_digest(desc, (u8 *)&cookie->c, bodysize, in sctp_pack_cookie()
1696 cookie->signature); in sctp_pack_cookie()
1721 struct sk_buff *skb = chunk->skb; in sctp_unpack_cookie()
1723 __u8 *digest = ep->digest; in sctp_unpack_cookie()
1732 (sizeof(struct sctp_signed_cookie) - in sctp_unpack_cookie()
1734 bodysize = ntohs(chunk->chunk_hdr->length) - headersize; in sctp_unpack_cookie()
1741 len = ntohs(chunk->chunk_hdr->length); in sctp_unpack_cookie()
1750 cookie = chunk->subh.cookie_hdr; in sctp_unpack_cookie()
1751 bear_cookie = &cookie->c; in sctp_unpack_cookie()
1753 if (!sctp_sk(ep->base.sk)->hmac) in sctp_unpack_cookie()
1758 SHASH_DESC_ON_STACK(desc, sctp_sk(ep->base.sk)->hmac); in sctp_unpack_cookie()
1761 desc->tfm = sctp_sk(ep->base.sk)->hmac; in sctp_unpack_cookie()
1762 desc->flags = 0; in sctp_unpack_cookie()
1764 err = crypto_shash_setkey(desc->tfm, ep->secret_key, in sctp_unpack_cookie()
1765 sizeof(ep->secret_key)) ?: in sctp_unpack_cookie()
1771 *error = -SCTP_IERROR_NOMEM; in sctp_unpack_cookie()
1776 if (memcmp(digest, cookie->signature, SCTP_SIGNATURE_SIZE)) { in sctp_unpack_cookie()
1777 *error = -SCTP_IERROR_BAD_SIG; in sctp_unpack_cookie()
1789 if (ntohl(chunk->sctp_hdr->vtag) != bear_cookie->my_vtag) { in sctp_unpack_cookie()
1790 *error = -SCTP_IERROR_BAD_TAG; in sctp_unpack_cookie()
1794 if (chunk->sctp_hdr->source != bear_cookie->peer_addr.v4.sin_port || in sctp_unpack_cookie()
1795 ntohs(chunk->sctp_hdr->dest) != bear_cookie->my_port) { in sctp_unpack_cookie()
1796 *error = -SCTP_IERROR_BAD_PORTS; in sctp_unpack_cookie()
1808 if (sock_flag(ep->base.sk, SOCK_TIMESTAMP)) in sctp_unpack_cookie()
1813 if (!asoc && ktime_before(bear_cookie->expiration, kt)) { in sctp_unpack_cookie()
1814 suseconds_t usecs = ktime_to_us(ktime_sub(kt, bear_cookie->expiration)); in sctp_unpack_cookie()
1821 * --------------- in sctp_unpack_cookie()
1829 *error = -SCTP_IERROR_STALE_COOKIE; in sctp_unpack_cookie()
1831 *error = -SCTP_IERROR_NOMEM; in sctp_unpack_cookie()
1838 retval = sctp_association_new(ep, ep->base.sk, scope, gfp); in sctp_unpack_cookie()
1840 *error = -SCTP_IERROR_NOMEM; in sctp_unpack_cookie()
1845 retval->peer.port = ntohs(chunk->sctp_hdr->source); in sctp_unpack_cookie()
1848 memcpy(&retval->c, bear_cookie, sizeof(*bear_cookie)); in sctp_unpack_cookie()
1852 *error = -SCTP_IERROR_NOMEM; in sctp_unpack_cookie()
1857 if (list_empty(&retval->base.bind_addr.address_list)) { in sctp_unpack_cookie()
1858 sctp_add_bind_addr(&retval->base.bind_addr, &chunk->dest, in sctp_unpack_cookie()
1859 sizeof(chunk->dest), SCTP_ADDR_SRC, in sctp_unpack_cookie()
1863 retval->next_tsn = retval->c.initial_tsn; in sctp_unpack_cookie()
1864 retval->ctsn_ack_point = retval->next_tsn - 1; in sctp_unpack_cookie()
1865 retval->addip_serial = retval->c.initial_tsn; in sctp_unpack_cookie()
1866 retval->strreset_outseq = retval->c.initial_tsn; in sctp_unpack_cookie()
1867 retval->adv_peer_ack_point = retval->ctsn_ack_point; in sctp_unpack_cookie()
1868 retval->peer.prsctp_capable = retval->c.prsctp_capable; in sctp_unpack_cookie()
1869 retval->peer.adaptation_ind = retval->c.adaptation_ind; in sctp_unpack_cookie()
1884 *error = -SCTP_IERROR_MALFORMED; in sctp_unpack_cookie()
1950 /* This is a fatal error. Any accumulated non-fatal errors are in sctp_process_inv_paramlength()
1971 __u16 len = ntohs(param.p->length); in sctp_process_hn_param()
1974 * ABORT. If we've accumulated any non-fatal errors, they in sctp_process_hn_param()
1990 __u16 num_ext = ntohs(param.p->length) - sizeof(struct sctp_paramhdr); in sctp_verify_ext_param()
1996 switch (param.ext->chunks[i]) { in sctp_verify_ext_param()
2007 /* ADD-IP Security: The draft requires us to ABORT or ignore the in sctp_verify_ext_param()
2008 * INIT/INIT-ACK if ADD-IP is listed, but AUTH is not. Do this in sctp_verify_ext_param()
2009 * only if ADD-IP is turned on and we are not backward-compatible in sctp_verify_ext_param()
2012 if (net->sctp.addip_noauth) in sctp_verify_ext_param()
2015 if (net->sctp.addip_enable && !have_auth && have_asconf) in sctp_verify_ext_param()
2024 __u16 num_ext = ntohs(param.p->length) - sizeof(struct sctp_paramhdr); in sctp_process_ext_param()
2025 struct net *net = sock_net(asoc->base.sk); in sctp_process_ext_param()
2029 switch (param.ext->chunks[i]) { in sctp_process_ext_param()
2031 if (asoc->reconf_enable && in sctp_process_ext_param()
2032 !asoc->peer.reconf_capable) in sctp_process_ext_param()
2033 asoc->peer.reconf_capable = 1; in sctp_process_ext_param()
2036 if (asoc->prsctp_enable && !asoc->peer.prsctp_capable) in sctp_process_ext_param()
2037 asoc->peer.prsctp_capable = 1; in sctp_process_ext_param()
2043 if (asoc->ep->auth_enable) in sctp_process_ext_param()
2044 asoc->peer.auth_capable = 1; in sctp_process_ext_param()
2048 if (net->sctp.addip_enable) in sctp_process_ext_param()
2049 asoc->peer.asconf_capable = 1; in sctp_process_ext_param()
2052 if (sctp_sk(asoc->base.sk)->strm_interleave) in sctp_process_ext_param()
2053 asoc->intl_enable = 1; in sctp_process_ext_param()
2064 * highest-order two bits specify the action that must be
2068 * 00 - Stop processing this parameter; do not process any further
2071 * 01 - Stop processing this parameter, do not process any further
2075 * 10 - Skip this parameter and continue processing.
2077 * 11 - Skip this parameter and continue processing but
2082 * SCTP_IERROR_NO_ERROR - continue with the chunk
2083 * SCTP_IERROR_ERROR - stop and report an error.
2084 * SCTP_IERROR_NOMEME - out of memory.
2094 switch (param.p->type & SCTP_PARAM_ACTION_MASK) { in sctp_process_unk_param()
2121 ntohs(param.p->length))) in sctp_process_unk_param()
2122 sctp_addto_chunk(*errp, ntohs(param.p->length), in sctp_process_unk_param()
2134 * SCTP_IERROR_ABORT - trigger an ABORT
2135 * SCTP_IERROR_NOMEM - out of memory (abort)
2136 * SCTP_IERROR_ERROR - stop processing, trigger an ERROR
2137 * SCTP_IERROR_NO_ERROR - continue with the chunk
2152 /* FIXME - This routine is not looking at each parameter per the in sctp_verify_param()
2157 switch (param.p->type) { in sctp_verify_param()
2175 if (!net->sctp.addip_enable) in sctp_verify_param()
2178 if (ntohs(param.p->length) < sizeof(struct sctp_addip_param) + in sctp_verify_param()
2193 if (ep->prsctp_enable) in sctp_verify_param()
2198 if (!ep->auth_enable) in sctp_verify_param()
2201 /* SCTP-AUTH: Secion 6.1 in sctp_verify_param()
2206 if (SCTP_AUTH_RANDOM_LENGTH != ntohs(param.p->length) - in sctp_verify_param()
2215 if (!ep->auth_enable) in sctp_verify_param()
2218 /* SCTP-AUTH: Section 3.2 in sctp_verify_param()
2220 * INIT-ACK chunk if the sender wants to receive authenticated in sctp_verify_param()
2223 if (260 < ntohs(param.p->length)) { in sctp_verify_param()
2231 if (!ep->auth_enable) in sctp_verify_param()
2235 n_elt = (ntohs(param.p->length) - in sctp_verify_param()
2238 /* SCTP-AUTH: Section 6.1 in sctp_verify_param()
2239 * The HMAC algorithm based on SHA-1 MUST be supported and in sctp_verify_param()
2240 * included in the HMAC-ALGO parameter. in sctp_verify_param()
2243 id = ntohs(hmacs->hmac_ids[i]); in sctp_verify_param()
2258 __func__, ntohs(param.p->type), cid); in sctp_verify_param()
2276 /* Check for missing mandatory parameters. Note: Initial TSN is in sctp_verify_init()
2278 * is 0..2**32-1. RFC4960, section 3.3.3. in sctp_verify_init()
2280 if (peer_init->init_hdr.num_outbound_streams == 0 || in sctp_verify_init()
2281 peer_init->init_hdr.num_inbound_streams == 0 || in sctp_verify_init()
2282 peer_init->init_hdr.init_tag == 0 || in sctp_verify_init()
2283 ntohl(peer_init->init_hdr.a_rwnd) < SCTP_DEFAULT_MINWINDOW) in sctp_verify_init()
2287 if (param.p->type == SCTP_PARAM_STATE_COOKIE) in sctp_verify_init()
2298 if (param.v != (void *)chunk->chunk_end) in sctp_verify_init()
2302 * the state cookie for an INIT-ACK chunk. in sctp_verify_init()
2336 struct net *net = sock_net(asoc->base.sk); in sctp_process_init()
2363 (param.p->type == SCTP_PARAM_IPV4_ADDRESS || in sctp_process_init()
2364 param.p->type == SCTP_PARAM_IPV6_ADDRESS)) { in sctp_process_init()
2365 af = sctp_get_af_specific(param_type2af(param.p->type)); in sctp_process_init()
2366 if (!af->from_addr_param(&addr, param.addr, in sctp_process_init()
2367 chunk->sctp_hdr->source, 0)) in sctp_process_init()
2384 if (asoc->peer.auth_capable && (!asoc->peer.peer_random || in sctp_process_init()
2385 !asoc->peer.peer_hmacs)) in sctp_process_init()
2386 asoc->peer.auth_capable = 0; in sctp_process_init()
2388 /* In a non-backward compatible mode, if the peer claims in sctp_process_init()
2389 * support for ADD-IP but not AUTH, the ADD-IP spec states in sctp_process_init()
2394 if (!net->sctp.addip_noauth && in sctp_process_init()
2395 (asoc->peer.asconf_capable && !asoc->peer.auth_capable)) { in sctp_process_init()
2396 asoc->peer.addip_disabled_mask |= (SCTP_PARAM_ADD_IP | in sctp_process_init()
2399 asoc->peer.asconf_capable = 0; in sctp_process_init()
2404 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { in sctp_process_init()
2406 if (transport->state == SCTP_UNKNOWN) { in sctp_process_init()
2414 asoc->peer.i.init_tag = in sctp_process_init()
2415 ntohl(peer_init->init_hdr.init_tag); in sctp_process_init()
2416 asoc->peer.i.a_rwnd = in sctp_process_init()
2417 ntohl(peer_init->init_hdr.a_rwnd); in sctp_process_init()
2418 asoc->peer.i.num_outbound_streams = in sctp_process_init()
2419 ntohs(peer_init->init_hdr.num_outbound_streams); in sctp_process_init()
2420 asoc->peer.i.num_inbound_streams = in sctp_process_init()
2421 ntohs(peer_init->init_hdr.num_inbound_streams); in sctp_process_init()
2422 asoc->peer.i.initial_tsn = in sctp_process_init()
2423 ntohl(peer_init->init_hdr.initial_tsn); in sctp_process_init()
2425 asoc->strreset_inseq = asoc->peer.i.initial_tsn; in sctp_process_init()
2430 if (asoc->c.sinit_num_ostreams > in sctp_process_init()
2431 ntohs(peer_init->init_hdr.num_inbound_streams)) { in sctp_process_init()
2432 asoc->c.sinit_num_ostreams = in sctp_process_init()
2433 ntohs(peer_init->init_hdr.num_inbound_streams); in sctp_process_init()
2436 if (asoc->c.sinit_max_instreams > in sctp_process_init()
2437 ntohs(peer_init->init_hdr.num_outbound_streams)) { in sctp_process_init()
2438 asoc->c.sinit_max_instreams = in sctp_process_init()
2439 ntohs(peer_init->init_hdr.num_outbound_streams); in sctp_process_init()
2443 asoc->c.peer_vtag = asoc->peer.i.init_tag; in sctp_process_init()
2446 asoc->peer.rwnd = asoc->peer.i.a_rwnd; in sctp_process_init()
2452 list_for_each_entry(transport, &asoc->peer.transport_addr_list, in sctp_process_init()
2454 transport->ssthresh = asoc->peer.i.a_rwnd; in sctp_process_init()
2457 /* Set up the TSN tracking pieces. */ in sctp_process_init()
2458 if (!sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_INITIAL, in sctp_process_init()
2459 asoc->peer.i.initial_tsn, gfp)) in sctp_process_init()
2470 if (sctp_stream_init(&asoc->stream, asoc->c.sinit_num_ostreams, in sctp_process_init()
2471 asoc->c.sinit_max_instreams, gfp)) in sctp_process_init()
2477 if (!asoc->temp && sctp_assoc_set_id(asoc, gfp)) in sctp_process_init()
2488 * association to the same value as the Initial TSN. in sctp_process_init()
2490 asoc->peer.addip_serial = asoc->peer.i.initial_tsn - 1; in sctp_process_init()
2495 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { in sctp_process_init()
2497 if (transport->state != SCTP_ACTIVE) in sctp_process_init()
2522 struct net *net = sock_net(asoc->base.sk); in sctp_process_param()
2523 struct sctp_endpoint *ep = asoc->ep; in sctp_process_param()
2537 switch (param.p->type) { in sctp_process_param()
2539 if (PF_INET6 != asoc->base.sk->sk_family) in sctp_process_param()
2544 /* v4 addresses are not allowed on v6-only socket */ in sctp_process_param()
2545 if (ipv6_only_sock(asoc->base.sk)) in sctp_process_param()
2548 af = sctp_get_af_specific(param_type2af(param.p->type)); in sctp_process_param()
2549 if (!af->from_addr_param(&addr, param.addr, htons(asoc->peer.port), 0)) in sctp_process_param()
2558 if (!net->sctp.cookie_preserve_enable) in sctp_process_param()
2561 stale = ntohl(param.life->lifespan_increment); in sctp_process_param()
2566 asoc->cookie_life = ktime_add_ms(asoc->cookie_life, stale); in sctp_process_param()
2577 asoc->peer.ipv4_address = 0; in sctp_process_param()
2578 asoc->peer.ipv6_address = 0; in sctp_process_param()
2583 if (peer_addr->sa.sa_family == AF_INET6) in sctp_process_param()
2584 asoc->peer.ipv6_address = 1; in sctp_process_param()
2585 else if (peer_addr->sa.sa_family == AF_INET) in sctp_process_param()
2586 asoc->peer.ipv4_address = 1; in sctp_process_param()
2589 sat = ntohs(param.p->length) - sizeof(struct sctp_paramhdr); in sctp_process_param()
2594 switch (param.sat->types[i]) { in sctp_process_param()
2596 asoc->peer.ipv4_address = 1; in sctp_process_param()
2600 if (PF_INET6 == asoc->base.sk->sk_family) in sctp_process_param()
2601 asoc->peer.ipv6_address = 1; in sctp_process_param()
2605 asoc->peer.hostname_address = 1; in sctp_process_param()
2615 asoc->peer.cookie_len = in sctp_process_param()
2616 ntohs(param.p->length) - sizeof(struct sctp_paramhdr); in sctp_process_param()
2617 if (asoc->peer.cookie) in sctp_process_param()
2618 kfree(asoc->peer.cookie); in sctp_process_param()
2619 asoc->peer.cookie = kmemdup(param.cookie->body, asoc->peer.cookie_len, gfp); in sctp_process_param()
2620 if (!asoc->peer.cookie) in sctp_process_param()
2633 asoc->peer.ecn_capable = 1; in sctp_process_param()
2637 asoc->peer.adaptation_ind = ntohl(param.aind->adaptation_ind); in sctp_process_param()
2641 if (!net->sctp.addip_enable) in sctp_process_param()
2646 af = sctp_get_af_specific(param_type2af(addr_param->p.type)); in sctp_process_param()
2650 if (!af->from_addr_param(&addr, addr_param, in sctp_process_param()
2651 htons(asoc->peer.port), 0)) in sctp_process_param()
2654 if (!af->addr_valid(&addr, NULL, NULL)) in sctp_process_param()
2669 if (asoc->prsctp_enable) { in sctp_process_param()
2670 asoc->peer.prsctp_capable = 1; in sctp_process_param()
2677 if (!ep->auth_enable) in sctp_process_param()
2681 if (asoc->peer.peer_random) in sctp_process_param()
2682 kfree(asoc->peer.peer_random); in sctp_process_param()
2683 asoc->peer.peer_random = kmemdup(param.p, in sctp_process_param()
2684 ntohs(param.p->length), gfp); in sctp_process_param()
2685 if (!asoc->peer.peer_random) { in sctp_process_param()
2692 if (!ep->auth_enable) in sctp_process_param()
2696 if (asoc->peer.peer_hmacs) in sctp_process_param()
2697 kfree(asoc->peer.peer_hmacs); in sctp_process_param()
2698 asoc->peer.peer_hmacs = kmemdup(param.p, in sctp_process_param()
2699 ntohs(param.p->length), gfp); in sctp_process_param()
2700 if (!asoc->peer.peer_hmacs) { in sctp_process_param()
2710 if (!ep->auth_enable) in sctp_process_param()
2713 if (asoc->peer.peer_chunks) in sctp_process_param()
2714 kfree(asoc->peer.peer_chunks); in sctp_process_param()
2715 asoc->peer.peer_chunks = kmemdup(param.p, in sctp_process_param()
2716 ntohs(param.p->length), gfp); in sctp_process_param()
2717 if (!asoc->peer.peer_chunks) in sctp_process_param()
2728 __func__, ntohs(param.p->type), asoc); in sctp_process_param()
2750 /* Select an initial TSN to send during startup. */
2763 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2765 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2767 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2769 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2771 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2775 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2777 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2790 struct sctp_af *af = sctp_get_af_specific(addr->v4.sin_family); in sctp_make_asconf()
2792 addrlen = af->to_addr_param(addr, &addrparam); in sctp_make_asconf()
2803 asconf.serial = htonl(asoc->addip_serial++); in sctp_make_asconf()
2805 retval->subh.addip_hdr = in sctp_make_asconf()
2807 retval->param_hdr.v = in sctp_make_asconf()
2817 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2819 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2820 * | ASCONF-Request Correlation ID |
2821 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2823 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2828 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2830 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2831 * | ASCONF-Request Correlation ID |
2832 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2834 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2857 af = sctp_get_af_specific(addr->v4.sin_family); in sctp_make_asconf_update_ip()
2858 addr_param_len = af->to_addr_param(addr, &addr_param); in sctp_make_asconf_update_ip()
2863 addr_buf += af->sockaddr_len; in sctp_make_asconf_update_ip()
2864 if (asoc->asconf_addr_del_pending && !del_pickup) { in sctp_make_asconf_update_ip()
2870 pr_debug("%s: picked same-scope del_pending addr, " in sctp_make_asconf_update_ip()
2885 af = sctp_get_af_specific(addr->v4.sin_family); in sctp_make_asconf_update_ip()
2886 addr_param_len = af->to_addr_param(addr, &addr_param); in sctp_make_asconf_update_ip()
2894 addr_buf += af->sockaddr_len; in sctp_make_asconf_update_ip()
2897 addr = asoc->asconf_addr_del_pending; in sctp_make_asconf_update_ip()
2898 af = sctp_get_af_specific(addr->v4.sin_family); in sctp_make_asconf_update_ip()
2899 addr_param_len = af->to_addr_param(addr, &addr_param); in sctp_make_asconf_update_ip()
2914 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2916 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2917 * | ASCONF-Request Correlation ID |
2918 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2920 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2927 struct sctp_af *af = sctp_get_af_specific(addr->v4.sin_family); in sctp_make_asconf_set_prim()
2934 addrlen = af->to_addr_param(addr, &addrparam); in sctp_make_asconf_set_prim()
2954 /* ADDIP 3.1.2 Address Configuration Acknowledgement Chunk (ASCONF-ACK)
2957 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2959 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2961 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2963 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2967 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2969 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2988 retval->subh.addip_hdr = in sctp_make_asconf_ack()
3012 ntohs(asconf_param->param_hdr.length); in sctp_add_asconf_response()
3048 if (asconf_param->param_hdr.type != SCTP_PARAM_ADD_IP && in sctp_process_asconf_param()
3049 asconf_param->param_hdr.type != SCTP_PARAM_DEL_IP && in sctp_process_asconf_param()
3050 asconf_param->param_hdr.type != SCTP_PARAM_SET_PRIMARY) in sctp_process_asconf_param()
3053 switch (addr_param->p.type) { in sctp_process_asconf_param()
3055 if (!asoc->peer.ipv6_address) in sctp_process_asconf_param()
3059 if (!asoc->peer.ipv4_address) in sctp_process_asconf_param()
3066 af = sctp_get_af_specific(param_type2af(addr_param->p.type)); in sctp_process_asconf_param()
3070 if (!af->from_addr_param(&addr, addr_param, htons(asoc->peer.port), 0)) in sctp_process_asconf_param()
3078 if (!af->is_any(&addr) && !af->addr_valid(&addr, NULL, asconf->skb)) in sctp_process_asconf_param()
3081 switch (asconf_param->param_hdr.type) { in sctp_process_asconf_param()
3087 if (af->is_any(&addr)) in sctp_process_asconf_param()
3088 memcpy(&addr, &asconf->source, sizeof(addr)); in sctp_process_asconf_param()
3090 if (security_sctp_bind_connect(asoc->ep->base.sk, in sctp_process_asconf_param()
3093 af->sockaddr_len)) in sctp_process_asconf_param()
3109 asoc->new_transport = peer; in sctp_process_asconf_param()
3117 if (asoc->peer.transport_count == 1) in sctp_process_asconf_param()
3127 if (sctp_cmp_addr_exact(&asconf->source, &addr)) in sctp_process_asconf_param()
3135 if (af->is_any(&addr)) { in sctp_process_asconf_param()
3136 sctp_assoc_set_primary(asoc, asconf->transport); in sctp_process_asconf_param()
3138 asconf->transport); in sctp_process_asconf_param()
3143 * ASCONF-ACK with Error Cause Indication Parameter in sctp_process_asconf_param()
3159 if (af->is_any(&addr)) in sctp_process_asconf_param()
3162 if (security_sctp_bind_connect(asoc->ep->base.sk, in sctp_process_asconf_param()
3165 af->sockaddr_len)) in sctp_process_asconf_param()
3188 addip = (struct sctp_addip_chunk *)chunk->chunk_hdr; in sctp_verify_asconf()
3190 size_t length = ntohs(param.p->length); in sctp_verify_asconf()
3193 switch (param.p->type) { in sctp_verify_asconf()
3202 if (param.v != addip->addip_hdr.params) in sctp_verify_asconf()
3209 if (param.v != addip->addip_hdr.params) in sctp_verify_asconf()
3219 length = ntohs(param.addip->param_hdr.length); in sctp_verify_asconf()
3240 if (param.v != chunk->chunk_end) in sctp_verify_asconf()
3262 addip = (struct sctp_addip_chunk *)asconf->chunk_hdr; in sctp_process_asconf()
3263 chunk_len = ntohs(asconf->chunk_hdr->length) - in sctp_process_asconf()
3265 hdr = (struct sctp_addiphdr *)asconf->skb->data; in sctp_process_asconf()
3266 serial = ntohl(hdr->serial); in sctp_process_asconf()
3270 addr_param = (union sctp_addr_param *)(asconf->skb->data + length); in sctp_process_asconf()
3271 chunk_len -= length; in sctp_process_asconf()
3276 length = ntohs(addr_param->p.length); in sctp_process_asconf()
3277 chunk_len -= length; in sctp_process_asconf()
3291 if (param.p->type == SCTP_PARAM_IPV4_ADDRESS || in sctp_process_asconf()
3292 param.p->type == SCTP_PARAM_IPV6_ADDRESS) in sctp_process_asconf()
3307 sctp_add_asconf_response(asconf_ack, param.addip->crr_id, in sctp_process_asconf()
3319 asoc->peer.addip_serial++; in sctp_process_asconf()
3326 list_add_tail(&asconf_ack->transmitted_list, in sctp_process_asconf()
3327 &asoc->asconf_ack_list); in sctp_process_asconf()
3337 struct sctp_bind_addr *bp = &asoc->base.bind_addr; in sctp_asconf_param_success()
3347 af = sctp_get_af_specific(param_type2af(addr_param->p.type)); in sctp_asconf_param_success()
3348 if (!af->from_addr_param(&addr, addr_param, htons(bp->port), 0)) in sctp_asconf_param_success()
3351 switch (asconf_param->param_hdr.type) { in sctp_asconf_param_success()
3357 list_for_each_entry(saddr, &bp->address_list, list) { in sctp_asconf_param_success()
3358 if (sctp_cmp_addr_exact(&saddr->a, &addr)) in sctp_asconf_param_success()
3359 saddr->state = SCTP_ADDR_SRC; in sctp_asconf_param_success()
3362 list_for_each_entry(transport, &asoc->peer.transport_addr_list, in sctp_asconf_param_success()
3370 if (asoc->asconf_addr_del_pending != NULL && in sctp_asconf_param_success()
3371 sctp_cmp_addr_exact(asoc->asconf_addr_del_pending, &addr)) { in sctp_asconf_param_success()
3372 kfree(asoc->asconf_addr_del_pending); in sctp_asconf_param_success()
3373 asoc->asconf_addr_del_pending = NULL; in sctp_asconf_param_success()
3376 list_for_each_entry(transport, &asoc->peer.transport_addr_list, in sctp_asconf_param_success()
3410 asconf_ack_len = ntohs(asconf_ack->chunk_hdr->length) - in sctp_get_asconf_response()
3417 asconf_ack_param = (struct sctp_addip_param *)(asconf_ack->skb->data + in sctp_get_asconf_response()
3419 asconf_ack_len -= length; in sctp_get_asconf_response()
3422 if (asconf_ack_param->crr_id == asconf_param->crr_id) { in sctp_get_asconf_response()
3423 switch (asconf_ack_param->param_hdr.type) { in sctp_get_asconf_response()
3429 asconf_ack_len -= length; in sctp_get_asconf_response()
3431 return err_param->cause; in sctp_get_asconf_response()
3440 length = ntohs(asconf_ack_param->param_hdr.length); in sctp_get_asconf_response()
3442 asconf_ack_len -= length; in sctp_get_asconf_response()
3452 struct sctp_chunk *asconf = asoc->addip_last_asconf; in sctp_process_asconf_ack()
3456 int asconf_len = asconf->skb->len; in sctp_process_asconf_ack()
3466 addr_param = (union sctp_addr_param *)(asconf->skb->data + length); in sctp_process_asconf_ack()
3467 asconf_len -= length; in sctp_process_asconf_ack()
3472 length = ntohs(addr_param->p.length); in sctp_process_asconf_ack()
3474 asconf_len -= length; in sctp_process_asconf_ack()
3481 if (asconf_ack->skb->len == sizeof(struct sctp_addiphdr)) in sctp_process_asconf_ack()
3509 asoc->peer.addip_disabled_mask |= in sctp_process_asconf_ack()
3510 asconf_param->param_hdr.type; in sctp_process_asconf_ack()
3523 length = ntohs(asconf_param->param_hdr.length); in sctp_process_asconf_ack()
3525 asconf_len -= length; in sctp_process_asconf_ack()
3528 if (no_err && asoc->src_out_of_asoc_ok) { in sctp_process_asconf_ack()
3529 asoc->src_out_of_asoc_ok = 0; in sctp_process_asconf_ack()
3530 sctp_transport_immediate_rtx(asoc->peer.primary_path); in sctp_process_asconf_ack()
3534 list_del_init(&asconf->transmitted_list); in sctp_process_asconf_ack()
3536 asoc->addip_last_asconf = NULL; in sctp_process_asconf_ack()
3541 /* Make a FWD TSN chunk. */
3560 retval->subh.fwdtsn_hdr = in sctp_make_fwdtsn()
3588 retval->subh.ifwdtsn_hdr = in sctp_make_ifwdtsn()
3596 /* RE-CONFIG 3.1 (RE-CONFIG chunk)
3599 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3601 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3603 * / Re-configuration Parameter /
3605 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3607 * / Re-configuration Parameter (optional) /
3609 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3622 reconf = (struct sctp_reconf_chunk *)retval->chunk_hdr; in sctp_make_reconf()
3623 retval->param_hdr.v = reconf->params; in sctp_make_reconf()
3628 /* RE-CONFIG 4.1 (STREAM OUT RESET)
3631 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3633 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3634 * | Re-configuration Request Sequence Number |
3635 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3636 * | Re-configuration Response Sequence Number |
3637 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3638 * | Sender's Last Assigned TSN |
3639 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3641 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3643 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3644 * | Stream Number N-1 (optional) | Stream Number N (optional) |
3645 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3647 * RE-CONFIG 4.2 (STREAM IN RESET)
3650 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3652 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3653 * | Re-configuration Request Sequence Number |
3654 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3656 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3658 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3659 * | Stream Number N-1 (optional) | Stream Number N (optional) |
3660 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3683 outreq.request_seq = htonl(asoc->strreset_outseq); in sctp_make_strreset_req()
3684 outreq.response_seq = htonl(asoc->strreset_inseq - 1); in sctp_make_strreset_req()
3685 outreq.send_reset_at_tsn = htonl(asoc->next_tsn - 1); in sctp_make_strreset_req()
3696 inreq.request_seq = htonl(asoc->strreset_outseq + out); in sctp_make_strreset_req()
3707 /* RE-CONFIG 4.3 (SSN/TSN RESET ALL)
3710 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3712 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3713 * | Re-configuration Request Sequence Number |
3714 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3729 tsnreq.request_seq = htonl(asoc->strreset_outseq); in sctp_make_strreset_tsnreq()
3736 /* RE-CONFIG 4.5/4.6 (ADD STREAM)
3739 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3741 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3742 * | Re-configuration Request Sequence Number |
3743 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3745 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3763 addstrm.request_seq = htonl(asoc->strreset_outseq); in sctp_make_strreset_addstrm()
3773 addstrm.request_seq = htonl(asoc->strreset_outseq + !!out); in sctp_make_strreset_addstrm()
3782 /* RE-CONFIG 4.4 (RESP)
3785 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3787 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3788 * | Re-configuration Response Sequence Number |
3789 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3791 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3814 /* RE-CONFIG 4.4 OPTIONAL (TSNRESP)
3817 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3819 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3820 * | Re-configuration Response Sequence Number |
3821 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3823 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3824 * | Sender's Next TSN (optional) |
3825 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3826 * | Receiver's Next TSN (optional) |
3827 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3864 hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr; in sctp_verify_reconf()
3866 __u16 length = ntohs(param.p->length); in sctp_verify_reconf()
3871 switch (param.p->type) { in sctp_verify_reconf()
3909 last = param.p->type; in sctp_verify_reconf()