From 165a654e29c055e5645f1857d13bc39c73193762 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 28 Sep 2021 11:45:24 +0900 Subject: [PATCH] network: radv: extends lifetime for DNS servers or domains propagated from uplink Previously, the lifetime was 30 minutes. But it is not necessary to set to such short time compared with prefix or route prefix lifetime. Note that the propagated DNS servers and domains are all 'static', that is, configured in a .network file, and not provided dynamically. So, it should be safe to use longer lifetime. --- src/network/networkd-radv.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/network/networkd-radv.c b/src/network/networkd-radv.c index 54a0d667c8..73e9bce52a 100644 --- a/src/network/networkd-radv.c +++ b/src/network/networkd-radv.c @@ -324,7 +324,6 @@ static int network_get_ipv6_dns(Network *network, struct in6_addr **ret_addresse static int radv_set_dns(Link *link, Link *uplink) { _cleanup_free_ struct in6_addr *dns = NULL; - usec_t lifetime_usec; size_t n_dns; int r; @@ -347,13 +346,10 @@ static int radv_set_dns(Link *link, Link *uplink) { *(p++) = link->network->router_dns[i]; n_dns = p - dns; - lifetime_usec = link->network->router_dns_lifetime_usec; goto set_dns; } - lifetime_usec = SD_RADV_DEFAULT_DNS_LIFETIME_USEC; - r = network_get_ipv6_dns(link->network, &dns, &n_dns); if (r > 0) goto set_dns; @@ -370,26 +366,22 @@ static int radv_set_dns(Link *link, Link *uplink) { set_dns: return sd_radv_set_rdnss(link->radv, - DIV_ROUND_UP(lifetime_usec, USEC_PER_SEC), + usec_to_lifetime(link->network->router_dns_lifetime_usec), dns, n_dns); } static int radv_set_domains(Link *link, Link *uplink) { - OrderedSet *search_domains; - usec_t lifetime_usec; _cleanup_free_ char **s = NULL; /* just free() because the strings are owned by the set */ + OrderedSet *search_domains; if (!link->network->router_emit_domains) return 0; search_domains = link->network->router_search_domains; - lifetime_usec = link->network->router_dns_lifetime_usec; if (search_domains) goto set_domains; - lifetime_usec = SD_RADV_DEFAULT_DNS_LIFETIME_USEC; - search_domains = link->network->search_domains; if (search_domains) goto set_domains; @@ -410,7 +402,7 @@ set_domains: return log_oom(); return sd_radv_set_dnssl(link->radv, - DIV_ROUND_UP(lifetime_usec, USEC_PER_SEC), + usec_to_lifetime(link->network->router_dns_lifetime_usec), s); }