summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-08-09 10:20:02 +0000
committerrwatson <rwatson@FreeBSD.org>2005-08-09 10:20:02 +0000
commit5d770a09e85126b8b3e9fe302c36350a90210cbe (patch)
treebb70e59641e2310a3c26ec449af5ab0cb7420d9d /sys/net
parent74759aaa78777146f23aa05c856f574efdfb41d9 (diff)
downloadFreeBSD-src-5d770a09e85126b8b3e9fe302c36350a90210cbe.zip
FreeBSD-src-5d770a09e85126b8b3e9fe302c36350a90210cbe.tar.gz
Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bridge.c3
-rw-r--r--sys/net/bridgestp.c6
-rw-r--r--sys/net/if_arcsubr.c3
-rw-r--r--sys/net/if_atm.h4
-rw-r--r--sys/net/if_atmsubr.c3
-rw-r--r--sys/net/if_bridge.c52
-rw-r--r--sys/net/if_ef.c6
-rw-r--r--sys/net/if_ethersubr.c3
-rw-r--r--sys/net/if_faith.c3
-rw-r--r--sys/net/if_fddisubr.c6
-rw-r--r--sys/net/if_fwsubr.c3
-rw-r--r--sys/net/if_gif.c12
-rw-r--r--sys/net/if_gre.c7
-rw-r--r--sys/net/if_iso88025subr.c6
-rw-r--r--sys/net/if_loop.c3
-rw-r--r--sys/net/if_ppp.c7
-rw-r--r--sys/net/if_spppsubr.c34
-rw-r--r--sys/net/if_tap.c16
-rw-r--r--sys/net/if_tun.c7
-rw-r--r--sys/net/if_vlan.c14
-rw-r--r--sys/net/ppp_tty.c2
21 files changed, 109 insertions, 91 deletions
diff --git a/sys/net/bridge.c b/sys/net/bridge.c
index 211f0e5..b95fa57 100644
--- a/sys/net/bridge.c
+++ b/sys/net/bridge.c
@@ -908,7 +908,8 @@ bridge_ifok(struct ifnet *ifp, struct ifnet *src, struct ifnet *dst)
return (BDG_USED(ifp)
&& !BDG_MUTED(ifp)
&& !_IF_QFULL(&ifp->if_snd)
- && (ifp->if_flags & (IFF_UP|IFF_RUNNING)) == (IFF_UP|IFF_RUNNING)
+ && (ifp->if_flags & IFF_UP)
+ && (ifp->if_drv_flags & IFF_DRV_RUNNING)
&& ifp != src
&& BDG_SAMECLUSTER(ifp, dst));
}
diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c
index ccb7674..b4d0a82 100644
--- a/sys/net/bridgestp.c
+++ b/sys/net/bridgestp.c
@@ -228,7 +228,7 @@ bstp_send_config_bpdu(struct bridge_softc *sc, struct bridge_iflist *bif,
ifp = bif->bif_ifp;
- if ((ifp->if_flags & IFF_RUNNING) == 0)
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return;
MGETHDR(m, M_DONTWAIT, MT_DATA);
@@ -370,7 +370,7 @@ bstp_transmit_tcn(struct bridge_softc *sc)
BRIDGE_LOCK_ASSERT(sc);
- if ((ifp->if_flags & IFF_RUNNING) == 0)
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return;
MGETHDR(m, M_DONTWAIT, MT_DATA);
@@ -1137,7 +1137,7 @@ bstp_tick(void *arg)
bstp_hold_timer_expiry(sc, bif);
}
- if (sc->sc_ifp->if_flags & IFF_RUNNING)
+ if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
callout_reset(&sc->sc_bstpcallout, hz, bstp_tick, sc);
BRIDGE_UNLOCK(sc);
diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c
index 09a672f..94f6681 100644
--- a/sys/net/if_arcsubr.c
+++ b/sys/net/if_arcsubr.c
@@ -112,7 +112,8 @@ arc_output(ifp, m, dst, rt0)
int loop_copy = 0;
int isphds;
- if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
+ if (!((ifp->if_flags & IFF_UP) &&
+ (ifp->if_drv_flags & IFF_DRV_RUNNING)))
return(ENETDOWN); /* m, m1 aren't initialized yet */
error = 0;
diff --git a/sys/net/if_atm.h b/sys/net/if_atm.h
index 4b07f36..99cc277 100644
--- a/sys/net/if_atm.h
+++ b/sys/net/if_atm.h
@@ -320,8 +320,8 @@ void atm_event(struct ifnet *, u_int, void *);
#define ATMEV_SEND_IFSTATE_CHANGED(ATMIF, CARRIER) \
do { \
struct atmev_ifstate_changed _arg; \
- _arg.running = (((ATMIF)->ifp->if_flags & \
- IFF_RUNNING) != 0); \
+ _arg.running = (((ATMIF)->ifp->if_drv_flags & \
+ IFF_DRV_RUNNING) != 0); \
_arg.carrier = ((CARRIER) != 0); \
atm_event((ATMIF)->ifp, ATMEV_IFSTATE_CHANGED, &_arg); \
} while (0)
diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c
index fa8778d..6e662a0 100644
--- a/sys/net/if_atmsubr.c
+++ b/sys/net/if_atmsubr.c
@@ -138,7 +138,8 @@ atm_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
senderr(error);
#endif
- if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) != (IFF_UP | IFF_RUNNING))
+ if (!((ifp->if_flags & IFF_UP) &&
+ (ifp->if_drv_flags & IFF_DRV_RUNNING)))
senderr(ENETDOWN);
/*
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 841c7af..6518513 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -584,13 +584,15 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
case SIOCSIFFLAGS:
- if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_RUNNING) {
+ if (!(ifp->if_flags & IFF_UP) &&
+ (ifp->if_drv_flags & IFF_DRV_RUNNING)) {
/*
* If interface is marked down and it is running,
* then stop and disable it.
*/
bridge_stop(ifp, 1);
- } else if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_UP) {
+ } else if ((ifp->if_flags & IFF_UP) &&
+ !(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
/*
* If interface is marked up and it is stopped, then
* start it.
@@ -699,7 +701,7 @@ bridge_delete_member(struct bridge_softc *sc, struct bridge_iflist *bif)
free(bif, M_DEVBUF);
- if (sc->sc_ifp->if_flags & IFF_RUNNING)
+ if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
bstp_initialization(sc);
}
@@ -764,7 +766,7 @@ bridge_ioctl_add(struct bridge_softc *sc, void *arg)
*/
LIST_INSERT_HEAD(&sc->sc_iflist, bif, bif_next);
- if (sc->sc_ifp->if_flags & IFF_RUNNING)
+ if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
bstp_initialization(sc);
else
bstp_stop(sc);
@@ -841,7 +843,7 @@ bridge_ioctl_sifflags(struct bridge_softc *sc, void *arg)
bif->bif_flags = req->ifbr_ifsflags;
- if (sc->sc_ifp->if_flags & IFF_RUNNING)
+ if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
bstp_initialization(sc);
return (0);
@@ -1042,7 +1044,7 @@ bridge_ioctl_spri(struct bridge_softc *sc, void *arg)
sc->sc_bridge_priority = param->ifbrp_prio;
- if (sc->sc_ifp->if_flags & IFF_RUNNING)
+ if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
bstp_initialization(sc);
return (0);
@@ -1071,7 +1073,7 @@ bridge_ioctl_sht(struct bridge_softc *sc, void *arg)
return (EINVAL);
sc->sc_bridge_hello_time = param->ifbrp_hellotime << 8;
- if (sc->sc_ifp->if_flags & IFF_RUNNING)
+ if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
bstp_initialization(sc);
return (0);
@@ -1100,7 +1102,7 @@ bridge_ioctl_sfd(struct bridge_softc *sc, void *arg)
return (EINVAL);
sc->sc_bridge_forward_delay = param->ifbrp_fwddelay << 8;
- if (sc->sc_ifp->if_flags & IFF_RUNNING)
+ if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
bstp_initialization(sc);
return (0);
@@ -1129,7 +1131,7 @@ bridge_ioctl_sma(struct bridge_softc *sc, void *arg)
return (EINVAL);
sc->sc_bridge_max_age = param->ifbrp_maxage << 8;
- if (sc->sc_ifp->if_flags & IFF_RUNNING)
+ if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
bstp_initialization(sc);
return (0);
@@ -1149,7 +1151,7 @@ bridge_ioctl_sifprio(struct bridge_softc *sc, void *arg)
bif->bif_priority = req->ifbr_priority;
- if (sc->sc_ifp->if_flags & IFF_RUNNING)
+ if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
bstp_initialization(sc);
return (0);
@@ -1169,7 +1171,7 @@ bridge_ioctl_sifcost(struct bridge_softc *sc, void *arg)
bif->bif_path_cost = req->ifbr_path_cost;
- if (sc->sc_ifp->if_flags & IFF_RUNNING)
+ if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
bstp_initialization(sc);
return (0);
@@ -1206,13 +1208,13 @@ bridge_init(void *xsc)
struct bridge_softc *sc = (struct bridge_softc *)xsc;
struct ifnet *ifp = sc->sc_ifp;
- if (ifp->if_flags & IFF_RUNNING)
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING)
return;
callout_reset(&sc->sc_brcallout, bridge_rtable_prune_period * hz,
bridge_timer, sc);
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
bstp_initialization(sc);
return;
}
@@ -1227,7 +1229,7 @@ bridge_stop(struct ifnet *ifp, int disable)
{
struct bridge_softc *sc = ifp->if_softc;
- if ((ifp->if_flags & IFF_RUNNING) == 0)
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return;
callout_stop(&sc->sc_brcallout);
@@ -1235,7 +1237,7 @@ bridge_stop(struct ifnet *ifp, int disable)
bridge_rtflush(sc, IFBF_FLUSHDYN);
- ifp->if_flags &= ~IFF_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
}
/*
@@ -1279,7 +1281,7 @@ bridge_enqueue(struct bridge_softc *sc, struct ifnet *dst_ifp, struct mbuf *m)
}
}
- if ((dst_ifp->if_flags & IFF_OACTIVE) == 0)
+ if ((dst_ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0)
(*dst_ifp->if_start)(dst_ifp);
}
@@ -1356,7 +1358,7 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa,
* go ahead and send out that interface. Otherwise, the packet
* is dropped below.
*/
- if ((sc->sc_ifp->if_flags & IFF_RUNNING) == 0) {
+ if ((sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
dst_if = ifp;
goto sendunicast;
}
@@ -1381,7 +1383,7 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa,
}
LIST_FOREACH(bif, &sc->sc_iflist, bif_next) {
dst_if = bif->bif_ifp;
- if ((dst_if->if_flags & IFF_RUNNING) == 0)
+ if ((dst_if->if_drv_flags & IFF_DRV_RUNNING) == 0)
continue;
/*
@@ -1424,7 +1426,7 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa,
* XXX Spanning tree consideration here?
*/
- if ((dst_if->if_flags & IFF_RUNNING) == 0) {
+ if ((dst_if->if_drv_flags & IFF_DRV_RUNNING) == 0) {
m_freem(m);
BRIDGE_UNLOCK(sc);
return (0);
@@ -1451,7 +1453,7 @@ bridge_start(struct ifnet *ifp)
sc = ifp->if_softc;
- ifp->if_flags |= IFF_OACTIVE;
+ ifp->if_drv_flags |= IFF_DRV_OACTIVE;
for (;;) {
IFQ_DEQUEUE(&ifp->if_snd, m);
if (m == 0)
@@ -1485,7 +1487,7 @@ bridge_start(struct ifnet *ifp)
bridge_enqueue(sc, dst_if, m);
}
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
return;
}
@@ -1607,7 +1609,7 @@ bridge_forward(struct bridge_softc *sc, struct mbuf *m)
* At this point, we're dealing with a unicast frame
* going to a different interface.
*/
- if ((dst_if->if_flags & IFF_RUNNING) == 0) {
+ if ((dst_if->if_drv_flags & IFF_DRV_RUNNING) == 0) {
BRIDGE_UNLOCK(sc);
m_freem(m);
return;
@@ -1663,7 +1665,7 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
struct ether_header *eh;
struct mbuf *mc;
- if ((sc->sc_ifp->if_flags & IFF_RUNNING) == 0)
+ if ((sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return (m);
BRIDGE_LOCK(sc);
@@ -1829,7 +1831,7 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *src_if,
(m->m_flags & (M_BCAST|M_MCAST)) == 0)
continue;
- if ((dst_if->if_flags & IFF_RUNNING) == 0)
+ if ((dst_if->if_drv_flags & IFF_DRV_RUNNING) == 0)
continue;
if (LIST_NEXT(bif, bif_next) == NULL) {
@@ -1985,7 +1987,7 @@ bridge_timer(void *arg)
bridge_rtage(sc);
BRIDGE_UNLOCK(sc);
- if (sc->sc_ifp->if_flags & IFF_RUNNING)
+ if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
callout_reset(&sc->sc_brcallout,
bridge_rtable_prune_period * hz, bridge_timer, sc);
}
diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c
index f615485..448240e 100644
--- a/sys/net/if_ef.c
+++ b/sys/net/if_ef.c
@@ -143,7 +143,7 @@ ef_attach(struct efnet *sc)
ifp->if_resolvemulti = 0;
ifp->if_type = IFT_XETHER;
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
EFDEBUG("%s: attached\n", ifp->if_xname);
return 1;
@@ -214,7 +214,7 @@ ef_start(struct ifnet *ifp)
struct mbuf *m;
int error;
- ifp->if_flags |= IFF_OACTIVE;
+ ifp->if_drv_flags |= IFF_DRV_OACTIVE;
p = sc->ef_pifp;
EFDEBUG("\n");
@@ -230,7 +230,7 @@ ef_start(struct ifnet *ifp)
}
ifp->if_opackets++;
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
return;
}
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index d2423a4..eada2f9 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -163,7 +163,8 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
if (ifp->if_flags & IFF_MONITOR)
senderr(ENETDOWN);
- if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
+ if (!((ifp->if_flags & IFF_UP) &&
+ (ifp->if_drv_flags & IFF_DRV_RUNNING)))
senderr(ENETDOWN);
hlen = ETHER_HDR_LEN;
diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c
index 36bc0cd..d71a3fa 100644
--- a/sys/net/if_faith.c
+++ b/sys/net/if_faith.c
@@ -300,7 +300,8 @@ faithioctl(ifp, cmd, data)
switch (cmd) {
case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP | IFF_RUNNING;
+ ifp->if_flags |= IFF_UP;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
ifa = (struct ifaddr *)data;
ifa->ifa_rtrequest = faithrtrequest;
/*
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index 4c626f2..ed33313 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -127,7 +127,8 @@ fddi_output(ifp, m, dst, rt0)
if (ifp->if_flags & IFF_MONITOR)
senderr(ENETDOWN);
- if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
+ if (!((ifp->if_flags & IFF_UP) &&
+ (ifp->if_drv_flags & IFF_DRV_RUNNING)))
senderr(ENETDOWN);
getmicrotime(&ifp->if_lastchange);
@@ -387,7 +388,8 @@ fddi_input(ifp, m)
/*
* Discard packet if interface is not up.
*/
- if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
+ if (!((ifp->if_flags & IFF_UP) &&
+ (ifp->if_drv_flags & IFF_DRV_RUNNING)))
goto dropanyway;
/*
diff --git a/sys/net/if_fwsubr.c b/sys/net/if_fwsubr.c
index baff6ec..0aaa949 100644
--- a/sys/net/if_fwsubr.c
+++ b/sys/net/if_fwsubr.c
@@ -97,7 +97,8 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
goto bad;
#endif
- if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
+ if (!((ifp->if_flags & IFF_UP) &&
+ (ifp->if_drv_flags & IFF_DRV_RUNNING))) {
error = ENETDOWN;
goto bad;
}
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index d5c7cd7..7b01bbb 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -876,18 +876,18 @@ gif_set_tunnel(ifp, src, dst)
free((caddr_t)odst, M_IFADDR);
if (sc->gif_psrc && sc->gif_pdst)
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
else
- ifp->if_flags &= ~IFF_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
splx(s);
return 0;
bad:
if (sc->gif_psrc && sc->gif_pdst)
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
else
- ifp->if_flags &= ~IFF_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
splx(s);
return error;
@@ -919,8 +919,8 @@ gif_delete_tunnel(ifp)
#endif
if (sc->gif_psrc && sc->gif_pdst)
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
else
- ifp->if_flags &= ~IFF_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
splx(s);
}
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index dc7355d..aa57526 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -257,7 +257,8 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
goto end;
}
- if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == 0 ||
+ if (!((ifp->if_flags & IFF_UP) &&
+ (ifp->if_drv_flags & IFF_DRV_RUNNING)) ||
sc->g_src.s_addr == INADDR_ANY || sc->g_dst.s_addr == INADDR_ANY) {
m_freem(m);
error = ENETDOWN;
@@ -559,9 +560,9 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if (sc->route.ro_rt != 0) /* free old route */
RTFREE(sc->route.ro_rt);
if (gre_compute_route(sc) == 0)
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
else
- ifp->if_flags &= ~IFF_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
}
break;
case GREGADDRS:
diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c
index 6c30564..2170e0e 100644
--- a/sys/net/if_iso88025subr.c
+++ b/sys/net/if_iso88025subr.c
@@ -253,7 +253,8 @@ iso88025_output(ifp, m, dst, rt0)
if (ifp->if_flags & IFF_MONITOR)
senderr(ENETDOWN);
- if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
+ if (!((ifp->if_flags & IFF_UP) &&
+ (ifp->if_drv_flags & IFF_DRV_RUNNING)))
senderr(ENETDOWN);
getmicrotime(&ifp->if_lastchange);
@@ -484,7 +485,8 @@ iso88025_input(ifp, m)
/*
* Discard packet if interface is not up.
*/
- if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
+ if (!((ifp->if_flags & IFF_UP) &&
+ (ifp->if_drv_flags & IFF_DRV_RUNNING)))
goto dropanyway;
/*
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index 12231b2..94f1c3e 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -349,7 +349,8 @@ loioctl(ifp, cmd, data)
switch (cmd) {
case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP | IFF_RUNNING;
+ ifp->if_flags |= IFF_UP;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
ifa = (struct ifaddr *)data;
ifa->ifa_rtrequest = lortrequest;
/*
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index c21b663..8050d81 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -404,7 +404,8 @@ pppdealloc(sc)
struct mbuf *m;
if_down(PPP2IFP(sc));
- PPP2IFP(sc)->if_flags &= ~(IFF_UP|IFF_RUNNING);
+ PPP2IFP(sc)->if_flags &= ~IFF_UP;
+ PPP2IFP(sc)->if_drv_flags &= ~IFF_DRV_RUNNING;
getmicrotime(&PPP2IFP(sc)->if_lastchange);
sc->sc_devp = NULL;
sc->sc_xfer = 0;
@@ -688,7 +689,7 @@ pppsioctl(ifp, cmd, data)
switch (cmd) {
case SIOCSIFFLAGS:
- if ((ifp->if_flags & IFF_RUNNING) == 0)
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
ifp->if_flags &= ~IFF_UP;
break;
@@ -822,7 +823,7 @@ pppoutput(ifp, m0, dst, rtp)
goto bad;
#endif
- if (sc->sc_devp == NULL || (ifp->if_flags & IFF_RUNNING) == 0
+ if (sc->sc_devp == NULL || (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0
|| ((ifp->if_flags & IFF_UP) == 0 && dst->sa_family != AF_UNSPEC)) {
error = ENETDOWN; /* sort of */
goto bad;
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index b3d1df5..875cb1c 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -839,8 +839,9 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
s = splimp();
SPPP_LOCK(sp);
- if ((ifp->if_flags & IFF_UP) == 0 ||
- (ifp->if_flags & (IFF_RUNNING | IFF_AUTO)) == 0) {
+ if (!(ifp->if_flags & IFF_UP) ||
+ (!(ifp->if_flags & IFF_AUTO) &&
+ !(ifp->if_drv_flags & IFF_DRV_RUNNING))) {
#ifdef INET6
drop:
#endif
@@ -850,7 +851,8 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
return (ENETDOWN);
}
- if ((ifp->if_flags & (IFF_RUNNING | IFF_AUTO)) == IFF_AUTO) {
+ if ((ifp->if_flags & IFF_AUTO) &&
+ !(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
#ifdef INET6
/*
* XXX
@@ -868,7 +870,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
* Interface is not yet running, but auto-dial. Need
* to start LCP for it.
*/
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
splx(s);
lcp.Open(sp);
s = splimp();
@@ -1268,9 +1270,9 @@ sppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, void *data)
case SIOCSIFFLAGS:
going_up = ifp->if_flags & IFF_UP &&
- (ifp->if_flags & IFF_RUNNING) == 0;
+ (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0;
going_down = (ifp->if_flags & IFF_UP) == 0 &&
- ifp->if_flags & IFF_RUNNING;
+ ifp->if_drv_flags & IFF_DRV_RUNNING;
newmode = ifp->if_flags & IFF_PASSIVE;
if (!newmode)
@@ -1286,7 +1288,7 @@ sppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, void *data)
if (newmode != sp->pp_mode) {
going_down = 1;
if (!going_up)
- going_up = ifp->if_flags & IFF_RUNNING;
+ going_up = ifp->if_drv_flags & IFF_DRV_RUNNING;
}
if (going_down) {
@@ -1296,7 +1298,7 @@ sppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, void *data)
else if (sp->pp_tlf)
(sp->pp_tlf)(sp);
sppp_flush_unlocked(ifp);
- ifp->if_flags &= ~IFF_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
sp->pp_mode = newmode;
}
@@ -1306,14 +1308,14 @@ sppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, void *data)
lcp.Close(sp);
sp->pp_mode = newmode;
if (sp->pp_mode == 0) {
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
lcp.Open(sp);
}
if ((sp->pp_mode == IFF_CISCO) ||
(sp->pp_mode == PP_FR)) {
if (sp->pp_tls)
(sp->pp_tls)(sp);
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
}
}
@@ -1428,7 +1430,7 @@ sppp_cisco_input(struct sppp *sp, struct mbuf *m)
}
sp->pp_loopcnt = 0;
if (! (ifp->if_flags & IFF_UP) &&
- (ifp->if_flags & IFF_RUNNING)) {
+ (ifp->if_drv_flags & IFF_DRV_RUNNING)) {
if_up(ifp);
printf (SPP_FMT "up\n", SPP_ARGS(ifp));
}
@@ -2268,7 +2270,7 @@ sppp_lcp_up(struct sppp *sp)
if (debug)
log(LOG_DEBUG,
SPP_FMT "Up event", SPP_ARGS(ifp));
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
if (sp->state[IDX_LCP] == STATE_INITIAL) {
if (debug)
log(-1, "(incoming call)\n");
@@ -2278,7 +2280,7 @@ sppp_lcp_up(struct sppp *sp)
log(-1, "\n");
} else if ((ifp->if_flags & (IFF_AUTO | IFF_PASSIVE)) == 0 &&
(sp->state[IDX_LCP] == STATE_INITIAL)) {
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
lcp.Open(sp);
}
@@ -2312,7 +2314,7 @@ sppp_lcp_down(struct sppp *sp)
sp->pp_flags &= ~PP_CALLIN;
if (sp->state[IDX_LCP] != STATE_INITIAL)
lcp.Close(sp);
- ifp->if_flags &= ~IFF_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
}
}
@@ -2718,7 +2720,7 @@ sppp_lcp_tlu(struct sppp *sp)
/* XXX ? */
if (! (ifp->if_flags & IFF_UP) &&
- (ifp->if_flags & IFF_RUNNING)) {
+ (ifp->if_drv_flags & IFF_DRV_RUNNING)) {
/* Coming out of loopback mode. */
if_up(ifp);
printf (SPP_FMT "up\n", SPP_ARGS(ifp));
@@ -4819,7 +4821,7 @@ sppp_keepalive(void *dummy)
SPPP_LOCK(sp);
/* Keepalive mode disabled or channel down? */
if (! (sp->pp_flags & PP_KEEPALIVE) ||
- ! (ifp->if_flags & IFF_RUNNING))
+ ! (ifp->if_drv_flags & IFF_DRV_RUNNING))
goto out;
if (sp->pp_mode == PP_FR) {
diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c
index f631c09..4e1b727 100644
--- a/sys/net/if_tap.c
+++ b/sys/net/if_tap.c
@@ -393,8 +393,8 @@ tapopen(dev, flag, mode, td)
mtx_unlock(&tp->tap_mtx);
s = splimp();
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
splx(s);
TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, minor(dev));
@@ -433,12 +433,12 @@ tapclose(dev, foo, bar, td)
mtx_unlock(&tp->tap_mtx);
s = splimp();
if_down(ifp);
- if (ifp->if_flags & IFF_RUNNING) {
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
rtinit(ifa, (int)RTM_DELETE, 0);
}
if_purgeaddrs(ifp);
- ifp->if_flags &= ~IFF_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
}
splx(s);
} else
@@ -473,8 +473,8 @@ tapifinit(xtp)
TAPDEBUG("initializing %s\n", ifp->if_xname);
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
/* attempt to start output */
tapifstart(ifp);
@@ -570,7 +570,7 @@ tapifstart(ifp)
mtx_unlock(&tp->tap_mtx);
s = splimp();
- ifp->if_flags |= IFF_OACTIVE;
+ ifp->if_drv_flags |= IFF_DRV_OACTIVE;
if (ifp->if_snd.ifq_len != 0) {
mtx_lock(&tp->tap_mtx);
@@ -589,7 +589,7 @@ tapifstart(ifp)
ifp->if_opackets ++; /* obytes are counted in ether_output */
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
splx(s);
} /* tapifstart */
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index d9c31e2..eafcdb5 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -360,7 +360,7 @@ tunclose(struct cdev *dev, int foo, int bar, struct thread *td)
splx(s);
}
- if (ifp->if_flags & IFF_RUNNING) {
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
struct ifaddr *ifa;
s = splimp();
@@ -370,7 +370,7 @@ tunclose(struct cdev *dev, int foo, int bar, struct thread *td)
/* Unlocked read. */
rtinit(ifa, (int)RTM_DELETE,
tp->tun_flags & TUN_DSTADDR ? RTF_HOST : 0);
- ifp->if_flags &= ~IFF_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
splx(s);
}
@@ -389,7 +389,8 @@ tuninit(struct ifnet *ifp)
TUNDEBUG(ifp, "tuninit\n");
- ifp->if_flags |= IFF_UP | IFF_RUNNING;
+ ifp->if_flags |= IFF_UP;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
getmicrotime(&ifp->if_lastchange);
for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index f909dbe..7be7a78 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -413,7 +413,7 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len)
return (error);
}
ifv->ifv_tag = tag;
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
VLAN_UNLOCK();
/* Update promiscuous mode, if necessary. */
@@ -467,7 +467,7 @@ vlan_start(struct ifnet *ifp)
ifv = ifp->if_softc;
p = ifv->ifv_p;
- ifp->if_flags |= IFF_OACTIVE;
+ ifp->if_drv_flags |= IFF_DRV_OACTIVE;
for (;;) {
IF_DEQUEUE(&ifp->if_snd, m);
if (m == 0)
@@ -478,8 +478,8 @@ vlan_start(struct ifnet *ifp)
* Do not run parent's if_start() if the parent is not up,
* or parent's driver will cause a system crash.
*/
- if ((p->if_flags & (IFF_UP | IFF_RUNNING)) !=
- (IFF_UP | IFF_RUNNING)) {
+ if (!((p->if_flags & IFF_UP) &&
+ (p->if_drv_flags & IFF_DRV_RUNNING))) {
m_freem(m);
ifp->if_collisions++;
continue;
@@ -550,7 +550,7 @@ vlan_start(struct ifnet *ifp)
else
ifp->if_oerrors++;
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
}
static void
@@ -926,7 +926,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
vlan_unconfig(ifp);
if (ifp->if_flags & IFF_UP)
if_down(ifp);
- ifp->if_flags &= ~IFF_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
VLAN_UNLOCK();
break;
}
@@ -950,7 +950,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
}
ifv->ifv_tag = vlr.vlr_tag;
- ifp->if_flags |= IFF_RUNNING;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
VLAN_UNLOCK();
/* Update promiscuous mode, if necessary. */
diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c
index 51c11cf..cd45438 100644
--- a/sys/net/ppp_tty.c
+++ b/sys/net/ppp_tty.c
@@ -207,7 +207,7 @@ pppopen(dev, tp)
sc->sc_setmtu = pppasyncsetmtu;
sc->sc_outm = NULL;
pppgetm(sc);
- PPP2IFP(sc)->if_flags |= IFF_RUNNING;
+ PPP2IFP(sc)->if_drv_flags |= IFF_DRV_RUNNING;
getmicrotime(&PPP2IFP(sc)->if_lastchange);
PPP2IFP(sc)->if_baudrate = tp->t_ospeed;
OpenPOWER on IntegriCloud