summaryrefslogtreecommitdiff
path: root/src/shared/net-condition.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-11-05 02:59:11 +0900
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-11-25 20:14:46 +0100
commit5213507113b9cf8a192016708fd8f0f38c1cd46c (patch)
treee1a8e78cb208dc104a464954807ce4870eab8389 /src/shared/net-condition.c
parent81e1590e2de268d57be72900c5fc66ff3d4d1410 (diff)
downloadsystemd-5213507113b9cf8a192016708fd8f0f38c1cd46c.tar.gz
network,udev: make .network and .link file can match with hardware address longer or shorter than ETH_ALEN
Diffstat (limited to 'src/shared/net-condition.c')
-rw-r--r--src/shared/net-condition.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/shared/net-condition.c b/src/shared/net-condition.c
index 6be8f1cbce..fbd7bd0784 100644
--- a/src/shared/net-condition.c
+++ b/src/shared/net-condition.c
@@ -17,8 +17,8 @@ void net_match_clear(NetMatch *match) {
if (!match)
return;
- match->mac = set_free(match->mac);
- match->permanent_mac = set_free(match->permanent_mac);
+ match->hw_addr = set_free(match->hw_addr);
+ match->permanent_hw_addr = set_free(match->permanent_hw_addr);
match->path = strv_free(match->path);
match->driver = strv_free(match->driver);
match->iftype = strv_free(match->iftype);
@@ -33,8 +33,8 @@ bool net_match_is_empty(const NetMatch *match) {
assert(match);
return
- set_isempty(match->mac) &&
- set_isempty(match->permanent_mac) &&
+ set_isempty(match->hw_addr) &&
+ set_isempty(match->permanent_hw_addr) &&
strv_isempty(match->path) &&
strv_isempty(match->driver) &&
strv_isempty(match->iftype) &&
@@ -122,8 +122,8 @@ static int net_condition_test_property(char * const *match_property, sd_device *
int net_match_config(
const NetMatch *match,
sd_device *device,
- const struct ether_addr *mac,
- const struct ether_addr *permanent_mac,
+ const struct hw_addr_data *hw_addr,
+ const struct hw_addr_data *permanent_hw_addr,
const char *driver,
unsigned short iftype,
const char *ifname,
@@ -150,13 +150,12 @@ int net_match_config(
(void) sd_device_get_sysname(device, &ifname);
}
- if (match->mac && (!mac || !set_contains(match->mac, mac)))
+ if (match->hw_addr && (!hw_addr || !set_contains(match->hw_addr, hw_addr)))
return false;
- if (match->permanent_mac &&
- (!permanent_mac ||
- ether_addr_is_null(permanent_mac) ||
- !set_contains(match->permanent_mac, permanent_mac)))
+ if (match->permanent_hw_addr &&
+ (!permanent_hw_addr ||
+ !set_contains(match->permanent_hw_addr, permanent_hw_addr)))
return false;
if (!net_condition_test_strv(match->path, path))