[systemd-commits] 2 commits - man/systemd-networkd.service.xml man/udev.xml rules/80-net-setup-link.rules src/network src/shared src/udev

Tom Gundersen tomegun at kemper.freedesktop.org
Fri Feb 21 13:59:28 PST 2014


 man/systemd-networkd.service.xml |    5 +++--
 man/udev.xml                     |    4 +++-
 rules/80-net-setup-link.rules    |    2 ++
 src/network/networkd-netdev.c    |    2 +-
 src/network/networkd-network.c   |    1 +
 src/shared/net-util.c            |   11 ++++++++---
 src/shared/net-util.h            |    1 +
 src/udev/net/link-config.c       |    1 +
 8 files changed, 20 insertions(+), 7 deletions(-)

New commits:
commit bf175aafd20c9ef974709ef12c5acf836121af33
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Feb 21 22:29:25 2014 +0100

    net-util: match on the driver as exposed by ethtool if DRIVER not set
    
    Also fix a copy-paste error that broke matching on interface name.

diff --git a/man/systemd-networkd.service.xml b/man/systemd-networkd.service.xml
index 026536e..2517efc 100644
--- a/man/systemd-networkd.service.xml
+++ b/man/systemd-networkd.service.xml
@@ -216,8 +216,9 @@
                                         <listitem>
                                                 <para>The driver currently bound to the device, as
                                                 exposed by the udev property <literal>DRIVER</literal>
-                                                of its parent device.
-                                                </para>
+                                                of its parent device, or if that is not set the driver
+                                                as exposed by <literal>ethtool -i</literal> of the
+                                                device itself.</para>
                                         </listitem>
                                 </varlistentry>
                                 <varlistentry>
diff --git a/man/udev.xml b/man/udev.xml
index 0e75715..ae7dc61 100644
--- a/man/udev.xml
+++ b/man/udev.xml
@@ -807,7 +807,9 @@
           <term><varname>Driver=</varname></term>
           <listitem>
             <para>The driver currently bound to the device, as exposed by the
-            udev property <literal>DRIVER</literal> of its parent device.</para>
+            udev property <literal>DRIVER</literal> of its parent device, or if
+            that is not set the driver as exposed by <literal>ethtool -i</literal>
+            of the device itself.</para>
           </listitem>
         </varlistentry>
         <varlistentry>
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index c3bda6d..05f21fa 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -366,7 +366,7 @@ static int netdev_load_one(Manager *manager, const char *filename) {
         if (net_match_config(NULL, NULL, NULL, NULL, NULL,
                              netdev->match_host, netdev->match_virt,
                              netdev->match_kernel, netdev->match_arch,
-                             NULL, NULL, NULL, NULL, NULL) <= 0)
+                             NULL, NULL, NULL, NULL, NULL, NULL) <= 0)
                 return 0;
 
         r = hashmap_put(netdev->manager->netdevs, netdev->name, netdev);
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 2e68bec..14fa92a 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -181,6 +181,7 @@ int network_get(Manager *manager, struct udev_device *device, Network **ret) {
                                         udev_device_get_sysattr_value(device, "address"),
                                         udev_device_get_property_value(device, "ID_PATH"),
                                         udev_device_get_driver(udev_device_get_parent(device)),
+                                        udev_device_get_property_value(device, "ID_NET_DRIVER"),
                                         udev_device_get_devtype(device),
                                         udev_device_get_sysname(device))) {
                         log_debug("%s: found matching network '%s'",
diff --git a/src/shared/net-util.c b/src/shared/net-util.c
index a8a2c44..50cfa2c 100644
--- a/src/shared/net-util.c
+++ b/src/shared/net-util.c
@@ -42,6 +42,7 @@ bool net_match_config(const struct ether_addr *match_mac,
                       Condition *match_arch,
                       const char *dev_mac,
                       const char *dev_path,
+                      const char *dev_parent_driver,
                       const char *dev_driver,
                       const char *dev_type,
                       const char *dev_name) {
@@ -64,13 +65,17 @@ bool net_match_config(const struct ether_addr *match_mac,
         if (match_path && (!dev_path || fnmatch(match_path, dev_path, 0)))
                 return 0;
 
-        if (match_driver && !streq_ptr(match_driver, dev_driver))
-                return 0;
+        if (match_driver) {
+                if (dev_parent_driver && !streq(match_driver, dev_parent_driver))
+                        return 0;
+                else if (!streq_ptr(match_driver, dev_driver))
+                        return 0;
+        }
 
         if (match_type && !streq_ptr(match_type, dev_type))
                 return 0;
 
-        if (match_name && (!dev_path || fnmatch(match_name, dev_name, 0)))
+        if (match_name && (!dev_name || fnmatch(match_name, dev_name, 0)))
                 return 0;
 
         return 1;
diff --git a/src/shared/net-util.h b/src/shared/net-util.h
index 908fb22..99479e1 100644
--- a/src/shared/net-util.h
+++ b/src/shared/net-util.h
@@ -38,6 +38,7 @@ bool net_match_config(const struct ether_addr *match_mac,
                       Condition *match_arch,
                       const char *dev_mac,
                       const char *dev_path,
+                      const char *dev_parent_driver,
                       const char *dev_driver,
                       const char *dev_type,
                       const char *dev_name);
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index 40b1d7f..92d248f 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -247,6 +247,7 @@ int link_config_get(link_config_ctx *ctx, struct udev_device *device, link_confi
                                      udev_device_get_sysattr_value(device, "address"),
                                      udev_device_get_property_value(device, "ID_PATH"),
                                      udev_device_get_driver(udev_device_get_parent(device)),
+                                     udev_device_get_property_value(device, "ID_NET_DRIVER"),
                                      udev_device_get_devtype(device),
                                      NULL)) {
                         log_debug("Config file %s applies to device %s",

commit 95f41b729855bdc9788bec87ab25e54e25ca8a5f
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Feb 21 21:45:47 2014 +0100

    udev: net_setup - import ID_NET_DRIVER
    
    This will do until all net properties are imported.

diff --git a/rules/80-net-setup-link.rules b/rules/80-net-setup-link.rules
index 6e411a9..f390fcb 100644
--- a/rules/80-net-setup-link.rules
+++ b/rules/80-net-setup-link.rules
@@ -4,6 +4,8 @@ SUBSYSTEM!="net", GOTO="net_setup_link_end"
 
 IMPORT{builtin}="path_id"
 
+ACTION=="move", IMPORT{db}="ID_NET_DRIVER"
+
 ACTION!="add", GOTO="net_setup_link_end"
 
 IMPORT{builtin}="net_setup_link"



More information about the systemd-commits mailing list