VirtualBox bridged adapter (vboxnetflt)

Juergen Lock nox at jelal.kn-bremen.de
Sat Aug 22 15:31:04 UTC 2009


In article <4A8EB3D2.7010109 at shapeshifter.se> you write:
>Hi
>
>I've started working on the missing bits of the FreeBSD network
>implementation in VirtualBox.
>
>I now have a working vboxnetflt.ko driver that allows automatic
>bridged networking in VirtualBox (probably what most people want).
>This allows guests to automatically bridge with your existing
>network adapter providing seamless network access.
>
>Work on host-only adapter mode is in progress (this should not
>be confused with host-interface in previous vbox 2.x releases).
>
>The patch can be found at
>http://www.shapeshifter.se/pub/patches/vbox-freebsd-network.patch
>
>Additional patch for emulators/virtualbox/Makefile
>http://www.shapeshifter.se/pub/patches/virtualbox-Makefile.patch
>
>
>You'll have to rebuild VirtualBox to make it work, the following lines
>should do the trick.
>
>cd /usr/ports/emulators/virtualbox
>make clean patch
>mkdir work/virtualbox-3.0.51r22226/src/VBox/HostDrivers/VBoxNetFlt/freebsd
>
>patch -d work/virtualbox-3.0.51r22226 < vbox-freebsd-network.patch
>patch < virtualbox-Makefile.patch
>make install
>
>In addition to vboxdrv.ko you'll need to load vboxnetflt.ko too.
>
>kldload /boot/modules/vboxnetflt.ko
>
>In VirtualBox network settings, under "Bridged Adapter" you should now
>see your available network interfaces. Select the one connected to your
>network and boot your virtual machine.  It should now be connected to
>your local network as any other machine.
>
>
>Please note that this is just the first iteration of the patch and it
>should by no means be considered complete. It has only been tested
>on FreeBSD 8/i386.  Slippery when wet :)
>
>
>The kld is also a bit hackish at the moment regarding to how it
>interfaces with the network stack to avoid kernel code modifications.

This is cool! :)

 I just did a quick test on stable/8/amd64: (its a little older checkout)
The good news is it builds and the guest can ping the host, also pinging
another box on the lan that I wasn't sure was up (it was down) from the
guest failed as expected, but pinging the same box from the host to
verify while the guest was still running then panic'd the host:

triton8.kn-bremen.de dumped core - see /var/crash/vmcore.3

Sat Aug 22 16:59:18 CEST 2009

FreeBSD triton8.kn-bremen.de 8.0-BETA2 FreeBSD 8.0-BETA2 #3: Wed Aug 12 21:38:39 CEST 2009     nox at triton8.kn-bremen.de:/usr/obj/usr/home/nox/src-r8/src/sys/TRITON8  amd64

panic: general protection fault

GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...

Unread portion of the kernel message buffer:


