]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: dhcp6pd: always use main route table for unreachable route
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 4 Dec 2021 21:54:03 +0000 (06:54 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 7 Dec 2021 09:35:30 +0000 (18:35 +0900)
This mostly reverts e47bcb7d0b2cb07c5c594e374baeb061bb7f88ba.

man/systemd.network.xml
src/network/networkd-dhcp-common.c
src/network/networkd-dhcp-common.h
src/network/networkd-dhcp-prefix-delegation.c
src/network/networkd-network-gperf.gperf
src/network/networkd-network.h
test/fuzz/fuzz-network-parser/directives.network

index 0714ebcd772dfe50d4ab7a185642cc9d767de030..68d91390cc77edb5c9ee3878fc2da988616774ce 100644 (file)
@@ -2085,7 +2085,6 @@ Table=1234</programlisting></para>
         </varlistentry>
 
         <varlistentry>
-          <term><varname>RouteMetric=</varname></term>
           <term><varname>UseDNS=</varname></term>
           <term><varname>UseNTP=</varname></term>
           <term><varname>UseHostname=</varname></term>
index c1de646a177ffa8240681397c508de279c66cf21..66d4153c84e374c8214829de0d22564872e72c3e 100644 (file)
@@ -39,15 +39,6 @@ uint32_t link_get_dhcp4_route_table(Link *link) {
         return link_get_vrf_table(link);
 }
 
-uint32_t link_get_dhcp6_route_table(Link *link) {
-        assert(link);
-        assert(link->network);
-
-        if (link->network->dhcp6_route_table_set)
-                return link->network->dhcp6_route_table;
-        return link_get_vrf_table(link);
-}
-
 uint32_t link_get_ipv6_accept_ra_route_table(Link *link) {
         assert(link);
         assert(link->network);
@@ -533,13 +524,9 @@ int config_parse_dhcp_or_ra_route_table(
 
         assert(filename);
         assert(lvalue);
-        assert(IN_SET(ltype,
-                      (RTPROT_DHCP<<16) | AF_UNSPEC,
-                      (RTPROT_DHCP<<16) | AF_INET,
-                      (RTPROT_DHCP<<16) | AF_INET6,
-                      (RTPROT_RA<<16) | AF_INET6));
+        assert(IN_SET(ltype, AF_INET, AF_INET6));
         assert(rvalue);
-        assert(data);
+        assert(userdata);
 
         r = safe_atou32(rvalue, &rt);
         if (r < 0) {
@@ -549,28 +536,11 @@ int config_parse_dhcp_or_ra_route_table(
         }
 
         switch(ltype) {
-        case (RTPROT_DHCP<<16) | AF_INET:
+        case AF_INET:
                 network->dhcp_route_table = rt;
                 network->dhcp_route_table_set = true;
-                network->dhcp_route_table_set_explicitly = true;
-                break;
-        case (RTPROT_DHCP<<16) | AF_INET6:
-                network->dhcp6_route_table = rt;
-                network->dhcp6_route_table_set = true;
-                network->dhcp6_route_table_set_explicitly = true;
-                break;
-        case (RTPROT_DHCP<<16) | AF_UNSPEC:
-                /* For backward compatibility. */
-                if (!network->dhcp_route_table_set_explicitly) {
-                        network->dhcp_route_table = rt;
-                        network->dhcp_route_table_set = true;
-                }
-                if (!network->dhcp6_route_table_set_explicitly) {
-                        network->dhcp6_route_table = rt;
-                        network->dhcp6_route_table_set = true;
-                }
                 break;
-        case (RTPROT_RA<<16) | AF_INET6:
+        case AF_INET6:
                 network->ipv6_accept_ra_route_table = rt;
                 network->ipv6_accept_ra_route_table_set = true;
                 break;
index d45b92e1a9869ae6a15ef931a83278e7f5054aa5..c19bc104075d5cc7050abe728cc1a2f0b3fe9af2 100644 (file)
@@ -51,7 +51,6 @@ typedef struct DUID {
 } DUID;
 
 uint32_t link_get_dhcp4_route_table(Link *link);
-uint32_t link_get_dhcp6_route_table(Link *link);
 uint32_t link_get_ipv6_accept_ra_route_table(Link *link);
 
 bool link_dhcp_enabled(Link *link, int family);
index 46e75e77c12b272e090cc7153b42b4d474205e12..3628423955684af183b70cd829f591fb30ecb1d3 100644 (file)
@@ -698,7 +698,6 @@ static int dhcp6_request_unreachable_route(
         route->family = AF_INET6;
         route->dst.in6 = *addr;
         route->dst_prefixlen = prefixlen;
-        route->table = link_get_dhcp6_route_table(link);
         route->type = RTN_UNREACHABLE;
         route->protocol = RTPROT_DHCP;
         route->priority = DHCP_ROUTE_METRIC;
index 3554e15c8786026314b8c1e20553767affc59ebf..8de72911aa707e7a4976ebb5c358f738d590cebe 100644 (file)
@@ -228,7 +228,7 @@ DHCPv4.IAID,                                 config_parse_iaid,
 DHCPv4.DUIDType,                             config_parse_network_duid_type,                           0,                             0
 DHCPv4.DUIDRawData,                          config_parse_network_duid_rawdata,                        0,                             0
 DHCPv4.RouteMetric,                          config_parse_dhcp_or_ra_route_metric,                     AF_INET,                       0
-DHCPv4.RouteTable,                           config_parse_dhcp_or_ra_route_table,                      (RTPROT_DHCP<<16) | AF_INET,   0
+DHCPv4.RouteTable,                           config_parse_dhcp_or_ra_route_table,                      AF_INET,                       0
 DHCPv4.UseTimezone,                          config_parse_bool,                                        0,                             offsetof(Network, dhcp_use_timezone)
 DHCPv4.ListenPort,                           config_parse_uint16,                                      0,                             offsetof(Network, dhcp_client_port)
 DHCPv4.SendRelease,                          config_parse_bool,                                        0,                             offsetof(Network, dhcp_send_release)
@@ -257,7 +257,6 @@ DHCPv6.SendOption,                           config_parse_dhcp_send_option,
 DHCPv6.IAID,                                 config_parse_iaid,                                        AF_INET6,                      0
 DHCPv6.DUIDType,                             config_parse_duid_type,                                   0,                             offsetof(Network, dhcp6_duid)
 DHCPv6.DUIDRawData,                          config_parse_duid_rawdata,                                0,                             offsetof(Network, dhcp6_duid)
-DHCPv6.RouteTable,                           config_parse_dhcp_or_ra_route_table,                      (RTPROT_DHCP<<16) | AF_INET6,  0
 IPv6AcceptRA.UseGateway,                     config_parse_bool,                                        0,                             offsetof(Network, ipv6_accept_ra_use_gateway)
 IPv6AcceptRA.UseRoutePrefix,                 config_parse_bool,                                        0,                             offsetof(Network, ipv6_accept_ra_use_route_prefix)
 IPv6AcceptRA.UseAutonomousPrefix,            config_parse_bool,                                        0,                             offsetof(Network, ipv6_accept_ra_use_autonomous_prefix)
@@ -266,7 +265,7 @@ IPv6AcceptRA.UseDNS,                         config_parse_bool,
 IPv6AcceptRA.UseDomains,                     config_parse_ipv6_accept_ra_use_domains,                  0,                             offsetof(Network, ipv6_accept_ra_use_domains)
 IPv6AcceptRA.UseMTU,                         config_parse_bool,                                        0,                             offsetof(Network, ipv6_accept_ra_use_mtu)
 IPv6AcceptRA.DHCPv6Client,                   config_parse_ipv6_accept_ra_start_dhcp6_client,           0,                             offsetof(Network, ipv6_accept_ra_start_dhcp6_client)
-IPv6AcceptRA.RouteTable,                     config_parse_dhcp_or_ra_route_table,                      (RTPROT_RA<<16) | AF_INET6,    0
+IPv6AcceptRA.RouteTable,                     config_parse_dhcp_or_ra_route_table,                      AF_INET6,                      0
 IPv6AcceptRA.RouteMetric,                    config_parse_dhcp_or_ra_route_metric,                     AF_INET6,                      0
 IPv6AcceptRA.RouterAllowList,                config_parse_in_addr_prefixes,                            AF_INET6,                      offsetof(Network, ndisc_allow_listed_router)
 IPv6AcceptRA.RouterDenyList,                 config_parse_in_addr_prefixes,                            AF_INET6,                      offsetof(Network, ndisc_deny_listed_router)
@@ -543,7 +542,7 @@ DHCP.IAID,                                   config_parse_iaid,
 DHCP.DUIDType,                               config_parse_network_duid_type,                           0,                             0
 DHCP.DUIDRawData,                            config_parse_network_duid_rawdata,                        0,                             0
 DHCP.RouteMetric,                            config_parse_dhcp_or_ra_route_metric,                     AF_UNSPEC,                     0
-DHCP.RouteTable,                             config_parse_dhcp_or_ra_route_table,                      (RTPROT_DHCP<<16) | AF_UNSPEC, 0
+DHCP.RouteTable,                             config_parse_dhcp_or_ra_route_table,                      AF_INET,                       0
 DHCP.UseTimezone,                            config_parse_bool,                                        0,                             offsetof(Network, dhcp_use_timezone)
 DHCP.ListenPort,                             config_parse_uint16,                                      0,                             offsetof(Network, dhcp_client_port)
 DHCP.RapidCommit,                            config_parse_warn_compat,                                 DISABLED_LEGACY,               0
index 9304ceaafbffc86174297ea6d8cef9d0c15ffa67..295b2dbefae01616c2c7270eba229ba23b5cb0cc 100644 (file)
@@ -133,7 +133,6 @@ struct Network {
         bool dhcp_route_metric_set;
         uint32_t dhcp_route_table;
         bool dhcp_route_table_set;
-        bool dhcp_route_table_set_explicitly;
         uint32_t dhcp_fallback_lease_lifetime;
         uint32_t dhcp_route_mtu;
         uint16_t dhcp_client_port;
@@ -172,9 +171,6 @@ struct Network {
         bool dhcp6_use_hostname;
         bool dhcp6_use_ntp;
         bool dhcp6_use_ntp_set;
-        bool dhcp6_route_table;
-        bool dhcp6_route_table_set;
-        bool dhcp6_route_table_set_explicitly;
         DHCPUseDomains dhcp6_use_domains;
         bool dhcp6_use_domains_set;
         uint32_t dhcp6_iaid;
index c1c0026234167026b628bfa8d66c26d35616f42a..9889fbfad49190b1d99aca0e41be075b1cd5e7a4 100644 (file)
@@ -149,7 +149,6 @@ RouteMetric=
 IAID=
 DUIDType=
 DUIDRawData=
-RouteTable=
 [DHCPv6PrefixDelegation]
 UplinkInterface=
 SubnetId=