[RFC PATCH 3/3] Avoid generating udev rules for vlan interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Cong Wang <xiyou.wangcong@xxxxxxxxx>

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 <dyoung@xxxxxxxxxx>
Cc: Harald Hoyer <harald@xxxxxxxxxx>
Signed-off-by: Cong Wang <xiyou.wangcong@xxxxxxxxx>
---
 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux