|
Harald Hoyer |
b38677 |
From 24a78b269745b0b16a2bdc03c35015b2cb9d0408 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
b38677 |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
b38677 |
Date: Tue, 19 Jan 2016 11:34:10 +0100
|
|
Harald Hoyer |
b38677 |
Subject: [PATCH] Fixed vlan, bonding, bridging, team logic
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
Call ifup for the slaves and assemble afterwards.
|
|
Harald Hoyer |
b38677 |
---
|
|
Harald Hoyer |
b38677 |
modules.d/40network/ifup.sh | 364 ++++++++++++++++++------------------
|
|
Harald Hoyer |
b38677 |
modules.d/40network/net-genrules.sh | 26 ++-
|
|
Harald Hoyer |
b38677 |
modules.d/40network/parse-bond.sh | 25 +--
|
|
Harald Hoyer |
b38677 |
modules.d/40network/parse-bridge.sh | 28 +--
|
|
Harald Hoyer |
b38677 |
modules.d/40network/parse-team.sh | 26 +--
|
|
Harald Hoyer |
b38677 |
modules.d/40network/parse-vlan.sh | 4 +-
|
|
Harald Hoyer |
b38677 |
modules.d/45ifcfg/write-ifcfg.sh | 21 +--
|
|
Harald Hoyer |
b38677 |
test/TEST-20-NFS/test.sh | 4 +-
|
|
Harald Hoyer |
b38677 |
test/TEST-30-ISCSI/test.sh | 4 +-
|
|
Harald Hoyer |
b38677 |
test/TEST-50-MULTINIC/test.sh | 17 +-
|
|
Harald Hoyer |
b38677 |
10 files changed, 249 insertions(+), 270 deletions(-)
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
|
|
Harald Hoyer |
b38677 |
index eca7478..14ca86d 100755
|
|
Harald Hoyer |
b38677 |
--- a/modules.d/40network/ifup.sh
|
|
Harald Hoyer |
b38677 |
+++ b/modules.d/40network/ifup.sh
|
|
Harald Hoyer |
b38677 |
@@ -15,76 +15,12 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
# $netif reads easier than $1
|
|
Harald Hoyer |
b38677 |
netif=$1
|
|
Harald Hoyer |
b38677 |
-use_bridge='false'
|
|
Harald Hoyer |
b38677 |
-use_vlan='false'
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-# enslave this interface to bond?
|
|
Harald Hoyer |
b38677 |
-for i in /tmp/bond.*.info; do
|
|
Harald Hoyer |
b38677 |
- [ -e "$i" ] || continue
|
|
Harald Hoyer |
b38677 |
- unset bondslaves
|
|
Harald Hoyer |
b38677 |
- unset bondname
|
|
Harald Hoyer |
b38677 |
- . "$i"
|
|
Harald Hoyer |
b38677 |
- for slave in $bondslaves ; do
|
|
Harald Hoyer |
b38677 |
- if [ "$netif" = "$slave" ] ; then
|
|
Harald Hoyer |
b38677 |
- netif=$bondname
|
|
Harald Hoyer |
b38677 |
- break 2
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
- done
|
|
Harald Hoyer |
b38677 |
-done
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
-if [ -e /tmp/team.info ]; then
|
|
Harald Hoyer |
b38677 |
- . /tmp/team.info
|
|
Harald Hoyer |
b38677 |
- for slave in $teamslaves ; do
|
|
Harald Hoyer |
b38677 |
- if [ "$netif" = "$slave" ] ; then
|
|
Harald Hoyer |
b38677 |
- netif=$teammaster
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
- done
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
-if [ -e /tmp/vlan.info ]; then
|
|
Harald Hoyer |
b38677 |
- . /tmp/vlan.info
|
|
Harald Hoyer |
b38677 |
- if [ "$netif" = "$phydevice" ]; then
|
|
Harald Hoyer |
b38677 |
- if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
|
Harald Hoyer |
b38677 |
- : # We need to really setup bond (recursive call)
|
|
Harald Hoyer |
b38677 |
- elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
|
Harald Hoyer |
b38677 |
- : # We need to really setup team (recursive call)
|
|
Harald Hoyer |
b38677 |
- else
|
|
Harald Hoyer |
b38677 |
- netif="$vlanname"
|
|
Harald Hoyer |
b38677 |
- use_vlan='true'
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
-# bridge this interface?
|
|
Harald Hoyer |
b38677 |
-if [ -e /tmp/bridge.info ]; then
|
|
Harald Hoyer |
b38677 |
- . /tmp/bridge.info
|
|
Harald Hoyer |
b38677 |
- for ethname in $bridgeslaves ; do
|
|
Harald Hoyer |
b38677 |
- if [ "$netif" = "$ethname" ]; then
|
|
Harald Hoyer |
b38677 |
- if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
|
Harald Hoyer |
b38677 |
- : # We need to really setup bond (recursive call)
|
|
Harald Hoyer |
b38677 |
- elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
|
Harald Hoyer |
b38677 |
- : # We need to really setup team (recursive call)
|
|
Harald Hoyer |
b38677 |
- elif [ "$netif" = "$vlanname" ] && [ -n "$DO_VLAN_SETUP" ]; then
|
|
Harald Hoyer |
b38677 |
- : # We need to really setup vlan (recursive call)
|
|
Harald Hoyer |
b38677 |
- else
|
|
Harald Hoyer |
b38677 |
- netif="$bridgename"
|
|
Harald Hoyer |
b38677 |
- use_bridge='true'
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
- done
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
-# disable manual ifup while netroot is set for simplifying our logic
|
|
Harald Hoyer |
b38677 |
-# in netroot case we prefer netroot to bringup $netif automaticlly
|
|
Harald Hoyer |
b38677 |
-[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
-if [ -n "$manualup" ]; then
|
|
Harald Hoyer |
b38677 |
- >/tmp/net.$netif.manualup
|
|
Harald Hoyer |
b38677 |
- rm -f /tmp/net.${netif}.did-setup
|
|
Harald Hoyer |
b38677 |
-else
|
|
Harald Hoyer |
b38677 |
- [ -e /tmp/net.${netif}.did-setup ] && exit 0
|
|
Harald Hoyer |
b38677 |
- [ -e /sys/class/net/$netif/address ] && \
|
|
Harald Hoyer |
b38677 |
- [ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
|
|
Harald Hoyer |
b38677 |
+# loopback is always handled the same way
|
|
Harald Hoyer |
b38677 |
+if [ "$netif" = "lo" ] ; then
|
|
Harald Hoyer |
b38677 |
+ ip link set lo up
|
|
Harald Hoyer |
b38677 |
+ ip addr add 127.0.0.1/8 dev lo
|
|
Harald Hoyer |
b38677 |
+ exit 0
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
# Run dhclient
|
|
Harald Hoyer |
b38677 |
@@ -188,134 +124,203 @@ do_static() {
|
|
Harald Hoyer |
b38677 |
return 0
|
|
Harald Hoyer |
b38677 |
}
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-# loopback is always handled the same way
|
|
Harald Hoyer |
b38677 |
-if [ "$netif" = "lo" ] ; then
|
|
Harald Hoyer |
b38677 |
- ip link set lo up
|
|
Harald Hoyer |
b38677 |
- ip addr add 127.0.0.1/8 dev lo
|
|
Harald Hoyer |
b38677 |
+get_vid() {
|
|
Harald Hoyer |
b38677 |
+ case "$1" in
|
|
Harald Hoyer |
b38677 |
+ vlan*)
|
|
Harald Hoyer |
b38677 |
+ echo ${1#vlan}
|
|
Harald Hoyer |
b38677 |
+ ;;
|
|
Harald Hoyer |
b38677 |
+ *.*)
|
|
Harald Hoyer |
b38677 |
+ echo ${1##*.}
|
|
Harald Hoyer |
b38677 |
+ ;;
|
|
Harald Hoyer |
b38677 |
+ esac
|
|
Harald Hoyer |
b38677 |
+}
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+# check, if we need VLAN's for this interface
|
|
Harald Hoyer |
b38677 |
+if [ -z "$DO_VLAN_PHY" ] && [ -e /tmp/vlan.${netif}.phy ]; then
|
|
Harald Hoyer |
b38677 |
+ NO_AUTO_DHCP=yes DO_VLAN_PHY=yes ifup "$netif"
|
|
Harald Hoyer |
b38677 |
+ modprobe -b -q 8021q
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ for i in /tmp/vlan.*.${netif}; do
|
|
Harald Hoyer |
b38677 |
+ [ -e "$i" ] || continue
|
|
Harald Hoyer |
b38677 |
+ read vlanname < "$i"
|
|
Harald Hoyer |
b38677 |
+ if [ -n "$vlanname" ]; then
|
|
Harald Hoyer |
b38677 |
+ linkup "$phydevice"
|
|
Harald Hoyer |
b38677 |
+ ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
|
|
Harald Hoyer |
b38677 |
+ ifup "$vlanname"
|
|
Harald Hoyer |
b38677 |
+ fi
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
exit 0
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-# start bond if needed
|
|
Harald Hoyer |
b38677 |
-if [ -e /tmp/bond.${netif}.info ]; then
|
|
Harald Hoyer |
b38677 |
- . /tmp/bond.${netif}.info
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
- if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
|
|
Harald Hoyer |
b38677 |
- modprobe bonding
|
|
Harald Hoyer |
b38677 |
- echo "+$netif" > /sys/class/net/bonding_masters
|
|
Harald Hoyer |
b38677 |
- ip link set $netif down
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
- # Stolen from ifup-eth
|
|
Harald Hoyer |
b38677 |
- # add the bits to setup driver parameters here
|
|
Harald Hoyer |
b38677 |
- for arg in $bondoptions ; do
|
|
Harald Hoyer |
b38677 |
- key=${arg%%=*};
|
|
Harald Hoyer |
b38677 |
- value=${arg##*=};
|
|
Harald Hoyer |
b38677 |
- # %{value:0:1} is replaced with non-bash specific construct
|
|
Harald Hoyer |
b38677 |
- if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
|
|
Harald Hoyer |
b38677 |
- OLDIFS=$IFS;
|
|
Harald Hoyer |
b38677 |
- IFS=',';
|
|
Harald Hoyer |
b38677 |
- for arp_ip in $value; do
|
|
Harald Hoyer |
b38677 |
- echo +$arp_ip > /sys/class/net/${netif}/bonding/$key
|
|
Harald Hoyer |
b38677 |
- done
|
|
Harald Hoyer |
b38677 |
- IFS=$OLDIFS;
|
|
Harald Hoyer |
b38677 |
- else
|
|
Harald Hoyer |
b38677 |
- echo $value > /sys/class/net/${netif}/bonding/$key
|
|
Harald Hoyer |
b38677 |
+# bridge this interface?
|
|
Harald Hoyer |
b38677 |
+if [ -z "$NO_BRIDGE_MASTER" ]; then
|
|
Harald Hoyer |
b38677 |
+ for i in /tmp/bridge.*.info; do
|
|
Harald Hoyer |
b38677 |
+ [ -e "$i" ] || continue
|
|
Harald Hoyer |
b38677 |
+ unset bridgeslaves
|
|
Harald Hoyer |
b38677 |
+ unset bridgename
|
|
Harald Hoyer |
b38677 |
+ . "$i"
|
|
Harald Hoyer |
b38677 |
+ for ethname in $bridgeslaves ; do
|
|
Harald Hoyer |
b38677 |
+ [ "$netif" != "$ethname" ] && continue
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ NO_BRIDGE_MASTER=yes NO_AUTO_DHCP=yes ifup $ethname
|
|
Harald Hoyer |
b38677 |
+ linkup $ethname
|
|
Harald Hoyer |
b38677 |
+ if [ ! -e /tmp/bridge.$bridgename.up ]; then
|
|
Harald Hoyer |
b38677 |
+ brctl addbr $bridgename
|
|
Harald Hoyer |
b38677 |
+ brctl setfd $bridgename 0
|
|
Harald Hoyer |
b38677 |
+ > /tmp/bridge.$bridgename.up
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
+ brctl addif $bridgename $ethname
|
|
Harald Hoyer |
b38677 |
+ ifup $bridgename
|
|
Harald Hoyer |
b38677 |
+ exit 0
|
|
Harald Hoyer |
b38677 |
done
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
+fi
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
- linkup $netif
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
+# enslave this interface to bond?
|
|
Harald Hoyer |
b38677 |
+if [ -z "$NO_BOND_MASTER" ]; then
|
|
Harald Hoyer |
b38677 |
+ for i in /tmp/bond.*.info; do
|
|
Harald Hoyer |
b38677 |
+ [ -e "$i" ] || continue
|
|
Harald Hoyer |
b38677 |
+ unset bondslaves
|
|
Harald Hoyer |
b38677 |
+ unset bondname
|
|
Harald Hoyer |
b38677 |
+ . "$i"
|
|
Harald Hoyer |
b38677 |
for slave in $bondslaves ; do
|
|
Harald Hoyer |
b38677 |
- ip link set $slave down
|
|
Harald Hoyer |
b38677 |
- cat /sys/class/net/$slave/address > /tmp/net.${netif}.${slave}.hwaddr
|
|
Harald Hoyer |
b38677 |
- echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
|
|
Harald Hoyer |
b38677 |
- linkup $slave
|
|
Harald Hoyer |
b38677 |
- done
|
|
Harald Hoyer |
b38677 |
+ [ "$netif" != "$slave" ] && continue
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
- # add the bits to setup the needed post enslavement parameters
|
|
Harald Hoyer |
b38677 |
- for arg in $BONDING_OPTS ; do
|
|
Harald Hoyer |
b38677 |
- key=${arg%%=*};
|
|
Harald Hoyer |
b38677 |
- value=${arg##*=};
|
|
Harald Hoyer |
b38677 |
- if [ "${key}" = "primary" ]; then
|
|
Harald Hoyer |
b38677 |
- echo $value > /sys/class/net/${netif}/bonding/$key
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
+ # already setup
|
|
Harald Hoyer |
b38677 |
+ [ -e /tmp/bond.$bondname.up ] && exit 0
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ # wait for all slaves to show up
|
|
Harald Hoyer |
b38677 |
+ for slave in $bondslaves ; do
|
|
Harald Hoyer |
b38677 |
+ # try to create the slave (maybe vlan or bridge)
|
|
Harald Hoyer |
b38677 |
+ NO_BOND_MASTER=yes NO_AUTO_DHCP=yes ifup $slave
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ if ! ip link show dev $slave >/dev/null 2>&1; then
|
|
Harald Hoyer |
b38677 |
+ # wait for the last slave to show up
|
|
Harald Hoyer |
b38677 |
+ exit 0
|
|
Harald Hoyer |
b38677 |
+ fi
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ modprobe -q -b bonding
|
|
Harald Hoyer |
b38677 |
+ echo "+$bondname" > /sys/class/net/bonding_masters 2>/dev/null
|
|
Harald Hoyer |
b38677 |
+ ip link set $bondname down
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ # Stolen from ifup-eth
|
|
Harald Hoyer |
b38677 |
+ # add the bits to setup driver parameters here
|
|
Harald Hoyer |
b38677 |
+ for arg in $bondoptions ; do
|
|
Harald Hoyer |
b38677 |
+ key=${arg%%=*};
|
|
Harald Hoyer |
b38677 |
+ value=${arg##*=};
|
|
Harald Hoyer |
b38677 |
+ # %{value:0:1} is replaced with non-bash specific construct
|
|
Harald Hoyer |
b38677 |
+ if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
|
|
Harald Hoyer |
b38677 |
+ OLDIFS=$IFS;
|
|
Harald Hoyer |
b38677 |
+ IFS=',';
|
|
Harald Hoyer |
b38677 |
+ for arp_ip in $value; do
|
|
Harald Hoyer |
b38677 |
+ echo +$arp_ip > /sys/class/net/${bondname}/bonding/$key
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
+ IFS=$OLDIFS;
|
|
Harald Hoyer |
b38677 |
+ else
|
|
Harald Hoyer |
b38677 |
+ echo $value > /sys/class/net/${bondname}/bonding/$key
|
|
Harald Hoyer |
b38677 |
+ fi
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ linkup $bondname
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ for slave in $bondslaves ; do
|
|
Harald Hoyer |
b38677 |
+ cat /sys/class/net/$slave/address > /tmp/net.${bondname}.${slave}.hwaddr
|
|
Harald Hoyer |
b38677 |
+ ip link set $slave down
|
|
Harald Hoyer |
b38677 |
+ echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
|
|
Harald Hoyer |
b38677 |
+ linkup $slave
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ # add the bits to setup the needed post enslavement parameters
|
|
Harald Hoyer |
b38677 |
+ for arg in $bondoptions ; do
|
|
Harald Hoyer |
b38677 |
+ key=${arg%%=*};
|
|
Harald Hoyer |
b38677 |
+ value=${arg##*=};
|
|
Harald Hoyer |
b38677 |
+ if [ "${key}" = "primary" ]; then
|
|
Harald Hoyer |
b38677 |
+ echo $value > /sys/class/net/${bondname}/bonding/$key
|
|
Harald Hoyer |
b38677 |
+ fi
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ > /tmp/bond.$bondname.up
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ NO_BOND_MASTER=yes ifup $bondname
|
|
Harald Hoyer |
b38677 |
+ exit $?
|
|
Harald Hoyer |
b38677 |
done
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-if [ -e /tmp/team.info ]; then
|
|
Harald Hoyer |
b38677 |
- . /tmp/team.info
|
|
Harald Hoyer |
b38677 |
- if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.up ] ; then
|
|
Harald Hoyer |
b38677 |
- # We shall only bring up those _can_ come up
|
|
Harald Hoyer |
b38677 |
- # in case of some slave is gone in active-backup mode
|
|
Harald Hoyer |
b38677 |
- working_slaves=""
|
|
Harald Hoyer |
b38677 |
+if [ -z "$NO_TEAM_MASTER" ]; then
|
|
Harald Hoyer |
b38677 |
+ for i in /tmp/team.*.info; do
|
|
Harald Hoyer |
b38677 |
+ [ -e "$i" ] || continue
|
|
Harald Hoyer |
b38677 |
+ unset teammaster
|
|
Harald Hoyer |
b38677 |
+ unset teamslaves
|
|
Harald Hoyer |
b38677 |
+ . "$i"
|
|
Harald Hoyer |
b38677 |
for slave in $teamslaves ; do
|
|
Harald Hoyer |
b38677 |
- ip link set $slave up 2>/dev/null
|
|
Harald Hoyer |
b38677 |
- if wait_for_if_up $slave; then
|
|
Harald Hoyer |
b38677 |
- working_slaves+="$slave "
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
- done
|
|
Harald Hoyer |
b38677 |
- # Do not add slaves now
|
|
Harald Hoyer |
b38677 |
- teamd -d -U -n -N -t $teammaster -f /etc/teamd/$teammaster.conf
|
|
Harald Hoyer |
b38677 |
- for slave in $working_slaves; do
|
|
Harald Hoyer |
b38677 |
- # team requires the slaves to be down before joining team
|
|
Harald Hoyer |
b38677 |
- ip link set $slave down
|
|
Harald Hoyer |
b38677 |
- teamdctl $teammaster port add $slave
|
|
Harald Hoyer |
b38677 |
- done
|
|
Harald Hoyer |
b38677 |
- ip link set $teammaster up
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
+ [ "$netif" != "$slave" ] && continue
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-# XXX need error handling like dhclient-script
|
|
Harald Hoyer |
b38677 |
+ [ -e /tmp/team.$teammaster.up ] && exit 0
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-if [ -e /tmp/bridge.info ]; then
|
|
Harald Hoyer |
b38677 |
- . /tmp/bridge.info
|
|
Harald Hoyer |
b38677 |
-# start bridge if necessary
|
|
Harald Hoyer |
b38677 |
- if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
|
Harald Hoyer |
b38677 |
- brctl addbr $bridgename
|
|
Harald Hoyer |
b38677 |
- brctl setfd $bridgename 0
|
|
Harald Hoyer |
b38677 |
- for ethname in $bridgeslaves ; do
|
|
Harald Hoyer |
b38677 |
- if [ "$ethname" = "$bondname" ] ; then
|
|
Harald Hoyer |
b38677 |
- DO_BOND_SETUP=yes ifup $bondname -m
|
|
Harald Hoyer |
b38677 |
- elif [ "$ethname" = "$teammaster" ] ; then
|
|
Harald Hoyer |
b38677 |
- DO_TEAM_SETUP=yes ifup $teammaster -m
|
|
Harald Hoyer |
b38677 |
- elif [ "$ethname" = "$vlanname" ]; then
|
|
Harald Hoyer |
b38677 |
- DO_VLAN_SETUP=yes ifup $vlanname -m
|
|
Harald Hoyer |
b38677 |
- else
|
|
Harald Hoyer |
b38677 |
- linkup $ethname
|
|
Harald Hoyer |
b38677 |
+ # wait for all slaves to show up
|
|
Harald Hoyer |
b38677 |
+ for slave in $teamslaves ; do
|
|
Harald Hoyer |
b38677 |
+ # try to create the slave (maybe vlan or bridge)
|
|
Harald Hoyer |
b38677 |
+ NO_BOND_MASTER=yes NO_AUTO_DHCP=yes ifup $slave
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ if ! ip link show dev $slave >/dev/null 2>&1; then
|
|
Harald Hoyer |
b38677 |
+ # wait for the last slave to show up
|
|
Harald Hoyer |
b38677 |
+ exit 0
|
|
Harald Hoyer |
b38677 |
+ fi
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ if [ ! -e /tmp/team.$teammaster.up ] ; then
|
|
Harald Hoyer |
b38677 |
+ # We shall only bring up those _can_ come up
|
|
Harald Hoyer |
b38677 |
+ # in case of some slave is gone in active-backup mode
|
|
Harald Hoyer |
b38677 |
+ working_slaves=""
|
|
Harald Hoyer |
b38677 |
+ for slave in $teamslaves ; do
|
|
Harald Hoyer |
b38677 |
+ ip link set $slave up 2>/dev/null
|
|
Harald Hoyer |
b38677 |
+ if wait_for_if_up $slave; then
|
|
Harald Hoyer |
b38677 |
+ working_slaves+="$slave "
|
|
Harald Hoyer |
b38677 |
+ fi
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
+ # Do not add slaves now
|
|
Harald Hoyer |
b38677 |
+ teamd -d -U -n -N -t $teammaster -f /etc/teamd/$teammaster.conf
|
|
Harald Hoyer |
b38677 |
+ for slave in $working_slaves; do
|
|
Harald Hoyer |
b38677 |
+ # team requires the slaves to be down before joining team
|
|
Harald Hoyer |
b38677 |
+ ip link set $slave down
|
|
Harald Hoyer |
b38677 |
+ teamdctl $teammaster port add $slave
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ ip link set $teammaster up
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ > /tmp/team.$teammaster.up
|
|
Harald Hoyer |
b38677 |
+ NO_TEAM_MASTER=yes ifup $teammaster
|
|
Harald Hoyer |
b38677 |
+ exit $?
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
- brctl addif $bridgename $ethname
|
|
Harald Hoyer |
b38677 |
done
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-get_vid() {
|
|
Harald Hoyer |
b38677 |
- case "$1" in
|
|
Harald Hoyer |
b38677 |
- vlan*)
|
|
Harald Hoyer |
b38677 |
- echo ${1#vlan}
|
|
Harald Hoyer |
b38677 |
- ;;
|
|
Harald Hoyer |
b38677 |
- *.*)
|
|
Harald Hoyer |
b38677 |
- echo ${1##*.}
|
|
Harald Hoyer |
b38677 |
- ;;
|
|
Harald Hoyer |
b38677 |
- esac
|
|
Harald Hoyer |
b38677 |
-}
|
|
Harald Hoyer |
b38677 |
+# all synthetic interfaces done.. now check if the interface is available
|
|
Harald Hoyer |
b38677 |
+if ! ip link show dev $netif >/dev/null 2>&1; then
|
|
Harald Hoyer |
b38677 |
+ exit 1
|
|
Harald Hoyer |
b38677 |
+fi
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
|
|
Harald Hoyer |
b38677 |
- modprobe 8021q
|
|
Harald Hoyer |
b38677 |
- if [ "$phydevice" = "$bondname" ] ; then
|
|
Harald Hoyer |
b38677 |
- DO_BOND_SETUP=yes ifup $phydevice -m
|
|
Harald Hoyer |
b38677 |
- elif [ "$phydevice" = "$teammaster" ] ; then
|
|
Harald Hoyer |
b38677 |
- DO_TEAM_SETUP=yes ifup $phydevice -m
|
|
Harald Hoyer |
b38677 |
- else
|
|
Harald Hoyer |
b38677 |
- linkup "$phydevice"
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
- ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
|
|
Harald Hoyer |
b38677 |
- ip link set "$vlanname" up
|
|
Harald Hoyer |
b38677 |
+# disable manual ifup while netroot is set for simplifying our logic
|
|
Harald Hoyer |
b38677 |
+# in netroot case we prefer netroot to bringup $netif automaticlly
|
|
Harald Hoyer |
b38677 |
+[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+if [ -n "$manualup" ]; then
|
|
Harald Hoyer |
b38677 |
+ >/tmp/net.$netif.manualup
|
|
Harald Hoyer |
b38677 |
+ rm -f /tmp/net.${netif}.did-setup
|
|
Harald Hoyer |
b38677 |
+else
|
|
Harald Hoyer |
b38677 |
+ [ -e /tmp/net.${netif}.did-setup ] && exit 0
|
|
Harald Hoyer |
b38677 |
+ [ -e /sys/class/net/$netif/address ] && \
|
|
Harald Hoyer |
b38677 |
+ [ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
# No ip lines default to dhcp
|
|
Harald Hoyer |
b38677 |
ip=$(getarg ip)
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-if [ -z "$ip" ]; then
|
|
Harald Hoyer |
b38677 |
+if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then
|
|
Harald Hoyer |
b38677 |
for s in $(getargs nameserver); do
|
|
Harald Hoyer |
b38677 |
[ -n "$s" ] || continue
|
|
Harald Hoyer |
b38677 |
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
|
Harald Hoyer |
b38677 |
@@ -348,9 +353,7 @@ for p in $(getargs ip=); do
|
|
Harald Hoyer |
b38677 |
esac
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
# If this option isn't directed at our interface, skip it
|
|
Harald Hoyer |
b38677 |
- [ -n "$dev" ] && [ "$dev" != "$netif" ] && \
|
|
Harald Hoyer |
b38677 |
- [ "$use_bridge" != 'true' ] && \
|
|
Harald Hoyer |
b38677 |
- [ "$use_vlan" != 'true' ] && continue
|
|
Harald Hoyer |
b38677 |
+ [ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
# setup nameserver
|
|
Harald Hoyer |
b38677 |
for s in "$dns1" "$dns2" $(getargs nameserver); do
|
|
Harald Hoyer |
b38677 |
@@ -402,15 +405,8 @@ for p in $(getargs ip=); do
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
done
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-# netif isn't the top stack? Then we should exit here.
|
|
Harald Hoyer |
b38677 |
-# eg. netif is bond0. br0 is on top of it. dhcp br0 is correct but dhcp
|
|
Harald Hoyer |
b38677 |
-# bond0 doesn't make sense.
|
|
Harald Hoyer |
b38677 |
-if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then
|
|
Harald Hoyer |
b38677 |
- exit 0
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
# no ip option directed at our interface?
|
|
Harald Hoyer |
b38677 |
-if [ ! -e /tmp/net.${netif}.up ]; then
|
|
Harald Hoyer |
b38677 |
+if [ -z "$NO_AUTO_DHCP" ] && [ ! -e /tmp/net.${netif}.up ]; then
|
|
Harald Hoyer |
b38677 |
if [ -e /tmp/net.bootdev ]; then
|
|
Harald Hoyer |
b38677 |
BOOTDEV=$(cat /tmp/net.bootdev)
|
|
Harald Hoyer |
b38677 |
if [ "$netif" = "$BOOTDEV" ] || [ "$BOOTDEV" = "$(cat /sys/class/net/${netif}/address)" ]; then
|
|
Harald Hoyer |
b38677 |
diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh
|
|
Harald Hoyer |
b38677 |
index b1c156c..5df50bd 100755
|
|
Harald Hoyer |
b38677 |
--- a/modules.d/40network/net-genrules.sh
|
|
Harald Hoyer |
b38677 |
+++ b/modules.d/40network/net-genrules.sh
|
|
Harald Hoyer |
b38677 |
@@ -12,11 +12,14 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
|
Harald Hoyer |
b38677 |
# Write udev rules
|
|
Harald Hoyer |
b38677 |
{
|
|
Harald Hoyer |
b38677 |
# bridge: attempt only the defined interface
|
|
Harald Hoyer |
b38677 |
- if [ -e /tmp/bridge.info ]; then
|
|
Harald Hoyer |
b38677 |
- . /tmp/bridge.info
|
|
Harald Hoyer |
b38677 |
+ for i in /tmp/bridge.*.info; do
|
|
Harald Hoyer |
b38677 |
+ [ -e "$i" ] || continue
|
|
Harald Hoyer |
b38677 |
+ unset bridgeslaves
|
|
Harald Hoyer |
b38677 |
+ unset bridgename
|
|
Harald Hoyer |
b38677 |
+ . "$i"
|
|
Harald Hoyer |
b38677 |
IFACES="$IFACES ${bridgeslaves%% *}"
|
|
Harald Hoyer |
b38677 |
MASTER_IFACES="$MASTER_IFACES $bridgename"
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
# bond: attempt only the defined interface (override bridge defines)
|
|
Harald Hoyer |
b38677 |
for i in /tmp/bond.*.info; do
|
|
Harald Hoyer |
b38677 |
@@ -35,11 +38,18 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
|
Harald Hoyer |
b38677 |
MASTER_IFACES="$MASTER_IFACES ${teammaster}"
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
- if [ -e /tmp/vlan.info ]; then
|
|
Harald Hoyer |
b38677 |
- . /tmp/vlan.info
|
|
Harald Hoyer |
b38677 |
- IFACES="$IFACES $phydevice"
|
|
Harald Hoyer |
b38677 |
- MASTER_IFACES="$MASTER_IFACES ${vlanname}"
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
+ for j in /tmp/vlan.*.phy; do
|
|
Harald Hoyer |
b38677 |
+ [ -e "$j" ] || continue
|
|
Harald Hoyer |
b38677 |
+ unset phydevice
|
|
Harald Hoyer |
b38677 |
+ . "$j"
|
|
Harald Hoyer |
b38677 |
+ for i in /tmp/vlan.*.${phydevice}; do
|
|
Harald Hoyer |
b38677 |
+ [ -e "$i" ] || continue
|
|
Harald Hoyer |
b38677 |
+ unset vlanname
|
|
Harald Hoyer |
b38677 |
+ . "$i"
|
|
Harald Hoyer |
b38677 |
+ IFACES="$IFACES $phydevice"
|
|
Harald Hoyer |
b38677 |
+ MASTER_IFACES="$MASTER_IFACES ${vlanname}"
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
if [ -z "$IFACES" ]; then
|
|
Harald Hoyer |
b38677 |
[ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
|
|
Harald Hoyer |
b38677 |
diff --git a/modules.d/40network/parse-bond.sh b/modules.d/40network/parse-bond.sh
|
|
Harald Hoyer |
b38677 |
index 25c51b8..80b3b07 100755
|
|
Harald Hoyer |
b38677 |
--- a/modules.d/40network/parse-bond.sh
|
|
Harald Hoyer |
b38677 |
+++ b/modules.d/40network/parse-bond.sh
|
|
Harald Hoyer |
b38677 |
@@ -10,14 +10,6 @@
|
|
Harald Hoyer |
b38677 |
# bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
|
|
Harald Hoyer |
b38677 |
#
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-# return if bond already parsed
|
|
Harald Hoyer |
b38677 |
-[ -n "$bondname" ] && return
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
-# Check if bond parameter is valid
|
|
Harald Hoyer |
b38677 |
-if getarg bond= >/dev/null ; then
|
|
Harald Hoyer |
b38677 |
- :
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
# We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
|
|
Harald Hoyer |
b38677 |
# Ditto for bonding options
|
|
Harald Hoyer |
b38677 |
parsebond() {
|
|
Harald Hoyer |
b38677 |
@@ -28,7 +20,6 @@ parsebond() {
|
|
Harald Hoyer |
b38677 |
v=${v#*:}
|
|
Harald Hoyer |
b38677 |
done
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
- unset bondname bondslaves bondoptions
|
|
Harald Hoyer |
b38677 |
case $# in
|
|
Harald Hoyer |
b38677 |
0) bondname=bond0; bondslaves="eth0 eth1" ;;
|
|
Harald Hoyer |
b38677 |
1) bondname=$1; bondslaves="eth0 eth1" ;;
|
|
Harald Hoyer |
b38677 |
@@ -38,14 +29,13 @@ parsebond() {
|
|
Harald Hoyer |
b38677 |
esac
|
|
Harald Hoyer |
b38677 |
}
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-unset bondname bondslaves bondoptions
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
# Parse bond for bondname, bondslaves, bondmode and bondoptions
|
|
Harald Hoyer |
b38677 |
-if getarg bond >/dev/null; then
|
|
Harald Hoyer |
b38677 |
- # Read bond= parameters if they exist
|
|
Harald Hoyer |
b38677 |
- bond="$(getarg bond=)"
|
|
Harald Hoyer |
b38677 |
- if [ ! "$bond" = "bond" ]; then
|
|
Harald Hoyer |
b38677 |
- parsebond "$(getarg bond=)"
|
|
Harald Hoyer |
b38677 |
+for bond in $(getargs bond=); do
|
|
Harald Hoyer |
b38677 |
+ unset bondname
|
|
Harald Hoyer |
b38677 |
+ unset bondslaves
|
|
Harald Hoyer |
b38677 |
+ unset bondoptions
|
|
Harald Hoyer |
b38677 |
+ if [ "$bond" != "bond" ]; then
|
|
Harald Hoyer |
b38677 |
+ parsebond "$bond"
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
# Simple default bond
|
|
Harald Hoyer |
b38677 |
if [ -z "$bondname" ]; then
|
|
Harald Hoyer |
b38677 |
@@ -57,5 +47,4 @@ if getarg bond >/dev/null; then
|
|
Harald Hoyer |
b38677 |
echo "bondname=$bondname" > /tmp/bond.${bondname}.info
|
|
Harald Hoyer |
b38677 |
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info
|
|
Harald Hoyer |
b38677 |
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info
|
|
Harald Hoyer |
b38677 |
- return
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
+done
|
|
Harald Hoyer |
b38677 |
diff --git a/modules.d/40network/parse-bridge.sh b/modules.d/40network/parse-bridge.sh
|
|
Harald Hoyer |
b38677 |
index 212f259..5c3af29 100755
|
|
Harald Hoyer |
b38677 |
--- a/modules.d/40network/parse-bridge.sh
|
|
Harald Hoyer |
b38677 |
+++ b/modules.d/40network/parse-bridge.sh
|
|
Harald Hoyer |
b38677 |
@@ -7,14 +7,6 @@
|
|
Harald Hoyer |
b38677 |
# bridge without parameters assumes bridge=br0:eth0
|
|
Harald Hoyer |
b38677 |
#
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-# return if bridge already parsed
|
|
Harald Hoyer |
b38677 |
-[ -n "$bridgename" ] && return
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
-# Check if bridge parameter is valid
|
|
Harald Hoyer |
b38677 |
-if getarg bridge= >/dev/null ; then
|
|
Harald Hoyer |
b38677 |
- command -v brctl >/dev/null 2>&1 || die "No 'brctl' installed"
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
parsebridge() {
|
|
Harald Hoyer |
b38677 |
local v=${1}:
|
|
Harald Hoyer |
b38677 |
set --
|
|
Harald Hoyer |
b38677 |
@@ -22,8 +14,6 @@ parsebridge() {
|
|
Harald Hoyer |
b38677 |
set -- "$@" "${v%%:*}"
|
|
Harald Hoyer |
b38677 |
v=${v#*:}
|
|
Harald Hoyer |
b38677 |
done
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
- unset bridgename bridgeslaves
|
|
Harald Hoyer |
b38677 |
case $# in
|
|
Harald Hoyer |
b38677 |
0) bridgename=br0; bridgeslaves=$iface ;;
|
|
Harald Hoyer |
b38677 |
1) die "bridge= requires two parameters" ;;
|
|
Harald Hoyer |
b38677 |
@@ -32,14 +22,13 @@ parsebridge() {
|
|
Harald Hoyer |
b38677 |
esac
|
|
Harald Hoyer |
b38677 |
}
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-unset bridgename bridgeslaves
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
-iface=eth0
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
# Parse bridge for bridgename and bridgeslaves
|
|
Harald Hoyer |
b38677 |
-if bridge="$(getarg bridge)"; then
|
|
Harald Hoyer |
b38677 |
+for bridge in $(getargs bridge=); do
|
|
Harald Hoyer |
b38677 |
+ unset bridgename
|
|
Harald Hoyer |
b38677 |
+ unset bridgeslaves
|
|
Harald Hoyer |
b38677 |
+ iface=eth0
|
|
Harald Hoyer |
b38677 |
# Read bridge= parameters if they exist
|
|
Harald Hoyer |
b38677 |
- if [ -n "$bridge" ]; then
|
|
Harald Hoyer |
b38677 |
+ if [ "$bridge" != "bridge" ]; then
|
|
Harald Hoyer |
b38677 |
parsebridge $bridge
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
# Simple default bridge
|
|
Harald Hoyer |
b38677 |
@@ -47,7 +36,6 @@ if bridge="$(getarg bridge)"; then
|
|
Harald Hoyer |
b38677 |
bridgename=br0
|
|
Harald Hoyer |
b38677 |
bridgeslaves=$iface
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
- echo "bridgename=$bridgename" > /tmp/bridge.info
|
|
Harald Hoyer |
b38677 |
- echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.info
|
|
Harald Hoyer |
b38677 |
- return
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
+ echo "bridgename=$bridgename" > /tmp/bridge.${bridgename}.info
|
|
Harald Hoyer |
b38677 |
+ echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.${bridgename}.info
|
|
Harald Hoyer |
b38677 |
+done
|
|
Harald Hoyer |
b38677 |
diff --git a/modules.d/40network/parse-team.sh b/modules.d/40network/parse-team.sh
|
|
Harald Hoyer |
b38677 |
index 318c0e1..cc5cba7 100755
|
|
Harald Hoyer |
b38677 |
--- a/modules.d/40network/parse-team.sh
|
|
Harald Hoyer |
b38677 |
+++ b/modules.d/40network/parse-team.sh
|
|
Harald Hoyer |
b38677 |
@@ -6,14 +6,6 @@
|
|
Harald Hoyer |
b38677 |
# teamslaves is a comma-separated list of physical (ethernet) interfaces
|
|
Harald Hoyer |
b38677 |
#
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-# return if team already parsed
|
|
Harald Hoyer |
b38677 |
-[ -n "$teammaster" ] && return
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
-# Check if team parameter is valid
|
|
Harald Hoyer |
b38677 |
-if getarg team= >/dev/null ; then
|
|
Harald Hoyer |
b38677 |
- :
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
parseteam() {
|
|
Harald Hoyer |
b38677 |
local v=${1}:
|
|
Harald Hoyer |
b38677 |
set --
|
|
Harald Hoyer |
b38677 |
@@ -22,23 +14,17 @@ parseteam() {
|
|
Harald Hoyer |
b38677 |
v=${v#*:}
|
|
Harald Hoyer |
b38677 |
done
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
- unset teammaster teamslaves
|
|
Harald Hoyer |
b38677 |
case $# in
|
|
Harald Hoyer |
b38677 |
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
|
|
Harald Hoyer |
b38677 |
*) die "team= requires two parameters" ;;
|
|
Harald Hoyer |
b38677 |
esac
|
|
Harald Hoyer |
b38677 |
}
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-unset teammaster teamslaves
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-if getarg team>/dev/null; then
|
|
Harald Hoyer |
b38677 |
- # Read team= parameters if they exist
|
|
Harald Hoyer |
b38677 |
- team="$(getarg team=)"
|
|
Harald Hoyer |
b38677 |
- if [ ! "$team" = "team" ]; then
|
|
Harald Hoyer |
b38677 |
- parseteam "$(getarg team=)"
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
+for team in $(getargs team=); do
|
|
Harald Hoyer |
b38677 |
+ unset teammaster teamslaves
|
|
Harald Hoyer |
b38677 |
+ parseteam "$(getarg team=)"
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
- echo "teammaster=$teammaster" > /tmp/team.info
|
|
Harald Hoyer |
b38677 |
- echo "teamslaves=\"$teamslaves\"" >> /tmp/team.info
|
|
Harald Hoyer |
b38677 |
- return
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
+ echo "teammaster=$teammaster" > /tmp/team.${teammaster}.info
|
|
Harald Hoyer |
b38677 |
+ echo "teamslaves=\"$teamslaves\"" >> /tmp/team.${teammaster}.info
|
|
Harald Hoyer |
b38677 |
+done
|
|
Harald Hoyer |
b38677 |
diff --git a/modules.d/40network/parse-vlan.sh b/modules.d/40network/parse-vlan.sh
|
|
Harald Hoyer |
b38677 |
index 3ba2289..b2a9c1c 100755
|
|
Harald Hoyer |
b38677 |
--- a/modules.d/40network/parse-vlan.sh
|
|
Harald Hoyer |
b38677 |
+++ b/modules.d/40network/parse-vlan.sh
|
|
Harald Hoyer |
b38677 |
@@ -36,7 +36,7 @@ if getarg vlan >/dev/null; then
|
|
Harald Hoyer |
b38677 |
parsevlan "$(getarg vlan=)"
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
- echo "vlanname=\"$vlanname\"" > /tmp/vlan.info
|
|
Harald Hoyer |
b38677 |
- echo "phydevice=\"$phydevice\"" >> /tmp/vlan.info
|
|
Harald Hoyer |
b38677 |
+ echo "$phydevice" > /tmp/vlan.${phydevice}.phy
|
|
Harald Hoyer |
b38677 |
+ echo "$vlanname" > /tmp/vlan.${vlanname}.${phydevice}
|
|
Harald Hoyer |
b38677 |
return
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
|
|
Harald Hoyer |
b38677 |
index 251d684..c3774ae 100755
|
|
Harald Hoyer |
b38677 |
--- a/modules.d/45ifcfg/write-ifcfg.sh
|
|
Harald Hoyer |
b38677 |
+++ b/modules.d/45ifcfg/write-ifcfg.sh
|
|
Harald Hoyer |
b38677 |
@@ -5,14 +5,6 @@ type is_persistent_ethernet_name >/dev/null 2>&1 || . /lib/net-lib.sh
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
udevadm settle --timeout=30
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
-if [ -e /tmp/bridge.info ]; then
|
|
Harald Hoyer |
b38677 |
- . /tmp/bridge.info
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
-if [ -e /tmp/vlan.info ]; then
|
|
Harald Hoyer |
b38677 |
- . /tmp/vlan.info
|
|
Harald Hoyer |
b38677 |
-fi
|
|
Harald Hoyer |
b38677 |
-
|
|
Harald Hoyer |
b38677 |
mkdir -m 0755 -p /tmp/ifcfg/
|
|
Harald Hoyer |
b38677 |
mkdir -m 0755 -p /tmp/ifcfg-leases/
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
@@ -129,6 +121,8 @@ for netup in /tmp/net.*.did-setup ; do
|
|
Harald Hoyer |
b38677 |
unset bondslaves
|
|
Harald Hoyer |
b38677 |
unset bondname
|
|
Harald Hoyer |
b38677 |
unset bondoptions
|
|
Harald Hoyer |
b38677 |
+ unset bridgename
|
|
Harald Hoyer |
b38677 |
+ unset bridgeslaves
|
|
Harald Hoyer |
b38677 |
unset uuid
|
|
Harald Hoyer |
b38677 |
unset ip
|
|
Harald Hoyer |
b38677 |
unset gw
|
|
Harald Hoyer |
b38677 |
@@ -140,17 +134,22 @@ for netup in /tmp/net.*.did-setup ; do
|
|
Harald Hoyer |
b38677 |
unset vlan
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
|
|
Harald Hoyer |
b38677 |
+ [ -e /tmp/bridge.${netif}.info ] && . /tmp/bridge.${netif}.info
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
uuid=$(cat /proc/sys/kernel/random/uuid)
|
|
Harald Hoyer |
b38677 |
if [ "$netif" = "$bridgename" ]; then
|
|
Harald Hoyer |
b38677 |
bridge=yes
|
|
Harald Hoyer |
b38677 |
elif [ "$netif" = "$bondname" ]; then
|
|
Harald Hoyer |
b38677 |
- # $netif can't be bridge and bond at the same time
|
|
Harald Hoyer |
b38677 |
+ # $netif can't be bridge and bond at the same time
|
|
Harald Hoyer |
b38677 |
bond=yes
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
- if [ "$netif" = "$vlanname" ]; then
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ for i in /tmp/vlan.${netif}.*; do
|
|
Harald Hoyer |
b38677 |
+ [ ! -e "$i" ] && continue
|
|
Harald Hoyer |
b38677 |
+ . "$i"
|
|
Harald Hoyer |
b38677 |
vlan=yes
|
|
Harald Hoyer |
b38677 |
- fi
|
|
Harald Hoyer |
b38677 |
+ break
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
{
|
|
Harald Hoyer |
b38677 |
echo "# Generated by dracut initrd"
|
|
Harald Hoyer |
b38677 |
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
|
|
Harald Hoyer |
b38677 |
index 61e4c1a..ceca1f0 100755
|
|
Harald Hoyer |
b38677 |
--- a/test/TEST-20-NFS/test.sh
|
|
Harald Hoyer |
b38677 |
+++ b/test/TEST-20-NFS/test.sh
|
|
Harald Hoyer |
b38677 |
@@ -16,8 +16,8 @@ run_server() {
|
|
Harald Hoyer |
b38677 |
-drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
|
|
Harald Hoyer |
b38677 |
-m 256M -smp 2 \
|
|
Harald Hoyer |
b38677 |
-display none \
|
|
Harald Hoyer |
b38677 |
- -net nic,macaddr=52:54:00:12:34:56,model=e1000 \
|
|
Harald Hoyer |
b38677 |
-net socket,listen=127.0.0.1:12320 \
|
|
Harald Hoyer |
b38677 |
+ -net nic,macaddr=52:54:00:12:34:56,model=e1000 \
|
|
Harald Hoyer |
b38677 |
-serial ${SERIAL:-null} \
|
|
Harald Hoyer |
b38677 |
-watchdog i6300esb -watchdog-action poweroff \
|
|
Harald Hoyer |
b38677 |
-append "rd.debug loglevel=77 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \
|
|
Harald Hoyer |
b38677 |
@@ -134,7 +134,7 @@ test_nfsv3() {
|
|
Harald Hoyer |
b38677 |
"root=nfs:192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
client_test "NFSv3 Bridge root=nfs:..." 52:54:00:12:34:04 \
|
|
Harald Hoyer |
b38677 |
- "root=nfs:192.168.50.1:/nfs/client bridge" 192.168.50.1 -wsize=4096 || return 1
|
|
Harald Hoyer |
b38677 |
+ "root=nfs:192.168.50.1:/nfs/client bridge net.ifnames=0" 192.168.50.1 -wsize=4096 || return 1
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
client_test "NFSv3 Legacy root=IP:path" 52:54:00:12:34:04 \
|
|
Harald Hoyer |
b38677 |
"root=192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
|
|
Harald Hoyer |
b38677 |
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
|
|
Harald Hoyer |
b38677 |
index fc4bdce..00c1fbd 100755
|
|
Harald Hoyer |
b38677 |
--- a/test/TEST-30-ISCSI/test.sh
|
|
Harald Hoyer |
b38677 |
+++ b/test/TEST-30-ISCSI/test.sh
|
|
Harald Hoyer |
b38677 |
@@ -85,7 +85,7 @@ do_test_run() {
|
|
Harald Hoyer |
b38677 |
"rd.iscsi.initiator=$initiator" \
|
|
Harald Hoyer |
b38677 |
|| return 1
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
- run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \
|
|
Harald Hoyer |
b38677 |
+ run_client "FAILME: netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \
|
|
Harald Hoyer |
b38677 |
"root=LABEL=sysroot" \
|
|
Harald Hoyer |
b38677 |
"ip=192.168.50.101:::255.255.255.0::ens3:off" \
|
|
Harald Hoyer |
b38677 |
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
|
|
Harald Hoyer |
b38677 |
@@ -94,7 +94,7 @@ do_test_run() {
|
|
Harald Hoyer |
b38677 |
"rd.iscsi.firmware" \
|
|
Harald Hoyer |
b38677 |
"rd.iscsi.initiator=$initiator" \
|
|
Harald Hoyer |
b38677 |
"rd.iscsi.waitnet=0" \
|
|
Harald Hoyer |
b38677 |
- || return 1
|
|
Harald Hoyer |
b38677 |
+ || return 0
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
|
|
Harald Hoyer |
b38677 |
"root=LABEL=sysroot" \
|
|
Harald Hoyer |
b38677 |
diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh
|
|
Harald Hoyer |
b38677 |
index fdeb840..484ebee 100755
|
|
Harald Hoyer |
b38677 |
--- a/test/TEST-50-MULTINIC/test.sh
|
|
Harald Hoyer |
b38677 |
+++ b/test/TEST-50-MULTINIC/test.sh
|
|
Harald Hoyer |
b38677 |
@@ -18,7 +18,7 @@ run_server() {
|
|
Harald Hoyer |
b38677 |
-display none \
|
|
Harald Hoyer |
b38677 |
-net socket,listen=127.0.0.1:12350 \
|
|
Harald Hoyer |
b38677 |
-net nic,macaddr=52:54:01:12:34:56,model=e1000 \
|
|
Harald Hoyer |
b38677 |
- ${SERIAL:+-serial "$SERIAL"} \
|
|
Harald Hoyer |
b38677 |
+ -serial ${SERIAL:-null} \
|
|
Harald Hoyer |
b38677 |
-watchdog i6300esb -watchdog-action poweroff \
|
|
Harald Hoyer |
b38677 |
-append "loglevel=7 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \
|
|
Harald Hoyer |
b38677 |
-initrd "$TESTDIR"/initramfs.server \
|
|
Harald Hoyer |
b38677 |
@@ -90,7 +90,10 @@ test_run() {
|
|
Harald Hoyer |
b38677 |
echo "Failed to start server" 1>&2
|
|
Harald Hoyer |
b38677 |
return 1
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
- test_client || { kill_server; return 1; }
|
|
Harald Hoyer |
b38677 |
+ test_client
|
|
Harald Hoyer |
b38677 |
+ ret=$?
|
|
Harald Hoyer |
b38677 |
+ kill_server
|
|
Harald Hoyer |
b38677 |
+ return $ret
|
|
Harald Hoyer |
b38677 |
}
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
test_client() {
|
|
Harald Hoyer |
b38677 |
@@ -133,7 +136,15 @@ test_client() {
|
|
Harald Hoyer |
b38677 |
"root=dhcp ip=ens3:dhcp ip=ens4:dhcp ip=ens5:dhcp bootdev=ens5" \
|
|
Harald Hoyer |
b38677 |
"ens3 ens4 ens5" || return 1
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
- kill_server
|
|
Harald Hoyer |
b38677 |
+ client_test "MULTINIC bonding" \
|
|
Harald Hoyer |
b38677 |
+ 00 01 02 \
|
|
Harald Hoyer |
b38677 |
+ "root=nfs:192.168.50.1:/nfs/client ip=bond0:dhcp bond=bond0:ens3,ens4,ens5:mode=balance-rr" \
|
|
Harald Hoyer |
b38677 |
+ "bond0" || return 1
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ client_test "MULTINIC bridging" \
|
|
Harald Hoyer |
b38677 |
+ 00 01 02 \
|
|
Harald Hoyer |
b38677 |
+ "root=nfs:192.168.50.1:/nfs/client ip=bridge0:dhcp bridge=bridge0:ens3,ens4,ens5" \
|
|
Harald Hoyer |
b38677 |
+ "bridge0" || return 1
|
|
Harald Hoyer |
b38677 |
return 0
|
|
Harald Hoyer |
b38677 |
}
|
|
Harald Hoyer |
b38677 |
|