svn commit: r213891 - stable/7/sys/net

Bjoern A. Zeeb bz at FreeBSD.org
Fri Oct 15 14:33:47 UTC 2010


Author: bz
Date: Fri Oct 15 14:33:46 2010
New Revision: 213891
URL: http://svn.freebsd.org/changeset/base/213891

Log:
  MFC r185963 (by csjp in 2008):
  
    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

Modified:
  stable/7/sys/net/if_tun.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/net/if_tun.c
==============================================================================
--- stable/7/sys/net/if_tun.c	Fri Oct 15 05:42:35 2010	(r213890)
+++ stable/7/sys/net/if_tun.c	Fri Oct 15 14:33:46 2010	(r213891)
@@ -413,6 +413,7 @@ tunopen(struct cdev *dev, int flag, int 
 
 	tp->tun_flags |= TUN_OPEN;
 	ifp = TUN2IFP(tp);
+	if_link_state_change(ifp, LINK_STATE_UP);
 	TUNDEBUG(ifp, "open\n");
 	mtx_unlock(&tp->tun_mtx);
 
@@ -465,6 +466,7 @@ tunclose(struct cdev *dev, int foo, int 
 		if_purgeaddrs(ifp);
 		mtx_lock(&tp->tun_mtx);
 	}
+	if_link_state_change(ifp, LINK_STATE_DOWN);
 
 	funsetown(&tp->tun_sigio);
 	selwakeuppri(&tp->tun_rsel, PZERO + 1);


More information about the svn-src-all mailing list