sctp_bsd_addr.c (179783) | sctp_bsd_addr.c (180387) |
---|---|
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. --- 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_output.c,v 1.46 2005/03/06 16:04:17 itojun Exp $ */ 32 33#include <sys/cdefs.h> | 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. --- 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_output.c,v 1.46 2005/03/06 16:04:17 itojun Exp $ */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 179783 2008-06-14 07:58:05Z rrs $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 180387 2008-07-09 16:45:30Z rrs $"); |
35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_var.h> 38#include <netinet/sctp_pcb.h> 39#include <netinet/sctp_header.h> 40#include <netinet/sctputil.h> 41#include <netinet/sctp_output.h> 42#include <netinet/sctp_bsd_addr.h> --- 31 unchanged lines hidden (view full) --- 74MALLOC_DEFINE(SCTP_M_VRF, "sctp_vrf", "sctp vrf struct"); 75MALLOC_DEFINE(SCTP_M_IFA, "sctp_ifa", "sctp ifa struct"); 76MALLOC_DEFINE(SCTP_M_IFN, "sctp_ifn", "sctp ifn struct"); 77MALLOC_DEFINE(SCTP_M_TIMW, "sctp_timw", "sctp time block"); 78MALLOC_DEFINE(SCTP_M_MVRF, "sctp_mvrf", "sctp mvrf pcb list"); 79MALLOC_DEFINE(SCTP_M_ITER, "sctp_iter", "sctp iterator control"); 80MALLOC_DEFINE(SCTP_M_SOCKOPT, "sctp_socko", "sctp socket option"); 81 | 35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_var.h> 38#include <netinet/sctp_pcb.h> 39#include <netinet/sctp_header.h> 40#include <netinet/sctputil.h> 41#include <netinet/sctp_output.h> 42#include <netinet/sctp_bsd_addr.h> --- 31 unchanged lines hidden (view full) --- 74MALLOC_DEFINE(SCTP_M_VRF, "sctp_vrf", "sctp vrf struct"); 75MALLOC_DEFINE(SCTP_M_IFA, "sctp_ifa", "sctp ifa struct"); 76MALLOC_DEFINE(SCTP_M_IFN, "sctp_ifn", "sctp ifn struct"); 77MALLOC_DEFINE(SCTP_M_TIMW, "sctp_timw", "sctp time block"); 78MALLOC_DEFINE(SCTP_M_MVRF, "sctp_mvrf", "sctp mvrf pcb list"); 79MALLOC_DEFINE(SCTP_M_ITER, "sctp_iter", "sctp iterator control"); 80MALLOC_DEFINE(SCTP_M_SOCKOPT, "sctp_socko", "sctp socket option"); 81 |
82 | |
83#if defined(SCTP_USE_THREAD_BASED_ITERATOR) 84void 85sctp_wakeup_iterator(void) 86{ 87 wakeup(&SCTP_BASE_INFO(iterator_running)); 88} 89 90static void --- 20 unchanged lines hidden (view full) --- 111 RFPROC, 112 SCTP_KTHREAD_PAGES, 113 SCTP_KTRHEAD_NAME); 114} 115 116#endif 117 118#ifdef INET6 | 82#if defined(SCTP_USE_THREAD_BASED_ITERATOR) 83void 84sctp_wakeup_iterator(void) 85{ 86 wakeup(&SCTP_BASE_INFO(iterator_running)); 87} 88 89static void --- 20 unchanged lines hidden (view full) --- 110 RFPROC, 111 SCTP_KTHREAD_PAGES, 112 SCTP_KTRHEAD_NAME); 113} 114 115#endif 116 117#ifdef INET6 |
118 |
|
119void 120sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa) 121{ 122 struct in6_ifaddr *ifa6; 123 124 ifa6 = (struct in6_ifaddr *)ifa->ifa; 125 ifa->flags = ifa6->ia6_flags; | 119void 120sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa) 121{ 122 struct in6_ifaddr *ifa6; 123 124 ifa6 = (struct in6_ifaddr *)ifa->ifa; 125 ifa->flags = ifa6->ia6_flags; |
126 if (!ip6_use_deprecated) { | 126 if (!MODULE_GLOBAL(MOD_INET6, ip6_use_deprecated)) { |
127 if (ifa->flags & 128 IN6_IFF_DEPRECATED) { 129 ifa->localifa_flags |= SCTP_ADDR_IFA_UNUSEABLE; 130 } else { 131 ifa->localifa_flags &= ~SCTP_ADDR_IFA_UNUSEABLE; 132 } 133 } else { 134 ifa->localifa_flags &= ~SCTP_ADDR_IFA_UNUSEABLE; 135 } 136 if (ifa->flags & 137 (IN6_IFF_DETACHED | 138 IN6_IFF_ANYCAST | 139 IN6_IFF_NOTREADY)) { 140 ifa->localifa_flags |= SCTP_ADDR_IFA_UNUSEABLE; 141 } else { 142 ifa->localifa_flags &= ~SCTP_ADDR_IFA_UNUSEABLE; 143 } 144} 145 | 127 if (ifa->flags & 128 IN6_IFF_DEPRECATED) { 129 ifa->localifa_flags |= SCTP_ADDR_IFA_UNUSEABLE; 130 } else { 131 ifa->localifa_flags &= ~SCTP_ADDR_IFA_UNUSEABLE; 132 } 133 } else { 134 ifa->localifa_flags &= ~SCTP_ADDR_IFA_UNUSEABLE; 135 } 136 if (ifa->flags & 137 (IN6_IFF_DETACHED | 138 IN6_IFF_ANYCAST | 139 IN6_IFF_NOTREADY)) { 140 ifa->localifa_flags |= SCTP_ADDR_IFA_UNUSEABLE; 141 } else { 142 ifa->localifa_flags &= ~SCTP_ADDR_IFA_UNUSEABLE; 143 } 144} 145 |
146#endif | 146#endif /* INET6 */ |
147 148 149static uint32_t 150sctp_is_desired_interface_type(struct ifaddr *ifa) 151{ 152 int result; 153 154 /* check the interface type to see if it's one we care about */ --- 29 unchanged lines hidden (view full) --- 184 185 return (result); 186} 187 188 189static void 190sctp_init_ifns_for_vrf(int vrfid) 191{ | 147 148 149static uint32_t 150sctp_is_desired_interface_type(struct ifaddr *ifa) 151{ 152 int result; 153 154 /* check the interface type to see if it's one we care about */ --- 29 unchanged lines hidden (view full) --- 184 185 return (result); 186} 187 188 189static void 190sctp_init_ifns_for_vrf(int vrfid) 191{ |
192 193 |
|
192 /* 193 * Here we must apply ANY locks needed by the IFN we access and also 194 * make sure we lock any IFA that exists as we float through the 195 * list of IFA's 196 */ 197 struct ifnet *ifn; 198 struct ifaddr *ifa; 199 struct in6_ifaddr *ifa6; 200 struct sctp_ifa *sctp_ifa; 201 uint32_t ifa_flags; 202 | 194 /* 195 * Here we must apply ANY locks needed by the IFN we access and also 196 * make sure we lock any IFA that exists as we float through the 197 * list of IFA's 198 */ 199 struct ifnet *ifn; 200 struct ifaddr *ifa; 201 struct in6_ifaddr *ifa6; 202 struct sctp_ifa *sctp_ifa; 203 uint32_t ifa_flags; 204 |
203 TAILQ_FOREACH(ifn, &ifnet, if_list) { | 205 TAILQ_FOREACH(ifn, &MODULE_GLOBAL(MOD_NET, ifnet), if_list) { |
204 TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { | 206 TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { |
207 |
|
205 if (ifa->ifa_addr == NULL) { 206 continue; 207 } 208 if ((ifa->ifa_addr->sa_family != AF_INET) && (ifa->ifa_addr->sa_family != AF_INET6)) { 209 /* non inet/inet6 skip */ 210 continue; 211 } 212 if (ifa->ifa_addr->sa_family == AF_INET6) { --- 111 unchanged lines hidden (view full) --- 324 } 325} 326 327void 328 sctp_add_or_del_interfaces(int (*pred) (struct ifnet *), int add){ 329 struct ifnet *ifn; 330 struct ifaddr *ifa; 331 | 208 if (ifa->ifa_addr == NULL) { 209 continue; 210 } 211 if ((ifa->ifa_addr->sa_family != AF_INET) && (ifa->ifa_addr->sa_family != AF_INET6)) { 212 /* non inet/inet6 skip */ 213 continue; 214 } 215 if (ifa->ifa_addr->sa_family == AF_INET6) { --- 111 unchanged lines hidden (view full) --- 327 } 328} 329 330void 331 sctp_add_or_del_interfaces(int (*pred) (struct ifnet *), int add){ 332 struct ifnet *ifn; 333 struct ifaddr *ifa; 334 |
332 TAILQ_FOREACH(ifn, &ifnet, if_list) { | 335 TAILQ_FOREACH(ifn, &MODULE_GLOBAL(MOD_NET, ifnet), if_list) { |
333 if (!(*pred) (ifn)) { 334 continue; 335 } 336 TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { 337 sctp_addr_change(ifa, add ? RTM_ADD : RTM_DELETE); 338 } 339 } 340} --- 187 unchanged lines hidden --- | 336 if (!(*pred) (ifn)) { 337 continue; 338 } 339 TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { 340 sctp_addr_change(ifa, add ? RTM_ADD : RTM_DELETE); 341 } 342 } 343} --- 187 unchanged lines hidden --- |