Blob Blame History Raw
From 56d60c4b2d65399a7d9fe187e1c48c9fc65dcd5f Mon Sep 17 00:00:00 2001
From: Kevin Yung <Kevin.Yung@myob.com>
Date: Wed, 6 Feb 2013 13:33:42 +0100
Subject: [PATCH] network/ifup.sh: enable bridged vlan interfaces

To use vlan for net boot, you need to specify vlan and ip kernel options
for the boot interface. For example,

 vlan=eth1.1:eth1 bootdev=eth1.1
 ip=1.2.3.4:1.2.3.4::255.255.255.0:my-hostname:eth1:none

To use bridge for net boot, you need to specify bridge and ip kernel
option for the boot interface. For example

 bridge=br1:eth1 bootdev=br1
 ip=1.2.3.4:1.2.3.4::255.255.255.0:my-hostname:eth1:none

In my environment, I needs to boot machines from network within
a vlan or on a bridged network.	I found curent dracut release
if-up.sh script in 40network module bypass ip setting for both
bridge and vlan interface.
---
 modules.d/40network/ifup.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index 6c3133e..83685c8 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -17,6 +17,8 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
 
 # $netif reads easier than $1
 netif=$1
+use_bridge='false'
+use_vlan='false'
 
 # enslave this interface to bond?
 if [ -e /tmp/bond.info ]; then
@@ -46,6 +48,7 @@ if [ -e /tmp/bridge.info ]; then
                 : # We need to really setup bond (recursive call)
             else
                 netif="$bridgename"
+                use_bridge='true'
             fi
         fi
     done
@@ -58,6 +61,7 @@ if [ -e /tmp/vlan.info ]; then
             : # We need to really setup bond (recursive call)
         else
             netif="$vlanname"
+            use_vlan='true'
         fi
     fi
 fi
@@ -256,6 +260,7 @@ if [ -z "$ip" ]; then
     fi
 fi
 
+
 # Specific configuration, spin through the kernel command line
 # looking for ip= lines
 for p in $(getargs ip=); do
@@ -264,7 +269,9 @@ for p in $(getargs ip=); do
     [ "$autoconf" = "ibft" ] && continue
 
     # If this option isn't directed at our interface, skip it
-    [ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
+    [ -n "$dev" ] && [ "$dev" != "$netif" ] && \
+    [ "$use_bridge" != 'true' ] && \
+    [ "$use_vlan" != 'true' ] && continue
 
     # Store config for later use
     for i in ip srv gw mask hostname macaddr; do