diff options
author | Harald Hoyer <harald@redhat.com> | 2011-04-12 14:28:39 +0200 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2011-04-12 14:39:36 +0200 |
commit | c3f28b98b89b17de5f3eef05eb013435c6e66d4f (patch) | |
tree | 2c4f2eebdffcf383177d2cbd8b95d6d9caf4c6e2 /sysconfig | |
parent | 55fd8bdd57f60c98ed3d34ea6645c201e9fb2aaa (diff) | |
download | initscripts-c3f28b98b89b17de5f3eef05eb013435c6e66d4f.tar initscripts-c3f28b98b89b17de5f3eef05eb013435c6e66d4f.tar.gz initscripts-c3f28b98b89b17de5f3eef05eb013435c6e66d4f.tar.bz2 initscripts-c3f28b98b89b17de5f3eef05eb013435c6e66d4f.tar.xz initscripts-c3f28b98b89b17de5f3eef05eb013435c6e66d4f.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')
-rwxr-xr-x | sysconfig/network-scripts/ifdown-eth | 23 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-eth | 10 |
2 files changed, 29 insertions, 4 deletions
diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth index 31ba0cac..2be3ef4d 100755 --- a/sysconfig/network-scripts/ifdown-eth +++ b/sysconfig/network-scripts/ifdown-eth @@ -45,11 +45,30 @@ 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 + if [ "${NETWORKING_IPV6}" = "yes" ]; then /etc/sysconfig/network-scripts/ifdown-ipv6 ${CONFIG} if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -f /var/run/dhcp6c_${DEVICE}.pid ]; then diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index 85dad42d..fa0f91b2 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 |