2024-05-04 02:04:11 +02:00
|
|
|
From 5e1e18fde92bae1ae87f78d470e80b1ffc9350d1 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Michal Kubecek <mkubecek@suse.cz>
|
|
|
|
Date: Wed, 26 Jul 2017 10:28:54 +0200
|
|
|
|
Subject: [PATCH] replace obsolete network configuration commands in scripts
|
|
|
|
|
|
|
|
Some scripts still use obsolete network configuration commands ifconfig and
|
|
|
|
brctl. Replace them by commands from iproute2 package.
|
|
|
|
---
|
2025-03-20 12:41:05 +01:00
|
|
|
tools/hotplug/Linux/colo-proxy-setup | 14 --------------
|
|
|
|
tools/hotplug/Linux/remus-netbuf-setup | 2 +-
|
|
|
|
tools/hotplug/Linux/vif-bridge | 6 +-----
|
|
|
|
tools/hotplug/Linux/vif-nat | 2 +-
|
|
|
|
tools/hotplug/Linux/vif-route | 6 ++++--
|
|
|
|
tools/hotplug/Linux/xen-network-common.sh | 15 +--------------
|
|
|
|
6 files changed, 8 insertions(+), 37 deletions(-)
|
2024-05-04 02:04:11 +02:00
|
|
|
|
2025-03-20 12:41:05 +01:00
|
|
|
--- a/tools/hotplug/Linux/colo-proxy-setup
|
|
|
|
+++ b/tools/hotplug/Linux/colo-proxy-setup
|
|
|
|
@@ -76,17 +76,10 @@
|
2024-05-04 02:04:11 +02:00
|
|
|
|
2025-03-20 12:41:05 +01:00
|
|
|
function setup_secondary()
|
|
|
|
{
|
|
|
|
- if which brctl >&/dev/null; then
|
|
|
|
- do_without_error brctl delif $bridge $vifname
|
|
|
|
- do_without_error brctl addbr $forwardbr
|
|
|
|
- do_without_error brctl addif $forwardbr $vifname
|
|
|
|
- do_without_error brctl addif $forwardbr $forwarddev
|
|
|
|
- else
|
|
|
|
do_without_error ip link set $vifname nomaster
|
|
|
|
do_without_error ip link add name $forwardbr type bridge
|
|
|
|
do_without_error ip link set $vifname master $forwardbr
|
|
|
|
do_without_error ip link set $forwarddev master $forwardbr
|
|
|
|
- fi
|
|
|
|
do_without_error ip link set dev $forwardbr up
|
|
|
|
do_without_error modprobe xt_SECCOLO
|
2024-05-04 02:04:11 +02:00
|
|
|
|
2025-03-20 12:41:05 +01:00
|
|
|
@@ -98,17 +91,10 @@
|
2024-05-04 02:04:11 +02:00
|
|
|
|
2025-03-20 12:41:05 +01:00
|
|
|
function teardown_secondary()
|
|
|
|
{
|
|
|
|
- if which brctl >&/dev/null; then
|
|
|
|
- do_without_error brctl delif $forwardbr $forwarddev
|
|
|
|
- do_without_error brctl delif $forwardbr $vifname
|
|
|
|
- do_without_error brctl delbr $forwardbr
|
|
|
|
- do_without_error brctl addif $bridge $vifname
|
|
|
|
- else
|
|
|
|
do_without_error ip link set $forwarddev nomaster
|
|
|
|
do_without_error ip link set $vifname nomaster
|
|
|
|
do_without_error ip link delete $forwardbr type bridge
|
|
|
|
do_without_error ip link set $vifname master $bridge
|
|
|
|
- fi
|
|
|
|
|
|
|
|
do_without_error iptables -t mangle -D PREROUTING -m physdev --physdev-in \
|
|
|
|
$vifname -j SECCOLO --index $index
|
|
|
|
--- a/tools/hotplug/Linux/remus-netbuf-setup
|
|
|
|
+++ b/tools/hotplug/Linux/remus-netbuf-setup
|
|
|
|
@@ -139,7 +139,7 @@
|
2024-05-04 02:04:11 +02:00
|
|
|
|
|
|
|
setup_ifb() {
|
|
|
|
|
|
|
|
- for ifb in `ifconfig -a -s|egrep ^ifb|cut -d ' ' -f1`
|
2025-03-20 12:41:05 +01:00
|
|
|
+ for ifb in $(ip --oneline link show type ifb | awk -F : '(NR == 1) { print $2; }')
|
2024-05-04 02:04:11 +02:00
|
|
|
do
|
|
|
|
check_ifb "$ifb" || continue
|
|
|
|
REMUS_IFB="$ifb"
|
2025-03-20 12:41:05 +01:00
|
|
|
--- a/tools/hotplug/Linux/vif-bridge
|
|
|
|
+++ b/tools/hotplug/Linux/vif-bridge
|
|
|
|
@@ -39,11 +39,7 @@
|
|
|
|
bridge=$(xenstore_read_default "$XENBUS_PATH/bridge" "$bridge")
|
|
|
|
|
|
|
|
if [ -z "$bridge" ]; then
|
|
|
|
- if which brctl >&/dev/null; then
|
|
|
|
- bridge=$(brctl show | awk 'NR==2{print$1}')
|
|
|
|
- else
|
2024-05-04 02:04:11 +02:00
|
|
|
- bridge=$(bridge link | cut -d" " -f7)
|
2025-03-20 12:41:05 +01:00
|
|
|
- fi
|
|
|
|
+ read bridge < <(ip --oneline link show type bridge | awk -F : '(NR == 1) { print $2; }')
|
2024-05-04 02:04:11 +02:00
|
|
|
if [ -z "$bridge" ]
|
|
|
|
then
|
2025-03-20 12:41:05 +01:00
|
|
|
fatal "Could not find bridge, and none was specified"
|
|
|
|
--- a/tools/hotplug/Linux/vif-nat
|
|
|
|
+++ b/tools/hotplug/Linux/vif-nat
|
|
|
|
@@ -172,7 +172,7 @@
|
2024-05-04 02:04:11 +02:00
|
|
|
;;
|
|
|
|
offline)
|
|
|
|
[ "$dhcp" != 'no' ] && dhcp_down
|
|
|
|
- do_without_error ifconfig "${dev}" down
|
2025-03-20 12:41:05 +01:00
|
|
|
+ do_without_error ip link set "${dev}" down
|
2024-05-04 02:04:11 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2025-03-20 12:41:05 +01:00
|
|
|
--- a/tools/hotplug/Linux/vif-route
|
|
|
|
+++ b/tools/hotplug/Linux/vif-route
|
|
|
|
@@ -23,13 +23,15 @@
|
2024-05-04 02:04:11 +02:00
|
|
|
|
|
|
|
case "${command}" in
|
|
|
|
add|online)
|
|
|
|
- ifconfig ${dev} ${main_ip} netmask 255.255.255.255 up
|
2025-03-20 12:41:05 +01:00
|
|
|
+ ip addr add "${main_ip}/32" dev "$dev"
|
2024-05-04 02:04:11 +02:00
|
|
|
+ ip link set "dev" up
|
|
|
|
echo 1 >/proc/sys/net/ipv4/conf/${dev}/proxy_arp
|
|
|
|
ipcmd='add'
|
|
|
|
cmdprefix=''
|
|
|
|
;;
|
|
|
|
remove|offline)
|
|
|
|
- do_without_error ifdown ${dev}
|
2025-03-20 12:41:05 +01:00
|
|
|
+ do_without_error ip addr flush dev "$dev"
|
|
|
|
+ do_without_error ip link set "$dev" down
|
2024-05-04 02:04:11 +02:00
|
|
|
ipcmd='del'
|
|
|
|
cmdprefix='do_without_error'
|
|
|
|
;;
|
2025-03-20 12:41:05 +01:00
|
|
|
--- a/tools/hotplug/Linux/xen-network-common.sh
|
|
|
|
+++ b/tools/hotplug/Linux/xen-network-common.sh
|
|
|
|
@@ -111,13 +111,7 @@
|
2024-05-04 02:04:11 +02:00
|
|
|
|
2025-03-20 12:41:05 +01:00
|
|
|
# Don't create the bridge if it already exists.
|
|
|
|
if [ ! -e "/sys/class/net/${bridge}/bridge" ]; then
|
|
|
|
- if which brctl >&/dev/null; then
|
|
|
|
- brctl addbr ${bridge}
|
|
|
|
- brctl stp ${bridge} off
|
|
|
|
- brctl setfd ${bridge} 0
|
|
|
|
- else
|
|
|
|
ip link add name ${bridge} type bridge stp_state 0 forward_delay 0
|
|
|
|
- fi
|
|
|
|
fi
|
|
|
|
}
|
2024-05-04 02:04:11 +02:00
|
|
|
|
2025-03-20 12:41:05 +01:00
|
|
|
@@ -129,11 +123,7 @@
|
|
|
|
# Don't add $dev to $bridge if it's already on the bridge.
|
|
|
|
if [ ! -e "/sys/class/net/${bridge}/brif/${dev}" ]; then
|
|
|
|
log debug "adding $dev to bridge $bridge"
|
|
|
|
- if which brctl >&/dev/null; then
|
|
|
|
- brctl addif ${bridge} ${dev}
|
|
|
|
- else
|
|
|
|
ip link set ${dev} master ${bridge}
|
|
|
|
- fi
|
|
|
|
else
|
|
|
|
log debug "$dev already on bridge $bridge"
|
|
|
|
fi
|
|
|
|
@@ -150,11 +140,8 @@
|
|
|
|
# Don't remove $dev from $bridge if it's not on the bridge.
|
|
|
|
if [ -e "/sys/class/net/${bridge}/brif/${dev}" ]; then
|
2024-05-04 02:04:11 +02:00
|
|
|
log debug "removing $dev from bridge $bridge"
|
2025-03-20 12:41:05 +01:00
|
|
|
- if which brctl >&/dev/null; then
|
|
|
|
- do_without_error brctl delif ${bridge} ${dev}
|
|
|
|
- else
|
2024-05-04 02:04:11 +02:00
|
|
|
do_without_error ip link set ${dev} nomaster
|
2025-03-20 12:41:05 +01:00
|
|
|
- fi
|
2024-05-04 02:04:11 +02:00
|
|
|
+ do_without_error ip link set "$dev" down
|
|
|
|
else
|
|
|
|
log debug "$dev not on bridge $bridge"
|
2025-03-20 12:41:05 +01:00
|
|
|
fi
|