Define IFNET_EMPTY() and replace !IFNET_FIRST() with it

No functional change.
This commit is contained in:
ozaki-r 2014-07-31 02:21:51 +00:00
parent 4423977ff5
commit f46609a687
3 changed files with 10 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.h,v 1.172 2014/07/16 03:17:26 ozaki-r Exp $ */
/* $NetBSD: if.h,v 1.173 2014/07/31 02:21:51 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -981,6 +981,7 @@ __END_DECLS
#ifdef _KERNEL
#define IFNET_FIRST() TAILQ_FIRST(&ifnet_list)
#define IFNET_EMPTY() TAILQ_EMPTY(&ifnet_list)
#define IFNET_NEXT(__ifp) TAILQ_NEXT((__ifp), if_list)
#define IFNET_FOREACH(__ifp) TAILQ_FOREACH(__ifp, &ifnet_list, if_list)
#define IFADDR_FIRST(__ifp) TAILQ_FIRST(&(__ifp)->if_addrlist)

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_ip.c,v 1.137 2014/07/30 10:04:26 rtr Exp $ */
/* $NetBSD: raw_ip.c,v 1.138 2014/07/31 02:21:51 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.137 2014/07/30 10:04:26 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.138 2014/07/31 02:21:51 ozaki-r Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@ -487,7 +487,7 @@ rip_connect_pcb(struct inpcb *inp, struct mbuf *nam)
if (nam->m_len != sizeof(*addr))
return (EINVAL);
if (!IFNET_FIRST())
if (IFNET_EMPTY())
return (EADDRNOTAVAIL);
if (addr->sin_family != AF_INET)
return (EAFNOSUPPORT);
@ -575,7 +575,7 @@ rip_bind(struct socket *so, struct mbuf *nam)
error = EINVAL;
goto release;
}
if (!IFNET_FIRST()) {
if (IFNET_EMPTY()) {
error = EADDRNOTAVAIL;
goto release;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_ip6.c,v 1.130 2014/07/30 10:04:26 rtr Exp $ */
/* $NetBSD: raw_ip6.c,v 1.131 2014/07/31 02:21:51 ozaki-r Exp $ */
/* $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.130 2014/07/30 10:04:26 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.131 2014/07/31 02:21:51 ozaki-r Exp $");
#include "opt_ipsec.h"
@ -667,7 +667,7 @@ rip6_bind(struct socket *so, struct mbuf *nam)
addr = mtod(nam, struct sockaddr_in6 *);
if (nam->m_len != sizeof(*addr))
return EINVAL;
if (!IFNET_FIRST() || addr->sin6_family != AF_INET6)
if (IFNET_EMPTY() || addr->sin6_family != AF_INET6)
return EADDRNOTAVAIL;
if ((error = sa6_embedscope(addr, ip6_use_defzone)) != 0)
@ -716,7 +716,7 @@ rip6_connect(struct socket *so, struct mbuf *nam)
if (nam->m_len != sizeof(*addr))
return EINVAL;
if (!IFNET_FIRST())
if (IFNET_EMPTY())
return EADDRNOTAVAIL;
if (addr->sin6_family != AF_INET6)
return EAFNOSUPPORT;