From 5d770a09e85126b8b3e9fe302c36350a90210cbe Mon Sep 17 00:00:00 2001 From: rwatson Date: Tue, 9 Aug 2005 10:20:02 +0000 Subject: 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 --- sys/net/if_tun.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/net/if_tun.c') 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; -- cgit v1.1