File biosdevname_udevrule_rename_all_network_devices.patch of Package biosdevname

From: Tom Gundersen <tgunders@redhat.com>
Subject: Fix double renaming of network interfaces on systems with systemd
References: bnc#869614
Patch-Mainline: yes
Git-commit: 6f7fbcc352aeae08b5cf2a8e608f92abf98529f8
Git-repo: linux.dell.com/biosdevname.git

Signed-off-by: Thomas Renninger <trenn@suse.de>

On systems with systemd, the network interfaces which are renamed by
biosdevname, could get renamed again by systemd. This happens because,
two ADD events get generated for every network interface and on the
second ADD event, the KERNEL!="eth*" check in 71-biosdevname.rules
matches as the interfaces will have em names. As a result, the NAME
gets unset and the interface will get renamed again by
80-net-name-slot.rules again to systemd naming scheme.

This patch addresses the issue by removing the KERNEL!="eth*" check.

Also, this patch enhances the 71-biosdevname.rules to

1. Check the interface type and run biosdevname if it matches ARPHRD_ETHER
2. Skip running biosdevname if the interface is a virtual device such
as vlan etc.

Index: biosdevname-0.5.0/biosdevname.rules.in
===================================================================
--- biosdevname-0.5.0.orig/biosdevname.rules.in
+++ biosdevname-0.5.0/biosdevname.rules.in
@@ -1,7 +1,8 @@
 SUBSYSTEM!="net", GOTO="netdevicename_end"
-KERNEL!="eth*",   GOTO="netdevicename_end"
 ACTION!="add",    GOTO="netdevicename_end"
 NAME=="?*",       GOTO="netdevicename_end"
+ATTR{type}!="1",  GOTO="netdevicename_end"
+ENV{DEVTYPE}=="?*", GOTO="netdevicename_end"
 
 # whitelist all Dell systems
 ATTR{[dmi/id]sys_vendor}=="Dell*", ENV{UDEV_BIOSDEVNAME}="1"
@@ -21,6 +22,6 @@ LABEL="netdevicename_start"
 
 # using NAME= instead of setting INTERFACE_NAME, so that persistent
 # names aren't generated for these devices, they are "named" on each boot.
-PROGRAM="/sbin/biosdevname --policy physical --smbios 2.6 --nopirq -i %k", NAME="%c",  OPTIONS+="string_escape=replace"
+SUBSYSTEMS=="pci", PROGRAM="/sbin/biosdevname --policy physical --smbios 2.6 --nopirq -i %k", NAME="%c",  OPTIONS+="string_escape=replace"
 
 LABEL="netdevicename_end"
openSUSE Build Service is sponsored by