diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-03-05 21:48:58 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-03-05 21:48:58 +0000 |
commit | 52f635294dc2220b27898d3db1703c9464b92fb1 (patch) | |
tree | 5c2d6cca90a4bcc953c4c704201e7c2d7c08188e /sys/netinet6/in6_ifattach.c | |
parent | 84fa77ca902d7934ca42a7fdd806497b643a8421 (diff) |
Use more queue macros rather than doing it by hand; ok otto@ krw@
Diffstat (limited to 'sys/netinet6/in6_ifattach.c')
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 542b35e8de2..53fea4b8566 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_ifattach.c,v 1.39 2005/05/23 20:10:14 mpf Exp $ */ +/* $OpenBSD: in6_ifattach.c,v 1.40 2006/03/05 21:48:57 miod Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -134,10 +134,7 @@ get_hw_ifid(ifp, in6) static u_int8_t allone[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - for (ifa = ifp->if_addrlist.tqh_first; - ifa; - ifa = ifa->ifa_list.tqe_next) - { + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_LINK) continue; sdl = (struct sockaddr_dl *)ifa->ifa_addr; @@ -279,8 +276,7 @@ get_ifid(ifp0, altifp, in6) } /* next, try to get it from some other hardware interface */ - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) - { + TAILQ_FOREACH(ifp, &ifnet, if_list) { if (ifp == ifp0) continue; if (get_hw_ifid(ifp, in6) != 0) @@ -663,18 +659,18 @@ in6_ifdetach(ifp) nd6_purge(ifp); /* nuke any of IPv6 addresses we have */ - for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = next) - { - next = ifa->ifa_list.tqe_next; + for (ifa = TAILQ_FIRST(&ifp->if_addrlist); + ifa != TAILQ_END(&ifp->if_addrlist); ifa = next) { + next = TAILQ_NEXT(ifa, ifa_list); if (ifa->ifa_addr->sa_family != AF_INET6) continue; in6_purgeaddr(ifa); } /* undo everything done by in6_ifattach(), just in case */ - for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = next) - { - next = ifa->ifa_list.tqe_next; + for (ifa = TAILQ_FIRST(&ifp->if_addrlist); + ifa != TAILQ_END(&ifp->if_addrlist); ifa = next) { + next = TAILQ_NEXT(ifa, ifa_list); if (ifa->ifa_addr->sa_family != AF_INET6 || !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) { @@ -686,7 +682,8 @@ in6_ifdetach(ifp) /* * leave from multicast groups we have joined for the interface */ - while ((imm = ia->ia6_memberships.lh_first) != NULL) { + while (!LIST_EMPTY(&ia->ia6_memberships)) { + imm = LIST_FIRST(&ia->ia6_memberships); LIST_REMOVE(imm, i6mm_chain); in6_leavegroup(imm); } |