Date: Fri, 12 Dec 2008 01:36:50 +0000 (UTC) From: "Christian S.J. Peron" <csjp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r185963 - head/sys/net Message-ID: <200812120136.mBC1aope082691@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: csjp Date: Fri Dec 12 01:36:50 2008 New Revision: 185963 URL: http://svn.freebsd.org/changeset/base/185963 Log: 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 Modified: head/sys/net/if_tun.c Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Fri Dec 12 01:26:11 2008 (r185962) +++ head/sys/net/if_tun.c Fri Dec 12 01:36:50 2008 (r185963) @@ -426,6 +426,7 @@ tunopen(struct cdev *dev, int flag, int 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 ifp->if_drv_flags &= ~IFF_DRV_RUNNING; splx(s); } + if_link_state_change(ifp, LINK_STATE_DOWN); CURVNET_RESTORE(); funsetown(&tp->tun_sigio);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812120136.mBC1aope082691>