summaryrefslogtreecommitdiff
path: root/src/udev/udev-builtin-net_id.c
diff options
context:
space:
mode:
authorArseny Maslennikov <arseny@altlinux.org>2018-08-29 04:07:55 +0300
committerArseny Maslennikov <arseny@altlinux.org>2018-09-18 20:13:42 +0300
commit938d30aa98df887797c9e05074a562ddacdcdf5e (patch)
treeefb226ef2de337d8febe5adf8b97dbb92a49eac8 /src/udev/udev-builtin-net_id.c
parent6058516a14ada1748313af6783f5b4e7e3006654 (diff)
downloadsystemd-938d30aa98df887797c9e05074a562ddacdcdf5e.tar.gz
udev: Introduce predictable naming for InfiniBand NICs
We've long neglected IP-over-InfiniBand network interfaces, let's treat them the same way we treat anyone else. IPoIB interfaces will retain the 'ib' prefix; otherwise the naming scheme is the same one we use for other network interfaces. E.g. a IPoIB network device provided by a PCI card at bus 21 slot 0 function 6 will be named 'ibp21s0f6'.
Diffstat (limited to 'src/udev/udev-builtin-net_id.c')
-rw-r--r--src/udev/udev-builtin-net_id.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index cb49ade4d8..239a825ae5 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -11,6 +11,7 @@
*
* Two character prefixes based on the type of interface:
* en — Ethernet
+ * ib — InfiniBand
* sl — serial line IP (slip)
* wl — wlan
* ww — wwan
@@ -67,6 +68,12 @@
* ID_NET_NAME_MAC=wlx0024d7e31130
* ID_NET_NAME_PATH=wlp3s0
*
+ * PCI IB host adapter with 2 ports:
+ * /sys/devices/pci0000:00/0000:00:03.0/0000:15:00.0/net/ibp21s0f0
+ * ID_NET_NAME_PATH=ibp21s0f0
+ * /sys/devices/pci0000:00/0000:00:03.0/0000:15:00.1/net/ibp21s0f1
+ * ID_NET_NAME_PATH=ibp21s0f1
+ *
* USB built-in 3G modem:
* /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.6/net/wwp0s29u1u4i6
* ID_NET_NAME_MAC=wwx028037ec0200
@@ -704,7 +711,9 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool
struct netnames names = {};
int err;
- /* handle only ARPHRD_ETHER and ARPHRD_SLIP devices */
+ /* handle only ARPHRD_ETHER, ARPHRD_SLIP
+ * and ARPHRD_INFINIBAND devices
+ */
s = udev_device_get_sysattr_value(dev, "type");
if (!s)
return EXIT_FAILURE;
@@ -713,6 +722,9 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool
case ARPHRD_ETHER:
prefix = "en";
break;
+ case ARPHRD_INFINIBAND:
+ prefix = "ib";
+ break;
case ARPHRD_SLIP:
prefix = "sl";
break;