VirtualBox

Ticket #4264 (closed defect: fixed)

Opened 5 years ago

Last modified 4 years ago

linux kernel 2.6.31 removes support for old net_device api => Fixed in SVN

Reported by: typerlc Owned by:
Priority: major Component: network
Version: VirtualBox 2.2.4 Keywords:
Cc: Guest type: other
Host type: Linux

Description

Fedora rawhide (fc12) has moved to linux kernel 2.6.31. This kernel removes backwards compatibility for the old network driver api. Only the new net_driver_ops structure api is supported.

This means that all current versions of vbox (including 2.2.4, and 3.0 beta) will not work on this or later kernels for any distribution.

See here for discussion of this change in 2.6.31:  http://patchwork.ozlabs.org/patch/27566/

This causes compilation failures in VBoxNetFlt-linux.c. Here's output from a sample build failure:

make KBUILD_VERBOSE= -C /lib/modules/2.6.31-0.11.rc0.git13.fc12.i686.PAE/build SUBDIRS=/tmp/vbox.4 SRCROOT=/tmp/vbox.4 modules
  CC [M]  /tmp/vbox.4/linux/VBoxNetFlt-linux.o
In file included from /tmp/vbox.4/include/VBox/intnet.h:34,
                 from /tmp/vbox.4/linux/../VBoxNetFltInternal.h:26,
                 from /tmp/vbox.4/linux/VBoxNetFlt-linux.c:47:
/tmp/vbox.4/include/VBox/stam.h:69:7: warning: "_MSC_VER" is not defined
/tmp/vbox.4/linux/VBoxNetFlt-linux.c: In function ‘vboxNetAdpNetDevInit’:
/tmp/vbox.4/linux/VBoxNetFlt-linux.c:225: error: ‘struct net_device’ has no member named ‘open’
/tmp/vbox.4/linux/VBoxNetFlt-linux.c:226: error: ‘struct net_device’ has no member named ‘stop’
/tmp/vbox.4/linux/VBoxNetFlt-linux.c:227: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
/tmp/vbox.4/linux/VBoxNetFlt-linux.c:228: error: ‘struct net_device’ has no member named ‘get_stats’
make[2]: *** [/tmp/vbox.4/linux/VBoxNetFlt-linux.o] Error 1
make[1]: *** [_module_/tmp/vbox.4] Error 2
make: *** [vboxnetflt] Error 2

Change History

comment:1 Changed 5 years ago by typerlc

A patch to fix this follows (apply to /usr/src/vboxnetflt-2.2.4/linux/VBoxNetFlt-linux.c):

--- VBoxNetFlt-linux.c-224orig  2009-06-21 13:24:02.278902777 +1000
+++ VBoxNetFlt-linux.c  2009-06-21 13:35:07.869147877 +1000
@@ -214,6 +214,15 @@
     return -EADDRNOTAVAIL;
 } */

+static const struct net_device_ops vboxNetAdpNetDevOps =
+{
+    .ndo_open = vboxNetAdpOpen,
+    .ndo_stop = vboxNetAdpStop,
+    .ndo_start_xmit = vboxNetAdpXmit,
+    .ndo_get_stats = vboxNetAdpGetStats,
+    //.validate_addr = vboxNetAdpValidateAddr,
+};
+
 static void vboxNetAdpNetDevInit(struct net_device *pNetDev)
 {
     PVBOXNETADPPRIV pPriv;
@@ -222,11 +231,8 @@
     /// @todo Use Sun vendor id
     memcpy(pNetDev->dev_addr, "\0vbnet", ETH_ALEN);
     Log(("vboxNetAdpNetDevInit: pNetDev->dev_addr = %.6Rhxd\n", pNetDev->dev_addr));
-    pNetDev->open = vboxNetAdpOpen;
-    pNetDev->stop = vboxNetAdpStop;
-    pNetDev->hard_start_xmit = vboxNetAdpXmit;
-    pNetDev->get_stats = vboxNetAdpGetStats;
-    //pNetDev->validate_addr = vboxNetAdpValidateAddr;
+    pNetDev->netdev_ops = &vboxNetAdpNetDevOps;
+
 /*    pNetDev-> = vboxNetAdp;
     pNetDev-> = vboxNetAdp;
     pNetDev-> = vboxNetAdp;

comment:2 Changed 5 years ago by frank

  • Summary changed from linux kernel 2.6.31 removes support for old net_device api to linux kernel 2.6.31 removes support for old net_device api => Fixed in SVN

comment:3 Changed 5 years ago by sandervl73

  • Status changed from new to closed
  • Resolution set to fixed

comment:4 Changed 5 years ago by robinbowes

Just a note to say that I applied this patch manually on Ubuntu Karmic and re-built using "/etc/init.d/vboxdrv setup" and it works just fine.

$ uname -a Linux stoat 2.6.31-2-generic #17-Ubuntu SMP Fri Jul 10 21:48:17 UTC 2009 x86_64 GNU/Linux

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use