Bug 462049

Summary: /etc/sysconfig/network-scripts/ifup-eth make the slave interface disabled
Product: Red Hat Enterprise Linux 5 Reporter: Jason Luo <jason.luo>
Component: initscriptsAssignee: initscripts Maintenance Team <initscripts-maint-list>
Status: CLOSED DUPLICATE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.2CC: joe.jin, notting
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-09-12 13:54:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jason Luo 2008-09-12 08:15:13 UTC
Description of problem:
I have a bonding interface with two slave interface(eth2, eth3). the configuration file such below:
####snip begin####
 /etc/sysconfig/network-scripts/ifcfg-bond0:
 DEVICE=bond0
 IPADDR=10.182.114.117
 NETMASK=255.255.252.0
 NETWORK=10.182.112.0
 BROADCAST=10.182.115.255
 ONBOOT=yes
 BOOTPROTO=none
 TYPE=Ethernet
  
 /etc/sysconfig/network-scripts/ifcfg-eth2:
 DEVICE=eth2
 ONBOOT=yes
 BOOTPROTO=dhcp
 HWADDR=00:16:3e:2d:92:f4
 MASTER=bond0
 SLAVE=yes
 TYPE=Ethernet
 PEERDNS=yes
 USERCTL=no
 IPV6INIT=no
  
 /etc/sysconfig/network-scripts/ifcfg-eth3:
 DEVICE=eth3
 ONBOOT=yes
 BOOTPROTO=dhcp
 HWADDR=00:16:3e:2d:93:f1
 MASTER=bond0
 SLAVE=yes
 TYPE=Ethernet
 PEERDNS=yes
 USERCTL=no
 IPV6INIT=no
  
 the related part in /etc/modprobe.conf:
 alias bond0 bonding
 options bond0 downdelay=200 updelay=200 miimon=100 mode=4
  
 alias eth2 8139cp
 alias eth3 8139cp
####snip end####

If bond0, eth2 and eth3 is enabled, run /sbin/ifup eth2 will disable eth2, the same with eth3

Version-Release number of selected component (if applicable):
8.45.19.EL


Steps to Reproduce:
1. configure the bonding interface and the slave interface
2. enable boding interface
3. /sbin/ifup slave interface
  
Actual results:
running /sbin/ifconfig, find out the slave interface was  disabled.

Expected results:
the slave interface is enabled.

Comment 1 Jason Luo 2008-09-12 08:19:33 UTC
In the scripts /etc/sysconfig/network-scripts/ifup-eth, it use /sbin/ip to disable the slave interface(eth2 or eth3), then attach  the interface to the bonding interface(bond0), but, slave eth0 is already enslaved! so kernel wouldn't do anything for it(now,the interface is disabled).  this patch will resolve it.


--- initscripts-8.45.19.EL/sysconfig/network-scripts/ifup-eth.orig      2008-09-12 15:19:12.000000000 +0800
+++ initscripts-8.45.19.EL/sysconfig/network-scripts/ifup-eth   2008-09-12 15:57:57.000000000 +0800
@@ -105,6 +105,14 @@
 
 # slave device?
 if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" ]; then
+    if LC_ALL=C grep "${DEVICE}"  /sys/class/net/${MASTER}/bonding/slaves > /dev/null 2>&1 ; then
+        if /sbin/ip  -o link show up ${DEVICE} | grep UP > /dev/null 2>&1; then
+            exit 0
+        fi
+        echo "-${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
+        sleep 2
+    fi
+
     /sbin/ip link set dev ${DEVICE} down
     echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null

Comment 2 Bill Nottingham 2008-09-12 13:54:47 UTC

*** This bug has been marked as a duplicate of bug 440077 ***

Comment 3 Joe Jin 2008-11-28 02:22:31 UTC
Sorry I could not check bug 440077, is the patch like below?

--- a/sysconfig/network-scripts/ifup-eth        2008-03-12 05:48:05.000000000 +0800
+++ b/sysconfig/network-scripts/ifup-eth        2008-04-04 23:40:30.000000000 +0800
@@ -117,9 +117,10 @@

 # slave device?
 if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" ]; then
-    /sbin/ip link set dev ${DEVICE} down
-    echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
-
+    grep -wq "${DEVICE}" /sys/class/net/${MASTER}/bonding/slaves || { 
+       /sbin/ip link set dev ${DEVICE} down
+       echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
+    } 
     if [ -n "$ETHTOOL_OPTS" ] ; then
         /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
     fi


If yes, I have checked the latest initscripts and found the patch have merged, but the patch 
could not solved the bug, with Jason's patch would solved the bug.

Would you please add me to CC list of bug 440077? Thanks.

Comment 4 Bill Nottingham 2008-12-01 15:47:28 UTC
It's essentially like that, yes.