core: extend NML3ConfigData:nameserver to track DNS as string
The DNS name can now also contain the DoT server name. It's not longer a binary IP address only. Extend NML3ConfigData to account for that. To track the additional data, use the string representation. The alternative to have a separate type that contains the parsed information would be cumbersome too.
This commit is contained in:
@@ -10780,14 +10780,14 @@ nm_device_copy_ip6_dns_config(NMDevice *self, NMDevice *from_device)
|
||||
l3cd_src = priv_src->l3cds[L3_CONFIG_DATA_TYPE_AC_6].d;
|
||||
}
|
||||
if (l3cd_src) {
|
||||
const char *const *strvarr;
|
||||
const struct in6_addr *addrs;
|
||||
guint n;
|
||||
guint i;
|
||||
const char *const *strvarr;
|
||||
const char *const *addrs;
|
||||
guint n;
|
||||
guint i;
|
||||
|
||||
addrs = nm_l3_config_data_get_nameservers(l3cd_src, AF_INET6, &n);
|
||||
for (i = 0; i < n; i++)
|
||||
nm_l3_config_data_add_nameserver(l3cd, AF_INET6, &addrs[i]);
|
||||
nm_l3_config_data_add_nameserver(l3cd, AF_INET6, addrs[i]);
|
||||
|
||||
strvarr = nm_l3_config_data_get_searches(l3cd_src, AF_INET6, &n);
|
||||
for (i = 0; i < n; i++)
|
||||
|
@@ -3735,7 +3735,7 @@ nm_device_iwd_parse_netconfig(NMDeviceIwd *self, int addr_family, GVariantIter *
|
||||
if (inet_pton(addr_family, str_value, &dns_bin) != 1)
|
||||
goto param_error;
|
||||
|
||||
nm_l3_config_data_add_nameserver(l3cd, addr_family, &dns_bin);
|
||||
nm_l3_config_data_add_nameserver_detail(l3cd, addr_family, &dns_bin, NULL);
|
||||
nm_l3_config_data_set_dns_priority(l3cd, addr_family, NM_DNS_PRIORITY_DEFAULT_NORMAL);
|
||||
}
|
||||
}
|
||||
|
@@ -1058,7 +1058,7 @@ stage3_ip_config_start(NMModem *modem, int addr_family, NMModemIPMethod ip_metho
|
||||
dns = mm_bearer_ip_config_get_dns(self->_priv.ipv4_config);
|
||||
for (i = 0; dns && dns[i]; i++) {
|
||||
if (nm_inet_parse_bin(AF_INET, dns[i], NULL, &address_network) && address_network > 0) {
|
||||
nm_l3_config_data_add_nameserver(l3cd, AF_INET, &address_network);
|
||||
nm_l3_config_data_add_nameserver_detail(l3cd, AF_INET, &address_network, NULL);
|
||||
_LOGI(" DNS %s", dns[i]);
|
||||
}
|
||||
}
|
||||
@@ -1173,7 +1173,7 @@ stage3_ip_config_start(NMModem *modem, int addr_family, NMModemIPMethod ip_metho
|
||||
struct in6_addr addr;
|
||||
|
||||
if (inet_pton(AF_INET6, dns[i], &addr)) {
|
||||
nm_l3_config_data_add_nameserver(l3cd, AF_INET6, &addr);
|
||||
nm_l3_config_data_add_nameserver_detail(l3cd, AF_INET6, &addr, NULL);
|
||||
_LOGI(" DNS %s", dns[i]);
|
||||
}
|
||||
}
|
||||
|
@@ -846,7 +846,7 @@ handle_settings(GVariant *v_dict, gpointer user_data)
|
||||
}
|
||||
any_good = TRUE;
|
||||
_LOGI("DNS: %s", *array);
|
||||
nm_l3_config_data_add_nameserver(priv->l3cd_4, AF_INET, &address_network);
|
||||
nm_l3_config_data_add_nameserver_detail(priv->l3cd_4, AF_INET, &address_network, NULL);
|
||||
}
|
||||
if (!any_good) {
|
||||
_LOGW("Settings: 'DomainNameServers': none specified");
|
||||
|
@@ -353,7 +353,7 @@ lease_parse_address_list(NDhcp4ClientLease *lease,
|
||||
nm_inet4_ntop(addr, addr_str));
|
||||
continue;
|
||||
}
|
||||
nm_l3_config_data_add_nameserver(l3cd, AF_INET, &addr);
|
||||
nm_l3_config_data_add_nameserver_detail(l3cd, AF_INET, &addr, NULL);
|
||||
break;
|
||||
case NM_DHCP_OPTION_DHCP4_NIS_SERVERS:
|
||||
nm_l3_config_data_add_nis_server(l3cd, addr);
|
||||
|
@@ -135,7 +135,7 @@ lease_to_ip6_config(NMDhcpSystemd *self, sd_dhcp6_lease *lease, gint32 ts, GErro
|
||||
for (i = 0; i < num; i++) {
|
||||
nm_inet6_ntop(&dns[i], addr_str);
|
||||
g_string_append(nm_gstring_add_space_delimiter(str), addr_str);
|
||||
nm_l3_config_data_add_nameserver(l3cd, AF_INET6, &dns[i]);
|
||||
nm_l3_config_data_add_nameserver_detail(l3cd, AF_INET6, &dns[i], NULL);
|
||||
}
|
||||
nm_dhcp_option_add_option(options, AF_INET6, NM_DHCP_OPTION_DHCP6_DNS_SERVERS, str->str);
|
||||
}
|
||||
|
@@ -499,7 +499,7 @@ nm_dhcp_utils_ip4_config_from_options(NMDedupMultiIndex *multi_idx,
|
||||
for (s = dns; dns && *s; s++) {
|
||||
if (inet_pton(AF_INET, *s, &tmp_addr) > 0) {
|
||||
if (tmp_addr) {
|
||||
nm_l3_config_data_add_nameserver(l3cd, AF_INET, &tmp_addr);
|
||||
nm_l3_config_data_add_nameserver_detail(l3cd, AF_INET, &tmp_addr, NULL);
|
||||
_LOG2I(LOGD_DHCP4, iface, " nameserver '%s'", *s);
|
||||
}
|
||||
} else
|
||||
@@ -704,7 +704,7 @@ nm_dhcp_utils_ip6_config_from_options(NMDedupMultiIndex *multi_idx,
|
||||
for (s = dns; dns && *s; s++) {
|
||||
if (inet_pton(AF_INET6, *s, &tmp_addr) > 0) {
|
||||
if (!IN6_IS_ADDR_UNSPECIFIED(&tmp_addr)) {
|
||||
nm_l3_config_data_add_nameserver(l3cd, AF_INET6, &tmp_addr);
|
||||
nm_l3_config_data_add_nameserver_detail(l3cd, AF_INET6, &tmp_addr, NULL);
|
||||
_LOG2I(LOGD_DHCP6, iface, " nameserver '%s'", *s);
|
||||
}
|
||||
} else
|
||||
|
@@ -88,7 +88,6 @@ test_generic_options(void)
|
||||
const char *expected_route2_dest = "100.99.88.56";
|
||||
const char *expected_route2_gw = "10.1.1.1";
|
||||
const char *const *strarr;
|
||||
const in_addr_t *ia_arr;
|
||||
guint u;
|
||||
|
||||
options = fill_table(generic_options, NULL);
|
||||
@@ -115,10 +114,10 @@ test_generic_options(void)
|
||||
g_assert_cmpstr(strarr[0], ==, expected_search1);
|
||||
g_assert_cmpstr(strarr[1], ==, expected_search2);
|
||||
|
||||
ia_arr = nm_l3_config_data_get_nameservers(l3cd, AF_INET, &u);
|
||||
strarr = nm_l3_config_data_get_nameservers(l3cd, AF_INET, &u);
|
||||
g_assert_cmpint(u, ==, 2);
|
||||
nmtst_assert_ip4_address(ia_arr[0], expected_dns1);
|
||||
nmtst_assert_ip4_address(ia_arr[1], expected_dns2);
|
||||
g_assert_cmpstr(strarr[0], ==, expected_dns1);
|
||||
g_assert_cmpstr(strarr[1], ==, expected_dns2);
|
||||
|
||||
g_assert_cmpint(nm_l3_config_data_get_num_routes(l3cd, AF_INET), ==, 3);
|
||||
|
||||
|
@@ -868,22 +868,24 @@ add_global_config(NMDnsDnsmasq *self,
|
||||
static void
|
||||
add_ip_config(NMDnsDnsmasq *self, GVariantBuilder *servers, const NMDnsConfigIPData *ip_data)
|
||||
{
|
||||
const char *iface;
|
||||
const char *domain;
|
||||
char ip_addr_to_string_buf[IP_ADDR_TO_STRING_BUFLEN];
|
||||
gconstpointer nameservers;
|
||||
guint num;
|
||||
guint i;
|
||||
guint j;
|
||||
const char *iface;
|
||||
const char *domain;
|
||||
char ip_addr_to_string_buf[IP_ADDR_TO_STRING_BUFLEN];
|
||||
const char *const *strarr;
|
||||
guint num;
|
||||
guint i;
|
||||
guint j;
|
||||
|
||||
iface = nm_platform_link_get_name(NM_PLATFORM_GET, ip_data->data->ifindex);
|
||||
|
||||
nameservers = nm_l3_config_data_get_nameservers(ip_data->l3cd, ip_data->addr_family, &num);
|
||||
strarr = nm_l3_config_data_get_nameservers(ip_data->l3cd, ip_data->addr_family, &num);
|
||||
for (i = 0; i < num; i++) {
|
||||
gconstpointer addr;
|
||||
NMIPAddr a;
|
||||
|
||||
addr = nm_ip_addr_from_packed_array(ip_data->addr_family, nameservers, i);
|
||||
ip_addr_to_string(ip_data->addr_family, addr, iface, ip_addr_to_string_buf);
|
||||
if (!nm_utils_dnsname_parse_assert(ip_data->addr_family, strarr[i], NULL, &a, NULL))
|
||||
continue;
|
||||
|
||||
ip_addr_to_string(ip_data->addr_family, &a, iface, ip_addr_to_string_buf);
|
||||
|
||||
if (!ip_data->domains.has_default_route_explicit && ip_data->domains.has_default_route)
|
||||
add_dnsmasq_nameserver(self, servers, ip_addr_to_string_buf, NULL);
|
||||
|
@@ -557,24 +557,24 @@ merge_one_l3cd(NMResolvConfData *rc, int addr_family, int ifindex, const NML3Con
|
||||
guint num_nameservers;
|
||||
guint num;
|
||||
guint i;
|
||||
gconstpointer nameservers;
|
||||
const char *const *strv;
|
||||
const char *const *strarr;
|
||||
|
||||
nm_assert(ifindex == nm_l3_config_data_get_ifindex(l3cd));
|
||||
|
||||
nameservers = nm_l3_config_data_get_nameservers(l3cd, addr_family, &num_nameservers);
|
||||
strarr = nm_l3_config_data_get_nameservers(l3cd, addr_family, &num_nameservers);
|
||||
for (i = 0; i < num_nameservers; i++) {
|
||||
const NMIPAddr *addr;
|
||||
NMIPAddr a;
|
||||
|
||||
addr = nm_ip_addr_from_packed_array(addr_family, nameservers, i);
|
||||
if (!nm_utils_dnsname_parse_assert(addr_family, strarr[i], NULL, &a, NULL))
|
||||
continue;
|
||||
|
||||
if (addr_family == AF_INET)
|
||||
nm_inet_ntop(addr_family, addr, buf);
|
||||
else if (IN6_IS_ADDR_V4MAPPED(addr))
|
||||
nm_inet4_ntop(addr->addr6.s6_addr32[3], buf);
|
||||
nm_inet_ntop(addr_family, &a, buf);
|
||||
else if (IN6_IS_ADDR_V4MAPPED(&a))
|
||||
nm_inet4_ntop(a.addr6.s6_addr32[3], buf);
|
||||
else {
|
||||
nm_inet6_ntop(&addr->addr6, buf);
|
||||
if (IN6_IS_ADDR_LINKLOCAL(addr)) {
|
||||
nm_inet6_ntop(&a.addr6, buf);
|
||||
if (IN6_IS_ADDR_LINKLOCAL(&a)) {
|
||||
const char *ifname;
|
||||
|
||||
ifname = nm_platform_link_get_name(NM_PLATFORM_GET, ifindex);
|
||||
@@ -591,9 +591,9 @@ merge_one_l3cd(NMResolvConfData *rc, int addr_family, int ifindex, const NML3Con
|
||||
add_dns_domains(rc->searches, addr_family, l3cd, FALSE, TRUE);
|
||||
|
||||
has_trust_ad = FALSE;
|
||||
strv = nm_l3_config_data_get_dns_options(l3cd, addr_family, &num);
|
||||
strarr = nm_l3_config_data_get_dns_options(l3cd, addr_family, &num);
|
||||
for (i = 0; i < num; i++) {
|
||||
const char *option = strv[i];
|
||||
const char *option = strarr[i];
|
||||
|
||||
if (nm_streq(option, NM_SETTING_DNS_OPTION_TRUST_AD)) {
|
||||
has_trust_ad = TRUE;
|
||||
@@ -1258,19 +1258,21 @@ merge_global_dns_config(NMResolvConfData *rc, NMGlobalDnsConfig *global_conf)
|
||||
static const char *
|
||||
get_nameserver_list(int addr_family, const NML3ConfigData *l3cd, NMStrBuf *tmp_strbuf)
|
||||
{
|
||||
char buf[NM_INET_ADDRSTRLEN];
|
||||
guint num;
|
||||
guint i;
|
||||
gconstpointer nameservers;
|
||||
char buf[NM_INET_ADDRSTRLEN];
|
||||
guint num;
|
||||
guint i;
|
||||
const char *const *strarr;
|
||||
|
||||
nm_str_buf_reset(tmp_strbuf);
|
||||
|
||||
nameservers = nm_l3_config_data_get_nameservers(l3cd, addr_family, &num);
|
||||
strarr = nm_l3_config_data_get_nameservers(l3cd, addr_family, &num);
|
||||
for (i = 0; i < num; i++) {
|
||||
const NMIPAddr *addr;
|
||||
NMIPAddr a;
|
||||
|
||||
addr = nm_ip_addr_from_packed_array(addr_family, nameservers, i);
|
||||
nm_inet_ntop(addr_family, addr->addr_ptr, buf);
|
||||
if (!nm_utils_dnsname_parse_assert(addr_family, strarr[i], NULL, &a, NULL))
|
||||
continue;
|
||||
|
||||
nm_inet_ntop(addr_family, &a, buf);
|
||||
if (i > 0)
|
||||
nm_str_buf_append_c(tmp_strbuf, ' ');
|
||||
nm_str_buf_append(tmp_strbuf, buf);
|
||||
@@ -2628,17 +2630,17 @@ _get_config_variant(NMDnsManager *self)
|
||||
|
||||
head = _mgr_get_ip_data_lst_head(self);
|
||||
c_list_for_each_entry (ip_data, head, ip_data_lst) {
|
||||
GVariantBuilder entry_builder;
|
||||
GVariantBuilder strv_builder;
|
||||
guint num;
|
||||
guint num_domains;
|
||||
guint num_searches;
|
||||
guint i;
|
||||
char buf[NM_INET_ADDRSTRLEN];
|
||||
const char *ifname;
|
||||
gconstpointer nameservers;
|
||||
GVariantBuilder entry_builder;
|
||||
GVariantBuilder strv_builder;
|
||||
guint num;
|
||||
guint num_domains;
|
||||
guint num_searches;
|
||||
guint i;
|
||||
char buf[NM_INET_ADDRSTRLEN];
|
||||
const char *ifname;
|
||||
const char *const *strarr;
|
||||
|
||||
nameservers = nm_l3_config_data_get_nameservers(ip_data->l3cd, ip_data->addr_family, &num);
|
||||
strarr = nm_l3_config_data_get_nameservers(ip_data->l3cd, ip_data->addr_family, &num);
|
||||
if (num == 0)
|
||||
continue;
|
||||
|
||||
@@ -2646,12 +2648,12 @@ _get_config_variant(NMDnsManager *self)
|
||||
|
||||
g_variant_builder_init(&strv_builder, G_VARIANT_TYPE("as"));
|
||||
for (i = 0; i < num; i++) {
|
||||
const NMIPAddr *addr;
|
||||
NMIPAddr a;
|
||||
|
||||
addr = nm_ip_addr_from_packed_array(ip_data->addr_family, nameservers, i);
|
||||
g_variant_builder_add(&strv_builder,
|
||||
"s",
|
||||
nm_inet_ntop(ip_data->addr_family, addr, buf));
|
||||
if (!nm_utils_dnsname_parse_assert(ip_data->addr_family, strarr[i], NULL, &a, NULL))
|
||||
continue;
|
||||
|
||||
g_variant_builder_add(&strv_builder, "s", nm_inet_ntop(ip_data->addr_family, &a, buf));
|
||||
}
|
||||
g_variant_builder_add(&entry_builder,
|
||||
"{sv}",
|
||||
|
@@ -343,13 +343,13 @@ update_add_ip_config(NMDnsSystemdResolved *self,
|
||||
GVariantBuilder *domains,
|
||||
const NMDnsConfigIPData *ip_data)
|
||||
{
|
||||
gsize addr_size;
|
||||
guint n;
|
||||
guint i;
|
||||
gboolean is_routing;
|
||||
const char *domain;
|
||||
gboolean has_config = FALSE;
|
||||
gconstpointer nameservers;
|
||||
gsize addr_size;
|
||||
guint n;
|
||||
guint i;
|
||||
gboolean is_routing;
|
||||
const char *domain;
|
||||
gboolean has_config = FALSE;
|
||||
const char *const *strarr;
|
||||
|
||||
addr_size = nm_utils_addr_family_to_size(ip_data->addr_family);
|
||||
|
||||
@@ -361,14 +361,16 @@ update_add_ip_config(NMDnsSystemdResolved *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
nameservers = nm_l3_config_data_get_nameservers(ip_data->l3cd, ip_data->addr_family, &n);
|
||||
strarr = nm_l3_config_data_get_nameservers(ip_data->l3cd, ip_data->addr_family, &n);
|
||||
for (i = 0; i < n; i++) {
|
||||
NMIPAddr a;
|
||||
|
||||
if (!nm_utils_dnsname_parse_assert(ip_data->addr_family, strarr[i], NULL, &a, NULL))
|
||||
continue;
|
||||
|
||||
g_variant_builder_open(dns, G_VARIANT_TYPE("(iay)"));
|
||||
g_variant_builder_add(dns, "i", ip_data->addr_family);
|
||||
g_variant_builder_add_value(
|
||||
dns,
|
||||
nm_g_variant_new_ay(nm_ip_addr_from_packed_array(ip_data->addr_family, nameservers, i),
|
||||
addr_size));
|
||||
g_variant_builder_add_value(dns, nm_g_variant_new_ay((gconstpointer) &a, addr_size));
|
||||
g_variant_builder_close(dns);
|
||||
has_config = TRUE;
|
||||
}
|
||||
|
@@ -104,7 +104,6 @@ create_dm_cmd_line(const char *iface,
|
||||
gs_free char *error_desc = NULL;
|
||||
const char *dm_binary;
|
||||
const NMPlatformIP4Address *listen_address;
|
||||
const in_addr_t *ipv4arr;
|
||||
const char *const *strarr;
|
||||
guint n;
|
||||
guint i;
|
||||
@@ -163,13 +162,18 @@ create_dm_cmd_line(const char *iface,
|
||||
nm_strv_ptrarray_add_string_concat(cmd, "--dhcp-option=option:router,", listen_address_s);
|
||||
}
|
||||
|
||||
ipv4arr = nm_l3_config_data_get_nameservers(l3cd, AF_INET, &n);
|
||||
strarr = nm_l3_config_data_get_nameservers(l3cd, AF_INET, &n);
|
||||
if (n > 0) {
|
||||
nm_gstring_prepare(&s);
|
||||
g_string_append(s, "--dhcp-option=option:dns-server");
|
||||
for (i = 0; i < n; i++) {
|
||||
in_addr_t a;
|
||||
|
||||
if (!nm_utils_dnsname_parse_assert(AF_INET, strarr[i], NULL, &a, NULL))
|
||||
continue;
|
||||
|
||||
g_string_append_c(s, ',');
|
||||
g_string_append(s, nm_inet4_ntop(ipv4arr[i], sbuf_addr));
|
||||
g_string_append(s, nm_inet4_ntop(a, sbuf_addr));
|
||||
}
|
||||
nm_strv_ptrarray_take_gstring(cmd, &s);
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include "libnm-platform/nm-platform-utils.h"
|
||||
#include "libnm-platform/nm-platform.h"
|
||||
#include "libnm-platform/nmp-netns.h"
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nm-l3-config-data.h"
|
||||
#include "nm-l3cfg.h"
|
||||
#include "nm-ndisc-private.h"
|
||||
@@ -186,8 +187,12 @@ nm_ndisc_data_to_l3cd(NMDedupMultiIndex *multi_idx,
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < rdata->dns_servers_n; i++)
|
||||
nm_l3_config_data_add_nameserver(l3cd, AF_INET6, &rdata->dns_servers[i].address);
|
||||
for (i = 0; i < rdata->dns_servers_n; i++) {
|
||||
nm_l3_config_data_add_nameserver_detail(l3cd,
|
||||
AF_INET6,
|
||||
&rdata->dns_servers[i].address,
|
||||
NULL);
|
||||
}
|
||||
|
||||
for (i = 0; i < rdata->dns_domains_n; i++)
|
||||
nm_l3_config_data_add_search(l3cd, AF_INET6, rdata->dns_domains[i].domain);
|
||||
@@ -989,14 +994,13 @@ announce_router_solicited(NMNDisc *ndisc)
|
||||
void
|
||||
nm_ndisc_set_config(NMNDisc *ndisc, const NML3ConfigData *l3cd)
|
||||
{
|
||||
gboolean changed = FALSE;
|
||||
const struct in6_addr *in6arr;
|
||||
const char *const *strvarr;
|
||||
NMDedupMultiIter iter;
|
||||
const NMPObject *obj;
|
||||
guint len;
|
||||
guint i;
|
||||
gint32 fake_now = NM_NDISC_EXPIRY_BASE_TIMESTAMP / 1000;
|
||||
gboolean changed = FALSE;
|
||||
const char *const *strvarr;
|
||||
NMDedupMultiIter iter;
|
||||
const NMPObject *obj;
|
||||
guint len;
|
||||
guint i;
|
||||
gint32 fake_now = NM_NDISC_EXPIRY_BASE_TIMESTAMP / 1000;
|
||||
|
||||
nm_assert(NM_IS_NDISC(ndisc));
|
||||
nm_assert(nm_ndisc_get_node_type(ndisc) == NM_NDISC_NODE_TYPE_ROUTER);
|
||||
@@ -1035,15 +1039,19 @@ nm_ndisc_set_config(NMNDisc *ndisc, const NML3ConfigData *l3cd)
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
in6arr = NULL;
|
||||
len = 0;
|
||||
strvarr = NULL;
|
||||
len = 0;
|
||||
if (l3cd)
|
||||
in6arr = nm_l3_config_data_get_nameservers(l3cd, AF_INET6, &len);
|
||||
strvarr = nm_l3_config_data_get_nameservers(l3cd, AF_INET6, &len);
|
||||
for (i = 0; i < len; i++) {
|
||||
struct in6_addr a;
|
||||
NMNDiscDNSServer n;
|
||||
|
||||
if (!nm_utils_dnsname_parse_assert(AF_INET6, strvarr[i], NULL, &a, NULL))
|
||||
continue;
|
||||
|
||||
n = (NMNDiscDNSServer){
|
||||
.address = in6arr[i],
|
||||
.address = a,
|
||||
.expiry_msec = _nm_ndisc_lifetime_to_expiry(NM_NDISC_EXPIRY_BASE_TIMESTAMP,
|
||||
NM_NDISC_ROUTER_LIFETIME),
|
||||
};
|
||||
|
@@ -179,7 +179,6 @@ dump_ip_to_props(const NML3ConfigData *l3cd, int addr_family, GVariantBuilder *b
|
||||
const NMPObject *default_route;
|
||||
const char *const *strarr;
|
||||
const in_addr_t *ip4arr;
|
||||
gconstpointer iparr;
|
||||
|
||||
if (IS_IPv4)
|
||||
g_variant_builder_init(&int_builder, G_VARIANT_TYPE("aau"));
|
||||
@@ -223,14 +222,17 @@ dump_ip_to_props(const NML3ConfigData *l3cd, int addr_family, GVariantBuilder *b
|
||||
g_variant_builder_init(&int_builder, G_VARIANT_TYPE("au"));
|
||||
else
|
||||
g_variant_builder_init(&int_builder, G_VARIANT_TYPE("aay"));
|
||||
iparr = nm_l3_config_data_get_nameservers(l3cd, addr_family, &n);
|
||||
strarr = nm_l3_config_data_get_nameservers(l3cd, addr_family, &n);
|
||||
for (i = 0; i < n; i++) {
|
||||
NMIPAddr a;
|
||||
|
||||
if (!nm_utils_dnsname_parse_assert(addr_family, strarr[i], NULL, &a, NULL))
|
||||
continue;
|
||||
|
||||
if (IS_IPv4)
|
||||
g_variant_builder_add(&int_builder, "u", ((const in_addr_t *) iparr)[i]);
|
||||
else {
|
||||
var1 = nm_g_variant_new_ay_in6addr(&(((const struct in6_addr *) iparr)[i]));
|
||||
g_variant_builder_add(&int_builder, "@ay", var1);
|
||||
}
|
||||
g_variant_builder_add(&int_builder, "u", &a);
|
||||
else
|
||||
g_variant_builder_add(&int_builder, "@ay", nm_g_variant_new_ay_in6addr(&a.addr6));
|
||||
}
|
||||
g_variant_builder_add(builder, "{sv}", "nameservers", g_variant_builder_end(&int_builder));
|
||||
|
||||
|
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <linux/rtnetlink.h>
|
||||
|
||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||
#include "nm-l3cfg.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
|
||||
@@ -336,6 +337,7 @@ get_property_ip4(GObject *object, guint prop_id, GValue *value, GParamSpec *pspe
|
||||
char addr_str[NM_INET_ADDRSTRLEN];
|
||||
GVariantBuilder builder;
|
||||
const in_addr_t *addrs;
|
||||
const char *const *strarr;
|
||||
guint len;
|
||||
guint i;
|
||||
|
||||
@@ -347,28 +349,37 @@ get_property_ip4(GObject *object, guint prop_id, GValue *value, GParamSpec *pspe
|
||||
g_value_set_variant(value, priv->v_routes);
|
||||
break;
|
||||
case PROP_IP4_NAMESERVERS:
|
||||
addrs = nm_l3_config_data_get_nameservers(priv->l3cd, AF_INET, &len);
|
||||
g_value_set_variant(value,
|
||||
(len == 0) ? nm_g_variant_singleton_au()
|
||||
: nm_g_variant_new_au(addrs, len));
|
||||
break;
|
||||
case PROP_IP4_NAMESERVER_DATA:
|
||||
addrs = nm_l3_config_data_get_nameservers(priv->l3cd, AF_INET, &len);
|
||||
if (len == 0)
|
||||
g_value_set_variant(value, nm_g_variant_singleton_aaLsvI());
|
||||
else {
|
||||
g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
|
||||
strarr = nm_l3_config_data_get_nameservers(priv->l3cd, AF_INET, &len);
|
||||
if (len == 0) {
|
||||
g_value_set_variant(value,
|
||||
(prop_id == PROP_IP4_NAMESERVERS)
|
||||
? nm_g_variant_singleton_au()
|
||||
: nm_g_variant_singleton_aaLsvI());
|
||||
} else {
|
||||
if (prop_id == PROP_IP4_NAMESERVERS)
|
||||
g_variant_builder_init(&builder, G_VARIANT_TYPE("au"));
|
||||
else
|
||||
g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
|
||||
for (i = 0; i < len; i++) {
|
||||
GVariantBuilder nested_builder;
|
||||
in_addr_t a;
|
||||
|
||||
nm_inet4_ntop(addrs[i], addr_str);
|
||||
if (!nm_utils_dnsname_parse_assert(AF_INET, strarr[i], NULL, &a, NULL))
|
||||
continue;
|
||||
|
||||
g_variant_builder_init(&nested_builder, G_VARIANT_TYPE("a{sv}"));
|
||||
g_variant_builder_add(&nested_builder,
|
||||
"{sv}",
|
||||
"address",
|
||||
g_variant_new_string(addr_str));
|
||||
g_variant_builder_add(&builder, "a{sv}", &nested_builder);
|
||||
if (prop_id == PROP_IP4_NAMESERVERS)
|
||||
g_variant_builder_add(&builder, "u", &a);
|
||||
else {
|
||||
GVariantBuilder nested_builder;
|
||||
|
||||
nm_inet4_ntop(a, addr_str);
|
||||
g_variant_builder_init(&nested_builder, G_VARIANT_TYPE("a{sv}"));
|
||||
g_variant_builder_add(&nested_builder,
|
||||
"{sv}",
|
||||
"address",
|
||||
g_variant_new_string(addr_str));
|
||||
g_variant_builder_add(&builder, "a{sv}", &nested_builder);
|
||||
}
|
||||
}
|
||||
|
||||
g_value_take_variant(value, g_variant_builder_end(&builder));
|
||||
@@ -503,7 +514,7 @@ nm_ip_config_dns_hash(const NML3ConfigData *l3cd, GChecksum *sum, int addr_famil
|
||||
{
|
||||
guint i;
|
||||
int val;
|
||||
const char *const *nameservers;
|
||||
const char *const *strarr;
|
||||
const in_addr_t *wins;
|
||||
const char *const *domains;
|
||||
const char *const *searches;
|
||||
@@ -517,12 +528,9 @@ nm_ip_config_dns_hash(const NML3ConfigData *l3cd, GChecksum *sum, int addr_famil
|
||||
g_return_if_fail(l3cd);
|
||||
g_return_if_fail(sum);
|
||||
|
||||
nameservers = nm_l3_config_data_get_nameservers(l3cd, addr_family, &num_nameservers);
|
||||
for (i = 0; i < num_nameservers; i++) {
|
||||
g_checksum_update(sum,
|
||||
nm_ip_addr_from_packed_array(addr_family, nameservers, i),
|
||||
nm_utils_addr_family_to_size(addr_family));
|
||||
}
|
||||
strarr = nm_l3_config_data_get_nameservers(l3cd, addr_family, &num_nameservers);
|
||||
for (i = 0; i < num_nameservers; i++)
|
||||
g_checksum_update(sum, (gpointer) strarr[i], strlen(strarr[i]));
|
||||
|
||||
if (addr_family == AF_INET) {
|
||||
wins = nm_l3_config_data_get_wins(l3cd, &num_wins);
|
||||
@@ -630,12 +638,12 @@ static const NMDBusInterfaceInfoExtended interface_info_ip6_config = {
|
||||
static void
|
||||
get_property_ip6(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMIPConfig *self = NM_IP_CONFIG(object);
|
||||
NMIPConfigPrivate *priv = NM_IP_CONFIG_GET_PRIVATE(self);
|
||||
GVariantBuilder builder;
|
||||
guint len;
|
||||
guint i;
|
||||
const struct in6_addr *addrs;
|
||||
NMIPConfig *self = NM_IP_CONFIG(object);
|
||||
NMIPConfigPrivate *priv = NM_IP_CONFIG_GET_PRIVATE(self);
|
||||
GVariantBuilder builder;
|
||||
guint len;
|
||||
guint i;
|
||||
const char *const *strarr;
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_IP6_ADDRESSES:
|
||||
@@ -645,13 +653,19 @@ get_property_ip6(GObject *object, guint prop_id, GValue *value, GParamSpec *pspe
|
||||
g_value_set_variant(value, priv->v_routes);
|
||||
break;
|
||||
case PROP_IP6_NAMESERVERS:
|
||||
addrs = nm_l3_config_data_get_nameservers(priv->l3cd, AF_INET6, &len);
|
||||
strarr = nm_l3_config_data_get_nameservers(priv->l3cd, AF_INET6, &len);
|
||||
if (len == 0)
|
||||
g_value_set_variant(value, nm_g_variant_singleton_aay());
|
||||
else {
|
||||
g_variant_builder_init(&builder, G_VARIANT_TYPE("aay"));
|
||||
for (i = 0; i < len; i++)
|
||||
g_variant_builder_add(&builder, "@ay", nm_g_variant_new_ay_in6addr(&addrs[i]));
|
||||
for (i = 0; i < len; i++) {
|
||||
struct in6_addr a;
|
||||
|
||||
if (!nm_utils_dnsname_parse_assert(AF_INET6, strarr[i], NULL, &a, NULL))
|
||||
continue;
|
||||
|
||||
g_variant_builder_add(&builder, "@ay", nm_g_variant_new_ay_in6addr(&a));
|
||||
}
|
||||
g_value_take_variant(value, g_variant_builder_end(&builder));
|
||||
}
|
||||
break;
|
||||
@@ -736,8 +750,8 @@ _handle_l3cd_changed(NMIPConfig *self, const NML3ConfigData *l3cd)
|
||||
nm_auto_unref_l3cd const NML3ConfigData *l3cd_old = NULL;
|
||||
GParamSpec *changed_params[8];
|
||||
guint n_changed_params = 0;
|
||||
const char *const *strv;
|
||||
const char *const *strv_old;
|
||||
const char *const *strarr;
|
||||
const char *const *strarr_old;
|
||||
gconstpointer addrs;
|
||||
gconstpointer addrs_old;
|
||||
guint len;
|
||||
@@ -748,9 +762,9 @@ _handle_l3cd_changed(NMIPConfig *self, const NML3ConfigData *l3cd)
|
||||
l3cd_old = g_steal_pointer(&priv->l3cd);
|
||||
priv->l3cd = nm_l3_config_data_ref(l3cd);
|
||||
|
||||
addrs_old = nm_l3_config_data_get_nameservers(l3cd_old, addr_family, &len_old);
|
||||
addrs = nm_l3_config_data_get_nameservers(priv->l3cd, addr_family, &len);
|
||||
if (!nm_memeq_n(addrs_old, len_old, addrs, len, nm_utils_addr_family_to_size(addr_family))) {
|
||||
strarr_old = nm_l3_config_data_get_nameservers(l3cd_old, addr_family, &len_old);
|
||||
strarr = nm_l3_config_data_get_nameservers(priv->l3cd, addr_family, &len);
|
||||
if (!nm_strv_equal_n(strarr_old, len_old, strarr, len)) {
|
||||
if (IS_IPv4) {
|
||||
changed_params[n_changed_params++] = obj_properties_ip4[PROP_IP4_NAMESERVER_DATA];
|
||||
changed_params[n_changed_params++] = obj_properties_ip4[PROP_IP4_NAMESERVERS];
|
||||
@@ -758,14 +772,14 @@ _handle_l3cd_changed(NMIPConfig *self, const NML3ConfigData *l3cd)
|
||||
changed_params[n_changed_params++] = obj_properties_ip6[PROP_IP6_NAMESERVERS];
|
||||
}
|
||||
|
||||
strv_old = nm_l3_config_data_get_domains(l3cd_old, addr_family, &len_old);
|
||||
strv = nm_l3_config_data_get_domains(priv->l3cd, addr_family, &len);
|
||||
if (!nm_strv_equal_n(strv, len, strv_old, len_old))
|
||||
strarr_old = nm_l3_config_data_get_domains(l3cd_old, addr_family, &len_old);
|
||||
strarr = nm_l3_config_data_get_domains(priv->l3cd, addr_family, &len);
|
||||
if (!nm_strv_equal_n(strarr, len, strarr_old, len_old))
|
||||
changed_params[n_changed_params++] = obj_properties_ip[PROP_IP_DOMAINS];
|
||||
|
||||
strv_old = nm_l3_config_data_get_searches(l3cd_old, addr_family, &len_old);
|
||||
strv = nm_l3_config_data_get_searches(priv->l3cd, addr_family, &len);
|
||||
if (!nm_strv_equal_n(strv, len, strv_old, len_old))
|
||||
strarr_old = nm_l3_config_data_get_searches(l3cd_old, addr_family, &len_old);
|
||||
strarr = nm_l3_config_data_get_searches(priv->l3cd, addr_family, &len);
|
||||
if (!nm_strv_equal_n(strarr, len, strarr_old, len_old))
|
||||
changed_params[n_changed_params++] = obj_properties_ip[PROP_IP_SEARCHES];
|
||||
|
||||
v_i_old = nm_l3_config_data_get_dns_priority_or_default(l3cd_old, addr_family);
|
||||
@@ -773,9 +787,9 @@ _handle_l3cd_changed(NMIPConfig *self, const NML3ConfigData *l3cd)
|
||||
if (v_i != v_i_old)
|
||||
changed_params[n_changed_params++] = obj_properties_ip[PROP_IP_DNS_PRIORITY];
|
||||
|
||||
strv_old = nm_l3_config_data_get_dns_options(l3cd_old, addr_family, &len);
|
||||
strv = nm_l3_config_data_get_dns_options(priv->l3cd, addr_family, &len);
|
||||
if (!nm_strv_equal_n(strv, len, strv_old, len_old))
|
||||
strarr_old = nm_l3_config_data_get_dns_options(l3cd_old, addr_family, &len);
|
||||
strarr = nm_l3_config_data_get_dns_options(priv->l3cd, addr_family, &len);
|
||||
if (!nm_strv_equal_n(strarr, len, strarr_old, len_old))
|
||||
changed_params[n_changed_params++] = obj_properties_ip[PROP_IP_DNS_OPTIONS];
|
||||
|
||||
if (IS_IPv4) {
|
||||
|
@@ -67,10 +67,10 @@ struct _NML3ConfigData {
|
||||
|
||||
union {
|
||||
struct {
|
||||
GArray *nameservers_6;
|
||||
GArray *nameservers_4;
|
||||
GPtrArray *nameservers_6;
|
||||
GPtrArray *nameservers_4;
|
||||
};
|
||||
GArray *nameservers_x[2];
|
||||
GPtrArray *nameservers_x[2];
|
||||
};
|
||||
|
||||
union {
|
||||
@@ -269,17 +269,6 @@ _garray_inaddr_get(GArray *arr, guint *out_len)
|
||||
return arr->data;
|
||||
}
|
||||
|
||||
static gconstpointer
|
||||
_garray_inaddr_at(GArray *arr, gboolean IS_IPv4, guint idx)
|
||||
{
|
||||
nm_assert(arr);
|
||||
nm_assert(idx < arr->len);
|
||||
|
||||
if (IS_IPv4)
|
||||
return &nm_g_array_index(arr, in_addr_t, idx);
|
||||
return &nm_g_array_index(arr, struct in6_addr, idx);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_garray_inaddr_add(GArray **p_arr, int addr_family, gconstpointer addr)
|
||||
{
|
||||
@@ -480,13 +469,11 @@ nm_l3_config_data_log(const NML3ConfigData *self,
|
||||
self->dns_priority_x[IS_IPv4]);
|
||||
}
|
||||
|
||||
for (i = 0; i < nm_g_array_len(self->nameservers_x[IS_IPv4]); i++) {
|
||||
for (i = 0; i < nm_g_ptr_array_len(self->nameservers_x[IS_IPv4]); i++) {
|
||||
_L("nameserver%c[%u]: %s",
|
||||
nm_utils_addr_family_to_char(addr_family),
|
||||
i,
|
||||
nm_inet_ntop(addr_family,
|
||||
_garray_inaddr_at(self->nameservers_x[IS_IPv4], IS_IPv4, i),
|
||||
sbuf_addr));
|
||||
(char *) self->nameservers_x[IS_IPv4]->pdata[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < nm_g_ptr_array_len(self->domains_x[IS_IPv4]); i++) {
|
||||
@@ -792,8 +779,8 @@ nm_l3_config_data_unref(const NML3ConfigData *self)
|
||||
nm_clear_pointer(&mutable->dhcp_lease_4, nm_dhcp_lease_unref);
|
||||
nm_clear_pointer(&mutable->dhcp_lease_6, nm_dhcp_lease_unref);
|
||||
|
||||
nm_clear_pointer(&mutable->nameservers_4, g_array_unref);
|
||||
nm_clear_pointer(&mutable->nameservers_6, g_array_unref);
|
||||
nm_clear_pointer(&mutable->nameservers_4, g_ptr_array_unref);
|
||||
nm_clear_pointer(&mutable->nameservers_6, g_ptr_array_unref);
|
||||
|
||||
nm_clear_pointer(&mutable->domains_4, g_ptr_array_unref);
|
||||
nm_clear_pointer(&mutable->domains_6, g_ptr_array_unref);
|
||||
@@ -1421,7 +1408,7 @@ _check_and_add_domain(GPtrArray **p_arr, const char *domain)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gconstpointer
|
||||
const char *const *
|
||||
nm_l3_config_data_get_nameservers(const NML3ConfigData *self, int addr_family, guint *out_len)
|
||||
{
|
||||
nm_assert(!self || _NM_IS_L3_CONFIG_DATA(self, TRUE));
|
||||
@@ -1433,33 +1420,68 @@ nm_l3_config_data_get_nameservers(const NML3ConfigData *self, int addr_family, g
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _garray_inaddr_get(self->nameservers_x[NM_IS_IPv4(addr_family)], out_len);
|
||||
return nm_strv_ptrarray_get_unsafe(self->nameservers_x[NM_IS_IPv4(addr_family)], out_len);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_l3_config_data_add_nameserver(NML3ConfigData *self,
|
||||
int addr_family,
|
||||
gconstpointer /* (const NMIPAddr *) */ nameserver)
|
||||
nm_l3_config_data_add_nameserver(NML3ConfigData *self, int addr_family, const char *nameserver)
|
||||
{
|
||||
GPtrArray **p_arr;
|
||||
|
||||
nm_assert(_NM_IS_L3_CONFIG_DATA(self, FALSE));
|
||||
nm_assert_addr_family(addr_family);
|
||||
nm_assert(nameserver);
|
||||
|
||||
return _garray_inaddr_add(&self->nameservers_x[NM_IS_IPv4(addr_family)],
|
||||
addr_family,
|
||||
nameserver);
|
||||
if (NM_MORE_ASSERTS > 5) {
|
||||
gs_free char *s_free = NULL;
|
||||
|
||||
nm_assert(
|
||||
nm_streq0(nm_utils_dnsname_normalize(addr_family, nameserver, &s_free), nameserver));
|
||||
}
|
||||
|
||||
p_arr = &self->nameservers_x[NM_IS_IPv4(addr_family)];
|
||||
|
||||
if (nm_strv_ptrarray_contains(*p_arr, nameserver))
|
||||
return FALSE;
|
||||
|
||||
nm_strv_ptrarray_add_string_dup(nm_strv_ptrarray_ensure(p_arr), nameserver);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_l3_config_data_add_nameserver_detail(NML3ConfigData *self,
|
||||
int addr_family,
|
||||
gconstpointer addr_bin,
|
||||
const char *server_name)
|
||||
{
|
||||
gs_free char *s_free = NULL;
|
||||
char *s;
|
||||
gsize l;
|
||||
|
||||
nm_assert(_NM_IS_L3_CONFIG_DATA(self, FALSE));
|
||||
nm_assert_addr_family(addr_family);
|
||||
nm_assert(addr_bin);
|
||||
|
||||
l = (NM_INET_ADDRSTRLEN + 2u) + (server_name ? strlen(server_name) : 0u);
|
||||
|
||||
s = nm_malloc_maybe_a(300, l, &s_free);
|
||||
|
||||
if (!nm_utils_dnsname_construct(addr_family, addr_bin, server_name, s, l))
|
||||
nm_assert_not_reached();
|
||||
|
||||
return nm_l3_config_data_add_nameserver(self, addr_family, s);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_l3_config_data_clear_nameservers(NML3ConfigData *self, int addr_family)
|
||||
{
|
||||
gs_unref_array GArray *old = NULL;
|
||||
gs_unref_ptrarray GPtrArray *old = NULL;
|
||||
|
||||
nm_assert(_NM_IS_L3_CONFIG_DATA(self, FALSE));
|
||||
nm_assert_addr_family(addr_family);
|
||||
|
||||
old = g_steal_pointer(&self->nameservers_x[NM_IS_IPv4(addr_family)]);
|
||||
return (nm_g_array_len(old) > 0);
|
||||
return (nm_g_ptr_array_len(old) > 0);
|
||||
}
|
||||
|
||||
const in_addr_t *
|
||||
@@ -2272,7 +2294,6 @@ nm_l3_config_data_cmp_full(const NML3ConfigData *a,
|
||||
}
|
||||
|
||||
for (IS_IPv4 = 1; IS_IPv4 >= 0; IS_IPv4--) {
|
||||
const int addr_family = IS_IPv4 ? AF_INET : AF_INET6;
|
||||
const NMPObject *def_route_a = a->best_default_route_x[IS_IPv4];
|
||||
const NMPObject *def_route_b = b->best_default_route_x[IS_IPv4];
|
||||
|
||||
@@ -2311,9 +2332,8 @@ nm_l3_config_data_cmp_full(const NML3ConfigData *a,
|
||||
if (NM_FLAGS_HAS(flags, NM_L3_CONFIG_CMP_FLAGS_DNS)) {
|
||||
const NML3ConfigDatFlags FLAG = NM_L3_CONFIG_DAT_FLAGS_HAS_DNS_PRIORITY(IS_IPv4);
|
||||
|
||||
NM_CMP_RETURN(_garray_inaddr_cmp(a->nameservers_x[IS_IPv4],
|
||||
b->nameservers_x[IS_IPv4],
|
||||
addr_family));
|
||||
NM_CMP_RETURN(
|
||||
nm_strv_ptrarray_cmp(a->nameservers_x[IS_IPv4], b->nameservers_x[IS_IPv4]));
|
||||
NM_CMP_RETURN(nm_strv_ptrarray_cmp(a->domains_x[IS_IPv4], b->domains_x[IS_IPv4]));
|
||||
NM_CMP_RETURN(nm_strv_ptrarray_cmp(a->searches_x[IS_IPv4], b->searches_x[IS_IPv4]));
|
||||
NM_CMP_RETURN(
|
||||
@@ -2843,19 +2863,8 @@ _init_from_connection_ip(NML3ConfigData *self, int addr_family, NMConnection *co
|
||||
}
|
||||
|
||||
nnameservers = nm_setting_ip_config_get_num_dns(s_ip);
|
||||
for (i = 0; i < nnameservers; i++) {
|
||||
const char *server_name;
|
||||
const char *s;
|
||||
NMIPAddr ip;
|
||||
|
||||
s = nm_setting_ip_config_get_dns(s_ip, i);
|
||||
|
||||
if (!nm_utils_dnsname_parse_assert(addr_family, s, NULL, &ip, &server_name))
|
||||
continue;
|
||||
|
||||
/* TODO: handle server_name. */
|
||||
nm_l3_config_data_add_nameserver(self, addr_family, &ip);
|
||||
}
|
||||
for (i = 0; i < nnameservers; i++)
|
||||
nm_l3_config_data_add_nameserver(self, addr_family, nm_setting_ip_config_get_dns(s_ip, i));
|
||||
|
||||
nsearches = nm_setting_ip_config_get_num_dns_searches(s_ip);
|
||||
for (i = 0; i < nsearches; i++) {
|
||||
@@ -3210,9 +3219,7 @@ nm_l3_config_data_merge(NML3ConfigData *self,
|
||||
}
|
||||
|
||||
if (!NM_FLAGS_HAS(merge_flags, NM_L3_CONFIG_MERGE_FLAGS_NO_DNS))
|
||||
_garray_inaddr_merge(&self->nameservers_x[IS_IPv4],
|
||||
src->nameservers_x[IS_IPv4],
|
||||
addr_family);
|
||||
_strv_ptrarray_merge(&self->nameservers_x[IS_IPv4], src->nameservers_x[IS_IPv4]);
|
||||
|
||||
if (!NM_FLAGS_HAS(merge_flags, NM_L3_CONFIG_MERGE_FLAGS_NO_DNS))
|
||||
_strv_ptrarray_merge(&self->domains_x[IS_IPv4], src->domains_x[IS_IPv4]);
|
||||
|
@@ -495,12 +495,16 @@ const in_addr_t *nm_l3_config_data_get_wins(const NML3ConfigData *self, guint *o
|
||||
|
||||
gboolean nm_l3_config_data_add_wins(NML3ConfigData *self, in_addr_t wins);
|
||||
|
||||
gconstpointer
|
||||
const char *const *
|
||||
nm_l3_config_data_get_nameservers(const NML3ConfigData *self, int addr_family, guint *out_len);
|
||||
|
||||
gboolean nm_l3_config_data_add_nameserver(NML3ConfigData *self,
|
||||
int addr_family,
|
||||
gconstpointer /* (const NMIPAddr *) */ nameserver);
|
||||
gboolean
|
||||
nm_l3_config_data_add_nameserver(NML3ConfigData *self, int addr_family, const char *nameserver);
|
||||
|
||||
gboolean nm_l3_config_data_add_nameserver_detail(NML3ConfigData *self,
|
||||
int addr_family,
|
||||
gconstpointer addr_bin,
|
||||
const char *server_name);
|
||||
|
||||
gboolean nm_l3_config_data_clear_nameservers(NML3ConfigData *self, int addr_family);
|
||||
|
||||
|
@@ -582,7 +582,7 @@ impl_ppp_manager_set_ip4_config(NMDBusObject *obj,
|
||||
|
||||
if (g_variant_lookup(config_dict, NM_PPP_IP4_CONFIG_DNS, "au", &iter)) {
|
||||
while (g_variant_iter_next(iter, "u", &u32))
|
||||
nm_l3_config_data_add_nameserver(l3cd, AF_INET, &u32);
|
||||
nm_l3_config_data_add_nameserver_detail(l3cd, AF_INET, &u32, NULL);
|
||||
g_variant_iter_free(iter);
|
||||
}
|
||||
|
||||
|
@@ -2011,14 +2011,14 @@ _dbus_signal_ip_config_cb(NMVpnConnection *self, int addr_family, GVariant *dict
|
||||
if (IS_IPv4) {
|
||||
if (g_variant_lookup(dict, NM_VPN_PLUGIN_IP4_CONFIG_DNS, "au", &var_iter)) {
|
||||
while (g_variant_iter_next(var_iter, "u", &u32))
|
||||
nm_l3_config_data_add_nameserver(l3cd, addr_family, &u32);
|
||||
nm_l3_config_data_add_nameserver_detail(l3cd, addr_family, &u32, NULL);
|
||||
g_variant_iter_free(var_iter);
|
||||
}
|
||||
} else {
|
||||
if (g_variant_lookup(dict, NM_VPN_PLUGIN_IP6_CONFIG_DNS, "aay", &var_iter)) {
|
||||
while (g_variant_iter_next(var_iter, "@ay", &v)) {
|
||||
if (nm_ip_addr_set_from_variant(AF_INET6, &v_addr, v, NULL))
|
||||
nm_l3_config_data_add_nameserver(l3cd, addr_family, &v_addr);
|
||||
nm_l3_config_data_add_nameserver_detail(l3cd, addr_family, &v_addr, NULL);
|
||||
g_variant_unref(v);
|
||||
}
|
||||
g_variant_iter_free(var_iter);
|
||||
|
Reference in New Issue
Block a user