summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-02-20 22:55:42 +0100
committerTom Gundersen <teg@jklm.no>2014-02-20 23:26:52 +0100
commitf28964e353e4bfb83990742be6f258cdcc78c03a (patch)
tree01c08800b3e8e888d65c7349153b03088acfe382 /src
parent95fe27d9307628a4a593e63794000c09ecb91b95 (diff)
net-util: match - allow globbing
For now support globbing for interface name and path.
Diffstat (limited to 'src')
-rw-r--r--src/shared/net-util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shared/net-util.c b/src/shared/net-util.c
index 06c50b593e..6008a41dae 100644
--- a/src/shared/net-util.c
+++ b/src/shared/net-util.c
@@ -22,6 +22,7 @@
#include <netinet/ether.h>
#include <linux/if.h>
#include <arpa/inet.h>
+#include <fnmatch.h>
#include "net-util.h"
#include "log.h"
@@ -56,7 +57,7 @@ bool net_match_config(const struct ether_addr *match_mac,
if (match_mac && (!dev_mac || memcmp(match_mac, ether_aton(dev_mac), ETH_ALEN)))
return 0;
- if (match_path && !streq_ptr(match_path, dev_path))
+ if (match_path && (!dev_path || fnmatch(match_path, dev_path, 0)))
return 0;
if (match_driver && !streq_ptr(match_driver, dev_driver))
@@ -65,7 +66,7 @@ bool net_match_config(const struct ether_addr *match_mac,
if (match_type && !streq_ptr(match_type, dev_type))
return 0;
- if (match_name && !streq_ptr(match_name, dev_name))
+ if (match_name && (!dev_path || fnmatch(match_name, dev_name, 0)))
return 0;
return 1;