From b705d7f50e827d55419e9da9d8b8ae5ff027c366 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 19 Dec 2013 12:05:54 -0600 Subject: [PATCH] rdisc: don't add new RDNSS and DNSSL options with zero lifetime A lifetime of 0 means that the domain or server should no longer be used, so if we get an RA with a zero-lifetime DNS server or domain that we haven't seen before, don't bother adding it to the list. DNS servers and domains that are already known and become zero lifetime in the next RA are already correctly handled by clean_dns_servers() and clean_domains(). --- src/rdisc/nm-lndp-rdisc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c index 6afe60c7f..04b52067f 100644 --- a/src/rdisc/nm-lndp-rdisc.c +++ b/src/rdisc/nm-lndp-rdisc.c @@ -162,6 +162,10 @@ add_dns_server (NMRDisc *rdisc, const NMRDiscDNSServer *new) } } + /* DNS server should no longer be used */ + if (new->lifetime == 0) + return FALSE; + g_array_insert_val (rdisc->dns_servers, i, *new); return TRUE; } @@ -187,6 +191,10 @@ add_dns_domain (NMRDisc *rdisc, const NMRDiscDNSDomain *new) } } + /* Domain should no longer be used */ + if (new->lifetime == 0) + return FALSE; + g_array_insert_val (rdisc->dns_domains, i, *new); item = &g_array_index (rdisc->dns_domains, NMRDiscDNSDomain, i); item->domain = g_strdup (new->domain);