sctp_pcb.c (ceaad40ae729dea2c5d8ffcfdd45bb96fb8969d2) sctp_pcb.c (851b7298b3f8f09d1a337bcd5bbe7222543872f5)
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

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

291 SCTP_DEREGISTER_INTERFACE(sctp_ifnp->ifn_index,
292 sctp_ifnp->registered_af);
293 if (hold_addr_lock == 0)
294 SCTP_IPI_ADDR_UNLOCK();
295 /* Take away the reference, and possibly free it */
296 sctp_free_ifn(sctp_ifnp);
297}
298
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

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

291 SCTP_DEREGISTER_INTERFACE(sctp_ifnp->ifn_index,
292 sctp_ifnp->registered_af);
293 if (hold_addr_lock == 0)
294 SCTP_IPI_ADDR_UNLOCK();
295 /* Take away the reference, and possibly free it */
296 sctp_free_ifn(sctp_ifnp);
297}
298
299void
300sctp_mark_ifa_addr_down(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index)
301{
302 struct sctp_vrf *vrf;
303 struct sctp_ifa *sctp_ifap = NULL;
299
304
305 SCTP_IPI_ADDR_LOCK();
306 vrf = sctp_find_vrf(vrf_id);
307 if (vrf == NULL) {
308 SCTPDBG(SCTP_DEBUG_PCB1, "Can't find vrf_id:%d\n", vrf_id);
309 goto out;
310
311 }
312 sctp_ifap = sctp_find_ifa_by_addr(addr, vrf->vrf_id, SCTP_ADDR_LOCKED);
313 if (sctp_ifap == NULL) {
314 SCTPDBG(SCTP_DEBUG_PCB1, "Can't find sctp_ifap for address\n");
315 goto out;
316 }
317 if (sctp_ifap->ifn_p == NULL) {
318 SCTPDBG(SCTP_DEBUG_PCB1, "IFA has no IFN - can't mark unuseable\n");
319 goto out;
320 }
321 if (if_name) {
322 int len1, len2;
323
324 len1 = strlen(if_name);
325 len2 = strlen(sctp_ifap->ifn_p->ifn_name);
326 if (len1 != len2) {
327 SCTPDBG(SCTP_DEBUG_PCB1, "IFN of ifa names different lenght %d vs %d - ignored\n",
328 len1, len2);
329 goto out;
330 }
331 if (strncmp(if_name, sctp_ifap->ifn_p->ifn_name, len1) != 0) {
332 SCTPDBG(SCTP_DEBUG_PCB1, "IFN %s of IFA not the same as %s\n",
333 sctp_ifap->ifn_p->ifn_name,
334 if_name);
335 goto out;
336 }
337 } else {
338 if (sctp_ifap->ifn_p->ifn_index != ifn_index) {
339 SCTPDBG(SCTP_DEBUG_PCB1, "IFA owned by ifn_index:%d down command for ifn_index:%d - ignored\n",
340 sctp_ifap->ifn_p->ifn_index, ifn_index);
341 goto out;
342 }
343 }
344
345 sctp_ifap->localifa_flags &= (~SCTP_ADDR_VALID);
346 sctp_ifap->localifa_flags |= SCTP_ADDR_IFA_UNUSEABLE;
347out:
348 SCTP_IPI_ADDR_UNLOCK();
349}
350
351void
352sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index)
353{
354 struct sctp_vrf *vrf;
355 struct sctp_ifa *sctp_ifap = NULL;
356
357 SCTP_IPI_ADDR_LOCK();
358 vrf = sctp_find_vrf(vrf_id);
359 if (vrf == NULL) {
360 SCTPDBG(SCTP_DEBUG_PCB1, "Can't find vrf_id:%d\n", vrf_id);
361 goto out;
362
363 }
364 sctp_ifap = sctp_find_ifa_by_addr(addr, vrf->vrf_id, SCTP_ADDR_LOCKED);
365 if (sctp_ifap == NULL) {
366 SCTPDBG(SCTP_DEBUG_PCB1, "Can't find sctp_ifap for address\n");
367 goto out;
368 }
369 if (sctp_ifap->ifn_p == NULL) {
370 SCTPDBG(SCTP_DEBUG_PCB1, "IFA has no IFN - can't mark unuseable\n");
371 goto out;
372 }
373 if (if_name) {
374 int len1, len2;
375
376 len1 = strlen(if_name);
377 len2 = strlen(sctp_ifap->ifn_p->ifn_name);
378 if (len1 != len2) {
379 SCTPDBG(SCTP_DEBUG_PCB1, "IFN of ifa names different lenght %d vs %d - ignored\n",
380 len1, len2);
381 goto out;
382 }
383 if (strncmp(if_name, sctp_ifap->ifn_p->ifn_name, len1) != 0) {
384 SCTPDBG(SCTP_DEBUG_PCB1, "IFN %s of IFA not the same as %s\n",
385 sctp_ifap->ifn_p->ifn_name,
386 if_name);
387 goto out;
388 }
389 } else {
390 if (sctp_ifap->ifn_p->ifn_index != ifn_index) {
391 SCTPDBG(SCTP_DEBUG_PCB1, "IFA owned by ifn_index:%d down command for ifn_index:%d - ignored\n",
392 sctp_ifap->ifn_p->ifn_index, ifn_index);
393 goto out;
394 }
395 }
396
397 sctp_ifap->localifa_flags &= (~SCTP_ADDR_IFA_UNUSEABLE);
398 sctp_ifap->localifa_flags |= SCTP_ADDR_VALID;
399out:
400 SCTP_IPI_ADDR_UNLOCK();
401}
402
403
300struct sctp_ifa *
301sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
302 uint32_t ifn_type, const char *if_name,
303 void *ifa, struct sockaddr *addr, uint32_t ifa_flags,
304 int dynamic_add)
305{
306 struct sctp_vrf *vrf;
307 struct sctp_ifn *sctp_ifnp = NULL;

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

356 hash_ifn_head = &sctppcbinfo.vrf_ifn_hash[(ifn_index & sctppcbinfo.vrf_ifn_hashmark)];
357 LIST_INIT(&sctp_ifnp->ifalist);
358 SCTP_IPI_ADDR_LOCK();
359 LIST_INSERT_HEAD(hash_ifn_head, sctp_ifnp, next_bucket);
360 LIST_INSERT_HEAD(&vrf->ifnlist, sctp_ifnp, next_ifn);
361 atomic_add_int(&sctppcbinfo.ipi_count_ifns, 1);
362 new_ifn_af = 1;
363 }
404struct sctp_ifa *
405sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
406 uint32_t ifn_type, const char *if_name,
407 void *ifa, struct sockaddr *addr, uint32_t ifa_flags,
408 int dynamic_add)
409{
410 struct sctp_vrf *vrf;
411 struct sctp_ifn *sctp_ifnp = NULL;

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

460 hash_ifn_head = &sctppcbinfo.vrf_ifn_hash[(ifn_index & sctppcbinfo.vrf_ifn_hashmark)];
461 LIST_INIT(&sctp_ifnp->ifalist);
462 SCTP_IPI_ADDR_LOCK();
463 LIST_INSERT_HEAD(hash_ifn_head, sctp_ifnp, next_bucket);
464 LIST_INSERT_HEAD(&vrf->ifnlist, sctp_ifnp, next_ifn);
465 atomic_add_int(&sctppcbinfo.ipi_count_ifns, 1);
466 new_ifn_af = 1;
467 }
364 sctp_ifap = sctp_find_ifa_by_addr(addr, vrf->vrf_id, 1);
468 sctp_ifap = sctp_find_ifa_by_addr(addr, vrf->vrf_id, SCTP_ADDR_LOCKED);
365 if (sctp_ifap) {
366 /* Hmm, it already exists? */
367 if ((sctp_ifap->ifn_p) &&
368 (sctp_ifap->ifn_p->ifn_index == ifn_index)) {
369 if (new_ifn_af) {
370 /* Remove the created one that we don't want */
371 sctp_delete_ifn(sctp_ifnp, 1);
372 }

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

379 SCTP_IPI_ADDR_UNLOCK();
380 return (sctp_ifap);
381 } else {
382 goto exit_stage_left;
383 }
384 } else {
385 if (sctp_ifap->ifn_p) {
386 /*
469 if (sctp_ifap) {
470 /* Hmm, it already exists? */
471 if ((sctp_ifap->ifn_p) &&
472 (sctp_ifap->ifn_p->ifn_index == ifn_index)) {
473 if (new_ifn_af) {
474 /* Remove the created one that we don't want */
475 sctp_delete_ifn(sctp_ifnp, 1);
476 }

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

483 SCTP_IPI_ADDR_UNLOCK();
484 return (sctp_ifap);
485 } else {
486 goto exit_stage_left;
487 }
488 } else {
489 if (sctp_ifap->ifn_p) {
490 /*
387 * The first IFN gets the address,
388 * duplicates are ignored.
491 * The last IFN gets the address, old ones
492 * are deleted.
389 */
390 if (new_ifn_af) {
391 /*
392 * Remove the created one that we
393 * don't want
394 */
493 */
494 if (new_ifn_af) {
495 /*
496 * Remove the created one that we
497 * don't want
498 */
395 sctp_delete_ifn(sctp_ifnp, 1);
499 sctp_free_ifn(sctp_ifap->ifn_p);
500 if (sctp_ifap->ifn_p->refcount == 1)
501 sctp_delete_ifn(sctp_ifap->ifn_p, 1);
502 sctp_ifap->ifn_p = sctp_ifnp;
503 atomic_add_int(&sctp_ifap->ifn_p->refcount, 1);
396 }
397 goto exit_stage_left;
398 } else {
399 /* repair ifnp which was NULL ? */
400 sctp_ifap->localifa_flags = SCTP_ADDR_VALID;
401 sctp_ifap->ifn_p = sctp_ifnp;
402 atomic_add_int(&sctp_ifap->ifn_p->refcount, 1);
403 }

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

483 wi = SCTP_ZONE_GET(sctppcbinfo.ipi_zone_laddr, struct sctp_laddr);
484 if (wi == NULL) {
485 /*
486 * Gak, what can we do? We have lost an address
487 * change can you say HOSED?
488 */
489 SCTPDBG(SCTP_DEBUG_PCB1, "Lost and address change ???\n");
490 /* Opps, must decrement the count */
504 }
505 goto exit_stage_left;
506 } else {
507 /* repair ifnp which was NULL ? */
508 sctp_ifap->localifa_flags = SCTP_ADDR_VALID;
509 sctp_ifap->ifn_p = sctp_ifnp;
510 atomic_add_int(&sctp_ifap->ifn_p->refcount, 1);
511 }

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

591 wi = SCTP_ZONE_GET(sctppcbinfo.ipi_zone_laddr, struct sctp_laddr);
592 if (wi == NULL) {
593 /*
594 * Gak, what can we do? We have lost an address
595 * change can you say HOSED?
596 */
597 SCTPDBG(SCTP_DEBUG_PCB1, "Lost and address change ???\n");
598 /* Opps, must decrement the count */
491 sctp_del_addr_from_vrf(vrf_id, addr, ifn_index);
599 sctp_del_addr_from_vrf(vrf_id, addr, ifn_index, if_name);
492 return (NULL);
493 }
494 SCTP_INCR_LADDR_COUNT();
495 bzero(wi, sizeof(*wi));
496 (void)SCTP_GETTIME_TIMEVAL(&wi->start_time);
497 wi->ifa = sctp_ifap;
498 wi->action = SCTP_ADD_IP_ADDRESS;
499 SCTP_IPI_ITERATOR_WQ_LOCK();

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

511 /* it's ready for use */
512 sctp_ifap->localifa_flags &= ~SCTP_ADDR_DEFER_USE;
513 }
514 return (sctp_ifap);
515}
516
517void
518sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
600 return (NULL);
601 }
602 SCTP_INCR_LADDR_COUNT();
603 bzero(wi, sizeof(*wi));
604 (void)SCTP_GETTIME_TIMEVAL(&wi->start_time);
605 wi->ifa = sctp_ifap;
606 wi->action = SCTP_ADD_IP_ADDRESS;
607 SCTP_IPI_ITERATOR_WQ_LOCK();

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

