summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-11-05 01:12:45 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-11-09 21:39:09 +0900
commitaa4f765326aa75622f1ab50068ca824ed33ecf8e (patch)
treed1609b4aa93003fe32ca79da8ca65744235af279
parent227e9ce2557b36570dd157d82774a15eb26dc99a (diff)
downloadsystemd-aa4f765326aa75622f1ab50068ca824ed33ecf8e.tar.gz
conf-parser: rename config_parse_hwaddr() -> config_parse_ether_addr()
-rw-r--r--src/network/netdev/netdev-gperf.gperf8
-rw-r--r--src/network/networkd-network-gperf.gperf8
-rw-r--r--src/network/test-networkd-conf.c124
-rw-r--r--src/shared/conf-parser.c4
-rw-r--r--src/shared/conf-parser.h4
-rw-r--r--src/udev/net/link-config-gperf.gperf6
6 files changed, 77 insertions, 77 deletions
diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf
index 9dd081425e..878d15d6c8 100644
--- a/src/network/netdev/netdev-gperf.gperf
+++ b/src/network/netdev/netdev-gperf.gperf
@@ -49,7 +49,7 @@ NetDev.Description, config_parse_string,
NetDev.Name, config_parse_ifname, 0, offsetof(NetDev, ifname)
NetDev.Kind, config_parse_netdev_kind, 0, offsetof(NetDev, kind)
NetDev.MTUBytes, config_parse_mtu, AF_UNSPEC, offsetof(NetDev, mtu)
-NetDev.MACAddress, config_parse_hwaddr, 0, offsetof(NetDev, mac)
+NetDev.MACAddress, config_parse_ether_addr, 0, offsetof(NetDev, mac)
VLAN.Id, config_parse_vlanid, 0, offsetof(VLan, id)
VLAN.Protocol, config_parse_vlanprotocol, 0, offsetof(VLan, protocol)
VLAN.GVRP, config_parse_tristate, 0, offsetof(VLan, gvrp)
@@ -59,10 +59,10 @@ VLAN.ReorderHeader, config_parse_tristate,
VLAN.EgressQOSMaps, config_parse_vlan_qos_maps, 0, offsetof(VLan, egress_qos_maps)
VLAN.IngressQOSMaps, config_parse_vlan_qos_maps, 0, offsetof(VLan, ingress_qos_maps)
MACVLAN.Mode, config_parse_macvlan_mode, 0, offsetof(MacVlan, mode)
-MACVLAN.SourceMACAddress, config_parse_hwaddrs, 0, offsetof(MacVlan, match_source_mac)
+MACVLAN.SourceMACAddress, config_parse_ether_addrs, 0, offsetof(MacVlan, match_source_mac)
MACVLAN.BroadcastMulticastQueueLength, config_parse_macvlan_broadcast_queue_size, 0, offsetof(MacVlan, bc_queue_length)
MACVTAP.Mode, config_parse_macvlan_mode, 0, offsetof(MacVlan, mode)
-MACVTAP.SourceMACAddress, config_parse_hwaddrs, 0, offsetof(MacVlan, match_source_mac)
+MACVTAP.SourceMACAddress, config_parse_ether_addrs, 0, offsetof(MacVlan, match_source_mac)
IPVLAN.Mode, config_parse_ipvlan_mode, 0, offsetof(IPVlan, mode)
IPVLAN.Flags, config_parse_ipvlan_flags, 0, offsetof(IPVlan, flags)
IPVTAP.Mode, config_parse_ipvlan_mode, 0, offsetof(IPVlan, mode)
@@ -111,7 +111,7 @@ L2TPSession.PeerSessionId, config_parse_l2tp_session_id,
L2TPSession.Layer2SpecificHeader, config_parse_l2tp_session_l2spec, 0, 0
L2TPSession.Name, config_parse_l2tp_session_name, 0, 0
Peer.Name, config_parse_ifname, 0, offsetof(Veth, ifname_peer)
-Peer.MACAddress, config_parse_hwaddr, 0, offsetof(Veth, mac_peer)
+Peer.MACAddress, config_parse_ether_addr, 0, offsetof(Veth, mac_peer)
VXCAN.Peer, config_parse_ifname, 0, offsetof(VxCan, ifname_peer)
VXLAN.VNI, config_parse_uint32, 0, offsetof(VxLan, vni)
VXLAN.Id, config_parse_uint32, 0, offsetof(VxLan, vni) /* deprecated */
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 9e23007e50..7787a033fa 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -45,14 +45,14 @@ struct ConfigPerfItem;
%struct-type
%includes
%%
-Match.MACAddress, config_parse_hwaddrs, 0, offsetof(Network, match.mac)
-Match.PermanentMACAddress, config_parse_hwaddrs, 0, offsetof(Network, match.permanent_mac)
+Match.MACAddress, config_parse_ether_addrs, 0, offsetof(Network, match.mac)
+Match.PermanentMACAddress, config_parse_ether_addrs, 0, offsetof(Network, match.permanent_mac)
Match.Path, config_parse_match_strv, 0, offsetof(Network, match.path)
Match.Driver, config_parse_match_strv, 0, offsetof(Network, match.driver)
Match.Type, config_parse_match_strv, 0, offsetof(Network, match.iftype)
Match.WLANInterfaceType, config_parse_match_strv, 0, offsetof(Network, match.wlan_iftype)
Match.SSID, config_parse_match_strv, 0, offsetof(Network, match.ssid)
-Match.BSSID, config_parse_hwaddrs, 0, offsetof(Network, match.bssid)
+Match.BSSID, config_parse_ether_addrs, 0, offsetof(Network, match.bssid)
Match.Name, config_parse_match_ifnames, IFNAME_VALID_ALTERNATIVE, offsetof(Network, match.ifname)
Match.Property, config_parse_match_property, 0, offsetof(Network, match.property)
Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(Network, conditions)
@@ -61,7 +61,7 @@ Match.KernelCommandLine, config_parse_net_condition,
Match.KernelVersion, config_parse_net_condition, CONDITION_KERNEL_VERSION, offsetof(Network, conditions)
Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(Network, conditions)
Match.Firmware, config_parse_net_condition, CONDITION_FIRMWARE, offsetof(Network, conditions)
-Link.MACAddress, config_parse_hwaddr, 0, offsetof(Network, mac)
+Link.MACAddress, config_parse_ether_addr, 0, offsetof(Network, mac)
Link.MTUBytes, config_parse_mtu, AF_UNSPEC, offsetof(Network, mtu)
Link.Group, config_parse_link_group, 0, 0
Link.ARP, config_parse_tristate, 0, offsetof(Network, arp)
diff --git a/src/network/test-networkd-conf.c b/src/network/test-networkd-conf.c
index 27dd387059..4b00a98086 100644
--- a/src/network/test-networkd-conf.c
+++ b/src/network/test-networkd-conf.c
@@ -51,11 +51,11 @@ static void test_config_parse_duid_rawdata_one(const char *rvalue, int ret, cons
}
}
-static void test_config_parse_hwaddr_one(const char *rvalue, int ret, const struct ether_addr* expected) {
+static void test_config_parse_ether_addr_one(const char *rvalue, int ret, const struct ether_addr* expected) {
struct ether_addr *actual = NULL;
int r;
- r = config_parse_hwaddr("network", "filename", 1, "section", 1, "lvalue", 0, rvalue, &actual, NULL);
+ r = config_parse_ether_addr("network", "filename", 1, "section", 1, "lvalue", 0, rvalue, &actual, NULL);
assert_se(ret == r);
if (expected) {
assert_se(actual);
@@ -66,10 +66,10 @@ static void test_config_parse_hwaddr_one(const char *rvalue, int ret, const stru
free(actual);
}
-static void test_config_parse_hwaddrs_one(const char *rvalue, const struct ether_addr* list, size_t n) {
+static void test_config_parse_ether_addrs_one(const char *rvalue, const struct ether_addr* list, size_t n) {
_cleanup_set_free_free_ Set *s = NULL;
- assert_se(config_parse_hwaddrs("network", "filename", 1, "section", 1, "lvalue", 0, rvalue, &s, NULL) == 0);
+ assert_se(config_parse_ether_addrs("network", "filename", 1, "section", 1, "lvalue", 0, rvalue, &s, NULL) == 0);
assert_se(set_size(s) == n);
for (size_t m = 0; m < n; m++) {
@@ -101,68 +101,68 @@ static void test_config_parse_duid_rawdata(void) {
test_config_parse_duid_rawdata_one(&BYTES_0_128[2], 0, &(DUID){0, 128, BYTES_1_128});
}
-static void test_config_parse_hwaddr(void) {
+static void test_config_parse_ether_addr(void) {
const struct ether_addr t[] = {
{ .ether_addr_octet = { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff } },
{ .ether_addr_octet = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab } },
};
- test_config_parse_hwaddr_one("", 0, NULL);
- test_config_parse_hwaddr_one("no:ta:ma:ca:dd:re", 0, NULL);
- test_config_parse_hwaddr_one("aa:bb:cc:dd:ee:fx", 0, NULL);
- test_config_parse_hwaddr_one("aa:bb:cc:dd:ee:ff", 0, &t[0]);
- test_config_parse_hwaddr_one(" aa:bb:cc:dd:ee:ff", 0, NULL);
- test_config_parse_hwaddr_one("aa:bb:cc:dd:ee:ff \t\n", 0, NULL);
- test_config_parse_hwaddr_one("aa:bb:cc:dd:ee:ff \t\nxxx", 0, NULL);
- test_config_parse_hwaddr_one("aa:bb:cc: dd:ee:ff", 0, NULL);
- test_config_parse_hwaddr_one("aa:bb:cc:d d:ee:ff", 0, NULL);
- test_config_parse_hwaddr_one("aa:bb:cc:dd:ee", 0, NULL);
- test_config_parse_hwaddr_one("9:aa:bb:cc:dd:ee:ff", 0, NULL);
- test_config_parse_hwaddr_one("aa:bb:cc:dd:ee:ff:gg", 0, NULL);
- test_config_parse_hwaddr_one("aa:Bb:CC:dd:ee:ff", 0, &t[0]);
- test_config_parse_hwaddr_one("01:23:45:67:89:aB", 0, &t[1]);
- test_config_parse_hwaddr_one("1:23:45:67:89:aB", 0, &t[1]);
- test_config_parse_hwaddr_one("aa-bb-cc-dd-ee-ff", 0, &t[0]);
- test_config_parse_hwaddr_one("AA-BB-CC-DD-EE-FF", 0, &t[0]);
- test_config_parse_hwaddr_one("01-23-45-67-89-ab", 0, &t[1]);
- test_config_parse_hwaddr_one("aabb.ccdd.eeff", 0, &t[0]);
- test_config_parse_hwaddr_one("0123.4567.89ab", 0, &t[1]);
- test_config_parse_hwaddr_one("123.4567.89ab.", 0, NULL);
- test_config_parse_hwaddr_one("aabbcc.ddeeff", 0, NULL);
- test_config_parse_hwaddr_one("aabbccddeeff", 0, NULL);
- test_config_parse_hwaddr_one("aabbccddee:ff", 0, NULL);
- test_config_parse_hwaddr_one("012345.6789ab", 0, NULL);
- test_config_parse_hwaddr_one("123.4567.89ab", 0, &t[1]);
-
- test_config_parse_hwaddrs_one("", t, 0);
- test_config_parse_hwaddrs_one("no:ta:ma:ca:dd:re", t, 0);
- test_config_parse_hwaddrs_one("aa:bb:cc:dd:ee:fx", t, 0);
- test_config_parse_hwaddrs_one("aa:bb:cc:dd:ee:ff", t, 1);
- test_config_parse_hwaddrs_one(" aa:bb:cc:dd:ee:ff", t, 1);
- test_config_parse_hwaddrs_one("aa:bb:cc:dd:ee:ff \t\n", t, 1);
- test_config_parse_hwaddrs_one("aa:bb:cc:dd:ee:ff \t\nxxx", t, 1);
- test_config_parse_hwaddrs_one("aa:bb:cc: dd:ee:ff", t, 0);
- test_config_parse_hwaddrs_one("aa:bb:cc:d d:ee:ff", t, 0);
- test_config_parse_hwaddrs_one("aa:bb:cc:dd:ee", t, 0);
- test_config_parse_hwaddrs_one("9:aa:bb:cc:dd:ee:ff", t, 0);
- test_config_parse_hwaddrs_one("aa:bb:cc:dd:ee:ff:gg", t, 0);
- test_config_parse_hwaddrs_one("aa:Bb:CC:dd:ee:ff", t, 1);
- test_config_parse_hwaddrs_one("01:23:45:67:89:aB", &t[1], 1);
- test_config_parse_hwaddrs_one("1:23:45:67:89:aB", &t[1], 1);
- test_config_parse_hwaddrs_one("aa-bb-cc-dd-ee-ff", t, 1);
- test_config_parse_hwaddrs_one("AA-BB-CC-DD-EE-FF", t, 1);
- test_config_parse_hwaddrs_one("01-23-45-67-89-ab", &t[1], 1);
- test_config_parse_hwaddrs_one("aabb.ccdd.eeff", t, 1);
- test_config_parse_hwaddrs_one("0123.4567.89ab", &t[1], 1);
- test_config_parse_hwaddrs_one("123.4567.89ab.", t, 0);
- test_config_parse_hwaddrs_one("aabbcc.ddeeff", t, 0);
- test_config_parse_hwaddrs_one("aabbccddeeff", t, 0);
- test_config_parse_hwaddrs_one("aabbccddee:ff", t, 0);
- test_config_parse_hwaddrs_one("012345.6789ab", t, 0);
- test_config_parse_hwaddrs_one("123.4567.89ab", &t[1], 1);
-
- test_config_parse_hwaddrs_one("123.4567.89ab aa:bb:cc:dd:ee:ff 01-23-45-67-89-ab aa:Bb:CC:dd:ee:ff", t, 2);
- test_config_parse_hwaddrs_one("123.4567.89ab aa:bb:cc:dd:ee:fx hogehoge 01-23-45-67-89-ab aaaa aa:Bb:CC:dd:ee:ff", t, 2);
+ test_config_parse_ether_addr_one("", 0, NULL);
+ test_config_parse_ether_addr_one("no:ta:ma:ca:dd:re", 0, NULL);
+ test_config_parse_ether_addr_one("aa:bb:cc:dd:ee:fx", 0, NULL);
+ test_config_parse_ether_addr_one("aa:bb:cc:dd:ee:ff", 0, &t[0]);
+ test_config_parse_ether_addr_one(" aa:bb:cc:dd:ee:ff", 0, NULL);
+ test_config_parse_ether_addr_one("aa:bb:cc:dd:ee:ff \t\n", 0, NULL);
+ test_config_parse_ether_addr_one("aa:bb:cc:dd:ee:ff \t\nxxx", 0, NULL);
+ test_config_parse_ether_addr_one("aa:bb:cc: dd:ee:ff", 0, NULL);
+ test_config_parse_ether_addr_one("aa:bb:cc:d d:ee:ff", 0, NULL);
+ test_config_parse_ether_addr_one("aa:bb:cc:dd:ee", 0, NULL);
+ test_config_parse_ether_addr_one("9:aa:bb:cc:dd:ee:ff", 0, NULL);
+ test_config_parse_ether_addr_one("aa:bb:cc:dd:ee:ff:gg", 0, NULL);
+ test_config_parse_ether_addr_one("aa:Bb:CC:dd:ee:ff", 0, &t[0]);
+ test_config_parse_ether_addr_one("01:23:45:67:89:aB", 0, &t[1]);
+ test_config_parse_ether_addr_one("1:23:45:67:89:aB", 0, &t[1]);
+ test_config_parse_ether_addr_one("aa-bb-cc-dd-ee-ff", 0, &t[0]);
+ test_config_parse_ether_addr_one("AA-BB-CC-DD-EE-FF", 0, &t[0]);
+ test_config_parse_ether_addr_one("01-23-45-67-89-ab", 0, &t[1]);
+ test_config_parse_ether_addr_one("aabb.ccdd.eeff", 0, &t[0]);
+ test_config_parse_ether_addr_one("0123.4567.89ab", 0, &t[1]);
+ test_config_parse_ether_addr_one("123.4567.89ab.", 0, NULL);
+ test_config_parse_ether_addr_one("aabbcc.ddeeff", 0, NULL);
+ test_config_parse_ether_addr_one("aabbccddeeff", 0, NULL);
+ test_config_parse_ether_addr_one("aabbccddee:ff", 0, NULL);
+ test_config_parse_ether_addr_one("012345.6789ab", 0, NULL);
+ test_config_parse_ether_addr_one("123.4567.89ab", 0, &t[1]);
+
+ test_config_parse_ether_addrs_one("", t, 0);
+ test_config_parse_ether_addrs_one("no:ta:ma:ca:dd:re", t, 0);
+ test_config_parse_ether_addrs_one("aa:bb:cc:dd:ee:fx", t, 0);
+ test_config_parse_ether_addrs_one("aa:bb:cc:dd:ee:ff", t, 1);
+ test_config_parse_ether_addrs_one(" aa:bb:cc:dd:ee:ff", t, 1);
+ test_config_parse_ether_addrs_one("aa:bb:cc:dd:ee:ff \t\n", t, 1);
+ test_config_parse_ether_addrs_one("aa:bb:cc:dd:ee:ff \t\nxxx", t, 1);
+ test_config_parse_ether_addrs_one("aa:bb:cc: dd:ee:ff", t, 0);
+ test_config_parse_ether_addrs_one("aa:bb:cc:d d:ee:ff", t, 0);
+ test_config_parse_ether_addrs_one("aa:bb:cc:dd:ee", t, 0);
+ test_config_parse_ether_addrs_one("9:aa:bb:cc:dd:ee:ff", t, 0);
+ test_config_parse_ether_addrs_one("aa:bb:cc:dd:ee:ff:gg", t, 0);
+ test_config_parse_ether_addrs_one("aa:Bb:CC:dd:ee:ff", t, 1);
+ test_config_parse_ether_addrs_one("01:23:45:67:89:aB", &t[1], 1);
+ test_config_parse_ether_addrs_one("1:23:45:67:89:aB", &t[1], 1);
+ test_config_parse_ether_addrs_one("aa-bb-cc-dd-ee-ff", t, 1);
+ test_config_parse_ether_addrs_one("AA-BB-CC-DD-EE-FF", t, 1);
+ test_config_parse_ether_addrs_one("01-23-45-67-89-ab", &t[1], 1);
+ test_config_parse_ether_addrs_one("aabb.ccdd.eeff", t, 1);
+ test_config_parse_ether_addrs_one("0123.4567.89ab", &t[1], 1);
+ test_config_parse_ether_addrs_one("123.4567.89ab.", t, 0);
+ test_config_parse_ether_addrs_one("aabbcc.ddeeff", t, 0);
+ test_config_parse_ether_addrs_one("aabbccddeeff", t, 0);
+ test_config_parse_ether_addrs_one("aabbccddee:ff", t, 0);
+ test_config_parse_ether_addrs_one("012345.6789ab", t, 0);
+ test_config_parse_ether_addrs_one("123.4567.89ab", &t[1], 1);
+
+ test_config_parse_ether_addrs_one("123.4567.89ab aa:bb:cc:dd:ee:ff 01-23-45-67-89-ab aa:Bb:CC:dd:ee:ff", t, 2);
+ test_config_parse_ether_addrs_one("123.4567.89ab aa:bb:cc:dd:ee:fx hogehoge 01-23-45-67-89-ab aaaa aa:Bb:CC:dd:ee:ff", t, 2);
}
static void test_config_parse_address_one(const char *rvalue, int family, unsigned n_addresses, const union in_addr_union *u, unsigned char prefixlen) {
@@ -248,7 +248,7 @@ int main(int argc, char **argv) {
test_config_parse_duid_type();
test_config_parse_duid_rawdata();
- test_config_parse_hwaddr();
+ test_config_parse_ether_addr();
test_config_parse_address();
test_config_parse_match_ifnames();
test_config_parse_match_strv();
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 29f28af444..f0633a71d1 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -1320,7 +1320,7 @@ int config_parse_vlanprotocol(
return 0;
}
-int config_parse_hwaddr(
+int config_parse_ether_addr(
const char *unit,
const char *filename,
unsigned line,
@@ -1362,7 +1362,7 @@ int config_parse_hwaddr(
return 0;
}
-int config_parse_hwaddrs(
+int config_parse_ether_addrs(
const char *unit,
const char *filename,
unsigned line,
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
index f893a53aa0..eff0e2712b 100644
--- a/src/shared/conf-parser.h
+++ b/src/shared/conf-parser.h
@@ -149,8 +149,8 @@ CONFIG_PARSER_PROTOTYPE(config_parse_ip_port);
CONFIG_PARSER_PROTOTYPE(config_parse_mtu);
CONFIG_PARSER_PROTOTYPE(config_parse_rlimit);
CONFIG_PARSER_PROTOTYPE(config_parse_vlanprotocol);
-CONFIG_PARSER_PROTOTYPE(config_parse_hwaddr);
-CONFIG_PARSER_PROTOTYPE(config_parse_hwaddrs);
+CONFIG_PARSER_PROTOTYPE(config_parse_ether_addr);
+CONFIG_PARSER_PROTOTYPE(config_parse_ether_addrs);
CONFIG_PARSER_PROTOTYPE(config_parse_in_addr_non_null);
CONFIG_PARSER_PROTOTYPE(config_parse_percent);
CONFIG_PARSER_PROTOTYPE(config_parse_permyriad);
diff --git a/src/udev/net/link-config-gperf.gperf b/src/udev/net/link-config-gperf.gperf
index a9c94b48ed..a3efb4e6c7 100644
--- a/src/udev/net/link-config-gperf.gperf
+++ b/src/udev/net/link-config-gperf.gperf
@@ -21,8 +21,8 @@ struct ConfigPerfItem;
%struct-type
%includes
%%
-Match.MACAddress, config_parse_hwaddrs, 0, offsetof(LinkConfig, match.mac)
-Match.PermanentMACAddress, config_parse_hwaddrs, 0, offsetof(LinkConfig, match.permanent_mac)
+Match.MACAddress, config_parse_ether_addrs, 0, offsetof(LinkConfig, match.mac)
+Match.PermanentMACAddress, config_parse_ether_addrs, 0, offsetof(LinkConfig, match.permanent_mac)
Match.OriginalName, config_parse_match_ifnames, 0, offsetof(LinkConfig, match.ifname)
Match.Path, config_parse_match_strv, 0, offsetof(LinkConfig, match.path)
Match.Driver, config_parse_match_strv, 0, offsetof(LinkConfig, match.driver)
@@ -35,7 +35,7 @@ Match.KernelVersion, config_parse_net_condition,
Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(LinkConfig, conditions)
Link.Description, config_parse_string, 0, offsetof(LinkConfig, description)
Link.MACAddressPolicy, config_parse_mac_address_policy, 0, offsetof(LinkConfig, mac_address_policy)
-Link.MACAddress, config_parse_hwaddr, 0, offsetof(LinkConfig, mac)
+Link.MACAddress, config_parse_ether_addr, 0, offsetof(LinkConfig, mac)
Link.NamePolicy, config_parse_name_policy, 0, offsetof(LinkConfig, name_policy)
Link.Name, config_parse_ifname, 0, offsetof(LinkConfig, name)
Link.AlternativeName, config_parse_ifnames, IFNAME_VALID_ALTERNATIVE, offsetof(LinkConfig, alternative_names)