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.
}
-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);
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);
/************************************************************/
- /* 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);