619 /* it's ready for use */
620 sctp_ifap->localifa_flags &= ~SCTP_ADDR_DEFER_USE;
621 }
622 return (sctp_ifap);
623}
624
625void
626sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
519 uint32_t ifn_index)
627 uint32_t ifn_index, const char *if_name)
520{
521 struct sctp_vrf *vrf;
522 struct sctp_ifa *sctp_ifap = NULL;
523
524 SCTP_IPI_ADDR_LOCK();
525
526 vrf = sctp_find_vrf(vrf_id);
527 if (vrf == NULL) {
528 SCTP_PRINTF("Can't find vrf_id:%d\n", vrf_id);
529 goto out_now;
530 }
628{
629 struct sctp_vrf *vrf;
630 struct sctp_ifa *sctp_ifap = NULL;
631
632 SCTP_IPI_ADDR_LOCK();
633
634 vrf = sctp_find_vrf(vrf_id);
635 if (vrf == NULL) {
636 SCTP_PRINTF("Can't find vrf_id:%d\n", vrf_id);
637 goto out_now;
638 }
531 sctp_ifap = sctp_find_ifa_by_addr(addr, vrf->vrf_id, 1);
639 sctp_ifap = sctp_find_ifa_by_addr(addr, vrf->vrf_id, SCTP_ADDR_LOCKED);
532 if (sctp_ifap) {
640 if (sctp_ifap) {
641 /* Validate the delete */
642 if (sctp_ifap->ifn_p) {
643 int valid = 0;
644
645 /*-
646 * The name has priority over the ifn_index
647 * if its given. We do this especially for
648 * panda who might recycle indexes fast.
649 */
650 if (if_name) {
651 int len1, len2;
652
653 len1 = min(SCTP_IFNAMSIZ, strlen(if_name));
654 len2 = min(SCTP_IFNAMSIZ, strlen(sctp_ifap->ifn_p->ifn_name));
655 if (len1 && len2 && (len1 == len2)) {
656 /* we can compare them */
657 if (strncmp(if_name, sctp_ifap->ifn_p->ifn_name, len1) == 0) {
658 /*
659 * They match its a correct
660 * delete
661 */
662 valid = 1;
663 }
664 }
665 }
666 if (!valid) {
667 /* last ditch check ifn_index */
668 if (ifn_index == sctp_ifap->ifn_p->ifn_index) {
669 valid = 1;
670 }
671 }
672 if (!valid) {
673#ifdef SCTP_DEBUG
674 SCTPDBG(SCTP_DEBUG_PCB1, "Deleting address:");
675 SCTPDBG_ADDR(SCTP_DEBUG_PCB1, addr);
676 SCTPDBG(SCTP_DEBUG_PCB1, "ifn:%d ifname:%s does not match addresses\n",
677 ifn_index, ((if_name == NULL) ? "NULL" : if_name));
678 SCTPDBG(SCTP_DEBUG_PCB1, "ifn:%d ifname:%s - ignoring delete\n",
679 sctp_ifap->ifn_p->ifn_index, sctp_ifap->ifn_p->ifn_name);
680#endif
681 return;
682 }
683 }
533 sctp_ifap->localifa_flags &= SCTP_ADDR_VALID;
534 sctp_ifap->localifa_flags |= SCTP_BEING_DELETED;
535 vrf->total_ifa_count--;
536 LIST_REMOVE(sctp_ifap, next_bucket);
537 LIST_REMOVE(sctp_ifap, next_ifa);
538 if (sctp_ifap->ifn_p) {
539 sctp_ifap->ifn_p->ifa_count--;
540 if (sctp_ifap->address.sa.sa_family == AF_INET6)

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

1852 SCTP_PCB_FLAGS_UNBOUND);
1853 /* Be sure we have blocking IO by default */
1854 SCTP_CLEAR_SO_NBIO(so);
1855 } else {
1856 /*
1857 * unsupported socket type (RAW, etc)- in case we missed it
1858 * in protosw
1859 */
684 sctp_ifap->localifa_flags &= SCTP_ADDR_VALID;
685 sctp_ifap->localifa_flags |= SCTP_BEING_DELETED;
686 vrf->total_ifa_count--;
687 LIST_REMOVE(sctp_ifap, next_bucket);
688 LIST_REMOVE(sctp_ifap, next_ifa);
689 if (sctp_ifap->ifn_p) {
690 sctp_ifap->ifn_p->ifa_count--;
691 if (sctp_ifap->address.sa.sa_family == AF_INET6)

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

2003 SCTP_PCB_FLAGS_UNBOUND);
2004 /* Be sure we have blocking IO by default */
2005 SCTP_CLEAR_SO_NBIO(so);
2006 } else {
2007 /*
2008 * unsupported socket type (RAW, etc)- in case we missed it
2009 * in protosw
2010 */
1860 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_ep, inp);
1861 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EOPNOTSUPP);
2011 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EOPNOTSUPP);
2012 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_ep, inp);
1862 return (EOPNOTSUPP);
1863 }
1864 if (sctp_default_frag_interleave == SCTP_FRAG_LEVEL_1) {
1865 sctp_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE);
1866 sctp_feature_off(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS);
1867 } else if (sctp_default_frag_interleave == SCTP_FRAG_LEVEL_2) {
1868 sctp_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE);
1869 sctp_feature_on(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS);
1870 } else if (sctp_default_frag_interleave == SCTP_FRAG_LEVEL_0) {
1871 sctp_feature_off(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE);
1872 sctp_feature_off(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS);
1873 }
1874 inp->sctp_tcbhash = SCTP_HASH_INIT(sctp_pcbtblsize,
1875 &inp->sctp_hashmark);
1876 if (inp->sctp_tcbhash == NULL) {
1877 SCTP_PRINTF("Out of SCTP-INPCB->hashinit - no resources\n");
2013 return (EOPNOTSUPP);
2014 }
2015 if (sctp_default_frag_interleave == SCTP_FRAG_LEVEL_1) {
2016 sctp_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE);
2017 sctp_feature_off(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS);
2018 } else if (sctp_default_frag_interleave == SCTP_FRAG_LEVEL_2) {
2019 sctp_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE);
2020 sctp_feature_on(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS);
2021 } else if (sctp_default_frag_interleave == SCTP_FRAG_LEVEL_0) {
2022 sctp_feature_off(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE);
2023 sctp_feature_off(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS);
2024 }
2025 inp->sctp_tcbhash = SCTP_HASH_INIT(sctp_pcbtblsize,
2026 &inp->sctp_hashmark);
2027 if (inp->sctp_tcbhash == NULL) {
2028 SCTP_PRINTF("Out of SCTP-INPCB->hashinit - no resources\n");
1878 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_ep, inp);
1879 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, ENOBUFS);
2029 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, ENOBUFS);
2030 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_ep, inp);
1880 return (ENOBUFS);
1881 }
1882 inp->def_vrf_id = vrf_id;
1883
1884 SCTP_INP_INFO_WLOCK();
1885 SCTP_INP_LOCK_INIT(inp);
1886 INP_LOCK_INIT(&inp->ip_inp.inp, "inp", "sctpinp");
1887 SCTP_INP_READ_INIT(inp);

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

