You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
172 lines
6.5 KiB
172 lines
6.5 KiB
From 19bb8937ed492afdbde7076b74010e1fb2f3a7c4 Mon Sep 17 00:00:00 2001 |
|
From: Harald Hoyer <harald@redhat.com> |
|
Date: Fri, 1 Aug 2014 13:16:29 +0200 |
|
Subject: [PATCH] fixed bridge setup |
|
|
|
renamed "ethnames" in bridge.info to "bridgeslaves" |
|
|
|
fixed ifcfg generation |
|
|
|
(cherry picked from commit 2db6d7111870c5d16d812d9cddc23558f3f4a202) |
|
--- |
|
modules.d/40network/ifup.sh | 4 ++-- |
|
modules.d/40network/net-genrules.sh | 2 +- |
|
modules.d/40network/parse-bridge.sh | 18 ++++++++-------- |
|
modules.d/45ifcfg/write-ifcfg.sh | 42 +++++++++---------------------------- |
|
4 files changed, 22 insertions(+), 44 deletions(-) |
|
|
|
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh |
|
index 79127f24..43e84a2c 100755 |
|
--- a/modules.d/40network/ifup.sh |
|
+++ b/modules.d/40network/ifup.sh |
|
@@ -60,7 +60,7 @@ fi |
|
# bridge this interface? |
|
if [ -e /tmp/bridge.info ]; then |
|
. /tmp/bridge.info |
|
- for ethname in $ethnames ; do |
|
+ for ethname in $bridgeslaves ; do |
|
if [ "$netif" = "$ethname" ]; then |
|
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then |
|
: # We need to really setup bond (recursive call) |
|
@@ -236,7 +236,7 @@ if [ -e /tmp/bridge.info ]; then |
|
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then |
|
brctl addbr $bridgename |
|
brctl setfd $bridgename 0 |
|
- for ethname in $ethnames ; do |
|
+ for ethname in $bridgeslaves ; do |
|
if [ "$ethname" = "$bondname" ] ; then |
|
DO_BOND_SETUP=yes ifup $bondname -m |
|
elif [ "$ethname" = "$teammaster" ] ; then |
|
diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh |
|
index af2f09c1..a43e3df1 100755 |
|
--- a/modules.d/40network/net-genrules.sh |
|
+++ b/modules.d/40network/net-genrules.sh |
|
@@ -16,7 +16,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh |
|
# bridge: attempt only the defined interface |
|
if [ -e /tmp/bridge.info ]; then |
|
. /tmp/bridge.info |
|
- IFACES="$IFACES ${ethnames%% *}" |
|
+ IFACES="$IFACES ${bridgeslaves%% *}" |
|
MASTER_IFACES="$MASTER_IFACES $bridgename" |
|
fi |
|
|
|
diff --git a/modules.d/40network/parse-bridge.sh b/modules.d/40network/parse-bridge.sh |
|
index 8c305c0f..a9101094 100755 |
|
--- a/modules.d/40network/parse-bridge.sh |
|
+++ b/modules.d/40network/parse-bridge.sh |
|
@@ -3,9 +3,9 @@ |
|
# ex: ts=8 sw=4 sts=4 et filetype=sh |
|
# |
|
# Format: |
|
-# bridge=<bridgename>:<ethnames> |
|
+# bridge=<bridgename>:<bridgeslaves> |
|
# |
|
-# <ethnames> is a comma-separated list of physical (ethernet) interfaces |
|
+# <bridgeslaves> is a comma-separated list of physical (ethernet) interfaces |
|
# bridge without parameters assumes bridge=br0:eth0 |
|
# |
|
|
|
@@ -25,20 +25,20 @@ parsebridge() { |
|
v=${v#*:} |
|
done |
|
|
|
- unset bridgename ethnames |
|
+ unset bridgename bridgeslaves |
|
case $# in |
|
- 0) bridgename=br0; ethnames=$iface ;; |
|
+ 0) bridgename=br0; bridgeslaves=$iface ;; |
|
1) die "bridge= requires two parameters" ;; |
|
- 2) bridgename=$1; ethnames=$(str_replace "$2" "," " ") ;; |
|
+ 2) bridgename=$1; bridgeslaves=$(str_replace "$2" "," " ") ;; |
|
*) die "bridge= requires two parameters" ;; |
|
esac |
|
} |
|
|
|
-unset bridgename ethnames |
|
+unset bridgename bridgeslaves |
|
|
|
iface=eth0 |
|
|
|
-# Parse bridge for bridgename and ethnames |
|
+# Parse bridge for bridgename and bridgeslaves |
|
if bridge="$(getarg bridge)"; then |
|
# Read bridge= parameters if they exist |
|
if [ -n "$bridge" ]; then |
|
@@ -47,9 +47,9 @@ if bridge="$(getarg bridge)"; then |
|
# Simple default bridge |
|
if [ -z "$bridgename" ]; then |
|
bridgename=br0 |
|
- ethnames=$iface |
|
+ bridgeslaves=$iface |
|
fi |
|
echo "bridgename=$bridgename" > /tmp/bridge.info |
|
- echo "ethnames=\"$ethnames\"" >> /tmp/bridge.info |
|
+ echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.info |
|
return |
|
fi |
|
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh |
|
index 5e333e45..c1cd23c3 100755 |
|
--- a/modules.d/45ifcfg/write-ifcfg.sh |
|
+++ b/modules.d/45ifcfg/write-ifcfg.sh |
|
@@ -214,6 +214,7 @@ for netup in /tmp/net.*.did-setup ; do |
|
echo "SLAVE=yes" |
|
echo "MASTER=\"$netif\"" |
|
echo "NAME=\"$slave\"" |
|
+ echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\"" |
|
} >> /tmp/ifcfg/ifcfg-$slave |
|
done |
|
fi |
|
@@ -224,44 +225,21 @@ for netup in /tmp/net.*.did-setup ; do |
|
echo "TYPE=Bridge" |
|
echo "NAME=\"$netif\"" |
|
} >> /tmp/ifcfg/ifcfg-$netif |
|
- if [ "$ethname" = "$bondname" ] ; then |
|
- { |
|
- echo "# Generated by dracut initrd" |
|
- echo "DEVICE=\"$bondname\"" |
|
- echo "ONBOOT=yes" |
|
- echo "NETBOOT=yes" |
|
- # This variable is an indicator of a bond interface for initscripts |
|
- echo "BONDING_OPTS=\"$bondoptions\"" |
|
- echo "BRIDGE=\"$netif\"" |
|
- echo "NAME=\"$bondname\"" |
|
- } >> /tmp/ifcfg/ifcfg-$bondname |
|
- for slave in $bondslaves ; do |
|
- # write separate ifcfg file for the raw eth interface |
|
- { |
|
- echo "# Generated by dracut initrd" |
|
- echo "DEVICE=\"$slave\"" |
|
- echo "TYPE=Ethernet" |
|
- echo "ONBOOT=yes" |
|
- echo "NETBOOT=yes" |
|
- echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\"" |
|
- echo "SLAVE=yes" |
|
- echo "MASTER=\"$bondname\"" |
|
- echo "NAME=\"$slave\"" |
|
- } >> /tmp/ifcfg/ifcfg-$slave |
|
- done |
|
- else |
|
+ for slave in $bridgeslaves ; do |
|
# write separate ifcfg file for the raw eth interface |
|
{ |
|
echo "# Generated by dracut initrd" |
|
- echo "DEVICE=\"$ethname\"" |
|
+ echo "DEVICE=\"$slave\"" |
|
echo "TYPE=Ethernet" |
|
echo "ONBOOT=yes" |
|
echo "NETBOOT=yes" |
|
- echo "HWADDR=\"$(cat /sys/class/net/$ethname/address)\"" |
|
- echo "BRIDGE=\"$netif\"" |
|
- echo "NAME=\"$ethname\"" |
|
- } >> /tmp/ifcfg/ifcfg-$ethname |
|
- fi |
|
+ echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\"" |
|
+ echo "SLAVE=yes" |
|
+ echo "MASTER=\"$bridgename\"" |
|
+ echo "NAME=\"$slave\"" |
|
+ echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\"" |
|
+ } >> /tmp/ifcfg/ifcfg-$slave |
|
+ done |
|
fi |
|
i=1 |
|
for ns in $(getargs nameserver); do
|
|
|