diff options
author | Dan Winship <danw@gnome.org> | 2014-10-19 17:30:10 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-11-07 07:49:40 -0500 |
commit | 3f30c6f1c2f9ce76b24fada0e75fd3cf733ca4bc (patch) | |
tree | f413fc1880cdeee48d5891d06b3d474142448ee3 | |
parent | 39709fdc2ecaf42e431410f9ad425a9fb5c57812 (diff) | |
download | NetworkManager-3f30c6f1c2f9ce76b24fada0e75fd3cf733ca4bc.tar.gz |
libnm-core: extract NMSettingIPConfig superclass out of IP4, IP6 classes
Split a base NMSettingIPConfig class out of NMSettingIP4Config and
NMSettingIP6Config, and update things accordingly.
Further simplifications of now-redundant IPv4-vs-IPv6 code are
possible, and should happen in the future.
53 files changed, 2988 insertions, 3907 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c index d92b913cf8..c131054168 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -2889,7 +2889,7 @@ check_and_convert_vlan_prio_maps (const char *prio_map, static gboolean add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection) { - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; gboolean ret; if (!ip4addr) @@ -2897,13 +2897,13 @@ add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection) s_ip4 = nm_connection_get_setting_ip4_config (connection); if (!s_ip4) { - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); } - ret = nm_setting_ip4_config_add_address (s_ip4, ip4addr); + ret = nm_setting_ip_config_add_address (s_ip4, ip4addr); nm_ip_address_unref (ip4addr); return ret; @@ -2912,7 +2912,7 @@ add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection) static gboolean add_ip6_address_to_connection (NMIPAddress *ip6addr, NMConnection *connection) { - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; gboolean ret; if (!ip6addr) @@ -2920,13 +2920,13 @@ add_ip6_address_to_connection (NMIPAddress *ip6addr, NMConnection *connection) s_ip6 = nm_connection_get_setting_ip6_config (connection); if (!s_ip6) { - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL); } - ret = nm_setting_ip6_config_add_address (s_ip6, ip6addr); + ret = nm_setting_ip_config_add_address (s_ip6, ip6addr); nm_ip_address_unref (ip6addr); return ret; @@ -8107,8 +8107,7 @@ editor_init_new_connection (NmCli *nmc, NMConnection *connection) static void editor_init_existing_connection (NMConnection *connection) { - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4, *s_ip6; NMSettingWireless *s_wireless; NMSettingConnection *s_con; diff --git a/clients/cli/settings.c b/clients/cli/settings.c index 19dc06d702..96932e5a16 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -20,6 +20,7 @@ #include "config.h" #include <stdlib.h> +#include <arpa/inet.h> #include <glib.h> #include <glib/gi18n.h> @@ -251,64 +252,64 @@ NmcOutputField nmc_fields_setting_wireless_security[] = { /* Available fields for NM_SETTING_IP4_CONFIG_SETTING_NAME */ NmcOutputField nmc_fields_setting_ip4_config[] = { - SETTING_FIELD ("name", 8), /* 0 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_METHOD, 10), /* 1 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_DNS, 20), /* 2 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_DNS_SEARCH, 15), /* 3 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_ADDRESSES, 20), /* 4 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_ROUTES, 20), /* 5 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, 15), /* 8 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, 19), /* 9 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, 14), /* 10 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, 15), /* 11 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_MAY_FAIL, 12), /* 12 */ + SETTING_FIELD ("name", 8), /* 0 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_METHOD, 10), /* 1 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS, 20), /* 2 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_SEARCH, 15), /* 3 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_ADDRESSES, 20), /* 4 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTES, 20), /* 5 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */ + SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, 15), /* 8 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, 19), /* 9 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, 14), /* 10 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, 15), /* 11 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL, 12), /* 12 */ {NULL, NULL, 0, NULL, FALSE, FALSE, 0} }; #define NMC_FIELDS_SETTING_IP4_CONFIG_ALL "name"","\ - NM_SETTING_IP4_CONFIG_METHOD","\ - NM_SETTING_IP4_CONFIG_DNS","\ - NM_SETTING_IP4_CONFIG_DNS_SEARCH","\ - NM_SETTING_IP4_CONFIG_ADDRESSES","\ - NM_SETTING_IP4_CONFIG_ROUTES","\ - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES","\ - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS","\ + NM_SETTING_IP_CONFIG_METHOD","\ + NM_SETTING_IP_CONFIG_DNS","\ + NM_SETTING_IP_CONFIG_DNS_SEARCH","\ + NM_SETTING_IP_CONFIG_ADDRESSES","\ + NM_SETTING_IP_CONFIG_ROUTES","\ + NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES","\ + NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS","\ NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID","\ - NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME","\ - NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME","\ - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT","\ - NM_SETTING_IP4_CONFIG_MAY_FAIL + NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME","\ + NM_SETTING_IP_CONFIG_DHCP_HOSTNAME","\ + NM_SETTING_IP_CONFIG_NEVER_DEFAULT","\ + NM_SETTING_IP_CONFIG_MAY_FAIL #define NMC_FIELDS_SETTING_IP4_CONFIG_COMMON NMC_FIELDS_SETTING_IP4_CONFIG_ALL /* Available fields for NM_SETTING_IP6_CONFIG_SETTING_NAME */ NmcOutputField nmc_fields_setting_ip6_config[] = { - SETTING_FIELD ("name", 8), /* 0 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_METHOD, 10), /* 1 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_DNS, 20), /* 2 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_DNS_SEARCH, 15), /* 3 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_ADDRESSES, 20), /* 4 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_ROUTES, 20), /* 5 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, 15), /* 8 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_MAY_FAIL, 12), /* 9 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, 15), /* 10 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, 14), /* 11 */ + SETTING_FIELD ("name", 8), /* 0 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_METHOD, 10), /* 1 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS, 20), /* 2 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_SEARCH, 15), /* 3 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_ADDRESSES, 20), /* 4 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTES, 20), /* 5 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, 15), /* 8 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL, 12), /* 9 */ + SETTING_FIELD (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, 15), /* 10 */ + SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, 14), /* 11 */ {NULL, NULL, 0, NULL, FALSE, FALSE, 0} }; #define NMC_FIELDS_SETTING_IP6_CONFIG_ALL "name"","\ - NM_SETTING_IP6_CONFIG_METHOD","\ - NM_SETTING_IP6_CONFIG_DNS","\ - NM_SETTING_IP6_CONFIG_DNS_SEARCH","\ - NM_SETTING_IP6_CONFIG_ADDRESSES","\ - NM_SETTING_IP6_CONFIG_ROUTES","\ - NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES","\ - NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS","\ - NM_SETTING_IP6_CONFIG_NEVER_DEFAULT","\ - NM_SETTING_IP6_CONFIG_MAY_FAIL","\ + NM_SETTING_IP_CONFIG_METHOD","\ + NM_SETTING_IP_CONFIG_DNS","\ + NM_SETTING_IP_CONFIG_DNS_SEARCH","\ + NM_SETTING_IP_CONFIG_ADDRESSES","\ + NM_SETTING_IP_CONFIG_ROUTES","\ + NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES","\ + NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS","\ + NM_SETTING_IP_CONFIG_NEVER_DEFAULT","\ + NM_SETTING_IP_CONFIG_MAY_FAIL","\ NM_SETTING_IP6_CONFIG_IP6_PRIVACY","\ - NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME + NM_SETTING_IP_CONFIG_DHCP_HOSTNAME #define NMC_FIELDS_SETTING_IP6_CONFIG_COMMON NMC_FIELDS_SETTING_IP4_CONFIG_ALL /* Available fields for NM_SETTING_SERIAL_SETTING_NAME */ @@ -1199,23 +1200,23 @@ nmc_property_ib_get_p_key (NMSetting *setting) DEFINE_GETTER (nmc_property_ib_get_parent, NM_SETTING_INFINIBAND_PARENT) /* --- NM_SETTING_IP4_CONFIG_SETTING_NAME property get functions --- */ -DEFINE_GETTER (nmc_property_ipv4_get_method, NM_SETTING_IP4_CONFIG_METHOD) -DEFINE_GETTER (nmc_property_ipv4_get_dns, NM_SETTING_IP4_CONFIG_DNS) -DEFINE_GETTER (nmc_property_ipv4_get_dns_search, NM_SETTING_IP4_CONFIG_DNS_SEARCH) +DEFINE_GETTER (nmc_property_ipv4_get_method, NM_SETTING_IP_CONFIG_METHOD) +DEFINE_GETTER (nmc_property_ipv4_get_dns, NM_SETTING_IP_CONFIG_DNS) +DEFINE_GETTER (nmc_property_ipv4_get_dns_search, NM_SETTING_IP_CONFIG_DNS_SEARCH) static char * nmc_property_ipv4_get_addresses (NMSetting *setting) { - NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (setting); + NMSettingIPConfig *s_ip4 = NM_SETTING_IP_CONFIG (setting); GString *printable; guint32 num_addresses, i; NMIPAddress *addr; printable = g_string_new (NULL); - num_addresses = nm_setting_ip4_config_get_num_addresses (s_ip4); + num_addresses = nm_setting_ip_config_get_num_addresses (s_ip4); for (i = 0; i < num_addresses; i++) { - addr = nm_setting_ip4_config_get_address (s_ip4, i); + addr = nm_setting_ip_config_get_address (s_ip4, i); if (printable->len > 0) g_string_append (printable, "; "); @@ -1240,16 +1241,16 @@ nmc_property_ipv4_get_addresses (NMSetting *setting) static char * nmc_property_ipv4_get_routes (NMSetting *setting) { - NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (setting); + NMSettingIPConfig *s_ip4 = NM_SETTING_IP_CONFIG (setting); GString *printable; guint32 num_routes, i; NMIPRoute *route; printable = g_string_new (NULL); - num_routes = nm_setting_ip4_config_get_num_routes (s_ip4); + num_routes = nm_setting_ip_config_get_num_routes (s_ip4); for (i = 0; i < num_routes; i++) { - route = nm_setting_ip4_config_get_route (s_ip4, i); + route = nm_setting_ip_config_get_route (s_ip4, i); if (printable->len > 0) g_string_append (printable, "; "); @@ -1274,32 +1275,32 @@ nmc_property_ipv4_get_routes (NMSetting *setting) return g_string_free (printable, FALSE); } -DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_routes, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES) -DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_dns, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS) +DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_routes, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES) +DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_dns, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS) DEFINE_GETTER (nmc_property_ipv4_get_dhcp_client_id, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID) -DEFINE_GETTER (nmc_property_ipv4_get_dhcp_send_hostname, NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME) -DEFINE_GETTER (nmc_property_ipv4_get_dhcp_hostname, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME) -DEFINE_GETTER (nmc_property_ipv4_get_never_default, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT) -DEFINE_GETTER (nmc_property_ipv4_get_may_fail, NM_SETTING_IP4_CONFIG_MAY_FAIL) +DEFINE_GETTER (nmc_property_ipv4_get_dhcp_send_hostname, NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME) +DEFINE_GETTER (nmc_property_ipv4_get_dhcp_hostname, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME) +DEFINE_GETTER (nmc_property_ipv4_get_never_default, NM_SETTING_IP_CONFIG_NEVER_DEFAULT) +DEFINE_GETTER (nmc_property_ipv4_get_may_fail, NM_SETTING_IP_CONFIG_MAY_FAIL) /* --- NM_SETTING_IP6_CONFIG_SETTING_NAME property get functions --- */ -DEFINE_GETTER (nmc_property_ipv6_get_method, NM_SETTING_IP6_CONFIG_METHOD) -DEFINE_GETTER (nmc_property_ipv6_get_dns, NM_SETTING_IP6_CONFIG_DNS) -DEFINE_GETTER (nmc_property_ipv6_get_dns_search, NM_SETTING_IP6_CONFIG_DNS_SEARCH) +DEFINE_GETTER (nmc_property_ipv6_get_method, NM_SETTING_IP_CONFIG_METHOD) +DEFINE_GETTER (nmc_property_ipv6_get_dns, NM_SETTING_IP_CONFIG_DNS) +DEFINE_GETTER (nmc_property_ipv6_get_dns_search, NM_SETTING_IP_CONFIG_DNS_SEARCH) static char * nmc_property_ipv6_get_addresses (NMSetting *setting) { - NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting); + NMSettingIPConfig *s_ip6 = NM_SETTING_IP_CONFIG (setting); GString *printable; guint32 num_addresses, i; NMIPAddress *addr; printable = g_string_new (NULL); - num_addresses = nm_setting_ip6_config_get_num_addresses (s_ip6); + num_addresses = nm_setting_ip_config_get_num_addresses (s_ip6); for (i = 0; i < num_addresses; i++) { - addr = nm_setting_ip6_config_get_address (s_ip6, i); + addr = nm_setting_ip_config_get_address (s_ip6, i); if (printable->len > 0) g_string_append (printable, "; "); @@ -1324,16 +1325,16 @@ nmc_property_ipv6_get_addresses (NMSetting *setting) static char * nmc_property_ipv6_get_routes (NMSetting *setting) { - NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting); + NMSettingIPConfig *s_ip6 = NM_SETTING_IP_CONFIG (setting); GString *printable; guint32 num_routes, i; NMIPRoute *route; printable = g_string_new (NULL); - num_routes = nm_setting_ip6_config_get_num_routes (s_ip6); + num_routes = nm_setting_ip_config_get_num_routes (s_ip6); for (i = 0; i < num_routes; i++) { - route = nm_setting_ip6_config_get_route (s_ip6, i); + route = nm_setting_ip_config_get_route (s_ip6, i); if (printable->len > 0) g_string_append (printable, "; "); @@ -1358,11 +1359,11 @@ nmc_property_ipv6_get_routes (NMSetting *setting) return g_string_free (printable, FALSE); } -DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_routes, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES) -DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_dns, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS) -DEFINE_GETTER (nmc_property_ipv6_get_never_default, NM_SETTING_IP6_CONFIG_NEVER_DEFAULT) -DEFINE_GETTER (nmc_property_ipv6_get_may_fail, NM_SETTING_IP6_CONFIG_MAY_FAIL) -DEFINE_GETTER (nmc_property_ipv6_get_dhcp_hostname, NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME) +DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_routes, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES) +DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_dns, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS) +DEFINE_GETTER (nmc_property_ipv6_get_never_default, NM_SETTING_IP_CONFIG_NEVER_DEFAULT) +DEFINE_GETTER (nmc_property_ipv6_get_may_fail, NM_SETTING_IP_CONFIG_MAY_FAIL) +DEFINE_GETTER (nmc_property_ipv6_get_dhcp_hostname, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME) static char * nmc_property_ipv6_get_ip6_privacy (NMSetting *setting) @@ -1696,19 +1697,19 @@ ipv4_addresses_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_dat /* If we have some IP addresses set method to 'manual'. * Else if the method was 'manual', change it back to 'auto'. */ - if (nm_setting_ip4_config_get_num_addresses (NM_SETTING_IP4_CONFIG (object))) { - if (g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { + if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) { + if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { if (!answered) { answered = TRUE; answer = get_answer ("ipv4.method", "manual"); } if (answer) - g_object_set (object, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); + g_object_set (object, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); } } else { answered = FALSE; - if (!g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) - g_object_set (object, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + if (!g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) + g_object_set (object, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); } g_signal_handlers_unblock_by_func (object, G_CALLBACK (ipv4_method_changed_cb), NULL); @@ -1724,8 +1725,8 @@ ipv4_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data) g_signal_handlers_block_by_func (object, G_CALLBACK (ipv4_addresses_changed_cb), NULL); /* If method != manual, remove addresses (save them for restoring them later when method becomes 'manual' */ - if (g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { - if (nm_setting_ip4_config_get_num_addresses (NM_SETTING_IP4_CONFIG (object))) { + if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { + if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) { if (!answered) { answered = TRUE; answer = get_answer ("ipv4.addresses", NULL); @@ -1733,14 +1734,14 @@ ipv4_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data) if (answer) { if (G_IS_VALUE (&value)) g_value_unset (&value); - nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP4_CONFIG_ADDRESSES, &value); - g_object_set (object, NM_SETTING_IP4_CONFIG_ADDRESSES, NULL, NULL); + nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value); + g_object_set (object, NM_SETTING_IP_CONFIG_ADDRESSES, NULL, NULL); } } } else { answered = FALSE; if (G_IS_VALUE (&value)) { - nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP4_CONFIG_ADDRESSES, &value); + nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value); g_value_unset (&value); } } @@ -1759,19 +1760,19 @@ ipv6_addresses_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_dat /* If we have some IP addresses set method to 'manual'. * Else if the method was 'manual', change it back to 'auto'. */ - if (nm_setting_ip6_config_get_num_addresses (NM_SETTING_IP6_CONFIG (object))) { - if (g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { + if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) { + if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { if (!answered) { answered = TRUE; answer = get_answer ("ipv6.method", "manual"); } if (answer) - g_object_set (object, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL); + g_object_set (object, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL); } } else { answered = FALSE; - if (!g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) - g_object_set (object, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); + if (!g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) + g_object_set (object, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); } g_signal_handlers_unblock_by_func (object, G_CALLBACK (ipv6_method_changed_cb), NULL); @@ -1787,8 +1788,8 @@ ipv6_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data) g_signal_handlers_block_by_func (object, G_CALLBACK (ipv6_addresses_changed_cb), NULL); /* If method != manual, remove addresses (save them for restoring them later when method becomes 'manual' */ - if (g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { - if (nm_setting_ip6_config_get_num_addresses (NM_SETTING_IP6_CONFIG (object))) { + if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { + if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) { if (!answered) { answered = TRUE; answer = get_answer ("ipv6.addresses", NULL); @@ -1796,14 +1797,14 @@ ipv6_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data) if (answer) { if (G_IS_VALUE (&value)) g_value_unset (&value); - nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP6_CONFIG_ADDRESSES, &value); - g_object_set (object, NM_SETTING_IP6_CONFIG_ADDRESSES, NULL, NULL); + nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value); + g_object_set (object, NM_SETTING_IP_CONFIG_ADDRESSES, NULL, NULL); } } } else { answered = FALSE; if (G_IS_VALUE (&value)) { - nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP6_CONFIG_ADDRESSES, &value); + nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value); g_value_unset (&value); } } @@ -1867,24 +1868,24 @@ connection_master_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_ } void -nmc_setting_ip4_connect_handlers (NMSettingIP4Config *setting) +nmc_setting_ip4_connect_handlers (NMSettingIPConfig *setting) { g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting)); - g_signal_connect (setting, "notify::" NM_SETTING_IP4_CONFIG_ADDRESSES, + g_signal_connect (setting, "notify::" NM_SETTING_IP_CONFIG_ADDRESSES, G_CALLBACK (ipv4_addresses_changed_cb), NULL); - g_signal_connect (setting, "notify::" NM_SETTING_IP4_CONFIG_METHOD, + g_signal_connect (setting, "notify::" NM_SETTING_IP_CONFIG_METHOD, G_CALLBACK (ipv4_method_changed_cb), NULL); } void -nmc_setting_ip6_connect_handlers (NMSettingIP6Config *setting) +nmc_setting_ip6_connect_handlers (NMSettingIPConfig *setting) { g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); - g_signal_connect (setting, "notify::" NM_SETTING_IP6_CONFIG_ADDRESSES, + g_signal_connect (setting, "notify::" NM_SETTING_IP_CONFIG_ADDRESSES, G_CALLBACK (ipv6_addresses_changed_cb), NULL); - g_signal_connect (setting, "notify::" NM_SETTING_IP6_CONFIG_METHOD, + g_signal_connect (setting, "notify::" NM_SETTING_IP_CONFIG_METHOD, G_CALLBACK (ipv6_method_changed_cb), NULL); } @@ -1918,15 +1919,15 @@ nmc_setting_custom_init (NMSetting *setting) g_return_if_fail (NM_IS_SETTING (setting)); if (NM_IS_SETTING_IP4_CONFIG (setting)) { - g_object_set (NM_SETTING_IP4_CONFIG (setting), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + g_object_set (NM_SETTING_IP_CONFIG (setting), + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); - nmc_setting_ip4_connect_handlers (NM_SETTING_IP4_CONFIG (setting)); + nmc_setting_ip4_connect_handlers (NM_SETTING_IP_CONFIG (setting)); } else if (NM_IS_SETTING_IP6_CONFIG (setting)) { - g_object_set (NM_SETTING_IP6_CONFIG (setting), - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + g_object_set (NM_SETTING_IP_CONFIG (setting), + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); - nmc_setting_ip6_connect_handlers (NM_SETTING_IP6_CONFIG (setting)); + nmc_setting_ip6_connect_handlers (NM_SETTING_IP_CONFIG (setting)); } else if (NM_IS_SETTING_WIRELESS (setting)) { g_object_set (NM_SETTING_WIRELESS (setting), NM_SETTING_WIRELESS_MODE, NM_SETTING_WIRELESS_MODE_INFRA, @@ -3151,14 +3152,14 @@ nmc_property_ipv4_set_dns (NMSetting *setting, const char *prop, const char *val g_strfreev (strv); return FALSE; } - nm_setting_ip4_config_add_dns (NM_SETTING_IP4_CONFIG (setting), addr); + nm_setting_ip_config_add_dns (NM_SETTING_IP_CONFIG (setting), addr); } g_strfreev (strv); return TRUE; } static gboolean -_validate_and_remove_ipv4_dns (NMSettingIP4Config *setting, +_validate_and_remove_ipv4_dns (NMSettingIPConfig *setting, const char *dns, GError **error) { @@ -3170,15 +3171,15 @@ _validate_and_remove_ipv4_dns (NMSettingIP4Config *setting, return FALSE; } - ret = nm_setting_ip4_config_remove_dns_by_value (setting, dns); + ret = nm_setting_ip_config_remove_dns_by_value (setting, dns); if (!ret) g_set_error (error, 1, 0, _("the property doesn't contain DNS server '%s'"), dns); return ret; } DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_dns, - NM_SETTING_IP4_CONFIG, - nm_setting_ip4_config_get_num_dns, - nm_setting_ip4_config_remove_dns, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_dns, + nm_setting_ip_config_remove_dns, _validate_and_remove_ipv4_dns) static const char * @@ -3204,20 +3205,20 @@ nmc_property_ipv4_set_dns_search (NMSetting *setting, const char *prop, const ch } while (strv && strv[i]) - nm_setting_ip4_config_add_dns_search (NM_SETTING_IP4_CONFIG (setting), strv[i++]); + nm_setting_ip_config_add_dns_search (NM_SETTING_IP_CONFIG (setting), strv[i++]); g_strfreev (strv); return TRUE; } static gboolean -_validate_and_remove_ipv4_dns_search (NMSettingIP4Config *setting, +_validate_and_remove_ipv4_dns_search (NMSettingIPConfig *setting, const char *dns_search, GError **error) { gboolean ret; - ret = nm_setting_ip4_config_remove_dns_search_by_value (setting, dns_search); + ret = nm_setting_ip_config_remove_dns_search_by_value (setting, dns_search); if (!ret) g_set_error (error, 1, 0, _("the property doesn't contain DNS search domain '%s'"), @@ -3225,9 +3226,9 @@ _validate_and_remove_ipv4_dns_search (NMSettingIP4Config *setting, return ret; } DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_dns_search, - NM_SETTING_IP4_CONFIG, - nm_setting_ip4_config_get_num_dns_searches, - nm_setting_ip4_config_remove_dns_search, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_dns_searches, + nm_setting_ip_config_remove_dns_search, _validate_and_remove_ipv4_dns_search) /* 'addresses' */ @@ -3252,7 +3253,7 @@ nmc_property_ipv4_set_addresses (NMSetting *setting, const char *prop, const cha g_strfreev (strv); return FALSE; } - nm_setting_ip4_config_add_address (NM_SETTING_IP4_CONFIG (setting), ip4addr); + nm_setting_ip_config_add_address (NM_SETTING_IP_CONFIG (setting), ip4addr); nm_ip_address_unref (ip4addr); } g_strfreev (strv); @@ -3260,7 +3261,7 @@ nmc_property_ipv4_set_addresses (NMSetting *setting, const char *prop, const cha } static gboolean -_validate_and_remove_ipv4_address (NMSettingIP4Config *setting, +_validate_and_remove_ipv4_address (NMSettingIPConfig *setting, const char *address, GError **error) { @@ -3271,7 +3272,7 @@ _validate_and_remove_ipv4_address (NMSettingIP4Config *setting, if (!ip4addr) return FALSE; - ret = nm_setting_ip4_config_remove_address_by_value (setting, ip4addr); + ret = nm_setting_ip_config_remove_address_by_value (setting, ip4addr); if (!ret) g_set_error (error, 1, 0, _("the property doesn't contain IP address '%s'"), address); @@ -3279,9 +3280,9 @@ _validate_and_remove_ipv4_address (NMSettingIP4Config *setting, return ret; } DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_addresses, - NM_SETTING_IP4_CONFIG, - nm_setting_ip4_config_get_num_addresses, - nm_setting_ip4_config_remove_address, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_addresses, + nm_setting_ip_config_remove_address, _validate_and_remove_ipv4_address) static const char * @@ -3350,7 +3351,7 @@ nmc_property_ipv4_set_routes (NMSetting *setting, const char *prop, const char * g_strfreev (strv); return FALSE; } - nm_setting_ip4_config_add_route (NM_SETTING_IP4_CONFIG (setting), ip4route); + nm_setting_ip_config_add_route (NM_SETTING_IP_CONFIG (setting), ip4route); nm_ip_route_unref (ip4route); } g_strfreev (strv); @@ -3358,7 +3359,7 @@ nmc_property_ipv4_set_routes (NMSetting *setting, const char *prop, const char * } static gboolean -_validate_and_remove_ipv4_route (NMSettingIP4Config *setting, +_validate_and_remove_ipv4_route (NMSettingIPConfig *setting, const char *route, GError **error) { @@ -3369,16 +3370,16 @@ _validate_and_remove_ipv4_route (NMSettingIP4Config *setting, if (!ip4route) return FALSE; - ret = nm_setting_ip4_config_remove_route_by_value (setting, ip4route); + ret = nm_setting_ip_config_remove_route_by_value (setting, ip4route); if (!ret) g_set_error (error, 1, 0, _("the property doesn't contain route '%s'"), route); nm_ip_route_unref (ip4route); return ret; } DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_routes, - NM_SETTING_IP4_CONFIG, - nm_setting_ip4_config_get_num_routes, - nm_setting_ip4_config_remove_route, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_routes, + nm_setting_ip_config_remove_route, _validate_and_remove_ipv4_route) static const char * @@ -3465,14 +3466,14 @@ nmc_property_ipv6_set_dns (NMSetting *setting, const char *prop, const char *val g_strfreev (strv); return FALSE; } - nm_setting_ip6_config_add_dns (NM_SETTING_IP6_CONFIG (setting), addr); + nm_setting_ip_config_add_dns (NM_SETTING_IP_CONFIG (setting), addr); } g_strfreev (strv); return TRUE; } static gboolean -_validate_and_remove_ipv6_dns (NMSettingIP6Config *setting, +_validate_and_remove_ipv6_dns (NMSettingIPConfig *setting, const char *dns, GError **error) { @@ -3484,15 +3485,15 @@ _validate_and_remove_ipv6_dns (NMSettingIP6Config *setting, return FALSE; } - ret = nm_setting_ip6_config_remove_dns_by_value (setting, dns); + ret = nm_setting_ip_config_remove_dns_by_value (setting, dns); if (!ret) g_set_error (error, 1, 0, _("the property doesn't contain DNS server '%s'"), dns); return ret; } DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_dns, - NM_SETTING_IP6_CONFIG, - nm_setting_ip6_config_get_num_dns, - nm_setting_ip6_config_remove_dns, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_dns, + nm_setting_ip_config_remove_dns, _validate_and_remove_ipv6_dns) static const char * @@ -3524,20 +3525,20 @@ nmc_property_ipv6_set_dns_search (NMSetting *setting, const char *prop, const ch } while (strv && strv[i]) - nm_setting_ip6_config_add_dns_search (NM_SETTING_IP6_CONFIG (setting), strv[i++]); + nm_setting_ip_config_add_dns_search (NM_SETTING_IP_CONFIG (setting), strv[i++]); g_strfreev (strv); return TRUE; } static gboolean -_validate_and_remove_ipv6_dns_search (NMSettingIP6Config *setting, +_validate_and_remove_ipv6_dns_search (NMSettingIPConfig *setting, const char *dns_search, GError **error) { gboolean ret; - ret = nm_setting_ip6_config_remove_dns_search_by_value (setting, dns_search); + ret = nm_setting_ip_config_remove_dns_search_by_value (setting, dns_search); if (!ret) g_set_error (error, 1, 0, _("the property doesn't contain DNS search domain '%s'"), @@ -3545,9 +3546,9 @@ _validate_and_remove_ipv6_dns_search (NMSettingIP6Config *setting, return ret; } DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_dns_search, - NM_SETTING_IP6_CONFIG, - nm_setting_ip6_config_get_num_dns_searches, - nm_setting_ip6_config_remove_dns_search, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_dns_searches, + nm_setting_ip_config_remove_dns_search, _validate_and_remove_ipv6_dns_search) /* 'addresses' */ @@ -3572,7 +3573,7 @@ nmc_property_ipv6_set_addresses (NMSetting *setting, const char *prop, const cha g_strfreev (strv); return FALSE; } - nm_setting_ip6_config_add_address (NM_SETTING_IP6_CONFIG (setting), ip6addr); + nm_setting_ip_config_add_address (NM_SETTING_IP_CONFIG (setting), ip6addr); nm_ip_address_unref (ip6addr); } g_strfreev (strv); @@ -3580,7 +3581,7 @@ nmc_property_ipv6_set_addresses (NMSetting *setting, const char *prop, const cha } static gboolean -_validate_and_remove_ipv6_address (NMSettingIP6Config *setting, +_validate_and_remove_ipv6_address (NMSettingIPConfig *setting, const char *address, GError **error) { @@ -3591,16 +3592,16 @@ _validate_and_remove_ipv6_address (NMSettingIP6Config *setting, if (!ip6addr) return FALSE; - ret = nm_setting_ip6_config_remove_address_by_value (setting, ip6addr); + ret = nm_setting_ip_config_remove_address_by_value (setting, ip6addr); if (!ret) g_set_error (error, 1, 0, _("the property doesn't contain IP address '%s'"), address); nm_ip_address_unref (ip6addr); return ret; } DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_addresses, - NM_SETTING_IP6_CONFIG, - nm_setting_ip6_config_get_num_addresses, - nm_setting_ip6_config_remove_address, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_addresses, + nm_setting_ip_config_remove_address, _validate_and_remove_ipv6_address) static const char * @@ -3634,7 +3635,7 @@ nmc_property_ipv6_set_routes (NMSetting *setting, const char *prop, const char * g_strfreev (strv); return FALSE; } - nm_setting_ip6_config_add_route (NM_SETTING_IP6_CONFIG (setting), ip6route); + nm_setting_ip_config_add_route (NM_SETTING_IP_CONFIG (setting), ip6route); nm_ip_route_unref (ip6route); } g_strfreev (strv); @@ -3642,7 +3643,7 @@ nmc_property_ipv6_set_routes (NMSetting *setting, const char *prop, const char * } static gboolean -_validate_and_remove_ipv6_route (NMSettingIP6Config *setting, +_validate_and_remove_ipv6_route (NMSettingIPConfig *setting, const char *route, GError **error) { @@ -3653,16 +3654,16 @@ _validate_and_remove_ipv6_route (NMSettingIP6Config *setting, if (!ip6route) return FALSE; - ret = nm_setting_ip6_config_remove_route_by_value (setting, ip6route); + ret = nm_setting_ip_config_remove_route_by_value (setting, ip6route); if (!ret) g_set_error (error, 1, 0, _("the property doesn't contain route '%s'"), route); nm_ip_route_unref (ip6route); return ret; } DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_routes, - NM_SETTING_IP6_CONFIG, - nm_setting_ip6_config_get_num_routes, - nm_setting_ip6_config_remove_route, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_routes, + nm_setting_ip_config_remove_route, _validate_and_remove_ipv6_route) static const char * @@ -4695,6 +4696,8 @@ nmc_add_prop_funcs (char *key, /* concatenate setting name and property name */ #define GLUE(A,B) (g_strconcat ((NM_SETTING_##A##_SETTING_NAME),(NM_SETTING_##A##_##B), NULL)) +#define GLUE_IP(A,B) (g_strconcat ((NM_SETTING_IP##A##_CONFIG_SETTING_NAME),(NM_SETTING_IP_CONFIG_##B), NULL)) + void nmc_properties_init (void) { @@ -5420,49 +5423,49 @@ nmc_properties_init (void) NULL); /* Add editable properties for NM_SETTING_IP4_CONFIG_SETTING_NAME */ - nmc_add_prop_funcs (GLUE (IP4_CONFIG, METHOD), + nmc_add_prop_funcs (GLUE_IP (4, METHOD), nmc_property_ipv4_get_method, nmc_property_ipv4_set_method, NULL, NULL, nmc_property_ipv4_allowed_method, NULL); - nmc_add_prop_funcs (GLUE (IP4_CONFIG, DNS), + nmc_add_prop_funcs (GLUE_IP (4, DNS), nmc_property_ipv4_get_dns, nmc_property_ipv4_set_dns, nmc_property_ipv4_remove_dns, nmc_property_ipv4_describe_dns, NULL, NULL); - nmc_add_prop_funcs (GLUE (IP4_CONFIG, DNS_SEARCH), + nmc_add_prop_funcs (GLUE_IP (4, DNS_SEARCH), nmc_property_ipv4_get_dns_search, nmc_property_ipv4_set_dns_search, nmc_property_ipv4_remove_dns_search, NULL, NULL, NULL); - nmc_add_prop_funcs (GLUE (IP4_CONFIG, ADDRESSES), + nmc_add_prop_funcs (GLUE_IP (4, ADDRESSES), nmc_property_ipv4_get_addresses, nmc_property_ipv4_set_addresses, nmc_property_ipv4_remove_addresses, nmc_property_ipv4_describe_addresses, NULL, nmc_property_out2in_addresses); - nmc_add_prop_funcs (GLUE (IP4_CONFIG, ROUTES), + nmc_add_prop_funcs (GLUE_IP (4, ROUTES), nmc_property_ipv4_get_routes, nmc_property_ipv4_set_routes, nmc_property_ipv4_remove_routes, nmc_property_ipv4_describe_routes, NULL, nmc_property_out2in_routes); - nmc_add_prop_funcs (GLUE (IP4_CONFIG, IGNORE_AUTO_ROUTES), + nmc_add_prop_funcs (GLUE_IP (4, IGNORE_AUTO_ROUTES), nmc_property_ipv4_get_ignore_auto_routes, nmc_property_set_bool, NULL, NULL, NULL, NULL); - nmc_add_prop_funcs (GLUE (IP4_CONFIG, IGNORE_AUTO_DNS), + nmc_add_prop_funcs (GLUE_IP (4, IGNORE_AUTO_DNS), nmc_property_ipv4_get_ignore_auto_dns, nmc_property_set_bool, NULL, @@ -5476,28 +5479,28 @@ nmc_properties_init (void) NULL, NULL, NULL); - nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_SEND_HOSTNAME), + nmc_add_prop_funcs (GLUE_IP (4, DHCP_SEND_HOSTNAME), nmc_property_ipv4_get_dhcp_send_hostname, nmc_property_set_bool, NULL, NULL, NULL, NULL); - nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_HOSTNAME), + nmc_add_prop_funcs (GLUE_IP (4, DHCP_HOSTNAME), nmc_property_ipv4_get_dhcp_hostname, nmc_property_set_string, NULL, NULL, NULL, NULL); - nmc_add_prop_funcs (GLUE (IP4_CONFIG, NEVER_DEFAULT), + nmc_add_prop_funcs (GLUE_IP (4, NEVER_DEFAULT), nmc_property_ipv4_get_never_default, nmc_property_set_bool, NULL, NULL, NULL, NULL); - nmc_add_prop_funcs (GLUE (IP4_CONFIG, MAY_FAIL), + nmc_add_prop_funcs (GLUE_IP (4, MAY_FAIL), nmc_property_ipv4_get_may_fail, nmc_property_set_bool, NULL, @@ -5506,63 +5509,63 @@ nmc_properties_init (void) NULL); /* Add editable properties for NM_SETTING_IP6_CONFIG_SETTING_NAME */ - nmc_add_prop_funcs (GLUE (IP6_CONFIG, METHOD), + nmc_add_prop_funcs (GLUE_IP (6, METHOD), nmc_property_ipv6_get_method, nmc_property_ipv6_set_method, NULL, NULL, nmc_property_ipv6_allowed_method, NULL); - nmc_add_prop_funcs (GLUE (IP6_CONFIG, DNS), + nmc_add_prop_funcs (GLUE_IP (6, DNS), nmc_property_ipv6_get_dns, nmc_property_ipv6_set_dns, nmc_property_ipv6_remove_dns, nmc_property_ipv6_describe_dns, NULL, NULL); - nmc_add_prop_funcs (GLUE (IP6_CONFIG, DNS_SEARCH), + nmc_add_prop_funcs (GLUE_IP (6, DNS_SEARCH), nmc_property_ipv6_get_dns_search, nmc_property_ipv6_set_dns_search, nmc_property_ipv6_remove_dns_search, NULL, NULL, NULL); - nmc_add_prop_funcs (GLUE (IP6_CONFIG, ADDRESSES), + nmc_add_prop_funcs (GLUE_IP (6, ADDRESSES), nmc_property_ipv6_get_addresses, nmc_property_ipv6_set_addresses, nmc_property_ipv6_remove_addresses, nmc_property_ipv6_describe_addresses, NULL, nmc_property_out2in_addresses); - nmc_add_prop_funcs (GLUE (IP6_CONFIG, ROUTES), + nmc_add_prop_funcs (GLUE_IP (6, ROUTES), nmc_property_ipv6_get_routes, nmc_property_ipv6_set_routes, nmc_property_ipv6_remove_routes, nmc_property_ipv6_describe_routes, NULL, nmc_property_out2in_routes); - nmc_add_prop_funcs (GLUE (IP6_CONFIG, IGNORE_AUTO_ROUTES), + nmc_add_prop_funcs (GLUE_IP (6, IGNORE_AUTO_ROUTES), nmc_property_ipv6_get_ignore_auto_routes, nmc_property_set_bool, NULL, NULL, NULL, NULL); - nmc_add_prop_funcs (GLUE (IP6_CONFIG, IGNORE_AUTO_DNS), + nmc_add_prop_funcs (GLUE_IP (6, IGNORE_AUTO_DNS), nmc_property_ipv6_get_ignore_auto_dns, nmc_property_set_bool, NULL, NULL, NULL, NULL); - nmc_add_prop_funcs (GLUE (IP6_CONFIG, NEVER_DEFAULT), + nmc_add_prop_funcs (GLUE_IP (6, NEVER_DEFAULT), nmc_property_ipv6_get_never_default, nmc_property_set_bool, NULL, NULL, NULL, NULL); - nmc_add_prop_funcs (GLUE (IP6_CONFIG, MAY_FAIL), + nmc_add_prop_funcs (GLUE_IP (6, MAY_FAIL), nmc_property_ipv6_get_may_fail, nmc_property_set_bool, NULL, @@ -5576,7 +5579,7 @@ nmc_properties_init (void) NULL, NULL, nmc_property_out2in_cut_paren); - nmc_add_prop_funcs (GLUE (IP6_CONFIG, DHCP_HOSTNAME), + nmc_add_prop_funcs (GLUE_IP (6, DHCP_HOSTNAME), nmc_property_ipv6_get_dhcp_hostname, nmc_property_set_string, NULL, @@ -6715,7 +6718,7 @@ setting_wireless_security_details (NMSetting *setting, NmCli *nmc, const char *o static gboolean setting_ip4_config_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets) { - NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (setting); + NMSettingIPConfig *s_ip4 = NM_SETTING_IP_CONFIG (setting); NmcOutputField *tmpl, *arr; size_t tmpl_len; @@ -6752,7 +6755,7 @@ setting_ip4_config_details (NMSetting *setting, NmCli *nmc, const char *one_pro static gboolean setting_ip6_config_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets) { - NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting); + NMSettingIPConfig *s_ip6 = NM_SETTING_IP_CONFIG (setting); NmcOutputField *tmpl, *arr; size_t tmpl_len; diff --git a/clients/cli/settings.h b/clients/cli/settings.h index ad74fc9053..3c4c814fd2 100644 --- a/clients/cli/settings.h +++ b/clients/cli/settings.h @@ -30,8 +30,8 @@ void nmc_properties_cleanup (void); NMSetting *nmc_setting_new_for_name (const char *name); void nmc_setting_custom_init (NMSetting *setting); -void nmc_setting_ip4_connect_handlers (NMSettingIP4Config *setting); -void nmc_setting_ip6_connect_handlers (NMSettingIP6Config *setting); +void nmc_setting_ip4_connect_handlers (NMSettingIPConfig *setting); +void nmc_setting_ip6_connect_handlers (NMSettingIPConfig *setting); void nmc_setting_wireless_connect_handlers (NMSettingWireless *setting); void nmc_setting_connection_connect_handlers (NMSettingConnection *setting, NMConnection *connection); diff --git a/clients/tui/nmt-page-ip4.c b/clients/tui/nmt-page-ip4.c index 686c2ce923..782a204fc9 100644 --- a/clients/tui/nmt-page-ip4.c +++ b/clients/tui/nmt-page-ip4.c @@ -59,12 +59,12 @@ static gboolean nmt_page_ip4_show_by_default (NmtEditorPage *page) { NMConnection *conn; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; conn = nmt_editor_page_get_connection (page); s_ip4 = nm_connection_get_setting_ip4_config (conn); - if ( !g_strcmp0 (nm_setting_ip4_config_get_method (s_ip4), NM_SETTING_IP4_CONFIG_METHOD_MANUAL) - || nm_setting_ip4_config_get_num_addresses (s_ip4)) + if ( !g_strcmp0 (nm_setting_ip_config_get_method (s_ip4), NM_SETTING_IP4_CONFIG_METHOD_MANUAL) + || nm_setting_ip_config_get_num_addresses (s_ip4)) return TRUE; return FALSE; } @@ -115,22 +115,22 @@ nmt_page_ip4_constructed (GObject *object) { NmtPageIP4 *ip4 = NMT_PAGE_IP4 (object); NmtPageGrid *grid; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NmtNewtWidget *widget, *button; NMConnection *conn; conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip4)); s_ip4 = nm_connection_get_setting_ip4_config (conn); if (!s_ip4) { - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); nm_connection_add_setting (conn, (NMSetting *) s_ip4); } widget = nmt_newt_popup_new (ip4methods); - g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, + g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_METHOD, widget, "active-id", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); nmt_editor_page_set_header_widget (NMT_EDITOR_PAGE (ip4), widget); @@ -139,27 +139,27 @@ nmt_page_ip4_constructed (GObject *object) widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4_WITH_PREFIX); nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET, - s_ip4, NM_SETTING_IP4_CONFIG_ADDRESSES, + s_ip4, NM_SETTING_IP_CONFIG_ADDRESSES, widget, "strings", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); nmt_page_grid_append (grid, _("Addresses"), widget, NULL); widget = nmt_ip_entry_new (25, AF_INET, FALSE, TRUE); nm_editor_bind_ip_gateway_to_string (AF_INET, - s_ip4, NM_SETTING_IP4_CONFIG_ADDRESSES, + s_ip4, NM_SETTING_IP_CONFIG_ADDRESSES, widget, "text", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); nmt_page_grid_append (grid, _("Gateway"), widget, NULL); widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4); nm_editor_bind_ip_addresses_to_strv (AF_INET, - s_ip4, NM_SETTING_IP4_CONFIG_DNS, + s_ip4, NM_SETTING_IP_CONFIG_DNS, widget, "strings", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); nmt_page_grid_append (grid, _("DNS servers"), widget, NULL); widget = nmt_address_list_new (NMT_ADDRESS_LIST_HOSTNAME); - g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_DNS_SEARCH, + g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_DNS_SEARCH, widget, "strings", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); nmt_page_grid_append (grid, _("Search domains"), widget, NULL); @@ -170,7 +170,7 @@ nmt_page_ip4_constructed (GObject *object) "text", "", "style", NMT_NEWT_LABEL_PLAIN, NULL); - g_object_bind_property_full (s_ip4, NM_SETTING_IP4_CONFIG_ROUTES, + g_object_bind_property_full (s_ip4, NM_SETTING_IP_CONFIG_ROUTES, widget, "text", G_BINDING_SYNC_CREATE, ip4_routes_transform_to_description, @@ -180,7 +180,7 @@ nmt_page_ip4_constructed (GObject *object) nmt_page_grid_append (grid, _("Routing"), widget, button); widget = nmt_newt_checkbox_new (_("Never use this network for default route")); - g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, + g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_NEVER_DEFAULT, widget, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); nmt_page_grid_append (grid, NULL, widget, NULL); @@ -188,7 +188,7 @@ nmt_page_ip4_constructed (GObject *object) nmt_page_grid_append (grid, NULL, nmt_newt_separator_new (), NULL); widget = nmt_newt_checkbox_new (_("Require IPv4 addressing for this connection")); - g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_MAY_FAIL, + g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_MAY_FAIL, widget, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL | G_BINDING_INVERT_BOOLEAN); diff --git a/clients/tui/nmt-page-ip6.c b/clients/tui/nmt-page-ip6.c index 05917fa0c8..88b948cd14 100644 --- a/clients/tui/nmt-page-ip6.c +++ b/clients/tui/nmt-page-ip6.c @@ -59,12 +59,12 @@ static gboolean nmt_page_ip6_show_by_default (NmtEditorPage *page) { NMConnection *conn; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; conn = nmt_editor_page_get_connection (page); s_ip6 = nm_connection_get_setting_ip6_config (conn); - if ( !g_strcmp0 (nm_setting_ip6_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_MANUAL) - || nm_setting_ip6_config_get_num_addresses (s_ip6)) + if ( !g_strcmp0 (nm_setting_ip_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_MANUAL) + || nm_setting_ip_config_get_num_addresses (s_ip6)) return TRUE; return FALSE; } @@ -115,22 +115,22 @@ nmt_page_ip6_constructed (GObject *object) { NmtPageIP6 *ip6 = NMT_PAGE_IP6 (object); NmtPageGrid *grid; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; NmtNewtWidget *widget, *button; NMConnection *conn; conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip6)); s_ip6 = nm_connection_get_setting_ip6_config (conn); if (!s_ip6) { - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_object_set (G_OBJECT (s_ip6), - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); nm_connection_add_setting (conn, (NMSetting *) s_ip6); } widget = nmt_newt_popup_new (ip6methods); - g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, + g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_METHOD, widget, "active-id", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); nmt_editor_page_set_header_widget (NMT_EDITOR_PAGE (ip6), widget); @@ -139,27 +139,27 @@ nmt_page_ip6_constructed (GObject *object) widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6_WITH_PREFIX); nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET6, - s_ip6, NM_SETTING_IP6_CONFIG_ADDRESSES, + s_ip6, NM_SETTING_IP_CONFIG_ADDRESSES, widget, "strings", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); nmt_page_grid_append (grid, _("Addresses"), widget, NULL); widget = nmt_ip_entry_new (25, AF_INET6, FALSE, TRUE); nm_editor_bind_ip_gateway_to_string (AF_INET6, - s_ip6, NM_SETTING_IP6_CONFIG_ADDRESSES, + s_ip6, NM_SETTING_IP_CONFIG_ADDRESSES, widget, "text", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); nmt_page_grid_append (grid, _("Gateway"), widget, NULL); widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6); nm_editor_bind_ip_addresses_to_strv (AF_INET6, - s_ip6, NM_SETTING_IP6_CONFIG_DNS, + s_ip6, NM_SETTING_IP_CONFIG_DNS, widget, "strings", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); nmt_page_grid_append (grid, _("DNS servers"), widget, NULL); widget = nmt_address_list_new (NMT_ADDRESS_LIST_HOSTNAME); - g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_DNS_SEARCH, + g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_DNS_SEARCH, widget, "strings", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); nmt_page_grid_append (grid, _("Search domains"), widget, NULL); @@ -168,7 +168,7 @@ nmt_page_ip6_constructed (GObject *object) "text", "", "style", NMT_NEWT_LABEL_PLAIN, NULL); - g_object_bind_property_full (s_ip6, NM_SETTING_IP6_CONFIG_ROUTES, + g_object_bind_property_full (s_ip6, NM_SETTING_IP_CONFIG_ROUTES, widget, "text", G_BINDING_SYNC_CREATE, ip6_routes_transform_to_description, @@ -178,7 +178,7 @@ nmt_page_ip6_constructed (GObject *object) nmt_page_grid_append (grid, _("Routing"), widget, button); widget = nmt_newt_checkbox_new (_("Never use this network for default route")); - g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, + g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_NEVER_DEFAULT, widget, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); nmt_page_grid_append (grid, NULL, widget, NULL); @@ -186,7 +186,7 @@ nmt_page_ip6_constructed (GObject *object) nmt_page_grid_append (grid, NULL, nmt_newt_separator_new (), NULL); widget = nmt_newt_checkbox_new (_("Require IPv6 addressing for this connection")); - g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_MAY_FAIL, + g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_MAY_FAIL, widget, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL | G_BINDING_INVERT_BOOLEAN); diff --git a/clients/tui/nmt-route-editor.c b/clients/tui/nmt-route-editor.c index 3871b86302..77bbec76de 100644 --- a/clients/tui/nmt-route-editor.c +++ b/clients/tui/nmt-route-editor.c @@ -77,21 +77,15 @@ save_routes_and_exit (NmtNewtButton *button, { NmtRouteEditor *editor = user_data; NmtRouteEditorPrivate *priv = NMT_ROUTE_EDITOR_GET_PRIVATE (editor); - const char *property; - GBinding *binding; + GPtrArray *routes; - if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting)) - property = NM_SETTING_IP4_CONFIG_ROUTES; - else - property = NM_SETTING_IP6_CONFIG_ROUTES; - - /* Because of the complicated dbus-glib GTypes, it's easier to cheat - * and use GBinding to do this than it is to copy the value by hand. - */ - binding = g_object_bind_property (priv->edit_setting, property, - priv->orig_setting, property, - G_BINDING_SYNC_CREATE); - g_object_unref (binding); + g_object_get (priv->edit_setting, + NM_SETTING_IP_CONFIG_ROUTES, &routes, + NULL); + g_object_set (priv->orig_setting, + NM_SETTING_IP_CONFIG_ROUTES, routes, + NULL); + g_ptr_array_unref (routes); nmt_newt_form_quit (NMT_NEWT_FORM (editor)); } @@ -106,17 +100,13 @@ nmt_route_editor_constructed (GObject *object) if (G_OBJECT_CLASS (nmt_route_editor_parent_class)->constructed) G_OBJECT_CLASS (nmt_route_editor_parent_class)->constructed (object); - if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting)) { + if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting)) routes = nmt_route_table_new (AF_INET); - g_object_bind_property (priv->edit_setting, NM_SETTING_IP4_CONFIG_ROUTES, - routes, "routes", - G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - } else { + else routes = nmt_route_table_new (AF_INET6); - g_object_bind_property (priv->edit_setting, NM_SETTING_IP6_CONFIG_ROUTES, - routes, "routes", - G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - } + g_object_bind_property (priv->edit_setting, NM_SETTING_IP_CONFIG_ROUTES, + routes, "routes", + G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); vbox = nmt_newt_grid_new (); nmt_newt_grid_add (NMT_NEWT_GRID (vbox), routes, 0, 0); diff --git a/examples/C/glib/add-connection-gdbus.c b/examples/C/glib/add-connection-gdbus.c index a7874fc51f..7a4d593945 100644 --- a/examples/C/glib/add-connection-gdbus.c +++ b/examples/C/glib/add-connection-gdbus.c @@ -86,7 +86,7 @@ add_connection (GDBusProxy *proxy, const char *con_name) /* Build up the 'ipv4' Setting */ g_variant_builder_init (&setting_builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_add (&setting_builder, "{sv}", - NM_SETTING_IP4_CONFIG_METHOD, + NM_SETTING_IP_CONFIG_METHOD, g_variant_new_string (NM_SETTING_IP4_CONFIG_METHOD_AUTO)); g_variant_builder_add (&connection_builder, "{sa{sv}}", NM_SETTING_IP4_CONFIG_SETTING_NAME, diff --git a/examples/C/glib/add-connection-libnm.c b/examples/C/glib/add-connection-libnm.c index 1288e79c51..f206340e0c 100644 --- a/examples/C/glib/add-connection-libnm.c +++ b/examples/C/glib/add-connection-libnm.c @@ -86,7 +86,7 @@ add_connection (NMClient *client, GMainLoop *loop, const char *con_name) /* Build up the 'ipv4' Setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c index a6789b3195..e2c06c1765 100644 --- a/libnm-core/nm-connection.c +++ b/libnm-core/nm-connection.c @@ -631,8 +631,7 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters) NMSettingConnection *s_con = nm_connection_get_setting_connection (self); const char *default_ip4_method = NM_SETTING_IP4_CONFIG_METHOD_AUTO; const char *default_ip6_method = NULL; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4, *s_ip6; NMSetting *setting; if (parameters) @@ -663,7 +662,7 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters) setting = nm_setting_ip4_config_new (); g_object_set (setting, - NM_SETTING_IP4_CONFIG_METHOD, default_ip4_method, + NM_SETTING_IP_CONFIG_METHOD, default_ip4_method, NULL); nm_connection_add_setting (self, setting); } @@ -671,8 +670,8 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters) setting = nm_setting_ip6_config_new (); g_object_set (setting, - NM_SETTING_IP6_CONFIG_METHOD, default_ip6_method, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, default_ip6_method, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); nm_connection_add_setting (self, setting); } @@ -740,8 +739,7 @@ _nm_connection_verify (NMConnection *connection, GError **error) { NMConnectionPrivate *priv; NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4, *s_ip6; GHashTableIter iter; gpointer value; GSList *all_settings = NULL, *setting_i; @@ -1739,14 +1737,19 @@ nm_connection_get_setting_infiniband (NMConnection *connection) * * A shortcut to return any #NMSettingIP4Config the connection might contain. * - * Returns: (transfer none): an #NMSettingIP4Config if the connection contains one, otherwise %NULL + * Note that it returns the value as type #NMSettingIPConfig, since the vast + * majority of IPv4-setting-related methods are on that type, not + * #NMSettingIP4Config. + * + * Returns: (type NMSettingIP4Config) (transfer none): an #NMSettingIP4Config if the + * connection contains one, otherwise %NULL **/ -NMSettingIP4Config * +NMSettingIPConfig * nm_connection_get_setting_ip4_config (NMConnection *connection) { g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); - return (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG); + return (NMSettingIPConfig *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG); } /** @@ -1755,14 +1758,19 @@ nm_connection_get_setting_ip4_config (NMConnection *connection) * * A shortcut to return any #NMSettingIP6Config the connection might contain. * - * Returns: (transfer none): an #NMSettingIP6Config if the connection contains one, otherwise %NULL + * Note that it returns the value as type #NMSettingIPConfig, since the vast + * majority of IPv6-setting-related methods are on that type, not + * #NMSettingIP6Config. + * + * Returns: (type NMSettingIP6Config) (transfer none): an #NMSettingIP6Config if the + * connection contains one, otherwise %NULL **/ -NMSettingIP6Config * +NMSettingIPConfig * nm_connection_get_setting_ip6_config (NMConnection *connection) { g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); - return (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG); + return (NMSettingIPConfig *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG); } /** diff --git a/libnm-core/nm-connection.h b/libnm-core/nm-connection.h index ec5db7fa2b..2f9883c33d 100644 --- a/libnm-core/nm-connection.h +++ b/libnm-core/nm-connection.h @@ -193,8 +193,8 @@ NMSettingDcb * nm_connection_get_setting_dcb (NMConnec NMSettingGeneric * nm_connection_get_setting_generic (NMConnection *connection); NMSettingGsm * nm_connection_get_setting_gsm (NMConnection *connection); NMSettingInfiniband * nm_connection_get_setting_infiniband (NMConnection *connection); -NMSettingIP4Config * nm_connection_get_setting_ip4_config (NMConnection *connection); -NMSettingIP6Config * nm_connection_get_setting_ip6_config (NMConnection *connection); +NMSettingIPConfig * nm_connection_get_setting_ip4_config (NMConnection *connection); +NMSettingIPConfig * nm_connection_get_setting_ip6_config (NMConnection *connection); NMSettingOlpcMesh * nm_connection_get_setting_olpc_mesh (NMConnection *connection); NMSettingPpp * nm_connection_get_setting_ppp (NMConnection *connection); NMSettingPppoe * nm_connection_get_setting_pppoe (NMConnection *connection); diff --git a/libnm-core/nm-core-types.h b/libnm-core/nm-core-types.h index a6fc529fae..524d6396c5 100644 --- a/libnm-core/nm-core-types.h +++ b/libnm-core/nm-core-types.h @@ -40,6 +40,7 @@ typedef struct _NMSettingDcb NMSettingDcb; typedef struct _NMSettingGeneric NMSettingGeneric; typedef struct _NMSettingGsm NMSettingGsm; typedef struct _NMSettingInfiniband NMSettingInfiniband; +typedef struct _NMSettingIPConfig NMSettingIPConfig; typedef struct _NMSettingIP4Config NMSettingIP4Config; typedef struct _NMSettingIP6Config NMSettingIP6Config; typedef struct _NMSettingOlpcMesh NMSettingOlpcMesh; diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c index 42857dca00..ebe38712b2 100644 --- a/libnm-core/nm-setting-ip-config.c +++ b/libnm-core/nm-setting-ip-config.c @@ -21,14 +21,29 @@ */ #include <string.h> +#include <arpa/inet.h> #include <glib/gi18n.h> #include "nm-setting-ip-config.h" +#include "nm-setting-ip4-config.h" +#include "nm-setting-ip6-config.h" #include "nm-utils.h" #include "nm-glib-compat.h" #include "nm-setting-private.h" #include "nm-utils-private.h" +/** + * SECTION:nm-setting-ip-config + * @short_description: Abstract base class for IPv4 and IPv6 + * addressing, routing, and name service properties + * @include: nm-setting-ip-config.h + * @see_also: #NMSettingIP4Config, #NMSettingIP6Config + * + * #NMSettingIPConfig is the abstract base class of + * #NMSettingIP4Config and #NMSettingIP6Config, providing properties + * related to IP addressing, routing, and Domain Name Service. + **/ + static char * canonicalize_ip (int family, const char *ip, gboolean null_any) { @@ -1054,3 +1069,1164 @@ nm_ip_route_set_attribute (NMIPRoute *route, const char *name, GVariant *value) else g_hash_table_remove (route->attributes, name); } + + +G_DEFINE_ABSTRACT_TYPE (NMSettingIPConfig, nm_setting_ip_config, NM_TYPE_SETTING) + +#define NM_SETTING_IP_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfigPrivate)) + +typedef struct { + char *method; + GPtrArray *dns; /* array of IP address strings */ + GPtrArray *dns_search; /* array of domain name strings */ + GPtrArray *addresses; /* array of NMIPAddress */ + GPtrArray *routes; /* array of NMIPRoute */ + gboolean ignore_auto_routes; + gboolean ignore_auto_dns; + char *dhcp_hostname; + gboolean dhcp_send_hostname; + gboolean never_default; + gboolean may_fail; +} NMSettingIPConfigPrivate; + +enum { + PROP_0, + PROP_METHOD, + PROP_DNS, + PROP_DNS_SEARCH, + PROP_ADDRESSES, + PROP_ROUTES, + PROP_IGNORE_AUTO_ROUTES, + PROP_IGNORE_AUTO_DNS, + PROP_DHCP_HOSTNAME, + PROP_DHCP_SEND_HOSTNAME, + PROP_NEVER_DEFAULT, + PROP_MAY_FAIL, + + LAST_PROP +}; + +#define NM_SETTING_IP_CONFIG_GET_FAMILY(setting) (NM_IS_SETTING_IP4_CONFIG (setting) ? AF_INET : AF_INET6) + +/** + * nm_setting_ip_config_get_method: + * @setting: the #NMSettingIPConfig + * + * Returns: the #NMSettingIPConfig:method property of the setting; see + * #NMSettingIP4Config and #NMSettingIP6Config for details of the + * methods available with each type. + **/ +const char * +nm_setting_ip_config_get_method (NMSettingIPConfig *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL); + + return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->method; +} + +/** + * nm_setting_ip_config_get_num_dns: + * @setting: the #NMSettingIPConfig + * + * Returns: the number of configured DNS servers + **/ +guint +nm_setting_ip_config_get_num_dns (NMSettingIPConfig *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), 0); + + return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->dns->len; +} + +/** + * nm_setting_ip_config_get_dns: + * @setting: the #NMSettingIPConfig + * @i: index number of the DNS server to return + * + * Returns: the IP address of the DNS server at index @i + **/ +const char * +nm_setting_ip_config_get_dns (NMSettingIPConfig *setting, int i) +{ + NMSettingIPConfigPrivate *priv; + + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + g_return_val_if_fail (i < priv->dns->len, NULL); + + return priv->dns->pdata[i]; +} + +/** + * nm_setting_ip_config_add_dns: + * @setting: the #NMSettingIPConfig + * @dns: the IP address of the DNS server to add + * + * Adds a new DNS server to the setting. + * + * Returns: %TRUE if the DNS server was added; %FALSE if the server was already + * known + **/ +gboolean +nm_setting_ip_config_add_dns (NMSettingIPConfig *setting, const char *dns) +{ + NMSettingIPConfigPrivate *priv; + char *dns_canonical; + int i; + + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + g_return_val_if_fail (dns != NULL, FALSE); + g_return_val_if_fail (nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns), FALSE); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + + dns_canonical = canonicalize_ip (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns, FALSE); + for (i = 0; i < priv->dns->len; i++) { + if (!strcmp (dns_canonical, priv->dns->pdata[i])) { + g_free (dns_canonical); + return FALSE; + } + } + + g_ptr_array_add (priv->dns, dns_canonical); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS); + return TRUE; +} + +/** + * nm_setting_ip_config_remove_dns: + * @setting: the #NMSettingIPConfig + * @i: index number of the DNS server to remove + * + * Removes the DNS server at index @i. + **/ +void +nm_setting_ip_config_remove_dns (NMSettingIPConfig *setting, int i) +{ + NMSettingIPConfigPrivate *priv; + + g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting)); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + g_return_if_fail (i < priv->dns->len); + + g_ptr_array_remove_index (priv->dns, i); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS); +} + +/** + * nm_setting_ip_config_remove_dns_by_value: + * @setting: the #NMSettingIPConfig + * @dns: the DNS server to remove + * + * Removes the DNS server @dns. + * + * Returns: %TRUE if the DNS server was found and removed; %FALSE if it was not. + **/ +gboolean +nm_setting_ip_config_remove_dns_by_value (NMSettingIPConfig *setting, const char *dns) +{ + NMSettingIPConfigPrivate *priv; + char *dns_canonical; + int i; + + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + g_return_val_if_fail (dns != NULL, FALSE); + g_return_val_if_fail (nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns), FALSE); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + + dns_canonical = canonicalize_ip (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns, FALSE); + for (i = 0; i < priv->dns->len; i++) { + if (!strcmp (dns_canonical, priv->dns->pdata[i])) { + g_ptr_array_remove_index (priv->dns, i); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS); + g_free (dns_canonical); + return TRUE; + } + } + g_free (dns_canonical); + return FALSE; +} + +/** + * nm_setting_ip_config_clear_dns: + * @setting: the #NMSettingIPConfig + * + * Removes all configured DNS servers. + **/ +void +nm_setting_ip_config_clear_dns (NMSettingIPConfig *setting) +{ + NMSettingIPConfigPrivate *priv; + + g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting)); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + g_ptr_array_set_size (priv->dns, 0); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS); +} + +/** + * nm_setting_ip_config_get_num_dns_searches: + * @setting: the #NMSettingIPConfig + * + * Returns: the number of configured DNS search domains + **/ +guint +nm_setting_ip_config_get_num_dns_searches (NMSettingIPConfig *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), 0); + + return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->dns_search->len; +} + +/** + * nm_setting_ip_config_get_dns_search: + * @setting: the #NMSettingIPConfig + * @i: index number of the DNS search domain to return + * + * Returns: the DNS search domain at index @i + **/ +const char * +nm_setting_ip_config_get_dns_search (NMSettingIPConfig *setting, int i) +{ + NMSettingIPConfigPrivate *priv; + + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + g_return_val_if_fail (i < priv->dns_search->len, NULL); + + return priv->dns_search->pdata[i]; +} + +/** + * nm_setting_ip_config_add_dns_search: + * @setting: the #NMSettingIPConfig + * @dns_search: the search domain to add + * + * Adds a new DNS search domain to the setting. + * + * Returns: %TRUE if the DNS search domain was added; %FALSE if the search + * domain was already known + **/ +gboolean +nm_setting_ip_config_add_dns_search (NMSettingIPConfig *setting, + const char *dns_search) +{ + NMSettingIPConfigPrivate *priv; + int i; + + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + g_return_val_if_fail (dns_search != NULL, FALSE); + g_return_val_if_fail (dns_search[0] != '\0', FALSE); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + for (i = 0; i < priv->dns_search->len; i++) { + if (!strcmp (dns_search, priv->dns_search->pdata[i])) + return FALSE; + } + + g_ptr_array_add (priv->dns_search, g_strdup (dns_search)); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS_SEARCH); + return TRUE; +} + +/** + * nm_setting_ip_config_remove_dns_search: + * @setting: the #NMSettingIPConfig + * @i: index number of the DNS search domain + * + * Removes the DNS search domain at index @i. + **/ +void +nm_setting_ip_config_remove_dns_search (NMSettingIPConfig *setting, int i) +{ + NMSettingIPConfigPrivate *priv; + + g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting)); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + g_return_if_fail (i < priv->dns_search->len); + + g_ptr_array_remove_index (priv->dns_search, i); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS_SEARCH); +} + +/** + * nm_setting_ip_config_remove_dns_search_by_value: + * @setting: the #NMSettingIPConfig + * @dns_search: the search domain to remove + * + * Removes the DNS search domain @dns_search. + * + * Returns: %TRUE if the DNS search domain was found and removed; %FALSE if it was not. + * + * Since 0.9.10 + **/ +gboolean +nm_setting_ip_config_remove_dns_search_by_value (NMSettingIPConfig *setting, + const char *dns_search) +{ + NMSettingIPConfigPrivate *priv; + int i; + + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + g_return_val_if_fail (dns_search != NULL, FALSE); + g_return_val_if_fail (dns_search[0] != '\0', FALSE); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + for (i = 0; i < priv->dns_search->len; i++) { + if (!strcmp (dns_search, priv->dns_search->pdata[i])) { + g_ptr_array_remove_index (priv->dns_search, i); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS_SEARCH); + return TRUE; + } + } + return FALSE; +} + +/** + * nm_setting_ip_config_clear_dns_searches: + * @setting: the #NMSettingIPConfig + * + * Removes all configured DNS search domains. + **/ +void +nm_setting_ip_config_clear_dns_searches (NMSettingIPConfig *setting) +{ + NMSettingIPConfigPrivate *priv; + + g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting)); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + g_ptr_array_set_size (priv->dns_search, 0); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS_SEARCH); +} + +/** + * nm_setting_ip_config_get_num_addresses: + * @setting: the #NMSettingIPConfig + * + * Returns: the number of configured addresses + **/ +guint +nm_setting_ip_config_get_num_addresses (NMSettingIPConfig *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), 0); + + return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->addresses->len; +} + +/** + * nm_setting_ip_config_get_address: + * @setting: the #NMSettingIPConfig + * @i: index number of the address to return + * + * Returns: the address at index @i + **/ +NMIPAddress * +nm_setting_ip_config_get_address (NMSettingIPConfig *setting, int i) +{ + NMSettingIPConfigPrivate *priv; + + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + g_return_val_if_fail (i < priv->addresses->len, NULL); + + return priv->addresses->pdata[i]; +} + +/** + * nm_setting_ip_config_add_address: + * @setting: the #NMSettingIPConfig + * @address: the new address to add + * + * Adds a new IP address and associated information to the setting. The + * given address is duplicated internally and is not changed by this function. + * + * Returns: %TRUE if the address was added; %FALSE if the address was already + * known. + **/ +gboolean +nm_setting_ip_config_add_address (NMSettingIPConfig *setting, + NMIPAddress *address) +{ + NMSettingIPConfigPrivate *priv; + int i; + + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + g_return_val_if_fail (address != NULL, FALSE); + g_return_val_if_fail (address->family == NM_SETTING_IP_CONFIG_GET_FAMILY (setting), FALSE); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + for (i = 0; i < priv->addresses->len; i++) { + if (nm_ip_address_equal (priv->addresses->pdata[i], address)) + return FALSE; + } + + g_ptr_array_add (priv->addresses, nm_ip_address_dup (address)); + + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ADDRESSES); + return TRUE; +} + +/** + * nm_setting_ip_config_remove_address: + * @setting: the #NMSettingIPConfig + * @i: index number of the address to remove + * + * Removes the address at index @i. + **/ +void +nm_setting_ip_config_remove_address (NMSettingIPConfig *setting, int i) +{ + NMSettingIPConfigPrivate *priv; + + g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting)); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + g_return_if_fail (i < priv->addresses->len); + + g_ptr_array_remove_index (priv->addresses, i); + + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ADDRESSES); +} + +/** + * nm_setting_ip_config_remove_address_by_value: + * @setting: the #NMSettingIPConfig + * @address: the IP address to remove + * + * Removes the address @address. + * + * Returns: %TRUE if the address was found and removed; %FALSE if it was not. + **/ +gboolean +nm_setting_ip_config_remove_address_by_value (NMSettingIPConfig *setting, + NMIPAddress *address) +{ + NMSettingIPConfigPrivate *priv; + int i; + + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + g_return_val_if_fail (address != NULL, FALSE); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + for (i = 0; i < priv->addresses->len; i++) { + if (nm_ip_address_equal (priv->addresses->pdata[i], address)) { + g_ptr_array_remove_index (priv->addresses, i); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ADDRESSES); + return TRUE; + } + } + return FALSE; +} + +/** + * nm_setting_ip_config_clear_addresses: + * @setting: the #NMSettingIPConfig + * + * Removes all configured addresses. + **/ +void +nm_setting_ip_config_clear_addresses (NMSettingIPConfig *setting) +{ + NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + + g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting)); + + g_ptr_array_set_size (priv->addresses, 0); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ADDRESSES); +} + +/** + * nm_setting_ip_config_get_num_routes: + * @setting: the #NMSettingIPConfig + * + * Returns: the number of configured routes + **/ +guint +nm_setting_ip_config_get_num_routes (NMSettingIPConfig *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), 0); + + return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->routes->len; +} + +/** + * nm_setting_ip_config_get_route: + * @setting: the #NMSettingIPConfig + * @i: index number of the route to return + * + * Returns: the route at index @i + **/ +NMIPRoute * +nm_setting_ip_config_get_route (NMSettingIPConfig *setting, int i) +{ + NMSettingIPConfigPrivate *priv; + + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + g_return_val_if_fail (i < priv->routes->len, NULL); + + return priv->routes->pdata[i]; +} + +/** + * nm_setting_ip_config_add_route: + * @setting: the #NMSettingIPConfig + * @route: the route to add + * + * Adds a new route and associated information to the setting. The + * given route is duplicated internally and is not changed by this function. + * + * Returns: %TRUE if the route was added; %FALSE if the route was already known. + **/ +gboolean +nm_setting_ip_config_add_route (NMSettingIPConfig *setting, + NMIPRoute *route) +{ + NMSettingIPConfigPrivate *priv; + int i; + + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + g_return_val_if_fail (route != NULL, FALSE); + g_return_val_if_fail (route->family == NM_SETTING_IP_CONFIG_GET_FAMILY (setting), FALSE); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + for (i = 0; i < priv->routes->len; i++) { + if (nm_ip_route_equal (priv->routes->pdata[i], route)) + return FALSE; + } + + g_ptr_array_add (priv->routes, nm_ip_route_dup (route)); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ROUTES); + return TRUE; +} + +/** + * nm_setting_ip_config_remove_route: + * @setting: the #NMSettingIPConfig + * @i: index number of the route + * + * Removes the route at index @i. + **/ +void +nm_setting_ip_config_remove_route (NMSettingIPConfig *setting, int i) +{ + NMSettingIPConfigPrivate *priv; + + g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting)); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + g_return_if_fail (i < priv->routes->len); + + g_ptr_array_remove_index (priv->routes, i); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ROUTES); +} + +/** + * nm_setting_ip_config_remove_route_by_value: + * @setting: the #NMSettingIPConfig + * @route: the route to remove + * + * Removes the route @route. + * + * Returns: %TRUE if the route was found and removed; %FALSE if it was not. + **/ +gboolean +nm_setting_ip_config_remove_route_by_value (NMSettingIPConfig *setting, + NMIPRoute *route) +{ + NMSettingIPConfigPrivate *priv; + int i; + + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + g_return_val_if_fail (route != NULL, FALSE); + + priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + for (i = 0; i < priv->routes->len; i++) { + if (nm_ip_route_equal (priv->routes->pdata[i], route)) { + g_ptr_array_remove_index (priv->routes, i); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ROUTES); + return TRUE; + } + } + return FALSE; +} + +/** + * nm_setting_ip_config_clear_routes: + * @setting: the #NMSettingIPConfig + * + * Removes all configured routes. + **/ +void +nm_setting_ip_config_clear_routes (NMSettingIPConfig *setting) +{ + NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + + g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting)); + + g_ptr_array_set_size (priv->routes, 0); + g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ROUTES); +} + +/** + * nm_setting_ip_config_get_ignore_auto_routes: + * @setting: the #NMSettingIPConfig + * + * Returns the value contained in the #NMSettingIPConfig:ignore-auto-routes + * property. + * + * Returns: %TRUE if automatically configured (ie via DHCP) routes should be + * ignored. + **/ +gboolean +nm_setting_ip_config_get_ignore_auto_routes (NMSettingIPConfig *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + + return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->ignore_auto_routes; +} + +/** + * nm_setting_ip_config_get_ignore_auto_dns: + * @setting: the #NMSettingIPConfig + * + * Returns the value contained in the #NMSettingIPConfig:ignore-auto-dns + * property. + * + * Returns: %TRUE if automatically configured (ie via DHCP) DNS information + * should be ignored. + **/ +gboolean +nm_setting_ip_config_get_ignore_auto_dns (NMSettingIPConfig *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + + return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->ignore_auto_dns; +} + +/** + * nm_setting_ip_config_get_dhcp_hostname: + * @setting: the #NMSettingIPConfig + * + * Returns the value contained in the #NMSettingIPConfig:dhcp-hostname + * property. + * + * Returns: the configured hostname to send to the DHCP server + **/ +const char * +nm_setting_ip_config_get_dhcp_hostname (NMSettingIPConfig *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL); + + return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->dhcp_hostname; +} + +/** + * nm_setting_ip_config_get_dhcp_send_hostname: + * @setting: the #NMSettingIPConfig + * + * Returns the value contained in the #NMSettingIPConfig:dhcp-send-hostname + * property. + * + * Returns: %TRUE if NetworkManager should send the machine hostname to the + * DHCP server when requesting addresses to allow the server to automatically + * update DNS information for this machine. + **/ +gboolean +nm_setting_ip_config_get_dhcp_send_hostname (NMSettingIPConfig *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + + return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->dhcp_send_hostname; +} + +/** + * nm_setting_ip_config_get_never_default: + * @setting: the #NMSettingIPConfig + * + * Returns the value contained in the #NMSettingIPConfig:never-default + * property. + * + * Returns: %TRUE if this connection should never be the default + * connection + **/ +gboolean +nm_setting_ip_config_get_never_default (NMSettingIPConfig *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + + return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->never_default; +} + +/** + * nm_setting_ip_config_get_may_fail: + * @setting: the #NMSettingIPConfig + * + * Returns the value contained in the #NMSettingIPConfig:may-fail + * property. + * + * Returns: %TRUE if this connection doesn't require this type of IP + * addressing to complete for the connection to succeed. + **/ +gboolean +nm_setting_ip_config_get_may_fail (NMSettingIPConfig *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE); + + return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->may_fail; +} + +static gboolean +verify_label (const char *label) +{ + const char *p; + char *iface; + + p = strchr (label, ':'); + if (!p) + return FALSE; + iface = g_strndup (label, p - label); + if (!nm_utils_iface_valid_name (iface)) { + g_free (iface); + return FALSE; + } + g_free (iface); + + for (p++; *p; p++) { + if (!g_ascii_isalnum (*p) && *p != '_') + return FALSE; + } + + return TRUE; +} + +static gboolean +verify (NMSetting *setting, NMConnection *connection, GError **error) +{ + NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + int i; + + if (!priv->method) { + g_set_error_literal (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_MISSING_PROPERTY, + _("property is missing")); + g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_METHOD); + return FALSE; + } + + if (priv->dhcp_hostname && !*priv->dhcp_hostname) { + g_set_error_literal (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("property is empty")); + g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_DHCP_HOSTNAME); + return FALSE; + } + + /* Validate DNS */ + for (i = 0; i < priv->dns->len; i++) { + const char *dns = priv->dns->pdata[i]; + + if (!nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns)) { + g_set_error (error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("%d. DNS server address is invalid"), + i+1); + g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_DNS); + return FALSE; + } + } + + /* Validate addresses */ + for (i = 0; i < priv->addresses->len; i++) { + NMIPAddress *addr = (NMIPAddress *) priv->addresses->pdata[i]; + GVariant *label; + + if (nm_ip_address_get_family (addr) != NM_SETTING_IP_CONFIG_GET_FAMILY (setting)) { + g_set_error (error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("%d. IP address is invalid"), + i+1); + g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_ADDRESSES); + return FALSE; + } + + label = nm_ip_address_get_attribute (addr, "label"); + if (label) { + if (!g_variant_is_of_type (label, G_VARIANT_TYPE_STRING)) { + g_set_error (error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("%d. IP address has 'label' property with invalid type"), + i+1); + g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_ADDRESSES); + return FALSE; + } + if (!verify_label (g_variant_get_string (label, NULL))) { + g_set_error (error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("%d. IP address has invalid label '%s'"), + i+1, g_variant_get_string (label, NULL)); + g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_ADDRESSES); + return FALSE; + } + } + } + + /* Validate routes */ + for (i = 0; i < priv->routes->len; i++) { + NMIPRoute *route = (NMIPRoute *) priv->routes->pdata[i]; + + if (nm_ip_route_get_family (route) != NM_SETTING_IP_CONFIG_GET_FAMILY (setting)) { + g_set_error (error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("%d. route is invalid"), + i+1); + g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_ROUTES); + return FALSE; + } + } + + return TRUE; +} + + +static void +nm_setting_ip_config_init (NMSettingIPConfig *setting) +{ + NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + + priv->dns = g_ptr_array_new_with_free_func (g_free); + priv->dns_search = g_ptr_array_new_with_free_func (g_free); + priv->addresses = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip_address_unref); + priv->routes = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip_route_unref); +} + +static void +finalize (GObject *object) +{ + NMSettingIPConfig *self = NM_SETTING_IP_CONFIG (object); + NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (self); + + g_free (priv->method); + g_free (priv->dhcp_hostname); + + g_ptr_array_unref (priv->dns); + g_ptr_array_unref (priv->dns_search); + g_ptr_array_unref (priv->addresses); + g_ptr_array_unref (priv->routes); + + G_OBJECT_CLASS (nm_setting_ip_config_parent_class)->finalize (object); +} + +static void +set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + NMSettingIPConfig *setting = NM_SETTING_IP_CONFIG (object); + NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + + switch (prop_id) { + case PROP_METHOD: + g_free (priv->method); + priv->method = g_value_dup_string (value); + break; + case PROP_DNS: + g_ptr_array_unref (priv->dns); + priv->dns = _nm_utils_strv_to_ptrarray (g_value_get_boxed (value)); + break; + case PROP_DNS_SEARCH: + g_ptr_array_unref (priv->dns_search); + priv->dns_search = _nm_utils_strv_to_ptrarray (g_value_get_boxed (value)); + break; + case PROP_ADDRESSES: + g_ptr_array_unref (priv->addresses); + priv->addresses = _nm_utils_copy_array (g_value_get_boxed (value), + (NMUtilsCopyFunc) nm_ip_address_dup, + (GDestroyNotify) nm_ip_address_unref); + break; + case PROP_ROUTES: + g_ptr_array_unref (priv->routes); + priv->routes = _nm_utils_copy_array (g_value_get_boxed (value), + (NMUtilsCopyFunc) nm_ip_route_dup, + (GDestroyNotify) nm_ip_route_unref); + break; + case PROP_IGNORE_AUTO_ROUTES: + priv->ignore_auto_routes = g_value_get_boolean (value); + break; + case PROP_IGNORE_AUTO_DNS: + priv->ignore_auto_dns = g_value_get_boolean (value); + break; + case PROP_DHCP_HOSTNAME: + g_free (priv->dhcp_hostname); + priv->dhcp_hostname = g_value_dup_string (value); + break; + case PROP_DHCP_SEND_HOSTNAME: + priv->dhcp_send_hostname = g_value_get_boolean (value); + break; + case PROP_NEVER_DEFAULT: + priv->never_default = g_value_get_boolean (value); + break; + case PROP_MAY_FAIL: + priv->may_fail = g_value_get_boolean (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + NMSettingIPConfig *setting = NM_SETTING_IP_CONFIG (object); + NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting); + + switch (prop_id) { + case PROP_METHOD: + g_value_set_string (value, nm_setting_ip_config_get_method (setting)); + break; + case PROP_DNS: + g_value_take_boxed (value, _nm_utils_ptrarray_to_strv (priv->dns)); + break; + case PROP_DNS_SEARCH: + g_value_take_boxed (value, _nm_utils_ptrarray_to_strv (priv->dns_search)); + break; + case PROP_ADDRESSES: + g_value_take_boxed (value, _nm_utils_copy_array (priv->addresses, + (NMUtilsCopyFunc) nm_ip_address_dup, + (GDestroyNotify) nm_ip_address_unref)); + break; + case PROP_ROUTES: + g_value_take_boxed (value, _nm_utils_copy_array (priv->routes, + (NMUtilsCopyFunc) nm_ip_route_dup, + (GDestroyNotify) nm_ip_route_unref)); + break; + case PROP_IGNORE_AUTO_ROUTES: + g_value_set_boolean (value, nm_setting_ip_config_get_ignore_auto_routes (setting)); + break; + case PROP_IGNORE_AUTO_DNS: + g_value_set_boolean (value, nm_setting_ip_config_get_ignore_auto_dns (setting)); + break; + case PROP_DHCP_HOSTNAME: + g_value_set_string (value, nm_setting_ip_config_get_dhcp_hostname (setting)); + break; + case PROP_DHCP_SEND_HOSTNAME: + g_value_set_boolean (value, nm_setting_ip_config_get_dhcp_send_hostname (setting)); + break; + case PROP_NEVER_DEFAULT: + g_value_set_boolean (value, priv->never_default); + break; + case PROP_MAY_FAIL: + g_value_set_boolean (value, priv->may_fail); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +nm_setting_ip_config_class_init (NMSettingIPConfigClass *setting_class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (setting_class); + NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class); + + g_type_class_add_private (setting_class, sizeof (NMSettingIPConfigPrivate)); + + /* virtual methods */ + object_class->set_property = set_property; + object_class->get_property = get_property; + object_class->finalize = finalize; + parent_class->verify = verify; + + /* Properties */ + + /** + * NMSettingIPConfig:method: + * + * IP configuration method. + * + * #NMSettingIP4Config and #NMSettingIP6Config both support "auto", + * "manual", and "link-local". See the subclass-specific documentation for + * other values. + * + * In general, for the "auto" method, properties such as + * #NMSettingIPConfig:dns and #NMSettingIPConfig:routes specify information + * that is added on to the information returned from automatic + * configuration. The #NMSettingIPConfig:ignore-auto-routes and + * #NMSettingIPConfig:ignore-auto-dns properties modify this behavior. + * + * For methods that imply no upstream network, such as "shared" or + * "link-local", these properties must be empty. + **/ + g_object_class_install_property + (object_class, PROP_METHOD, + g_param_spec_string (NM_SETTING_IP_CONFIG_METHOD, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIPConfig:dns: + * + * Array of IP addresses of DNS servers. + **/ + g_object_class_install_property + (object_class, PROP_DNS, + g_param_spec_boxed (NM_SETTING_IP_CONFIG_DNS, "", "", + G_TYPE_STRV, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIPConfig:dns-search: + * + * Array of DNS search domains. + **/ + g_object_class_install_property + (object_class, PROP_DNS_SEARCH, + g_param_spec_boxed (NM_SETTING_IP_CONFIG_DNS_SEARCH, "", "", + G_TYPE_STRV, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIPConfig:addresses: + * + * Array of IP addresses. + * + * Element-Type: NMIPAddress + **/ + g_object_class_install_property + (object_class, PROP_ADDRESSES, + g_param_spec_boxed (NM_SETTING_IP_CONFIG_ADDRESSES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIPConfig:routes: + * + * Array of IP routes. + * + * Element-Type: NMIPRoute + **/ + g_object_class_install_property + (object_class, PROP_ROUTES, + g_param_spec_boxed (NM_SETTING_IP_CONFIG_ROUTES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIPConfig:ignore-auto-routes: + * + * When #NMSettingIPConfig:method is set to "auto" and this property to + * %TRUE, automatically configured routes are ignored and only routes + * specified in the #NMSettingIPConfig:routes property, if any, are used. + **/ + g_object_class_install_property + (object_class, PROP_IGNORE_AUTO_ROUTES, + g_param_spec_boolean (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIPConfig:ignore-auto-dns: + * + * When #NMSettingIPConfig:method is set to "auto" and this property to + * %TRUE, automatically configured nameservers and search domains are + * ignored and only nameservers and search domains specified in the + * #NMSettingIPConfig:dns and #NMSettingIPConfig:dns-search properties, if + * any, are used. + **/ + g_object_class_install_property + (object_class, PROP_IGNORE_AUTO_DNS, + g_param_spec_boolean (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIPConfig:dhcp-hostname: + * + * If the #NMSettingIPConfig:dhcp-send-hostname property is %TRUE, then the + * specified name will be sent to the DHCP server when acquiring a lease. + **/ + g_object_class_install_property + (object_class, PROP_DHCP_HOSTNAME, + g_param_spec_string (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIPConfig:dhcp-send-hostname: + * + * If %TRUE, a hostname is sent to the DHCP server when acquiring a lease. + * Some DHCP servers use this hostname to update DNS databases, essentially + * providing a static hostname for the computer. If the + * #NMSettingIPConfig:dhcp-hostname property is %NULL and this property is + * %TRUE, the current persistent hostname of the computer is sent. + **/ + g_object_class_install_property + (object_class, PROP_DHCP_SEND_HOSTNAME, + g_param_spec_boolean (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIPConfig:never-default: + * + * If %TRUE, this connection will never be the default connection for this + * IP type, meaning it will never be assigned the default route by + * NetworkManager. + **/ + g_object_class_install_property + (object_class, PROP_NEVER_DEFAULT, + g_param_spec_boolean (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIPConfig:may-fail: + * + * If %TRUE, allow overall network configuration to proceed even if the + * configuration specified by this property times out. Note that at least + * one IP configuration must succeed or overall network configuration will + * still fail. For example, in IPv6-only networks, setting this property to + * %TRUE on the #NMSettingIP4Config allows the overall network configuration + * to succeed if IPv4 configuration fails but IPv6 configuration completes + * successfully. + **/ + g_object_class_install_property + (object_class, PROP_MAY_FAIL, + g_param_spec_boolean (NM_SETTING_IP_CONFIG_MAY_FAIL, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); +} diff --git a/libnm-core/nm-setting-ip-config.h b/libnm-core/nm-setting-ip-config.h index 24c1cbda42..0f2d16367c 100644 --- a/libnm-core/nm-setting-ip-config.h +++ b/libnm-core/nm-setting-ip-config.h @@ -127,6 +127,94 @@ void nm_ip_route_set_attribute (NMIPRoute *route, const char *name, GVariant *value); + +#define NM_TYPE_SETTING_IP_CONFIG (nm_setting_ip_config_get_type ()) +#define NM_SETTING_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfig)) +#define NM_SETTING_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_IPCONFIG, NMSettingIPConfigClass)) +#define NM_IS_SETTING_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_IP_CONFIG)) +#define NM_IS_SETTING_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_IP_CONFIG)) +#define NM_SETTING_IP_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfigClass)) + +#define NM_SETTING_IP_CONFIG_METHOD "method" +#define NM_SETTING_IP_CONFIG_DNS "dns" +#define NM_SETTING_IP_CONFIG_DNS_SEARCH "dns-search" +#define NM_SETTING_IP_CONFIG_ADDRESSES "addresses" +#define NM_SETTING_IP_CONFIG_ROUTES "routes" +#define NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes" +#define NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns" +#define NM_SETTING_IP_CONFIG_DHCP_HOSTNAME "dhcp-hostname" +#define NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname" +#define NM_SETTING_IP_CONFIG_NEVER_DEFAULT "never-default" +#define NM_SETTING_IP_CONFIG_MAY_FAIL "may-fail" + +struct _NMSettingIPConfig { + NMSetting parent; +}; + +typedef struct { + NMSettingClass parent; + + /* Padding for future expansion */ + gpointer padding[8]; +} NMSettingIPConfigClass; + +GType nm_setting_ip_config_get_type (void); + +const char *nm_setting_ip_config_get_method (NMSettingIPConfig *setting); + +guint nm_setting_ip_config_get_num_dns (NMSettingIPConfig *setting); +const char *nm_setting_ip_config_get_dns (NMSettingIPConfig *setting, + int i); +gboolean nm_setting_ip_config_add_dns (NMSettingIPConfig *setting, + const char *dns); +void nm_setting_ip_config_remove_dns (NMSettingIPConfig *setting, + int i); +gboolean nm_setting_ip_config_remove_dns_by_value (NMSettingIPConfig *setting, + const char *dns); +void nm_setting_ip_config_clear_dns (NMSettingIPConfig *setting); + +guint nm_setting_ip_config_get_num_dns_searches (NMSettingIPConfig *setting); +const char *nm_setting_ip_config_get_dns_search (NMSettingIPConfig *setting, + int i); +gboolean nm_setting_ip_config_add_dns_search (NMSettingIPConfig *setting, + const char *dns_search); +void nm_setting_ip_config_remove_dns_search (NMSettingIPConfig *setting, + int i); +gboolean nm_setting_ip_config_remove_dns_search_by_value (NMSettingIPConfig *setting, + const char *dns_search); +void nm_setting_ip_config_clear_dns_searches (NMSettingIPConfig *setting); + +guint nm_setting_ip_config_get_num_addresses (NMSettingIPConfig *setting); +NMIPAddress *nm_setting_ip_config_get_address (NMSettingIPConfig *setting, + int i); +gboolean nm_setting_ip_config_add_address (NMSettingIPConfig *setting, + NMIPAddress *address); +void nm_setting_ip_config_remove_address (NMSettingIPConfig *setting, + int i); +gboolean nm_setting_ip_config_remove_address_by_value (NMSettingIPConfig *setting, + NMIPAddress *address); +void nm_setting_ip_config_clear_addresses (NMSettingIPConfig *setting); + +guint nm_setting_ip_config_get_num_routes (NMSettingIPConfig *setting); +NMIPRoute *nm_setting_ip_config_get_route (NMSettingIPConfig *setting, + int i); +gboolean nm_setting_ip_config_add_route (NMSettingIPConfig *setting, + NMIPRoute *route); +void nm_setting_ip_config_remove_route (NMSettingIPConfig *setting, + int i); +gboolean nm_setting_ip_config_remove_route_by_value (NMSettingIPConfig *setting, + NMIPRoute *route); +void nm_setting_ip_config_clear_routes (NMSettingIPConfig *setting); + +gboolean nm_setting_ip_config_get_ignore_auto_routes (NMSettingIPConfig *setting); +gboolean nm_setting_ip_config_get_ignore_auto_dns (NMSettingIPConfig *setting); + +const char *nm_setting_ip_config_get_dhcp_hostname (NMSettingIPConfig *setting); +gboolean nm_setting_ip_config_get_dhcp_send_hostname (NMSettingIPConfig *setting); + +gboolean nm_setting_ip_config_get_never_default (NMSettingIPConfig *setting); +gboolean nm_setting_ip_config_get_may_fail (NMSettingIPConfig *setting); + G_END_DECLS #endif /* NM_SETTING_IP_CONFIG_H */ diff --git a/libnm-core/nm-setting-ip4-config.c b/libnm-core/nm-setting-ip4-config.c index e15dae0491..068ba0451a 100644 --- a/libnm-core/nm-setting-ip4-config.c +++ b/libnm-core/nm-setting-ip4-config.c @@ -16,64 +16,52 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * Copyright 2007 - 2014 Red Hat, Inc. - * Copyright 2007 - 2008 Novell, Inc. + * Copyright 2014 Red Hat, Inc. */ #include <string.h> #include <glib/gi18n.h> -#include <arpa/inet.h> #include "nm-setting-ip4-config.h" -#include "nm-utils.h" -#include "nm-glib-compat.h" #include "nm-setting-private.h" -#include "nm-core-internal.h" -#include "nm-utils-private.h" /** * SECTION:nm-setting-ip4-config * @short_description: Describes IPv4 addressing, routing, and name service properties * * The #NMSettingIP4Config object is a #NMSetting subclass that describes - * properties related to IPv4 addressing, routing, and Domain Name Service - **/ - -G_DEFINE_TYPE_WITH_CODE (NMSettingIP4Config, nm_setting_ip4_config, NM_TYPE_SETTING, + * properties related to IPv4 addressing, routing, and Domain Name Service. + * + * #NMSettingIP4Config has few properties or methods of its own; it inherits + * almost everything from #NMSettingIPConfig. + * + * NetworkManager supports 5 values for the #NMSettingIPConfig:method property + * for IPv4. If "auto" is specified then the appropriate automatic method + * (DHCP, PPP, etc) is used for the interface and most other properties can be + * left unset. If "link-local" is specified, then a link-local address in the + * 169.254/16 range will be assigned to the interface. If "manual" is + * specified, static IP addressing is used and at least one IP address must be + * given in the "addresses" property. If "shared" is specified (indicating that + * this connection will provide network access to other computers) then the + * interface is assigned an address in the 10.42.x.1/24 range and a DHCP and + * forwarding DNS server are started, and the interface is NAT-ed to the current + * default network connection. "disabled" means IPv4 will not be used on this + * connection. + **/ + +G_DEFINE_TYPE_WITH_CODE (NMSettingIP4Config, nm_setting_ip4_config, NM_TYPE_SETTING_IP_CONFIG, _nm_register_setting (IP4_CONFIG, 4)) NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_IP4_CONFIG) #define NM_SETTING_IP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_IP4_CONFIG, NMSettingIP4ConfigPrivate)) typedef struct { - char *method; - GSList *dns; /* list of IP address strings */ - GSList *dns_search; /* list of strings */ - GSList *addresses; /* array of NMIPAddress */ - GSList *routes; /* array of NMIPRoute */ - gboolean ignore_auto_routes; - gboolean ignore_auto_dns; char *dhcp_client_id; - gboolean dhcp_send_hostname; - char *dhcp_hostname; - gboolean never_default; - gboolean may_fail; } NMSettingIP4ConfigPrivate; enum { PROP_0, - PROP_METHOD, - PROP_DNS, - PROP_DNS_SEARCH, - PROP_ADDRESSES, - PROP_ROUTES, - PROP_IGNORE_AUTO_ROUTES, - PROP_IGNORE_AUTO_DNS, PROP_DHCP_CLIENT_ID, - PROP_DHCP_SEND_HOSTNAME, - PROP_DHCP_HOSTNAME, - PROP_NEVER_DEFAULT, - PROP_MAY_FAIL, LAST_PROP }; @@ -92,632 +80,6 @@ nm_setting_ip4_config_new (void) } /** - * nm_setting_ip4_config_get_method: - * @setting: the #NMSettingIP4Config - * - * Returns: the #NMSettingIP4Config:method property of the setting - **/ -const char * -nm_setting_ip4_config_get_method (NMSettingIP4Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL); - - return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->method; -} - -/** - * nm_setting_ip4_config_get_num_dns: - * @setting: the #NMSettingIP4Config - * - * Returns: the number of configured DNS servers - **/ -guint32 -nm_setting_ip4_config_get_num_dns (NMSettingIP4Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), 0); - - return g_slist_length (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns); -} - -/** - * nm_setting_ip4_config_get_dns: - * @setting: the #NMSettingIP4Config - * @i: index number of the DNS server to return - * - * Returns: the IPv4 address of the DNS server at index @i - **/ -const char * -nm_setting_ip4_config_get_dns (NMSettingIP4Config *setting, guint32 i) -{ - NMSettingIP4ConfigPrivate *priv; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - g_return_val_if_fail (i < g_slist_length (priv->dns), NULL); - - return (const char *) g_slist_nth_data (priv->dns, i); -} - -static const char * -canonicalize_ip (const char *ip) -{ - in_addr_t addr; - int ret; - - ret = inet_pton (AF_INET, ip, &addr); - g_return_val_if_fail (ret == 1, NULL); - return nm_utils_inet4_ntop (addr, NULL); -} - -/** - * nm_setting_ip4_config_add_dns: - * @setting: the #NMSettingIP4Config - * @dns: the IPv4 address of the DNS server to add - * - * Adds a new DNS server to the setting. - * - * Returns: %TRUE if the DNS server was added; %FALSE if the server was already - * known - **/ -gboolean -nm_setting_ip4_config_add_dns (NMSettingIP4Config *setting, const char *dns) -{ - NMSettingIP4ConfigPrivate *priv; - const char *dns_canonical; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - g_return_val_if_fail (dns != NULL, FALSE); - g_return_val_if_fail (dns[0] != '\0', FALSE); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - - dns_canonical = canonicalize_ip (dns); - g_return_val_if_fail (dns_canonical != NULL, FALSE); - - for (iter = priv->dns; iter; iter = g_slist_next (iter)) { - if (!strcmp (dns_canonical, (char *) iter->data)) - return FALSE; - } - - priv->dns = g_slist_append (priv->dns, g_strdup (dns_canonical)); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS); - return TRUE; -} - -/** - * nm_setting_ip4_config_remove_dns: - * @setting: the #NMSettingIP4Config - * @i: index number of the DNS server to remove - * - * Removes the DNS server at index @i. - **/ -void -nm_setting_ip4_config_remove_dns (NMSettingIP4Config *setting, guint32 i) -{ - NMSettingIP4ConfigPrivate *priv; - GSList *elt; - - g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting)); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - elt = g_slist_nth (priv->dns, i); - g_return_if_fail (elt != NULL); - - g_free (elt->data); - priv->dns = g_slist_delete_link (priv->dns, elt); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS); -} - -/** - * nm_setting_ip4_config_remove_dns_by_value: - * @setting: the #NMSettingIP4Config - * @dns: the DNS server to remove - * - * Removes the DNS server @dns. - * - * Returns: %TRUE if the DNS server was found and removed; %FALSE if it was not. - **/ -gboolean -nm_setting_ip4_config_remove_dns_by_value (NMSettingIP4Config *setting, const char *dns) -{ - NMSettingIP4ConfigPrivate *priv; - const char *dns_canonical; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - g_return_val_if_fail (dns != NULL, FALSE); - g_return_val_if_fail (dns[0] != '\0', FALSE); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - - dns_canonical = canonicalize_ip (dns); - g_return_val_if_fail (dns_canonical != NULL, FALSE); - - for (iter = priv->dns; iter; iter = g_slist_next (iter)) { - if (!strcmp (dns_canonical, (char *) iter->data)) { - priv->dns = g_slist_delete_link (priv->dns, iter); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS); - return TRUE; - } - } - return FALSE; -} - -/** - * nm_setting_ip4_config_clear_dns: - * @setting: the #NMSettingIP4Config - * - * Removes all configured DNS servers. - **/ -void -nm_setting_ip4_config_clear_dns (NMSettingIP4Config *setting) -{ - g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting)); - - g_slist_free_full (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns, g_free); - NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns = NULL; - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS); -} - -/** - * nm_setting_ip4_config_get_num_dns_searches: - * @setting: the #NMSettingIP4Config - * - * Returns: the number of configured DNS search domains - **/ -guint32 -nm_setting_ip4_config_get_num_dns_searches (NMSettingIP4Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), 0); - - return g_slist_length (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search); -} - -/** - * nm_setting_ip4_config_get_dns_search: - * @setting: the #NMSettingIP4Config - * @i: index number of the DNS search domain to return - * - * Returns: the DNS search domain at index @i - **/ -const char * -nm_setting_ip4_config_get_dns_search (NMSettingIP4Config *setting, guint32 i) -{ - NMSettingIP4ConfigPrivate *priv; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - g_return_val_if_fail (i < g_slist_length (priv->dns_search), NULL); - - return (const char *) g_slist_nth_data (priv->dns_search, i); -} - -/** - * nm_setting_ip4_config_add_dns_search: - * @setting: the #NMSettingIP4Config - * @dns_search: the search domain to add - * - * Adds a new DNS search domain to the setting. - * - * Returns: %TRUE if the DNS search domain was added; %FALSE if the search - * domain was already known - **/ -gboolean -nm_setting_ip4_config_add_dns_search (NMSettingIP4Config *setting, - const char *dns_search) -{ - NMSettingIP4ConfigPrivate *priv; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - g_return_val_if_fail (dns_search != NULL, FALSE); - g_return_val_if_fail (dns_search[0] != '\0', FALSE); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - for (iter = priv->dns_search; iter; iter = g_slist_next (iter)) { - if (!strcmp (dns_search, (char *) iter->data)) - return FALSE; - } - - priv->dns_search = g_slist_append (priv->dns_search, g_strdup (dns_search)); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH); - return TRUE; -} - -/** - * nm_setting_ip4_config_remove_dns_search: - * @setting: the #NMSettingIP4Config - * @i: index number of the DNS search domain - * - * Removes the DNS search domain at index @i. - **/ -void -nm_setting_ip4_config_remove_dns_search (NMSettingIP4Config *setting, guint32 i) -{ - NMSettingIP4ConfigPrivate *priv; - GSList *elt; - - g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting)); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - elt = g_slist_nth (priv->dns_search, i); - g_return_if_fail (elt != NULL); - - g_free (elt->data); - priv->dns_search = g_slist_delete_link (priv->dns_search, elt); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH); -} - -/** - * nm_setting_ip4_config_remove_dns_search_by_value: - * @setting: the #NMSettingIP4Config - * @dns_search: the search domain to remove - * - * Removes the DNS search domain @dns_search. - * - * Returns: %TRUE if the DNS search domain was found and removed; %FALSE if it was not. - **/ -gboolean -nm_setting_ip4_config_remove_dns_search_by_value (NMSettingIP4Config *setting, - const char *dns_search) -{ - NMSettingIP4ConfigPrivate *priv; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - g_return_val_if_fail (dns_search != NULL, FALSE); - g_return_val_if_fail (dns_search[0] != '\0', FALSE); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - for (iter = priv->dns_search; iter; iter = g_slist_next (iter)) { - if (!strcmp (dns_search, (char *) iter->data)) { - priv->dns_search = g_slist_delete_link (priv->dns_search, iter); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH); - return TRUE; - } - } - return FALSE; -} - -/** - * nm_setting_ip4_config_clear_dns_searches: - * @setting: the #NMSettingIP4Config - * - * Removes all configured DNS search domains. - **/ -void -nm_setting_ip4_config_clear_dns_searches (NMSettingIP4Config *setting) -{ - g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting)); - - g_slist_free_full (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search, g_free); - NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search = NULL; - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH); -} - -/** - * nm_setting_ip4_config_get_num_addresses: - * @setting: the #NMSettingIP4Config - * - * Returns: the number of configured addresses - **/ -guint32 -nm_setting_ip4_config_get_num_addresses (NMSettingIP4Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), 0); - - return g_slist_length (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->addresses); -} - -/** - * nm_setting_ip4_config_get_address: - * @setting: the #NMSettingIP4Config - * @i: index number of the address to return - * - * Returns: the address at index @i - **/ -NMIPAddress * -nm_setting_ip4_config_get_address (NMSettingIP4Config *setting, guint32 i) -{ - NMSettingIP4ConfigPrivate *priv; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - g_return_val_if_fail (i < g_slist_length (priv->addresses), NULL); - - return (NMIPAddress *) g_slist_nth_data (priv->addresses, i); -} - -/** - * nm_setting_ip4_config_add_address: - * @setting: the #NMSettingIP4Config - * @address: the new address to add - * - * Adds a new IPv4 address and associated information to the setting. The - * given address is duplicated internally and is not changed by this function. - * - * Returns: %TRUE if the address was added; %FALSE if the address was already - * known. - **/ -gboolean -nm_setting_ip4_config_add_address (NMSettingIP4Config *setting, - NMIPAddress *address) -{ - NMSettingIP4ConfigPrivate *priv; - NMIPAddress *copy; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - g_return_val_if_fail (address != NULL, FALSE); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - for (iter = priv->addresses; iter; iter = g_slist_next (iter)) { - if (nm_ip_address_equal ((NMIPAddress *) iter->data, address)) - return FALSE; - } - - copy = nm_ip_address_dup (address); - priv->addresses = g_slist_append (priv->addresses, copy); - - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES); - return TRUE; -} - -/** - * nm_setting_ip4_config_remove_address: - * @setting: the #NMSettingIP4Config - * @i: index number of the address to remove - * - * Removes the address at index @i. - **/ -void -nm_setting_ip4_config_remove_address (NMSettingIP4Config *setting, guint32 i) -{ - NMSettingIP4ConfigPrivate *priv; - GSList *addr; - - g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting)); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - addr = g_slist_nth (priv->addresses, i); - g_return_if_fail (addr != NULL); - - nm_ip_address_unref ((NMIPAddress *) addr->data); - priv->addresses = g_slist_delete_link (priv->addresses, addr); - - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES); -} - -/** - * nm_setting_ip4_config_remove_address_by_value: - * @setting: the #NMSettingIP4Config - * @address: the IP address to remove - * - * Removes the address @address. - * - * Returns: %TRUE if the address was found and removed; %FALSE if it was not. - **/ -gboolean -nm_setting_ip4_config_remove_address_by_value (NMSettingIP4Config *setting, - NMIPAddress *address) -{ - NMSettingIP4ConfigPrivate *priv; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - g_return_val_if_fail (address != NULL, FALSE); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - for (iter = priv->addresses; iter; iter = g_slist_next (iter)) { - if (nm_ip_address_equal ((NMIPAddress *) iter->data, address)) { - nm_ip_address_unref ((NMIPAddress *) iter->data); - priv->addresses = g_slist_delete_link (priv->addresses, iter); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES); - return TRUE; - } - } - return FALSE; -} - -/** - * nm_setting_ip4_config_clear_addresses: - * @setting: the #NMSettingIP4Config - * - * Removes all configured addresses. - **/ -void -nm_setting_ip4_config_clear_addresses (NMSettingIP4Config *setting) -{ - NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - - g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting)); - - g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip_address_unref); - priv->addresses = NULL; - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES); -} - -/** - * nm_setting_ip4_config_get_num_routes: - * @setting: the #NMSettingIP4Config - * - * Returns: the number of configured routes - **/ -guint32 -nm_setting_ip4_config_get_num_routes (NMSettingIP4Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), 0); - - return g_slist_length (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->routes); -} - -/** - * nm_setting_ip4_config_get_route: - * @setting: the #NMSettingIP4Config - * @i: index number of the route to return - * - * Returns: the route at index @i - **/ -NMIPRoute * -nm_setting_ip4_config_get_route (NMSettingIP4Config *setting, guint32 i) -{ - NMSettingIP4ConfigPrivate *priv; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - g_return_val_if_fail (i < g_slist_length (priv->routes), NULL); - - return (NMIPRoute *) g_slist_nth_data (priv->routes, i); -} - -/** - * nm_setting_ip4_config_add_route: - * @setting: the #NMSettingIP4Config - * @route: the route to add - * - * Adds a new IPv4 route and associated information to the setting. The - * given route is duplicated internally and is not changed by this function. - * - * Returns: %TRUE if the route was added; %FALSE if the route was already known. - **/ -gboolean -nm_setting_ip4_config_add_route (NMSettingIP4Config *setting, - NMIPRoute *route) -{ - NMSettingIP4ConfigPrivate *priv; - NMIPRoute *copy; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - g_return_val_if_fail (route != NULL, FALSE); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - for (iter = priv->routes; iter; iter = g_slist_next (iter)) { - if (nm_ip_route_equal (iter->data, route)) - return FALSE; - } - - copy = nm_ip_route_dup (route); - priv->routes = g_slist_append (priv->routes, copy); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES); - return TRUE; -} - -/** - * nm_setting_ip4_config_remove_route: - * @setting: the #NMSettingIP4Config - * @i: index number of the route - * - * Removes the route at index @i. - **/ -void -nm_setting_ip4_config_remove_route (NMSettingIP4Config *setting, guint32 i) -{ - NMSettingIP4ConfigPrivate *priv; - GSList *elt; - - g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting)); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - elt = g_slist_nth (priv->routes, i); - g_return_if_fail (elt != NULL); - - nm_ip_route_unref ((NMIPRoute *) elt->data); - priv->routes = g_slist_delete_link (priv->routes, elt); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES); -} - -/** - * nm_setting_ip4_config_remove_route_by_value: - * @setting: the #NMSettingIP4Config - * @route: the route to remove - * - * Removes the route @route. - * - * Returns: %TRUE if the route was found and removed; %FALSE if it was not. - **/ -gboolean -nm_setting_ip4_config_remove_route_by_value (NMSettingIP4Config *setting, - NMIPRoute *route) -{ - NMSettingIP4ConfigPrivate *priv; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - g_return_val_if_fail (route != NULL, FALSE); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - for (iter = priv->routes; iter; iter = g_slist_next (iter)) { - if (nm_ip_route_equal ((NMIPRoute *) iter->data, route)) { - nm_ip_route_unref ((NMIPRoute *) iter->data); - priv->routes = g_slist_delete_link (priv->routes, iter); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES); - return TRUE; - } - } - return FALSE; -} - -/** - * nm_setting_ip4_config_clear_routes: - * @setting: the #NMSettingIP4Config - * - * Removes all configured routes. - **/ -void -nm_setting_ip4_config_clear_routes (NMSettingIP4Config *setting) -{ - NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - - g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting)); - - g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_route_unref); - priv->routes = NULL; - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES); -} - -/** - * nm_setting_ip4_config_get_ignore_auto_routes: - * @setting: the #NMSettingIP4Config - * - * Returns the value contained in the #NMSettingIP4Config:ignore-auto-routes - * property. - * - * Returns: %TRUE if automatically configured (ie via DHCP) routes should be - * ignored. - **/ -gboolean -nm_setting_ip4_config_get_ignore_auto_routes (NMSettingIP4Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - - return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->ignore_auto_routes; -} - -/** - * nm_setting_ip4_config_get_ignore_auto_dns: - * @setting: the #NMSettingIP4Config - * - * Returns the value contained in the #NMSettingIP4Config:ignore-auto-dns - * property. - * - * Returns: %TRUE if automatically configured (ie via DHCP) DNS information - * should be ignored. - **/ -gboolean -nm_setting_ip4_config_get_ignore_auto_dns (NMSettingIP4Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - - return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->ignore_auto_dns; -} - -/** * nm_setting_ip4_config_get_dhcp_client_id: * @setting: the #NMSettingIP4Config * @@ -735,171 +97,73 @@ nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting) return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_client_id; } -/** - * nm_setting_ip4_config_get_dhcp_send_hostname: - * @setting: the #NMSettingIP4Config - * - * Returns the value contained in the #NMSettingIP4Config:dhcp-send-hostname - * property. - * - * Returns: %TRUE if NetworkManager should send the machine hostname to the - * DHCP server when requesting addresses to allow the server to automatically - * update DNS information for this machine. - **/ -gboolean -nm_setting_ip4_config_get_dhcp_send_hostname (NMSettingIP4Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - - return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_send_hostname; -} - -/** - * nm_setting_ip4_config_get_dhcp_hostname: - * @setting: the #NMSettingIP4Config - * - * Returns the value contained in the #NMSettingIP4Config:dhcp-hostname - * property. - * - * Returns: the configured hostname to send to the DHCP server - **/ -const char * -nm_setting_ip4_config_get_dhcp_hostname (NMSettingIP4Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL); - - return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_hostname; -} - -/** - * nm_setting_ip4_config_get_never_default: - * @setting: the #NMSettingIP4Config - * - * Returns the value contained in the #NMSettingIP4Config:never-default - * property. - * - * Returns: %TRUE if this connection should never be the default connection - * for IPv4 addressing - **/ -gboolean -nm_setting_ip4_config_get_never_default (NMSettingIP4Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - - return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->never_default; -} - -/** - * nm_setting_ip4_config_get_may_fail: - * @setting: the #NMSettingIP4Config - * - * Returns the value contained in the #NMSettingIP4Config:may-fail - * property. - * - * Returns: %TRUE if this connection doesn't require IPv4 addressing to complete - * for the connection to succeed. - **/ -gboolean -nm_setting_ip4_config_get_may_fail (NMSettingIP4Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE); - - return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->may_fail; -} - -static gboolean -verify_label (const char *label) -{ - const char *p; - char *iface; - - p = strchr (label, ':'); - if (!p) - return FALSE; - iface = g_strndup (label, p - label); - if (!nm_utils_iface_valid_name (iface)) { - g_free (iface); - return FALSE; - } - g_free (iface); - - for (p++; *p; p++) { - if (!g_ascii_isalnum (*p) && *p != '_') - return FALSE; - } - - return TRUE; -} - static gboolean verify (NMSetting *setting, NMConnection *connection, GError **error) { NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - GSList *iter; - int i; + NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting); + const char *method; - if (!priv->method) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_MISSING_PROPERTY, - _("property is missing")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_METHOD); + if (!NM_SETTING_CLASS (nm_setting_ip4_config_parent_class)->verify (setting, connection, error)) return FALSE; - } - if (!strcmp (priv->method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { - if (!priv->addresses) { + method = nm_setting_ip_config_get_method (s_ip); + /* Base class already checked that it exists */ + g_assert (method); + + if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { + if (nm_setting_ip_config_get_num_addresses (s_ip) == 0) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_MISSING_PROPERTY, _("this property cannot be empty for '%s=%s'"), - NM_SETTING_IP4_CONFIG_METHOD, priv->method); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_METHOD, method); + g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES); return FALSE; } - } else if ( !strcmp (priv->method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL) - || !strcmp (priv->method, NM_SETTING_IP4_CONFIG_METHOD_SHARED) - || !strcmp (priv->method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED)) { - if (priv->dns) { + } else if ( !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL) + || !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED) + || !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED)) { + if (nm_setting_ip_config_get_num_dns (s_ip) > 0) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, _("this property is not allowed for '%s=%s'"), - NM_SETTING_IP4_CONFIG_METHOD, priv->method); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_METHOD, method); + g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS); return FALSE; } - if (priv->dns_search) { + if (nm_setting_ip_config_get_num_dns_searches (s_ip) > 0) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, _("this property is not allowed for '%s=%s'"), - NM_SETTING_IP4_CONFIG_METHOD, priv->method); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_METHOD, method); + g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS_SEARCH); return FALSE; } /* Shared allows IP addresses; link-local and disabled do not */ - if (strcmp (priv->method, NM_SETTING_IP4_CONFIG_METHOD_SHARED) != 0) { - if (priv->addresses) { + if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED) != 0) { + if (nm_setting_ip_config_get_num_addresses (s_ip) > 0) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, _("this property is not allowed for '%s=%s'"), - NM_SETTING_IP4_CONFIG_METHOD, priv->method); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_METHOD, method); + g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES); return FALSE; } } - } else if (!strcmp (priv->method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { + } else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { /* nothing to do */ } else { g_set_error_literal (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, _("property is invalid")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_METHOD); + g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_METHOD); return FALSE; } @@ -912,63 +176,9 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } - if (priv->dhcp_hostname && !strlen (priv->dhcp_hostname)) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("property is empty")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME); - return FALSE; - } - - /* Validate address labels */ - for (iter = priv->addresses, i = 0; iter; iter = g_slist_next (iter), i++) { - NMIPAddress *addr = (NMIPAddress *) iter->data; - GVariant *label; - - label = nm_ip_address_get_attribute (addr, "label"); - if (!label) - continue; - if (!g_variant_is_of_type (label, G_VARIANT_TYPE_STRING)) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("%d. IPv4 address has 'label' property with invalid type"), - i+1); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ADDRESSES); - return FALSE; - } - if (!verify_label (g_variant_get_string (label, NULL))) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("%d. IPv4 address has invalid label '%s'"), - i+1, g_variant_get_string (label, NULL)); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ADDRESSES); - return FALSE; - } - } - - /* Validate DNS */ - for (iter = priv->dns, i = 0; iter; iter = g_slist_next (iter), i++) { - const char *dns = (const char *) iter->data; - in_addr_t addr; - - if (inet_pton (AF_INET, dns, &addr) != 1) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("%d. DNS server address is invalid"), - i+1); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_DNS); - return FALSE; - } - } - return TRUE; } - static void nm_setting_ip4_config_init (NMSettingIP4Config *setting) { @@ -977,21 +187,46 @@ nm_setting_ip4_config_init (NMSettingIP4Config *setting) static void finalize (GObject *object) { - NMSettingIP4Config *self = NM_SETTING_IP4_CONFIG (object); - NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (self); + NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (object); - g_free (priv->method); - g_free (priv->dhcp_hostname); g_free (priv->dhcp_client_id); - g_slist_free_full (priv->dns, g_free); - g_slist_free_full (priv->dns_search, g_free); - g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip_address_unref); - g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_route_unref); - G_OBJECT_CLASS (nm_setting_ip4_config_parent_class)->finalize (object); } +static void +set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (object); + + switch (prop_id) { + case PROP_DHCP_CLIENT_ID: + g_free (priv->dhcp_client_id); + priv->dhcp_client_id = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (object); + + switch (prop_id) { + case PROP_DHCP_CLIENT_ID: + g_value_set_string (value, nm_setting_ip4_config_get_dhcp_client_id (s_ip4)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + static GVariant * ip4_dns_to_dbus (const GValue *prop_value) { @@ -1050,14 +285,15 @@ ip4_address_labels_get (NMSetting *setting, NMConnection *connection, const char *property) { - NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); + NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting); GPtrArray *labels; - GSList *iter; GVariant *ret; + int num_addrs, i; labels = g_ptr_array_new (); - for (iter = priv->addresses; iter; iter = iter->next) { - NMIPAddress *addr = iter->data; + num_addrs = nm_setting_ip_config_get_num_addresses (s_ip); + for (i = 0; i < num_addrs; i++) { + NMIPAddress *addr = nm_setting_ip_config_get_address (s_ip, i); GVariant *label = nm_ip_address_get_attribute (addr, "label"); g_ptr_array_add (labels, (char *) (label ? g_variant_get_string (label, NULL) : "")); @@ -1082,121 +318,12 @@ ip4_routes_from_dbus (GVariant *dbus_value, g_value_take_boxed (prop_value, nm_utils_ip4_routes_from_variant (dbus_value)); } -static void -set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - NMSettingIP4Config *setting = NM_SETTING_IP4_CONFIG (object); - NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - - switch (prop_id) { - case PROP_METHOD: - g_free (priv->method); - priv->method = g_value_dup_string (value); - break; - case PROP_DNS: - g_slist_free_full (priv->dns, g_free); - priv->dns = _nm_utils_strv_to_slist (g_value_get_boxed (value)); - break; - case PROP_DNS_SEARCH: - g_slist_free_full (priv->dns_search, g_free); - priv->dns_search = _nm_utils_strv_to_slist (g_value_get_boxed (value)); - break; - case PROP_ADDRESSES: - g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip_address_unref); - priv->addresses = _nm_utils_copy_array_to_slist (g_value_get_boxed (value), - (NMUtilsCopyFunc) nm_ip_address_dup); - - break; - case PROP_ROUTES: - g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_route_unref); - priv->routes = _nm_utils_copy_array_to_slist (g_value_get_boxed (value), - (NMUtilsCopyFunc) nm_ip_route_dup); - break; - case PROP_IGNORE_AUTO_ROUTES: - priv->ignore_auto_routes = g_value_get_boolean (value); - break; - case PROP_IGNORE_AUTO_DNS: - priv->ignore_auto_dns = g_value_get_boolean (value); - break; - case PROP_DHCP_CLIENT_ID: - g_free (priv->dhcp_client_id); - priv->dhcp_client_id = g_value_dup_string (value); - break; - case PROP_DHCP_SEND_HOSTNAME: - priv->dhcp_send_hostname = g_value_get_boolean (value); - break; - case PROP_DHCP_HOSTNAME: - g_free (priv->dhcp_hostname); - priv->dhcp_hostname = g_value_dup_string (value); - break; - case PROP_NEVER_DEFAULT: - priv->never_default = g_value_get_boolean (value); - break; - case PROP_MAY_FAIL: - priv->may_fail = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - NMSettingIP4Config *setting = NM_SETTING_IP4_CONFIG (object); - NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - - switch (prop_id) { - case PROP_METHOD: - g_value_set_string (value, nm_setting_ip4_config_get_method (setting)); - break; - case PROP_DNS: - g_value_take_boxed (value, _nm_utils_slist_to_strv (priv->dns)); - break; - case PROP_DNS_SEARCH: - g_value_take_boxed (value, _nm_utils_slist_to_strv (priv->dns_search)); - break; - case PROP_ADDRESSES: - g_value_take_boxed (value, _nm_utils_copy_slist_to_array (priv->addresses, (NMUtilsCopyFunc) nm_ip_address_dup, (GDestroyNotify) nm_ip_address_unref)); - break; - case PROP_ROUTES: - g_value_take_boxed (value, _nm_utils_copy_slist_to_array (priv->routes, (NMUtilsCopyFunc) nm_ip_route_dup, (GDestroyNotify) nm_ip_route_unref)); - break; - case PROP_IGNORE_AUTO_ROUTES: - g_value_set_boolean (value, nm_setting_ip4_config_get_ignore_auto_routes (setting)); - break; - case PROP_IGNORE_AUTO_DNS: - g_value_set_boolean (value, nm_setting_ip4_config_get_ignore_auto_dns (setting)); - break; - case PROP_DHCP_CLIENT_ID: - g_value_set_string (value, nm_setting_ip4_config_get_dhcp_client_id (setting)); - break; - case PROP_DHCP_SEND_HOSTNAME: - g_value_set_boolean (value, nm_setting_ip4_config_get_dhcp_send_hostname (setting)); - break; - case PROP_DHCP_HOSTNAME: - g_value_set_string (value, nm_setting_ip4_config_get_dhcp_hostname (setting)); - break; - case PROP_NEVER_DEFAULT: - g_value_set_boolean (value, priv->never_default); - break; - case PROP_MAY_FAIL: - g_value_set_boolean (value, priv->may_fail); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} static void -nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) +nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *ip4_class) { - GObjectClass *object_class = G_OBJECT_CLASS (setting_class); - NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class); + NMSettingClass *setting_class = NM_SETTING_CLASS (ip4_class); + GObjectClass *object_class = G_OBJECT_CLASS (ip4_class); g_type_class_add_private (setting_class, sizeof (NMSettingIP4ConfigPrivate)); @@ -1204,227 +331,46 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) object_class->set_property = set_property; object_class->get_property = get_property; object_class->finalize = finalize; - parent_class->verify = verify; + setting_class->verify = verify; + + /* properties */ - /* Properties */ /** - * NMSettingIP4Config:method: + * NMSettingIP4Config:dhcp-client-id: * - * IPv4 configuration method. If "auto" is specified then the appropriate - * automatic method (DHCP, PPP, etc) is used for the interface and most - * other properties can be left unset. If "link-local" is specified, then a - * link-local address in the 169.254/16 range will be assigned to the - * interface. If "manual" is specified, static IP addressing is used and at - * least one IP address must be given in the "addresses" property. If - * "shared" is specified (indicating that this connection will provide - * network access to other computers) then the interface is assigned an - * address in the 10.42.x.1/24 range and a DHCP and forwarding DNS server - * are started, and the interface is NAT-ed to the current default network - * connection. "disabled" means IPv4 will not be used on this connection. - * This property must be set. + * A string sent to the DHCP server to identify the local machine which the + * DHCP server may use to customize the DHCP lease and options. **/ g_object_class_install_property - (object_class, PROP_METHOD, - g_param_spec_string (NM_SETTING_IP4_CONFIG_METHOD, "", "", + (object_class, PROP_DHCP_CLIENT_ID, + g_param_spec_string (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, "", "", NULL, G_PARAM_READWRITE | - NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS)); - /** - * NMSettingIP4Config:dns: - * - * Array of IPv4 addresses of DNS servers. For the 'auto' method, these - * DNS servers are appended to those (if any) returned by automatic - * configuration. DNS servers cannot be used with the "shared", - * "link-local", or "disabled" methods as there is no upstream network. In - * all other methods, these DNS servers are used as the only DNS servers for - * this connection. - **/ - g_object_class_install_property - (object_class, PROP_DNS, - g_param_spec_boxed (NM_SETTING_IP4_CONFIG_DNS, "", "", - G_TYPE_STRV, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - _nm_setting_class_transform_property (parent_class, NM_SETTING_IP4_CONFIG_DNS, + /* IP4-specific property overrides */ + _nm_setting_class_transform_property (setting_class, + NM_SETTING_IP_CONFIG_DNS, G_VARIANT_TYPE ("au"), ip4_dns_to_dbus, ip4_dns_from_dbus); - /** - * NMSettingIP4Config:dns-search: - * - * List of DNS search domains. For the "auto" method, these search domains - * are appended to those returned by automatic configuration. Search domains - * cannot be used with the "shared", "link-local", or "disabled" methods as - * there is no upstream network. In all other methods, these search domains - * are used as the only search domains for this connection. - **/ - g_object_class_install_property - (object_class, PROP_DNS_SEARCH, - g_param_spec_boxed (NM_SETTING_IP4_CONFIG_DNS_SEARCH, "", "", - G_TYPE_STRV, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP4Config:addresses: - * - * Array of IPv4 addresses. The gateway may be left as 0 if no gateway exists - * for that subnet. For the 'auto' method, given IP addresses are appended - * to those returned by automatic configuration. Addresses cannot be used - * with the "shared", "link-local", or "disabled" methods as addressing is - * either automatic or disabled with these methods. - * - * Element-Type: NMIPAddress - **/ - g_object_class_install_property - (object_class, PROP_ADDRESSES, - g_param_spec_boxed (NM_SETTING_IP4_CONFIG_ADDRESSES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READWRITE | - NM_SETTING_PARAM_INFERRABLE | - G_PARAM_STATIC_STRINGS)); - _nm_setting_class_override_property (parent_class, NM_SETTING_IP4_CONFIG_ADDRESSES, + _nm_setting_class_override_property (setting_class, + NM_SETTING_IP_CONFIG_ADDRESSES, G_VARIANT_TYPE ("aau"), ip4_addresses_get, ip4_addresses_set, NULL); - _nm_setting_class_add_dbus_only_property (parent_class, + _nm_setting_class_add_dbus_only_property (setting_class, "address-labels", G_VARIANT_TYPE_STRING_ARRAY, ip4_address_labels_get, NULL); - /** - * NMSettingIP4Config:routes: - * - * Array of IPv4 routes. For the 'auto' method, given IP routes are appended - * to those returned by automatic configuration. Routes cannot be used with - * the 'shared', 'link-local', or 'disabled' methods because there is no - * upstream network. - * - * Element-Type: NMIPRoute - **/ - g_object_class_install_property - (object_class, PROP_ROUTES, - g_param_spec_boxed (NM_SETTING_IP4_CONFIG_ROUTES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READWRITE | - NM_SETTING_PARAM_INFERRABLE | - G_PARAM_STATIC_STRINGS)); - _nm_setting_class_transform_property (parent_class, NM_SETTING_IP4_CONFIG_ROUTES, + _nm_setting_class_transform_property (setting_class, + NM_SETTING_IP_CONFIG_ROUTES, G_VARIANT_TYPE ("aau"), ip4_routes_to_dbus, ip4_routes_from_dbus); - - /** - * NMSettingIP4Config:ignore-auto-routes: - * - * When the method is set to "auto" and this property to %TRUE, - * automatically configured routes are ignored and only routes specified in - * the #NMSettingIP4Config:routes property, if any, are used. - **/ - g_object_class_install_property - (object_class, PROP_IGNORE_AUTO_ROUTES, - g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP4Config:ignore-auto-dns: - * - * When the method is set to "auto" and this property to %TRUE, - * automatically configured nameservers and search domains are ignored and - * only nameservers and search domains specified in the - * #NMSettingIP4Config:dns and #NMSettingIP4Config:dns-search properties, if - * any, are used. - **/ - g_object_class_install_property - (object_class, PROP_IGNORE_AUTO_DNS, - g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP4Config:dhcp-client-id: - * - * A string sent to the DHCP server to identify the local machine which the - * DHCP server may use to customize the DHCP lease and options. - **/ - g_object_class_install_property - (object_class, PROP_DHCP_CLIENT_ID, - g_param_spec_string (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, "", "", - NULL, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP4Config:dhcp-send-hostname: - * - * If %TRUE, a hostname is sent to the DHCP server when acquiring a lease. - * Some DHCP servers use this hostname to update DNS databases, essentially - * providing a static hostname for the computer. If the - * #NMSettingIP4Config:dhcp-hostname property is empty and this property is - * %TRUE, the current persistent hostname of the computer is sent. - **/ - g_object_class_install_property - (object_class, PROP_DHCP_SEND_HOSTNAME, - g_param_spec_boolean (NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, "", "", - TRUE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP4Config:dhcp-hostname: - * - * If the #NMSettingIP4Config:dhcp-send-hostname property is %TRUE, then the - * specified name will be sent to the DHCP server when acquiring a lease. - **/ - g_object_class_install_property - (object_class, PROP_DHCP_HOSTNAME, - g_param_spec_string (NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, "", "", - NULL, - G_PARAM_READWRITE | - NM_SETTING_PARAM_INFERRABLE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP4Config:never-default: - * - * If %TRUE, this connection will never be the default IPv4 connection, - * meaning it will never be assigned the default route by NetworkManager. - **/ - g_object_class_install_property - (object_class, PROP_NEVER_DEFAULT, - g_param_spec_boolean (NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP4Config:may-fail: - * - * If %TRUE, allow overall network configuration to proceed even if IPv4 - * configuration times out. Note that at least one IP configuration must - * succeed or overall network configuration will still fail. For example, - * in IPv6-only networks, setting this property to %TRUE allows the overall - * network configuration to succeed if IPv4 configuration fails but IPv6 - * configuration completes successfully. - **/ - g_object_class_install_property - (object_class, PROP_MAY_FAIL, - g_param_spec_boolean (NM_SETTING_IP4_CONFIG_MAY_FAIL, "", "", - TRUE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-core/nm-setting-ip4-config.h b/libnm-core/nm-setting-ip4-config.h index f683becda5..e944dfe391 100644 --- a/libnm-core/nm-setting-ip4-config.h +++ b/libnm-core/nm-setting-ip4-config.h @@ -27,7 +27,6 @@ #error "Only <NetworkManager.h> can be included directly." #endif -#include "nm-setting.h" #include "nm-setting-ip-config.h" G_BEGIN_DECLS @@ -41,18 +40,7 @@ G_BEGIN_DECLS #define NM_SETTING_IP4_CONFIG_SETTING_NAME "ipv4" -#define NM_SETTING_IP4_CONFIG_METHOD "method" -#define NM_SETTING_IP4_CONFIG_DNS "dns" -#define NM_SETTING_IP4_CONFIG_DNS_SEARCH "dns-search" -#define NM_SETTING_IP4_CONFIG_ADDRESSES "addresses" -#define NM_SETTING_IP4_CONFIG_ROUTES "routes" -#define NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes" -#define NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns" #define NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID "dhcp-client-id" -#define NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname" -#define NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME "dhcp-hostname" -#define NM_SETTING_IP4_CONFIG_NEVER_DEFAULT "never-default" -#define NM_SETTING_IP4_CONFIG_MAY_FAIL "may-fail" /** * NM_SETTING_IP4_CONFIG_METHOD_AUTO: @@ -99,11 +87,11 @@ G_BEGIN_DECLS #define NM_SETTING_IP4_CONFIG_METHOD_DISABLED "disabled" struct _NMSettingIP4Config { - NMSetting parent; + NMSettingIPConfig parent; }; typedef struct { - NMSettingClass parent; + NMSettingIPConfigClass parent; /*< private >*/ gpointer padding[4]; @@ -111,46 +99,9 @@ typedef struct { GType nm_setting_ip4_config_get_type (void); -NMSetting * nm_setting_ip4_config_new (void); -const char * nm_setting_ip4_config_get_method (NMSettingIP4Config *setting); - -guint32 nm_setting_ip4_config_get_num_dns (NMSettingIP4Config *setting); -const char * nm_setting_ip4_config_get_dns (NMSettingIP4Config *setting, guint32 i); -gboolean nm_setting_ip4_config_add_dns (NMSettingIP4Config *setting, const char *dns); -void nm_setting_ip4_config_remove_dns (NMSettingIP4Config *setting, guint32 i); -gboolean nm_setting_ip4_config_remove_dns_by_value (NMSettingIP4Config *setting, const char *dns); -void nm_setting_ip4_config_clear_dns (NMSettingIP4Config *setting); - -guint32 nm_setting_ip4_config_get_num_dns_searches (NMSettingIP4Config *setting); -const char * nm_setting_ip4_config_get_dns_search (NMSettingIP4Config *setting, guint32 i); -gboolean nm_setting_ip4_config_add_dns_search (NMSettingIP4Config *setting, const char *dns_search); -void nm_setting_ip4_config_remove_dns_search (NMSettingIP4Config *setting, guint32 i); -gboolean nm_setting_ip4_config_remove_dns_search_by_value (NMSettingIP4Config *setting, const char *dns_search); -void nm_setting_ip4_config_clear_dns_searches (NMSettingIP4Config *setting); - -guint32 nm_setting_ip4_config_get_num_addresses (NMSettingIP4Config *setting); -NMIPAddress * nm_setting_ip4_config_get_address (NMSettingIP4Config *setting, guint32 i); -gboolean nm_setting_ip4_config_add_address (NMSettingIP4Config *setting, NMIPAddress *address); -void nm_setting_ip4_config_remove_address (NMSettingIP4Config *setting, guint32 i); -gboolean nm_setting_ip4_config_remove_address_by_value (NMSettingIP4Config *setting, NMIPAddress *address); -void nm_setting_ip4_config_clear_addresses (NMSettingIP4Config *setting); - -guint32 nm_setting_ip4_config_get_num_routes (NMSettingIP4Config *setting); -NMIPRoute * nm_setting_ip4_config_get_route (NMSettingIP4Config *setting, guint32 i); -gboolean nm_setting_ip4_config_add_route (NMSettingIP4Config *setting, NMIPRoute *route); -void nm_setting_ip4_config_remove_route (NMSettingIP4Config *setting, guint32 i); -gboolean nm_setting_ip4_config_remove_route_by_value (NMSettingIP4Config *setting, NMIPRoute *route); -void nm_setting_ip4_config_clear_routes (NMSettingIP4Config *setting); - -gboolean nm_setting_ip4_config_get_ignore_auto_routes (NMSettingIP4Config *setting); -gboolean nm_setting_ip4_config_get_ignore_auto_dns (NMSettingIP4Config *setting); -const char * nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting); -gboolean nm_setting_ip4_config_get_dhcp_send_hostname (NMSettingIP4Config *setting); -const char * nm_setting_ip4_config_get_dhcp_hostname (NMSettingIP4Config *setting); - -gboolean nm_setting_ip4_config_get_never_default (NMSettingIP4Config *setting); - -gboolean nm_setting_ip4_config_get_may_fail (NMSettingIP4Config *setting); +NMSetting *nm_setting_ip4_config_new (void); + +const char *nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting); G_END_DECLS diff --git a/libnm-core/nm-setting-ip6-config.c b/libnm-core/nm-setting-ip6-config.c index 3ac82eb4e1..dc05e541c3 100644 --- a/libnm-core/nm-setting-ip6-config.c +++ b/libnm-core/nm-setting-ip6-config.c @@ -23,9 +23,6 @@ #include <glib/gi18n.h> #include "nm-setting-ip6-config.h" -#include "nm-utils.h" -#include "nm-utils-private.h" -#include "nm-glib-compat.h" #include "nm-setting-private.h" #include "nm-core-enum-types.h" @@ -35,41 +32,35 @@ * * The #NMSettingIP6Config object is a #NMSetting subclass that describes * properties related to IPv6 addressing, routing, and Domain Name Service + * + * #NMSettingIP6Config has few properties or methods of its own; it inherits + * almost everything from #NMSettingIPConfig. + * + * NetworkManager supports 6 values for the #NMSettingIPConfig:method property + * for IPv6. If "auto" is specified then the appropriate automatic method (PPP, + * router advertisement, etc) is used for the device and most other properties + * can be left unset. To force the use of DHCP only, specify "dhcp"; this + * method is only valid for Ethernet- based hardware. If "link-local" is + * specified, then an IPv6 link-local address will be assigned to the interface. + * If "manual" is specified, static IP addressing is used and at least one IP + * address must be given in the "addresses" property. If "ignore" is specified, + * IPv6 configuration is not done. Note: the "shared" method is not yet + * supported. **/ -G_DEFINE_TYPE_WITH_CODE (NMSettingIP6Config, nm_setting_ip6_config, NM_TYPE_SETTING, +G_DEFINE_TYPE_WITH_CODE (NMSettingIP6Config, nm_setting_ip6_config, NM_TYPE_SETTING_IP_CONFIG, _nm_register_setting (IP6_CONFIG, 4)) NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_IP6_CONFIG) #define NM_SETTING_IP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_IP6_CONFIG, NMSettingIP6ConfigPrivate)) typedef struct { - char *method; - char *dhcp_hostname; - GSList *dns; /* array of struct in6_addr */ - GSList *dns_search; /* list of strings */ - GSList *addresses; /* array of NMIPAddress */ - GSList *routes; /* array of NMIPRoute */ - gboolean ignore_auto_routes; - gboolean ignore_auto_dns; - gboolean never_default; - gboolean may_fail; NMSettingIP6ConfigPrivacy ip6_privacy; } NMSettingIP6ConfigPrivate; enum { PROP_0, - PROP_METHOD, - PROP_DHCP_HOSTNAME, - PROP_DNS, - PROP_DNS_SEARCH, - PROP_ADDRESSES, - PROP_ROUTES, - PROP_IGNORE_AUTO_ROUTES, - PROP_IGNORE_AUTO_DNS, - PROP_NEVER_DEFAULT, - PROP_MAY_FAIL, PROP_IP6_PRIVACY, LAST_PROP @@ -89,683 +80,6 @@ nm_setting_ip6_config_new (void) } /** - * nm_setting_ip6_config_get_method: - * @setting: the #NMSettingIP6Config - * - * Returns: the #NMSettingIP6Config:method property of the setting - **/ -const char * -nm_setting_ip6_config_get_method (NMSettingIP6Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); - - return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->method; -} - -/** - * nm_setting_ip6_config_get_dhcp_hostname: - * @setting: the #NMSettingIP6Config - * - * Returns the value contained in the #NMSettingIP6Config:dhcp-hostname - * property. - * - * Returns: the configured hostname to send to the DHCP server - **/ -const char * -nm_setting_ip6_config_get_dhcp_hostname (NMSettingIP6Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); - - return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dhcp_hostname; -} - -/** - * nm_setting_ip6_config_get_num_dns: - * @setting: the #NMSettingIP6Config - * - * Returns: the number of configured DNS servers - **/ -guint32 -nm_setting_ip6_config_get_num_dns (NMSettingIP6Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), 0); - - return g_slist_length (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns); -} - -/** - * nm_setting_ip6_config_get_dns: - * @setting: the #NMSettingIP6Config - * @i: index number of the DNS server to return - * - * Returns: (transfer none): the IPv6 address of the DNS server at index @i - **/ -const char * -nm_setting_ip6_config_get_dns (NMSettingIP6Config *setting, guint32 i) -{ - NMSettingIP6ConfigPrivate *priv; - - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - g_return_val_if_fail (i < g_slist_length (priv->dns), NULL); - - return (const char *) g_slist_nth_data (priv->dns, i); -} - -static const char * -canonicalize_ip (const char *ip) -{ - struct in6_addr addr; - int ret; - - ret = inet_pton (AF_INET6, ip, &addr); - g_return_val_if_fail (ret == 1, NULL); - return nm_utils_inet6_ntop (&addr, NULL); -} - -/** - * nm_setting_ip6_config_add_dns: - * @setting: the #NMSettingIP6Config - * @dns: the IPv6 address of the DNS server to add - * - * Adds a new DNS server to the setting. - * - * Returns: %TRUE if the DNS server was added; %FALSE if the server was already - * known - **/ -gboolean -nm_setting_ip6_config_add_dns (NMSettingIP6Config *setting, const char *dns) -{ - NMSettingIP6ConfigPrivate *priv; - const char *dns_canonical; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); - g_return_val_if_fail (dns != NULL, FALSE); - g_return_val_if_fail (dns[0] != '\0', FALSE); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - - dns_canonical = canonicalize_ip (dns); - g_return_val_if_fail (dns_canonical != NULL, FALSE); - - for (iter = priv->dns; iter; iter = g_slist_next (iter)) { - if (!strcmp (dns_canonical, (char *) iter->data)) - return FALSE; - } - - priv->dns = g_slist_append (priv->dns, g_strdup (dns_canonical)); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS); - return TRUE; -} - -/** - * nm_setting_ip6_config_remove_dns: - * @setting: the #NMSettingIP6Config - * @i: index number of the DNS server to remove - * - * Removes the DNS server at index @i. - **/ -void -nm_setting_ip6_config_remove_dns (NMSettingIP6Config *setting, guint32 i) -{ - NMSettingIP6ConfigPrivate *priv; - GSList *elt; - - g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - elt = g_slist_nth (priv->dns, i); - g_return_if_fail (elt != NULL); - - g_free (elt->data); - priv->dns = g_slist_delete_link (priv->dns, elt); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS); -} - -/** - * nm_setting_ip6_config_remove_dns_by_value: - * @setting: the #NMSettingIP6Config - * @dns: the IPv6 address of the DNS server to remove - * - * Removes the DNS server at index @i. - * - * Returns: %TRUE if the DNS server was found and removed; %FALSE if it was not. - **/ -gboolean -nm_setting_ip6_config_remove_dns_by_value (NMSettingIP6Config *setting, - const char *dns) -{ - NMSettingIP6ConfigPrivate *priv; - const char *dns_canonical; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); - g_return_val_if_fail (dns != NULL, FALSE); - g_return_val_if_fail (dns[0] != '\0', FALSE); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - - dns_canonical = canonicalize_ip (dns); - g_return_val_if_fail (dns_canonical != NULL, FALSE); - - for (iter = priv->dns; iter; iter = g_slist_next (iter)) { - if (!strcmp (dns_canonical, (char *) iter->data)) { - priv->dns = g_slist_delete_link (priv->dns, iter); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS); - return TRUE; - } - } - return FALSE; -} - -/** - * nm_setting_ip6_config_clear_dns: - * @setting: the #NMSettingIP6Config - * - * Removes all configured DNS servers. - **/ -void -nm_setting_ip6_config_clear_dns (NMSettingIP6Config *setting) -{ - g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); - - g_slist_free_full (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns, g_free); - NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns = NULL; - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS); -} - -/** - * nm_setting_ip6_config_get_num_dns_searches: - * @setting: the #NMSettingIP6Config - * - * Returns: the number of configured DNS search domains - **/ -guint32 -nm_setting_ip6_config_get_num_dns_searches (NMSettingIP6Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), 0); - - return g_slist_length (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search); -} - -/** - * nm_setting_ip6_config_get_dns_search: - * @setting: the #NMSettingIP6Config - * @i: index number of the DNS search domain to return - * - * Returns: the DNS search domain at index @i - **/ -const char * -nm_setting_ip6_config_get_dns_search (NMSettingIP6Config *setting, guint32 i) -{ - NMSettingIP6ConfigPrivate *priv; - - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - g_return_val_if_fail (i < g_slist_length (priv->dns_search), NULL); - - return (const char *) g_slist_nth_data (priv->dns_search, i); -} - -/** - * nm_setting_ip6_config_add_dns_search: - * @setting: the #NMSettingIP6Config - * @dns_search: the search domain to add - * - * Adds a new DNS search domain to the setting. - * - * Returns: %TRUE if the DNS search domain was added; %FALSE if the search - * domain was already known - **/ -gboolean -nm_setting_ip6_config_add_dns_search (NMSettingIP6Config *setting, - const char *dns_search) -{ - NMSettingIP6ConfigPrivate *priv; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); - g_return_val_if_fail (dns_search != NULL, FALSE); - g_return_val_if_fail (dns_search[0] != '\0', FALSE); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - for (iter = priv->dns_search; iter; iter = g_slist_next (iter)) { - if (!strcmp (dns_search, (char *) iter->data)) - return FALSE; - } - - priv->dns_search = g_slist_append (priv->dns_search, g_strdup (dns_search)); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH); - return TRUE; -} - -/** - * nm_setting_ip6_config_remove_dns_search: - * @setting: the #NMSettingIP6Config - * @i: index number of the DNS search domain - * - * Removes the DNS search domain at index @i. - **/ -void -nm_setting_ip6_config_remove_dns_search (NMSettingIP6Config *setting, guint32 i) -{ - NMSettingIP6ConfigPrivate *priv; - GSList *elt; - - g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - elt = g_slist_nth (priv->dns_search, i); - g_return_if_fail (elt != NULL); - - g_free (elt->data); - priv->dns_search = g_slist_delete_link (priv->dns_search, elt); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH); -} - -/** - * nm_setting_ip6_config_remove_dns_search_by_value: - * @setting: the #NMSettingIP6Config - * @dns_search: the search domain to remove - * - * Removes the DNS search domain @dns_search. - * - * Returns: %TRUE if the DNS search domain was found and removed; %FALSE if it was not. - **/ -gboolean -nm_setting_ip6_config_remove_dns_search_by_value (NMSettingIP6Config *setting, - const char *dns_search) -{ - NMSettingIP6ConfigPrivate *priv; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); - g_return_val_if_fail (dns_search != NULL, FALSE); - g_return_val_if_fail (dns_search[0] != '\0', FALSE); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - for (iter = priv->dns_search; iter; iter = g_slist_next (iter)) { - if (!strcmp (dns_search, (char *) iter->data)) { - priv->dns_search = g_slist_delete_link (priv->dns_search, iter); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH); - return TRUE; - } - } - return FALSE; -} - -/** - * nm_setting_ip6_config_clear_dns_searches: - * @setting: the #NMSettingIP6Config - * - * Removes all configured DNS search domains. - **/ -void -nm_setting_ip6_config_clear_dns_searches (NMSettingIP6Config *setting) -{ - g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); - - g_slist_free_full (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search, g_free); - NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search = NULL; - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH); -} - -/** - * nm_setting_ip6_config_get_num_addresses: - * @setting: the #NMSettingIP6Config - * - * Returns: the number of configured addresses - **/ -guint32 -nm_setting_ip6_config_get_num_addresses (NMSettingIP6Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), 0); - - return g_slist_length (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->addresses); -} - -/** - * nm_setting_ip6_config_get_address: - * @setting: the #NMSettingIP6Config - * @i: index number of the address to return - * - * Returns: the address at index @i - **/ -NMIPAddress * -nm_setting_ip6_config_get_address (NMSettingIP6Config *setting, guint32 i) -{ - NMSettingIP6ConfigPrivate *priv; - - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - g_return_val_if_fail (i < g_slist_length (priv->addresses), NULL); - - return (NMIPAddress *) g_slist_nth_data (priv->addresses, i); -} - -/** - * nm_setting_ip6_config_add_address: - * @setting: the #NMSettingIP6Config - * @address: the new address to add - * - * Adds a new IPv6 address and associated information to the setting. The - * given address is duplicated internally and is not changed by this function. - * - * Returns: %TRUE if the address was added; %FALSE if the address was already - * known. - **/ -gboolean -nm_setting_ip6_config_add_address (NMSettingIP6Config *setting, - NMIPAddress *address) -{ - NMSettingIP6ConfigPrivate *priv; - NMIPAddress *copy; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); - g_return_val_if_fail (address != NULL, FALSE); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - for (iter = priv->addresses; iter; iter = g_slist_next (iter)) { - if (nm_ip_address_equal ((NMIPAddress *) iter->data, address)) - return FALSE; - } - - copy = nm_ip_address_dup (address); - priv->addresses = g_slist_append (priv->addresses, copy); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES); - return TRUE; -} - -/** - * nm_setting_ip6_config_remove_address: - * @setting: the #NMSettingIP6Config - * @i: index number of the address to remove - * - * Removes the address at index @i. - **/ -void -nm_setting_ip6_config_remove_address (NMSettingIP6Config *setting, guint32 i) -{ - NMSettingIP6ConfigPrivate *priv; - GSList *elt; - - g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - elt = g_slist_nth (priv->addresses, i); - g_return_if_fail (elt != NULL); - - nm_ip_address_unref ((NMIPAddress *) elt->data); - priv->addresses = g_slist_delete_link (priv->addresses, elt); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES); -} - -/** - * nm_setting_ip6_config_remove_address_by_value: - * @setting: the #NMSettingIP6Config - * @address: the address to remove - * - * Removes the address @address. - * - * Returns: %TRUE if the address was found and removed; %FALSE if it was not. - **/ -gboolean -nm_setting_ip6_config_remove_address_by_value (NMSettingIP6Config *setting, - NMIPAddress *address) -{ - NMSettingIP6ConfigPrivate *priv; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); - g_return_val_if_fail (address != NULL, FALSE); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - for (iter = priv->addresses; iter; iter = g_slist_next (iter)) { - if (nm_ip_address_equal ((NMIPAddress *) iter->data, address)) { - priv->addresses = g_slist_delete_link (priv->addresses, iter); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES); - return TRUE; - } - } - return FALSE; -} - -/** - * nm_setting_ip6_config_clear_addresses: - * @setting: the #NMSettingIP6Config - * - * Removes all configured addresses. - **/ -void -nm_setting_ip6_config_clear_addresses (NMSettingIP6Config *setting) -{ - NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - - g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); - - g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip_address_unref); - priv->addresses = NULL; - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES); -} - -/** - * nm_setting_ip6_config_get_num_routes: - * @setting: the #NMSettingIP6Config - * - * Returns: the number of configured routes - **/ -guint32 -nm_setting_ip6_config_get_num_routes (NMSettingIP6Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), 0); - - return g_slist_length (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->routes); -} - -/** - * nm_setting_ip6_config_get_route: - * @setting: the #NMSettingIP6Config - * @i: index number of the route to return - * - * Returns: the route at index @i - **/ -NMIPRoute * -nm_setting_ip6_config_get_route (NMSettingIP6Config *setting, guint32 i) -{ - NMSettingIP6ConfigPrivate *priv; - - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - g_return_val_if_fail (i < g_slist_length (priv->routes), NULL); - - return (NMIPRoute *) g_slist_nth_data (priv->routes, i); -} - -/** - * nm_setting_ip6_config_add_route: - * @setting: the #NMSettingIP6Config - * @route: the route to add - * - * Adds a new IPv6 route and associated information to the setting. The - * given route is duplicated internally and is not changed by this function. - * - * Returns: %TRUE if the route was added; %FALSE if the route was already known. - **/ -gboolean -nm_setting_ip6_config_add_route (NMSettingIP6Config *setting, - NMIPRoute *route) -{ - NMSettingIP6ConfigPrivate *priv; - NMIPRoute *copy; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); - g_return_val_if_fail (route != NULL, FALSE); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - for (iter = priv->routes; iter; iter = g_slist_next (iter)) { - if (nm_ip_route_equal ((NMIPRoute *) iter->data, route)) - return FALSE; - } - - copy = nm_ip_route_dup (route); - priv->routes = g_slist_append (priv->routes, copy); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES); - return TRUE; -} - -/** - * nm_setting_ip6_config_remove_route: - * @setting: the #NMSettingIP6Config - * @i: index number of the route - * - * Removes the route at index @i. - **/ -void -nm_setting_ip6_config_remove_route (NMSettingIP6Config *setting, guint32 i) -{ - NMSettingIP6ConfigPrivate *priv; - GSList *elt; - - g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - elt = g_slist_nth (priv->routes, i); - g_return_if_fail (elt != NULL); - - nm_ip_route_unref ((NMIPRoute *) elt->data); - priv->routes = g_slist_delete_link (priv->routes, elt); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES); -} - -/** - * nm_setting_ip6_config_remove_route_by_value: - * @setting: the #NMSettingIP6Config - * @route: the route to remove - * - * Removes the route @route. - * - * Returns: %TRUE if the route was found and removed; %FALSE if it was not. - **/ -gboolean -nm_setting_ip6_config_remove_route_by_value (NMSettingIP6Config *setting, - NMIPRoute *route) -{ - NMSettingIP6ConfigPrivate *priv; - GSList *iter; - - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); - g_return_val_if_fail (route != NULL, FALSE); - - priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - for (iter = priv->routes; iter; iter = g_slist_next (iter)) { - if (nm_ip_route_equal ((NMIPRoute *) iter->data, route)) { - nm_ip_route_unref ((NMIPRoute *) iter->data); - priv->routes = g_slist_delete_link (priv->routes, iter); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES); - return TRUE; - } - } - return FALSE; -} - -/** - * nm_setting_ip6_config_clear_routes: - * @setting: the #NMSettingIP6Config - * - * Removes all configured routes. - **/ -void -nm_setting_ip6_config_clear_routes (NMSettingIP6Config *setting) -{ - NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - - g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); - - g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_route_unref); - priv->routes = NULL; - g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES); -} - -/** - * nm_setting_ip6_config_get_ignore_auto_routes: - * @setting: the #NMSettingIP6Config - * - * Returns the value contained in the #NMSettingIP6Config:ignore-auto-routes - * property. - * - * Returns: %TRUE if automatically configured (ie via DHCP) routes should be - * ignored. - **/ -gboolean -nm_setting_ip6_config_get_ignore_auto_routes (NMSettingIP6Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); - - return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->ignore_auto_routes; -} - -/** - * nm_setting_ip6_config_get_ignore_auto_dns: - * @setting: the #NMSettingIP6Config - * - * Returns the value contained in the #NMSettingIP6Config:ignore-auto-dns - * property. - * - * Returns: %TRUE if automatically configured (ie via DHCP or router - * advertisements) DNS information should be ignored. - **/ -gboolean -nm_setting_ip6_config_get_ignore_auto_dns (NMSettingIP6Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); - - return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->ignore_auto_dns; -} - -/** - * nm_setting_ip6_config_get_never_default: - * @setting: the #NMSettingIP6Config - * - * Returns the value contained in the #NMSettingIP6Config:never-default - * property. - * - * Returns: %TRUE if this connection should never be the default connection - * for IPv6 addressing - **/ -gboolean -nm_setting_ip6_config_get_never_default (NMSettingIP6Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); - - return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->never_default; -} - -/** - * nm_setting_ip6_config_get_may_fail: - * @setting: the #NMSettingIP6Config - * - * Returns the value contained in the #NMSettingIP6Config:may-fail - * property. - * - * Returns: %TRUE if this connection doesn't require IPv6 addressing to complete - * for the connection to succeed. - **/ -gboolean -nm_setting_ip6_config_get_may_fail (NMSettingIP6Config *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); - - return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->may_fail; -} - -/** * nm_setting_ip6_config_get_ip6_privacy: * @setting: the #NMSettingIP6Config * @@ -785,98 +99,71 @@ nm_setting_ip6_config_get_ip6_privacy (NMSettingIP6Config *setting) static gboolean verify (NMSetting *setting, NMConnection *connection, GError **error) { - NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - GSList *iter; - int i; + NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting); + const char *method; - if (!priv->method) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_MISSING_PROPERTY, - _("property is missing")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_METHOD); + if (!NM_SETTING_CLASS (nm_setting_ip6_config_parent_class)->verify (setting, connection, error)) return FALSE; - } - if (!strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { - if (!priv->addresses) { + method = nm_setting_ip_config_get_method (s_ip); + /* Base class already checked that it exists */ + g_assert (method); + + if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { + if (nm_setting_ip_config_get_num_addresses (s_ip) == 0) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_MISSING_PROPERTY, _("this property cannot be empty for '%s=%s'"), - NM_SETTING_IP6_CONFIG_METHOD, priv->method); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_METHOD, method); + g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES); return FALSE; } - } else if ( !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) - || !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) - || !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) { - if (priv->dns) { + } else if ( !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) + || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) + || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) { + if (nm_setting_ip_config_get_num_dns (s_ip) > 0) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, _("'%s' not allowed for %s=%s"), _("this property is not allowed for '%s=%s'"), - NM_SETTING_IP6_CONFIG_METHOD, priv->method); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DNS); + NM_SETTING_IP_CONFIG_METHOD, method); + g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS); return FALSE; } - if (priv->dns_search) { + if (nm_setting_ip_config_get_num_dns_searches (s_ip) > 0) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, _("this property is not allowed for '%s=%s'"), - NM_SETTING_IP6_CONFIG_METHOD, priv->method); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_METHOD, method); + g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS_SEARCH); return FALSE; } - if (priv->addresses) { + if (nm_setting_ip_config_get_num_addresses (s_ip) > 0) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, _("this property is not allowed for '%s=%s'"), - NM_SETTING_IP6_CONFIG_METHOD, priv->method); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_METHOD, method); + g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES); return FALSE; } - } else if ( !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) - || !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) { + } else if ( !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) + || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) { /* nothing to do */ } else { g_set_error_literal (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, _("property is invalid")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_METHOD); - return FALSE; - } - - if (priv->dhcp_hostname && !strlen (priv->dhcp_hostname)) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("property is missing")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME); + g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_METHOD); return FALSE; } - for (iter = priv->dns, i = 0; iter; iter = g_slist_next (iter), i++) { - const char *dns = (const char *) iter->data; - struct in6_addr addr; - - if (inet_pton (AF_INET6, dns, &addr) != 1) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("%d. DNS server address is invalid"), - i+1); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DNS); - return FALSE; - } - } - return TRUE; } @@ -886,22 +173,6 @@ nm_setting_ip6_config_init (NMSettingIP6Config *setting) { } -static void -finalize (GObject *object) -{ - NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (object); - - g_free (priv->method); - g_free (priv->dhcp_hostname); - - g_slist_free_full (priv->dns, g_free); - g_slist_free_full (priv->dns_search, g_free); - g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip_address_unref); - g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_route_unref); - - G_OBJECT_CLASS (nm_setting_ip6_config_parent_class)->finalize (object); -} - static GVariant * ip6_dns_to_dbus (const GValue *prop_value) { @@ -948,44 +219,6 @@ set_property (GObject *object, guint prop_id, NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (object); switch (prop_id) { - case PROP_METHOD: - g_free (priv->method); - priv->method = g_value_dup_string (value); - break; - case PROP_DNS: - g_slist_free_full (priv->dns, g_free); - priv->dns = _nm_utils_strv_to_slist (g_value_get_boxed (value)); - break; - case PROP_DNS_SEARCH: - g_slist_free_full (priv->dns_search, g_free); - priv->dns_search = _nm_utils_strv_to_slist (g_value_get_boxed (value)); - break; - case PROP_ADDRESSES: - g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_address_unref); - priv->addresses = _nm_utils_copy_array_to_slist (g_value_get_boxed (value), - (NMUtilsCopyFunc) nm_ip_address_dup); - break; - case PROP_ROUTES: - g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_route_unref); - priv->routes = _nm_utils_copy_array_to_slist (g_value_get_boxed (value), - (NMUtilsCopyFunc) nm_ip_route_dup); - break; - case PROP_IGNORE_AUTO_ROUTES: - priv->ignore_auto_routes = g_value_get_boolean (value); - break; - case PROP_IGNORE_AUTO_DNS: - priv->ignore_auto_dns = g_value_get_boolean (value); - break; - case PROP_DHCP_HOSTNAME: - g_free (priv->dhcp_hostname); - priv->dhcp_hostname = g_value_dup_string (value); - break; - case PROP_NEVER_DEFAULT: - priv->never_default = g_value_get_boolean (value); - break; - case PROP_MAY_FAIL: - priv->may_fail = g_value_get_boolean (value); - break; case PROP_IP6_PRIVACY: priv->ip6_privacy = g_value_get_enum (value); break; @@ -1002,36 +235,6 @@ get_property (GObject *object, guint prop_id, NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (object); switch (prop_id) { - case PROP_METHOD: - g_value_set_string (value, priv->method); - break; - case PROP_DNS: - g_value_take_boxed (value, _nm_utils_slist_to_strv (priv->dns)); - break; - case PROP_DNS_SEARCH: - g_value_take_boxed (value, _nm_utils_slist_to_strv (priv->dns_search)); - break; - case PROP_ADDRESSES: - g_value_take_boxed (value, _nm_utils_copy_slist_to_array (priv->addresses, (NMUtilsCopyFunc) nm_ip_address_dup, (GDestroyNotify) nm_ip_address_unref)); - break; - case PROP_ROUTES: - g_value_take_boxed (value, _nm_utils_copy_slist_to_array (priv->routes, (NMUtilsCopyFunc) nm_ip_route_dup, (GDestroyNotify) nm_ip_route_unref)); - break; - case PROP_IGNORE_AUTO_ROUTES: - g_value_set_boolean (value, priv->ignore_auto_routes); - break; - case PROP_IGNORE_AUTO_DNS: - g_value_set_boolean (value, priv->ignore_auto_dns); - break; - case PROP_DHCP_HOSTNAME: - g_value_set_string (value, priv->dhcp_hostname); - break; - case PROP_NEVER_DEFAULT: - g_value_set_boolean (value, priv->never_default); - break; - case PROP_MAY_FAIL: - g_value_set_boolean (value, priv->may_fail); - break; case PROP_IP6_PRIVACY: g_value_set_enum (value, priv->ip6_privacy); break; @@ -1042,201 +245,20 @@ get_property (GObject *object, guint prop_id, } static void -nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) +nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *ip6_class) { - GObjectClass *object_class = G_OBJECT_CLASS (setting_class); - NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class); + GObjectClass *object_class = G_OBJECT_CLASS (ip6_class); + NMSettingClass *setting_class = NM_SETTING_CLASS (ip6_class); - g_type_class_add_private (setting_class, sizeof (NMSettingIP6ConfigPrivate)); + g_type_class_add_private (ip6_class, sizeof (NMSettingIP6ConfigPrivate)); /* virtual methods */ object_class->set_property = set_property; object_class->get_property = get_property; - object_class->finalize = finalize; - parent_class->verify = verify; + setting_class->verify = verify; /* Properties */ /** - * NMSettingIP6Config:method: - * - * IPv6 configuration method. If "auto" is specified then the appropriate - * automatic method (PPP, router advertisement, etc) is used for the device - * and most other properties can be left unset. To force the use of DHCP - * only, specify "dhcp"; this method is only valid for Ethernet- based - * hardware. If "link-local" is specified, then an IPv6 link-local address - * will be assigned to the interface. If "manual" is specified, static IP - * addressing is used and at least one IP address must be given in the - * "addresses" property. If "ignore" is specified, IPv6 configuration is - * not done. This property must be set. Note: the "shared" method is not - * yet supported. - **/ - g_object_class_install_property - (object_class, PROP_METHOD, - g_param_spec_string (NM_SETTING_IP6_CONFIG_METHOD, "", "", - NULL, - G_PARAM_READWRITE | - NM_SETTING_PARAM_INFERRABLE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP6Config:dhcp-hostname: - * - * The specified name will be sent to the DHCP server when acquiring a - * lease. - **/ - g_object_class_install_property - (object_class, PROP_DHCP_HOSTNAME, - g_param_spec_string (NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, "", "", - NULL, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP6Config:dns: - * - * Array of IPv6 addresses of DNS servers. For the "auto" method, these DNS - * servers are appended to those (if any) returned by automatic - * configuration. DNS servers cannot be used with the "shared" or - * "link-local" methods as there is no usptream network. In all other - * methods, these DNS servers are used as the only DNS servers for this - * connection. - **/ - g_object_class_install_property - (object_class, PROP_DNS, - g_param_spec_boxed (NM_SETTING_IP6_CONFIG_DNS, "", "", - G_TYPE_STRV, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - _nm_setting_class_transform_property (parent_class, NM_SETTING_IP6_CONFIG_DNS, - G_VARIANT_TYPE ("aay"), - ip6_dns_to_dbus, - ip6_dns_from_dbus); - - /** - * NMSettingIP6Config:dns-search: - * - * List of DNS search domains. For the "auto" method, these search domains - * are appended to those returned by automatic configuration. Search domains - * cannot be used with the "shared" or "link-local" methods as there is no - * upstream network. In all other methods, these search domains are used as - * the only search domains for this connection. - **/ - g_object_class_install_property - (object_class, PROP_DNS_SEARCH, - g_param_spec_boxed (NM_SETTING_IP6_CONFIG_DNS_SEARCH, "", "", - G_TYPE_STRV, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP6Config:addresses: - * - * Array of IPv6 addresses. For the 'auto' method, given IP addresses are - * appended to those returned by automatic configuration. Addresses cannot - * be used with the 'shared' or 'link-local' methods as the interface is - * automatically assigned an address with these methods. - * - * Element-Type: NMIPAddress - **/ - g_object_class_install_property - (object_class, PROP_ADDRESSES, - g_param_spec_boxed (NM_SETTING_IP6_CONFIG_ADDRESSES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READWRITE | - NM_SETTING_PARAM_INFERRABLE | - G_PARAM_STATIC_STRINGS)); - _nm_setting_class_transform_property (parent_class, NM_SETTING_IP6_CONFIG_ADDRESSES, - G_VARIANT_TYPE ("a(ayuay)"), - ip6_addresses_to_dbus, - ip6_addresses_from_dbus); - - /** - * NMSettingIP6Config:routes: - * - * Array of IPv6 routes. For the 'auto' method, given IP routes are appended - * to those returned by automatic configuration. Routes cannot be used with - * the 'shared' or 'link-local' methods because there is no upstream network. - * - * Element-Type: NMIPRoute - **/ - g_object_class_install_property - (object_class, PROP_ROUTES, - g_param_spec_boxed (NM_SETTING_IP6_CONFIG_ROUTES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READWRITE | - NM_SETTING_PARAM_INFERRABLE | - G_PARAM_STATIC_STRINGS)); - _nm_setting_class_transform_property (parent_class, NM_SETTING_IP6_CONFIG_ROUTES, - G_VARIANT_TYPE ("a(ayuayu)"), - ip6_routes_to_dbus, - ip6_routes_from_dbus); - - /** - * NMSettingIP6Config:ignore-auto-routes: - * - * When the method is set to "auto" or "dhcp" and this property is set to - * %TRUE, automatically configured routes are ignored and only routes - * specified in the #NMSettingIP6Config:routes property, if any, are used. - **/ - g_object_class_install_property - (object_class, PROP_IGNORE_AUTO_ROUTES, - g_param_spec_boolean (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP6Config:ignore-auto-dns: - * - * When the method is set to "auto" or "dhcp" and this property is set to - * %TRUE, automatically configured nameservers and search domains are - * ignored and only nameservers and search domains specified in the - * #NMSettingIP6Config:dns and #NMSettingIP6Config:dns-search properties, if - * any, are used. - **/ - g_object_class_install_property - (object_class, PROP_IGNORE_AUTO_DNS, - g_param_spec_boolean (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP6Config:never-default: - * - * If %TRUE, this connection will never be the default IPv6 connection, - * meaning it will never be assigned the default IPv6 route by - * NetworkManager. - **/ - g_object_class_install_property - (object_class, PROP_NEVER_DEFAULT, - g_param_spec_boolean (NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingIP6Config:may-fail: - * - * If %TRUE, allow overall network configuration to proceed even if IPv6 - * configuration times out. Note that at least one IP configuration must - * succeed or overall network configuration will still fail. For example, - * in IPv4-only networks, setting this property to %TRUE allows the overall - * network configuration to succeed if IPv6 configuration fails but IPv4 - * configuration completes successfully. - **/ - g_object_class_install_property - (object_class, PROP_MAY_FAIL, - g_param_spec_boolean (NM_SETTING_IP6_CONFIG_MAY_FAIL, "", "", - TRUE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); - - /** * NMSettingIP6Config:ip6-privacy: * * Configure IPv6 Privacy Extensions for SLAAC, described in RFC4941. If @@ -1255,4 +277,23 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); + + /* IP6-specific property overrides */ + _nm_setting_class_transform_property (setting_class, + NM_SETTING_IP_CONFIG_DNS, + G_VARIANT_TYPE ("aay"), + ip6_dns_to_dbus, + ip6_dns_from_dbus); + + _nm_setting_class_transform_property (setting_class, + NM_SETTING_IP_CONFIG_ADDRESSES, + G_VARIANT_TYPE ("a(ayuay)"), + ip6_addresses_to_dbus, + ip6_addresses_from_dbus); + + _nm_setting_class_transform_property (setting_class, + NM_SETTING_IP_CONFIG_ROUTES, + G_VARIANT_TYPE ("a(ayuayu)"), + ip6_routes_to_dbus, + ip6_routes_from_dbus); } diff --git a/libnm-core/nm-setting-ip6-config.h b/libnm-core/nm-setting-ip6-config.h index 73b93eeae8..b791e937b4 100644 --- a/libnm-core/nm-setting-ip6-config.h +++ b/libnm-core/nm-setting-ip6-config.h @@ -26,9 +26,6 @@ #error "Only <NetworkManager.h> can be included directly." #endif -#include <arpa/inet.h> - -#include "nm-setting.h" #include "nm-setting-ip-config.h" G_BEGIN_DECLS @@ -42,18 +39,7 @@ G_BEGIN_DECLS #define NM_SETTING_IP6_CONFIG_SETTING_NAME "ipv6" -#define NM_SETTING_IP6_CONFIG_METHOD "method" -#define NM_SETTING_IP6_CONFIG_DNS "dns" -#define NM_SETTING_IP6_CONFIG_DNS_SEARCH "dns-search" -#define NM_SETTING_IP6_CONFIG_ADDRESSES "addresses" -#define NM_SETTING_IP6_CONFIG_ROUTES "routes" -#define NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes" -#define NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns" -#define NM_SETTING_IP6_CONFIG_NEVER_DEFAULT "never-default" -#define NM_SETTING_IP6_CONFIG_MAY_FAIL "may-fail" -#define NM_SETTING_IP6_CONFIG_IP6_PRIVACY "ip6-privacy" -#define NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME "dhcp-hostname" - +#define NM_SETTING_IP6_CONFIG_IP6_PRIVACY "ip6-privacy" /** * NM_SETTING_IP6_CONFIG_METHOD_IGNORE: @@ -129,11 +115,11 @@ typedef enum { } NMSettingIP6ConfigPrivacy; struct _NMSettingIP6Config { - NMSetting parent; + NMSettingIPConfig parent; }; typedef struct { - NMSettingClass parent; + NMSettingIPConfigClass parent; /*< private >*/ gpointer padding[4]; @@ -141,42 +127,8 @@ typedef struct { GType nm_setting_ip6_config_get_type (void); -NMSetting * nm_setting_ip6_config_new (void); -const char * nm_setting_ip6_config_get_method (NMSettingIP6Config *setting); - -guint32 nm_setting_ip6_config_get_num_dns (NMSettingIP6Config *setting); -const char * nm_setting_ip6_config_get_dns (NMSettingIP6Config *setting, guint32 i); -gboolean nm_setting_ip6_config_add_dns (NMSettingIP6Config *setting, const char *dns); -void nm_setting_ip6_config_remove_dns (NMSettingIP6Config *setting, guint32 i); -gboolean nm_setting_ip6_config_remove_dns_by_value (NMSettingIP6Config *setting, const char *dns); -void nm_setting_ip6_config_clear_dns (NMSettingIP6Config *setting); - -guint32 nm_setting_ip6_config_get_num_dns_searches (NMSettingIP6Config *setting); -const char * nm_setting_ip6_config_get_dns_search (NMSettingIP6Config *setting, guint32 i); -gboolean nm_setting_ip6_config_add_dns_search (NMSettingIP6Config *setting, const char *dns_search); -void nm_setting_ip6_config_remove_dns_search (NMSettingIP6Config *setting, guint32 i); -gboolean nm_setting_ip6_config_remove_dns_search_by_value (NMSettingIP6Config *setting, const char *dns_search); -void nm_setting_ip6_config_clear_dns_searches (NMSettingIP6Config *setting); - -guint32 nm_setting_ip6_config_get_num_addresses (NMSettingIP6Config *setting); -NMIPAddress * nm_setting_ip6_config_get_address (NMSettingIP6Config *setting, guint32 i); -gboolean nm_setting_ip6_config_add_address (NMSettingIP6Config *setting, NMIPAddress *address); -void nm_setting_ip6_config_remove_address (NMSettingIP6Config *setting, guint32 i); -gboolean nm_setting_ip6_config_remove_address_by_value (NMSettingIP6Config *setting, NMIPAddress *address); -void nm_setting_ip6_config_clear_addresses (NMSettingIP6Config *setting); - -guint32 nm_setting_ip6_config_get_num_routes (NMSettingIP6Config *setting); -NMIPRoute * nm_setting_ip6_config_get_route (NMSettingIP6Config *setting, guint32 i); -gboolean nm_setting_ip6_config_add_route (NMSettingIP6Config *setting, NMIPRoute *route); -void nm_setting_ip6_config_remove_route (NMSettingIP6Config *setting, guint32 i); -gboolean nm_setting_ip6_config_remove_route_by_value (NMSettingIP6Config *setting, NMIPRoute *route); -void nm_setting_ip6_config_clear_routes (NMSettingIP6Config *setting); -gboolean nm_setting_ip6_config_get_ignore_auto_routes (NMSettingIP6Config *setting); - -gboolean nm_setting_ip6_config_get_ignore_auto_dns (NMSettingIP6Config *setting); -const char * nm_setting_ip6_config_get_dhcp_hostname (NMSettingIP6Config *setting); -gboolean nm_setting_ip6_config_get_never_default (NMSettingIP6Config *setting); -gboolean nm_setting_ip6_config_get_may_fail (NMSettingIP6Config *setting); +NMSetting *nm_setting_ip6_config_new (void); + NMSettingIP6ConfigPrivacy nm_setting_ip6_config_get_ip6_privacy (NMSettingIP6Config *setting); G_END_DECLS diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index a028f84d4d..0f67da3733 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -24,6 +24,7 @@ #include <string.h> #include <stdlib.h> #include <netinet/ether.h> +#include <arpa/inet.h> #include <uuid/uuid.h> #include <gmodule.h> diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index b103ce8922..041c4263f4 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -323,7 +323,7 @@ test_setting_vpn_modify_during_foreach (void) static void test_setting_ip4_config_labels (void) { - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMIPAddress *addr; GVariant *label; GPtrArray *addrs; @@ -332,21 +332,21 @@ test_setting_ip4_config_labels (void) GVariant *dict, *setting_dict, *value; GError *error = NULL; - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); /* addr 1 */ addr = nm_ip_address_new (AF_INET, "1.1.1.1", 24, NULL, &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); g_assert_no_error (error); - addr = nm_setting_ip4_config_get_address (s_ip4, 0); + addr = nm_setting_ip_config_get_address (s_ip4, 0); label = nm_ip_address_get_attribute (addr, "label"); g_assert (label == NULL); @@ -355,12 +355,12 @@ test_setting_ip4_config_labels (void) g_assert_no_error (error); nm_ip_address_set_attribute (addr, "label", g_variant_new_string ("eth0:1")); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); g_assert_no_error (error); - addr = nm_setting_ip4_config_get_address (s_ip4, 1); + addr = nm_setting_ip_config_get_address (s_ip4, 1); label = nm_ip_address_get_attribute (addr, "label"); g_assert (label != NULL); g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1"); @@ -370,27 +370,27 @@ test_setting_ip4_config_labels (void) g_assert_no_error (error); nm_ip_address_set_attribute (addr, "label", NULL); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); g_assert_no_error (error); - addr = nm_setting_ip4_config_get_address (s_ip4, 2); + addr = nm_setting_ip_config_get_address (s_ip4, 2); label = nm_ip_address_get_attribute (addr, "label"); g_assert (label == NULL); /* Remove addr 1 and re-verify remaining addresses */ - nm_setting_ip4_config_remove_address (s_ip4, 0); + nm_setting_ip_config_remove_address (s_ip4, 0); nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); g_assert_no_error (error); - addr = nm_setting_ip4_config_get_address (s_ip4, 0); + addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "2.2.2.2"); label = nm_ip_address_get_attribute (addr, "label"); g_assert (label != NULL); g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1"); - addr = nm_setting_ip4_config_get_address (s_ip4, 1); + addr = nm_setting_ip_config_get_address (s_ip4, 1); g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "3.3.3.3"); label = nm_ip_address_get_attribute (addr, "label"); g_assert (label == NULL); @@ -422,40 +422,40 @@ test_setting_ip4_config_labels (void) s_ip4 = nm_connection_get_setting_ip4_config (conn); - addr = nm_setting_ip4_config_get_address (s_ip4, 0); + addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "2.2.2.2"); label = nm_ip_address_get_attribute (addr, "label"); g_assert (label != NULL); g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1"); - addr = nm_setting_ip4_config_get_address (s_ip4, 1); + addr = nm_setting_ip_config_get_address (s_ip4, 1); g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "3.3.3.3"); label = nm_ip_address_get_attribute (addr, "label"); g_assert (label == NULL); /* Test explicit property assignment */ g_object_get (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_ADDRESSES, &addrs, + NM_SETTING_IP_CONFIG_ADDRESSES, &addrs, NULL); - nm_setting_ip4_config_clear_addresses (s_ip4); - g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 0); + nm_setting_ip_config_clear_addresses (s_ip4); + g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 0); g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_ADDRESSES, addrs, + NM_SETTING_IP_CONFIG_ADDRESSES, addrs, NULL); g_ptr_array_unref (addrs); nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); g_assert_no_error (error); - g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 2); + g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 2); - addr = nm_setting_ip4_config_get_address (s_ip4, 0); + addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "2.2.2.2"); label = nm_ip_address_get_attribute (addr, "label"); g_assert (label != NULL); g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1"); - addr = nm_setting_ip4_config_get_address (s_ip4, 1); + addr = nm_setting_ip_config_get_address (s_ip4, 1); g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "3.3.3.3"); label = nm_ip_address_get_attribute (addr, "label"); g_assert (label == NULL); @@ -996,8 +996,8 @@ new_test_connection (void) setting = nm_setting_ip4_config_new (); g_object_set (G_OBJECT (setting), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, - NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, "eyeofthetiger", + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, "eyeofthetiger", NULL); nm_connection_add_setting (connection, setting); @@ -1045,7 +1045,7 @@ new_connection_dict (char **out_uuid, /* IP6 */ g_variant_builder_init (&setting_builder, NM_VARIANT_TYPE_SETTING); g_variant_builder_add (&setting_builder, "{sv}", - NM_SETTING_IP6_CONFIG_METHOD, + NM_SETTING_IP_CONFIG_METHOD, g_variant_new_string (*out_expected_ip6_method)); g_variant_builder_add (&conn_builder, "{sa{sv}}", NM_SETTING_IP6_CONFIG_SETTING_NAME, @@ -1062,7 +1062,7 @@ test_connection_replace_settings (void) GError *error = NULL; gboolean success; NMSettingConnection *s_con; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; char *uuid = NULL; const char *expected_id = NULL, *expected_method = NULL; @@ -1086,7 +1086,7 @@ test_connection_replace_settings (void) s_ip6 = nm_connection_get_setting_ip6_config (connection); g_assert (s_ip6); - g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, expected_method); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, expected_method); g_free (uuid); g_variant_unref (new_settings); @@ -1217,7 +1217,7 @@ test_connection_new_from_dbus (void) GVariant *new_settings; GError *error = NULL; NMSettingConnection *s_con; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; char *uuid = NULL; const char *expected_id = NULL, *expected_method = NULL; @@ -1239,7 +1239,7 @@ test_connection_new_from_dbus (void) s_ip6 = nm_connection_get_setting_ip6_config (connection); g_assert (s_ip6); - g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, expected_method); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, expected_method); g_free (uuid); g_variant_unref (new_settings); @@ -1630,18 +1630,18 @@ test_connection_diff_a_only (void) { NULL, NM_SETTING_DIFF_RESULT_UNKNOWN }, } }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, { - { NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A }, - { NM_SETTING_IP4_CONFIG_DNS, NM_SETTING_DIFF_RESULT_IN_A }, - { NM_SETTING_IP4_CONFIG_DNS_SEARCH, NM_SETTING_DIFF_RESULT_IN_A }, - { NM_SETTING_IP4_CONFIG_ADDRESSES, NM_SETTING_DIFF_RESULT_IN_A }, - { NM_SETTING_IP4_CONFIG_ROUTES, NM_SETTING_DIFF_RESULT_IN_A }, - { NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, NM_SETTING_DIFF_RESULT_IN_A }, - { NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP_CONFIG_DNS, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP_CONFIG_DNS_SEARCH, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP_CONFIG_ADDRESSES, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP_CONFIG_ROUTES, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, NM_SETTING_DIFF_RESULT_IN_A }, - { NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A }, - { NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A }, - { NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, NM_SETTING_DIFF_RESULT_IN_A }, - { NM_SETTING_IP4_CONFIG_MAY_FAIL, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP_CONFIG_NEVER_DEFAULT, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP_CONFIG_MAY_FAIL, NM_SETTING_DIFF_RESULT_IN_A }, { NULL, NM_SETTING_DIFF_RESULT_UNKNOWN }, } }, }; @@ -1681,11 +1681,11 @@ test_connection_diff_different (void) { NMConnection *a, *b; GHashTable *out_diffs = NULL; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; gboolean same; const DiffSetting settings[] = { { NM_SETTING_IP4_CONFIG_SETTING_NAME, { - { NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A | NM_SETTING_DIFF_RESULT_IN_B }, + { NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A | NM_SETTING_DIFF_RESULT_IN_B }, { NULL, NM_SETTING_DIFF_RESULT_UNKNOWN }, } }, }; @@ -1695,7 +1695,7 @@ test_connection_diff_different (void) s_ip4 = nm_connection_get_setting_ip4_config (a); g_assert (s_ip4); g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); same = nm_connection_diff (a, b, NM_SETTING_COMPARE_FLAG_EXACT, &out_diffs); @@ -1766,7 +1766,7 @@ test_connection_diff_inferrable (void) gboolean same; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *uuid; const DiffSetting settings[] = { { NM_SETTING_CONNECTION_SETTING_NAME, { @@ -1794,7 +1794,7 @@ test_connection_diff_inferrable (void) s_ip4 = nm_connection_get_setting_ip4_config (a); g_assert (s_ip4); - g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TRUE, NULL); + g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, TRUE, NULL); /* Make sure the diff returns no results as secrets are ignored */ same = nm_connection_diff (a, b, NM_SETTING_COMPARE_FLAG_INFERRABLE, &out_diffs); @@ -1836,11 +1836,11 @@ add_generic_settings (NMConnection *connection, const char *ctype) g_free (uuid); setting = nm_setting_ip4_config_new (); - g_object_set (setting, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (setting, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); nm_connection_add_setting (connection, setting); setting = nm_setting_ip6_config_new (); - g_object_set (setting, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); + g_object_set (setting, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); nm_connection_add_setting (connection, setting); } @@ -2446,7 +2446,7 @@ test_setting_ip4_changed_signal (void) { NMConnection *connection; gboolean changed = FALSE; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMIPAddress *addr; NMIPRoute *route; GError *error = NULL; @@ -2457,53 +2457,53 @@ test_setting_ip4_changed_signal (void) (GCallback) test_connection_changed_cb, &changed); - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - ASSERT_CHANGED (nm_setting_ip4_config_add_dns (s_ip4, "11.22.0.0")); - ASSERT_CHANGED (nm_setting_ip4_config_remove_dns (s_ip4, 0)); + ASSERT_CHANGED (nm_setting_ip_config_add_dns (s_ip4, "11.22.0.0")); + ASSERT_CHANGED (nm_setting_ip_config_remove_dns (s_ip4, 0)); - g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); - ASSERT_UNCHANGED (nm_setting_ip4_config_remove_dns (s_ip4, 1)); + g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns->len*"); + ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns (s_ip4, 1)); g_test_assert_expected_messages (); - nm_setting_ip4_config_add_dns (s_ip4, "33.44.0.0"); - ASSERT_CHANGED (nm_setting_ip4_config_clear_dns (s_ip4)); + nm_setting_ip_config_add_dns (s_ip4, "33.44.0.0"); + ASSERT_CHANGED (nm_setting_ip_config_clear_dns (s_ip4)); - ASSERT_CHANGED (nm_setting_ip4_config_add_dns_search (s_ip4, "foobar.com")); - ASSERT_CHANGED (nm_setting_ip4_config_remove_dns_search (s_ip4, 0)); + ASSERT_CHANGED (nm_setting_ip_config_add_dns_search (s_ip4, "foobar.com")); + ASSERT_CHANGED (nm_setting_ip_config_remove_dns_search (s_ip4, 0)); - g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); - ASSERT_UNCHANGED (nm_setting_ip4_config_remove_dns_search (s_ip4, 1)); + g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns_search->len*"); + ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns_search (s_ip4, 1)); g_test_assert_expected_messages (); - ASSERT_CHANGED (nm_setting_ip4_config_add_dns_search (s_ip4, "foobar.com")); - ASSERT_CHANGED (nm_setting_ip4_config_clear_dns_searches (s_ip4)); + ASSERT_CHANGED (nm_setting_ip_config_add_dns_search (s_ip4, "foobar.com")); + ASSERT_CHANGED (nm_setting_ip_config_clear_dns_searches (s_ip4)); addr = nm_ip_address_new (AF_INET, "22.33.0.0", 24, NULL, &error); g_assert_no_error (error); - ASSERT_CHANGED (nm_setting_ip4_config_add_address (s_ip4, addr)); - ASSERT_CHANGED (nm_setting_ip4_config_remove_address (s_ip4, 0)); + ASSERT_CHANGED (nm_setting_ip_config_add_address (s_ip4, addr)); + ASSERT_CHANGED (nm_setting_ip_config_remove_address (s_ip4, 0)); - g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*addr != NULL*"); - ASSERT_UNCHANGED (nm_setting_ip4_config_remove_address (s_ip4, 1)); + g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->addresses->len*"); + ASSERT_UNCHANGED (nm_setting_ip_config_remove_address (s_ip4, 1)); g_test_assert_expected_messages (); - nm_setting_ip4_config_add_address (s_ip4, addr); - ASSERT_CHANGED (nm_setting_ip4_config_clear_addresses (s_ip4)); + nm_setting_ip_config_add_address (s_ip4, addr); + ASSERT_CHANGED (nm_setting_ip_config_clear_addresses (s_ip4)); route = nm_ip_route_new (AF_INET, "22.33.0.0", 24, NULL, 0, &error); g_assert_no_error (error); - ASSERT_CHANGED (nm_setting_ip4_config_add_route (s_ip4, route)); - ASSERT_CHANGED (nm_setting_ip4_config_remove_route (s_ip4, 0)); + ASSERT_CHANGED (nm_setting_ip_config_add_route (s_ip4, route)); + ASSERT_CHANGED (nm_setting_ip_config_remove_route (s_ip4, 0)); - g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); - ASSERT_UNCHANGED (nm_setting_ip4_config_remove_route (s_ip4, 1)); + g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->routes->len*"); + ASSERT_UNCHANGED (nm_setting_ip_config_remove_route (s_ip4, 1)); g_test_assert_expected_messages (); - nm_setting_ip4_config_add_route (s_ip4, route); - ASSERT_CHANGED (nm_setting_ip4_config_clear_routes (s_ip4)); + nm_setting_ip_config_add_route (s_ip4, route); + ASSERT_CHANGED (nm_setting_ip_config_clear_routes (s_ip4)); nm_ip_address_unref (addr); nm_ip_route_unref (route); @@ -2515,7 +2515,7 @@ test_setting_ip6_changed_signal (void) { NMConnection *connection; gboolean changed = FALSE; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; NMIPAddress *addr; NMIPRoute *route; GError *error = NULL; @@ -2526,54 +2526,54 @@ test_setting_ip6_changed_signal (void) (GCallback) test_connection_changed_cb, &changed); - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); - ASSERT_CHANGED (nm_setting_ip6_config_add_dns (s_ip6, "1:2:3::4:5:6")); - ASSERT_CHANGED (nm_setting_ip6_config_remove_dns (s_ip6, 0)); + ASSERT_CHANGED (nm_setting_ip_config_add_dns (s_ip6, "1:2:3::4:5:6")); + ASSERT_CHANGED (nm_setting_ip_config_remove_dns (s_ip6, 0)); - g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); - ASSERT_UNCHANGED (nm_setting_ip6_config_remove_dns (s_ip6, 1)); + g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns->len*"); + ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns (s_ip6, 1)); g_test_assert_expected_messages (); - nm_setting_ip6_config_add_dns (s_ip6, "1:2:3::4:5:6"); - ASSERT_CHANGED (nm_setting_ip6_config_clear_dns (s_ip6)); + nm_setting_ip_config_add_dns (s_ip6, "1:2:3::4:5:6"); + ASSERT_CHANGED (nm_setting_ip_config_clear_dns (s_ip6)); - ASSERT_CHANGED (nm_setting_ip6_config_add_dns_search (s_ip6, "foobar.com")); - ASSERT_CHANGED (nm_setting_ip6_config_remove_dns_search (s_ip6, 0)); + ASSERT_CHANGED (nm_setting_ip_config_add_dns_search (s_ip6, "foobar.com")); + ASSERT_CHANGED (nm_setting_ip_config_remove_dns_search (s_ip6, 0)); - g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); - ASSERT_UNCHANGED (nm_setting_ip6_config_remove_dns_search (s_ip6, 1)); + g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns_search->len*"); + ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns_search (s_ip6, 1)); g_test_assert_expected_messages (); - nm_setting_ip6_config_add_dns_search (s_ip6, "foobar.com"); - ASSERT_CHANGED (nm_setting_ip6_config_clear_dns_searches (s_ip6)); + nm_setting_ip_config_add_dns_search (s_ip6, "foobar.com"); + ASSERT_CHANGED (nm_setting_ip_config_clear_dns_searches (s_ip6)); addr = nm_ip_address_new (AF_INET6, "1:2:3::4:5:6", 64, NULL, &error); g_assert_no_error (error); - ASSERT_CHANGED (nm_setting_ip6_config_add_address (s_ip6, addr)); - ASSERT_CHANGED (nm_setting_ip6_config_remove_address (s_ip6, 0)); + ASSERT_CHANGED (nm_setting_ip_config_add_address (s_ip6, addr)); + ASSERT_CHANGED (nm_setting_ip_config_remove_address (s_ip6, 0)); - g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); - ASSERT_UNCHANGED (nm_setting_ip6_config_remove_address (s_ip6, 1)); + g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->addresses->len*"); + ASSERT_UNCHANGED (nm_setting_ip_config_remove_address (s_ip6, 1)); g_test_assert_expected_messages (); - nm_setting_ip6_config_add_address (s_ip6, addr); - ASSERT_CHANGED (nm_setting_ip6_config_clear_addresses (s_ip6)); + nm_setting_ip_config_add_address (s_ip6, addr); + ASSERT_CHANGED (nm_setting_ip_config_clear_addresses (s_ip6)); route = nm_ip_route_new (AF_INET6, "1:2:3::4:5:6", 128, NULL, 0, &error); g_assert_no_error (error); - ASSERT_CHANGED (nm_setting_ip6_config_add_route (s_ip6, route)); - ASSERT_CHANGED (nm_setting_ip6_config_remove_route (s_ip6, 0)); + ASSERT_CHANGED (nm_setting_ip_config_add_route (s_ip6, route)); + ASSERT_CHANGED (nm_setting_ip_config_remove_route (s_ip6, 0)); - g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); - ASSERT_UNCHANGED (nm_setting_ip6_config_remove_route (s_ip6, 1)); + g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->routes->len*"); + ASSERT_UNCHANGED (nm_setting_ip_config_remove_route (s_ip6, 1)); g_test_assert_expected_messages (); - nm_setting_ip6_config_add_route (s_ip6, route); - ASSERT_CHANGED (nm_setting_ip6_config_clear_routes (s_ip6)); + nm_setting_ip_config_add_route (s_ip6, route); + ASSERT_CHANGED (nm_setting_ip_config_clear_routes (s_ip6)); nm_ip_address_unref (addr); nm_ip_route_unref (route); @@ -2834,12 +2834,12 @@ test_connection_normalize_virtual_iface_name (void) nm_connection_add_setting (con, g_object_new (NM_TYPE_SETTING_IP4_CONFIG, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL)); nm_connection_add_setting (con, g_object_new (NM_TYPE_SETTING_IP6_CONFIG, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL)); s_vlan = nm_connection_get_setting_vlan (con); diff --git a/libnm-core/tests/test-secrets.c b/libnm-core/tests/test-secrets.c index b93a1ba155..bb4b4daea5 100644 --- a/libnm-core/tests/test-secrets.c +++ b/libnm-core/tests/test-secrets.c @@ -125,7 +125,7 @@ make_tls_connection (const char *detail, NMSetting8021xCKScheme scheme) s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, detail, "failed to verify connection: %s", @@ -293,7 +293,7 @@ make_tls_phase2_connection (const char *detail, NMSetting8021xCKScheme scheme) s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, detail, "failed to verify connection: %s", diff --git a/libnm/libnm.ver b/libnm/libnm.ver index b40c232591..5a5d534bfc 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -551,74 +551,45 @@ global: nm_setting_infiniband_get_type; nm_setting_infiniband_get_virtual_interface_name; nm_setting_infiniband_new; - nm_setting_ip4_config_add_address; - nm_setting_ip4_config_add_dns; - nm_setting_ip4_config_add_dns_search; - nm_setting_ip4_config_add_route; - nm_setting_ip4_config_clear_addresses; - nm_setting_ip4_config_clear_dns; - nm_setting_ip4_config_clear_dns_searches; - nm_setting_ip4_config_clear_routes; - nm_setting_ip4_config_get_address; nm_setting_ip4_config_get_dhcp_client_id; - nm_setting_ip4_config_get_dhcp_hostname; - nm_setting_ip4_config_get_dhcp_send_hostname; - nm_setting_ip4_config_get_dns; - nm_setting_ip4_config_get_dns_search; - nm_setting_ip4_config_get_ignore_auto_dns; - nm_setting_ip4_config_get_ignore_auto_routes; - nm_setting_ip4_config_get_may_fail; - nm_setting_ip4_config_get_method; - nm_setting_ip4_config_get_never_default; - nm_setting_ip4_config_get_num_addresses; - nm_setting_ip4_config_get_num_dns; - nm_setting_ip4_config_get_num_dns_searches; - nm_setting_ip4_config_get_num_routes; - nm_setting_ip4_config_get_route; nm_setting_ip4_config_get_type; nm_setting_ip4_config_new; - nm_setting_ip4_config_remove_address; - nm_setting_ip4_config_remove_address_by_value; - nm_setting_ip4_config_remove_dns; - nm_setting_ip4_config_remove_dns_by_value; - nm_setting_ip4_config_remove_dns_search; - nm_setting_ip4_config_remove_dns_search_by_value; - nm_setting_ip4_config_remove_route; - nm_setting_ip4_config_remove_route_by_value; - nm_setting_ip6_config_add_address; - nm_setting_ip6_config_add_dns; - nm_setting_ip6_config_add_dns_search; - nm_setting_ip6_config_add_route; - nm_setting_ip6_config_clear_addresses; - nm_setting_ip6_config_clear_dns; - nm_setting_ip6_config_clear_dns_searches; - nm_setting_ip6_config_clear_routes; - nm_setting_ip6_config_get_address; - nm_setting_ip6_config_get_dhcp_hostname; - nm_setting_ip6_config_get_dns; - nm_setting_ip6_config_get_dns_search; - nm_setting_ip6_config_get_ignore_auto_dns; - nm_setting_ip6_config_get_ignore_auto_routes; nm_setting_ip6_config_get_ip6_privacy; - nm_setting_ip6_config_get_may_fail; - nm_setting_ip6_config_get_method; - nm_setting_ip6_config_get_never_default; - nm_setting_ip6_config_get_num_addresses; - nm_setting_ip6_config_get_num_dns; - nm_setting_ip6_config_get_num_dns_searches; - nm_setting_ip6_config_get_num_routes; - nm_setting_ip6_config_get_route; nm_setting_ip6_config_get_type; nm_setting_ip6_config_new; nm_setting_ip6_config_privacy_get_type; - nm_setting_ip6_config_remove_address; - nm_setting_ip6_config_remove_address_by_value; - nm_setting_ip6_config_remove_dns; - nm_setting_ip6_config_remove_dns_by_value; - nm_setting_ip6_config_remove_dns_search; - nm_setting_ip6_config_remove_dns_search_by_value; - nm_setting_ip6_config_remove_route; - nm_setting_ip6_config_remove_route_by_value; + nm_setting_ip_config_add_address; + nm_setting_ip_config_add_dns; + nm_setting_ip_config_add_dns_search; + nm_setting_ip_config_add_route; + nm_setting_ip_config_clear_addresses; + nm_setting_ip_config_clear_dns; + nm_setting_ip_config_clear_dns_searches; + nm_setting_ip_config_clear_routes; + nm_setting_ip_config_get_address; + nm_setting_ip_config_get_dhcp_hostname; + nm_setting_ip_config_get_dhcp_send_hostname; + nm_setting_ip_config_get_dns; + nm_setting_ip_config_get_dns_search; + nm_setting_ip_config_get_ignore_auto_dns; + nm_setting_ip_config_get_ignore_auto_routes; + nm_setting_ip_config_get_may_fail; + nm_setting_ip_config_get_method; + nm_setting_ip_config_get_never_default; + nm_setting_ip_config_get_num_addresses; + nm_setting_ip_config_get_num_dns; + nm_setting_ip_config_get_num_dns_searches; + nm_setting_ip_config_get_num_routes; + nm_setting_ip_config_get_route; + nm_setting_ip_config_get_type; + nm_setting_ip_config_remove_address; + nm_setting_ip_config_remove_address_by_value; + nm_setting_ip_config_remove_dns; + nm_setting_ip_config_remove_dns_by_value; + nm_setting_ip_config_remove_dns_search; + nm_setting_ip_config_remove_dns_search_by_value; + nm_setting_ip_config_remove_route; + nm_setting_ip_config_remove_route_by_value; nm_setting_lookup_type; nm_setting_olpc_mesh_get_channel; nm_setting_olpc_mesh_get_dhcp_anycast_address; diff --git a/po/POTFILES.in b/po/POTFILES.in index 6d23a67b77..5c44103240 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -59,6 +59,7 @@ libnm-core/nm-setting-connection.c libnm-core/nm-setting-dcb.c libnm-core/nm-setting-gsm.c libnm-core/nm-setting-infiniband.c +libnm-core/nm-setting-ip-config.c libnm-core/nm-setting-ip4-config.c libnm-core/nm-setting-ip6-config.c libnm-core/nm-setting-olpc-mesh.c diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index 9b624a2f6b..19896696bb 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -1212,8 +1212,7 @@ nm_utils_get_ip_config_method (NMConnection *connection, GType ip_setting_type) { NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4, *s_ip6; const char *method; s_con = nm_connection_get_setting_connection (connection); @@ -1226,7 +1225,7 @@ nm_utils_get_ip_config_method (NMConnection *connection, else { s_ip4 = nm_connection_get_setting_ip4_config (connection); g_return_val_if_fail (s_ip4 != NULL, NM_SETTING_IP4_CONFIG_METHOD_AUTO); - method = nm_setting_ip4_config_get_method (s_ip4); + method = nm_setting_ip_config_get_method (s_ip4); g_return_val_if_fail (method != NULL, NM_SETTING_IP4_CONFIG_METHOD_AUTO); return method; @@ -1240,7 +1239,7 @@ nm_utils_get_ip_config_method (NMConnection *connection, else { s_ip6 = nm_connection_get_setting_ip6_config (connection); g_return_val_if_fail (s_ip6 != NULL, NM_SETTING_IP6_CONFIG_METHOD_AUTO); - method = nm_setting_ip6_config_get_method (s_ip6); + method = nm_setting_ip_config_get_method (s_ip6); g_return_val_if_fail (method != NULL, NM_SETTING_IP6_CONFIG_METHOD_AUTO); return method; @@ -1387,12 +1386,12 @@ check_ip6_method (NMConnection *orig, { GHashTable *props; const char *orig_ip6_method, *candidate_ip6_method; - NMSettingIP6Config *candidate_ip6; + NMSettingIPConfig *candidate_ip6; gboolean allow = FALSE; props = check_property_in_hash (settings, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); if (!props) return TRUE; @@ -1408,7 +1407,7 @@ check_ip6_method (NMConnection *orig, if ( strcmp (orig_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0 && strcmp (candidate_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0 - && (!candidate_ip6 || nm_setting_ip6_config_get_may_fail (candidate_ip6))) { + && (!candidate_ip6 || nm_setting_ip_config_get_may_fail (candidate_ip6))) { allow = TRUE; } @@ -1425,7 +1424,7 @@ check_ip6_method (NMConnection *orig, if (allow) { remove_from_hash (settings, props, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); } return allow; } @@ -1438,11 +1437,11 @@ check_ip4_method (NMConnection *orig, { GHashTable *props; const char *orig_ip4_method, *candidate_ip4_method; - NMSettingIP4Config *candidate_ip4; + NMSettingIPConfig *candidate_ip4; props = check_property_in_hash (settings, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); if (!props) return TRUE; @@ -1457,11 +1456,11 @@ check_ip4_method (NMConnection *orig, if ( strcmp (orig_ip4_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0 && strcmp (candidate_ip4_method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0 - && (!candidate_ip4 || nm_setting_ip4_config_get_may_fail (candidate_ip4)) + && (!candidate_ip4 || nm_setting_ip_config_get_may_fail (candidate_ip4)) && (device_has_carrier == FALSE)) { remove_from_hash (settings, props, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); return TRUE; } return FALSE; diff --git a/src/devices/bluetooth/nm-bluez-device.c b/src/devices/bluetooth/nm-bluez-device.c index 74a89a5f64..40fb31819b 100644 --- a/src/devices/bluetooth/nm-bluez-device.c +++ b/src/devices/bluetooth/nm-bluez-device.c @@ -211,16 +211,16 @@ pan_connection_check_create (NMBluezDevice *self) /* Setting: IPv4 */ setting = nm_setting_ip4_config_new (); g_object_set (G_OBJECT (setting), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, - NM_SETTING_IP4_CONFIG_MAY_FAIL, FALSE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_MAY_FAIL, FALSE, NULL); nm_connection_add_setting (connection, setting); /* Setting: IPv6 */ setting = nm_setting_ip6_config_new (); g_object_set (G_OBJECT (setting), - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); nm_connection_add_setting (connection, setting); diff --git a/src/devices/nm-device-gre.c b/src/devices/nm-device-gre.c index e7df12e3f8..9c25b398ce 100644 --- a/src/devices/nm-device-gre.c +++ b/src/devices/nm-device-gre.c @@ -21,6 +21,7 @@ #include "config.h" #include <string.h> +#include <arpa/inet.h> #include "nm-device-gre.h" #include "nm-device-private.h" diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 6071b9527d..a9ea2cb61c 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -2106,8 +2106,7 @@ gboolean nm_device_ip_config_should_fail (NMDevice *self, gboolean ip6) { NMConnection *connection; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4, *s_ip6; g_return_val_if_fail (self != NULL, TRUE); @@ -2117,11 +2116,11 @@ nm_device_ip_config_should_fail (NMDevice *self, gboolean ip6) /* Fail the connection if the failed IP method is required to complete */ if (ip6) { s_ip6 = nm_connection_get_setting_ip6_config (connection); - if (!nm_setting_ip6_config_get_may_fail (s_ip6)) + if (!nm_setting_ip_config_get_may_fail (s_ip6)) return TRUE; } else { s_ip4 = nm_connection_get_setting_ip4_config (connection); - if (!nm_setting_ip4_config_get_may_fail (s_ip4)) + if (!nm_setting_ip_config_get_may_fail (s_ip4)) return TRUE; } @@ -2778,7 +2777,7 @@ dhcp4_start (NMDevice *self, NMDeviceStateReason *reason) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; const guint8 *hw_addr; size_t hw_addr_len = 0; GByteArray *tmp = NULL; @@ -2804,9 +2803,9 @@ dhcp4_start (NMDevice *self, tmp, nm_connection_get_uuid (connection), nm_device_get_priority (self), - nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4), - nm_setting_ip4_config_get_dhcp_hostname (s_ip4), - nm_setting_ip4_config_get_dhcp_client_id (s_ip4), + nm_setting_ip_config_get_dhcp_send_hostname (s_ip4), + nm_setting_ip_config_get_dhcp_hostname (s_ip4), + nm_setting_ip4_config_get_dhcp_client_id (NM_SETTING_IP4_CONFIG (s_ip4)), priv->dhcp_timeout, priv->dhcp_anycast_address); @@ -2864,16 +2863,16 @@ release_shared_ip (gpointer data) } static gboolean -reserve_shared_ip (NMDevice *self, NMSettingIP4Config *s_ip4, NMPlatformIP4Address *address) +reserve_shared_ip (NMDevice *self, NMSettingIPConfig *s_ip4, NMPlatformIP4Address *address) { if (G_UNLIKELY (shared_ips == NULL)) shared_ips = g_hash_table_new (g_direct_hash, g_direct_equal); memset (address, 0, sizeof (*address)); - if (s_ip4 && nm_setting_ip4_config_get_num_addresses (s_ip4)) { + if (s_ip4 && nm_setting_ip_config_get_num_addresses (s_ip4)) { /* Use the first user-supplied address */ - NMIPAddress *user = nm_setting_ip4_config_get_address (s_ip4, 0); + NMIPAddress *user = nm_setting_ip_config_get_address (s_ip4, 0); g_assert (user); nm_ip_address_get_address_binary (user, &address->address); @@ -2964,8 +2963,7 @@ connection_ip6_method_requires_carrier (NMConnection *connection, static gboolean connection_requires_carrier (NMConnection *connection) { - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4, *s_ip6; gboolean ip4_carrier_wanted, ip6_carrier_wanted; gboolean ip4_used = FALSE, ip6_used = FALSE; @@ -2975,7 +2973,7 @@ connection_requires_carrier (NMConnection *connection) * requires a carrier regardless of the IPv6 method. */ s_ip4 = nm_connection_get_setting_ip4_config (connection); - if (s_ip4 && !nm_setting_ip4_config_get_may_fail (s_ip4)) + if (s_ip4 && !nm_setting_ip_config_get_may_fail (s_ip4)) return TRUE; } @@ -2985,7 +2983,7 @@ connection_requires_carrier (NMConnection *connection) * requires a carrier regardless of the IPv4 method. */ s_ip6 = nm_connection_get_setting_ip6_config (connection); - if (s_ip6 && !nm_setting_ip6_config_get_may_fail (s_ip6)) + if (s_ip6 && !nm_setting_ip_config_get_may_fail (s_ip6)) return TRUE; } @@ -3320,7 +3318,7 @@ dhcp6_start (NMDevice *self, guint32 dhcp_opt, NMDeviceStateReason *reason) { - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE; GByteArray *tmp = NULL; @@ -3358,11 +3356,11 @@ dhcp6_start (NMDevice *self, tmp, nm_connection_get_uuid (connection), nm_device_get_priority (self), - nm_setting_ip6_config_get_dhcp_hostname (s_ip6), + nm_setting_ip_config_get_dhcp_hostname (s_ip6), priv->dhcp_timeout, priv->dhcp_anycast_address, (dhcp_opt == NM_RDISC_DHCP_LEVEL_OTHERCONF) ? TRUE : FALSE, - nm_setting_ip6_config_get_ip6_privacy (s_ip6)); + nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6))); if (tmp) g_byte_array_free (tmp, TRUE); @@ -3373,8 +3371,8 @@ dhcp6_start (NMDevice *self, self); s_ip6 = nm_connection_get_setting_ip6_config (connection); - if (!nm_setting_ip6_config_get_may_fail (s_ip6) || - !strcmp (nm_setting_ip6_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_DHCP)) + if (!nm_setting_ip_config_get_may_fail (s_ip6) || + !strcmp (nm_setting_ip_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_DHCP)) nm_device_add_pending_action (self, PENDING_ACTION_DHCP6, TRUE); /* DHCP devices will be notified by the DHCP manager when stuff happens */ @@ -3858,7 +3856,7 @@ addrconf6_start (NMDevice *self, NMSettingIP6ConfigPrivacy use_tempaddr) priv->rdisc_use_tempaddr = use_tempaddr; print_support_extended_ifa_flags (use_tempaddr); - if (!nm_setting_ip6_config_get_may_fail (nm_connection_get_setting_ip6_config (connection))) + if (!nm_setting_ip_config_get_may_fail (nm_connection_get_setting_ip6_config (connection))) nm_device_add_pending_action (self, PENDING_ACTION_AUTOCONF6, TRUE); /* ensure link local is ready... */ @@ -4116,10 +4114,10 @@ act_stage3_ip6_config_start (NMDevice *self, */ ip6_privacy = ip6_use_tempaddr (); if (ip6_privacy == NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN) { - NMSettingIP6Config *s_ip6 = nm_connection_get_setting_ip6_config (connection); + NMSettingIPConfig *s_ip6 = nm_connection_get_setting_ip6_config (connection); if (s_ip6) - ip6_privacy = nm_setting_ip6_config_get_ip6_privacy (s_ip6); + ip6_privacy = nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6)); } ip6_privacy = use_tempaddr_clamp (ip6_privacy); @@ -4648,7 +4646,7 @@ send_arps (NMDevice *self, const char *mode_arg) const char *argv[] = { NULL, mode_arg, "-q", "-I", nm_device_get_ip_iface (self), "-c", "1", NULL, NULL }; int ip_arg = G_N_ELEMENTS (argv) - 2; NMConnection *connection; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; int i, num; NMIPAddress *addr; GError *error = NULL; @@ -4659,7 +4657,7 @@ send_arps (NMDevice *self, const char *mode_arg) s_ip4 = nm_connection_get_setting_ip4_config (connection); if (!s_ip4) return; - num = nm_setting_ip4_config_get_num_addresses (s_ip4); + num = nm_setting_ip_config_get_num_addresses (s_ip4); if (num == 0) return; @@ -4671,7 +4669,7 @@ send_arps (NMDevice *self, const char *mode_arg) for (i = 0; i < num; i++) { gs_free char *tmp_str = NULL; - addr = nm_setting_ip4_config_get_address (s_ip4, i); + addr = nm_setting_ip_config_get_address (s_ip4, i); argv[ip_arg] = nm_ip_address_get_address (addr); _LOGD (LOGD_DEVICE | LOGD_IP4, @@ -4719,7 +4717,7 @@ arp_announce (NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMConnection *connection; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; int num; arp_cleanup (self); @@ -4733,7 +4731,7 @@ arp_announce (NMDevice *self) s_ip4 = nm_connection_get_setting_ip4_config (connection); if (!s_ip4) return; - num = nm_setting_ip4_config_get_num_addresses (s_ip4); + num = nm_setting_ip_config_get_num_addresses (s_ip4); if (num == 0) return; diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 1210106a0e..f8b4c2a3d6 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -2809,14 +2809,14 @@ act_stage3_ip4_config_start (NMDevice *device, NMDeviceStateReason *reason) { NMConnection *connection; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; const char *method = NM_SETTING_IP4_CONFIG_METHOD_AUTO; connection = nm_device_get_connection (device); g_assert (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection); if (s_ip4) - method = nm_setting_ip4_config_get_method (s_ip4); + method = nm_setting_ip_config_get_method (s_ip4); /* Indicate that a critical protocol is about to start */ if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0) @@ -2831,14 +2831,14 @@ act_stage3_ip6_config_start (NMDevice *device, NMDeviceStateReason *reason) { NMConnection *connection; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; const char *method = NM_SETTING_IP6_CONFIG_METHOD_AUTO; connection = nm_device_get_connection (device); g_assert (connection); s_ip6 = nm_connection_get_setting_ip6_config (connection); if (s_ip6) - method = nm_setting_ip6_config_get_method (s_ip6); + method = nm_setting_ip_config_get_method (s_ip6); /* Indicate that a critical protocol is about to start */ if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0 || @@ -2938,7 +2938,7 @@ static NMActStageReturn act_stage4_ip4_config_timeout (NMDevice *device, NMDeviceStateReason *reason) { NMConnection *connection; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; gboolean may_fail = FALSE, chain_up = FALSE; NMActStageReturn ret; @@ -2946,7 +2946,7 @@ act_stage4_ip4_config_timeout (NMDevice *device, NMDeviceStateReason *reason) g_assert (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection); - may_fail = nm_setting_ip4_config_get_may_fail (s_ip4); + may_fail = nm_setting_ip_config_get_may_fail (s_ip4); ret = handle_ip_config_timeout (NM_DEVICE_WIFI (device), connection, may_fail, &chain_up, reason); if (chain_up) @@ -2959,7 +2959,7 @@ static NMActStageReturn act_stage4_ip6_config_timeout (NMDevice *device, NMDeviceStateReason *reason) { NMConnection *connection; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; gboolean may_fail = FALSE, chain_up = FALSE; NMActStageReturn ret; @@ -2967,7 +2967,7 @@ act_stage4_ip6_config_timeout (NMDevice *device, NMDeviceStateReason *reason) g_assert (connection); s_ip6 = nm_connection_get_setting_ip6_config (connection); - may_fail = nm_setting_ip6_config_get_may_fail (s_ip6); + may_fail = nm_setting_ip_config_get_may_fail (s_ip6); ret = handle_ip_config_timeout (NM_DEVICE_WIFI (device), connection, may_fail, &chain_up, reason); if (chain_up) diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c index e896cbc10a..cf61a077f4 100644 --- a/src/devices/wwan/nm-modem-broadband.c +++ b/src/devices/wwan/nm-modem-broadband.c @@ -20,6 +20,7 @@ #include <glib/gi18n.h> #include <string.h> +#include <arpa/inet.h> #include <libmm-glib.h> #include "nm-modem-broadband.h" diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c index 431dc05c0b..ba01d5ca46 100644 --- a/src/devices/wwan/nm-modem.c +++ b/src/devices/wwan/nm-modem.c @@ -235,26 +235,25 @@ nm_modem_get_connection_ip_type (NMModem *self, GError **error) { NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self); - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4, *s_ip6; const char *method; gboolean ip4 = TRUE, ip6 = TRUE; gboolean ip4_may_fail = TRUE, ip6_may_fail = TRUE; s_ip4 = nm_connection_get_setting_ip4_config (connection); if (s_ip4) { - method = nm_setting_ip4_config_get_method (s_ip4); + method = nm_setting_ip_config_get_method (s_ip4); if (g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0) ip4 = FALSE; - ip4_may_fail = nm_setting_ip4_config_get_may_fail (s_ip4); + ip4_may_fail = nm_setting_ip_config_get_may_fail (s_ip4); } s_ip6 = nm_connection_get_setting_ip6_config (connection); if (s_ip6) { - method = nm_setting_ip6_config_get_method (s_ip6); + method = nm_setting_ip_config_get_method (s_ip6); if (g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0) ip6 = FALSE; - ip6_may_fail = nm_setting_ip6_config_get_may_fail (s_ip6); + ip6_may_fail = nm_setting_ip_config_get_may_fail (s_ip6); } if (ip4 && !ip6) { diff --git a/src/dhcp-manager/nm-dhcp-dhclient-utils.c b/src/dhcp-manager/nm-dhcp-dhclient-utils.c index 2469076719..a53e95b009 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient-utils.c +++ b/src/dhcp-manager/nm-dhcp-dhclient-utils.c @@ -23,6 +23,7 @@ #include <glib/gi18n.h> #include <string.h> #include <ctype.h> +#include <arpa/inet.h> #include "nm-dhcp-dhclient-utils.h" #include "nm-ip4-config.h" diff --git a/src/dhcp-manager/nm-dhcp-utils.c b/src/dhcp-manager/nm-dhcp-utils.c index 02fc4fe513..424d93db11 100644 --- a/src/dhcp-manager/nm-dhcp-utils.c +++ b/src/dhcp-manager/nm-dhcp-utils.c @@ -22,6 +22,7 @@ #include <string.h> #include <errno.h> #include <unistd.h> +#include <arpa/inet.h> #include "nm-logging.h" #include "nm-dhcp-utils.h" diff --git a/src/dhcp-manager/tests/test-dhcp-dhclient.c b/src/dhcp-manager/tests/test-dhcp-dhclient.c index ab496b38bd..2ddf6b5078 100644 --- a/src/dhcp-manager/tests/test-dhcp-dhclient.c +++ b/src/dhcp-manager/tests/test-dhcp-dhclient.c @@ -21,6 +21,7 @@ #include <glib.h> #include <string.h> #include <unistd.h> +#include <arpa/inet.h> #include "nm-dhcp-dhclient-utils.h" #include "nm-utils.h" diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index cebfe3bbe9..c51b449920 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -20,6 +20,7 @@ */ #include <string.h> +#include <arpa/inet.h> #include "nm-ip4-config.h" @@ -296,7 +297,7 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex) } void -nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, int default_route_metric) +nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, int default_route_metric) { guint naddresses, nroutes, nnameservers, nsearches; int i; @@ -304,20 +305,22 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i if (!setting) return; + g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting)); + g_object_freeze_notify (G_OBJECT (config)); - naddresses = nm_setting_ip4_config_get_num_addresses (setting); - nroutes = nm_setting_ip4_config_get_num_routes (setting); - nnameservers = nm_setting_ip4_config_get_num_dns (setting); - nsearches = nm_setting_ip4_config_get_num_dns_searches (setting); + naddresses = nm_setting_ip_config_get_num_addresses (setting); + nroutes = nm_setting_ip_config_get_num_routes (setting); + nnameservers = nm_setting_ip_config_get_num_dns (setting); + nsearches = nm_setting_ip_config_get_num_dns_searches (setting); /* Gateway */ - if (nm_setting_ip4_config_get_never_default (setting)) + if (nm_setting_ip_config_get_never_default (setting)) nm_ip4_config_set_never_default (config, TRUE); - else if (nm_setting_ip4_config_get_ignore_auto_routes (setting)) + else if (nm_setting_ip_config_get_ignore_auto_routes (setting)) nm_ip4_config_set_never_default (config, FALSE); for (i = 0; i < naddresses; i++) { - const char *gateway_str = nm_ip_address_get_gateway (nm_setting_ip4_config_get_address (setting, i)); + const char *gateway_str = nm_ip_address_get_gateway (nm_setting_ip_config_get_address (setting, i)); guint32 gateway; if (gateway_str) { @@ -329,7 +332,7 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i /* Addresses */ for (i = 0; i < naddresses; i++) { - NMIPAddress *s_addr = nm_setting_ip4_config_get_address (setting, i); + NMIPAddress *s_addr = nm_setting_ip_config_get_address (setting, i); GVariant *label; NMPlatformIP4Address address; @@ -348,10 +351,10 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i } /* Routes */ - if (nm_setting_ip4_config_get_ignore_auto_routes (setting)) + if (nm_setting_ip_config_get_ignore_auto_routes (setting)) nm_ip4_config_reset_routes (config); for (i = 0; i < nroutes; i++) { - NMIPRoute *s_route = nm_setting_ip4_config_get_route (setting, i); + NMIPRoute *s_route = nm_setting_ip_config_get_route (setting, i); NMPlatformIP4Route route; memset (&route, 0, sizeof (route)); @@ -367,7 +370,7 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i } /* DNS */ - if (nm_setting_ip4_config_get_ignore_auto_dns (setting)) { + if (nm_setting_ip_config_get_ignore_auto_dns (setting)) { nm_ip4_config_reset_nameservers (config); nm_ip4_config_reset_domains (config); nm_ip4_config_reset_searches (config); @@ -375,11 +378,11 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *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) + if (inet_pton (AF_INET, nm_setting_ip_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)); + nm_ip4_config_add_search (config, nm_setting_ip_config_get_dns_search (setting, i)); g_object_thaw_notify (G_OBJECT (config)); } @@ -387,17 +390,17 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i NMSetting * nm_ip4_config_create_setting (const NMIP4Config *config) { - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; guint32 gateway; guint naddresses, nroutes, nnameservers, nsearches; const char *method = NULL; int i; - s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); + s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ()); if (!config) { g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, NULL); return NM_SETTING (s_ip4); } @@ -433,14 +436,14 @@ nm_ip4_config_create_setting (const NMIP4Config *config) if (*address->label) nm_ip_address_set_attribute (s_addr, "label", g_variant_new_string (address->label)); - nm_setting_ip4_config_add_address (s_ip4, s_addr); + nm_setting_ip_config_add_address (s_ip4, s_addr); nm_ip_address_unref (s_addr); } /* Use 'disabled' if the method wasn't previously set */ if (!method) method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED; - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, method, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, method, NULL); /* Routes */ for (i = 0; i < nroutes; i++) { @@ -459,7 +462,7 @@ nm_ip4_config_create_setting (const NMIP4Config *config) &route->network, route->plen, &route->gateway, route->metric, NULL); - nm_setting_ip4_config_add_route (s_ip4, s_route); + nm_setting_ip_config_add_route (s_ip4, s_route); nm_ip_route_unref (s_route); } @@ -467,12 +470,12 @@ 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, nm_utils_inet4_ntop (nameserver, NULL)); + nm_setting_ip_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); - nm_setting_ip4_config_add_dns_search (s_ip4, search); + nm_setting_ip_config_add_dns_search (s_ip4, search); } return NM_SETTING (s_ip4); diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h index 16372be5cd..e9f2642af7 100644 --- a/src/nm-ip4-config.h +++ b/src/nm-ip4-config.h @@ -61,7 +61,7 @@ const char * nm_ip4_config_get_dbus_path (const NMIP4Config *config); /* Integration with nm-platform and nm-setting */ NMIP4Config *nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf); gboolean nm_ip4_config_commit (const NMIP4Config *config, int ifindex); -void nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, int default_route_metric); +void nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, int default_route_metric); NMSetting *nm_ip4_config_create_setting (const NMIP4Config *config); /* Utility functions */ diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c index ed7d41b46b..e022e7178c 100644 --- a/src/nm-ip6-config.c +++ b/src/nm-ip6-config.c @@ -20,6 +20,7 @@ */ #include <string.h> +#include <arpa/inet.h> #include "nm-ip6-config.h" @@ -400,7 +401,7 @@ nm_ip6_config_commit (const NMIP6Config *config, int ifindex) } void -nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, int default_route_metric) +nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIPConfig *setting, int default_route_metric) { guint naddresses, nroutes, nnameservers, nsearches; int i; @@ -408,20 +409,22 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i if (!setting) return; - naddresses = nm_setting_ip6_config_get_num_addresses (setting); - nroutes = nm_setting_ip6_config_get_num_routes (setting); - nnameservers = nm_setting_ip6_config_get_num_dns (setting); - nsearches = nm_setting_ip6_config_get_num_dns_searches (setting); + g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); + + naddresses = nm_setting_ip_config_get_num_addresses (setting); + nroutes = nm_setting_ip_config_get_num_routes (setting); + nnameservers = nm_setting_ip_config_get_num_dns (setting); + nsearches = nm_setting_ip_config_get_num_dns_searches (setting); g_object_freeze_notify (G_OBJECT (config)); /* Gateway */ - if (nm_setting_ip6_config_get_never_default (setting)) + if (nm_setting_ip_config_get_never_default (setting)) nm_ip6_config_set_never_default (config, TRUE); - else if (nm_setting_ip6_config_get_ignore_auto_routes (setting)) + else if (nm_setting_ip_config_get_ignore_auto_routes (setting)) nm_ip6_config_set_never_default (config, FALSE); for (i = 0; i < naddresses; i++) { - const char *gateway_str = nm_ip_address_get_gateway (nm_setting_ip6_config_get_address (setting, i)); + const char *gateway_str = nm_ip_address_get_gateway (nm_setting_ip_config_get_address (setting, i)); struct in6_addr gateway; if (gateway_str) { @@ -433,7 +436,7 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i /* Addresses */ for (i = 0; i < naddresses; i++) { - NMIPAddress *s_addr = nm_setting_ip6_config_get_address (setting, i); + NMIPAddress *s_addr = nm_setting_ip_config_get_address (setting, i); NMPlatformIP6Address address; memset (&address, 0, sizeof (address)); @@ -447,10 +450,10 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i } /* Routes */ - if (nm_setting_ip6_config_get_ignore_auto_routes (setting)) + if (nm_setting_ip_config_get_ignore_auto_routes (setting)) nm_ip6_config_reset_routes (config); for (i = 0; i < nroutes; i++) { - NMIPRoute *s_route = nm_setting_ip6_config_get_route (setting, i); + NMIPRoute *s_route = nm_setting_ip_config_get_route (setting, i); NMPlatformIP6Route route; memset (&route, 0, sizeof (route)); @@ -466,7 +469,7 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i } /* DNS */ - if (nm_setting_ip6_config_get_ignore_auto_dns (setting)) { + if (nm_setting_ip_config_get_ignore_auto_dns (setting)) { nm_ip6_config_reset_nameservers (config); nm_ip6_config_reset_domains (config); nm_ip6_config_reset_searches (config); @@ -474,11 +477,11 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i for (i = 0; i < nnameservers; i++) { struct in6_addr ip; - if (inet_pton (AF_INET6, nm_setting_ip6_config_get_dns (setting, i), &ip) == 1) + if (inet_pton (AF_INET6, nm_setting_ip_config_get_dns (setting, i), &ip) == 1) nm_ip6_config_add_nameserver (config, &ip); } for (i = 0; i < nsearches; i++) - nm_ip6_config_add_search (config, nm_setting_ip6_config_get_dns_search (setting, i)); + nm_ip6_config_add_search (config, nm_setting_ip_config_get_dns_search (setting, i)); g_object_thaw_notify (G_OBJECT (config)); } @@ -486,17 +489,17 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i NMSetting * nm_ip6_config_create_setting (const NMIP6Config *config) { - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; const struct in6_addr *gateway; guint naddresses, nroutes, nnameservers, nsearches; const char *method = NULL; int i; - s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ()); + s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ()); if (!config) { g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL); return NM_SETTING (s_ip6); } @@ -530,14 +533,14 @@ nm_ip6_config_create_setting (const NMIP6Config *config) method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL; s_addr = nm_ip_address_new_binary (AF_INET6, &address->address, address->plen, gateway, NULL); - nm_setting_ip6_config_add_address (s_ip6, s_addr); + nm_setting_ip_config_add_address (s_ip6, s_addr); nm_ip_address_unref (s_addr); } /* Use 'ignore' if the method wasn't previously set */ if (!method) method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE; - g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, method, NULL); + g_object_set (s_ip6, NM_SETTING_IP_CONFIG_METHOD, method, NULL); /* Routes */ for (i = 0; i < nroutes; i++) { @@ -560,7 +563,7 @@ nm_ip6_config_create_setting (const NMIP6Config *config) &route->network, route->plen, &route->gateway, route->metric, NULL); - nm_setting_ip6_config_add_route (s_ip6, s_route); + nm_setting_ip_config_add_route (s_ip6, s_route); nm_ip_route_unref (s_route); } @@ -568,12 +571,12 @@ nm_ip6_config_create_setting (const NMIP6Config *config) for (i = 0; i < nnameservers; i++) { const struct in6_addr *nameserver = nm_ip6_config_get_nameserver (config, i); - nm_setting_ip6_config_add_dns (s_ip6, nm_utils_inet6_ntop (nameserver, NULL)); + nm_setting_ip_config_add_dns (s_ip6, nm_utils_inet6_ntop (nameserver, NULL)); } for (i = 0; i < nsearches; i++) { const char *search = nm_ip6_config_get_search (config, i); - nm_setting_ip6_config_add_dns_search (s_ip6, search); + nm_setting_ip_config_add_dns_search (s_ip6, search); } return NM_SETTING (s_ip6); diff --git a/src/nm-ip6-config.h b/src/nm-ip6-config.h index 60a82b0f72..19eef01372 100644 --- a/src/nm-ip6-config.h +++ b/src/nm-ip6-config.h @@ -22,6 +22,7 @@ #define __NETWORKMANAGER_IP6_CONFIG_H__ #include <glib-object.h> +#include <netinet/in.h> #include "nm-types.h" #include "nm-setting-ip6-config.h" @@ -60,7 +61,7 @@ const char * nm_ip6_config_get_dbus_path (const NMIP6Config *config); /* Integration with nm-platform and nm-setting */ NMIP6Config *nm_ip6_config_capture (int ifindex, gboolean capture_resolv_conf, NMSettingIP6ConfigPrivacy use_temporary); gboolean nm_ip6_config_commit (const NMIP6Config *config, int ifindex); -void nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, int default_route_metric); +void nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIPConfig *setting, int default_route_metric); NMSetting *nm_ip6_config_create_setting (const NMIP6Config *config); /* Utility functions */ diff --git a/src/nm-policy.c b/src/nm-policy.c index e21df28a9c..e5a295bfb7 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -110,7 +110,7 @@ get_best_ip4_device (NMPolicy *self, gboolean fully_activated) NMDeviceState state = nm_device_get_state (dev); NMActRequest *req; NMConnection *connection; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; int prio; const char *method = NULL; @@ -151,7 +151,7 @@ get_best_ip4_device (NMPolicy *self, gboolean fully_activated) /* 'never-default' devices can't ever be the default */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - if (nm_setting_ip4_config_get_never_default (s_ip4)) + if (nm_setting_ip_config_get_never_default (s_ip4)) continue; prio = nm_device_get_priority (dev); @@ -194,7 +194,7 @@ get_best_ip6_device (NMPolicy *self, gboolean fully_activated) NMDeviceState state = nm_device_get_state (dev); NMActRequest *req; NMConnection *connection; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; int prio; const char *method = NULL; @@ -231,7 +231,7 @@ get_best_ip6_device (NMPolicy *self, gboolean fully_activated) s_ip6 = nm_connection_get_setting_ip6_config (connection); g_assert (s_ip6); - if (nm_setting_ip6_config_get_never_default (s_ip6)) + if (nm_setting_ip_config_get_never_default (s_ip6)) continue; prio = nm_device_get_priority (dev); @@ -539,7 +539,7 @@ get_best_ip4_config (NMPolicy *policy, NMVpnConnection *candidate; NMIP4Config *vpn_ip4; NMConnection *tmp; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMVpnConnectionState vpn_state; if (!NM_IS_VPN_CONNECTION (active)) @@ -565,7 +565,7 @@ get_best_ip4_config (NMPolicy *policy, /* Check the user's preference from the NMConnection */ s_ip4 = nm_connection_get_setting_ip4_config (tmp); - if (nm_setting_ip4_config_get_never_default (s_ip4)) + if (nm_setting_ip_config_get_never_default (s_ip4)) continue; } @@ -751,7 +751,7 @@ get_best_ip6_config (NMPolicy *policy, NMVpnConnection *candidate; NMIP6Config *vpn_ip6; NMConnection *tmp; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; NMVpnConnectionState vpn_state; if (!NM_IS_VPN_CONNECTION (active)) @@ -777,7 +777,7 @@ get_best_ip6_config (NMPolicy *policy, /* Check the user's preference from the NMConnection */ s_ip6 = nm_connection_get_setting_ip6_config (tmp); - if (nm_setting_ip6_config_get_never_default (s_ip6)) + if (nm_setting_ip_config_get_never_default (s_ip6)) continue; } diff --git a/src/settings/plugins/ibft/reader.c b/src/settings/plugins/ibft/reader.c index be9e249678..487e3f8b05 100644 --- a/src/settings/plugins/ibft/reader.c +++ b/src/settings/plugins/ibft/reader.c @@ -267,7 +267,7 @@ ip4_setting_add_from_block (const GPtrArray *block, NMConnection *connection, GError **error) { - NMSettingIP4Config *s_ip4 = NULL; + NMSettingIPConfig *s_ip4 = NULL; NMIPAddress *addr; const char *s_method = NULL; const char *s_ipaddr = NULL; @@ -296,10 +296,10 @@ ip4_setting_add_from_block (const GPtrArray *block, goto error; } - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); if (!g_ascii_strcasecmp (s_method, "dhcp")) { - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); goto success; } else if (g_ascii_strcasecmp (s_method, "static") != 0) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, @@ -309,7 +309,7 @@ ip4_setting_add_from_block (const GPtrArray *block, } /* Static configuration stuff */ - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); /* IP address */ if (!s_ipaddr || !nm_utils_ipaddr_valid (AF_INET, s_ipaddr)) { @@ -355,13 +355,13 @@ ip4_setting_add_from_block (const GPtrArray *block, goto error; } - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); if (s_dns1) - nm_setting_ip4_config_add_dns (s_ip4, s_dns1); + nm_setting_ip_config_add_dns (s_ip4, s_dns1); if (s_dns2) - nm_setting_ip4_config_add_dns (s_ip4, s_dns2); + nm_setting_ip_config_add_dns (s_ip4, s_dns2); success: nm_connection_add_setting (connection, NM_SETTING (s_ip4)); diff --git a/src/settings/plugins/ibft/tests/test-ibft.c b/src/settings/plugins/ibft/tests/test-ibft.c index 32e1eb6a8b..28a05bafe1 100644 --- a/src/settings/plugins/ibft/tests/test-ibft.c +++ b/src/settings/plugins/ibft/tests/test-ibft.c @@ -71,7 +71,7 @@ test_read_ibft_dhcp (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; GError *error = NULL; const char *mac_address; const char *expected_mac_address = "00:33:21:98:b9:f1"; @@ -105,7 +105,7 @@ test_read_ibft_dhcp (void) /* ===== IPv4 SETTING ===== */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO); g_object_unref (connection); } @@ -116,7 +116,7 @@ test_read_ibft_static (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; GError *error = NULL; const char *mac_address; const char *expected_mac_address = "00:33:21:98:b9:f0"; @@ -151,14 +151,14 @@ test_read_ibft_static (void) /* ===== IPv4 SETTING ===== */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); - g_assert_cmpint (nm_setting_ip4_config_get_num_dns (s_ip4), ==, 2); - g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 0), ==, "10.16.255.2"); - g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 1), ==, "10.16.255.3"); + g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 2); + g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 0), ==, "10.16.255.2"); + g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 1), ==, "10.16.255.3"); - g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 1); - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); + g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert (ip4_addr); g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.32.72"); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 22); @@ -217,7 +217,7 @@ test_read_ibft_vlan (void) NMSettingConnection *s_con; NMSettingWired *s_wired; NMSettingVlan *s_vlan; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; const char *mac_address; const char *expected_mac_address = "00:33:21:98:b9:f0"; NMIPAddress *ip4_addr; @@ -250,12 +250,12 @@ test_read_ibft_vlan (void) /* ===== IPv4 SETTING ===== */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); - g_assert_cmpint (nm_setting_ip4_config_get_num_dns (s_ip4), ==, 0); + g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 0); - g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 1); - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); + g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert (ip4_addr); g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.6.200"); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24); diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index 62f52d41c0..b16302c0ba 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -540,7 +540,7 @@ out: } static gboolean -read_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError **error) +read_route_file_legacy (const char *filename, NMSettingIPConfig *s_ip4, GError **error) { char *contents = NULL; gsize len = 0; @@ -670,7 +670,7 @@ read_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError g_free (next_hop); goto error; } - if (!nm_setting_ip4_config_add_route (s_ip4, route)) + if (!nm_setting_ip_config_add_route (s_ip4, route)) PARSE_WARNING ("duplicate IP4 route"); } @@ -771,7 +771,7 @@ error: #define IPV6_ADDR_REGEX "[0-9A-Fa-f:.]+" static gboolean -read_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **error) +read_route6_file (const char *filename, NMSettingIPConfig *s_ip6, GError **error) { char *contents = NULL; gsize len = 0; @@ -898,7 +898,7 @@ read_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **erro g_free (next_hop); if (!route) goto error; - if (!nm_setting_ip6_config_add_route (s_ip6, route)) + if (!nm_setting_ip_config_add_route (s_ip6, route)) PARSE_WARNING ("duplicate IP6 route"); } @@ -923,7 +923,7 @@ make_ip4_setting (shvarFile *ifcfg, const char *network_file, GError **error) { - NMSettingIP4Config *s_ip4 = NULL; + NMSettingIPConfig *s_ip4 = NULL; char *value = NULL; char *route_path = NULL; char *method; @@ -932,7 +932,7 @@ make_ip4_setting (shvarFile *ifcfg, shvarFile *route_ifcfg; gboolean never_default = FALSE; - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); /* First check if DEFROUTE is set for this device; DEFROUTE has the * opposite meaning from never-default. The default if DEFROUTE is not @@ -975,15 +975,15 @@ make_ip4_setting (shvarFile *ifcfg, } else if (!g_ascii_strcasecmp (value, "autoip")) { g_free (value); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL, + NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default, NULL); return NM_SETTING (s_ip4); } else if (!g_ascii_strcasecmp (value, "shared")) { g_free (value); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_SHARED, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_SHARED, + NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default, NULL); return NM_SETTING (s_ip4); } else { @@ -995,11 +995,11 @@ make_ip4_setting (shvarFile *ifcfg, g_free (value); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, method, - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "PEERDNS", TRUE), - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "PEERROUTES", TRUE), - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default, - NM_SETTING_IP4_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV4_FAILURE_FATAL", FALSE), + NM_SETTING_IP_CONFIG_METHOD, method, + NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "PEERDNS", TRUE), + NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "PEERROUTES", TRUE), + NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default, + NM_SETTING_IP_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV4_FAILURE_FATAL", FALSE), NULL); if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0) @@ -1009,11 +1009,11 @@ make_ip4_setting (shvarFile *ifcfg, if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE); if (value && strlen (value)) - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, value, NULL); g_free (value); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, + NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, svTrueValue (ifcfg, "DHCP_SEND_HOSTNAME", TRUE), NULL); @@ -1042,7 +1042,7 @@ make_ip4_setting (shvarFile *ifcfg, continue; } - if (!nm_setting_ip4_config_add_address (s_ip4, addr)) + if (!nm_setting_ip_config_add_address (s_ip4, addr)) PARSE_WARNING ("duplicate IP4 address"); nm_ip_address_unref (addr); } @@ -1057,7 +1057,7 @@ make_ip4_setting (shvarFile *ifcfg, value = svGetValue (ifcfg, tag, FALSE); if (value) { if (nm_utils_ipaddr_valid (AF_INET, value)) { - if (!nm_setting_ip4_config_add_dns (s_ip4, value)) + if (!nm_setting_ip_config_add_dns (s_ip4, value)) PARSE_WARNING ("duplicate DNS server %s", tag); } else if (nm_utils_ipaddr_valid (AF_INET6, value)) { /* Ignore IPv6 addresses */ @@ -1084,7 +1084,7 @@ make_ip4_setting (shvarFile *ifcfg, char **item; for (item = searches; *item; item++) { if (strlen (*item)) { - if (!nm_setting_ip4_config_add_dns_search (s_ip4, *item)) + if (!nm_setting_ip_config_add_dns_search (s_ip4, *item)) PARSE_WARNING ("duplicate DNS domain '%s'", *item); } } @@ -1117,7 +1117,7 @@ make_ip4_setting (shvarFile *ifcfg, if (!route) break; - if (!nm_setting_ip4_config_add_route (s_ip4, route)) + if (!nm_setting_ip_config_add_route (s_ip4, route)) PARSE_WARNING ("duplicate IP4 route"); nm_ip_route_unref (route); } @@ -1129,7 +1129,7 @@ make_ip4_setting (shvarFile *ifcfg, } /* Legacy value NM used for a while but is incorrect (rh #459370) */ - if (!nm_setting_ip4_config_get_num_dns_searches (s_ip4)) { + if (!nm_setting_ip_config_get_num_dns_searches (s_ip4)) { value = svGetValue (ifcfg, "SEARCH", FALSE); if (value) { char **searches = NULL; @@ -1139,7 +1139,7 @@ make_ip4_setting (shvarFile *ifcfg, char **item; for (item = searches; *item; item++) { if (strlen (*item)) { - if (!nm_setting_ip4_config_add_dns_search (s_ip4, *item)) + if (!nm_setting_ip_config_add_dns_search (s_ip4, *item)) PARSE_WARNING ("duplicate DNS search '%s'", *item); } } @@ -1158,7 +1158,7 @@ done: } static void -read_aliases (NMSettingIP4Config *s_ip4, const char *filename, const char *network_file) +read_aliases (NMSettingIPConfig *s_ip4, const char *filename, const char *network_file) { GDir *dir; char *dirname, *base; @@ -1169,10 +1169,10 @@ read_aliases (NMSettingIP4Config *s_ip4, const char *filename, const char *netwo g_return_if_fail (s_ip4 != NULL); g_return_if_fail (filename != NULL); - if (nm_setting_ip4_config_get_num_addresses (s_ip4) == 0) + if (nm_setting_ip_config_get_num_addresses (s_ip4) == 0) return; - base_addr = nm_setting_ip4_config_get_address (s_ip4, 0); + base_addr = nm_setting_ip_config_get_address (s_ip4, 0); dirname = g_path_get_dirname (filename); g_return_if_fail (dirname != NULL); @@ -1236,7 +1236,7 @@ read_aliases (NMSettingIP4Config *s_ip4, const char *filename, const char *netwo svCloseFile (parsed); if (ok) { nm_ip_address_set_attribute (addr, "label", g_variant_new_string (device)); - if (!nm_setting_ip4_config_add_address (s_ip4, addr)) + if (!nm_setting_ip_config_add_address (s_ip4, addr)) PARSE_WARNING ("duplicate IP4 address in alias file %s", item); } else { PARSE_WARNING ("error reading IP4 address from alias file '%s': %s", @@ -1264,7 +1264,7 @@ make_ip6_setting (shvarFile *ifcfg, const char *network_file, GError **error) { - NMSettingIP6Config *s_ip6 = NULL; + NMSettingIPConfig *s_ip6 = NULL; char *value = NULL; char *str_value; char *route6_path = NULL; @@ -1279,7 +1279,7 @@ make_ip6_setting (shvarFile *ifcfg, char *ip6_privacy_str; NMSettingIP6ConfigPrivacy ip6_privacy_val; - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); /* First check if IPV6_DEFROUTE is set for this device; IPV6_DEFROUTE has the * opposite meaning from never-default. The default if IPV6_DEFROUTE is not @@ -1376,11 +1376,11 @@ make_ip6_setting (shvarFile *ifcfg, g_free (ip6_privacy_str); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, method, - NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "IPV6_PEERDNS", TRUE), - NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "IPV6_PEERROUTES", TRUE), - NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, never_default, - NM_SETTING_IP6_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV6_FAILURE_FATAL", FALSE), + NM_SETTING_IP_CONFIG_METHOD, method, + NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "IPV6_PEERDNS", TRUE), + NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "IPV6_PEERROUTES", TRUE), + NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default, + NM_SETTING_IP_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV6_FAILURE_FATAL", FALSE), NM_SETTING_IP6_CONFIG_IP6_PRIVACY, ip6_privacy_val, NULL); @@ -1393,7 +1393,7 @@ make_ip6_setting (shvarFile *ifcfg, /* METHOD_AUTO may trigger DHCPv6, so save the hostname to send to DHCP */ value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE); if (value && value[0]) - g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, value, NULL); + g_object_set (s_ip6, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, value, NULL); g_free (value); } @@ -1422,7 +1422,7 @@ make_ip6_setting (shvarFile *ifcfg, goto error; } - if (!nm_setting_ip6_config_add_address (s_ip6, addr)) + if (!nm_setting_ip_config_add_address (s_ip6, addr)) PARSE_WARNING ("duplicate IP6 address"); nm_ip_address_unref (addr); } @@ -1442,7 +1442,7 @@ make_ip6_setting (shvarFile *ifcfg, } if (nm_utils_ipaddr_valid (AF_INET6, value)) { - if (!nm_setting_ip6_config_add_dns (s_ip6, value)) + if (!nm_setting_ip_config_add_dns (s_ip6, value)) PARSE_WARNING ("duplicate DNS server %s", tag); } else if (nm_utils_ipaddr_valid (AF_INET, value)) { /* Ignore IPv4 addresses */ @@ -1457,7 +1457,7 @@ make_ip6_setting (shvarFile *ifcfg, g_free (value); } - /* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIP4Config */ + /* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIPConfig */ /* Read static routes from route6-<interface> file */ route6_path = utils_get_route6_path (ifcfg->fileName); @@ -4604,7 +4604,7 @@ check_dns_search_domains (shvarFile *ifcfg, NMSetting *s_ip4, NMSetting *s_ip6) /* If there is no IPv4 config or it doesn't contain DNS searches, * read DOMAIN and put the domains into IPv6. */ - if (!s_ip4 || nm_setting_ip4_config_get_num_dns_searches (NM_SETTING_IP4_CONFIG (s_ip4)) == 0) { + if (!s_ip4 || nm_setting_ip_config_get_num_dns_searches (NM_SETTING_IP_CONFIG (s_ip4)) == 0) { /* DNS searches */ char *value = svGetValue (ifcfg, "DOMAIN", FALSE); if (value) { @@ -4613,7 +4613,7 @@ check_dns_search_domains (shvarFile *ifcfg, NMSetting *s_ip4, NMSetting *s_ip6) char **item; for (item = searches; *item; item++) { if (strlen (*item)) { - if (!nm_setting_ip6_config_add_dns_search (NM_SETTING_IP6_CONFIG (s_ip6), *item)) + if (!nm_setting_ip_config_add_dns_search (NM_SETTING_IP_CONFIG (s_ip6), *item)) PARSE_WARNING ("duplicate DNS domain '%s'", *item); } } @@ -4794,7 +4794,7 @@ connection_from_file (const char *filename, connection = NULL; goto done; } else { - read_aliases (NM_SETTING_IP4_CONFIG (s_ip4), filename, network_file); + read_aliases (NM_SETTING_IP_CONFIG (s_ip4), filename, network_file); nm_connection_add_setting (connection, s_ip4); } diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index cafaf88be9..3c43a2f5df 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -183,8 +183,8 @@ test_read_basic (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; GError *error = NULL; const char *mac; char expected_mac_address[ETH_ALEN] = { 0x00, 0x16, 0x41, 0x11, 0x22, 0x33 }; @@ -225,14 +225,14 @@ test_read_basic (void) /* ===== IPv4 SETTING ===== */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED); - g_assert (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED); + g_assert (nm_setting_ip_config_get_never_default (s_ip4) == FALSE); /* ===== IPv6 SETTING ===== */ s_ip6 = nm_connection_get_setting_ip6_config (connection); g_assert (s_ip6); - g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE); - g_assert (nm_setting_ip6_config_get_never_default (s_ip6) == FALSE); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE); + g_assert (nm_setting_ip_config_get_never_default (s_ip6) == FALSE); g_object_unref (connection); } @@ -243,7 +243,7 @@ test_read_miscellaneous_variables (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; GError *error = NULL; char *expected_mac_blacklist[3] = { "00:16:41:11:22:88", "00:16:41:11:22:99", "6a:5d:5a:fa:dd:f0" }; int mac_blacklist_num, i; @@ -281,8 +281,8 @@ test_read_miscellaneous_variables (void) /* ===== IPv4 SETTING ===== */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED); - g_assert (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED); + g_assert (nm_setting_ip_config_get_never_default (s_ip4) == FALSE); g_object_unref (connection); } @@ -293,7 +293,7 @@ test_read_variables_corner_cases (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; GError *error = NULL; const char *mac; char expected_mac_address[ETH_ALEN] = { 0x00, 0x16, 0x41, 0x11, 0x22, 0x33 }; @@ -331,8 +331,8 @@ test_read_variables_corner_cases (void) /* ===== IPv4 SETTING ===== */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED); - g_assert (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED); + g_assert (nm_setting_ip_config_get_never_default (s_ip4) == FALSE); g_object_unref (connection); } @@ -440,8 +440,8 @@ test_read_wired_static (const char *file, NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *unmanaged = NULL; GError *error = NULL; const char *mac; @@ -479,17 +479,17 @@ test_read_wired_static (const char *file, /* ===== IPv4 SETTING ===== */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); - g_assert (nm_setting_ip4_config_get_may_fail (s_ip4)); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); + g_assert (nm_setting_ip_config_get_may_fail (s_ip4)); /* DNS Addresses */ - g_assert_cmpint (nm_setting_ip4_config_get_num_dns (s_ip4), ==, 2); - g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 0), ==, "4.2.2.1"); - g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 1), ==, "4.2.2.2"); + g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 2); + g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 0), ==, "4.2.2.1"); + g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 1), ==, "4.2.2.2"); /* IP addresses */ - g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 1); - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); + g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert (ip4_addr); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24); g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.1.5"); @@ -499,28 +499,28 @@ test_read_wired_static (const char *file, s_ip6 = nm_connection_get_setting_ip6_config (connection); g_assert (s_ip6); if (expect_ip6) { - g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_MANUAL); - g_assert (nm_setting_ip6_config_get_may_fail (s_ip6)); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_MANUAL); + g_assert (nm_setting_ip_config_get_may_fail (s_ip6)); /* DNS Addresses */ - g_assert_cmpint (nm_setting_ip6_config_get_num_dns (s_ip6), ==, 2); - g_assert_cmpstr (nm_setting_ip6_config_get_dns (s_ip6, 0), ==, "1:2:3:4::a"); - g_assert_cmpstr (nm_setting_ip6_config_get_dns (s_ip6, 1), ==, "1:2:3:4::b"); + g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip6), ==, 2); + g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip6, 0), ==, "1:2:3:4::a"); + g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip6, 1), ==, "1:2:3:4::b"); /* IP addresses */ - g_assert_cmpint (nm_setting_ip6_config_get_num_addresses (s_ip6), ==, 2); + g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip6), ==, 2); - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0); + ip6_addr = nm_setting_ip_config_get_address (s_ip6, 0); g_assert (ip6_addr); g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 64); g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "dead:beaf::1"); - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 1); + ip6_addr = nm_setting_ip_config_get_address (s_ip6, 1); g_assert (ip6_addr); g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 56); g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "dead:beaf::2"); } else { - g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE); } g_free (unmanaged); @@ -533,7 +533,7 @@ test_read_wired_static_no_prefix (gconstpointer user_data) guint32 expected_prefix = GPOINTER_TO_UINT (user_data); NMConnection *connection; NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; GError *error = NULL; NMIPAddress *ip4_addr; char *file, *expected_id; @@ -558,10 +558,10 @@ test_read_wired_static_no_prefix (gconstpointer user_data) /* ===== IPv4 SETTING ===== */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); - g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 1); - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); + g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert (ip4_addr); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, expected_prefix); @@ -578,7 +578,7 @@ test_read_wired_dhcp (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -674,49 +674,49 @@ test_read_wired_dhcp (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DHCP, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); - tmp = nm_setting_ip4_config_get_dhcp_hostname (s_ip4); + tmp = nm_setting_ip_config_get_dhcp_hostname (s_ip4); ASSERT (tmp != NULL, "wired-dhcp-verify-ip4", "failed to verify %s: missing %s / %s key", TEST_IFCFG_WIRED_DHCP, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME); + NM_SETTING_IP_CONFIG_DHCP_HOSTNAME); ASSERT (strcmp (tmp, expected_dhcp_hostname) == 0, "wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DHCP, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME); + NM_SETTING_IP_CONFIG_DHCP_HOSTNAME); - ASSERT (nm_setting_ip4_config_get_ignore_auto_dns (s_ip4) == TRUE, + ASSERT (nm_setting_ip_config_get_ignore_auto_dns (s_ip4) == TRUE, "wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DHCP, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS); + NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS); /* DNS Addresses */ - ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2, + ASSERT (nm_setting_ip_config_get_num_dns (s_ip4) == 2, "wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DHCP, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 0), "4.2.2.1") == 0, + ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 0), "4.2.2.1") == 0, "wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value #1", TEST_IFCFG_WIRED_DHCP, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 1), "4.2.2.2") == 0, + ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 1), "4.2.2.2") == 0, "wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value #2", TEST_IFCFG_WIRED_DHCP, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); g_free (unmanaged); g_free (keyfile); @@ -729,8 +729,8 @@ static void test_read_wired_dhcp_plus_ip (void) { NMConnection *connection; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; GError *error = NULL; NMIPAddress *ip4_addr; NMIPAddress *ip6_addr; @@ -748,23 +748,23 @@ test_read_wired_dhcp_plus_ip (void) /* ===== IPv4 SETTING ===== */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO); - g_assert (nm_setting_ip4_config_get_may_fail (s_ip4)); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO); + g_assert (nm_setting_ip_config_get_may_fail (s_ip4)); /* DNS Addresses */ - g_assert_cmpint (nm_setting_ip4_config_get_num_dns (s_ip4), ==, 2); - g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 0), ==, "4.2.2.1"); - g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 1), ==, "4.2.2.2"); + g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 2); + g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 0), ==, "4.2.2.1"); + g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 1), ==, "4.2.2.2"); /* IP addresses */ - g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 2); - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); + g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 2); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert (ip4_addr); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24); g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "1.2.3.4"); g_assert_cmpstr (nm_ip_address_get_gateway (ip4_addr), ==, "1.1.1.1"); - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 1); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 1); g_assert (ip4_addr); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 16); g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "9.8.7.6"); @@ -772,27 +772,27 @@ test_read_wired_dhcp_plus_ip (void) /* ===== IPv6 SETTING ===== */ s_ip6 = nm_connection_get_setting_ip6_config (connection); g_assert (s_ip6); - g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_AUTO); - g_assert (nm_setting_ip6_config_get_may_fail (s_ip6)); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_AUTO); + g_assert (nm_setting_ip_config_get_may_fail (s_ip6)); /* DNS Addresses */ - g_assert_cmpint (nm_setting_ip6_config_get_num_dns (s_ip6), ==, 2); - g_assert_cmpstr (nm_setting_ip6_config_get_dns (s_ip6, 0), ==, "1:2:3:4::a"); - g_assert_cmpstr (nm_setting_ip6_config_get_dns (s_ip6, 1), ==, "1:2:3:4::b"); + g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip6), ==, 2); + g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip6, 0), ==, "1:2:3:4::a"); + g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip6, 1), ==, "1:2:3:4::b"); /* IP addresses */ - g_assert_cmpint (nm_setting_ip6_config_get_num_addresses (s_ip6), ==, 3); - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0); + g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip6), ==, 3); + ip6_addr = nm_setting_ip_config_get_address (s_ip6, 0); g_assert (ip6_addr); g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 56); g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "1001:abba::1234"); - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 1); + ip6_addr = nm_setting_ip_config_get_address (s_ip6, 1); g_assert (ip6_addr); g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 64); g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "2001:abba::2234"); - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 2); + ip6_addr = nm_setting_ip_config_get_address (s_ip6, 2); g_assert (ip6_addr); g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 96); g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "3001:abba::3234"); @@ -806,7 +806,7 @@ test_read_wired_global_gateway (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; GError *error = NULL; NMIPAddress *ip4_addr; char *unmanaged = NULL; @@ -829,10 +829,10 @@ test_read_wired_global_gateway (void) /* ===== IPv4 SETTING ===== */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); /* Address #1 */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert (ip4_addr); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24); g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.1.5"); @@ -845,8 +845,8 @@ static void test_read_wired_never_default (void) { NMConnection *connection; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; GError *error = NULL; connection = connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-never-default", @@ -860,15 +860,15 @@ test_read_wired_never_default (void) /* ===== IPv4 SETTING ===== */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO); - g_assert (nm_setting_ip4_config_get_never_default (s_ip4)); - g_assert_cmpint (nm_setting_ip4_config_get_num_dns (s_ip4), ==, 0); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO); + g_assert (nm_setting_ip_config_get_never_default (s_ip4)); + g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 0); /* ===== IPv6 SETTING ===== */ s_ip6 = nm_connection_get_setting_ip6_config (connection); g_assert (s_ip6); - g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_AUTO); - g_assert (nm_setting_ip6_config_get_never_default (s_ip6)); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_AUTO); + g_assert (nm_setting_ip_config_get_never_default (s_ip6)); g_object_unref (connection); } @@ -881,8 +881,8 @@ test_read_wired_defroute_no (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -948,18 +948,18 @@ test_read_wired_defroute_no (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wired-defroute-no-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DEFROUTE_NO, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); - ASSERT (nm_setting_ip4_config_get_never_default (s_ip4) == TRUE, + ASSERT (nm_setting_ip_config_get_never_default (s_ip4) == TRUE, "wired-defroute-no-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DEFROUTE_NO, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT); + NM_SETTING_IP_CONFIG_NEVER_DEFAULT); /* ===== IPv6 SETTING ===== */ @@ -970,18 +970,18 @@ test_read_wired_defroute_no (void) NM_SETTING_IP6_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); + tmp = nm_setting_ip_config_get_method (s_ip6); ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0, "wired-defroute-no-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DEFROUTE_NO, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); - ASSERT (nm_setting_ip6_config_get_never_default (s_ip6) == TRUE, + ASSERT (nm_setting_ip_config_get_never_default (s_ip6) == TRUE, "wired-defroute-no-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DEFROUTE_NO, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_NEVER_DEFAULT); + NM_SETTING_IP_CONFIG_NEVER_DEFAULT); g_free (unmanaged); g_free (keyfile); @@ -999,8 +999,8 @@ test_read_wired_defroute_no_gatewaydev_yes (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -1074,18 +1074,18 @@ test_read_wired_defroute_no_gatewaydev_yes (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); - ASSERT (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE, + ASSERT (nm_setting_ip_config_get_never_default (s_ip4) == FALSE, "wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT); + NM_SETTING_IP_CONFIG_NEVER_DEFAULT); /* ===== IPv6 SETTING ===== */ @@ -1096,18 +1096,18 @@ test_read_wired_defroute_no_gatewaydev_yes (void) NM_SETTING_IP6_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); - ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, - "wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: unexpected %s / %s key value", + tmp = nm_setting_ip_config_get_method (s_ip6); + ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0, + "wired-defroute-no-gatewaydev-yes-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); - ASSERT (nm_setting_ip6_config_get_never_default (s_ip6) == FALSE, - "wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: unexpected %s / %s key value", + ASSERT (nm_setting_ip_config_get_never_default (s_ip6) == FALSE, + "wired-defroute-no-gatewaydev-yes-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_NEVER_DEFAULT); + NM_SETTING_IP_CONFIG_NEVER_DEFAULT); g_free (unmanaged); g_free (keyfile); @@ -1122,7 +1122,7 @@ test_read_wired_static_routes (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; GError *error = NULL; NMIPRoute *ip4_route; @@ -1142,19 +1142,19 @@ test_read_wired_static_routes (void) /* ===== IPv4 SETTING ===== */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL); /* Routes */ - g_assert_cmpint (nm_setting_ip4_config_get_num_routes (s_ip4), ==, 2); + g_assert_cmpint (nm_setting_ip_config_get_num_routes (s_ip4), ==, 2); - ip4_route = nm_setting_ip4_config_get_route (s_ip4, 0); + ip4_route = nm_setting_ip_config_get_route (s_ip4, 0); g_assert (ip4_route); g_assert_cmpstr (nm_ip_route_get_dest (ip4_route), ==, "11.22.33.0"); g_assert_cmpint (nm_ip_route_get_prefix (ip4_route), ==, 24); g_assert_cmpstr (nm_ip_route_get_next_hop (ip4_route), ==, "192.168.1.5"); g_assert_cmpint (nm_ip_route_get_metric (ip4_route), ==, 0); - ip4_route = nm_setting_ip4_config_get_route (s_ip4, 1); + ip4_route = nm_setting_ip_config_get_route (s_ip4, 1); g_assert (ip4_route); g_assert_cmpstr (nm_ip_route_get_dest (ip4_route), ==, "44.55.66.77"); g_assert_cmpint (nm_ip_route_get_prefix (ip4_route), ==, 32); @@ -1172,7 +1172,7 @@ test_read_wired_static_routes_legacy (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -1245,22 +1245,22 @@ test_read_wired_static_routes_legacy (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* Routes */ - ASSERT (nm_setting_ip4_config_get_num_routes (s_ip4) == 3, + ASSERT (nm_setting_ip_config_get_num_routes (s_ip4) == 3, "wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES); + NM_SETTING_IP_CONFIG_ROUTES); /* Route #1 */ - ip4_route = nm_setting_ip4_config_get_route (s_ip4, 0); + ip4_route = nm_setting_ip_config_get_route (s_ip4, 0); g_assert (ip4_route != NULL); g_assert_cmpstr (nm_ip_route_get_dest (ip4_route), ==, "21.31.41.0"); g_assert_cmpint (nm_ip_route_get_prefix (ip4_route), ==, 24); @@ -1268,7 +1268,7 @@ test_read_wired_static_routes_legacy (void) g_assert_cmpint (nm_ip_route_get_metric (ip4_route), ==, 1); /* Route #2 */ - ip4_route = nm_setting_ip4_config_get_route (s_ip4, 1); + ip4_route = nm_setting_ip_config_get_route (s_ip4, 1); g_assert (ip4_route != NULL); g_assert_cmpstr (nm_ip_route_get_dest (ip4_route), ==, "32.42.52.62"); g_assert_cmpint (nm_ip_route_get_prefix (ip4_route), ==, 32); @@ -1276,7 +1276,7 @@ test_read_wired_static_routes_legacy (void) g_assert_cmpint (nm_ip_route_get_metric (ip4_route), ==, 0); /* Route #3 */ - ip4_route = nm_setting_ip4_config_get_route (s_ip4, 2); + ip4_route = nm_setting_ip_config_get_route (s_ip4, 2); g_assert (ip4_route != NULL); g_assert_cmpstr (nm_ip_route_get_dest (ip4_route), ==, "43.53.0.0"); g_assert_cmpint (nm_ip_route_get_prefix (ip4_route), ==, 16); @@ -1296,7 +1296,7 @@ test_read_wired_ipv4_manual (const char *file, const char *expected_id) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -1362,34 +1362,34 @@ test_read_wired_ipv4_manual (const char *file, const char *expected_id) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, "wired-ipv4-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* IP addresses */ - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 3, + ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 3, "wired-ipv4-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_ADDRESSES); /* Address #1 */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert (ip4_addr != NULL); g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "1.2.3.4"); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24); /* Address #2 */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 1); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 1); g_assert (ip4_addr != NULL); g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "9.8.7.6"); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 16); /* Address #3 */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 2); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 2); g_assert (ip4_addr != NULL); g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "3.3.3.3"); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 8); @@ -1409,8 +1409,8 @@ test_read_wired_ipv6_manual (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -1482,54 +1482,54 @@ test_read_wired_ipv6_manual (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* DNS Addresses */ - ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2, + ASSERT (nm_setting_ip_config_get_num_dns (s_ip4) == 2, "wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); /* DNS search domains */ - ASSERT (nm_setting_ip4_config_get_num_dns_searches (s_ip4) == 3, + ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip4) == 3, "wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 0); + tmp = nm_setting_ip_config_get_dns_search (s_ip4, 0); ASSERT (tmp != NULL, "wired-ipv6-manual-verify-ip4", "failed to verify %s: missing %s / %s key", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); ASSERT (strcmp (tmp, "lorem.com") == 0, "wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); - tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 1); + tmp = nm_setting_ip_config_get_dns_search (s_ip4, 1); ASSERT (tmp != NULL, "wired-ipv6-manual-verify-ip4", "failed to verify %s: missing %s / %s key", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); ASSERT (strcmp (tmp, "ipsum.org") == 0, "wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); - tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 2); + tmp = nm_setting_ip_config_get_dns_search (s_ip4, 2); ASSERT (tmp != NULL, "wired-ipv6-manual-verify-ip4", "failed to verify %s: missing %s / %s key", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); ASSERT (strcmp (tmp, "dolor.edu") == 0, "wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); /* ===== IPv6 SETTING ===== */ @@ -1540,61 +1540,61 @@ test_read_wired_ipv6_manual (void) NM_SETTING_IP6_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); + tmp = nm_setting_ip_config_get_method (s_ip6); ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0, "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); - ASSERT (nm_setting_ip6_config_get_never_default (s_ip6) == FALSE, + ASSERT (nm_setting_ip_config_get_never_default (s_ip6) == FALSE, "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_NEVER_DEFAULT); + NM_SETTING_IP_CONFIG_NEVER_DEFAULT); - ASSERT (nm_setting_ip6_config_get_may_fail (s_ip6) == TRUE, + ASSERT (nm_setting_ip_config_get_may_fail (s_ip6) == TRUE, "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_MAY_FAIL); + NM_SETTING_IP_CONFIG_MAY_FAIL); /* IP addresses */ - ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 3, + ASSERT (nm_setting_ip_config_get_num_addresses (s_ip6) == 3, "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_ADDRESSES); /* Address #1 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0); + ip6_addr = nm_setting_ip_config_get_address (s_ip6, 0); g_assert (ip6_addr != NULL); g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "1001:abba::1234"); g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 56); /* Address #2 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 1); + ip6_addr = nm_setting_ip_config_get_address (s_ip6, 1); g_assert (ip6_addr != NULL); g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "2001:abba::2234"); g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 64); /* Address #3 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 2); + ip6_addr = nm_setting_ip_config_get_address (s_ip6, 2); g_assert (ip6_addr != NULL); g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "3001:abba::3234"); g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 96); /* Routes */ - g_assert_cmpint (nm_setting_ip6_config_get_num_routes (s_ip6), ==, 2); + g_assert_cmpint (nm_setting_ip_config_get_num_routes (s_ip6), ==, 2); /* Route #1 */ - ip6_route = nm_setting_ip6_config_get_route (s_ip6, 0); + ip6_route = nm_setting_ip_config_get_route (s_ip6, 0); g_assert (ip6_route); g_assert_cmpstr (nm_ip_route_get_dest (ip6_route), ==, "9876::1234"); g_assert_cmpint (nm_ip_route_get_prefix (ip6_route), ==, 96); g_assert_cmpstr (nm_ip_route_get_next_hop (ip6_route), ==, "9876::7777"); g_assert_cmpint (nm_ip_route_get_metric (ip6_route), ==, 2); /* Route #2 */ - ip6_route = nm_setting_ip6_config_get_route (s_ip6, 1); + ip6_route = nm_setting_ip_config_get_route (s_ip6, 1); g_assert (ip6_route); g_assert_cmpstr (nm_ip_route_get_dest (ip6_route), ==, "abbe::cafe"); g_assert_cmpint (nm_ip_route_get_prefix (ip6_route), ==, 64); @@ -1602,30 +1602,30 @@ test_read_wired_ipv6_manual (void) g_assert_cmpint (nm_ip_route_get_metric (ip6_route), ==, 777); /* DNS Addresses */ - ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 2, + ASSERT (nm_setting_ip_config_get_num_dns (s_ip6) == 2, "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (strcmp (nm_setting_ip6_config_get_dns (s_ip6, 0), "1:2:3:4::a") == 0, + ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip6, 0), "1:2:3:4::a") == 0, "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value #1", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (strcmp (nm_setting_ip6_config_get_dns (s_ip6, 1), "1:2:3:4::b") == 0, + ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip6, 1), "1:2:3:4::b") == 0, "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value #2", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); /* DNS domains - none as domains are stuffed to 'ipv4' setting */ - ASSERT (nm_setting_ip6_config_get_num_dns_searches (s_ip6) == 0, + ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip6) == 0, "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); g_free (unmanaged); g_free (keyfile); @@ -1642,8 +1642,8 @@ test_read_wired_ipv6_only (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -1710,12 +1710,12 @@ test_read_wired_ipv6_only (void) TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP4_CONFIG_SETTING_NAME); - method = nm_setting_ip4_config_get_method (s_ip4); + method = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0, "wired-ipv6-only-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* ===== IPv6 SETTING ===== */ @@ -1726,44 +1726,44 @@ test_read_wired_ipv6_only (void) NM_SETTING_IP6_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); + tmp = nm_setting_ip_config_get_method (s_ip6); ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0, "wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* IP addresses */ - ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1, + ASSERT (nm_setting_ip_config_get_num_addresses (s_ip6) == 1, "wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_ADDRESSES); /* Address #1 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0); + ip6_addr = nm_setting_ip_config_get_address (s_ip6, 0); g_assert (ip6_addr != NULL); g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "1001:abba::1234"); g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 56); /* DNS Addresses */ - ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 1, + ASSERT (nm_setting_ip_config_get_num_dns (s_ip6) == 1, "wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (strcmp (nm_setting_ip6_config_get_dns (s_ip6, 0), "1:2:3:4::a") == 0, + ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip6, 0), "1:2:3:4::a") == 0, "wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value #1", TEST_IFCFG_WIRED_IPV6_MANUAL, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); /* DNS domains should be in IPv6, because IPv4 is disabled */ - g_assert_cmpint (nm_setting_ip6_config_get_num_dns_searches (s_ip6), ==, 3); - g_assert_cmpstr (nm_setting_ip6_config_get_dns_search (s_ip6, 0), ==, "lorem.com"); - g_assert_cmpstr (nm_setting_ip6_config_get_dns_search (s_ip6, 1), ==, "ipsum.org"); - g_assert_cmpstr (nm_setting_ip6_config_get_dns_search (s_ip6, 2), ==, "dolor.edu"); + g_assert_cmpint (nm_setting_ip_config_get_num_dns_searches (s_ip6), ==, 3); + g_assert_cmpstr (nm_setting_ip_config_get_dns_search (s_ip6, 0), ==, "lorem.com"); + g_assert_cmpstr (nm_setting_ip_config_get_dns_search (s_ip6, 1), ==, "ipsum.org"); + g_assert_cmpstr (nm_setting_ip_config_get_dns_search (s_ip6, 2), ==, "dolor.edu"); g_free (unmanaged); g_free (keyfile); @@ -1780,8 +1780,8 @@ test_read_wired_dhcp6_only (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -1847,12 +1847,12 @@ test_read_wired_dhcp6_only (void) TEST_IFCFG_WIRED_DHCP6_ONLY, NM_SETTING_IP4_CONFIG_SETTING_NAME); - method = nm_setting_ip4_config_get_method (s_ip4); + method = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0, "wired-dhcp6-only-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DHCP6_ONLY, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* ===== IPv6 SETTING ===== */ @@ -1863,12 +1863,12 @@ test_read_wired_dhcp6_only (void) NM_SETTING_IP6_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); + tmp = nm_setting_ip_config_get_method (s_ip6); ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_DHCP) == 0, "wired-dhcp6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_DHCP6_ONLY, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); g_free (unmanaged); g_free (keyfile); @@ -1937,8 +1937,8 @@ static void test_read_noip (void) { NMConnection *connection; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -1961,13 +1961,13 @@ test_read_noip (void) s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED); - g_assert (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED); + g_assert (nm_setting_ip_config_get_never_default (s_ip4) == FALSE); s_ip6 = nm_connection_get_setting_ip6_config (connection); g_assert (s_ip6); - g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE); - g_assert (nm_setting_ip6_config_get_never_default (s_ip6) == FALSE); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE); + g_assert (nm_setting_ip_config_get_never_default (s_ip6) == FALSE); g_free (unmanaged); g_free (keyfile); @@ -1984,7 +1984,7 @@ test_read_wired_8021x_peap_mschapv2 (void) { NMConnection *connection; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSetting8021x *s_8021x; NMSetting8021x *tmp_8021x; char *unmanaged = NULL; @@ -2036,12 +2036,12 @@ test_read_wired_8021x_peap_mschapv2 (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wired-8021x-peap-mschapv2-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* ===== 802.1x SETTING ===== */ s_8021x = nm_connection_get_setting_802_1x (connection); @@ -2365,7 +2365,7 @@ test_read_wired_aliases_good (void) { NMConnection *connection; NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -2425,18 +2425,18 @@ test_read_wired_aliases_good (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, "aliases-good-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_ALIASES_GOOD, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == expected_num_addresses, + ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == expected_num_addresses, "aliases-good-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_ALIASES_GOOD, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_ADDRESSES); /* Addresses */ for (i = 0; i < expected_num_addresses; i++) { @@ -2444,7 +2444,7 @@ test_read_wired_aliases_good (void) const char *addr; GVariant *label; - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, i); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, i); g_assert (ip4_addr != NULL); addr = nm_ip_address_get_address (ip4_addr); @@ -2487,7 +2487,7 @@ test_read_wired_aliases_bad (const char *base, const char *expected_id) { NMConnection *connection; NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -2543,21 +2543,21 @@ test_read_wired_aliases_bad (const char *base, const char *expected_id) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, "aliases-bad-verify-ip4", "failed to verify %s: unexpected %s / %s key value", base, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1, + ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 1, "aliases-bad-verify-ip4", "failed to verify %s: unexpected %s / %s key value", base, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_ADDRESSES); /* Addresses */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert (ip4_addr != NULL); g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.1.5"); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24); @@ -2599,7 +2599,7 @@ test_read_wifi_open (void) NMSettingConnection *s_con; NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -2754,12 +2754,12 @@ test_read_wifi_open (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wifi-open-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIFI_OPEN, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); g_free (unmanaged); g_free (keyfile); @@ -3063,7 +3063,7 @@ test_read_wifi_wep (void) NMSettingConnection *s_con; NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -3298,12 +3298,12 @@ test_read_wifi_wep (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wifi-wep-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIFI_WEP, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); g_free (unmanaged); g_free (keyfile); @@ -3321,7 +3321,7 @@ test_read_wifi_wep_adhoc (void) NMSettingConnection *s_con; NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -3512,38 +3512,38 @@ test_read_wifi_wep_adhoc (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIFI_WEP_ADHOC, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* Ignore auto DNS */ - ASSERT (nm_setting_ip4_config_get_ignore_auto_dns (s_ip4) == TRUE, + ASSERT (nm_setting_ip_config_get_ignore_auto_dns (s_ip4) == TRUE, "wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIFI_WEP_ADHOC, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS); + NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS); /* DNS Addresses */ - ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2, + ASSERT (nm_setting_ip_config_get_num_dns (s_ip4) == 2, "wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIFI_WEP_ADHOC, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 0), "4.2.2.1") == 0, + ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 0), "4.2.2.1") == 0, "wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value #1", TEST_IFCFG_WIFI_WEP_ADHOC, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 1), "4.2.2.2") == 0, + ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 1), "4.2.2.2") == 0, "wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value #2", TEST_IFCFG_WIFI_WEP_ADHOC, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); g_free (unmanaged); g_free (keyfile); @@ -4113,7 +4113,7 @@ test_read_wifi_wpa_psk (void) NMSettingConnection *s_con; NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -4391,12 +4391,12 @@ test_read_wifi_wpa_psk (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wifi-wpa-psk-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIFI_WPA_PSK, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); g_free (unmanaged); g_free (keyfile); @@ -4632,7 +4632,7 @@ test_read_wifi_wpa_psk_adhoc (void) NMSettingConnection *s_con; NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -4787,12 +4787,12 @@ test_read_wifi_wpa_psk_adhoc (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wifi-wpa-psk-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIFI_WPA_PSK_ADHOC, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); g_free (unmanaged); g_free (keyfile); @@ -4810,7 +4810,7 @@ test_read_wifi_wpa_psk_hex (void) NMSettingConnection *s_con; NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -4929,12 +4929,12 @@ test_read_wifi_wpa_psk_hex (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wifi-wpa-psk-hex-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIFI_WPA_PSK_HEX, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); g_free (unmanaged); g_free (keyfile); @@ -4953,7 +4953,7 @@ test_read_wifi_wpa_eap_tls (void) { NMConnection *connection; NMSettingWireless *s_wireless; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSetting8021x *s_8021x; char *unmanaged = NULL; char *keyfile = NULL; @@ -5000,12 +5000,12 @@ test_read_wifi_wpa_eap_tls (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wifi-wpa-eap-tls-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIFI_WPA_EAP_TLS, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* ===== 802.1x SETTING ===== */ s_8021x = nm_connection_get_setting_802_1x (connection); @@ -5093,7 +5093,7 @@ test_read_wifi_wpa_eap_ttls_tls (void) { NMConnection *connection; NMSettingWireless *s_wireless; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSetting8021x *s_8021x; char *unmanaged = NULL; char *keyfile = NULL; @@ -5140,12 +5140,12 @@ test_read_wifi_wpa_eap_ttls_tls (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wifi-wpa-eap-ttls-tls-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* ===== 802.1x SETTING ===== */ s_8021x = nm_connection_get_setting_802_1x (connection); @@ -5324,7 +5324,7 @@ test_read_wifi_wep_eap_ttls_chap (void) NMConnection *connection; NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSetting8021x *s_8021x; char *unmanaged = NULL; char *keyfile = NULL; @@ -5372,12 +5372,12 @@ test_read_wifi_wep_eap_ttls_chap (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "wifi-wep-eap-ttls-chap-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* ===== 802.1x SETTING ===== */ s_wsec = nm_connection_get_setting_wireless_security (connection); @@ -5736,7 +5736,7 @@ test_read_wired_qeth_static (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -5884,12 +5884,12 @@ test_read_wired_qeth_static (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, "wired-qeth-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_WIRED_QETH_STATIC, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); g_free (unmanaged); g_free (keyfile); @@ -6226,8 +6226,8 @@ test_write_wired_static (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4, *reread_s_ip4; - NMSettingIP6Config *s_ip6, *reread_s_ip6; + NMSettingIPConfig *s_ip4, *reread_s_ip4; + NMSettingIPConfig *s_ip6, *reread_s_ip6; static const char *mac = "31:33:33:37:be:cd"; guint32 mtu = 1492; char *uuid; @@ -6276,53 +6276,53 @@ test_write_wired_static (void) NULL); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, - NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.1", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); addr = nm_ip_address_new (AF_INET, "1.1.1.5", 24, "1.1.1.1", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); - nm_setting_ip4_config_add_dns (s_ip4, dns1); - nm_setting_ip4_config_add_dns (s_ip4, dns2); + nm_setting_ip_config_add_dns (s_ip4, dns1); + nm_setting_ip_config_add_dns (s_ip4, dns2); - nm_setting_ip4_config_add_dns_search (s_ip4, dns_search1); - nm_setting_ip4_config_add_dns_search (s_ip4, dns_search2); + nm_setting_ip_config_add_dns_search (s_ip4, dns_search1); + nm_setting_ip_config_add_dns_search (s_ip4, dns_search2); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); /* Add addresses */ addr6 = nm_ip_address_new (AF_INET6, "1003:1234:abcd::1", 11, NULL, &error); g_assert_no_error (error); - nm_setting_ip6_config_add_address (s_ip6, addr6); + nm_setting_ip_config_add_address (s_ip6, addr6); nm_ip_address_unref (addr6); addr6 = nm_ip_address_new (AF_INET6, "2003:1234:abcd::2", 22, NULL, &error); g_assert_no_error (error); - nm_setting_ip6_config_add_address (s_ip6, addr6); + nm_setting_ip_config_add_address (s_ip6, addr6); nm_ip_address_unref (addr6); addr6 = nm_ip_address_new (AF_INET6, "3003:1234:abcd::3", 33, NULL, &error); g_assert_no_error (error); - nm_setting_ip6_config_add_address (s_ip6, addr6); + nm_setting_ip_config_add_address (s_ip6, addr6); nm_ip_address_unref (addr6); /* Add routes */ @@ -6330,21 +6330,21 @@ test_write_wired_static (void) "2222:aaaa:bbbb:cccc::", 64, "2222:aaaa:bbbb:cccc:dddd:eeee:5555:6666", 99, &error); g_assert_no_error (error); - nm_setting_ip6_config_add_route (s_ip6, route6); + nm_setting_ip_config_add_route (s_ip6, route6); nm_ip_route_unref (route6); route6 = nm_ip_route_new (AF_INET6, "::", 128, "2222:aaaa::9999", 1, &error); g_assert_no_error (error); - nm_setting_ip6_config_add_route (s_ip6, route6); + nm_setting_ip_config_add_route (s_ip6, route6); nm_ip_route_unref (route6); /* DNS servers */ - nm_setting_ip6_config_add_dns (s_ip6, dns6_1); - nm_setting_ip6_config_add_dns (s_ip6, dns6_2); + nm_setting_ip_config_add_dns (s_ip6, dns6_1); + nm_setting_ip_config_add_dns (s_ip6, dns6_2); /* DNS domains */ - nm_setting_ip6_config_add_dns_search (s_ip6, dns_search3); - nm_setting_ip6_config_add_dns_search (s_ip6, dns_search4); + nm_setting_ip_config_add_dns_search (s_ip6, dns_search3); + nm_setting_ip_config_add_dns_search (s_ip6, dns_search4); ASSERT (nm_connection_verify (connection, &error) == TRUE, "wired-static-write", "failed to verify connection: %s", @@ -6389,10 +6389,10 @@ test_write_wired_static (void) */ reread_s_ip4 = nm_connection_get_setting_ip4_config (reread); reread_s_ip6 = nm_connection_get_setting_ip6_config (reread); - nm_setting_ip6_config_add_dns_search (reread_s_ip6, nm_setting_ip4_config_get_dns_search (reread_s_ip4, 2)); - nm_setting_ip6_config_add_dns_search (reread_s_ip6, nm_setting_ip4_config_get_dns_search (reread_s_ip4, 3)); - nm_setting_ip4_config_remove_dns_search (reread_s_ip4, 3); - nm_setting_ip4_config_remove_dns_search (reread_s_ip4, 2); + nm_setting_ip_config_add_dns_search (reread_s_ip6, nm_setting_ip_config_get_dns_search (reread_s_ip4, 2)); + nm_setting_ip_config_add_dns_search (reread_s_ip6, nm_setting_ip_config_get_dns_search (reread_s_ip4, 3)); + nm_setting_ip_config_remove_dns_search (reread_s_ip4, 3); + nm_setting_ip_config_remove_dns_search (reread_s_ip4, 2); ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, "wired-static-write", "written and re-read connection weren't the same."); @@ -6416,8 +6416,8 @@ test_write_wired_dhcp (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -6448,15 +6448,15 @@ test_write_wired_dhcp (void) nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, "random-client-id-00:22:33", - NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, "awesome-hostname", - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, TRUE, - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TRUE, + NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, "awesome-hostname", + NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, TRUE, + NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -6464,12 +6464,12 @@ test_write_wired_dhcp (void) (error && error->message) ? error->message : "(unknown)"); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); /* Save the ifcfg */ @@ -6564,8 +6564,8 @@ static void test_read_write_wired_dhcp_send_hostname (void) { NMConnection *connection, *reread; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; const char * dhcp_hostname = "kamil-patka"; char *written = NULL; GError *error = NULL; @@ -6582,14 +6582,14 @@ test_read_write_wired_dhcp_send_hostname (void) s_ip6 = nm_connection_get_setting_ip6_config (connection); g_assert (s_ip4); g_assert (s_ip6); - g_assert (nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) == TRUE); - g_assert_cmpstr (nm_setting_ip4_config_get_dhcp_hostname (s_ip4), ==, "svata-pulec"); - g_assert_cmpstr (nm_setting_ip6_config_get_dhcp_hostname (s_ip6), ==, "svata-pulec"); + g_assert (nm_setting_ip_config_get_dhcp_send_hostname (s_ip4) == TRUE); + g_assert_cmpstr (nm_setting_ip_config_get_dhcp_hostname (s_ip4), ==, "svata-pulec"); + g_assert_cmpstr (nm_setting_ip_config_get_dhcp_hostname (s_ip6), ==, "svata-pulec"); /* Set dhcp-send-hostname=false dhcp-hostname="kamil-patka" and write the connection. */ - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, FALSE, NULL); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL); - g_object_set (s_ip6, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, FALSE, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL); + g_object_set (s_ip6, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL); success = writer_new_connection (connection, TEST_SCRATCH_DIR "/network-scripts/", @@ -6621,9 +6621,9 @@ test_read_write_wired_dhcp_send_hostname (void) s_ip6 = nm_connection_get_setting_ip6_config (reread); g_assert (s_ip4); g_assert (s_ip6); - g_assert (nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) == FALSE); - g_assert_cmpstr (nm_setting_ip4_config_get_dhcp_hostname (s_ip4), ==, dhcp_hostname); - g_assert_cmpstr (nm_setting_ip6_config_get_dhcp_hostname (s_ip6), ==, dhcp_hostname); + g_assert (nm_setting_ip_config_get_dhcp_send_hostname (s_ip4) == FALSE); + g_assert_cmpstr (nm_setting_ip_config_get_dhcp_hostname (s_ip4), ==, dhcp_hostname); + g_assert_cmpstr (nm_setting_ip_config_get_dhcp_hostname (s_ip6), ==, dhcp_hostname); g_object_unref (connection); g_object_unref (reread); @@ -6636,8 +6636,8 @@ test_write_wired_static_ip6_only (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; static const char *mac = "31:33:33:37:be:cd"; char *uuid; const char *dns6 = "fade:0102:0103::face"; @@ -6673,29 +6673,29 @@ test_write_wired_static_ip6_only (void) g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS, mac, NULL); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL); /* Add addresses */ addr6 = nm_ip_address_new (AF_INET6, "1003:1234:abcd::1", 11, NULL, &error); g_assert_no_error (error); - nm_setting_ip6_config_add_address (s_ip6, addr6); + nm_setting_ip_config_add_address (s_ip6, addr6); nm_ip_address_unref (addr6); /* DNS server */ - nm_setting_ip6_config_add_dns (s_ip6, dns6); + nm_setting_ip_config_add_dns (s_ip6, dns6); ASSERT (nm_connection_verify (connection, &error) == TRUE, "wired-static-ip6-only-write", "failed to verify connection: %s", @@ -6764,8 +6764,8 @@ test_write_wired_static_ip6_only_gw (gconstpointer user_data) NMConnection *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; static const char *mac = "31:33:33:37:be:cd"; char *uuid; const char *dns6 = "fade:0102:0103::face"; @@ -6802,29 +6802,29 @@ test_write_wired_static_ip6_only_gw (gconstpointer user_data) g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS, mac, NULL); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL); /* Add addresses */ addr6 = nm_ip_address_new (AF_INET6, "1003:1234:abcd::1", 11, gateway6, &error); g_assert_no_error (error); - nm_setting_ip6_config_add_address (s_ip6, addr6); + nm_setting_ip_config_add_address (s_ip6, addr6); nm_ip_address_unref (addr6); /* DNS server */ - nm_setting_ip6_config_add_dns (s_ip6, dns6); + nm_setting_ip_config_add_dns (s_ip6, dns6); g_assert (nm_connection_verify (connection, &error)); @@ -6867,8 +6867,8 @@ test_write_wired_static_ip6_only_gw (gconstpointer user_data) /* access the gateway from the loaded connection. */ s_ip6 = nm_connection_get_setting_ip6_config (reread); - g_assert (s_ip6 && nm_setting_ip6_config_get_num_addresses (s_ip6)==1); - addr6 = nm_setting_ip6_config_get_address (s_ip6, 0); + g_assert (s_ip6 && nm_setting_ip_config_get_num_addresses (s_ip6)==1); + addr6 = nm_setting_ip_config_get_address (s_ip6, 0); g_assert (addr6); /* assert that the gateway was written and reloaded as expected */ @@ -6895,7 +6895,7 @@ test_read_write_static_routes_legacy (void) NMConnection *connection, *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; char *testfile = NULL; char *keyfile = NULL; @@ -6966,18 +6966,18 @@ test_read_write_static_routes_legacy (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "read-write-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); - ASSERT (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE, + ASSERT (nm_setting_ip_config_get_never_default (s_ip4) == FALSE, "read-write-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value", TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT); + NM_SETTING_IP_CONFIG_NEVER_DEFAULT); /* Save the ifcfg; use a special different scratch dir to ensure that * we can clean up after the written connection in both the original @@ -7042,8 +7042,8 @@ test_write_wired_static_routes (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; static const char *mac = "31:33:33:37:be:cd"; guint32 mtu = 1492; char *uuid; @@ -7087,47 +7087,47 @@ test_write_wired_static_routes (void) NULL); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.1", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); addr = nm_ip_address_new (AF_INET, "1.1.1.5", 24, "1.1.1.1", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); /* Write out routes */ route = nm_ip_route_new (AF_INET, "1.2.3.0", 24, "222.173.190.239", 0, &error); g_assert_no_error (error); - nm_setting_ip4_config_add_route (s_ip4, route); + nm_setting_ip_config_add_route (s_ip4, route); nm_ip_route_unref (route); route = nm_ip_route_new (AF_INET, "3.2.1.0", 24, "202.254.186.190", 77, &error); g_assert_no_error (error); - nm_setting_ip4_config_add_route (s_ip4, route); + nm_setting_ip_config_add_route (s_ip4, route); nm_ip_route_unref (route); - nm_setting_ip4_config_add_dns (s_ip4, dns1); - nm_setting_ip4_config_add_dns (s_ip4, dns2); + nm_setting_ip_config_add_dns (s_ip4, dns1); + nm_setting_ip_config_add_dns (s_ip4, dns2); - nm_setting_ip4_config_add_dns_search (s_ip4, dns_search1); - nm_setting_ip4_config_add_dns_search (s_ip4, dns_search2); + nm_setting_ip_config_add_dns_search (s_ip4, dns_search1); + nm_setting_ip_config_add_dns_search (s_ip4, dns_search2); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -7190,8 +7190,8 @@ test_write_wired_dhcp_8021x_peap_mschapv2 (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; NMSetting8021x *s_8021x; char *uuid; gboolean success; @@ -7223,18 +7223,18 @@ test_write_wired_dhcp_8021x_peap_mschapv2 (void) nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); /* 802.1x setting */ @@ -7344,8 +7344,8 @@ test_write_wired_8021x_tls (NMSetting8021xCKScheme scheme, NMConnection *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; NMSetting8021x *s_8021x; char *uuid; gboolean success; @@ -7383,17 +7383,17 @@ test_write_wired_8021x_tls (NMSetting8021xCKScheme scheme, nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_assert (s_ip6); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); @@ -7558,7 +7558,7 @@ test_write_wired_aliases (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *uuid; int num_addresses = 4; const char *ip[] = { "1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4" }; @@ -7602,15 +7602,15 @@ test_write_wired_aliases (void) nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); ASSERT (s_ip4 != NULL, "wired-aliases-write", "failed to allocate new %s setting", NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, - NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); for (i = 0; i < num_addresses; i++) { @@ -7618,7 +7618,7 @@ test_write_wired_aliases (void) g_assert_no_error (error); if (label[i]) nm_ip_address_set_attribute (addr, "label", g_variant_new_string (label[i])); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); } @@ -7688,17 +7688,17 @@ test_write_wired_aliases (void) * verify the aliases manually. */ s_ip4 = nm_connection_get_setting_ip4_config (connection); - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == num_addresses, + ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == num_addresses, "wired-aliases-write-verify-ip4", "failed to verify %s: unexpected %s / %s key value", testfile, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_ADDRESSES); /* Addresses */ for (i = 0; i < num_addresses; i++) { const char *addrstr; - addr = nm_setting_ip4_config_get_address (s_ip4, i); + addr = nm_setting_ip_config_get_address (s_ip4, i); g_assert (addr != NULL); addrstr = nm_ip_address_get_address (addr); @@ -7739,7 +7739,7 @@ test_write_gateway (void) NMConnection *connection, *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *uuid, *testfile = NULL, *val; gboolean success; GError *error = NULL; @@ -7765,22 +7765,22 @@ test_write_gateway (void) nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, - NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.254", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); addr = nm_ip_address_new (AF_INET, "2.2.2.5", 24, "2.2.2.254", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); success = nm_connection_verify (connection, &error); @@ -7871,8 +7871,8 @@ test_write_wifi_open (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingWireless *s_wifi; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -7924,18 +7924,18 @@ test_write_wifi_open (void) g_bytes_unref (ssid); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -8011,8 +8011,8 @@ test_write_wifi_open_hex_ssid (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingWireless *s_wifi; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -8054,18 +8054,18 @@ test_write_wifi_open_hex_ssid (void) g_bytes_unref (ssid); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -8125,8 +8125,8 @@ test_write_wifi_wep (void) NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -8183,18 +8183,18 @@ test_write_wifi_wep (void) nm_setting_wireless_security_set_wep_key (s_wsec, 3, "BBBBBBBBBBBBBBBBBBBBBBBBBB"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -8266,8 +8266,8 @@ test_write_wifi_wep_adhoc (void) NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -8319,26 +8319,26 @@ test_write_wifi_wep_adhoc (void) nm_setting_wireless_security_set_wep_key (s_wsec, 0, "0123456789abcdef0123456789"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); /* IP Address */ addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.1", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); - nm_setting_ip4_config_add_dns (s_ip4, dns1); + nm_setting_ip_config_add_dns (s_ip4, dns1); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -8410,8 +8410,8 @@ test_write_wifi_wep_passphrase (void) NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -8466,18 +8466,18 @@ test_write_wifi_wep_passphrase (void) nm_setting_wireless_security_set_wep_key (s_wsec, 0, "asdfdjaslfjasd;flasjdfl;aksdf"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -8549,8 +8549,8 @@ test_write_wifi_wep_40_ascii (void) NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -8607,18 +8607,18 @@ test_write_wifi_wep_40_ascii (void) nm_setting_wireless_security_set_wep_key (s_wsec, 3, "donec"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -8690,8 +8690,8 @@ test_write_wifi_wep_104_ascii (void) NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -8748,18 +8748,18 @@ test_write_wifi_wep_104_ascii (void) nm_setting_wireless_security_set_wep_key (s_wsec, 3, "thisismyascii"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -8831,8 +8831,8 @@ test_write_wifi_leap (void) NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -8886,18 +8886,18 @@ test_write_wifi_leap (void) NULL); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -8969,8 +8969,8 @@ test_write_wifi_leap_secret_flags (NMSettingSecretFlags flags) NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -9025,19 +9025,19 @@ test_write_wifi_leap_secret_flags (NMSettingSecretFlags flags) NULL); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_assert (s_ip6); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); success = nm_connection_verify (connection, &error); @@ -9108,8 +9108,8 @@ test_write_wifi_wpa_psk (const char *name, NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid, *tmp; gboolean success; GError *error = NULL; @@ -9177,18 +9177,18 @@ test_write_wifi_wpa_psk (const char *name, } /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -9254,8 +9254,8 @@ test_write_wifi_wpa_psk_adhoc (void) NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -9313,26 +9313,26 @@ test_write_wifi_wpa_psk_adhoc (void) nm_setting_wireless_security_add_group (s_wsec, "tkip"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); /* IP Address */ addr = nm_ip_address_new (AF_INET, "1.1.1.3", 25, "1.1.1.1", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); - nm_setting_ip4_config_add_dns (s_ip4, dns1); + nm_setting_ip_config_add_dns (s_ip4, dns1); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -9397,8 +9397,8 @@ test_write_wifi_wpa_eap_tls (void) NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; NMSetting8021x *s_8021x; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -9485,18 +9485,18 @@ test_write_wifi_wpa_eap_tls (void) TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY, error->message); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -9561,8 +9561,8 @@ test_write_wifi_wpa_eap_ttls_tls (void) NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; NMSetting8021x *s_8021x; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -9667,18 +9667,18 @@ test_write_wifi_wpa_eap_ttls_tls (void) TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY, error->message); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -9743,8 +9743,8 @@ test_write_wifi_wpa_eap_ttls_mschapv2 (void) NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; NMSetting8021x *s_8021x; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -9821,18 +9821,18 @@ test_write_wifi_wpa_eap_ttls_mschapv2 (void) /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -9896,8 +9896,8 @@ test_write_wifi_wpa_then_open (void) NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -9964,20 +9964,20 @@ test_write_wifi_wpa_then_open (void) nm_setting_wireless_security_add_group (s_wsec, "ccmp"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_assert (s_ip6); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); success = nm_connection_verify (connection, &error); @@ -10086,8 +10086,8 @@ test_write_wifi_wpa_then_wep_with_perms (void) NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -10160,20 +10160,20 @@ test_write_wifi_wpa_then_wep_with_perms (void) nm_setting_wireless_security_add_group (s_wsec, "ccmp"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_assert (s_ip6); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); success = nm_connection_verify (connection, &error); @@ -10290,8 +10290,8 @@ test_write_wifi_dynamic_wep_leap (void) NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; NMSetting8021x *s_8021x; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -10356,19 +10356,19 @@ test_write_wifi_dynamic_wep_leap (void) NULL); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_assert (s_ip6); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); success = nm_connection_verify (connection, &error); @@ -10443,8 +10443,8 @@ test_write_wired_qeth_dhcp (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; char **subchans; gboolean success; @@ -10488,20 +10488,20 @@ test_write_wired_qeth_dhcp (void) nm_setting_wired_add_s390_option (s_wired, "protocol", "blahbalh"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); /* Verify */ @@ -10564,8 +10564,8 @@ test_write_wired_ctc_dhcp (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; char **subchans; gboolean success; @@ -10609,19 +10609,19 @@ test_write_wired_ctc_dhcp (void) nm_setting_wired_add_s390_option (s_wired, "ctcprot", "0"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_assert (s_ip6); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); /* Verify */ @@ -10697,8 +10697,8 @@ test_write_permissions (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -10733,20 +10733,20 @@ test_write_permissions (void) nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); /* Verify */ @@ -10810,8 +10810,8 @@ test_write_wifi_wep_agent_keys (void) NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; const char *str_ssid = "foobarbaz"; GBytes *ssid; @@ -10841,19 +10841,19 @@ test_write_wifi_wep_agent_keys (void) g_free (uuid); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_assert (s_ip6); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); /* Wifi setting */ @@ -10948,7 +10948,7 @@ test_write_wired_pppoe (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSettingPppoe *s_pppoe; NMSettingPpp *s_ppp; char *uuid; @@ -10976,11 +10976,11 @@ test_write_wired_pppoe (void) nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* PPPoE setting */ @@ -11017,7 +11017,7 @@ test_write_vpn (void) { NMConnection *connection; NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSettingVpn *s_vpn; char *uuid; gboolean success; @@ -11052,11 +11052,11 @@ test_write_vpn (void) nm_setting_vpn_add_secret (s_vpn, "password", "sup3rs3cr3t"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -11079,7 +11079,7 @@ test_write_mobile_broadband (gboolean gsm) { NMConnection *connection; NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSettingGsm *s_gsm; NMSettingCdma *s_cdma; NMSettingPpp *s_ppp; @@ -11130,11 +11130,11 @@ test_write_mobile_broadband (gboolean gsm) NULL); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* PPP setting */ @@ -11217,8 +11217,8 @@ test_write_bridge_main (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingBridge *s_bridge; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; NMIPAddress *addr; static const char *mac = "31:33:33:37:be:cd"; @@ -11259,27 +11259,27 @@ test_write_bridge_main (void) NULL); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, - NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.1", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_assert (s_ip6); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL); nmtst_assert_connection_verifies_without_normalization (connection); @@ -11814,8 +11814,8 @@ test_write_ethernet_missing_ipv6 (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; GError *error = NULL; @@ -11849,14 +11849,14 @@ test_write_ethernet_missing_ipv6 (void) nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, "random-client-id-00:22:33", - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, TRUE, - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TRUE, + NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, TRUE, + NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, TRUE, NULL); /* IP6 setting */ @@ -11907,12 +11907,12 @@ test_write_ethernet_missing_ipv6 (void) * the comparison can succeed. Missing IPv6 setting should have been * written out (and re-read) as Automatic IPv6. */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_assert (s_ip6); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, @@ -11999,8 +11999,8 @@ test_write_bond_main (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingBond *s_bond; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; NMSettingWired *s_wired; char *uuid; NMIPAddress *addr; @@ -12038,25 +12038,25 @@ test_write_bond_main (void) nm_connection_add_setting (connection, NM_SETTING (s_bond)); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, - NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.1", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL); nmtst_assert_connection_verifies_without_normalization (connection); @@ -12337,8 +12337,8 @@ test_write_infiniband (void) NMConnection *reread; NMSettingConnection *s_con; NMSettingInfiniband *s_infiniband; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; const char *mac = "80:00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22"; guint32 mtu = 65520; char *uuid; @@ -12378,25 +12378,25 @@ test_write_infiniband (void) NULL); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, - NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.1", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, addr); + nm_setting_ip_config_add_address (s_ip4, addr); nm_ip_address_unref (addr); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -12672,8 +12672,8 @@ test_write_dcb_basic (void) NMSettingConnection *s_con; NMSettingWired *s_wired; NMSettingDcb *s_dcb; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; gboolean success, ignore_error; guint i; char *uuid, *testfile; @@ -12702,12 +12702,12 @@ test_write_dcb_basic (void) nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP stuff */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); + g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - g_object_set (G_OBJECT (s_ip6), NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); + g_object_set (G_OBJECT (s_ip6), NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); /* DCB */ @@ -12952,8 +12952,8 @@ test_write_fcoe_mode (gconstpointer user_data) NMSettingConnection *s_con; NMSettingWired *s_wired; NMSettingDcb *s_dcb; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; gboolean success, ignore_error; char *uuid, *testfile; @@ -12975,12 +12975,12 @@ test_write_fcoe_mode (gconstpointer user_data) nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP stuff */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); + g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - g_object_set (G_OBJECT (s_ip6), NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); + g_object_set (G_OBJECT (s_ip6), NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); /* DCB */ @@ -13074,8 +13074,8 @@ test_write_team_master (void) NMSettingConnection *s_con; NMSettingTeam *s_team; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid, *testfile = NULL, *val; gboolean success; GError *error = NULL; @@ -13111,21 +13111,21 @@ test_write_team_master (void) nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_assert (s_ip6); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); nmtst_assert_connection_verifies_without_normalization (connection); diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c index d22b30cdc6..d12ff03cf4 100644 --- a/src/settings/plugins/ifcfg-rh/writer.c +++ b/src/settings/plugins/ifcfg-rh/writer.c @@ -1741,7 +1741,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) } static gboolean -write_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError **error) +write_route_file_legacy (const char *filename, NMSettingIPConfig *s_ip4, GError **error) { const char *dest, *next_hop; char **route_items; @@ -1756,7 +1756,7 @@ write_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError g_return_val_if_fail (error != NULL, FALSE); g_return_val_if_fail (*error == NULL, FALSE); - num = nm_setting_ip4_config_get_num_routes (s_ip4); + num = nm_setting_ip_config_get_num_routes (s_ip4); if (num == 0) { unlink (filename); return TRUE; @@ -1764,7 +1764,7 @@ write_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError route_items = g_malloc0 (sizeof (char*) * (num + 1)); for (i = 0; i < num; i++) { - route = nm_setting_ip4_config_get_route (s_ip4, i); + route = nm_setting_ip_config_get_route (s_ip4, i); dest = nm_ip_route_get_dest (route); prefix = nm_ip_route_get_prefix (route); @@ -1794,7 +1794,7 @@ error: static gboolean write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) { - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; const char *value; char *addr_key, *prefix_key, *netmask_key, *gw_key, *metric_key, *tmp; char *route_path = NULL; @@ -1807,7 +1807,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) s_ip4 = nm_connection_get_setting_ip4_config (connection); if (s_ip4) - method = nm_setting_ip4_config_get_method (s_ip4); + method = nm_setting_ip_config_get_method (s_ip4); /* Missing IP4 setting is assumed to be DHCP */ if (!method) @@ -1850,7 +1850,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) /* Temporarily create fake IP4 setting if missing; method set to DHCP above */ if (!s_ip4) { - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); fake_ip4 = TRUE; } @@ -1877,11 +1877,11 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) /* Write out IPADDR<n>, PREFIX<n>, GATEWAY<n> for current IP addresses * without labels. Unset obsolete NETMASK<n>. */ - num = nm_setting_ip4_config_get_num_addresses (s_ip4); + num = nm_setting_ip_config_get_num_addresses (s_ip4); for (i = n = 0; i < num; i++) { NMIPAddress *addr; - addr = nm_setting_ip4_config_get_address (s_ip4, i); + addr = nm_setting_ip_config_get_address (s_ip4, i); if (i > 0) { GVariant *label; @@ -1943,7 +1943,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) g_free (gw_key); } - num = nm_setting_ip4_config_get_num_dns (s_ip4); + num = nm_setting_ip_config_get_num_dns (s_ip4); for (i = 0; i < 254; i++) { const char *dns; @@ -1952,19 +1952,19 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) if (i >= num) svSetValue (ifcfg, addr_key, NULL, FALSE); else { - dns = nm_setting_ip4_config_get_dns (s_ip4, i); + dns = nm_setting_ip_config_get_dns (s_ip4, i); svSetValue (ifcfg, addr_key, dns, FALSE); } g_free (addr_key); } - num = nm_setting_ip4_config_get_num_dns_searches (s_ip4); + num = nm_setting_ip_config_get_num_dns_searches (s_ip4); if (num > 0) { searches = g_string_new (NULL); for (i = 0; i < num; i++) { if (i > 0) g_string_append_c (searches, ' '); - g_string_append (searches, nm_setting_ip4_config_get_dns_search (s_ip4, i)); + g_string_append (searches, nm_setting_ip_config_get_dns_search (s_ip4, i)); } svSetValue (ifcfg, "DOMAIN", searches->str, FALSE); g_string_free (searches, TRUE); @@ -1973,7 +1973,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) /* DEFROUTE; remember that it has the opposite meaning from never-default */ svSetValue (ifcfg, "DEFROUTE", - nm_setting_ip4_config_get_never_default (s_ip4) ? "no" : "yes", + nm_setting_ip_config_get_never_default (s_ip4) ? "no" : "yes", FALSE); svSetValue (ifcfg, "PEERDNS", NULL, FALSE); @@ -1981,14 +1981,14 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svSetValue (ifcfg, "DHCP_CLIENT_ID", NULL, FALSE); if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { svSetValue (ifcfg, "PEERDNS", - nm_setting_ip4_config_get_ignore_auto_dns (s_ip4) ? "no" : "yes", + nm_setting_ip_config_get_ignore_auto_dns (s_ip4) ? "no" : "yes", FALSE); svSetValue (ifcfg, "PEERROUTES", - nm_setting_ip4_config_get_ignore_auto_routes (s_ip4) ? "no" : "yes", + nm_setting_ip_config_get_ignore_auto_routes (s_ip4) ? "no" : "yes", FALSE); - value = nm_setting_ip4_config_get_dhcp_hostname (s_ip4); + value = nm_setting_ip_config_get_dhcp_hostname (s_ip4); if (value) svSetValue (ifcfg, "DHCP_HOSTNAME", value, FALSE); @@ -1996,16 +1996,16 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) * in that case, because it is NM-specific variable */ svSetValue (ifcfg, "DHCP_SEND_HOSTNAME", - nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) ? NULL : "no", + nm_setting_ip_config_get_dhcp_send_hostname (s_ip4) ? NULL : "no", FALSE); - value = nm_setting_ip4_config_get_dhcp_client_id (s_ip4); + value = nm_setting_ip4_config_get_dhcp_client_id (NM_SETTING_IP4_CONFIG (s_ip4)); if (value) svSetValue (ifcfg, "DHCP_CLIENT_ID", value, FALSE); } svSetValue (ifcfg, "IPV4_FAILURE_FATAL", - nm_setting_ip4_config_get_may_fail (s_ip4) ? "no" : "yes", + nm_setting_ip_config_get_may_fail (s_ip4) ? "no" : "yes", FALSE); /* Static routes - route-<name> file */ @@ -2028,7 +2028,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) } g_free (route_path); - num = nm_setting_ip4_config_get_num_routes (s_ip4); + num = nm_setting_ip_config_get_num_routes (s_ip4); for (i = 0; i < 256; i++) { char buf[INET_ADDRSTRLEN]; NMIPRoute *route; @@ -2045,7 +2045,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svSetValue (routefile, gw_key, NULL, FALSE); svSetValue (routefile, metric_key, NULL, FALSE); } else { - route = nm_setting_ip4_config_get_route (s_ip4, i); + route = nm_setting_ip_config_get_route (s_ip4, i); svSetValue (routefile, addr_key, nm_ip_route_get_dest (route), FALSE); @@ -2096,7 +2096,7 @@ out: static void write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path) { - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *base_ifcfg_dir, *base_ifcfg_name, *base_name; int i, num, base_ifcfg_name_len, base_name_len; GDir *dir; @@ -2134,7 +2134,7 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path) if (!s_ip4) return; - num = nm_setting_ip4_config_get_num_addresses (s_ip4); + num = nm_setting_ip_config_get_num_addresses (s_ip4); for (i = 0; i < num; i++) { GVariant *label_var; const char *label, *p; @@ -2142,7 +2142,7 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path) NMIPAddress *addr; shvarFile *ifcfg; - addr = nm_setting_ip4_config_get_address (s_ip4, i); + addr = nm_setting_ip_config_get_address (s_ip4, i); label_var = nm_ip_address_get_attribute (addr, "label"); if (!label_var) @@ -2165,7 +2165,7 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path) svSetValue (ifcfg, "DEVICE", label, FALSE); - addr = nm_setting_ip4_config_get_address (s_ip4, i); + addr = nm_setting_ip_config_get_address (s_ip4, i); svSetValue (ifcfg, "IPADDR", nm_ip_address_get_address (addr), FALSE); tmp = g_strdup_printf ("%u", nm_ip_address_get_prefix (addr)); @@ -2183,7 +2183,7 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path) } static gboolean -write_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **error) +write_route6_file (const char *filename, NMSettingIPConfig *s_ip6, GError **error) { char **route_items; char *route_contents; @@ -2196,7 +2196,7 @@ write_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **err g_return_val_if_fail (error != NULL, FALSE); g_return_val_if_fail (*error == NULL, FALSE); - num = nm_setting_ip6_config_get_num_routes (s_ip6); + num = nm_setting_ip_config_get_num_routes (s_ip6); if (num == 0) { unlink (filename); return TRUE; @@ -2204,7 +2204,7 @@ write_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **err route_items = g_malloc0 (sizeof (char*) * (num + 1)); for (i = 0; i < num; i++) { - route = nm_setting_ip6_config_get_route (s_ip6, i); + route = nm_setting_ip_config_get_route (s_ip6, i); route_items[i] = g_strdup_printf ("%s/%u via %s metric %u\n", nm_ip_route_get_dest (route), nm_ip_route_get_prefix (route), @@ -2231,8 +2231,8 @@ error: static gboolean write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) { - NMSettingIP6Config *s_ip6; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip6; + NMSettingIPConfig *s_ip4; const char *value; char *addr_key; guint32 i, num, num4; @@ -2256,7 +2256,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) return TRUE; } - value = nm_setting_ip6_config_get_method (s_ip6); + value = nm_setting_ip_config_get_method (s_ip6); g_assert (value); if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) { svSetValue (ifcfg, "IPV6INIT", "no", FALSE); @@ -2271,7 +2271,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svSetValue (ifcfg, "IPV6INIT", "yes", FALSE); svSetValue (ifcfg, "IPV6_AUTOCONF", "no", FALSE); svSetValue (ifcfg, "DHCPV6C", "yes", FALSE); - hostname = nm_setting_ip6_config_get_dhcp_hostname (s_ip6); + hostname = nm_setting_ip_config_get_dhcp_hostname (s_ip6); if (hostname) svSetValue (ifcfg, "DHCP_HOSTNAME", hostname, FALSE); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { @@ -2289,7 +2289,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) } /* Write out IP addresses */ - num = nm_setting_ip6_config_get_num_addresses (s_ip6); + num = nm_setting_ip_config_get_num_addresses (s_ip6); ip_str1 = g_string_new (NULL); ip_str2 = g_string_new (NULL); ipv6_defaultgw = NULL; @@ -2299,7 +2299,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) else ip_ptr = ip_str2; - addr = nm_setting_ip6_config_get_address (s_ip6, i); + addr = nm_setting_ip_config_get_address (s_ip6, i); if (i > 1) g_string_append_c (ip_ptr, ' '); /* separate addresses in IPV6ADDR_SECONDARIES */ @@ -2319,22 +2319,22 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) /* Write out DNS - 'DNS' key is used both for IPv4 and IPv6 */ s_ip4 = nm_connection_get_setting_ip4_config (connection); - num4 = s_ip4 ? nm_setting_ip4_config_get_num_dns (s_ip4) : 0; /* from where to start with IPv6 entries */ - num = nm_setting_ip6_config_get_num_dns (s_ip6); + num4 = s_ip4 ? nm_setting_ip_config_get_num_dns (s_ip4) : 0; /* from where to start with IPv6 entries */ + num = nm_setting_ip_config_get_num_dns (s_ip6); for (i = 0; i < 254; i++) { addr_key = g_strdup_printf ("DNS%d", i + num4 + 1); if (i >= num) svSetValue (ifcfg, addr_key, NULL, FALSE); else { - dns = nm_setting_ip6_config_get_dns (s_ip6, i); + dns = nm_setting_ip_config_get_dns (s_ip6, i); svSetValue (ifcfg, addr_key, dns, FALSE); } g_free (addr_key); } /* Write out DNS domains - 'DOMAIN' key is shared for both IPv4 and IPv6 domains */ - num = nm_setting_ip6_config_get_num_dns_searches (s_ip6); + num = nm_setting_ip_config_get_num_dns_searches (s_ip6); if (num > 0) { char *ip4_domains; ip4_domains = svGetValue (ifcfg, "DOMAIN", FALSE); @@ -2342,7 +2342,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) for (i = 0; i < num; i++) { if (searches->len > 0) g_string_append_c (searches, ' '); - g_string_append (searches, nm_setting_ip6_config_get_dns_search (s_ip6, i)); + g_string_append (searches, nm_setting_ip_config_get_dns_search (s_ip6, i)); } svSetValue (ifcfg, "DOMAIN", searches->str, FALSE); g_string_free (searches, TRUE); @@ -2351,7 +2351,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) /* handle IPV6_DEFROUTE */ /* IPV6_DEFROUTE has the opposite meaning from 'never-default' */ - if (nm_setting_ip6_config_get_never_default(s_ip6)) + if (nm_setting_ip_config_get_never_default(s_ip6)) svSetValue (ifcfg, "IPV6_DEFROUTE", "no", FALSE); else svSetValue (ifcfg, "IPV6_DEFROUTE", "yes", FALSE); @@ -2360,22 +2360,22 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svSetValue (ifcfg, "IPV6_PEERROUTES", NULL, FALSE); if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) { svSetValue (ifcfg, "IPV6_PEERDNS", - nm_setting_ip6_config_get_ignore_auto_dns (s_ip6) ? "no" : "yes", + nm_setting_ip_config_get_ignore_auto_dns (s_ip6) ? "no" : "yes", FALSE); svSetValue (ifcfg, "IPV6_PEERROUTES", - nm_setting_ip6_config_get_ignore_auto_routes (s_ip6) ? "no" : "yes", + nm_setting_ip_config_get_ignore_auto_routes (s_ip6) ? "no" : "yes", FALSE); } svSetValue (ifcfg, "IPV6_FAILURE_FATAL", - nm_setting_ip6_config_get_may_fail (s_ip6) ? "no" : "yes", + nm_setting_ip_config_get_may_fail (s_ip6) ? "no" : "yes", FALSE); /* IPv6 Privacy Extensions */ svSetValue (ifcfg, "IPV6_PRIVACY", NULL, FALSE); svSetValue (ifcfg, "IPV6_PRIVACY_PREFER_PUBLIC_IP", NULL, FALSE); - switch (nm_setting_ip6_config_get_ip6_privacy (s_ip6)){ + switch (nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6))){ case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED: svSetValue (ifcfg, "IPV6_PRIVACY", "no", FALSE); break; diff --git a/src/settings/plugins/ifnet/connection_parser.c b/src/settings/plugins/ifnet/connection_parser.c index 64dcd75a77..4233c75f2f 100644 --- a/src/settings/plugins/ifnet/connection_parser.c +++ b/src/settings/plugins/ifnet/connection_parser.c @@ -544,25 +544,25 @@ make_wired_connection_setting (NMConnection *connection, nm_connection_add_setting (connection, NM_SETTING (s_wired)); } -/* add NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, - * NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID in future*/ +/* add NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, + * NM_SETTING_IP_CONFIG_DHCP_CLIENT_ID in future*/ static void make_ip4_setting (NMConnection *connection, const char *conn_name, GError **error) { - NMSettingIP4Config *ip4_setting = - NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); + NMSettingIPConfig *ip4_setting = + NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ()); const char *value, *method = NULL; gboolean is_static_block = is_static_ip4 (conn_name); ip_block *iblock = NULL; /* set dhcp options (dhcp_xxx) */ value = ifnet_get_data (conn_name, "dhcp"); - g_object_set (ip4_setting, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, value + g_object_set (ip4_setting, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, value && strstr (value, "nodns") ? TRUE : FALSE, - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, value + NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, value && strstr (value, "nogateway") ? TRUE : FALSE, NULL); if (!is_static_block) { @@ -575,21 +575,21 @@ make_ip4_setting (NMConnection *connection, } if (strstr (method, "dhcp")) g_object_set (ip4_setting, - NM_SETTING_IP4_CONFIG_METHOD, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL); + NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, NULL); else if (strstr (method, "autoip")) { g_object_set (ip4_setting, - NM_SETTING_IP4_CONFIG_METHOD, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL); + NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, NULL); nm_connection_add_setting (connection, NM_SETTING (ip4_setting)); return; } else if (strstr (method, "shared")) { g_object_set (ip4_setting, - NM_SETTING_IP4_CONFIG_METHOD, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_SHARED, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL); + NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, NULL); nm_connection_add_setting (connection, NM_SETTING (ip4_setting)); return; } else { @@ -618,11 +618,11 @@ make_ip4_setting (NMConnection *connection, ip4_addr = nm_ip_address_new (AF_INET, iblock->ip, iblock->prefix, iblock->next_hop, &local); if (iblock->next_hop) g_object_set (ip4_setting, - NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, + NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, TRUE, NULL); if (ip4_addr) { - if (!nm_setting_ip4_config_add_address (ip4_setting, ip4_addr)) + if (!nm_setting_ip_config_add_address (ip4_setting, ip4_addr)) nm_log_warn (LOGD_SETTINGS, "ignoring duplicate IP4 address"); nm_ip_address_unref (ip4_addr); } else { @@ -636,8 +636,8 @@ make_ip4_setting (NMConnection *connection, } g_object_set (ip4_setting, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, - NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, !has_default_ip4_route (conn_name), + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_NEVER_DEFAULT, !has_default_ip4_route (conn_name), NULL); } @@ -648,7 +648,7 @@ make_ip4_setting (NMConnection *connection, get_dhcp_hostname_and_client_id (&dhcp_hostname, &client_id); if (dhcp_hostname) { g_object_set (ip4_setting, - NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, + NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL); nm_log_info (LOGD_SETTINGS, "DHCP hostname: %s", dhcp_hostname); g_free (dhcp_hostname); @@ -679,7 +679,7 @@ make_ip4_setting (NMConnection *connection, for (item = searches; *item; item++) { if (strlen (*item)) { - if (!nm_setting_ip4_config_add_dns_search (ip4_setting, *item)) + if (!nm_setting_ip_config_add_dns_search (ip4_setting, *item)) nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *item); } } @@ -711,9 +711,8 @@ make_ip4_setting (NMConnection *connection, } route = nm_ip_route_new (AF_INET, iblock->ip, iblock->prefix, iblock->next_hop, metric, &local); - if (route) { - if (nm_setting_ip4_config_add_route (ip4_setting, route)) + if (nm_setting_ip_config_add_route (ip4_setting, route)) nm_log_info (LOGD_SETTINGS, "new IP4 route:%s\n", iblock->ip); else nm_log_warn (LOGD_SETTINGS, "duplicate IP4 route"); @@ -737,7 +736,7 @@ make_ip6_setting (NMConnection *connection, const char *conn_name, GError **error) { - NMSettingIP6Config *s_ip6 = NULL; + NMSettingIPConfig *s_ip6 = NULL; gboolean is_static_block = is_static_ip6 (conn_name); // used to disable IPv6 @@ -747,7 +746,7 @@ make_ip6_setting (NMConnection *connection, ip_block *iblock; gboolean never_default = !has_default_ip6_route (conn_name); - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); value = ifnet_get_data (conn_name, "enable_ipv6"); if (value && is_true (value)) @@ -757,7 +756,7 @@ make_ip6_setting (NMConnection *connection, // Currently only Manual and DHCP are supported if (!ipv6_enabled) { g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL); goto done; } else if (!is_static_block) { @@ -774,10 +773,10 @@ make_ip6_setting (NMConnection *connection, nm_log_info (LOGD_SETTINGS, "IPv6 for %s enabled, using %s", conn_name, method); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, method, - NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, FALSE, - NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, FALSE, - NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, never_default, NULL); + NM_SETTING_IP_CONFIG_METHOD, method, + NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, FALSE, + NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, FALSE, + NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default, NULL); /* Make manual settings */ if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { @@ -797,9 +796,9 @@ make_ip6_setting (NMConnection *connection, ip6_addr = nm_ip_address_new (AF_INET6, iblock->ip, iblock->prefix, NULL, &local); if (ip6_addr) { - if (nm_setting_ip6_config_add_address (s_ip6, ip6_addr)) { + if (nm_setting_ip_config_add_address (s_ip6, ip6_addr)) { nm_log_info (LOGD_SETTINGS, "ipv6 addresses count: %d", - nm_setting_ip6_config_get_num_addresses (s_ip6)); + nm_setting_ip_config_get_num_addresses (s_ip6)); } else { nm_log_warn (LOGD_SETTINGS, "ignoring duplicate IP6 address"); } @@ -817,15 +816,15 @@ make_ip6_setting (NMConnection *connection, } else if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) { /* - autoconf or DHCPv6 stuff goes here */ } - // DNS Servers, set NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS TRUE here + // DNS Servers, set NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS TRUE here set_ip6_dns_servers (s_ip6, conn_name); - /* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIP4Config */ + /* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIPConfig */ // Add routes iblock = convert_ip6_routes_block (conn_name); if (iblock) - g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, + g_object_set (s_ip6, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, TRUE, NULL); /* Add all IPv6 routes */ while (iblock) { @@ -855,7 +854,7 @@ make_ip6_setting (NMConnection *connection, route = nm_ip_route_new (AF_INET6, iblock->ip, iblock->prefix, iblock->next_hop, metric, &local); if (route) { - if (nm_setting_ip6_config_add_route (s_ip6, route)) + if (nm_setting_ip_config_add_route (s_ip6, route)) nm_log_info (LOGD_SETTINGS, " new IP6 route"); else nm_log_warn (LOGD_SETTINGS, " duplicate IP6 route"); @@ -2373,7 +2372,7 @@ write_wired_setting (NMConnection *connection, static gboolean write_ip4_setting (NMConnection *connection, const char *conn_name, GError **error) { - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; const char *value; guint32 i, num; GString *searches; @@ -2392,17 +2391,17 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err } routes = g_string_new (NULL); - value = nm_setting_ip4_config_get_method (s_ip4); + value = nm_setting_ip_config_get_method (s_ip4); g_assert (value); if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { - num = nm_setting_ip4_config_get_num_addresses (s_ip4); + num = nm_setting_ip_config_get_num_addresses (s_ip4); ips = g_string_new (NULL); /* IPv4 addresses */ for (i = 0; i < num; i++) { NMIPAddress *addr; - addr = nm_setting_ip4_config_get_address (s_ip4, i); + addr = nm_setting_ip_config_get_address (s_ip4, i); g_string_append_printf (ips, "\"%s/%u", nm_ip_address_get_address (addr), @@ -2426,13 +2425,13 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err ifnet_set_data (conn_name, "config", "dhcp"); /* DNS Servers */ - num = nm_setting_ip4_config_get_num_dns (s_ip4); + num = nm_setting_ip_config_get_num_dns (s_ip4); if (num > 0) { dns = g_string_new (NULL); for (i = 0; i < num; i++) { const char *ip; - ip = nm_setting_ip4_config_get_dns (s_ip4, i); + ip = nm_setting_ip_config_get_dns (s_ip4, i); g_string_append_printf (dns, " %s", ip); } ifnet_set_data (conn_name, "dns_servers", dns->str); @@ -2441,14 +2440,14 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err ifnet_set_data (conn_name, "dns_servers", NULL); /* DNS Searches */ - num = nm_setting_ip4_config_get_num_dns_searches (s_ip4); + num = nm_setting_ip_config_get_num_dns_searches (s_ip4); if (num > 0) { searches = g_string_new (NULL); for (i = 0; i < num; i++) { if (i > 0) g_string_append_c (searches, ' '); g_string_append (searches, - nm_setting_ip4_config_get_dns_search + nm_setting_ip_config_get_dns_search (s_ip4, i)); } ifnet_set_data (conn_name, "dns_search", searches->str); @@ -2457,12 +2456,12 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err ifnet_set_data (conn_name, "dns_search", NULL); /* FIXME Will be implemented when configuration supports it if (!strcmp(value, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { - value = nm_setting_ip4_config_get_dhcp_hostname(s_ip4); + value = nm_setting_ip_config_get_dhcp_hostname(s_ip4); if (value) ifnet_set_data(conn_name, "DHCP_HOSTNAME", value, FALSE); - value = nm_setting_ip4_config_get_dhcp_client_id(s_ip4); + value = nm_setting_ip_config_get_dhcp_client_id(s_ip4); if (value) ifnet_set_data(conn_name, "DHCP_CLIENT_ID", value, FALSE); @@ -2470,13 +2469,13 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err */ /* Static routes */ - num = nm_setting_ip4_config_get_num_routes (s_ip4); + num = nm_setting_ip_config_get_num_routes (s_ip4); if (num > 0) { for (i = 0; i < num; i++) { NMIPRoute *route; const char *next_hop; - route = nm_setting_ip4_config_get_route (s_ip4, i); + route = nm_setting_ip_config_get_route (s_ip4, i); next_hop = nm_ip_route_get_next_hop (route); if (!next_hop) @@ -2500,7 +2499,7 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err } static gboolean -write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **error) +write_route6_file (NMSettingIPConfig *s_ip6, const char *conn_name, GError **error) { NMIPRoute *route; const char *next_hop; @@ -2509,7 +2508,7 @@ write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **er const char *old_routes; g_return_val_if_fail (s_ip6 != NULL, FALSE); - num = nm_setting_ip6_config_get_num_routes (s_ip6); + num = nm_setting_ip_config_get_num_routes (s_ip6); if (num == 0) { return TRUE; } @@ -2519,7 +2518,7 @@ write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **er if (old_routes) g_string_append (routes_string, "\" "); for (i = 0; i < num; i++) { - route = nm_setting_ip6_config_get_route (s_ip6, i); + route = nm_setting_ip_config_get_route (s_ip6, i); next_hop = nm_ip_route_get_next_hop (route); if (!next_hop) @@ -2540,7 +2539,7 @@ write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **er static gboolean write_ip6_setting (NMConnection *connection, const char *conn_name, GError **error) { - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; const char *value; guint32 i, num; GString *searches; @@ -2554,7 +2553,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err return FALSE; } - value = nm_setting_ip6_config_get_method (s_ip6); + value = nm_setting_ip_config_get_method (s_ip6); g_assert (value); if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) { ifnet_set_data (conn_name, "enable_ipv6", "false"); @@ -2588,12 +2587,12 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err if (!config) config = ""; - num = nm_setting_ip6_config_get_num_addresses (s_ip6); + num = nm_setting_ip_config_get_num_addresses (s_ip6); /* IPv6 addresses */ ip_str = g_string_new (NULL); for (i = 0; i < num; i++) { - addr = nm_setting_ip6_config_get_address (s_ip6, i); + addr = nm_setting_ip_config_get_address (s_ip6, i); g_string_append_printf (ip_str, "\"%s/%u\"", nm_ip_address_get_address (addr), @@ -2606,7 +2605,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err } /* DNS Servers */ - num = nm_setting_ip6_config_get_num_dns (s_ip6); + num = nm_setting_ip_config_get_num_dns (s_ip6); if (num > 0) { const char *dns_servers = ifnet_get_data (conn_name, "dns_servers"); gchar *tmp; @@ -2616,7 +2615,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err if (!dns_servers) dns_servers = ""; for (i = 0; i < num; i++) { - dns = nm_setting_ip6_config_get_dns (s_ip6, i); + dns = nm_setting_ip_config_get_dns (s_ip6, i); if (!strstr (dns_servers, dns)) g_string_append_printf (dns_string, "%s ", dns); @@ -2628,7 +2627,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err } else /* DNS Searches */ - num = nm_setting_ip6_config_get_num_dns_searches (s_ip6); + num = nm_setting_ip_config_get_num_dns_searches (s_ip6); if (num > 0) { const char *ip4_domains; @@ -2640,7 +2639,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err const gchar *search = NULL; search = - nm_setting_ip6_config_get_dns_search (s_ip6, i); + nm_setting_ip_config_get_dns_search (s_ip6, i); if (search && !strstr (searches->str, search)) { if (searches->len > 0) g_string_append_c (searches, ' '); @@ -2686,7 +2685,7 @@ ifnet_update_parsers_by_connection (NMConnection *connection, GError **error) { NMSettingConnection *s_con; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; gboolean success = FALSE; const char *type; gboolean no_8021x = FALSE; diff --git a/src/settings/plugins/ifnet/net_utils.c b/src/settings/plugins/ifnet/net_utils.c index 9ead29f6e2..c4302418ec 100644 --- a/src/settings/plugins/ifnet/net_utils.c +++ b/src/settings/plugins/ifnet/net_utils.c @@ -651,7 +651,7 @@ destroy_ip_block (ip_block * iblock) } void -set_ip4_dns_servers (NMSettingIP4Config *s_ip4, const char *conn_name) +set_ip4_dns_servers (NMSettingIPConfig *s_ip4, const char *conn_name) { const char *dns_servers; gchar **server_list, *stripped; @@ -668,7 +668,7 @@ set_ip4_dns_servers (NMSettingIP4Config *s_ip4, const char *conn_name) length = g_strv_length (server_list); if (length) - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, TRUE, NULL); for (i = 0; i < length; i++) { g_strstrip (server_list[i]); @@ -679,14 +679,14 @@ set_ip4_dns_servers (NMSettingIP4Config *s_ip4, const char *conn_name) nm_log_warn (LOGD_SETTINGS, "ignored dns: %s\n", server_list[i]); continue; } - if (!nm_setting_ip4_config_add_dns (s_ip4, server_list[i])) + if (!nm_setting_ip_config_add_dns (s_ip4, server_list[i])) nm_log_warn (LOGD_SETTINGS, "warning: duplicate DNS server %s", server_list[i]); } g_strfreev (server_list); } void -set_ip6_dns_servers (NMSettingIP6Config *s_ip6, const char *conn_name) +set_ip6_dns_servers (NMSettingIPConfig *s_ip6, const char *conn_name) { const char *dns_servers; gchar **server_list, *stripped; @@ -704,7 +704,7 @@ set_ip6_dns_servers (NMSettingIP6Config *s_ip6, const char *conn_name) length = g_strv_length (server_list); if (length) - g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, + g_object_set (s_ip6, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, TRUE, NULL); for (i = 0; i < length; i++) { g_strstrip (server_list[i]); @@ -715,7 +715,7 @@ set_ip6_dns_servers (NMSettingIP6Config *s_ip6, const char *conn_name) nm_log_warn (LOGD_SETTINGS, "ignored dns: %s\n", server_list[i]); continue; } - if (!nm_setting_ip6_config_add_dns (s_ip6, server_list[i])) + if (!nm_setting_ip_config_add_dns (s_ip6, server_list[i])) nm_log_warn (LOGD_SETTINGS, "warning: duplicate DNS server %s", server_list[i]); } g_strfreev (server_list); diff --git a/src/settings/plugins/ifnet/net_utils.h b/src/settings/plugins/ifnet/net_utils.h index 83272e8956..d58e7ec616 100644 --- a/src/settings/plugins/ifnet/net_utils.h +++ b/src/settings/plugins/ifnet/net_utils.h @@ -53,8 +53,8 @@ ip_block *convert_ip4_routes_block (const char *conn_name); ip_block *convert_ip6_routes_block (const char *conn_name); void destroy_ip_block (ip_block * iblock); -void set_ip4_dns_servers (NMSettingIP4Config * s_ip4, const char *conn_name); -void set_ip6_dns_servers (NMSettingIP6Config * s_ip6, const char *conn_name); +void set_ip4_dns_servers (NMSettingIPConfig * s_ip4, const char *conn_name); +void set_ip6_dns_servers (NMSettingIPConfig * s_ip6, const char *conn_name); gchar *strip_string (gchar *str, gchar t); gboolean is_managed (const char *conn_name); diff --git a/src/settings/plugins/ifupdown/parser.c b/src/settings/plugins/ifupdown/parser.c index 72340a90eb..f916fa0e78 100644 --- a/src/settings/plugins/ifupdown/parser.c +++ b/src/settings/plugins/ifupdown/parser.c @@ -410,7 +410,7 @@ update_wired_setting_from_if_block(NMConnection *connection, } static void -ifupdown_ip4_add_dns (NMSettingIP4Config *s_ip4, const char *dns) +ifupdown_ip4_add_dns (NMSettingIPConfig *s_ip4, const char *dns) { guint32 addr; char **list, **iter; @@ -428,7 +428,7 @@ ifupdown_ip4_add_dns (NMSettingIP4Config *s_ip4, const char *dns) continue; } - if (!nm_setting_ip4_config_add_dns (s_ip4, *iter)) + if (!nm_setting_ip_config_add_dns (s_ip4, *iter)) nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter); } g_strfreev (list); @@ -440,12 +440,12 @@ update_ip4_setting_from_if_block(NMConnection *connection, GError **error) { - NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new()); + NMSettingIPConfig *s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new()); const char *type = ifparser_getkey(block, "inet"); gboolean is_static = type && !strcmp("static", type); if (!is_static) { - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); } else { guint32 tmp_mask; NMIPAddress *addr; @@ -490,9 +490,9 @@ update_ip4_setting_from_if_block(NMConnection *connection, if (!addr) goto error; - if (nm_setting_ip4_config_add_address (s_ip4, addr)) { + if (nm_setting_ip_config_add_address (s_ip4, addr)) { nm_log_info (LOGD_SETTINGS, "addresses count: %d", - nm_setting_ip4_config_get_num_addresses (s_ip4)); + nm_setting_ip_config_get_num_addresses (s_ip4)); } else { nm_log_info (LOGD_SETTINGS, "ignoring duplicate IP4 address"); } @@ -504,7 +504,7 @@ update_ip4_setting_from_if_block(NMConnection *connection, nameservers_v = ifparser_getkey (block, "dns-nameservers"); ifupdown_ip4_add_dns (s_ip4, nameservers_v); - if (!nm_setting_ip4_config_get_num_dns (s_ip4)) + if (!nm_setting_ip_config_get_num_dns (s_ip4)) nm_log_info (LOGD_SETTINGS, "No dns-nameserver configured in /etc/network/interfaces"); /* DNS searches */ @@ -515,13 +515,13 @@ update_ip4_setting_from_if_block(NMConnection *connection, g_strstrip (*iter); if (g_ascii_isspace (*iter[0])) continue; - if (!nm_setting_ip4_config_add_dns_search (s_ip4, *iter)) + if (!nm_setting_ip_config_add_dns_search (s_ip4, *iter)) nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter); } g_strfreev (list); } - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); } nm_connection_add_setting (connection, NM_SETTING (s_ip4)); @@ -533,7 +533,7 @@ error: } static void -ifupdown_ip6_add_dns (NMSettingIP6Config *s_ip6, const char *dns) +ifupdown_ip6_add_dns (NMSettingIPConfig *s_ip6, const char *dns) { struct in6_addr addr; char **list, **iter; @@ -551,7 +551,7 @@ ifupdown_ip6_add_dns (NMSettingIP6Config *s_ip6, const char *dns) continue; } - if (!nm_setting_ip6_config_add_dns (s_ip6, *iter)) + if (!nm_setting_ip_config_add_dns (s_ip6, *iter)) nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter); } g_strfreev (list); @@ -562,13 +562,13 @@ update_ip6_setting_from_if_block(NMConnection *connection, if_block *block, GError **error) { - NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new()); + NMSettingIPConfig *s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new()); const char *type = ifparser_getkey(block, "inet6"); gboolean is_static = type && (!strcmp("static", type) || !strcmp("v4tunnel", type)); if (!is_static) { - g_object_set(s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); + g_object_set(s_ip6, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); } else { NMIPAddress *addr; const char *address_v; @@ -603,9 +603,9 @@ update_ip6_setting_from_if_block(NMConnection *connection, if (!addr) goto error; - if (nm_setting_ip6_config_add_address (s_ip6, addr)) { + if (nm_setting_ip_config_add_address (s_ip6, addr)) { nm_log_info (LOGD_SETTINGS, "addresses count: %d", - nm_setting_ip6_config_get_num_addresses (s_ip6)); + nm_setting_ip_config_get_num_addresses (s_ip6)); } else { nm_log_info (LOGD_SETTINGS, "ignoring duplicate IP6 address"); } @@ -617,7 +617,7 @@ update_ip6_setting_from_if_block(NMConnection *connection, nameservers_v = ifparser_getkey(block, "dns-nameservers"); ifupdown_ip6_add_dns (s_ip6, nameservers_v); - if (!nm_setting_ip6_config_get_num_dns (s_ip6)) + if (!nm_setting_ip_config_get_num_dns (s_ip6)) nm_log_info (LOGD_SETTINGS, "No dns-nameserver configured in /etc/network/interfaces"); /* DNS searches */ @@ -628,14 +628,14 @@ update_ip6_setting_from_if_block(NMConnection *connection, g_strstrip (*iter); if (isblank (*iter[0])) continue; - if (!nm_setting_ip6_config_add_dns_search (s_ip6, *iter)) + if (!nm_setting_ip_config_add_dns_search (s_ip6, *iter)) nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter); } g_strfreev (list); } g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL); } diff --git a/src/settings/plugins/ifupdown/tests/test-ifupdown.c b/src/settings/plugins/ifupdown/tests/test-ifupdown.c index 643fa7d08a..0752ec4bbc 100644 --- a/src/settings/plugins/ifupdown/tests/test-ifupdown.c +++ b/src/settings/plugins/ifupdown/tests/test-ifupdown.c @@ -459,7 +459,7 @@ test17_read_static_ipv4 (const char *path) { NMConnection *connection; NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSettingWired *s_wired; char *unmanaged = NULL; GError *error = NULL; @@ -525,81 +525,81 @@ test17_read_static_ipv4 (const char *path) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, TEST17_NAME, "failed to verify %s: unexpected %s / %s key value", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* IP addresses */ - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1, + ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 1, TEST17_NAME, "failed to verify %s: unexpected %s / %s key value", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_ADDRESSES); - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert (ip4_addr != NULL); g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "10.0.0.3"); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 8); /* DNS Addresses */ - ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2, + ASSERT (nm_setting_ip_config_get_num_dns (s_ip4) == 2, TEST17_NAME, "failed to verify %s: unexpected %s / %s key value", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (!strcmp (nm_setting_ip4_config_get_dns (s_ip4, 0), "10.0.0.1"), + ASSERT (!strcmp (nm_setting_ip_config_get_dns (s_ip4, 0), "10.0.0.1"), TEST17_NAME, "failed to verify %s: unexpected %s / %s key value #1", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (!strcmp (nm_setting_ip4_config_get_dns (s_ip4, 1), "10.0.0.2"), + ASSERT (!strcmp (nm_setting_ip_config_get_dns (s_ip4, 1), "10.0.0.2"), TEST17_NAME, "failed to verify %s: unexpected %s / %s key value #2", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1, + ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 1, TEST17_NAME, "failed to verify %s: unexpected %s / %s key value", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); /* DNS search domains */ - ASSERT (nm_setting_ip4_config_get_num_dns_searches (s_ip4) == 2, + ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip4) == 2, TEST17_NAME, "failed to verify %s: unexpected %s / %s key value", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 0); + tmp = nm_setting_ip_config_get_dns_search (s_ip4, 0); ASSERT (tmp != NULL, TEST17_NAME, "failed to verify %s: missing %s / %s key", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); ASSERT (strcmp (tmp, expected_search1) == 0, TEST17_NAME, "failed to verify %s: unexpected %s / %s key value", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); - tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 1); + tmp = nm_setting_ip_config_get_dns_search (s_ip4, 1); ASSERT (tmp != NULL, TEST17_NAME, "failed to verify %s: missing %s / %s key", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); ASSERT (strcmp (tmp, expected_search2) == 0, TEST17_NAME, "failed to verify %s: unexpected %s / %s key value", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); g_object_unref (connection); } @@ -609,7 +609,7 @@ test18_read_static_ipv6 (const char *path) { NMConnection *connection; NMSettingConnection *s_con; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; NMSettingWired *s_wired; char *unmanaged = NULL; GError *error = NULL; @@ -681,85 +681,85 @@ test18_read_static_ipv6 (const char *path) NM_SETTING_IP6_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); + tmp = nm_setting_ip_config_get_method (s_ip6); ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0, TEST18_NAME, "failed to verify %s: unexpected %s / %s key value", file, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* IP addresses */ - ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1, + ASSERT (nm_setting_ip_config_get_num_addresses (s_ip6) == 1, TEST18_NAME, "failed to verify %s: unexpected number of %s / %s", file, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_ADDRESSES); - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0); + ip6_addr = nm_setting_ip_config_get_address (s_ip6, 0); g_assert (ip6_addr != NULL); g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "fc00::1"); g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 64); /* DNS Addresses */ - ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 2, + ASSERT (nm_setting_ip_config_get_num_dns (s_ip6) == 2, TEST18_NAME, "failed to verify %s: unexpected number of %s / %s values", file, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (!strcmp (nm_setting_ip6_config_get_dns (s_ip6, 0), "fc00::2"), + ASSERT (!strcmp (nm_setting_ip_config_get_dns (s_ip6, 0), "fc00::2"), TEST18_NAME, "failed to verify %s: unexpected %s / %s #1", file, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (!strcmp (nm_setting_ip6_config_get_dns (s_ip6, 1), "fc00::3"), + ASSERT (!strcmp (nm_setting_ip_config_get_dns (s_ip6, 1), "fc00::3"), TEST18_NAME, "failed to verify %s: unexpected %s / %s #2", file, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); /* DNS search domains */ - ASSERT (nm_setting_ip6_config_get_num_dns_searches (s_ip6) == 2, + ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip6) == 2, TEST18_NAME, "failed to verify %s: unexpected number of %s / %s values", file, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); - tmp = nm_setting_ip6_config_get_dns_search (s_ip6, 0); + tmp = nm_setting_ip_config_get_dns_search (s_ip6, 0); ASSERT (tmp != NULL, "wired-ipv6-manual-verify-ip6", "failed to verify %s: missing %s / %s #1", file, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); ASSERT (strcmp (tmp, expected_search1) == 0, "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s #1", file, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); - tmp = nm_setting_ip6_config_get_dns_search (s_ip6, 1); + tmp = nm_setting_ip_config_get_dns_search (s_ip6, 1); ASSERT (tmp != NULL, TEST18_NAME, "failed to verify %s: missing %s / %s #2", file, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); ASSERT (strcmp (tmp, expected_search2) == 0, TEST18_NAME, "failed to verify %s: unexpected %s / %s #2", file, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); g_free (unmanaged); g_object_unref (connection); @@ -769,7 +769,7 @@ static void test19_read_static_ipv4_plen (const char *path) { NMConnection *connection; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *unmanaged = NULL; GError *error = NULL; NMIPAddress *ip4_addr; @@ -801,13 +801,13 @@ test19_read_static_ipv4_plen (const char *path) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* IP addresses */ - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1, + ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 1, TEST19_NAME, "failed to verify %s: unexpected %s / %s key value", file, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); + NM_SETTING_IP_CONFIG_ADDRESSES); - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); + ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0); g_assert (ip4_addr != NULL); g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "10.0.0.3"); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 8); diff --git a/src/settings/plugins/keyfile/reader.c b/src/settings/plugins/keyfile/reader.c index 97ccf7d89b..526831a32e 100644 --- a/src/settings/plugins/keyfile/reader.c +++ b/src/settings/plugins/keyfile/reader.c @@ -879,27 +879,27 @@ static KeyParser key_parsers[] = { TRUE, mac_address_parser_ETHER }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES, + NM_SETTING_IP_CONFIG_ADDRESSES, FALSE, ip_address_or_route_parser }, { NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES, + NM_SETTING_IP_CONFIG_ADDRESSES, FALSE, ip_address_or_route_parser }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES, + NM_SETTING_IP_CONFIG_ROUTES, FALSE, ip_address_or_route_parser }, { NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES, + NM_SETTING_IP_CONFIG_ROUTES, FALSE, ip_address_or_route_parser }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS, + NM_SETTING_IP_CONFIG_DNS, FALSE, ip4_dns_parser }, { NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS, + NM_SETTING_IP_CONFIG_DNS, FALSE, ip6_dns_parser }, { NM_SETTING_WIRED_SETTING_NAME, diff --git a/src/settings/plugins/keyfile/tests/test-keyfile.c b/src/settings/plugins/keyfile/tests/test-keyfile.c index 0e05fed45b..89504b38a6 100644 --- a/src/settings/plugins/keyfile/tests/test-keyfile.c +++ b/src/settings/plugins/keyfile/tests/test-keyfile.c @@ -38,9 +38,9 @@ #define TEST_WIRELESS_FILE TEST_KEYFILES_DIR"/Test_Wireless_Connection" static void -check_ip4_address (NMSettingIP4Config *config, int idx, const char *address, int plen, const char *gateway) +check_ip_address (NMSettingIPConfig *config, int idx, const char *address, int plen, const char *gateway) { - NMIPAddress *ip4 = nm_setting_ip4_config_get_address (config, idx); + NMIPAddress *ip4 = nm_setting_ip_config_get_address (config, idx); g_assert (ip4); g_assert_cmpstr (nm_ip_address_get_address (ip4), ==, address); @@ -49,34 +49,10 @@ check_ip4_address (NMSettingIP4Config *config, int idx, const char *address, int } static void -check_ip6_address (NMSettingIP6Config *config, int idx, const char *address, int plen, const char *gateway) +check_ip_route (NMSettingIPConfig *config, int idx, const char *destination, int plen, + const char *next_hop, int metric) { - NMIPAddress *ip6 = nm_setting_ip6_config_get_address (config, idx); - - g_assert (ip6); - g_assert_cmpstr (nm_ip_address_get_address (ip6), ==, address); - g_assert_cmpint (nm_ip_address_get_prefix (ip6), ==, plen); - g_assert_cmpstr (nm_ip_address_get_gateway (ip6), ==, gateway); -} - -static void -check_ip4_route (NMSettingIP4Config *config, int idx, const char *destination, int plen, - const char *next_hop, int metric) -{ - NMIPRoute *route = nm_setting_ip4_config_get_route (config, idx); - - g_assert (route); - g_assert_cmpstr (nm_ip_route_get_dest (route), ==, destination); - g_assert_cmpint (nm_ip_route_get_prefix (route), ==, plen); - g_assert_cmpstr (nm_ip_route_get_next_hop (route), ==, next_hop); - g_assert_cmpint (nm_ip_route_get_metric (route), ==, metric); -} - -static void -check_ip6_route (NMSettingIP6Config *config, int idx, const char *destination, int plen, - const char *next_hop, int metric) -{ - NMIPRoute *route = nm_setting_ip6_config_get_route (config, idx); + NMIPRoute *route = nm_setting_ip_config_get_route (config, idx); g_assert (route); g_assert_cmpstr (nm_ip_route_get_dest (route), ==, destination); @@ -107,8 +83,8 @@ test_read_valid_wired_connection (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; GError *error = NULL; const char *mac; char expected_mac_address[ETH_ALEN] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }; @@ -242,55 +218,55 @@ test_read_valid_wired_connection (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", TEST_WIRED_FILE, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* DNS Addresses */ - ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2, + ASSERT (nm_setting_ip_config_get_num_dns (s_ip4) == 2, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", TEST_WIRED_FILE, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 0), "4.2.2.1") == 0, + ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 0), "4.2.2.1") == 0, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #1", TEST_WIRED_FILE, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 1), "4.2.2.2") == 0, + ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 1), "4.2.2.2") == 0, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #2", TEST_WIRED_FILE, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); /* IPv4 addresses */ - g_assert (nm_setting_ip4_config_get_num_addresses (s_ip4) == 6); - check_ip4_address (s_ip4, 0, "2.3.4.5", 24, "2.3.4.6"); - check_ip4_address (s_ip4, 1, "192.168.0.5", 24, "192.168.0.1"); - check_ip4_address (s_ip4, 2, "1.2.3.4", 16, "1.2.1.1"); - check_ip4_address (s_ip4, 3, "3.4.5.6", 16, NULL); - check_ip4_address (s_ip4, 4, "4.5.6.7", 24, "1.2.3.4"); - check_ip4_address (s_ip4, 5, "5.6.7.8", 24, NULL); + g_assert (nm_setting_ip_config_get_num_addresses (s_ip4) == 6); + check_ip_address (s_ip4, 0, "2.3.4.5", 24, "2.3.4.6"); + check_ip_address (s_ip4, 1, "192.168.0.5", 24, "192.168.0.1"); + check_ip_address (s_ip4, 2, "1.2.3.4", 16, "1.2.1.1"); + check_ip_address (s_ip4, 3, "3.4.5.6", 16, NULL); + check_ip_address (s_ip4, 4, "4.5.6.7", 24, "1.2.3.4"); + check_ip_address (s_ip4, 5, "5.6.7.8", 24, NULL); /* IPv4 routes */ - g_assert (nm_setting_ip4_config_get_num_routes (s_ip4) == 12); - check_ip4_route (s_ip4, 0, "5.6.7.8", 32, NULL, 0); - check_ip4_route (s_ip4, 1, "1.2.3.0", 24, "2.3.4.8", 99); - check_ip4_route (s_ip4, 2, "1.1.1.2", 12, NULL, 0); - check_ip4_route (s_ip4, 3, "1.1.1.3", 13, NULL, 0); - check_ip4_route (s_ip4, 4, "1.1.1.4", 14, "2.2.2.4", 0); - check_ip4_route (s_ip4, 5, "1.1.1.5", 15, "2.2.2.5", 0); - check_ip4_route (s_ip4, 6, "1.1.1.6", 16, "2.2.2.6", 0); - check_ip4_route (s_ip4, 7, "1.1.1.7", 17, NULL, 0); - check_ip4_route (s_ip4, 8, "1.1.1.8", 18, NULL, 0); - check_ip4_route (s_ip4, 9, "1.1.1.9", 19, NULL, 0); - check_ip4_route (s_ip4, 10, "1.1.1.10", 20, NULL, 0); - check_ip4_route (s_ip4, 11, "1.1.1.11", 21, NULL, 21); + g_assert (nm_setting_ip_config_get_num_routes (s_ip4) == 12); + check_ip_route (s_ip4, 0, "5.6.7.8", 32, NULL, 0); + check_ip_route (s_ip4, 1, "1.2.3.0", 24, "2.3.4.8", 99); + check_ip_route (s_ip4, 2, "1.1.1.2", 12, NULL, 0); + check_ip_route (s_ip4, 3, "1.1.1.3", 13, NULL, 0); + check_ip_route (s_ip4, 4, "1.1.1.4", 14, "2.2.2.4", 0); + check_ip_route (s_ip4, 5, "1.1.1.5", 15, "2.2.2.5", 0); + check_ip_route (s_ip4, 6, "1.1.1.6", 16, "2.2.2.6", 0); + check_ip_route (s_ip4, 7, "1.1.1.7", 17, NULL, 0); + check_ip_route (s_ip4, 8, "1.1.1.8", 18, NULL, 0); + check_ip_route (s_ip4, 9, "1.1.1.9", 19, NULL, 0); + check_ip_route (s_ip4, 10, "1.1.1.10", 20, NULL, 0); + check_ip_route (s_ip4, 11, "1.1.1.11", 21, NULL, 21); /* ===== IPv6 SETTING ===== */ @@ -301,139 +277,110 @@ test_read_valid_wired_connection (void) NM_SETTING_IP6_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); + tmp = nm_setting_ip_config_get_method (s_ip6); ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", TEST_WIRED_FILE, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* DNS Addresses */ - ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 2, + ASSERT (nm_setting_ip_config_get_num_dns (s_ip6) == 2, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", TEST_WIRED_FILE, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (strcmp (nm_setting_ip6_config_get_dns (s_ip6, 0), "1111:dddd::aaaa") == 0, + ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip6, 0), "1111:dddd::aaaa") == 0, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #1", TEST_WIRED_FILE, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); - ASSERT (strcmp (nm_setting_ip6_config_get_dns (s_ip6, 1), "1::cafe") == 0, + ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip6, 1), "1::cafe") == 0, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #2", TEST_WIRED_FILE, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); /* DNS Searches */ - ASSERT (nm_setting_ip6_config_get_num_dns_searches (s_ip6) == 3, + ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip6) == 3, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", TEST_WIRED_FILE, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); - ASSERT (!strcmp (nm_setting_ip6_config_get_dns_search (s_ip6, 0), expected6_dnssearch1), + ASSERT (!strcmp (nm_setting_ip_config_get_dns_search (s_ip6, 0), expected6_dnssearch1), "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #1", TEST_WIRED_FILE, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS_SEARCH); - ASSERT (!strcmp (nm_setting_ip6_config_get_dns_search (s_ip6, 1), expected6_dnssearch2), + NM_SETTING_IP_CONFIG_DNS_SEARCH); + ASSERT (!strcmp (nm_setting_ip_config_get_dns_search (s_ip6, 1), expected6_dnssearch2), "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #2", TEST_WIRED_FILE, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS_SEARCH); - ASSERT (!strcmp (nm_setting_ip6_config_get_dns_search (s_ip6, 2), expected6_dnssearch3), + NM_SETTING_IP_CONFIG_DNS_SEARCH); + ASSERT (!strcmp (nm_setting_ip_config_get_dns_search (s_ip6, 2), expected6_dnssearch3), "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #3", TEST_WIRED_FILE, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS_SEARCH); + NM_SETTING_IP_CONFIG_DNS_SEARCH); /* IPv6 addresses */ - g_assert (nm_setting_ip6_config_get_num_addresses (s_ip6) == 10); - check_ip6_address (s_ip6, 0, "2:3:4:5:6:7:8:9", 64, "2:3:4:5:1:2:3:4"); - check_ip6_address (s_ip6, 1, "abcd:1234:ffff::cdde", 64, NULL); - check_ip6_address (s_ip6, 2, "1:2:3:4:5:6:7:8", 96, NULL); - check_ip6_address (s_ip6, 3, "3:4:5:6:7:8:9:0", 128, NULL); - check_ip6_address (s_ip6, 4, "3:4:5:6:7:8:9:14", 64, NULL); - check_ip6_address (s_ip6, 5, "3:4:5:6:7:8:9:15", 64, NULL); - check_ip6_address (s_ip6, 6, "3:4:5:6:7:8:9:16", 66, NULL); - check_ip6_address (s_ip6, 7, "3:4:5:6:7:8:9:17", 67, NULL); - check_ip6_address (s_ip6, 8, "3:4:5:6:7:8:9:18", 68, NULL); - check_ip6_address (s_ip6, 9, "3:4:5:6:7:8:9:19", 69, "1::9"); + g_assert (nm_setting_ip_config_get_num_addresses (s_ip6) == 10); + check_ip_address (s_ip6, 0, "2:3:4:5:6:7:8:9", 64, "2:3:4:5:1:2:3:4"); + check_ip_address (s_ip6, 1, "abcd:1234:ffff::cdde", 64, NULL); + check_ip_address (s_ip6, 2, "1:2:3:4:5:6:7:8", 96, NULL); + check_ip_address (s_ip6, 3, "3:4:5:6:7:8:9:0", 128, NULL); + check_ip_address (s_ip6, 4, "3:4:5:6:7:8:9:14", 64, NULL); + check_ip_address (s_ip6, 5, "3:4:5:6:7:8:9:15", 64, NULL); + check_ip_address (s_ip6, 6, "3:4:5:6:7:8:9:16", 66, NULL); + check_ip_address (s_ip6, 7, "3:4:5:6:7:8:9:17", 67, NULL); + check_ip_address (s_ip6, 8, "3:4:5:6:7:8:9:18", 68, NULL); + check_ip_address (s_ip6, 9, "3:4:5:6:7:8:9:19", 69, "1::9"); /* Route #1 */ - g_assert (nm_setting_ip6_config_get_num_routes (s_ip6) == 7); - check_ip6_route (s_ip6, 0, "d:e:f:0:1:2:3:4", 64, "f:e:d:c:1:2:3:4", 0); - check_ip6_route (s_ip6, 1, "a:b:c:d::", 64, "f:e:d:c:1:2:3:4", 99); - check_ip6_route (s_ip6, 2, "8:7:6:5:4:3:2:1", 128, NULL, 0); - check_ip6_route (s_ip6, 3, "6:7:8:9:0:1:2:3", 126, NULL, 1); - check_ip6_route (s_ip6, 4, "7:8:9:0:1:2:3:4", 125, NULL, 5); - check_ip6_route (s_ip6, 5, "8:9:0:1:2:3:4:5", 124, NULL, 6); - check_ip6_route (s_ip6, 6, "8:9:0:1:2:3:4:6", 123, NULL, 0); + g_assert (nm_setting_ip_config_get_num_routes (s_ip6) == 7); + check_ip_route (s_ip6, 0, "d:e:f:0:1:2:3:4", 64, "f:e:d:c:1:2:3:4", 0); + check_ip_route (s_ip6, 1, "a:b:c:d::", 64, "f:e:d:c:1:2:3:4", 99); + check_ip_route (s_ip6, 2, "8:7:6:5:4:3:2:1", 128, NULL, 0); + check_ip_route (s_ip6, 3, "6:7:8:9:0:1:2:3", 126, NULL, 1); + check_ip_route (s_ip6, 4, "7:8:9:0:1:2:3:4", 125, NULL, 5); + check_ip_route (s_ip6, 5, "8:9:0:1:2:3:4:5", 124, NULL, 6); + check_ip_route (s_ip6, 6, "8:9:0:1:2:3:4:6", 123, NULL, 0); g_object_unref (connection); } static void -add_one_ip4_address (NMSettingIP4Config *s_ip4, - const char *addr, - const char *gw, - guint32 prefix) -{ - NMIPAddress *ip4_addr; - GError *error = NULL; - - ip4_addr = nm_ip_address_new (AF_INET, addr, prefix, gw, &error); - g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, ip4_addr); - nm_ip_address_unref (ip4_addr); -} - -static void -add_one_ip4_route (NMSettingIP4Config *s_ip4, - const char *dest, - const char *nh, - guint32 prefix, - guint32 metric) -{ - NMIPRoute *route; - GError *error = NULL; - - route = nm_ip_route_new (AF_INET, dest, prefix, nh, metric, &error); - g_assert_no_error (error); - nm_setting_ip4_config_add_route (s_ip4, route); - nm_ip_route_unref (route); -} - -static void -add_one_ip6_address (NMSettingIP6Config *s_ip6, - const char *addr, - guint32 prefix, - const char *gw) +add_one_ip_address (NMSettingIPConfig *s_ip, + const char *addr, + guint32 prefix, + const char *gw) { - NMIPAddress *ip6_addr; + NMIPAddress *ip_addr; GError *error = NULL; - ip6_addr = nm_ip_address_new (AF_INET6, addr, prefix, gw, &error); + ip_addr = nm_ip_address_new (NM_IS_SETTING_IP4_CONFIG (s_ip) ? AF_INET : AF_INET6, + addr, prefix, gw, &error); g_assert_no_error (error); - nm_setting_ip6_config_add_address (s_ip6, ip6_addr); - nm_ip_address_unref (ip6_addr); + nm_setting_ip_config_add_address (s_ip, ip_addr); + nm_ip_address_unref (ip_addr); } static void -add_one_ip6_route (NMSettingIP6Config *s_ip6, - const char *dest, - const char *nh, - guint32 prefix, - guint32 metric) +add_one_ip_route (NMSettingIPConfig *s_ip, + const char *dest, + const char *nh, + guint32 prefix, + guint32 metric) { NMIPRoute *route; GError *error = NULL; - route = nm_ip_route_new (AF_INET6, dest, prefix, nh, metric, &error); + route = nm_ip_route_new (NM_IS_SETTING_IP4_CONFIG (s_ip) ? AF_INET : AF_INET6, + dest, prefix, nh, metric, &error); g_assert_no_error (error); - nm_setting_ip6_config_add_route (s_ip6, route); + nm_setting_ip_config_add_route (s_ip, route); nm_ip_route_unref (route); } @@ -444,8 +391,8 @@ test_write_wired_connection (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; const char *mac = "99:88:77:66:55:44"; gboolean success; @@ -511,52 +458,52 @@ test_write_wired_connection (void) /* IP4 setting */ - s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); + s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ()); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); /* Addresses */ - add_one_ip4_address (s_ip4, address1, address1_gw, 24); - add_one_ip4_address (s_ip4, address2, address2_gw, 8); + add_one_ip_address (s_ip4, address1, 24, address1_gw); + add_one_ip_address (s_ip4, address2, 8, address2_gw); /* Routes */ - add_one_ip4_route (s_ip4, route1, route1_nh, 24, 3); - add_one_ip4_route (s_ip4, route2, route2_nh, 8, 1); - add_one_ip4_route (s_ip4, route3, route3_nh, 7, 0); - add_one_ip4_route (s_ip4, route4, route4_nh, 6, 4); + add_one_ip_route (s_ip4, route1, route1_nh, 24, 3); + add_one_ip_route (s_ip4, route2, route2_nh, 8, 1); + add_one_ip_route (s_ip4, route3, route3_nh, 7, 0); + add_one_ip_route (s_ip4, route4, route4_nh, 6, 4); /* DNS servers */ - nm_setting_ip4_config_add_dns (s_ip4, dns1); - nm_setting_ip4_config_add_dns (s_ip4, dns2); + nm_setting_ip_config_add_dns (s_ip4, dns1); + nm_setting_ip_config_add_dns (s_ip4, dns2); /* IP6 setting */ - s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ()); + s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ()); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL); /* Addresses */ - add_one_ip6_address (s_ip6, address6_1, 64, NULL); - add_one_ip6_address (s_ip6, address6_2, 56, NULL); + add_one_ip_address (s_ip6, address6_1, 64, NULL); + add_one_ip_address (s_ip6, address6_2, 56, NULL); /* Routes */ - add_one_ip6_route (s_ip6, route6_1, route6_1_nh, 64, 3); - add_one_ip6_route (s_ip6, route6_2, route6_2_nh, 56, 1); - add_one_ip6_route (s_ip6, route6_3, route6_3_nh, 63, 5); - add_one_ip6_route (s_ip6, route6_4, route6_4_nh, 62, 0); + add_one_ip_route (s_ip6, route6_1, route6_1_nh, 64, 3); + add_one_ip_route (s_ip6, route6_2, route6_2_nh, 56, 1); + add_one_ip_route (s_ip6, route6_3, route6_3_nh, 63, 5); + add_one_ip_route (s_ip6, route6_4, route6_4_nh, 62, 0); /* DNS servers */ - nm_setting_ip6_config_add_dns (s_ip6, dns6_1); - nm_setting_ip6_config_add_dns (s_ip6, dns6_2); + nm_setting_ip_config_add_dns (s_ip6, dns6_1); + nm_setting_ip_config_add_dns (s_ip6, dns6_2); /* DNS searches */ - nm_setting_ip6_config_add_dns_search (s_ip6, "wallaceandgromit.com"); + nm_setting_ip_config_add_dns_search (s_ip6, "wallaceandgromit.com"); /* Write out the connection */ owner_uid = geteuid (); @@ -592,8 +539,8 @@ test_read_ip6_wired_connection (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; GError *error = NULL; const char *tmp; const char *expected_id = "Test Wired Connection IP6"; @@ -657,18 +604,18 @@ test_read_ip6_wired_connection (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", TEST_WIRED_IP6_FILE, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 0, + ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 0, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", TEST_WIRED_IP6_FILE, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); + NM_SETTING_IP_CONFIG_DNS); /* ===== IPv6 SETTING ===== */ @@ -679,16 +626,16 @@ test_read_ip6_wired_connection (void) NM_SETTING_IP6_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip6_config_get_method (s_ip6); + tmp = nm_setting_ip_config_get_method (s_ip6); ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", TEST_WIRED_IP6_FILE, NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); /* IPv6 address */ - g_assert (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1); - check_ip6_address (s_ip6, 0, "abcd:1234:ffff::cdde", 64, "abcd:1234:ffff::cdd1"); + g_assert (nm_setting_ip_config_get_num_addresses (s_ip6) == 1); + check_ip_address (s_ip6, 0, "abcd:1234:ffff::cdde", 64, "abcd:1234:ffff::cdd1"); g_object_unref (connection); } @@ -699,8 +646,8 @@ test_write_ip6_wired_connection (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; NMConnection *reread; @@ -735,30 +682,30 @@ test_write_ip6_wired_connection (void) /* IP4 setting */ - s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); + s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ()); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, NULL); /* IP6 setting */ - s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ()); + s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ()); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL); /* Addresses */ - add_one_ip6_address (s_ip6, address, 64, gw); + add_one_ip_address (s_ip6, address, 64, gw); /* DNS servers */ - nm_setting_ip6_config_add_dns (s_ip6, dns); + nm_setting_ip_config_add_dns (s_ip6, dns); /* DNS searches */ - nm_setting_ip6_config_add_dns_search (s_ip6, "wallaceandgromit.com"); + nm_setting_ip_config_add_dns_search (s_ip6, "wallaceandgromit.com"); /* Write out the connection */ owner_uid = geteuid (); @@ -949,7 +896,7 @@ test_read_valid_wireless_connection (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWireless *s_wireless; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; GError *error = NULL; const char *bssid; const guint8 expected_bssid[ETH_ALEN] = { 0x00, 0x1a, 0x33, 0x44, 0x99, 0x82 }; @@ -1045,12 +992,12 @@ test_read_valid_wireless_connection (void) NM_SETTING_IP4_CONFIG_SETTING_NAME); /* Method */ - tmp = nm_setting_ip4_config_get_method (s_ip4); + tmp = nm_setting_ip_config_get_method (s_ip4); ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, "connection-verify-wireless", "failed to verify %s: unexpected %s / %s key value", TEST_WIRELESS_FILE, NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_METHOD); + NM_SETTING_IP_CONFIG_METHOD); g_object_unref (connection); } @@ -1061,8 +1008,8 @@ test_write_wireless_connection (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWireless *s_wireless; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; const char *bssid = "aa:b9:a1:74:55:44"; GBytes *ssid; @@ -1109,20 +1056,20 @@ test_write_wireless_connection (void) /* IP4 setting */ - s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); + s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ()); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ()); + s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ()); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); /* Write out the connection */ @@ -1199,7 +1146,7 @@ test_write_string_ssid (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWireless *s_wireless; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *uuid, *testfile = NULL, *tmp; GBytes *ssid; unsigned char tmpssid[] = { 65, 49, 50, 51, 32, 46, 92, 46, 36, 37, 126, 93 }; @@ -1236,11 +1183,11 @@ test_write_string_ssid (void) /* IP4 setting */ - s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); + s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ()); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* Write out the connection */ @@ -1322,7 +1269,7 @@ test_write_intlist_ssid (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWireless *s_wifi; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *uuid, *testfile = NULL; GBytes *ssid; unsigned char tmpssid[] = { 65, 49, 50, 51, 0, 50, 50 }; @@ -1362,10 +1309,10 @@ test_write_intlist_ssid (void) g_bytes_unref (ssid); /* IP4 setting */ - s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); + s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ()); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* Write out the connection */ owner_uid = geteuid (); @@ -1483,7 +1430,7 @@ test_write_intlike_ssid (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWireless *s_wifi; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *uuid, *testfile = NULL; GBytes *ssid; unsigned char tmpssid[] = { 49, 48, 49 }; @@ -1522,10 +1469,10 @@ test_write_intlike_ssid (void) g_bytes_unref (ssid); /* IP4 setting */ - s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); + s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ()); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* Write out the connection */ owner_uid = geteuid (); @@ -1569,7 +1516,7 @@ test_write_intlike_ssid_2 (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWireless *s_wifi; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; char *uuid, *testfile = NULL; GBytes *ssid; unsigned char tmpssid[] = { 49, 49, 59, 49, 50, 59, 49, 51, 59}; @@ -1608,10 +1555,10 @@ test_write_intlike_ssid_2 (void) g_bytes_unref (ssid); /* IP4 setting */ - s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); + s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ()); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* Write out the connection */ owner_uid = geteuid (); @@ -1816,7 +1763,7 @@ test_write_bt_dun_connection (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingBluetooth *s_bt; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSettingGsm *s_gsm; char *uuid; const char *bdaddr = "aa:b9:a1:74:55:44"; @@ -1857,11 +1804,11 @@ test_write_bt_dun_connection (void) /* IP4 setting */ - s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); + s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ()); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* GSM setting */ @@ -2065,7 +2012,7 @@ test_write_gsm_connection (void) { NMConnection *connection; NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSettingGsm *s_gsm; char *uuid; gboolean success; @@ -2095,11 +2042,11 @@ test_write_gsm_connection (void) /* IP4 setting */ - s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); + s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ()); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* GSM setting */ @@ -2401,7 +2348,7 @@ create_wired_tls_connection (NMSetting8021xCKScheme scheme) { NMConnection *connection; NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSetting *s_wired; NMSetting8021x *s_8021x; char *uuid; @@ -2425,9 +2372,9 @@ create_wired_tls_connection (NMSetting8021xCKScheme scheme) g_free (uuid); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); /* Wired setting */ @@ -2704,8 +2651,8 @@ test_write_infiniband_connection (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingInfiniband *s_ib; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; const char *mac = "99:88:77:66:55:44:ab:bc:cd:de:ef:f0:0a:1b:2c:3d:4e:5f:6f:ba"; gboolean success; @@ -2745,16 +2692,16 @@ test_write_infiniband_connection (void) NULL); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_assert (s_ip6); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); - g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip6, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); /* Write out the connection */ owner_uid = geteuid (); @@ -2785,7 +2732,7 @@ test_read_bridge_main (void) { NMConnection *connection; NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSettingBridge *s_bridge; GError *error = NULL; const char *expected_id = "Test Bridge Main"; @@ -2809,7 +2756,7 @@ test_read_bridge_main (void) /* IPv4 setting */ s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); - g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO); + g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO); /* Bridge setting */ s_bridge = nm_connection_get_setting_bridge (connection); @@ -2830,8 +2777,8 @@ test_write_bridge_main (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingBridge *s_bridge; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; NMConnection *reread; @@ -2864,21 +2811,21 @@ test_write_bridge_main (void) nm_connection_add_setting (connection, NM_SETTING (s_bridge)); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); g_assert (s_ip4); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, - NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); - add_one_ip4_address (s_ip4, "1.2.3.4", "1.1.1.1", 24); + add_one_ip_address (s_ip4, "1.2.3.4", 24, "1.1.1.1"); /* IP6 setting */ - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); g_assert (s_ip6); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); - g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip6, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); /* Write out the connection */ owner_uid = geteuid (); @@ -3401,7 +3348,7 @@ static void test_read_enum_property (void) { NMConnection *connection; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; GError *error = NULL; gboolean success; @@ -3415,7 +3362,7 @@ test_read_enum_property (void) /* IPv6 setting */ s_ip6 = nm_connection_get_setting_ip6_config (connection); g_assert (s_ip6); - g_assert_cmpint (nm_setting_ip6_config_get_ip6_privacy (s_ip6), ==, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR); + g_assert_cmpint (nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6)), ==, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR); g_object_unref (connection); } @@ -3426,7 +3373,7 @@ test_write_enum_property (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; char *uuid; gboolean success; NMConnection *reread; @@ -3455,10 +3402,10 @@ test_write_enum_property (void) nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP6 setting */ - s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ()); + s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ()); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NM_SETTING_IP6_CONFIG_IP6_PRIVACY, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR, NULL); diff --git a/src/settings/plugins/keyfile/writer.c b/src/settings/plugins/keyfile/writer.c index 766eabf44f..fdf4823a51 100644 --- a/src/settings/plugins/keyfile/writer.c +++ b/src/settings/plugins/keyfile/writer.c @@ -578,25 +578,25 @@ static KeyWriter key_writers[] = { NM_SETTING_CONNECTION_TYPE, setting_alias_writer }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES, + NM_SETTING_IP_CONFIG_ADDRESSES, addr_writer }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, "address-labels", ip4_addr_label_writer }, { NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES, + NM_SETTING_IP_CONFIG_ADDRESSES, addr_writer }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ROUTES, + NM_SETTING_IP_CONFIG_ROUTES, route_writer }, { NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES, + NM_SETTING_IP_CONFIG_ROUTES, route_writer }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS, + NM_SETTING_IP_CONFIG_DNS, dns_writer }, { NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS, + NM_SETTING_IP_CONFIG_DNS, dns_writer }, { NM_SETTING_WIRELESS_SETTING_NAME, NM_SETTING_WIRELESS_SSID, diff --git a/src/supplicant-manager/tests/test-supplicant-config.c b/src/supplicant-manager/tests/test-supplicant-config.c index 2d16eecfd6..4f1950128f 100644 --- a/src/supplicant-manager/tests/test-supplicant-config.c +++ b/src/supplicant-manager/tests/test-supplicant-config.c @@ -108,7 +108,7 @@ test_wifi_open (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWireless *s_wifi; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSupplicantConfig *config; GHashTable *hash; char *uuid; @@ -149,10 +149,10 @@ test_wifi_open (void) g_bytes_unref (ssid); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, "wifi-open", "failed to verify connection: %s", @@ -203,7 +203,7 @@ test_wifi_wep_key (const char *detail, NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSupplicantConfig *config; GHashTable *hash; char *uuid; @@ -254,10 +254,10 @@ test_wifi_wep_key (const char *detail, nm_setting_wireless_security_set_wep_key (s_wsec, 0, key_data); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, detail, "failed to verify connection: %s", @@ -340,7 +340,7 @@ test_wifi_wpa_psk (const char *detail, NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; NMSupplicantConfig *config; GHashTable *hash; char *uuid; @@ -397,10 +397,10 @@ test_wifi_wpa_psk (const char *detail, nm_setting_wireless_security_add_group (s_wsec, "ccmp"); /* IP4 setting */ - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); - g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); + g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); ASSERT (nm_connection_verify (connection, &error) == TRUE, detail, "failed to verify connection: %s", diff --git a/src/tests/test-general.c b/src/tests/test-general.c index e16d702ddb..2f073c9cac 100644 --- a/src/tests/test-general.c +++ b/src/tests/test-general.c @@ -288,8 +288,7 @@ _match_connection_new (void) NMConnection *connection; NMSettingConnection *s_con; NMSettingWired *s_wired; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4, *s_ip6; char *uuid; connection = nm_simple_connection_new (); @@ -308,16 +307,16 @@ _match_connection_new (void) s_wired = (NMSettingWired *) nm_setting_wired_new (); nm_connection_add_setting (connection, (NMSetting *) s_wired); - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); nm_connection_add_setting (connection, (NMSetting *) s_ip4); g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); - s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); nm_connection_add_setting (connection, (NMSetting *) s_ip6); g_object_set (G_OBJECT (s_ip6), - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); return connection; @@ -328,7 +327,7 @@ test_connection_match_basic (void) { NMConnection *orig, *copy, *matched; GSList *connections = NULL; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; orig = _match_connection_new (); copy = nm_simple_connection_new_clone (orig); @@ -341,7 +340,7 @@ test_connection_match_basic (void) s_ip4 = nm_connection_get_setting_ip4_config (orig); g_assert (s_ip4); g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL, NULL); matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL); g_assert (matched == NULL); @@ -356,7 +355,7 @@ test_connection_match_ip6_method (void) { NMConnection *orig, *copy, *matched; GSList *connections = NULL; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; orig = _match_connection_new (); copy = nm_simple_connection_new_clone (orig); @@ -369,14 +368,14 @@ test_connection_match_ip6_method (void) s_ip6 = nm_connection_get_setting_ip6_config (orig); g_assert (s_ip6); g_object_set (G_OBJECT (s_ip6), - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL, NULL); s_ip6 = nm_connection_get_setting_ip6_config (copy); g_assert (s_ip6); g_object_set (G_OBJECT (s_ip6), - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, - NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL); @@ -392,7 +391,7 @@ test_connection_match_ip6_method_ignore (void) { NMConnection *orig, *copy, *matched; GSList *connections = NULL; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; orig = _match_connection_new (); copy = nm_simple_connection_new_clone (orig); @@ -404,13 +403,13 @@ test_connection_match_ip6_method_ignore (void) s_ip6 = nm_connection_get_setting_ip6_config (orig); g_assert (s_ip6); g_object_set (G_OBJECT (s_ip6), - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL, NULL); s_ip6 = nm_connection_get_setting_ip6_config (copy); g_assert (s_ip6); g_object_set (G_OBJECT (s_ip6), - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL); matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL); @@ -426,7 +425,7 @@ test_connection_match_ip6_method_ignore_auto (void) { NMConnection *orig, *copy, *matched; GSList *connections = NULL; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip6; orig = _match_connection_new (); copy = nm_simple_connection_new_clone (orig); @@ -438,13 +437,13 @@ test_connection_match_ip6_method_ignore_auto (void) s_ip6 = nm_connection_get_setting_ip6_config (orig); g_assert (s_ip6); g_object_set (G_OBJECT (s_ip6), - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); s_ip6 = nm_connection_get_setting_ip6_config (copy); g_assert (s_ip6); g_object_set (G_OBJECT (s_ip6), - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL); matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL); @@ -461,7 +460,7 @@ test_connection_match_ip4_method (void) { NMConnection *orig, *copy, *matched; GSList *connections = NULL; - NMSettingIP4Config *s_ip4; + NMSettingIPConfig *s_ip4; orig = _match_connection_new (); copy = nm_simple_connection_new_clone (orig); @@ -474,14 +473,14 @@ test_connection_match_ip4_method (void) s_ip4 = nm_connection_get_setting_ip4_config (orig); g_assert (s_ip4); g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, NULL); s_ip4 = nm_connection_get_setting_ip4_config (copy); g_assert (s_ip4); g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, - NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); matched = nm_utils_match_connection (connections, orig, FALSE, NULL, NULL); @@ -574,8 +573,7 @@ test_connection_no_match_ip4_addr (void) { NMConnection *orig, *copy, *matched; GSList *connections = NULL; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; + NMSettingIPConfig *s_ip4, *s_ip6; NMIPAddress *nm_addr; GError *error = NULL; @@ -589,34 +587,34 @@ test_connection_no_match_ip4_addr (void) s_ip6 = nm_connection_get_setting_ip6_config (orig); g_assert (s_ip6); g_object_set (G_OBJECT (s_ip6), - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL, NULL); s_ip6 = nm_connection_get_setting_ip6_config (copy); g_assert (s_ip6); g_object_set (G_OBJECT (s_ip6), - NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL); s_ip4 = nm_connection_get_setting_ip4_config (orig); g_assert (s_ip4); g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); nm_addr = nm_ip_address_new (AF_INET, "1.1.1.4", 24, "1.1.1.254", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, nm_addr); + nm_setting_ip_config_add_address (s_ip4, nm_addr); nm_ip_address_unref (nm_addr); s_ip4 = nm_connection_get_setting_ip4_config (copy); g_assert (s_ip4); g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); nm_addr = nm_ip_address_new (AF_INET, "2.2.2.4", 24, "2.2.2.254", &error); g_assert_no_error (error); - nm_setting_ip4_config_add_address (s_ip4, nm_addr); + nm_setting_ip_config_add_address (s_ip4, nm_addr); nm_ip_address_unref (nm_addr); matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL); diff --git a/src/tests/test-resolvconf-capture.c b/src/tests/test-resolvconf-capture.c index 2d787b7188..555f10c016 100644 --- a/src/tests/test-resolvconf-capture.c +++ b/src/tests/test-resolvconf-capture.c @@ -20,6 +20,7 @@ #include <glib.h> #include <string.h> +#include <arpa/inet.h> #include "NetworkManagerUtils.h" #include "nm-ip4-config.h" |