From: Harald Hoyer Date: Fri, 6 Jul 2012 10:31:31 +0000 (+0200) Subject: network: do not rename other interfaces and document the ifname usage X-Git-Tag: 021~63 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1760dfc051dfd84e932dbd63ba2b3c7e8b6ecf50;p=platform%2Fupstream%2Fdracut.git network: do not rename other interfaces and document the ifname usage We do not support renaming in the kernel namespace anymore (as udev does that not anymore). So, if a user wants to use ifname, he has to rename to a custom namespace. "eth[0-9]+" is not allowed anymore. --- diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc index 5f0396c..755d641 100644 --- a/dracut.cmdline.7.asc +++ b/dracut.cmdline.7.asc @@ -295,24 +295,51 @@ Network **ip=**__:_{dhcp|on|any|dhcp6|auto6}_[:[__][:__]]:: This parameter can be specified multiple times. + +===================== dhcp|on|any|dhcp6::: get ip from dhcp server on a specific interface auto6::: do IPv6 autoconfiguration -::: optionally set on the +::: optionally **set** on the . This +cannot be used in conjunction with the **ifname** argument for the +same . +===================== + +[IMPORTANT] +===================== +It is recommended to either bind to a MAC with the **ifname** +argument. Or use biosdevname to name your interfaces, which will then have names according to their hardware location. + +em::: for embedded NICs +p#_::: for cards in PCI slots +===================== **ip=**__:__:__:__:__:__:_{none|off|dhcp|on|any|dhcp6|auto6|ibft}_[:[__][:__]]:: explicit network configuration. If you want do define a IPv6 address, put it in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple times. + -::: optionally set on the +===================== +::: optionally **set** on the . This +cannot be used in conjunction with the **ifname** argument for the +same . +===================== + +[IMPORTANT] +===================== +It is recommended to either bind to a MAC with the **ifname** +argument. Or use biosdevname to name your interfaces, which will then have names according to their hardware location. + +em::: for embedded NICs +p#_::: for cards in PCI slots +===================== **ifname=**__:__:: - Assign network device name (ie eth0) to the NIC with MAC . - Note: If you use this option you _must_ specify an ifname= argument for all - interfaces used in ip= or fcoe= arguments. However, if the interface in - ip= or fcoe= is a bridge, bonding or vlan interface, you should specify - an ifname= for _each_ of its underlying interfaces. This parameter can be - specified multiple times. + Assign network device name (ie "bootnet") to the NIC with MAC . ++ +[IMPORTANT] + +Do **not** use the default kernel naming scheme for the interface name, +as it can conflict with the kernel names. So, don't use "eth[0-9]+" for the +interface name. Better name it "bootnet" or "bluesocket". **bootdev=**__:: specify network interface to use routing and netroot information from. @@ -430,8 +457,10 @@ FCoE **fcoe=**__:_{dcb|nodcb}_:: Try to connect to a FCoE SAN through the NIC specified by __ or __ or EDD settings. For the second argument, currently only nodcb is - supported. This parameter can be specified multiple times. Note: letters in - the MAC-address must be lowercase! + supported. This parameter can be specified multiple times. ++ +[NOTE] +letters in the MAC-address must be lowercase! NBD ~~~ diff --git a/modules.d/40network/ifname-genrules.sh b/modules.d/40network/ifname-genrules.sh index b0b429c..d5f8b0f 100755 --- a/modules.d/40network/ifname-genrules.sh +++ b/modules.d/40network/ifname-genrules.sh @@ -15,9 +15,4 @@ command -v parse_ifname_opts >/dev/null || . /lib/net-lib.sh printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if" done - # Rename non named interfaces out of the way for named ones. - for p in $(getargs ifname=); do - parse_ifname_opts $p - printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME!="?*", KERNEL=="%s", NAME="%%k-renamed"\n' "$ifname_if" - done -} > /etc/udev/rules.d/50-ifname.rules +} >> /etc/udev/rules.d/80-ifname.rules diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh index 3bb5d80..8aeee2d 100755 --- a/modules.d/40network/net-genrules.sh +++ b/modules.d/40network/net-genrules.sh @@ -54,7 +54,7 @@ fix_bootif() { # Default: We don't know the interface to use, handle all else - printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/61-default-net.rules + printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/91-default-net.rules fi -} > /etc/udev/rules.d/60-net.rules +} > /etc/udev/rules.d/90-net.rules diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh index 9a1e004..641b21e 100644 --- a/modules.d/40network/net-lib.sh +++ b/modules.d/40network/net-lib.sh @@ -304,4 +304,14 @@ parse_ifname_opts() { die "Invalid arguments for ifname=" ;; esac + + case $ifname_if in + eth[0-9]|eth[0-9][0-9]|eth[0-9][0-9][0-9]|eth[0-9][0-9][0-9][0-9]) + warn "ifname=$ifname_if uses the kernel name space for interfaces" + warn "This can fail for multiple network interfaces and is discouraged!" + warn "Please use a custom name like \"netboot\" or \"bluesocket\"" + warn "or use biosdevname and no ifname= at all." + ;; + esac + } diff --git a/modules.d/95fcoe/fcoe-genrules.sh b/modules.d/95fcoe/fcoe-genrules.sh index d87f72c..80894ed 100755 --- a/modules.d/95fcoe/fcoe-genrules.sh +++ b/modules.d/95fcoe/fcoe-genrules.sh @@ -13,4 +13,4 @@ else printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s"\n' "$fcoe_interface" "$fcoe_dcb" fi -} > /etc/udev/rules.d/60-fcoe.rules +} > /etc/udev/rules.d/92-fcoe.rules