Skip to contentSkip to conversation

Add vlan support in network module

RFC PATCH In review Cong Wang 3 participants 15 messages May 21, 2012 – May 24, 2012 12 messages not in the archive

lore
Share & tools
lore

Cong Wang

author
#0 lore raw

RFC PATCH 1/3 Add vlan support in network module

From: Cong Wang <[email protected]>

This patch adds basic vlan support in network module.

The cmdline syntax for vlan is:

	vlan=<vlanname>[:<phydevice>]

for an example:

	vlan=eth0.2:eth0

or

	vlan=eth0.2

This is just the basic syntax, vlan has other styles of naming, like "vlan2". We need to extend the syntax in the future, this patch is just a starter. ;-)

TODO: Add doc for vlan= cmdline

Any comments?

Cc Dave Young <[email protected]>
Cc Harald Hoyer <[email protected]>
---
 modules.d/40network/ifup.sh         |   18 +++++++++++++
 modules.d/40network/module-setup.sh |    5 +++-
 modules.d/40network/net-genrules.sh |    5 ++++
 modules.d/40network/parse-vlan.sh   |   46 +++++++++++++++++++++++++++++++++++
 4 files changed, 73 insertions(+), 1 deletions(-)
 create mode 100644 modules.d/40network/parse-vlan.sh
modules.d/40network/ifup.sh +18 -0
index 71b869d..aab0dfc 100755
@@ -40,6 +40,17 @@ if [ -e /tmp/bridge.info ]; then
     fi
 fi
 
