Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 120016

Summary: bonding devices not unbound upon shutdown
Product: Gentoo Linux Reporter: Mark Dominik Bürkle <dominik.buerkle>
Component: [OLD] baselayoutAssignee: Gentoo's Team for Core System packages <base-system>
Status: VERIFIED INVALID    
Severity: minor CC: uberlord
Priority: Low    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Mark Dominik Bürkle 2006-01-22 23:53:29 UTC
I'm not allowed to re-open bug#118590, which introduces:

-	slaves=$( sed -n -e 's/^Slave Interface: //p' "/proc/net/bonding/${iface}" )
+	slaves="$( \
+		sed -n -e 's/^Slave Interface: //p' /proc/net/bonding/${iface} | xargs \
+	)"


Please fix this (still in 1.12.0_pre15) like:

diff -wu /tmp/._cfg0000_bonding /lib/rcscripts/net.modules.d/bonding 
--- /tmp/._cfg0000_bonding      2006-01-23 06:43:28.000000000 +0100
+++ /lib/rcscripts/net.modules.d/bonding        2006-01-23 07:58:11.000000000 +0100
@@ -90,8 +90,9 @@
 
        # don't trust the config, get the active list instead
        slaves="$( \
-               sed -n -e 's/^Slave Interface: //p' /proc/net/bonding/${iface} | xargs \
+               sed -n -e 's/^Slave Interface: //p' /proc/net/bonding/${iface} \
        )"
+       slaves="$( echo ${slaves[*]} )"
        [[ -z ${slaves} ]] && return 0
 
        # remove all slaves

or, if You want to use xargs, with
--- /tmp/._cfg0000_bonding      2006-01-23 06:43:28.000000000 +0100
+++ /lib/rcscripts/net.modules.d/bonding        2006-01-23 08:41:25.000000000 +0100
@@ -89,8 +89,9 @@
        ! bonding_exists "${iface}" && return 0
 
        # don't trust the config, get the active list instead
-       slaves="$( \
-               sed -n -e 's/^Slave Interface: //p' /proc/net/bonding/${iface} | xargs \
+       slaves="$( 
+               sed -n -e 's/^Slave Interface: //p' /proc/net/bonding/${iface} |
+               xargs -r echo 
        )"
        [[ -z ${slaves} ]] && return 0
 


BTW, this should be consistent with the behaviour in respect to "slaves" within bonding_pre_start()...

BTW2: both are untested, though I'd expect both of them to work. You should have some vmware (or other) setup to test the scripts at least once. ;-)
Comment 1 Roy Marples (RETIRED) gentoo-dev 2006-01-23 01:44:33 UTC
Could you tell me what this is actually supposed to do or fix?
Comment 2 Mark Dominik Bürkle 2006-01-23 06:09:24 UTC
Hi Roy,

basically You wrote
    slaves="$( sed ... | xargs )"
(xargs without a command) which I'd expect to end up in sth. similar to
# stderr: xargs: eth0: no such file or directory / not executable
# stdout: empty => slaves is empty
so
    [[ -z ${slaves} ]] && return 0
would exit and 
    /sbin/ifenslave -d "${iface}" ${slaves}
would never be executed...

Though... I don't know the output of /proc/net/bonding, but I'd be _really_ surprised if it would contain "Slave Interface: echo eth0 eth1" or sth. like that. :-)

I don't know if this may have any implications on network devices (switches, routers), but I'd expect only little influence. Anyway, proper re-initialization (e.g. net.bond0 restart or the like) might fail miserably. But "reboot is good" is not what I really like to hear. ;-)

Kind regards,
Dominik
Comment 3 Roy Marples (RETIRED) gentoo-dev 2006-01-23 06:37:06 UTC
(In reply to comment #2)
> basically You wrote
>     slaves="$( sed ... | xargs )"
> (xargs without a command) which I'd expect to end up in sth. similar to
> # stderr: xargs: eth0: no such file or directory / not executable
> # stdout: empty => slaves is empty
> so
>     [[ -z ${slaves} ]] && return 0
> would exit and 
>     /sbin/ifenslave -d "${iface}" ${slaves}
> would never be executed...

When we call xargs like that it basically changes this

eth0
eth1
wlan0

into this

eth0 eth1 wlan0

> 
> Though... I don't know the output of /proc/net/bonding, but I'd be _really_
> surprised if it would contain "Slave Interface: echo eth0 eth1" or sth. like
> that. :-)

Here's the full output of bond0 with lan and wlan0 bonded.

Ethernet Channel Bonding Driver: v2.6.5 (November 4, 2005)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: lan
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0b:cd:17:51:e7

Slave Interface: wlan0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0e:2e:66:94:6d



ifenslave just adds to and removes interfaces from the bond interface. As such, I still fail to see the relevance of your patch.
Comment 4 Mark Dominik Bürkle 2006-01-23 07:06:49 UTC
> (xargs without a command) which I'd expect to end up in sth. similar to
> # stderr: xargs: eth0: no such file or directory / not executable
Ouch, :-O, unbelievable... feel like I'm a cmdline fossil.

Sorry to waiste Your time, I didn't try it, and reading the manpage would have helped as well:
    ... xargs reads ... executes the command (default is /bin/echo) ...
which is a behaviour I didn't know yet but which was already present at least in spring 2000...

I'll resolve invalid and close - I beg Your pardon.
Comment 5 Mark Dominik Bürkle 2006-01-23 07:07:28 UTC
invalid, close