mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-15 06:50:35 +01:00
dhcp/internal: handle localhost and 0.0.0.0 DNS/NTP servers specially
- regarding the DHCP options, we should not suppress them. If the lease contains such bogus(?) addresses, we still want to expose them on D-Bus without modification. - regrading using the DNS server, ignore localhost addresses like done for systemd-networkd ([1], [2]). Until recently, the DHCP library would internally suppress such addresses ([3]). That is no longer the case, and we should handle them specially. [1] https://github.com/systemd/systemd/issues/4524 [2]d9ec2e632d[3]334d5682ae
This commit is contained in:
parent
f3e1dea1fe
commit
c2b3b9b955
1 changed files with 9 additions and 7 deletions
|
|
@ -326,17 +326,19 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
|||
if (num > 0) {
|
||||
nm_gstring_prepare (&str);
|
||||
for (i = 0; i < num; i++) {
|
||||
if (addr_list[i].s_addr == 0)
|
||||
continue;
|
||||
|
||||
nm_utils_inet4_ntop (addr_list[i].s_addr, addr_str);
|
||||
g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
|
||||
|
||||
if ( addr_list[i].s_addr == 0
|
||||
|| nm_ip4_addr_is_localhost (addr_list[i].s_addr)) {
|
||||
/* Skip localhost addresses, like also networkd does.
|
||||
* See https://github.com/systemd/systemd/issues/4524. */
|
||||
continue;
|
||||
}
|
||||
nm_ip4_config_add_nameserver (ip4_config, addr_list[i].s_addr);
|
||||
}
|
||||
if (str->len) {
|
||||
LOG_LEASE (LOGD_DHCP4, "nameserver '%s'", str->str);
|
||||
add_option (options, dhcp4_requests, SD_DHCP_OPTION_DOMAIN_NAME_SERVER, str->str);
|
||||
}
|
||||
LOG_LEASE (LOGD_DHCP4, "nameserver '%s'", str->str);
|
||||
add_option (options, dhcp4_requests, SD_DHCP_OPTION_DOMAIN_NAME_SERVER, str->str);
|
||||
}
|
||||
|
||||
num = sd_dhcp_lease_get_search_domains (lease, (char ***) &search_domains);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue