Module Name: src Committed By: mlelstv Date: Sun Apr 3 09:57:40 UTC 2016
Modified Files: src/sys/netinet: sctp_asconf.c sctp_output.c sctp_pcb.c sctp_usrreq.c sctputil.c Log Message: Replace generic queue macros with IFNET/IFADDR macros. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctp_asconf.c \ src/sys/netinet/sctp_output.c src/sys/netinet/sctp_pcb.c cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/sctp_usrreq.c cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/sctputil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet/sctp_asconf.c diff -u src/sys/netinet/sctp_asconf.c:1.1 src/sys/netinet/sctp_asconf.c:1.2 --- src/sys/netinet/sctp_asconf.c:1.1 Tue Oct 13 21:28:35 2015 +++ src/sys/netinet/sctp_asconf.c Sun Apr 3 09:57:40 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sctp_asconf.c,v 1.1 2015/10/13 21:28:35 rjs Exp $ */ +/* $NetBSD: sctp_asconf.c,v 1.2 2016/04/03 09:57:40 mlelstv Exp $ */ /* $KAME: sctp_asconf.c,v 1.25 2005/06/16 20:44:24 jinmei Exp $ */ /* @@ -30,7 +30,7 @@ * SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sctp_asconf.c,v 1.1 2015/10/13 21:28:35 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_asconf.c,v 1.2 2016/04/03 09:57:40 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -2116,7 +2116,7 @@ sctp_find_valid_localaddr(struct sctp_tc struct ifnet *ifn; struct ifaddr *ifa, *nifa; - TAILQ_FOREACH(ifn, &ifnet_list, if_list) { + IFNET_FOREACH(ifn) { if (stcb->asoc.loopback_scope == 0 && ifn->if_type == IFT_LOOP) { /* Skip if loopback_scope not set */ continue; @@ -2774,14 +2774,14 @@ sctp_check_address_list_all(struct sctp_ struct ifaddr *ifa; /* go through all our known interfaces */ - TAILQ_FOREACH(ifn, &ifnet_list, if_list) { + IFNET_FOREACH(ifn) { if (loopback_scope == 0 && ifn->if_type == IFT_LOOP) { /* skip loopback interface */ continue; } /* go through each interface address */ - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { /* do i have it implicitly? */ if (sctp_cmpaddr(ifa->ifa_addr, init_addr)) { #ifdef SCTP_DEBUG Index: src/sys/netinet/sctp_output.c diff -u src/sys/netinet/sctp_output.c:1.1 src/sys/netinet/sctp_output.c:1.2 --- src/sys/netinet/sctp_output.c:1.1 Tue Oct 13 21:28:35 2015 +++ src/sys/netinet/sctp_output.c Sun Apr 3 09:57:40 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sctp_output.c,v 1.1 2015/10/13 21:28:35 rjs Exp $ */ +/* $NetBSD: sctp_output.c,v 1.2 2016/04/03 09:57:40 mlelstv Exp $ */ /* $KAME: sctp_output.c,v 1.48 2005/06/16 18:29:24 jinmei Exp $ */ /* @@ -30,7 +30,7 @@ * SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.1 2015/10/13 21:28:35 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.2 2016/04/03 09:57:40 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -546,7 +546,7 @@ sctp_choose_v4_boundspecific_inp(struct ifn = rt->rt_ifp; if (ifn) { /* is a prefered one on the interface we route out? */ - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { sin = sctp_is_v4_ifa_addr_prefered (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local); if (sin == NULL) continue; @@ -555,7 +555,7 @@ sctp_choose_v4_boundspecific_inp(struct } } /* is an acceptable one on the interface we route out? */ - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { sin = sctp_is_v4_ifa_addr_acceptable (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local); if (sin == NULL) continue; @@ -648,7 +648,7 @@ sctp_choose_v4_boundspecific_stcb(struct */ if (ifn) { /* first try for an prefered address on the ep */ - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (sctp_is_addr_in_ep(inp, ifa)) { sin = sctp_is_v4_ifa_addr_prefered (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local); if (sin == NULL) @@ -662,7 +662,7 @@ sctp_choose_v4_boundspecific_stcb(struct } } /* next try for an acceptable address on the ep */ - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (sctp_is_addr_in_ep(inp, ifa)) { sin = sctp_is_v4_ifa_addr_acceptable (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local); if (sin == NULL) @@ -762,7 +762,7 @@ sctp_choose_v4_boundspecific_stcb(struct continue; /* first question, is laddr->ifa an address associated with the emit interface */ if (ifn) { - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (laddr->ifa == ifa) { sin = (struct sockaddr_in *)laddr->ifa->ifa_addr; return (sin->sin_addr); @@ -786,7 +786,7 @@ sctp_choose_v4_boundspecific_stcb(struct continue; /* first question, is laddr->ifa an address associated with the emit interface */ if (ifn) { - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (laddr->ifa == ifa) { sin = (struct sockaddr_in *)laddr->ifa->ifa_addr; return (sin->sin_addr); @@ -836,7 +836,7 @@ sctp_select_v4_nth_prefered_addr_from_if struct sockaddr_in *sin; uint8_t sin_loop, sin_local; int num_eligible_addr = 0; - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { sin = sctp_is_v4_ifa_addr_prefered (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local); if (sin == NULL) continue; @@ -864,7 +864,7 @@ sctp_count_v4_num_prefered_boundall (str struct sockaddr_in *sin; int num_eligible_addr = 0; - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { sin = sctp_is_v4_ifa_addr_prefered (ifa, loopscope, ipv4_scope, sin_loop, sin_local); if (sin == NULL) continue; @@ -956,7 +956,7 @@ sctp_choose_v4_boundall(struct sctp_inpc * and see if we can find an acceptable address. */ bound_all_v4_plan_b: - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { sin = sctp_is_v4_ifa_addr_acceptable (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local); if (sin == NULL) continue; @@ -975,9 +975,9 @@ sctp_choose_v4_boundall(struct sctp_inpc * address. If we reache here we are in trouble I think. */ bound_all_v4_plan_c: - for (ifn = TAILQ_FIRST(&ifnet_list); - ifn && (ifn != inp->next_ifn_touse); - ifn=TAILQ_NEXT(ifn, if_list)) { + IFNET_FOREACH(ifn) { + if (ifn == inp->next_ifn_touse) + break; if (loopscope == 0 && ifn->if_type == IFT_LOOP) { /* wrong base scope */ continue; @@ -1021,9 +1021,9 @@ sctp_choose_v4_boundall(struct sctp_inpc * illicit an ABORT, falling through. */ - for (ifn = TAILQ_FIRST(&ifnet_list); - ifn && (ifn != inp->next_ifn_touse); - ifn=TAILQ_NEXT(ifn, if_list)) { + IFNET_FOREACH(ifn) { + if (ifn == inp->next_ifn_touse) + break; if (loopscope == 0 && ifn->if_type == IFT_LOOP) { /* wrong base scope */ continue; @@ -1032,7 +1032,7 @@ sctp_choose_v4_boundall(struct sctp_inpc /* already looked at this guy */ continue; - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { sin = sctp_is_v4_ifa_addr_acceptable (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local); if (sin == NULL) continue; @@ -1297,7 +1297,7 @@ sctp_choose_v6_boundspecific_stcb(struct * in our list, if so, we want that one. */ if (ifn) { - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (sctp_is_addr_in_ep(inp, ifa)) { sin6 = sctp_is_v6_ifa_addr_acceptable (ifa, loopscope, loc_scope, &sin_loop, &sin_local); if (sin6 == NULL) @@ -1398,7 +1398,7 @@ sctp_choose_v6_boundspecific_stcb(struct continue; /* first question, is laddr->ifa an address associated with the emit interface */ if (ifn) { - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (laddr->ifa == ifa) { sin6 = (struct sockaddr_in6 *)laddr->ifa->ifa_addr; return (sin6); @@ -1477,7 +1477,7 @@ sctp_choose_v6_boundspecific_inp(struct ifn = rt->rt_ifp; if (ifn) { - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { sin6 = sctp_is_v6_ifa_addr_acceptable (ifa, loopscope, loc_scope, &sin_loop, &sin_local); if (sin6 == NULL) continue; @@ -1547,7 +1547,7 @@ sctp_select_v6_nth_addr_from_ifn_boundal int sin_loop, sin_local; int num_eligible_addr = 0; - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { sin6 = sctp_is_v6_ifa_addr_acceptable (ifa, loopscope, loc_scope, &sin_loop, &sin_local); if (sin6 == NULL) continue; @@ -1595,7 +1595,7 @@ sctp_count_v6_num_eligible_boundall (str int num_eligible_addr = 0; int sin_loop, sin_local; - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { sin6 = sctp_is_v6_ifa_addr_acceptable (ifa, loopscope, loc_scope, &sin_loop, &sin_local); if (sin6 == NULL) continue; @@ -1715,14 +1715,14 @@ sctp_choose_v6_boundall(struct sctp_inpc #endif if (inp->next_ifn_touse == NULL) { started_at_beginning=1; - inp->next_ifn_touse = TAILQ_FIRST(&ifnet_list); + inp->next_ifn_touse = IFNET_FIRST(); #ifdef SCTP_DEBUG if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) { printf("Start at first IFN:%p\n", inp->next_ifn_touse); } #endif } else { - inp->next_ifn_touse = TAILQ_NEXT(inp->next_ifn_touse, if_list); + inp->next_ifn_touse = IFNET_NEXT(inp->next_ifn_touse); #ifdef SCTP_DEBUG if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) { printf("Resume at IFN:%p\n", inp->next_ifn_touse); @@ -1735,11 +1735,10 @@ sctp_choose_v6_boundall(struct sctp_inpc } #endif started_at_beginning=1; - inp->next_ifn_touse = TAILQ_FIRST(&ifnet_list); + inp->next_ifn_touse = IFNET_FIRST(); } } - for (ifn = inp->next_ifn_touse; ifn; - ifn = TAILQ_NEXT(ifn, if_list)) { + IFNET_FOREACH(ifn) { if (loopscope == 0 && ifn->if_type == IFT_LOOP) { /* wrong base scope */ continue; @@ -2714,7 +2713,7 @@ sctp_send_initiate(struct sctp_inpcb *in int cnt; cnt = cnt_inits_to; - TAILQ_FOREACH(ifn, &ifnet_list, if_list) { + IFNET_FOREACH(ifn) { if ((stcb->asoc.loopback_scope == 0) && (ifn->if_type == IFT_LOOP)) { /* @@ -2723,7 +2722,7 @@ sctp_send_initiate(struct sctp_inpcb *in */ continue; } - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (sctp_is_address_in_scope(ifa, stcb->asoc.ipv4_addr_legal, stcb->asoc.ipv6_addr_legal, @@ -2737,7 +2736,7 @@ sctp_send_initiate(struct sctp_inpcb *in } } if (cnt > 1) { - TAILQ_FOREACH(ifn, &ifnet_list, if_list) { + IFNET_FOREACH(ifn) { if ((stcb->asoc.loopback_scope == 0) && (ifn->if_type == IFT_LOOP)) { /* @@ -2746,7 +2745,7 @@ sctp_send_initiate(struct sctp_inpcb *in */ continue; } - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (sctp_is_address_in_scope(ifa, stcb->asoc.ipv4_addr_legal, stcb->asoc.ipv6_addr_legal, @@ -3659,7 +3658,7 @@ sctp_send_initiate_ack(struct sctp_inpcb struct ifaddr *ifa; int cnt = cnt_inits_to; - TAILQ_FOREACH(ifn, &ifnet_list, if_list) { + IFNET_FOREACH(ifn) { if ((stc.loopback_scope == 0) && (ifn->if_type == IFT_LOOP)) { /* @@ -3668,7 +3667,7 @@ sctp_send_initiate_ack(struct sctp_inpcb */ continue; } - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (sctp_is_address_in_scope(ifa, stc.ipv4_addr_legal, stc.ipv6_addr_legal, stc.loopback_scope, stc.ipv4_scope, @@ -3679,7 +3678,7 @@ sctp_send_initiate_ack(struct sctp_inpcb } } if (cnt > 1) { - TAILQ_FOREACH(ifn, &ifnet_list, if_list) { + IFNET_FOREACH(ifn) { if ((stc.loopback_scope == 0) && (ifn->if_type == IFT_LOOP)) { /* @@ -3688,7 +3687,7 @@ sctp_send_initiate_ack(struct sctp_inpcb */ continue; } - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (sctp_is_address_in_scope(ifa, stc.ipv4_addr_legal, stc.ipv6_addr_legal, Index: src/sys/netinet/sctp_pcb.c diff -u src/sys/netinet/sctp_pcb.c:1.1 src/sys/netinet/sctp_pcb.c:1.2 --- src/sys/netinet/sctp_pcb.c:1.1 Tue Oct 13 21:28:35 2015 +++ src/sys/netinet/sctp_pcb.c Sun Apr 3 09:57:40 2016 @@ -1,5 +1,5 @@ /* $KAME: sctp_pcb.c,v 1.39 2005/06/16 18:29:25 jinmei Exp $ */ -/* $NetBSD: sctp_pcb.c,v 1.1 2015/10/13 21:28:35 rjs Exp $ */ +/* $NetBSD: sctp_pcb.c,v 1.2 2016/04/03 09:57:40 mlelstv Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.1 2015/10/13 21:28:35 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.2 2016/04/03 09:57:40 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2339,8 +2339,8 @@ sctp_is_address_on_local_host(struct soc { struct ifnet *ifn; struct ifaddr *ifa; - TAILQ_FOREACH(ifn, &ifnet_list, if_list) { - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFNET_FOREACH(ifn) { + IFADDR_FOREACH(ifa, ifn) { if (addr->sa_family == ifa->ifa_addr->sa_family) { /* same family */ if (addr->sa_family == AF_INET) { Index: src/sys/netinet/sctp_usrreq.c diff -u src/sys/netinet/sctp_usrreq.c:1.2 src/sys/netinet/sctp_usrreq.c:1.3 --- src/sys/netinet/sctp_usrreq.c:1.2 Sun Dec 13 18:58:13 2015 +++ src/sys/netinet/sctp_usrreq.c Sun Apr 3 09:57:40 2016 @@ -1,5 +1,5 @@ /* $KAME: sctp_usrreq.c,v 1.50 2005/06/16 20:45:29 jinmei Exp $ */ -/* $NetBSD: sctp_usrreq.c,v 1.2 2015/12/13 18:58:13 christos Exp $ */ +/* $NetBSD: sctp_usrreq.c,v 1.3 2016/04/03 09:57:40 mlelstv Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.2 2015/12/13 18:58:13 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.3 2016/04/03 09:57:40 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -943,13 +943,13 @@ sctp_fill_up_addresses(struct sctp_inpcb } if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { - TAILQ_FOREACH(ifn, &ifnet_list, if_list) { + IFNET_FOREACH(ifn) { if ((loopback_scope == 0) && (ifn->if_type == IFT_LOOP)) { /* Skip loopback if loopback_scope not set */ continue; } - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (stcb) { /* * For the BOUND-ALL case, the list @@ -1096,8 +1096,8 @@ sctp_count_max_addresses(struct sctp_inp struct ifnet *ifn; struct ifaddr *ifa; - TAILQ_FOREACH(ifn, &ifnet_list, if_list) { - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFNET_FOREACH(ifn) { + IFADDR_FOREACH(ifa, ifn) { /* Count them if they are the right type */ if (ifa->ifa_addr->sa_family == AF_INET) { if (inp->sctp_flags & SCTP_PCB_FLAGS_NEEDS_MAPPED_V4) Index: src/sys/netinet/sctputil.c diff -u src/sys/netinet/sctputil.c:1.3 src/sys/netinet/sctputil.c:1.4 --- src/sys/netinet/sctputil.c:1.3 Sun Mar 6 19:46:05 2016 +++ src/sys/netinet/sctputil.c Sun Apr 3 09:57:40 2016 @@ -1,5 +1,5 @@ /* $KAME: sctputil.c,v 1.39 2005/06/16 20:54:06 jinmei Exp $ */ -/* $NetBSD: sctputil.c,v 1.3 2016/03/06 19:46:05 christos Exp $ */ +/* $NetBSD: sctputil.c,v 1.4 2016/04/03 09:57:40 mlelstv Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.3 2016/03/06 19:46:05 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.4 2016/04/03 09:57:40 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -3610,9 +3610,9 @@ sctp_find_ifa_by_addr(struct sockaddr *s struct ifaddr *ifa; /* go through all our known interfaces */ - TAILQ_FOREACH(ifn, &ifnet_list, if_list) { + IFNET_FOREACH(ifn) { /* go through each interface addresses */ - TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { /* correct family? */ if (ifa->ifa_addr->sa_family != sa->sa_family) continue;