diff options
author | Harald Hoyer <harald@redhat.com> | 2011-04-12 14:28:39 +0200 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2011-04-12 09:52:16 -0400 |
commit | 6d3ff7f2ed31eaf89fe3fb4e6af96eeaffd9410d (patch) | |
tree | 1069f492848c1dc05275e60f291e5b20ef70df34 /sysconfig/network-scripts | |
parent | 34d2d8720ddb3a421d7069f9b512748bc35297c3 (diff) | |
download | initscripts-6d3ff7f2ed31eaf89fe3fb4e6af96eeaffd9410d.tar initscripts-6d3ff7f2ed31eaf89fe3fb4e6af96eeaffd9410d.tar.gz initscripts-6d3ff7f2ed31eaf89fe3fb4e6af96eeaffd9410d.tar.bz2 initscripts-6d3ff7f2ed31eaf89fe3fb4e6af96eeaffd9410d.tar.xz initscripts-6d3ff7f2ed31eaf89fe3fb4e6af96eeaffd9410d.zip |
ifup/ifdown-eth: properly add and remove arp_ip_target's
Only add arp_ip_target, if not yet present.
Only remove arp_ip_target, if present in BONDING_OPTS, to prevent clash
with module options.
https://bugzilla.redhat.com/show_bug.cgi?id=604669
Diffstat (limited to 'sysconfig/network-scripts')
-rwxr-xr-x | sysconfig/network-scripts/ifdown-eth | 21 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-eth | 10 |
2 files changed, 27 insertions, 4 deletions
diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth index 530975c3..aa870673 100755 --- a/sysconfig/network-scripts/ifdown-eth +++ b/sysconfig/network-scripts/ifdown-eth @@ -57,8 +57,25 @@ if is_bonding_device ${DEVICE} ; then is_ignored_file "$device" && continue /sbin/ifdown ${device##*/} done - for target in $(cat /sys/class/net/${DEVICE}/bonding/arp_ip_target) ; do - echo "-${target}" > /sys/class/net/${DEVICE}/bonding/arp_ip_target + for arg in $BONDING_OPTS ; do + key=${arg%%=*}; + [[ "${key}" != "arp_ip_target" ]] || continue + value=${arg##*=}; + if [ "${value:0:1}" != "" ]; then + OLDIFS=$IFS; + IFS=','; + for arp_ip in $value; do + if grep -q $arp_ip /sys/class/net/${DEVICE}/bonding/arp_ip_target; then + echo "-$arp_ip" > /sys/class/net/${DEVICE}/bonding/arp_ip_target + fi + done + IFS=$OLDIFS; + else + value=${value#}; + if grep -q $value /sys/class/net/${DEVICE}/bonding/arp_ip_target; then + echo "-$value" > /sys/class/net/${DEVICE}/bonding/arp_ip_target + fi + fi done fi diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index a7d41abe..0121d33f 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -119,10 +119,16 @@ if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then OLDIFS=$IFS; IFS=','; for arp_ip in $value; do - echo +$arp_ip > /sys/class/net/${DEVICE}/bonding/$key + 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; - else + 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 + else echo $value > /sys/class/net/${DEVICE}/bonding/$key fi done |