summaryrefslogtreecommitdiff
path: root/src/nm-ip4-config.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-06-24 12:46:03 -0400
committerDan Winship <danw@gnome.org>2014-09-04 09:20:11 -0400
commit983756578935580a663735cc2c650a6ebfbc8015 (patch)
tree230b6a7bb1ed9b418f90441e67bd4b5e30613593 /src/nm-ip4-config.c
parent9ed6bd2be58606e1700fe193c65e9991cf657ad0 (diff)
downloadNetworkManager-983756578935580a663735cc2c650a6ebfbc8015.tar.gz
libnm-core: improve NMSettingIP4Config / NMSettingIP6Config property types
Make the :addresses and :routes properties be GPtrArrays of NMIP4Address, etc, rather than just reflecting the D-Bus data. Make the :dns properties be arrays of strings rather than arrays of binary IP addresses (and update the corresponding APIs as well).
Diffstat (limited to 'src/nm-ip4-config.c')
-rw-r--r--src/nm-ip4-config.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index beb4b92815..aab50aeb8d 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -367,8 +367,12 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
nm_ip4_config_reset_domains (config);
nm_ip4_config_reset_searches (config);
}
- for (i = 0; i < nnameservers; i++)
- nm_ip4_config_add_nameserver (config, nm_setting_ip4_config_get_dns (setting, i));
+ for (i = 0; i < nnameservers; i++) {
+ guint32 ip;
+
+ if (inet_pton (AF_INET, nm_setting_ip4_config_get_dns (setting, i), &ip) == 1)
+ nm_ip4_config_add_nameserver (config, ip);
+ }
for (i = 0; i < nsearches; i++)
nm_ip4_config_add_search (config, nm_setting_ip4_config_get_dns_search (setting, i));
@@ -460,7 +464,7 @@ nm_ip4_config_create_setting (const NMIP4Config *config)
for (i = 0; i < nnameservers; i++) {
guint32 nameserver = nm_ip4_config_get_nameserver (config, i);
- nm_setting_ip4_config_add_dns (s_ip4, nameserver);
+ nm_setting_ip4_config_add_dns (s_ip4, nm_utils_inet4_ntop (nameserver, NULL));
}
for (i = 0; i < nsearches; i++) {
const char *search = nm_ip4_config_get_search (config, i);