Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Step:15-SP2
xen.31135
replace-obsolete-network-configuration-commands...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File replace-obsolete-network-configuration-commands-in-s.patch of Package xen.31135
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/vif2 | 6 +++--- tools/hotplug/Linux/xen-network-common.sh | 6 ++---- .../i386-dm/qemu-ifup-Linux | 5 +++-- 9 files changed, 26 insertions(+), 26 deletions(-) Index: xen-4.13.0-testing/README =================================================================== --- xen-4.13.0-testing.orig/README +++ xen-4.13.0-testing/README @@ -57,8 +57,7 @@ provided by your OS distributor: * 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 * GNU gettext * ACPI ASL compiler (iasl) Index: xen-4.13.0-testing/tools/hotplug/Linux/colo-proxy-setup =================================================================== --- xen-4.13.0-testing.orig/tools/hotplug/Linux/colo-proxy-setup +++ xen-4.13.0-testing/tools/hotplug/Linux/colo-proxy-setup @@ -76,10 +76,16 @@ function teardown_primary() function setup_secondary() { - 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 + if [ "$legacy_tools" ]; 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 add "$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 @@ -91,10 +97,16 @@ function setup_secondary() function teardown_secondary() { - 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 + if [ "$legacy_tools" ]; 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" master "$bridge" + do_without_error ip link del "$forwardbr" + fi do_without_error iptables -t mangle -D PREROUTING -m physdev --physdev-in \ $vifname -j SECCOLO --index $index Index: xen-4.13.0-testing/tools/hotplug/Linux/remus-netbuf-setup =================================================================== --- xen-4.13.0-testing.orig/tools/hotplug/Linux/remus-netbuf-setup +++ xen-4.13.0-testing/tools/hotplug/Linux/remus-netbuf-setup @@ -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 Index: xen-4.13.0-testing/tools/hotplug/Linux/vif-bridge =================================================================== --- xen-4.13.0-testing.orig/tools/hotplug/Linux/vif-bridge +++ xen-4.13.0-testing/tools/hotplug/Linux/vif-bridge @@ -40,7 +40,12 @@ bridge=$(xenstore_read_default "$XENBUS_ if [ -z "$bridge" ] then - bridge=$(brctl show | awk 'NR==2{print$1}') + if [ "$legacy_tools" ]; then + bridge=$(brctl show | awk 'NR==2{print$1}') + else + bridge=$(ip --oneline link show type bridge | awk '(NR == 1) { print $2; }') + bridge="${bridge%:}" + fi if [ -z "$bridge" ] then @@ -89,8 +94,13 @@ case "$command" in ;; offline) - do_without_error brctl delif "$bridge" "$dev" - do_without_error ifconfig "$dev" down + if [ "$legacy_tools" ]; 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 ;; add) Index: xen-4.13.0-testing/tools/hotplug/Linux/vif-nat =================================================================== --- xen-4.13.0-testing.orig/tools/hotplug/Linux/vif-nat +++ xen-4.13.0-testing/tools/hotplug/Linux/vif-nat @@ -174,7 +174,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 Index: xen-4.13.0-testing/tools/hotplug/Linux/vif-route =================================================================== --- xen-4.13.0-testing.orig/tools/hotplug/Linux/vif-route +++ xen-4.13.0-testing/tools/hotplug/Linux/vif-route @@ -25,7 +25,12 @@ 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='' @@ -33,7 +38,12 @@ case "${command}" in 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' ;; Index: xen-4.13.0-testing/tools/hotplug/Linux/vif2 =================================================================== --- xen-4.13.0-testing.orig/tools/hotplug/Linux/vif2 +++ xen-4.13.0-testing/tools/hotplug/Linux/vif2 @@ -7,13 +7,22 @@ dir=$(dirname "$0") bridge=$(xenstore_read_default "$XENBUS_PATH/bridge" "$bridge") if [ -z "$bridge" ] then - nr_bridges=$(($(brctl show | cut -f 1 | grep -v "^$" | wc -l) - 1)) + if [ "$legacy_tools" ]; then + nr_bridges=$(($(brctl show | cut -f 1 | grep -v "^$" | wc -l) - 1)) + else + nr_bridges=$(ip --oneline link show type bridge | wc -l) + fi if [ "$nr_bridges" != 1 ] then fatal "no bridge specified, and don't know which one to use ($nr_bridges found)" fi - bridge=$(brctl show | cut -d " + if [ "$legacy_tools" ]; then + bridge=$(brctl show | cut -d " " -f 2 | cut -f 1) + else + bridge=$(ip --oneline link show type bridge | head -1 | cut -d ' ' -f2) + bridge="${bridge%:}" + fi fi command="$1" Index: xen-4.13.0-testing/tools/hotplug/Linux/xen-network-common.sh =================================================================== --- xen-4.13.0-testing.orig/tools/hotplug/Linux/xen-network-common.sh +++ xen-4.13.0-testing/tools/hotplug/Linux/xen-network-common.sh @@ -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. @@ -111,9 +117,13 @@ create_bridge () { # Don't create the bridge if it already exists. if [ ! -e "/sys/class/net/${bridge}/bridge" ]; then - brctl addbr ${bridge} - brctl stp ${bridge} off - brctl setfd ${bridge} 0 + if [ "$legacy_tools" ]; then + brctl addbr ${bridge} + brctl stp ${bridge} off + brctl setfd ${bridge} 0 + else + ip link add "$bridge" type bridge stp_state 0 forward_delay 0 + fi fi } @@ -127,7 +137,11 @@ add_to_bridge () { ip link set dev ${dev} up || true return fi - brctl addif ${bridge} ${dev} + if [ "$legacy_tools" ]; then + brctl addif ${bridge} ${dev} + else + ip link set "$dev" master "$bridge" + fi ip link set dev ${dev} up }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor