From 52672db3f80adedad2dad38a19ff44a004a319ee Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 23 Feb 2024 12:41:24 +0900 Subject: [PATCH] network/ndisc: rename Network.ipv6_accept_ra -> Network.ndisc These settings are leated to sd-ndisc and Neighbor Discovery protocol. Let's use more suitable name. --- src/network/networkd-dhcp-common.c | 30 +++++----- src/network/networkd-dhcp-common.h | 4 +- src/network/networkd-dhcp6.c | 2 +- src/network/networkd-json.c | 6 +- src/network/networkd-link.c | 6 +- src/network/networkd-ndisc.c | 70 ++++++++++++------------ src/network/networkd-ndisc.h | 8 +-- src/network/networkd-network-gperf.gperf | 38 ++++++------- src/network/networkd-network.c | 36 ++++++------ src/network/networkd-network.h | 46 ++++++++-------- src/network/networkd-route-nexthop.c | 2 +- src/network/networkd-state-file.c | 8 +-- 12 files changed, 128 insertions(+), 128 deletions(-) diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index ac8baeb94ca..2edd849cce1 100644 --- a/src/network/networkd-dhcp-common.c +++ b/src/network/networkd-dhcp-common.c @@ -40,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); } @@ -281,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; @@ -409,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: @@ -422,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, @@ -472,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; } @@ -717,8 +717,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(); diff --git a/src/network/networkd-dhcp-common.h b/src/network/networkd-dhcp-common.h index f888e03b961..c3e6a6d51cd 100644 --- a/src/network/networkd-dhcp-common.h +++ b/src/network/networkd-dhcp-common.h @@ -54,7 +54,7 @@ typedef struct DUID { } DUID; uint32_t link_get_dhcp4_route_table(Link *link); -uint32_t link_get_ipv6_accept_ra_route_table(Link *link); +uint32_t link_get_ndisc_route_table(Link *link); bool link_dhcp_enabled(Link *link, int family); static inline bool link_dhcp4_enabled(Link *link) { @@ -95,7 +95,7 @@ DHCPOptionDataType dhcp_option_data_type_from_string(const char *d) _pure_; CONFIG_PARSER_PROTOTYPE(config_parse_dhcp); CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_route_metric); -CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_accept_ra_route_metric); +CONFIG_PARSER_PROTOTYPE(config_parse_ndisc_route_metric); CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_send_hostname); CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_use_dns); CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_use_domains); diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 27081e9d310..d280251e07e 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -799,7 +799,7 @@ int link_request_dhcp6_client(Link *link) { assert(link); - if (!link_dhcp6_enabled(link) && !link_ipv6_accept_ra_enabled(link)) + if (!link_dhcp6_enabled(link) && !link_ndisc_enabled(link)) return 0; if (link->dhcp6_client) diff --git a/src/network/networkd-json.c b/src/network/networkd-json.c index 1e9c64f9f51..57bea190f50 100644 --- a/src/network/networkd-json.c +++ b/src/network/networkd-json.c @@ -490,7 +490,7 @@ static int dns_append_json(Link *link, JsonVariant **v) { } } - if (link->network->ipv6_accept_ra_use_dns) { + if (link->network->ndisc_use_dns) { NDiscRDNSS *a; SET_FOREACH(a, link->ndisc_rdnss) { @@ -730,7 +730,7 @@ static int domains_append_json(Link *link, bool is_route, JsonVariant **v) { } } - if (link->network->ipv6_accept_ra_use_domains == use_domains) { + if (link->network->ndisc_use_domains == use_domains) { NDiscDNSSL *a; SET_FOREACH(a, link->ndisc_dnssl) { @@ -869,7 +869,7 @@ static int pref64_append_json(Link *link, JsonVariant **v) { assert(link); assert(v); - if (!link->network || !link->network->ipv6_accept_ra_use_pref64) + if (!link->network || !link->network->ndisc_use_pref64) return 0; SET_FOREACH(i, link->ndisc_pref64) { diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 95391017024..6304ead97ad 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -541,7 +541,7 @@ void link_check_ready(Link *link) { * Note, ignore NDisc when ConfigureWithoutCarrier= is enabled, as IPv6AcceptRA= is enabled by default. */ if (!link_ipv4ll_enabled(link) && !link_dhcp4_enabled(link) && !link_dhcp6_enabled(link) && !link_dhcp_pd_is_enabled(link) && - (link->network->configure_without_carrier || !link_ipv6_accept_ra_enabled(link))) + (link->network->configure_without_carrier || !link_ndisc_enabled(link))) goto ready; bool ipv4ll_ready = @@ -559,8 +559,8 @@ void link_check_ready(Link *link) { (!link->network->dhcp_pd_assign || link_check_addresses_ready(link, NETWORK_CONFIG_SOURCE_DHCP_PD)); bool ndisc_ready = - link_ipv6_accept_ra_enabled(link) && link->ndisc_configured && - (!link->network->ipv6_accept_ra_use_autonomous_prefix || + link_ndisc_enabled(link) && link->ndisc_configured && + (!link->network->ndisc_use_autonomous_prefix || link_check_addresses_ready(link, NETWORK_CONFIG_SOURCE_NDISC)); /* If the uplink for PD is self, then request the corresponding DHCP protocol is also ready. */ diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c index 04f31263371..24808413c18 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -35,7 +35,7 @@ * Not sure if the threshold is high enough. Let's adjust later if not. */ #define NDISC_PREF64_MAX 64U -bool link_ipv6_accept_ra_enabled(Link *link) { +bool link_ndisc_enabled(Link *link) { assert(link); if (!socket_ipv6_is_supported()) @@ -53,8 +53,8 @@ bool link_ipv6_accept_ra_enabled(Link *link) { if (!link_may_have_ipv6ll(link, /* check_multicast = */ true)) return false; - if (link->network->ipv6_accept_ra >= 0) - return link->network->ipv6_accept_ra; + if (link->network->ndisc >= 0) + return link->network->ndisc; /* Accept RAs if IPv6 forwarding is disabled, and ignore RAs if IPv6 forwarding is enabled. */ int t = link_get_ip_forwarding(link, AF_INET6); @@ -65,14 +65,14 @@ bool link_ipv6_accept_ra_enabled(Link *link) { return true; } -void network_adjust_ipv6_accept_ra(Network *network) { +void network_adjust_ndisc(Network *network) { assert(network); if (!FLAGS_SET(network->link_local, ADDRESS_FAMILY_IPV6)) { - if (network->ipv6_accept_ra > 0) + if (network->ndisc > 0) log_warning("%s: IPv6AcceptRA= is enabled but IPv6 link-local addressing is disabled or not supported. " "Disabling IPv6AcceptRA=.", network->filename); - network->ipv6_accept_ra = false; + network->ndisc = false; } /* When RouterAllowList=, PrefixAllowList= or RouteAllowList= are specified, then @@ -164,13 +164,13 @@ static void ndisc_set_route_priority(Link *link, Route *route) { switch (route->pref) { case SD_NDISC_PREFERENCE_LOW: - route->priority = link->network->ipv6_accept_ra_route_metric_low; + route->priority = link->network->ndisc_route_metric_low; break; case SD_NDISC_PREFERENCE_MEDIUM: - route->priority = link->network->ipv6_accept_ra_route_metric_medium; + route->priority = link->network->ndisc_route_metric_medium; break; case SD_NDISC_PREFERENCE_HIGH: - route->priority = link->network->ipv6_accept_ra_route_metric_high; + route->priority = link->network->ndisc_route_metric_high; break; default: assert_not_reached(); @@ -194,13 +194,13 @@ static int ndisc_request_route(Route *route, Link *link, sd_ndisc_router *rt) { if (r < 0) return r; - if (link->network->ipv6_accept_ra_use_mtu) { + if (link->network->ndisc_use_mtu) { r = sd_ndisc_router_get_mtu(rt, &mtu); if (r < 0 && r != -ENODATA) return log_link_warning_errno(link, r, "Failed to get MTU from RA: %m"); } - if (link->network->ipv6_accept_ra_use_hop_limit) { + if (link->network->ndisc_use_hop_limit) { r = sd_ndisc_router_get_hop_limit(rt, &hop_limit); if (r < 0 && r != -ENODATA) return log_link_warning_errno(link, r, "Failed to get hop limit from RA: %m"); @@ -209,7 +209,7 @@ static int ndisc_request_route(Route *route, Link *link, sd_ndisc_router *rt) { route->source = NETWORK_CONFIG_SOURCE_NDISC; route->provider.in6 = router; if (!route->table_set) - route->table = link_get_ipv6_accept_ra_route_table(link); + route->table = link_get_ndisc_route_table(link); if (!route->protocol_set) route->protocol = RTPROT_RA; r = route_metric_set(&route->metric, RTAX_MTU, mtu); @@ -218,7 +218,7 @@ static int ndisc_request_route(Route *route, Link *link, sd_ndisc_router *rt) { r = route_metric_set(&route->metric, RTAX_HOPLIMIT, hop_limit); if (r < 0) return r; - r = route_metric_set(&route->metric, RTAX_QUICKACK, link->network->ipv6_accept_ra_quickack); + r = route_metric_set(&route->metric, RTAX_QUICKACK, link->network->ndisc_quickack); if (r < 0) return r; @@ -288,7 +288,7 @@ static int ndisc_remove_route(Route *route, Link *link) { ndisc_set_route_priority(link, route); if (!route->table_set) - route->table = link_get_ipv6_accept_ra_route_table(link); + route->table = link_get_ndisc_route_table(link); r = route_adjust_nexthops(route, link); if (r < 0) @@ -444,7 +444,7 @@ static int ndisc_router_process_default(Link *link, sd_ndisc_router *rt) { if (r == 0) return ndisc_router_drop_default(link, rt); - if (!link->network->ipv6_accept_ra_use_gateway && + if (!link->network->ndisc_use_gateway && hashmap_isempty(link->network->routes_by_section)) return 0; @@ -467,7 +467,7 @@ static int ndisc_router_process_default(Link *link, sd_ndisc_router *rt) { if (r < 0) return log_link_warning_errno(link, r, "Failed to get router preference from RA: %m"); - if (link->network->ipv6_accept_ra_use_gateway) { + if (link->network->ndisc_use_gateway) { _cleanup_(route_unrefp) Route *route = NULL; r = route_new(&route); @@ -520,7 +520,7 @@ static int ndisc_router_process_icmp6_ratelimit(Link *link, sd_ndisc_router *rt) assert(link->network); assert(rt); - if (!link->network->ipv6_accept_ra_use_icmp6_ratelimit) + if (!link->network->ndisc_use_icmp6_ratelimit) return 0; /* Ignore the icmp6 ratelimit field of the RA header if the lifetime is zero. */ @@ -557,7 +557,7 @@ static int ndisc_router_process_reachable_time(Link *link, sd_ndisc_router *rt) assert(link->network); assert(rt); - if (!link->network->ipv6_accept_ra_use_reachable_time) + if (!link->network->ndisc_use_reachable_time) return 0; /* Ignore the reachable time field of the RA header if the lifetime is zero. */ @@ -595,7 +595,7 @@ static int ndisc_router_process_retransmission_time(Link *link, sd_ndisc_router assert(link->network); assert(rt); - if (!link->network->ipv6_accept_ra_use_retransmission_time) + if (!link->network->ndisc_use_retransmission_time) return 0; /* Ignore the retransmission time field of the RA header if the lifetime is zero. */ @@ -633,7 +633,7 @@ static int ndisc_router_process_hop_limit(Link *link, sd_ndisc_router *rt) { assert(link->network); assert(rt); - if (!link->network->ipv6_accept_ra_use_hop_limit) + if (!link->network->ndisc_use_hop_limit) return 0; /* Ignore the hop limit field of the RA header if the lifetime is zero. */ @@ -676,7 +676,7 @@ static int ndisc_router_process_autonomous_prefix(Link *link, sd_ndisc_router *r assert(link->network); assert(rt); - if (!link->network->ipv6_accept_ra_use_autonomous_prefix) + if (!link->network->ndisc_use_autonomous_prefix) return 0; r = sd_ndisc_router_prefix_get_address(rt, &prefix); @@ -756,7 +756,7 @@ static int ndisc_router_process_onlink_prefix(Link *link, sd_ndisc_router *rt) { assert(link->network); assert(rt); - if (!link->network->ipv6_accept_ra_use_onlink_prefix) + if (!link->network->ndisc_use_onlink_prefix) return 0; r = sd_ndisc_router_prefix_get_valid_lifetime_timestamp(rt, CLOCK_BOOTTIME, &lifetime_usec); @@ -810,7 +810,7 @@ static int ndisc_router_drop_onlink_prefix(Link *link, sd_ndisc_router *rt) { * covered by the prefix are off-link. The only way to cancel a previous on-link indication is to * advertise that prefix with the L-bit set and the Lifetime set to zero. */ - if (!link->network->ipv6_accept_ra_use_onlink_prefix) + if (!link->network->ndisc_use_onlink_prefix) return 0; r = sd_ndisc_router_prefix_get_valid_lifetime(rt, &lifetime_usec); @@ -907,7 +907,7 @@ static int ndisc_router_process_route(Link *link, sd_ndisc_router *rt) { assert(link); - if (!link->network->ipv6_accept_ra_use_route_prefix) + if (!link->network->ndisc_use_route_prefix) return 0; r = sd_ndisc_router_route_get_lifetime_timestamp(rt, CLOCK_BOOTTIME, &lifetime_usec); @@ -1003,7 +1003,7 @@ static int ndisc_router_process_rdnss(Link *link, sd_ndisc_router *rt) { assert(link->network); assert(rt); - if (!link->network->ipv6_accept_ra_use_dns) + if (!link->network->ndisc_use_dns) return 0; r = sd_ndisc_router_get_address(rt, &router); @@ -1095,7 +1095,7 @@ static int ndisc_router_process_dnssl(Link *link, sd_ndisc_router *rt) { assert(link->network); assert(rt); - if (link->network->ipv6_accept_ra_use_domains == DHCP_USE_DOMAINS_NO) + if (link->network->ndisc_use_domains == DHCP_USE_DOMAINS_NO) return 0; r = sd_ndisc_router_get_address(rt, &router); @@ -1200,7 +1200,7 @@ static int ndisc_router_process_captive_portal(Link *link, sd_ndisc_router *rt) assert(link->network); assert(rt); - if (!link->network->ipv6_accept_ra_use_captive_portal) + if (!link->network->ndisc_use_captive_portal) return 0; r = sd_ndisc_router_get_address(rt, &router); @@ -1320,7 +1320,7 @@ static int ndisc_router_process_pref64(Link *link, sd_ndisc_router *rt) { assert(link->network); assert(rt); - if (!link->network->ipv6_accept_ra_use_pref64) + if (!link->network->ndisc_use_pref64) return 0; r = sd_ndisc_router_get_address(rt, &router); @@ -1614,7 +1614,7 @@ static int ndisc_start_dhcp6_client(Link *link, sd_ndisc_router *rt) { if (r <= 0) return r; - switch (link->network->ipv6_accept_ra_start_dhcp6_client) { + switch (link->network->ndisc_start_dhcp6_client) { case IPV6_ACCEPT_RA_START_DHCP6_CLIENT_NO: return 0; @@ -1770,7 +1770,7 @@ static int ndisc_configure(Link *link) { assert(link); - if (!link_ipv6_accept_ra_enabled(link)) + if (!link_ndisc_enabled(link)) return 0; if (link->ndisc) @@ -1850,7 +1850,7 @@ int link_request_ndisc(Link *link) { assert(link); - if (!link_ipv6_accept_ra_enabled(link)) + if (!link_ndisc_enabled(link)) return 0; if (link->ndisc) @@ -1885,15 +1885,15 @@ void ndisc_flush(Link *link) { link->ndisc_pref64 = set_free(link->ndisc_pref64); } -static const char* const ipv6_accept_ra_start_dhcp6_client_table[_IPV6_ACCEPT_RA_START_DHCP6_CLIENT_MAX] = { +static const char* const ndisc_start_dhcp6_client_table[_IPV6_ACCEPT_RA_START_DHCP6_CLIENT_MAX] = { [IPV6_ACCEPT_RA_START_DHCP6_CLIENT_NO] = "no", [IPV6_ACCEPT_RA_START_DHCP6_CLIENT_ALWAYS] = "always", [IPV6_ACCEPT_RA_START_DHCP6_CLIENT_YES] = "yes", }; -DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(ipv6_accept_ra_start_dhcp6_client, IPv6AcceptRAStartDHCP6Client, IPV6_ACCEPT_RA_START_DHCP6_CLIENT_YES); +DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(ndisc_start_dhcp6_client, IPv6AcceptRAStartDHCP6Client, IPV6_ACCEPT_RA_START_DHCP6_CLIENT_YES); -DEFINE_CONFIG_PARSE_ENUM(config_parse_ipv6_accept_ra_use_domains, dhcp_use_domains, DHCPUseDomains, +DEFINE_CONFIG_PARSE_ENUM(config_parse_ndisc_use_domains, dhcp_use_domains, DHCPUseDomains, "Failed to parse UseDomains= setting"); -DEFINE_CONFIG_PARSE_ENUM(config_parse_ipv6_accept_ra_start_dhcp6_client, ipv6_accept_ra_start_dhcp6_client, IPv6AcceptRAStartDHCP6Client, +DEFINE_CONFIG_PARSE_ENUM(config_parse_ndisc_start_dhcp6_client, ndisc_start_dhcp6_client, IPv6AcceptRAStartDHCP6Client, "Failed to parse DHCPv6Client= setting"); diff --git a/src/network/networkd-ndisc.h b/src/network/networkd-ndisc.h index a463f42b522..2766f5e4350 100644 --- a/src/network/networkd-ndisc.h +++ b/src/network/networkd-ndisc.h @@ -52,9 +52,9 @@ static inline char* NDISC_DNSSL_DOMAIN(const NDiscDNSSL *n) { return ((char*) n) + ALIGN(sizeof(NDiscDNSSL)); } -bool link_ipv6_accept_ra_enabled(Link *link); +bool link_ndisc_enabled(Link *link); -void network_adjust_ipv6_accept_ra(Network *network); +void network_adjust_ndisc(Network *network); int ndisc_start(Link *link); int ndisc_stop(Link *link); @@ -62,5 +62,5 @@ void ndisc_flush(Link *link); int link_request_ndisc(Link *link); -CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_accept_ra_start_dhcp6_client); -CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_accept_ra_use_domains); +CONFIG_PARSER_PROTOTYPE(config_parse_ndisc_start_dhcp6_client); +CONFIG_PARSER_PROTOTYPE(config_parse_ndisc_use_domains); diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 12023772f96..91710561563 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -129,8 +129,8 @@ Network.IPv4Forwarding, config_parse_tristate, Network.IPv6Forwarding, config_parse_tristate, 0, offsetof(Network, ip_forwarding[1]) Network.IPMasquerade, config_parse_ip_masquerade, 0, offsetof(Network, ip_masquerade) Network.IPv6PrivacyExtensions, config_parse_ipv6_privacy_extensions, 0, offsetof(Network, ipv6_privacy_extensions) -Network.IPv6AcceptRA, config_parse_tristate, 0, offsetof(Network, ipv6_accept_ra) -Network.IPv6AcceptRouterAdvertisements, config_parse_tristate, 0, offsetof(Network, ipv6_accept_ra) +Network.IPv6AcceptRA, config_parse_tristate, 0, offsetof(Network, ndisc) +Network.IPv6AcceptRouterAdvertisements, config_parse_tristate, 0, offsetof(Network, ndisc) Network.IPv6DuplicateAddressDetection, config_parse_int, 0, offsetof(Network, ipv6_dad_transmits) Network.IPv6HopLimit, config_parse_uint8, 0, offsetof(Network, ipv6_hop_limit) Network.IPv6RetransmissionTimeSec, config_parse_sec, 0, offsetof(Network, ipv6_retransmission_time) @@ -292,23 +292,23 @@ DHCPv6.RapidCommit, config_parse_bool, 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) -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) -IPv6AcceptRA.UseOnLinkPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_onlink_prefix) -IPv6AcceptRA.UsePREF64, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_pref64) -IPv6AcceptRA.UseDNS, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_dns) -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.UseHopLimit, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_hop_limit) -IPv6AcceptRA.UseReachableTime, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_reachable_time) -IPv6AcceptRA.UseRetransmissionTime, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_retransmission_time) -IPv6AcceptRA.UseICMP6RateLimit, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_icmp6_ratelimit) -IPv6AcceptRA.DHCPv6Client, config_parse_ipv6_accept_ra_start_dhcp6_client, 0, offsetof(Network, ipv6_accept_ra_start_dhcp6_client) +IPv6AcceptRA.UseGateway, config_parse_bool, 0, offsetof(Network, ndisc_use_gateway) +IPv6AcceptRA.UseRoutePrefix, config_parse_bool, 0, offsetof(Network, ndisc_use_route_prefix) +IPv6AcceptRA.UseAutonomousPrefix, config_parse_bool, 0, offsetof(Network, ndisc_use_autonomous_prefix) +IPv6AcceptRA.UseOnLinkPrefix, config_parse_bool, 0, offsetof(Network, ndisc_use_onlink_prefix) +IPv6AcceptRA.UsePREF64, config_parse_bool, 0, offsetof(Network, ndisc_use_pref64) +IPv6AcceptRA.UseDNS, config_parse_bool, 0, offsetof(Network, ndisc_use_dns) +IPv6AcceptRA.UseDomains, config_parse_ndisc_use_domains, 0, offsetof(Network, ndisc_use_domains) +IPv6AcceptRA.UseMTU, config_parse_bool, 0, offsetof(Network, ndisc_use_mtu) +IPv6AcceptRA.UseHopLimit, config_parse_bool, 0, offsetof(Network, ndisc_use_hop_limit) +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.UseICMP6RateLimit, config_parse_bool, 0, offsetof(Network, ndisc_use_icmp6_ratelimit) +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.RouteMetric, config_parse_ipv6_accept_ra_route_metric, 0, 0 -IPv6AcceptRA.QuickAck, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_quickack) -IPv6AcceptRA.UseCaptivePortal, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_captive_portal) +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) 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) IPv6AcceptRA.PrefixAllowList, config_parse_in_addr_prefixes, AF_INET6, offsetof(Network, ndisc_allow_listed_prefix) @@ -611,7 +611,7 @@ DHCP.RapidCommit, config_parse_bool, DHCP.ForceDHCPv6PDOtherInformation, config_parse_warn_compat, DISABLED_LEGACY, 0 DHCPv4.UseDomainName, config_parse_dhcp_use_domains, AF_INET, 0 DHCPv4.CriticalConnection, config_parse_tristate, 0, offsetof(Network, dhcp_critical) -DHCPv6.RouteMetric, config_parse_ipv6_accept_ra_route_metric, AF_INET6, 0 +DHCPv6.RouteMetric, config_parse_ndisc_route_metric, AF_INET6, 0 DHCPv6.ForceDHCPv6PDOtherInformation, config_parse_warn_compat, DISABLED_LEGACY, 0 DHCPv6PrefixDelegation.SubnetId, config_parse_dhcp_pd_subnet_id, 0, offsetof(Network, dhcp_pd_subnet_id) DHCPv6PrefixDelegation.Announce, config_parse_bool, 0, offsetof(Network, dhcp_pd_announce) diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 2ecbbff8208..601820b1232 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -226,7 +226,7 @@ int network_verify(Network *network) { network->ipv6ll_address_gen_mode = IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_STABLE_PRIVACY; network_adjust_ipv6_proxy_ndp(network); - network_adjust_ipv6_accept_ra(network); + network_adjust_ndisc(network); network_adjust_dhcp(network); network_adjust_radv(network); network_adjust_bridge_vlan(network); @@ -472,23 +472,23 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi .proxy_arp_pvlan = -1, .ipv4_rp_filter = _IP_REVERSE_PATH_FILTER_INVALID, - .ipv6_accept_ra = -1, - .ipv6_accept_ra_use_dns = true, - .ipv6_accept_ra_use_gateway = true, - .ipv6_accept_ra_use_captive_portal = true, - .ipv6_accept_ra_use_route_prefix = true, - .ipv6_accept_ra_use_autonomous_prefix = true, - .ipv6_accept_ra_use_onlink_prefix = true, - .ipv6_accept_ra_use_mtu = true, - .ipv6_accept_ra_use_hop_limit = true, - .ipv6_accept_ra_use_reachable_time = true, - .ipv6_accept_ra_use_retransmission_time = true, - .ipv6_accept_ra_use_icmp6_ratelimit = true, - .ipv6_accept_ra_route_table = RT_TABLE_MAIN, - .ipv6_accept_ra_route_metric_high = IPV6RA_ROUTE_METRIC_HIGH, - .ipv6_accept_ra_route_metric_medium = IPV6RA_ROUTE_METRIC_MEDIUM, - .ipv6_accept_ra_route_metric_low = IPV6RA_ROUTE_METRIC_LOW, - .ipv6_accept_ra_start_dhcp6_client = IPV6_ACCEPT_RA_START_DHCP6_CLIENT_YES, + .ndisc = -1, + .ndisc_use_dns = true, + .ndisc_use_gateway = true, + .ndisc_use_captive_portal = true, + .ndisc_use_route_prefix = true, + .ndisc_use_autonomous_prefix = true, + .ndisc_use_onlink_prefix = true, + .ndisc_use_mtu = true, + .ndisc_use_hop_limit = true, + .ndisc_use_reachable_time = true, + .ndisc_use_retransmission_time = true, + .ndisc_use_icmp6_ratelimit = true, + .ndisc_route_table = RT_TABLE_MAIN, + .ndisc_route_metric_high = IPV6RA_ROUTE_METRIC_HIGH, + .ndisc_route_metric_medium = IPV6RA_ROUTE_METRIC_MEDIUM, + .ndisc_route_metric_low = IPV6RA_ROUTE_METRIC_LOW, + .ndisc_start_dhcp6_client = IPV6_ACCEPT_RA_START_DHCP6_CLIENT_YES, .can_termination = -1, diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index e9236ded01c..b30e3b22098 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -334,31 +334,31 @@ struct Network { int ipv6_proxy_ndp; Set *ipv6_proxy_ndp_addresses; - /* IPv6 accept RA */ - int ipv6_accept_ra; - bool ipv6_accept_ra_use_dns; - bool ipv6_accept_ra_use_gateway; - bool ipv6_accept_ra_use_route_prefix; - bool ipv6_accept_ra_use_autonomous_prefix; - bool ipv6_accept_ra_use_onlink_prefix; - bool ipv6_accept_ra_use_mtu; - bool ipv6_accept_ra_use_hop_limit; - bool ipv6_accept_ra_use_reachable_time; - bool ipv6_accept_ra_use_retransmission_time; - bool ipv6_accept_ra_use_icmp6_ratelimit; - bool ipv6_accept_ra_quickack; - bool ipv6_accept_ra_use_captive_portal; - bool ipv6_accept_ra_use_pref64; + /* NDisc support */ + int ndisc; + bool ndisc_use_dns; + bool ndisc_use_gateway; + bool ndisc_use_route_prefix; + bool ndisc_use_autonomous_prefix; + bool ndisc_use_onlink_prefix; + bool ndisc_use_mtu; + bool ndisc_use_hop_limit; + bool ndisc_use_reachable_time; + bool ndisc_use_retransmission_time; + bool ndisc_use_icmp6_ratelimit; + bool ndisc_quickack; + bool ndisc_use_captive_portal; + bool ndisc_use_pref64; bool active_slave; bool primary_slave; - DHCPUseDomains ipv6_accept_ra_use_domains; - IPv6AcceptRAStartDHCP6Client ipv6_accept_ra_start_dhcp6_client; - uint32_t ipv6_accept_ra_route_table; - bool ipv6_accept_ra_route_table_set; - uint32_t ipv6_accept_ra_route_metric_high; - uint32_t ipv6_accept_ra_route_metric_medium; - uint32_t ipv6_accept_ra_route_metric_low; - bool ipv6_accept_ra_route_metric_set; + DHCPUseDomains ndisc_use_domains; + IPv6AcceptRAStartDHCP6Client ndisc_start_dhcp6_client; + uint32_t ndisc_route_table; + bool ndisc_route_table_set; + uint32_t ndisc_route_metric_high; + uint32_t ndisc_route_metric_medium; + uint32_t ndisc_route_metric_low; + bool ndisc_route_metric_set; Set *ndisc_deny_listed_router; Set *ndisc_allow_listed_router; Set *ndisc_deny_listed_prefix; diff --git a/src/network/networkd-route-nexthop.c b/src/network/networkd-route-nexthop.c index 23bf0b33063..8ba7505987a 100644 --- a/src/network/networkd-route-nexthop.c +++ b/src/network/networkd-route-nexthop.c @@ -840,7 +840,7 @@ int route_section_verify_nexthops(Route *route) { "Ignoring [Route] section from line %u.", route->section->filename, route->section->line); - if (route->nexthop.family == AF_INET6 && route->network->ipv6_accept_ra == 0) + if (route->nexthop.family == AF_INET6 && route->network->ndisc == 0) return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "%s: Gateway=\"_ipv6ra\" is specified but IPv6AcceptRA= is disabled. " "Ignoring [Route] section from line %u.", diff --git a/src/network/networkd-state-file.c b/src/network/networkd-state-file.c index 859a28aa59f..1cd23bb4ca8 100644 --- a/src/network/networkd-state-file.c +++ b/src/network/networkd-state-file.c @@ -123,7 +123,7 @@ static int link_put_dns(Link *link, OrderedSet **s) { } } - if (link->network->ipv6_accept_ra_use_dns) { + if (link->network->ndisc_use_dns) { NDiscRDNSS *a; SET_FOREACH(a, link->ndisc_rdnss) { @@ -254,7 +254,7 @@ static int link_put_domains(Link *link, bool is_route, OrderedSet **s) { } } - if (link->network->ipv6_accept_ra_use_domains == use_domains) { + if (link->network->ndisc_use_domains == use_domains) { NDiscDNSSL *a; SET_FOREACH(a, link->ndisc_dnssl) { @@ -559,7 +559,7 @@ static void link_save_domains(Link *link, FILE *f, OrderedSet *static_domains, D fputstrv(f, domains, NULL, &space); } - if (link->network->ipv6_accept_ra_use_domains == use_domains) { + if (link->network->ndisc_use_domains == use_domains) { NDiscDNSSL *dd; SET_FOREACH(dd, link->ndisc_dnssl) @@ -675,7 +675,7 @@ static int link_save(Link *link) { sd_dhcp6_lease_get_dns, NULL); - if (link->network->ipv6_accept_ra_use_dns) { + if (link->network->ndisc_use_dns) { NDiscRDNSS *dd; SET_FOREACH(dd, link->ndisc_rdnss) -- 2.39.2