[systemd-devel] [PATCH 4/5] udev: net-name-slot - disable by kernel command line switch

Tom Gundersen teg at jklm.no
Mon Mar 18 06:17:27 PDT 2013


The properties will still be set in the udev database, but they will not be used
for setting the interface names. As for the other kernel commandline switches,
we allow it to be prefixed by 'rd.' to only apply in the initrd.
---
 TODO                         | 2 --
 man/udev.xml                 | 6 ++++++
 rules/80-net-name-slot.rules | 4 ++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/TODO b/TODO
index fcc3471..c73e8dc 100644
--- a/TODO
+++ b/TODO
@@ -28,8 +28,6 @@ Fedora 19:
 * cgroup attrs:
   - update dbus interface docs in wiki
 
-* kernel cmdline switch to turn off predictable network interface names
-
 * journal is not closed properly at shutdown when run in a container?
 
 * localed:
diff --git a/man/udev.xml b/man/udev.xml
index fed8a5e..61ee0ae 100644
--- a/man/udev.xml
+++ b/man/udev.xml
@@ -100,6 +100,12 @@
             external helper program.</para>
           </listitem>
         </varlistentry>
+        <varlistentry>
+          <term><varname>udev.no-net-name</varname></term>
+          <listitem>
+            <para>If specified, udev will not try to assign persistent names to the network interfaces.</para>
+          </listitem>
+        </varlistentry>
       </variablelist>
     </refsect2>
 
diff --git a/rules/80-net-name-slot.rules b/rules/80-net-name-slot.rules
index 2834e82..045631a 100644
--- a/rules/80-net-name-slot.rules
+++ b/rules/80-net-name-slot.rules
@@ -4,6 +4,10 @@ ACTION=="remove", GOTO="net_name_slot_end"
 SUBSYSTEM!="net", GOTO="net_name_slot_end"
 NAME!="", GOTO="net_name_slot_end"
 
+IMPORT{cmdline}="udev.no-net-name"
+ENV{udev.no-net-name}=="1", GOTO="net_name_slot_end"
+ENV{rd.udev.no-net-name}=="1", TEST=="/etc/initrd-release", GOTO="net_name_slot_end"
+
 NAME=="", ENV{ID_NET_NAME_ONBOARD}!="", NAME="$env{ID_NET_NAME_ONBOARD}"
 NAME=="", ENV{ID_NET_NAME_SLOT}!="", NAME="$env{ID_NET_NAME_SLOT}"
 NAME=="", ENV{ID_NET_NAME_PATH}!="", NAME="$env{ID_NET_NAME_PATH}"
-- 
1.8.2



More information about the systemd-devel mailing list