mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 10:20:11 +01:00
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:
parent
3f654dc6e6
commit
b705d7f50e
1 changed files with 8 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue