Blame SOURCES/0002-Ignore-naming-of-non-Ethernet-network-interfaces.patch

9dd2b6
From eb7cb935f585d41163bb9bf0e64f267cb0597bdd Mon Sep 17 00:00:00 2001
9dd2b6
From: Sujith Pandel <sujithpandel@gmail.com>
9dd2b6
Date: Tue, 14 Mar 2017 11:44:23 +0530
9dd2b6
Subject: [PATCH] Ignore naming of non-Ethernet network interfaces
9dd2b6
9dd2b6
Support of biosdevname is to name Ethernet interfaces only, as per biosdevname spec.
9dd2b6
Currently, manual call of biosdevname on other types of network interfaces will return interface names.
9dd2b6
This code change is to ignore naming of Infiniband and other types of network interfaces.
9dd2b6
9dd2b6
(cherry picked from commit 609f20c26f40ae4883f5e8c9b241470260722b3f)
9dd2b6
---
9dd2b6
 src/bios_device.c | 3 +++
9dd2b6
 src/eths.h        | 5 +++++
9dd2b6
 2 files changed, 8 insertions(+)
9dd2b6
9dd2b6
diff --git a/src/bios_device.c b/src/bios_device.c
9dd2b6
index 6636e67..e9d5177 100644
9dd2b6
--- a/src/bios_device.c
9dd2b6
+++ b/src/bios_device.c
9dd2b6
@@ -238,6 +238,9 @@ static void match_pci_and_eth_devs(struct libbiosdevname_state *state)
9dd2b6
 		/* Loop through all ether devices to find match */
9dd2b6
 		unparse_pci_name(pci_name, sizeof(pci_name), p->pci_dev);
9dd2b6
 		list_for_each_entry(n, &state->network_devices, node) {
9dd2b6
+			//Accept only Ethernet devices, otherwise ignore.
9dd2b6
+			if(!netdev_arphrd_type_is_eth(n))
9dd2b6
+				continue;
9dd2b6
 			if (strncmp(n->drvinfo.bus_info, pci_name, sizeof(n->drvinfo.bus_info)))
9dd2b6
 				continue;
9dd2b6
 			/* Ignore if devtype is fcoe */
9dd2b6
diff --git a/src/eths.h b/src/eths.h
9dd2b6
index a145b4f..b695d3d 100644
9dd2b6
--- a/src/eths.h
9dd2b6
+++ b/src/eths.h
9dd2b6
@@ -63,4 +63,9 @@ static inline int netdev_devtype_is_fcoe(const struct network_device *dev)
9dd2b6
 	return (dev->devtype_is_fcoe == 1);
9dd2b6
 }
9dd2b6
 
9dd2b6
+static inline int netdev_arphrd_type_is_eth(const struct network_device *dev)
9dd2b6
+{
9dd2b6
+        return (dev->arphrd_type == ARPHRD_ETHER);
9dd2b6
+}
9dd2b6
+
9dd2b6
 #endif /* __ETHS_H_INCLUDED */
9dd2b6
-- 
9dd2b6
2.9.3
9dd2b6