chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gpt-auto-generator: automatically find the root disk of the system
[elogind.git]
/
src
/
shared
/
net-util.c
diff --git
a/src/shared/net-util.c
b/src/shared/net-util.c
index 06c50b593ee3652e8818b561264c3aabe74fe38c..50cfa2c3f3a5a791f903859167523ebda43da131 100644
(file)
--- 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 <netinet/ether.h>
#include <linux/if.h>
#include <arpa/inet.h>
+#include <fnmatch.h>
#include "net-util.h"
#include "log.h"
#include "net-util.h"
#include "log.h"
@@
-38,8
+39,10
@@
bool net_match_config(const struct ether_addr *match_mac,
Condition *match_host,
Condition *match_virt,
Condition *match_kernel,
Condition *match_host,
Condition *match_virt,
Condition *match_kernel,
+ Condition *match_arch,
const char *dev_mac,
const char *dev_path,
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) {
const char *dev_driver,
const char *dev_type,
const char *dev_name) {
@@
-53,19
+56,26
@@
bool net_match_config(const struct ether_addr *match_mac,
if (match_kernel && !condition_test_kernel_command_line(match_kernel))
return 0;
if (match_kernel && !condition_test_kernel_command_line(match_kernel))
return 0;
- if (match_
mac && (!dev_mac || memcmp(match_mac, ether_aton(dev_mac), ETH_ALEN)
))
+ if (match_
arch && !condition_test_architecture(match_arch
))
return 0;
return 0;
- if (match_
path && !streq_ptr(match_path, dev_path
))
+ if (match_
mac && (!dev_mac || memcmp(match_mac, ether_aton(dev_mac), ETH_ALEN)
))
return 0;
return 0;
- if (match_
driver && !streq_ptr(match_driver, dev_driver
))
+ if (match_
path && (!dev_path || fnmatch(match_path, dev_path, 0)
))
return 0;
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_type && !streq_ptr(match_type, dev_type))
return 0;
- if (match_name &&
!streq_ptr(match_name, dev_name
))
+ if (match_name &&
(!dev_name || fnmatch(match_name, dev_name, 0)
))
return 0;
return 1;
return 0;
return 1;