svn commit: r206068 - stable/8/sys/net
Qing Li
qingli at FreeBSD.org
Fri Apr 2 05:05:51 UTC 2010
Author: qingli
Date: Fri Apr 2 05:05:51 2010
New Revision: 206068
URL: http://svn.freebsd.org/changeset/base/206068
Log:
MFC 205024
The if_tap interface is of IFT_ETHERNET type, but it
does not set or update the if_link_state variable.
As such RT_LINK_IS_UP() fails for the if_tap interface.
Also, the RT_LINK_IS_UP() needs to bypass all loopback
interfaces because loopback interfaces are considered
up logically as long as the system is running.
This patch fixes the above issues by setting and updating
the if_link_state variable when the tap interface is
opened or closed respectively. Similary approach is
already done in the if_tun device.
Modified:
stable/8/sys/net/if_tap.c
stable/8/sys/net/route.h
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
stable/8/sys/net/ (props changed)
Modified: stable/8/sys/net/if_tap.c
==============================================================================
--- stable/8/sys/net/if_tap.c Fri Apr 2 05:02:50 2010 (r206067)
+++ stable/8/sys/net/if_tap.c Fri Apr 2 05:05:51 2010 (r206068)
@@ -502,6 +502,7 @@ tapopen(struct cdev *dev, int flag, int
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
if (tapuponopen)
ifp->if_flags |= IFF_UP;
+ if_link_state_change(ifp, LINK_STATE_UP);
splx(s);
TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, dev2unit(dev));
@@ -547,6 +548,7 @@ tapclose(struct cdev *dev, int foo, int
} else
mtx_unlock(&tp->tap_mtx);
+ if_link_state_change(ifp, LINK_STATE_DOWN);
funsetown(&tp->tap_sigio);
selwakeuppri(&tp->tap_rsel, PZERO+1);
KNOTE_UNLOCKED(&tp->tap_rsel.si_note, 0);
Modified: stable/8/sys/net/route.h
==============================================================================
--- stable/8/sys/net/route.h Fri Apr 2 05:02:50 2010 (r206067)
+++ stable/8/sys/net/route.h Fri Apr 2 05:05:51 2010 (r206068)
@@ -319,7 +319,9 @@ struct rt_addrinfo {
#ifdef _KERNEL
-#define RT_LINK_IS_UP(ifp) ((ifp)->if_link_state == LINK_STATE_UP)
+#define RT_LINK_IS_UP(ifp) (((ifp)->if_flags & \
+ (IFF_LOOPBACK | IFF_POINTOPOINT)) \
+ || (ifp)->if_link_state == LINK_STATE_UP)
#define RT_LOCK_INIT(_rt) \
mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK)
More information about the svn-src-stable-8
mailing list