summaryrefslogtreecommitdiff
path: root/emulators/qemu-riscv/files/qemu-ifup
diff options
context:
space:
mode:
Diffstat (limited to 'emulators/qemu-riscv/files/qemu-ifup')
-rw-r--r--emulators/qemu-riscv/files/qemu-ifup40
1 files changed, 0 insertions, 40 deletions
diff --git a/emulators/qemu-riscv/files/qemu-ifup b/emulators/qemu-riscv/files/qemu-ifup
deleted file mode 100644
index 1207696..0000000
--- a/emulators/qemu-riscv/files/qemu-ifup
+++ /dev/null
@@ -1,40 +0,0 @@
1#! /bin/sh
2
3_ETHER=`route -n get default 2>/dev/null |awk '/interface:/ {print $2}'`
4_ETHER=${_ETHER:=trunk0}
5_BRIDGE=bridge0
6
7# Let the environment over-ride this
8[ "$BRIDGE" ] || BRIDGE=${_BRIDGE}
9[ "$ETHER" ] || ETHER=${_ETHER}
10
11if test `id -u` -ne 0; then
12 DOAS=doas
13fi
14
15echo -n " {$1 ($BRIDGE <-> $ETHER)"
16
17# Set up our bridge
18$DOAS ifconfig $1 group tap > /dev/null 2>&1
19$DOAS ifconfig $BRIDGE create > /dev/null 2>&1 && {
20 # Only add rules if the bridge creation succeeds; otherwise
21 # duplicate rules get loaded each time qemu starts
22 # The following two block carp packets from wasting cpu cycles inside the
23 # qemu sessions, remove if testing carp inside qemu
24 $DOAS ifconfig $BRIDGE rule block in on $ETHER dst 33:33:0:0:0:12
25 $DOAS ifconfig $BRIDGE rule block in on $ETHER dst 01:00:5e:00:00:12
26}
27# Since we can specify ETHER and BRIDGE above, its possible that
28# this tap interface or this physical interface was setup as part of
29# a different bridge earlier, and that is never cleaned up, so we have
30# to cleanup here first before we set it up; a physical interface cannot
31# be member to more than one bridge, thankfully, or I never would have
32# caught this
33ifconfig bridge | sed -n '/^bridge[0-9]*/{s/:.*$//;p;}' | while read brif
34do
35 $DOAS ifconfig $brif del $ETHER > /dev/null 2>&1
36 $DOAS ifconfig $brif del $1 > /dev/null 2>&1
37done
38$DOAS ifconfig $BRIDGE add $ETHER up
39$DOAS ifconfig $BRIDGE add $1 up || true
40echo "}"