sctp_pcb.c (168124) | sctp_pcb.c (168299) |
---|---|
1/*- 2 * Copyright (c) 2001-2007, 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. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctp_pcb.c,v 1.38 2005/03/06 16:04:18 itojun Exp $ */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2007, 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. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctp_pcb.c,v 1.38 2005/03/06 16:04:18 itojun Exp $ */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 168124 2007-03-31 11:47:30Z rrs $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 168299 2007-04-03 11:15:32Z rrs $"); |
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_pcb.h> 41#include <netinet/sctputil.h> 42#include <netinet/sctp.h> --- 159 unchanged lines hidden (view full) --- 202 LIST_FOREACH(liste, bucket, next_vrf) { 203 if (vrfid == liste->vrf_id) { 204 return (liste); 205 } 206 } 207 return (NULL); 208} 209 | 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_pcb.h> 41#include <netinet/sctputil.h> 42#include <netinet/sctp.h> --- 159 unchanged lines hidden (view full) --- 202 LIST_FOREACH(liste, bucket, next_vrf) { 203 if (vrfid == liste->vrf_id) { 204 return (liste); 205 } 206 } 207 return (NULL); 208} 209 |
210 |
|
210void 211sctp_free_ifa(struct sctp_ifa *sctp_ifap) 212{ 213 int ret; 214 215 ret = atomic_fetchadd_int(&sctp_ifap->refcount, -1); 216 if (ret == 1) { 217 /* We zero'd the count */ | 211void 212sctp_free_ifa(struct sctp_ifa *sctp_ifap) 213{ 214 int ret; 215 216 ret = atomic_fetchadd_int(&sctp_ifap->refcount, -1); 217 if (ret == 1) { 218 /* We zero'd the count */ |
219#ifdef INVARIANTS 220 if (sctp_ifap->in_ifa_list) { 221 panic("Attempt to free item in a list"); 222 } 223#else 224 if (sctp_ifap->in_ifa_list) { 225 printf("in_ifa_list was not clear, fixing cnt\n"); 226 atomic_add_int(&sctp_ifap->refcount, 1); 227 return; 228 } 229#endif |
|
218 SCTP_FREE(sctp_ifap); 219 } 220} 221 222struct sctp_ifa * 223sctp_add_addr_to_vrf(uint32_t vrfid, void *ifn, uint32_t ifn_index, 224 uint32_t ifn_type, const char *if_name, 225 void *ifa, struct sockaddr *addr, uint32_t ifa_flags) --- 118 unchanged lines hidden (view full) --- 344 sctp_ifap->src_is_glob = 1; 345 } 346 SCTP_IPI_ADDR_LOCK(); 347 hash_head = &vrf->vrf_addr_hash[(hash_of_addr & vrf->vrf_hashmark)]; 348 LIST_INSERT_HEAD(hash_head, sctp_ifap, next_bucket); 349 sctp_ifap->refcount = 1; 350 LIST_INSERT_HEAD(&sctp_ifnp->ifalist, sctp_ifap, next_ifa); 351 sctp_ifnp->ifa_count++; | 230 SCTP_FREE(sctp_ifap); 231 } 232} 233 234struct sctp_ifa * 235sctp_add_addr_to_vrf(uint32_t vrfid, void *ifn, uint32_t ifn_index, 236 uint32_t ifn_type, const char *if_name, 237 void *ifa, struct sockaddr *addr, uint32_t ifa_flags) --- 118 unchanged lines hidden (view full) --- 356 sctp_ifap->src_is_glob = 1; 357 } 358 SCTP_IPI_ADDR_LOCK(); 359 hash_head = &vrf->vrf_addr_hash[(hash_of_addr & vrf->vrf_hashmark)]; 360 LIST_INSERT_HEAD(hash_head, sctp_ifap, next_bucket); 361 sctp_ifap->refcount = 1; 362 LIST_INSERT_HEAD(&sctp_ifnp->ifalist, sctp_ifap, next_ifa); 363 sctp_ifnp->ifa_count++; |
364 sctp_ifap->in_ifa_list = 1; |
|
352 vrf->total_ifa_count++; 353 SCTP_IPI_ADDR_UNLOCK(); 354 return (sctp_ifap); 355} 356 357struct sctp_ifa * 358sctp_del_addr_from_vrf(uint32_t vrfid, struct sockaddr *addr, 359 uint32_t ifn_index) --- 18 unchanged lines hidden (view full) --- 378 379 if (sctp_ifap) { 380 sctp_ifap->localifa_flags &= SCTP_ADDR_VALID; 381 sctp_ifap->localifa_flags |= SCTP_BEING_DELETED; 382 sctp_ifnp->ifa_count--; 383 vrf->total_ifa_count--; 384 LIST_REMOVE(sctp_ifap, next_bucket); 385 LIST_REMOVE(sctp_ifap, next_ifa); | 365 vrf->total_ifa_count++; 366 SCTP_IPI_ADDR_UNLOCK(); 367 return (sctp_ifap); 368} 369 370struct sctp_ifa * 371sctp_del_addr_from_vrf(uint32_t vrfid, struct sockaddr *addr, 372 uint32_t ifn_index) --- 18 unchanged lines hidden (view full) --- 391 392 if (sctp_ifap) { 393 sctp_ifap->localifa_flags &= SCTP_ADDR_VALID; 394 sctp_ifap->localifa_flags |= SCTP_BEING_DELETED; 395 sctp_ifnp->ifa_count--; 396 vrf->total_ifa_count--; 397 LIST_REMOVE(sctp_ifap, next_bucket); 398 LIST_REMOVE(sctp_ifap, next_ifa); |
399 sctp_ifap->in_ifa_list = 0; |
|
386 atomic_add_int(&sctp_ifnp->refcount, -1); 387 } else { 388 printf("Del Addr-ifn:%d Could not find address:", 389 ifn_index); 390 sctp_print_address(addr); 391 } 392out_now: 393 SCTP_IPI_ADDR_UNLOCK(); --- 13 unchanged lines hidden (view full) --- 407/* 408 * Given a endpoint, look and find in its association list any association 409 * with the "to" address given. This can be a "from" address, too, for 410 * inbound packets. For outbound packets it is a true "to" address. 411 */ 412 413static struct sctp_tcb * 414sctp_tcb_special_locate(struct sctp_inpcb **inp_p, struct sockaddr *from, | 400 atomic_add_int(&sctp_ifnp->refcount, -1); 401 } else { 402 printf("Del Addr-ifn:%d Could not find address:", 403 ifn_index); 404 sctp_print_address(addr); 405 } 406out_now: 407 SCTP_IPI_ADDR_UNLOCK(); --- 13 unchanged lines hidden (view full) --- 421/* 422 * Given a endpoint, look and find in its association list any association 423 * with the "to" address given. This can be a "from" address, too, for 424 * inbound packets. For outbound packets it is a true "to" address. 425 */ 426 427static struct sctp_tcb * 428sctp_tcb_special_locate(struct sctp_inpcb **inp_p, struct sockaddr *from, |
415 struct sockaddr *to, struct sctp_nets **netp) | 429 struct sockaddr *to, struct sctp_nets **netp, uint32_t vrf_id) |
416{ 417 /**** ASSUMSES THE CALLER holds the INP_INFO_RLOCK */ 418 419 /* 420 * Note for this module care must be taken when observing what to is 421 * for. In most of the rest of the code the TO field represents my 422 * peer and the FROM field represents my address. For this module it 423 * is reversed of that. --- 33 unchanged lines hidden (view full) --- 457 if (lport != inp->sctp_lport) { 458 continue; 459 } 460 SCTP_INP_RLOCK(inp); 461 if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) { 462 SCTP_INP_RUNLOCK(inp); 463 continue; 464 } | 430{ 431 /**** ASSUMSES THE CALLER holds the INP_INFO_RLOCK */ 432 433 /* 434 * Note for this module care must be taken when observing what to is 435 * for. In most of the rest of the code the TO field represents my 436 * peer and the FROM field represents my address. For this module it 437 * is reversed of that. --- 33 unchanged lines hidden (view full) --- 471 if (lport != inp->sctp_lport) { 472 continue; 473 } 474 SCTP_INP_RLOCK(inp); 475 if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) { 476 SCTP_INP_RUNLOCK(inp); 477 continue; 478 } |
479 if (inp->def_vrf_id == vrf_id) { 480 SCTP_INP_RUNLOCK(inp); 481 continue; 482 } |
|
465 /* check to see if the ep has one of the addresses */ 466 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) { 467 /* We are NOT bound all, so look further */ 468 int match = 0; 469 470 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { 471 472 if (laddr->ifa == NULL) { --- 121 unchanged lines hidden (view full) --- 594 */ 595 596struct sctp_tcb * 597sctp_findassociation_ep_addr(struct sctp_inpcb **inp_p, struct sockaddr *remote, 598 struct sctp_nets **netp, struct sockaddr *local, struct sctp_tcb *locked_tcb) 599{ 600 struct sctpasochead *head; 601 struct sctp_inpcb *inp; | 483 /* check to see if the ep has one of the addresses */ 484 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) { 485 /* We are NOT bound all, so look further */ 486 int match = 0; 487 488 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { 489 490 if (laddr->ifa == NULL) { --- 121 unchanged lines hidden (view full) --- 612 */ 613 614struct sctp_tcb * 615sctp_findassociation_ep_addr(struct sctp_inpcb **inp_p, struct sockaddr *remote, 616 struct sctp_nets **netp, struct sockaddr *local, struct sctp_tcb *locked_tcb) 617{ 618 struct sctpasochead *head; 619 struct sctp_inpcb *inp; |
602 struct sctp_tcb *stcb; | 620 struct sctp_tcb *stcb = NULL; |
603 struct sctp_nets *net; 604 uint16_t rport; 605 606 inp = *inp_p; 607 if (remote->sa_family == AF_INET) { 608 rport = (((struct sockaddr_in *)remote)->sin_port); 609 } else if (remote->sa_family == AF_INET6) { 610 rport = (((struct sockaddr_in6 *)remote)->sin6_port); --- 4 unchanged lines hidden (view full) --- 615 /* 616 * UN-lock so we can do proper locking here this occurs when 617 * called from load_addresses_from_init. 618 */ 619 SCTP_TCB_UNLOCK(locked_tcb); 620 } 621 SCTP_INP_INFO_RLOCK(); 622 if (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { | 621 struct sctp_nets *net; 622 uint16_t rport; 623 624 inp = *inp_p; 625 if (remote->sa_family == AF_INET) { 626 rport = (((struct sockaddr_in *)remote)->sin_port); 627 } else if (remote->sa_family == AF_INET6) { 628 rport = (((struct sockaddr_in6 *)remote)->sin6_port); --- 4 unchanged lines hidden (view full) --- 633 /* 634 * UN-lock so we can do proper locking here this occurs when 635 * called from load_addresses_from_init. 636 */ 637 SCTP_TCB_UNLOCK(locked_tcb); 638 } 639 SCTP_INP_INFO_RLOCK(); 640 if (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { |
623 /* | 641 /*- |
624 * Now either this guy is our listener or it's the 625 * connector. If it is the one that issued the connect, then 626 * it's only chance is to be the first TCB in the list. If 627 * it is the acceptor, then do the special_lookup to hash 628 * and find the real inp. 629 */ 630 if ((inp->sctp_socket) && (inp->sctp_socket->so_qlimit)) { 631 /* to is peer addr, from is my addr */ 632 stcb = sctp_tcb_special_locate(inp_p, remote, local, | 642 * Now either this guy is our listener or it's the 643 * connector. If it is the one that issued the connect, then 644 * it's only chance is to be the first TCB in the list. If 645 * it is the acceptor, then do the special_lookup to hash 646 * and find the real inp. 647 */ 648 if ((inp->sctp_socket) && (inp->sctp_socket->so_qlimit)) { 649 /* to is peer addr, from is my addr */ 650 stcb = sctp_tcb_special_locate(inp_p, remote, local, |
633 netp); | 651 netp, inp->def_vrf_id); |
634 if ((stcb != NULL) && (locked_tcb == NULL)) { 635 /* we have a locked tcb, lower refcount */ 636 SCTP_INP_WLOCK(inp); 637 SCTP_INP_DECR_REF(inp); 638 SCTP_INP_WUNLOCK(inp); 639 } 640 if ((locked_tcb != NULL) && (locked_tcb != stcb)) { 641 SCTP_INP_RLOCK(locked_tcb->sctp_ep); --- 484 unchanged lines hidden (view full) --- 1126 struct sctp_inpcb **inp_p, struct sctp_nets **netp, int find_tcp_pool, uint32_t vrf_id) 1127{ 1128 struct sctp_inpcb *inp; 1129 struct sctp_tcb *retval; 1130 1131 SCTP_INP_INFO_RLOCK(); 1132 if (find_tcp_pool) { 1133 if (inp_p != NULL) { | 652 if ((stcb != NULL) && (locked_tcb == NULL)) { 653 /* we have a locked tcb, lower refcount */ 654 SCTP_INP_WLOCK(inp); 655 SCTP_INP_DECR_REF(inp); 656 SCTP_INP_WUNLOCK(inp); 657 } 658 if ((locked_tcb != NULL) && (locked_tcb != stcb)) { 659 SCTP_INP_RLOCK(locked_tcb->sctp_ep); --- 484 unchanged lines hidden (view full) --- 1144 struct sctp_inpcb **inp_p, struct sctp_nets **netp, int find_tcp_pool, uint32_t vrf_id) 1145{ 1146 struct sctp_inpcb *inp; 1147 struct sctp_tcb *retval; 1148 1149 SCTP_INP_INFO_RLOCK(); 1150 if (find_tcp_pool) { 1151 if (inp_p != NULL) { |
1134 retval = sctp_tcb_special_locate(inp_p, from, to, netp); | 1152 retval = sctp_tcb_special_locate(inp_p, from, to, netp, vrf_id); |
1135 } else { | 1153 } else { |
1136 retval = sctp_tcb_special_locate(&inp, from, to, netp); | 1154 retval = sctp_tcb_special_locate(&inp, from, to, netp, vrf_id); |
1137 } 1138 if (retval != NULL) { 1139 SCTP_INP_INFO_RUNLOCK(); 1140 return (retval); 1141 } 1142 } 1143 inp = sctp_pcb_findep(to, 0, 1, vrf_id); 1144 if (inp_p != NULL) { --- 181 unchanged lines hidden (view full) --- 1326 1327/* 1328 * Find an association with the pointer to the inbound IP packet. This can be 1329 * a IPv4 or IPv6 packet. 1330 */ 1331struct sctp_tcb * 1332sctp_findassociation_addr(struct mbuf *m, int iphlen, int offset, 1333 struct sctphdr *sh, struct sctp_chunkhdr *ch, | 1155 } 1156 if (retval != NULL) { 1157 SCTP_INP_INFO_RUNLOCK(); 1158 return (retval); 1159 } 1160 } 1161 inp = sctp_pcb_findep(to, 0, 1, vrf_id); 1162 if (inp_p != NULL) { --- 181 unchanged lines hidden (view full) --- 1344 1345/* 1346 * Find an association with the pointer to the inbound IP packet. This can be 1347 * a IPv4 or IPv6 packet. 1348 */ 1349struct sctp_tcb * 1350sctp_findassociation_addr(struct mbuf *m, int iphlen, int offset, 1351 struct sctphdr *sh, struct sctp_chunkhdr *ch, |
1334 struct sctp_inpcb **inp_p, struct sctp_nets **netp) | 1352 struct sctp_inpcb **inp_p, struct sctp_nets **netp, uint32_t vrf_id) |
1335{ 1336 int find_tcp_pool; 1337 struct ip *iph; 1338 struct sctp_tcb *retval; 1339 struct sockaddr_storage to_store, from_store; 1340 struct sockaddr *to = (struct sockaddr *)&to_store; 1341 struct sockaddr *from = (struct sockaddr *)&from_store; 1342 struct sctp_inpcb *inp; | 1353{ 1354 int find_tcp_pool; 1355 struct ip *iph; 1356 struct sctp_tcb *retval; 1357 struct sockaddr_storage to_store, from_store; 1358 struct sockaddr *to = (struct sockaddr *)&to_store; 1359 struct sockaddr *from = (struct sockaddr *)&from_store; 1360 struct sctp_inpcb *inp; |
1343 uint32_t vrf_id; | |
1344 | 1361 |
1345 vrf_id = SCTP_DEFAULT_VRFID; | |
1346 iph = mtod(m, struct ip *); 1347 if (iph->ip_v == IPVERSION) { 1348 /* its IPv4 */ 1349 struct sockaddr_in *from4; 1350 1351 from4 = (struct sockaddr_in *)&from_store; 1352 bzero(from4, sizeof(*from4)); 1353 from4->sin_family = AF_INET; --- 512 unchanged lines hidden (view full) --- 1866 printf("Association hosed in TCP model, out of laddr memory\n"); 1867 } 1868#endif /* SCTP_DEBUG */ 1869 continue; 1870 } 1871 SCTP_INCR_LADDR_COUNT(); 1872 bzero(laddr, sizeof(*laddr)); 1873 laddr->ifa = oladdr->ifa; | 1362 iph = mtod(m, struct ip *); 1363 if (iph->ip_v == IPVERSION) { 1364 /* its IPv4 */ 1365 struct sockaddr_in *from4; 1366 1367 from4 = (struct sockaddr_in *)&from_store; 1368 bzero(from4, sizeof(*from4)); 1369 from4->sin_family = AF_INET; --- 512 unchanged lines hidden (view full) --- 1882 printf("Association hosed in TCP model, out of laddr memory\n"); 1883 } 1884#endif /* SCTP_DEBUG */ 1885 continue; 1886 } 1887 SCTP_INCR_LADDR_COUNT(); 1888 bzero(laddr, sizeof(*laddr)); 1889 laddr->ifa = oladdr->ifa; |
1890 atomic_add_int(&laddr->ifa->refcount, 1); |
|
1874 LIST_INSERT_HEAD(&new_inp->sctp_addr_list, laddr, 1875 sctp_nxt_addr); 1876 new_inp->laddr_count++; 1877 } 1878 } 1879 /* 1880 * Now any running timers need to be adjusted since we really don't 1881 * care if they are running or not just blast in the new_inp into --- 484 unchanged lines hidden (view full) --- 2366 struct sctp_inpcb *inp_save; 2367 struct sctp_tcb *asoc, *nasoc; 2368 struct sctp_laddr *laddr, *nladdr; 2369 struct inpcb *ip_pcb; 2370 struct socket *so; 2371 2372 struct sctp_queued_to_read *sq; 2373 | 1891 LIST_INSERT_HEAD(&new_inp->sctp_addr_list, laddr, 1892 sctp_nxt_addr); 1893 new_inp->laddr_count++; 1894 } 1895 } 1896 /* 1897 * Now any running timers need to be adjusted since we really don't 1898 * care if they are running or not just blast in the new_inp into --- 484 unchanged lines hidden (view full) --- 2383 struct sctp_inpcb *inp_save; 2384 struct sctp_tcb *asoc, *nasoc; 2385 struct sctp_laddr *laddr, *nladdr; 2386 struct inpcb *ip_pcb; 2387 struct socket *so; 2388 2389 struct sctp_queued_to_read *sq; 2390 |
2391 |
|
2374 int cnt; 2375 sctp_sharedkey_t *shared_key; 2376 2377 2378#ifdef SCTP_LOG_CLOSING 2379 sctp_log_closing(inp, NULL, 0); 2380#endif 2381 --- 432 unchanged lines hidden (view full) --- 2814 net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); 2815 /* we always get at LEAST 2 MTU's */ 2816 if (net->cwnd < (2 * net->mtu)) { 2817 net->cwnd = 2 * net->mtu; 2818 } 2819 net->ssthresh = stcb->asoc.peers_rwnd; 2820} 2821 | 2392 int cnt; 2393 sctp_sharedkey_t *shared_key; 2394 2395 2396#ifdef SCTP_LOG_CLOSING 2397 sctp_log_closing(inp, NULL, 0); 2398#endif 2399 --- 432 unchanged lines hidden (view full) --- 2832 net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); 2833 /* we always get at LEAST 2 MTU's */ 2834 if (net->cwnd < (2 * net->mtu)) { 2835 net->cwnd = 2 * net->mtu; 2836 } 2837 net->ssthresh = stcb->asoc.peers_rwnd; 2838} 2839 |
2840 |
|
2822int 2823sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, 2824 int set_scope, int from) 2825{ 2826 /* 2827 * The following is redundant to the same lines in the 2828 * sctp_aloc_assoc() but is needed since other's call the add 2829 * address function --- 164 unchanged lines hidden (view full) --- 2994 if (newaddr->sa_family == AF_INET6) { 2995 struct sockaddr_in6 *sin6; 2996 2997 sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; 2998 (void)sa6_embedscope(sin6, ip6_use_defzone); 2999 sin6->sin6_scope_id = 0; 3000 } 3001 rtalloc_ign((struct route *)&net->ro, 0UL); | 2841int 2842sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, 2843 int set_scope, int from) 2844{ 2845 /* 2846 * The following is redundant to the same lines in the 2847 * sctp_aloc_assoc() but is needed since other's call the add 2848 * address function --- 164 unchanged lines hidden (view full) --- 3013 if (newaddr->sa_family == AF_INET6) { 3014 struct sockaddr_in6 *sin6; 3015 3016 sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; 3017 (void)sa6_embedscope(sin6, ip6_use_defzone); 3018 sin6->sin6_scope_id = 0; 3019 } 3020 rtalloc_ign((struct route *)&net->ro, 0UL); |
3021 |
|
3002 if (newaddr->sa_family == AF_INET6) { 3003 struct sockaddr_in6 *sin6; 3004 3005 sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; 3006 (void)sa6_recoverscope(sin6); 3007 } 3008 if ((net->ro.ro_rt) && 3009 (net->ro.ro_rt->rt_ifp)) { --- 55 unchanged lines hidden (view full) --- 3065 * after that. c) end of the list.. insert at the tail. 3066 */ 3067 struct sctp_nets *netlook; 3068 3069 do { 3070 netlook = TAILQ_NEXT(netfirst, sctp_next); 3071 if (netlook == NULL) { 3072 /* End of the list */ | 3022 if (newaddr->sa_family == AF_INET6) { 3023 struct sockaddr_in6 *sin6; 3024 3025 sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; 3026 (void)sa6_recoverscope(sin6); 3027 } 3028 if ((net->ro.ro_rt) && 3029 (net->ro.ro_rt->rt_ifp)) { --- 55 unchanged lines hidden (view full) --- 3085 * after that. c) end of the list.. insert at the tail. 3086 */ 3087 struct sctp_nets *netlook; 3088 3089 do { 3090 netlook = TAILQ_NEXT(netfirst, sctp_next); 3091 if (netlook == NULL) { 3092 /* End of the list */ |
3073 TAILQ_INSERT_TAIL(&stcb->asoc.nets, net, 3074 sctp_next); | 3093 TAILQ_INSERT_TAIL(&stcb->asoc.nets, net, sctp_next); |
3075 break; 3076 } else if (netlook->ro.ro_rt == NULL) { 3077 /* next one has NO route */ 3078 TAILQ_INSERT_BEFORE(netfirst, net, sctp_next); 3079 break; | 3094 break; 3095 } else if (netlook->ro.ro_rt == NULL) { 3096 /* next one has NO route */ 3097 TAILQ_INSERT_BEFORE(netfirst, net, sctp_next); 3098 break; |
3080 } else if (netlook->ro.ro_rt->rt_ifp != 3081 net->ro.ro_rt->rt_ifp) { | 3099 } else if (netlook->ro.ro_rt->rt_ifp != net->ro.ro_rt->rt_ifp) { |
3082 TAILQ_INSERT_AFTER(&stcb->asoc.nets, netlook, 3083 net, sctp_next); 3084 break; 3085 } 3086 /* Shift forward */ 3087 netfirst = netlook; 3088 } while (netlook != NULL); 3089 } --- 173 unchanged lines hidden (view full) --- 3263 SCTP_FREE(asoc->strmout); 3264 if (asoc->mapping_array) 3265 SCTP_FREE(asoc->mapping_array); 3266 3267 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asoc, stcb); 3268 SCTP_DECR_ASOC_COUNT(); 3269 SCTP_TCB_LOCK_DESTROY(stcb); 3270 SCTP_TCB_SEND_LOCK_DESTROY(stcb); | 3100 TAILQ_INSERT_AFTER(&stcb->asoc.nets, netlook, 3101 net, sctp_next); 3102 break; 3103 } 3104 /* Shift forward */ 3105 netfirst = netlook; 3106 } while (netlook != NULL); 3107 } --- 173 unchanged lines hidden (view full) --- 3281 SCTP_FREE(asoc->strmout); 3282 if (asoc->mapping_array) 3283 SCTP_FREE(asoc->mapping_array); 3284 3285 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asoc, stcb); 3286 SCTP_DECR_ASOC_COUNT(); 3287 SCTP_TCB_LOCK_DESTROY(stcb); 3288 SCTP_TCB_SEND_LOCK_DESTROY(stcb); |
3289 SCTP_INP_WUNLOCK(inp); |
|
3271 *error = ENOBUFS; 3272 return (NULL); 3273 } 3274 /* Init all the timers */ 3275 SCTP_OS_TIMER_INIT(&asoc->hb_timer.timer); 3276 SCTP_OS_TIMER_INIT(&asoc->dack_timer.timer); 3277 SCTP_OS_TIMER_INIT(&asoc->strreset_timer.timer); 3278 SCTP_OS_TIMER_INIT(&asoc->asconf_timer.timer); --- 174 unchanged lines hidden (view full) --- 3453 if (it->iterator_flags & SCTP_ITERATOR_DO_SINGLE_INP) { 3454 it->inp = NULL; 3455 } else { 3456 it->inp = LIST_NEXT(inp, sctp_list); 3457 } 3458 } 3459} 3460 | 3290 *error = ENOBUFS; 3291 return (NULL); 3292 } 3293 /* Init all the timers */ 3294 SCTP_OS_TIMER_INIT(&asoc->hb_timer.timer); 3295 SCTP_OS_TIMER_INIT(&asoc->dack_timer.timer); 3296 SCTP_OS_TIMER_INIT(&asoc->strreset_timer.timer); 3297 SCTP_OS_TIMER_INIT(&asoc->asconf_timer.timer); --- 174 unchanged lines hidden (view full) --- 3472 if (it->iterator_flags & SCTP_ITERATOR_DO_SINGLE_INP) { 3473 it->inp = NULL; 3474 } else { 3475 it->inp = LIST_NEXT(inp, sctp_list); 3476 } 3477 } 3478} 3479 |
3480 |
|
3461/* 3462 * Free the association after un-hashing the remote port. 3463 */ 3464int 3465sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfree, int from_location) 3466{ 3467 int i; 3468 struct sctp_association *asoc; --- 1918 unchanged lines hidden (view full) --- 5387} 5388 5389/* 5390 * start a new iterator 5391 * iterates through all endpoints and associations based on the pcb_state 5392 * flags and asoc_state. "af" (mandatory) is executed for all matching 5393 * assocs and "ef" (optional) is executed when the iterator completes. 5394 * "inpf" (optional) is executed for each new endpoint as it is being | 3481/* 3482 * Free the association after un-hashing the remote port. 3483 */ 3484int 3485sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfree, int from_location) 3486{ 3487 int i; 3488 struct sctp_association *asoc; --- 1918 unchanged lines hidden (view full) --- 5407} 5408 5409/* 5410 * start a new iterator 5411 * iterates through all endpoints and associations based on the pcb_state 5412 * flags and asoc_state. "af" (mandatory) is executed for all matching 5413 * assocs and "ef" (optional) is executed when the iterator completes. 5414 * "inpf" (optional) is executed for each new endpoint as it is being |
5395 * iterated through. | 5415 * iterated through. inpe (optional) is called when the inp completes 5416 * its way through all the stcbs. |
5396 */ 5397int 5398sctp_initiate_iterator(inp_func inpf, 5399 asoc_func af, 5400 inp_func inpe, 5401 uint32_t pcb_state, 5402 uint32_t pcb_features, 5403 uint32_t asoc_state, --- 63 unchanged lines hidden --- | 5417 */ 5418int 5419sctp_initiate_iterator(inp_func inpf, 5420 asoc_func af, 5421 inp_func inpe, 5422 uint32_t pcb_state, 5423 uint32_t pcb_features, 5424 uint32_t asoc_state, --- 63 unchanged lines hidden --- |