Bug 483711 - [RHEL5] [PATCH] Cleanup arp_ip_target with ifdown-eth network script for avoiding write error message
Summary: [RHEL5] [PATCH] Cleanup arp_ip_target with ifdown-eth network script for avoi...
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: initscripts
Version: 5.3
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: initscripts Maintenance Team
QA Contact: BaseOS QE
Depends On:
TreeView+ depends on / blocked
Reported: 2009-02-03 08:53 UTC by Masaki MAENO
Modified: 2014-09-08 11:27 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2009-09-02 11:14:41 UTC
Target Upstream Version:

Attachments (Terms of Use)
ifdown-eth script patch (738 bytes, patch)
2009-02-03 08:53 UTC, Masaki MAENO
no flags Details | Diff
ifdown-up script patch (check all current 'arp_ip_target' entries before regist a new entry) (958 bytes, patch)
2009-02-04 01:24 UTC, Masaki MAENO
no flags Details | Diff

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:1344 0 normal SHIPPED_LIVE initscripts bug fix update 2009-09-01 10:44:36 UTC

Description Masaki MAENO 2009-02-03 08:53:58 UTC
Created attachment 330717 [details]
ifdown-eth script patch

Description of problem:

If the entry in /sys/class/net/bondX/bonding/arp_ip_target
and the entry of 'arp_ip_target' in /etc/sysconfig/network-scripts/ifcfg-bondX 
are the same, 'echo: write error' is output.

> Bringing up interface bond0:  /etc/sysconfig/network-scripts/ifup-eth: \
> line 133: echo: write error: Invalid argument

But, there is no problem in 'ifup bond0' operation.
Therefore, I am unpleasant.

Please take this patch by all means so that it is easy.

Steps to Reproduce:
0. set 'arp_ip_target' in /etc/sysconfig/network-scripts/ifcfg-bondX
1. ifup bondX (regist 'arp_ip_target')
2. ifdown bondX
3. ifup bondX (output 'echo: write error' because of the entry overlaps)

Actual results:
errormsg is output.

Expected results:
No errormsg is output.

Comment 1 Masaki MAENO 2009-02-03 08:56:52 UTC
The patch deletes all of 'arp_ip_target' in /sys/class/net/bondX/bonding/arp_ip_target at doing 'ifdown bondX'

Comment 2 Bill Nottingham 2009-02-03 17:35:40 UTC
I'm not sure that's the right answer - we don't deconfigure other bonding parameters of the interface on ifdown.

Comment 3 Andy Gospodarek 2009-02-03 18:17:03 UTC
Bill, you are correct that we don't deconfigure other bonding parameters, but the initscripts presume that all parameters will be unset when they begin configuration.

It would be wise to consider removing all entries for arp_ip_target either when the interface goes down (with ifdown) or when it comes up (with ifup) before the parameters are set.  It might even be wise to zero out all parameters when the interface is just brought up to be sure no residual information remains from the previous configuration.

Comment 4 Bill Nottingham 2009-02-03 19:07:49 UTC
'Zero out'... given how bonding is configured, there's no way to guess what needs zeroed out to what.

For arp_ip_target, is there a '-*' or similar syntax supported?

Comment 5 Andy Gospodarek 2009-02-03 19:45:18 UTC
So I didn't elaborate on what I meant by 'zero out.'  I liked the patch in the Description that simply did this:

       # cleanup arp_ip_target
       if [ -d "/sys/class/net/${DEVICE}" ]; then
           arp_ip_targets=`cat ${arp_ip_target_path}`
           for arg in ${arp_ip_targets}; do
              echo "-${arg}" > ${arp_ip_target_path}

The sysfs files for 'arp_ip_target' and 'slaves' both use +[string] and -[string] syntax for adding and removing entries from their lists.  I might be a good idea to clear both of those with a patch much like the one above when it is first detected that a bonding device is coming up.

Maybe something like this untested patch:

diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth
index 33df60f..2a9fe7d 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -122,6 +122,17 @@ if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then

     /sbin/ip link set dev ${DEVICE} down

+    # cleanup old settings if there are any
+    for arg in "slaves arp_ip_target" ; do
+       if [ -d "/sys/class/net/${DEVICE}" ]; then
+           sysfs_path=/sys/class/net/${DEVICE}/bonding/${arg}
+           targets=`cat ${sysfs_path}`
+           for entry in ${targets}; do
+              echo "-${entry}" > ${sysfs_path}
+           done
+       fi
+    done
     # add the bits to setup driver parameters here
     for arg in $BONDING_OPTS ; do

Comment 6 Bill Nottingham 2009-02-03 20:59:16 UTC
Hm, this means that running 'ifup' twice in a row will bounce the device and all the slave links. Is that what we want?

Comment 7 Masaki MAENO 2009-02-04 00:22:40 UTC
I am good only to erase all current entries of 'arp_ip_target'
by "echo -<ip address> > /sys/class/net/bondX/bonding/arp_ip_target" that kernel supports,
when bondX is doing down.

I think that I need not maintain 'arp_ip_target' configuration when bondX is down.
Why should kernel maintain 'arp_ip_target' configuration?

If the end-user sees this message, he becomes perplexed.
Please fix the problem.
> Bringing up interface bond0:  /etc/sysconfig/network-scripts/ifup-eth: \
> line 133: echo: write error: Invalid argument

Comment 8 Masaki MAENO 2009-02-04 00:43:18 UTC
I confirmed that there is a success case and is a failure case
by operation of 'echo "-<ip address>" > /sys/class/net/bondX/bonding/arp_ip_target'

If it is so, I think that 'ifup-eth' script should check it so as not to register doubly
before it regist 'arp_ip_target'.
What do you think?

Comment 9 Masaki MAENO 2009-02-04 01:24:00 UTC
Created attachment 330805 [details]
ifdown-up script patch (check all current 'arp_ip_target' entries before regist a new entry)

I changed the patch from deleting all 'arp_ip_target' entries in 'ifdown-eth'
to checking all current entries before regist a new entry.

Comment 10 Masaki MAENO 2009-02-04 01:25:24 UTC
typo: ifdown-up script patch ----> correct: ifup-eth script patch

Comment 11 Bill Nottingham 2009-03-17 16:51:31 UTC
Upstream commit is at http://git.fedorahosted.org/git/?p=initscripts.git;a=commitdiff;h=a0895aba2529c34387cf9abdc658f5f43c39d32c - it's probably better to do it in the down path.

Comment 13 Harald Hoyer 2009-05-05 12:52:34 UTC
Please test the erratum candidate:

Comment 17 errata-xmlrpc 2009-09-02 11:14:41 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.