2081
2082 stcb->asoc.hb_timer.ep = (void *)new_inp;
2083 stcb->asoc.dack_timer.ep = (void *)new_inp;
2084 stcb->asoc.asconf_timer.ep = (void *)new_inp;
2085 stcb->asoc.strreset_timer.ep = (void *)new_inp;
2086 stcb->asoc.shut_guard_timer.ep = (void *)new_inp;
2087 stcb->asoc.autoclose_timer.ep = (void *)new_inp;
2088 stcb->asoc.delayed_event_timer.ep = (void *)new_inp;
2031 return (ENOBUFS);
2032 }
2033 inp->def_vrf_id = vrf_id;
2034
2035 SCTP_INP_INFO_WLOCK();
2036 SCTP_INP_LOCK_INIT(inp);
2037 INP_LOCK_INIT(&inp->ip_inp.inp, "inp", "sctpinp");
2038 SCTP_INP_READ_INIT(inp);

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

2232
2233 stcb->asoc.hb_timer.ep = (void *)new_inp;
2234 stcb->asoc.dack_timer.ep = (void *)new_inp;
2235 stcb->asoc.asconf_timer.ep = (void *)new_inp;
2236 stcb->asoc.strreset_timer.ep = (void *)new_inp;
2237 stcb->asoc.shut_guard_timer.ep = (void *)new_inp;
2238 stcb->asoc.autoclose_timer.ep = (void *)new_inp;
2239 stcb->asoc.delayed_event_timer.ep = (void *)new_inp;
2240 stcb->asoc.delete_prim_timer.ep = (void *)new_inp;
2089 /* now what about the nets? */
2090 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
2091 net->pmtu_timer.ep = (void *)new_inp;
2092 net->rxt_timer.ep = (void *)new_inp;
2093 net->fr_timer.ep = (void *)new_inp;
2094 }
2095 SCTP_INP_WUNLOCK(new_inp);
2096 SCTP_INP_WUNLOCK(old_inp);

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

