summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-02-13 18:38:22 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-02-16 13:16:46 -0500
commitee5de57b9d474161df259e7faa958fa9d7bbd736 (patch)
tree136d0dfc1d8a691bbb734c8fcb583ac8856c7179 /src
parentbceccd5ecc393c344ab008737ba6aab211a5ea9f (diff)
network-internal: chain matches with AND in net_match_config()
The test would treat the first non-empty set of matches in match_paths, match_drivers, match_types, match_names as definitive (essentially chaining them with OR). Make those tests instead match like other tests and require all to pass if the set of patterns is nonempty.
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-network/network-internal.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
index 5867aef662..b6bddd9c60 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -112,17 +112,17 @@ bool net_match_config(const struct ether_addr *match_mac,
if (match_mac && (!dev_mac || memcmp(match_mac, dev_mac, ETH_ALEN)))
return false;
- if (!strv_isempty(match_paths))
- return strv_fnmatch(dev_path, match_paths, 0);
+ if (!strv_fnmatch_or_empty(dev_path, match_paths, 0))
+ return false;
- if (!strv_isempty(match_drivers))
- return strv_fnmatch(dev_driver, match_drivers, 0);
+ if (!strv_fnmatch_or_empty(dev_driver, match_drivers, 0))
+ return false;
- if (!strv_isempty(match_types))
- return strv_fnmatch(dev_type, match_types, 0);
+ if (!strv_fnmatch_or_empty(dev_type, match_types, 0))
+ return false;
- if (!strv_isempty(match_names))
- return strv_fnmatch(dev_name, match_names, 0);
+ if (!strv_fnmatch_or_empty(dev_name, match_names, 0))
+ return false;
return true;
}