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

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

 



On 05/21/2012 05:44 PM, Harald Hoyer wrote:
Am 21.05.2012 11:31, schrieb Cong Wang:
On 05/21/2012 05:25 PM, Harald Hoyer wrote:
-        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.

Maybe one of the /sys attributes indicate, that it is a vlan interface?

Hmm... I tried DRIVERS!="8021q", then I got:

SUBSYSTEM=="net", ACTION=="add", DRIVERS!="8021q", ATTR{address}=="%s",
ATTR{type}=="1" NAME="eth0"

SUBSYSTEM=="net", ACTION=="add", DRIVERS!="8021q", ATTR{address}=="%s",
ATTR{type}=="1" NAME="eth0.2"

So, eth0 will be still renamed to eth0.2. :(


DEVPATH!="*/virtual/*" should help

The problem is not in udev rules themselves, the problem is we generate two same lines for eth0 and eth0.2, even with DEVPATH!="*/virtual/*" we will have:

SUBSYSTEM=="net", ACTION=="add", DEVPATH!="*/virtual/*", ATTR{address}=="%s", ATTR{type}=="1" NAME="eth0"

SUBSYSTEM=="net", ACTION=="add", DEVPATH!="*/virtual/*", ATTR{address}=="%s", ATTR{type}=="1" NAME="eth0.2"

eth0 will be still override. Thus, we should only generate one line for eth0, and let ip/vconfig to name the eth0.2 upon eth0.

The reason why we have two lines is that I passed two ifname= cmdline, one for eth0 and the other for eth0.2, this is required by ip=, all interfaces in ip= should be passed in ifname= too.


Thanks!
--
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