2405 sctp_feature_on(inp, SCTP_PCB_FLAGS_AUTO_ASCONF);
2406 }
2407 /*
2408 * set the automatic mobility_base from kernel flag (by
2409 * micchie)
2410 */
2411 if (sctp_mobility_base == 0) {
2412 sctp_mobility_feature_off(inp, SCTP_MOBILITY_BASE);
2241 /* now what about the nets? */
2242 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
2243 net->pmtu_timer.ep = (void *)new_inp;
2244 net->rxt_timer.ep = (void *)new_inp;
2245 net->fr_timer.ep = (void *)new_inp;
2246 }
2247 SCTP_INP_WUNLOCK(new_inp);
2248 SCTP_INP_WUNLOCK(old_inp);

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

2557 sctp_feature_on(inp, SCTP_PCB_FLAGS_AUTO_ASCONF);
2558 }
2559 /*
2560 * set the automatic mobility_base from kernel flag (by
2561 * micchie)
2562 */
2563 if (sctp_mobility_base == 0) {
2564 sctp_mobility_feature_off(inp, SCTP_MOBILITY_BASE);
2565 sctp_mobility_feature_off(inp, SCTP_MOBILITY_PRIM_DELETED);
2413 } else {
2414 sctp_mobility_feature_on(inp, SCTP_MOBILITY_BASE);
2566 } else {
2567 sctp_mobility_feature_on(inp, SCTP_MOBILITY_BASE);
2568 sctp_mobility_feature_off(inp, SCTP_MOBILITY_PRIM_DELETED);
2415 }
2416 /*
2417 * set the automatic mobility_fasthandoff from kernel flag
2418 * (by micchie)
2419 */
2420 if (sctp_mobility_fasthandoff == 0) {
2421 sctp_mobility_feature_off(inp, SCTP_MOBILITY_FASTHANDOFF);
2569 }
2570 /*
2571 * set the automatic mobility_fasthandoff from kernel flag
2572 * (by micchie)
2573 */
2574 if (sctp_mobility_fasthandoff == 0) {
2575 sctp_mobility_feature_off(inp, SCTP_MOBILITY_FASTHANDOFF);
2422 sctp_mobility_feature_off(inp, SCTP_MOBILITY_DO_FASTHANDOFF);
2576 sctp_mobility_feature_off(inp, SCTP_MOBILITY_PRIM_DELETED);
2423 } else {
2424 sctp_mobility_feature_on(inp, SCTP_MOBILITY_FASTHANDOFF);
2577 } else {
2578 sctp_mobility_feature_on(inp, SCTP_MOBILITY_FASTHANDOFF);
2425 sctp_mobility_feature_off(inp, SCTP_MOBILITY_DO_FASTHANDOFF);
2579 sctp_mobility_feature_off(inp, SCTP_MOBILITY_PRIM_DELETED);
2426 }
2427 } else {
2428 /*
2429 * bind specific, make sure flags is off and add a new
2430 * address structure to the sctp_addr_list inside the ep
2431 * structure.
2432 *
2433 * We will need to allocate one and insert it at the head. The

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

2461 ifa = sctp_ifap;
2462 else {
2463 /*
2464 * Note for BSD we hit here always other O/S's will
2465 * pass things in via the sctp_ifap argument
2466 * (Panda).
2467 */
2468 ifa = sctp_find_ifa_by_addr((struct sockaddr *)&store_sa,
2580 }
2581 } else {
2582 /*
2583 * bind specific, make sure flags is off and add a new
2584 * address structure to the sctp_addr_list inside the ep
2585 * structure.
2586 *
2587 * We will need to allocate one and insert it at the head. The

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

2615 ifa = sctp_ifap;
2616 else {
2617 /*
2618 * Note for BSD we hit here always other O/S's will
2619 * pass things in via the sctp_ifap argument
2620 * (Panda).
2621 */
2622 ifa = sctp_find_ifa_by_addr((struct sockaddr *)&store_sa,
2469 vrf_id, 0);
2623 vrf_id, SCTP_ADDR_NOT_LOCKED);
2470 }
2471 if (ifa == NULL) {
2472 /* Can't find an interface with that address */
2473 SCTP_INP_WUNLOCK(inp);
2474 SCTP_INP_INFO_WUNLOCK();
2475 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRNOTAVAIL);
2476 return (EADDRNOTAVAIL);
2477 }

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

