Deleted Added
full compact
sctp_output.c (237565) sctp_output.c (237715)
1/*-
2 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
3 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
4 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
3 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
4 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_output.c 237565 2012-06-25 17:15:09Z tuexen $");
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_output.c 237715 2012-06-28 16:01:08Z tuexen $");
35
36#include <netinet/sctp_os.h>
37#include <sys/proc.h>
38#include <netinet/sctp_var.h>
39#include <netinet/sctp_sysctl.h>
40#include <netinet/sctp_header.h>
41#include <netinet/sctp_pcb.h>
42#include <netinet/sctputil.h>

--- 5141 unchanged lines hidden (view full) ---

5184 /* Only copy back the p-hdr that caused the issue */
5185 m_copyback(op_err, err_at, sizeof(struct sctp_paramhdr), (caddr_t)phdr);
5186 }
5187 return (op_err);
5188}
5189
5190static int
5191sctp_are_there_new_addresses(struct sctp_association *asoc,
35
36#include <netinet/sctp_os.h>
37#include <sys/proc.h>
38#include <netinet/sctp_var.h>
39#include <netinet/sctp_sysctl.h>
40#include <netinet/sctp_header.h>
41#include <netinet/sctp_pcb.h>
42#include <netinet/sctputil.h>

--- 5141 unchanged lines hidden (view full) ---

5184 /* Only copy back the p-hdr that caused the issue */
5185 m_copyback(op_err, err_at, sizeof(struct sctp_paramhdr), (caddr_t)phdr);
5186 }
5187 return (op_err);
5188}
5189
5190static int
5191sctp_are_there_new_addresses(struct sctp_association *asoc,
5192 struct mbuf *in_initpkt, int offset)
5192 struct mbuf *in_initpkt, int offset, struct sockaddr *src)
5193{
5194 /*
5195 * Given a INIT packet, look through the packet to verify that there
5196 * are NO new addresses. As we go through the parameters add reports
5197 * of any un-understood parameters that require an error. Also we
5198 * must return (1) to drop the packet if we see a un-understood
5199 * parameter that tells us to drop the chunk.
5200 */
5201 struct sockaddr *sa_touse;
5202 struct sockaddr *sa;
5203 struct sctp_paramhdr *phdr, params;
5204 uint16_t ptype, plen;
5205 uint8_t fnd;
5206 struct sctp_nets *net;
5193{
5194 /*
5195 * Given a INIT packet, look through the packet to verify that there
5196 * are NO new addresses. As we go through the parameters add reports
5197 * of any un-understood parameters that require an error. Also we
5198 * must return (1) to drop the packet if we see a un-understood
5199 * parameter that tells us to drop the chunk.
5200 */
5201 struct sockaddr *sa_touse;
5202 struct sockaddr *sa;
5203 struct sctp_paramhdr *phdr, params;
5204 uint16_t ptype, plen;
5205 uint8_t fnd;
5206 struct sctp_nets *net;
5207 struct ip *iph;
5208
5209#ifdef INET
5210 struct sockaddr_in sin4, *sa4;
5211
5212#endif
5213#ifdef INET6
5214 struct sockaddr_in6 sin6, *sa6;
5207
5208#ifdef INET
5209 struct sockaddr_in sin4, *sa4;
5210
5211#endif
5212#ifdef INET6
5213 struct sockaddr_in6 sin6, *sa6;
5215 struct ip6_hdr *ip6h;
5216
5217#endif
5218
5219#ifdef INET
5220 memset(&sin4, 0, sizeof(sin4));
5221 sin4.sin_family = AF_INET;
5222 sin4.sin_len = sizeof(sin4);
5223#endif
5224#ifdef INET6
5225 memset(&sin6, 0, sizeof(sin6));
5226 sin6.sin6_family = AF_INET6;
5227 sin6.sin6_len = sizeof(sin6);
5228#endif
5214
5215#endif
5216
5217#ifdef INET
5218 memset(&sin4, 0, sizeof(sin4));
5219 sin4.sin_family = AF_INET;
5220 sin4.sin_len = sizeof(sin4);
5221#endif
5222#ifdef INET6
5223 memset(&sin6, 0, sizeof(sin6));
5224 sin6.sin6_family = AF_INET6;
5225 sin6.sin6_len = sizeof(sin6);
5226#endif
5229 sa_touse = NULL;
5230 /* First what about the src address of the pkt ? */
5227 /* First what about the src address of the pkt ? */
5231 iph = mtod(in_initpkt, struct ip *);
5232 switch (iph->ip_v) {
5233#ifdef INET
5234 case IPVERSION:
5235 /* source addr is IPv4 */
5236 sin4.sin_addr = iph->ip_src;
5237 sa_touse = (struct sockaddr *)&sin4;
5238 break;
5239#endif
5240#ifdef INET6
5241 case IPV6_VERSION >> 4:
5242 /* source addr is IPv6 */
5243 ip6h = mtod(in_initpkt, struct ip6_hdr *);
5244 sin6.sin6_addr = ip6h->ip6_src;
5245 sa_touse = (struct sockaddr *)&sin6;
5246 break;
5247#endif
5248 default:
5249 return (1);
5250 }
5251
5252 fnd = 0;
5253 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5254 sa = (struct sockaddr *)&net->ro._l_addr;
5228 fnd = 0;
5229 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5230 sa = (struct sockaddr *)&net->ro._l_addr;
5255 if (sa->sa_family == sa_touse->sa_family) {
5231 if (sa->sa_family == src->sa_family) {
5256#ifdef INET
5257 if (sa->sa_family == AF_INET) {
5232#ifdef INET
5233 if (sa->sa_family == AF_INET) {
5234 struct sockaddr_in *src4;
5235
5258 sa4 = (struct sockaddr_in *)sa;
5236 sa4 = (struct sockaddr_in *)sa;
5259 if (sa4->sin_addr.s_addr == sin4.sin_addr.s_addr) {
5237 src4 = (struct sockaddr_in *)src;
5238 if (sa4->sin_addr.s_addr == src4->sin_addr.s_addr) {
5260 fnd = 1;
5261 break;
5262 }
5263 }
5264#endif
5265#ifdef INET6
5266 if (sa->sa_family == AF_INET6) {
5239 fnd = 1;
5240 break;
5241 }
5242 }
5243#endif
5244#ifdef INET6
5245 if (sa->sa_family == AF_INET6) {
5246 struct sockaddr_in6 *src6;
5247
5267 sa6 = (struct sockaddr_in6 *)sa;
5248 sa6 = (struct sockaddr_in6 *)sa;
5268 if (SCTP6_ARE_ADDR_EQUAL(sa6, &sin6)) {
5249 src6 = (struct sockaddr_in6 *)src;
5250 if (SCTP6_ARE_ADDR_EQUAL(sa6, src6)) {
5269 fnd = 1;
5270 break;
5271 }
5272 }
5273#endif
5274 }
5275 }
5276 if (fnd == 0) {

--- 91 unchanged lines hidden (view full) ---

5368 * Given a MBUF chain that was sent into us containing an INIT. Build a
5369 * INIT-ACK with COOKIE and send back. We assume that the in_initpkt has done
5370 * a pullup to include IPv6/4header, SCTP header and initial part of INIT
5371 * message (i.e. the struct sctp_init_msg).
5372 */
5373void
5374sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
5375 struct mbuf *init_pkt, int iphlen, int offset,
5251 fnd = 1;
5252 break;
5253 }
5254 }
5255#endif
5256 }
5257 }
5258 if (fnd == 0) {

--- 91 unchanged lines hidden (view full) ---

5350 * Given a MBUF chain that was sent into us containing an INIT. Build a
5351 * INIT-ACK with COOKIE and send back. We assume that the in_initpkt has done
5352 * a pullup to include IPv6/4header, SCTP header and initial part of INIT
5353 * message (i.e. the struct sctp_init_msg).
5354 */
5355void
5356sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
5357 struct mbuf *init_pkt, int iphlen, int offset,
5358 struct sockaddr *src, struct sockaddr *dst,
5376 struct sctphdr *sh, struct sctp_init_chunk *init_chk,
5377 uint8_t use_mflowid, uint32_t mflowid,
5378 uint32_t vrf_id, uint16_t port, int hold_inp_lock)
5379{
5380 struct sctp_association *asoc;
5381 struct mbuf *m, *m_at, *m_tmp, *m_cookie, *op_err, *mp_last;
5382 struct sctp_init_ack_chunk *initack;
5383 struct sctp_adaptation_layer_indication *ali;
5384 struct sctp_ecn_supported_param *ecn;
5385 struct sctp_prsctp_supported_param *prsctp;
5386 struct sctp_supported_chunk_types_param *pr_supported;
5359 struct sctphdr *sh, struct sctp_init_chunk *init_chk,
5360 uint8_t use_mflowid, uint32_t mflowid,
5361 uint32_t vrf_id, uint16_t port, int hold_inp_lock)
5362{
5363 struct sctp_association *asoc;
5364 struct mbuf *m, *m_at, *m_tmp, *m_cookie, *op_err, *mp_last;
5365 struct sctp_init_ack_chunk *initack;
5366 struct sctp_adaptation_layer_indication *ali;
5367 struct sctp_ecn_supported_param *ecn;
5368 struct sctp_prsctp_supported_param *prsctp;
5369 struct sctp_supported_chunk_types_param *pr_supported;
5387 union sctp_sockstore store, store1, *over_addr;
5370 union sctp_sockstore *over_addr;
5388
5389#ifdef INET
5371
5372#ifdef INET
5390 struct sockaddr_in *sin, *to_sin;
5373 struct sockaddr_in *dst4 = (struct sockaddr_in *)dst;
5374 struct sockaddr_in *src4 = (struct sockaddr_in *)src;
5375 struct sockaddr_in *sin;
5391
5392#endif
5393#ifdef INET6
5376
5377#endif
5378#ifdef INET6
5394 struct sockaddr_in6 *sin6, *to_sin6;
5379 struct sockaddr_in6 *dst6 = (struct sockaddr_in6 *)dst;
5380 struct sockaddr_in6 *src6 = (struct sockaddr_in6 *)src;
5381 struct sockaddr_in6 *sin6;
5395
5396#endif
5382
5383#endif
5397 struct ip *iph;
5398
5399#ifdef INET6
5400 struct ip6_hdr *ip6;
5401
5402#endif
5403 struct sockaddr *to;
5404 struct sctp_state_cookie stc;
5405 struct sctp_nets *net = NULL;
5406 uint8_t *signature = NULL;
5407 int cnt_inits_to = 0;
5408 uint16_t his_limit, i_want;
5409 int abort_flag, padval;
5410 int num_ext;
5411 int p_len;
5412 int nat_friendly = 0;
5413 struct socket *so;
5414
5384 struct sockaddr *to;
5385 struct sctp_state_cookie stc;
5386 struct sctp_nets *net = NULL;
5387 uint8_t *signature = NULL;
5388 int cnt_inits_to = 0;
5389 uint16_t his_limit, i_want;
5390 int abort_flag, padval;
5391 int num_ext;
5392 int p_len;
5393 int nat_friendly = 0;
5394 struct socket *so;
5395
5415 if (stcb)
5396 if (stcb) {
5416 asoc = &stcb->asoc;
5397 asoc = &stcb->asoc;
5417 else
5398 } else {
5418 asoc = NULL;
5399 asoc = NULL;
5400 }
5419 mp_last = NULL;
5420 if ((asoc != NULL) &&
5421 (SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_WAIT) &&
5401 mp_last = NULL;
5402 if ((asoc != NULL) &&
5403 (SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_WAIT) &&
5422 (sctp_are_there_new_addresses(asoc, init_pkt, offset))) {
5404 (sctp_are_there_new_addresses(asoc, init_pkt, offset, src))) {
5423 /* new addresses, out of here in non-cookie-wait states */
5424 /*
5425 * Send a ABORT, we don't add the new address error clause
5426 * though we even set the T bit and copy in the 0 tag.. this
5427 * looks no different than if no listener was present.
5428 */
5405 /* new addresses, out of here in non-cookie-wait states */
5406 /*
5407 * Send a ABORT, we don't add the new address error clause
5408 * though we even set the T bit and copy in the 0 tag.. this
5409 * looks no different than if no listener was present.
5410 */
5429 sctp_send_abort(init_pkt, iphlen, sh, 0, NULL,
5411 sctp_send_abort(init_pkt, iphlen, src, dst, sh, 0, NULL,
5430 use_mflowid, mflowid,
5431 vrf_id, port);
5432 return;
5433 }
5434 abort_flag = 0;
5435 op_err = sctp_arethere_unrecognized_parameters(init_pkt,
5436 (offset + sizeof(struct sctp_init_chunk)),
5437 &abort_flag, (struct sctp_chunkhdr *)init_chk, &nat_friendly);
5438 if (abort_flag) {
5439do_a_abort:
5412 use_mflowid, mflowid,
5413 vrf_id, port);
5414 return;
5415 }
5416 abort_flag = 0;
5417 op_err = sctp_arethere_unrecognized_parameters(init_pkt,
5418 (offset + sizeof(struct sctp_init_chunk)),
5419 &abort_flag, (struct sctp_chunkhdr *)init_chk, &nat_friendly);
5420 if (abort_flag) {
5421do_a_abort:
5440 sctp_send_abort(init_pkt, iphlen, sh,
5422 sctp_send_abort(init_pkt, iphlen, src, dst, sh,
5441 init_chk->init.initiate_tag, op_err,
5442 use_mflowid, mflowid,
5443 vrf_id, port);
5444 return;
5445 }
5446 m = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_DONTWAIT, 1, MT_DATA);
5447 if (m == NULL) {
5448 /* No memory, INIT timer will re-attempt. */

--- 48 unchanged lines hidden (view full) ---

5497 stc.ipv6_addr_legal = 0;
5498 }
5499
5500#ifdef SCTP_DONT_DO_PRIVADDR_SCOPE
5501 stc.ipv4_scope = 1;
5502#else
5503 stc.ipv4_scope = 0;
5504#endif
5423 init_chk->init.initiate_tag, op_err,
5424 use_mflowid, mflowid,
5425 vrf_id, port);
5426 return;
5427 }
5428 m = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_DONTWAIT, 1, MT_DATA);
5429 if (m == NULL) {
5430 /* No memory, INIT timer will re-attempt. */

--- 48 unchanged lines hidden (view full) ---

5479 stc.ipv6_addr_legal = 0;
5480 }
5481
5482#ifdef SCTP_DONT_DO_PRIVADDR_SCOPE
5483 stc.ipv4_scope = 1;
5484#else
5485 stc.ipv4_scope = 0;
5486#endif
5505 /* now for scope setup */
5506 memset((caddr_t)&store, 0, sizeof(store));
5507 memset((caddr_t)&store1, 0, sizeof(store1));
5508#ifdef INET
5509 sin = &store.sin;
5510 to_sin = &store1.sin;
5511#endif
5512#ifdef INET6
5513 sin6 = &store.sin6;
5514 to_sin6 = &store1.sin6;
5515#endif
5516 iph = mtod(init_pkt, struct ip *);
5517 /* establish the to_addr's */
5518 switch (iph->ip_v) {
5519#ifdef INET
5520 case IPVERSION:
5521 to_sin->sin_port = sh->dest_port;
5522 to_sin->sin_family = AF_INET;
5523 to_sin->sin_len = sizeof(struct sockaddr_in);
5524 to_sin->sin_addr = iph->ip_dst;
5525 break;
5526#endif
5527#ifdef INET6
5528 case IPV6_VERSION >> 4:
5529 ip6 = mtod(init_pkt, struct ip6_hdr *);
5530 to_sin6->sin6_addr = ip6->ip6_dst;
5531 to_sin6->sin6_scope_id = 0;
5532 to_sin6->sin6_port = sh->dest_port;
5533 to_sin6->sin6_family = AF_INET6;
5534 to_sin6->sin6_len = sizeof(struct sockaddr_in6);
5535 break;
5536#endif
5537 default:
5538 goto do_a_abort;
5539 break;
5540 }
5541
5542 if (net == NULL) {
5487 if (net == NULL) {
5543 to = (struct sockaddr *)&store;
5544 switch (iph->ip_v) {
5488 to = src;
5489 switch (dst->sa_family) {
5545#ifdef INET
5490#ifdef INET
5546 case IPVERSION:
5491 case AF_INET:
5547 {
5492 {
5548 sin->sin_family = AF_INET;
5549 sin->sin_len = sizeof(struct sockaddr_in);
5550 sin->sin_port = sh->src_port;
5551 sin->sin_addr = iph->ip_src;
5552 /* lookup address */
5493 /* lookup address */
5553 stc.address[0] = sin->sin_addr.s_addr;
5494 stc.address[0] = src4->sin_addr.s_addr;
5554 stc.address[1] = 0;
5555 stc.address[2] = 0;
5556 stc.address[3] = 0;
5557 stc.addr_type = SCTP_IPV4_ADDRESS;
5558 /* local from address */
5495 stc.address[1] = 0;
5496 stc.address[2] = 0;
5497 stc.address[3] = 0;
5498 stc.addr_type = SCTP_IPV4_ADDRESS;
5499 /* local from address */
5559 stc.laddress[0] = to_sin->sin_addr.s_addr;
5500 stc.laddress[0] = dst4->sin_addr.s_addr;
5560 stc.laddress[1] = 0;
5561 stc.laddress[2] = 0;
5562 stc.laddress[3] = 0;
5563 stc.laddr_type = SCTP_IPV4_ADDRESS;
5564 /* scope_id is only for v6 */
5565 stc.scope_id = 0;
5566#ifndef SCTP_DONT_DO_PRIVADDR_SCOPE
5501 stc.laddress[1] = 0;
5502 stc.laddress[2] = 0;
5503 stc.laddress[3] = 0;
5504 stc.laddr_type = SCTP_IPV4_ADDRESS;
5505 /* scope_id is only for v6 */
5506 stc.scope_id = 0;
5507#ifndef SCTP_DONT_DO_PRIVADDR_SCOPE
5567 if (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) {
5508 if (IN4_ISPRIVATE_ADDRESS(&src4->sin_addr)) {
5568 stc.ipv4_scope = 1;
5569 }
5570#else
5571 stc.ipv4_scope = 1;
5572#endif /* SCTP_DONT_DO_PRIVADDR_SCOPE */
5573 /* Must use the address in this case */
5509 stc.ipv4_scope = 1;
5510 }
5511#else
5512 stc.ipv4_scope = 1;
5513#endif /* SCTP_DONT_DO_PRIVADDR_SCOPE */
5514 /* Must use the address in this case */
5574 if (sctp_is_address_on_local_host((struct sockaddr *)sin, vrf_id)) {
5515 if (sctp_is_address_on_local_host(src, vrf_id)) {
5575 stc.loopback_scope = 1;
5576 stc.ipv4_scope = 1;
5577 stc.site_scope = 1;
5578 stc.local_scope = 0;
5579 }
5580 break;
5581 }
5582#endif
5583#ifdef INET6
5516 stc.loopback_scope = 1;
5517 stc.ipv4_scope = 1;
5518 stc.site_scope = 1;
5519 stc.local_scope = 0;
5520 }
5521 break;
5522 }
5523#endif
5524#ifdef INET6
5584 case IPV6_VERSION >> 4:
5525 case AF_INET6:
5585 {
5526 {
5586 ip6 = mtod(init_pkt, struct ip6_hdr *);
5587 sin6->sin6_family = AF_INET6;
5588 sin6->sin6_len = sizeof(struct sockaddr_in6);
5589 sin6->sin6_port = sh->src_port;
5590 sin6->sin6_addr = ip6->ip6_src;
5591 /* lookup address */
5592 memcpy(&stc.address, &sin6->sin6_addr,
5593 sizeof(struct in6_addr));
5594 sin6->sin6_scope_id = 0;
5595 stc.addr_type = SCTP_IPV6_ADDRESS;
5527 stc.addr_type = SCTP_IPV6_ADDRESS;
5596 stc.scope_id = 0;
5597 if (sctp_is_address_on_local_host((struct sockaddr *)sin6, vrf_id)) {
5598 /*
5599 * FIX ME: does this have scope from
5600 * rcvif?
5601 */
5602 (void)sa6_recoverscope(sin6);
5603 stc.scope_id = sin6->sin6_scope_id;
5604 sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone));
5528 stc.scope_id = in6_getscope(&src6->sin6_addr);
5529 if (sctp_is_address_on_local_host(src, vrf_id)) {
5605 stc.loopback_scope = 1;
5606 stc.local_scope = 0;
5607 stc.site_scope = 1;
5608 stc.ipv4_scope = 1;
5530 stc.loopback_scope = 1;
5531 stc.local_scope = 0;
5532 stc.site_scope = 1;
5533 stc.ipv4_scope = 1;
5609 } else if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
5534 } else if (IN6_IS_ADDR_LINKLOCAL(&src6->sin6_addr)) {
5610 /*
5611 * If the new destination is a
5612 * LINK_LOCAL we must have common
5613 * both site and local scope. Don't
5614 * set local scope though since we
5615 * must depend on the source to be
5616 * added implicitly. We cannot
5617 * assure just because we share one

--- 8 unchanged lines hidden (view full) ---

5626 * link local we source from won't
5627 * show up in our scoped count.
5628 */
5629 cnt_inits_to = 1;
5630 /*
5631 * pull out the scope_id from
5632 * incoming pkt
5633 */
5535 /*
5536 * If the new destination is a
5537 * LINK_LOCAL we must have common
5538 * both site and local scope. Don't
5539 * set local scope though since we
5540 * must depend on the source to be
5541 * added implicitly. We cannot
5542 * assure just because we share one

--- 8 unchanged lines hidden (view full) ---

5551 * link local we source from won't
5552 * show up in our scoped count.
5553 */
5554 cnt_inits_to = 1;
5555 /*
5556 * pull out the scope_id from
5557 * incoming pkt
5558 */
5559 } else if (IN6_IS_ADDR_SITELOCAL(&src6->sin6_addr)) {
5634 /*
5560 /*
5635 * FIX ME: does this have scope from
5636 * rcvif?
5637 */
5638 (void)sa6_recoverscope(sin6);
5639 stc.scope_id = sin6->sin6_scope_id;
5640 sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone));
5641 } else if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) {
5642 /*
5643 * If the new destination is
5644 * SITE_LOCAL then we must have site
5645 * scope in common.
5646 */
5647 stc.site_scope = 1;
5648 }
5561 * If the new destination is
5562 * SITE_LOCAL then we must have site
5563 * scope in common.
5564 */
5565 stc.site_scope = 1;
5566 }
5649 memcpy(&stc.laddress, &to_sin6->sin6_addr, sizeof(struct in6_addr));
5567 memcpy(&stc.laddress, &dst6->sin6_addr, sizeof(struct in6_addr));
5650 stc.laddr_type = SCTP_IPV6_ADDRESS;
5651 break;
5652 }
5653#endif
5654 default:
5655 /* TSNH */
5656 goto do_a_abort;
5657 break;

