diff options
Diffstat (limited to 'src/network/networkd-dhcp-common.c')
-rw-r--r-- | src/network/networkd-dhcp-common.c | 193 |
1 files changed, 16 insertions, 177 deletions
diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index 080b153..9f0268d 100644 --- a/src/network/networkd-dhcp-common.c +++ b/src/network/networkd-dhcp-common.c @@ -5,7 +5,6 @@ #include "bus-error.h" #include "bus-locator.h" -#include "dhcp-identifier.h" #include "dhcp-option.h" #include "dhcp6-internal.h" #include "escape.h" @@ -41,12 +40,12 @@ uint32_t link_get_dhcp4_route_table(Link *link) { return link_get_vrf_table(link); } -uint32_t link_get_ipv6_accept_ra_route_table(Link *link) { +uint32_t link_get_ndisc_route_table(Link *link) { assert(link); assert(link->network); - if (link->network->ipv6_accept_ra_route_table_set) - return link->network->ipv6_accept_ra_route_table; + if (link->network->ndisc_route_table_set) + return link->network->ndisc_route_table; return link_get_vrf_table(link); } @@ -282,7 +281,7 @@ int link_get_captive_portal(Link *link, const char **ret) { return r; } - if (link->network->ipv6_accept_ra_use_captive_portal) { + if (link->network->ndisc_use_captive_portal) { NDiscCaptivePortal *cp; usec_t usec = 0; @@ -410,10 +409,10 @@ int config_parse_dhcp_route_metric( /* For backward compatibility. */ if (!network->dhcp_route_metric_set) network->dhcp_route_metric = metric; - if (!network->ipv6_accept_ra_route_metric_set) { - network->ipv6_accept_ra_route_metric_high = metric; - network->ipv6_accept_ra_route_metric_medium = metric; - network->ipv6_accept_ra_route_metric_low = metric; + if (!network->ndisc_route_metric_set) { + network->ndisc_route_metric_high = metric; + network->ndisc_route_metric_medium = metric; + network->ndisc_route_metric_low = metric; } break; default: @@ -423,7 +422,7 @@ int config_parse_dhcp_route_metric( return 0; } -int config_parse_ipv6_accept_ra_route_metric( +int config_parse_ndisc_route_metric( const char *unit, const char *filename, unsigned line, @@ -448,7 +447,7 @@ int config_parse_ipv6_accept_ra_route_metric( _cleanup_free_ char *high = NULL, *medium = NULL, *low = NULL; const char *p = rvalue; - r = extract_many_words(&p, ":", EXTRACT_DONT_COALESCE_SEPARATORS, &high, &medium, &low, NULL); + r = extract_many_words(&p, ":", EXTRACT_DONT_COALESCE_SEPARATORS, &high, &medium, &low); if (r == -ENOMEM) return log_oom(); if (r != 3 || !isempty(p)) { @@ -473,10 +472,10 @@ int config_parse_ipv6_accept_ra_route_metric( } } - network->ipv6_accept_ra_route_metric_high = metric_high; - network->ipv6_accept_ra_route_metric_medium = metric_medium; - network->ipv6_accept_ra_route_metric_low = metric_low; - network->ipv6_accept_ra_route_metric_set = true; + network->ndisc_route_metric_high = metric_high; + network->ndisc_route_metric_medium = metric_medium; + network->ndisc_route_metric_low = metric_low; + network->ndisc_route_metric_set = true; return 0; } @@ -531,158 +530,6 @@ int config_parse_dhcp_send_hostname( return 0; } -int config_parse_dhcp_use_dns( - const char* unit, - const char *filename, - unsigned line, - const char *section, - unsigned section_line, - const char *lvalue, - int ltype, - const char *rvalue, - void *data, - void *userdata) { - - Network *network = userdata; - int r; - - assert(filename); - assert(lvalue); - assert(IN_SET(ltype, AF_UNSPEC, AF_INET, AF_INET6)); - assert(rvalue); - assert(data); - - r = parse_boolean(rvalue); - if (r < 0) { - log_syntax(unit, LOG_WARNING, filename, line, r, - "Failed to parse UseDNS=%s, ignoring assignment: %m", rvalue); - return 0; - } - - switch (ltype) { - case AF_INET: - network->dhcp_use_dns = r; - network->dhcp_use_dns_set = true; - break; - case AF_INET6: - network->dhcp6_use_dns = r; - network->dhcp6_use_dns_set = true; - break; - case AF_UNSPEC: - /* For backward compatibility. */ - if (!network->dhcp_use_dns_set) - network->dhcp_use_dns = r; - if (!network->dhcp6_use_dns_set) - network->dhcp6_use_dns = r; - break; - default: - assert_not_reached(); - } - - return 0; -} - -int config_parse_dhcp_use_domains( - const char* unit, - const char *filename, - unsigned line, - const char *section, - unsigned section_line, - const char *lvalue, - int ltype, - const char *rvalue, - void *data, - void *userdata) { - - Network *network = userdata; - DHCPUseDomains d; - - assert(filename); - assert(lvalue); - assert(IN_SET(ltype, AF_UNSPEC, AF_INET, AF_INET6)); - assert(rvalue); - assert(data); - - d = dhcp_use_domains_from_string(rvalue); - if (d < 0) { - log_syntax(unit, LOG_WARNING, filename, line, d, - "Failed to parse %s=%s, ignoring assignment: %m", lvalue, rvalue); - return 0; - } - - switch (ltype) { - case AF_INET: - network->dhcp_use_domains = d; - network->dhcp_use_domains_set = true; - break; - case AF_INET6: - network->dhcp6_use_domains = d; - network->dhcp6_use_domains_set = true; - break; - case AF_UNSPEC: - /* For backward compatibility. */ - if (!network->dhcp_use_domains_set) - network->dhcp_use_domains = d; - if (!network->dhcp6_use_domains_set) - network->dhcp6_use_domains = d; - break; - default: - assert_not_reached(); - } - - return 0; -} - -int config_parse_dhcp_use_ntp( - const char* unit, - const char *filename, - unsigned line, - const char *section, - unsigned section_line, - const char *lvalue, - int ltype, - const char *rvalue, - void *data, - void *userdata) { - - Network *network = userdata; - int r; - - assert(filename); - assert(lvalue); - assert(IN_SET(ltype, AF_UNSPEC, AF_INET, AF_INET6)); - assert(rvalue); - assert(data); - - r = parse_boolean(rvalue); - if (r < 0) { - log_syntax(unit, LOG_WARNING, filename, line, r, - "Failed to parse UseNTP=%s, ignoring assignment: %m", rvalue); - return 0; - } - - switch (ltype) { - case AF_INET: - network->dhcp_use_ntp = r; - network->dhcp_use_ntp_set = true; - break; - case AF_INET6: - network->dhcp6_use_ntp = r; - network->dhcp6_use_ntp_set = true; - break; - case AF_UNSPEC: - /* For backward compatibility. */ - if (!network->dhcp_use_ntp_set) - network->dhcp_use_ntp = r; - if (!network->dhcp6_use_ntp_set) - network->dhcp6_use_ntp = r; - break; - default: - assert_not_reached(); - } - - return 0; -} int config_parse_dhcp_or_ra_route_table( const char *unit, @@ -718,8 +565,8 @@ int config_parse_dhcp_or_ra_route_table( network->dhcp_route_table_set = true; break; case AF_INET6: - network->ipv6_accept_ra_route_table = rt; - network->ipv6_accept_ra_route_table_set = true; + network->ndisc_route_table = rt; + network->ndisc_route_table_set = true; break; default: assert_not_reached(); @@ -1138,14 +985,6 @@ int config_parse_dhcp_request_options( } } -static const char* const dhcp_use_domains_table[_DHCP_USE_DOMAINS_MAX] = { - [DHCP_USE_DOMAINS_NO] = "no", - [DHCP_USE_DOMAINS_ROUTE] = "route", - [DHCP_USE_DOMAINS_YES] = "yes", -}; - -DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(dhcp_use_domains, DHCPUseDomains, DHCP_USE_DOMAINS_YES); - static const char * const dhcp_option_data_type_table[_DHCP_OPTION_DATA_MAX] = { [DHCP_OPTION_DATA_UINT8] = "uint8", [DHCP_OPTION_DATA_UINT16] = "uint16", |