Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Introduce if_is_deactivated
details: https://anonhg.NetBSD.org/src/rev/898e37f80f9e
branches: trunk
changeset: 346137:898e37f80f9e
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Tue Jun 28 02:36:54 2016 +0000
description:
Introduce if_is_deactivated
Checking ifp->if_output == if_nulloutput is too implicit.
No functional change.
diffstat:
sys/net/if.c | 33 ++++++++++++++++++++-------------
sys/net/if.h | 3 ++-
sys/netinet6/in6.c | 6 +++---
3 files changed, 25 insertions(+), 17 deletions(-)
diffs (175 lines):
diff -r 2916614b8b5f -r 898e37f80f9e sys/net/if.c
--- a/sys/net/if.c Tue Jun 28 02:02:56 2016 +0000
+++ b/sys/net/if.c Tue Jun 28 02:36:54 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.347 2016/06/27 10:09:02 knakahara Exp $ */
+/* $NetBSD: if.c,v 1.348 2016/06/28 02:36:54 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.347 2016/06/27 10:09:02 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.348 2016/06/28 02:36:54 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -1006,6 +1006,13 @@
splx(s);
}
+bool
+if_is_deactivated(struct ifnet *ifp)
+{
+
+ return ifp->if_output == if_nulloutput;
+}
+
void
if_purgeaddrs(struct ifnet *ifp, int family, void (*purgeaddr)(struct ifaddr *))
{
@@ -1515,7 +1522,7 @@
s = pserialize_read_enter();
IFNET_READER_FOREACH(ifp) {
- if (ifp->if_output == if_nulloutput)
+ if (if_is_deactivated(ifp))
continue;
IFADDR_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != addr->sa_family)
@@ -1547,7 +1554,7 @@
s = pserialize_read_enter();
IFNET_READER_FOREACH(ifp) {
- if (ifp->if_output == if_nulloutput)
+ if (if_is_deactivated(ifp))
continue;
if ((ifp->if_flags & IFF_POINTOPOINT) == 0)
continue;
@@ -1582,7 +1589,7 @@
sdl = satocsdl(addr);
if (sdl->sdl_index && sdl->sdl_index < if_indexlim &&
ifindex2ifnet[sdl->sdl_index] &&
- ifindex2ifnet[sdl->sdl_index]->if_output != if_nulloutput) {
+ !if_is_deactivated(ifindex2ifnet[sdl->sdl_index])) {
return ifindex2ifnet[sdl->sdl_index]->if_dl;
}
}
@@ -1592,7 +1599,7 @@
sat = (const struct sockaddr_at *)addr;
s = pserialize_read_enter();
IFNET_READER_FOREACH(ifp) {
- if (ifp->if_output == if_nulloutput)
+ if (if_is_deactivated(ifp))
continue;
ifa = at_ifawithnet((const struct sockaddr_at *)addr, ifp);
if (ifa == NULL)
@@ -1611,7 +1618,7 @@
#endif
s = pserialize_read_enter();
IFNET_READER_FOREACH(ifp) {
- if (ifp->if_output == if_nulloutput)
+ if (if_is_deactivated(ifp))
continue;
IFADDR_FOREACH(ifa, ifp) {
const char *cp, *cp2, *cp3;
@@ -1666,7 +1673,7 @@
s = pserialize_read_enter();
IFNET_READER_FOREACH(ifp) {
- if (ifp->if_output == if_nulloutput)
+ if (if_is_deactivated(ifp))
continue;
IFADDR_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family == af)
@@ -1691,7 +1698,7 @@
struct ifaddr *ifa_maybe = 0;
u_int af = addr->sa_family;
- if (ifp->if_output == if_nulloutput)
+ if (if_is_deactivated(ifp))
return NULL;
if (af >= AF_MAX)
@@ -2128,7 +2135,7 @@
if (unit >= if_indexlim)
return NULL;
ifp = ifindex2ifnet[unit];
- if (ifp == NULL || ifp->if_output == if_nulloutput)
+ if (ifp == NULL || if_is_deactivated(ifp))
return NULL;
return ifp;
}
@@ -2136,7 +2143,7 @@
ifp = NULL;
s = pserialize_read_enter();
IFNET_READER_FOREACH(ifp) {
- if (ifp->if_output == if_nulloutput)
+ if (if_is_deactivated(ifp))
continue;
if (strcmp(ifp->if_xname, name) == 0)
goto out;
@@ -2174,7 +2181,7 @@
if (unit >= if_indexlim)
return NULL;
ifp = ifindex2ifnet[unit];
- if (ifp == NULL || ifp->if_output == if_nulloutput)
+ if (ifp == NULL || if_is_deactivated(ifp))
return NULL;
return ifp;
}
@@ -2182,7 +2189,7 @@
ifp = NULL;
s = pserialize_read_enter();
IFNET_READER_FOREACH(ifp) {
- if (ifp->if_output == if_nulloutput)
+ if (if_is_deactivated(ifp))
continue;
if (strcmp(ifp->if_xname, name) == 0) {
psref_acquire(psref, &ifp->if_psref,
diff -r 2916614b8b5f -r 898e37f80f9e sys/net/if.h
--- a/sys/net/if.h Tue Jun 28 02:02:56 2016 +0000
+++ b/sys/net/if.h Tue Jun 28 02:36:54 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.h,v 1.217 2016/06/27 10:09:02 knakahara Exp $ */
+/* $NetBSD: if.h,v 1.218 2016/06/28 02:36:54 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -938,6 +938,7 @@
void if_attach(struct ifnet *); /* Deprecated. Use if_initialize and if_register */
void if_attachdomain(void);
void if_deactivate(struct ifnet *);
+bool if_is_deactivated(struct ifnet *);
void if_purgeaddrs(struct ifnet *, int, void (*)(struct ifaddr *));
void if_detach(struct ifnet *);
void if_down(struct ifnet *);
diff -r 2916614b8b5f -r 898e37f80f9e sys/netinet6/in6.c
--- a/sys/netinet6/in6.c Tue Jun 28 02:02:56 2016 +0000
+++ b/sys/netinet6/in6.c Tue Jun 28 02:36:54 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6.c,v 1.200 2016/06/22 07:48:17 ozaki-r Exp $ */
+/* $NetBSD: in6.c,v 1.201 2016/06/28 02:36:54 ozaki-r 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.200 2016/06/22 07:48:17 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.201 2016/06/28 02:36:54 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1368,7 +1368,7 @@
*/
if (LIST_EMPTY(&oia->ia6_multiaddrs))
;
- else if (oia->ia_ifa.ifa_ifp->if_output == if_nulloutput) {
+ else if (if_is_deactivated(oia->ia_ifa.ifa_ifp)) {
struct in6_multi *in6m, *next;
for (in6m = LIST_FIRST(&oia->ia6_multiaddrs); in6m != NULL;
Home |
Main Index |
Thread Index |
Old Index