From: Antonio Huete Jimenez Date: Tue, 6 Dec 2011 17:59:30 +0000 (+0100) Subject: rc.d - Add a basic vknetd script. X-Git-Tag: v3.0.0~467 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/c4740fdfae598975a31a0842071d426f5dd39acc rc.d - Add a basic vknetd script. --- diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index 5c8df0a22c..0d144f87f5 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -442,6 +442,8 @@ vkernel_list="" # Space separated list of names of vkernels #vkernel_bin="/boot/kernel.VKERNEL" # Default path to the vkernel binary #vkernel_kill_timeout="45" # Default timeout before a SIGKILL is issued +vknetd_enable="NO" # Bridged networking +vknetd_flags="-U" # Bridged networking flags # # Create an entry for each vkernel specified in vkernel_list # replacing 'example' by the name of the vkernel. diff --git a/etc/rc.d/vknetd b/etc/rc.d/vknetd new file mode 100644 index 0000000000..1b4b96c05f --- /dev/null +++ b/etc/rc.d/vknetd @@ -0,0 +1,29 @@ +#!/bin/sh +# + +# PROVIDE: vknetd +# REQUIRE: DAEMON netif +# BEFORE: LOGIN + +. /etc/rc.subr + +name="vknetd" +rcvar=`set_rcvar` +start_precmd="vknetd_precmd" +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" + +vknetd_precmd() +{ + # load if_tap kernel module if needed + if ! kldstat -q -m "if_tap"; then + if kldload if_tap; then + info 'if_tap module loaded.' + else + err 1 'if_tap module failed to load.' + fi + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/test/vkernel/README b/test/vkernel/README index f95fe11a9a..732f6afcab 100644 --- a/test/vkernel/README +++ b/test/vkernel/README @@ -10,12 +10,12 @@ are two easy ways of doing this. First you can set up a bridge: /usr/sbin/vknetd -p /var/run/vknet -U -b bridge0 Second, you can set up a LAN just between the vkernel and the machine it -is running on: +is running on. In your /etc/rc.conf you set: - /usr/sbin/vknetd -p /var/run/vknet -U 10.30.0.1/16 + vknetd_enable="YES" + vknetd_flags="10.30.0.1/16" -This setup is typically done in /etc/rc.local. vknetd just sits there -waiting for connections. Any number of vkernels can then attach to it. -If you bridge you can use your normal LAN's dhcp server and run dhclient -on the vkernel. If you set up a local LAN it is easiest to simply configure -the address by hand. +vknetd just sits there waiting for connections. Any number of vkernels +can then attach to it. If you bridge you can use your normal LAN's dhcp +server and run dhclient on the vkernel. If you set up a local LAN it +is easiest to simply configure the address by hand.