--- 63 unchanged lines hidden (view full) ---

5721 sin6 = (struct sockaddr_in6 *)to;
5722 memcpy(&stc.address, &sin6->sin6_addr,
5723 sizeof(struct in6_addr));
5724 stc.addr_type = SCTP_IPV6_ADDRESS;
5725 stc.scope_id = sin6->sin6_scope_id;
5726 if (net->src_addr_selected == 0) {
5727 /*
5728 * strange case here, the INIT should have
5568 stc.laddr_type = SCTP_IPV6_ADDRESS;
5569 break;
5570 }
5571#endif
5572 default:
5573 /* TSNH */
5574 goto do_a_abort;
5575 break;

--- 63 unchanged lines hidden (view full) ---

5639 sin6 = (struct sockaddr_in6 *)to;
5640 memcpy(&stc.address, &sin6->sin6_addr,
5641 sizeof(struct in6_addr));
5642 stc.addr_type = SCTP_IPV6_ADDRESS;
5643 stc.scope_id = sin6->sin6_scope_id;
5644 if (net->src_addr_selected == 0) {
5645 /*
5646 * strange case here, the INIT should have
5729 * did the selection.
5647 * done the selection.
5730 */
5731 net->ro._s_addr = sctp_source_address_selection(inp,
5732 stcb, (sctp_route_t *) & net->ro,
5733 net, 0, vrf_id);
5734 if (net->ro._s_addr == NULL)
5735 return;
5736
5737 net->src_addr_selected = 1;

--- 291 unchanged lines hidden (view full) ---

6029 /* see my previous comments on mp_last */
6030 if (sctp_add_pad_tombuf(mp_last, (4 - padval))) {
6031 /* Houston we have a problem, no space */
6032 sctp_m_freem(m);
6033 return;
6034 }
6035 }
6036 if (stc.loopback_scope) {
5648 */
5649 net->ro._s_addr = sctp_source_address_selection(inp,
5650 stcb, (sctp_route_t *) & net->ro,
5651 net, 0, vrf_id);
5652 if (net->ro._s_addr == NULL)
5653 return;
5654
5655 net->src_addr_selected = 1;

--- 291 unchanged lines hidden (view full) ---

5947 /* see my previous comments on mp_last */
5948 if (sctp_add_pad_tombuf(mp_last, (4 - padval))) {
5949 /* Houston we have a problem, no space */
5950 sctp_m_freem(m);
5951 return;
5952 }
5953 }
5954 if (stc.loopback_scope) {
6037 over_addr = &store1;
5955 over_addr = (union sctp_sockstore *)dst;
6038 } else {
6039 over_addr = NULL;
6040 }
6041
6042 (void)sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0,
6043 0, 0,
6044 inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag,
6045 port, over_addr,

--- 4828 unchanged lines hidden (view full) ---

10874 net->port, NULL,
10875 0, 0,
10876 SCTP_SO_NOT_LOCKED);
10877 SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
10878 return;
10879}
10880
10881static void
5956 } else {
5957 over_addr = NULL;
5958 }
5959
5960 (void)sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0,
5961 0, 0,
5962 inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag,
5963 port, over_addr,

