diff options
author | csjp <csjp@FreeBSD.org> | 2008-12-12 01:36:50 +0000 |
---|---|---|
committer | csjp <csjp@FreeBSD.org> | 2008-12-12 01:36:50 +0000 |
commit | 7073cd1683bb1a98c3dfaf3cf2092fdc59efcb16 (patch) | |
tree | e474b564442d61e3ce37be2b18b6f7862881f0d5 /sys/net/if_tun.c | |
parent | 9d93d25c0eaa787d926ecbbef45f6a216d99f7fe (diff) | |
download | FreeBSD-src-7073cd1683bb1a98c3dfaf3cf2092fdc59efcb16.zip FreeBSD-src-7073cd1683bb1a98c3dfaf3cf2092fdc59efcb16.tar.gz |
Consider processes attaching/detaching from tun(4) devices as being link
state changes. This change modifies tunopen and tunclose to call the
if_link_state_change() function. Among other things, this will result in
devd(8) receiving events from devctl(4) for linkup/link down. This allows
us to do several useful things, including initializing tunnel parameters
and adding routes.
Discussed on: freebsd-net@
MFC after: 2 weeks
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r-- | sys/net/if_tun.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 216d325..67fb74e 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -426,6 +426,7 @@ tunopen(struct cdev *dev, int flag, int mode, struct thread *td) tp->tun_flags |= TUN_OPEN; mtx_unlock(&tp->tun_mtx); ifp = TUN2IFP(tp); + if_link_state_change(ifp, LINK_STATE_UP); TUNDEBUG(ifp, "open\n"); return (0); @@ -482,6 +483,7 @@ tunclose(struct cdev *dev, int foo, int bar, struct thread *td) ifp->if_drv_flags &= ~IFF_DRV_RUNNING; splx(s); } + if_link_state_change(ifp, LINK_STATE_DOWN); CURVNET_RESTORE(); funsetown(&tp->tun_sigio); |