diff --git a/sys/net/if_gre.h b/sys/net/if_gre.h --- a/sys/net/if_gre.h +++ b/sys/net/if_gre.h @@ -85,6 +85,9 @@ struct gre_softc { struct ifnet *gre_ifp; int gre_family; /* AF of delivery header */ + uint32_t gre_flags; +#define GRE_FLAG_RUNNING 0x0001 + uint32_t gre_iseq; uint32_t gre_oseq; uint32_t gre_key; diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -190,6 +190,7 @@ #endif GRE2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE; GRE2IFP(sc)->if_capenable |= IFCAP_LINKSTATE; + GRE2IFP(sc)->if_drv_flags |= IFF_DRV_RUNNING; if_attach(GRE2IFP(sc)); bpfattach(GRE2IFP(sc), DLT_NULL, sizeof(u_int32_t)); return (0); @@ -415,7 +416,7 @@ NET_EPOCH_CALL(gre_sofree, &gs->epoch_ctx); sc->gre_so = NULL; } - GRE2IFP(sc)->if_drv_flags &= ~IFF_DRV_RUNNING; + sc->gre_flags &= ~GRE_FLAG_RUNNING; if_link_state_change(GRE2IFP(sc), LINK_STATE_DOWN); } @@ -539,7 +540,7 @@ } if (flags & GRE_FLAGS_KP) { #ifdef notyet - /* + /* * XXX: The current implementation uses the key only for outgoing * packets. But we can check the key value here, or even in the * encapcheck function. @@ -702,7 +703,7 @@ sc = ifp->if_softc; if ((ifp->if_flags & IFF_MONITOR) != 0 || (ifp->if_flags & IFF_UP) == 0 || - (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + (sc->gre_flags & GRE_FLAG_RUNNING) == 0 || sc->gre_family == 0 || (error = if_tunnel_check_nesting(ifp, m, MTAG_GRE, V_max_gre_nesting)) != 0) { diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c --- a/sys/netinet/ip_gre.c +++ b/sys/netinet/ip_gre.c @@ -187,14 +187,14 @@ { if (in_localip(sc->gre_oip.ip_src)) - GRE2IFP(sc)->if_drv_flags |= IFF_DRV_RUNNING; + sc->gre_flags |= GRE_FLAG_RUNNING; else - GRE2IFP(sc)->if_drv_flags &= ~IFF_DRV_RUNNING; + sc->gre_flags &= ~GRE_FLAG_RUNNING; } /* * ifaddr_event handler. - * Clear IFF_DRV_RUNNING flag when ingress address disappears to prevent + * Clear GRE_FLAG_RUNNING flag when ingress address disappears to prevent * source address spoofing. */ static void @@ -381,7 +381,7 @@ CK_LIST_INSERT_HEAD(&GRE_SRCHASH(sc->gre_oip.ip_src.s_addr), sc, srchash); - /* Set IFF_DRV_RUNNING if interface is ready */ + /* Set GRE_FLAG_RUNNING if interface is ready */ NET_EPOCH_ENTER(et); in_gre_set_running(sc); NET_EPOCH_EXIT(et); diff --git a/sys/netinet6/ip6_gre.c b/sys/netinet6/ip6_gre.c --- a/sys/netinet6/ip6_gre.c +++ b/sys/netinet6/ip6_gre.c @@ -179,14 +179,14 @@ { if (in6_localip(&sc->gre_oip6.ip6_src)) - GRE2IFP(sc)->if_drv_flags |= IFF_DRV_RUNNING; + sc->gre_flags |= GRE_FLAG_RUNNING; else - GRE2IFP(sc)->if_drv_flags &= ~IFF_DRV_RUNNING; + sc->gre_flags &= ~GRE_FLAG_RUNNING; } /* * ifaddr_event handler. - * Clear IFF_DRV_RUNNING flag when ingress address disappears to prevent + * Clear GRE_FLAG_RUNNING flag when ingress address disappears to prevent * source address spoofing. */ static void @@ -381,7 +381,7 @@ CK_LIST_INSERT_HEAD(&GRE_HASH_SC(sc), sc, chain); CK_LIST_INSERT_HEAD(&GRE_SRCHASH(&sc->gre_oip6.ip6_src), sc, srchash); - /* Set IFF_DRV_RUNNING if interface is ready */ + /* Set GRE_FLAG_RUNNING if interface is ready */ in6_gre_set_running(sc); return (0); }