mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-11 09:18:38 +02:00
Fix: When configuring DNS as zero in NetworkManager, it results in the loss of system DNS configuration.The solution is to verify during configuration whether the address is zero.
This commit is contained in:
parent
95a329a927
commit
fe5fbde00a
1 changed files with 19 additions and 0 deletions
|
|
@ -786,6 +786,15 @@ nm_dns_uri_parse(int addr_family, const char *str, NMDnsServer *dns, GError **er
|
|||
str);
|
||||
return FALSE;
|
||||
}
|
||||
/*check addr is zero*/
|
||||
if(memcmp(&dns->addr, &nm_ip_addr_zero, sizeof(dns->addr)) == 0){
|
||||
g_set_error(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("\"%s\" is not a valid IP address"),
|
||||
str);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
dns->servername = name;
|
||||
dns->scheme = NM_DNS_URI_SCHEME_NONE;
|
||||
|
|
@ -889,6 +898,16 @@ nm_dns_uri_parse(int addr_family, const char *str, NMDnsServer *dns, GError **er
|
|||
addr);
|
||||
return FALSE;
|
||||
}
|
||||
/*check addr is zero*/
|
||||
if(memcmp(&dns->addr, &nm_ip_addr_zero, sizeof(dns->addr)) == 0){
|
||||
g_set_error(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("\"%s\" is not a valid IP address"),
|
||||
addr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (dns->scheme != NM_DNS_URI_SCHEME_TLS && dns->servername) {
|
||||
g_set_error_literal(error,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue