aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2011-04-12 14:28:39 +0200
committerBill Nottingham <notting@redhat.com>2011-04-12 09:03:10 -0400
commit5749d2e9d5795fdaf65b97befd64cf90103d423d (patch)
tree9af0b545859db1069ed1dcee529981d07efe2f55
parent3de0e06afda2e572d0952941498446fdda7f3f42 (diff)
downloadinitscripts-5749d2e9d5795fdaf65b97befd64cf90103d423d.tar
initscripts-5749d2e9d5795fdaf65b97befd64cf90103d423d.tar.gz
initscripts-5749d2e9d5795fdaf65b97befd64cf90103d423d.tar.bz2
initscripts-5749d2e9d5795fdaf65b97befd64cf90103d423d.tar.xz
initscripts-5749d2e9d5795fdaf65b97befd64cf90103d423d.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
-rwxr-xr-xsysconfig/network-scripts/ifdown-eth21
-rwxr-xr-xsysconfig/network-scripts/ifup-eth10
2 files changed, 27 insertions, 4 deletions
diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth
index 80b99544..2bc976de 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 836243a0..469a07fa 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -120,10 +120,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