diff options
author | Lukas Nykryn <lnykryn@redhat.com> | 2012-10-08 13:35:01 +0200 |
---|---|---|
committer | Václav Pavlín <vpavlin@redhat.com> | 2013-01-22 10:07:14 +0100 |
commit | 87d60f87d68ddf8ea214dbbcc072ef4097680b6c (patch) | |
tree | d77b63a031516300074b4de2cc6e8a1081943dfa /sysconfig/network-scripts | |
parent | 814fac877b22577f4835afcfb2597677270f6a4c (diff) | |
download | initscripts-87d60f87d68ddf8ea214dbbcc072ef4097680b6c.tar initscripts-87d60f87d68ddf8ea214dbbcc072ef4097680b6c.tar.gz initscripts-87d60f87d68ddf8ea214dbbcc072ef4097680b6c.tar.bz2 initscripts-87d60f87d68ddf8ea214dbbcc072ef4097680b6c.tar.xz initscripts-87d60f87d68ddf8ea214dbbcc072ef4097680b6c.zip |
Sets BONDING_OPTS before interface is brougth up
Diffstat (limited to 'sysconfig/network-scripts')
-rwxr-xr-x | sysconfig/network-scripts/ifup-eth | 31 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions | 34 |
2 files changed, 37 insertions, 28 deletions
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index f584e43a..a7add8a9 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -113,38 +113,15 @@ fi # Bonding initialization. For DHCP, we need to enslave the devices early, # so it can actually get an IP. if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then - - /sbin/ip link set dev ${DEVICE} down - - # add the bits to setup driver parameters here - for arg in $BONDING_OPTS ; do - key=${arg%%=*}; - value=${arg##*=}; - if [ "${key}" = "arp_ip_target" -a "${value:0:1}" != "+" ]; then - OLDIFS=$IFS; - IFS=','; - for arp_ip in $value; do - if ! grep -q $arp_ip /sys/class/net/${DEVICE}/bonding/$key; then - echo +$arp_ip > /sys/class/net/${DEVICE}/bonding/$key - fi - done - IFS=$OLDIFS; - elif [ "${key}" = "arp_ip_target" ]; then - if ! grep -q ${value#+} /sys/class/net/${DEVICE}/bonding/$key; then - echo "$value" > /sys/class/net/${DEVICE}/bonding/$key - fi - elif [ "${key}" != "primary" ]; then - echo $value > /sys/class/net/${DEVICE}/bonding/$key - fi - done - - /sbin/ip link set dev ${DEVICE} up - [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} + install_bonding_driver ${DEVICE} for device in $(LANG=C egrep -l "^[[:space:]]*MASTER=\"?${DEVICE}\"?[[:space:]]*$" /etc/sysconfig/network-scripts/ifcfg-*) ; do is_ignored_file "$device" && continue /sbin/ifup ${device##*/} done + /sbin/ip link set dev ${DEVICE} up + [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} + # add the bits to setup the needed post enslavement parameters for arg in $BONDING_OPTS ; do key=${arg%%=*}; diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 0b5b11d8..c57093df 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -427,7 +427,39 @@ install_bonding_driver () { [ -d "/sys/class/net/$1" ] && return 0 [ ! -f /sys/class/net/bonding_masters ] && ( modprobe bonding || return 1 ) - echo "+$1" > /sys/class/net/bonding_masters 2>/dev/null + if ! grep -sq "$1" /sys/class/net/bonding_masters; then + echo "+$1" > /sys/class/net/bonding_masters 2>/dev/null + fi + ( + # Set config here + need_config "$1" + source_config + if [ -f /sys/class/net/${DEVICE}/bonding/slaves -a $(wc -l < /sys/class/net/${DEVICE}/bonding/slaves) -eq 0 ]; then + /sbin/ip link set dev ${DEVICE} down + + # add the bits to setup driver parameters here + for arg in $BONDING_OPTS ; do + key=${arg%%=*}; + value=${arg##*=}; + if [ "${key}" = "arp_ip_target" -a "${value:0:1}" != "+" ]; then + OLDIFS=$IFS; + IFS=','; + for arp_ip in $value; do + if ! grep -q $arp_ip /sys/class/net/${DEVICE}/bonding/$key; then + echo +$arp_ip > /sys/class/net/${DEVICE}/bonding/$key + fi + done + IFS=$OLDIFS; + elif [ "${key}" = "arp_ip_target" ]; then + if ! grep -q ${value#+} /sys/class/net/${DEVICE}/bonding/$key; then + echo "$value" > /sys/class/net/${DEVICE}/bonding/$key + fi + elif [ "${key}" != "primary" ]; then + echo $value > /sys/class/net/${DEVICE}/bonding/$key + fi + done + fi + ) return 0 } |