qemu-boot.sh: Replace deprecated brctl by iproute2 (ip)

/sbin/brctl is not part of openSUSE anymore, use ip link commands instead.

Also, remove the vlan option, now unsupported by qemu.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-07-16 13:23:21 +00:00
commit a0842c6297

View file

@ -3,7 +3,7 @@
goodbye()
{
:
rm -f $tmp_files
rm -rf $tmp_files
}
usage()
@ -89,8 +89,8 @@ boot_net()
do_sudo -E /usr/bin/$qemu_exe \
-boot n \
-net tap,ifname=tap0,vlan=0,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
-net nic,vlan=0$nic_model$macaddr \
-net tap,ifname=tap0,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
-net nic$nic_model$macaddr \
"$qemu_opts"
# invalid param macaddr
@ -116,7 +116,7 @@ boot_image()
#-net tap,ifname=tap1,vlan=1,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
#set -x
do_sudo -E /usr/bin/$qemu_exe \
-net nic,vlan=0$nic_model$macaddr \
-net nic,$nic_model$macaddr \
-net tap,ifname=tap0,vlan=0,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
"$qemu_opts" \
-drive file=$boot_image
@ -134,7 +134,8 @@ boot()
case $1 in
net)
boot_net
shift
boot_net "$@"
;;
*)
boot_image "$@"
@ -156,7 +157,7 @@ macaddr=,macaddr=00:0B:DC:9B:D6:DA
base=dc=priv,dc=lcl
qemu_exe=qemu-kvm
qemu_opts=""
brctl=`PATH=/usr/sbin:/sbin /usr/bin/which brctl`
ip=`PATH=/usr/sbin:/sbin:/usr/bin /usr/bin/which ip`
#nic_model=",model=rtl8139"
tmp_files=""
tmpdir=""
@ -196,25 +197,16 @@ shift $(($OPTIND - 1))
case $myname in
*ifup*)
#set -x
#[ "$1" = tap1 ] || exit 0
#do_sudo /sbin/ifconfig tap1 up
#do_sudo $brctl addif in1 tap0
#do_sudo /sbin/ifconfig tap0 up
#do_sudo $brctl addif in2 tap1
#exit 0
virt_if=$1
touch /tmp/i-ran-$myname
do_sudo /sbin/ifconfig $virt_if up
# this is most certainly always priv0
do_sudo $brctl addif $bridge $virt_if
do_sudo $ip link set $virt_if up
do_sudo $ip link set dev $virt_if master $bridge
;;
*ifdown*)
# this is most certainly always priv0
do_sudo $brctl delif $bridge $1
do_sudo /sbin/ifconfig $1 down
virt_if=$1
do_sudo $ip link set dev $virt_if nomaster
do_sudo $ip link set dev $virt_if down
;;
qemu.sh)
boot "$@"