summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2001-12-10 06:10:54 +0000
committerJason Wright <jason@cvs.openbsd.org>2001-12-10 06:10:54 +0000
commitd8191d98a2bdc19162af3d513307c13f7af19e0c (patch)
treee82ca94786e5488e57d401c5ded4812ef9eac561
parent17b1ac72885b865246a857a583fb7e12d8b3a0de (diff)
use queue.h macros for TAILQ operations
-rw-r--r--sys/net/if_fddisubr.c8
-rw-r--r--sys/net/if_spppsubr.c14
-rw-r--r--sys/net/if_tun.c8
-rw-r--r--sys/net/route.c6
-rw-r--r--sys/net/rtsock.c16
5 files changed, 26 insertions, 26 deletions
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index f33507d23e8..cfc37923b59 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_fddisubr.c,v 1.26 2001/11/30 07:59:17 itojun Exp $ */
+/* $OpenBSD: if_fddisubr.c,v 1.27 2001/12/10 06:10:53 jason Exp $ */
/* $NetBSD: if_fddisubr.c,v 1.5 1996/05/07 23:20:21 christos Exp $ */
/*
@@ -671,10 +671,9 @@ fddi_ifattach(ifp)
ifp->if_mtu = FDDIMTU;
ifp->if_output = fddi_output;
#if defined(__NetBSD__) || defined(__OpenBSD__)
- for (ifa = ifp->if_addrlist.tqh_first; ifa != 0;
- ifa = ifa->ifa_list.tqe_next)
+ TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
#else
- for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
+ for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) {
#endif
if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) &&
sdl->sdl_family == AF_LINK) {
@@ -684,4 +683,5 @@ fddi_ifattach(ifp)
LLADDR(sdl), ifp->if_addrlen);
break;
}
+ }
}
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index 4e31e983b8c..c45ec27d7d3 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_spppsubr.c,v 1.10 2001/07/10 11:09:07 espie Exp $ */
+/* $OpenBSD: if_spppsubr.c,v 1.11 2001/12/10 06:10:53 jason Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
* Keepalive protocol implemented in both Cisco and PPP modes.
@@ -3903,16 +3903,17 @@ sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask)
ifa;
ifa = ifa->ifa_link.tqe_next)
#else
- for (ifa = ifp->if_addrlist.tqh_first, si = 0;
- ifa;
- ifa = ifa->ifa_list.tqe_next)
+ si = 0;
+ TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list)
#endif
+ {
if (ifa->ifa_addr->sa_family == AF_INET) {
si = (struct sockaddr_in *)ifa->ifa_addr;
sm = (struct sockaddr_in *)ifa->ifa_netmask;
if (si)
break;
}
+ }
if (ifa) {
if (si && si->sin_addr.s_addr) {
ssrc = si->sin_addr.s_addr;
@@ -3949,9 +3950,8 @@ sppp_set_ip_addr(struct sppp *sp, u_long src)
ifa;
ifa = ifa->ifa_link.tqe_next)
#else
- for (ifa = ifp->if_addrlist.tqh_first, si = 0;
- ifa;
- ifa = ifa->ifa_list.tqe_next)
+ si = 0;
+ TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list)
#endif
{
if (ifa->ifa_addr->sa_family == AF_INET)
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index ba073c9644c..c0febffec45 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.39 2001/08/21 11:03:45 brian Exp $ */
+/* $OpenBSD: if_tun.c,v 1.40 2001/12/10 06:10:53 jason Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -222,8 +222,7 @@ tunclose(dev, flag, mode, p)
if (ifp->if_flags & IFF_RUNNING) {
/* find internet addresses and delete routes */
register struct ifaddr *ifa;
- for (ifa = ifp->if_addrlist.tqh_first; ifa != 0;
- ifa = ifa->ifa_list.tqe_next) {
+ TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
#ifdef INET
if (ifa->ifa_addr->sa_family == AF_INET) {
rtinit(ifa, (int)RTM_DELETE,
@@ -254,8 +253,7 @@ tuninit(tp)
ifp->if_flags |= IFF_UP | IFF_RUNNING;
tp->tun_flags &= ~(TUN_IASET|TUN_DSTADDR|TUN_BRDADDR);
- for (ifa = ifp->if_addrlist.tqh_first; ifa != 0;
- ifa = ifa->ifa_list.tqe_next) {
+ TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
#ifdef INET
if (ifa->ifa_addr->sa_family == AF_INET) {
struct sockaddr_in *sin;
diff --git a/sys/net/route.c b/sys/net/route.c
index cf841b34c65..6940a8e91b9 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.25 2001/07/20 18:46:50 itojun Exp $ */
+/* $OpenBSD: route.c,v 1.26 2001/12/10 06:10:53 jason Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -117,7 +117,7 @@ static int okaytoclone __P((u_int, int));
static struct ifaddr *
encap_findgwifa(struct sockaddr *gw)
{
- return encif.if_addrlist.tqh_first;
+ return TAILQ_FIRST(&encif.if_addrlist);
}
#endif
@@ -250,7 +250,7 @@ rtalloc1(dst, report)
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
if (rt->rt_ifp != NULL) {
info.rti_info[RTAX_IFP] =
- rt->rt_ifp->if_addrlist.tqh_first->ifa_addr;
+ TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr;
info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
}
rt_missmsg(RTM_ADD, &info, rt->rt_flags, 0);
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index c58b7225ce7..d60219dd494 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.18 2001/11/06 19:53:20 miod Exp $ */
+/* $OpenBSD: rtsock.c,v 1.19 2001/12/10 06:10:53 jason Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -293,7 +293,8 @@ route_output(m, va_alist)
genmask = rt->rt_genmask;
if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) {
if ((ifp = rt->rt_ifp) != NULL) {
- ifpaddr = ifp->if_addrlist.tqh_first->ifa_addr;
+ ifpaddr =
+ TAILQ_FIRST(&ifp->if_addrlist)->ifa_addr;
ifaaddr = rt->rt_ifa->ifa_addr;
if (ifp->if_flags & IFF_POINTOPOINT)
brdaddr = rt->rt_ifa->ifa_dstaddr;
@@ -728,7 +729,7 @@ rt_newaddrmsg(cmd, ifa, error, rt)
int ncmd = cmd == RTM_ADD ? RTM_NEWADDR : RTM_DELADDR;
ifaaddr = sa = ifa->ifa_addr;
- ifpaddr = ifp->if_addrlist.tqh_first->ifa_addr;
+ ifpaddr = TAILQ_FIRST(&ifp->if_addrlist)->ifa_addr;
netmask = ifa->ifa_netmask;
brdaddr = ifa->ifa_dstaddr;
if ((m = rt_msg1(ncmd, &info)) == NULL)
@@ -782,7 +783,7 @@ sysctl_dumpentry(rn, v)
netmask = rt_mask(rt);
genmask = rt->rt_genmask;
if (rt->rt_ifp) {
- ifpaddr = rt->rt_ifp->if_addrlist.tqh_first->ifa_addr;
+ ifpaddr = TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr;
ifaaddr = rt->rt_ifa->ifa_addr;
if (rt->rt_ifp->if_flags & IFF_POINTOPOINT)
brdaddr = rt->rt_ifa->ifa_dstaddr;
@@ -816,10 +817,10 @@ sysctl_iflist(af, w)
int len, error = 0;
bzero((caddr_t)&info, sizeof(info));
- for (ifp = ifnet.tqh_first; ifp != 0; ifp = ifp->if_list.tqe_next) {
+ TAILQ_FOREACH(ifp, &ifnet, if_list) {
if (w->w_arg && w->w_arg != ifp->if_index)
continue;
- ifa = ifp->if_addrlist.tqh_first;
+ ifa = TAILQ_FIRST(&ifp->if_addrlist);
ifpaddr = ifa->ifa_addr;
len = rt_msg2(RTM_IFINFO, &info, (caddr_t)0, w);
ifpaddr = 0;
@@ -836,7 +837,8 @@ sysctl_iflist(af, w)
return (error);
w->w_where += len;
}
- while ((ifa = ifa->ifa_list.tqe_next) != NULL) {
+ while ((ifa = TAILQ_NEXT(ifa, ifa_list)) !=
+ TAILQ_END(&ifp->if_addrlist)) {
if (af && af != ifa->ifa_addr->sa_family)
continue;
ifaaddr = ifa->ifa_addr;