2620 /* First time through we have the socket lock, after that no more. */
2621 if (from == SCTP_CALLED_AFTER_CMPSET_OFCLOSE) {
2622 /*
2623 * Once we are in we can remove the flag from = 1 is only
2624 * passed from the actual closing routines that are called
2625 * via the sockets layer.
2626 */
2627 inp->sctp_flags &= ~SCTP_PCB_FLAGS_CLOSE_IP;
2624 }
2625 if (ifa == NULL) {
2626 /* Can't find an interface with that address */
2627 SCTP_INP_WUNLOCK(inp);
2628 SCTP_INP_INFO_WUNLOCK();
2629 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRNOTAVAIL);
2630 return (EADDRNOTAVAIL);
2631 }

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

2774 /* First time through we have the socket lock, after that no more. */
2775 if (from == SCTP_CALLED_AFTER_CMPSET_OFCLOSE) {
2776 /*
2777 * Once we are in we can remove the flag from = 1 is only
2778 * passed from the actual closing routines that are called
2779 * via the sockets layer.
2780 */
2781 inp->sctp_flags &= ~SCTP_PCB_FLAGS_CLOSE_IP;
2782 /* socket is gone, so no more wakeups allowed */
2783 inp->sctp_flags |= SCTP_PCB_FLAGS_DONT_WAKE;
2784 inp->sctp_flags &= ~SCTP_PCB_FLAGS_WAKEINPUT;
2785 inp->sctp_flags &= ~SCTP_PCB_FLAGS_WAKEOUTPUT;
2628 }
2629 sctp_timer_stop(SCTP_TIMER_TYPE_NEWCOOKIE, inp, NULL, NULL,
2630 SCTP_FROM_SCTP_PCB + SCTP_LOC_1);
2631
2632 if (inp->control) {
2633 sctp_m_freem(inp->control);
2634 inp->control = NULL;
2635 }

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

3034}
3035
3036
3037int
3038sctp_is_address_on_local_host(struct sockaddr *addr, uint32_t vrf_id)
3039{
3040 struct sctp_ifa *sctp_ifa;
3041
2786 }
2787 sctp_timer_stop(SCTP_TIMER_TYPE_NEWCOOKIE, inp, NULL, NULL,
2788 SCTP_FROM_SCTP_PCB + SCTP_LOC_1);
2789
2790 if (inp->control) {
2791 sctp_m_freem(inp->control);
2792 inp->control = NULL;
2793 }

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

