summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-02-21 22:29:25 +0100
committerTom Gundersen <teg@jklm.no>2014-02-21 22:59:29 +0100
commitbf175aafd20c9ef974709ef12c5acf836121af33 (patch)
tree47262edca73fc2ea2107185eb1a45066c426ca61 /src/shared
parent95f41b729855bdc9788bec87ab25e54e25ca8a5f (diff)
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.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/net-util.c11
-rw-r--r--src/shared/net-util.h1
2 files changed, 9 insertions, 3 deletions
diff --git a/src/shared/net-util.c b/src/shared/net-util.c
index a8a2c44bae..50cfa2c3f3 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 908fb22ffa..99479e1f5c 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);