From 67bfedfe52ed2063ba3f0bff1cb71b1e807f4b89 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 21 Feb 2022 18:25:18 +0100 Subject: [dhcp-busybox] Add service to create additional bridges --- .../data/opt/openslx/scripts/systemd-vbox_env | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'core/modules/vbox-src') diff --git a/core/modules/vbox-src/data/opt/openslx/scripts/systemd-vbox_env b/core/modules/vbox-src/data/opt/openslx/scripts/systemd-vbox_env index 8d2302bc..c3b08b01 100755 --- a/core/modules/vbox-src/data/opt/openslx/scripts/systemd-vbox_env +++ b/core/modules/vbox-src/data/opt/openslx/scripts/systemd-vbox_env @@ -21,6 +21,8 @@ VBOX_BASE_DIR="/usr/lib/virtualbox" VBOX_KMOD_DIR="/lib/modules/vbox" VBOX_MANAGE="${VBOX_BASE_DIR}/VBoxManage" +. /opt/openslx/config + # Runtime critical checks first # VBoxManage should be under /usr/lib/virtualbox if ! [ -d "${VBOX_BASE_DIR}" -o -x "${VBOX_MANAGE}" -o -d "${VBOX_KMOD_DIR}" ]; then @@ -54,10 +56,11 @@ mkdir -p "/tmp/virt/virtualbox" -m 1777 # reload udev rules since aufs'ing the layer on top do not trigger its inotify watch udevadm control --reload -# pretty dumb you can just create host-only interfaces, +# pretty dumb, you can only create host-only interfaces, # but not assign a specific name/number ${VBOX_MANAGE} hostonlyif create ip link set dev vboxnet0 up +[ "$SLX_JUMBO_FRAMES" = "yes" ] && ip link set dev vboxnet0 mtu 9000 brctl addif br0 vboxnet0 ${VBOX_MANAGE} hostonlyif create @@ -68,4 +71,23 @@ ${VBOX_MANAGE} hostonlyif create ip link set dev vboxnet2 up brctl addif vsw2 vboxnet2 +if [ "$SLX_BRIDGE_OTHER_NICS" = "yes" ]; then + # These will have been set up in our init, or by bridge-other-nics.service + NICS=$( ls -1 /sys/class/net | grep '^br-nic-' | cut -c 8- ) + vboxnet=3 + for nic in $NICS; do + if ! [ "$nic" -gt 0 ] && ! [ "$nic" -eq 0 ]; then + slxlog "vbox-other-nics" "NaN: br-nic-X has X='$nic'" + continue + fi + # create vboxnet10 - vboxnetN for these + ${VBOX_MANAGE} hostonlyif create + brctl addif "br-nic-${nic}" "vboxnet${vboxnet}" + vboxnet="$(( vboxnet + 1 ))" + done +fi + +# trigger reload of iptables stuff (it's using inotify) +touch /opt/openslx/iptables/rules.d/empty + exit 0 -- cgit v1.2.3-55-g7522