+if [ -e /tmp/vlan.info ]; then
+    . /tmp/vlan.info
+    if [ "$netif" = "$phydevice" ]; then
+        if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
+            : # We need to really setup bond (recursive call)
+        else
+            netif="$vlanname"
+        fi
+    fi
+fi
+
 # disable manual ifup while netroot is set for simplifying our logic
 # in netroot case we prefer netroot to bringup $netif automaticlly
 [ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
@@ -178,6 +189,13 @@ if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
     brctl addif $bridgename $ethname
 fi
 
+if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
+    modprobe 8021q
+    ip link set "$phydevice" up
+    wait_for_if_up "$phydevice"
+    vconfig add "$phydevice" "${vlanname##*.}"
+fi
+
 # No ip lines default to dhcp
 ip=$(getarg ip)
 
modules.d/40network/module-setup.sh +4 -1
index d49b594..07cdc7f 100755
@@ -68,12 +68,14 @@ installkernel() {
     instmods ipv6
     # bonding
     instmods bonding
+    # vlan
+    instmods 8021q
 }
 
 install() {
     local _arch _i _dir
     dracut_install ip arping tr dhclient
-    dracut_install -o brctl ifenslave
+    dracut_install -o brctl ifenslave vconfig
     inst "$moddir/ifup.sh" "/sbin/ifup"
     inst "$moddir/netroot.sh" "/sbin/netroot"
     inst "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
@@ -82,6 +84,7 @@ install() {
     inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
     inst_hook pre-udev 60 "$moddir/net-genrules.sh"
     inst_hook cmdline 91 "$moddir/dhcp-root.sh"
+    inst_hook cmdline 95 "$moddir/parse-vlan.sh"
     inst_hook cmdline 96 "$moddir/parse-bond.sh"
     inst_hook cmdline 97 "$moddir/parse-bridge.sh"
     inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
modules.d/40network/net-genrules.sh +5 -0
index 7176681..142634e 100755
@@ -31,6 +31,11 @@ fix_bootif() {
         IFACES=${bondslaves%% *}
     fi
 
+    if [ -e /tmp/vlan.info ]; then
+        . /tmp/vlan.info
+        IFACES=$phydevice
+    fi
+
     ifup='/sbin/ifup $env{INTERFACE}'
     [ -z "$netroot" ] && ifup="$ifup -m"
 
modules.d/40network/parse-vlan.sh new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
1.7.7.6
author
#2 lore raw

RFC PATCH 2/3 Remove netroot check in cmdline parsing code

In reply to a message not in the archive

From: Cong Wang <[email protected]>

Relax the rules for kdump, we don't specify netroot in kdump.

Cc Dave Young <[email protected]>
Cc Harald Hoyer <[email protected]>
---
 modules.d/40network/parse-bond.sh   |    3 ---
 modules.d/40network/parse-bridge.sh |    3 ---
 modules.d/40network/parse-vlan.sh   |    3 ---
 3 files changed, 0 insertions(+), 9 deletions(-)
modules.d/40network/parse-bond.sh +0 -3
index 0a4c006..c7bbc63 100755
@@ -15,9 +15,6 @@
 
 # Check if bond parameter is valid
 if getarg bond= >/dev/null ; then
-    if [ -z "$netroot" ] ; then
-        die "No netboot configured, bond is invalid"
-    fi
     command -v brctl >/dev/null 2>&1 || die "No 'brctl' installed"
 fi
 
modules.d/40network/parse-bridge.sh +0 -3
index aaa5a54..6e1fee1 100755
@@ -13,9 +13,6 @@
 
 # Check if bridge parameter is valid
 if getarg bridge= >/dev/null ; then
-    if [ -z "$netroot" ] ; then
-        die "No netboot configured, bridge is invalid"
-    fi
     command -v brctl >/dev/null 2>&1 || die "No 'brctl' installed" 
 fi
 
modules.d/40network/parse-vlan.sh +0 -3
index efe7bfa..a99c858 100644
@@ -9,9 +9,6 @@
 
 # Check if vlan parameter is valid
 if getarg vlan= >/dev/null ; then
-    if [ -z "$netroot" ] ; then
-        die "No netboot configured, vlan is invalid"
-    fi
     command -v vconfig >/dev/null 2>&1 || die "No 'vconfig' installed"
 fi
 
Signature · 1 line
1.7.7.6
author
#3 lore raw

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

In reply to a message not in the archive

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]>
---
 modules.d/40network/ifname-genrules.sh |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
modules.d/40network/ifname-genrules.sh +5 -1
index e188c88..b36f167 100755
@@ -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.
Signature · 1 line
1.7.7.6
#24 lore raw
In reply to a message not in the archive

vconfig is deprecated. Please use iproute.

- /sbin/vconfig add ${PHYSDEV} ${VID}
+ ip link add dev ${DEVICE} link ${PHYSDEV} type vlan id ${VID}

Am 21.05.2012 11:14, schrieb Cong Wang:

Quoted 167 lines

From: Cong Wang <[email protected]>

This patch adds basic vlan support in network module.

The cmdline syntax for vlan is:

	vlan=<vlanname>[:<phydevice>]

for an example:

	vlan=eth0.2:eth0

or

	vlan=eth0.2

This is just the basic syntax, vlan has other styles of naming, like "vlan2". We need to extend the syntax in the future, this patch is just a starter. ;-)

TODO: Add doc for vlan= cmdline

Any comments?

Cc Dave Young <[email protected]>
Cc Harald Hoyer <[email protected]>
---
 modules.d/40network/ifup.sh         |   18 +++++++++++++
 modules.d/40network/module-setup.sh |    5 +++-
 modules.d/40network/net-genrules.sh |    5 ++++
 modules.d/40network/parse-vlan.sh   |   46 +++++++++++++++++++++++++++++++++++
 4 files changed, 73 insertions(+), 1 deletions(-)
 create mode 100644 modules.d/40network/parse-vlan.sh
modules.d/40network/ifup.sh +18 -0
index 71b869d..aab0dfc 100755
@@ -40,6 +40,17 @@ if [ -e /tmp/bridge.info ]; then
     fi
 fi
 
+if [ -e /tmp/vlan.info ]; then
+    . /tmp/vlan.info
+    if [ "$netif" = "$phydevice" ]; then
+        if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
+            : # We need to really setup bond (recursive call)
+        else
+            netif="$vlanname"
+        fi
+    fi
+fi
+
 # disable manual ifup while netroot is set for simplifying our logic
 # in netroot case we prefer netroot to bringup $netif automaticlly
 [ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
@@ -178,6 +189,13 @@ if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
     brctl addif $bridgename $ethname
 fi
 
+if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
+    modprobe 8021q
+    ip link set "$phydevice" up
+    wait_for_if_up "$phydevice"
+    vconfig add "$phydevice" "${vlanname##*.}"
+fi
+
 # No ip lines default to dhcp
 ip=$(getarg ip)
 
modules.d/40network/module-setup.sh +4 -1
index d49b594..07cdc7f 100755
@@ -68,12 +68,14 @@ installkernel() {
     instmods ipv6
     # bonding
     instmods bonding
+    # vlan
+    instmods 8021q
 }
 
 install() {
     local _arch _i _dir
     dracut_install ip arping tr dhclient
-    dracut_install -o brctl ifenslave
+    dracut_install -o brctl ifenslave vconfig
     inst "$moddir/ifup.sh" "/sbin/ifup"
     inst "$moddir/netroot.sh" "/sbin/netroot"
     inst "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
@@ -82,6 +84,7 @@ install() {
     inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
     inst_hook pre-udev 60 "$moddir/net-genrules.sh"
     inst_hook cmdline 91 "$moddir/dhcp-root.sh"
+    inst_hook cmdline 95 "$moddir/parse-vlan.sh"
     inst_hook cmdline 96 "$moddir/parse-bond.sh"
     inst_hook cmdline 97 "$moddir/parse-bridge.sh"
     inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
modules.d/40network/net-genrules.sh +5 -0
index 7176681..142634e 100755
@@ -31,6 +31,11 @@ fix_bootif() {
         IFACES=${bondslaves%% *}
     fi
 
+    if [ -e /tmp/vlan.info ]; then
+        . /tmp/vlan.info
+        IFACES=$phydevice
+    fi
+
     ifup='/sbin/ifup $env{INTERFACE}'
     [ -z "$netroot" ] && ifup="$ifup -m"
 
modules.d/40network/parse-vlan.sh new file +46 -0
new file mode 100644
index 0000000..efe7bfa
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# Format:
+#	vlan=<vlanname>[:<phydevice>]
+#
+
+# return if vlan already parsed
+[ -n "$vlanname" ] && return
+
+# Check if vlan parameter is valid
+if getarg vlan= >/dev/null ; then
+    if [ -z "$netroot" ] ; then
+        die "No netboot configured, vlan is invalid"
+    fi
+    command -v vconfig >/dev/null 2>&1 || die "No 'vconfig' installed"
+fi
+
+parsevlan() {
+    local v=${1}:
+    set --
+    while [ -n "$v" ]; do
+        set -- "$@" "${v%%:*}"
+        v=${v#*:}
+    done
+
+    unset vlanname phydevice
+    case $# in
+    1)  vlanname=$1; phydevice="${1%.*}" ;;
+    2)  vlanname=$1; phydevice=$2 ;;
+    *)  die "vlan= requires one or two parameters" ;;
+    esac
+}
+
+unset vlanname phydevice
+
+if getarg vlan >/dev/null; then
+    # Read vlan= parameters if they exist
+    vlan="$(getarg vlan=)"
+    if [ ! "$vlan" = "vlan" ]; then
+        parsevlan "$(getarg vlan=)"
+    fi
+
+    echo "vlanname=\"$vlanname\"" > /tmp/vlan.info
+    echo "phydevice=\"$phydevice\"" >> /tmp/vlan.info
+    return
+fi
#5 lore raw

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

In reply to a message not in the archive

Am 21.05.2012 11:14, schrieb Cong Wang:

Quoted 23 lines

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]>
---
 modules.d/40network/ifname-genrules.sh |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
modules.d/40network/ifname-genrules.sh +0 -0
index e188c88..b36f167 100755
@@ -10,7 +10,11 @@ fi
 {
     for p in $(getargs ifname=); do

modules.d/40network/ifname-genrules.sh fi · line 20

Quoted 10 lines
modules.d/40network/ifname-genrules.sh +5 -1
         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.

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

#26 lore raw
In reply to a message not in the archive

Review

Quoted 5 lines · Harald Hoyer

vconfig is deprecated. Please use iproute.

(quoted diff) +1 -1
-           /sbin/vconfig add ${PHYSDEV} ${VID}
+           ip link add dev ${DEVICE} link ${PHYSDEV} type vlan id ${VID}

Fair enough, I will drop it. ;-)

BTW, I think ifenslave can be dropped too, as we can use the /proc interface to add slaves.

Thanks!

#7 lore raw

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

In reply to a message not in the archive
Quoted 11 lines · Harald Hoyer

modules.d/40network/ifname-genrules.sh fi · line 20

Quoted 9 lines
modules.d/40network/ifname-genrules.sh +5 -1
-        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. :(

#9 lore raw

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

In reply to a message not in the archive

Am 21.05.2012 11:31, schrieb Cong Wang:

Quoted 17 lines · Harald Hoyer
Quoted 10 lines
Quoted 10 lines

- printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"

modules.d/40network/ifname-genrules.sh +4 -0
+        #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

Quoted 3 lines
Quoted 1 line

# 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:

Quoted 7 lines

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

#11 lore raw

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

In reply to a message not in the archive
Quoted 21 lines · Harald Hoyer

Am 21.05.2012 11:31, schrieb Cong Wang:

Quoted 20 lines · Harald Hoyer
Quoted 10 lines
Quoted 10 lines

- printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"

(quoted diff) +4 -0
+        #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

Quoted 3 lines
Quoted 1 line

# 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"

Quoted 7 lines
Quoted 4 lines

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!

#13 lore raw

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

In reply to a message not in the archive

Am 21.05.2012 12:19, schrieb Cong Wang:

Quoted 42 lines · Harald Hoyer
Quoted 21 lines

Am 21.05.2012 11:31, schrieb Cong Wang:

Quoted 20 lines · Harald Hoyer
Quoted 10 lines
Quoted 10 lines

- printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"

(quoted diff) +4 -0
+        #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

Quoted 3 lines
Quoted 1 line

# 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"

Quoted 7 lines
Quoted 4 lines

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.

Quoted 6 lines

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!

it would skip eth0.2, because its DEVPATH contains "virtual" and the rule is never matched

#15 lore raw

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

In reply to a message not in the archive

On 05/21/2012 07:27 PM, Harald Hoyer wrote:!

Quoted 3 lines

it would skip eth0.2, because its DEVPATH contains "virtual" and the rule is never matched

When eth0.2 comes up, yes.

When eth0 comes up, no, both lines will be applied to eth0 and the final result is that eth0 will be renamed to eth0.2.

And eth0 comes up before eth0.2, so...

#17 lore raw

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

In reply to a message not in the archive

Am 22.05.2012 03:43, schrieb Cong Wang:

Quoted 11 lines

On 05/21/2012 07:27 PM, Harald Hoyer wrote:!

Quoted 3 lines

it would skip eth0.2, because its DEVPATH contains "virtual" and the rule is never matched

When eth0.2 comes up, yes.

When eth0 comes up, no, both lines will be applied to eth0 and the final result is that eth0 will be renamed to eth0.2.

And eth0 comes up before eth0.2, so...

well, but you wouldn't specify "ifname=" on the kernel command line for eth0.2, would you?

#19 lore raw

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

In reply to a message not in the archive
Quoted 8 lines · Harald Hoyer

Am 22.05.2012 03:43, schrieb Cong Wang:

Quoted 7 lines

On 05/21/2012 07:27 PM, Harald Hoyer wrote:!

Quoted 3 lines

it would skip eth0.2, because its DEVPATH contains "virtual" and the rule is never matched

When eth0.2 comes up, yes.

Quoted 7 lines
Quoted 4 lines

When eth0 comes up, no, both lines will be applied to eth0 and the final result is that eth0 will be renamed to eth0.2.

And eth0 comes up before eth0.2, so...

well, but you wouldn't specify "ifname=" on the kernel command line for eth0.2, would you?

We use ip=eth0.2:dhcp to get IP for eth0.2 via DHCP, so ifname=eth0.2:XXX is requried by ip=, no?

#21 lore raw

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

In reply to a message not in the archive

Am 22.05.2012 15:43, schrieb Cong Wang:

Quoted 12 lines · Harald Hoyer
Quoted 11 lines

Am 22.05.2012 03:43, schrieb Cong Wang:

Quoted 10 lines

On 05/21/2012 07:27 PM, Harald Hoyer wrote:!

Quoted 3 lines

it would skip eth0.2, because its DEVPATH contains "virtual" and the rule is never matched

When eth0.2 comes up, yes.

When eth0 comes up, no, both lines will be applied to eth0 and the final result is that eth0 will be renamed to eth0.2.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

And eth0 comes up before eth0.2, so...

well, but you wouldn't specify "ifname=" on the kernel command line for eth0.2, would you?

We use ip=eth0.2:dhcp to get IP for eth0.2 via DHCP, so ifname=eth0.2:XXX is requried by ip=, no?

no, you would need ifname=eth0:XXX

#23 lore raw

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

In reply to a message not in the archive
Quoted 7 lines · Harald Hoyer

Am 22.05.2012 15:43, schrieb Cong Wang:

Quoted 3 lines

We use ip=eth0.2:dhcp to get IP for eth0.2 via DHCP, so ifname=eth0.2:XXX is requried by ip=, no?

no, you would need ifname=eth0:XXX

Yeah, only specifying ifname=eth0:XXX seems also work.

Actually I am confused by the doc of ifname=, which said:

Note: If you use this option you _must_ specify an ifname= argument for all interfaces used in ip= or fcoe= arguments.

I think it is out-of-date? In my case, "ip=eth0.2:dhcp ifname=eth0:XXX", eth0.2 appears in ip= but does not have to be in ifname=, as you suggested.

What's more, how about bridge and bonding cases? Do we have to specify the slave device in ifname= instead of the master device??

Thanks!