udev-builtin-net_id.c revision a4bbef099209d4e3bccd913cd30da536f8971064
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering This file is part of systemd.
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering Copyright 2012 Kay Sievers <kay@vrfy.org>
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering systemd is free software; you can redistribute it and/or modify it
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering under the terms of the GNU Lesser General Public License as published by
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering (at your option) any later version.
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering systemd is distributed in the hope that it will be useful, but
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering Lesser General Public License for more details.
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering You should have received a copy of the GNU Lesser General Public License
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
0dad12c190b7493955cd60d2a1625199b1709f69Lennart Poettering * Predictable network interface device names based on:
72f1d5a2880d103dc1c1746f5c02e192e054705eLennart Poettering * - firmware/bios-provided index numbers for on-board devices
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * - firmware-provided pci-express hotplug slot index number
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * - physical/geographical location of the hardware
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * - the interface's MAC address
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering * Two character prefixes based on the type of interface:
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * en -- ethernet
0d39fa9c69b97a2ceb156053deef69c0866c2b97Lennart Poettering * Type of names:
c004493cdefc1f43a3956ca529e8070f8d70be56Lennart Poettering * o<index> -- on-board device index number
a09abc4ae0bdc0200324eaa0416f23ff2170ec4eLennart Poettering * s<slot>[f<function>][d<dev_id>] -- hotplug slot index number
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * x<MAC> -- MAC address
15a5e95075a7f6007dd97b2a165c8ed16fe683dfLennart Poettering * [P<domain>]p<bus>s<slot>[f<function>][d<dev_id>]
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * -- PCI geographical location
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * [P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * -- USB port number chain
bb99a35a873c35e80b0b47fe045081022660374dLennart Poettering * All multi-function PCI devices will carry the [f<function>] number in the
3ed08c446cfaaae2b234fdfeb0c34ab6b4748c3eLennart Poettering * device name, including the function 0 device.
3ed08c446cfaaae2b234fdfeb0c34ab6b4748c3eLennart Poettering * When using PCI geography, The PCI domain is only prepended when it is not 0.
3ed08c446cfaaae2b234fdfeb0c34ab6b4748c3eLennart Poettering * For USB devices the full chain of port numbers of hubs is composed. If the
3ed08c446cfaaae2b234fdfeb0c34ab6b4748c3eLennart Poettering * name gets longer than the maximum number of 15 characters, the name is not
3ed08c446cfaaae2b234fdfeb0c34ab6b4748c3eLennart Poettering * The usual USB configuration == 1 and interface == 0 values are suppressed.
3ed08c446cfaaae2b234fdfeb0c34ab6b4748c3eLennart Poettering * PCI ethernet card with firmware index "1":
3ed08c446cfaaae2b234fdfeb0c34ab6b4748c3eLennart Poettering * ID_NET_NAME_ONBOARD=eno1
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_ONBOARD_LABEL=Ethernet Port 1
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * PCI ethernet card in hotplug slot with firmware index number:
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * /sys/devices/pci0000:00/0000:00:1c.3/0000:05:00.0/net/ens1
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_MAC=enx000000000466
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_PATH=enp5s0
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_SLOT=ens1
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * PCI ethernet multi-function card with 2 ports:
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/enp2s0f0
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_MAC=enx78e7d1ea46da
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_PATH=enp2s0f0
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.1/net/enp2s0f1
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_MAC=enx78e7d1ea46dc
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_PATH=enp2s0f1
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * PCI wlan card:
bb99a35a873c35e80b0b47fe045081022660374dLennart Poettering * /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlp3s0
bb99a35a873c35e80b0b47fe045081022660374dLennart Poettering * ID_NET_NAME_MAC=wlx0024d7e31130
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_PATH=wlp3s0
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * USB built-in 3G modem:
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.6/net/wwp0s29u1u4i6
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_MAC=wwx028037ec0200
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_PATH=wwp0s29u1u4i6
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * USB Android phone:
a5344d2c3b0f14e954ce1c0ef905c5b44bc5bf0aLennart Poettering * /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/net/enp0s29u1u2
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_MAC=enxd626b3450fb5
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering * ID_NET_NAME_PATH=enp0s29u1u2
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering/* retrieve on-board index number and label from firmware */
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poetteringstatic int dev_pci_onboard(struct udev_device *dev, struct netnames *names) {
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering /* ACPI _DSM -- device specific method for naming a PCI or PCI Express device */
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering index = udev_device_get_sysattr_value(names->pcidev, "acpi_index");
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering /* SMBIOS type 41 -- Onboard Devices Extended Information */
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering index = udev_device_get_sysattr_value(names->pcidev, "index");
72f1d5a2880d103dc1c1746f5c02e192e054705eLennart Poettering snprintf(names->pci_onboard, sizeof(names->pci_onboard), "o%d", idx);
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering names->pci_onboard_label = udev_device_get_sysattr_value(names->pcidev, "label");
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering/* read the 256 bytes PCI configuration space to check the multi-function bit */
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic bool is_pci_multifunction(struct udev_device *dev) {
72f1d5a2880d103dc1c1746f5c02e192e054705eLennart Poettering snprintf(filename, sizeof(filename), "%s/config", udev_device_get_syspath(dev));
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering if (fread(&config, sizeof(config), 1, f) != 1)
72f1d5a2880d103dc1c1746f5c02e192e054705eLennart Poettering /* bit 0-6 header type, bit 7 multi/single function device */
72f1d5a2880d103dc1c1746f5c02e192e054705eLennart Poettering if ((config[PCI_HEADER_TYPE] & 0x80) != 0)
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poetteringstatic int dev_pci_slot(struct udev_device *dev, struct netnames *names) {
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering struct udev *udev = udev_device_get_udev(names->pcidev);
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering unsigned int dev_id = 0;
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering if (sscanf(udev_device_get_sysname(names->pcidev), "%x:%x:%x.%d", &domain, &bus, &slot, &func) != 4)
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering /* kernel provided multi-device index */
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering attr = udev_device_get_sysattr_value(dev, "dev_id");
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering /* compose a name based on the raw kernel's PCI bus, slot numbers */
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering l = strpcpyf(&s, l, "p%ds%d", bus, slot);
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering if (func > 0 || is_pci_multifunction(names->pcidev))
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering /* ACPI _SUN -- slot user number */
61c024b328d5493a334242a4d01ba923582093faZbigniew Jędrzejewski-Szmek pci = udev_device_new_from_subsystem_sysname(udev, "subsystem", "pci");
6e5abe1564070a760196b97031eca9cf5e95e8a2Zbigniew Jędrzejewski-Szmek snprintf(slots, sizeof(slots), "%s/slots", udev_device_get_syspath(pci));
0dad12c190b7493955cd60d2a1625199b1709f69Lennart Poettering for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
9a7800af088cc013573310504ae76e325d44d4b4Zbigniew Jędrzejewski-Szmek i = strtol(dent->d_name, &rest, 10);
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering snprintf(str, sizeof(str), "%s/%s/address", slots, dent->d_name);
5c0aa72a4999bdcf03fe93ed5c8213c2b4c681f0Lennart Poettering if (read_one_line_file(str, &address) >= 0) {
5c0aa72a4999bdcf03fe93ed5c8213c2b4c681f0Lennart Poettering /* match slot address with device by stripping the function */
a5344d2c3b0f14e954ce1c0ef905c5b44bc5bf0aLennart Poettering if (strneq(address, udev_device_get_sysname(names->pcidev), strlen(address)))
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering l = strpcpyf(&s, l, "s%d", hotplug_slot);
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering if (func > 0 || is_pci_multifunction(names->pcidev))
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poetteringstatic int names_pci(struct udev_device *dev, struct netnames *names) {
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering /* check if our direct parent is a PCI device with no other bus in-between */
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering if (streq_ptr("pci", udev_device_get_subsystem(parent))) {
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering names->pcidev = udev_device_get_parent_with_subsystem_devtype(dev, "pci", NULL);
ee55db41442ad8055f5a84a339b1e0e22bc037c4Lennart Poetteringstatic int names_usb(struct udev_device *dev, struct netnames *names) {
5c0aa72a4999bdcf03fe93ed5c8213c2b4c681f0Lennart Poettering usbdev = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface");
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering /* get USB port number chain, configuration, interface */
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering strscpy(name, sizeof(name), udev_device_get_sysname(usbdev));
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering /* prefix every port number in the chain with "u"*/
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering l = strpcpyl(&s, sizeof(names->usb_ports), "u", ports, NULL);
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering /* append USB config number, suppress the common config == 1 */
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering l = strpcpyl(&s, sizeof(names->usb_ports), "c", config, NULL);
73843b52585d42cc1a970a1c664818ece6942e9eLennart Poettering /* append USB interface number, suppress the interface == 0 */
0dad12c190b7493955cd60d2a1625199b1709f69Lennart Poettering l = strpcpyl(&s, sizeof(names->usb_ports), "i", interf, NULL);
73843b52585d42cc1a970a1c664818ece6942e9eLennart Poetteringstatic int names_bcma(struct udev_device *dev, struct netnames *names) {
4941e4aca907f26bf74aa9efe1c70ccad1d10a82Zbigniew Jędrzejewski-Szmek bcmadev = udev_device_get_parent_with_subsystem_devtype(dev, "bcma", NULL);
7f3e62571a63ac90de6ac5eefeeb8d3e9aa6f49eLennart Poettering /* bus num:core num */
fe6521272ba203ec8f0d5a94f0729960b3f90525Lennart Poettering if (sscanf(udev_device_get_sysname(bcmadev), "bcma%*d:%d", &core) != 1)
5c0aa72a4999bdcf03fe93ed5c8213c2b4c681f0Lennart Poettering /* suppress the common core == 0 */
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering snprintf(names->bcma_core, sizeof(names->bcma_core), "b%d", core);
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poetteringstatic int names_mac(struct udev_device *dev, struct netnames *names) {
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering const char *s;
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering unsigned int i;
5ffa8c818120e35c89becd938d160235c069dd12Zbigniew Jędrzejewski-Szmek /* check for NET_ADDR_PERM, skip random MAC addresses */
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering s = udev_device_get_sysattr_value(dev, "addr_assign_type");
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering s = udev_device_get_sysattr_value(dev, "address");
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering if (sscanf(s, "%x:%x:%x:%x:%x:%x", &a1, &a2, &a3, &a4, &a5, &a6) != 6)
4850d39ab72e7cb00a6e9c9aa4745c997674efa6Lennart Poettering /* skip empty MAC addresses */
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering/* IEEE Organizationally Unique Identifier vendor string */
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poetteringstatic int ieee_oui(struct udev_device *dev, struct netnames *names, bool test) {
18c7ed186be28800a2eeb37ad31c9c44480d3d9cLennart Poettering /* skip commonly misused 00:00:00 (Xerox) prefix */
4cd9a9d9ecf3a8835e21930f3215a5f5b74144beLennart Poettering if (memcmp(names->mac, "\0\0\0", 3) == 0)
6e5abe1564070a760196b97031eca9cf5e95e8a2Zbigniew Jędrzejewski-Szmek snprintf(str, sizeof(str), "OUI:%02X%02X%02X%02X%02X%02X",
6e5abe1564070a760196b97031eca9cf5e95e8a2Zbigniew Jędrzejewski-Szmek names->mac[0], names->mac[1], names->mac[2],
6e5abe1564070a760196b97031eca9cf5e95e8a2Zbigniew Jędrzejewski-Szmek names->mac[3], names->mac[4], names->mac[5]);
61c024b328d5493a334242a4d01ba923582093faZbigniew Jędrzejewski-Szmek udev_builtin_hwdb_lookup(dev, NULL, str, NULL, test);
fe6521272ba203ec8f0d5a94f0729960b3f90525Lennart Poetteringstatic int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool test) {
fe6521272ba203ec8f0d5a94f0729960b3f90525Lennart Poettering unsigned int i;
61c024b328d5493a334242a4d01ba923582093faZbigniew Jędrzejewski-Szmek /* handle only ARPHRD_ETHER devices */
fe6521272ba203ec8f0d5a94f0729960b3f90525Lennart Poettering s = udev_device_get_sysattr_value(dev, "type");
4cd9a9d9ecf3a8835e21930f3215a5f5b74144beLennart Poettering /* skip stacked devices, like VLANs, ... */
4cd9a9d9ecf3a8835e21930f3215a5f5b74144beLennart Poettering s = udev_device_get_sysattr_value(dev, "ifindex");
8b38f3cc3eb73adf9536cb73d0f319e60d42ea0cLennart Poettering p = udev_device_get_sysattr_value(dev, "iflink");
61c024b328d5493a334242a4d01ba923582093faZbigniew Jędrzejewski-Szmek snprintf(str, sizeof(str), "%sx%02x%02x%02x%02x%02x%02x", prefix,
fe6521272ba203ec8f0d5a94f0729960b3f90525Lennart Poettering names.mac[0], names.mac[1], names.mac[2],
61c024b328d5493a334242a4d01ba923582093faZbigniew Jędrzejewski-Szmek names.mac[3], names.mac[4], names.mac[5]);
61c024b328d5493a334242a4d01ba923582093faZbigniew Jędrzejewski-Szmek udev_builtin_add_property(dev, test, "ID_NET_NAME_MAC", str);
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering /* get PCI based path names, we compose only PCI based paths */
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering /* plain PCI device */
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering if (snprintf(str, sizeof(str), "%s%s", prefix, names.pci_onboard) < (int)sizeof(str))
5ffa8c818120e35c89becd938d160235c069dd12Zbigniew Jędrzejewski-Szmek udev_builtin_add_property(dev, test, "ID_NET_NAME_ONBOARD", str);
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering if (snprintf(str, sizeof(str), "%s%s", prefix, names.pci_onboard_label) < (int)sizeof(str))
1ae464e09376853c52075ec4d8a6bfc4b4036d0cThomas Hindoe Paaboel Andersen udev_builtin_add_property(dev, test, "ID_NET_LABEL_ONBOARD", str);
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering if (snprintf(str, sizeof(str), "%s%s", prefix, names.pci_path) < (int)sizeof(str))
5ffa8c818120e35c89becd938d160235c069dd12Zbigniew Jędrzejewski-Szmek udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str);
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering if (snprintf(str, sizeof(str), "%s%s", prefix, names.pci_slot) < (int)sizeof(str))
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering udev_builtin_add_property(dev, test, "ID_NET_NAME_SLOT", str);
3ed08c446cfaaae2b234fdfeb0c34ab6b4748c3eLennart Poettering /* USB device */
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_path, names.usb_ports) < (int)sizeof(str))
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str);
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_slot, names.usb_ports) < (int)sizeof(str))
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering udev_builtin_add_property(dev, test, "ID_NET_NAME_SLOT", str);
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering /* Broadcom bus */
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering if (err >= 0 && names.type == NET_BCMA) {
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_path, names.bcma_core) < (int)sizeof(str))
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str);
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_slot, names.bcma_core) < (int)sizeof(str))
b070e7f3c9ed680c821bd89d42506695f2438506Lennart Poettering udev_builtin_add_property(dev, test, "ID_NET_NAME_SLOT", str);