From: Cong Wang <[email protected]>

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

I used an ugly hack in ifname-genrules.sh, don't know if we have any
better ways to fix this?

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

diff --git a/modules.d/40network/ifname-genrules.sh 
b/modules.d/40network/ifname-genrules.sh
index e188c88..b36f167 100755
--- a/modules.d/40network/ifname-genrules.sh
+++ b/modules.d/40network/ifname-genrules.sh
@@ -10,7 +10,11 @@ fi
 {
     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 device has the same mac address with its physical device
+        [ -e /tmp/vlan.info ] && source /tmp/vlan.info
+        if [ "$ifname_if" != "$vlanname" ]; 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