From: Cong Wang <[email protected]>

Vlan/bridge/bonding device has the same mac address with its underlying
physical device, if we generate udev rules for vlan NIC too,
its physical device name will be override.

This looks a little ugly, but I can't find any better way to handle this.

Cc: Dave Young <[email protected]>
Cc: Harald Hoyer <[email protected]>
Cc: Vivek Goyal <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
---
 modules.d/40network/ifname-genrules.sh |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/modules.d/40network/ifname-genrules.sh 
b/modules.d/40network/ifname-genrules.sh
index e188c88..89621a2 100755
--- a/modules.d/40network/ifname-genrules.sh
+++ b/modules.d/40network/ifname-genrules.sh
@@ -8,9 +8,15 @@ if ! getarg ifname= >/dev/null ; then
 fi
 
 {
+    [ -e /tmp/vlan.info ] && source /tmp/vlan.info
+    [ -e /tmp/bridge.info ] && source /tmp/bridge.info
+    [ -e /tmp/bond.info ] && source /tmp/bond.info
     for p in $(getargs ifname=); do
         parse_ifname_opts $p
-        printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", 
ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
+        #Hack: vlan, bridge, bonding devices may have the same mac address 
with its physical device
+        if [ "$ifname_if" != "$vlanname" ] && [ "$ifname_if" != "$bridgename" 
] && [ "$ifname_if" != "$bondname" ]; then
+            printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", 
ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
+        fi
     done
 
     # Rename non named interfaces out of the way for named ones.
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to