From 247641170e6359ee4fc27c0b2871ce935cec338b Mon Sep 17 00:00:00 2001 From: CentOS Buildsys Date: Sep 23 2013 14:18:24 +0000 Subject: import biosdevname-0.5.0-5.el7.src.rpm --- diff --git a/.biosdevname.metadata b/.biosdevname.metadata new file mode 100644 index 0000000..18c269f --- /dev/null +++ b/.biosdevname.metadata @@ -0,0 +1 @@ +708ccec6a312869f5ebfb0dd393f3b218dd5d171 SOURCES/biosdevname-0.5.0.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/0001-CoverityScan-update.patch b/SOURCES/0001-CoverityScan-update.patch new file mode 100644 index 0000000..8494f58 --- /dev/null +++ b/SOURCES/0001-CoverityScan-update.patch @@ -0,0 +1,199 @@ +From da98b8f43c74492c5471439d6ca20c15da5aeb45 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= +Date: Thu, 15 Nov 2012 10:24:02 +0100 +Subject: [PATCH] CoverityScan update + +Resolves: #873636 +--- + src/bios_device.c | 14 +++++++++++--- + src/eths.c | 2 +- + src/pci.c | 38 +++++++++++++++++++++++++++++--------- + 3 files changed, 41 insertions(+), 13 deletions(-) + +diff --git a/src/bios_device.c b/src/bios_device.c +index 9e319a3..a8827ec 100644 +--- a/src/bios_device.c ++++ b/src/bios_device.c +@@ -359,10 +359,11 @@ extern int addslot(struct libbiosdevname_state *state, int slot); + + /* Fix for RHBZ 816536/757743/756164/: Cards with same PCI but multiple ports + * chelsio, mellanox */ +-static void check_ports(struct libbiosdevname_state *state) ++static int check_ports(struct libbiosdevname_state *state) + { + struct pci_device *dev; + struct bios_device *a; ++ int slot = 0; + + list_for_each_entry(a, &state->bios_devices, node) { + dev = a->pcidev; +@@ -370,9 +371,14 @@ static void check_ports(struct libbiosdevname_state *state) + continue; + if (dev->physical_slot != PHYSICAL_SLOT_UNKNOWN) { + a->slot_num = dev->physical_slot; +- a->port_num = addslot(state, 0x1000 + dev->physical_slot); ++ slot = addslot(state, 0x1000 + dev->physical_slot); ++ if (slot<0) ++ return slot; ++ a->port_num = slot; + } + } ++ ++ return 0; + } + + void * setup_bios_devices(int namingpolicy, const char *prefix) +@@ -390,7 +396,9 @@ void * setup_bios_devices(int namingpolicy, const char *prefix) + get_eths(state); + match_all(state); + sort_device_list(state); +- check_ports(state); ++ rc = check_ports(state); ++ if (rc) ++ goto out; + rc = assign_bios_network_names(state, namingpolicy, prefix); + if (rc) + goto out; +diff --git a/src/eths.c b/src/eths.c +index bcd02e1..04db300 100644 +--- a/src/eths.c ++++ b/src/eths.c +@@ -40,7 +40,7 @@ static int eths_get_ifindex(const char *devname, int *ifindex) + struct ifreq ifr; + + memset(&ifr, 0, sizeof(ifr)); +- strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name)); ++ strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name)-1); + + /* Open control socket. */ + fd = socket(AF_INET, SOCK_DGRAM, 0); +@@ -63,7 +63,7 @@ static int eths_get_hwaddr(const char *devname, unsigned char *buf, int size, in + struct ifreq ifr; + + memset(&ifr, 0, sizeof(ifr)); +- strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name)); ++ strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name)-1); + + /* Open control socket. */ + fd = socket(AF_INET, SOCK_DGRAM, 0); +@@ -88,7 +88,7 @@ static int eths_get_info(const char *devname, struct ethtool_drvinfo *drvinfo) + + /* Setup our control structures. */ + memset(&ifr, 0, sizeof(ifr)); +- strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name)); ++ strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name)-1); + + /* Open control socket. */ + fd = socket(AF_INET, SOCK_DGRAM, 0); +@@ -118,7 +118,7 @@ static int eths_get_permaddr(const char *devname, unsigned char *buf, int size) + + /* Setup our control structures. */ + memset(&ifr, 0, sizeof(ifr)); +- strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name)); ++ strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name)-1); + + + +diff --git a/src/pci.c b/src/pci.c +index 75cf786..9bc0535 100644 +--- a/src/pci.c ++++ b/src/pci.c +@@ -198,10 +198,14 @@ static void set_pci_vpd_instance(struct libbiosdevname_state *state) + + /* Read VPD-R on Dell systems only */ + if ((fd = open("/sys/devices/virtual/dmi/id/sys_vendor", O_RDONLY)) >= 0) { +- if (read(fd, sys_vendor, 9) != 9) ++ if (read(fd, sys_vendor, 9) != 9) { ++ close(fd); + return; +- if (strncmp(sys_vendor, "Dell Inc.", 9)) ++ } ++ if (strncmp(sys_vendor, "Dell Inc.", 9)) { ++ close(fd); + return; ++ } + } else + return; + +@@ -238,6 +242,8 @@ static void set_pci_vpd_instance(struct libbiosdevname_state *state) + dev->vpd_pf = NULL; + } + } ++ ++ close(fd); + } + + static int pci_find_capability(struct pci_dev *p, int cap) +@@ -628,6 +634,8 @@ int addslot(struct libbiosdevname_state *state, int slot) + } + } + s = malloc(sizeof(*s)); ++ if(!s) ++ return -1; + INIT_LIST_HEAD(&s->node); + s->slot = slot; + s->count = 0; +@@ -636,9 +644,10 @@ int addslot(struct libbiosdevname_state *state, int slot) + return ++s->count; + } + +-static void set_pci_slots(struct libbiosdevname_state *state) ++static int set_pci_slots(struct libbiosdevname_state *state) + { + struct pci_device *dev; ++ int slot = 0; + + list_for_each_entry(dev, &state->pci_devices, node) { + dev_to_slot(state, dev); +@@ -651,11 +660,19 @@ static void set_pci_slots(struct libbiosdevname_state *state) + } + if (dev->physical_slot == 0) { + dev->embedded_index_valid = 1; +- dev->embedded_index = addslot(state, 0); ++ slot = addslot(state, 0); ++ if (slot<0) ++ return slot; ++ dev->embedded_index = slot; + } else if (dev->physical_slot != PHYSICAL_SLOT_UNKNOWN) { +- dev->index_in_slot = addslot(state, dev->physical_slot); ++ slot = addslot(state, dev->physical_slot); ++ if (slot<0) ++ return slot; ++ dev->index_in_slot = slot; + } + } ++ ++ return 0; + } + + static void set_sriov_pf_vf(struct libbiosdevname_state *state) +@@ -737,9 +754,12 @@ int get_pci_devices(struct libbiosdevname_state *state) + dmidecode_main(state); /* this will fail on Xen guests, that's OK */ + sort_device_list(state); + set_pci_vpd_instance(state); +- set_pci_slots(state); ++ rc = set_pci_slots(state); ++ if(rc) ++ goto out; + set_sriov_pf_vf(state); + ++out: + return rc; + } + +diff --git a/src/read_proc.c b/src/read_proc.c +index c89cb6d..eb988e9 100644 +--- a/src/read_proc.c ++++ b/src/read_proc.c +@@ -25,7 +25,7 @@ static struct network_device *add_interface(struct libbiosdevname_state *state, + return NULL; + memset(i, 0, sizeof(*i)); + INIT_LIST_HEAD(&i->node); +- strncpy(i->kernel_name, name, sizeof(i->kernel_name)); ++ strncpy(i->kernel_name, name, sizeof(i->kernel_name)-1); + list_add_tail(&i->node, &state->network_devices); + return i; + } +-- +1.7.11.7 + diff --git a/SOURCES/0001-Fix-regression-introduced-by-the-addslot-function.patch b/SOURCES/0001-Fix-regression-introduced-by-the-addslot-function.patch new file mode 100644 index 0000000..33173e2 --- /dev/null +++ b/SOURCES/0001-Fix-regression-introduced-by-the-addslot-function.patch @@ -0,0 +1,282 @@ +From 783de6c93b01fec3f3cb8682156a21417567db9f Mon Sep 17 00:00:00 2001 +From: Narendra K +Date: Wed, 4 Sep 2013 20:32:14 +0530 +Subject: [PATCH] Fix regression introduced by the addslot function + +This patch reverts the following commits + +1452ea7125b5e713b80459f7b528d5562438f3d5 +0bb870f09a34b6c505fcefdbcf85cfcc1aa5ca97 + +The commits introduced addslot function to implement naming for +devices which have more than one physical port sharing the same +PCI b/d/f. But the port determination logic in 'addslot' function +could +result in more than one interface on a given PCI slot getting same +port number when renames are happening in parallel. This patch +restores the logic that existed in version 0.3.11 to determine +port number of an interface. + +Fixes Fedora bz-782145. +--- + src/bios_device.c | 59 ------------------------------------ + src/bios_device.h | 3 -- + src/naming_policy.c | 6 ++-- + src/pci.c | 86 ++++++++++++++++++++++++++++++----------------------- + 4 files changed, 50 insertions(+), 104 deletions(-) + +diff --git a/src/bios_device.c b/src/bios_device.c +index a8827ec..132877e 100644 +--- a/src/bios_device.c ++++ b/src/bios_device.c +@@ -217,32 +217,6 @@ static void match_pci_and_eth_devs(struct libbiosdevname_state *state) + struct pci_device *p; + struct bios_device *b; + struct network_device *n; +- +- list_for_each_entry(n, &state->network_devices, node) { +- p = find_dev_by_pci_name(state, n->drvinfo.bus_info); +- if (!p) +- continue; +- +- b = malloc(sizeof(*b)); +- if (!b) +- continue; +- memset(b, 0, sizeof(*b)); +- INIT_LIST_HEAD(&b->node); +- b->pcidev = p; +- b->netdev = n; +- b->slot_num = -1; +- b->port_num = -1; +- claim_netdev(b->netdev); +- list_add(&b->node, &state->bios_devices); +- } +-} +- +- +-static void match_eth_and_pci_devs(struct libbiosdevname_state *state) +-{ +- struct pci_device *p; +- struct bios_device *b; +- struct network_device *n; + char pci_name[40]; + + list_for_each_entry(p, &state->pci_devices, node) { +@@ -261,8 +235,6 @@ static void match_eth_and_pci_devs(struct libbiosdevname_state *state) + INIT_LIST_HEAD(&b->node); + b->pcidev = p; + b->netdev = n; +- b->slot_num = -1; +- b->port_num = -1; + claim_netdev(b->netdev); + list_add(&b->node, &state->bios_devices); + } +@@ -286,8 +258,6 @@ static void match_unknown_eths(struct libbiosdevname_state *state) + memset(b, 0, sizeof(*b)); + INIT_LIST_HEAD(&b->node); + b->netdev = n; +- b->slot_num = -1; +- b->port_num = -1; + list_add(&b->node, &state->bios_devices); + } + } +@@ -355,32 +325,6 @@ static void find_duplicates(struct libbiosdevname_state *state) + } + } + +-extern int addslot(struct libbiosdevname_state *state, int slot); +- +-/* Fix for RHBZ 816536/757743/756164/: Cards with same PCI but multiple ports +- * chelsio, mellanox */ +-static int check_ports(struct libbiosdevname_state *state) +-{ +- struct pci_device *dev; +- struct bios_device *a; +- int slot = 0; +- +- list_for_each_entry(a, &state->bios_devices, node) { +- dev = a->pcidev; +- if (dev == NULL || dev->is_sriov_virtual_function || dev->vpd_port != INT_MAX) +- continue; +- if (dev->physical_slot != PHYSICAL_SLOT_UNKNOWN) { +- a->slot_num = dev->physical_slot; +- slot = addslot(state, 0x1000 + dev->physical_slot); +- if (slot<0) +- return slot; +- a->port_num = slot; +- } +- } +- +- return 0; +-} +- + void * setup_bios_devices(int namingpolicy, const char *prefix) + { + int rc=1; +@@ -396,9 +340,6 @@ void * setup_bios_devices(int namingpolicy, const char *prefix) + get_eths(state); + match_all(state); + sort_device_list(state); +- rc = check_ports(state); +- if (rc) +- goto out; + rc = assign_bios_network_names(state, namingpolicy, prefix); + if (rc) + goto out; +diff --git a/src/bios_device.h b/src/bios_device.h +index d1ef911..690ed6f 100644 +--- a/src/bios_device.h ++++ b/src/bios_device.h +@@ -19,9 +19,6 @@ struct bios_device { + struct pci_device *pcidev; + char *bios_name; + int duplicate; +- +- int slot_num; +- int port_num; + }; + + static inline int is_pci(const struct bios_device *dev) +diff --git a/src/naming_policy.c b/src/naming_policy.c +index fe7b934..4f2033c 100644 +--- a/src/naming_policy.c ++++ b/src/naming_policy.c +@@ -59,8 +59,8 @@ static void use_physical(const struct libbiosdevname_state *state, const char *p + portnum = vf->sysfs_index; + else if (vf->uses_smbios & HAS_SMBIOS_INSTANCE && is_pci_smbios_type_ethernet(vf)) + portnum = vf->smbios_instance; +- else if (dev->port_num != -1) +- portnum = dev->port_num; ++ else if (vf->embedded_index_valid) ++ portnum = vf->embedded_index; + if (portnum != INT_MAX) { + snprintf(location, sizeof(location), "%s%u", prefix, portnum); + known=1; +@@ -70,8 +70,6 @@ static void use_physical(const struct libbiosdevname_state *state, const char *p + snprintf(location, sizeof(location), "p%u", dev->pcidev->physical_slot); + if (dev->pcidev->vpd_port < INT_MAX) + portnum = dev->pcidev->vpd_port; +- else if (dev->port_num != -1) +- portnum = dev->port_num; + else if (!dev->pcidev->is_sriov_virtual_function) + portnum = dev->pcidev->index_in_slot; + else +diff --git a/src/pci.c b/src/pci.c +index b64fc3f..7aa32fc 100644 +--- a/src/pci.c ++++ b/src/pci.c +@@ -637,26 +637,6 @@ void free_pci_devices(struct libbiosdevname_state *state) + } + } + +-int addslot(struct libbiosdevname_state *state, int slot) +-{ +- struct slotlist *s; +- +- list_for_each_entry(s, &state->slots, node) { +- if (s->slot == slot) { +- return ++s->count; +- } +- } +- s = malloc(sizeof(*s)); +- if(!s) +- return -1; +- INIT_LIST_HEAD(&s->node); +- s->slot = slot; +- s->count = 0; +- list_add(&s->node, &state->slots); +- +- return ++s->count; +-} +- + static int set_pci_slots(struct libbiosdevname_state *state) + { + struct pci_device *dev; +@@ -665,29 +645,56 @@ static int set_pci_slots(struct libbiosdevname_state *state) + list_for_each_entry(dev, &state->pci_devices, node) { + dev_to_slot(state, dev); + } ++} + +- /* Get mapping for each slot */ +- list_for_each_entry(dev, &state->pci_devices, node) { +- if (dev->is_sriov_virtual_function || !is_pci_network(dev) || dev->vpd_port != INT_MAX) { ++static int set_pci_slot_index(struct libbiosdevname_state *state) ++{ ++ struct pci_device *pcidev; ++ int prevslot=-1; ++ int index=1; ++ ++ /* only iterate over the PCI devices, because the bios_device list may be incomplete due to renames happening in parallel */ ++ list_for_each_entry(pcidev, &state->pci_devices, node) { ++ if (pcidev->physical_slot == 0) /* skip embedded devices */ ++ continue; ++ if (!is_pci_network(pcidev)) /* only look at PCI network devices */ + continue; +- } +- if (dev->physical_slot == 0) { +- dev->embedded_index_valid = 1; +- slot = addslot(state, 0); +- if (slot<0) +- return slot; +- dev->embedded_index = slot; +- } else if (dev->physical_slot != PHYSICAL_SLOT_UNKNOWN) { +- slot = addslot(state, dev->physical_slot); +- if (slot<0) +- return slot; +- dev->index_in_slot = slot; +- } +- } ++ if (pcidev->is_sriov_virtual_function) /* skip sriov VFs, they're handled later */ ++ continue; ++ if (pcidev->physical_slot != prevslot) { ++ index=1; ++ prevslot = pcidev->physical_slot; ++ } ++ else ++ index++; ++ pcidev->index_in_slot = index; ++ } ++ return 0; ++} ++ ++static int set_embedded_index(struct libbiosdevname_state *state) ++{ ++ struct pci_device *pcidev; ++ int index=1; + +- return 0; ++ list_for_each_entry(pcidev, &state->pci_devices, node) { ++ if (pcidev->physical_slot != 0) /* skip non-embedded devices */ ++ continue; ++ if (!is_pci_network(pcidev)) /* only look at PCI network devices */ ++ continue; ++ if (pcidev->is_sriov_virtual_function) /* skip sriov VFs, they're handled later */ ++ continue; ++ if (pcidev->vpd_port != INT_MAX) ++ continue; ++ pcidev->embedded_index = index; ++ pcidev->embedded_index_valid = 1; ++ index++; ++ } ++ return 0; + } + ++ ++ + static void set_sriov_pf_vf(struct libbiosdevname_state *state) + { + struct pci_device *vf; +@@ -774,6 +781,9 @@ int get_pci_devices(struct libbiosdevname_state *state) + rc = set_pci_slots(state); + if(rc) + goto out; ++ ++ set_embedded_index(state); ++ set_pci_slot_index(state); + set_sriov_pf_vf(state); + + out: +-- +1.8.3.1 + diff --git a/SOURCES/0001-Place-udev-rules-to-usr-lib.patch b/SOURCES/0001-Place-udev-rules-to-usr-lib.patch new file mode 100644 index 0000000..b25dc0e --- /dev/null +++ b/SOURCES/0001-Place-udev-rules-to-usr-lib.patch @@ -0,0 +1,38 @@ +From 14a0cef248d2996cde90e64ae56d7bdb569b3995 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= +Date: Mon, 23 Sep 2013 14:05:59 +0200 +Subject: [PATCH] Place udev rules to /usr/lib + +--- + biosdevname.rules.in | 2 +- + configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/biosdevname.rules.in b/biosdevname.rules.in +index 0a32aa5..eb2ed3c 100644 +--- a/biosdevname.rules.in ++++ b/biosdevname.rules.in +@@ -19,6 +19,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. +-SUBSYSTEMS=="pci", PROGRAM="/sbin/biosdevname --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace" ++SUBSYSTEMS=="pci", PROGRAM="/usr/sbin/biosdevname --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace" + + LABEL="netdevicename_end" +diff --git a/configure.ac b/configure.ac +index e26ba98..8c12cb8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -68,7 +68,7 @@ AC_CHECK_FUNCS([dup2 gettimeofday memset munmap select socket strcasecmp strchr + + # this is ugly, but accounts for SLES 10, Red Hat/Fedora, and Ubuntu + # handles default udev rules as of udev 114 or thereabouts +-RULEDEST=/lib/udev/rules.d/71-biosdevname.rules ++RULEDEST=${prefix}/lib/udev/rules.d/71-biosdevname.rules + + if [[ -e /etc/udev/rules.d/60-net.rules ]]; then + # RHEL 5 / Fedora +-- +1.8.3.1 + diff --git a/SOURCES/0001-Update-help-and-man-to-cover-all-possible-arguments.patch b/SOURCES/0001-Update-help-and-man-to-cover-all-possible-arguments.patch new file mode 100644 index 0000000..08c4f67 --- /dev/null +++ b/SOURCES/0001-Update-help-and-man-to-cover-all-possible-arguments.patch @@ -0,0 +1,68 @@ +From b02989fe9544311179cd9b333f9d9e450410c6bb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= +Date: Tue, 9 Apr 2013 14:25:14 +0200 +Subject: [PATCH] Update help and man to cover all possible arguments + +--- + biosdevname.1 | 8 ++++---- + src/bios_dev_name.c | 12 ++++++------ + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/biosdevname.1 b/biosdevname.1 +index 7067a56..22a53bd 100644 +--- a/biosdevname.1 ++++ b/biosdevname.1 +@@ -31,16 +31,16 @@ Treat [args] as ethernet devs + .B \-d, \-\-debug + Enable debugging + .TP +-.B \-\-policy \fI[physical|all_ethN] ++.B \-p, \-\-policy \fI[physical|all_ethN] + .TP +-.B \-\-prefix \fI[string] ++.B \-P, \-\-prefix \fI[string] + string use for embedded NICs in the physical policy (default=em) + .TP +-.B \-\-nopirq ++.B \-x, \-\-nopirq + Do not use $PIR table for mapping PCI device to slot. Some BIOS have + incorrect values. + .TP +-.B \-\-smbios \fI[x.y] ++.B \-s, \-\-smbios \fI[x.y] + Require minimum SMBIOS version x.y + .SH POLICIES + .br +diff --git a/src/bios_dev_name.c b/src/bios_dev_name.c +index 6084d28..5001f85 100644 +--- a/src/bios_dev_name.c ++++ b/src/bios_dev_name.c +@@ -25,11 +25,11 @@ static void usage(void) + fprintf(stderr, " Options:\n"); + fprintf(stderr, " -i or --interface treat [args] as ethernet devs\n"); + fprintf(stderr, " -d or --debug enable debugging\n"); +- fprintf(stderr, " --policy [physical | all_ethN ]\n"); +- fprintf(stderr, " --prefix [string] string use for embedded NICs (default='em')\n"); +- fprintf(stderr, " --smbios [x.y] Require SMBIOS x.y or greater\n"); +- fprintf(stderr, " --nopirq Don't use $PIR table for slot numbers\n"); +- fprintf(stderr, " --version Show biosdevname version\n"); ++ fprintf(stderr, " -p or --policy [physical | all_ethN ]\n"); ++ fprintf(stderr, " -P or --prefix [string] string use for embedded NICs (default='em')\n"); ++ fprintf(stderr, " -s or --smbios [x.y] Require SMBIOS x.y or greater\n"); ++ fprintf(stderr, " -x or --nopirq Don't use $PIR table for slot numbers\n"); ++ fprintf(stderr, " -v or --version Show biosdevname version\n"); + fprintf(stderr, " Example: biosdevname -i eth0\n"); + fprintf(stderr, " returns: em1\n"); + fprintf(stderr, " when eth0 is an embedded NIC with label '1' on the chassis.\n"); +@@ -68,7 +68,7 @@ parse_opts(int argc, char **argv) + {0, 0, 0, 0} + }; + c = getopt_long(argc, argv, +- "dinp:", ++ "dip:", + long_options, &option_index); + if (c == -1) + break; +-- +1.8.1.4 + diff --git a/SOURCES/biosdevname-0.5.0-rules.patch b/SOURCES/biosdevname-0.5.0-rules.patch new file mode 100644 index 0000000..61941c3 --- /dev/null +++ b/SOURCES/biosdevname-0.5.0-rules.patch @@ -0,0 +1,21 @@ +diff -up biosdevname-0.5.0/biosdevname.rules.in.new biosdevname-0.5.0/biosdevname.rules.in +--- biosdevname-0.5.0/biosdevname.rules.in.new 2013-03-12 13:26:06.000000000 +0100 ++++ biosdevname-0.5.0/biosdevname.rules.in 2013-09-02 19:07:01.953956219 +0200 +@@ -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" + + # kernel command line "biosdevname={0|1}" can turn off/on biosdevname + IMPORT{cmdline}="biosdevname" +@@ -18,6 +19,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 -i %k", NAME="%c", OPTIONS+="string_escape=replace" ++SUBSYSTEMS=="pci", PROGRAM="/sbin/biosdevname --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace" + + LABEL="netdevicename_end" diff --git a/SPECS/biosdevname.spec b/SPECS/biosdevname.spec new file mode 100644 index 0000000..1a3d96a --- /dev/null +++ b/SPECS/biosdevname.spec @@ -0,0 +1,237 @@ +Name: biosdevname +Version: 0.5.0 +Release: 5%{?dist} +Summary: Udev helper for naming devices per BIOS names + +Group: System Environment/Base +License: GPLv2 +URL: http://linux.dell.com/files/%{name} +# SMBIOS only exists on these arches. It's also likely that other +# arches don't expect the PCI bus to be sorted breadth-first, or of +# so, there haven't been any comments about that on LKML. +ExclusiveArch: %{ix86} x86_64 ia64 +Source0: http://linux.dell.com/files/%{name}/%{name}-%{version}/%{name}-%{version}.tar.gz + +BuildRequires: pciutils-devel, zlib-devel +# to figure out how to name the rules file +BuildRequires: udev +#To generate the configure script +BuildRequires: autoconf +BuildRequires: automake +# for ownership of /etc/udev/rules.d +Requires: udev + +Patch0: 0001-Update-help-and-man-to-cover-all-possible-arguments.patch +Patch1: biosdevname-0.5.0-rules.patch +Patch2: 0001-CoverityScan-update.patch +Patch3: 0001-Fix-regression-introduced-by-the-addslot-function.patch +Patch4: 0001-Place-udev-rules-to-usr-lib.patch + +%description +biosdevname in its simplest form takes a kernel device name as an +argument, and returns the BIOS-given name it "should" be. This is necessary +on systems where the BIOS name for a given device (e.g. the label on +the chassis is "Gb1") doesn't map directly and obviously to the kernel +name (e.g. eth0). + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 + + +%build +autoreconf -iv +#If configure script doesn't exist generate it with autogen script +[ -e ./configure ] || ./autogen.sh --no-configure + +# this is a udev rule, so it needs to live in / rather than /usr +%configure --disable-rpath --prefix=%{_prefix} --sbindir=%{_prefix}/sbin +make %{?_smp_mflags} + + +%install +make install install-data DESTDIR=%{buildroot} + +%files +%defattr(-,root,root,-) +%doc COPYING README +%{_prefix}/sbin/%{name} +# hack for either /etc or /lib rules location +%{_prefix}/lib/udev/rules.d/*.rules +%{_mandir}/man1/%{name}.1* + + +%changelog +* Fri Sep 20 2013 Václav Pavlín - 0.5.0-5 +- Fix regression introduced by the addslot function +- CoverityScan fixes +- Place udev rules to /usr/lib rather than /lib +Resolves: rhbz#1008899 + +* Mon Sep 02 2013 Harald Hoyer 0.5.0-3 +- not only NAME KERNEL=="eth*", but every ethernet device + +* Tue Jul 30 2013 Václav Pavlín - 0.5.0-2 +- Update help and man pages to cover all possible arguments +Resolves: rhbz#949021 + +* Tue Jul 30 2013 Václav Pavlín - 0.5.0-1 +- Updating the sources to 0.5.0 version. Following are the changes: +- Change scan of SMBIOS slot <-> PCI methods, recurse to set SMBIOS slot field +- Save off secondary bus of PCI device for PCI tree traversal +- Add version number to biosdevname + +* Wed Feb 13 2013 Fedora Release Engineering - 0.4.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Nov 14 2012 Václav Pavlín - 0.4.1-3 +- Source link update + +* Wed Jul 18 2012 Fedora Release Engineering - 0.4.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed Jul 18 2012 Praveen K Paladugu - 0.4.1-1 +- Fix autoconfig for Fedora systems +- Make sure that vpd scan only runs on Dell systems, also blacklist Atheros + wireless cards which hang when vpd is read. +- Add fixes to biosdevname to support cards that export multiple network + ports per PCI device (chelsio/mellanox). + + + +* Thu May 3 2012 Praveen K Paladugu - 0.4.0-1 +- Create detached signature +- Fix man page to use new naming convention +- Remove unused variables from Stephen Hemminger [shemminger@vyatta.com] +- Use Physical device for slot numbering for embedded SR-IOV cards +- Add tracking of ifindex to eths structure +- Fix naming for add-in network adapters when SMBIOS version is invalid +- Read VPD-R on Dell systems only + +* Thu Jan 12 2012 Fedora Release Engineering - 0.3.11-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Oct 4 2011 Praveen K Paladugu - 0.3.11-5 +- Added automake as a build dependency + +* Tue Oct 4 2011 Praveen K Paladugu - 0.3.11-4 +- Added autoconf as a build dependency + +* Tue Oct 4 2011 Praveen K Paladugu - 0.3.11-3 +- Generating the configure script if it doesn't exist + +* Tue Oct 4 2011 Praveen K Paladugu - 0.3.11-2 +- Fixed the dir structure inside the archive + +* Tue Oct 4 2011 Praveen K Paladugu - 0.3.11-1 +- Updating the sources to 0.3.11 version. Following are the changes: +- Fix man page for PCI slot naming +- Fix clearing of buffer for NPAR/SRIOV naming +- Add --nopirq and --smbios options to manpage. +- Verify length of VPD on network device +- Close file handle on sysfs read +- Fix naming policy for NPAR devices. + Match each PCI device to its VPD 'physical' device to get correct index +- Exclude building on ia64 arch +- Add support functions for determining PCIE slot +- Scan full path to parent when getting PCIE slot +- Fix NPAR naming for add-in cards +- Don't display _vf suffix on NPAR devices with single function +- Fix PCIe/PIRQ slot mapping + +* Thu Apr 21 2011 Praveen K Paladugu - 0.3.8-1 +- Add changes to parse VPD structure for device mapping on NPAR devices +- Fix pathname +- Cleanup and comment NPAR code +- Fix debian packaging rules to regenerate configure script +- Change pciX to pX for shortened names for PCI add-on devices +- Fix manpage typo +- Delete CR-LF in script +- Change default signing key +- Add command line arguments for checking SMBIOS version and ignore $PIRQ. + +* Thu Feb 17 2011 Matt Domsch - 0.3.7-1 +- drop dump_pirq, suggest use biosdecode instead +- don't use '#' in names, use 'p' instead, by popular demand +- properly look for SMBIOS, then $PIR, then recurse +- Add kernel command line parameter "biosdevname={0|1}" to turn off/on biosdevname +- Fix segfault when BIOS advertises zero sized PIRQ Routing Table +- Add 'bonding' and 'openvswitch' to the virtual devices list +- fail PIRQ lookups if device domain is not 0 +- Don't suggest names if running in a virtual machine (Xen, KVM, + VMware tested, but should work on others) +- Typo fixes + +* Mon Feb 07 2011 Fedora Release Engineering - 0.3.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Tue Jan 25 2011 Matt Domsch - 0.3.6-1 +- drop biosdevnameS, it's unused and fails to build on F15 + +* Tue Jan 25 2011 Matt Domsch - 0.3.5-1 +- install dump_pirq into /usr/sbin +- fix udev rule, skip running if NAME is already set +- move udev rule to /lib/udev/rules.d by default + +* Thu Dec 16 2010 Matt Domsch - 0.3.4-1 +- drop unnecessary explicit version requirement on udev +- bugfix: start indices at 1 not 0, to match Dell and HP server port designations +- bugfix: don't assign names to unknown devices +- bugfix: don't assign duplicate names + +* Thu Dec 9 2010 Matt Domsch - 0.3.3-1 +- add back in use of PCI IRQ Routing Table, if info is not provided by + sysfs or SMBIOS + +* Thu Dec 2 2010 Matt Domsch - 0.3.2-1 +- fix for multi-port cards with bridges +- removal of code for seriously obsolete systems + +* Sun Nov 28 2010 Matt Domsch 0.3.1-1 +- remove all policies except 'physical' and 'all_ethN' +- handle SR-IOV devices properly + +* Wed Nov 10 2010 Matt Domsch 0.3.0-1 +- add --policy=loms, make it default +- read index and labels from sysfs if available + +* Mon Jul 27 2009 Jordan Hargrave 0.2.5-1 +- fix mmap error checking + +* Fri Jul 24 2009 Fedora Release Engineering - 0.2.4-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Feb 23 2009 Fedora Release Engineering - 0.2.4-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Tue May 06 2008 Matt Domsch 0.2.4-5 +- use policy=all_names to find breakage + +* Sun Feb 10 2008 Matt Domsch 0.2.4-4 +- rebuild for gcc43 + +* Fri Sep 21 2007 Matt Domsch 0.2.4-3 +- fix manpage entry in files + +* Fri Sep 21 2007 Matt Domsch 0.2.4-2 +- rebuild with Requires: udev > 115-3.20070920git + +* Fri Sep 21 2007 Matt Domsch 0.2.4-1 +- coordinate udev rules usage with udev maintainer +- fix crashes in pcmcia search, in_ethernet(), and incorrect command + line parsing. + +* Mon Aug 27 2007 Matt Domsch 0.2.3-1 +- eliminate libbiosdevname.*, pre and post scripts + +* Fri Aug 24 2007 Matt Domsch 0.2.2-1 +- ExclusiveArch those arches with SMBIOS and PCI IRQ Routing tables +- eliminate libsysfs dependency, move app to / for use before /usr is mounted. +- build static + +* Mon Aug 20 2007 Matt Domsch 0.2.1-1 +- initial release