Use IFADDR_FIRST(), IFADDR_NEXT().

This commit is contained in:
dyoung 2007-12-05 23:00:58 +00:00
parent 0bf994db38
commit b039c2dbef
4 changed files with 17 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6.c,v 1.136 2007/12/04 10:27:33 dyoung Exp $ */
/* $NetBSD: in6.c,v 1.137 2007/12/05 23:00:58 dyoung Exp $ */
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.136 2007/12/04 10:27:33 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.137 2007/12/05 23:00:58 dyoung Exp $");
#include "opt_inet.h"
#include "opt_pfil_hooks.h"
@ -1424,8 +1424,8 @@ in6_purgeif(struct ifnet *ifp)
{
struct ifaddr *ifa, *nifa;
for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa != NULL; ifa = nifa) {
nifa = TAILQ_NEXT(ifa, ifa_list);
for (ifa = IFADDR_FIRST(ifp); ifa != NULL; ifa = nifa) {
nifa = IFADDR_NEXT(ifa);
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
in6_purgeaddr(ifa);

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6_ifattach.c,v 1.76 2007/12/04 10:27:33 dyoung Exp $ */
/* $NetBSD: in6_ifattach.c,v 1.77 2007/12/05 23:00:58 dyoung Exp $ */
/* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */
/*
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.76 2007/12/04 10:27:33 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.77 2007/12/05 23:00:58 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -856,8 +856,8 @@ in6_ifdetach(struct ifnet *ifp)
/* XXX this code is duplicated in in6_purgeif() --dyoung */
/* nuke any of IPv6 addresses we have */
for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa; ifa = next) {
next = TAILQ_NEXT(ifa, ifa_list);
for (ifa = IFADDR_FIRST(ifp); ifa != NULL; ifa = next) {
next = IFADDR_NEXT(ifa);
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
in6_purgeaddr(ifa);
@ -866,8 +866,8 @@ in6_ifdetach(struct ifnet *ifp)
/* XXX isn't this code is redundant, given the above? --dyoung */
/* XXX doesn't this code replicate code in in6_purgeaddr() ? --dyoung */
/* undo everything done by in6_ifattach(), just in case */
for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa; ifa = next) {
next = TAILQ_NEXT(ifa, ifa_list);
for (ifa = IFADDR_FIRST(ifp); ifa != NULL; ifa = next) {
next = IFADDR_NEXT(ifa);
if (ifa->ifa_addr->sa_family != AF_INET6
|| !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: nd6_rtr.c,v 1.70 2007/12/04 10:27:34 dyoung Exp $ */
/* $NetBSD: nd6_rtr.c,v 1.71 2007/12/05 23:00:58 dyoung Exp $ */
/* $KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $ */
/*
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.70 2007/12/04 10:27:34 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.71 2007/12/05 23:00:58 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -423,7 +423,7 @@ nd6_rtmsg(int cmd, struct rtentry *rt)
info.rti_info[RTAX_NETMASK] = rt_mask(rt);
if (rt->rt_ifp) {
info.rti_info[RTAX_IFP] =
TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr;
IFADDR_FIRST(rt->rt_ifp)->ifa_addr;
info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: iso.c,v 1.45 2007/12/05 01:20:01 dyoung Exp $ */
/* $NetBSD: iso.c,v 1.46 2007/12/05 23:02:51 dyoung Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -95,7 +95,7 @@ SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: iso.c,v 1.45 2007/12/05 01:20:01 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: iso.c,v 1.46 2007/12/05 23:02:51 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -620,8 +620,8 @@ iso_purgeif(struct ifnet *ifp)
{
struct ifaddr *ifa, *nifa;
for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa != NULL; ifa = nifa) {
nifa = TAILQ_NEXT(ifa, ifa_list);
for (ifa = IFADDR_FIRST(ifp); ifa != NULL; ifa = nifa) {
nifa = IFADDR_NEXT(ifa);
if (ifa->ifa_addr->sa_family != AF_ISO)
continue;
iso_purgeaddr(ifa, ifp);