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)
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)
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 */
%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)
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)
}
}
-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);
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++) {
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) {
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();