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.
This commit is contained in:
Dan Winship 2014-10-19 17:30:10 -04:00
parent 39709fdc2e
commit 3f30c6f1c2
53 changed files with 2992 additions and 3911 deletions

View file

@ -2889,7 +2889,7 @@ check_and_convert_vlan_prio_maps (const char *prio_map,
static gboolean static gboolean
add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection) add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection)
{ {
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
gboolean ret; gboolean ret;
if (!ip4addr) if (!ip4addr)
@ -2897,13 +2897,13 @@ add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection)
s_ip4 = nm_connection_get_setting_ip4_config (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (!s_ip4) { 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (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); 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); nm_ip_address_unref (ip4addr);
return ret; return ret;
@ -2912,7 +2912,7 @@ add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection)
static gboolean static gboolean
add_ip6_address_to_connection (NMIPAddress *ip6addr, NMConnection *connection) add_ip6_address_to_connection (NMIPAddress *ip6addr, NMConnection *connection)
{ {
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
gboolean ret; gboolean ret;
if (!ip6addr) if (!ip6addr)
@ -2920,13 +2920,13 @@ add_ip6_address_to_connection (NMIPAddress *ip6addr, NMConnection *connection)
s_ip6 = nm_connection_get_setting_ip6_config (connection); s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (!s_ip6) { 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (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); 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); nm_ip_address_unref (ip6addr);
return ret; return ret;
@ -8107,8 +8107,7 @@ editor_init_new_connection (NmCli *nmc, NMConnection *connection)
static void static void
editor_init_existing_connection (NMConnection *connection) editor_init_existing_connection (NMConnection *connection)
{ {
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4, *s_ip6;
NMSettingIP6Config *s_ip6;
NMSettingWireless *s_wireless; NMSettingWireless *s_wireless;
NMSettingConnection *s_con; NMSettingConnection *s_con;

View file

@ -20,6 +20,7 @@
#include "config.h" #include "config.h"
#include <stdlib.h> #include <stdlib.h>
#include <arpa/inet.h>
#include <glib.h> #include <glib.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
@ -251,64 +252,64 @@ NmcOutputField nmc_fields_setting_wireless_security[] = {
/* Available fields for NM_SETTING_IP4_CONFIG_SETTING_NAME */ /* Available fields for NM_SETTING_IP4_CONFIG_SETTING_NAME */
NmcOutputField nmc_fields_setting_ip4_config[] = { NmcOutputField nmc_fields_setting_ip4_config[] = {
SETTING_FIELD ("name", 8), /* 0 */ SETTING_FIELD ("name", 8), /* 0 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_METHOD, 10), /* 1 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_METHOD, 10), /* 1 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_DNS, 20), /* 2 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS, 20), /* 2 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_DNS_SEARCH, 15), /* 3 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_SEARCH, 15), /* 3 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_ADDRESSES, 20), /* 4 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_ADDRESSES, 20), /* 4 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_ROUTES, 20), /* 5 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTES, 20), /* 5 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */ 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_IP4_CONFIG_DHCP_CLIENT_ID, 15), /* 8 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, 19), /* 9 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, 19), /* 9 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, 14), /* 10 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, 14), /* 10 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, 15), /* 11 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, 15), /* 11 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_MAY_FAIL, 12), /* 12 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL, 12), /* 12 */
{NULL, NULL, 0, NULL, FALSE, FALSE, 0} {NULL, NULL, 0, NULL, FALSE, FALSE, 0}
}; };
#define NMC_FIELDS_SETTING_IP4_CONFIG_ALL "name"","\ #define NMC_FIELDS_SETTING_IP4_CONFIG_ALL "name"","\
NM_SETTING_IP4_CONFIG_METHOD","\ NM_SETTING_IP_CONFIG_METHOD","\
NM_SETTING_IP4_CONFIG_DNS","\ NM_SETTING_IP_CONFIG_DNS","\
NM_SETTING_IP4_CONFIG_DNS_SEARCH","\ NM_SETTING_IP_CONFIG_DNS_SEARCH","\
NM_SETTING_IP4_CONFIG_ADDRESSES","\ NM_SETTING_IP_CONFIG_ADDRESSES","\
NM_SETTING_IP4_CONFIG_ROUTES","\ NM_SETTING_IP_CONFIG_ROUTES","\
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES","\ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES","\
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS","\ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS","\
NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID","\ NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID","\
NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME","\ NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME","\
NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME","\ NM_SETTING_IP_CONFIG_DHCP_HOSTNAME","\
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT","\ NM_SETTING_IP_CONFIG_NEVER_DEFAULT","\
NM_SETTING_IP4_CONFIG_MAY_FAIL NM_SETTING_IP_CONFIG_MAY_FAIL
#define NMC_FIELDS_SETTING_IP4_CONFIG_COMMON NMC_FIELDS_SETTING_IP4_CONFIG_ALL #define NMC_FIELDS_SETTING_IP4_CONFIG_COMMON NMC_FIELDS_SETTING_IP4_CONFIG_ALL
/* Available fields for NM_SETTING_IP6_CONFIG_SETTING_NAME */ /* Available fields for NM_SETTING_IP6_CONFIG_SETTING_NAME */
NmcOutputField nmc_fields_setting_ip6_config[] = { NmcOutputField nmc_fields_setting_ip6_config[] = {
SETTING_FIELD ("name", 8), /* 0 */ SETTING_FIELD ("name", 8), /* 0 */
SETTING_FIELD (NM_SETTING_IP6_CONFIG_METHOD, 10), /* 1 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_METHOD, 10), /* 1 */
SETTING_FIELD (NM_SETTING_IP6_CONFIG_DNS, 20), /* 2 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS, 20), /* 2 */
SETTING_FIELD (NM_SETTING_IP6_CONFIG_DNS_SEARCH, 15), /* 3 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_SEARCH, 15), /* 3 */
SETTING_FIELD (NM_SETTING_IP6_CONFIG_ADDRESSES, 20), /* 4 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_ADDRESSES, 20), /* 4 */
SETTING_FIELD (NM_SETTING_IP6_CONFIG_ROUTES, 20), /* 5 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTES, 20), /* 5 */
SETTING_FIELD (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */
SETTING_FIELD (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */
SETTING_FIELD (NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, 15), /* 8 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, 15), /* 8 */
SETTING_FIELD (NM_SETTING_IP6_CONFIG_MAY_FAIL, 12), /* 9 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL, 12), /* 9 */
SETTING_FIELD (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, 15), /* 10 */ SETTING_FIELD (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, 15), /* 10 */
SETTING_FIELD (NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, 14), /* 11 */ SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, 14), /* 11 */
{NULL, NULL, 0, NULL, FALSE, FALSE, 0} {NULL, NULL, 0, NULL, FALSE, FALSE, 0}
}; };
#define NMC_FIELDS_SETTING_IP6_CONFIG_ALL "name"","\ #define NMC_FIELDS_SETTING_IP6_CONFIG_ALL "name"","\
NM_SETTING_IP6_CONFIG_METHOD","\ NM_SETTING_IP_CONFIG_METHOD","\
NM_SETTING_IP6_CONFIG_DNS","\ NM_SETTING_IP_CONFIG_DNS","\
NM_SETTING_IP6_CONFIG_DNS_SEARCH","\ NM_SETTING_IP_CONFIG_DNS_SEARCH","\
NM_SETTING_IP6_CONFIG_ADDRESSES","\ NM_SETTING_IP_CONFIG_ADDRESSES","\
NM_SETTING_IP6_CONFIG_ROUTES","\ NM_SETTING_IP_CONFIG_ROUTES","\
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES","\ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES","\
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS","\ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS","\
NM_SETTING_IP6_CONFIG_NEVER_DEFAULT","\ NM_SETTING_IP_CONFIG_NEVER_DEFAULT","\
NM_SETTING_IP6_CONFIG_MAY_FAIL","\ NM_SETTING_IP_CONFIG_MAY_FAIL","\
NM_SETTING_IP6_CONFIG_IP6_PRIVACY","\ 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 #define NMC_FIELDS_SETTING_IP6_CONFIG_COMMON NMC_FIELDS_SETTING_IP4_CONFIG_ALL
/* Available fields for NM_SETTING_SERIAL_SETTING_NAME */ /* 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) DEFINE_GETTER (nmc_property_ib_get_parent, NM_SETTING_INFINIBAND_PARENT)
/* --- NM_SETTING_IP4_CONFIG_SETTING_NAME property get functions --- */ /* --- 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_method, NM_SETTING_IP_CONFIG_METHOD)
DEFINE_GETTER (nmc_property_ipv4_get_dns, NM_SETTING_IP4_CONFIG_DNS) DEFINE_GETTER (nmc_property_ipv4_get_dns, NM_SETTING_IP_CONFIG_DNS)
DEFINE_GETTER (nmc_property_ipv4_get_dns_search, NM_SETTING_IP4_CONFIG_DNS_SEARCH) DEFINE_GETTER (nmc_property_ipv4_get_dns_search, NM_SETTING_IP_CONFIG_DNS_SEARCH)
static char * static char *
nmc_property_ipv4_get_addresses (NMSetting *setting) 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; GString *printable;
guint32 num_addresses, i; guint32 num_addresses, i;
NMIPAddress *addr; NMIPAddress *addr;
printable = g_string_new (NULL); 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++) { 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) if (printable->len > 0)
g_string_append (printable, "; "); g_string_append (printable, "; ");
@ -1240,16 +1241,16 @@ nmc_property_ipv4_get_addresses (NMSetting *setting)
static char * static char *
nmc_property_ipv4_get_routes (NMSetting *setting) 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; GString *printable;
guint32 num_routes, i; guint32 num_routes, i;
NMIPRoute *route; NMIPRoute *route;
printable = g_string_new (NULL); 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++) { 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) if (printable->len > 0)
g_string_append (printable, "; "); g_string_append (printable, "; ");
@ -1274,32 +1275,32 @@ nmc_property_ipv4_get_routes (NMSetting *setting)
return g_string_free (printable, FALSE); 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_routes, NM_SETTING_IP_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_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_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_send_hostname, NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME)
DEFINE_GETTER (nmc_property_ipv4_get_dhcp_hostname, NM_SETTING_IP4_CONFIG_DHCP_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_IP4_CONFIG_NEVER_DEFAULT) DEFINE_GETTER (nmc_property_ipv4_get_never_default, NM_SETTING_IP_CONFIG_NEVER_DEFAULT)
DEFINE_GETTER (nmc_property_ipv4_get_may_fail, NM_SETTING_IP4_CONFIG_MAY_FAIL) DEFINE_GETTER (nmc_property_ipv4_get_may_fail, NM_SETTING_IP_CONFIG_MAY_FAIL)
/* --- NM_SETTING_IP6_CONFIG_SETTING_NAME property get functions --- */ /* --- 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_method, NM_SETTING_IP_CONFIG_METHOD)
DEFINE_GETTER (nmc_property_ipv6_get_dns, NM_SETTING_IP6_CONFIG_DNS) DEFINE_GETTER (nmc_property_ipv6_get_dns, NM_SETTING_IP_CONFIG_DNS)
DEFINE_GETTER (nmc_property_ipv6_get_dns_search, NM_SETTING_IP6_CONFIG_DNS_SEARCH) DEFINE_GETTER (nmc_property_ipv6_get_dns_search, NM_SETTING_IP_CONFIG_DNS_SEARCH)
static char * static char *
nmc_property_ipv6_get_addresses (NMSetting *setting) 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; GString *printable;
guint32 num_addresses, i; guint32 num_addresses, i;
NMIPAddress *addr; NMIPAddress *addr;
printable = g_string_new (NULL); 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++) { 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) if (printable->len > 0)
g_string_append (printable, "; "); g_string_append (printable, "; ");
@ -1324,16 +1325,16 @@ nmc_property_ipv6_get_addresses (NMSetting *setting)
static char * static char *
nmc_property_ipv6_get_routes (NMSetting *setting) 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; GString *printable;
guint32 num_routes, i; guint32 num_routes, i;
NMIPRoute *route; NMIPRoute *route;
printable = g_string_new (NULL); 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++) { 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) if (printable->len > 0)
g_string_append (printable, "; "); g_string_append (printable, "; ");
@ -1358,11 +1359,11 @@ nmc_property_ipv6_get_routes (NMSetting *setting)
return g_string_free (printable, FALSE); 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_routes, NM_SETTING_IP_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_ignore_auto_dns, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS)
DEFINE_GETTER (nmc_property_ipv6_get_never_default, NM_SETTING_IP6_CONFIG_NEVER_DEFAULT) DEFINE_GETTER (nmc_property_ipv6_get_never_default, NM_SETTING_IP_CONFIG_NEVER_DEFAULT)
DEFINE_GETTER (nmc_property_ipv6_get_may_fail, NM_SETTING_IP6_CONFIG_MAY_FAIL) DEFINE_GETTER (nmc_property_ipv6_get_may_fail, NM_SETTING_IP_CONFIG_MAY_FAIL)
DEFINE_GETTER (nmc_property_ipv6_get_dhcp_hostname, NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME) DEFINE_GETTER (nmc_property_ipv6_get_dhcp_hostname, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME)
static char * static char *
nmc_property_ipv6_get_ip6_privacy (NMSetting *setting) 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'. /* If we have some IP addresses set method to 'manual'.
* Else if the method was 'manual', change it back to 'auto'. * 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 (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) {
if (g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
if (!answered) { if (!answered) {
answered = TRUE; answered = TRUE;
answer = get_answer ("ipv4.method", "manual"); answer = get_answer ("ipv4.method", "manual");
} }
if (answer) 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 { } else {
answered = FALSE; answered = FALSE;
if (!g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) 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_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); 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); 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); 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 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 (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
if (nm_setting_ip4_config_get_num_addresses (NM_SETTING_IP4_CONFIG (object))) { if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) {
if (!answered) { if (!answered) {
answered = TRUE; answered = TRUE;
answer = get_answer ("ipv4.addresses", NULL); answer = get_answer ("ipv4.addresses", NULL);
@ -1733,14 +1734,14 @@ ipv4_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
if (answer) { if (answer) {
if (G_IS_VALUE (&value)) if (G_IS_VALUE (&value))
g_value_unset (&value); g_value_unset (&value);
nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP4_CONFIG_ADDRESSES, &value); nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value);
g_object_set (object, NM_SETTING_IP4_CONFIG_ADDRESSES, NULL, NULL); g_object_set (object, NM_SETTING_IP_CONFIG_ADDRESSES, NULL, NULL);
} }
} }
} else { } else {
answered = FALSE; answered = FALSE;
if (G_IS_VALUE (&value)) { 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); 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'. /* If we have some IP addresses set method to 'manual'.
* Else if the method was 'manual', change it back to 'auto'. * 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 (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) {
if (g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
if (!answered) { if (!answered) {
answered = TRUE; answered = TRUE;
answer = get_answer ("ipv6.method", "manual"); answer = get_answer ("ipv6.method", "manual");
} }
if (answer) 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 { } else {
answered = FALSE; answered = FALSE;
if (!g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) 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_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); 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); 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); 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 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 (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
if (nm_setting_ip6_config_get_num_addresses (NM_SETTING_IP6_CONFIG (object))) { if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) {
if (!answered) { if (!answered) {
answered = TRUE; answered = TRUE;
answer = get_answer ("ipv6.addresses", NULL); answer = get_answer ("ipv6.addresses", NULL);
@ -1796,14 +1797,14 @@ ipv6_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
if (answer) { if (answer) {
if (G_IS_VALUE (&value)) if (G_IS_VALUE (&value))
g_value_unset (&value); g_value_unset (&value);
nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP6_CONFIG_ADDRESSES, &value); nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value);
g_object_set (object, NM_SETTING_IP6_CONFIG_ADDRESSES, NULL, NULL); g_object_set (object, NM_SETTING_IP_CONFIG_ADDRESSES, NULL, NULL);
} }
} }
} else { } else {
answered = FALSE; answered = FALSE;
if (G_IS_VALUE (&value)) { 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); g_value_unset (&value);
} }
} }
@ -1867,24 +1868,24 @@ connection_master_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_
} }
void 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_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_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); G_CALLBACK (ipv4_method_changed_cb), NULL);
} }
void 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_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_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); 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)); g_return_if_fail (NM_IS_SETTING (setting));
if (NM_IS_SETTING_IP4_CONFIG (setting)) { if (NM_IS_SETTING_IP4_CONFIG (setting)) {
g_object_set (NM_SETTING_IP4_CONFIG (setting), g_object_set (NM_SETTING_IP_CONFIG (setting),
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL); 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)) { } else if (NM_IS_SETTING_IP6_CONFIG (setting)) {
g_object_set (NM_SETTING_IP6_CONFIG (setting), g_object_set (NM_SETTING_IP_CONFIG (setting),
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
NULL); 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)) { } else if (NM_IS_SETTING_WIRELESS (setting)) {
g_object_set (NM_SETTING_WIRELESS (setting), g_object_set (NM_SETTING_WIRELESS (setting),
NM_SETTING_WIRELESS_MODE, NM_SETTING_WIRELESS_MODE_INFRA, 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); g_strfreev (strv);
return FALSE; 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); g_strfreev (strv);
return TRUE; return TRUE;
} }
static gboolean static gboolean
_validate_and_remove_ipv4_dns (NMSettingIP4Config *setting, _validate_and_remove_ipv4_dns (NMSettingIPConfig *setting,
const char *dns, const char *dns,
GError **error) GError **error)
{ {
@ -3170,15 +3171,15 @@ _validate_and_remove_ipv4_dns (NMSettingIP4Config *setting,
return FALSE; 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) if (!ret)
g_set_error (error, 1, 0, _("the property doesn't contain DNS server '%s'"), dns); g_set_error (error, 1, 0, _("the property doesn't contain DNS server '%s'"), dns);
return ret; return ret;
} }
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_dns, DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_dns,
NM_SETTING_IP4_CONFIG, NM_SETTING_IP_CONFIG,
nm_setting_ip4_config_get_num_dns, nm_setting_ip_config_get_num_dns,
nm_setting_ip4_config_remove_dns, nm_setting_ip_config_remove_dns,
_validate_and_remove_ipv4_dns) _validate_and_remove_ipv4_dns)
static const char * static const char *
@ -3204,20 +3205,20 @@ nmc_property_ipv4_set_dns_search (NMSetting *setting, const char *prop, const ch
} }
while (strv && strv[i]) 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); g_strfreev (strv);
return TRUE; return TRUE;
} }
static gboolean static gboolean
_validate_and_remove_ipv4_dns_search (NMSettingIP4Config *setting, _validate_and_remove_ipv4_dns_search (NMSettingIPConfig *setting,
const char *dns_search, const char *dns_search,
GError **error) GError **error)
{ {
gboolean ret; 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) if (!ret)
g_set_error (error, 1, 0, g_set_error (error, 1, 0,
_("the property doesn't contain DNS search domain '%s'"), _("the property doesn't contain DNS search domain '%s'"),
@ -3225,9 +3226,9 @@ _validate_and_remove_ipv4_dns_search (NMSettingIP4Config *setting,
return ret; return ret;
} }
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_dns_search, DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_dns_search,
NM_SETTING_IP4_CONFIG, NM_SETTING_IP_CONFIG,
nm_setting_ip4_config_get_num_dns_searches, nm_setting_ip_config_get_num_dns_searches,
nm_setting_ip4_config_remove_dns_search, nm_setting_ip_config_remove_dns_search,
_validate_and_remove_ipv4_dns_search) _validate_and_remove_ipv4_dns_search)
/* 'addresses' */ /* 'addresses' */
@ -3252,7 +3253,7 @@ nmc_property_ipv4_set_addresses (NMSetting *setting, const char *prop, const cha
g_strfreev (strv); g_strfreev (strv);
return FALSE; 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); nm_ip_address_unref (ip4addr);
} }
g_strfreev (strv); g_strfreev (strv);
@ -3260,7 +3261,7 @@ nmc_property_ipv4_set_addresses (NMSetting *setting, const char *prop, const cha
} }
static gboolean static gboolean
_validate_and_remove_ipv4_address (NMSettingIP4Config *setting, _validate_and_remove_ipv4_address (NMSettingIPConfig *setting,
const char *address, const char *address,
GError **error) GError **error)
{ {
@ -3271,7 +3272,7 @@ _validate_and_remove_ipv4_address (NMSettingIP4Config *setting,
if (!ip4addr) if (!ip4addr)
return FALSE; 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) if (!ret)
g_set_error (error, 1, 0, g_set_error (error, 1, 0,
_("the property doesn't contain IP address '%s'"), address); _("the property doesn't contain IP address '%s'"), address);
@ -3279,9 +3280,9 @@ _validate_and_remove_ipv4_address (NMSettingIP4Config *setting,
return ret; return ret;
} }
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_addresses, DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_addresses,
NM_SETTING_IP4_CONFIG, NM_SETTING_IP_CONFIG,
nm_setting_ip4_config_get_num_addresses, nm_setting_ip_config_get_num_addresses,
nm_setting_ip4_config_remove_address, nm_setting_ip_config_remove_address,
_validate_and_remove_ipv4_address) _validate_and_remove_ipv4_address)
static const char * static const char *
@ -3350,7 +3351,7 @@ nmc_property_ipv4_set_routes (NMSetting *setting, const char *prop, const char *
g_strfreev (strv); g_strfreev (strv);
return FALSE; 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); nm_ip_route_unref (ip4route);
} }
g_strfreev (strv); g_strfreev (strv);
@ -3358,7 +3359,7 @@ nmc_property_ipv4_set_routes (NMSetting *setting, const char *prop, const char *
} }
static gboolean static gboolean
_validate_and_remove_ipv4_route (NMSettingIP4Config *setting, _validate_and_remove_ipv4_route (NMSettingIPConfig *setting,
const char *route, const char *route,
GError **error) GError **error)
{ {
@ -3369,16 +3370,16 @@ _validate_and_remove_ipv4_route (NMSettingIP4Config *setting,
if (!ip4route) if (!ip4route)
return FALSE; 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) if (!ret)
g_set_error (error, 1, 0, _("the property doesn't contain route '%s'"), route); g_set_error (error, 1, 0, _("the property doesn't contain route '%s'"), route);
nm_ip_route_unref (ip4route); nm_ip_route_unref (ip4route);
return ret; return ret;
} }
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_routes, DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_routes,
NM_SETTING_IP4_CONFIG, NM_SETTING_IP_CONFIG,
nm_setting_ip4_config_get_num_routes, nm_setting_ip_config_get_num_routes,
nm_setting_ip4_config_remove_route, nm_setting_ip_config_remove_route,
_validate_and_remove_ipv4_route) _validate_and_remove_ipv4_route)
static const char * static const char *
@ -3465,14 +3466,14 @@ nmc_property_ipv6_set_dns (NMSetting *setting, const char *prop, const char *val
g_strfreev (strv); g_strfreev (strv);
return FALSE; 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); g_strfreev (strv);
return TRUE; return TRUE;
} }
static gboolean static gboolean
_validate_and_remove_ipv6_dns (NMSettingIP6Config *setting, _validate_and_remove_ipv6_dns (NMSettingIPConfig *setting,
const char *dns, const char *dns,
GError **error) GError **error)
{ {
@ -3484,15 +3485,15 @@ _validate_and_remove_ipv6_dns (NMSettingIP6Config *setting,
return FALSE; 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) if (!ret)
g_set_error (error, 1, 0, _("the property doesn't contain DNS server '%s'"), dns); g_set_error (error, 1, 0, _("the property doesn't contain DNS server '%s'"), dns);
return ret; return ret;
} }
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_dns, DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_dns,
NM_SETTING_IP6_CONFIG, NM_SETTING_IP_CONFIG,
nm_setting_ip6_config_get_num_dns, nm_setting_ip_config_get_num_dns,
nm_setting_ip6_config_remove_dns, nm_setting_ip_config_remove_dns,
_validate_and_remove_ipv6_dns) _validate_and_remove_ipv6_dns)
static const char * static const char *
@ -3524,20 +3525,20 @@ nmc_property_ipv6_set_dns_search (NMSetting *setting, const char *prop, const ch
} }
while (strv && strv[i]) 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); g_strfreev (strv);
return TRUE; return TRUE;
} }
static gboolean static gboolean
_validate_and_remove_ipv6_dns_search (NMSettingIP6Config *setting, _validate_and_remove_ipv6_dns_search (NMSettingIPConfig *setting,
const char *dns_search, const char *dns_search,
GError **error) GError **error)
{ {
gboolean ret; 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) if (!ret)
g_set_error (error, 1, 0, g_set_error (error, 1, 0,
_("the property doesn't contain DNS search domain '%s'"), _("the property doesn't contain DNS search domain '%s'"),
@ -3545,9 +3546,9 @@ _validate_and_remove_ipv6_dns_search (NMSettingIP6Config *setting,
return ret; return ret;
} }
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_dns_search, DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_dns_search,
NM_SETTING_IP6_CONFIG, NM_SETTING_IP_CONFIG,
nm_setting_ip6_config_get_num_dns_searches, nm_setting_ip_config_get_num_dns_searches,
nm_setting_ip6_config_remove_dns_search, nm_setting_ip_config_remove_dns_search,
_validate_and_remove_ipv6_dns_search) _validate_and_remove_ipv6_dns_search)
/* 'addresses' */ /* 'addresses' */
@ -3572,7 +3573,7 @@ nmc_property_ipv6_set_addresses (NMSetting *setting, const char *prop, const cha
g_strfreev (strv); g_strfreev (strv);
return FALSE; 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); nm_ip_address_unref (ip6addr);
} }
g_strfreev (strv); g_strfreev (strv);
@ -3580,7 +3581,7 @@ nmc_property_ipv6_set_addresses (NMSetting *setting, const char *prop, const cha
} }
static gboolean static gboolean
_validate_and_remove_ipv6_address (NMSettingIP6Config *setting, _validate_and_remove_ipv6_address (NMSettingIPConfig *setting,
const char *address, const char *address,
GError **error) GError **error)
{ {
@ -3591,16 +3592,16 @@ _validate_and_remove_ipv6_address (NMSettingIP6Config *setting,
if (!ip6addr) if (!ip6addr)
return FALSE; 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) if (!ret)
g_set_error (error, 1, 0, _("the property doesn't contain IP address '%s'"), address); g_set_error (error, 1, 0, _("the property doesn't contain IP address '%s'"), address);
nm_ip_address_unref (ip6addr); nm_ip_address_unref (ip6addr);
return ret; return ret;
} }
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_addresses, DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_addresses,
NM_SETTING_IP6_CONFIG, NM_SETTING_IP_CONFIG,
nm_setting_ip6_config_get_num_addresses, nm_setting_ip_config_get_num_addresses,
nm_setting_ip6_config_remove_address, nm_setting_ip_config_remove_address,
_validate_and_remove_ipv6_address) _validate_and_remove_ipv6_address)
static const char * static const char *
@ -3634,7 +3635,7 @@ nmc_property_ipv6_set_routes (NMSetting *setting, const char *prop, const char *
g_strfreev (strv); g_strfreev (strv);
return FALSE; 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); nm_ip_route_unref (ip6route);
} }
g_strfreev (strv); g_strfreev (strv);
@ -3642,7 +3643,7 @@ nmc_property_ipv6_set_routes (NMSetting *setting, const char *prop, const char *
} }
static gboolean static gboolean
_validate_and_remove_ipv6_route (NMSettingIP6Config *setting, _validate_and_remove_ipv6_route (NMSettingIPConfig *setting,
const char *route, const char *route,
GError **error) GError **error)
{ {
@ -3653,16 +3654,16 @@ _validate_and_remove_ipv6_route (NMSettingIP6Config *setting,
if (!ip6route) if (!ip6route)
return FALSE; 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) if (!ret)
g_set_error (error, 1, 0, _("the property doesn't contain route '%s'"), route); g_set_error (error, 1, 0, _("the property doesn't contain route '%s'"), route);
nm_ip_route_unref (ip6route); nm_ip_route_unref (ip6route);
return ret; return ret;
} }
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_routes, DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_routes,
NM_SETTING_IP6_CONFIG, NM_SETTING_IP_CONFIG,
nm_setting_ip6_config_get_num_routes, nm_setting_ip_config_get_num_routes,
nm_setting_ip6_config_remove_route, nm_setting_ip_config_remove_route,
_validate_and_remove_ipv6_route) _validate_and_remove_ipv6_route)
static const char * static const char *
@ -4695,6 +4696,8 @@ nmc_add_prop_funcs (char *key,
/* concatenate setting name and property name */ /* concatenate setting name and property name */
#define GLUE(A,B) (g_strconcat ((NM_SETTING_##A##_SETTING_NAME),(NM_SETTING_##A##_##B), NULL)) #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 void
nmc_properties_init (void) nmc_properties_init (void)
{ {
@ -5420,49 +5423,49 @@ nmc_properties_init (void)
NULL); NULL);
/* Add editable properties for NM_SETTING_IP4_CONFIG_SETTING_NAME */ /* 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_get_method,
nmc_property_ipv4_set_method, nmc_property_ipv4_set_method,
NULL, NULL,
NULL, NULL,
nmc_property_ipv4_allowed_method, nmc_property_ipv4_allowed_method,
NULL); 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_get_dns,
nmc_property_ipv4_set_dns, nmc_property_ipv4_set_dns,
nmc_property_ipv4_remove_dns, nmc_property_ipv4_remove_dns,
nmc_property_ipv4_describe_dns, nmc_property_ipv4_describe_dns,
NULL, NULL,
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_get_dns_search,
nmc_property_ipv4_set_dns_search, nmc_property_ipv4_set_dns_search,
nmc_property_ipv4_remove_dns_search, nmc_property_ipv4_remove_dns_search,
NULL, NULL,
NULL, 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_get_addresses,
nmc_property_ipv4_set_addresses, nmc_property_ipv4_set_addresses,
nmc_property_ipv4_remove_addresses, nmc_property_ipv4_remove_addresses,
nmc_property_ipv4_describe_addresses, nmc_property_ipv4_describe_addresses,
NULL, NULL,
nmc_property_out2in_addresses); 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_get_routes,
nmc_property_ipv4_set_routes, nmc_property_ipv4_set_routes,
nmc_property_ipv4_remove_routes, nmc_property_ipv4_remove_routes,
nmc_property_ipv4_describe_routes, nmc_property_ipv4_describe_routes,
NULL, NULL,
nmc_property_out2in_routes); 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_ipv4_get_ignore_auto_routes,
nmc_property_set_bool, nmc_property_set_bool,
NULL, NULL,
NULL, NULL,
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_ipv4_get_ignore_auto_dns,
nmc_property_set_bool, nmc_property_set_bool,
NULL, NULL,
@ -5476,28 +5479,28 @@ nmc_properties_init (void)
NULL, NULL,
NULL, 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_ipv4_get_dhcp_send_hostname,
nmc_property_set_bool, nmc_property_set_bool,
NULL, NULL,
NULL, NULL,
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_ipv4_get_dhcp_hostname,
nmc_property_set_string, nmc_property_set_string,
NULL, NULL,
NULL, NULL,
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_ipv4_get_never_default,
nmc_property_set_bool, nmc_property_set_bool,
NULL, NULL,
NULL, NULL,
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_ipv4_get_may_fail,
nmc_property_set_bool, nmc_property_set_bool,
NULL, NULL,
@ -5506,63 +5509,63 @@ nmc_properties_init (void)
NULL); NULL);
/* Add editable properties for NM_SETTING_IP6_CONFIG_SETTING_NAME */ /* 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_get_method,
nmc_property_ipv6_set_method, nmc_property_ipv6_set_method,
NULL, NULL,
NULL, NULL,
nmc_property_ipv6_allowed_method, nmc_property_ipv6_allowed_method,
NULL); 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_get_dns,
nmc_property_ipv6_set_dns, nmc_property_ipv6_set_dns,
nmc_property_ipv6_remove_dns, nmc_property_ipv6_remove_dns,
nmc_property_ipv6_describe_dns, nmc_property_ipv6_describe_dns,
NULL, NULL,
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_get_dns_search,
nmc_property_ipv6_set_dns_search, nmc_property_ipv6_set_dns_search,
nmc_property_ipv6_remove_dns_search, nmc_property_ipv6_remove_dns_search,
NULL, NULL,
NULL, 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_get_addresses,
nmc_property_ipv6_set_addresses, nmc_property_ipv6_set_addresses,
nmc_property_ipv6_remove_addresses, nmc_property_ipv6_remove_addresses,
nmc_property_ipv6_describe_addresses, nmc_property_ipv6_describe_addresses,
NULL, NULL,
nmc_property_out2in_addresses); 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_get_routes,
nmc_property_ipv6_set_routes, nmc_property_ipv6_set_routes,
nmc_property_ipv6_remove_routes, nmc_property_ipv6_remove_routes,
nmc_property_ipv6_describe_routes, nmc_property_ipv6_describe_routes,
NULL, NULL,
nmc_property_out2in_routes); 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_ipv6_get_ignore_auto_routes,
nmc_property_set_bool, nmc_property_set_bool,
NULL, NULL,
NULL, NULL,
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_ipv6_get_ignore_auto_dns,
nmc_property_set_bool, nmc_property_set_bool,
NULL, NULL,
NULL, NULL,
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_ipv6_get_never_default,
nmc_property_set_bool, nmc_property_set_bool,
NULL, NULL,
NULL, NULL,
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_ipv6_get_may_fail,
nmc_property_set_bool, nmc_property_set_bool,
NULL, NULL,
@ -5576,7 +5579,7 @@ nmc_properties_init (void)
NULL, NULL,
NULL, NULL,
nmc_property_out2in_cut_paren); 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_ipv6_get_dhcp_hostname,
nmc_property_set_string, nmc_property_set_string,
NULL, NULL,
@ -6715,7 +6718,7 @@ setting_wireless_security_details (NMSetting *setting, NmCli *nmc, const char *o
static gboolean static gboolean
setting_ip4_config_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets) 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; NmcOutputField *tmpl, *arr;
size_t tmpl_len; size_t tmpl_len;
@ -6752,7 +6755,7 @@ setting_ip4_config_details (NMSetting *setting, NmCli *nmc, const char *one_pro
static gboolean static gboolean
setting_ip6_config_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets) 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; NmcOutputField *tmpl, *arr;
size_t tmpl_len; size_t tmpl_len;

View file

@ -30,8 +30,8 @@ void nmc_properties_cleanup (void);
NMSetting *nmc_setting_new_for_name (const char *name); NMSetting *nmc_setting_new_for_name (const char *name);
void nmc_setting_custom_init (NMSetting *setting); void nmc_setting_custom_init (NMSetting *setting);
void nmc_setting_ip4_connect_handlers (NMSettingIP4Config *setting); void nmc_setting_ip4_connect_handlers (NMSettingIPConfig *setting);
void nmc_setting_ip6_connect_handlers (NMSettingIP6Config *setting); void nmc_setting_ip6_connect_handlers (NMSettingIPConfig *setting);
void nmc_setting_wireless_connect_handlers (NMSettingWireless *setting); void nmc_setting_wireless_connect_handlers (NMSettingWireless *setting);
void nmc_setting_connection_connect_handlers (NMSettingConnection *setting, NMConnection *connection); void nmc_setting_connection_connect_handlers (NMSettingConnection *setting, NMConnection *connection);

View file

@ -59,12 +59,12 @@ static gboolean
nmt_page_ip4_show_by_default (NmtEditorPage *page) nmt_page_ip4_show_by_default (NmtEditorPage *page)
{ {
NMConnection *conn; NMConnection *conn;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
conn = nmt_editor_page_get_connection (page); conn = nmt_editor_page_get_connection (page);
s_ip4 = nm_connection_get_setting_ip4_config (conn); 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) if ( !g_strcmp0 (nm_setting_ip_config_get_method (s_ip4), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)
|| nm_setting_ip4_config_get_num_addresses (s_ip4)) || nm_setting_ip_config_get_num_addresses (s_ip4))
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
@ -115,22 +115,22 @@ nmt_page_ip4_constructed (GObject *object)
{ {
NmtPageIP4 *ip4 = NMT_PAGE_IP4 (object); NmtPageIP4 *ip4 = NMT_PAGE_IP4 (object);
NmtPageGrid *grid; NmtPageGrid *grid;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NmtNewtWidget *widget, *button; NmtNewtWidget *widget, *button;
NMConnection *conn; NMConnection *conn;
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip4)); conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip4));
s_ip4 = nm_connection_get_setting_ip4_config (conn); s_ip4 = nm_connection_get_setting_ip4_config (conn);
if (!s_ip4) { 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), 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); NULL);
nm_connection_add_setting (conn, (NMSetting *) s_ip4); nm_connection_add_setting (conn, (NMSetting *) s_ip4);
} }
widget = nmt_newt_popup_new (ip4methods); 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", widget, "active-id",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_editor_page_set_header_widget (NMT_EDITOR_PAGE (ip4), widget); 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); widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4_WITH_PREFIX);
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET, 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", widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Addresses"), widget, NULL); nmt_page_grid_append (grid, _("Addresses"), widget, NULL);
widget = nmt_ip_entry_new (25, AF_INET, FALSE, TRUE); widget = nmt_ip_entry_new (25, AF_INET, FALSE, TRUE);
nm_editor_bind_ip_gateway_to_string (AF_INET, 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", widget, "text",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Gateway"), widget, NULL); nmt_page_grid_append (grid, _("Gateway"), widget, NULL);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4); widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4);
nm_editor_bind_ip_addresses_to_strv (AF_INET, 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", widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("DNS servers"), widget, NULL); nmt_page_grid_append (grid, _("DNS servers"), widget, NULL);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_HOSTNAME); 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", widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Search domains"), widget, NULL); nmt_page_grid_append (grid, _("Search domains"), widget, NULL);
@ -170,7 +170,7 @@ nmt_page_ip4_constructed (GObject *object)
"text", "", "text", "",
"style", NMT_NEWT_LABEL_PLAIN, "style", NMT_NEWT_LABEL_PLAIN,
NULL); 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", widget, "text",
G_BINDING_SYNC_CREATE, G_BINDING_SYNC_CREATE,
ip4_routes_transform_to_description, ip4_routes_transform_to_description,
@ -180,7 +180,7 @@ nmt_page_ip4_constructed (GObject *object)
nmt_page_grid_append (grid, _("Routing"), widget, button); nmt_page_grid_append (grid, _("Routing"), widget, button);
widget = nmt_newt_checkbox_new (_("Never use this network for default route")); 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", widget, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
nmt_page_grid_append (grid, NULL, widget, NULL); 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); nmt_page_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);
widget = nmt_newt_checkbox_new (_("Require IPv4 addressing for this connection")); 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", widget, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL |
G_BINDING_INVERT_BOOLEAN); G_BINDING_INVERT_BOOLEAN);

View file

@ -59,12 +59,12 @@ static gboolean
nmt_page_ip6_show_by_default (NmtEditorPage *page) nmt_page_ip6_show_by_default (NmtEditorPage *page)
{ {
NMConnection *conn; NMConnection *conn;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
conn = nmt_editor_page_get_connection (page); conn = nmt_editor_page_get_connection (page);
s_ip6 = nm_connection_get_setting_ip6_config (conn); 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) if ( !g_strcmp0 (nm_setting_ip_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)
|| nm_setting_ip6_config_get_num_addresses (s_ip6)) || nm_setting_ip_config_get_num_addresses (s_ip6))
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
@ -115,22 +115,22 @@ nmt_page_ip6_constructed (GObject *object)
{ {
NmtPageIP6 *ip6 = NMT_PAGE_IP6 (object); NmtPageIP6 *ip6 = NMT_PAGE_IP6 (object);
NmtPageGrid *grid; NmtPageGrid *grid;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
NmtNewtWidget *widget, *button; NmtNewtWidget *widget, *button;
NMConnection *conn; NMConnection *conn;
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip6)); conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip6));
s_ip6 = nm_connection_get_setting_ip6_config (conn); s_ip6 = nm_connection_get_setting_ip6_config (conn);
if (!s_ip6) { 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), 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); NULL);
nm_connection_add_setting (conn, (NMSetting *) s_ip6); nm_connection_add_setting (conn, (NMSetting *) s_ip6);
} }
widget = nmt_newt_popup_new (ip6methods); 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", widget, "active-id",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_editor_page_set_header_widget (NMT_EDITOR_PAGE (ip6), widget); 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); widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6_WITH_PREFIX);
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET6, 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", widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Addresses"), widget, NULL); nmt_page_grid_append (grid, _("Addresses"), widget, NULL);
widget = nmt_ip_entry_new (25, AF_INET6, FALSE, TRUE); widget = nmt_ip_entry_new (25, AF_INET6, FALSE, TRUE);
nm_editor_bind_ip_gateway_to_string (AF_INET6, 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", widget, "text",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Gateway"), widget, NULL); nmt_page_grid_append (grid, _("Gateway"), widget, NULL);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6); widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6);
nm_editor_bind_ip_addresses_to_strv (AF_INET6, 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", widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("DNS servers"), widget, NULL); nmt_page_grid_append (grid, _("DNS servers"), widget, NULL);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_HOSTNAME); 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", widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Search domains"), widget, NULL); nmt_page_grid_append (grid, _("Search domains"), widget, NULL);
@ -168,7 +168,7 @@ nmt_page_ip6_constructed (GObject *object)
"text", "", "text", "",
"style", NMT_NEWT_LABEL_PLAIN, "style", NMT_NEWT_LABEL_PLAIN,
NULL); 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", widget, "text",
G_BINDING_SYNC_CREATE, G_BINDING_SYNC_CREATE,
ip6_routes_transform_to_description, ip6_routes_transform_to_description,
@ -178,7 +178,7 @@ nmt_page_ip6_constructed (GObject *object)
nmt_page_grid_append (grid, _("Routing"), widget, button); nmt_page_grid_append (grid, _("Routing"), widget, button);
widget = nmt_newt_checkbox_new (_("Never use this network for default route")); 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", widget, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
nmt_page_grid_append (grid, NULL, widget, NULL); 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); nmt_page_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);
widget = nmt_newt_checkbox_new (_("Require IPv6 addressing for this connection")); 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", widget, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL |
G_BINDING_INVERT_BOOLEAN); G_BINDING_INVERT_BOOLEAN);

View file

@ -77,21 +77,15 @@ save_routes_and_exit (NmtNewtButton *button,
{ {
NmtRouteEditor *editor = user_data; NmtRouteEditor *editor = user_data;
NmtRouteEditorPrivate *priv = NMT_ROUTE_EDITOR_GET_PRIVATE (editor); NmtRouteEditorPrivate *priv = NMT_ROUTE_EDITOR_GET_PRIVATE (editor);
const char *property; GPtrArray *routes;
GBinding *binding;
if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting)) g_object_get (priv->edit_setting,
property = NM_SETTING_IP4_CONFIG_ROUTES; NM_SETTING_IP_CONFIG_ROUTES, &routes,
else NULL);
property = NM_SETTING_IP6_CONFIG_ROUTES; g_object_set (priv->orig_setting,
NM_SETTING_IP_CONFIG_ROUTES, routes,
/* Because of the complicated dbus-glib GTypes, it's easier to cheat NULL);
* and use GBinding to do this than it is to copy the value by hand. g_ptr_array_unref (routes);
*/
binding = g_object_bind_property (priv->edit_setting, property,
priv->orig_setting, property,
G_BINDING_SYNC_CREATE);
g_object_unref (binding);
nmt_newt_form_quit (NMT_NEWT_FORM (editor)); 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) if (G_OBJECT_CLASS (nmt_route_editor_parent_class)->constructed)
G_OBJECT_CLASS (nmt_route_editor_parent_class)->constructed (object); 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); routes = nmt_route_table_new (AF_INET);
g_object_bind_property (priv->edit_setting, NM_SETTING_IP4_CONFIG_ROUTES, else
routes, "routes",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
} else {
routes = nmt_route_table_new (AF_INET6); routes = nmt_route_table_new (AF_INET6);
g_object_bind_property (priv->edit_setting, NM_SETTING_IP6_CONFIG_ROUTES, g_object_bind_property (priv->edit_setting, NM_SETTING_IP_CONFIG_ROUTES,
routes, "routes", routes, "routes",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
}
vbox = nmt_newt_grid_new (); vbox = nmt_newt_grid_new ();
nmt_newt_grid_add (NMT_NEWT_GRID (vbox), routes, 0, 0); nmt_newt_grid_add (NMT_NEWT_GRID (vbox), routes, 0, 0);

View file

@ -86,7 +86,7 @@ add_connection (GDBusProxy *proxy, const char *con_name)
/* Build up the 'ipv4' Setting */ /* Build up the 'ipv4' Setting */
g_variant_builder_init (&setting_builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_init (&setting_builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&setting_builder, "{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_new_string (NM_SETTING_IP4_CONFIG_METHOD_AUTO));
g_variant_builder_add (&connection_builder, "{sa{sv}}", g_variant_builder_add (&connection_builder, "{sa{sv}}",
NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME,

View file

@ -86,7 +86,7 @@ add_connection (NMClient *client, GMainLoop *loop, const char *con_name)
/* Build up the 'ipv4' Setting */ /* Build up the 'ipv4' Setting */
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
g_object_set (G_OBJECT (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); NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ip4)); nm_connection_add_setting (connection, NM_SETTING (s_ip4));

View file

@ -631,8 +631,7 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
NMSettingConnection *s_con = nm_connection_get_setting_connection (self); NMSettingConnection *s_con = nm_connection_get_setting_connection (self);
const char *default_ip4_method = NM_SETTING_IP4_CONFIG_METHOD_AUTO; const char *default_ip4_method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
const char *default_ip6_method = NULL; const char *default_ip6_method = NULL;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4, *s_ip6;
NMSettingIP6Config *s_ip6;
NMSetting *setting; NMSetting *setting;
if (parameters) if (parameters)
@ -663,7 +662,7 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
setting = nm_setting_ip4_config_new (); setting = nm_setting_ip4_config_new ();
g_object_set (setting, g_object_set (setting,
NM_SETTING_IP4_CONFIG_METHOD, default_ip4_method, NM_SETTING_IP_CONFIG_METHOD, default_ip4_method,
NULL); NULL);
nm_connection_add_setting (self, setting); nm_connection_add_setting (self, setting);
} }
@ -671,8 +670,8 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
setting = nm_setting_ip6_config_new (); setting = nm_setting_ip6_config_new ();
g_object_set (setting, g_object_set (setting,
NM_SETTING_IP6_CONFIG_METHOD, default_ip6_method, NM_SETTING_IP_CONFIG_METHOD, default_ip6_method,
NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL); NULL);
nm_connection_add_setting (self, setting); nm_connection_add_setting (self, setting);
} }
@ -740,8 +739,7 @@ _nm_connection_verify (NMConnection *connection, GError **error)
{ {
NMConnectionPrivate *priv; NMConnectionPrivate *priv;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4, *s_ip6;
NMSettingIP6Config *s_ip6;
GHashTableIter iter; GHashTableIter iter;
gpointer value; gpointer value;
GSList *all_settings = NULL, *setting_i; 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. * 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) nm_connection_get_setting_ip4_config (NMConnection *connection)
{ {
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); 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. * 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) nm_connection_get_setting_ip6_config (NMConnection *connection)
{ {
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); 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);
} }
/** /**

View file

@ -193,8 +193,8 @@ NMSettingDcb * nm_connection_get_setting_dcb (NMConnec
NMSettingGeneric * nm_connection_get_setting_generic (NMConnection *connection); NMSettingGeneric * nm_connection_get_setting_generic (NMConnection *connection);
NMSettingGsm * nm_connection_get_setting_gsm (NMConnection *connection); NMSettingGsm * nm_connection_get_setting_gsm (NMConnection *connection);
NMSettingInfiniband * nm_connection_get_setting_infiniband (NMConnection *connection); NMSettingInfiniband * nm_connection_get_setting_infiniband (NMConnection *connection);
NMSettingIP4Config * nm_connection_get_setting_ip4_config (NMConnection *connection); NMSettingIPConfig * nm_connection_get_setting_ip4_config (NMConnection *connection);
NMSettingIP6Config * nm_connection_get_setting_ip6_config (NMConnection *connection); NMSettingIPConfig * nm_connection_get_setting_ip6_config (NMConnection *connection);
NMSettingOlpcMesh * nm_connection_get_setting_olpc_mesh (NMConnection *connection); NMSettingOlpcMesh * nm_connection_get_setting_olpc_mesh (NMConnection *connection);
NMSettingPpp * nm_connection_get_setting_ppp (NMConnection *connection); NMSettingPpp * nm_connection_get_setting_ppp (NMConnection *connection);
NMSettingPppoe * nm_connection_get_setting_pppoe (NMConnection *connection); NMSettingPppoe * nm_connection_get_setting_pppoe (NMConnection *connection);

View file

@ -40,6 +40,7 @@ typedef struct _NMSettingDcb NMSettingDcb;
typedef struct _NMSettingGeneric NMSettingGeneric; typedef struct _NMSettingGeneric NMSettingGeneric;
typedef struct _NMSettingGsm NMSettingGsm; typedef struct _NMSettingGsm NMSettingGsm;
typedef struct _NMSettingInfiniband NMSettingInfiniband; typedef struct _NMSettingInfiniband NMSettingInfiniband;
typedef struct _NMSettingIPConfig NMSettingIPConfig;
typedef struct _NMSettingIP4Config NMSettingIP4Config; typedef struct _NMSettingIP4Config NMSettingIP4Config;
typedef struct _NMSettingIP6Config NMSettingIP6Config; typedef struct _NMSettingIP6Config NMSettingIP6Config;
typedef struct _NMSettingOlpcMesh NMSettingOlpcMesh; typedef struct _NMSettingOlpcMesh NMSettingOlpcMesh;

File diff suppressed because it is too large Load diff

View file

@ -127,6 +127,94 @@ void nm_ip_route_set_attribute (NMIPRoute *route,
const char *name, const char *name,
GVariant *value); 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 G_END_DECLS
#endif /* NM_SETTING_IP_CONFIG_H */ #endif /* NM_SETTING_IP_CONFIG_H */

