Blame 0043-network-do-not-rename-other-interfaces-and-document-.patch

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