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.
|
|
|
|
---
|
|
|
|
README | 3 +--
|
|
|
|
tools/hotplug/Linux/colo-proxy-setup | 14 ++++++--------
|
|
|
|
tools/hotplug/Linux/remus-netbuf-setup | 3 ++-
|
|
|
|
tools/hotplug/Linux/vif-bridge | 7 ++++---
|
|
|
|
tools/hotplug/Linux/vif-nat | 2 +-
|
|
|
|
tools/hotplug/Linux/vif-route | 6 ++++--
|
|
|
|
tools/hotplug/Linux/xen-network-common.sh | 6 ++----
|
|
|
|
.../i386-dm/qemu-ifup-Linux | 5 +++--
|
|
|
|
9 files changed, 26 insertions(+), 26 deletions(-)
|
|
|
|
|
2024-10-18 15:48:08 +02:00
|
|
|
Index: xen-4.19.0-testing/README
|
2024-05-04 02:04:11 +02:00
|
|
|
===================================================================
|
2024-10-18 15:48:08 +02:00
|
|
|
--- xen-4.19.0-testing.orig/README
|
|
|
|
+++ xen-4.19.0-testing/README
|
|
|
|
@@ -59,8 +59,7 @@ provided by your OS distributor:
|
2024-05-04 02:04:11 +02:00
|
|
|
* Development install of GLib v2.0 (e.g. libglib2.0-dev)
|
|
|
|
* Development install of Pixman (e.g. libpixman-1-dev)
|
|
|
|
* pkg-config
|
|
|
|
- * bridge-utils package (/sbin/brctl)
|
|
|
|
- * iproute package (/sbin/ip)
|
|
|
|
+ * iproute package (/sbin/ip, /sbin/bridge)
|
|
|
|
* GNU bison and GNU flex
|
|
|
|
* ACPI ASL compiler (iasl)
|
|
|
|
|
2024-10-18 15:48:08 +02:00
|
|
|
Index: xen-4.19.0-testing/tools/hotplug/Linux/remus-netbuf-setup
|
2024-05-04 02:04:11 +02:00
|
|
|
===================================================================
|
2024-10-18 15:48:08 +02:00
|
|
|
--- xen-4.19.0-testing.orig/tools/hotplug/Linux/remus-netbuf-setup
|
|
|
|
+++ xen-4.19.0-testing/tools/hotplug/Linux/remus-netbuf-setup
|
2024-05-04 02:04:11 +02:00
|
|
|
@@ -76,6 +76,7 @@
|
|
|
|
#specific setup code such as renaming.
|
|
|
|
dir=$(dirname "$0")
|
|
|
|
. "$dir/xen-hotplug-common.sh"
|
|
|
|
+. "$dir/xen-network-common.sh"
|
|
|
|
|
|
|
|
findCommand "$@"
|
|
|
|
|
|
|
|
@@ -139,8 +140,16 @@ check_ifb() {
|
|
|
|
|
|
|
|
setup_ifb() {
|
|
|
|
|
|
|
|
- for ifb in `ifconfig -a -s|egrep ^ifb|cut -d ' ' -f1`
|
|
|
|
+ if [ "$legacy_tools" ]; then
|
|
|
|
+ ifbs=`ifconfig -a -s|egrep ^ifb|cut -d ' ' -f1`
|
|
|
|
+ else
|
|
|
|
+ ifbs=$(ip --oneline link show type ifb | cut -d ' ' -f2)
|
|
|
|
+ fi
|
|
|
|
+ for ifb in $ifbs
|
|
|
|
do
|
|
|
|
+ if [ ! "$legacy_tools" ]; then
|
|
|
|
+ ifb="${ifb%:}"
|
|
|
|
+ fi
|
|
|
|
check_ifb "$ifb" || continue
|
|
|
|
REMUS_IFB="$ifb"
|
|
|
|
break
|
2024-10-18 15:48:08 +02:00
|
|
|
Index: xen-4.19.0-testing/tools/hotplug/Linux/vif-bridge
|
2024-05-04 02:04:11 +02:00
|
|
|
===================================================================
|
2024-10-18 15:48:08 +02:00
|
|
|
--- xen-4.19.0-testing.orig/tools/hotplug/Linux/vif-bridge
|
|
|
|
+++ xen-4.19.0-testing/tools/hotplug/Linux/vif-bridge
|
2024-05-04 02:04:11 +02:00
|
|
|
@@ -42,7 +42,8 @@ if [ -z "$bridge" ]; then
|
|
|
|
if which brctl >&/dev/null; then
|
|
|
|
bridge=$(brctl show | awk 'NR==2{print$1}')
|
|
|
|
else
|
|
|
|
- bridge=$(bridge link | cut -d" " -f7)
|
|
|
|
+ bridge=$(ip --oneline link show type bridge | awk '(NR == 1) { print $2; }')
|
|
|
|
+ bridge="${bridge%:}"
|
|
|
|
fi
|
|
|
|
if [ -z "$bridge" ]
|
|
|
|
then
|
2024-10-18 15:48:08 +02:00
|
|
|
Index: xen-4.19.0-testing/tools/hotplug/Linux/vif-nat
|
2024-05-04 02:04:11 +02:00
|
|
|
===================================================================
|
2024-10-18 15:48:08 +02:00
|
|
|
--- xen-4.19.0-testing.orig/tools/hotplug/Linux/vif-nat
|
|
|
|
+++ xen-4.19.0-testing/tools/hotplug/Linux/vif-nat
|
2024-05-04 02:04:11 +02:00
|
|
|
@@ -172,7 +172,11 @@ case "$command" in
|
|
|
|
;;
|
|
|
|
offline)
|
|
|
|
[ "$dhcp" != 'no' ] && dhcp_down
|
|
|
|
- do_without_error ifconfig "${dev}" down
|
|
|
|
+ if [ "$legacy_tools" ]; then
|
|
|
|
+ do_without_error ifconfig "${dev}" down
|
|
|
|
+ else
|
|
|
|
+ do_without_error ip link set "${dev}" down
|
|
|
|
+ fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2024-10-18 15:48:08 +02:00
|
|
|
Index: xen-4.19.0-testing/tools/hotplug/Linux/vif-route
|
2024-05-04 02:04:11 +02:00
|
|
|
===================================================================
|
2024-10-18 15:48:08 +02:00
|
|
|
--- xen-4.19.0-testing.orig/tools/hotplug/Linux/vif-route
|
|
|
|
+++ xen-4.19.0-testing/tools/hotplug/Linux/vif-route
|
2024-05-04 02:04:11 +02:00
|
|
|
@@ -23,13 +23,23 @@ main_ip=$(dom0_ip)
|
|
|
|
|
|
|
|
case "${command}" in
|
|
|
|
add|online)
|
|
|
|
- ifconfig ${dev} ${main_ip} netmask 255.255.255.255 up
|
|
|
|
+ if [ "$legacy_tools" ]; then
|
|
|
|
+ ifconfig ${dev} ${main_ip} netmask 255.255.255.255 up
|
|
|
|
+ else
|
|
|
|
+ ip addr add "${main_ip}/32" dev "$dev"
|
|
|
|
+ fi
|
|
|
|
+ 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}
|
|
|
|
+ if [ "$legacy_tools" ]; then
|
|
|
|
+ do_without_error ifdown ${dev}
|
|
|
|
+ else
|
|
|
|
+ do_without_error ip addr flush dev "$dev"
|
|
|
|
+ do_without_error ip link set "$dev" down
|
|
|
|
+ fi
|
|
|
|
ipcmd='del'
|
|
|
|
cmdprefix='do_without_error'
|
|
|
|
;;
|
2024-10-18 15:48:08 +02:00
|
|
|
Index: xen-4.19.0-testing/tools/hotplug/Linux/xen-network-common.sh
|
2024-05-04 02:04:11 +02:00
|
|
|
===================================================================
|
2024-10-18 15:48:08 +02:00
|
|
|
--- xen-4.19.0-testing.orig/tools/hotplug/Linux/xen-network-common.sh
|
|
|
|
+++ xen-4.19.0-testing/tools/hotplug/Linux/xen-network-common.sh
|
2024-05-04 02:04:11 +02:00
|
|
|
@@ -15,6 +15,12 @@
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
+# Use brctl and ifconfig on older systems
|
|
|
|
+legacy_tools=
|
|
|
|
+if [ -f /sbin/brctl -a -f /sbin/ifconfig ]; then
|
|
|
|
+ legacy_tools="true"
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
# Gentoo doesn't have ifup/ifdown, so we define appropriate alternatives.
|
|
|
|
|
|
|
|
# Other platforms just use ifup / ifdown directly.
|
|
|
|
@@ -152,8 +158,10 @@ remove_from_bridge () {
|
|
|
|
log debug "removing $dev from bridge $bridge"
|
|
|
|
if which brctl >&/dev/null; then
|
|
|
|
do_without_error brctl delif ${bridge} ${dev}
|
|
|
|
+ do_without_error ifconfig "$dev" down
|
|
|
|
else
|
|
|
|
do_without_error ip link set ${dev} nomaster
|
|
|
|
+ do_without_error ip link set "$dev" down
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
log debug "$dev not on bridge $bridge"
|