Fatal trap 9: general protection fault while in kernel mode
cpuid = 1; apic id = 01
instruction pointer	= 0x20:0xffffffff80614c05
stack pointer	        = 0x28:0xffffff8000055ac0
frame pointer	        = 0x28:0xffffff8000055ae0
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 12 (swi4: clock)
trap number		= 9
panic: general protection fault
cpuid = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2a
panic() at panic+0x182
trap_fatal() at trap_fatal+0x2ad
trap() at trap+0xe4
calltrap() at calltrap+0x8
--- trap 0x9, rip = 0xffffffff80614c05, rsp = 0xffffff8000055ac0, rbp = 0xffffff8000055ae0 ---
m_freem() at m_freem+0x25
llentry_free() at llentry_free+0x5c
arptimer() at arptimer+0xd8
softclock() at softclock+0x291
intr_event_execute_handlers() at intr_event_execute_handlers+0x68
ithread_loop() at ithread_loop+0xb2
fork_exit() at fork_exit+0x12a
fork_trampoline() at fork_trampoline+0xe
--- trap 0, rip = 0, rsp = 0xffffff8000055d30, rbp = 0 ---
Uptime: 2h34m56s
Physical memory: 8175 MB
Dumping 2353 MB: 2338 2322 2306 2290 2274 2258 2242 2226 2210 2194 2178 2162 2146 2130 2114 2098 2082 2066 2050 2034 2018 2002 1986 1970 1954 1938 1922 1906 1890 1874 1858 1842 1826 1810 1794 1778 1762 1746 1730 1714 1698 1682 1666 1650 1634 1618 1602 1586 1570 1554 1538 1522 1506 1490 1474 1458 1442 1426 1410 1394 1378 1362 1346 1330 1314 1298 1282 1266 1250 1234 1218 1202 1186 1170 1154 1138 1122 1106 1090 1074 1058 1042 1026 1010 994 978 962 946 930 914 898 882 866 850 834 818 802 786 770 754 738 722 706 690 674 658 642 626 610 594 578 562 546 530 514 498 482 466 450 434 418 402 386 370 354 338 322 306 290 274 258 242 226 210 194 178 162 146 130 114 98 82 66 50 34 18 2

Reading symbols from /boot/kernel/amdtemp.ko...Reading symbols from /boot/kernel/amdtemp.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/amdtemp.ko
Reading symbols from /boot/kernel/ahci.ko...Reading symbols from /boot/kernel/ahci.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/ahci.ko
Reading symbols from /boot/kernel/siis.ko...Reading symbols from /boot/kernel/siis.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/siis.ko
Reading symbols from /boot/kernel/linprocfs.ko...Reading symbols from /boot/kernel/linprocfs.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/linprocfs.ko
Reading symbols from /boot/kernel/linux.ko...Reading symbols from /boot/kernel/linux.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/linux.ko
Reading symbols from /boot/kernel/netgraph.ko...Reading symbols from /boot/kernel/netgraph.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/netgraph.ko
Reading symbols from /boot/kernel/ng_ether.ko...Reading symbols from /boot/kernel/ng_ether.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/ng_ether.ko
Reading symbols from /boot/kernel/ng_pppoe.ko...Reading symbols from /boot/kernel/ng_pppoe.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/ng_pppoe.ko
Reading symbols from /boot/kernel/ng_socket.ko...Reading symbols from /boot/kernel/ng_socket.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/ng_socket.ko
Reading symbols from /boot/kernel/green_saver.ko...Reading symbols from /boot/kernel/green_saver.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/green_saver.ko
Reading symbols from /boot/kernel/radeon.ko...Reading symbols from /boot/kernel/radeon.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/radeon.ko
Reading symbols from /boot/kernel/drm.ko...Reading symbols from /boot/kernel/drm.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/drm.ko
Reading symbols from /boot/modules/vboxdrv.ko...done.
Loaded symbols for /boot/modules/vboxdrv.ko
Reading symbols from /boot/modules/vboxnetflt.ko...done.
Loaded symbols for /boot/modules/vboxnetflt.ko
Reading symbols from /boot/kernel/snd_hda.ko...Reading symbols from /boot/kernel/snd_hda.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/snd_hda.ko
Reading symbols from /boot/kernel/sound.ko...Reading symbols from /boot/kernel/sound.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/sound.ko
#0  doadump () at pcpu.h:223
223	pcpu.h: No such file or directory.
	in pcpu.h
(kgdb) #0  doadump () at pcpu.h:223
#1  0xffffffff805ba723 in boot (howto=260)
    at /usr/home/nox/src-r8/src/sys/kern/kern_shutdown.c:419
#2  0xffffffff805bab7c in panic (fmt=Variable "fmt" is not available.
)
    at /usr/home/nox/src-r8/src/sys/kern/kern_shutdown.c:575
#3  0xffffffff8089653d in trap_fatal (frame=0x9, eva=Variable "eva" is not available.
)
    at /usr/home/nox/src-r8/src/sys/amd64/amd64/trap.c:852
