Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Replace generic queue macros with IFNET/IFADDR m...
details: https://anonhg.NetBSD.org/src/rev/0dd18704ac7b
branches: trunk
changeset: 344524:0dd18704ac7b
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun Apr 03 09:57:40 2016 +0000
description:
Replace generic queue macros with IFNET/IFADDR macros.
diffstat:
sys/netinet/sctp_asconf.c | 10 +++---
sys/netinet/sctp_output.c | 75 +++++++++++++++++++++++-----------------------
sys/netinet/sctp_pcb.c | 8 ++--
sys/netinet/sctp_usrreq.c | 12 +++---
sys/netinet/sctputil.c | 8 ++--
5 files changed, 56 insertions(+), 57 deletions(-)
diffs (truncated from 435 to 300 lines):
diff -r 26bd096b111c -r 0dd18704ac7b sys/netinet/sctp_asconf.c
--- a/sys/netinet/sctp_asconf.c Sun Apr 03 09:06:28 2016 +0000
+++ b/sys/netinet/sctp_asconf.c Sun Apr 03 09:57:40 2016 +0000
@@ -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 @@
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 @@
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
diff -r 26bd096b111c -r 0dd18704ac7b sys/netinet/sctp_output.c
--- a/sys/netinet/sctp_output.c Sun Apr 03 09:06:28 2016 +0000
+++ b/sys/netinet/sctp_output.c Sun Apr 03 09:57:40 2016 +0000
@@ -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 @@
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 @@
}
}
/* 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 @@
*/
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 @@
}
}
/* 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 @@
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 @@
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 @@
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 @@
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 @@
* 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 @@
* 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 @@
* 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 @@
/* 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 @@
* 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 @@
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 @@
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 @@
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 @@
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 @@
#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 @@
}
#endif
started_at_beginning=1;
- inp->next_ifn_touse = TAILQ_FIRST(&ifnet_list);
- }
- }
- for (ifn = inp->next_ifn_touse; ifn;
- ifn = TAILQ_NEXT(ifn, if_list)) {
+ inp->next_ifn_touse = IFNET_FIRST();
+ }
+ }
+ IFNET_FOREACH(ifn) {
if (loopscope == 0 && ifn->if_type == IFT_LOOP) {
/* wrong base scope */
continue;
@@ -2714,7 +2713,7 @@
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 @@
*/
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 @@
}
}
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 @@
*/
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 @@
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)) {
Home |
Main Index |
Thread Index |
Old Index