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().
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user