File diff suppressed because it is too large Load diff

View file

@ -27,7 +27,6 @@
#error "Only <NetworkManager.h> can be included directly." #error "Only <NetworkManager.h> can be included directly."
#endif #endif
#include "nm-setting.h"
#include "nm-setting-ip-config.h" #include "nm-setting-ip-config.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -41,18 +40,7 @@ G_BEGIN_DECLS
#define NM_SETTING_IP4_CONFIG_SETTING_NAME "ipv4" #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_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: * NM_SETTING_IP4_CONFIG_METHOD_AUTO:
@ -99,11 +87,11 @@ G_BEGIN_DECLS
#define NM_SETTING_IP4_CONFIG_METHOD_DISABLED "disabled" #define NM_SETTING_IP4_CONFIG_METHOD_DISABLED "disabled"
struct _NMSettingIP4Config { struct _NMSettingIP4Config {
NMSetting parent; NMSettingIPConfig parent;
}; };
typedef struct { typedef struct {
NMSettingClass parent; NMSettingIPConfigClass parent;
/*< private >*/ /*< private >*/
gpointer padding[4]; gpointer padding[4];
@ -111,46 +99,9 @@ typedef struct {
GType nm_setting_ip4_config_get_type (void); GType nm_setting_ip4_config_get_type (void);
NMSetting * nm_setting_ip4_config_new (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_dhcp_client_id (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);
G_END_DECLS G_END_DECLS

File diff suppressed because it is too large Load diff

View file

@ -26,9 +26,6 @@
#error "Only <NetworkManager.h> can be included directly." #error "Only <NetworkManager.h> can be included directly."
#endif #endif
#include <arpa/inet.h>
#include "nm-setting.h"
#include "nm-setting-ip-config.h" #include "nm-setting-ip-config.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -42,18 +39,7 @@ G_BEGIN_DECLS
#define NM_SETTING_IP6_CONFIG_SETTING_NAME "ipv6" #define NM_SETTING_IP6_CONFIG_SETTING_NAME "ipv6"
#define NM_SETTING_IP6_CONFIG_METHOD "method" #define NM_SETTING_IP6_CONFIG_IP6_PRIVACY "ip6-privacy"
#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"
/** /**
* NM_SETTING_IP6_CONFIG_METHOD_IGNORE: * NM_SETTING_IP6_CONFIG_METHOD_IGNORE:
@ -129,11 +115,11 @@ typedef enum {
} NMSettingIP6ConfigPrivacy; } NMSettingIP6ConfigPrivacy;
struct _NMSettingIP6Config { struct _NMSettingIP6Config {
NMSetting parent; NMSettingIPConfig parent;
}; };
typedef struct { typedef struct {
NMSettingClass parent; NMSettingIPConfigClass parent;
/*< private >*/ /*< private >*/
gpointer padding[4]; gpointer padding[4];
@ -141,42 +127,8 @@ typedef struct {
GType nm_setting_ip6_config_get_type (void); GType nm_setting_ip6_config_get_type (void);
NMSetting * nm_setting_ip6_config_new (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);
NMSettingIP6ConfigPrivacy nm_setting_ip6_config_get_ip6_privacy (NMSettingIP6Config *setting); NMSettingIP6ConfigPrivacy nm_setting_ip6_config_get_ip6_privacy (NMSettingIP6Config *setting);
G_END_DECLS G_END_DECLS

View file

@ -24,6 +24,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <netinet/ether.h> #include <netinet/ether.h>
#include <arpa/inet.h>
#include <uuid/uuid.h> #include <uuid/uuid.h>
#include <gmodule.h> #include <gmodule.h>

View file

@ -323,7 +323,7 @@ test_setting_vpn_modify_during_foreach (void)
static void static void
test_setting_ip4_config_labels (void) test_setting_ip4_config_labels (void)
{ {
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMIPAddress *addr; NMIPAddress *addr;
GVariant *label; GVariant *label;
GPtrArray *addrs; GPtrArray *addrs;
@ -332,21 +332,21 @@ test_setting_ip4_config_labels (void)
GVariant *dict, *setting_dict, *value; GVariant *dict, *setting_dict, *value;
GError *error = NULL; 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), 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); NULL);
/* addr 1 */ /* addr 1 */
addr = nm_ip_address_new (AF_INET, "1.1.1.1", 24, NULL, &error); addr = nm_ip_address_new (AF_INET, "1.1.1.1", 24, NULL, &error);
g_assert_no_error (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_ip_address_unref (addr);
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (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"); label = nm_ip_address_get_attribute (addr, "label");
g_assert (label == NULL); g_assert (label == NULL);
@ -355,12 +355,12 @@ test_setting_ip4_config_labels (void)
g_assert_no_error (error); g_assert_no_error (error);
nm_ip_address_set_attribute (addr, "label", g_variant_new_string ("eth0:1")); 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_ip_address_unref (addr);
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (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"); label = nm_ip_address_get_attribute (addr, "label");
g_assert (label != NULL); g_assert (label != NULL);
g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1"); 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); g_assert_no_error (error);
nm_ip_address_set_attribute (addr, "label", NULL); 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_ip_address_unref (addr);
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (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"); label = nm_ip_address_get_attribute (addr, "label");
g_assert (label == NULL); g_assert (label == NULL);
/* Remove addr 1 and re-verify remaining addresses */ /* 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); nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (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"); g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "2.2.2.2");
label = nm_ip_address_get_attribute (addr, "label"); label = nm_ip_address_get_attribute (addr, "label");
g_assert (label != NULL); g_assert (label != NULL);
g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1"); 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"); g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "3.3.3.3");
label = nm_ip_address_get_attribute (addr, "label"); label = nm_ip_address_get_attribute (addr, "label");
g_assert (label == NULL); g_assert (label == NULL);
@ -422,40 +422,40 @@ test_setting_ip4_config_labels (void)
s_ip4 = nm_connection_get_setting_ip4_config (conn); 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"); g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "2.2.2.2");
label = nm_ip_address_get_attribute (addr, "label"); label = nm_ip_address_get_attribute (addr, "label");
g_assert (label != NULL); g_assert (label != NULL);
g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1"); 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"); g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "3.3.3.3");
label = nm_ip_address_get_attribute (addr, "label"); label = nm_ip_address_get_attribute (addr, "label");
g_assert (label == NULL); g_assert (label == NULL);
/* Test explicit property assignment */ /* Test explicit property assignment */
g_object_get (G_OBJECT (s_ip4), g_object_get (G_OBJECT (s_ip4),
NM_SETTING_IP4_CONFIG_ADDRESSES, &addrs, NM_SETTING_IP_CONFIG_ADDRESSES, &addrs,
NULL); NULL);
nm_setting_ip4_config_clear_addresses (s_ip4); nm_setting_ip_config_clear_addresses (s_ip4);
g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 0); g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 0);
g_object_set (G_OBJECT (s_ip4), g_object_set (G_OBJECT (s_ip4),
NM_SETTING_IP4_CONFIG_ADDRESSES, addrs, NM_SETTING_IP_CONFIG_ADDRESSES, addrs,
NULL); NULL);
g_ptr_array_unref (addrs); g_ptr_array_unref (addrs);
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (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"); g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "2.2.2.2");
label = nm_ip_address_get_attribute (addr, "label"); label = nm_ip_address_get_attribute (addr, "label");
g_assert (label != NULL); g_assert (label != NULL);
g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1"); 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"); g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "3.3.3.3");
label = nm_ip_address_get_attribute (addr, "label"); label = nm_ip_address_get_attribute (addr, "label");
g_assert (label == NULL); g_assert (label == NULL);
@ -996,8 +996,8 @@ new_test_connection (void)
setting = nm_setting_ip4_config_new (); setting = nm_setting_ip4_config_new ();
g_object_set (G_OBJECT (setting), g_object_set (G_OBJECT (setting),
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_HOSTNAME, "eyeofthetiger", NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, "eyeofthetiger",
NULL); NULL);
nm_connection_add_setting (connection, setting); nm_connection_add_setting (connection, setting);
@ -1045,7 +1045,7 @@ new_connection_dict (char **out_uuid,
/* IP6 */ /* IP6 */
g_variant_builder_init (&setting_builder, NM_VARIANT_TYPE_SETTING); g_variant_builder_init (&setting_builder, NM_VARIANT_TYPE_SETTING);
g_variant_builder_add (&setting_builder, "{sv}", 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_new_string (*out_expected_ip6_method));
g_variant_builder_add (&conn_builder, "{sa{sv}}", g_variant_builder_add (&conn_builder, "{sa{sv}}",
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
@ -1062,7 +1062,7 @@ test_connection_replace_settings (void)
GError *error = NULL; GError *error = NULL;
gboolean success; gboolean success;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
char *uuid = NULL; char *uuid = NULL;
const char *expected_id = NULL, *expected_method = 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); s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6); 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_free (uuid);
g_variant_unref (new_settings); g_variant_unref (new_settings);
@ -1217,7 +1217,7 @@ test_connection_new_from_dbus (void)
GVariant *new_settings; GVariant *new_settings;
GError *error = NULL; GError *error = NULL;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
char *uuid = NULL; char *uuid = NULL;
const char *expected_id = NULL, *expected_method = 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); s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6); 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_free (uuid);
g_variant_unref (new_settings); g_variant_unref (new_settings);
@ -1630,18 +1630,18 @@ test_connection_diff_a_only (void)
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN }, { NULL, NM_SETTING_DIFF_RESULT_UNKNOWN },
} }, } },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, { { NM_SETTING_IP4_CONFIG_SETTING_NAME, {
{ NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_DNS, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP_CONFIG_DNS, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_DNS_SEARCH, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP_CONFIG_DNS_SEARCH, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_ADDRESSES, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP_CONFIG_ADDRESSES, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_ROUTES, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP_CONFIG_ROUTES, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP_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_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_CLIENT_ID, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP_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_MAY_FAIL, NM_SETTING_DIFF_RESULT_IN_A },
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN }, { NULL, NM_SETTING_DIFF_RESULT_UNKNOWN },
} }, } },
}; };
@ -1681,11 +1681,11 @@ test_connection_diff_different (void)
{ {
NMConnection *a, *b; NMConnection *a, *b;
GHashTable *out_diffs = NULL; GHashTable *out_diffs = NULL;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
gboolean same; gboolean same;
const DiffSetting settings[] = { const DiffSetting settings[] = {
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, { { 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 }, { NULL, NM_SETTING_DIFF_RESULT_UNKNOWN },
} }, } },
}; };
@ -1695,7 +1695,7 @@ test_connection_diff_different (void)
s_ip4 = nm_connection_get_setting_ip4_config (a); s_ip4 = nm_connection_get_setting_ip4_config (a);
g_assert (s_ip4); g_assert (s_ip4);
g_object_set (G_OBJECT (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); NULL);
same = nm_connection_diff (a, b, NM_SETTING_COMPARE_FLAG_EXACT, &out_diffs); same = nm_connection_diff (a, b, NM_SETTING_COMPARE_FLAG_EXACT, &out_diffs);
@ -1766,7 +1766,7 @@ test_connection_diff_inferrable (void)
gboolean same; gboolean same;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWired *s_wired; NMSettingWired *s_wired;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
char *uuid; char *uuid;
const DiffSetting settings[] = { const DiffSetting settings[] = {
{ NM_SETTING_CONNECTION_SETTING_NAME, { { NM_SETTING_CONNECTION_SETTING_NAME, {
@ -1794,7 +1794,7 @@ test_connection_diff_inferrable (void)
s_ip4 = nm_connection_get_setting_ip4_config (a); s_ip4 = nm_connection_get_setting_ip4_config (a);
g_assert (s_ip4); 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 */ /* Make sure the diff returns no results as secrets are ignored */
same = nm_connection_diff (a, b, NM_SETTING_COMPARE_FLAG_INFERRABLE, &out_diffs); 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); g_free (uuid);
setting = nm_setting_ip4_config_new (); 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); nm_connection_add_setting (connection, setting);
setting = nm_setting_ip6_config_new (); 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); nm_connection_add_setting (connection, setting);
} }
@ -2446,7 +2446,7 @@ test_setting_ip4_changed_signal (void)
{ {
NMConnection *connection; NMConnection *connection;
gboolean changed = FALSE; gboolean changed = FALSE;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMIPAddress *addr; NMIPAddress *addr;
NMIPRoute *route; NMIPRoute *route;
GError *error = NULL; GError *error = NULL;
@ -2457,53 +2457,53 @@ test_setting_ip4_changed_signal (void)
(GCallback) test_connection_changed_cb, (GCallback) test_connection_changed_cb,
&changed); &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)); 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_ip_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_remove_dns (s_ip4, 0));
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns->len*");
ASSERT_UNCHANGED (nm_setting_ip4_config_remove_dns (s_ip4, 1)); ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns (s_ip4, 1));
g_test_assert_expected_messages (); g_test_assert_expected_messages ();
nm_setting_ip4_config_add_dns (s_ip4, "33.44.0.0"); nm_setting_ip_config_add_dns (s_ip4, "33.44.0.0");
ASSERT_CHANGED (nm_setting_ip4_config_clear_dns (s_ip4)); 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_ip_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_remove_dns_search (s_ip4, 0));
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns_search->len*");
ASSERT_UNCHANGED (nm_setting_ip4_config_remove_dns_search (s_ip4, 1)); ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns_search (s_ip4, 1));
g_test_assert_expected_messages (); g_test_assert_expected_messages ();
ASSERT_CHANGED (nm_setting_ip4_config_add_dns_search (s_ip4, "foobar.com")); ASSERT_CHANGED (nm_setting_ip_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_clear_dns_searches (s_ip4));
addr = nm_ip_address_new (AF_INET, "22.33.0.0", 24, NULL, &error); addr = nm_ip_address_new (AF_INET, "22.33.0.0", 24, NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
ASSERT_CHANGED (nm_setting_ip4_config_add_address (s_ip4, addr)); ASSERT_CHANGED (nm_setting_ip_config_add_address (s_ip4, addr));
ASSERT_CHANGED (nm_setting_ip4_config_remove_address (s_ip4, 0)); ASSERT_CHANGED (nm_setting_ip_config_remove_address (s_ip4, 0));
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*addr != NULL*"); g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->addresses->len*");
ASSERT_UNCHANGED (nm_setting_ip4_config_remove_address (s_ip4, 1)); ASSERT_UNCHANGED (nm_setting_ip_config_remove_address (s_ip4, 1));
g_test_assert_expected_messages (); g_test_assert_expected_messages ();
nm_setting_ip4_config_add_address (s_ip4, addr); nm_setting_ip_config_add_address (s_ip4, addr);
ASSERT_CHANGED (nm_setting_ip4_config_clear_addresses (s_ip4)); 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); route = nm_ip_route_new (AF_INET, "22.33.0.0", 24, NULL, 0, &error);
g_assert_no_error (error); g_assert_no_error (error);
ASSERT_CHANGED (nm_setting_ip4_config_add_route (s_ip4, route)); ASSERT_CHANGED (nm_setting_ip_config_add_route (s_ip4, route));
ASSERT_CHANGED (nm_setting_ip4_config_remove_route (s_ip4, 0)); ASSERT_CHANGED (nm_setting_ip_config_remove_route (s_ip4, 0));
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->routes->len*");
ASSERT_UNCHANGED (nm_setting_ip4_config_remove_route (s_ip4, 1)); ASSERT_UNCHANGED (nm_setting_ip_config_remove_route (s_ip4, 1));
g_test_assert_expected_messages (); g_test_assert_expected_messages ();
nm_setting_ip4_config_add_route (s_ip4, route); nm_setting_ip_config_add_route (s_ip4, route);
ASSERT_CHANGED (nm_setting_ip4_config_clear_routes (s_ip4)); ASSERT_CHANGED (nm_setting_ip_config_clear_routes (s_ip4));
nm_ip_address_unref (addr); nm_ip_address_unref (addr);
nm_ip_route_unref (route); nm_ip_route_unref (route);
@ -2515,7 +2515,7 @@ test_setting_ip6_changed_signal (void)
{ {
NMConnection *connection; NMConnection *connection;
gboolean changed = FALSE; gboolean changed = FALSE;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
NMIPAddress *addr; NMIPAddress *addr;
NMIPRoute *route; NMIPRoute *route;
GError *error = NULL; GError *error = NULL;
@ -2526,54 +2526,54 @@ test_setting_ip6_changed_signal (void)
(GCallback) test_connection_changed_cb, (GCallback) test_connection_changed_cb,
&changed); &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)); 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_ip_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_remove_dns (s_ip6, 0));
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns->len*");
ASSERT_UNCHANGED (nm_setting_ip6_config_remove_dns (s_ip6, 1)); ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns (s_ip6, 1));
g_test_assert_expected_messages (); g_test_assert_expected_messages ();
nm_setting_ip6_config_add_dns (s_ip6, "1:2:3::4:5:6"); nm_setting_ip_config_add_dns (s_ip6, "1:2:3::4:5:6");
ASSERT_CHANGED (nm_setting_ip6_config_clear_dns (s_ip6)); 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_ip_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_remove_dns_search (s_ip6, 0));
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns_search->len*");
ASSERT_UNCHANGED (nm_setting_ip6_config_remove_dns_search (s_ip6, 1)); ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns_search (s_ip6, 1));
g_test_assert_expected_messages (); g_test_assert_expected_messages ();
nm_setting_ip6_config_add_dns_search (s_ip6, "foobar.com"); nm_setting_ip_config_add_dns_search (s_ip6, "foobar.com");
ASSERT_CHANGED (nm_setting_ip6_config_clear_dns_searches (s_ip6)); 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); addr = nm_ip_address_new (AF_INET6, "1:2:3::4:5:6", 64, NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
ASSERT_CHANGED (nm_setting_ip6_config_add_address (s_ip6, addr)); ASSERT_CHANGED (nm_setting_ip_config_add_address (s_ip6, addr));
ASSERT_CHANGED (nm_setting_ip6_config_remove_address (s_ip6, 0)); ASSERT_CHANGED (nm_setting_ip_config_remove_address (s_ip6, 0));
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->addresses->len*");
ASSERT_UNCHANGED (nm_setting_ip6_config_remove_address (s_ip6, 1)); ASSERT_UNCHANGED (nm_setting_ip_config_remove_address (s_ip6, 1));
g_test_assert_expected_messages (); g_test_assert_expected_messages ();
nm_setting_ip6_config_add_address (s_ip6, addr); nm_setting_ip_config_add_address (s_ip6, addr);
ASSERT_CHANGED (nm_setting_ip6_config_clear_addresses (s_ip6)); 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); route = nm_ip_route_new (AF_INET6, "1:2:3::4:5:6", 128, NULL, 0, &error);
g_assert_no_error (error); g_assert_no_error (error);
ASSERT_CHANGED (nm_setting_ip6_config_add_route (s_ip6, route)); ASSERT_CHANGED (nm_setting_ip_config_add_route (s_ip6, route));
ASSERT_CHANGED (nm_setting_ip6_config_remove_route (s_ip6, 0)); ASSERT_CHANGED (nm_setting_ip_config_remove_route (s_ip6, 0));
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->routes->len*");
ASSERT_UNCHANGED (nm_setting_ip6_config_remove_route (s_ip6, 1)); ASSERT_UNCHANGED (nm_setting_ip_config_remove_route (s_ip6, 1));
g_test_assert_expected_messages (); g_test_assert_expected_messages ();
nm_setting_ip6_config_add_route (s_ip6, route); nm_setting_ip_config_add_route (s_ip6, route);
ASSERT_CHANGED (nm_setting_ip6_config_clear_routes (s_ip6)); ASSERT_CHANGED (nm_setting_ip_config_clear_routes (s_ip6));
nm_ip_address_unref (addr); nm_ip_address_unref (addr);
nm_ip_route_unref (route); nm_ip_route_unref (route);
@ -2834,12 +2834,12 @@ test_connection_normalize_virtual_iface_name (void)
nm_connection_add_setting (con, nm_connection_add_setting (con,
g_object_new (NM_TYPE_SETTING_IP4_CONFIG, 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)); NULL));
nm_connection_add_setting (con, nm_connection_add_setting (con,
g_object_new (NM_TYPE_SETTING_IP6_CONFIG, 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)); NULL));
s_vlan = nm_connection_get_setting_vlan (con); s_vlan = nm_connection_get_setting_vlan (con);