3192}
3193
3194
3195int
3196sctp_is_address_on_local_host(struct sockaddr *addr, uint32_t vrf_id)
3197{
3198 struct sctp_ifa *sctp_ifa;
3199
3042 sctp_ifa = sctp_find_ifa_by_addr(addr, vrf_id, 0);
3200 sctp_ifa = sctp_find_ifa_by_addr(addr, vrf_id, SCTP_ADDR_NOT_LOCKED);
3043 if (sctp_ifa) {
3044 return (1);
3045 } else {
3046 return (0);
3047 }
3048}
3049
3050/*

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

3536 }
3537 SCTP_TCB_LOCK(stcb);
3538
3539 /* now that my_vtag is set, add it to the hash */
3540 head = &sctppcbinfo.sctp_asochash[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag,
3541 sctppcbinfo.hashasocmark)];
3542 /* put it in the bucket in the vtag hash of assoc's for the system */
3543 LIST_INSERT_HEAD(head, stcb, sctp_asocs);
3201 if (sctp_ifa) {
3202 return (1);
3203 } else {
3204 return (0);
3205 }
3206}
3207
3208/*

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

3694 }
3695 SCTP_TCB_LOCK(stcb);
3696
3697 /* now that my_vtag is set, add it to the hash */
3698 head = &sctppcbinfo.sctp_asochash[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag,
3699 sctppcbinfo.hashasocmark)];
3700 /* put it in the bucket in the vtag hash of assoc's for the system */
3701 LIST_INSERT_HEAD(head, stcb, sctp_asocs);
3702 sctp_delete_from_timewait(stcb->asoc.my_vtag);
3703
3544 SCTP_INP_INFO_WUNLOCK();
3545
3546 if ((err = sctp_add_remote_addr(stcb, firstaddr, SCTP_DO_SETSCOPE, SCTP_ALLOC_ASOC))) {
3547 /* failure.. memory error? */
3548 if (asoc->strmout) {
3549 SCTP_FREE(asoc->strmout, SCTP_M_STRMO);
3550 asoc->strmout = NULL;
3551 }

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

3565 /* Init all the timers */
3566 SCTP_OS_TIMER_INIT(&asoc->hb_timer.timer);
3567 SCTP_OS_TIMER_INIT(&asoc->dack_timer.timer);
3568 SCTP_OS_TIMER_INIT(&asoc->strreset_timer.timer);
3569 SCTP_OS_TIMER_INIT(&asoc->asconf_timer.timer);
3570 SCTP_OS_TIMER_INIT(&asoc->shut_guard_timer.timer);
3571 SCTP_OS_TIMER_INIT(&asoc->autoclose_timer.timer);
3572 SCTP_OS_TIMER_INIT(&asoc->delayed_event_timer.timer);
3704 SCTP_INP_INFO_WUNLOCK();
3705
3706 if ((err = sctp_add_remote_addr(stcb, firstaddr, SCTP_DO_SETSCOPE, SCTP_ALLOC_ASOC))) {
3707 /* failure.. memory error? */
3708 if (asoc->strmout) {
3709 SCTP_FREE(asoc->strmout, SCTP_M_STRMO);
3710 asoc->strmout = NULL;
3711 }

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

3725 /* Init all the timers */
3726 SCTP_OS_TIMER_INIT(&asoc->hb_timer.timer);
3727 SCTP_OS_TIMER_INIT(&asoc->dack_timer.timer);
3728 SCTP_OS_TIMER_INIT(&asoc->strreset_timer.timer);
3729 SCTP_OS_TIMER_INIT(&asoc->asconf_timer.timer);
3730 SCTP_OS_TIMER_INIT(&asoc->shut_guard_timer.timer);
3731 SCTP_OS_TIMER_INIT(&asoc->autoclose_timer.timer);
3732 SCTP_OS_TIMER_INIT(&asoc->delayed_event_timer.timer);
3733 SCTP_OS_TIMER_INIT(&asoc->delete_prim_timer.timer);
3573
3574 LIST_INSERT_HEAD(&inp->sctp_asoc_list, stcb, sctp_tcblist);
3575 /* now file the port under the hash as well */
3576 if (inp->sctp_tcbhash != NULL) {
3577 head = &inp->sctp_tcbhash[SCTP_PCBHASH_ALLADDR(stcb->rport,
3578 inp->sctp_hashmark)];
3579 LIST_INSERT_HEAD(head, stcb, sctp_tcbhash);
3580 }

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

3592 asoc = &stcb->asoc;
3593 asoc->numnets--;
3594 TAILQ_REMOVE(&asoc->nets, net, sctp_next);
3595 if (net == asoc->primary_destination) {
3596 /* Reset primary */
3597 struct sctp_nets *lnet;
3598
3599 lnet = TAILQ_FIRST(&asoc->nets);
3734
3735 LIST_INSERT_HEAD(&inp->sctp_asoc_list, stcb, sctp_tcblist);
3736 /* now file the port under the hash as well */
3737 if (inp->sctp_tcbhash != NULL) {
3738 head = &inp->sctp_tcbhash[SCTP_PCBHASH_ALLADDR(stcb->rport,
3739 inp->sctp_hashmark)];
3740 LIST_INSERT_HEAD(head, stcb, sctp_tcbhash);
3741 }

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

3753 asoc = &stcb->asoc;
3754 asoc->numnets--;
3755 TAILQ_REMOVE(&asoc->nets, net, sctp_next);
3756 if (net == asoc->primary_destination) {
3757 /* Reset primary */
3758 struct sctp_nets *lnet;
3759
3760 lnet = TAILQ_FIRST(&asoc->nets);
3761 /*
3762 * Mobility adaptation Ideally, if deleted destination is
3763 * the primary, it becomes a fast retransmission trigger by
3764 * the subsequent SET PRIMARY. (by micchie)
3765 */
3766 if (sctp_is_mobility_feature_on(stcb->sctp_ep,
3767 SCTP_MOBILITY_FASTHANDOFF)) {
3768 SCTPDBG(SCTP_DEBUG_ASCONF1, "remove_net: primary dst is deleting\n");
3769 if (asoc->deleted_primary != NULL) {
3770 SCTPDBG(SCTP_DEBUG_ASCONF1, "remove_net: deleted primary may be already stored\n");
3771 goto leave;
3772 }
3773 asoc->deleted_primary = net;
3774 atomic_add_int(&net->ref_count, 1);
3775 sctp_mobility_feature_on(stcb->sctp_ep,
3776 SCTP_MOBILITY_PRIM_DELETED);
3777 sctp_timer_start(SCTP_TIMER_TYPE_PRIM_DELETED,
3778 stcb->sctp_ep, stcb, NULL);
3779 }
3780leave:
3600 /* Try to find a confirmed primary */
3601 asoc->primary_destination = sctp_find_alternate_net(stcb, lnet, 0);
3602 }
3603 if (net == asoc->last_data_chunk_from) {
3604 /* Reset primary */
3605 asoc->last_data_chunk_from = TAILQ_FIRST(&asoc->nets);
3606 }
3607 if (net == asoc->last_control_chunk_from) {

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

3647 return (0);
3648 }
3649 }
3650 }
3651 /* not found. */
3652 return (-2);
3653}
3654
3781 /* Try to find a confirmed primary */
3782 asoc->primary_destination = sctp_find_alternate_net(stcb, lnet, 0);
3783 }
3784 if (net == asoc->last_data_chunk_from) {
3785 /* Reset primary */
3786 asoc->last_data_chunk_from = TAILQ_FIRST(&asoc->nets);
3787 }
3788 if (net == asoc->last_control_chunk_from) {

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

3828 return (0);
3829 }
3830 }
3831 }
3832 /* not found. */
3833 return (-2);
3834}
3835
3836void
3837sctp_delete_from_timewait(uint32_t tag)
3838{
3839 struct sctpvtaghead *chain;
3840 struct sctp_tagblock *twait_block;
3841 int found = 0;
3842 int i;
3655
3843
3844 chain = &sctppcbinfo.vtag_timewait[(tag % SCTP_STACK_VTAG_HASH_SIZE)];
3845 if (!SCTP_LIST_EMPTY(chain)) {
3846 LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) {
3847 for (i = 0; i < SCTP_NUMBER_IN_VTAG_BLOCK; i++) {
3848 if (twait_block->vtag_block[i].v_tag == tag) {
3849 twait_block->vtag_block[i].tv_sec_at_expire = 0;
3850 twait_block->vtag_block[i].v_tag = 0;
3851 found = 1;
3852 break;
3853 }
3854 }
3855 if (found)
3856 break;
3857 }
3858 }
3859}
3860
3656void
3861void
3657sctp_add_vtag_to_timewait(struct sctp_inpcb *inp, uint32_t tag, uint32_t time)
3862sctp_add_vtag_to_timewait(uint32_t tag, uint32_t time)
3658{
3659 struct sctpvtaghead *chain;
3660 struct sctp_tagblock *twait_block;
3661 struct timeval now;
3662 int set, i;
3663
3664 (void)SCTP_GETTIME_TIMEVAL(&now);
3665 chain = &sctppcbinfo.vtag_timewait[(tag % SCTP_STACK_VTAG_HASH_SIZE)];

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

3838 (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer);
3839 asoc->asconf_timer.self = NULL;
3840 (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer);
3841 asoc->autoclose_timer.self = NULL;
3842 (void)SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer);
3843 asoc->shut_guard_timer.self = NULL;
3844 (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer);
3845 asoc->delayed_event_timer.self = NULL;
3863{
3864 struct sctpvtaghead *chain;
3865 struct sctp_tagblock *twait_block;
3866 struct timeval now;
3867 int set, i;
3868
3869 (void)SCTP_GETTIME_TIMEVAL(&now);
3870 chain = &sctppcbinfo.vtag_timewait[(tag % SCTP_STACK_VTAG_HASH_SIZE)];

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

4043 (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer);
4044 asoc->asconf_timer.self = NULL;
4045 (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer);
4046 asoc->autoclose_timer.self = NULL;
4047 (void)SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer);
4048 asoc->shut_guard_timer.self = NULL;
4049 (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer);
4050 asoc->delayed_event_timer.self = NULL;
4051 /* Mobility adaptation */
4052 (void)SCTP_OS_TIMER_STOP(&asoc->delete_prim_timer.timer);
4053 asoc->delete_prim_timer.self = NULL;
3846 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3847 (void)SCTP_OS_TIMER_STOP(&net->fr_timer.timer);
3848 net->fr_timer.self = NULL;
3849 (void)SCTP_OS_TIMER_STOP(&net->rxt_timer.timer);
3850 net->rxt_timer.self = NULL;
3851 (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer);
3852 net->pmtu_timer.self = NULL;
3853 }

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