--- 4828 unchanged lines hidden (view full) ---

10792 net->port, NULL,
10793 0, 0,
10794 SCTP_SO_NOT_LOCKED);
10795 SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
10796 return;
10797}
10798
10799static void
10882sctp_send_resp_msg(struct mbuf *m, struct sctphdr *sh, uint32_t vtag,
10800sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
10801 struct sctphdr *sh, uint32_t vtag,
10883 uint8_t type, struct mbuf *cause,
10884 uint8_t use_mflowid, uint32_t mflowid,
10885 uint32_t vrf_id, uint16_t port)
10886{
10887 struct mbuf *o_pak;
10888 struct mbuf *mout;
10889 struct sctphdr *shout;
10890 struct sctp_chunkhdr *ch;
10802 uint8_t type, struct mbuf *cause,
10803 uint8_t use_mflowid, uint32_t mflowid,
10804 uint32_t vrf_id, uint16_t port)
10805{
10806 struct mbuf *o_pak;
10807 struct mbuf *mout;
10808 struct sctphdr *shout;
10809 struct sctp_chunkhdr *ch;
10891 struct ip *iph;
10892 struct udphdr *udp;
10893 int len, cause_len, padding_len, ret;
10894
10895#ifdef INET
10896 sctp_route_t ro;
10810 struct udphdr *udp;
10811 int len, cause_len, padding_len, ret;
10812
10813#ifdef INET
10814 sctp_route_t ro;
10897 struct ip *iph_out;
10815 struct sockaddr_in *src_sin, *dst_sin;
10816 struct ip *ip;
10898
10899#endif
10900#ifdef INET6
10817
10818#endif
10819#ifdef INET6
10901 struct ip6_hdr *ip6, *ip6_out;
10820 struct sockaddr_in6 *src_sin6, *dst_sin6;
10821 struct ip6_hdr *ip6;
10902
10903#endif
10904
10905 /* Compute the length of the cause and add final padding. */
10906 cause_len = 0;
10907 if (cause != NULL) {
10908 struct mbuf *m_at, *m_last = NULL;
10909

--- 12 unchanged lines hidden (view full) ---

10922 return;
10923 }
10924 }
10925 } else {
10926 padding_len = 0;
10927 }
10928 /* Get an mbuf for the header. */
10929 len = sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr);
10822
10823#endif
10824
10825 /* Compute the length of the cause and add final padding. */
10826 cause_len = 0;
10827 if (cause != NULL) {
10828 struct mbuf *m_at, *m_last = NULL;
10829

--- 12 unchanged lines hidden (view full) ---

10842 return;
10843 }
10844 }
10845 } else {
10846 padding_len = 0;
10847 }
10848 /* Get an mbuf for the header. */
10849 len = sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr);
10930 iph = mtod(m, struct ip *);
10931 switch (iph->ip_v) {
10850 switch (dst->sa_family) {
10932#ifdef INET
10851#ifdef INET
10933 case IPVERSION:
10852 case AF_INET:
10934 len += sizeof(struct ip);
10935 break;
10936#endif
10937#ifdef INET6
10853 len += sizeof(struct ip);
10854 break;
10855#endif
10856#ifdef INET6
10938 case IPV6_VERSION >> 4:
10857 case AF_INET6:
10939 len += sizeof(struct ip6_hdr);
10940 break;
10941#endif
10942 default:
10943 break;
10944 }
10945 if (port) {
10946 len += sizeof(struct udphdr);

--- 8 unchanged lines hidden (view full) ---

10955 SCTP_BUF_RESV_UF(mout, max_linkhdr);
10956 SCTP_BUF_LEN(mout) = len;
10957 SCTP_BUF_NEXT(mout) = cause;
10958 if (use_mflowid != 0) {
10959 mout->m_pkthdr.flowid = mflowid;
10960 mout->m_flags |= M_FLOWID;
10961 }
10962#ifdef INET
10858 len += sizeof(struct ip6_hdr);
10859 break;
10860#endif
10861 default:
10862 break;
10863 }
10864 if (port) {
10865 len += sizeof(struct udphdr);

--- 8 unchanged lines hidden (view full) ---

10874 SCTP_BUF_RESV_UF(mout, max_linkhdr);
10875 SCTP_BUF_LEN(mout) = len;
10876 SCTP_BUF_NEXT(mout) = cause;
10877 if (use_mflowid != 0) {
10878 mout->m_pkthdr.flowid = mflowid;
10879 mout->m_flags |= M_FLOWID;
10880 }
10881#ifdef INET
10963 iph_out = NULL;
10882 ip = NULL;
10964#endif
10965#ifdef INET6
10883#endif
10884#ifdef INET6
10966 ip6_out = NULL;
10885 ip6 = NULL;
10967#endif
10886#endif
10968 switch (iph->ip_v) {
10887 switch (dst->sa_family) {
10969#ifdef INET
10888#ifdef INET
10970 case IPVERSION:
10971 iph_out = mtod(mout, struct ip *);
10972 iph_out->ip_v = IPVERSION;
10973 iph_out->ip_hl = (sizeof(struct ip) >> 2);
10974 iph_out->ip_tos = 0;
10975 iph_out->ip_id = ip_newid();
10976 iph_out->ip_off = 0;
10977 iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl);
10889 case AF_INET:
10890 src_sin = (struct sockaddr_in *)src;
10891 dst_sin = (struct sockaddr_in *)dst;
10892 ip = mtod(mout, struct ip *);
10893 ip->ip_v = IPVERSION;
10894 ip->ip_hl = (sizeof(struct ip) >> 2);
10895 ip->ip_tos = 0;
10896 ip->ip_id = ip_newid();
10897 ip->ip_off = 0;
10898 ip->ip_ttl = MODULE_GLOBAL(ip_defttl);
10978 if (port) {
10899 if (port) {
10979 iph_out->ip_p = IPPROTO_UDP;
10900 ip->ip_p = IPPROTO_UDP;
10980 } else {
10901 } else {
10981 iph_out->ip_p = IPPROTO_SCTP;
10902 ip->ip_p = IPPROTO_SCTP;
10982 }
10903 }
10983 iph_out->ip_src.s_addr = iph->ip_dst.s_addr;
10984 iph_out->ip_dst.s_addr = iph->ip_src.s_addr;
10985 iph_out->ip_sum = 0;
10904 ip->ip_src.s_addr = dst_sin->sin_addr.s_addr;
10905 ip->ip_dst.s_addr = src_sin->sin_addr.s_addr;
10906 ip->ip_sum = 0;
10986 len = sizeof(struct ip);
10907 len = sizeof(struct ip);
10987 shout = (struct sctphdr *)((caddr_t)iph_out + len);
10908 shout = (struct sctphdr *)((caddr_t)ip + len);
10988 break;
10989#endif
10990#ifdef INET6
10909 break;
10910#endif
10911#ifdef INET6
10991 case IPV6_VERSION >> 4:
10992 ip6 = (struct ip6_hdr *)iph;
10993 ip6_out = mtod(mout, struct ip6_hdr *);
10994 ip6_out->ip6_flow = htonl(0x60000000);
10912 case AF_INET6:
10913 src_sin6 = (struct sockaddr_in6 *)src;
10914 dst_sin6 = (struct sockaddr_in6 *)dst;
10915 ip6 = mtod(mout, struct ip6_hdr *);
10916 ip6->ip6_flow = htonl(0x60000000);
10995 if (V_ip6_auto_flowlabel) {
10917 if (V_ip6_auto_flowlabel) {
10996 ip6_out->ip6_flow |= (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK);
10918 ip6->ip6_flow |= (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK);
10997 }
10919 }
10998 ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim);
10920 ip6->ip6_hlim = MODULE_GLOBAL(ip6_defhlim);
10999 if (port) {
10921 if (port) {
11000 ip6_out->ip6_nxt = IPPROTO_UDP;
10922 ip6->ip6_nxt = IPPROTO_UDP;
11001 } else {
10923 } else {
11002 ip6_out->ip6_nxt = IPPROTO_SCTP;
10924 ip6->ip6_nxt = IPPROTO_SCTP;
11003 }
10925 }
11004 ip6_out->ip6_src = ip6->ip6_dst;
11005 ip6_out->ip6_dst = ip6->ip6_src;
10926 ip6->ip6_src = dst_sin6->sin6_addr;
10927 ip6->ip6_dst = src_sin6->sin6_addr;
11006 len = sizeof(struct ip6_hdr);
10928 len = sizeof(struct ip6_hdr);
11007 shout = (struct sctphdr *)((caddr_t)ip6_out + len);
10929 shout = (struct sctphdr *)((caddr_t)ip6 + len);
11008 break;
11009#endif
11010 default:
11011 len = 0;
11012 shout = mtod(mout, struct sctphdr *);
11013 break;
11014 }
11015 if (port) {

--- 35 unchanged lines hidden (view full) ---

11051 len += cause_len + padding_len;
11052
11053 if (SCTP_GET_HEADER_FOR_OUTPUT(o_pak)) {
11054 sctp_m_freem(mout);
11055 return;
11056 }
11057 SCTP_ATTACH_CHAIN(o_pak, mout, len);
11058#ifdef INET
10930 break;
10931#endif
10932 default:
10933 len = 0;
10934 shout = mtod(mout, struct sctphdr *);
10935 break;
10936 }
10937 if (port) {

--- 35 unchanged lines hidden (view full) ---

10973 len += cause_len + padding_len;
10974
10975 if (SCTP_GET_HEADER_FOR_OUTPUT(o_pak)) {
10976 sctp_m_freem(mout);
10977 return;
10978 }
10979 SCTP_ATTACH_CHAIN(o_pak, mout, len);
10980#ifdef INET
11059 if (iph_out != NULL) {
10981 if (ip != NULL) {
11060 /* zap the stack pointer to the route */
11061 bzero(&ro, sizeof(sctp_route_t));
11062 if (port) {
11063 if (V_udp_cksum) {
10982 /* zap the stack pointer to the route */
10983 bzero(&ro, sizeof(sctp_route_t));
10984 if (port) {
10985 if (V_udp_cksum) {
11064 udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
10986 udp->uh_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
11065 } else {
11066 udp->uh_sum = 0;
11067 }
11068 }
10987 } else {
10988 udp->uh_sum = 0;
10989 }
10990 }
11069 iph_out->ip_len = len;
10991 ip->ip_len = len;
11070 if (port) {
11071#if defined(SCTP_WITH_NO_CSUM)
11072 SCTP_STAT_INCR(sctps_sendnocrc);
11073#else
11074 shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip) + sizeof(struct udphdr));
11075 SCTP_STAT_INCR(sctps_sendswcrc);
11076#endif
11077 if (V_udp_cksum) {

--- 16 unchanged lines hidden (view full) ---

11094 SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id);
11095 /* Free the route if we got one back */
11096 if (ro.ro_rt) {
11097 RTFREE(ro.ro_rt);
11098 }
11099 }
11100#endif
11101#ifdef INET6
10992 if (port) {
10993#if defined(SCTP_WITH_NO_CSUM)
10994 SCTP_STAT_INCR(sctps_sendnocrc);
10995#else
10996 shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip) + sizeof(struct udphdr));
10997 SCTP_STAT_INCR(sctps_sendswcrc);
10998#endif
10999 if (V_udp_cksum) {

--- 16 unchanged lines hidden (view full) ---

11016 SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id);
11017 /* Free the route if we got one back */
11018 if (ro.ro_rt) {
11019 RTFREE(ro.ro_rt);
11020 }
11021 }
11022#endif
11023#ifdef INET6
11102 if (ip6_out != NULL) {
11103 ip6_out->ip6_plen = len - sizeof(struct ip6_hdr);
11024 if (ip6 != NULL) {
11025 ip6->ip6_plen = len - sizeof(struct ip6_hdr);
11104 if (port) {
11105#if defined(SCTP_WITH_NO_CSUM)
11106 SCTP_STAT_INCR(sctps_sendnocrc);
11107#else
11108 shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
11109 SCTP_STAT_INCR(sctps_sendswcrc);
11110#endif
11111 if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) {

--- 18 unchanged lines hidden (view full) ---

11130#endif
11131 SCTP_STAT_INCR(sctps_sendpackets);
11132 SCTP_STAT_INCR_COUNTER64(sctps_outpackets);
11133 SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
11134 return;
11135}
11136
11137void
11026 if (port) {
11027#if defined(SCTP_WITH_NO_CSUM)
11028 SCTP_STAT_INCR(sctps_sendnocrc);
11029#else
11030 shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
11031 SCTP_STAT_INCR(sctps_sendswcrc);
11032#endif
11033 if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) {

--- 18 unchanged lines hidden (view full) ---

11052#endif
11053 SCTP_STAT_INCR(sctps_sendpackets);
11054 SCTP_STAT_INCR_COUNTER64(sctps_outpackets);
11055 SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
11056 return;
11057}
11058
11059void
11138sctp_send_shutdown_complete2(struct mbuf *m, struct sctphdr *sh,
11060sctp_send_shutdown_complete2(struct sockaddr *src, struct sockaddr *dst,
11061 struct sctphdr *sh,
11139 uint8_t use_mflowid, uint32_t mflowid,
11140 uint32_t vrf_id, uint16_t port)
11141{
11062 uint8_t use_mflowid, uint32_t mflowid,
11063 uint32_t vrf_id, uint16_t port)
11064{
11142 sctp_send_resp_msg(m, sh, 0, SCTP_SHUTDOWN_COMPLETE, NULL,
11065 sctp_send_resp_msg(src, dst, sh, 0, SCTP_SHUTDOWN_COMPLETE, NULL,
11143 use_mflowid, mflowid,
11144 vrf_id, port);
11145}
11146
11147void
11148sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked
11149#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
11150 SCTP_UNUSED

--- 163 unchanged lines hidden (view full) ---

11314sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net,
11315 struct mbuf *m, int len, int iphlen, int bad_crc)
11316{
11317 struct sctp_association *asoc;
11318 struct sctp_pktdrop_chunk *drp;
11319 struct sctp_tmit_chunk *chk;
11320 uint8_t *datap;
11321 int was_trunc = 0;
11066 use_mflowid, mflowid,
11067 vrf_id, port);
11068}
11069
11070void
11071sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked
11072#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
11073 SCTP_UNUSED

--- 163 unchanged lines hidden (view full) ---

11237sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net,
11238 struct mbuf *m, int len, int iphlen, int bad_crc)
11239{
11240 struct sctp_association *asoc;
11241 struct sctp_pktdrop_chunk *drp;
11242 struct sctp_tmit_chunk *chk;
11243 uint8_t *datap;
11244 int was_trunc = 0;
11322 struct ip *iph;
11323 int fullsz = 0;
11324 long spc;
11325 int offset;
11326 struct sctp_chunkhdr *ch, chunk_buf;
11327 unsigned int chk_length;
11328
11329 if (!stcb) {
11330 return;

--- 9 unchanged lines hidden (view full) ---

11340 if (stcb->sctp_socket == NULL) {
11341 return;
11342 }
11343 sctp_alloc_a_chunk(stcb, chk);
11344 if (chk == NULL) {
11345 return;
11346 }
11347 chk->copy_by_ref = 0;
11245 int fullsz = 0;
11246 long spc;
11247 int offset;
11248 struct sctp_chunkhdr *ch, chunk_buf;
11249 unsigned int chk_length;
11250
11251 if (!stcb) {
11252 return;

--- 9 unchanged lines hidden (view full) ---

11262 if (stcb->sctp_socket == NULL) {
11263 return;
11264 }
11265 sctp_alloc_a_chunk(stcb, chk);
11266 if (chk == NULL) {
11267 return;
11268 }
11269 chk->copy_by_ref = 0;
11348 iph = mtod(m, struct ip *);
11349 if (iph == NULL) {
11350 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
11351 return;
11352 }
11353 len -= iphlen;
11354 chk->send_size = len;
11355 /* Validate that we do not have an ABORT in here. */
11356 offset = iphlen + sizeof(struct sctphdr);
11357 ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset,
11358 sizeof(*ch), (uint8_t *) & chunk_buf);
11359 while (ch != NULL) {
11360 chk_length = ntohs(ch->chunk_length);

--- 585 unchanged lines hidden (view full) ---

11946 chk,
11947 sctp_next);
11948 asoc->ctrl_queue_cnt++;
11949 sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo);
11950 return (0);
11951}
11952
11953void
11270 len -= iphlen;
11271 chk->send_size = len;
11272 /* Validate that we do not have an ABORT in here. */
11273 offset = iphlen + sizeof(struct sctphdr);
11274 ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset,
11275 sizeof(*ch), (uint8_t *) & chunk_buf);
11276 while (ch != NULL) {
11277 chk_length = ntohs(ch->chunk_length);

--- 585 unchanged lines hidden (view full) ---

11863 chk,
11864 sctp_next);
11865 asoc->ctrl_queue_cnt++;
11866 sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo);
11867 return (0);
11868}
11869
11870void
11954sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag,
11955 struct mbuf *cause,
11871sctp_send_abort(struct mbuf *m, int iphlen, struct sockaddr *src, struct sockaddr *dst,
11872 struct sctphdr *sh, uint32_t vtag, struct mbuf *cause,
11956 uint8_t use_mflowid, uint32_t mflowid,
11957 uint32_t vrf_id, uint16_t port)
11958{
11959 /* Don't respond to an ABORT with an ABORT. */
11960 if (sctp_is_there_an_abort_here(m, iphlen, &vtag)) {
11961 if (cause)
11962 sctp_m_freem(cause);
11963 return;
11964 }
11873 uint8_t use_mflowid, uint32_t mflowid,
11874 uint32_t vrf_id, uint16_t port)
11875{
11876 /* Don't respond to an ABORT with an ABORT. */
11877 if (sctp_is_there_an_abort_here(m, iphlen, &vtag)) {
11878 if (cause)
11879 sctp_m_freem(cause);
11880 return;
11881 }
11965 sctp_send_resp_msg(m, sh, vtag, SCTP_ABORT_ASSOCIATION, cause,
11882 sctp_send_resp_msg(src, dst, sh, vtag, SCTP_ABORT_ASSOCIATION, cause,
11966 use_mflowid, mflowid,
11967 vrf_id, port);
11968 return;
11969}
11970
11971void
11883 use_mflowid, mflowid,
11884 vrf_id, port);
11885 return;
11886}
11887
11888void
11972sctp_send_operr_to(struct mbuf *m, struct sctphdr *sh, uint32_t vtag,
11973 struct mbuf *cause,
11889sctp_send_operr_to(struct sockaddr *src, struct sockaddr *dst,
11890 struct sctphdr *sh, uint32_t vtag, struct mbuf *cause,
11974 uint8_t use_mflowid, uint32_t mflowid,
11975 uint32_t vrf_id, uint16_t port)
11976{
11891 uint8_t use_mflowid, uint32_t mflowid,
11892 uint32_t vrf_id, uint16_t port)
11893{
11977 sctp_send_resp_msg(m, sh, vtag, SCTP_OPERATION_ERROR, cause,
11894 sctp_send_resp_msg(src, dst, sh, vtag, SCTP_OPERATION_ERROR, cause,
11978 use_mflowid, mflowid,
11979 vrf_id, port);
11980 return;
11981}
11982
11983static struct mbuf *
11984sctp_copy_resume(struct uio *uio,
11985 int max_send_len,

--- 1512 unchanged lines hidden ---
11895 use_mflowid, mflowid,
11896 vrf_id, port);
11897 return;
11898}
11899
11900static struct mbuf *
11901sctp_copy_resume(struct uio *uio,
11902 int max_send_len,

--- 1512 unchanged lines hidden ---