#include "networkd-manager.h"
#include "networkd-network.h"
#include "networkd-route-util.h"
+#include "networkd-util.h"
#include "parse-util.h"
#include "set.h"
#include "socket-util.h"
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);
+}
+
bool link_dhcp_enabled(Link *link, int family) {
assert(link);
assert(IN_SET(family, AF_INET, AF_INET6));
assert(filename);
assert(lvalue);
- assert(IN_SET(ltype, AF_INET, AF_INET6));
+ assert(IN_SET(ltype, NETWORK_CONFIG_SOURCE_DHCP4, NETWORK_CONFIG_SOURCE_DHCP6, NETWORK_CONFIG_SOURCE_NDISC));
assert(rvalue);
r = manager_get_route_table_from_string(network->manager, rvalue, &rt);
}
switch (ltype) {
- case AF_INET:
+ case NETWORK_CONFIG_SOURCE_DHCP4:
network->dhcp_route_table = rt;
network->dhcp_route_table_set = true;
break;
- case AF_INET6:
+ case NETWORK_CONFIG_SOURCE_DHCP6:
+ network->dhcp6_route_table = rt;
+ network->dhcp6_route_table_set = true;
+ break;
+ case NETWORK_CONFIG_SOURCE_NDISC:
network->ndisc_route_table = rt;
network->ndisc_route_table_set = true;
break;
DHCPv4.DUIDType, config_parse_network_duid_type, 0, 0
DHCPv4.DUIDRawData, config_parse_network_duid_rawdata, 0, 0
DHCPv4.RouteMetric, config_parse_dhcp_route_metric, AF_INET, 0
-DHCPv4.RouteTable, config_parse_dhcp_or_ra_route_table, AF_INET, 0
+DHCPv4.RouteTable, config_parse_dhcp_or_ra_route_table, NETWORK_CONFIG_SOURCE_DHCP4, 0
DHCPv4.UseTimezone, config_parse_bool, 0, offsetof(Network, dhcp_use_timezone)
DHCPv4.ListenPort, config_parse_uint16, 0, offsetof(Network, dhcp_client_port)
DHCPv4.ServerPort, config_parse_uint16, 0, offsetof(Network, dhcp_port)
DHCPv6.NetLabel, config_parse_string, CONFIG_PARSE_STRING_SAFE, offsetof(Network, dhcp6_netlabel)
DHCPv6.SendRelease, config_parse_bool, 0, offsetof(Network, dhcp6_send_release)
DHCPv6.NFTSet, config_parse_nft_set, NFT_SET_PARSE_NETWORK, offsetof(Network, dhcp6_nft_set_context)
+DHCPv6.RouteTable, config_parse_dhcp_or_ra_route_table, NETWORK_CONFIG_SOURCE_DHCP6, 0
IPv6AcceptRA.UseRedirect, config_parse_bool, 0, offsetof(Network, ndisc_use_redirect)
IPv6AcceptRA.UseGateway, config_parse_bool, 0, offsetof(Network, ndisc_use_gateway)
IPv6AcceptRA.UseRoutePrefix, config_parse_bool, 0, offsetof(Network, ndisc_use_route_prefix)
IPv6AcceptRA.UseReachableTime, config_parse_bool, 0, offsetof(Network, ndisc_use_reachable_time)
IPv6AcceptRA.UseRetransmissionTime, config_parse_bool, 0, offsetof(Network, ndisc_use_retransmission_time)
IPv6AcceptRA.DHCPv6Client, config_parse_ndisc_start_dhcp6_client, 0, offsetof(Network, ndisc_start_dhcp6_client)
-IPv6AcceptRA.RouteTable, config_parse_dhcp_or_ra_route_table, AF_INET6, 0
+IPv6AcceptRA.RouteTable, config_parse_dhcp_or_ra_route_table, NETWORK_CONFIG_SOURCE_NDISC, 0
IPv6AcceptRA.RouteMetric, config_parse_ndisc_route_metric, 0, 0
IPv6AcceptRA.QuickAck, config_parse_bool, 0, offsetof(Network, ndisc_quickack)
IPv6AcceptRA.UseCaptivePortal, config_parse_bool, 0, offsetof(Network, ndisc_use_captive_portal)
DHCP.DUIDType, config_parse_network_duid_type, 0, 0
DHCP.DUIDRawData, config_parse_network_duid_rawdata, 0, 0
DHCP.RouteMetric, config_parse_dhcp_route_metric, AF_UNSPEC, 0
-DHCP.RouteTable, config_parse_dhcp_or_ra_route_table, AF_INET, 0
+DHCP.RouteTable, config_parse_dhcp_or_ra_route_table, NETWORK_CONFIG_SOURCE_DHCP4, 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_bool, 0, offsetof(Network, dhcp6_use_rapid_commit)