Skip to contentSkip to conversation

ifup: do not dhcp on network interface of secondary stack

PATCH In review WANG Chao 2 participants 2 messages Sep 13, 2013 1 message not in the archive

lore
Share & tools
lore

WANG Chao

author
#0 lore raw

PATCH 1/1 ifup: do not dhcp on network interface of secondary stack

Configure cmdline to:
ip=br0:dhcp bridge=br0:bond0 bond=bond0:eth0

By default ifup bond0 will run dhcp on bond0, which is wrong. bond0 isn't the top interface. we should really run dhcp on br0.

So if we ifup an network interface on secondary stack, we should not dhcp. Fix this issue with this patch.

---
 modules.d/40network/ifup.sh | 7 +++++++
 1 file changed, 7 insertions(+)
modules.d/40network/ifup.sh +7 -0
index 3261647..9f6f449 100755
@@ -336,6 +336,13 @@ for p in $(getargs ip=); do
     exit 0
 done
 
+# netif isn't the top stack? Then we should exit here.
+# eg. netif is bond0. br0 is on top of it. dhcp br0 is correct but dhcp
+#     bond0 doesn't make sense.
+if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then
+    exit 0
+fi
+
 # no ip option directed at our interface?
 if [ ! -e /tmp/setup_net_${netif}.ok ]; then
     do_dhcp -4
Signature · 1 line
1.8.3.1

A message that is not in the archive (sent off-list or not yet received): 20130913142844.GD2070-UAAZkH0G2Ts1naxU1pY8ZxcY2uh10dtjAL8bYrjMMd8@public.gmane.org

#2 lore raw
Quoted 21 lines · WANG Chao

Configure cmdline to:
ip=br0:dhcp bridge=br0:bond0 bond=bond0:eth0

By default ifup bond0 will run dhcp on bond0, which is wrong. bond0 isn't the top interface. we should really run dhcp on br0.

So if we ifup an network interface on secondary stack, we should not dhcp. Fix this issue with this patch.

---
 modules.d/40network/ifup.sh | 7 +++++++
 1 file changed, 7 insertions(+)
modules.d/40network/ifup.sh +0 -0
index 3261647..9f6f449 100755
@@ -336,6 +336,13 @@ for p in $(getargs ip=); do
     exit 0
 done
 

modules.d/40network/ifup.sh for p in $(getargs ip=); do · line 348

Quoted 10 lines
modules.d/40network/ifup.sh +7 -0
+# netif isn't the top stack? Then we should exit here.
+# eg. netif is bond0. br0 is on top of it. dhcp br0 is correct but dhcp
+#     bond0 doesn't make sense.
+if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then
+    exit 0
+fi
+
 # no ip option directed at our interface?
 if [ ! -e /tmp/setup_net_${netif}.ok ]; then
     do_dhcp -4

pushed! thanks!