3994 LIST_REMOVE(stcb, sctp_tcblist);
3995 if (from_inpcbfree == SCTP_NORMAL_PROC) {
3996 SCTP_INP_INCR_REF(inp);
3997 SCTP_INP_WUNLOCK(inp);
3998 SCTP_ITERATOR_UNLOCK();
3999 }
4000 /* pull from vtag hash */
4001 LIST_REMOVE(stcb, sctp_asocs);
4054 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
4055 (void)SCTP_OS_TIMER_STOP(&net->fr_timer.timer);
4056 net->fr_timer.self = NULL;
4057 (void)SCTP_OS_TIMER_STOP(&net->rxt_timer.timer);
4058 net->rxt_timer.self = NULL;
4059 (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer);
4060 net->pmtu_timer.self = NULL;
4061 }

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

4202 LIST_REMOVE(stcb, sctp_tcblist);
4203 if (from_inpcbfree == SCTP_NORMAL_PROC) {
4204 SCTP_INP_INCR_REF(inp);
4205 SCTP_INP_WUNLOCK(inp);
4206 SCTP_ITERATOR_UNLOCK();
4207 }
4208 /* pull from vtag hash */
4209 LIST_REMOVE(stcb, sctp_asocs);
4002 sctp_add_vtag_to_timewait(inp, asoc->my_vtag, SCTP_TIME_WAIT);
4210 sctp_add_vtag_to_timewait(asoc->my_vtag, SCTP_TIME_WAIT);
4003
4004 /*
4005 * Now restop the timers to be sure - this is paranoia at is finest!
4006 */
4007 (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
4008 (void)SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer);
4009 (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer);
4010 (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);

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

