summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet6/in6.c8
-rw-r--r--sys/netinet6/in6_ifattach.c11
-rw-r--r--sys/netinet6/nd6.c5
3 files changed, 8 insertions, 16 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 5610b9c2191..1eddd037f19 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.98 2012/07/14 17:23:16 sperreault Exp $ */
+/* $OpenBSD: in6.c,v 1.99 2012/09/19 09:47:25 bluhm Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -2154,8 +2154,7 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain)
* Comparing an interface with the outgoing interface will be done
* only at the final stage of tiebreaking.
*/
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list))
- {
+ TAILQ_FOREACH(ifp, &ifnet, if_list) {
if (ifp->if_rdomain != rdomain)
continue;
@@ -2462,8 +2461,7 @@ in6_setmaxmtu(void)
unsigned long maxmtu = 0;
struct ifnet *ifp;
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list))
- {
+ TAILQ_FOREACH(ifp, &ifnet, if_list) {
/* this function can be called during ifnet initialization */
if (!ifp->if_afdata[AF_INET6])
continue;
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 5158eee25cc..4cf9d71edc4 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_ifattach.c,v 1.55 2012/08/21 19:50:39 bluhm Exp $ */
+/* $OpenBSD: in6_ifattach.c,v 1.56 2012/09/19 09:47:25 bluhm Exp $ */
/* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */
/*
@@ -668,19 +668,14 @@ in6_ifdetach(struct ifnet *ifp)
nd6_purge(ifp);
/* nuke any of IPv6 addresses we have */
- for (ifa = TAILQ_FIRST(&ifp->if_addrlist);
- ifa != TAILQ_END(&ifp->if_addrlist); ifa = next) {
- next = TAILQ_NEXT(ifa, ifa_list);
+ TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrlist, ifa_list, next) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
in6_purgeaddr(ifa);
}
/* undo everything done by in6_ifattach(), just in case */
- for (ifa = TAILQ_FIRST(&ifp->if_addrlist);
- ifa != TAILQ_END(&ifp->if_addrlist); ifa = next) {
- next = TAILQ_NEXT(ifa, ifa_list);
-
+ TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrlist, ifa_list, next) {
if (ifa->ifa_addr->sa_family != AF_INET6
|| !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) {
continue;
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index f995e27c38f..c1a0696db3c 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.91 2012/01/03 23:41:51 bluhm Exp $ */
+/* $OpenBSD: nd6.c,v 1.92 2012/09/19 09:47:25 bluhm Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -1719,8 +1719,7 @@ nd6_slowtimo(void *ignored_arg)
timeout_set(&nd6_slowtimo_ch, nd6_slowtimo, NULL);
timeout_add_sec(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL);
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list))
- {
+ TAILQ_FOREACH(ifp, &ifnet, if_list) {
nd6if = ND_IFINFO(ifp);
if (nd6if->basereachable && /* already initialized */
(nd6if->recalctm -= ND6_SLOWTIMER_INTERVAL) <= 0) {