#4  0xffffffff80896fc4 in trap (frame=0xffffff8000055a10)
    at /usr/home/nox/src-r8/src/sys/amd64/amd64/trap.c:639
#5  0xffffffff8087cd63 in calltrap ()
    at /usr/home/nox/src-r8/src/sys/amd64/amd64/exception.S:224
#6  0xffffffff80614c05 in m_freem (mb=0xdeadc0dedeadc0de)
    at /usr/home/nox/src-r8/src/sys/kern/uipc_mbuf.c:160
#7  0xffffffff8066851c in llentry_free (lle=0xffffff01f0e35400)
    at /usr/home/nox/src-r8/src/sys/net/if_llatbl.c:101
#8  0xffffffff806adbb8 in arptimer (arg=0xffffff01f0e35400)
    at /usr/home/nox/src-r8/src/sys/netinet/if_ether.c:172
#9  0xffffffff805ccd41 in softclock (arg=Variable "arg" is not available.
)
    at /usr/home/nox/src-r8/src/sys/kern/kern_timeout.c:411
#10 0xffffffff80594f78 in intr_event_execute_handlers (p=Variable "p" is not available.
)
    at /usr/home/nox/src-r8/src/sys/kern/kern_intr.c:1165
#11 0xffffffff80595bd2 in ithread_loop (arg=0xffffff000187f840)
    at /usr/home/nox/src-r8/src/sys/kern/kern_intr.c:1178
#12 0xffffffff80592eca in fork_exit (
    callout=0xffffffff80595b20 <ithread_loop>, arg=0xffffff000187f840, 
    frame=0xffffff8000055c80)
    at /usr/home/nox/src-r8/src/sys/kern/kern_fork.c:838
#13 0xffffffff8087d23e in fork_trampoline ()
    at /usr/home/nox/src-r8/src/sys/amd64/amd64/exception.S:561
#14 0x0000000000000000 in ?? ()
#15 0x0000000000000000 in ?? ()
#16 0x0000000000000001 in ?? ()
#17 0x0000000000000000 in ?? ()
#18 0x0000000000000000 in ?? ()
#19 0x0000000000000000 in ?? ()
#20 0x0000000000000000 in ?? ()
#21 0x0000000000000000 in ?? ()
#22 0x0000000000000000 in ?? ()
#23 0x0000000000000000 in ?? ()
#24 0x0000000000000000 in ?? ()
#25 0x0000000000000000 in ?? ()
#26 0x0000000000000000 in ?? ()
#27 0x0000000000000000 in ?? ()
#28 0x0000000000000000 in ?? ()
#29 0x0000000000000000 in ?? ()
#30 0x0000000000000000 in ?? ()
#31 0x0000000000000000 in ?? ()
#32 0x0000000000000000 in ?? ()
#33 0x0000000000000000 in ?? ()
#34 0x0000000000000000 in ?? ()
#35 0x0000000000000000 in ?? ()
#36 0x0000000000000000 in ?? ()
#37 0x0000000000000000 in ?? ()
#38 0x0000000000ed5000 in ?? ()
#39 0x0000000000000000 in ?? ()
#40 0xffffffff80c58ec0 in affinity ()
#41 0xffffffff80c58ec0 in affinity ()
#42 0xffffff00019ff720 in ?? ()
#43 0xffffff8000054ee0 in ?? ()
#44 0xffffff8000054e98 in ?? ()
#45 0xffffff0001890390 in ?? ()
#46 0xffffffff805dd5c0 in sched_switch (td=0xffffff000187f840, 
    newtd=0xffffffff80595b20, flags=Variable "flags" is not available.
)
    at /usr/home/nox/src-r8/src/sys/kern/sched_ule.c:1858
Previous frame inner to this frame (corrupt stack?)
(kgdb) 

 Oh and the plist is now wrong too, vboxnetflt.ko is missing at least...

 Thanx,
	Juergen


More information about the freebsd-emulation mailing list