]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: drop unnecessary call of ndisc_vacuum()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 7 Oct 2022 05:17:13 +0000 (14:17 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 7 Oct 2022 05:17:28 +0000 (14:17 +0900)
After the commit 773024685b37170395a11716f8e4ad99d3580455, DNS servers
or domains are dropped when their lifefime become zero. Hence, it is not
necessary to try to them when writing state file.

Of course, because of the accuracy of the timer event source or priority
of event sources, a possibility is introduced that a DNS server or domain
with zero lifetime is stored in the state file. However, such entry will
be dropped soon when the timer event source is triggered. Hence, that
should not cause any real issues.

src/network/networkd-ndisc.c
src/network/networkd-ndisc.h
src/network/networkd-state-file.c

index 95722e24ef90bd52ec2cedc026291956e5a20da6..f31735b6ec6f6793d3188dfdb58d18caae4e5c6e 100644 (file)
@@ -1175,27 +1175,6 @@ int ndisc_stop(Link *link) {
 }
 
 
-void ndisc_vacuum(Link *link) {
-        NDiscRDNSS *r;
-        NDiscDNSSL *d;
-        usec_t now_usec;
-
-        assert(link);
-        assert(link->manager);
-
-        /* Removes all RDNSS and DNSSL entries whose validity time has passed */
-
-        assert_se(sd_event_now(link->manager->event, CLOCK_BOOTTIME, &now_usec) >= 0);
-
-        SET_FOREACH(r, link->ndisc_rdnss)
-                if (r->lifetime_usec < now_usec)
-                        free(set_remove(link->ndisc_rdnss, r));
-
-        SET_FOREACH(d, link->ndisc_dnssl)
-                if (d->lifetime_usec < now_usec)
-                        free(set_remove(link->ndisc_dnssl, d));
-}
-
 void ndisc_flush(Link *link) {
         assert(link);
 
index b696db9df13471b5cc36b9a923463e466f4b7a63..6ccc1295d01b0a69aa50bb317d546175406d7b52 100644 (file)
@@ -41,7 +41,6 @@ void network_adjust_ipv6_accept_ra(Network *network);
 
 int ndisc_start(Link *link);
 int ndisc_stop(Link *link);
-void ndisc_vacuum(Link *link);
 void ndisc_flush(Link *link);
 
 int link_request_ndisc(Link *link);
index 502da1afb2ba0319269712a60e213e748f6d884d..493218499187c2f1699e9e89c13b627678d3c653 100644 (file)
@@ -540,9 +540,6 @@ int link_save(Link *link) {
 
                 /************************************************************/
 
-                /* Make sure to flush out old entries before we use the NDisc data */
-                ndisc_vacuum(link);
-
                 fputs("DNS=", f);
                 if (link->n_dns != UINT_MAX)
                         link_save_dns(link, f, link->dns, link->n_dns, NULL);