View file

@ -125,7 +125,7 @@ make_tls_connection (const char *detail, NMSetting8021xCKScheme scheme)
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (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);
ASSERT (nm_connection_verify (connection, &error) == TRUE, ASSERT (nm_connection_verify (connection, &error) == TRUE,
detail, "failed to verify connection: %s", 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 (); s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (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);
ASSERT (nm_connection_verify (connection, &error) == TRUE, ASSERT (nm_connection_verify (connection, &error) == TRUE,
detail, "failed to verify connection: %s", detail, "failed to verify connection: %s",

View file

@ -551,74 +551,45 @@ global:
nm_setting_infiniband_get_type; nm_setting_infiniband_get_type;
nm_setting_infiniband_get_virtual_interface_name; nm_setting_infiniband_get_virtual_interface_name;
nm_setting_infiniband_new; 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_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_get_type;
nm_setting_ip4_config_new; 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_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_get_type;
nm_setting_ip6_config_new; nm_setting_ip6_config_new;
nm_setting_ip6_config_privacy_get_type; nm_setting_ip6_config_privacy_get_type;
nm_setting_ip6_config_remove_address; nm_setting_ip_config_add_address;
nm_setting_ip6_config_remove_address_by_value; nm_setting_ip_config_add_dns;
nm_setting_ip6_config_remove_dns; nm_setting_ip_config_add_dns_search;
nm_setting_ip6_config_remove_dns_by_value; nm_setting_ip_config_add_route;
nm_setting_ip6_config_remove_dns_search; nm_setting_ip_config_clear_addresses;
nm_setting_ip6_config_remove_dns_search_by_value; nm_setting_ip_config_clear_dns;
nm_setting_ip6_config_remove_route; nm_setting_ip_config_clear_dns_searches;
nm_setting_ip6_config_remove_route_by_value; 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_lookup_type;
nm_setting_olpc_mesh_get_channel; nm_setting_olpc_mesh_get_channel;
nm_setting_olpc_mesh_get_dhcp_anycast_address; nm_setting_olpc_mesh_get_dhcp_anycast_address;

View file

@ -59,6 +59,7 @@ libnm-core/nm-setting-connection.c
libnm-core/nm-setting-dcb.c libnm-core/nm-setting-dcb.c
libnm-core/nm-setting-gsm.c libnm-core/nm-setting-gsm.c
libnm-core/nm-setting-infiniband.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-ip4-config.c
libnm-core/nm-setting-ip6-config.c libnm-core/nm-setting-ip6-config.c
libnm-core/nm-setting-olpc-mesh.c libnm-core/nm-setting-olpc-mesh.c

View file

@ -1212,8 +1212,7 @@ nm_utils_get_ip_config_method (NMConnection *connection,
GType ip_setting_type) GType ip_setting_type)
{ {
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4, *s_ip6;
NMSettingIP6Config *s_ip6;
const char *method; const char *method;
s_con = nm_connection_get_setting_connection (connection); s_con = nm_connection_get_setting_connection (connection);
@ -1226,7 +1225,7 @@ nm_utils_get_ip_config_method (NMConnection *connection,
else { else {
s_ip4 = nm_connection_get_setting_ip4_config (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_return_val_if_fail (s_ip4 != NULL, NM_SETTING_IP4_CONFIG_METHOD_AUTO); 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); g_return_val_if_fail (method != NULL, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
return method; return method;
@ -1240,7 +1239,7 @@ nm_utils_get_ip_config_method (NMConnection *connection,
else { else {
s_ip6 = nm_connection_get_setting_ip6_config (connection); s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_return_val_if_fail (s_ip6 != NULL, NM_SETTING_IP6_CONFIG_METHOD_AUTO); 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); g_return_val_if_fail (method != NULL, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
return method; return method;
@ -1387,12 +1386,12 @@ check_ip6_method (NMConnection *orig,
{ {
GHashTable *props; GHashTable *props;
const char *orig_ip6_method, *candidate_ip6_method; const char *orig_ip6_method, *candidate_ip6_method;
NMSettingIP6Config *candidate_ip6; NMSettingIPConfig *candidate_ip6;
gboolean allow = FALSE; gboolean allow = FALSE;
props = check_property_in_hash (settings, props = check_property_in_hash (settings,
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_METHOD); NM_SETTING_IP_CONFIG_METHOD);
if (!props) if (!props)
return TRUE; return TRUE;
@ -1408,7 +1407,7 @@ check_ip6_method (NMConnection *orig,
if ( strcmp (orig_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0 if ( strcmp (orig_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0
&& strcmp (candidate_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 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; allow = TRUE;
} }
@ -1425,7 +1424,7 @@ check_ip6_method (NMConnection *orig,
if (allow) { if (allow) {
remove_from_hash (settings, props, remove_from_hash (settings, props,
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_METHOD); NM_SETTING_IP_CONFIG_METHOD);
} }
return allow; return allow;
} }
@ -1438,11 +1437,11 @@ check_ip4_method (NMConnection *orig,
{ {
GHashTable *props; GHashTable *props;
const char *orig_ip4_method, *candidate_ip4_method; const char *orig_ip4_method, *candidate_ip4_method;
NMSettingIP4Config *candidate_ip4; NMSettingIPConfig *candidate_ip4;
props = check_property_in_hash (settings, props = check_property_in_hash (settings,
NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_METHOD); NM_SETTING_IP_CONFIG_METHOD);
if (!props) if (!props)
return TRUE; return TRUE;
@ -1457,11 +1456,11 @@ check_ip4_method (NMConnection *orig,
if ( strcmp (orig_ip4_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0 if ( strcmp (orig_ip4_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0
&& strcmp (candidate_ip4_method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 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)) { && (device_has_carrier == FALSE)) {
remove_from_hash (settings, props, remove_from_hash (settings, props,
NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_METHOD); NM_SETTING_IP_CONFIG_METHOD);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;

View file

@ -211,16 +211,16 @@ pan_connection_check_create (NMBluezDevice *self)
/* Setting: IPv4 */ /* Setting: IPv4 */
setting = nm_setting_ip4_config_new (); setting = nm_setting_ip4_config_new ();
g_object_set (G_OBJECT (setting), g_object_set (G_OBJECT (setting),
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_MAY_FAIL, FALSE, NM_SETTING_IP_CONFIG_MAY_FAIL, FALSE,
NULL); NULL);
nm_connection_add_setting (connection, setting); nm_connection_add_setting (connection, setting);
/* Setting: IPv6 */ /* Setting: IPv6 */
setting = nm_setting_ip6_config_new (); setting = nm_setting_ip6_config_new ();
g_object_set (G_OBJECT (setting), g_object_set (G_OBJECT (setting),
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_MAY_FAIL, TRUE, NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL); NULL);
nm_connection_add_setting (connection, setting); nm_connection_add_setting (connection, setting);

View file

@ -21,6 +21,7 @@
#include "config.h" #include "config.h"
#include <string.h> #include <string.h>
#include <arpa/inet.h>
#include "nm-device-gre.h" #include "nm-device-gre.h"
#include "nm-device-private.h" #include "nm-device-private.h"

View file

@ -2106,8 +2106,7 @@ gboolean
nm_device_ip_config_should_fail (NMDevice *self, gboolean ip6) nm_device_ip_config_should_fail (NMDevice *self, gboolean ip6)
{ {
NMConnection *connection; NMConnection *connection;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4, *s_ip6;
NMSettingIP6Config *s_ip6;
g_return_val_if_fail (self != NULL, TRUE); 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 */ /* Fail the connection if the failed IP method is required to complete */
if (ip6) { if (ip6) {
s_ip6 = nm_connection_get_setting_ip6_config (connection); 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; return TRUE;
} else { } else {
s_ip4 = nm_connection_get_setting_ip4_config (connection); 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; return TRUE;
} }
@ -2778,7 +2777,7 @@ dhcp4_start (NMDevice *self,
NMDeviceStateReason *reason) NMDeviceStateReason *reason)
{ {
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
const guint8 *hw_addr; const guint8 *hw_addr;
size_t hw_addr_len = 0; size_t hw_addr_len = 0;
GByteArray *tmp = NULL; GByteArray *tmp = NULL;
@ -2804,9 +2803,9 @@ dhcp4_start (NMDevice *self,
tmp, tmp,
nm_connection_get_uuid (connection), nm_connection_get_uuid (connection),
nm_device_get_priority (self), nm_device_get_priority (self),
nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4), nm_setting_ip_config_get_dhcp_send_hostname (s_ip4),
nm_setting_ip4_config_get_dhcp_hostname (s_ip4), nm_setting_ip_config_get_dhcp_hostname (s_ip4),
nm_setting_ip4_config_get_dhcp_client_id (s_ip4), nm_setting_ip4_config_get_dhcp_client_id (NM_SETTING_IP4_CONFIG (s_ip4)),
priv->dhcp_timeout, priv->dhcp_timeout,
priv->dhcp_anycast_address); priv->dhcp_anycast_address);
@ -2864,16 +2863,16 @@ release_shared_ip (gpointer data)
} }
static gboolean 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)) if (G_UNLIKELY (shared_ips == NULL))
shared_ips = g_hash_table_new (g_direct_hash, g_direct_equal); shared_ips = g_hash_table_new (g_direct_hash, g_direct_equal);
memset (address, 0, sizeof (*address)); 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 */ /* 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); g_assert (user);
nm_ip_address_get_address_binary (user, &address->address); nm_ip_address_get_address_binary (user, &address->address);
@ -2964,8 +2963,7 @@ connection_ip6_method_requires_carrier (NMConnection *connection,
static gboolean static gboolean
connection_requires_carrier (NMConnection *connection) connection_requires_carrier (NMConnection *connection)
{ {
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4, *s_ip6;
NMSettingIP6Config *s_ip6;
gboolean ip4_carrier_wanted, ip6_carrier_wanted; gboolean ip4_carrier_wanted, ip6_carrier_wanted;
gboolean ip4_used = FALSE, ip6_used = FALSE; gboolean ip4_used = FALSE, ip6_used = FALSE;
@ -2975,7 +2973,7 @@ connection_requires_carrier (NMConnection *connection)
* requires a carrier regardless of the IPv6 method. * requires a carrier regardless of the IPv6 method.
*/ */
s_ip4 = nm_connection_get_setting_ip4_config (connection); 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; return TRUE;
} }
@ -2985,7 +2983,7 @@ connection_requires_carrier (NMConnection *connection)
* requires a carrier regardless of the IPv4 method. * requires a carrier regardless of the IPv4 method.
*/ */
s_ip6 = nm_connection_get_setting_ip6_config (connection); 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; return TRUE;
} }
@ -3320,7 +3318,7 @@ dhcp6_start (NMDevice *self,
guint32 dhcp_opt, guint32 dhcp_opt,
NMDeviceStateReason *reason) NMDeviceStateReason *reason)
{ {
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE; NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
GByteArray *tmp = NULL; GByteArray *tmp = NULL;
@ -3358,11 +3356,11 @@ dhcp6_start (NMDevice *self,
tmp, tmp,
nm_connection_get_uuid (connection), nm_connection_get_uuid (connection),
nm_device_get_priority (self), 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_timeout,
priv->dhcp_anycast_address, priv->dhcp_anycast_address,
(dhcp_opt == NM_RDISC_DHCP_LEVEL_OTHERCONF) ? TRUE : FALSE, (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) if (tmp)
g_byte_array_free (tmp, TRUE); g_byte_array_free (tmp, TRUE);
@ -3373,8 +3371,8 @@ dhcp6_start (NMDevice *self,
self); self);
s_ip6 = nm_connection_get_setting_ip6_config (connection); 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) ||
!strcmp (nm_setting_ip6_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_DHCP)) !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); nm_device_add_pending_action (self, PENDING_ACTION_DHCP6, TRUE);
/* DHCP devices will be notified by the DHCP manager when stuff happens */ /* 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; priv->rdisc_use_tempaddr = use_tempaddr;
print_support_extended_ifa_flags (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); nm_device_add_pending_action (self, PENDING_ACTION_AUTOCONF6, TRUE);
/* ensure link local is ready... */ /* ensure link local is ready... */
@ -4116,10 +4114,10 @@ act_stage3_ip6_config_start (NMDevice *self,
*/ */
ip6_privacy = ip6_use_tempaddr (); ip6_privacy = ip6_use_tempaddr ();
if (ip6_privacy == NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN) { 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) 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); 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 }; 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; int ip_arg = G_N_ELEMENTS (argv) - 2;
NMConnection *connection; NMConnection *connection;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
int i, num; int i, num;
NMIPAddress *addr; NMIPAddress *addr;
GError *error = NULL; GError *error = NULL;
@ -4659,7 +4657,7 @@ send_arps (NMDevice *self, const char *mode_arg)
s_ip4 = nm_connection_get_setting_ip4_config (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (!s_ip4) if (!s_ip4)
return; return;
num = nm_setting_ip4_config_get_num_addresses (s_ip4); num = nm_setting_ip_config_get_num_addresses (s_ip4);
if (num == 0) if (num == 0)
return; return;
@ -4671,7 +4669,7 @@ send_arps (NMDevice *self, const char *mode_arg)
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
gs_free char *tmp_str = NULL; 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); argv[ip_arg] = nm_ip_address_get_address (addr);
_LOGD (LOGD_DEVICE | LOGD_IP4, _LOGD (LOGD_DEVICE | LOGD_IP4,
@ -4719,7 +4717,7 @@ arp_announce (NMDevice *self)
{ {
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
NMConnection *connection; NMConnection *connection;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
int num; int num;
arp_cleanup (self); arp_cleanup (self);
@ -4733,7 +4731,7 @@ arp_announce (NMDevice *self)
s_ip4 = nm_connection_get_setting_ip4_config (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (!s_ip4) if (!s_ip4)
return; return;
num = nm_setting_ip4_config_get_num_addresses (s_ip4); num = nm_setting_ip_config_get_num_addresses (s_ip4);
if (num == 0) if (num == 0)
return; return;

View file

@ -2809,14 +2809,14 @@ act_stage3_ip4_config_start (NMDevice *device,
NMDeviceStateReason *reason) NMDeviceStateReason *reason)
{ {
NMConnection *connection; NMConnection *connection;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
const char *method = NM_SETTING_IP4_CONFIG_METHOD_AUTO; const char *method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
connection = nm_device_get_connection (device); connection = nm_device_get_connection (device);
g_assert (connection); g_assert (connection);
s_ip4 = nm_connection_get_setting_ip4_config (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4) 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 */ /* Indicate that a critical protocol is about to start */
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0) if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0)
@ -2831,14 +2831,14 @@ act_stage3_ip6_config_start (NMDevice *device,
NMDeviceStateReason *reason) NMDeviceStateReason *reason)
{ {
NMConnection *connection; NMConnection *connection;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
const char *method = NM_SETTING_IP6_CONFIG_METHOD_AUTO; const char *method = NM_SETTING_IP6_CONFIG_METHOD_AUTO;
connection = nm_device_get_connection (device); connection = nm_device_get_connection (device);
g_assert (connection); g_assert (connection);
s_ip6 = nm_connection_get_setting_ip6_config (connection); s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (s_ip6) 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 */ /* Indicate that a critical protocol is about to start */
if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0 || 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) act_stage4_ip4_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
{ {
NMConnection *connection; NMConnection *connection;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
gboolean may_fail = FALSE, chain_up = FALSE; gboolean may_fail = FALSE, chain_up = FALSE;
NMActStageReturn ret; NMActStageReturn ret;
@ -2946,7 +2946,7 @@ act_stage4_ip4_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
g_assert (connection); g_assert (connection);
s_ip4 = nm_connection_get_setting_ip4_config (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); ret = handle_ip_config_timeout (NM_DEVICE_WIFI (device), connection, may_fail, &chain_up, reason);
if (chain_up) if (chain_up)
@ -2959,7 +2959,7 @@ static NMActStageReturn
act_stage4_ip6_config_timeout (NMDevice *device, NMDeviceStateReason *reason) act_stage4_ip6_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
{ {
NMConnection *connection; NMConnection *connection;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
gboolean may_fail = FALSE, chain_up = FALSE; gboolean may_fail = FALSE, chain_up = FALSE;
NMActStageReturn ret; NMActStageReturn ret;
@ -2967,7 +2967,7 @@ act_stage4_ip6_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
g_assert (connection); g_assert (connection);
s_ip6 = nm_connection_get_setting_ip6_config (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); ret = handle_ip_config_timeout (NM_DEVICE_WIFI (device), connection, may_fail, &chain_up, reason);
if (chain_up) if (chain_up)

View file

@ -20,6 +20,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <string.h> #include <string.h>
#include <arpa/inet.h>
#include <libmm-glib.h> #include <libmm-glib.h>
#include "nm-modem-broadband.h" #include "nm-modem-broadband.h"

View file

@ -235,26 +235,25 @@ nm_modem_get_connection_ip_type (NMModem *self,
GError **error) GError **error)
{ {
NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self); NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4, *s_ip6;
NMSettingIP6Config *s_ip6;
const char *method; const char *method;
gboolean ip4 = TRUE, ip6 = TRUE; gboolean ip4 = TRUE, ip6 = TRUE;
gboolean ip4_may_fail = TRUE, ip6_may_fail = TRUE; gboolean ip4_may_fail = TRUE, ip6_may_fail = TRUE;
s_ip4 = nm_connection_get_setting_ip4_config (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4) { 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) if (g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0)
ip4 = FALSE; 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); s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (s_ip6) { 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) if (g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0)
ip6 = FALSE; 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) { if (ip4 && !ip6) {

View file

@ -23,6 +23,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <arpa/inet.h>
#include "nm-dhcp-dhclient-utils.h" #include "nm-dhcp-dhclient-utils.h"
#include "nm-ip4-config.h" #include "nm-ip4-config.h"

View file

@ -22,6 +22,7 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <arpa/inet.h>
#include "nm-logging.h" #include "nm-logging.h"
#include "nm-dhcp-utils.h" #include "nm-dhcp-utils.h"

View file

@ -21,6 +21,7 @@
#include <glib.h> #include <glib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <arpa/inet.h>
#include "nm-dhcp-dhclient-utils.h" #include "nm-dhcp-dhclient-utils.h"
#include "nm-utils.h" #include "nm-utils.h"

View file

@ -20,6 +20,7 @@
*/ */
#include <string.h> #include <string.h>
#include <arpa/inet.h>
#include "nm-ip4-config.h" #include "nm-ip4-config.h"
@ -296,7 +297,7 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex)
} }
void 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; guint naddresses, nroutes, nnameservers, nsearches;
int i; int i;
@ -304,20 +305,22 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
if (!setting) if (!setting)
return; return;
g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
g_object_freeze_notify (G_OBJECT (config)); g_object_freeze_notify (G_OBJECT (config));
naddresses = nm_setting_ip4_config_get_num_addresses (setting); naddresses = nm_setting_ip_config_get_num_addresses (setting);
nroutes = nm_setting_ip4_config_get_num_routes (setting); nroutes = nm_setting_ip_config_get_num_routes (setting);
nnameservers = nm_setting_ip4_config_get_num_dns (setting); nnameservers = nm_setting_ip_config_get_num_dns (setting);
nsearches = nm_setting_ip4_config_get_num_dns_searches (setting); nsearches = nm_setting_ip_config_get_num_dns_searches (setting);
/* Gateway */ /* 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); 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); nm_ip4_config_set_never_default (config, FALSE);
for (i = 0; i < naddresses; i++) { 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; guint32 gateway;
if (gateway_str) { if (gateway_str) {
@ -329,7 +332,7 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
/* Addresses */ /* Addresses */
for (i = 0; i < naddresses; i++) { 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; GVariant *label;
NMPlatformIP4Address address; NMPlatformIP4Address address;
@ -348,10 +351,10 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
} }
/* Routes */ /* 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); nm_ip4_config_reset_routes (config);
for (i = 0; i < nroutes; i++) { 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; NMPlatformIP4Route route;
memset (&route, 0, sizeof (route)); memset (&route, 0, sizeof (route));
@ -367,7 +370,7 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
} }
/* DNS */ /* 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_nameservers (config);
nm_ip4_config_reset_domains (config); nm_ip4_config_reset_domains (config);
nm_ip4_config_reset_searches (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++) { for (i = 0; i < nnameservers; i++) {
guint32 ip; 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); nm_ip4_config_add_nameserver (config, ip);
} }
for (i = 0; i < nsearches; i++) 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)); g_object_thaw_notify (G_OBJECT (config));
} }
@ -387,17 +390,17 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
NMSetting * NMSetting *
nm_ip4_config_create_setting (const NMIP4Config *config) nm_ip4_config_create_setting (const NMIP4Config *config)
{ {
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
guint32 gateway; guint32 gateway;
guint naddresses, nroutes, nnameservers, nsearches; guint naddresses, nroutes, nnameservers, nsearches;
const char *method = NULL; const char *method = NULL;
int i; 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) { if (!config) {
g_object_set (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); NULL);
return NM_SETTING (s_ip4); return NM_SETTING (s_ip4);
} }
@ -433,14 +436,14 @@ nm_ip4_config_create_setting (const NMIP4Config *config)
if (*address->label) if (*address->label)
nm_ip_address_set_attribute (s_addr, "label", g_variant_new_string (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); nm_ip_address_unref (s_addr);
} }
/* Use 'disabled' if the method wasn't previously set */ /* Use 'disabled' if the method wasn't previously set */
if (!method) if (!method)
method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED; 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 */ /* Routes */
for (i = 0; i < nroutes; i++) { for (i = 0; i < nroutes; i++) {
@ -459,7 +462,7 @@ nm_ip4_config_create_setting (const NMIP4Config *config)
&route->network, route->plen, &route->network, route->plen,
&route->gateway, route->metric, &route->gateway, route->metric,
NULL); 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); nm_ip_route_unref (s_route);
} }
@ -467,12 +470,12 @@ nm_ip4_config_create_setting (const NMIP4Config *config)
for (i = 0; i < nnameservers; i++) { for (i = 0; i < nnameservers; i++) {
guint32 nameserver = nm_ip4_config_get_nameserver (config, 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++) { for (i = 0; i < nsearches; i++) {
const char *search = nm_ip4_config_get_search (config, 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); return NM_SETTING (s_ip4);

View file

@ -61,7 +61,7 @@ const char * nm_ip4_config_get_dbus_path (const NMIP4Config *config);
/* Integration with nm-platform and nm-setting */ /* Integration with nm-platform and nm-setting */
NMIP4Config *nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf); NMIP4Config *nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf);
gboolean nm_ip4_config_commit (const NMIP4Config *config, int ifindex); 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); NMSetting *nm_ip4_config_create_setting (const NMIP4Config *config);
/* Utility functions */ /* Utility functions */

View file

@ -20,6 +20,7 @@
*/ */
#include <string.h> #include <string.h>
#include <arpa/inet.h>
#include "nm-ip6-config.h" #include "nm-ip6-config.h"
@ -400,7 +401,7 @@ nm_ip6_config_commit (const NMIP6Config *config, int ifindex)
} }
void 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; guint naddresses, nroutes, nnameservers, nsearches;
int i; int i;
@ -408,20 +409,22 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
if (!setting) if (!setting)
return; return;
naddresses = nm_setting_ip6_config_get_num_addresses (setting); g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
nroutes = nm_setting_ip6_config_get_num_routes (setting);
nnameservers = nm_setting_ip6_config_get_num_dns (setting); naddresses = nm_setting_ip_config_get_num_addresses (setting);
nsearches = nm_setting_ip6_config_get_num_dns_searches (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)); g_object_freeze_notify (G_OBJECT (config));
/* Gateway */ /* 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); 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); nm_ip6_config_set_never_default (config, FALSE);
for (i = 0; i < naddresses; i++) { 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; struct in6_addr gateway;
if (gateway_str) { if (gateway_str) {
@ -433,7 +436,7 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
/* Addresses */ /* Addresses */
for (i = 0; i < naddresses; i++) { 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; NMPlatformIP6Address address;
memset (&address, 0, sizeof (address)); memset (&address, 0, sizeof (address));
@ -447,10 +450,10 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
} }
/* Routes */ /* 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); nm_ip6_config_reset_routes (config);
for (i = 0; i < nroutes; i++) { 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; NMPlatformIP6Route route;
memset (&route, 0, sizeof (route)); memset (&route, 0, sizeof (route));
@ -466,7 +469,7 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
} }
/* DNS */ /* 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_nameservers (config);
nm_ip6_config_reset_domains (config); nm_ip6_config_reset_domains (config);
nm_ip6_config_reset_searches (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++) { for (i = 0; i < nnameservers; i++) {
struct in6_addr ip; 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); nm_ip6_config_add_nameserver (config, &ip);
} }
for (i = 0; i < nsearches; i++) 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)); g_object_thaw_notify (G_OBJECT (config));
} }
@ -486,17 +489,17 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
NMSetting * NMSetting *
nm_ip6_config_create_setting (const NMIP6Config *config) nm_ip6_config_create_setting (const NMIP6Config *config)
{ {
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
const struct in6_addr *gateway; const struct in6_addr *gateway;
guint naddresses, nroutes, nnameservers, nsearches; guint naddresses, nroutes, nnameservers, nsearches;
const char *method = NULL; const char *method = NULL;
int i; 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) { if (!config) {
g_object_set (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); NULL);
return NM_SETTING (s_ip6); return NM_SETTING (s_ip6);
} }
@ -530,14 +533,14 @@ nm_ip6_config_create_setting (const NMIP6Config *config)
method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL; method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
s_addr = nm_ip_address_new_binary (AF_INET6, &address->address, address->plen, gateway, NULL); 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); nm_ip_address_unref (s_addr);
} }
/* Use 'ignore' if the method wasn't previously set */ /* Use 'ignore' if the method wasn't previously set */
if (!method) if (!method)
method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE; 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 */ /* Routes */
for (i = 0; i < nroutes; i++) { for (i = 0; i < nroutes; i++) {
@ -560,7 +563,7 @@ nm_ip6_config_create_setting (const NMIP6Config *config)
&route->network, route->plen, &route->network, route->plen,
&route->gateway, route->metric, &route->gateway, route->metric,
NULL); 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); nm_ip_route_unref (s_route);
} }
@ -568,12 +571,12 @@ nm_ip6_config_create_setting (const NMIP6Config *config)
for (i = 0; i < nnameservers; i++) { for (i = 0; i < nnameservers; i++) {
const struct in6_addr *nameserver = nm_ip6_config_get_nameserver (config, 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++) { for (i = 0; i < nsearches; i++) {
const char *search = nm_ip6_config_get_search (config, 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); return NM_SETTING (s_ip6);

View file

@ -22,6 +22,7 @@
#define __NETWORKMANAGER_IP6_CONFIG_H__ #define __NETWORKMANAGER_IP6_CONFIG_H__
#include <glib-object.h> #include <glib-object.h>
#include <netinet/in.h>
#include "nm-types.h" #include "nm-types.h"
#include "nm-setting-ip6-config.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 */ /* Integration with nm-platform and nm-setting */
NMIP6Config *nm_ip6_config_capture (int ifindex, gboolean capture_resolv_conf, NMSettingIP6ConfigPrivacy use_temporary); NMIP6Config *nm_ip6_config_capture (int ifindex, gboolean capture_resolv_conf, NMSettingIP6ConfigPrivacy use_temporary);
gboolean nm_ip6_config_commit (const NMIP6Config *config, int ifindex); 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); NMSetting *nm_ip6_config_create_setting (const NMIP6Config *config);
/* Utility functions */ /* Utility functions */

View file

@ -110,7 +110,7 @@ get_best_ip4_device (NMPolicy *self, gboolean fully_activated)
NMDeviceState state = nm_device_get_state (dev); NMDeviceState state = nm_device_get_state (dev);
NMActRequest *req; NMActRequest *req;
NMConnection *connection; NMConnection *connection;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
int prio; int prio;
const char *method = NULL; 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 */ /* 'never-default' devices can't ever be the default */
s_ip4 = nm_connection_get_setting_ip4_config (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4); 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; continue;
prio = nm_device_get_priority (dev); 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); NMDeviceState state = nm_device_get_state (dev);
NMActRequest *req; NMActRequest *req;
NMConnection *connection; NMConnection *connection;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
int prio; int prio;
const char *method = NULL; 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); s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6); 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; continue;
prio = nm_device_get_priority (dev); prio = nm_device_get_priority (dev);
@ -539,7 +539,7 @@ get_best_ip4_config (NMPolicy *policy,
NMVpnConnection *candidate; NMVpnConnection *candidate;
NMIP4Config *vpn_ip4; NMIP4Config *vpn_ip4;
NMConnection *tmp; NMConnection *tmp;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMVpnConnectionState vpn_state; NMVpnConnectionState vpn_state;
if (!NM_IS_VPN_CONNECTION (active)) if (!NM_IS_VPN_CONNECTION (active))
@ -565,7 +565,7 @@ get_best_ip4_config (NMPolicy *policy,
/* Check the user's preference from the NMConnection */ /* Check the user's preference from the NMConnection */
s_ip4 = nm_connection_get_setting_ip4_config (tmp); 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; continue;
} }
@ -751,7 +751,7 @@ get_best_ip6_config (NMPolicy *policy,
NMVpnConnection *candidate; NMVpnConnection *candidate;
NMIP6Config *vpn_ip6; NMIP6Config *vpn_ip6;
NMConnection *tmp; NMConnection *tmp;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
NMVpnConnectionState vpn_state; NMVpnConnectionState vpn_state;
if (!NM_IS_VPN_CONNECTION (active)) if (!NM_IS_VPN_CONNECTION (active))
@ -777,7 +777,7 @@ get_best_ip6_config (NMPolicy *policy,
/* Check the user's preference from the NMConnection */ /* Check the user's preference from the NMConnection */
s_ip6 = nm_connection_get_setting_ip6_config (tmp); 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; continue;
} }

View file

@ -267,7 +267,7 @@ ip4_setting_add_from_block (const GPtrArray *block,
NMConnection *connection, NMConnection *connection,
GError **error) GError **error)
{ {
NMSettingIP4Config *s_ip4 = NULL; NMSettingIPConfig *s_ip4 = NULL;
NMIPAddress *addr; NMIPAddress *addr;
const char *s_method = NULL; const char *s_method = NULL;
const char *s_ipaddr = NULL; const char *s_ipaddr = NULL;
@ -296,10 +296,10 @@ ip4_setting_add_from_block (const GPtrArray *block,
goto error; 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")) { 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; goto success;
} else if (g_ascii_strcasecmp (s_method, "static") != 0) { } else if (g_ascii_strcasecmp (s_method, "static") != 0) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, 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 */ /* 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 */ /* IP address */
if (!s_ipaddr || !nm_utils_ipaddr_valid (AF_INET, s_ipaddr)) { 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; 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); nm_ip_address_unref (addr);
if (s_dns1) 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) if (s_dns2)
nm_setting_ip4_config_add_dns (s_ip4, s_dns2); nm_setting_ip_config_add_dns (s_ip4, s_dns2);
success: success:
nm_connection_add_setting (connection, NM_SETTING (s_ip4)); nm_connection_add_setting (connection, NM_SETTING (s_ip4));

View file

@ -71,7 +71,7 @@ test_read_ibft_dhcp (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWired *s_wired; NMSettingWired *s_wired;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
GError *error = NULL; GError *error = NULL;
const char *mac_address; const char *mac_address;
const char *expected_mac_address = "00:33:21:98:b9:f1"; const char *expected_mac_address = "00:33:21:98:b9:f1";
@ -105,7 +105,7 @@ test_read_ibft_dhcp (void)
/* ===== IPv4 SETTING ===== */ /* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4); 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); g_object_unref (connection);
} }
@ -116,7 +116,7 @@ test_read_ibft_static (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWired *s_wired; NMSettingWired *s_wired;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
GError *error = NULL; GError *error = NULL;
const char *mac_address; const char *mac_address;
const char *expected_mac_address = "00:33:21:98:b9:f0"; const char *expected_mac_address = "00:33:21:98:b9:f0";
@ -151,14 +151,14 @@ test_read_ibft_static (void)
/* ===== IPv4 SETTING ===== */ /* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4); 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_cmpint (nm_setting_ip_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_ip_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_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); g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 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 (ip4_addr);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.32.72"); 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); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 22);
@ -217,7 +217,7 @@ test_read_ibft_vlan (void)
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWired *s_wired; NMSettingWired *s_wired;
NMSettingVlan *s_vlan; NMSettingVlan *s_vlan;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
const char *mac_address; const char *mac_address;
const char *expected_mac_address = "00:33:21:98:b9:f0"; const char *expected_mac_address = "00:33:21:98:b9:f0";
NMIPAddress *ip4_addr; NMIPAddress *ip4_addr;
@ -250,12 +250,12 @@ test_read_ibft_vlan (void)
/* ===== IPv4 SETTING ===== */ /* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4); 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); g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 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 (ip4_addr);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.6.200"); 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); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24);

View file

@ -540,7 +540,7 @@ out:
} }
static gboolean 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; char *contents = NULL;
gsize len = 0; gsize len = 0;
@ -670,7 +670,7 @@ read_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError
g_free (next_hop); g_free (next_hop);
goto error; 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"); PARSE_WARNING ("duplicate IP4 route");
} }
@ -771,7 +771,7 @@ error:
#define IPV6_ADDR_REGEX "[0-9A-Fa-f:.]+" #define IPV6_ADDR_REGEX "[0-9A-Fa-f:.]+"
static gboolean 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; char *contents = NULL;
gsize len = 0; gsize len = 0;
@ -898,7 +898,7 @@ read_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **erro
g_free (next_hop); g_free (next_hop);
if (!route) if (!route)
goto error; 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"); PARSE_WARNING ("duplicate IP6 route");
} }
@ -923,7 +923,7 @@ make_ip4_setting (shvarFile *ifcfg,
const char *network_file, const char *network_file,
GError **error) GError **error)
{ {
NMSettingIP4Config *s_ip4 = NULL; NMSettingIPConfig *s_ip4 = NULL;
char *value = NULL; char *value = NULL;
char *route_path = NULL; char *route_path = NULL;
char *method; char *method;
@ -932,7 +932,7 @@ make_ip4_setting (shvarFile *ifcfg,
shvarFile *route_ifcfg; shvarFile *route_ifcfg;
gboolean never_default = FALSE; 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 /* First check if DEFROUTE is set for this device; DEFROUTE has the
* opposite meaning from never-default. The default if DEFROUTE is not * 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")) { } else if (!g_ascii_strcasecmp (value, "autoip")) {
g_free (value); g_free (value);
g_object_set (s_ip4, g_object_set (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,
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default, NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default,
NULL); NULL);
return NM_SETTING (s_ip4); return NM_SETTING (s_ip4);
} else if (!g_ascii_strcasecmp (value, "shared")) { } else if (!g_ascii_strcasecmp (value, "shared")) {
g_free (value); g_free (value);
g_object_set (s_ip4, g_object_set (s_ip4,
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_SHARED, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_SHARED,
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default, NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default,
NULL); NULL);
return NM_SETTING (s_ip4); return NM_SETTING (s_ip4);
} else { } else {
@ -995,11 +995,11 @@ make_ip4_setting (shvarFile *ifcfg,
g_free (value); g_free (value);
g_object_set (s_ip4, g_object_set (s_ip4,
NM_SETTING_IP4_CONFIG_METHOD, method, NM_SETTING_IP_CONFIG_METHOD, method,
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "PEERDNS", TRUE), NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "PEERDNS", TRUE),
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "PEERROUTES", TRUE), NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "PEERROUTES", TRUE),
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default, NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default,
NM_SETTING_IP4_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV4_FAILURE_FATAL", FALSE), NM_SETTING_IP_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV4_FAILURE_FATAL", FALSE),
NULL); NULL);
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0) 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)) { if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE); value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE);
if (value && strlen (value)) 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_free (value);
g_object_set (s_ip4, 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), svTrueValue (ifcfg, "DHCP_SEND_HOSTNAME", TRUE),
NULL); NULL);
@ -1042,7 +1042,7 @@ make_ip4_setting (shvarFile *ifcfg,
continue; 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"); PARSE_WARNING ("duplicate IP4 address");
nm_ip_address_unref (addr); nm_ip_address_unref (addr);
} }
@ -1057,7 +1057,7 @@ make_ip4_setting (shvarFile *ifcfg,
value = svGetValue (ifcfg, tag, FALSE); value = svGetValue (ifcfg, tag, FALSE);
if (value) { if (value) {
if (nm_utils_ipaddr_valid (AF_INET, 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); PARSE_WARNING ("duplicate DNS server %s", tag);
} else if (nm_utils_ipaddr_valid (AF_INET6, value)) { } else if (nm_utils_ipaddr_valid (AF_INET6, value)) {
/* Ignore IPv6 addresses */ /* Ignore IPv6 addresses */
@ -1084,7 +1084,7 @@ make_ip4_setting (shvarFile *ifcfg,
char **item; char **item;
for (item = searches; *item; item++) { for (item = searches; *item; item++) {
if (strlen (*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); PARSE_WARNING ("duplicate DNS domain '%s'", *item);
} }
} }
@ -1117,7 +1117,7 @@ make_ip4_setting (shvarFile *ifcfg,
if (!route) if (!route)
break; 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"); PARSE_WARNING ("duplicate IP4 route");
nm_ip_route_unref (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) */ /* 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); value = svGetValue (ifcfg, "SEARCH", FALSE);
if (value) { if (value) {
char **searches = NULL; char **searches = NULL;
@ -1139,7 +1139,7 @@ make_ip4_setting (shvarFile *ifcfg,
char **item; char **item;
for (item = searches; *item; item++) { for (item = searches; *item; item++) {
if (strlen (*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); PARSE_WARNING ("duplicate DNS search '%s'", *item);
} }
} }
@ -1158,7 +1158,7 @@ done:
} }
static void 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; GDir *dir;
char *dirname, *base; 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 (s_ip4 != NULL);
g_return_if_fail (filename != 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; 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); dirname = g_path_get_dirname (filename);
g_return_if_fail (dirname != NULL); g_return_if_fail (dirname != NULL);
@ -1236,7 +1236,7 @@ read_aliases (NMSettingIP4Config *s_ip4, const char *filename, const char *netwo
svCloseFile (parsed); svCloseFile (parsed);
if (ok) { if (ok) {
nm_ip_address_set_attribute (addr, "label", g_variant_new_string (device)); 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); PARSE_WARNING ("duplicate IP4 address in alias file %s", item);
} else { } else {
PARSE_WARNING ("error reading IP4 address from alias file '%s': %s", PARSE_WARNING ("error reading IP4 address from alias file '%s': %s",
@ -1264,7 +1264,7 @@ make_ip6_setting (shvarFile *ifcfg,
const char *network_file, const char *network_file,
GError **error) GError **error)
{ {
NMSettingIP6Config *s_ip6 = NULL; NMSettingIPConfig *s_ip6 = NULL;
char *value = NULL; char *value = NULL;
char *str_value; char *str_value;
char *route6_path = NULL; char *route6_path = NULL;
@ -1279,7 +1279,7 @@ make_ip6_setting (shvarFile *ifcfg,
char *ip6_privacy_str; char *ip6_privacy_str;
NMSettingIP6ConfigPrivacy ip6_privacy_val; 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 /* 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 * 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_free (ip6_privacy_str);
g_object_set (s_ip6, g_object_set (s_ip6,
NM_SETTING_IP6_CONFIG_METHOD, method, NM_SETTING_IP_CONFIG_METHOD, method,
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "IPV6_PEERDNS", TRUE), NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "IPV6_PEERDNS", TRUE),
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "IPV6_PEERROUTES", TRUE), NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "IPV6_PEERROUTES", TRUE),
NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, never_default, NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default,
NM_SETTING_IP6_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV6_FAILURE_FATAL", FALSE), NM_SETTING_IP_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV6_FAILURE_FATAL", FALSE),
NM_SETTING_IP6_CONFIG_IP6_PRIVACY, ip6_privacy_val, NM_SETTING_IP6_CONFIG_IP6_PRIVACY, ip6_privacy_val,
NULL); NULL);
@ -1393,7 +1393,7 @@ make_ip6_setting (shvarFile *ifcfg,
/* METHOD_AUTO may trigger DHCPv6, so save the hostname to send to DHCP */ /* METHOD_AUTO may trigger DHCPv6, so save the hostname to send to DHCP */
value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE); value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE);
if (value && value[0]) 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); g_free (value);
} }
@ -1422,7 +1422,7 @@ make_ip6_setting (shvarFile *ifcfg,
goto error; 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"); PARSE_WARNING ("duplicate IP6 address");
nm_ip_address_unref (addr); nm_ip_address_unref (addr);
} }
@ -1442,7 +1442,7 @@ make_ip6_setting (shvarFile *ifcfg,
} }
if (nm_utils_ipaddr_valid (AF_INET6, value)) { 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); PARSE_WARNING ("duplicate DNS server %s", tag);
} else if (nm_utils_ipaddr_valid (AF_INET, value)) { } else if (nm_utils_ipaddr_valid (AF_INET, value)) {
/* Ignore IPv4 addresses */ /* Ignore IPv4 addresses */
@ -1457,7 +1457,7 @@ make_ip6_setting (shvarFile *ifcfg,
g_free (value); 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 */ /* Read static routes from route6-<interface> file */
route6_path = utils_get_route6_path (ifcfg->fileName); 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, /* If there is no IPv4 config or it doesn't contain DNS searches,
* read DOMAIN and put the domains into IPv6. * 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 */ /* DNS searches */
char *value = svGetValue (ifcfg, "DOMAIN", FALSE); char *value = svGetValue (ifcfg, "DOMAIN", FALSE);
if (value) { if (value) {
@ -4613,7 +4613,7 @@ check_dns_search_domains (shvarFile *ifcfg, NMSetting *s_ip4, NMSetting *s_ip6)
char **item; char **item;
for (item = searches; *item; item++) { for (item = searches; *item; item++) {
if (strlen (*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); PARSE_WARNING ("duplicate DNS domain '%s'", *item);
} }
} }
@ -4794,7 +4794,7 @@ connection_from_file (const char *filename,
connection = NULL; connection = NULL;
goto done; goto done;
} else { } 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); nm_connection_add_setting (connection, s_ip4);
} }

File diff suppressed because it is too large Load diff

View file

@ -1741,7 +1741,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
} }
static gboolean 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; const char *dest, *next_hop;
char **route_items; 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);
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) { if (num == 0) {
unlink (filename); unlink (filename);
return TRUE; 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)); route_items = g_malloc0 (sizeof (char*) * (num + 1));
for (i = 0; i < num; i++) { 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); dest = nm_ip_route_get_dest (route);
prefix = nm_ip_route_get_prefix (route); prefix = nm_ip_route_get_prefix (route);
@ -1794,7 +1794,7 @@ error:
static gboolean static gboolean
write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
{ {
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
const char *value; const char *value;
char *addr_key, *prefix_key, *netmask_key, *gw_key, *metric_key, *tmp; char *addr_key, *prefix_key, *netmask_key, *gw_key, *metric_key, *tmp;
char *route_path = NULL; 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); s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4) 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 */ /* Missing IP4 setting is assumed to be DHCP */
if (!method) 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 */ /* Temporarily create fake IP4 setting if missing; method set to DHCP above */
if (!s_ip4) { if (!s_ip4) {
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
fake_ip4 = TRUE; 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 /* Write out IPADDR<n>, PREFIX<n>, GATEWAY<n> for current IP addresses
* without labels. Unset obsolete NETMASK<n>. * 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++) { for (i = n = 0; i < num; i++) {
NMIPAddress *addr; 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) { if (i > 0) {
GVariant *label; GVariant *label;
@ -1943,7 +1943,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
g_free (gw_key); 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++) { for (i = 0; i < 254; i++) {
const char *dns; const char *dns;
@ -1952,19 +1952,19 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
if (i >= num) if (i >= num)
svSetValue (ifcfg, addr_key, NULL, FALSE); svSetValue (ifcfg, addr_key, NULL, FALSE);
else { 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); svSetValue (ifcfg, addr_key, dns, FALSE);
} }
g_free (addr_key); 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) { if (num > 0) {
searches = g_string_new (NULL); searches = g_string_new (NULL);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
if (i > 0) if (i > 0)
g_string_append_c (searches, ' '); 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); svSetValue (ifcfg, "DOMAIN", searches->str, FALSE);
g_string_free (searches, TRUE); 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 */ /* DEFROUTE; remember that it has the opposite meaning from never-default */
svSetValue (ifcfg, "DEFROUTE", 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); FALSE);
svSetValue (ifcfg, "PEERDNS", NULL, 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); svSetValue (ifcfg, "DHCP_CLIENT_ID", NULL, FALSE);
if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
svSetValue (ifcfg, "PEERDNS", 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); FALSE);
svSetValue (ifcfg, "PEERROUTES", 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); FALSE);
value = nm_setting_ip4_config_get_dhcp_hostname (s_ip4); value = nm_setting_ip_config_get_dhcp_hostname (s_ip4);
if (value) if (value)
svSetValue (ifcfg, "DHCP_HOSTNAME", value, FALSE); 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 * in that case, because it is NM-specific variable
*/ */
svSetValue (ifcfg, "DHCP_SEND_HOSTNAME", 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); 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) if (value)
svSetValue (ifcfg, "DHCP_CLIENT_ID", value, FALSE); svSetValue (ifcfg, "DHCP_CLIENT_ID", value, FALSE);
} }
svSetValue (ifcfg, "IPV4_FAILURE_FATAL", 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); FALSE);
/* Static routes - route-<name> file */ /* Static routes - route-<name> file */
@ -2028,7 +2028,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
} }
g_free (route_path); 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++) { for (i = 0; i < 256; i++) {
char buf[INET_ADDRSTRLEN]; char buf[INET_ADDRSTRLEN];
NMIPRoute *route; NMIPRoute *route;
@ -2045,7 +2045,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
svSetValue (routefile, gw_key, NULL, FALSE); svSetValue (routefile, gw_key, NULL, FALSE);
svSetValue (routefile, metric_key, NULL, FALSE); svSetValue (routefile, metric_key, NULL, FALSE);
} else { } 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); svSetValue (routefile, addr_key, nm_ip_route_get_dest (route), FALSE);
@ -2096,7 +2096,7 @@ out:
static void static void
write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path) write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path)
{ {
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
char *base_ifcfg_dir, *base_ifcfg_name, *base_name; char *base_ifcfg_dir, *base_ifcfg_name, *base_name;
int i, num, base_ifcfg_name_len, base_name_len; int i, num, base_ifcfg_name_len, base_name_len;
GDir *dir; GDir *dir;
@ -2134,7 +2134,7 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path)
if (!s_ip4) if (!s_ip4)
return; 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++) { for (i = 0; i < num; i++) {
GVariant *label_var; GVariant *label_var;
const char *label, *p; const char *label, *p;
@ -2142,7 +2142,7 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path)
NMIPAddress *addr; NMIPAddress *addr;
shvarFile *ifcfg; 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"); label_var = nm_ip_address_get_attribute (addr, "label");
if (!label_var) if (!label_var)
@ -2165,7 +2165,7 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path)
svSetValue (ifcfg, "DEVICE", label, FALSE); 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); svSetValue (ifcfg, "IPADDR", nm_ip_address_get_address (addr), FALSE);
tmp = g_strdup_printf ("%u", nm_ip_address_get_prefix (addr)); 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 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_items;
char *route_contents; 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);
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) { if (num == 0) {
unlink (filename); unlink (filename);
return TRUE; 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)); route_items = g_malloc0 (sizeof (char*) * (num + 1));
for (i = 0; i < num; i++) { 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", route_items[i] = g_strdup_printf ("%s/%u via %s metric %u\n",
nm_ip_route_get_dest (route), nm_ip_route_get_dest (route),
nm_ip_route_get_prefix (route), nm_ip_route_get_prefix (route),
@ -2231,8 +2231,8 @@ error:
static gboolean static gboolean
write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
{ {
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
const char *value; const char *value;
char *addr_key; char *addr_key;
guint32 i, num, num4; guint32 i, num, num4;
@ -2256,7 +2256,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
return TRUE; return TRUE;
} }
value = nm_setting_ip6_config_get_method (s_ip6); value = nm_setting_ip_config_get_method (s_ip6);
g_assert (value); g_assert (value);
if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) { if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
svSetValue (ifcfg, "IPV6INIT", "no", FALSE); 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, "IPV6INIT", "yes", FALSE);
svSetValue (ifcfg, "IPV6_AUTOCONF", "no", FALSE); svSetValue (ifcfg, "IPV6_AUTOCONF", "no", FALSE);
svSetValue (ifcfg, "DHCPV6C", "yes", 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) if (hostname)
svSetValue (ifcfg, "DHCP_HOSTNAME", hostname, FALSE); svSetValue (ifcfg, "DHCP_HOSTNAME", hostname, FALSE);
} else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { } 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 */ /* 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_str1 = g_string_new (NULL);
ip_str2 = g_string_new (NULL); ip_str2 = g_string_new (NULL);
ipv6_defaultgw = NULL; ipv6_defaultgw = NULL;
@ -2299,7 +2299,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
else else
ip_ptr = ip_str2; 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) if (i > 1)
g_string_append_c (ip_ptr, ' '); /* separate addresses in IPV6ADDR_SECONDARIES */ 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 */ /* Write out DNS - 'DNS' key is used both for IPv4 and IPv6 */
s_ip4 = nm_connection_get_setting_ip4_config (connection); 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 */ num4 = s_ip4 ? nm_setting_ip_config_get_num_dns (s_ip4) : 0; /* from where to start with IPv6 entries */
num = nm_setting_ip6_config_get_num_dns (s_ip6); num = nm_setting_ip_config_get_num_dns (s_ip6);
for (i = 0; i < 254; i++) { for (i = 0; i < 254; i++) {
addr_key = g_strdup_printf ("DNS%d", i + num4 + 1); addr_key = g_strdup_printf ("DNS%d", i + num4 + 1);
if (i >= num) if (i >= num)
svSetValue (ifcfg, addr_key, NULL, FALSE); svSetValue (ifcfg, addr_key, NULL, FALSE);
else { 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); svSetValue (ifcfg, addr_key, dns, FALSE);
} }
g_free (addr_key); g_free (addr_key);
} }
/* Write out DNS domains - 'DOMAIN' key is shared for both IPv4 and IPv6 domains */ /* 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) { if (num > 0) {
char *ip4_domains; char *ip4_domains;
ip4_domains = svGetValue (ifcfg, "DOMAIN", FALSE); 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++) { for (i = 0; i < num; i++) {
if (searches->len > 0) if (searches->len > 0)
g_string_append_c (searches, ' '); 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); svSetValue (ifcfg, "DOMAIN", searches->str, FALSE);
g_string_free (searches, TRUE); g_string_free (searches, TRUE);
@ -2351,7 +2351,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
/* handle IPV6_DEFROUTE */ /* handle IPV6_DEFROUTE */
/* IPV6_DEFROUTE has the opposite meaning from 'never-default' */ /* 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); svSetValue (ifcfg, "IPV6_DEFROUTE", "no", FALSE);
else else
svSetValue (ifcfg, "IPV6_DEFROUTE", "yes", FALSE); 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); svSetValue (ifcfg, "IPV6_PEERROUTES", NULL, FALSE);
if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) { if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) {
svSetValue (ifcfg, "IPV6_PEERDNS", 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); FALSE);
svSetValue (ifcfg, "IPV6_PEERROUTES", 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); FALSE);
} }
svSetValue (ifcfg, "IPV6_FAILURE_FATAL", 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); FALSE);
/* IPv6 Privacy Extensions */ /* IPv6 Privacy Extensions */
svSetValue (ifcfg, "IPV6_PRIVACY", NULL, FALSE); svSetValue (ifcfg, "IPV6_PRIVACY", NULL, FALSE);
svSetValue (ifcfg, "IPV6_PRIVACY_PREFER_PUBLIC_IP", 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: case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED:
svSetValue (ifcfg, "IPV6_PRIVACY", "no", FALSE); svSetValue (ifcfg, "IPV6_PRIVACY", "no", FALSE);
break; break;

View file

@ -544,25 +544,25 @@ make_wired_connection_setting (NMConnection *connection,
nm_connection_add_setting (connection, NM_SETTING (s_wired)); nm_connection_add_setting (connection, NM_SETTING (s_wired));
} }
/* add NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, /* add NM_SETTING_IP_CONFIG_DHCP_HOSTNAME,
* NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID in future*/ * NM_SETTING_IP_CONFIG_DHCP_CLIENT_ID in future*/
static void static void
make_ip4_setting (NMConnection *connection, make_ip4_setting (NMConnection *connection,
const char *conn_name, const char *conn_name,
GError **error) GError **error)
{ {
NMSettingIP4Config *ip4_setting = NMSettingIPConfig *ip4_setting =
NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
const char *value, *method = NULL; const char *value, *method = NULL;
gboolean is_static_block = is_static_ip4 (conn_name); gboolean is_static_block = is_static_ip4 (conn_name);
ip_block *iblock = NULL; ip_block *iblock = NULL;
/* set dhcp options (dhcp_xxx) */ /* set dhcp options (dhcp_xxx) */
value = ifnet_get_data (conn_name, "dhcp"); 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, && 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); && strstr (value, "nogateway") ? TRUE : FALSE, NULL);
if (!is_static_block) { if (!is_static_block) {
@ -575,21 +575,21 @@ make_ip4_setting (NMConnection *connection,
} }
if (strstr (method, "dhcp")) if (strstr (method, "dhcp"))
g_object_set (ip4_setting, 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_METHOD_AUTO,
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL); NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, NULL);
else if (strstr (method, "autoip")) { else if (strstr (method, "autoip")) {
g_object_set (ip4_setting, 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_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)); nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
return; return;
} else if (strstr (method, "shared")) { } else if (strstr (method, "shared")) {
g_object_set (ip4_setting, 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_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)); nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
return; return;
} else { } 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); ip4_addr = nm_ip_address_new (AF_INET, iblock->ip, iblock->prefix, iblock->next_hop, &local);
if (iblock->next_hop) if (iblock->next_hop)
g_object_set (ip4_setting, g_object_set (ip4_setting,
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES,
TRUE, NULL); TRUE, NULL);
if (ip4_addr) { 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_log_warn (LOGD_SETTINGS, "ignoring duplicate IP4 address");
nm_ip_address_unref (ip4_addr); nm_ip_address_unref (ip4_addr);
} else { } else {
@ -636,8 +636,8 @@ make_ip4_setting (NMConnection *connection,
} }
g_object_set (ip4_setting, g_object_set (ip4_setting,
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, !has_default_ip4_route (conn_name), NM_SETTING_IP_CONFIG_NEVER_DEFAULT, !has_default_ip4_route (conn_name),
NULL); NULL);
} }
@ -648,7 +648,7 @@ make_ip4_setting (NMConnection *connection,
get_dhcp_hostname_and_client_id (&dhcp_hostname, &client_id); get_dhcp_hostname_and_client_id (&dhcp_hostname, &client_id);
if (dhcp_hostname) { if (dhcp_hostname) {
g_object_set (ip4_setting, g_object_set (ip4_setting,
NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME,
dhcp_hostname, NULL); dhcp_hostname, NULL);
nm_log_info (LOGD_SETTINGS, "DHCP hostname: %s", dhcp_hostname); nm_log_info (LOGD_SETTINGS, "DHCP hostname: %s", dhcp_hostname);
g_free (dhcp_hostname); g_free (dhcp_hostname);
@ -679,7 +679,7 @@ make_ip4_setting (NMConnection *connection,
for (item = searches; *item; item++) { for (item = searches; *item; item++) {
if (strlen (*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); 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); route = nm_ip_route_new (AF_INET, iblock->ip, iblock->prefix, iblock->next_hop, metric, &local);
if (route) { 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); nm_log_info (LOGD_SETTINGS, "new IP4 route:%s\n", iblock->ip);
else else
nm_log_warn (LOGD_SETTINGS, "duplicate IP4 route"); nm_log_warn (LOGD_SETTINGS, "duplicate IP4 route");
@ -737,7 +736,7 @@ make_ip6_setting (NMConnection *connection,
const char *conn_name, const char *conn_name,
GError **error) GError **error)
{ {
NMSettingIP6Config *s_ip6 = NULL; NMSettingIPConfig *s_ip6 = NULL;
gboolean is_static_block = is_static_ip6 (conn_name); gboolean is_static_block = is_static_ip6 (conn_name);
// used to disable IPv6 // used to disable IPv6
@ -747,7 +746,7 @@ make_ip6_setting (NMConnection *connection,
ip_block *iblock; ip_block *iblock;
gboolean never_default = !has_default_ip6_route (conn_name); 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"); value = ifnet_get_data (conn_name, "enable_ipv6");
if (value && is_true (value)) if (value && is_true (value))
@ -757,7 +756,7 @@ make_ip6_setting (NMConnection *connection,
// Currently only Manual and DHCP are supported // Currently only Manual and DHCP are supported
if (!ipv6_enabled) { if (!ipv6_enabled) {
g_object_set (s_ip6, g_object_set (s_ip6,
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP_CONFIG_METHOD,
NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL); NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL);
goto done; goto done;
} else if (!is_static_block) { } 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); nm_log_info (LOGD_SETTINGS, "IPv6 for %s enabled, using %s", conn_name, method);
g_object_set (s_ip6, g_object_set (s_ip6,
NM_SETTING_IP6_CONFIG_METHOD, method, NM_SETTING_IP_CONFIG_METHOD, method,
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, FALSE, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, FALSE,
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, FALSE, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, FALSE,
NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, never_default, NULL); NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default, NULL);
/* Make manual settings */ /* Make manual settings */
if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { 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); ip6_addr = nm_ip_address_new (AF_INET6, iblock->ip, iblock->prefix, NULL, &local);
if (ip6_addr) { 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_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 { } else {
nm_log_warn (LOGD_SETTINGS, "ignoring duplicate IP6 address"); 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)) { } else if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) {
/* - autoconf or DHCPv6 stuff goes here */ /* - 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); 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 // Add routes
iblock = convert_ip6_routes_block (conn_name); iblock = convert_ip6_routes_block (conn_name);
if (iblock) 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); TRUE, NULL);
/* Add all IPv6 routes */ /* Add all IPv6 routes */
while (iblock) { 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); route = nm_ip_route_new (AF_INET6, iblock->ip, iblock->prefix, iblock->next_hop, metric, &local);
if (route) { 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"); nm_log_info (LOGD_SETTINGS, " new IP6 route");
else else
nm_log_warn (LOGD_SETTINGS, " duplicate IP6 route"); nm_log_warn (LOGD_SETTINGS, " duplicate IP6 route");
@ -2373,7 +2372,7 @@ write_wired_setting (NMConnection *connection,
static gboolean static gboolean
write_ip4_setting (NMConnection *connection, const char *conn_name, GError **error) write_ip4_setting (NMConnection *connection, const char *conn_name, GError **error)
{ {
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
const char *value; const char *value;
guint32 i, num; guint32 i, num;
GString *searches; GString *searches;
@ -2392,17 +2391,17 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err
} }
routes = g_string_new (NULL); 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); g_assert (value);
if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { 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); ips = g_string_new (NULL);
/* IPv4 addresses */ /* IPv4 addresses */
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
NMIPAddress *addr; 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", g_string_append_printf (ips, "\"%s/%u",
nm_ip_address_get_address (addr), 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"); ifnet_set_data (conn_name, "config", "dhcp");
/* DNS Servers */ /* 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) { if (num > 0) {
dns = g_string_new (NULL); dns = g_string_new (NULL);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
const char *ip; 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); g_string_append_printf (dns, " %s", ip);
} }
ifnet_set_data (conn_name, "dns_servers", dns->str); 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); ifnet_set_data (conn_name, "dns_servers", NULL);
/* DNS Searches */ /* 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) { if (num > 0) {
searches = g_string_new (NULL); searches = g_string_new (NULL);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
if (i > 0) if (i > 0)
g_string_append_c (searches, ' '); g_string_append_c (searches, ' ');
g_string_append (searches, g_string_append (searches,
nm_setting_ip4_config_get_dns_search nm_setting_ip_config_get_dns_search
(s_ip4, i)); (s_ip4, i));
} }
ifnet_set_data (conn_name, "dns_search", searches->str); 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); ifnet_set_data (conn_name, "dns_search", NULL);
/* FIXME Will be implemented when configuration supports it /* FIXME Will be implemented when configuration supports it
if (!strcmp(value, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { 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) if (value)
ifnet_set_data(conn_name, "DHCP_HOSTNAME", value, ifnet_set_data(conn_name, "DHCP_HOSTNAME", value,
FALSE); 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) if (value)
ifnet_set_data(conn_name, "DHCP_CLIENT_ID", value, ifnet_set_data(conn_name, "DHCP_CLIENT_ID", value,
FALSE); FALSE);
@ -2470,13 +2469,13 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err
*/ */
/* Static routes */ /* 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) { if (num > 0) {
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
NMIPRoute *route; NMIPRoute *route;
const char *next_hop; 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); next_hop = nm_ip_route_get_next_hop (route);
if (!next_hop) if (!next_hop)
@ -2500,7 +2499,7 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err
} }
static gboolean 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; NMIPRoute *route;
const char *next_hop; const char *next_hop;
@ -2509,7 +2508,7 @@ write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **er
const char *old_routes; const char *old_routes;
g_return_val_if_fail (s_ip6 != NULL, FALSE); 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) { if (num == 0) {
return TRUE; return TRUE;
} }
@ -2519,7 +2518,7 @@ write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **er
if (old_routes) if (old_routes)
g_string_append (routes_string, "\" "); g_string_append (routes_string, "\" ");
for (i = 0; i < num; i++) { 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); next_hop = nm_ip_route_get_next_hop (route);
if (!next_hop) if (!next_hop)
@ -2540,7 +2539,7 @@ write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **er
static gboolean static gboolean
write_ip6_setting (NMConnection *connection, const char *conn_name, GError **error) write_ip6_setting (NMConnection *connection, const char *conn_name, GError **error)
{ {
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
const char *value; const char *value;
guint32 i, num; guint32 i, num;
GString *searches; GString *searches;
@ -2554,7 +2553,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err
return FALSE; return FALSE;
} }
value = nm_setting_ip6_config_get_method (s_ip6); value = nm_setting_ip_config_get_method (s_ip6);
g_assert (value); g_assert (value);
if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) { if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
ifnet_set_data (conn_name, "enable_ipv6", "false"); 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) if (!config)
config = ""; config = "";
num = nm_setting_ip6_config_get_num_addresses (s_ip6); num = nm_setting_ip_config_get_num_addresses (s_ip6);
/* IPv6 addresses */ /* IPv6 addresses */
ip_str = g_string_new (NULL); ip_str = g_string_new (NULL);
for (i = 0; i < num; i++) { 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\"", g_string_append_printf (ip_str, "\"%s/%u\"",
nm_ip_address_get_address (addr), nm_ip_address_get_address (addr),
@ -2606,7 +2605,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err
} }
/* DNS Servers */ /* 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) { if (num > 0) {
const char *dns_servers = ifnet_get_data (conn_name, "dns_servers"); const char *dns_servers = ifnet_get_data (conn_name, "dns_servers");
gchar *tmp; gchar *tmp;
@ -2616,7 +2615,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err
if (!dns_servers) if (!dns_servers)
dns_servers = ""; dns_servers = "";
for (i = 0; i < num; i++) { 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)) if (!strstr (dns_servers, dns))
g_string_append_printf (dns_string, "%s ", 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 } else
/* DNS Searches */ /* 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) { if (num > 0) {
const char *ip4_domains; const char *ip4_domains;
@ -2640,7 +2639,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err
const gchar *search = NULL; const gchar *search = NULL;
search = 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 (search && !strstr (searches->str, search)) {
if (searches->len > 0) if (searches->len > 0)
g_string_append_c (searches, ' '); g_string_append_c (searches, ' ');
@ -2686,7 +2685,7 @@ ifnet_update_parsers_by_connection (NMConnection *connection,
GError **error) GError **error)
{ {
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
gboolean success = FALSE; gboolean success = FALSE;
const char *type; const char *type;
gboolean no_8021x = FALSE; gboolean no_8021x = FALSE;

View file

@ -651,7 +651,7 @@ destroy_ip_block (ip_block * iblock)
} }
void 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; const char *dns_servers;
gchar **server_list, *stripped; 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); length = g_strv_length (server_list);
if (length) 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); TRUE, NULL);
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
g_strstrip (server_list[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]); nm_log_warn (LOGD_SETTINGS, "ignored dns: %s\n", server_list[i]);
continue; 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]); nm_log_warn (LOGD_SETTINGS, "warning: duplicate DNS server %s", server_list[i]);
} }
g_strfreev (server_list); g_strfreev (server_list);
} }
void 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; const char *dns_servers;
gchar **server_list, *stripped; 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); length = g_strv_length (server_list);
if (length) 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); TRUE, NULL);
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
g_strstrip (server_list[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]); nm_log_warn (LOGD_SETTINGS, "ignored dns: %s\n", server_list[i]);
continue; 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]); nm_log_warn (LOGD_SETTINGS, "warning: duplicate DNS server %s", server_list[i]);
} }
g_strfreev (server_list); g_strfreev (server_list);

View file

@ -53,8 +53,8 @@ ip_block *convert_ip4_routes_block (const char *conn_name);
ip_block *convert_ip6_routes_block (const char *conn_name); ip_block *convert_ip6_routes_block (const char *conn_name);
void destroy_ip_block (ip_block * iblock); void destroy_ip_block (ip_block * iblock);
void set_ip4_dns_servers (NMSettingIP4Config * s_ip4, const char *conn_name); void set_ip4_dns_servers (NMSettingIPConfig * s_ip4, const char *conn_name);
void set_ip6_dns_servers (NMSettingIP6Config * s_ip6, const char *conn_name); void set_ip6_dns_servers (NMSettingIPConfig * s_ip6, const char *conn_name);
gchar *strip_string (gchar *str, gchar t); gchar *strip_string (gchar *str, gchar t);
gboolean is_managed (const char *conn_name); gboolean is_managed (const char *conn_name);

View file

@ -410,7 +410,7 @@ update_wired_setting_from_if_block(NMConnection *connection,
} }
static void static void
ifupdown_ip4_add_dns (NMSettingIP4Config *s_ip4, const char *dns) ifupdown_ip4_add_dns (NMSettingIPConfig *s_ip4, const char *dns)
{ {
guint32 addr; guint32 addr;
char **list, **iter; char **list, **iter;
@ -428,7 +428,7 @@ ifupdown_ip4_add_dns (NMSettingIP4Config *s_ip4, const char *dns)
continue; 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); nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter);
} }
g_strfreev (list); g_strfreev (list);
@ -440,12 +440,12 @@ update_ip4_setting_from_if_block(NMConnection *connection,
GError **error) 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"); const char *type = ifparser_getkey(block, "inet");
gboolean is_static = type && !strcmp("static", type); gboolean is_static = type && !strcmp("static", type);
if (!is_static) { 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 { } else {
guint32 tmp_mask; guint32 tmp_mask;
NMIPAddress *addr; NMIPAddress *addr;
@ -490,9 +490,9 @@ update_ip4_setting_from_if_block(NMConnection *connection,
if (!addr) if (!addr)
goto error; 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_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 { } else {
nm_log_info (LOGD_SETTINGS, "ignoring duplicate IP4 address"); 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"); nameservers_v = ifparser_getkey (block, "dns-nameservers");
ifupdown_ip4_add_dns (s_ip4, nameservers_v); 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"); nm_log_info (LOGD_SETTINGS, "No dns-nameserver configured in /etc/network/interfaces");
/* DNS searches */ /* DNS searches */
@ -515,13 +515,13 @@ update_ip4_setting_from_if_block(NMConnection *connection,
g_strstrip (*iter); g_strstrip (*iter);
if (g_ascii_isspace (*iter[0])) if (g_ascii_isspace (*iter[0]))
continue; 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); nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter);
} }
g_strfreev (list); 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip4));
@ -533,7 +533,7 @@ error:
} }
static void 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; struct in6_addr addr;
char **list, **iter; char **list, **iter;
@ -551,7 +551,7 @@ ifupdown_ip6_add_dns (NMSettingIP6Config *s_ip6, const char *dns)
continue; 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); nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter);
} }
g_strfreev (list); g_strfreev (list);
@ -562,13 +562,13 @@ update_ip6_setting_from_if_block(NMConnection *connection,
if_block *block, if_block *block,
GError **error) 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"); const char *type = ifparser_getkey(block, "inet6");
gboolean is_static = type && (!strcmp("static", type) || gboolean is_static = type && (!strcmp("static", type) ||
!strcmp("v4tunnel", type)); !strcmp("v4tunnel", type));
if (!is_static) { 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 { } else {
NMIPAddress *addr; NMIPAddress *addr;
const char *address_v; const char *address_v;
@ -603,9 +603,9 @@ update_ip6_setting_from_if_block(NMConnection *connection,
if (!addr) if (!addr)
goto error; 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_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 { } else {
nm_log_info (LOGD_SETTINGS, "ignoring duplicate IP6 address"); 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"); nameservers_v = ifparser_getkey(block, "dns-nameservers");
ifupdown_ip6_add_dns (s_ip6, nameservers_v); 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"); nm_log_info (LOGD_SETTINGS, "No dns-nameserver configured in /etc/network/interfaces");
/* DNS searches */ /* DNS searches */
@ -628,14 +628,14 @@ update_ip6_setting_from_if_block(NMConnection *connection,
g_strstrip (*iter); g_strstrip (*iter);
if (isblank (*iter[0])) if (isblank (*iter[0]))
continue; 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); nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter);
} }
g_strfreev (list); g_strfreev (list);
} }
g_object_set (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); NULL);
} }

View file

@ -459,7 +459,7 @@ test17_read_static_ipv4 (const char *path)
{ {
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSettingWired *s_wired; NMSettingWired *s_wired;
char *unmanaged = NULL; char *unmanaged = NULL;
GError *error = NULL; GError *error = NULL;
@ -525,81 +525,81 @@ test17_read_static_ipv4 (const char *path)
NM_SETTING_IP4_CONFIG_SETTING_NAME); NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */ /* 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, ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0,
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value", TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file, file,
NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_METHOD); NM_SETTING_IP_CONFIG_METHOD);
/* IP addresses */ /* 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", TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file, file,
NM_SETTING_IP4_CONFIG_SETTING_NAME, 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 (ip4_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "10.0.0.3"); 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); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 8);
/* DNS Addresses */ /* 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", TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file, file,
NM_SETTING_IP4_CONFIG_SETTING_NAME, 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", TEST17_NAME, "failed to verify %s: unexpected %s / %s key value #1",
file, file,
NM_SETTING_IP4_CONFIG_SETTING_NAME, 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", TEST17_NAME, "failed to verify %s: unexpected %s / %s key value #2",
file, file,
NM_SETTING_IP4_CONFIG_SETTING_NAME, 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", TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file, file,
NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_DNS); NM_SETTING_IP_CONFIG_DNS);
/* DNS search domains */ /* 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", TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file, file,
NM_SETTING_IP4_CONFIG_SETTING_NAME, 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, ASSERT (tmp != NULL,
TEST17_NAME, "failed to verify %s: missing %s / %s key", TEST17_NAME, "failed to verify %s: missing %s / %s key",
file, file,
NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_DNS_SEARCH); NM_SETTING_IP_CONFIG_DNS_SEARCH);
ASSERT (strcmp (tmp, expected_search1) == 0, ASSERT (strcmp (tmp, expected_search1) == 0,
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value", TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file, file,
NM_SETTING_IP4_CONFIG_SETTING_NAME, 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, ASSERT (tmp != NULL,
TEST17_NAME, "failed to verify %s: missing %s / %s key", TEST17_NAME, "failed to verify %s: missing %s / %s key",
file, file,
NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_DNS_SEARCH); NM_SETTING_IP_CONFIG_DNS_SEARCH);
ASSERT (strcmp (tmp, expected_search2) == 0, ASSERT (strcmp (tmp, expected_search2) == 0,
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value", TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file, file,
NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_DNS_SEARCH); NM_SETTING_IP_CONFIG_DNS_SEARCH);
g_object_unref (connection); g_object_unref (connection);
} }
@ -609,7 +609,7 @@ test18_read_static_ipv6 (const char *path)
{ {
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
NMSettingWired *s_wired; NMSettingWired *s_wired;
char *unmanaged = NULL; char *unmanaged = NULL;
GError *error = NULL; GError *error = NULL;
@ -681,85 +681,85 @@ test18_read_static_ipv6 (const char *path)
NM_SETTING_IP6_CONFIG_SETTING_NAME); NM_SETTING_IP6_CONFIG_SETTING_NAME);
/* Method */ /* 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, ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0,
TEST18_NAME, TEST18_NAME,
"failed to verify %s: unexpected %s / %s key value", "failed to verify %s: unexpected %s / %s key value",
file, file,
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_METHOD); NM_SETTING_IP_CONFIG_METHOD);
/* IP addresses */ /* 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, TEST18_NAME,
"failed to verify %s: unexpected number of %s / %s", "failed to verify %s: unexpected number of %s / %s",
file, file,
NM_SETTING_IP6_CONFIG_SETTING_NAME, 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 (ip6_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "fc00::1"); g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "fc00::1");
g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 64); g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 64);
/* DNS Addresses */ /* 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, TEST18_NAME,
"failed to verify %s: unexpected number of %s / %s values", "failed to verify %s: unexpected number of %s / %s values",
file, file,
NM_SETTING_IP6_CONFIG_SETTING_NAME, 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, TEST18_NAME,
"failed to verify %s: unexpected %s / %s #1", "failed to verify %s: unexpected %s / %s #1",
file, file,
NM_SETTING_IP6_CONFIG_SETTING_NAME, 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", TEST18_NAME, "failed to verify %s: unexpected %s / %s #2",
file, file,
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_DNS); NM_SETTING_IP_CONFIG_DNS);
/* DNS search domains */ /* 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, TEST18_NAME,
"failed to verify %s: unexpected number of %s / %s values", "failed to verify %s: unexpected number of %s / %s values",
file, file,
NM_SETTING_IP6_CONFIG_SETTING_NAME, 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, ASSERT (tmp != NULL,
"wired-ipv6-manual-verify-ip6", "wired-ipv6-manual-verify-ip6",
"failed to verify %s: missing %s / %s #1", "failed to verify %s: missing %s / %s #1",
file, file,
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_DNS_SEARCH); NM_SETTING_IP_CONFIG_DNS_SEARCH);
ASSERT (strcmp (tmp, expected_search1) == 0, ASSERT (strcmp (tmp, expected_search1) == 0,
"wired-ipv6-manual-verify-ip6", "wired-ipv6-manual-verify-ip6",
"failed to verify %s: unexpected %s / %s #1", "failed to verify %s: unexpected %s / %s #1",
file, file,
NM_SETTING_IP6_CONFIG_SETTING_NAME, 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, ASSERT (tmp != NULL,
TEST18_NAME, TEST18_NAME,
"failed to verify %s: missing %s / %s #2", "failed to verify %s: missing %s / %s #2",
file, file,
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_DNS_SEARCH); NM_SETTING_IP_CONFIG_DNS_SEARCH);
ASSERT (strcmp (tmp, expected_search2) == 0, ASSERT (strcmp (tmp, expected_search2) == 0,
TEST18_NAME, TEST18_NAME,
"failed to verify %s: unexpected %s / %s #2", "failed to verify %s: unexpected %s / %s #2",
file, file,
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_DNS_SEARCH); NM_SETTING_IP_CONFIG_DNS_SEARCH);
g_free (unmanaged); g_free (unmanaged);
g_object_unref (connection); g_object_unref (connection);
@ -769,7 +769,7 @@ static void
test19_read_static_ipv4_plen (const char *path) test19_read_static_ipv4_plen (const char *path)
{ {
NMConnection *connection; NMConnection *connection;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
char *unmanaged = NULL; char *unmanaged = NULL;
GError *error = NULL; GError *error = NULL;
NMIPAddress *ip4_addr; NMIPAddress *ip4_addr;
@ -801,13 +801,13 @@ test19_read_static_ipv4_plen (const char *path)
NM_SETTING_IP4_CONFIG_SETTING_NAME); NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* IP addresses */ /* 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", TEST19_NAME, "failed to verify %s: unexpected %s / %s key value",
file, file,
NM_SETTING_IP4_CONFIG_SETTING_NAME, 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 (ip4_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "10.0.0.3"); 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); g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 8);

View file

@ -879,27 +879,27 @@ static KeyParser key_parsers[] = {
TRUE, TRUE,
mac_address_parser_ETHER }, mac_address_parser_ETHER },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, { NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_ADDRESSES, NM_SETTING_IP_CONFIG_ADDRESSES,
FALSE, FALSE,
ip_address_or_route_parser }, ip_address_or_route_parser },
{ NM_SETTING_IP6_CONFIG_SETTING_NAME, { NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_ADDRESSES, NM_SETTING_IP_CONFIG_ADDRESSES,
FALSE, FALSE,
ip_address_or_route_parser }, ip_address_or_route_parser },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, { NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_ROUTES, NM_SETTING_IP_CONFIG_ROUTES,
FALSE, FALSE,
ip_address_or_route_parser }, ip_address_or_route_parser },
{ NM_SETTING_IP6_CONFIG_SETTING_NAME, { NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_ROUTES, NM_SETTING_IP_CONFIG_ROUTES,
FALSE, FALSE,
ip_address_or_route_parser }, ip_address_or_route_parser },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, { NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_DNS, NM_SETTING_IP_CONFIG_DNS,
FALSE, FALSE,
ip4_dns_parser }, ip4_dns_parser },
{ NM_SETTING_IP6_CONFIG_SETTING_NAME, { NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_DNS, NM_SETTING_IP_CONFIG_DNS,
FALSE, FALSE,
ip6_dns_parser }, ip6_dns_parser },
{ NM_SETTING_WIRED_SETTING_NAME, { NM_SETTING_WIRED_SETTING_NAME,

View file

@ -38,9 +38,9 @@
#define TEST_WIRELESS_FILE TEST_KEYFILES_DIR"/Test_Wireless_Connection" #define TEST_WIRELESS_FILE TEST_KEYFILES_DIR"/Test_Wireless_Connection"
static void 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 (ip4);
g_assert_cmpstr (nm_ip_address_get_address (ip4), ==, address); 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 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); NMIPRoute *route = nm_setting_ip_config_get_route (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);
g_assert (route); g_assert (route);
g_assert_cmpstr (nm_ip_route_get_dest (route), ==, destination); g_assert_cmpstr (nm_ip_route_get_dest (route), ==, destination);
@ -107,8 +83,8 @@ test_read_valid_wired_connection (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWired *s_wired; NMSettingWired *s_wired;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
GError *error = NULL; GError *error = NULL;
const char *mac; const char *mac;
char expected_mac_address[ETH_ALEN] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }; 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); NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */ /* 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, ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_FILE, TEST_WIRED_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_METHOD); NM_SETTING_IP_CONFIG_METHOD);
/* DNS Addresses */ /* 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", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_FILE, TEST_WIRED_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME, 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", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #1",
TEST_WIRED_FILE, TEST_WIRED_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME, 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", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #2",
TEST_WIRED_FILE, TEST_WIRED_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_DNS); NM_SETTING_IP_CONFIG_DNS);
/* IPv4 addresses */ /* IPv4 addresses */
g_assert (nm_setting_ip4_config_get_num_addresses (s_ip4) == 6); g_assert (nm_setting_ip_config_get_num_addresses (s_ip4) == 6);
check_ip4_address (s_ip4, 0, "2.3.4.5", 24, "2.3.4.6"); check_ip_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_ip_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_ip_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_ip_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_ip_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); check_ip_address (s_ip4, 5, "5.6.7.8", 24, NULL);
/* IPv4 routes */ /* IPv4 routes */
g_assert (nm_setting_ip4_config_get_num_routes (s_ip4) == 12); g_assert (nm_setting_ip_config_get_num_routes (s_ip4) == 12);
check_ip4_route (s_ip4, 0, "5.6.7.8", 32, NULL, 0); check_ip_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_ip_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_ip_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_ip_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_ip_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_ip_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_ip_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_ip_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_ip_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_ip_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_ip_route (s_ip4, 10, "1.1.1.10", 20, NULL, 0);
check_ip4_route (s_ip4, 11, "1.1.1.11", 21, NULL, 21); check_ip_route (s_ip4, 11, "1.1.1.11", 21, NULL, 21);
/* ===== IPv6 SETTING ===== */ /* ===== IPv6 SETTING ===== */
@ -301,139 +277,110 @@ test_read_valid_wired_connection (void)
NM_SETTING_IP6_CONFIG_SETTING_NAME); NM_SETTING_IP6_CONFIG_SETTING_NAME);
/* Method */ /* 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, ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_FILE, TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_METHOD); NM_SETTING_IP_CONFIG_METHOD);
/* DNS Addresses */ /* 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", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_FILE, TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME, 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", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #1",
TEST_WIRED_FILE, TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME, 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", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #2",
TEST_WIRED_FILE, TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_DNS); NM_SETTING_IP_CONFIG_DNS);
/* DNS Searches */ /* 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", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_FILE, TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME, 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", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #1",
TEST_WIRED_FILE, TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME, 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, 1), expected6_dnssearch2), 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", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #2",
TEST_WIRED_FILE, TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME, 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, 2), expected6_dnssearch3), 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", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #3",
TEST_WIRED_FILE, TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_DNS_SEARCH); NM_SETTING_IP_CONFIG_DNS_SEARCH);
/* IPv6 addresses */ /* IPv6 addresses */
g_assert (nm_setting_ip6_config_get_num_addresses (s_ip6) == 10); g_assert (nm_setting_ip_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_ip_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_ip_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_ip_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_ip_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_ip_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_ip_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_ip_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_ip_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_ip_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"); check_ip_address (s_ip6, 9, "3:4:5:6:7:8:9:19", 69, "1::9");
/* Route #1 */ /* Route #1 */
g_assert (nm_setting_ip6_config_get_num_routes (s_ip6) == 7); g_assert (nm_setting_ip_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_ip_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_ip_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_ip_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_ip_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_ip_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_ip_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); check_ip_route (s_ip6, 6, "8:9:0:1:2:3:4:6", 123, NULL, 0);
g_object_unref (connection); g_object_unref (connection);
} }
static void static void
add_one_ip4_address (NMSettingIP4Config *s_ip4, add_one_ip_address (NMSettingIPConfig *s_ip,
const char *addr, const char *addr,
const char *gw, guint32 prefix,
guint32 prefix) const char *gw)
{ {
NMIPAddress *ip4_addr; NMIPAddress *ip_addr;
GError *error = NULL; GError *error = NULL;
ip4_addr = nm_ip_address_new (AF_INET, 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); g_assert_no_error (error);
nm_setting_ip4_config_add_address (s_ip4, ip4_addr); nm_setting_ip_config_add_address (s_ip, ip_addr);
nm_ip_address_unref (ip4_addr); nm_ip_address_unref (ip_addr);
} }
static void static void
add_one_ip4_route (NMSettingIP4Config *s_ip4, add_one_ip_route (NMSettingIPConfig *s_ip,
const char *dest, const char *dest,
const char *nh, const char *nh,
guint32 prefix, guint32 prefix,
guint32 metric) guint32 metric)
{ {
NMIPRoute *route; NMIPRoute *route;
GError *error = NULL; GError *error = NULL;
route = nm_ip_route_new (AF_INET, 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); g_assert_no_error (error);
nm_setting_ip4_config_add_route (s_ip4, route); nm_setting_ip_config_add_route (s_ip, route);
nm_ip_route_unref (route);
}
static void
add_one_ip6_address (NMSettingIP6Config *s_ip6,
const char *addr,
guint32 prefix,
const char *gw)
{
NMIPAddress *ip6_addr;
GError *error = NULL;
ip6_addr = nm_ip_address_new (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);
}
static void
add_one_ip6_route (NMSettingIP6Config *s_ip6,
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);
g_assert_no_error (error);
nm_setting_ip6_config_add_route (s_ip6, route);
nm_ip_route_unref (route); nm_ip_route_unref (route);
} }
@ -444,8 +391,8 @@ test_write_wired_connection (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWired *s_wired; NMSettingWired *s_wired;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
char *uuid; char *uuid;
const char *mac = "99:88:77:66:55:44"; const char *mac = "99:88:77:66:55:44";
gboolean success; gboolean success;
@ -511,52 +458,52 @@ test_write_wired_connection (void)
/* IP4 setting */ /* 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (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); NULL);
/* Addresses */ /* Addresses */
add_one_ip4_address (s_ip4, address1, address1_gw, 24); add_one_ip_address (s_ip4, address1, 24, address1_gw);
add_one_ip4_address (s_ip4, address2, address2_gw, 8); add_one_ip_address (s_ip4, address2, 8, address2_gw);
/* Routes */ /* Routes */
add_one_ip4_route (s_ip4, route1, route1_nh, 24, 3); add_one_ip_route (s_ip4, route1, route1_nh, 24, 3);
add_one_ip4_route (s_ip4, route2, route2_nh, 8, 1); add_one_ip_route (s_ip4, route2, route2_nh, 8, 1);
add_one_ip4_route (s_ip4, route3, route3_nh, 7, 0); add_one_ip_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, route4, route4_nh, 6, 4);
/* DNS servers */ /* DNS servers */
nm_setting_ip4_config_add_dns (s_ip4, dns1); nm_setting_ip_config_add_dns (s_ip4, dns1);
nm_setting_ip4_config_add_dns (s_ip4, dns2); nm_setting_ip_config_add_dns (s_ip4, dns2);
/* IP6 setting */ /* 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (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); NULL);
/* Addresses */ /* Addresses */
add_one_ip6_address (s_ip6, address6_1, 64, NULL); add_one_ip_address (s_ip6, address6_1, 64, NULL);
add_one_ip6_address (s_ip6, address6_2, 56, NULL); add_one_ip_address (s_ip6, address6_2, 56, NULL);
/* Routes */ /* Routes */
add_one_ip6_route (s_ip6, route6_1, route6_1_nh, 64, 3); add_one_ip_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_ip_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_ip_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_4, route6_4_nh, 62, 0);
/* DNS servers */ /* DNS servers */
nm_setting_ip6_config_add_dns (s_ip6, dns6_1); nm_setting_ip_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_2);
/* DNS searches */ /* 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 */ /* Write out the connection */
owner_uid = geteuid (); owner_uid = geteuid ();
@ -592,8 +539,8 @@ test_read_ip6_wired_connection (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWired *s_wired; NMSettingWired *s_wired;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
GError *error = NULL; GError *error = NULL;
const char *tmp; const char *tmp;
const char *expected_id = "Test Wired Connection IP6"; const char *expected_id = "Test Wired Connection IP6";
@ -657,18 +604,18 @@ test_read_ip6_wired_connection (void)
NM_SETTING_IP4_CONFIG_SETTING_NAME); NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */ /* 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, ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_IP6_FILE, TEST_WIRED_IP6_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME, 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", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_IP6_FILE, TEST_WIRED_IP6_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_DNS); NM_SETTING_IP_CONFIG_DNS);
/* ===== IPv6 SETTING ===== */ /* ===== IPv6 SETTING ===== */
@ -679,16 +626,16 @@ test_read_ip6_wired_connection (void)
NM_SETTING_IP6_CONFIG_SETTING_NAME); NM_SETTING_IP6_CONFIG_SETTING_NAME);
/* Method */ /* 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, ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_IP6_FILE, TEST_WIRED_IP6_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_METHOD); NM_SETTING_IP_CONFIG_METHOD);
/* IPv6 address */ /* IPv6 address */
g_assert (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1); g_assert (nm_setting_ip_config_get_num_addresses (s_ip6) == 1);
check_ip6_address (s_ip6, 0, "abcd:1234:ffff::cdde", 64, "abcd:1234:ffff::cdd1"); check_ip_address (s_ip6, 0, "abcd:1234:ffff::cdde", 64, "abcd:1234:ffff::cdd1");
g_object_unref (connection); g_object_unref (connection);
} }
@ -699,8 +646,8 @@ test_write_ip6_wired_connection (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWired *s_wired; NMSettingWired *s_wired;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
char *uuid; char *uuid;
gboolean success; gboolean success;
NMConnection *reread; NMConnection *reread;
@ -735,30 +682,30 @@ test_write_ip6_wired_connection (void)
/* IP4 setting */ /* 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (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); NULL);
/* IP6 setting */ /* 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (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); NULL);
/* Addresses */ /* Addresses */
add_one_ip6_address (s_ip6, address, 64, gw); add_one_ip_address (s_ip6, address, 64, gw);
/* DNS servers */ /* DNS servers */
nm_setting_ip6_config_add_dns (s_ip6, dns); nm_setting_ip_config_add_dns (s_ip6, dns);
/* DNS searches */ /* 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 */ /* Write out the connection */
owner_uid = geteuid (); owner_uid = geteuid ();
@ -949,7 +896,7 @@ test_read_valid_wireless_connection (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWireless *s_wireless; NMSettingWireless *s_wireless;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
GError *error = NULL; GError *error = NULL;
const char *bssid; const char *bssid;
const guint8 expected_bssid[ETH_ALEN] = { 0x00, 0x1a, 0x33, 0x44, 0x99, 0x82 }; 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); NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */ /* 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, ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"connection-verify-wireless", "failed to verify %s: unexpected %s / %s key value", "connection-verify-wireless", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRELESS_FILE, TEST_WIRELESS_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_METHOD); NM_SETTING_IP_CONFIG_METHOD);
g_object_unref (connection); g_object_unref (connection);
} }
@ -1061,8 +1008,8 @@ test_write_wireless_connection (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWireless *s_wireless; NMSettingWireless *s_wireless;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
char *uuid; char *uuid;
const char *bssid = "aa:b9:a1:74:55:44"; const char *bssid = "aa:b9:a1:74:55:44";
GBytes *ssid; GBytes *ssid;
@ -1109,20 +1056,20 @@ test_write_wireless_connection (void)
/* IP4 setting */ /* 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (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); NULL);
/* IP6 setting */ /* 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (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); NULL);
/* Write out the connection */ /* Write out the connection */
@ -1199,7 +1146,7 @@ test_write_string_ssid (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWireless *s_wireless; NMSettingWireless *s_wireless;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
char *uuid, *testfile = NULL, *tmp; char *uuid, *testfile = NULL, *tmp;
GBytes *ssid; GBytes *ssid;
unsigned char tmpssid[] = { 65, 49, 50, 51, 32, 46, 92, 46, 36, 37, 126, 93 }; 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 */ /* 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (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); NULL);
/* Write out the connection */ /* Write out the connection */
@ -1322,7 +1269,7 @@ test_write_intlist_ssid (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWireless *s_wifi; NMSettingWireless *s_wifi;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
char *uuid, *testfile = NULL; char *uuid, *testfile = NULL;
GBytes *ssid; GBytes *ssid;
unsigned char tmpssid[] = { 65, 49, 50, 51, 0, 50, 50 }; unsigned char tmpssid[] = { 65, 49, 50, 51, 0, 50, 50 };
@ -1362,10 +1309,10 @@ test_write_intlist_ssid (void)
g_bytes_unref (ssid); g_bytes_unref (ssid);
/* IP4 setting */ /* 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); g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (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 */ /* Write out the connection */
owner_uid = geteuid (); owner_uid = geteuid ();
@ -1483,7 +1430,7 @@ test_write_intlike_ssid (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWireless *s_wifi; NMSettingWireless *s_wifi;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
char *uuid, *testfile = NULL; char *uuid, *testfile = NULL;
GBytes *ssid; GBytes *ssid;
unsigned char tmpssid[] = { 49, 48, 49 }; unsigned char tmpssid[] = { 49, 48, 49 };
@ -1522,10 +1469,10 @@ test_write_intlike_ssid (void)
g_bytes_unref (ssid); g_bytes_unref (ssid);
/* IP4 setting */ /* 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); g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (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 */ /* Write out the connection */
owner_uid = geteuid (); owner_uid = geteuid ();
@ -1569,7 +1516,7 @@ test_write_intlike_ssid_2 (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWireless *s_wifi; NMSettingWireless *s_wifi;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
char *uuid, *testfile = NULL; char *uuid, *testfile = NULL;
GBytes *ssid; GBytes *ssid;
unsigned char tmpssid[] = { 49, 49, 59, 49, 50, 59, 49, 51, 59}; 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); g_bytes_unref (ssid);
/* IP4 setting */ /* 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); g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (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 */ /* Write out the connection */
owner_uid = geteuid (); owner_uid = geteuid ();
@ -1816,7 +1763,7 @@ test_write_bt_dun_connection (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingBluetooth *s_bt; NMSettingBluetooth *s_bt;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSettingGsm *s_gsm; NMSettingGsm *s_gsm;
char *uuid; char *uuid;
const char *bdaddr = "aa:b9:a1:74:55:44"; const char *bdaddr = "aa:b9:a1:74:55:44";
@ -1857,11 +1804,11 @@ test_write_bt_dun_connection (void)
/* IP4 setting */ /* 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (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); NULL);
/* GSM setting */ /* GSM setting */
@ -2065,7 +2012,7 @@ test_write_gsm_connection (void)
{ {
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSettingGsm *s_gsm; NMSettingGsm *s_gsm;
char *uuid; char *uuid;
gboolean success; gboolean success;
@ -2095,11 +2042,11 @@ test_write_gsm_connection (void)
/* IP4 setting */ /* 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (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); NULL);
/* GSM setting */ /* GSM setting */
@ -2401,7 +2348,7 @@ create_wired_tls_connection (NMSetting8021xCKScheme scheme)
{ {
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSetting *s_wired; NMSetting *s_wired;
NMSetting8021x *s_8021x; NMSetting8021x *s_8021x;
char *uuid; char *uuid;
@ -2425,9 +2372,9 @@ create_wired_tls_connection (NMSetting8021xCKScheme scheme)
g_free (uuid); g_free (uuid);
/* IP4 setting */ /* IP4 setting */
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4); 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip4));
/* Wired setting */ /* Wired setting */
@ -2704,8 +2651,8 @@ test_write_infiniband_connection (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingInfiniband *s_ib; NMSettingInfiniband *s_ib;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
char *uuid; 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"; 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; gboolean success;
@ -2745,16 +2692,16 @@ test_write_infiniband_connection (void)
NULL); NULL);
/* IP4 setting */ /* IP4 setting */
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4); g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (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 */ /* IP6 setting */
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6); g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (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 */ /* Write out the connection */
owner_uid = geteuid (); owner_uid = geteuid ();
@ -2785,7 +2732,7 @@ test_read_bridge_main (void)
{ {
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSettingBridge *s_bridge; NMSettingBridge *s_bridge;
GError *error = NULL; GError *error = NULL;
const char *expected_id = "Test Bridge Main"; const char *expected_id = "Test Bridge Main";
@ -2809,7 +2756,7 @@ test_read_bridge_main (void)
/* IPv4 setting */ /* IPv4 setting */
s_ip4 = nm_connection_get_setting_ip4_config (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4); 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 */ /* Bridge setting */
s_bridge = nm_connection_get_setting_bridge (connection); s_bridge = nm_connection_get_setting_bridge (connection);
@ -2830,8 +2777,8 @@ test_write_bridge_main (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingBridge *s_bridge; NMSettingBridge *s_bridge;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
char *uuid; char *uuid;
gboolean success; gboolean success;
NMConnection *reread; NMConnection *reread;
@ -2864,21 +2811,21 @@ test_write_bridge_main (void)
nm_connection_add_setting (connection, NM_SETTING (s_bridge)); nm_connection_add_setting (connection, NM_SETTING (s_bridge));
/* IP4 setting */ /* IP4 setting */
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4); g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4)); nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (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,
NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL); 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 */ /* IP6 setting */
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6); g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (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 */ /* Write out the connection */
owner_uid = geteuid (); owner_uid = geteuid ();
@ -3401,7 +3348,7 @@ static void
test_read_enum_property (void) test_read_enum_property (void)
{ {
NMConnection *connection; NMConnection *connection;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
GError *error = NULL; GError *error = NULL;
gboolean success; gboolean success;
@ -3415,7 +3362,7 @@ test_read_enum_property (void)
/* IPv6 setting */ /* IPv6 setting */
s_ip6 = nm_connection_get_setting_ip6_config (connection); s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6); 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); g_object_unref (connection);
} }
@ -3426,7 +3373,7 @@ test_write_enum_property (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWired *s_wired; NMSettingWired *s_wired;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
char *uuid; char *uuid;
gboolean success; gboolean success;
NMConnection *reread; NMConnection *reread;
@ -3455,10 +3402,10 @@ test_write_enum_property (void)
nm_connection_add_setting (connection, NM_SETTING (s_wired)); nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP6 setting */ /* 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)); nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (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, NM_SETTING_IP6_CONFIG_IP6_PRIVACY, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR,
NULL); NULL);

View file

@ -578,25 +578,25 @@ static KeyWriter key_writers[] = {
NM_SETTING_CONNECTION_TYPE, NM_SETTING_CONNECTION_TYPE,
setting_alias_writer }, setting_alias_writer },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, { NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_ADDRESSES, NM_SETTING_IP_CONFIG_ADDRESSES,
addr_writer }, addr_writer },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, { NM_SETTING_IP4_CONFIG_SETTING_NAME,
"address-labels", "address-labels",
ip4_addr_label_writer }, ip4_addr_label_writer },
{ NM_SETTING_IP6_CONFIG_SETTING_NAME, { NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_ADDRESSES, NM_SETTING_IP_CONFIG_ADDRESSES,
addr_writer }, addr_writer },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, { NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_ROUTES, NM_SETTING_IP_CONFIG_ROUTES,
route_writer }, route_writer },
{ NM_SETTING_IP6_CONFIG_SETTING_NAME, { NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_ROUTES, NM_SETTING_IP_CONFIG_ROUTES,
route_writer }, route_writer },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, { NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP4_CONFIG_DNS, NM_SETTING_IP_CONFIG_DNS,
dns_writer }, dns_writer },
{ NM_SETTING_IP6_CONFIG_SETTING_NAME, { NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_DNS, NM_SETTING_IP_CONFIG_DNS,
dns_writer }, dns_writer },
{ NM_SETTING_WIRELESS_SETTING_NAME, { NM_SETTING_WIRELESS_SETTING_NAME,
NM_SETTING_WIRELESS_SSID, NM_SETTING_WIRELESS_SSID,

View file

@ -108,7 +108,7 @@ test_wifi_open (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWireless *s_wifi; NMSettingWireless *s_wifi;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSupplicantConfig *config; NMSupplicantConfig *config;
GHashTable *hash; GHashTable *hash;
char *uuid; char *uuid;
@ -149,10 +149,10 @@ test_wifi_open (void)
g_bytes_unref (ssid); g_bytes_unref (ssid);
/* IP4 setting */ /* 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)); 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, ASSERT (nm_connection_verify (connection, &error) == TRUE,
"wifi-open", "failed to verify connection: %s", "wifi-open", "failed to verify connection: %s",
@ -203,7 +203,7 @@ test_wifi_wep_key (const char *detail,
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWireless *s_wifi; NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec; NMSettingWirelessSecurity *s_wsec;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSupplicantConfig *config; NMSupplicantConfig *config;
GHashTable *hash; GHashTable *hash;
char *uuid; 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); nm_setting_wireless_security_set_wep_key (s_wsec, 0, key_data);
/* IP4 setting */ /* 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)); 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, ASSERT (nm_connection_verify (connection, &error) == TRUE,
detail, "failed to verify connection: %s", detail, "failed to verify connection: %s",
@ -340,7 +340,7 @@ test_wifi_wpa_psk (const char *detail,
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWireless *s_wifi; NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec; NMSettingWirelessSecurity *s_wsec;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
NMSupplicantConfig *config; NMSupplicantConfig *config;
GHashTable *hash; GHashTable *hash;
char *uuid; char *uuid;
@ -397,10 +397,10 @@ test_wifi_wpa_psk (const char *detail,
nm_setting_wireless_security_add_group (s_wsec, "ccmp"); nm_setting_wireless_security_add_group (s_wsec, "ccmp");
/* IP4 setting */ /* 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)); 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, ASSERT (nm_connection_verify (connection, &error) == TRUE,
detail, "failed to verify connection: %s", detail, "failed to verify connection: %s",

View file

@ -288,8 +288,7 @@ _match_connection_new (void)
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWired *s_wired; NMSettingWired *s_wired;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4, *s_ip6;
NMSettingIP6Config *s_ip6;
char *uuid; char *uuid;
connection = nm_simple_connection_new (); connection = nm_simple_connection_new ();
@ -308,16 +307,16 @@ _match_connection_new (void)
s_wired = (NMSettingWired *) nm_setting_wired_new (); s_wired = (NMSettingWired *) nm_setting_wired_new ();
nm_connection_add_setting (connection, (NMSetting *) s_wired); 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); nm_connection_add_setting (connection, (NMSetting *) s_ip4);
g_object_set (G_OBJECT (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); 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); nm_connection_add_setting (connection, (NMSetting *) s_ip6);
g_object_set (G_OBJECT (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); NULL);
return connection; return connection;
@ -328,7 +327,7 @@ test_connection_match_basic (void)
{ {
NMConnection *orig, *copy, *matched; NMConnection *orig, *copy, *matched;
GSList *connections = NULL; GSList *connections = NULL;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
orig = _match_connection_new (); orig = _match_connection_new ();
copy = nm_simple_connection_new_clone (orig); 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); s_ip4 = nm_connection_get_setting_ip4_config (orig);
g_assert (s_ip4); g_assert (s_ip4);
g_object_set (G_OBJECT (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); NULL);
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL); matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
g_assert (matched == NULL); g_assert (matched == NULL);
@ -356,7 +355,7 @@ test_connection_match_ip6_method (void)
{ {
NMConnection *orig, *copy, *matched; NMConnection *orig, *copy, *matched;
GSList *connections = NULL; GSList *connections = NULL;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
orig = _match_connection_new (); orig = _match_connection_new ();
copy = nm_simple_connection_new_clone (orig); 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); s_ip6 = nm_connection_get_setting_ip6_config (orig);
g_assert (s_ip6); g_assert (s_ip6);
g_object_set (G_OBJECT (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); NULL);
s_ip6 = nm_connection_get_setting_ip6_config (copy); s_ip6 = nm_connection_get_setting_ip6_config (copy);
g_assert (s_ip6); g_assert (s_ip6);
g_object_set (G_OBJECT (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,
NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL); NULL);
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, 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; NMConnection *orig, *copy, *matched;
GSList *connections = NULL; GSList *connections = NULL;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
orig = _match_connection_new (); orig = _match_connection_new ();
copy = nm_simple_connection_new_clone (orig); 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); s_ip6 = nm_connection_get_setting_ip6_config (orig);
g_assert (s_ip6); g_assert (s_ip6);
g_object_set (G_OBJECT (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); NULL);
s_ip6 = nm_connection_get_setting_ip6_config (copy); s_ip6 = nm_connection_get_setting_ip6_config (copy);
g_assert (s_ip6); g_assert (s_ip6);
g_object_set (G_OBJECT (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); NULL);
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, 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; NMConnection *orig, *copy, *matched;
GSList *connections = NULL; GSList *connections = NULL;
NMSettingIP6Config *s_ip6; NMSettingIPConfig *s_ip6;
orig = _match_connection_new (); orig = _match_connection_new ();
copy = nm_simple_connection_new_clone (orig); 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); s_ip6 = nm_connection_get_setting_ip6_config (orig);
g_assert (s_ip6); g_assert (s_ip6);
g_object_set (G_OBJECT (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); NULL);
s_ip6 = nm_connection_get_setting_ip6_config (copy); s_ip6 = nm_connection_get_setting_ip6_config (copy);
g_assert (s_ip6); g_assert (s_ip6);
g_object_set (G_OBJECT (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); NULL);
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, 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; NMConnection *orig, *copy, *matched;
GSList *connections = NULL; GSList *connections = NULL;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4;
orig = _match_connection_new (); orig = _match_connection_new ();
copy = nm_simple_connection_new_clone (orig); 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); s_ip4 = nm_connection_get_setting_ip4_config (orig);
g_assert (s_ip4); g_assert (s_ip4);
g_object_set (G_OBJECT (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); NULL);
s_ip4 = nm_connection_get_setting_ip4_config (copy); s_ip4 = nm_connection_get_setting_ip4_config (copy);
g_assert (s_ip4); g_assert (s_ip4);
g_object_set (G_OBJECT (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,
NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL); NULL);
matched = nm_utils_match_connection (connections, orig, FALSE, NULL, 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; NMConnection *orig, *copy, *matched;
GSList *connections = NULL; GSList *connections = NULL;
NMSettingIP4Config *s_ip4; NMSettingIPConfig *s_ip4, *s_ip6;
NMSettingIP6Config *s_ip6;
NMIPAddress *nm_addr; NMIPAddress *nm_addr;
GError *error = NULL; GError *error = NULL;
@ -589,34 +587,34 @@ test_connection_no_match_ip4_addr (void)
s_ip6 = nm_connection_get_setting_ip6_config (orig); s_ip6 = nm_connection_get_setting_ip6_config (orig);
g_assert (s_ip6); g_assert (s_ip6);
g_object_set (G_OBJECT (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); NULL);
s_ip6 = nm_connection_get_setting_ip6_config (copy); s_ip6 = nm_connection_get_setting_ip6_config (copy);
g_assert (s_ip6); g_assert (s_ip6);
g_object_set (G_OBJECT (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); NULL);
s_ip4 = nm_connection_get_setting_ip4_config (orig); s_ip4 = nm_connection_get_setting_ip4_config (orig);
g_assert (s_ip4); g_assert (s_ip4);
g_object_set (G_OBJECT (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); NULL);
nm_addr = nm_ip_address_new (AF_INET, "1.1.1.4", 24, "1.1.1.254", &error); nm_addr = nm_ip_address_new (AF_INET, "1.1.1.4", 24, "1.1.1.254", &error);
g_assert_no_error (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); nm_ip_address_unref (nm_addr);
s_ip4 = nm_connection_get_setting_ip4_config (copy); s_ip4 = nm_connection_get_setting_ip4_config (copy);
g_assert (s_ip4); g_assert (s_ip4);
g_object_set (G_OBJECT (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); NULL);
nm_addr = nm_ip_address_new (AF_INET, "2.2.2.4", 24, "2.2.2.254", &error); nm_addr = nm_ip_address_new (AF_INET, "2.2.2.4", 24, "2.2.2.254", &error);
g_assert_no_error (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); nm_ip_address_unref (nm_addr);
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL); matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);

View file

@ -20,6 +20,7 @@
#include <glib.h> #include <glib.h>
#include <string.h> #include <string.h>
#include <arpa/inet.h>
#include "NetworkManagerUtils.h" #include "NetworkManagerUtils.h"
#include "nm-ip4-config.h" #include "nm-ip4-config.h"