]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
conf-parser: rename config_parse_hwaddr() -> config_parse_ether_addr()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Nov 2021 16:12:45 +0000 (01:12 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 9 Nov 2021 12:39:09 +0000 (21:39 +0900)
src/network/netdev/netdev-gperf.gperf
src/network/networkd-network-gperf.gperf
src/network/test-networkd-conf.c
src/shared/conf-parser.c
src/shared/conf-parser.h
src/udev/net/link-config-gperf.gperf

index 9dd081425e2e1276bff051f6f64c651a0739b412..878d15d6c85dab15e8ee34bf6cdf2fcdc714a02a 100644 (file)
@@ -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 */
index 9e23007e50141d77b089773295359a456f3aaa77..7787a033fada3912e37a7ca30b0cd14b0c97d535 100644 (file)
@@ -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)
index 27dd3870592eeddf6e11f312a9a0878673205959..4b00a980863e95ccbfdaec0fc03a2a5e3ef9bcb7 100644 (file)
@@ -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();
index 29f28af444bbb89d2d1d769edc165a59004df79d..f0633a71d1c6e17c0882bb5442ec6209c3e0fd49 100644 (file)
@@ -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,
index f893a53aa01195fad853a1c07efc58eed5509edd..eff0e2712b5bd6085d4667d2271f06697b573776 100644 (file)
@@ -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);
index a9c94b48ed93aac500651be6fbf2f794a9cbbf22..a3efb4e6c7727e16e55bc78582e1226c9f05be52 100644 (file)
@@ -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)