IFF_RUNNING checking in Rx and Tx processing is unnecessary now.

Because the configs of gif (members of gif_var) are protected by psref(9).
This commit is contained in:
knakahara 2017-11-27 05:05:50 +00:00
parent 62d0256281
commit 753ed3406c
3 changed files with 10 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_gif.c,v 1.133 2017/11/27 05:02:22 knakahara Exp $ */
/* $NetBSD: if_gif.c,v 1.134 2017/11/27 05:05:50 knakahara Exp $ */
/* $KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $ */
/*
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.133 2017/11/27 05:02:22 knakahara Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.134 2017/11/27 05:05:50 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -378,8 +378,7 @@ gif_encapcheck(struct mbuf *m, int off, int proto, void *arg)
if (sc == NULL)
return 0;
if ((sc->gif_if.if_flags & (IFF_UP|IFF_RUNNING))
!= (IFF_UP|IFF_RUNNING))
if ((sc->gif_if.if_flags & IFF_UP) == 0)
return 0;
var = gif_getref_variant(sc, &psref);
@ -492,7 +491,7 @@ gif_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
goto end;
}
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
if ((ifp->if_flags & IFF_UP) == 0) {
m_freem(m);
error = ENETDOWN;
goto end;

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_gif.c,v 1.90 2017/11/27 05:02:22 knakahara Exp $ */
/* $NetBSD: in_gif.c,v 1.91 2017/11/27 05:05:51 knakahara Exp $ */
/* $KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $ */
/*
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.90 2017/11/27 05:02:22 knakahara Exp $");
__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.91 2017/11/27 05:05:51 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -216,7 +216,7 @@ in_gif_input(struct mbuf *m, int off, int proto, void *eparg)
ip = mtod(m, const struct ip *);
gifp = &sc->gif_if;
if ((gifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
if ((gifp->if_flags & IFF_UP) == 0) {
m_freem(m);
ip_statinc(IP_STAT_NOGIF);
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6_gif.c,v 1.88 2017/11/27 05:02:22 knakahara Exp $ */
/* $NetBSD: in6_gif.c,v 1.89 2017/11/27 05:05:51 knakahara Exp $ */
/* $KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 itojun Exp $ */
/*
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.88 2017/11/27 05:02:22 knakahara Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.89 2017/11/27 05:05:51 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -233,7 +233,7 @@ in6_gif_input(struct mbuf **mp, int *offp, int proto, void *eparg)
ip6 = mtod(m, struct ip6_hdr *);
gifp = &sc->gif_if;
if ((gifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
if ((gifp->if_flags & IFF_UP) == 0) {
m_freem(m);
IP6_STATINC(IP6_STAT_NOGIF);
return IPPROTO_DONE;