[systemd-commits] hwdb/20-net-ifname.hwdb Makefile.am man/udev.xml network/99-default.link src/udev
Tom Gundersen
tomegun at kemper.freedesktop.org
Wed Feb 19 23:36:34 CET 2014
Makefile.am | 1 +
hwdb/20-net-ifname.hwdb | 5 +++++
man/udev.xml | 9 +++++++++
network/99-default.link | 2 +-
src/udev/net/link-config.c | 4 ++++
src/udev/net/link-config.h | 1 +
6 files changed, 21 insertions(+), 1 deletion(-)
New commits:
commit e51660ae56bb747ece2cab8fe6eec37f4d06a438
Author: Tom Gundersen <teg at jklm.no>
Date: Wed Feb 19 22:37:13 2014 +0100
udev: net-config - allow interface names to be set from the hwdb
diff --git a/Makefile.am b/Makefile.am
index d8b5b71..02a1aae 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2463,6 +2463,7 @@ dist_udevhwdb_DATA = \
hwdb/20-bluetooth-vendor-product.hwdb \
hwdb/20-acpi-vendor.hwdb \
hwdb/20-OUI.hwdb \
+ hwdb/20-net-ifname.hwdb \
hwdb/60-keyboard.hwdb
udevconfdir = $(sysconfdir)/udev
diff --git a/hwdb/20-net-ifname.hwdb b/hwdb/20-net-ifname.hwdb
new file mode 100644
index 0000000..29d2633
--- /dev/null
+++ b/hwdb/20-net-ifname.hwdb
@@ -0,0 +1,5 @@
+# This file is part of systemd.
+
+# Dell iDRAC Virtual USB NIC
+usb:v413CpA102*
+ ID_NET_NAME_FROM_DATABASE=irdac
diff --git a/man/udev.xml b/man/udev.xml
index eab5d25..c053a86 100644
--- a/man/udev.xml
+++ b/man/udev.xml
@@ -884,6 +884,15 @@
</para>
<variablelist>
<varlistentry>
+ <term><literal>database</literal></term>
+ <listitem>
+ <para>The name is set based on entries in the Hardware
+ Database with the key
+ <literal>ID_NET_NAME_FROM_DATABASE</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><literal>onboard</literal></term>
<listitem>
<para>The name is set based on information given by the
diff --git a/network/99-default.link b/network/99-default.link
index 05be03b..53215f6 100644
--- a/network/99-default.link
+++ b/network/99-default.link
@@ -1,3 +1,3 @@
[Link]
-NamePolicy=onboard slot path
+NamePolicy=database onboard slot path
MACAddressPolicy=persistent
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index 3afaff1..d05b909 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -383,6 +383,9 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev
for (policy = config->name_policy; !new_name && *policy != _NAMEPOLICY_INVALID; policy++) {
switch (*policy) {
+ case NAMEPOLICY_DATABASE:
+ new_name = udev_device_get_property_value(device, "ID_NET_NAME_FROM_DATABASE");
+ break;
case NAMEPOLICY_ONBOARD:
new_name = udev_device_get_property_value(device, "ID_NET_NAME_ONBOARD");
break;
@@ -447,6 +450,7 @@ DEFINE_STRING_TABLE_LOOKUP(mac_policy, MACPolicy);
DEFINE_CONFIG_PARSE_ENUM(config_parse_mac_policy, mac_policy, MACPolicy, "Failed to parse MAC address policy");
static const char* const name_policy_table[] = {
+ [NAMEPOLICY_DATABASE] = "database",
[NAMEPOLICY_ONBOARD] = "onboard",
[NAMEPOLICY_SLOT] = "slot",
[NAMEPOLICY_PATH] = "path",
diff --git a/src/udev/net/link-config.h b/src/udev/net/link-config.h
index a55c6f5..4fc8963 100644
--- a/src/udev/net/link-config.h
+++ b/src/udev/net/link-config.h
@@ -38,6 +38,7 @@ typedef enum MACPolicy {
} MACPolicy;
typedef enum NamePolicy {
+ NAMEPOLICY_DATABASE,
NAMEPOLICY_ONBOARD,
NAMEPOLICY_SLOT,
NAMEPOLICY_PATH,
More information about the systemd-commits
mailing list