[Pkg-virtualbox-devel] Bug#604259: virtualbox-ose-source: bridged networking with taps not working with kernel > 3.6.36
Markus
akamoto at ml1.net
Sun Nov 21 16:11:43 UTC 2010
Package: virtualbox-ose-source
Version: 3.2.10-dfsg-1
Severity: important
Tags: patch
Hi VirtualBox Maintainers.
As explained via http://www.virtualbox.org/ticket/7649 the commit
bee31369ce16fc3898ec9a54161248c9eddb06bc
(http://amailbox.org/mailarchive/linux-netdev/2010/10/23/6288128/thread) changed
the behaviour of tun.c which results in tapdevices not beeing correctly set up
in VirtualBox'es initialization of a tap device.
The patch http://www.virtualbox.org/attachment/ticket/7649/netflt_tap.patch
applied to /usr/src/virtualbox-ose-3.2.10/vboxnetflt/linux/VBoxNetFlt-linux.c
corrected the problem.
The Patch is supposedly already included in VirtualBox's SVN, but I thought this
might be a good to know thing for you guys.
Thanks for maintaining the virtualbox package I constantly use!
Gruss,
Markus
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (400, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.36-0.slh.6-aptosid-amd64 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages virtualbox-ose-source depends on:
ii build-essential 11.5 Informational list of build-essent
ii bzip2 1.0.5-6 high-quality block-sorting file co
ii debhelper 8.0.0 helper programs for debian/rules
ii kbuild 1:0.1.98svn2318-8 framework for writing simple makef
Versions of packages virtualbox-ose-source recommends:
ii module-assistant 0.11.3 tool to make module package creati
virtualbox-ose-source suggests no packages.
-- no debconf information
Patch as on http://www.virtualbox.org/attachment/ticket/7649/netflt_tap.patch
-------------- next part --------------
--- src/vboxhost/vboxnetflt/linux/VBoxNetFlt-linux.c.r66523 2010-10-28 20:30:38.556181086 +0400
+++ src/vboxhost/vboxnetflt/linux/VBoxNetFlt-linux.c 2010-10-28 20:33:08.726181061 +0400
@@ -1337,6 +1337,54 @@
return fRc;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+/**
+ * Helper for detecting TAP devices.
+ */
+static bool vboxNetFltIsTapDevice(PVBOXNETFLTINS pThis, struct net_device *pDev)
+{
+ if (pDev->ethtool_ops && pDev->ethtool_ops->get_drvinfo)
+ {
+ struct ethtool_drvinfo Info;
+
+ memset(&Info, 0, sizeof(Info));
+ Info.cmd = ETHTOOL_GDRVINFO;
+ pDev->ethtool_ops->get_drvinfo(pDev, &Info);
+ Log3(("vboxNetFltIsTapDevice: driver=%s version=%s bus_info=%s\n",
+ Info.driver, Info.version, Info.bus_info));
+
+ return !strncmp(Info.driver, "tun", 4)
+ && !strncmp(Info.bus_info, "tap", 4);
+ }
+
+ return false;
+}
+
+/**
+ * Helper for updating the link state of TAP devices.
+ * Only TAP devices are affected.
+ */
+static void vboxNetFltSetTapLinkState(PVBOXNETFLTINS pThis, struct net_device *pDev, bool fLinkUp)
+{
+ if (vboxNetFltIsTapDevice(pThis, pDev))
+ {
+ Log3(("vboxNetFltSetTapLinkState: bringing %s tap device link state\n",
+ fLinkUp ? "up" : "down"));
+ netif_tx_lock_bh(pDev);
+ if (fLinkUp)
+ netif_carrier_on(pDev);
+ else
+ netif_carrier_off(pDev);
+ netif_tx_unlock_bh(pDev);
+ }
+}
+#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) */
+DECLINLINE(void) vboxNetFltSetTapLinkState(PVBOXNETFLTINS pThis, struct net_device *pDev, bool fLinkUp)
+{
+ /* Nothing to do for pre-2.6.36 kernels. */
+}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) */
+
/**
* Internal worker for vboxNetFltLinuxNotifierCallback.
*
@@ -1378,6 +1426,12 @@
#endif
/*
+ * If attaching to TAP interface we need to bring the link state up
+ * starting from 2.6.36 kernel.
+ */
+ vboxNetFltSetTapLinkState(pThis, pDev, true);
+
+ /*
* Set indicators that require the spinlock. Be abit paranoid about racing
* the device notification handle.
*/
@@ -1741,6 +1795,8 @@
if (fRegistered)
{
+ vboxNetFltSetTapLinkState(pThis, pDev, false);
+
#ifndef VBOXNETFLT_LINUX_NO_XMIT_QUEUE
skb_queue_purge(&pThis->u.s.XmitQueue);
#endif
More information about the Pkg-virtualbox-devel
mailing list