4241 /* pending asconf (address) parameters */
4242 while (!TAILQ_EMPTY(&asoc->asconf_queue)) {
4243 /* sa_ignore FREED_MEMORY */
4244 aparam = TAILQ_FIRST(&asoc->asconf_queue);
4245 TAILQ_REMOVE(&asoc->asconf_queue, aparam, next);
4246 SCTP_FREE(aparam, SCTP_M_ASC_ADDR);
4247 }
4248 while (!TAILQ_EMPTY(&asoc->asconf_ack_sent)) {
4211
4212 /*
4213 * Now restop the timers to be sure - this is paranoia at is finest!
4214 */
4215 (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
4216 (void)SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer);
4217 (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer);
4218 (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);

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

4449 /* pending asconf (address) parameters */
4450 while (!TAILQ_EMPTY(&asoc->asconf_queue)) {
4451 /* sa_ignore FREED_MEMORY */
4452 aparam = TAILQ_FIRST(&asoc->asconf_queue);
4453 TAILQ_REMOVE(&asoc->asconf_queue, aparam, next);
4454 SCTP_FREE(aparam, SCTP_M_ASC_ADDR);
4455 }
4456 while (!TAILQ_EMPTY(&asoc->asconf_ack_sent)) {
4457 /* sa_ignore FREED_MEMORY */
4249 aack = TAILQ_FIRST(&asoc->asconf_ack_sent);
4250 TAILQ_REMOVE(&asoc->asconf_ack_sent, aack, next);
4458 aack = TAILQ_FIRST(&asoc->asconf_ack_sent);
4459 TAILQ_REMOVE(&asoc->asconf_ack_sent, aack, next);
4251 if (aack->last_sent_to != NULL) {
4252 sctp_free_remote_addr(aack->last_sent_to);
4253 }
4254 if (aack->data != NULL) {
4255 sctp_m_freem(aack->data);
4256 }
4257 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asconf_ack, aack);
4258 }
4259 /* clean up auth stuff */
4260 if (asoc->local_hmacs)
4261 sctp_free_hmaclist(asoc->local_hmacs);

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

4691void
4692sctp_pcb_init()
4693{
4694 /*
4695 * SCTP initialization for the PCB structures should be called by
4696 * the sctp_init() funciton.
4697 */
4698 int i;
4460 if (aack->data != NULL) {
4461 sctp_m_freem(aack->data);
4462 }
4463 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asconf_ack, aack);
4464 }
4465 /* clean up auth stuff */
4466 if (asoc->local_hmacs)
4467 sctp_free_hmaclist(asoc->local_hmacs);

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

4897void
4898sctp_pcb_init()
4899{
4900 /*
4901 * SCTP initialization for the PCB structures should be called by
4902 * the sctp_init() funciton.
4903 */
4904 int i;
4905 struct timeval tv;
4699
4700 if (sctp_pcb_initialized != 0) {
4701 /* error I was called twice */
4702 return;
4703 }
4704 sctp_pcb_initialized = 1;
4705
4706 bzero(&sctpstat, sizeof(struct sctpstat));
4906
4907 if (sctp_pcb_initialized != 0) {
4908 /* error I was called twice */
4909 return;
4910 }
4911 sctp_pcb_initialized = 1;
4912
4913 bzero(&sctpstat, sizeof(struct sctpstat));
4707 (void)SCTP_GETTIME_TIMEVAL(&sctpstat.sctps_discontinuitytime);
4914 (void)SCTP_GETTIME_TIMEVAL(&tv);
4915 sctpstat.sctps_discontinuitytime.tv_sec = (uint32_t) tv.tv_sec;
4916 sctpstat.sctps_discontinuitytime.tv_usec = (uint32_t) tv.tv_usec;
4708 /* init the empty list of (All) Endpoints */
4709 LIST_INIT(&sctppcbinfo.listhead);
4710
4711 /* init the iterator head */
4712 TAILQ_INIT(&sctppcbinfo.iteratorhead);
4713
4714 /* init the hash table of endpoints */
4715 TUNABLE_INT_FETCH("net.inet.sctp.tcbhashsize", &sctp_hashtblsize);

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

5537 tag) {
5538 /* Bad tag, sorry :< */
5539 SCTP_INP_INFO_WUNLOCK();
5540 return (0);
5541 }
5542 }
5543 }
5544 }
4917 /* init the empty list of (All) Endpoints */
4918 LIST_INIT(&sctppcbinfo.listhead);
4919
4920 /* init the iterator head */
4921 TAILQ_INIT(&sctppcbinfo.iteratorhead);
4922
4923 /* init the hash table of endpoints */
4924 TUNABLE_INT_FETCH("net.inet.sctp.tcbhashsize", &sctp_hashtblsize);

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

5746 tag) {
5747 /* Bad tag, sorry :< */
5748 SCTP_INP_INFO_WUNLOCK();
5749 return (0);
5750 }
5751 }
5752 }
5753 }
5545 /* Not found, ok to use the tag */
5754 /*-
5755 * Not found, ok to use the tag, add it to the time wait hash
5756 * as well this will prevent two sucessive cookies from getting
5757 * the same tag or two inits sent quickly on multi-processors.
5758 * We only keep the tag for the life of a cookie and when we
5759 * add this tag to the assoc hash we need to purge it from
5760 * the t-wait hash.
5761 */
5762 sctp_add_vtag_to_timewait(tag, TICKS_TO_SEC(inp->sctp_ep.def_cookie_life));
5546 SCTP_INP_INFO_WUNLOCK();
5547 return (1);
5548}
5549
5550
5551static sctp_assoc_t reneged_asoc_ids[256];
5552static uint8_t reneged_at = 0;
5553

--- 275 unchanged lines hidden ---
5763 SCTP_INP_INFO_WUNLOCK();
5764 return (1);
5765}
5766
5767
5768static sctp_assoc_t reneged_asoc_ids[256];
5769static uint8_t reneged_at = 0;
5770

--- 275 unchanged lines hidden ---