dns: merge IPv4 and IPv6 versions of add_ip_config() (part 1)
This commit is contained in:
@@ -201,9 +201,16 @@ add_global_config (NMDnsDnsmasq *self, GVariantBuilder *dnsmasq_servers, const N
|
||||
}
|
||||
|
||||
static gboolean
|
||||
add_ip4_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP4Config *ip4,
|
||||
const char *iface, gboolean split)
|
||||
add_ip_config (NMDnsDnsmasq *self,
|
||||
GVariantBuilder *servers,
|
||||
NMIPConfig *ip_config,
|
||||
const char *iface,
|
||||
gboolean split)
|
||||
{
|
||||
int addr_family = nm_ip_config_get_addr_family (ip_config);
|
||||
|
||||
if (addr_family == AF_INET) {
|
||||
NMIP4Config *ip4 = (NMIP4Config *) ip_config;
|
||||
char buf[INET_ADDRSTRLEN + 1 + IFNAMSIZ];
|
||||
char buf2[INET_ADDRSTRLEN];
|
||||
in_addr_t addr;
|
||||
@@ -267,14 +274,8 @@ add_ip4_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP4Config *ip4,
|
||||
add_dnsmasq_nameserver (self, servers, buf, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
add_ip6_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP6Config *ip6,
|
||||
const char *iface, gboolean split)
|
||||
{
|
||||
} else {
|
||||
NMIP6Config *ip6 = (NMIP6Config *) ip_config;
|
||||
const struct in6_addr *addr;
|
||||
char *buf = NULL;
|
||||
int nnameservers, i_nameserver, n, i;
|
||||
@@ -340,6 +341,7 @@ add_ip6_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP6Config *ip6,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -347,20 +349,11 @@ add_ip6_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP6Config *ip6,
|
||||
static gboolean
|
||||
add_ip_config_data (NMDnsDnsmasq *self, GVariantBuilder *servers, const NMDnsIPConfigData *data)
|
||||
{
|
||||
if (NM_IS_IP4_CONFIG (data->config)) {
|
||||
return add_ip4_config (self,
|
||||
return add_ip_config (self,
|
||||
servers,
|
||||
(NMIP4Config *) data->config,
|
||||
data->config,
|
||||
data->iface,
|
||||
data->type == NM_DNS_IP_CONFIG_TYPE_VPN);
|
||||
} else if (NM_IS_IP6_CONFIG (data->config)) {
|
||||
return add_ip6_config (self,
|
||||
servers,
|
||||
(NMIP6Config *) data->config,
|
||||
data->iface,
|
||||
data->type == NM_DNS_IP_CONFIG_TYPE_VPN);
|
||||
} else
|
||||
g_return_val_if_reached (FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user