static gboolean
add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection)
{
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
gboolean ret;
if (!ip4addr)
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (!s_ip4) {
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
NULL);
}
- ret = nm_setting_ip4_config_add_address (s_ip4, ip4addr);
+ ret = nm_setting_ip_config_add_address (s_ip4, ip4addr);
nm_ip_address_unref (ip4addr);
return ret;
static gboolean
add_ip6_address_to_connection (NMIPAddress *ip6addr, NMConnection *connection)
{
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
gboolean ret;
if (!ip6addr)
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (!s_ip6) {
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
NULL);
}
- ret = nm_setting_ip6_config_add_address (s_ip6, ip6addr);
+ ret = nm_setting_ip_config_add_address (s_ip6, ip6addr);
nm_ip_address_unref (ip6addr);
return ret;
static void
editor_init_existing_connection (NMConnection *connection)
{
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4, *s_ip6;
NMSettingWireless *s_wireless;
NMSettingConnection *s_con;
#include "config.h"
#include <stdlib.h>
+#include <arpa/inet.h>
#include <glib.h>
#include <glib/gi18n.h>
/* Available fields for NM_SETTING_IP4_CONFIG_SETTING_NAME */
NmcOutputField nmc_fields_setting_ip4_config[] = {
- SETTING_FIELD ("name", 8), /* 0 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_METHOD, 10), /* 1 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_DNS, 20), /* 2 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_DNS_SEARCH, 15), /* 3 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_ADDRESSES, 20), /* 4 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_ROUTES, 20), /* 5 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, 15), /* 8 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, 19), /* 9 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, 14), /* 10 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, 15), /* 11 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_MAY_FAIL, 12), /* 12 */
+ SETTING_FIELD ("name", 8), /* 0 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_METHOD, 10), /* 1 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS, 20), /* 2 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_SEARCH, 15), /* 3 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_ADDRESSES, 20), /* 4 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTES, 20), /* 5 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */
+ SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, 15), /* 8 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, 19), /* 9 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, 14), /* 10 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, 15), /* 11 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL, 12), /* 12 */
{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
};
#define NMC_FIELDS_SETTING_IP4_CONFIG_ALL "name"","\
- NM_SETTING_IP4_CONFIG_METHOD","\
- NM_SETTING_IP4_CONFIG_DNS","\
- NM_SETTING_IP4_CONFIG_DNS_SEARCH","\
- NM_SETTING_IP4_CONFIG_ADDRESSES","\
- NM_SETTING_IP4_CONFIG_ROUTES","\
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES","\
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS","\
+ NM_SETTING_IP_CONFIG_METHOD","\
+ NM_SETTING_IP_CONFIG_DNS","\
+ NM_SETTING_IP_CONFIG_DNS_SEARCH","\
+ NM_SETTING_IP_CONFIG_ADDRESSES","\
+ NM_SETTING_IP_CONFIG_ROUTES","\
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES","\
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS","\
NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID","\
- NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME","\
- NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME","\
- NM_SETTING_IP4_CONFIG_NEVER_DEFAULT","\
- NM_SETTING_IP4_CONFIG_MAY_FAIL
+ NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME","\
+ NM_SETTING_IP_CONFIG_DHCP_HOSTNAME","\
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT","\
+ NM_SETTING_IP_CONFIG_MAY_FAIL
#define NMC_FIELDS_SETTING_IP4_CONFIG_COMMON NMC_FIELDS_SETTING_IP4_CONFIG_ALL
/* Available fields for NM_SETTING_IP6_CONFIG_SETTING_NAME */
NmcOutputField nmc_fields_setting_ip6_config[] = {
- SETTING_FIELD ("name", 8), /* 0 */
- SETTING_FIELD (NM_SETTING_IP6_CONFIG_METHOD, 10), /* 1 */
- SETTING_FIELD (NM_SETTING_IP6_CONFIG_DNS, 20), /* 2 */
- SETTING_FIELD (NM_SETTING_IP6_CONFIG_DNS_SEARCH, 15), /* 3 */
- SETTING_FIELD (NM_SETTING_IP6_CONFIG_ADDRESSES, 20), /* 4 */
- SETTING_FIELD (NM_SETTING_IP6_CONFIG_ROUTES, 20), /* 5 */
- SETTING_FIELD (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */
- SETTING_FIELD (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */
- SETTING_FIELD (NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, 15), /* 8 */
- SETTING_FIELD (NM_SETTING_IP6_CONFIG_MAY_FAIL, 12), /* 9 */
- SETTING_FIELD (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, 15), /* 10 */
- SETTING_FIELD (NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, 14), /* 11 */
+ SETTING_FIELD ("name", 8), /* 0 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_METHOD, 10), /* 1 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS, 20), /* 2 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_SEARCH, 15), /* 3 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_ADDRESSES, 20), /* 4 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTES, 20), /* 5 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, 15), /* 8 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL, 12), /* 9 */
+ SETTING_FIELD (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, 15), /* 10 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, 14), /* 11 */
{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
};
#define NMC_FIELDS_SETTING_IP6_CONFIG_ALL "name"","\
- NM_SETTING_IP6_CONFIG_METHOD","\
- NM_SETTING_IP6_CONFIG_DNS","\
- NM_SETTING_IP6_CONFIG_DNS_SEARCH","\
- NM_SETTING_IP6_CONFIG_ADDRESSES","\
- NM_SETTING_IP6_CONFIG_ROUTES","\
- NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES","\
- NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS","\
- NM_SETTING_IP6_CONFIG_NEVER_DEFAULT","\
- NM_SETTING_IP6_CONFIG_MAY_FAIL","\
+ NM_SETTING_IP_CONFIG_METHOD","\
+ NM_SETTING_IP_CONFIG_DNS","\
+ NM_SETTING_IP_CONFIG_DNS_SEARCH","\
+ NM_SETTING_IP_CONFIG_ADDRESSES","\
+ NM_SETTING_IP_CONFIG_ROUTES","\
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES","\
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS","\
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT","\
+ NM_SETTING_IP_CONFIG_MAY_FAIL","\
NM_SETTING_IP6_CONFIG_IP6_PRIVACY","\
- NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME
+ NM_SETTING_IP_CONFIG_DHCP_HOSTNAME
#define NMC_FIELDS_SETTING_IP6_CONFIG_COMMON NMC_FIELDS_SETTING_IP4_CONFIG_ALL
/* Available fields for NM_SETTING_SERIAL_SETTING_NAME */
DEFINE_GETTER (nmc_property_ib_get_parent, NM_SETTING_INFINIBAND_PARENT)
/* --- NM_SETTING_IP4_CONFIG_SETTING_NAME property get functions --- */
-DEFINE_GETTER (nmc_property_ipv4_get_method, NM_SETTING_IP4_CONFIG_METHOD)
-DEFINE_GETTER (nmc_property_ipv4_get_dns, NM_SETTING_IP4_CONFIG_DNS)
-DEFINE_GETTER (nmc_property_ipv4_get_dns_search, NM_SETTING_IP4_CONFIG_DNS_SEARCH)
+DEFINE_GETTER (nmc_property_ipv4_get_method, NM_SETTING_IP_CONFIG_METHOD)
+DEFINE_GETTER (nmc_property_ipv4_get_dns, NM_SETTING_IP_CONFIG_DNS)
+DEFINE_GETTER (nmc_property_ipv4_get_dns_search, NM_SETTING_IP_CONFIG_DNS_SEARCH)
static char *
nmc_property_ipv4_get_addresses (NMSetting *setting)
{
- NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (setting);
+ NMSettingIPConfig *s_ip4 = NM_SETTING_IP_CONFIG (setting);
GString *printable;
guint32 num_addresses, i;
NMIPAddress *addr;
printable = g_string_new (NULL);
- num_addresses = nm_setting_ip4_config_get_num_addresses (s_ip4);
+ num_addresses = nm_setting_ip_config_get_num_addresses (s_ip4);
for (i = 0; i < num_addresses; i++) {
- addr = nm_setting_ip4_config_get_address (s_ip4, i);
+ addr = nm_setting_ip_config_get_address (s_ip4, i);
if (printable->len > 0)
g_string_append (printable, "; ");
static char *
nmc_property_ipv4_get_routes (NMSetting *setting)
{
- NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (setting);
+ NMSettingIPConfig *s_ip4 = NM_SETTING_IP_CONFIG (setting);
GString *printable;
guint32 num_routes, i;
NMIPRoute *route;
printable = g_string_new (NULL);
- num_routes = nm_setting_ip4_config_get_num_routes (s_ip4);
+ num_routes = nm_setting_ip_config_get_num_routes (s_ip4);
for (i = 0; i < num_routes; i++) {
- route = nm_setting_ip4_config_get_route (s_ip4, i);
+ route = nm_setting_ip_config_get_route (s_ip4, i);
if (printable->len > 0)
g_string_append (printable, "; ");
return g_string_free (printable, FALSE);
}
-DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_routes, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES)
-DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_dns, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS)
+DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_routes, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES)
+DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_dns, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS)
DEFINE_GETTER (nmc_property_ipv4_get_dhcp_client_id, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID)
-DEFINE_GETTER (nmc_property_ipv4_get_dhcp_send_hostname, NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME)
-DEFINE_GETTER (nmc_property_ipv4_get_dhcp_hostname, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME)
-DEFINE_GETTER (nmc_property_ipv4_get_never_default, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT)
-DEFINE_GETTER (nmc_property_ipv4_get_may_fail, NM_SETTING_IP4_CONFIG_MAY_FAIL)
+DEFINE_GETTER (nmc_property_ipv4_get_dhcp_send_hostname, NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME)
+DEFINE_GETTER (nmc_property_ipv4_get_dhcp_hostname, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME)
+DEFINE_GETTER (nmc_property_ipv4_get_never_default, NM_SETTING_IP_CONFIG_NEVER_DEFAULT)
+DEFINE_GETTER (nmc_property_ipv4_get_may_fail, NM_SETTING_IP_CONFIG_MAY_FAIL)
/* --- NM_SETTING_IP6_CONFIG_SETTING_NAME property get functions --- */
-DEFINE_GETTER (nmc_property_ipv6_get_method, NM_SETTING_IP6_CONFIG_METHOD)
-DEFINE_GETTER (nmc_property_ipv6_get_dns, NM_SETTING_IP6_CONFIG_DNS)
-DEFINE_GETTER (nmc_property_ipv6_get_dns_search, NM_SETTING_IP6_CONFIG_DNS_SEARCH)
+DEFINE_GETTER (nmc_property_ipv6_get_method, NM_SETTING_IP_CONFIG_METHOD)
+DEFINE_GETTER (nmc_property_ipv6_get_dns, NM_SETTING_IP_CONFIG_DNS)
+DEFINE_GETTER (nmc_property_ipv6_get_dns_search, NM_SETTING_IP_CONFIG_DNS_SEARCH)
static char *
nmc_property_ipv6_get_addresses (NMSetting *setting)
{
- NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting);
+ NMSettingIPConfig *s_ip6 = NM_SETTING_IP_CONFIG (setting);
GString *printable;
guint32 num_addresses, i;
NMIPAddress *addr;
printable = g_string_new (NULL);
- num_addresses = nm_setting_ip6_config_get_num_addresses (s_ip6);
+ num_addresses = nm_setting_ip_config_get_num_addresses (s_ip6);
for (i = 0; i < num_addresses; i++) {
- addr = nm_setting_ip6_config_get_address (s_ip6, i);
+ addr = nm_setting_ip_config_get_address (s_ip6, i);
if (printable->len > 0)
g_string_append (printable, "; ");
static char *
nmc_property_ipv6_get_routes (NMSetting *setting)
{
- NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting);
+ NMSettingIPConfig *s_ip6 = NM_SETTING_IP_CONFIG (setting);
GString *printable;
guint32 num_routes, i;
NMIPRoute *route;
printable = g_string_new (NULL);
- num_routes = nm_setting_ip6_config_get_num_routes (s_ip6);
+ num_routes = nm_setting_ip_config_get_num_routes (s_ip6);
for (i = 0; i < num_routes; i++) {
- route = nm_setting_ip6_config_get_route (s_ip6, i);
+ route = nm_setting_ip_config_get_route (s_ip6, i);
if (printable->len > 0)
g_string_append (printable, "; ");
return g_string_free (printable, FALSE);
}
-DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_routes, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES)
-DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_dns, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS)
-DEFINE_GETTER (nmc_property_ipv6_get_never_default, NM_SETTING_IP6_CONFIG_NEVER_DEFAULT)
-DEFINE_GETTER (nmc_property_ipv6_get_may_fail, NM_SETTING_IP6_CONFIG_MAY_FAIL)
-DEFINE_GETTER (nmc_property_ipv6_get_dhcp_hostname, NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME)
+DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_routes, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES)
+DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_dns, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS)
+DEFINE_GETTER (nmc_property_ipv6_get_never_default, NM_SETTING_IP_CONFIG_NEVER_DEFAULT)
+DEFINE_GETTER (nmc_property_ipv6_get_may_fail, NM_SETTING_IP_CONFIG_MAY_FAIL)
+DEFINE_GETTER (nmc_property_ipv6_get_dhcp_hostname, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME)
static char *
nmc_property_ipv6_get_ip6_privacy (NMSetting *setting)
/* If we have some IP addresses set method to 'manual'.
* Else if the method was 'manual', change it back to 'auto'.
*/
- if (nm_setting_ip4_config_get_num_addresses (NM_SETTING_IP4_CONFIG (object))) {
- if (g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
+ if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) {
+ if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
if (!answered) {
answered = TRUE;
answer = get_answer ("ipv4.method", "manual");
}
if (answer)
- g_object_set (object, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
+ g_object_set (object, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
}
} else {
answered = FALSE;
- if (!g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
- g_object_set (object, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ if (!g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
+ g_object_set (object, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
}
g_signal_handlers_unblock_by_func (object, G_CALLBACK (ipv4_method_changed_cb), NULL);
g_signal_handlers_block_by_func (object, G_CALLBACK (ipv4_addresses_changed_cb), NULL);
/* If method != manual, remove addresses (save them for restoring them later when method becomes 'manual' */
- if (g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
- if (nm_setting_ip4_config_get_num_addresses (NM_SETTING_IP4_CONFIG (object))) {
+ if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
+ if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) {
if (!answered) {
answered = TRUE;
answer = get_answer ("ipv4.addresses", NULL);
if (answer) {
if (G_IS_VALUE (&value))
g_value_unset (&value);
- nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP4_CONFIG_ADDRESSES, &value);
- g_object_set (object, NM_SETTING_IP4_CONFIG_ADDRESSES, NULL, NULL);
+ nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value);
+ g_object_set (object, NM_SETTING_IP_CONFIG_ADDRESSES, NULL, NULL);
}
}
} else {
answered = FALSE;
if (G_IS_VALUE (&value)) {
- nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP4_CONFIG_ADDRESSES, &value);
+ nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value);
g_value_unset (&value);
}
}
/* If we have some IP addresses set method to 'manual'.
* Else if the method was 'manual', change it back to 'auto'.
*/
- if (nm_setting_ip6_config_get_num_addresses (NM_SETTING_IP6_CONFIG (object))) {
- if (g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
+ if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) {
+ if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
if (!answered) {
answered = TRUE;
answer = get_answer ("ipv6.method", "manual");
}
if (answer)
- g_object_set (object, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL);
+ g_object_set (object, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL);
}
} else {
answered = FALSE;
- if (!g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL))
- g_object_set (object, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
+ if (!g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL))
+ g_object_set (object, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
}
g_signal_handlers_unblock_by_func (object, G_CALLBACK (ipv6_method_changed_cb), NULL);
g_signal_handlers_block_by_func (object, G_CALLBACK (ipv6_addresses_changed_cb), NULL);
/* If method != manual, remove addresses (save them for restoring them later when method becomes 'manual' */
- if (g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
- if (nm_setting_ip6_config_get_num_addresses (NM_SETTING_IP6_CONFIG (object))) {
+ if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
+ if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) {
if (!answered) {
answered = TRUE;
answer = get_answer ("ipv6.addresses", NULL);
if (answer) {
if (G_IS_VALUE (&value))
g_value_unset (&value);
- nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP6_CONFIG_ADDRESSES, &value);
- g_object_set (object, NM_SETTING_IP6_CONFIG_ADDRESSES, NULL, NULL);
+ nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value);
+ g_object_set (object, NM_SETTING_IP_CONFIG_ADDRESSES, NULL, NULL);
}
}
} else {
answered = FALSE;
if (G_IS_VALUE (&value)) {
- nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP6_CONFIG_ADDRESSES, &value);
+ nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value);
g_value_unset (&value);
}
}
}
void
-nmc_setting_ip4_connect_handlers (NMSettingIP4Config *setting)
+nmc_setting_ip4_connect_handlers (NMSettingIPConfig *setting)
{
g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
- g_signal_connect (setting, "notify::" NM_SETTING_IP4_CONFIG_ADDRESSES,
+ g_signal_connect (setting, "notify::" NM_SETTING_IP_CONFIG_ADDRESSES,
G_CALLBACK (ipv4_addresses_changed_cb), NULL);
- g_signal_connect (setting, "notify::" NM_SETTING_IP4_CONFIG_METHOD,
+ g_signal_connect (setting, "notify::" NM_SETTING_IP_CONFIG_METHOD,
G_CALLBACK (ipv4_method_changed_cb), NULL);
}
void
-nmc_setting_ip6_connect_handlers (NMSettingIP6Config *setting)
+nmc_setting_ip6_connect_handlers (NMSettingIPConfig *setting)
{
g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
- g_signal_connect (setting, "notify::" NM_SETTING_IP6_CONFIG_ADDRESSES,
+ g_signal_connect (setting, "notify::" NM_SETTING_IP_CONFIG_ADDRESSES,
G_CALLBACK (ipv6_addresses_changed_cb), NULL);
- g_signal_connect (setting, "notify::" NM_SETTING_IP6_CONFIG_METHOD,
+ g_signal_connect (setting, "notify::" NM_SETTING_IP_CONFIG_METHOD,
G_CALLBACK (ipv6_method_changed_cb), NULL);
}
g_return_if_fail (NM_IS_SETTING (setting));
if (NM_IS_SETTING_IP4_CONFIG (setting)) {
- g_object_set (NM_SETTING_IP4_CONFIG (setting),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ g_object_set (NM_SETTING_IP_CONFIG (setting),
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
- nmc_setting_ip4_connect_handlers (NM_SETTING_IP4_CONFIG (setting));
+ nmc_setting_ip4_connect_handlers (NM_SETTING_IP_CONFIG (setting));
} else if (NM_IS_SETTING_IP6_CONFIG (setting)) {
- g_object_set (NM_SETTING_IP6_CONFIG (setting),
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+ g_object_set (NM_SETTING_IP_CONFIG (setting),
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
NULL);
- nmc_setting_ip6_connect_handlers (NM_SETTING_IP6_CONFIG (setting));
+ nmc_setting_ip6_connect_handlers (NM_SETTING_IP_CONFIG (setting));
} else if (NM_IS_SETTING_WIRELESS (setting)) {
g_object_set (NM_SETTING_WIRELESS (setting),
NM_SETTING_WIRELESS_MODE, NM_SETTING_WIRELESS_MODE_INFRA,
g_strfreev (strv);
return FALSE;
}
- nm_setting_ip4_config_add_dns (NM_SETTING_IP4_CONFIG (setting), addr);
+ nm_setting_ip_config_add_dns (NM_SETTING_IP_CONFIG (setting), addr);
}
g_strfreev (strv);
return TRUE;
}
static gboolean
-_validate_and_remove_ipv4_dns (NMSettingIP4Config *setting,
+_validate_and_remove_ipv4_dns (NMSettingIPConfig *setting,
const char *dns,
GError **error)
{
return FALSE;
}
- ret = nm_setting_ip4_config_remove_dns_by_value (setting, dns);
+ ret = nm_setting_ip_config_remove_dns_by_value (setting, dns);
if (!ret)
g_set_error (error, 1, 0, _("the property doesn't contain DNS server '%s'"), dns);
return ret;
}
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_dns,
- NM_SETTING_IP4_CONFIG,
- nm_setting_ip4_config_get_num_dns,
- nm_setting_ip4_config_remove_dns,
+ NM_SETTING_IP_CONFIG,
+ nm_setting_ip_config_get_num_dns,
+ nm_setting_ip_config_remove_dns,
_validate_and_remove_ipv4_dns)
static const char *
}
while (strv && strv[i])
- nm_setting_ip4_config_add_dns_search (NM_SETTING_IP4_CONFIG (setting), strv[i++]);
+ nm_setting_ip_config_add_dns_search (NM_SETTING_IP_CONFIG (setting), strv[i++]);
g_strfreev (strv);
return TRUE;
}
static gboolean
-_validate_and_remove_ipv4_dns_search (NMSettingIP4Config *setting,
+_validate_and_remove_ipv4_dns_search (NMSettingIPConfig *setting,
const char *dns_search,
GError **error)
{
gboolean ret;
- ret = nm_setting_ip4_config_remove_dns_search_by_value (setting, dns_search);
+ ret = nm_setting_ip_config_remove_dns_search_by_value (setting, dns_search);
if (!ret)
g_set_error (error, 1, 0,
_("the property doesn't contain DNS search domain '%s'"),
return ret;
}
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_dns_search,
- NM_SETTING_IP4_CONFIG,
- nm_setting_ip4_config_get_num_dns_searches,
- nm_setting_ip4_config_remove_dns_search,
+ NM_SETTING_IP_CONFIG,
+ nm_setting_ip_config_get_num_dns_searches,
+ nm_setting_ip_config_remove_dns_search,
_validate_and_remove_ipv4_dns_search)
/* 'addresses' */
g_strfreev (strv);
return FALSE;
}
- nm_setting_ip4_config_add_address (NM_SETTING_IP4_CONFIG (setting), ip4addr);
+ nm_setting_ip_config_add_address (NM_SETTING_IP_CONFIG (setting), ip4addr);
nm_ip_address_unref (ip4addr);
}
g_strfreev (strv);
}
static gboolean
-_validate_and_remove_ipv4_address (NMSettingIP4Config *setting,
+_validate_and_remove_ipv4_address (NMSettingIPConfig *setting,
const char *address,
GError **error)
{
if (!ip4addr)
return FALSE;
- ret = nm_setting_ip4_config_remove_address_by_value (setting, ip4addr);
+ ret = nm_setting_ip_config_remove_address_by_value (setting, ip4addr);
if (!ret)
g_set_error (error, 1, 0,
_("the property doesn't contain IP address '%s'"), address);
return ret;
}
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_addresses,
- NM_SETTING_IP4_CONFIG,
- nm_setting_ip4_config_get_num_addresses,
- nm_setting_ip4_config_remove_address,
+ NM_SETTING_IP_CONFIG,
+ nm_setting_ip_config_get_num_addresses,
+ nm_setting_ip_config_remove_address,
_validate_and_remove_ipv4_address)
static const char *
g_strfreev (strv);
return FALSE;
}
- nm_setting_ip4_config_add_route (NM_SETTING_IP4_CONFIG (setting), ip4route);
+ nm_setting_ip_config_add_route (NM_SETTING_IP_CONFIG (setting), ip4route);
nm_ip_route_unref (ip4route);
}
g_strfreev (strv);
}
static gboolean
-_validate_and_remove_ipv4_route (NMSettingIP4Config *setting,
+_validate_and_remove_ipv4_route (NMSettingIPConfig *setting,
const char *route,
GError **error)
{
if (!ip4route)
return FALSE;
- ret = nm_setting_ip4_config_remove_route_by_value (setting, ip4route);
+ ret = nm_setting_ip_config_remove_route_by_value (setting, ip4route);
if (!ret)
g_set_error (error, 1, 0, _("the property doesn't contain route '%s'"), route);
nm_ip_route_unref (ip4route);
return ret;
}
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_routes,
- NM_SETTING_IP4_CONFIG,
- nm_setting_ip4_config_get_num_routes,
- nm_setting_ip4_config_remove_route,
+ NM_SETTING_IP_CONFIG,
+ nm_setting_ip_config_get_num_routes,
+ nm_setting_ip_config_remove_route,
_validate_and_remove_ipv4_route)
static const char *
g_strfreev (strv);
return FALSE;
}
- nm_setting_ip6_config_add_dns (NM_SETTING_IP6_CONFIG (setting), addr);
+ nm_setting_ip_config_add_dns (NM_SETTING_IP_CONFIG (setting), addr);
}
g_strfreev (strv);
return TRUE;
}
static gboolean
-_validate_and_remove_ipv6_dns (NMSettingIP6Config *setting,
+_validate_and_remove_ipv6_dns (NMSettingIPConfig *setting,
const char *dns,
GError **error)
{
return FALSE;
}
- ret = nm_setting_ip6_config_remove_dns_by_value (setting, dns);
+ ret = nm_setting_ip_config_remove_dns_by_value (setting, dns);
if (!ret)
g_set_error (error, 1, 0, _("the property doesn't contain DNS server '%s'"), dns);
return ret;
}
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_dns,
- NM_SETTING_IP6_CONFIG,
- nm_setting_ip6_config_get_num_dns,
- nm_setting_ip6_config_remove_dns,
+ NM_SETTING_IP_CONFIG,
+ nm_setting_ip_config_get_num_dns,
+ nm_setting_ip_config_remove_dns,
_validate_and_remove_ipv6_dns)
static const char *
}
while (strv && strv[i])
- nm_setting_ip6_config_add_dns_search (NM_SETTING_IP6_CONFIG (setting), strv[i++]);
+ nm_setting_ip_config_add_dns_search (NM_SETTING_IP_CONFIG (setting), strv[i++]);
g_strfreev (strv);
return TRUE;
}
static gboolean
-_validate_and_remove_ipv6_dns_search (NMSettingIP6Config *setting,
+_validate_and_remove_ipv6_dns_search (NMSettingIPConfig *setting,
const char *dns_search,
GError **error)
{
gboolean ret;
- ret = nm_setting_ip6_config_remove_dns_search_by_value (setting, dns_search);
+ ret = nm_setting_ip_config_remove_dns_search_by_value (setting, dns_search);
if (!ret)
g_set_error (error, 1, 0,
_("the property doesn't contain DNS search domain '%s'"),
return ret;
}
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_dns_search,
- NM_SETTING_IP6_CONFIG,
- nm_setting_ip6_config_get_num_dns_searches,
- nm_setting_ip6_config_remove_dns_search,
+ NM_SETTING_IP_CONFIG,
+ nm_setting_ip_config_get_num_dns_searches,
+ nm_setting_ip_config_remove_dns_search,
_validate_and_remove_ipv6_dns_search)
/* 'addresses' */
g_strfreev (strv);
return FALSE;
}
- nm_setting_ip6_config_add_address (NM_SETTING_IP6_CONFIG (setting), ip6addr);
+ nm_setting_ip_config_add_address (NM_SETTING_IP_CONFIG (setting), ip6addr);
nm_ip_address_unref (ip6addr);
}
g_strfreev (strv);
}
static gboolean
-_validate_and_remove_ipv6_address (NMSettingIP6Config *setting,
+_validate_and_remove_ipv6_address (NMSettingIPConfig *setting,
const char *address,
GError **error)
{
if (!ip6addr)
return FALSE;
- ret = nm_setting_ip6_config_remove_address_by_value (setting, ip6addr);
+ ret = nm_setting_ip_config_remove_address_by_value (setting, ip6addr);
if (!ret)
g_set_error (error, 1, 0, _("the property doesn't contain IP address '%s'"), address);
nm_ip_address_unref (ip6addr);
return ret;
}
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_addresses,
- NM_SETTING_IP6_CONFIG,
- nm_setting_ip6_config_get_num_addresses,
- nm_setting_ip6_config_remove_address,
+ NM_SETTING_IP_CONFIG,
+ nm_setting_ip_config_get_num_addresses,
+ nm_setting_ip_config_remove_address,
_validate_and_remove_ipv6_address)
static const char *
g_strfreev (strv);
return FALSE;
}
- nm_setting_ip6_config_add_route (NM_SETTING_IP6_CONFIG (setting), ip6route);
+ nm_setting_ip_config_add_route (NM_SETTING_IP_CONFIG (setting), ip6route);
nm_ip_route_unref (ip6route);
}
g_strfreev (strv);
}
static gboolean
-_validate_and_remove_ipv6_route (NMSettingIP6Config *setting,
+_validate_and_remove_ipv6_route (NMSettingIPConfig *setting,
const char *route,
GError **error)
{
if (!ip6route)
return FALSE;
- ret = nm_setting_ip6_config_remove_route_by_value (setting, ip6route);
+ ret = nm_setting_ip_config_remove_route_by_value (setting, ip6route);
if (!ret)
g_set_error (error, 1, 0, _("the property doesn't contain route '%s'"), route);
nm_ip_route_unref (ip6route);
return ret;
}
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_routes,
- NM_SETTING_IP6_CONFIG,
- nm_setting_ip6_config_get_num_routes,
- nm_setting_ip6_config_remove_route,
+ NM_SETTING_IP_CONFIG,
+ nm_setting_ip_config_get_num_routes,
+ nm_setting_ip_config_remove_route,
_validate_and_remove_ipv6_route)
static const char *
/* concatenate setting name and property name */
#define GLUE(A,B) (g_strconcat ((NM_SETTING_##A##_SETTING_NAME),(NM_SETTING_##A##_##B), NULL))
+#define GLUE_IP(A,B) (g_strconcat ((NM_SETTING_IP##A##_CONFIG_SETTING_NAME),(NM_SETTING_IP_CONFIG_##B), NULL))
+
void
nmc_properties_init (void)
{
NULL);
/* Add editable properties for NM_SETTING_IP4_CONFIG_SETTING_NAME */
- nmc_add_prop_funcs (GLUE (IP4_CONFIG, METHOD),
+ nmc_add_prop_funcs (GLUE_IP (4, METHOD),
nmc_property_ipv4_get_method,
nmc_property_ipv4_set_method,
NULL,
NULL,
nmc_property_ipv4_allowed_method,
NULL);
- nmc_add_prop_funcs (GLUE (IP4_CONFIG, DNS),
+ nmc_add_prop_funcs (GLUE_IP (4, DNS),
nmc_property_ipv4_get_dns,
nmc_property_ipv4_set_dns,
nmc_property_ipv4_remove_dns,
nmc_property_ipv4_describe_dns,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP4_CONFIG, DNS_SEARCH),
+ nmc_add_prop_funcs (GLUE_IP (4, DNS_SEARCH),
nmc_property_ipv4_get_dns_search,
nmc_property_ipv4_set_dns_search,
nmc_property_ipv4_remove_dns_search,
NULL,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP4_CONFIG, ADDRESSES),
+ nmc_add_prop_funcs (GLUE_IP (4, ADDRESSES),
nmc_property_ipv4_get_addresses,
nmc_property_ipv4_set_addresses,
nmc_property_ipv4_remove_addresses,
nmc_property_ipv4_describe_addresses,
NULL,
nmc_property_out2in_addresses);
- nmc_add_prop_funcs (GLUE (IP4_CONFIG, ROUTES),
+ nmc_add_prop_funcs (GLUE_IP (4, ROUTES),
nmc_property_ipv4_get_routes,
nmc_property_ipv4_set_routes,
nmc_property_ipv4_remove_routes,
nmc_property_ipv4_describe_routes,
NULL,
nmc_property_out2in_routes);
- nmc_add_prop_funcs (GLUE (IP4_CONFIG, IGNORE_AUTO_ROUTES),
+ nmc_add_prop_funcs (GLUE_IP (4, IGNORE_AUTO_ROUTES),
nmc_property_ipv4_get_ignore_auto_routes,
nmc_property_set_bool,
NULL,
NULL,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP4_CONFIG, IGNORE_AUTO_DNS),
+ nmc_add_prop_funcs (GLUE_IP (4, IGNORE_AUTO_DNS),
nmc_property_ipv4_get_ignore_auto_dns,
nmc_property_set_bool,
NULL,
NULL,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_SEND_HOSTNAME),
+ nmc_add_prop_funcs (GLUE_IP (4, DHCP_SEND_HOSTNAME),
nmc_property_ipv4_get_dhcp_send_hostname,
nmc_property_set_bool,
NULL,
NULL,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_HOSTNAME),
+ nmc_add_prop_funcs (GLUE_IP (4, DHCP_HOSTNAME),
nmc_property_ipv4_get_dhcp_hostname,
nmc_property_set_string,
NULL,
NULL,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP4_CONFIG, NEVER_DEFAULT),
+ nmc_add_prop_funcs (GLUE_IP (4, NEVER_DEFAULT),
nmc_property_ipv4_get_never_default,
nmc_property_set_bool,
NULL,
NULL,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP4_CONFIG, MAY_FAIL),
+ nmc_add_prop_funcs (GLUE_IP (4, MAY_FAIL),
nmc_property_ipv4_get_may_fail,
nmc_property_set_bool,
NULL,
NULL);
/* Add editable properties for NM_SETTING_IP6_CONFIG_SETTING_NAME */
- nmc_add_prop_funcs (GLUE (IP6_CONFIG, METHOD),
+ nmc_add_prop_funcs (GLUE_IP (6, METHOD),
nmc_property_ipv6_get_method,
nmc_property_ipv6_set_method,
NULL,
NULL,
nmc_property_ipv6_allowed_method,
NULL);
- nmc_add_prop_funcs (GLUE (IP6_CONFIG, DNS),
+ nmc_add_prop_funcs (GLUE_IP (6, DNS),
nmc_property_ipv6_get_dns,
nmc_property_ipv6_set_dns,
nmc_property_ipv6_remove_dns,
nmc_property_ipv6_describe_dns,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP6_CONFIG, DNS_SEARCH),
+ nmc_add_prop_funcs (GLUE_IP (6, DNS_SEARCH),
nmc_property_ipv6_get_dns_search,
nmc_property_ipv6_set_dns_search,
nmc_property_ipv6_remove_dns_search,
NULL,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP6_CONFIG, ADDRESSES),
+ nmc_add_prop_funcs (GLUE_IP (6, ADDRESSES),
nmc_property_ipv6_get_addresses,
nmc_property_ipv6_set_addresses,
nmc_property_ipv6_remove_addresses,
nmc_property_ipv6_describe_addresses,
NULL,
nmc_property_out2in_addresses);
- nmc_add_prop_funcs (GLUE (IP6_CONFIG, ROUTES),
+ nmc_add_prop_funcs (GLUE_IP (6, ROUTES),
nmc_property_ipv6_get_routes,
nmc_property_ipv6_set_routes,
nmc_property_ipv6_remove_routes,
nmc_property_ipv6_describe_routes,
NULL,
nmc_property_out2in_routes);
- nmc_add_prop_funcs (GLUE (IP6_CONFIG, IGNORE_AUTO_ROUTES),
+ nmc_add_prop_funcs (GLUE_IP (6, IGNORE_AUTO_ROUTES),
nmc_property_ipv6_get_ignore_auto_routes,
nmc_property_set_bool,
NULL,
NULL,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP6_CONFIG, IGNORE_AUTO_DNS),
+ nmc_add_prop_funcs (GLUE_IP (6, IGNORE_AUTO_DNS),
nmc_property_ipv6_get_ignore_auto_dns,
nmc_property_set_bool,
NULL,
NULL,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP6_CONFIG, NEVER_DEFAULT),
+ nmc_add_prop_funcs (GLUE_IP (6, NEVER_DEFAULT),
nmc_property_ipv6_get_never_default,
nmc_property_set_bool,
NULL,
NULL,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP6_CONFIG, MAY_FAIL),
+ nmc_add_prop_funcs (GLUE_IP (6, MAY_FAIL),
nmc_property_ipv6_get_may_fail,
nmc_property_set_bool,
NULL,
NULL,
NULL,
nmc_property_out2in_cut_paren);
- nmc_add_prop_funcs (GLUE (IP6_CONFIG, DHCP_HOSTNAME),
+ nmc_add_prop_funcs (GLUE_IP (6, DHCP_HOSTNAME),
nmc_property_ipv6_get_dhcp_hostname,
nmc_property_set_string,
NULL,
static gboolean
setting_ip4_config_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets)
{
- NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (setting);
+ NMSettingIPConfig *s_ip4 = NM_SETTING_IP_CONFIG (setting);
NmcOutputField *tmpl, *arr;
size_t tmpl_len;
static gboolean
setting_ip6_config_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets)
{
- NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting);
+ NMSettingIPConfig *s_ip6 = NM_SETTING_IP_CONFIG (setting);
NmcOutputField *tmpl, *arr;
size_t tmpl_len;
NMSetting *nmc_setting_new_for_name (const char *name);
void nmc_setting_custom_init (NMSetting *setting);
-void nmc_setting_ip4_connect_handlers (NMSettingIP4Config *setting);
-void nmc_setting_ip6_connect_handlers (NMSettingIP6Config *setting);
+void nmc_setting_ip4_connect_handlers (NMSettingIPConfig *setting);
+void nmc_setting_ip6_connect_handlers (NMSettingIPConfig *setting);
void nmc_setting_wireless_connect_handlers (NMSettingWireless *setting);
void nmc_setting_connection_connect_handlers (NMSettingConnection *setting, NMConnection *connection);
nmt_page_ip4_show_by_default (NmtEditorPage *page)
{
NMConnection *conn;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
conn = nmt_editor_page_get_connection (page);
s_ip4 = nm_connection_get_setting_ip4_config (conn);
- if ( !g_strcmp0 (nm_setting_ip4_config_get_method (s_ip4), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)
- || nm_setting_ip4_config_get_num_addresses (s_ip4))
+ if ( !g_strcmp0 (nm_setting_ip_config_get_method (s_ip4), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)
+ || nm_setting_ip_config_get_num_addresses (s_ip4))
return TRUE;
return FALSE;
}
{
NmtPageIP4 *ip4 = NMT_PAGE_IP4 (object);
NmtPageGrid *grid;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NmtNewtWidget *widget, *button;
NMConnection *conn;
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip4));
s_ip4 = nm_connection_get_setting_ip4_config (conn);
if (!s_ip4) {
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_object_set (G_OBJECT (s_ip4),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
nm_connection_add_setting (conn, (NMSetting *) s_ip4);
}
widget = nmt_newt_popup_new (ip4methods);
- g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_METHOD,
+ g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_METHOD,
widget, "active-id",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_editor_page_set_header_widget (NMT_EDITOR_PAGE (ip4), widget);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4_WITH_PREFIX);
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET,
- s_ip4, NM_SETTING_IP4_CONFIG_ADDRESSES,
+ s_ip4, NM_SETTING_IP_CONFIG_ADDRESSES,
widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Addresses"), widget, NULL);
widget = nmt_ip_entry_new (25, AF_INET, FALSE, TRUE);
nm_editor_bind_ip_gateway_to_string (AF_INET,
- s_ip4, NM_SETTING_IP4_CONFIG_ADDRESSES,
+ s_ip4, NM_SETTING_IP_CONFIG_ADDRESSES,
widget, "text",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Gateway"), widget, NULL);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4);
nm_editor_bind_ip_addresses_to_strv (AF_INET,
- s_ip4, NM_SETTING_IP4_CONFIG_DNS,
+ s_ip4, NM_SETTING_IP_CONFIG_DNS,
widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("DNS servers"), widget, NULL);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_HOSTNAME);
- g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_DNS_SEARCH,
+ g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_DNS_SEARCH,
widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Search domains"), widget, NULL);
"text", "",
"style", NMT_NEWT_LABEL_PLAIN,
NULL);
- g_object_bind_property_full (s_ip4, NM_SETTING_IP4_CONFIG_ROUTES,
+ g_object_bind_property_full (s_ip4, NM_SETTING_IP_CONFIG_ROUTES,
widget, "text",
G_BINDING_SYNC_CREATE,
ip4_routes_transform_to_description,
nmt_page_grid_append (grid, _("Routing"), widget, button);
widget = nmt_newt_checkbox_new (_("Never use this network for default route"));
- g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT,
+ g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_NEVER_DEFAULT,
widget, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
nmt_page_grid_append (grid, NULL, widget, NULL);
nmt_page_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);
widget = nmt_newt_checkbox_new (_("Require IPv4 addressing for this connection"));
- g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_MAY_FAIL,
+ g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_MAY_FAIL,
widget, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL |
G_BINDING_INVERT_BOOLEAN);
nmt_page_ip6_show_by_default (NmtEditorPage *page)
{
NMConnection *conn;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
conn = nmt_editor_page_get_connection (page);
s_ip6 = nm_connection_get_setting_ip6_config (conn);
- if ( !g_strcmp0 (nm_setting_ip6_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)
- || nm_setting_ip6_config_get_num_addresses (s_ip6))
+ if ( !g_strcmp0 (nm_setting_ip_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)
+ || nm_setting_ip_config_get_num_addresses (s_ip6))
return TRUE;
return FALSE;
}
{
NmtPageIP6 *ip6 = NMT_PAGE_IP6 (object);
NmtPageGrid *grid;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
NmtNewtWidget *widget, *button;
NMConnection *conn;
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip6));
s_ip6 = nm_connection_get_setting_ip6_config (conn);
if (!s_ip6) {
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_object_set (G_OBJECT (s_ip6),
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
NULL);
nm_connection_add_setting (conn, (NMSetting *) s_ip6);
}
widget = nmt_newt_popup_new (ip6methods);
- g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_METHOD,
+ g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_METHOD,
widget, "active-id",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_editor_page_set_header_widget (NMT_EDITOR_PAGE (ip6), widget);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6_WITH_PREFIX);
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET6,
- s_ip6, NM_SETTING_IP6_CONFIG_ADDRESSES,
+ s_ip6, NM_SETTING_IP_CONFIG_ADDRESSES,
widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Addresses"), widget, NULL);
widget = nmt_ip_entry_new (25, AF_INET6, FALSE, TRUE);
nm_editor_bind_ip_gateway_to_string (AF_INET6,
- s_ip6, NM_SETTING_IP6_CONFIG_ADDRESSES,
+ s_ip6, NM_SETTING_IP_CONFIG_ADDRESSES,
widget, "text",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Gateway"), widget, NULL);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6);
nm_editor_bind_ip_addresses_to_strv (AF_INET6,
- s_ip6, NM_SETTING_IP6_CONFIG_DNS,
+ s_ip6, NM_SETTING_IP_CONFIG_DNS,
widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("DNS servers"), widget, NULL);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_HOSTNAME);
- g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_DNS_SEARCH,
+ g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_DNS_SEARCH,
widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Search domains"), widget, NULL);
"text", "",
"style", NMT_NEWT_LABEL_PLAIN,
NULL);
- g_object_bind_property_full (s_ip6, NM_SETTING_IP6_CONFIG_ROUTES,
+ g_object_bind_property_full (s_ip6, NM_SETTING_IP_CONFIG_ROUTES,
widget, "text",
G_BINDING_SYNC_CREATE,
ip6_routes_transform_to_description,
nmt_page_grid_append (grid, _("Routing"), widget, button);
widget = nmt_newt_checkbox_new (_("Never use this network for default route"));
- g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_NEVER_DEFAULT,
+ g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_NEVER_DEFAULT,
widget, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
nmt_page_grid_append (grid, NULL, widget, NULL);
nmt_page_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);
widget = nmt_newt_checkbox_new (_("Require IPv6 addressing for this connection"));
- g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_MAY_FAIL,
+ g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_MAY_FAIL,
widget, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL |
G_BINDING_INVERT_BOOLEAN);
{
NmtRouteEditor *editor = user_data;
NmtRouteEditorPrivate *priv = NMT_ROUTE_EDITOR_GET_PRIVATE (editor);
- const char *property;
- GBinding *binding;
+ GPtrArray *routes;
- if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting))
- property = NM_SETTING_IP4_CONFIG_ROUTES;
- else
- property = NM_SETTING_IP6_CONFIG_ROUTES;
-
- /* Because of the complicated dbus-glib GTypes, it's easier to cheat
- * and use GBinding to do this than it is to copy the value by hand.
- */
- binding = g_object_bind_property (priv->edit_setting, property,
- priv->orig_setting, property,
- G_BINDING_SYNC_CREATE);
- g_object_unref (binding);
+ g_object_get (priv->edit_setting,
+ NM_SETTING_IP_CONFIG_ROUTES, &routes,
+ NULL);
+ g_object_set (priv->orig_setting,
+ NM_SETTING_IP_CONFIG_ROUTES, routes,
+ NULL);
+ g_ptr_array_unref (routes);
nmt_newt_form_quit (NMT_NEWT_FORM (editor));
}
if (G_OBJECT_CLASS (nmt_route_editor_parent_class)->constructed)
G_OBJECT_CLASS (nmt_route_editor_parent_class)->constructed (object);
- if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting)) {
+ if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting))
routes = nmt_route_table_new (AF_INET);
- g_object_bind_property (priv->edit_setting, NM_SETTING_IP4_CONFIG_ROUTES,
- routes, "routes",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
- } else {
+ else
routes = nmt_route_table_new (AF_INET6);
- g_object_bind_property (priv->edit_setting, NM_SETTING_IP6_CONFIG_ROUTES,
- routes, "routes",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
- }
+ g_object_bind_property (priv->edit_setting, NM_SETTING_IP_CONFIG_ROUTES,
+ routes, "routes",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
vbox = nmt_newt_grid_new ();
nmt_newt_grid_add (NMT_NEWT_GRID (vbox), routes, 0, 0);
/* Build up the 'ipv4' Setting */
g_variant_builder_init (&setting_builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&setting_builder, "{sv}",
- NM_SETTING_IP4_CONFIG_METHOD,
+ NM_SETTING_IP_CONFIG_METHOD,
g_variant_new_string (NM_SETTING_IP4_CONFIG_METHOD_AUTO));
g_variant_builder_add (&connection_builder, "{sa{sv}}",
NM_SETTING_IP4_CONFIG_SETTING_NAME,
/* Build up the 'ipv4' Setting */
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
g_object_set (G_OBJECT (s_ip4),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
NMSettingConnection *s_con = nm_connection_get_setting_connection (self);
const char *default_ip4_method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
const char *default_ip6_method = NULL;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4, *s_ip6;
NMSetting *setting;
if (parameters)
setting = nm_setting_ip4_config_new ();
g_object_set (setting,
- NM_SETTING_IP4_CONFIG_METHOD, default_ip4_method,
+ NM_SETTING_IP_CONFIG_METHOD, default_ip4_method,
NULL);
nm_connection_add_setting (self, setting);
}
setting = nm_setting_ip6_config_new ();
g_object_set (setting,
- NM_SETTING_IP6_CONFIG_METHOD, default_ip6_method,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, default_ip6_method,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
nm_connection_add_setting (self, setting);
}
{
NMConnectionPrivate *priv;
NMSettingConnection *s_con;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4, *s_ip6;
GHashTableIter iter;
gpointer value;
GSList *all_settings = NULL, *setting_i;
*
* A shortcut to return any #NMSettingIP4Config the connection might contain.
*
- * Returns: (transfer none): an #NMSettingIP4Config if the connection contains one, otherwise %NULL
+ * Note that it returns the value as type #NMSettingIPConfig, since the vast
+ * majority of IPv4-setting-related methods are on that type, not
+ * #NMSettingIP4Config.
+ *
+ * Returns: (type NMSettingIP4Config) (transfer none): an #NMSettingIP4Config if the
+ * connection contains one, otherwise %NULL
**/
-NMSettingIP4Config *
+NMSettingIPConfig *
nm_connection_get_setting_ip4_config (NMConnection *connection)
{
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
- return (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
+ return (NMSettingIPConfig *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
}
/**
*
* A shortcut to return any #NMSettingIP6Config the connection might contain.
*
- * Returns: (transfer none): an #NMSettingIP6Config if the connection contains one, otherwise %NULL
+ * Note that it returns the value as type #NMSettingIPConfig, since the vast
+ * majority of IPv6-setting-related methods are on that type, not
+ * #NMSettingIP6Config.
+ *
+ * Returns: (type NMSettingIP6Config) (transfer none): an #NMSettingIP6Config if the
+ * connection contains one, otherwise %NULL
**/
-NMSettingIP6Config *
+NMSettingIPConfig *
nm_connection_get_setting_ip6_config (NMConnection *connection)
{
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
- return (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
+ return (NMSettingIPConfig *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
}
/**
NMSettingGeneric * nm_connection_get_setting_generic (NMConnection *connection);
NMSettingGsm * nm_connection_get_setting_gsm (NMConnection *connection);
NMSettingInfiniband * nm_connection_get_setting_infiniband (NMConnection *connection);
-NMSettingIP4Config * nm_connection_get_setting_ip4_config (NMConnection *connection);
-NMSettingIP6Config * nm_connection_get_setting_ip6_config (NMConnection *connection);
+NMSettingIPConfig * nm_connection_get_setting_ip4_config (NMConnection *connection);
+NMSettingIPConfig * nm_connection_get_setting_ip6_config (NMConnection *connection);
NMSettingOlpcMesh * nm_connection_get_setting_olpc_mesh (NMConnection *connection);
NMSettingPpp * nm_connection_get_setting_ppp (NMConnection *connection);
NMSettingPppoe * nm_connection_get_setting_pppoe (NMConnection *connection);
typedef struct _NMSettingGeneric NMSettingGeneric;
typedef struct _NMSettingGsm NMSettingGsm;
typedef struct _NMSettingInfiniband NMSettingInfiniband;
+typedef struct _NMSettingIPConfig NMSettingIPConfig;
typedef struct _NMSettingIP4Config NMSettingIP4Config;
typedef struct _NMSettingIP6Config NMSettingIP6Config;
typedef struct _NMSettingOlpcMesh NMSettingOlpcMesh;
*/
#include <string.h>
+#include <arpa/inet.h>
#include <glib/gi18n.h>
#include "nm-setting-ip-config.h"
+#include "nm-setting-ip4-config.h"
+#include "nm-setting-ip6-config.h"
#include "nm-utils.h"
#include "nm-glib-compat.h"
#include "nm-setting-private.h"
#include "nm-utils-private.h"
+/**
+ * SECTION:nm-setting-ip-config
+ * @short_description: Abstract base class for IPv4 and IPv6
+ * addressing, routing, and name service properties
+ * @include: nm-setting-ip-config.h
+ * @see_also: #NMSettingIP4Config, #NMSettingIP6Config
+ *
+ * #NMSettingIPConfig is the abstract base class of
+ * #NMSettingIP4Config and #NMSettingIP6Config, providing properties
+ * related to IP addressing, routing, and Domain Name Service.
+ **/
+
static char *
canonicalize_ip (int family, const char *ip, gboolean null_any)
{
else
g_hash_table_remove (route->attributes, name);
}
+
+
+G_DEFINE_ABSTRACT_TYPE (NMSettingIPConfig, nm_setting_ip_config, NM_TYPE_SETTING)
+
+#define NM_SETTING_IP_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfigPrivate))
+
+typedef struct {
+ char *method;
+ GPtrArray *dns; /* array of IP address strings */
+ GPtrArray *dns_search; /* array of domain name strings */
+ GPtrArray *addresses; /* array of NMIPAddress */
+ GPtrArray *routes; /* array of NMIPRoute */
+ gboolean ignore_auto_routes;
+ gboolean ignore_auto_dns;
+ char *dhcp_hostname;
+ gboolean dhcp_send_hostname;
+ gboolean never_default;
+ gboolean may_fail;
+} NMSettingIPConfigPrivate;
+
+enum {
+ PROP_0,
+ PROP_METHOD,
+ PROP_DNS,
+ PROP_DNS_SEARCH,
+ PROP_ADDRESSES,
+ PROP_ROUTES,
+ PROP_IGNORE_AUTO_ROUTES,
+ PROP_IGNORE_AUTO_DNS,
+ PROP_DHCP_HOSTNAME,
+ PROP_DHCP_SEND_HOSTNAME,
+ PROP_NEVER_DEFAULT,
+ PROP_MAY_FAIL,
+
+ LAST_PROP
+};
+
+#define NM_SETTING_IP_CONFIG_GET_FAMILY(setting) (NM_IS_SETTING_IP4_CONFIG (setting) ? AF_INET : AF_INET6)
+
+/**
+ * nm_setting_ip_config_get_method:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns: the #NMSettingIPConfig:method property of the setting; see
+ * #NMSettingIP4Config and #NMSettingIP6Config for details of the
+ * methods available with each type.
+ **/
+const char *
+nm_setting_ip_config_get_method (NMSettingIPConfig *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL);
+
+ return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->method;
+}
+
+/**
+ * nm_setting_ip_config_get_num_dns:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns: the number of configured DNS servers
+ **/
+guint
+nm_setting_ip_config_get_num_dns (NMSettingIPConfig *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), 0);
+
+ return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->dns->len;
+}
+
+/**
+ * nm_setting_ip_config_get_dns:
+ * @setting: the #NMSettingIPConfig
+ * @i: index number of the DNS server to return
+ *
+ * Returns: the IP address of the DNS server at index @i
+ **/
+const char *
+nm_setting_ip_config_get_dns (NMSettingIPConfig *setting, int i)
+{
+ NMSettingIPConfigPrivate *priv;
+
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL);
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ g_return_val_if_fail (i < priv->dns->len, NULL);
+
+ return priv->dns->pdata[i];
+}
+
+/**
+ * nm_setting_ip_config_add_dns:
+ * @setting: the #NMSettingIPConfig
+ * @dns: the IP address of the DNS server to add
+ *
+ * Adds a new DNS server to the setting.
+ *
+ * Returns: %TRUE if the DNS server was added; %FALSE if the server was already
+ * known
+ **/
+gboolean
+nm_setting_ip_config_add_dns (NMSettingIPConfig *setting, const char *dns)
+{
+ NMSettingIPConfigPrivate *priv;
+ char *dns_canonical;
+ int i;
+
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+ g_return_val_if_fail (dns != NULL, FALSE);
+ g_return_val_if_fail (nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns), FALSE);
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+
+ dns_canonical = canonicalize_ip (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns, FALSE);
+ for (i = 0; i < priv->dns->len; i++) {
+ if (!strcmp (dns_canonical, priv->dns->pdata[i])) {
+ g_free (dns_canonical);
+ return FALSE;
+ }
+ }
+
+ g_ptr_array_add (priv->dns, dns_canonical);
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS);
+ return TRUE;
+}
+
+/**
+ * nm_setting_ip_config_remove_dns:
+ * @setting: the #NMSettingIPConfig
+ * @i: index number of the DNS server to remove
+ *
+ * Removes the DNS server at index @i.
+ **/
+void
+nm_setting_ip_config_remove_dns (NMSettingIPConfig *setting, int i)
+{
+ NMSettingIPConfigPrivate *priv;
+
+ g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ g_return_if_fail (i < priv->dns->len);
+
+ g_ptr_array_remove_index (priv->dns, i);
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS);
+}
+
+/**
+ * nm_setting_ip_config_remove_dns_by_value:
+ * @setting: the #NMSettingIPConfig
+ * @dns: the DNS server to remove
+ *
+ * Removes the DNS server @dns.
+ *
+ * Returns: %TRUE if the DNS server was found and removed; %FALSE if it was not.
+ **/
+gboolean
+nm_setting_ip_config_remove_dns_by_value (NMSettingIPConfig *setting, const char *dns)
+{
+ NMSettingIPConfigPrivate *priv;
+ char *dns_canonical;
+ int i;
+
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+ g_return_val_if_fail (dns != NULL, FALSE);
+ g_return_val_if_fail (nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns), FALSE);
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+
+ dns_canonical = canonicalize_ip (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns, FALSE);
+ for (i = 0; i < priv->dns->len; i++) {
+ if (!strcmp (dns_canonical, priv->dns->pdata[i])) {
+ g_ptr_array_remove_index (priv->dns, i);
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS);
+ g_free (dns_canonical);
+ return TRUE;
+ }
+ }
+ g_free (dns_canonical);
+ return FALSE;
+}
+
+/**
+ * nm_setting_ip_config_clear_dns:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Removes all configured DNS servers.
+ **/
+void
+nm_setting_ip_config_clear_dns (NMSettingIPConfig *setting)
+{
+ NMSettingIPConfigPrivate *priv;
+
+ g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ g_ptr_array_set_size (priv->dns, 0);
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS);
+}
+
+/**
+ * nm_setting_ip_config_get_num_dns_searches:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns: the number of configured DNS search domains
+ **/
+guint
+nm_setting_ip_config_get_num_dns_searches (NMSettingIPConfig *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), 0);
+
+ return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->dns_search->len;
+}
+
+/**
+ * nm_setting_ip_config_get_dns_search:
+ * @setting: the #NMSettingIPConfig
+ * @i: index number of the DNS search domain to return
+ *
+ * Returns: the DNS search domain at index @i
+ **/
+const char *
+nm_setting_ip_config_get_dns_search (NMSettingIPConfig *setting, int i)
+{
+ NMSettingIPConfigPrivate *priv;
+
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL);
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ g_return_val_if_fail (i < priv->dns_search->len, NULL);
+
+ return priv->dns_search->pdata[i];
+}
+
+/**
+ * nm_setting_ip_config_add_dns_search:
+ * @setting: the #NMSettingIPConfig
+ * @dns_search: the search domain to add
+ *
+ * Adds a new DNS search domain to the setting.
+ *
+ * Returns: %TRUE if the DNS search domain was added; %FALSE if the search
+ * domain was already known
+ **/
+gboolean
+nm_setting_ip_config_add_dns_search (NMSettingIPConfig *setting,
+ const char *dns_search)
+{
+ NMSettingIPConfigPrivate *priv;
+ int i;
+
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+ g_return_val_if_fail (dns_search != NULL, FALSE);
+ g_return_val_if_fail (dns_search[0] != '\0', FALSE);
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ for (i = 0; i < priv->dns_search->len; i++) {
+ if (!strcmp (dns_search, priv->dns_search->pdata[i]))
+ return FALSE;
+ }
+
+ g_ptr_array_add (priv->dns_search, g_strdup (dns_search));
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS_SEARCH);
+ return TRUE;
+}
+
+/**
+ * nm_setting_ip_config_remove_dns_search:
+ * @setting: the #NMSettingIPConfig
+ * @i: index number of the DNS search domain
+ *
+ * Removes the DNS search domain at index @i.
+ **/
+void
+nm_setting_ip_config_remove_dns_search (NMSettingIPConfig *setting, int i)
+{
+ NMSettingIPConfigPrivate *priv;
+
+ g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ g_return_if_fail (i < priv->dns_search->len);
+
+ g_ptr_array_remove_index (priv->dns_search, i);
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS_SEARCH);
+}
+
+/**
+ * nm_setting_ip_config_remove_dns_search_by_value:
+ * @setting: the #NMSettingIPConfig
+ * @dns_search: the search domain to remove
+ *
+ * Removes the DNS search domain @dns_search.
+ *
+ * Returns: %TRUE if the DNS search domain was found and removed; %FALSE if it was not.
+ *
+ * Since 0.9.10
+ **/
+gboolean
+nm_setting_ip_config_remove_dns_search_by_value (NMSettingIPConfig *setting,
+ const char *dns_search)
+{
+ NMSettingIPConfigPrivate *priv;
+ int i;
+
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+ g_return_val_if_fail (dns_search != NULL, FALSE);
+ g_return_val_if_fail (dns_search[0] != '\0', FALSE);
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ for (i = 0; i < priv->dns_search->len; i++) {
+ if (!strcmp (dns_search, priv->dns_search->pdata[i])) {
+ g_ptr_array_remove_index (priv->dns_search, i);
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS_SEARCH);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/**
+ * nm_setting_ip_config_clear_dns_searches:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Removes all configured DNS search domains.
+ **/
+void
+nm_setting_ip_config_clear_dns_searches (NMSettingIPConfig *setting)
+{
+ NMSettingIPConfigPrivate *priv;
+
+ g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ g_ptr_array_set_size (priv->dns_search, 0);
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS_SEARCH);
+}
+
+/**
+ * nm_setting_ip_config_get_num_addresses:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns: the number of configured addresses
+ **/
+guint
+nm_setting_ip_config_get_num_addresses (NMSettingIPConfig *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), 0);
+
+ return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->addresses->len;
+}
+
+/**
+ * nm_setting_ip_config_get_address:
+ * @setting: the #NMSettingIPConfig
+ * @i: index number of the address to return
+ *
+ * Returns: the address at index @i
+ **/
+NMIPAddress *
+nm_setting_ip_config_get_address (NMSettingIPConfig *setting, int i)
+{
+ NMSettingIPConfigPrivate *priv;
+
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL);
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ g_return_val_if_fail (i < priv->addresses->len, NULL);
+
+ return priv->addresses->pdata[i];
+}
+
+/**
+ * nm_setting_ip_config_add_address:
+ * @setting: the #NMSettingIPConfig
+ * @address: the new address to add
+ *
+ * Adds a new IP address and associated information to the setting. The
+ * given address is duplicated internally and is not changed by this function.
+ *
+ * Returns: %TRUE if the address was added; %FALSE if the address was already
+ * known.
+ **/
+gboolean
+nm_setting_ip_config_add_address (NMSettingIPConfig *setting,
+ NMIPAddress *address)
+{
+ NMSettingIPConfigPrivate *priv;
+ int i;
+
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+ g_return_val_if_fail (address != NULL, FALSE);
+ g_return_val_if_fail (address->family == NM_SETTING_IP_CONFIG_GET_FAMILY (setting), FALSE);
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ for (i = 0; i < priv->addresses->len; i++) {
+ if (nm_ip_address_equal (priv->addresses->pdata[i], address))
+ return FALSE;
+ }
+
+ g_ptr_array_add (priv->addresses, nm_ip_address_dup (address));
+
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ADDRESSES);
+ return TRUE;
+}
+
+/**
+ * nm_setting_ip_config_remove_address:
+ * @setting: the #NMSettingIPConfig
+ * @i: index number of the address to remove
+ *
+ * Removes the address at index @i.
+ **/
+void
+nm_setting_ip_config_remove_address (NMSettingIPConfig *setting, int i)
+{
+ NMSettingIPConfigPrivate *priv;
+
+ g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ g_return_if_fail (i < priv->addresses->len);
+
+ g_ptr_array_remove_index (priv->addresses, i);
+
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ADDRESSES);
+}
+
+/**
+ * nm_setting_ip_config_remove_address_by_value:
+ * @setting: the #NMSettingIPConfig
+ * @address: the IP address to remove
+ *
+ * Removes the address @address.
+ *
+ * Returns: %TRUE if the address was found and removed; %FALSE if it was not.
+ **/
+gboolean
+nm_setting_ip_config_remove_address_by_value (NMSettingIPConfig *setting,
+ NMIPAddress *address)
+{
+ NMSettingIPConfigPrivate *priv;
+ int i;
+
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+ g_return_val_if_fail (address != NULL, FALSE);
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ for (i = 0; i < priv->addresses->len; i++) {
+ if (nm_ip_address_equal (priv->addresses->pdata[i], address)) {
+ g_ptr_array_remove_index (priv->addresses, i);
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ADDRESSES);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/**
+ * nm_setting_ip_config_clear_addresses:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Removes all configured addresses.
+ **/
+void
+nm_setting_ip_config_clear_addresses (NMSettingIPConfig *setting)
+{
+ NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+
+ g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
+
+ g_ptr_array_set_size (priv->addresses, 0);
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ADDRESSES);
+}
+
+/**
+ * nm_setting_ip_config_get_num_routes:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns: the number of configured routes
+ **/
+guint
+nm_setting_ip_config_get_num_routes (NMSettingIPConfig *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), 0);
+
+ return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->routes->len;
+}
+
+/**
+ * nm_setting_ip_config_get_route:
+ * @setting: the #NMSettingIPConfig
+ * @i: index number of the route to return
+ *
+ * Returns: the route at index @i
+ **/
+NMIPRoute *
+nm_setting_ip_config_get_route (NMSettingIPConfig *setting, int i)
+{
+ NMSettingIPConfigPrivate *priv;
+
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL);
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ g_return_val_if_fail (i < priv->routes->len, NULL);
+
+ return priv->routes->pdata[i];
+}
+
+/**
+ * nm_setting_ip_config_add_route:
+ * @setting: the #NMSettingIPConfig
+ * @route: the route to add
+ *
+ * Adds a new route and associated information to the setting. The
+ * given route is duplicated internally and is not changed by this function.
+ *
+ * Returns: %TRUE if the route was added; %FALSE if the route was already known.
+ **/
+gboolean
+nm_setting_ip_config_add_route (NMSettingIPConfig *setting,
+ NMIPRoute *route)
+{
+ NMSettingIPConfigPrivate *priv;
+ int i;
+
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+ g_return_val_if_fail (route != NULL, FALSE);
+ g_return_val_if_fail (route->family == NM_SETTING_IP_CONFIG_GET_FAMILY (setting), FALSE);
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ for (i = 0; i < priv->routes->len; i++) {
+ if (nm_ip_route_equal (priv->routes->pdata[i], route))
+ return FALSE;
+ }
+
+ g_ptr_array_add (priv->routes, nm_ip_route_dup (route));
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ROUTES);
+ return TRUE;
+}
+
+/**
+ * nm_setting_ip_config_remove_route:
+ * @setting: the #NMSettingIPConfig
+ * @i: index number of the route
+ *
+ * Removes the route at index @i.
+ **/
+void
+nm_setting_ip_config_remove_route (NMSettingIPConfig *setting, int i)
+{
+ NMSettingIPConfigPrivate *priv;
+
+ g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ g_return_if_fail (i < priv->routes->len);
+
+ g_ptr_array_remove_index (priv->routes, i);
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ROUTES);
+}
+
+/**
+ * nm_setting_ip_config_remove_route_by_value:
+ * @setting: the #NMSettingIPConfig
+ * @route: the route to remove
+ *
+ * Removes the route @route.
+ *
+ * Returns: %TRUE if the route was found and removed; %FALSE if it was not.
+ **/
+gboolean
+nm_setting_ip_config_remove_route_by_value (NMSettingIPConfig *setting,
+ NMIPRoute *route)
+{
+ NMSettingIPConfigPrivate *priv;
+ int i;
+
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+ g_return_val_if_fail (route != NULL, FALSE);
+
+ priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ for (i = 0; i < priv->routes->len; i++) {
+ if (nm_ip_route_equal (priv->routes->pdata[i], route)) {
+ g_ptr_array_remove_index (priv->routes, i);
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ROUTES);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/**
+ * nm_setting_ip_config_clear_routes:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Removes all configured routes.
+ **/
+void
+nm_setting_ip_config_clear_routes (NMSettingIPConfig *setting)
+{
+ NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+
+ g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
+
+ g_ptr_array_set_size (priv->routes, 0);
+ g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ROUTES);
+}
+
+/**
+ * nm_setting_ip_config_get_ignore_auto_routes:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns the value contained in the #NMSettingIPConfig:ignore-auto-routes
+ * property.
+ *
+ * Returns: %TRUE if automatically configured (ie via DHCP) routes should be
+ * ignored.
+ **/
+gboolean
+nm_setting_ip_config_get_ignore_auto_routes (NMSettingIPConfig *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+
+ return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->ignore_auto_routes;
+}
+
+/**
+ * nm_setting_ip_config_get_ignore_auto_dns:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns the value contained in the #NMSettingIPConfig:ignore-auto-dns
+ * property.
+ *
+ * Returns: %TRUE if automatically configured (ie via DHCP) DNS information
+ * should be ignored.
+ **/
+gboolean
+nm_setting_ip_config_get_ignore_auto_dns (NMSettingIPConfig *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+
+ return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->ignore_auto_dns;
+}
+
+/**
+ * nm_setting_ip_config_get_dhcp_hostname:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns the value contained in the #NMSettingIPConfig:dhcp-hostname
+ * property.
+ *
+ * Returns: the configured hostname to send to the DHCP server
+ **/
+const char *
+nm_setting_ip_config_get_dhcp_hostname (NMSettingIPConfig *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL);
+
+ return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->dhcp_hostname;
+}
+
+/**
+ * nm_setting_ip_config_get_dhcp_send_hostname:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns the value contained in the #NMSettingIPConfig:dhcp-send-hostname
+ * property.
+ *
+ * Returns: %TRUE if NetworkManager should send the machine hostname to the
+ * DHCP server when requesting addresses to allow the server to automatically
+ * update DNS information for this machine.
+ **/
+gboolean
+nm_setting_ip_config_get_dhcp_send_hostname (NMSettingIPConfig *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+
+ return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->dhcp_send_hostname;
+}
+
+/**
+ * nm_setting_ip_config_get_never_default:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns the value contained in the #NMSettingIPConfig:never-default
+ * property.
+ *
+ * Returns: %TRUE if this connection should never be the default
+ * connection
+ **/
+gboolean
+nm_setting_ip_config_get_never_default (NMSettingIPConfig *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+
+ return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->never_default;
+}
+
+/**
+ * nm_setting_ip_config_get_may_fail:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns the value contained in the #NMSettingIPConfig:may-fail
+ * property.
+ *
+ * Returns: %TRUE if this connection doesn't require this type of IP
+ * addressing to complete for the connection to succeed.
+ **/
+gboolean
+nm_setting_ip_config_get_may_fail (NMSettingIPConfig *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
+
+ return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->may_fail;
+}
+
+static gboolean
+verify_label (const char *label)
+{
+ const char *p;
+ char *iface;
+
+ p = strchr (label, ':');
+ if (!p)
+ return FALSE;
+ iface = g_strndup (label, p - label);
+ if (!nm_utils_iface_valid_name (iface)) {
+ g_free (iface);
+ return FALSE;
+ }
+ g_free (iface);
+
+ for (p++; *p; p++) {
+ if (!g_ascii_isalnum (*p) && *p != '_')
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+verify (NMSetting *setting, NMConnection *connection, GError **error)
+{
+ NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+ int i;
+
+ if (!priv->method) {
+ g_set_error_literal (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_MISSING_PROPERTY,
+ _("property is missing"));
+ g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_METHOD);
+ return FALSE;
+ }
+
+ if (priv->dhcp_hostname && !*priv->dhcp_hostname) {
+ g_set_error_literal (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("property is empty"));
+ g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_DHCP_HOSTNAME);
+ return FALSE;
+ }
+
+ /* Validate DNS */
+ for (i = 0; i < priv->dns->len; i++) {
+ const char *dns = priv->dns->pdata[i];
+
+ if (!nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns)) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("%d. DNS server address is invalid"),
+ i+1);
+ g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_DNS);
+ return FALSE;
+ }
+ }
+
+ /* Validate addresses */
+ for (i = 0; i < priv->addresses->len; i++) {
+ NMIPAddress *addr = (NMIPAddress *) priv->addresses->pdata[i];
+ GVariant *label;
+
+ if (nm_ip_address_get_family (addr) != NM_SETTING_IP_CONFIG_GET_FAMILY (setting)) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("%d. IP address is invalid"),
+ i+1);
+ g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_ADDRESSES);
+ return FALSE;
+ }
+
+ label = nm_ip_address_get_attribute (addr, "label");
+ if (label) {
+ if (!g_variant_is_of_type (label, G_VARIANT_TYPE_STRING)) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("%d. IP address has 'label' property with invalid type"),
+ i+1);
+ g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_ADDRESSES);
+ return FALSE;
+ }
+ if (!verify_label (g_variant_get_string (label, NULL))) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("%d. IP address has invalid label '%s'"),
+ i+1, g_variant_get_string (label, NULL));
+ g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_ADDRESSES);
+ return FALSE;
+ }
+ }
+ }
+
+ /* Validate routes */
+ for (i = 0; i < priv->routes->len; i++) {
+ NMIPRoute *route = (NMIPRoute *) priv->routes->pdata[i];
+
+ if (nm_ip_route_get_family (route) != NM_SETTING_IP_CONFIG_GET_FAMILY (setting)) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("%d. route is invalid"),
+ i+1);
+ g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_ROUTES);
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+
+static void
+nm_setting_ip_config_init (NMSettingIPConfig *setting)
+{
+ NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+
+ priv->dns = g_ptr_array_new_with_free_func (g_free);
+ priv->dns_search = g_ptr_array_new_with_free_func (g_free);
+ priv->addresses = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip_address_unref);
+ priv->routes = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip_route_unref);
+}
+
+static void
+finalize (GObject *object)
+{
+ NMSettingIPConfig *self = NM_SETTING_IP_CONFIG (object);
+ NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (self);
+
+ g_free (priv->method);
+ g_free (priv->dhcp_hostname);
+
+ g_ptr_array_unref (priv->dns);
+ g_ptr_array_unref (priv->dns_search);
+ g_ptr_array_unref (priv->addresses);
+ g_ptr_array_unref (priv->routes);
+
+ G_OBJECT_CLASS (nm_setting_ip_config_parent_class)->finalize (object);
+}
+
+static void
+set_property (GObject *object, guint prop_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ NMSettingIPConfig *setting = NM_SETTING_IP_CONFIG (object);
+ NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+
+ switch (prop_id) {
+ case PROP_METHOD:
+ g_free (priv->method);
+ priv->method = g_value_dup_string (value);
+ break;
+ case PROP_DNS:
+ g_ptr_array_unref (priv->dns);
+ priv->dns = _nm_utils_strv_to_ptrarray (g_value_get_boxed (value));
+ break;
+ case PROP_DNS_SEARCH:
+ g_ptr_array_unref (priv->dns_search);
+ priv->dns_search = _nm_utils_strv_to_ptrarray (g_value_get_boxed (value));
+ break;
+ case PROP_ADDRESSES:
+ g_ptr_array_unref (priv->addresses);
+ priv->addresses = _nm_utils_copy_array (g_value_get_boxed (value),
+ (NMUtilsCopyFunc) nm_ip_address_dup,
+ (GDestroyNotify) nm_ip_address_unref);
+ break;
+ case PROP_ROUTES:
+ g_ptr_array_unref (priv->routes);
+ priv->routes = _nm_utils_copy_array (g_value_get_boxed (value),
+ (NMUtilsCopyFunc) nm_ip_route_dup,
+ (GDestroyNotify) nm_ip_route_unref);
+ break;
+ case PROP_IGNORE_AUTO_ROUTES:
+ priv->ignore_auto_routes = g_value_get_boolean (value);
+ break;
+ case PROP_IGNORE_AUTO_DNS:
+ priv->ignore_auto_dns = g_value_get_boolean (value);
+ break;
+ case PROP_DHCP_HOSTNAME:
+ g_free (priv->dhcp_hostname);
+ priv->dhcp_hostname = g_value_dup_string (value);
+ break;
+ case PROP_DHCP_SEND_HOSTNAME:
+ priv->dhcp_send_hostname = g_value_get_boolean (value);
+ break;
+ case PROP_NEVER_DEFAULT:
+ priv->never_default = g_value_get_boolean (value);
+ break;
+ case PROP_MAY_FAIL:
+ priv->may_fail = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
+{
+ NMSettingIPConfig *setting = NM_SETTING_IP_CONFIG (object);
+ NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
+
+ switch (prop_id) {
+ case PROP_METHOD:
+ g_value_set_string (value, nm_setting_ip_config_get_method (setting));
+ break;
+ case PROP_DNS:
+ g_value_take_boxed (value, _nm_utils_ptrarray_to_strv (priv->dns));
+ break;
+ case PROP_DNS_SEARCH:
+ g_value_take_boxed (value, _nm_utils_ptrarray_to_strv (priv->dns_search));
+ break;
+ case PROP_ADDRESSES:
+ g_value_take_boxed (value, _nm_utils_copy_array (priv->addresses,
+ (NMUtilsCopyFunc) nm_ip_address_dup,
+ (GDestroyNotify) nm_ip_address_unref));
+ break;
+ case PROP_ROUTES:
+ g_value_take_boxed (value, _nm_utils_copy_array (priv->routes,
+ (NMUtilsCopyFunc) nm_ip_route_dup,
+ (GDestroyNotify) nm_ip_route_unref));
+ break;
+ case PROP_IGNORE_AUTO_ROUTES:
+ g_value_set_boolean (value, nm_setting_ip_config_get_ignore_auto_routes (setting));
+ break;
+ case PROP_IGNORE_AUTO_DNS:
+ g_value_set_boolean (value, nm_setting_ip_config_get_ignore_auto_dns (setting));
+ break;
+ case PROP_DHCP_HOSTNAME:
+ g_value_set_string (value, nm_setting_ip_config_get_dhcp_hostname (setting));
+ break;
+ case PROP_DHCP_SEND_HOSTNAME:
+ g_value_set_boolean (value, nm_setting_ip_config_get_dhcp_send_hostname (setting));
+ break;
+ case PROP_NEVER_DEFAULT:
+ g_value_set_boolean (value, priv->never_default);
+ break;
+ case PROP_MAY_FAIL:
+ g_value_set_boolean (value, priv->may_fail);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+nm_setting_ip_config_class_init (NMSettingIPConfigClass *setting_class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
+ NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
+
+ g_type_class_add_private (setting_class, sizeof (NMSettingIPConfigPrivate));
+
+ /* virtual methods */
+ object_class->set_property = set_property;
+ object_class->get_property = get_property;
+ object_class->finalize = finalize;
+ parent_class->verify = verify;
+
+ /* Properties */
+
+ /**
+ * NMSettingIPConfig:method:
+ *
+ * IP configuration method.
+ *
+ * #NMSettingIP4Config and #NMSettingIP6Config both support "auto",
+ * "manual", and "link-local". See the subclass-specific documentation for
+ * other values.
+ *
+ * In general, for the "auto" method, properties such as
+ * #NMSettingIPConfig:dns and #NMSettingIPConfig:routes specify information
+ * that is added on to the information returned from automatic
+ * configuration. The #NMSettingIPConfig:ignore-auto-routes and
+ * #NMSettingIPConfig:ignore-auto-dns properties modify this behavior.
+ *
+ * For methods that imply no upstream network, such as "shared" or
+ * "link-local", these properties must be empty.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_METHOD,
+ g_param_spec_string (NM_SETTING_IP_CONFIG_METHOD, "", "",
+ NULL,
+ G_PARAM_READWRITE |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingIPConfig:dns:
+ *
+ * Array of IP addresses of DNS servers.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_DNS,
+ g_param_spec_boxed (NM_SETTING_IP_CONFIG_DNS, "", "",
+ G_TYPE_STRV,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingIPConfig:dns-search:
+ *
+ * Array of DNS search domains.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_DNS_SEARCH,
+ g_param_spec_boxed (NM_SETTING_IP_CONFIG_DNS_SEARCH, "", "",
+ G_TYPE_STRV,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingIPConfig:addresses:
+ *
+ * Array of IP addresses.
+ *
+ * Element-Type: NMIPAddress
+ **/
+ g_object_class_install_property
+ (object_class, PROP_ADDRESSES,
+ g_param_spec_boxed (NM_SETTING_IP_CONFIG_ADDRESSES, "", "",
+ G_TYPE_PTR_ARRAY,
+ G_PARAM_READWRITE |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingIPConfig:routes:
+ *
+ * Array of IP routes.
+ *
+ * Element-Type: NMIPRoute
+ **/
+ g_object_class_install_property
+ (object_class, PROP_ROUTES,
+ g_param_spec_boxed (NM_SETTING_IP_CONFIG_ROUTES, "", "",
+ G_TYPE_PTR_ARRAY,
+ G_PARAM_READWRITE |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingIPConfig:ignore-auto-routes:
+ *
+ * When #NMSettingIPConfig:method is set to "auto" and this property to
+ * %TRUE, automatically configured routes are ignored and only routes
+ * specified in the #NMSettingIPConfig:routes property, if any, are used.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_IGNORE_AUTO_ROUTES,
+ g_param_spec_boolean (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, "", "",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingIPConfig:ignore-auto-dns:
+ *
+ * When #NMSettingIPConfig:method is set to "auto" and this property to
+ * %TRUE, automatically configured nameservers and search domains are
+ * ignored and only nameservers and search domains specified in the
+ * #NMSettingIPConfig:dns and #NMSettingIPConfig:dns-search properties, if
+ * any, are used.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_IGNORE_AUTO_DNS,
+ g_param_spec_boolean (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, "", "",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingIPConfig:dhcp-hostname:
+ *
+ * If the #NMSettingIPConfig:dhcp-send-hostname property is %TRUE, then the
+ * specified name will be sent to the DHCP server when acquiring a lease.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_DHCP_HOSTNAME,
+ g_param_spec_string (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, "", "",
+ NULL,
+ G_PARAM_READWRITE |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingIPConfig:dhcp-send-hostname:
+ *
+ * If %TRUE, a hostname is sent to the DHCP server when acquiring a lease.
+ * Some DHCP servers use this hostname to update DNS databases, essentially
+ * providing a static hostname for the computer. If the
+ * #NMSettingIPConfig:dhcp-hostname property is %NULL and this property is
+ * %TRUE, the current persistent hostname of the computer is sent.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_DHCP_SEND_HOSTNAME,
+ g_param_spec_boolean (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, "", "",
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingIPConfig:never-default:
+ *
+ * If %TRUE, this connection will never be the default connection for this
+ * IP type, meaning it will never be assigned the default route by
+ * NetworkManager.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_NEVER_DEFAULT,
+ g_param_spec_boolean (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, "", "",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingIPConfig:may-fail:
+ *
+ * If %TRUE, allow overall network configuration to proceed even if the
+ * configuration specified by this property times out. Note that at least
+ * one IP configuration must succeed or overall network configuration will
+ * still fail. For example, in IPv6-only networks, setting this property to
+ * %TRUE on the #NMSettingIP4Config allows the overall network configuration
+ * to succeed if IPv4 configuration fails but IPv6 configuration completes
+ * successfully.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_MAY_FAIL,
+ g_param_spec_boolean (NM_SETTING_IP_CONFIG_MAY_FAIL, "", "",
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+}
const char *name,
GVariant *value);
+
+#define NM_TYPE_SETTING_IP_CONFIG (nm_setting_ip_config_get_type ())
+#define NM_SETTING_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfig))
+#define NM_SETTING_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_IPCONFIG, NMSettingIPConfigClass))
+#define NM_IS_SETTING_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_IP_CONFIG))
+#define NM_IS_SETTING_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_IP_CONFIG))
+#define NM_SETTING_IP_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfigClass))
+
+#define NM_SETTING_IP_CONFIG_METHOD "method"
+#define NM_SETTING_IP_CONFIG_DNS "dns"
+#define NM_SETTING_IP_CONFIG_DNS_SEARCH "dns-search"
+#define NM_SETTING_IP_CONFIG_ADDRESSES "addresses"
+#define NM_SETTING_IP_CONFIG_ROUTES "routes"
+#define NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
+#define NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns"
+#define NM_SETTING_IP_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
+#define NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname"
+#define NM_SETTING_IP_CONFIG_NEVER_DEFAULT "never-default"
+#define NM_SETTING_IP_CONFIG_MAY_FAIL "may-fail"
+
+struct _NMSettingIPConfig {
+ NMSetting parent;
+};
+
+typedef struct {
+ NMSettingClass parent;
+
+ /* Padding for future expansion */
+ gpointer padding[8];
+} NMSettingIPConfigClass;
+
+GType nm_setting_ip_config_get_type (void);
+
+const char *nm_setting_ip_config_get_method (NMSettingIPConfig *setting);
+
+guint nm_setting_ip_config_get_num_dns (NMSettingIPConfig *setting);
+const char *nm_setting_ip_config_get_dns (NMSettingIPConfig *setting,
+ int i);
+gboolean nm_setting_ip_config_add_dns (NMSettingIPConfig *setting,
+ const char *dns);
+void nm_setting_ip_config_remove_dns (NMSettingIPConfig *setting,
+ int i);
+gboolean nm_setting_ip_config_remove_dns_by_value (NMSettingIPConfig *setting,
+ const char *dns);
+void nm_setting_ip_config_clear_dns (NMSettingIPConfig *setting);
+
+guint nm_setting_ip_config_get_num_dns_searches (NMSettingIPConfig *setting);
+const char *nm_setting_ip_config_get_dns_search (NMSettingIPConfig *setting,
+ int i);
+gboolean nm_setting_ip_config_add_dns_search (NMSettingIPConfig *setting,
+ const char *dns_search);
+void nm_setting_ip_config_remove_dns_search (NMSettingIPConfig *setting,
+ int i);
+gboolean nm_setting_ip_config_remove_dns_search_by_value (NMSettingIPConfig *setting,
+ const char *dns_search);
+void nm_setting_ip_config_clear_dns_searches (NMSettingIPConfig *setting);
+
+guint nm_setting_ip_config_get_num_addresses (NMSettingIPConfig *setting);
+NMIPAddress *nm_setting_ip_config_get_address (NMSettingIPConfig *setting,
+ int i);
+gboolean nm_setting_ip_config_add_address (NMSettingIPConfig *setting,
+ NMIPAddress *address);
+void nm_setting_ip_config_remove_address (NMSettingIPConfig *setting,
+ int i);
+gboolean nm_setting_ip_config_remove_address_by_value (NMSettingIPConfig *setting,
+ NMIPAddress *address);
+void nm_setting_ip_config_clear_addresses (NMSettingIPConfig *setting);
+
+guint nm_setting_ip_config_get_num_routes (NMSettingIPConfig *setting);
+NMIPRoute *nm_setting_ip_config_get_route (NMSettingIPConfig *setting,
+ int i);
+gboolean nm_setting_ip_config_add_route (NMSettingIPConfig *setting,
+ NMIPRoute *route);
+void nm_setting_ip_config_remove_route (NMSettingIPConfig *setting,
+ int i);
+gboolean nm_setting_ip_config_remove_route_by_value (NMSettingIPConfig *setting,
+ NMIPRoute *route);
+void nm_setting_ip_config_clear_routes (NMSettingIPConfig *setting);
+
+gboolean nm_setting_ip_config_get_ignore_auto_routes (NMSettingIPConfig *setting);
+gboolean nm_setting_ip_config_get_ignore_auto_dns (NMSettingIPConfig *setting);
+
+const char *nm_setting_ip_config_get_dhcp_hostname (NMSettingIPConfig *setting);
+gboolean nm_setting_ip_config_get_dhcp_send_hostname (NMSettingIPConfig *setting);
+
+gboolean nm_setting_ip_config_get_never_default (NMSettingIPConfig *setting);
+gboolean nm_setting_ip_config_get_may_fail (NMSettingIPConfig *setting);
+
G_END_DECLS
#endif /* NM_SETTING_IP_CONFIG_H */
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
- * Copyright 2007 - 2014 Red Hat, Inc.
- * Copyright 2007 - 2008 Novell, Inc.
+ * Copyright 2014 Red Hat, Inc.
*/
#include <string.h>
#include <glib/gi18n.h>
-#include <arpa/inet.h>
#include "nm-setting-ip4-config.h"
-#include "nm-utils.h"
-#include "nm-glib-compat.h"
#include "nm-setting-private.h"
-#include "nm-core-internal.h"
-#include "nm-utils-private.h"
/**
* SECTION:nm-setting-ip4-config
* @short_description: Describes IPv4 addressing, routing, and name service properties
*
* The #NMSettingIP4Config object is a #NMSetting subclass that describes
- * properties related to IPv4 addressing, routing, and Domain Name Service
- **/
-
-G_DEFINE_TYPE_WITH_CODE (NMSettingIP4Config, nm_setting_ip4_config, NM_TYPE_SETTING,
+ * properties related to IPv4 addressing, routing, and Domain Name Service.
+ *
+ * #NMSettingIP4Config has few properties or methods of its own; it inherits
+ * almost everything from #NMSettingIPConfig.
+ *
+ * NetworkManager supports 5 values for the #NMSettingIPConfig:method property
+ * for IPv4. If "auto" is specified then the appropriate automatic method
+ * (DHCP, PPP, etc) is used for the interface and most other properties can be
+ * left unset. If "link-local" is specified, then a link-local address in the
+ * 169.254/16 range will be assigned to the interface. If "manual" is
+ * specified, static IP addressing is used and at least one IP address must be
+ * given in the "addresses" property. If "shared" is specified (indicating that
+ * this connection will provide network access to other computers) then the
+ * interface is assigned an address in the 10.42.x.1/24 range and a DHCP and
+ * forwarding DNS server are started, and the interface is NAT-ed to the current
+ * default network connection. "disabled" means IPv4 will not be used on this
+ * connection.
+ **/
+
+G_DEFINE_TYPE_WITH_CODE (NMSettingIP4Config, nm_setting_ip4_config, NM_TYPE_SETTING_IP_CONFIG,
_nm_register_setting (IP4_CONFIG, 4))
NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_IP4_CONFIG)
#define NM_SETTING_IP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_IP4_CONFIG, NMSettingIP4ConfigPrivate))
typedef struct {
- char *method;
- GSList *dns; /* list of IP address strings */
- GSList *dns_search; /* list of strings */
- GSList *addresses; /* array of NMIPAddress */
- GSList *routes; /* array of NMIPRoute */
- gboolean ignore_auto_routes;
- gboolean ignore_auto_dns;
char *dhcp_client_id;
- gboolean dhcp_send_hostname;
- char *dhcp_hostname;
- gboolean never_default;
- gboolean may_fail;
} NMSettingIP4ConfigPrivate;
enum {
PROP_0,
- PROP_METHOD,
- PROP_DNS,
- PROP_DNS_SEARCH,
- PROP_ADDRESSES,
- PROP_ROUTES,
- PROP_IGNORE_AUTO_ROUTES,
- PROP_IGNORE_AUTO_DNS,
PROP_DHCP_CLIENT_ID,
- PROP_DHCP_SEND_HOSTNAME,
- PROP_DHCP_HOSTNAME,
- PROP_NEVER_DEFAULT,
- PROP_MAY_FAIL,
LAST_PROP
-};
-
-/**
- * nm_setting_ip4_config_new:
- *
- * Creates a new #NMSettingIP4Config object with default values.
- *
- * Returns: (transfer full): the new empty #NMSettingIP4Config object
- **/
-NMSetting *
-nm_setting_ip4_config_new (void)
-{
- return (NMSetting *) g_object_new (NM_TYPE_SETTING_IP4_CONFIG, NULL);
-}
-
-/**
- * nm_setting_ip4_config_get_method:
- * @setting: the #NMSettingIP4Config
- *
- * Returns: the #NMSettingIP4Config:method property of the setting
- **/
-const char *
-nm_setting_ip4_config_get_method (NMSettingIP4Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL);
-
- return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->method;
-}
-
-/**
- * nm_setting_ip4_config_get_num_dns:
- * @setting: the #NMSettingIP4Config
- *
- * Returns: the number of configured DNS servers
- **/
-guint32
-nm_setting_ip4_config_get_num_dns (NMSettingIP4Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), 0);
-
- return g_slist_length (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns);
-}
-
-/**
- * nm_setting_ip4_config_get_dns:
- * @setting: the #NMSettingIP4Config
- * @i: index number of the DNS server to return
- *
- * Returns: the IPv4 address of the DNS server at index @i
- **/
-const char *
-nm_setting_ip4_config_get_dns (NMSettingIP4Config *setting, guint32 i)
-{
- NMSettingIP4ConfigPrivate *priv;
-
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL);
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < g_slist_length (priv->dns), NULL);
-
- return (const char *) g_slist_nth_data (priv->dns, i);
-}
-
-static const char *
-canonicalize_ip (const char *ip)
-{
- in_addr_t addr;
- int ret;
-
- ret = inet_pton (AF_INET, ip, &addr);
- g_return_val_if_fail (ret == 1, NULL);
- return nm_utils_inet4_ntop (addr, NULL);
-}
-
-/**
- * nm_setting_ip4_config_add_dns:
- * @setting: the #NMSettingIP4Config
- * @dns: the IPv4 address of the DNS server to add
- *
- * Adds a new DNS server to the setting.
- *
- * Returns: %TRUE if the DNS server was added; %FALSE if the server was already
- * known
- **/
-gboolean
-nm_setting_ip4_config_add_dns (NMSettingIP4Config *setting, const char *dns)
-{
- NMSettingIP4ConfigPrivate *priv;
- const char *dns_canonical;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
- g_return_val_if_fail (dns != NULL, FALSE);
- g_return_val_if_fail (dns[0] != '\0', FALSE);
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
-
- dns_canonical = canonicalize_ip (dns);
- g_return_val_if_fail (dns_canonical != NULL, FALSE);
-
- for (iter = priv->dns; iter; iter = g_slist_next (iter)) {
- if (!strcmp (dns_canonical, (char *) iter->data))
- return FALSE;
- }
-
- priv->dns = g_slist_append (priv->dns, g_strdup (dns_canonical));
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS);
- return TRUE;
-}
-
-/**
- * nm_setting_ip4_config_remove_dns:
- * @setting: the #NMSettingIP4Config
- * @i: index number of the DNS server to remove
- *
- * Removes the DNS server at index @i.
- **/
-void
-nm_setting_ip4_config_remove_dns (NMSettingIP4Config *setting, guint32 i)
-{
- NMSettingIP4ConfigPrivate *priv;
- GSList *elt;
-
- g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- elt = g_slist_nth (priv->dns, i);
- g_return_if_fail (elt != NULL);
-
- g_free (elt->data);
- priv->dns = g_slist_delete_link (priv->dns, elt);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS);
-}
-
-/**
- * nm_setting_ip4_config_remove_dns_by_value:
- * @setting: the #NMSettingIP4Config
- * @dns: the DNS server to remove
- *
- * Removes the DNS server @dns.
- *
- * Returns: %TRUE if the DNS server was found and removed; %FALSE if it was not.
- **/
-gboolean
-nm_setting_ip4_config_remove_dns_by_value (NMSettingIP4Config *setting, const char *dns)
-{
- NMSettingIP4ConfigPrivate *priv;
- const char *dns_canonical;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
- g_return_val_if_fail (dns != NULL, FALSE);
- g_return_val_if_fail (dns[0] != '\0', FALSE);
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
-
- dns_canonical = canonicalize_ip (dns);
- g_return_val_if_fail (dns_canonical != NULL, FALSE);
-
- for (iter = priv->dns; iter; iter = g_slist_next (iter)) {
- if (!strcmp (dns_canonical, (char *) iter->data)) {
- priv->dns = g_slist_delete_link (priv->dns, iter);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * nm_setting_ip4_config_clear_dns:
- * @setting: the #NMSettingIP4Config
- *
- * Removes all configured DNS servers.
- **/
-void
-nm_setting_ip4_config_clear_dns (NMSettingIP4Config *setting)
-{
- g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
-
- g_slist_free_full (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns, g_free);
- NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns = NULL;
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS);
-}
-
-/**
- * nm_setting_ip4_config_get_num_dns_searches:
- * @setting: the #NMSettingIP4Config
- *
- * Returns: the number of configured DNS search domains
- **/
-guint32
-nm_setting_ip4_config_get_num_dns_searches (NMSettingIP4Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), 0);
-
- return g_slist_length (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search);
-}
-
-/**
- * nm_setting_ip4_config_get_dns_search:
- * @setting: the #NMSettingIP4Config
- * @i: index number of the DNS search domain to return
- *
- * Returns: the DNS search domain at index @i
- **/
-const char *
-nm_setting_ip4_config_get_dns_search (NMSettingIP4Config *setting, guint32 i)
-{
- NMSettingIP4ConfigPrivate *priv;
-
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL);
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < g_slist_length (priv->dns_search), NULL);
-
- return (const char *) g_slist_nth_data (priv->dns_search, i);
-}
-
-/**
- * nm_setting_ip4_config_add_dns_search:
- * @setting: the #NMSettingIP4Config
- * @dns_search: the search domain to add
- *
- * Adds a new DNS search domain to the setting.
- *
- * Returns: %TRUE if the DNS search domain was added; %FALSE if the search
- * domain was already known
- **/
-gboolean
-nm_setting_ip4_config_add_dns_search (NMSettingIP4Config *setting,
- const char *dns_search)
-{
- NMSettingIP4ConfigPrivate *priv;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
- g_return_val_if_fail (dns_search != NULL, FALSE);
- g_return_val_if_fail (dns_search[0] != '\0', FALSE);
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- for (iter = priv->dns_search; iter; iter = g_slist_next (iter)) {
- if (!strcmp (dns_search, (char *) iter->data))
- return FALSE;
- }
-
- priv->dns_search = g_slist_append (priv->dns_search, g_strdup (dns_search));
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH);
- return TRUE;
-}
-
-/**
- * nm_setting_ip4_config_remove_dns_search:
- * @setting: the #NMSettingIP4Config
- * @i: index number of the DNS search domain
- *
- * Removes the DNS search domain at index @i.
- **/
-void
-nm_setting_ip4_config_remove_dns_search (NMSettingIP4Config *setting, guint32 i)
-{
- NMSettingIP4ConfigPrivate *priv;
- GSList *elt;
-
- g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- elt = g_slist_nth (priv->dns_search, i);
- g_return_if_fail (elt != NULL);
-
- g_free (elt->data);
- priv->dns_search = g_slist_delete_link (priv->dns_search, elt);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH);
-}
-
-/**
- * nm_setting_ip4_config_remove_dns_search_by_value:
- * @setting: the #NMSettingIP4Config
- * @dns_search: the search domain to remove
- *
- * Removes the DNS search domain @dns_search.
- *
- * Returns: %TRUE if the DNS search domain was found and removed; %FALSE if it was not.
- **/
-gboolean
-nm_setting_ip4_config_remove_dns_search_by_value (NMSettingIP4Config *setting,
- const char *dns_search)
-{
- NMSettingIP4ConfigPrivate *priv;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
- g_return_val_if_fail (dns_search != NULL, FALSE);
- g_return_val_if_fail (dns_search[0] != '\0', FALSE);
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- for (iter = priv->dns_search; iter; iter = g_slist_next (iter)) {
- if (!strcmp (dns_search, (char *) iter->data)) {
- priv->dns_search = g_slist_delete_link (priv->dns_search, iter);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * nm_setting_ip4_config_clear_dns_searches:
- * @setting: the #NMSettingIP4Config
- *
- * Removes all configured DNS search domains.
- **/
-void
-nm_setting_ip4_config_clear_dns_searches (NMSettingIP4Config *setting)
-{
- g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
-
- g_slist_free_full (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search, g_free);
- NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search = NULL;
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH);
-}
-
-/**
- * nm_setting_ip4_config_get_num_addresses:
- * @setting: the #NMSettingIP4Config
- *
- * Returns: the number of configured addresses
- **/
-guint32
-nm_setting_ip4_config_get_num_addresses (NMSettingIP4Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), 0);
-
- return g_slist_length (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->addresses);
-}
-
-/**
- * nm_setting_ip4_config_get_address:
- * @setting: the #NMSettingIP4Config
- * @i: index number of the address to return
- *
- * Returns: the address at index @i
- **/
-NMIPAddress *
-nm_setting_ip4_config_get_address (NMSettingIP4Config *setting, guint32 i)
-{
- NMSettingIP4ConfigPrivate *priv;
-
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL);
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < g_slist_length (priv->addresses), NULL);
-
- return (NMIPAddress *) g_slist_nth_data (priv->addresses, i);
-}
-
-/**
- * nm_setting_ip4_config_add_address:
- * @setting: the #NMSettingIP4Config
- * @address: the new address to add
- *
- * Adds a new IPv4 address and associated information to the setting. The
- * given address is duplicated internally and is not changed by this function.
- *
- * Returns: %TRUE if the address was added; %FALSE if the address was already
- * known.
- **/
-gboolean
-nm_setting_ip4_config_add_address (NMSettingIP4Config *setting,
- NMIPAddress *address)
-{
- NMSettingIP4ConfigPrivate *priv;
- NMIPAddress *copy;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
- g_return_val_if_fail (address != NULL, FALSE);
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- for (iter = priv->addresses; iter; iter = g_slist_next (iter)) {
- if (nm_ip_address_equal ((NMIPAddress *) iter->data, address))
- return FALSE;
- }
-
- copy = nm_ip_address_dup (address);
- priv->addresses = g_slist_append (priv->addresses, copy);
-
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES);
- return TRUE;
-}
-
-/**
- * nm_setting_ip4_config_remove_address:
- * @setting: the #NMSettingIP4Config
- * @i: index number of the address to remove
- *
- * Removes the address at index @i.
- **/
-void
-nm_setting_ip4_config_remove_address (NMSettingIP4Config *setting, guint32 i)
-{
- NMSettingIP4ConfigPrivate *priv;
- GSList *addr;
-
- g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- addr = g_slist_nth (priv->addresses, i);
- g_return_if_fail (addr != NULL);
-
- nm_ip_address_unref ((NMIPAddress *) addr->data);
- priv->addresses = g_slist_delete_link (priv->addresses, addr);
-
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES);
-}
-
-/**
- * nm_setting_ip4_config_remove_address_by_value:
- * @setting: the #NMSettingIP4Config
- * @address: the IP address to remove
- *
- * Removes the address @address.
- *
- * Returns: %TRUE if the address was found and removed; %FALSE if it was not.
- **/
-gboolean
-nm_setting_ip4_config_remove_address_by_value (NMSettingIP4Config *setting,
- NMIPAddress *address)
-{
- NMSettingIP4ConfigPrivate *priv;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
- g_return_val_if_fail (address != NULL, FALSE);
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- for (iter = priv->addresses; iter; iter = g_slist_next (iter)) {
- if (nm_ip_address_equal ((NMIPAddress *) iter->data, address)) {
- nm_ip_address_unref ((NMIPAddress *) iter->data);
- priv->addresses = g_slist_delete_link (priv->addresses, iter);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * nm_setting_ip4_config_clear_addresses:
- * @setting: the #NMSettingIP4Config
- *
- * Removes all configured addresses.
- **/
-void
-nm_setting_ip4_config_clear_addresses (NMSettingIP4Config *setting)
-{
- NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
-
- g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
-
- g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip_address_unref);
- priv->addresses = NULL;
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES);
-}
-
-/**
- * nm_setting_ip4_config_get_num_routes:
- * @setting: the #NMSettingIP4Config
- *
- * Returns: the number of configured routes
- **/
-guint32
-nm_setting_ip4_config_get_num_routes (NMSettingIP4Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), 0);
-
- return g_slist_length (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->routes);
-}
-
-/**
- * nm_setting_ip4_config_get_route:
- * @setting: the #NMSettingIP4Config
- * @i: index number of the route to return
- *
- * Returns: the route at index @i
- **/
-NMIPRoute *
-nm_setting_ip4_config_get_route (NMSettingIP4Config *setting, guint32 i)
-{
- NMSettingIP4ConfigPrivate *priv;
-
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL);
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < g_slist_length (priv->routes), NULL);
-
- return (NMIPRoute *) g_slist_nth_data (priv->routes, i);
-}
-
-/**
- * nm_setting_ip4_config_add_route:
- * @setting: the #NMSettingIP4Config
- * @route: the route to add
- *
- * Adds a new IPv4 route and associated information to the setting. The
- * given route is duplicated internally and is not changed by this function.
- *
- * Returns: %TRUE if the route was added; %FALSE if the route was already known.
- **/
-gboolean
-nm_setting_ip4_config_add_route (NMSettingIP4Config *setting,
- NMIPRoute *route)
-{
- NMSettingIP4ConfigPrivate *priv;
- NMIPRoute *copy;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
- g_return_val_if_fail (route != NULL, FALSE);
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- for (iter = priv->routes; iter; iter = g_slist_next (iter)) {
- if (nm_ip_route_equal (iter->data, route))
- return FALSE;
- }
-
- copy = nm_ip_route_dup (route);
- priv->routes = g_slist_append (priv->routes, copy);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
- return TRUE;
-}
-
-/**
- * nm_setting_ip4_config_remove_route:
- * @setting: the #NMSettingIP4Config
- * @i: index number of the route
- *
- * Removes the route at index @i.
- **/
-void
-nm_setting_ip4_config_remove_route (NMSettingIP4Config *setting, guint32 i)
-{
- NMSettingIP4ConfigPrivate *priv;
- GSList *elt;
-
- g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- elt = g_slist_nth (priv->routes, i);
- g_return_if_fail (elt != NULL);
-
- nm_ip_route_unref ((NMIPRoute *) elt->data);
- priv->routes = g_slist_delete_link (priv->routes, elt);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
-}
-
-/**
- * nm_setting_ip4_config_remove_route_by_value:
- * @setting: the #NMSettingIP4Config
- * @route: the route to remove
- *
- * Removes the route @route.
- *
- * Returns: %TRUE if the route was found and removed; %FALSE if it was not.
- **/
-gboolean
-nm_setting_ip4_config_remove_route_by_value (NMSettingIP4Config *setting,
- NMIPRoute *route)
-{
- NMSettingIP4ConfigPrivate *priv;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
- g_return_val_if_fail (route != NULL, FALSE);
-
- priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- for (iter = priv->routes; iter; iter = g_slist_next (iter)) {
- if (nm_ip_route_equal ((NMIPRoute *) iter->data, route)) {
- nm_ip_route_unref ((NMIPRoute *) iter->data);
- priv->routes = g_slist_delete_link (priv->routes, iter);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * nm_setting_ip4_config_clear_routes:
- * @setting: the #NMSettingIP4Config
- *
- * Removes all configured routes.
- **/
-void
-nm_setting_ip4_config_clear_routes (NMSettingIP4Config *setting)
-{
- NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
-
- g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
-
- g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_route_unref);
- priv->routes = NULL;
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
-}
-
-/**
- * nm_setting_ip4_config_get_ignore_auto_routes:
- * @setting: the #NMSettingIP4Config
- *
- * Returns the value contained in the #NMSettingIP4Config:ignore-auto-routes
- * property.
- *
- * Returns: %TRUE if automatically configured (ie via DHCP) routes should be
- * ignored.
- **/
-gboolean
-nm_setting_ip4_config_get_ignore_auto_routes (NMSettingIP4Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
-
- return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->ignore_auto_routes;
-}
+};
/**
- * nm_setting_ip4_config_get_ignore_auto_dns:
- * @setting: the #NMSettingIP4Config
+ * nm_setting_ip4_config_new:
*
- * Returns the value contained in the #NMSettingIP4Config:ignore-auto-dns
- * property.
+ * Creates a new #NMSettingIP4Config object with default values.
*
- * Returns: %TRUE if automatically configured (ie via DHCP) DNS information
- * should be ignored.
+ * Returns: (transfer full): the new empty #NMSettingIP4Config object
**/
-gboolean
-nm_setting_ip4_config_get_ignore_auto_dns (NMSettingIP4Config *setting)
+NMSetting *
+nm_setting_ip4_config_new (void)
{
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
-
- return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->ignore_auto_dns;
+ return (NMSetting *) g_object_new (NM_TYPE_SETTING_IP4_CONFIG, NULL);
}
/**
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_client_id;
}
-/**
- * nm_setting_ip4_config_get_dhcp_send_hostname:
- * @setting: the #NMSettingIP4Config
- *
- * Returns the value contained in the #NMSettingIP4Config:dhcp-send-hostname
- * property.
- *
- * Returns: %TRUE if NetworkManager should send the machine hostname to the
- * DHCP server when requesting addresses to allow the server to automatically
- * update DNS information for this machine.
- **/
-gboolean
-nm_setting_ip4_config_get_dhcp_send_hostname (NMSettingIP4Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
-
- return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_send_hostname;
-}
-
-/**
- * nm_setting_ip4_config_get_dhcp_hostname:
- * @setting: the #NMSettingIP4Config
- *
- * Returns the value contained in the #NMSettingIP4Config:dhcp-hostname
- * property.
- *
- * Returns: the configured hostname to send to the DHCP server
- **/
-const char *
-nm_setting_ip4_config_get_dhcp_hostname (NMSettingIP4Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL);
-
- return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_hostname;
-}
-
-/**
- * nm_setting_ip4_config_get_never_default:
- * @setting: the #NMSettingIP4Config
- *
- * Returns the value contained in the #NMSettingIP4Config:never-default
- * property.
- *
- * Returns: %TRUE if this connection should never be the default connection
- * for IPv4 addressing
- **/
-gboolean
-nm_setting_ip4_config_get_never_default (NMSettingIP4Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
-
- return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->never_default;
-}
-
-/**
- * nm_setting_ip4_config_get_may_fail:
- * @setting: the #NMSettingIP4Config
- *
- * Returns the value contained in the #NMSettingIP4Config:may-fail
- * property.
- *
- * Returns: %TRUE if this connection doesn't require IPv4 addressing to complete
- * for the connection to succeed.
- **/
-gboolean
-nm_setting_ip4_config_get_may_fail (NMSettingIP4Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
-
- return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->may_fail;
-}
-
-static gboolean
-verify_label (const char *label)
-{
- const char *p;
- char *iface;
-
- p = strchr (label, ':');
- if (!p)
- return FALSE;
- iface = g_strndup (label, p - label);
- if (!nm_utils_iface_valid_name (iface)) {
- g_free (iface);
- return FALSE;
- }
- g_free (iface);
-
- for (p++; *p; p++) {
- if (!g_ascii_isalnum (*p) && *p != '_')
- return FALSE;
- }
-
- return TRUE;
-}
-
static gboolean
verify (NMSetting *setting, NMConnection *connection, GError **error)
{
NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
- GSList *iter;
- int i;
+ NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting);
+ const char *method;
- if (!priv->method) {
- g_set_error_literal (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_MISSING_PROPERTY,
- _("property is missing"));
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_METHOD);
+ if (!NM_SETTING_CLASS (nm_setting_ip4_config_parent_class)->verify (setting, connection, error))
return FALSE;
- }
- if (!strcmp (priv->method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
- if (!priv->addresses) {
+ method = nm_setting_ip_config_get_method (s_ip);
+ /* Base class already checked that it exists */
+ g_assert (method);
+
+ if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
+ if (nm_setting_ip_config_get_num_addresses (s_ip) == 0) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_MISSING_PROPERTY,
_("this property cannot be empty for '%s=%s'"),
- NM_SETTING_IP4_CONFIG_METHOD, priv->method);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_METHOD, method);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES);
return FALSE;
}
- } else if ( !strcmp (priv->method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)
- || !strcmp (priv->method, NM_SETTING_IP4_CONFIG_METHOD_SHARED)
- || !strcmp (priv->method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED)) {
- if (priv->dns) {
+ } else if ( !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)
+ || !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED)
+ || !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED)) {
+ if (nm_setting_ip_config_get_num_dns (s_ip) > 0) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("this property is not allowed for '%s=%s'"),
- NM_SETTING_IP4_CONFIG_METHOD, priv->method);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_METHOD, method);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS);
return FALSE;
}
- if (priv->dns_search) {
+ if (nm_setting_ip_config_get_num_dns_searches (s_ip) > 0) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("this property is not allowed for '%s=%s'"),
- NM_SETTING_IP4_CONFIG_METHOD, priv->method);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_METHOD, method);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS_SEARCH);
return FALSE;
}
/* Shared allows IP addresses; link-local and disabled do not */
- if (strcmp (priv->method, NM_SETTING_IP4_CONFIG_METHOD_SHARED) != 0) {
- if (priv->addresses) {
+ if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED) != 0) {
+ if (nm_setting_ip_config_get_num_addresses (s_ip) > 0) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("this property is not allowed for '%s=%s'"),
- NM_SETTING_IP4_CONFIG_METHOD, priv->method);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_METHOD, method);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES);
return FALSE;
}
}
- } else if (!strcmp (priv->method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
+ } else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
/* nothing to do */
} else {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("property is invalid"));
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_METHOD);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_METHOD);
return FALSE;
}
return FALSE;
}
- if (priv->dhcp_hostname && !strlen (priv->dhcp_hostname)) {
- g_set_error_literal (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("property is empty"));
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME);
- return FALSE;
- }
-
- /* Validate address labels */
- for (iter = priv->addresses, i = 0; iter; iter = g_slist_next (iter), i++) {
- NMIPAddress *addr = (NMIPAddress *) iter->data;
- GVariant *label;
-
- label = nm_ip_address_get_attribute (addr, "label");
- if (!label)
- continue;
- if (!g_variant_is_of_type (label, G_VARIANT_TYPE_STRING)) {
- g_set_error (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("%d. IPv4 address has 'label' property with invalid type"),
- i+1);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ADDRESSES);
- return FALSE;
- }
- if (!verify_label (g_variant_get_string (label, NULL))) {
- g_set_error (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("%d. IPv4 address has invalid label '%s'"),
- i+1, g_variant_get_string (label, NULL));
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ADDRESSES);
- return FALSE;
- }
- }
-
- /* Validate DNS */
- for (iter = priv->dns, i = 0; iter; iter = g_slist_next (iter), i++) {
- const char *dns = (const char *) iter->data;
- in_addr_t addr;
-
- if (inet_pton (AF_INET, dns, &addr) != 1) {
- g_set_error (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("%d. DNS server address is invalid"),
- i+1);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_DNS);
- return FALSE;
- }
- }
-
return TRUE;
}
-
static void
nm_setting_ip4_config_init (NMSettingIP4Config *setting)
{
static void
finalize (GObject *object)
{
- NMSettingIP4Config *self = NM_SETTING_IP4_CONFIG (object);
- NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (self);
+ NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (object);
- g_free (priv->method);
- g_free (priv->dhcp_hostname);
g_free (priv->dhcp_client_id);
- g_slist_free_full (priv->dns, g_free);
- g_slist_free_full (priv->dns_search, g_free);
- g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip_address_unref);
- g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_route_unref);
-
G_OBJECT_CLASS (nm_setting_ip4_config_parent_class)->finalize (object);
}
+static void
+set_property (GObject *object, guint prop_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (object);
+
+ switch (prop_id) {
+ case PROP_DHCP_CLIENT_ID:
+ g_free (priv->dhcp_client_id);
+ priv->dhcp_client_id = g_value_dup_string (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
+{
+ NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (object);
+
+ switch (prop_id) {
+ case PROP_DHCP_CLIENT_ID:
+ g_value_set_string (value, nm_setting_ip4_config_get_dhcp_client_id (s_ip4));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
static GVariant *
ip4_dns_to_dbus (const GValue *prop_value)
{
NMConnection *connection,
const char *property)
{
- NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
+ NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting);
GPtrArray *labels;
- GSList *iter;
GVariant *ret;
+ int num_addrs, i;
labels = g_ptr_array_new ();
- for (iter = priv->addresses; iter; iter = iter->next) {
- NMIPAddress *addr = iter->data;
+ num_addrs = nm_setting_ip_config_get_num_addresses (s_ip);
+ for (i = 0; i < num_addrs; i++) {
+ NMIPAddress *addr = nm_setting_ip_config_get_address (s_ip, i);
GVariant *label = nm_ip_address_get_attribute (addr, "label");
g_ptr_array_add (labels, (char *) (label ? g_variant_get_string (label, NULL) : ""));
g_value_take_boxed (prop_value, nm_utils_ip4_routes_from_variant (dbus_value));
}
-static void
-set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
-{
- NMSettingIP4Config *setting = NM_SETTING_IP4_CONFIG (object);
- NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
-
- switch (prop_id) {
- case PROP_METHOD:
- g_free (priv->method);
- priv->method = g_value_dup_string (value);
- break;
- case PROP_DNS:
- g_slist_free_full (priv->dns, g_free);
- priv->dns = _nm_utils_strv_to_slist (g_value_get_boxed (value));
- break;
- case PROP_DNS_SEARCH:
- g_slist_free_full (priv->dns_search, g_free);
- priv->dns_search = _nm_utils_strv_to_slist (g_value_get_boxed (value));
- break;
- case PROP_ADDRESSES:
- g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip_address_unref);
- priv->addresses = _nm_utils_copy_array_to_slist (g_value_get_boxed (value),
- (NMUtilsCopyFunc) nm_ip_address_dup);
-
- break;
- case PROP_ROUTES:
- g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_route_unref);
- priv->routes = _nm_utils_copy_array_to_slist (g_value_get_boxed (value),
- (NMUtilsCopyFunc) nm_ip_route_dup);
- break;
- case PROP_IGNORE_AUTO_ROUTES:
- priv->ignore_auto_routes = g_value_get_boolean (value);
- break;
- case PROP_IGNORE_AUTO_DNS:
- priv->ignore_auto_dns = g_value_get_boolean (value);
- break;
- case PROP_DHCP_CLIENT_ID:
- g_free (priv->dhcp_client_id);
- priv->dhcp_client_id = g_value_dup_string (value);
- break;
- case PROP_DHCP_SEND_HOSTNAME:
- priv->dhcp_send_hostname = g_value_get_boolean (value);
- break;
- case PROP_DHCP_HOSTNAME:
- g_free (priv->dhcp_hostname);
- priv->dhcp_hostname = g_value_dup_string (value);
- break;
- case PROP_NEVER_DEFAULT:
- priv->never_default = g_value_get_boolean (value);
- break;
- case PROP_MAY_FAIL:
- priv->may_fail = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
-{
- NMSettingIP4Config *setting = NM_SETTING_IP4_CONFIG (object);
- NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
-
- switch (prop_id) {
- case PROP_METHOD:
- g_value_set_string (value, nm_setting_ip4_config_get_method (setting));
- break;
- case PROP_DNS:
- g_value_take_boxed (value, _nm_utils_slist_to_strv (priv->dns));
- break;
- case PROP_DNS_SEARCH:
- g_value_take_boxed (value, _nm_utils_slist_to_strv (priv->dns_search));
- break;
- case PROP_ADDRESSES:
- g_value_take_boxed (value, _nm_utils_copy_slist_to_array (priv->addresses, (NMUtilsCopyFunc) nm_ip_address_dup, (GDestroyNotify) nm_ip_address_unref));
- break;
- case PROP_ROUTES:
- g_value_take_boxed (value, _nm_utils_copy_slist_to_array (priv->routes, (NMUtilsCopyFunc) nm_ip_route_dup, (GDestroyNotify) nm_ip_route_unref));
- break;
- case PROP_IGNORE_AUTO_ROUTES:
- g_value_set_boolean (value, nm_setting_ip4_config_get_ignore_auto_routes (setting));
- break;
- case PROP_IGNORE_AUTO_DNS:
- g_value_set_boolean (value, nm_setting_ip4_config_get_ignore_auto_dns (setting));
- break;
- case PROP_DHCP_CLIENT_ID:
- g_value_set_string (value, nm_setting_ip4_config_get_dhcp_client_id (setting));
- break;
- case PROP_DHCP_SEND_HOSTNAME:
- g_value_set_boolean (value, nm_setting_ip4_config_get_dhcp_send_hostname (setting));
- break;
- case PROP_DHCP_HOSTNAME:
- g_value_set_string (value, nm_setting_ip4_config_get_dhcp_hostname (setting));
- break;
- case PROP_NEVER_DEFAULT:
- g_value_set_boolean (value, priv->never_default);
- break;
- case PROP_MAY_FAIL:
- g_value_set_boolean (value, priv->may_fail);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
static void
-nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class)
+nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *ip4_class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
- NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
+ NMSettingClass *setting_class = NM_SETTING_CLASS (ip4_class);
+ GObjectClass *object_class = G_OBJECT_CLASS (ip4_class);
g_type_class_add_private (setting_class, sizeof (NMSettingIP4ConfigPrivate));
object_class->set_property = set_property;
object_class->get_property = get_property;
object_class->finalize = finalize;
- parent_class->verify = verify;
+ setting_class->verify = verify;
+
+ /* properties */
- /* Properties */
/**
- * NMSettingIP4Config:method:
+ * NMSettingIP4Config:dhcp-client-id:
*
- * IPv4 configuration method. If "auto" is specified then the appropriate
- * automatic method (DHCP, PPP, etc) is used for the interface and most
- * other properties can be left unset. If "link-local" is specified, then a
- * link-local address in the 169.254/16 range will be assigned to the
- * interface. If "manual" is specified, static IP addressing is used and at
- * least one IP address must be given in the "addresses" property. If
- * "shared" is specified (indicating that this connection will provide
- * network access to other computers) then the interface is assigned an
- * address in the 10.42.x.1/24 range and a DHCP and forwarding DNS server
- * are started, and the interface is NAT-ed to the current default network
- * connection. "disabled" means IPv4 will not be used on this connection.
- * This property must be set.
+ * A string sent to the DHCP server to identify the local machine which the
+ * DHCP server may use to customize the DHCP lease and options.
**/
g_object_class_install_property
- (object_class, PROP_METHOD,
- g_param_spec_string (NM_SETTING_IP4_CONFIG_METHOD, "", "",
+ (object_class, PROP_DHCP_CLIENT_ID,
+ g_param_spec_string (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, "", "",
NULL,
G_PARAM_READWRITE |
- NM_SETTING_PARAM_INFERRABLE |
G_PARAM_STATIC_STRINGS));
- /**
- * NMSettingIP4Config:dns:
- *
- * Array of IPv4 addresses of DNS servers. For the 'auto' method, these
- * DNS servers are appended to those (if any) returned by automatic
- * configuration. DNS servers cannot be used with the "shared",
- * "link-local", or "disabled" methods as there is no upstream network. In
- * all other methods, these DNS servers are used as the only DNS servers for
- * this connection.
- **/
- g_object_class_install_property
- (object_class, PROP_DNS,
- g_param_spec_boxed (NM_SETTING_IP4_CONFIG_DNS, "", "",
- G_TYPE_STRV,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
- _nm_setting_class_transform_property (parent_class, NM_SETTING_IP4_CONFIG_DNS,
+ /* IP4-specific property overrides */
+ _nm_setting_class_transform_property (setting_class,
+ NM_SETTING_IP_CONFIG_DNS,
G_VARIANT_TYPE ("au"),
ip4_dns_to_dbus,
ip4_dns_from_dbus);
- /**
- * NMSettingIP4Config:dns-search:
- *
- * List of DNS search domains. For the "auto" method, these search domains
- * are appended to those returned by automatic configuration. Search domains
- * cannot be used with the "shared", "link-local", or "disabled" methods as
- * there is no upstream network. In all other methods, these search domains
- * are used as the only search domains for this connection.
- **/
- g_object_class_install_property
- (object_class, PROP_DNS_SEARCH,
- g_param_spec_boxed (NM_SETTING_IP4_CONFIG_DNS_SEARCH, "", "",
- G_TYPE_STRV,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP4Config:addresses:
- *
- * Array of IPv4 addresses. The gateway may be left as 0 if no gateway exists
- * for that subnet. For the 'auto' method, given IP addresses are appended
- * to those returned by automatic configuration. Addresses cannot be used
- * with the "shared", "link-local", or "disabled" methods as addressing is
- * either automatic or disabled with these methods.
- *
- * Element-Type: NMIPAddress
- **/
- g_object_class_install_property
- (object_class, PROP_ADDRESSES,
- g_param_spec_boxed (NM_SETTING_IP4_CONFIG_ADDRESSES, "", "",
- G_TYPE_PTR_ARRAY,
- G_PARAM_READWRITE |
- NM_SETTING_PARAM_INFERRABLE |
- G_PARAM_STATIC_STRINGS));
- _nm_setting_class_override_property (parent_class, NM_SETTING_IP4_CONFIG_ADDRESSES,
+ _nm_setting_class_override_property (setting_class,
+ NM_SETTING_IP_CONFIG_ADDRESSES,
G_VARIANT_TYPE ("aau"),
ip4_addresses_get,
ip4_addresses_set,
NULL);
- _nm_setting_class_add_dbus_only_property (parent_class,
+ _nm_setting_class_add_dbus_only_property (setting_class,
"address-labels",
G_VARIANT_TYPE_STRING_ARRAY,
ip4_address_labels_get,
NULL);
- /**
- * NMSettingIP4Config:routes:
- *
- * Array of IPv4 routes. For the 'auto' method, given IP routes are appended
- * to those returned by automatic configuration. Routes cannot be used with
- * the 'shared', 'link-local', or 'disabled' methods because there is no
- * upstream network.
- *
- * Element-Type: NMIPRoute
- **/
- g_object_class_install_property
- (object_class, PROP_ROUTES,
- g_param_spec_boxed (NM_SETTING_IP4_CONFIG_ROUTES, "", "",
- G_TYPE_PTR_ARRAY,
- G_PARAM_READWRITE |
- NM_SETTING_PARAM_INFERRABLE |
- G_PARAM_STATIC_STRINGS));
- _nm_setting_class_transform_property (parent_class, NM_SETTING_IP4_CONFIG_ROUTES,
+ _nm_setting_class_transform_property (setting_class,
+ NM_SETTING_IP_CONFIG_ROUTES,
G_VARIANT_TYPE ("aau"),
ip4_routes_to_dbus,
ip4_routes_from_dbus);
-
- /**
- * NMSettingIP4Config:ignore-auto-routes:
- *
- * When the method is set to "auto" and this property to %TRUE,
- * automatically configured routes are ignored and only routes specified in
- * the #NMSettingIP4Config:routes property, if any, are used.
- **/
- g_object_class_install_property
- (object_class, PROP_IGNORE_AUTO_ROUTES,
- g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, "", "",
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP4Config:ignore-auto-dns:
- *
- * When the method is set to "auto" and this property to %TRUE,
- * automatically configured nameservers and search domains are ignored and
- * only nameservers and search domains specified in the
- * #NMSettingIP4Config:dns and #NMSettingIP4Config:dns-search properties, if
- * any, are used.
- **/
- g_object_class_install_property
- (object_class, PROP_IGNORE_AUTO_DNS,
- g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, "", "",
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP4Config:dhcp-client-id:
- *
- * A string sent to the DHCP server to identify the local machine which the
- * DHCP server may use to customize the DHCP lease and options.
- **/
- g_object_class_install_property
- (object_class, PROP_DHCP_CLIENT_ID,
- g_param_spec_string (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, "", "",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP4Config:dhcp-send-hostname:
- *
- * If %TRUE, a hostname is sent to the DHCP server when acquiring a lease.
- * Some DHCP servers use this hostname to update DNS databases, essentially
- * providing a static hostname for the computer. If the
- * #NMSettingIP4Config:dhcp-hostname property is empty and this property is
- * %TRUE, the current persistent hostname of the computer is sent.
- **/
- g_object_class_install_property
- (object_class, PROP_DHCP_SEND_HOSTNAME,
- g_param_spec_boolean (NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, "", "",
- TRUE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP4Config:dhcp-hostname:
- *
- * If the #NMSettingIP4Config:dhcp-send-hostname property is %TRUE, then the
- * specified name will be sent to the DHCP server when acquiring a lease.
- **/
- g_object_class_install_property
- (object_class, PROP_DHCP_HOSTNAME,
- g_param_spec_string (NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, "", "",
- NULL,
- G_PARAM_READWRITE |
- NM_SETTING_PARAM_INFERRABLE |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP4Config:never-default:
- *
- * If %TRUE, this connection will never be the default IPv4 connection,
- * meaning it will never be assigned the default route by NetworkManager.
- **/
- g_object_class_install_property
- (object_class, PROP_NEVER_DEFAULT,
- g_param_spec_boolean (NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, "", "",
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP4Config:may-fail:
- *
- * If %TRUE, allow overall network configuration to proceed even if IPv4
- * configuration times out. Note that at least one IP configuration must
- * succeed or overall network configuration will still fail. For example,
- * in IPv6-only networks, setting this property to %TRUE allows the overall
- * network configuration to succeed if IPv4 configuration fails but IPv6
- * configuration completes successfully.
- **/
- g_object_class_install_property
- (object_class, PROP_MAY_FAIL,
- g_param_spec_boolean (NM_SETTING_IP4_CONFIG_MAY_FAIL, "", "",
- TRUE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
}
#error "Only <NetworkManager.h> can be included directly."
#endif
-#include "nm-setting.h"
#include "nm-setting-ip-config.h"
G_BEGIN_DECLS
#define NM_SETTING_IP4_CONFIG_SETTING_NAME "ipv4"
-#define NM_SETTING_IP4_CONFIG_METHOD "method"
-#define NM_SETTING_IP4_CONFIG_DNS "dns"
-#define NM_SETTING_IP4_CONFIG_DNS_SEARCH "dns-search"
-#define NM_SETTING_IP4_CONFIG_ADDRESSES "addresses"
-#define NM_SETTING_IP4_CONFIG_ROUTES "routes"
-#define NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
-#define NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns"
#define NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID "dhcp-client-id"
-#define NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname"
-#define NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
-#define NM_SETTING_IP4_CONFIG_NEVER_DEFAULT "never-default"
-#define NM_SETTING_IP4_CONFIG_MAY_FAIL "may-fail"
/**
* NM_SETTING_IP4_CONFIG_METHOD_AUTO:
#define NM_SETTING_IP4_CONFIG_METHOD_DISABLED "disabled"
struct _NMSettingIP4Config {
- NMSetting parent;
+ NMSettingIPConfig parent;
};
typedef struct {
- NMSettingClass parent;
+ NMSettingIPConfigClass parent;
/*< private >*/
gpointer padding[4];
GType nm_setting_ip4_config_get_type (void);
-NMSetting * nm_setting_ip4_config_new (void);
-const char * nm_setting_ip4_config_get_method (NMSettingIP4Config *setting);
-
-guint32 nm_setting_ip4_config_get_num_dns (NMSettingIP4Config *setting);
-const char * nm_setting_ip4_config_get_dns (NMSettingIP4Config *setting, guint32 i);
-gboolean nm_setting_ip4_config_add_dns (NMSettingIP4Config *setting, const char *dns);
-void nm_setting_ip4_config_remove_dns (NMSettingIP4Config *setting, guint32 i);
-gboolean nm_setting_ip4_config_remove_dns_by_value (NMSettingIP4Config *setting, const char *dns);
-void nm_setting_ip4_config_clear_dns (NMSettingIP4Config *setting);
-
-guint32 nm_setting_ip4_config_get_num_dns_searches (NMSettingIP4Config *setting);
-const char * nm_setting_ip4_config_get_dns_search (NMSettingIP4Config *setting, guint32 i);
-gboolean nm_setting_ip4_config_add_dns_search (NMSettingIP4Config *setting, const char *dns_search);
-void nm_setting_ip4_config_remove_dns_search (NMSettingIP4Config *setting, guint32 i);
-gboolean nm_setting_ip4_config_remove_dns_search_by_value (NMSettingIP4Config *setting, const char *dns_search);
-void nm_setting_ip4_config_clear_dns_searches (NMSettingIP4Config *setting);
-
-guint32 nm_setting_ip4_config_get_num_addresses (NMSettingIP4Config *setting);
-NMIPAddress * nm_setting_ip4_config_get_address (NMSettingIP4Config *setting, guint32 i);
-gboolean nm_setting_ip4_config_add_address (NMSettingIP4Config *setting, NMIPAddress *address);
-void nm_setting_ip4_config_remove_address (NMSettingIP4Config *setting, guint32 i);
-gboolean nm_setting_ip4_config_remove_address_by_value (NMSettingIP4Config *setting, NMIPAddress *address);
-void nm_setting_ip4_config_clear_addresses (NMSettingIP4Config *setting);
-
-guint32 nm_setting_ip4_config_get_num_routes (NMSettingIP4Config *setting);
-NMIPRoute * nm_setting_ip4_config_get_route (NMSettingIP4Config *setting, guint32 i);
-gboolean nm_setting_ip4_config_add_route (NMSettingIP4Config *setting, NMIPRoute *route);
-void nm_setting_ip4_config_remove_route (NMSettingIP4Config *setting, guint32 i);
-gboolean nm_setting_ip4_config_remove_route_by_value (NMSettingIP4Config *setting, NMIPRoute *route);
-void nm_setting_ip4_config_clear_routes (NMSettingIP4Config *setting);
-
-gboolean nm_setting_ip4_config_get_ignore_auto_routes (NMSettingIP4Config *setting);
-gboolean nm_setting_ip4_config_get_ignore_auto_dns (NMSettingIP4Config *setting);
-const char * nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting);
-gboolean nm_setting_ip4_config_get_dhcp_send_hostname (NMSettingIP4Config *setting);
-const char * nm_setting_ip4_config_get_dhcp_hostname (NMSettingIP4Config *setting);
-
-gboolean nm_setting_ip4_config_get_never_default (NMSettingIP4Config *setting);
-
-gboolean nm_setting_ip4_config_get_may_fail (NMSettingIP4Config *setting);
+NMSetting *nm_setting_ip4_config_new (void);
+
+const char *nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting);
G_END_DECLS
#include <glib/gi18n.h>
#include "nm-setting-ip6-config.h"
-#include "nm-utils.h"
-#include "nm-utils-private.h"
-#include "nm-glib-compat.h"
#include "nm-setting-private.h"
#include "nm-core-enum-types.h"
*
* The #NMSettingIP6Config object is a #NMSetting subclass that describes
* properties related to IPv6 addressing, routing, and Domain Name Service
+ *
+ * #NMSettingIP6Config has few properties or methods of its own; it inherits
+ * almost everything from #NMSettingIPConfig.
+ *
+ * NetworkManager supports 6 values for the #NMSettingIPConfig:method property
+ * for IPv6. If "auto" is specified then the appropriate automatic method (PPP,
+ * router advertisement, etc) is used for the device and most other properties
+ * can be left unset. To force the use of DHCP only, specify "dhcp"; this
+ * method is only valid for Ethernet- based hardware. If "link-local" is
+ * specified, then an IPv6 link-local address will be assigned to the interface.
+ * If "manual" is specified, static IP addressing is used and at least one IP
+ * address must be given in the "addresses" property. If "ignore" is specified,
+ * IPv6 configuration is not done. Note: the "shared" method is not yet
+ * supported.
**/
-G_DEFINE_TYPE_WITH_CODE (NMSettingIP6Config, nm_setting_ip6_config, NM_TYPE_SETTING,
+G_DEFINE_TYPE_WITH_CODE (NMSettingIP6Config, nm_setting_ip6_config, NM_TYPE_SETTING_IP_CONFIG,
_nm_register_setting (IP6_CONFIG, 4))
NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_IP6_CONFIG)
#define NM_SETTING_IP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_IP6_CONFIG, NMSettingIP6ConfigPrivate))
typedef struct {
- char *method;
- char *dhcp_hostname;
- GSList *dns; /* array of struct in6_addr */
- GSList *dns_search; /* list of strings */
- GSList *addresses; /* array of NMIPAddress */
- GSList *routes; /* array of NMIPRoute */
- gboolean ignore_auto_routes;
- gboolean ignore_auto_dns;
- gboolean never_default;
- gboolean may_fail;
NMSettingIP6ConfigPrivacy ip6_privacy;
} NMSettingIP6ConfigPrivate;
enum {
PROP_0,
- PROP_METHOD,
- PROP_DHCP_HOSTNAME,
- PROP_DNS,
- PROP_DNS_SEARCH,
- PROP_ADDRESSES,
- PROP_ROUTES,
- PROP_IGNORE_AUTO_ROUTES,
- PROP_IGNORE_AUTO_DNS,
- PROP_NEVER_DEFAULT,
- PROP_MAY_FAIL,
PROP_IP6_PRIVACY,
LAST_PROP
return (NMSetting *) g_object_new (NM_TYPE_SETTING_IP6_CONFIG, NULL);
}
-/**
- * nm_setting_ip6_config_get_method:
- * @setting: the #NMSettingIP6Config
- *
- * Returns: the #NMSettingIP6Config:method property of the setting
- **/
-const char *
-nm_setting_ip6_config_get_method (NMSettingIP6Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL);
-
- return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->method;
-}
-
-/**
- * nm_setting_ip6_config_get_dhcp_hostname:
- * @setting: the #NMSettingIP6Config
- *
- * Returns the value contained in the #NMSettingIP6Config:dhcp-hostname
- * property.
- *
- * Returns: the configured hostname to send to the DHCP server
- **/
-const char *
-nm_setting_ip6_config_get_dhcp_hostname (NMSettingIP6Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL);
-
- return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dhcp_hostname;
-}
-
-/**
- * nm_setting_ip6_config_get_num_dns:
- * @setting: the #NMSettingIP6Config
- *
- * Returns: the number of configured DNS servers
- **/
-guint32
-nm_setting_ip6_config_get_num_dns (NMSettingIP6Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), 0);
-
- return g_slist_length (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns);
-}
-
-/**
- * nm_setting_ip6_config_get_dns:
- * @setting: the #NMSettingIP6Config
- * @i: index number of the DNS server to return
- *
- * Returns: (transfer none): the IPv6 address of the DNS server at index @i
- **/
-const char *
-nm_setting_ip6_config_get_dns (NMSettingIP6Config *setting, guint32 i)
-{
- NMSettingIP6ConfigPrivate *priv;
-
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL);
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < g_slist_length (priv->dns), NULL);
-
- return (const char *) g_slist_nth_data (priv->dns, i);
-}
-
-static const char *
-canonicalize_ip (const char *ip)
-{
- struct in6_addr addr;
- int ret;
-
- ret = inet_pton (AF_INET6, ip, &addr);
- g_return_val_if_fail (ret == 1, NULL);
- return nm_utils_inet6_ntop (&addr, NULL);
-}
-
-/**
- * nm_setting_ip6_config_add_dns:
- * @setting: the #NMSettingIP6Config
- * @dns: the IPv6 address of the DNS server to add
- *
- * Adds a new DNS server to the setting.
- *
- * Returns: %TRUE if the DNS server was added; %FALSE if the server was already
- * known
- **/
-gboolean
-nm_setting_ip6_config_add_dns (NMSettingIP6Config *setting, const char *dns)
-{
- NMSettingIP6ConfigPrivate *priv;
- const char *dns_canonical;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE);
- g_return_val_if_fail (dns != NULL, FALSE);
- g_return_val_if_fail (dns[0] != '\0', FALSE);
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
-
- dns_canonical = canonicalize_ip (dns);
- g_return_val_if_fail (dns_canonical != NULL, FALSE);
-
- for (iter = priv->dns; iter; iter = g_slist_next (iter)) {
- if (!strcmp (dns_canonical, (char *) iter->data))
- return FALSE;
- }
-
- priv->dns = g_slist_append (priv->dns, g_strdup (dns_canonical));
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS);
- return TRUE;
-}
-
-/**
- * nm_setting_ip6_config_remove_dns:
- * @setting: the #NMSettingIP6Config
- * @i: index number of the DNS server to remove
- *
- * Removes the DNS server at index @i.
- **/
-void
-nm_setting_ip6_config_remove_dns (NMSettingIP6Config *setting, guint32 i)
-{
- NMSettingIP6ConfigPrivate *priv;
- GSList *elt;
-
- g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- elt = g_slist_nth (priv->dns, i);
- g_return_if_fail (elt != NULL);
-
- g_free (elt->data);
- priv->dns = g_slist_delete_link (priv->dns, elt);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS);
-}
-
-/**
- * nm_setting_ip6_config_remove_dns_by_value:
- * @setting: the #NMSettingIP6Config
- * @dns: the IPv6 address of the DNS server to remove
- *
- * Removes the DNS server at index @i.
- *
- * Returns: %TRUE if the DNS server was found and removed; %FALSE if it was not.
- **/
-gboolean
-nm_setting_ip6_config_remove_dns_by_value (NMSettingIP6Config *setting,
- const char *dns)
-{
- NMSettingIP6ConfigPrivate *priv;
- const char *dns_canonical;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE);
- g_return_val_if_fail (dns != NULL, FALSE);
- g_return_val_if_fail (dns[0] != '\0', FALSE);
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
-
- dns_canonical = canonicalize_ip (dns);
- g_return_val_if_fail (dns_canonical != NULL, FALSE);
-
- for (iter = priv->dns; iter; iter = g_slist_next (iter)) {
- if (!strcmp (dns_canonical, (char *) iter->data)) {
- priv->dns = g_slist_delete_link (priv->dns, iter);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * nm_setting_ip6_config_clear_dns:
- * @setting: the #NMSettingIP6Config
- *
- * Removes all configured DNS servers.
- **/
-void
-nm_setting_ip6_config_clear_dns (NMSettingIP6Config *setting)
-{
- g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
-
- g_slist_free_full (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns, g_free);
- NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns = NULL;
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS);
-}
-
-/**
- * nm_setting_ip6_config_get_num_dns_searches:
- * @setting: the #NMSettingIP6Config
- *
- * Returns: the number of configured DNS search domains
- **/
-guint32
-nm_setting_ip6_config_get_num_dns_searches (NMSettingIP6Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), 0);
-
- return g_slist_length (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search);
-}
-
-/**
- * nm_setting_ip6_config_get_dns_search:
- * @setting: the #NMSettingIP6Config
- * @i: index number of the DNS search domain to return
- *
- * Returns: the DNS search domain at index @i
- **/
-const char *
-nm_setting_ip6_config_get_dns_search (NMSettingIP6Config *setting, guint32 i)
-{
- NMSettingIP6ConfigPrivate *priv;
-
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL);
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < g_slist_length (priv->dns_search), NULL);
-
- return (const char *) g_slist_nth_data (priv->dns_search, i);
-}
-
-/**
- * nm_setting_ip6_config_add_dns_search:
- * @setting: the #NMSettingIP6Config
- * @dns_search: the search domain to add
- *
- * Adds a new DNS search domain to the setting.
- *
- * Returns: %TRUE if the DNS search domain was added; %FALSE if the search
- * domain was already known
- **/
-gboolean
-nm_setting_ip6_config_add_dns_search (NMSettingIP6Config *setting,
- const char *dns_search)
-{
- NMSettingIP6ConfigPrivate *priv;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE);
- g_return_val_if_fail (dns_search != NULL, FALSE);
- g_return_val_if_fail (dns_search[0] != '\0', FALSE);
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- for (iter = priv->dns_search; iter; iter = g_slist_next (iter)) {
- if (!strcmp (dns_search, (char *) iter->data))
- return FALSE;
- }
-
- priv->dns_search = g_slist_append (priv->dns_search, g_strdup (dns_search));
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH);
- return TRUE;
-}
-
-/**
- * nm_setting_ip6_config_remove_dns_search:
- * @setting: the #NMSettingIP6Config
- * @i: index number of the DNS search domain
- *
- * Removes the DNS search domain at index @i.
- **/
-void
-nm_setting_ip6_config_remove_dns_search (NMSettingIP6Config *setting, guint32 i)
-{
- NMSettingIP6ConfigPrivate *priv;
- GSList *elt;
-
- g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- elt = g_slist_nth (priv->dns_search, i);
- g_return_if_fail (elt != NULL);
-
- g_free (elt->data);
- priv->dns_search = g_slist_delete_link (priv->dns_search, elt);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH);
-}
-
-/**
- * nm_setting_ip6_config_remove_dns_search_by_value:
- * @setting: the #NMSettingIP6Config
- * @dns_search: the search domain to remove
- *
- * Removes the DNS search domain @dns_search.
- *
- * Returns: %TRUE if the DNS search domain was found and removed; %FALSE if it was not.
- **/
-gboolean
-nm_setting_ip6_config_remove_dns_search_by_value (NMSettingIP6Config *setting,
- const char *dns_search)
-{
- NMSettingIP6ConfigPrivate *priv;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE);
- g_return_val_if_fail (dns_search != NULL, FALSE);
- g_return_val_if_fail (dns_search[0] != '\0', FALSE);
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- for (iter = priv->dns_search; iter; iter = g_slist_next (iter)) {
- if (!strcmp (dns_search, (char *) iter->data)) {
- priv->dns_search = g_slist_delete_link (priv->dns_search, iter);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * nm_setting_ip6_config_clear_dns_searches:
- * @setting: the #NMSettingIP6Config
- *
- * Removes all configured DNS search domains.
- **/
-void
-nm_setting_ip6_config_clear_dns_searches (NMSettingIP6Config *setting)
-{
- g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
-
- g_slist_free_full (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search, g_free);
- NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search = NULL;
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH);
-}
-
-/**
- * nm_setting_ip6_config_get_num_addresses:
- * @setting: the #NMSettingIP6Config
- *
- * Returns: the number of configured addresses
- **/
-guint32
-nm_setting_ip6_config_get_num_addresses (NMSettingIP6Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), 0);
-
- return g_slist_length (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->addresses);
-}
-
-/**
- * nm_setting_ip6_config_get_address:
- * @setting: the #NMSettingIP6Config
- * @i: index number of the address to return
- *
- * Returns: the address at index @i
- **/
-NMIPAddress *
-nm_setting_ip6_config_get_address (NMSettingIP6Config *setting, guint32 i)
-{
- NMSettingIP6ConfigPrivate *priv;
-
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL);
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < g_slist_length (priv->addresses), NULL);
-
- return (NMIPAddress *) g_slist_nth_data (priv->addresses, i);
-}
-
-/**
- * nm_setting_ip6_config_add_address:
- * @setting: the #NMSettingIP6Config
- * @address: the new address to add
- *
- * Adds a new IPv6 address and associated information to the setting. The
- * given address is duplicated internally and is not changed by this function.
- *
- * Returns: %TRUE if the address was added; %FALSE if the address was already
- * known.
- **/
-gboolean
-nm_setting_ip6_config_add_address (NMSettingIP6Config *setting,
- NMIPAddress *address)
-{
- NMSettingIP6ConfigPrivate *priv;
- NMIPAddress *copy;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE);
- g_return_val_if_fail (address != NULL, FALSE);
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- for (iter = priv->addresses; iter; iter = g_slist_next (iter)) {
- if (nm_ip_address_equal ((NMIPAddress *) iter->data, address))
- return FALSE;
- }
-
- copy = nm_ip_address_dup (address);
- priv->addresses = g_slist_append (priv->addresses, copy);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
- return TRUE;
-}
-
-/**
- * nm_setting_ip6_config_remove_address:
- * @setting: the #NMSettingIP6Config
- * @i: index number of the address to remove
- *
- * Removes the address at index @i.
- **/
-void
-nm_setting_ip6_config_remove_address (NMSettingIP6Config *setting, guint32 i)
-{
- NMSettingIP6ConfigPrivate *priv;
- GSList *elt;
-
- g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- elt = g_slist_nth (priv->addresses, i);
- g_return_if_fail (elt != NULL);
-
- nm_ip_address_unref ((NMIPAddress *) elt->data);
- priv->addresses = g_slist_delete_link (priv->addresses, elt);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
-}
-
-/**
- * nm_setting_ip6_config_remove_address_by_value:
- * @setting: the #NMSettingIP6Config
- * @address: the address to remove
- *
- * Removes the address @address.
- *
- * Returns: %TRUE if the address was found and removed; %FALSE if it was not.
- **/
-gboolean
-nm_setting_ip6_config_remove_address_by_value (NMSettingIP6Config *setting,
- NMIPAddress *address)
-{
- NMSettingIP6ConfigPrivate *priv;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE);
- g_return_val_if_fail (address != NULL, FALSE);
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- for (iter = priv->addresses; iter; iter = g_slist_next (iter)) {
- if (nm_ip_address_equal ((NMIPAddress *) iter->data, address)) {
- priv->addresses = g_slist_delete_link (priv->addresses, iter);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * nm_setting_ip6_config_clear_addresses:
- * @setting: the #NMSettingIP6Config
- *
- * Removes all configured addresses.
- **/
-void
-nm_setting_ip6_config_clear_addresses (NMSettingIP6Config *setting)
-{
- NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
-
- g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
-
- g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip_address_unref);
- priv->addresses = NULL;
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
-}
-
-/**
- * nm_setting_ip6_config_get_num_routes:
- * @setting: the #NMSettingIP6Config
- *
- * Returns: the number of configured routes
- **/
-guint32
-nm_setting_ip6_config_get_num_routes (NMSettingIP6Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), 0);
-
- return g_slist_length (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->routes);
-}
-
-/**
- * nm_setting_ip6_config_get_route:
- * @setting: the #NMSettingIP6Config
- * @i: index number of the route to return
- *
- * Returns: the route at index @i
- **/
-NMIPRoute *
-nm_setting_ip6_config_get_route (NMSettingIP6Config *setting, guint32 i)
-{
- NMSettingIP6ConfigPrivate *priv;
-
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL);
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < g_slist_length (priv->routes), NULL);
-
- return (NMIPRoute *) g_slist_nth_data (priv->routes, i);
-}
-
-/**
- * nm_setting_ip6_config_add_route:
- * @setting: the #NMSettingIP6Config
- * @route: the route to add
- *
- * Adds a new IPv6 route and associated information to the setting. The
- * given route is duplicated internally and is not changed by this function.
- *
- * Returns: %TRUE if the route was added; %FALSE if the route was already known.
- **/
-gboolean
-nm_setting_ip6_config_add_route (NMSettingIP6Config *setting,
- NMIPRoute *route)
-{
- NMSettingIP6ConfigPrivate *priv;
- NMIPRoute *copy;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE);
- g_return_val_if_fail (route != NULL, FALSE);
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- for (iter = priv->routes; iter; iter = g_slist_next (iter)) {
- if (nm_ip_route_equal ((NMIPRoute *) iter->data, route))
- return FALSE;
- }
-
- copy = nm_ip_route_dup (route);
- priv->routes = g_slist_append (priv->routes, copy);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
- return TRUE;
-}
-
-/**
- * nm_setting_ip6_config_remove_route:
- * @setting: the #NMSettingIP6Config
- * @i: index number of the route
- *
- * Removes the route at index @i.
- **/
-void
-nm_setting_ip6_config_remove_route (NMSettingIP6Config *setting, guint32 i)
-{
- NMSettingIP6ConfigPrivate *priv;
- GSList *elt;
-
- g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- elt = g_slist_nth (priv->routes, i);
- g_return_if_fail (elt != NULL);
-
- nm_ip_route_unref ((NMIPRoute *) elt->data);
- priv->routes = g_slist_delete_link (priv->routes, elt);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
-}
-
-/**
- * nm_setting_ip6_config_remove_route_by_value:
- * @setting: the #NMSettingIP6Config
- * @route: the route to remove
- *
- * Removes the route @route.
- *
- * Returns: %TRUE if the route was found and removed; %FALSE if it was not.
- **/
-gboolean
-nm_setting_ip6_config_remove_route_by_value (NMSettingIP6Config *setting,
- NMIPRoute *route)
-{
- NMSettingIP6ConfigPrivate *priv;
- GSList *iter;
-
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE);
- g_return_val_if_fail (route != NULL, FALSE);
-
- priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- for (iter = priv->routes; iter; iter = g_slist_next (iter)) {
- if (nm_ip_route_equal ((NMIPRoute *) iter->data, route)) {
- nm_ip_route_unref ((NMIPRoute *) iter->data);
- priv->routes = g_slist_delete_link (priv->routes, iter);
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * nm_setting_ip6_config_clear_routes:
- * @setting: the #NMSettingIP6Config
- *
- * Removes all configured routes.
- **/
-void
-nm_setting_ip6_config_clear_routes (NMSettingIP6Config *setting)
-{
- NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
-
- g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
-
- g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_route_unref);
- priv->routes = NULL;
- g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
-}
-
-/**
- * nm_setting_ip6_config_get_ignore_auto_routes:
- * @setting: the #NMSettingIP6Config
- *
- * Returns the value contained in the #NMSettingIP6Config:ignore-auto-routes
- * property.
- *
- * Returns: %TRUE if automatically configured (ie via DHCP) routes should be
- * ignored.
- **/
-gboolean
-nm_setting_ip6_config_get_ignore_auto_routes (NMSettingIP6Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE);
-
- return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->ignore_auto_routes;
-}
-
-/**
- * nm_setting_ip6_config_get_ignore_auto_dns:
- * @setting: the #NMSettingIP6Config
- *
- * Returns the value contained in the #NMSettingIP6Config:ignore-auto-dns
- * property.
- *
- * Returns: %TRUE if automatically configured (ie via DHCP or router
- * advertisements) DNS information should be ignored.
- **/
-gboolean
-nm_setting_ip6_config_get_ignore_auto_dns (NMSettingIP6Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE);
-
- return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->ignore_auto_dns;
-}
-
-/**
- * nm_setting_ip6_config_get_never_default:
- * @setting: the #NMSettingIP6Config
- *
- * Returns the value contained in the #NMSettingIP6Config:never-default
- * property.
- *
- * Returns: %TRUE if this connection should never be the default connection
- * for IPv6 addressing
- **/
-gboolean
-nm_setting_ip6_config_get_never_default (NMSettingIP6Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE);
-
- return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->never_default;
-}
-
-/**
- * nm_setting_ip6_config_get_may_fail:
- * @setting: the #NMSettingIP6Config
- *
- * Returns the value contained in the #NMSettingIP6Config:may-fail
- * property.
- *
- * Returns: %TRUE if this connection doesn't require IPv6 addressing to complete
- * for the connection to succeed.
- **/
-gboolean
-nm_setting_ip6_config_get_may_fail (NMSettingIP6Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE);
-
- return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->may_fail;
-}
-
/**
* nm_setting_ip6_config_get_ip6_privacy:
* @setting: the #NMSettingIP6Config
static gboolean
verify (NMSetting *setting, NMConnection *connection, GError **error)
{
- NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
- GSList *iter;
- int i;
+ NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting);
+ const char *method;
- if (!priv->method) {
- g_set_error_literal (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_MISSING_PROPERTY,
- _("property is missing"));
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_METHOD);
+ if (!NM_SETTING_CLASS (nm_setting_ip6_config_parent_class)->verify (setting, connection, error))
return FALSE;
- }
- if (!strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
- if (!priv->addresses) {
+ method = nm_setting_ip_config_get_method (s_ip);
+ /* Base class already checked that it exists */
+ g_assert (method);
+
+ if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
+ if (nm_setting_ip_config_get_num_addresses (s_ip) == 0) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_MISSING_PROPERTY,
_("this property cannot be empty for '%s=%s'"),
- NM_SETTING_IP6_CONFIG_METHOD, priv->method);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_METHOD, method);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES);
return FALSE;
}
- } else if ( !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)
- || !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)
- || !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) {
- if (priv->dns) {
+ } else if ( !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)
+ || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)
+ || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) {
+ if (nm_setting_ip_config_get_num_dns (s_ip) > 0) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("'%s' not allowed for %s=%s"),
_("this property is not allowed for '%s=%s'"),
- NM_SETTING_IP6_CONFIG_METHOD, priv->method);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_METHOD, method);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS);
return FALSE;
}
- if (priv->dns_search) {
+ if (nm_setting_ip_config_get_num_dns_searches (s_ip) > 0) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("this property is not allowed for '%s=%s'"),
- NM_SETTING_IP6_CONFIG_METHOD, priv->method);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_METHOD, method);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS_SEARCH);
return FALSE;
}
- if (priv->addresses) {
+ if (nm_setting_ip_config_get_num_addresses (s_ip) > 0) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("this property is not allowed for '%s=%s'"),
- NM_SETTING_IP6_CONFIG_METHOD, priv->method);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_METHOD, method);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES);
return FALSE;
}
- } else if ( !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_AUTO)
- || !strcmp (priv->method, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) {
+ } else if ( !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO)
+ || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) {
/* nothing to do */
} else {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("property is invalid"));
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_METHOD);
- return FALSE;
- }
-
- if (priv->dhcp_hostname && !strlen (priv->dhcp_hostname)) {
- g_set_error_literal (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("property is missing"));
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_METHOD);
return FALSE;
}
- for (iter = priv->dns, i = 0; iter; iter = g_slist_next (iter), i++) {
- const char *dns = (const char *) iter->data;
- struct in6_addr addr;
-
- if (inet_pton (AF_INET6, dns, &addr) != 1) {
- g_set_error (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("%d. DNS server address is invalid"),
- i+1);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DNS);
- return FALSE;
- }
- }
-
return TRUE;
}
{
}
-static void
-finalize (GObject *object)
-{
- NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (object);
-
- g_free (priv->method);
- g_free (priv->dhcp_hostname);
-
- g_slist_free_full (priv->dns, g_free);
- g_slist_free_full (priv->dns_search, g_free);
- g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip_address_unref);
- g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_route_unref);
-
- G_OBJECT_CLASS (nm_setting_ip6_config_parent_class)->finalize (object);
-}
-
static GVariant *
ip6_dns_to_dbus (const GValue *prop_value)
{
NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (object);
switch (prop_id) {
- case PROP_METHOD:
- g_free (priv->method);
- priv->method = g_value_dup_string (value);
- break;
- case PROP_DNS:
- g_slist_free_full (priv->dns, g_free);
- priv->dns = _nm_utils_strv_to_slist (g_value_get_boxed (value));
- break;
- case PROP_DNS_SEARCH:
- g_slist_free_full (priv->dns_search, g_free);
- priv->dns_search = _nm_utils_strv_to_slist (g_value_get_boxed (value));
- break;
- case PROP_ADDRESSES:
- g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_address_unref);
- priv->addresses = _nm_utils_copy_array_to_slist (g_value_get_boxed (value),
- (NMUtilsCopyFunc) nm_ip_address_dup);
- break;
- case PROP_ROUTES:
- g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip_route_unref);
- priv->routes = _nm_utils_copy_array_to_slist (g_value_get_boxed (value),
- (NMUtilsCopyFunc) nm_ip_route_dup);
- break;
- case PROP_IGNORE_AUTO_ROUTES:
- priv->ignore_auto_routes = g_value_get_boolean (value);
- break;
- case PROP_IGNORE_AUTO_DNS:
- priv->ignore_auto_dns = g_value_get_boolean (value);
- break;
- case PROP_DHCP_HOSTNAME:
- g_free (priv->dhcp_hostname);
- priv->dhcp_hostname = g_value_dup_string (value);
- break;
- case PROP_NEVER_DEFAULT:
- priv->never_default = g_value_get_boolean (value);
- break;
- case PROP_MAY_FAIL:
- priv->may_fail = g_value_get_boolean (value);
- break;
case PROP_IP6_PRIVACY:
priv->ip6_privacy = g_value_get_enum (value);
break;
NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (object);
switch (prop_id) {
- case PROP_METHOD:
- g_value_set_string (value, priv->method);
- break;
- case PROP_DNS:
- g_value_take_boxed (value, _nm_utils_slist_to_strv (priv->dns));
- break;
- case PROP_DNS_SEARCH:
- g_value_take_boxed (value, _nm_utils_slist_to_strv (priv->dns_search));
- break;
- case PROP_ADDRESSES:
- g_value_take_boxed (value, _nm_utils_copy_slist_to_array (priv->addresses, (NMUtilsCopyFunc) nm_ip_address_dup, (GDestroyNotify) nm_ip_address_unref));
- break;
- case PROP_ROUTES:
- g_value_take_boxed (value, _nm_utils_copy_slist_to_array (priv->routes, (NMUtilsCopyFunc) nm_ip_route_dup, (GDestroyNotify) nm_ip_route_unref));
- break;
- case PROP_IGNORE_AUTO_ROUTES:
- g_value_set_boolean (value, priv->ignore_auto_routes);
- break;
- case PROP_IGNORE_AUTO_DNS:
- g_value_set_boolean (value, priv->ignore_auto_dns);
- break;
- case PROP_DHCP_HOSTNAME:
- g_value_set_string (value, priv->dhcp_hostname);
- break;
- case PROP_NEVER_DEFAULT:
- g_value_set_boolean (value, priv->never_default);
- break;
- case PROP_MAY_FAIL:
- g_value_set_boolean (value, priv->may_fail);
- break;
case PROP_IP6_PRIVACY:
g_value_set_enum (value, priv->ip6_privacy);
break;
}
static void
-nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class)
+nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *ip6_class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
- NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
+ GObjectClass *object_class = G_OBJECT_CLASS (ip6_class);
+ NMSettingClass *setting_class = NM_SETTING_CLASS (ip6_class);
- g_type_class_add_private (setting_class, sizeof (NMSettingIP6ConfigPrivate));
+ g_type_class_add_private (ip6_class, sizeof (NMSettingIP6ConfigPrivate));
/* virtual methods */
object_class->set_property = set_property;
object_class->get_property = get_property;
- object_class->finalize = finalize;
- parent_class->verify = verify;
+ setting_class->verify = verify;
/* Properties */
- /**
- * NMSettingIP6Config:method:
- *
- * IPv6 configuration method. If "auto" is specified then the appropriate
- * automatic method (PPP, router advertisement, etc) is used for the device
- * and most other properties can be left unset. To force the use of DHCP
- * only, specify "dhcp"; this method is only valid for Ethernet- based
- * hardware. If "link-local" is specified, then an IPv6 link-local address
- * will be assigned to the interface. If "manual" is specified, static IP
- * addressing is used and at least one IP address must be given in the
- * "addresses" property. If "ignore" is specified, IPv6 configuration is
- * not done. This property must be set. Note: the "shared" method is not
- * yet supported.
- **/
- g_object_class_install_property
- (object_class, PROP_METHOD,
- g_param_spec_string (NM_SETTING_IP6_CONFIG_METHOD, "", "",
- NULL,
- G_PARAM_READWRITE |
- NM_SETTING_PARAM_INFERRABLE |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP6Config:dhcp-hostname:
- *
- * The specified name will be sent to the DHCP server when acquiring a
- * lease.
- **/
- g_object_class_install_property
- (object_class, PROP_DHCP_HOSTNAME,
- g_param_spec_string (NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, "", "",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP6Config:dns:
- *
- * Array of IPv6 addresses of DNS servers. For the "auto" method, these DNS
- * servers are appended to those (if any) returned by automatic
- * configuration. DNS servers cannot be used with the "shared" or
- * "link-local" methods as there is no usptream network. In all other
- * methods, these DNS servers are used as the only DNS servers for this
- * connection.
- **/
- g_object_class_install_property
- (object_class, PROP_DNS,
- g_param_spec_boxed (NM_SETTING_IP6_CONFIG_DNS, "", "",
- G_TYPE_STRV,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
- _nm_setting_class_transform_property (parent_class, NM_SETTING_IP6_CONFIG_DNS,
- G_VARIANT_TYPE ("aay"),
- ip6_dns_to_dbus,
- ip6_dns_from_dbus);
-
- /**
- * NMSettingIP6Config:dns-search:
- *
- * List of DNS search domains. For the "auto" method, these search domains
- * are appended to those returned by automatic configuration. Search domains
- * cannot be used with the "shared" or "link-local" methods as there is no
- * upstream network. In all other methods, these search domains are used as
- * the only search domains for this connection.
- **/
- g_object_class_install_property
- (object_class, PROP_DNS_SEARCH,
- g_param_spec_boxed (NM_SETTING_IP6_CONFIG_DNS_SEARCH, "", "",
- G_TYPE_STRV,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP6Config:addresses:
- *
- * Array of IPv6 addresses. For the 'auto' method, given IP addresses are
- * appended to those returned by automatic configuration. Addresses cannot
- * be used with the 'shared' or 'link-local' methods as the interface is
- * automatically assigned an address with these methods.
- *
- * Element-Type: NMIPAddress
- **/
- g_object_class_install_property
- (object_class, PROP_ADDRESSES,
- g_param_spec_boxed (NM_SETTING_IP6_CONFIG_ADDRESSES, "", "",
- G_TYPE_PTR_ARRAY,
- G_PARAM_READWRITE |
- NM_SETTING_PARAM_INFERRABLE |
- G_PARAM_STATIC_STRINGS));
- _nm_setting_class_transform_property (parent_class, NM_SETTING_IP6_CONFIG_ADDRESSES,
- G_VARIANT_TYPE ("a(ayuay)"),
- ip6_addresses_to_dbus,
- ip6_addresses_from_dbus);
-
- /**
- * NMSettingIP6Config:routes:
- *
- * Array of IPv6 routes. For the 'auto' method, given IP routes are appended
- * to those returned by automatic configuration. Routes cannot be used with
- * the 'shared' or 'link-local' methods because there is no upstream network.
- *
- * Element-Type: NMIPRoute
- **/
- g_object_class_install_property
- (object_class, PROP_ROUTES,
- g_param_spec_boxed (NM_SETTING_IP6_CONFIG_ROUTES, "", "",
- G_TYPE_PTR_ARRAY,
- G_PARAM_READWRITE |
- NM_SETTING_PARAM_INFERRABLE |
- G_PARAM_STATIC_STRINGS));
- _nm_setting_class_transform_property (parent_class, NM_SETTING_IP6_CONFIG_ROUTES,
- G_VARIANT_TYPE ("a(ayuayu)"),
- ip6_routes_to_dbus,
- ip6_routes_from_dbus);
-
- /**
- * NMSettingIP6Config:ignore-auto-routes:
- *
- * When the method is set to "auto" or "dhcp" and this property is set to
- * %TRUE, automatically configured routes are ignored and only routes
- * specified in the #NMSettingIP6Config:routes property, if any, are used.
- **/
- g_object_class_install_property
- (object_class, PROP_IGNORE_AUTO_ROUTES,
- g_param_spec_boolean (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, "", "",
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP6Config:ignore-auto-dns:
- *
- * When the method is set to "auto" or "dhcp" and this property is set to
- * %TRUE, automatically configured nameservers and search domains are
- * ignored and only nameservers and search domains specified in the
- * #NMSettingIP6Config:dns and #NMSettingIP6Config:dns-search properties, if
- * any, are used.
- **/
- g_object_class_install_property
- (object_class, PROP_IGNORE_AUTO_DNS,
- g_param_spec_boolean (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, "", "",
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP6Config:never-default:
- *
- * If %TRUE, this connection will never be the default IPv6 connection,
- * meaning it will never be assigned the default IPv6 route by
- * NetworkManager.
- **/
- g_object_class_install_property
- (object_class, PROP_NEVER_DEFAULT,
- g_param_spec_boolean (NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, "", "",
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- /**
- * NMSettingIP6Config:may-fail:
- *
- * If %TRUE, allow overall network configuration to proceed even if IPv6
- * configuration times out. Note that at least one IP configuration must
- * succeed or overall network configuration will still fail. For example,
- * in IPv4-only networks, setting this property to %TRUE allows the overall
- * network configuration to succeed if IPv6 configuration fails but IPv4
- * configuration completes successfully.
- **/
- g_object_class_install_property
- (object_class, PROP_MAY_FAIL,
- g_param_spec_boolean (NM_SETTING_IP6_CONFIG_MAY_FAIL, "", "",
- TRUE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
/**
* NMSettingIP6Config:ip6-privacy:
*
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
+
+ /* IP6-specific property overrides */
+ _nm_setting_class_transform_property (setting_class,
+ NM_SETTING_IP_CONFIG_DNS,
+ G_VARIANT_TYPE ("aay"),
+ ip6_dns_to_dbus,
+ ip6_dns_from_dbus);
+
+ _nm_setting_class_transform_property (setting_class,
+ NM_SETTING_IP_CONFIG_ADDRESSES,
+ G_VARIANT_TYPE ("a(ayuay)"),
+ ip6_addresses_to_dbus,
+ ip6_addresses_from_dbus);
+
+ _nm_setting_class_transform_property (setting_class,
+ NM_SETTING_IP_CONFIG_ROUTES,
+ G_VARIANT_TYPE ("a(ayuayu)"),
+ ip6_routes_to_dbus,
+ ip6_routes_from_dbus);
}
#error "Only <NetworkManager.h> can be included directly."
#endif
-#include <arpa/inet.h>
-
-#include "nm-setting.h"
#include "nm-setting-ip-config.h"
G_BEGIN_DECLS
#define NM_SETTING_IP6_CONFIG_SETTING_NAME "ipv6"
-#define NM_SETTING_IP6_CONFIG_METHOD "method"
-#define NM_SETTING_IP6_CONFIG_DNS "dns"
-#define NM_SETTING_IP6_CONFIG_DNS_SEARCH "dns-search"
-#define NM_SETTING_IP6_CONFIG_ADDRESSES "addresses"
-#define NM_SETTING_IP6_CONFIG_ROUTES "routes"
-#define NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
-#define NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns"
-#define NM_SETTING_IP6_CONFIG_NEVER_DEFAULT "never-default"
-#define NM_SETTING_IP6_CONFIG_MAY_FAIL "may-fail"
-#define NM_SETTING_IP6_CONFIG_IP6_PRIVACY "ip6-privacy"
-#define NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
-
+#define NM_SETTING_IP6_CONFIG_IP6_PRIVACY "ip6-privacy"
/**
* NM_SETTING_IP6_CONFIG_METHOD_IGNORE:
} NMSettingIP6ConfigPrivacy;
struct _NMSettingIP6Config {
- NMSetting parent;
+ NMSettingIPConfig parent;
};
typedef struct {
- NMSettingClass parent;
+ NMSettingIPConfigClass parent;
/*< private >*/
gpointer padding[4];
GType nm_setting_ip6_config_get_type (void);
-NMSetting * nm_setting_ip6_config_new (void);
-const char * nm_setting_ip6_config_get_method (NMSettingIP6Config *setting);
-
-guint32 nm_setting_ip6_config_get_num_dns (NMSettingIP6Config *setting);
-const char * nm_setting_ip6_config_get_dns (NMSettingIP6Config *setting, guint32 i);
-gboolean nm_setting_ip6_config_add_dns (NMSettingIP6Config *setting, const char *dns);
-void nm_setting_ip6_config_remove_dns (NMSettingIP6Config *setting, guint32 i);
-gboolean nm_setting_ip6_config_remove_dns_by_value (NMSettingIP6Config *setting, const char *dns);
-void nm_setting_ip6_config_clear_dns (NMSettingIP6Config *setting);
-
-guint32 nm_setting_ip6_config_get_num_dns_searches (NMSettingIP6Config *setting);
-const char * nm_setting_ip6_config_get_dns_search (NMSettingIP6Config *setting, guint32 i);
-gboolean nm_setting_ip6_config_add_dns_search (NMSettingIP6Config *setting, const char *dns_search);
-void nm_setting_ip6_config_remove_dns_search (NMSettingIP6Config *setting, guint32 i);
-gboolean nm_setting_ip6_config_remove_dns_search_by_value (NMSettingIP6Config *setting, const char *dns_search);
-void nm_setting_ip6_config_clear_dns_searches (NMSettingIP6Config *setting);
-
-guint32 nm_setting_ip6_config_get_num_addresses (NMSettingIP6Config *setting);
-NMIPAddress * nm_setting_ip6_config_get_address (NMSettingIP6Config *setting, guint32 i);
-gboolean nm_setting_ip6_config_add_address (NMSettingIP6Config *setting, NMIPAddress *address);
-void nm_setting_ip6_config_remove_address (NMSettingIP6Config *setting, guint32 i);
-gboolean nm_setting_ip6_config_remove_address_by_value (NMSettingIP6Config *setting, NMIPAddress *address);
-void nm_setting_ip6_config_clear_addresses (NMSettingIP6Config *setting);
-
-guint32 nm_setting_ip6_config_get_num_routes (NMSettingIP6Config *setting);
-NMIPRoute * nm_setting_ip6_config_get_route (NMSettingIP6Config *setting, guint32 i);
-gboolean nm_setting_ip6_config_add_route (NMSettingIP6Config *setting, NMIPRoute *route);
-void nm_setting_ip6_config_remove_route (NMSettingIP6Config *setting, guint32 i);
-gboolean nm_setting_ip6_config_remove_route_by_value (NMSettingIP6Config *setting, NMIPRoute *route);
-void nm_setting_ip6_config_clear_routes (NMSettingIP6Config *setting);
-gboolean nm_setting_ip6_config_get_ignore_auto_routes (NMSettingIP6Config *setting);
-
-gboolean nm_setting_ip6_config_get_ignore_auto_dns (NMSettingIP6Config *setting);
-const char * nm_setting_ip6_config_get_dhcp_hostname (NMSettingIP6Config *setting);
-gboolean nm_setting_ip6_config_get_never_default (NMSettingIP6Config *setting);
-gboolean nm_setting_ip6_config_get_may_fail (NMSettingIP6Config *setting);
+NMSetting *nm_setting_ip6_config_new (void);
+
NMSettingIP6ConfigPrivacy nm_setting_ip6_config_get_ip6_privacy (NMSettingIP6Config *setting);
G_END_DECLS
#include <string.h>
#include <stdlib.h>
#include <netinet/ether.h>
+#include <arpa/inet.h>
#include <uuid/uuid.h>
#include <gmodule.h>
static void
test_setting_ip4_config_labels (void)
{
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMIPAddress *addr;
GVariant *label;
GPtrArray *addrs;
GVariant *dict, *setting_dict, *value;
GError *error = NULL;
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_object_set (G_OBJECT (s_ip4),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
NULL);
/* addr 1 */
addr = nm_ip_address_new (AF_INET, "1.1.1.1", 24, NULL, &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (error);
- addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ addr = nm_setting_ip_config_get_address (s_ip4, 0);
label = nm_ip_address_get_attribute (addr, "label");
g_assert (label == NULL);
g_assert_no_error (error);
nm_ip_address_set_attribute (addr, "label", g_variant_new_string ("eth0:1"));
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (error);
- addr = nm_setting_ip4_config_get_address (s_ip4, 1);
+ addr = nm_setting_ip_config_get_address (s_ip4, 1);
label = nm_ip_address_get_attribute (addr, "label");
g_assert (label != NULL);
g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1");
g_assert_no_error (error);
nm_ip_address_set_attribute (addr, "label", NULL);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (error);
- addr = nm_setting_ip4_config_get_address (s_ip4, 2);
+ addr = nm_setting_ip_config_get_address (s_ip4, 2);
label = nm_ip_address_get_attribute (addr, "label");
g_assert (label == NULL);
/* Remove addr 1 and re-verify remaining addresses */
- nm_setting_ip4_config_remove_address (s_ip4, 0);
+ nm_setting_ip_config_remove_address (s_ip4, 0);
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (error);
- addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "2.2.2.2");
label = nm_ip_address_get_attribute (addr, "label");
g_assert (label != NULL);
g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1");
- addr = nm_setting_ip4_config_get_address (s_ip4, 1);
+ addr = nm_setting_ip_config_get_address (s_ip4, 1);
g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "3.3.3.3");
label = nm_ip_address_get_attribute (addr, "label");
g_assert (label == NULL);
s_ip4 = nm_connection_get_setting_ip4_config (conn);
- addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "2.2.2.2");
label = nm_ip_address_get_attribute (addr, "label");
g_assert (label != NULL);
g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1");
- addr = nm_setting_ip4_config_get_address (s_ip4, 1);
+ addr = nm_setting_ip_config_get_address (s_ip4, 1);
g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "3.3.3.3");
label = nm_ip_address_get_attribute (addr, "label");
g_assert (label == NULL);
/* Test explicit property assignment */
g_object_get (G_OBJECT (s_ip4),
- NM_SETTING_IP4_CONFIG_ADDRESSES, &addrs,
+ NM_SETTING_IP_CONFIG_ADDRESSES, &addrs,
NULL);
- nm_setting_ip4_config_clear_addresses (s_ip4);
- g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 0);
+ nm_setting_ip_config_clear_addresses (s_ip4);
+ g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 0);
g_object_set (G_OBJECT (s_ip4),
- NM_SETTING_IP4_CONFIG_ADDRESSES, addrs,
+ NM_SETTING_IP_CONFIG_ADDRESSES, addrs,
NULL);
g_ptr_array_unref (addrs);
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (error);
- g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 2);
+ g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 2);
- addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "2.2.2.2");
label = nm_ip_address_get_attribute (addr, "label");
g_assert (label != NULL);
g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1");
- addr = nm_setting_ip4_config_get_address (s_ip4, 1);
+ addr = nm_setting_ip_config_get_address (s_ip4, 1);
g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "3.3.3.3");
label = nm_ip_address_get_attribute (addr, "label");
g_assert (label == NULL);
setting = nm_setting_ip4_config_new ();
g_object_set (G_OBJECT (setting),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
- NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, "eyeofthetiger",
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, "eyeofthetiger",
NULL);
nm_connection_add_setting (connection, setting);
/* IP6 */
g_variant_builder_init (&setting_builder, NM_VARIANT_TYPE_SETTING);
g_variant_builder_add (&setting_builder, "{sv}",
- NM_SETTING_IP6_CONFIG_METHOD,
+ NM_SETTING_IP_CONFIG_METHOD,
g_variant_new_string (*out_expected_ip6_method));
g_variant_builder_add (&conn_builder, "{sa{sv}}",
NM_SETTING_IP6_CONFIG_SETTING_NAME,
GError *error = NULL;
gboolean success;
NMSettingConnection *s_con;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
char *uuid = NULL;
const char *expected_id = NULL, *expected_method = NULL;
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6);
- g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, expected_method);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, expected_method);
g_free (uuid);
g_variant_unref (new_settings);
GVariant *new_settings;
GError *error = NULL;
NMSettingConnection *s_con;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
char *uuid = NULL;
const char *expected_id = NULL, *expected_method = NULL;
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6);
- g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, expected_method);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, expected_method);
g_free (uuid);
g_variant_unref (new_settings);
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN },
} },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, {
- { NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A },
- { NM_SETTING_IP4_CONFIG_DNS, NM_SETTING_DIFF_RESULT_IN_A },
- { NM_SETTING_IP4_CONFIG_DNS_SEARCH, NM_SETTING_DIFF_RESULT_IN_A },
- { NM_SETTING_IP4_CONFIG_ADDRESSES, NM_SETTING_DIFF_RESULT_IN_A },
- { NM_SETTING_IP4_CONFIG_ROUTES, NM_SETTING_DIFF_RESULT_IN_A },
- { NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, NM_SETTING_DIFF_RESULT_IN_A },
- { NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_IP_CONFIG_DNS, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_IP_CONFIG_DNS_SEARCH, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_IP_CONFIG_ADDRESSES, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_IP_CONFIG_ROUTES, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, NM_SETTING_DIFF_RESULT_IN_A },
- { NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
- { NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
- { NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, NM_SETTING_DIFF_RESULT_IN_A },
- { NM_SETTING_IP4_CONFIG_MAY_FAIL, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_IP_CONFIG_NEVER_DEFAULT, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_IP_CONFIG_MAY_FAIL, NM_SETTING_DIFF_RESULT_IN_A },
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN },
} },
};
{
NMConnection *a, *b;
GHashTable *out_diffs = NULL;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
gboolean same;
const DiffSetting settings[] = {
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, {
- { NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A | NM_SETTING_DIFF_RESULT_IN_B },
+ { NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A | NM_SETTING_DIFF_RESULT_IN_B },
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN },
} },
};
s_ip4 = nm_connection_get_setting_ip4_config (a);
g_assert (s_ip4);
g_object_set (G_OBJECT (s_ip4),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
NULL);
same = nm_connection_diff (a, b, NM_SETTING_COMPARE_FLAG_EXACT, &out_diffs);
gboolean same;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *uuid;
const DiffSetting settings[] = {
{ NM_SETTING_CONNECTION_SETTING_NAME, {
s_ip4 = nm_connection_get_setting_ip4_config (a);
g_assert (s_ip4);
- g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TRUE, NULL);
+ g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, TRUE, NULL);
/* Make sure the diff returns no results as secrets are ignored */
same = nm_connection_diff (a, b, NM_SETTING_COMPARE_FLAG_INFERRABLE, &out_diffs);
g_free (uuid);
setting = nm_setting_ip4_config_new ();
- g_object_set (setting, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (setting, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
nm_connection_add_setting (connection, setting);
setting = nm_setting_ip6_config_new ();
- g_object_set (setting, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (setting, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
nm_connection_add_setting (connection, setting);
}
{
NMConnection *connection;
gboolean changed = FALSE;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMIPAddress *addr;
NMIPRoute *route;
GError *error = NULL;
(GCallback) test_connection_changed_cb,
&changed);
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- ASSERT_CHANGED (nm_setting_ip4_config_add_dns (s_ip4, "11.22.0.0"));
- ASSERT_CHANGED (nm_setting_ip4_config_remove_dns (s_ip4, 0));
+ ASSERT_CHANGED (nm_setting_ip_config_add_dns (s_ip4, "11.22.0.0"));
+ ASSERT_CHANGED (nm_setting_ip_config_remove_dns (s_ip4, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
- ASSERT_UNCHANGED (nm_setting_ip4_config_remove_dns (s_ip4, 1));
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns->len*");
+ ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns (s_ip4, 1));
g_test_assert_expected_messages ();
- nm_setting_ip4_config_add_dns (s_ip4, "33.44.0.0");
- ASSERT_CHANGED (nm_setting_ip4_config_clear_dns (s_ip4));
+ nm_setting_ip_config_add_dns (s_ip4, "33.44.0.0");
+ ASSERT_CHANGED (nm_setting_ip_config_clear_dns (s_ip4));
- ASSERT_CHANGED (nm_setting_ip4_config_add_dns_search (s_ip4, "foobar.com"));
- ASSERT_CHANGED (nm_setting_ip4_config_remove_dns_search (s_ip4, 0));
+ ASSERT_CHANGED (nm_setting_ip_config_add_dns_search (s_ip4, "foobar.com"));
+ ASSERT_CHANGED (nm_setting_ip_config_remove_dns_search (s_ip4, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
- ASSERT_UNCHANGED (nm_setting_ip4_config_remove_dns_search (s_ip4, 1));
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns_search->len*");
+ ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns_search (s_ip4, 1));
g_test_assert_expected_messages ();
- ASSERT_CHANGED (nm_setting_ip4_config_add_dns_search (s_ip4, "foobar.com"));
- ASSERT_CHANGED (nm_setting_ip4_config_clear_dns_searches (s_ip4));
+ ASSERT_CHANGED (nm_setting_ip_config_add_dns_search (s_ip4, "foobar.com"));
+ ASSERT_CHANGED (nm_setting_ip_config_clear_dns_searches (s_ip4));
addr = nm_ip_address_new (AF_INET, "22.33.0.0", 24, NULL, &error);
g_assert_no_error (error);
- ASSERT_CHANGED (nm_setting_ip4_config_add_address (s_ip4, addr));
- ASSERT_CHANGED (nm_setting_ip4_config_remove_address (s_ip4, 0));
+ ASSERT_CHANGED (nm_setting_ip_config_add_address (s_ip4, addr));
+ ASSERT_CHANGED (nm_setting_ip_config_remove_address (s_ip4, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*addr != NULL*");
- ASSERT_UNCHANGED (nm_setting_ip4_config_remove_address (s_ip4, 1));
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->addresses->len*");
+ ASSERT_UNCHANGED (nm_setting_ip_config_remove_address (s_ip4, 1));
g_test_assert_expected_messages ();
- nm_setting_ip4_config_add_address (s_ip4, addr);
- ASSERT_CHANGED (nm_setting_ip4_config_clear_addresses (s_ip4));
+ nm_setting_ip_config_add_address (s_ip4, addr);
+ ASSERT_CHANGED (nm_setting_ip_config_clear_addresses (s_ip4));
route = nm_ip_route_new (AF_INET, "22.33.0.0", 24, NULL, 0, &error);
g_assert_no_error (error);
- ASSERT_CHANGED (nm_setting_ip4_config_add_route (s_ip4, route));
- ASSERT_CHANGED (nm_setting_ip4_config_remove_route (s_ip4, 0));
+ ASSERT_CHANGED (nm_setting_ip_config_add_route (s_ip4, route));
+ ASSERT_CHANGED (nm_setting_ip_config_remove_route (s_ip4, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
- ASSERT_UNCHANGED (nm_setting_ip4_config_remove_route (s_ip4, 1));
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->routes->len*");
+ ASSERT_UNCHANGED (nm_setting_ip_config_remove_route (s_ip4, 1));
g_test_assert_expected_messages ();
- nm_setting_ip4_config_add_route (s_ip4, route);
- ASSERT_CHANGED (nm_setting_ip4_config_clear_routes (s_ip4));
+ nm_setting_ip_config_add_route (s_ip4, route);
+ ASSERT_CHANGED (nm_setting_ip_config_clear_routes (s_ip4));
nm_ip_address_unref (addr);
nm_ip_route_unref (route);
{
NMConnection *connection;
gboolean changed = FALSE;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
NMIPAddress *addr;
NMIPRoute *route;
GError *error = NULL;
(GCallback) test_connection_changed_cb,
&changed);
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
- ASSERT_CHANGED (nm_setting_ip6_config_add_dns (s_ip6, "1:2:3::4:5:6"));
- ASSERT_CHANGED (nm_setting_ip6_config_remove_dns (s_ip6, 0));
+ ASSERT_CHANGED (nm_setting_ip_config_add_dns (s_ip6, "1:2:3::4:5:6"));
+ ASSERT_CHANGED (nm_setting_ip_config_remove_dns (s_ip6, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
- ASSERT_UNCHANGED (nm_setting_ip6_config_remove_dns (s_ip6, 1));
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns->len*");
+ ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns (s_ip6, 1));
g_test_assert_expected_messages ();
- nm_setting_ip6_config_add_dns (s_ip6, "1:2:3::4:5:6");
- ASSERT_CHANGED (nm_setting_ip6_config_clear_dns (s_ip6));
+ nm_setting_ip_config_add_dns (s_ip6, "1:2:3::4:5:6");
+ ASSERT_CHANGED (nm_setting_ip_config_clear_dns (s_ip6));
- ASSERT_CHANGED (nm_setting_ip6_config_add_dns_search (s_ip6, "foobar.com"));
- ASSERT_CHANGED (nm_setting_ip6_config_remove_dns_search (s_ip6, 0));
+ ASSERT_CHANGED (nm_setting_ip_config_add_dns_search (s_ip6, "foobar.com"));
+ ASSERT_CHANGED (nm_setting_ip_config_remove_dns_search (s_ip6, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
- ASSERT_UNCHANGED (nm_setting_ip6_config_remove_dns_search (s_ip6, 1));
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns_search->len*");
+ ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns_search (s_ip6, 1));
g_test_assert_expected_messages ();
- nm_setting_ip6_config_add_dns_search (s_ip6, "foobar.com");
- ASSERT_CHANGED (nm_setting_ip6_config_clear_dns_searches (s_ip6));
+ nm_setting_ip_config_add_dns_search (s_ip6, "foobar.com");
+ ASSERT_CHANGED (nm_setting_ip_config_clear_dns_searches (s_ip6));
addr = nm_ip_address_new (AF_INET6, "1:2:3::4:5:6", 64, NULL, &error);
g_assert_no_error (error);
- ASSERT_CHANGED (nm_setting_ip6_config_add_address (s_ip6, addr));
- ASSERT_CHANGED (nm_setting_ip6_config_remove_address (s_ip6, 0));
+ ASSERT_CHANGED (nm_setting_ip_config_add_address (s_ip6, addr));
+ ASSERT_CHANGED (nm_setting_ip_config_remove_address (s_ip6, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
- ASSERT_UNCHANGED (nm_setting_ip6_config_remove_address (s_ip6, 1));
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->addresses->len*");
+ ASSERT_UNCHANGED (nm_setting_ip_config_remove_address (s_ip6, 1));
g_test_assert_expected_messages ();
- nm_setting_ip6_config_add_address (s_ip6, addr);
- ASSERT_CHANGED (nm_setting_ip6_config_clear_addresses (s_ip6));
+ nm_setting_ip_config_add_address (s_ip6, addr);
+ ASSERT_CHANGED (nm_setting_ip_config_clear_addresses (s_ip6));
route = nm_ip_route_new (AF_INET6, "1:2:3::4:5:6", 128, NULL, 0, &error);
g_assert_no_error (error);
- ASSERT_CHANGED (nm_setting_ip6_config_add_route (s_ip6, route));
- ASSERT_CHANGED (nm_setting_ip6_config_remove_route (s_ip6, 0));
+ ASSERT_CHANGED (nm_setting_ip_config_add_route (s_ip6, route));
+ ASSERT_CHANGED (nm_setting_ip_config_remove_route (s_ip6, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
- ASSERT_UNCHANGED (nm_setting_ip6_config_remove_route (s_ip6, 1));
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->routes->len*");
+ ASSERT_UNCHANGED (nm_setting_ip_config_remove_route (s_ip6, 1));
g_test_assert_expected_messages ();
- nm_setting_ip6_config_add_route (s_ip6, route);
- ASSERT_CHANGED (nm_setting_ip6_config_clear_routes (s_ip6));
+ nm_setting_ip_config_add_route (s_ip6, route);
+ ASSERT_CHANGED (nm_setting_ip_config_clear_routes (s_ip6));
nm_ip_address_unref (addr);
nm_ip_route_unref (route);
nm_connection_add_setting (con,
g_object_new (NM_TYPE_SETTING_IP4_CONFIG,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL));
nm_connection_add_setting (con,
g_object_new (NM_TYPE_SETTING_IP6_CONFIG,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL));
s_vlan = nm_connection_get_setting_vlan (con);
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
detail, "failed to verify connection: %s",
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
detail, "failed to verify connection: %s",
nm_setting_infiniband_get_type;
nm_setting_infiniband_get_virtual_interface_name;
nm_setting_infiniband_new;
- nm_setting_ip4_config_add_address;
- nm_setting_ip4_config_add_dns;
- nm_setting_ip4_config_add_dns_search;
- nm_setting_ip4_config_add_route;
- nm_setting_ip4_config_clear_addresses;
- nm_setting_ip4_config_clear_dns;
- nm_setting_ip4_config_clear_dns_searches;
- nm_setting_ip4_config_clear_routes;
- nm_setting_ip4_config_get_address;
nm_setting_ip4_config_get_dhcp_client_id;
- nm_setting_ip4_config_get_dhcp_hostname;
- nm_setting_ip4_config_get_dhcp_send_hostname;
- nm_setting_ip4_config_get_dns;
- nm_setting_ip4_config_get_dns_search;
- nm_setting_ip4_config_get_ignore_auto_dns;
- nm_setting_ip4_config_get_ignore_auto_routes;
- nm_setting_ip4_config_get_may_fail;
- nm_setting_ip4_config_get_method;
- nm_setting_ip4_config_get_never_default;
- nm_setting_ip4_config_get_num_addresses;
- nm_setting_ip4_config_get_num_dns;
- nm_setting_ip4_config_get_num_dns_searches;
- nm_setting_ip4_config_get_num_routes;
- nm_setting_ip4_config_get_route;
nm_setting_ip4_config_get_type;
nm_setting_ip4_config_new;
- nm_setting_ip4_config_remove_address;
- nm_setting_ip4_config_remove_address_by_value;
- nm_setting_ip4_config_remove_dns;
- nm_setting_ip4_config_remove_dns_by_value;
- nm_setting_ip4_config_remove_dns_search;
- nm_setting_ip4_config_remove_dns_search_by_value;
- nm_setting_ip4_config_remove_route;
- nm_setting_ip4_config_remove_route_by_value;
- nm_setting_ip6_config_add_address;
- nm_setting_ip6_config_add_dns;
- nm_setting_ip6_config_add_dns_search;
- nm_setting_ip6_config_add_route;
- nm_setting_ip6_config_clear_addresses;
- nm_setting_ip6_config_clear_dns;
- nm_setting_ip6_config_clear_dns_searches;
- nm_setting_ip6_config_clear_routes;
- nm_setting_ip6_config_get_address;
- nm_setting_ip6_config_get_dhcp_hostname;
- nm_setting_ip6_config_get_dns;
- nm_setting_ip6_config_get_dns_search;
- nm_setting_ip6_config_get_ignore_auto_dns;
- nm_setting_ip6_config_get_ignore_auto_routes;
nm_setting_ip6_config_get_ip6_privacy;
- nm_setting_ip6_config_get_may_fail;
- nm_setting_ip6_config_get_method;
- nm_setting_ip6_config_get_never_default;
- nm_setting_ip6_config_get_num_addresses;
- nm_setting_ip6_config_get_num_dns;
- nm_setting_ip6_config_get_num_dns_searches;
- nm_setting_ip6_config_get_num_routes;
- nm_setting_ip6_config_get_route;
nm_setting_ip6_config_get_type;
nm_setting_ip6_config_new;
nm_setting_ip6_config_privacy_get_type;
- nm_setting_ip6_config_remove_address;
- nm_setting_ip6_config_remove_address_by_value;
- nm_setting_ip6_config_remove_dns;
- nm_setting_ip6_config_remove_dns_by_value;
- nm_setting_ip6_config_remove_dns_search;
- nm_setting_ip6_config_remove_dns_search_by_value;
- nm_setting_ip6_config_remove_route;
- nm_setting_ip6_config_remove_route_by_value;
+ nm_setting_ip_config_add_address;
+ nm_setting_ip_config_add_dns;
+ nm_setting_ip_config_add_dns_search;
+ nm_setting_ip_config_add_route;
+ nm_setting_ip_config_clear_addresses;
+ nm_setting_ip_config_clear_dns;
+ nm_setting_ip_config_clear_dns_searches;
+ nm_setting_ip_config_clear_routes;
+ nm_setting_ip_config_get_address;
+ nm_setting_ip_config_get_dhcp_hostname;
+ nm_setting_ip_config_get_dhcp_send_hostname;
+ nm_setting_ip_config_get_dns;
+ nm_setting_ip_config_get_dns_search;
+ nm_setting_ip_config_get_ignore_auto_dns;
+ nm_setting_ip_config_get_ignore_auto_routes;
+ nm_setting_ip_config_get_may_fail;
+ nm_setting_ip_config_get_method;
+ nm_setting_ip_config_get_never_default;
+ nm_setting_ip_config_get_num_addresses;
+ nm_setting_ip_config_get_num_dns;
+ nm_setting_ip_config_get_num_dns_searches;
+ nm_setting_ip_config_get_num_routes;
+ nm_setting_ip_config_get_route;
+ nm_setting_ip_config_get_type;
+ nm_setting_ip_config_remove_address;
+ nm_setting_ip_config_remove_address_by_value;
+ nm_setting_ip_config_remove_dns;
+ nm_setting_ip_config_remove_dns_by_value;
+ nm_setting_ip_config_remove_dns_search;
+ nm_setting_ip_config_remove_dns_search_by_value;
+ nm_setting_ip_config_remove_route;
+ nm_setting_ip_config_remove_route_by_value;
nm_setting_lookup_type;
nm_setting_olpc_mesh_get_channel;
nm_setting_olpc_mesh_get_dhcp_anycast_address;
libnm-core/nm-setting-dcb.c
libnm-core/nm-setting-gsm.c
libnm-core/nm-setting-infiniband.c
+libnm-core/nm-setting-ip-config.c
libnm-core/nm-setting-ip4-config.c
libnm-core/nm-setting-ip6-config.c
libnm-core/nm-setting-olpc-mesh.c
GType ip_setting_type)
{
NMSettingConnection *s_con;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4, *s_ip6;
const char *method;
s_con = nm_connection_get_setting_connection (connection);
else {
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_return_val_if_fail (s_ip4 != NULL, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
- method = nm_setting_ip4_config_get_method (s_ip4);
+ method = nm_setting_ip_config_get_method (s_ip4);
g_return_val_if_fail (method != NULL, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
return method;
else {
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_return_val_if_fail (s_ip6 != NULL, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
- method = nm_setting_ip6_config_get_method (s_ip6);
+ method = nm_setting_ip_config_get_method (s_ip6);
g_return_val_if_fail (method != NULL, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
return method;
{
GHashTable *props;
const char *orig_ip6_method, *candidate_ip6_method;
- NMSettingIP6Config *candidate_ip6;
+ NMSettingIPConfig *candidate_ip6;
gboolean allow = FALSE;
props = check_property_in_hash (settings,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
if (!props)
return TRUE;
if ( strcmp (orig_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0
&& strcmp (candidate_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0
- && (!candidate_ip6 || nm_setting_ip6_config_get_may_fail (candidate_ip6))) {
+ && (!candidate_ip6 || nm_setting_ip_config_get_may_fail (candidate_ip6))) {
allow = TRUE;
}
if (allow) {
remove_from_hash (settings, props,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
}
return allow;
}
{
GHashTable *props;
const char *orig_ip4_method, *candidate_ip4_method;
- NMSettingIP4Config *candidate_ip4;
+ NMSettingIPConfig *candidate_ip4;
props = check_property_in_hash (settings,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
if (!props)
return TRUE;
if ( strcmp (orig_ip4_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0
&& strcmp (candidate_ip4_method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0
- && (!candidate_ip4 || nm_setting_ip4_config_get_may_fail (candidate_ip4))
+ && (!candidate_ip4 || nm_setting_ip_config_get_may_fail (candidate_ip4))
&& (device_has_carrier == FALSE)) {
remove_from_hash (settings, props,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
return TRUE;
}
return FALSE;
/* Setting: IPv4 */
setting = nm_setting_ip4_config_new ();
g_object_set (G_OBJECT (setting),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
- NM_SETTING_IP4_CONFIG_MAY_FAIL, FALSE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, FALSE,
NULL);
nm_connection_add_setting (connection, setting);
/* Setting: IPv6 */
setting = nm_setting_ip6_config_new ();
g_object_set (G_OBJECT (setting),
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
nm_connection_add_setting (connection, setting);
#include "config.h"
#include <string.h>
+#include <arpa/inet.h>
#include "nm-device-gre.h"
#include "nm-device-private.h"
nm_device_ip_config_should_fail (NMDevice *self, gboolean ip6)
{
NMConnection *connection;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4, *s_ip6;
g_return_val_if_fail (self != NULL, TRUE);
/* Fail the connection if the failed IP method is required to complete */
if (ip6) {
s_ip6 = nm_connection_get_setting_ip6_config (connection);
- if (!nm_setting_ip6_config_get_may_fail (s_ip6))
+ if (!nm_setting_ip_config_get_may_fail (s_ip6))
return TRUE;
} else {
s_ip4 = nm_connection_get_setting_ip4_config (connection);
- if (!nm_setting_ip4_config_get_may_fail (s_ip4))
+ if (!nm_setting_ip_config_get_may_fail (s_ip4))
return TRUE;
}
NMDeviceStateReason *reason)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
const guint8 *hw_addr;
size_t hw_addr_len = 0;
GByteArray *tmp = NULL;
tmp,
nm_connection_get_uuid (connection),
nm_device_get_priority (self),
- nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4),
- nm_setting_ip4_config_get_dhcp_hostname (s_ip4),
- nm_setting_ip4_config_get_dhcp_client_id (s_ip4),
+ nm_setting_ip_config_get_dhcp_send_hostname (s_ip4),
+ nm_setting_ip_config_get_dhcp_hostname (s_ip4),
+ nm_setting_ip4_config_get_dhcp_client_id (NM_SETTING_IP4_CONFIG (s_ip4)),
priv->dhcp_timeout,
priv->dhcp_anycast_address);
}
static gboolean
-reserve_shared_ip (NMDevice *self, NMSettingIP4Config *s_ip4, NMPlatformIP4Address *address)
+reserve_shared_ip (NMDevice *self, NMSettingIPConfig *s_ip4, NMPlatformIP4Address *address)
{
if (G_UNLIKELY (shared_ips == NULL))
shared_ips = g_hash_table_new (g_direct_hash, g_direct_equal);
memset (address, 0, sizeof (*address));
- if (s_ip4 && nm_setting_ip4_config_get_num_addresses (s_ip4)) {
+ if (s_ip4 && nm_setting_ip_config_get_num_addresses (s_ip4)) {
/* Use the first user-supplied address */
- NMIPAddress *user = nm_setting_ip4_config_get_address (s_ip4, 0);
+ NMIPAddress *user = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert (user);
nm_ip_address_get_address_binary (user, &address->address);
static gboolean
connection_requires_carrier (NMConnection *connection)
{
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4, *s_ip6;
gboolean ip4_carrier_wanted, ip6_carrier_wanted;
gboolean ip4_used = FALSE, ip6_used = FALSE;
* requires a carrier regardless of the IPv6 method.
*/
s_ip4 = nm_connection_get_setting_ip4_config (connection);
- if (s_ip4 && !nm_setting_ip4_config_get_may_fail (s_ip4))
+ if (s_ip4 && !nm_setting_ip_config_get_may_fail (s_ip4))
return TRUE;
}
* requires a carrier regardless of the IPv4 method.
*/
s_ip6 = nm_connection_get_setting_ip6_config (connection);
- if (s_ip6 && !nm_setting_ip6_config_get_may_fail (s_ip6))
+ if (s_ip6 && !nm_setting_ip_config_get_may_fail (s_ip6))
return TRUE;
}
guint32 dhcp_opt,
NMDeviceStateReason *reason)
{
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
GByteArray *tmp = NULL;
tmp,
nm_connection_get_uuid (connection),
nm_device_get_priority (self),
- nm_setting_ip6_config_get_dhcp_hostname (s_ip6),
+ nm_setting_ip_config_get_dhcp_hostname (s_ip6),
priv->dhcp_timeout,
priv->dhcp_anycast_address,
(dhcp_opt == NM_RDISC_DHCP_LEVEL_OTHERCONF) ? TRUE : FALSE,
- nm_setting_ip6_config_get_ip6_privacy (s_ip6));
+ nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6)));
if (tmp)
g_byte_array_free (tmp, TRUE);
self);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
- if (!nm_setting_ip6_config_get_may_fail (s_ip6) ||
- !strcmp (nm_setting_ip6_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_DHCP))
+ if (!nm_setting_ip_config_get_may_fail (s_ip6) ||
+ !strcmp (nm_setting_ip_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_DHCP))
nm_device_add_pending_action (self, PENDING_ACTION_DHCP6, TRUE);
/* DHCP devices will be notified by the DHCP manager when stuff happens */
priv->rdisc_use_tempaddr = use_tempaddr;
print_support_extended_ifa_flags (use_tempaddr);
- if (!nm_setting_ip6_config_get_may_fail (nm_connection_get_setting_ip6_config (connection)))
+ if (!nm_setting_ip_config_get_may_fail (nm_connection_get_setting_ip6_config (connection)))
nm_device_add_pending_action (self, PENDING_ACTION_AUTOCONF6, TRUE);
/* ensure link local is ready... */
*/
ip6_privacy = ip6_use_tempaddr ();
if (ip6_privacy == NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN) {
- NMSettingIP6Config *s_ip6 = nm_connection_get_setting_ip6_config (connection);
+ NMSettingIPConfig *s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (s_ip6)
- ip6_privacy = nm_setting_ip6_config_get_ip6_privacy (s_ip6);
+ ip6_privacy = nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6));
}
ip6_privacy = use_tempaddr_clamp (ip6_privacy);
const char *argv[] = { NULL, mode_arg, "-q", "-I", nm_device_get_ip_iface (self), "-c", "1", NULL, NULL };
int ip_arg = G_N_ELEMENTS (argv) - 2;
NMConnection *connection;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
int i, num;
NMIPAddress *addr;
GError *error = NULL;
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (!s_ip4)
return;
- num = nm_setting_ip4_config_get_num_addresses (s_ip4);
+ num = nm_setting_ip_config_get_num_addresses (s_ip4);
if (num == 0)
return;
for (i = 0; i < num; i++) {
gs_free char *tmp_str = NULL;
- addr = nm_setting_ip4_config_get_address (s_ip4, i);
+ addr = nm_setting_ip_config_get_address (s_ip4, i);
argv[ip_arg] = nm_ip_address_get_address (addr);
_LOGD (LOGD_DEVICE | LOGD_IP4,
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
NMConnection *connection;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
int num;
arp_cleanup (self);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (!s_ip4)
return;
- num = nm_setting_ip4_config_get_num_addresses (s_ip4);
+ num = nm_setting_ip_config_get_num_addresses (s_ip4);
if (num == 0)
return;
NMDeviceStateReason *reason)
{
NMConnection *connection;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
const char *method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
connection = nm_device_get_connection (device);
g_assert (connection);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
- method = nm_setting_ip4_config_get_method (s_ip4);
+ method = nm_setting_ip_config_get_method (s_ip4);
/* Indicate that a critical protocol is about to start */
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0)
NMDeviceStateReason *reason)
{
NMConnection *connection;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
const char *method = NM_SETTING_IP6_CONFIG_METHOD_AUTO;
connection = nm_device_get_connection (device);
g_assert (connection);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (s_ip6)
- method = nm_setting_ip6_config_get_method (s_ip6);
+ method = nm_setting_ip_config_get_method (s_ip6);
/* Indicate that a critical protocol is about to start */
if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0 ||
act_stage4_ip4_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
{
NMConnection *connection;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
gboolean may_fail = FALSE, chain_up = FALSE;
NMActStageReturn ret;
g_assert (connection);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
- may_fail = nm_setting_ip4_config_get_may_fail (s_ip4);
+ may_fail = nm_setting_ip_config_get_may_fail (s_ip4);
ret = handle_ip_config_timeout (NM_DEVICE_WIFI (device), connection, may_fail, &chain_up, reason);
if (chain_up)
act_stage4_ip6_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
{
NMConnection *connection;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
gboolean may_fail = FALSE, chain_up = FALSE;
NMActStageReturn ret;
g_assert (connection);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
- may_fail = nm_setting_ip6_config_get_may_fail (s_ip6);
+ may_fail = nm_setting_ip_config_get_may_fail (s_ip6);
ret = handle_ip_config_timeout (NM_DEVICE_WIFI (device), connection, may_fail, &chain_up, reason);
if (chain_up)
#include <glib/gi18n.h>
#include <string.h>
+#include <arpa/inet.h>
#include <libmm-glib.h>
#include "nm-modem-broadband.h"
GError **error)
{
NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4, *s_ip6;
const char *method;
gboolean ip4 = TRUE, ip6 = TRUE;
gboolean ip4_may_fail = TRUE, ip6_may_fail = TRUE;
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4) {
- method = nm_setting_ip4_config_get_method (s_ip4);
+ method = nm_setting_ip_config_get_method (s_ip4);
if (g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0)
ip4 = FALSE;
- ip4_may_fail = nm_setting_ip4_config_get_may_fail (s_ip4);
+ ip4_may_fail = nm_setting_ip_config_get_may_fail (s_ip4);
}
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (s_ip6) {
- method = nm_setting_ip6_config_get_method (s_ip6);
+ method = nm_setting_ip_config_get_method (s_ip6);
if (g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0)
ip6 = FALSE;
- ip6_may_fail = nm_setting_ip6_config_get_may_fail (s_ip6);
+ ip6_may_fail = nm_setting_ip_config_get_may_fail (s_ip6);
}
if (ip4 && !ip6) {
#include <glib/gi18n.h>
#include <string.h>
#include <ctype.h>
+#include <arpa/inet.h>
#include "nm-dhcp-dhclient-utils.h"
#include "nm-ip4-config.h"
#include <string.h>
#include <errno.h>
#include <unistd.h>
+#include <arpa/inet.h>
#include "nm-logging.h"
#include "nm-dhcp-utils.h"
#include <glib.h>
#include <string.h>
#include <unistd.h>
+#include <arpa/inet.h>
#include "nm-dhcp-dhclient-utils.h"
#include "nm-utils.h"
*/
#include <string.h>
+#include <arpa/inet.h>
#include "nm-ip4-config.h"
}
void
-nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, int default_route_metric)
+nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, int default_route_metric)
{
guint naddresses, nroutes, nnameservers, nsearches;
int i;
if (!setting)
return;
+ g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
+
g_object_freeze_notify (G_OBJECT (config));
- naddresses = nm_setting_ip4_config_get_num_addresses (setting);
- nroutes = nm_setting_ip4_config_get_num_routes (setting);
- nnameservers = nm_setting_ip4_config_get_num_dns (setting);
- nsearches = nm_setting_ip4_config_get_num_dns_searches (setting);
+ naddresses = nm_setting_ip_config_get_num_addresses (setting);
+ nroutes = nm_setting_ip_config_get_num_routes (setting);
+ nnameservers = nm_setting_ip_config_get_num_dns (setting);
+ nsearches = nm_setting_ip_config_get_num_dns_searches (setting);
/* Gateway */
- if (nm_setting_ip4_config_get_never_default (setting))
+ if (nm_setting_ip_config_get_never_default (setting))
nm_ip4_config_set_never_default (config, TRUE);
- else if (nm_setting_ip4_config_get_ignore_auto_routes (setting))
+ else if (nm_setting_ip_config_get_ignore_auto_routes (setting))
nm_ip4_config_set_never_default (config, FALSE);
for (i = 0; i < naddresses; i++) {
- const char *gateway_str = nm_ip_address_get_gateway (nm_setting_ip4_config_get_address (setting, i));
+ const char *gateway_str = nm_ip_address_get_gateway (nm_setting_ip_config_get_address (setting, i));
guint32 gateway;
if (gateway_str) {
/* Addresses */
for (i = 0; i < naddresses; i++) {
- NMIPAddress *s_addr = nm_setting_ip4_config_get_address (setting, i);
+ NMIPAddress *s_addr = nm_setting_ip_config_get_address (setting, i);
GVariant *label;
NMPlatformIP4Address address;
}
/* Routes */
- if (nm_setting_ip4_config_get_ignore_auto_routes (setting))
+ if (nm_setting_ip_config_get_ignore_auto_routes (setting))
nm_ip4_config_reset_routes (config);
for (i = 0; i < nroutes; i++) {
- NMIPRoute *s_route = nm_setting_ip4_config_get_route (setting, i);
+ NMIPRoute *s_route = nm_setting_ip_config_get_route (setting, i);
NMPlatformIP4Route route;
memset (&route, 0, sizeof (route));
}
/* DNS */
- if (nm_setting_ip4_config_get_ignore_auto_dns (setting)) {
+ if (nm_setting_ip_config_get_ignore_auto_dns (setting)) {
nm_ip4_config_reset_nameservers (config);
nm_ip4_config_reset_domains (config);
nm_ip4_config_reset_searches (config);
for (i = 0; i < nnameservers; i++) {
guint32 ip;
- if (inet_pton (AF_INET, nm_setting_ip4_config_get_dns (setting, i), &ip) == 1)
+ if (inet_pton (AF_INET, nm_setting_ip_config_get_dns (setting, i), &ip) == 1)
nm_ip4_config_add_nameserver (config, ip);
}
for (i = 0; i < nsearches; i++)
- nm_ip4_config_add_search (config, nm_setting_ip4_config_get_dns_search (setting, i));
+ nm_ip4_config_add_search (config, nm_setting_ip_config_get_dns_search (setting, i));
g_object_thaw_notify (G_OBJECT (config));
}
NMSetting *
nm_ip4_config_create_setting (const NMIP4Config *config)
{
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
guint32 gateway;
guint naddresses, nroutes, nnameservers, nsearches;
const char *method = NULL;
int i;
- s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
+ s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
if (!config) {
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
NULL);
return NM_SETTING (s_ip4);
}
if (*address->label)
nm_ip_address_set_attribute (s_addr, "label", g_variant_new_string (address->label));
- nm_setting_ip4_config_add_address (s_ip4, s_addr);
+ nm_setting_ip_config_add_address (s_ip4, s_addr);
nm_ip_address_unref (s_addr);
}
/* Use 'disabled' if the method wasn't previously set */
if (!method)
method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, method, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, method, NULL);
/* Routes */
for (i = 0; i < nroutes; i++) {
&route->network, route->plen,
&route->gateway, route->metric,
NULL);
- nm_setting_ip4_config_add_route (s_ip4, s_route);
+ nm_setting_ip_config_add_route (s_ip4, s_route);
nm_ip_route_unref (s_route);
}
for (i = 0; i < nnameservers; i++) {
guint32 nameserver = nm_ip4_config_get_nameserver (config, i);
- nm_setting_ip4_config_add_dns (s_ip4, nm_utils_inet4_ntop (nameserver, NULL));
+ nm_setting_ip_config_add_dns (s_ip4, nm_utils_inet4_ntop (nameserver, NULL));
}
for (i = 0; i < nsearches; i++) {
const char *search = nm_ip4_config_get_search (config, i);
- nm_setting_ip4_config_add_dns_search (s_ip4, search);
+ nm_setting_ip_config_add_dns_search (s_ip4, search);
}
return NM_SETTING (s_ip4);
/* Integration with nm-platform and nm-setting */
NMIP4Config *nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf);
gboolean nm_ip4_config_commit (const NMIP4Config *config, int ifindex);
-void nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, int default_route_metric);
+void nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, int default_route_metric);
NMSetting *nm_ip4_config_create_setting (const NMIP4Config *config);
/* Utility functions */
*/
#include <string.h>
+#include <arpa/inet.h>
#include "nm-ip6-config.h"
}
void
-nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, int default_route_metric)
+nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIPConfig *setting, int default_route_metric)
{
guint naddresses, nroutes, nnameservers, nsearches;
int i;
if (!setting)
return;
- naddresses = nm_setting_ip6_config_get_num_addresses (setting);
- nroutes = nm_setting_ip6_config_get_num_routes (setting);
- nnameservers = nm_setting_ip6_config_get_num_dns (setting);
- nsearches = nm_setting_ip6_config_get_num_dns_searches (setting);
+ g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
+
+ naddresses = nm_setting_ip_config_get_num_addresses (setting);
+ nroutes = nm_setting_ip_config_get_num_routes (setting);
+ nnameservers = nm_setting_ip_config_get_num_dns (setting);
+ nsearches = nm_setting_ip_config_get_num_dns_searches (setting);
g_object_freeze_notify (G_OBJECT (config));
/* Gateway */
- if (nm_setting_ip6_config_get_never_default (setting))
+ if (nm_setting_ip_config_get_never_default (setting))
nm_ip6_config_set_never_default (config, TRUE);
- else if (nm_setting_ip6_config_get_ignore_auto_routes (setting))
+ else if (nm_setting_ip_config_get_ignore_auto_routes (setting))
nm_ip6_config_set_never_default (config, FALSE);
for (i = 0; i < naddresses; i++) {
- const char *gateway_str = nm_ip_address_get_gateway (nm_setting_ip6_config_get_address (setting, i));
+ const char *gateway_str = nm_ip_address_get_gateway (nm_setting_ip_config_get_address (setting, i));
struct in6_addr gateway;
if (gateway_str) {
/* Addresses */
for (i = 0; i < naddresses; i++) {
- NMIPAddress *s_addr = nm_setting_ip6_config_get_address (setting, i);
+ NMIPAddress *s_addr = nm_setting_ip_config_get_address (setting, i);
NMPlatformIP6Address address;
memset (&address, 0, sizeof (address));
}
/* Routes */
- if (nm_setting_ip6_config_get_ignore_auto_routes (setting))
+ if (nm_setting_ip_config_get_ignore_auto_routes (setting))
nm_ip6_config_reset_routes (config);
for (i = 0; i < nroutes; i++) {
- NMIPRoute *s_route = nm_setting_ip6_config_get_route (setting, i);
+ NMIPRoute *s_route = nm_setting_ip_config_get_route (setting, i);
NMPlatformIP6Route route;
memset (&route, 0, sizeof (route));
}
/* DNS */
- if (nm_setting_ip6_config_get_ignore_auto_dns (setting)) {
+ if (nm_setting_ip_config_get_ignore_auto_dns (setting)) {
nm_ip6_config_reset_nameservers (config);
nm_ip6_config_reset_domains (config);
nm_ip6_config_reset_searches (config);
for (i = 0; i < nnameservers; i++) {
struct in6_addr ip;
- if (inet_pton (AF_INET6, nm_setting_ip6_config_get_dns (setting, i), &ip) == 1)
+ if (inet_pton (AF_INET6, nm_setting_ip_config_get_dns (setting, i), &ip) == 1)
nm_ip6_config_add_nameserver (config, &ip);
}
for (i = 0; i < nsearches; i++)
- nm_ip6_config_add_search (config, nm_setting_ip6_config_get_dns_search (setting, i));
+ nm_ip6_config_add_search (config, nm_setting_ip_config_get_dns_search (setting, i));
g_object_thaw_notify (G_OBJECT (config));
}
NMSetting *
nm_ip6_config_create_setting (const NMIP6Config *config)
{
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
const struct in6_addr *gateway;
guint naddresses, nroutes, nnameservers, nsearches;
const char *method = NULL;
int i;
- s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ());
+ s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
if (!config) {
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
NULL);
return NM_SETTING (s_ip6);
}
method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
s_addr = nm_ip_address_new_binary (AF_INET6, &address->address, address->plen, gateway, NULL);
- nm_setting_ip6_config_add_address (s_ip6, s_addr);
+ nm_setting_ip_config_add_address (s_ip6, s_addr);
nm_ip_address_unref (s_addr);
}
/* Use 'ignore' if the method wasn't previously set */
if (!method)
method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
- g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, method, NULL);
+ g_object_set (s_ip6, NM_SETTING_IP_CONFIG_METHOD, method, NULL);
/* Routes */
for (i = 0; i < nroutes; i++) {
&route->network, route->plen,
&route->gateway, route->metric,
NULL);
- nm_setting_ip6_config_add_route (s_ip6, s_route);
+ nm_setting_ip_config_add_route (s_ip6, s_route);
nm_ip_route_unref (s_route);
}
for (i = 0; i < nnameservers; i++) {
const struct in6_addr *nameserver = nm_ip6_config_get_nameserver (config, i);
- nm_setting_ip6_config_add_dns (s_ip6, nm_utils_inet6_ntop (nameserver, NULL));
+ nm_setting_ip_config_add_dns (s_ip6, nm_utils_inet6_ntop (nameserver, NULL));
}
for (i = 0; i < nsearches; i++) {
const char *search = nm_ip6_config_get_search (config, i);
- nm_setting_ip6_config_add_dns_search (s_ip6, search);
+ nm_setting_ip_config_add_dns_search (s_ip6, search);
}
return NM_SETTING (s_ip6);
#define __NETWORKMANAGER_IP6_CONFIG_H__
#include <glib-object.h>
+#include <netinet/in.h>
#include "nm-types.h"
#include "nm-setting-ip6-config.h"
/* Integration with nm-platform and nm-setting */
NMIP6Config *nm_ip6_config_capture (int ifindex, gboolean capture_resolv_conf, NMSettingIP6ConfigPrivacy use_temporary);
gboolean nm_ip6_config_commit (const NMIP6Config *config, int ifindex);
-void nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, int default_route_metric);
+void nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIPConfig *setting, int default_route_metric);
NMSetting *nm_ip6_config_create_setting (const NMIP6Config *config);
/* Utility functions */
NMDeviceState state = nm_device_get_state (dev);
NMActRequest *req;
NMConnection *connection;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
int prio;
const char *method = NULL;
/* 'never-default' devices can't ever be the default */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- if (nm_setting_ip4_config_get_never_default (s_ip4))
+ if (nm_setting_ip_config_get_never_default (s_ip4))
continue;
prio = nm_device_get_priority (dev);
NMDeviceState state = nm_device_get_state (dev);
NMActRequest *req;
NMConnection *connection;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
int prio;
const char *method = NULL;
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6);
- if (nm_setting_ip6_config_get_never_default (s_ip6))
+ if (nm_setting_ip_config_get_never_default (s_ip6))
continue;
prio = nm_device_get_priority (dev);
NMVpnConnection *candidate;
NMIP4Config *vpn_ip4;
NMConnection *tmp;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMVpnConnectionState vpn_state;
if (!NM_IS_VPN_CONNECTION (active))
/* Check the user's preference from the NMConnection */
s_ip4 = nm_connection_get_setting_ip4_config (tmp);
- if (nm_setting_ip4_config_get_never_default (s_ip4))
+ if (nm_setting_ip_config_get_never_default (s_ip4))
continue;
}
NMVpnConnection *candidate;
NMIP6Config *vpn_ip6;
NMConnection *tmp;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
NMVpnConnectionState vpn_state;
if (!NM_IS_VPN_CONNECTION (active))
/* Check the user's preference from the NMConnection */
s_ip6 = nm_connection_get_setting_ip6_config (tmp);
- if (nm_setting_ip6_config_get_never_default (s_ip6))
+ if (nm_setting_ip_config_get_never_default (s_ip6))
continue;
}
NMConnection *connection,
GError **error)
{
- NMSettingIP4Config *s_ip4 = NULL;
+ NMSettingIPConfig *s_ip4 = NULL;
NMIPAddress *addr;
const char *s_method = NULL;
const char *s_ipaddr = NULL;
goto error;
}
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
if (!g_ascii_strcasecmp (s_method, "dhcp")) {
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
goto success;
} else if (g_ascii_strcasecmp (s_method, "static") != 0) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
}
/* Static configuration stuff */
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
/* IP address */
if (!s_ipaddr || !nm_utils_ipaddr_valid (AF_INET, s_ipaddr)) {
goto error;
}
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
if (s_dns1)
- nm_setting_ip4_config_add_dns (s_ip4, s_dns1);
+ nm_setting_ip_config_add_dns (s_ip4, s_dns1);
if (s_dns2)
- nm_setting_ip4_config_add_dns (s_ip4, s_dns2);
+ nm_setting_ip_config_add_dns (s_ip4, s_dns2);
success:
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
GError *error = NULL;
const char *mac_address;
const char *expected_mac_address = "00:33:21:98:b9:f1";
/* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
g_object_unref (connection);
}
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
GError *error = NULL;
const char *mac_address;
const char *expected_mac_address = "00:33:21:98:b9:f0";
/* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
- g_assert_cmpint (nm_setting_ip4_config_get_num_dns (s_ip4), ==, 2);
- g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 0), ==, "10.16.255.2");
- g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 1), ==, "10.16.255.3");
+ g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 2);
+ g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 0), ==, "10.16.255.2");
+ g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 1), ==, "10.16.255.3");
- g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 1);
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert (ip4_addr);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.32.72");
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 22);
NMSettingConnection *s_con;
NMSettingWired *s_wired;
NMSettingVlan *s_vlan;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
const char *mac_address;
const char *expected_mac_address = "00:33:21:98:b9:f0";
NMIPAddress *ip4_addr;
/* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
- g_assert_cmpint (nm_setting_ip4_config_get_num_dns (s_ip4), ==, 0);
+ g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 0);
- g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 1);
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert (ip4_addr);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.6.200");
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24);
}
static gboolean
-read_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError **error)
+read_route_file_legacy (const char *filename, NMSettingIPConfig *s_ip4, GError **error)
{
char *contents = NULL;
gsize len = 0;
g_free (next_hop);
goto error;
}
- if (!nm_setting_ip4_config_add_route (s_ip4, route))
+ if (!nm_setting_ip_config_add_route (s_ip4, route))
PARSE_WARNING ("duplicate IP4 route");
}
#define IPV6_ADDR_REGEX "[0-9A-Fa-f:.]+"
static gboolean
-read_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **error)
+read_route6_file (const char *filename, NMSettingIPConfig *s_ip6, GError **error)
{
char *contents = NULL;
gsize len = 0;
g_free (next_hop);
if (!route)
goto error;
- if (!nm_setting_ip6_config_add_route (s_ip6, route))
+ if (!nm_setting_ip_config_add_route (s_ip6, route))
PARSE_WARNING ("duplicate IP6 route");
}
const char *network_file,
GError **error)
{
- NMSettingIP4Config *s_ip4 = NULL;
+ NMSettingIPConfig *s_ip4 = NULL;
char *value = NULL;
char *route_path = NULL;
char *method;
shvarFile *route_ifcfg;
gboolean never_default = FALSE;
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
/* First check if DEFROUTE is set for this device; DEFROUTE has the
* opposite meaning from never-default. The default if DEFROUTE is not
} else if (!g_ascii_strcasecmp (value, "autoip")) {
g_free (value);
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
- NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default,
NULL);
return NM_SETTING (s_ip4);
} else if (!g_ascii_strcasecmp (value, "shared")) {
g_free (value);
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_SHARED,
- NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_SHARED,
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default,
NULL);
return NM_SETTING (s_ip4);
} else {
g_free (value);
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, method,
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "PEERDNS", TRUE),
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "PEERROUTES", TRUE),
- NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default,
- NM_SETTING_IP4_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV4_FAILURE_FATAL", FALSE),
+ NM_SETTING_IP_CONFIG_METHOD, method,
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "PEERDNS", TRUE),
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "PEERROUTES", TRUE),
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV4_FAILURE_FATAL", FALSE),
NULL);
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0)
if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE);
if (value && strlen (value))
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, value, NULL);
g_free (value);
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME,
+ NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME,
svTrueValue (ifcfg, "DHCP_SEND_HOSTNAME", TRUE),
NULL);
continue;
}
- if (!nm_setting_ip4_config_add_address (s_ip4, addr))
+ if (!nm_setting_ip_config_add_address (s_ip4, addr))
PARSE_WARNING ("duplicate IP4 address");
nm_ip_address_unref (addr);
}
value = svGetValue (ifcfg, tag, FALSE);
if (value) {
if (nm_utils_ipaddr_valid (AF_INET, value)) {
- if (!nm_setting_ip4_config_add_dns (s_ip4, value))
+ if (!nm_setting_ip_config_add_dns (s_ip4, value))
PARSE_WARNING ("duplicate DNS server %s", tag);
} else if (nm_utils_ipaddr_valid (AF_INET6, value)) {
/* Ignore IPv6 addresses */
char **item;
for (item = searches; *item; item++) {
if (strlen (*item)) {
- if (!nm_setting_ip4_config_add_dns_search (s_ip4, *item))
+ if (!nm_setting_ip_config_add_dns_search (s_ip4, *item))
PARSE_WARNING ("duplicate DNS domain '%s'", *item);
}
}
if (!route)
break;
- if (!nm_setting_ip4_config_add_route (s_ip4, route))
+ if (!nm_setting_ip_config_add_route (s_ip4, route))
PARSE_WARNING ("duplicate IP4 route");
nm_ip_route_unref (route);
}
}
/* Legacy value NM used for a while but is incorrect (rh #459370) */
- if (!nm_setting_ip4_config_get_num_dns_searches (s_ip4)) {
+ if (!nm_setting_ip_config_get_num_dns_searches (s_ip4)) {
value = svGetValue (ifcfg, "SEARCH", FALSE);
if (value) {
char **searches = NULL;
char **item;
for (item = searches; *item; item++) {
if (strlen (*item)) {
- if (!nm_setting_ip4_config_add_dns_search (s_ip4, *item))
+ if (!nm_setting_ip_config_add_dns_search (s_ip4, *item))
PARSE_WARNING ("duplicate DNS search '%s'", *item);
}
}
}
static void
-read_aliases (NMSettingIP4Config *s_ip4, const char *filename, const char *network_file)
+read_aliases (NMSettingIPConfig *s_ip4, const char *filename, const char *network_file)
{
GDir *dir;
char *dirname, *base;
g_return_if_fail (s_ip4 != NULL);
g_return_if_fail (filename != NULL);
- if (nm_setting_ip4_config_get_num_addresses (s_ip4) == 0)
+ if (nm_setting_ip_config_get_num_addresses (s_ip4) == 0)
return;
- base_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ base_addr = nm_setting_ip_config_get_address (s_ip4, 0);
dirname = g_path_get_dirname (filename);
g_return_if_fail (dirname != NULL);
svCloseFile (parsed);
if (ok) {
nm_ip_address_set_attribute (addr, "label", g_variant_new_string (device));
- if (!nm_setting_ip4_config_add_address (s_ip4, addr))
+ if (!nm_setting_ip_config_add_address (s_ip4, addr))
PARSE_WARNING ("duplicate IP4 address in alias file %s", item);
} else {
PARSE_WARNING ("error reading IP4 address from alias file '%s': %s",
const char *network_file,
GError **error)
{
- NMSettingIP6Config *s_ip6 = NULL;
+ NMSettingIPConfig *s_ip6 = NULL;
char *value = NULL;
char *str_value;
char *route6_path = NULL;
char *ip6_privacy_str;
NMSettingIP6ConfigPrivacy ip6_privacy_val;
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
/* First check if IPV6_DEFROUTE is set for this device; IPV6_DEFROUTE has the
* opposite meaning from never-default. The default if IPV6_DEFROUTE is not
g_free (ip6_privacy_str);
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, method,
- NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "IPV6_PEERDNS", TRUE),
- NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "IPV6_PEERROUTES", TRUE),
- NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, never_default,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV6_FAILURE_FATAL", FALSE),
+ NM_SETTING_IP_CONFIG_METHOD, method,
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "IPV6_PEERDNS", TRUE),
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "IPV6_PEERROUTES", TRUE),
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV6_FAILURE_FATAL", FALSE),
NM_SETTING_IP6_CONFIG_IP6_PRIVACY, ip6_privacy_val,
NULL);
/* METHOD_AUTO may trigger DHCPv6, so save the hostname to send to DHCP */
value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE);
if (value && value[0])
- g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, value, NULL);
+ g_object_set (s_ip6, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, value, NULL);
g_free (value);
}
goto error;
}
- if (!nm_setting_ip6_config_add_address (s_ip6, addr))
+ if (!nm_setting_ip_config_add_address (s_ip6, addr))
PARSE_WARNING ("duplicate IP6 address");
nm_ip_address_unref (addr);
}
}
if (nm_utils_ipaddr_valid (AF_INET6, value)) {
- if (!nm_setting_ip6_config_add_dns (s_ip6, value))
+ if (!nm_setting_ip_config_add_dns (s_ip6, value))
PARSE_WARNING ("duplicate DNS server %s", tag);
} else if (nm_utils_ipaddr_valid (AF_INET, value)) {
/* Ignore IPv4 addresses */
g_free (value);
}
- /* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIP4Config */
+ /* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIPConfig */
/* Read static routes from route6-<interface> file */
route6_path = utils_get_route6_path (ifcfg->fileName);
/* If there is no IPv4 config or it doesn't contain DNS searches,
* read DOMAIN and put the domains into IPv6.
*/
- if (!s_ip4 || nm_setting_ip4_config_get_num_dns_searches (NM_SETTING_IP4_CONFIG (s_ip4)) == 0) {
+ if (!s_ip4 || nm_setting_ip_config_get_num_dns_searches (NM_SETTING_IP_CONFIG (s_ip4)) == 0) {
/* DNS searches */
char *value = svGetValue (ifcfg, "DOMAIN", FALSE);
if (value) {
char **item;
for (item = searches; *item; item++) {
if (strlen (*item)) {
- if (!nm_setting_ip6_config_add_dns_search (NM_SETTING_IP6_CONFIG (s_ip6), *item))
+ if (!nm_setting_ip_config_add_dns_search (NM_SETTING_IP_CONFIG (s_ip6), *item))
PARSE_WARNING ("duplicate DNS domain '%s'", *item);
}
}
connection = NULL;
goto done;
} else {
- read_aliases (NM_SETTING_IP4_CONFIG (s_ip4), filename, network_file);
+ read_aliases (NM_SETTING_IP_CONFIG (s_ip4), filename, network_file);
nm_connection_add_setting (connection, s_ip4);
}
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
GError *error = NULL;
const char *mac;
char expected_mac_address[ETH_ALEN] = { 0x00, 0x16, 0x41, 0x11, 0x22, 0x33 };
/* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED);
- g_assert (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED);
+ g_assert (nm_setting_ip_config_get_never_default (s_ip4) == FALSE);
/* ===== IPv6 SETTING ===== */
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6);
- g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE);
- g_assert (nm_setting_ip6_config_get_never_default (s_ip6) == FALSE);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE);
+ g_assert (nm_setting_ip_config_get_never_default (s_ip6) == FALSE);
g_object_unref (connection);
}
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
GError *error = NULL;
char *expected_mac_blacklist[3] = { "00:16:41:11:22:88", "00:16:41:11:22:99", "6a:5d:5a:fa:dd:f0" };
int mac_blacklist_num, i;
/* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED);
- g_assert (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED);
+ g_assert (nm_setting_ip_config_get_never_default (s_ip4) == FALSE);
g_object_unref (connection);
}
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
GError *error = NULL;
const char *mac;
char expected_mac_address[ETH_ALEN] = { 0x00, 0x16, 0x41, 0x11, 0x22, 0x33 };
/* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED);
- g_assert (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED);
+ g_assert (nm_setting_ip_config_get_never_default (s_ip4) == FALSE);
g_object_unref (connection);
}
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *unmanaged = NULL;
GError *error = NULL;
const char *mac;
/* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
- g_assert (nm_setting_ip4_config_get_may_fail (s_ip4));
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
+ g_assert (nm_setting_ip_config_get_may_fail (s_ip4));
/* DNS Addresses */
- g_assert_cmpint (nm_setting_ip4_config_get_num_dns (s_ip4), ==, 2);
- g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 0), ==, "4.2.2.1");
- g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 1), ==, "4.2.2.2");
+ g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 2);
+ g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 0), ==, "4.2.2.1");
+ g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 1), ==, "4.2.2.2");
/* IP addresses */
- g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 1);
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert (ip4_addr);
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.1.5");
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6);
if (expect_ip6) {
- g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_MANUAL);
- g_assert (nm_setting_ip6_config_get_may_fail (s_ip6));
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_MANUAL);
+ g_assert (nm_setting_ip_config_get_may_fail (s_ip6));
/* DNS Addresses */
- g_assert_cmpint (nm_setting_ip6_config_get_num_dns (s_ip6), ==, 2);
- g_assert_cmpstr (nm_setting_ip6_config_get_dns (s_ip6, 0), ==, "1:2:3:4::a");
- g_assert_cmpstr (nm_setting_ip6_config_get_dns (s_ip6, 1), ==, "1:2:3:4::b");
+ g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip6), ==, 2);
+ g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip6, 0), ==, "1:2:3:4::a");
+ g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip6, 1), ==, "1:2:3:4::b");
/* IP addresses */
- g_assert_cmpint (nm_setting_ip6_config_get_num_addresses (s_ip6), ==, 2);
+ g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip6), ==, 2);
- ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0);
+ ip6_addr = nm_setting_ip_config_get_address (s_ip6, 0);
g_assert (ip6_addr);
g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 64);
g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "dead:beaf::1");
- ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 1);
+ ip6_addr = nm_setting_ip_config_get_address (s_ip6, 1);
g_assert (ip6_addr);
g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 56);
g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "dead:beaf::2");
} else {
- g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE);
}
g_free (unmanaged);
guint32 expected_prefix = GPOINTER_TO_UINT (user_data);
NMConnection *connection;
NMSettingConnection *s_con;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
GError *error = NULL;
NMIPAddress *ip4_addr;
char *file, *expected_id;
/* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
- g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 1);
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert (ip4_addr);
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, expected_prefix);
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DHCP,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
- tmp = nm_setting_ip4_config_get_dhcp_hostname (s_ip4);
+ tmp = nm_setting_ip_config_get_dhcp_hostname (s_ip4);
ASSERT (tmp != NULL,
"wired-dhcp-verify-ip4", "failed to verify %s: missing %s / %s key",
TEST_IFCFG_WIRED_DHCP,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME);
+ NM_SETTING_IP_CONFIG_DHCP_HOSTNAME);
ASSERT (strcmp (tmp, expected_dhcp_hostname) == 0,
"wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DHCP,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME);
+ NM_SETTING_IP_CONFIG_DHCP_HOSTNAME);
- ASSERT (nm_setting_ip4_config_get_ignore_auto_dns (s_ip4) == TRUE,
+ ASSERT (nm_setting_ip_config_get_ignore_auto_dns (s_ip4) == TRUE,
"wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DHCP,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS);
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS);
/* DNS Addresses */
- ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2,
+ ASSERT (nm_setting_ip_config_get_num_dns (s_ip4) == 2,
"wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DHCP,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 0), "4.2.2.1") == 0,
+ ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 0), "4.2.2.1") == 0,
"wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value #1",
TEST_IFCFG_WIRED_DHCP,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 1), "4.2.2.2") == 0,
+ ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 1), "4.2.2.2") == 0,
"wired-dhcp-verify-ip4", "failed to verify %s: unexpected %s / %s key value #2",
TEST_IFCFG_WIRED_DHCP,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
g_free (unmanaged);
g_free (keyfile);
test_read_wired_dhcp_plus_ip (void)
{
NMConnection *connection;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
GError *error = NULL;
NMIPAddress *ip4_addr;
NMIPAddress *ip6_addr;
/* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
- g_assert (nm_setting_ip4_config_get_may_fail (s_ip4));
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
+ g_assert (nm_setting_ip_config_get_may_fail (s_ip4));
/* DNS Addresses */
- g_assert_cmpint (nm_setting_ip4_config_get_num_dns (s_ip4), ==, 2);
- g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 0), ==, "4.2.2.1");
- g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 1), ==, "4.2.2.2");
+ g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 2);
+ g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 0), ==, "4.2.2.1");
+ g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 1), ==, "4.2.2.2");
/* IP addresses */
- g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 2);
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 2);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert (ip4_addr);
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "1.2.3.4");
g_assert_cmpstr (nm_ip_address_get_gateway (ip4_addr), ==, "1.1.1.1");
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 1);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 1);
g_assert (ip4_addr);
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 16);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "9.8.7.6");
/* ===== IPv6 SETTING ===== */
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6);
- g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
- g_assert (nm_setting_ip6_config_get_may_fail (s_ip6));
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
+ g_assert (nm_setting_ip_config_get_may_fail (s_ip6));
/* DNS Addresses */
- g_assert_cmpint (nm_setting_ip6_config_get_num_dns (s_ip6), ==, 2);
- g_assert_cmpstr (nm_setting_ip6_config_get_dns (s_ip6, 0), ==, "1:2:3:4::a");
- g_assert_cmpstr (nm_setting_ip6_config_get_dns (s_ip6, 1), ==, "1:2:3:4::b");
+ g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip6), ==, 2);
+ g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip6, 0), ==, "1:2:3:4::a");
+ g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip6, 1), ==, "1:2:3:4::b");
/* IP addresses */
- g_assert_cmpint (nm_setting_ip6_config_get_num_addresses (s_ip6), ==, 3);
- ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0);
+ g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip6), ==, 3);
+ ip6_addr = nm_setting_ip_config_get_address (s_ip6, 0);
g_assert (ip6_addr);
g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 56);
g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "1001:abba::1234");
- ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 1);
+ ip6_addr = nm_setting_ip_config_get_address (s_ip6, 1);
g_assert (ip6_addr);
g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 64);
g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "2001:abba::2234");
- ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 2);
+ ip6_addr = nm_setting_ip_config_get_address (s_ip6, 2);
g_assert (ip6_addr);
g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 96);
g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "3001:abba::3234");
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
GError *error = NULL;
NMIPAddress *ip4_addr;
char *unmanaged = NULL;
/* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
/* Address #1 */
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert (ip4_addr);
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.1.5");
test_read_wired_never_default (void)
{
NMConnection *connection;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
GError *error = NULL;
connection = connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-never-default",
/* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
- g_assert (nm_setting_ip4_config_get_never_default (s_ip4));
- g_assert_cmpint (nm_setting_ip4_config_get_num_dns (s_ip4), ==, 0);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
+ g_assert (nm_setting_ip_config_get_never_default (s_ip4));
+ g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 0);
/* ===== IPv6 SETTING ===== */
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6);
- g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
- g_assert (nm_setting_ip6_config_get_never_default (s_ip6));
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
+ g_assert (nm_setting_ip_config_get_never_default (s_ip6));
g_object_unref (connection);
}
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wired-defroute-no-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DEFROUTE_NO,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
- ASSERT (nm_setting_ip4_config_get_never_default (s_ip4) == TRUE,
+ ASSERT (nm_setting_ip_config_get_never_default (s_ip4) == TRUE,
"wired-defroute-no-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DEFROUTE_NO,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_NEVER_DEFAULT);
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT);
/* ===== IPv6 SETTING ===== */
NM_SETTING_IP6_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip6_config_get_method (s_ip6);
+ tmp = nm_setting_ip_config_get_method (s_ip6);
ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0,
"wired-defroute-no-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DEFROUTE_NO,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
- ASSERT (nm_setting_ip6_config_get_never_default (s_ip6) == TRUE,
+ ASSERT (nm_setting_ip_config_get_never_default (s_ip6) == TRUE,
"wired-defroute-no-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DEFROUTE_NO,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_NEVER_DEFAULT);
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT);
g_free (unmanaged);
g_free (keyfile);
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
- ASSERT (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE,
+ ASSERT (nm_setting_ip_config_get_never_default (s_ip4) == FALSE,
"wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_NEVER_DEFAULT);
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT);
/* ===== IPv6 SETTING ===== */
NM_SETTING_IP6_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip6_config_get_method (s_ip6);
- ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
- "wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
+ tmp = nm_setting_ip_config_get_method (s_ip6);
+ ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0,
+ "wired-defroute-no-gatewaydev-yes-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
- ASSERT (nm_setting_ip6_config_get_never_default (s_ip6) == FALSE,
- "wired-defroute-no-gatewaydev-yes-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
+ ASSERT (nm_setting_ip_config_get_never_default (s_ip6) == FALSE,
+ "wired-defroute-no-gatewaydev-yes-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DEFROUTE_NO_GATEWAYDEV_YES,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_NEVER_DEFAULT);
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT);
g_free (unmanaged);
g_free (keyfile);
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
GError *error = NULL;
NMIPRoute *ip4_route;
/* ===== IPv4 SETTING ===== */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
/* Routes */
- g_assert_cmpint (nm_setting_ip4_config_get_num_routes (s_ip4), ==, 2);
+ g_assert_cmpint (nm_setting_ip_config_get_num_routes (s_ip4), ==, 2);
- ip4_route = nm_setting_ip4_config_get_route (s_ip4, 0);
+ ip4_route = nm_setting_ip_config_get_route (s_ip4, 0);
g_assert (ip4_route);
g_assert_cmpstr (nm_ip_route_get_dest (ip4_route), ==, "11.22.33.0");
g_assert_cmpint (nm_ip_route_get_prefix (ip4_route), ==, 24);
g_assert_cmpstr (nm_ip_route_get_next_hop (ip4_route), ==, "192.168.1.5");
g_assert_cmpint (nm_ip_route_get_metric (ip4_route), ==, 0);
- ip4_route = nm_setting_ip4_config_get_route (s_ip4, 1);
+ ip4_route = nm_setting_ip_config_get_route (s_ip4, 1);
g_assert (ip4_route);
g_assert_cmpstr (nm_ip_route_get_dest (ip4_route), ==, "44.55.66.77");
g_assert_cmpint (nm_ip_route_get_prefix (ip4_route), ==, 32);
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0,
"wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* Routes */
- ASSERT (nm_setting_ip4_config_get_num_routes (s_ip4) == 3,
+ ASSERT (nm_setting_ip_config_get_num_routes (s_ip4) == 3,
"wired-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_STATIC_ROUTES_LEGACY,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_ROUTES);
+ NM_SETTING_IP_CONFIG_ROUTES);
/* Route #1 */
- ip4_route = nm_setting_ip4_config_get_route (s_ip4, 0);
+ ip4_route = nm_setting_ip_config_get_route (s_ip4, 0);
g_assert (ip4_route != NULL);
g_assert_cmpstr (nm_ip_route_get_dest (ip4_route), ==, "21.31.41.0");
g_assert_cmpint (nm_ip_route_get_prefix (ip4_route), ==, 24);
g_assert_cmpint (nm_ip_route_get_metric (ip4_route), ==, 1);
/* Route #2 */
- ip4_route = nm_setting_ip4_config_get_route (s_ip4, 1);
+ ip4_route = nm_setting_ip_config_get_route (s_ip4, 1);
g_assert (ip4_route != NULL);
g_assert_cmpstr (nm_ip_route_get_dest (ip4_route), ==, "32.42.52.62");
g_assert_cmpint (nm_ip_route_get_prefix (ip4_route), ==, 32);
g_assert_cmpint (nm_ip_route_get_metric (ip4_route), ==, 0);
/* Route #3 */
- ip4_route = nm_setting_ip4_config_get_route (s_ip4, 2);
+ ip4_route = nm_setting_ip_config_get_route (s_ip4, 2);
g_assert (ip4_route != NULL);
g_assert_cmpstr (nm_ip_route_get_dest (ip4_route), ==, "43.53.0.0");
g_assert_cmpint (nm_ip_route_get_prefix (ip4_route), ==, 16);
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0,
"wired-ipv4-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* IP addresses */
- ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 3,
+ ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 3,
"wired-ipv4-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_ADDRESSES);
/* Address #1 */
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert (ip4_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "1.2.3.4");
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24);
/* Address #2 */
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 1);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 1);
g_assert (ip4_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "9.8.7.6");
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 16);
/* Address #3 */
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 2);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 2);
g_assert (ip4_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "3.3.3.3");
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 8);
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* DNS Addresses */
- ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2,
+ ASSERT (nm_setting_ip_config_get_num_dns (s_ip4) == 2,
"wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
/* DNS search domains */
- ASSERT (nm_setting_ip4_config_get_num_dns_searches (s_ip4) == 3,
+ ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip4) == 3,
"wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 0);
+ tmp = nm_setting_ip_config_get_dns_search (s_ip4, 0);
ASSERT (tmp != NULL,
"wired-ipv6-manual-verify-ip4", "failed to verify %s: missing %s / %s key",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
ASSERT (strcmp (tmp, "lorem.com") == 0,
"wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
- tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 1);
+ tmp = nm_setting_ip_config_get_dns_search (s_ip4, 1);
ASSERT (tmp != NULL,
"wired-ipv6-manual-verify-ip4", "failed to verify %s: missing %s / %s key",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
ASSERT (strcmp (tmp, "ipsum.org") == 0,
"wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
- tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 2);
+ tmp = nm_setting_ip_config_get_dns_search (s_ip4, 2);
ASSERT (tmp != NULL,
"wired-ipv6-manual-verify-ip4", "failed to verify %s: missing %s / %s key",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
ASSERT (strcmp (tmp, "dolor.edu") == 0,
"wired-ipv6-manual-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
/* ===== IPv6 SETTING ===== */
NM_SETTING_IP6_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip6_config_get_method (s_ip6);
+ tmp = nm_setting_ip_config_get_method (s_ip6);
ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0,
"wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
- ASSERT (nm_setting_ip6_config_get_never_default (s_ip6) == FALSE,
+ ASSERT (nm_setting_ip_config_get_never_default (s_ip6) == FALSE,
"wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_NEVER_DEFAULT);
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT);
- ASSERT (nm_setting_ip6_config_get_may_fail (s_ip6) == TRUE,
+ ASSERT (nm_setting_ip_config_get_may_fail (s_ip6) == TRUE,
"wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_MAY_FAIL);
+ NM_SETTING_IP_CONFIG_MAY_FAIL);
/* IP addresses */
- ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 3,
+ ASSERT (nm_setting_ip_config_get_num_addresses (s_ip6) == 3,
"wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_ADDRESSES);
/* Address #1 */
- ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0);
+ ip6_addr = nm_setting_ip_config_get_address (s_ip6, 0);
g_assert (ip6_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "1001:abba::1234");
g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 56);
/* Address #2 */
- ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 1);
+ ip6_addr = nm_setting_ip_config_get_address (s_ip6, 1);
g_assert (ip6_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "2001:abba::2234");
g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 64);
/* Address #3 */
- ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 2);
+ ip6_addr = nm_setting_ip_config_get_address (s_ip6, 2);
g_assert (ip6_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "3001:abba::3234");
g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 96);
/* Routes */
- g_assert_cmpint (nm_setting_ip6_config_get_num_routes (s_ip6), ==, 2);
+ g_assert_cmpint (nm_setting_ip_config_get_num_routes (s_ip6), ==, 2);
/* Route #1 */
- ip6_route = nm_setting_ip6_config_get_route (s_ip6, 0);
+ ip6_route = nm_setting_ip_config_get_route (s_ip6, 0);
g_assert (ip6_route);
g_assert_cmpstr (nm_ip_route_get_dest (ip6_route), ==, "9876::1234");
g_assert_cmpint (nm_ip_route_get_prefix (ip6_route), ==, 96);
g_assert_cmpstr (nm_ip_route_get_next_hop (ip6_route), ==, "9876::7777");
g_assert_cmpint (nm_ip_route_get_metric (ip6_route), ==, 2);
/* Route #2 */
- ip6_route = nm_setting_ip6_config_get_route (s_ip6, 1);
+ ip6_route = nm_setting_ip_config_get_route (s_ip6, 1);
g_assert (ip6_route);
g_assert_cmpstr (nm_ip_route_get_dest (ip6_route), ==, "abbe::cafe");
g_assert_cmpint (nm_ip_route_get_prefix (ip6_route), ==, 64);
g_assert_cmpint (nm_ip_route_get_metric (ip6_route), ==, 777);
/* DNS Addresses */
- ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 2,
+ ASSERT (nm_setting_ip_config_get_num_dns (s_ip6) == 2,
"wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (strcmp (nm_setting_ip6_config_get_dns (s_ip6, 0), "1:2:3:4::a") == 0,
+ ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip6, 0), "1:2:3:4::a") == 0,
"wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value #1",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (strcmp (nm_setting_ip6_config_get_dns (s_ip6, 1), "1:2:3:4::b") == 0,
+ ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip6, 1), "1:2:3:4::b") == 0,
"wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value #2",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
/* DNS domains - none as domains are stuffed to 'ipv4' setting */
- ASSERT (nm_setting_ip6_config_get_num_dns_searches (s_ip6) == 0,
+ ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip6) == 0,
"wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
g_free (unmanaged);
g_free (keyfile);
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP4_CONFIG_SETTING_NAME);
- method = nm_setting_ip4_config_get_method (s_ip4);
+ method = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0,
"wired-ipv6-only-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* ===== IPv6 SETTING ===== */
NM_SETTING_IP6_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip6_config_get_method (s_ip6);
+ tmp = nm_setting_ip_config_get_method (s_ip6);
ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0,
"wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* IP addresses */
- ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1,
+ ASSERT (nm_setting_ip_config_get_num_addresses (s_ip6) == 1,
"wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_ADDRESSES);
/* Address #1 */
- ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0);
+ ip6_addr = nm_setting_ip_config_get_address (s_ip6, 0);
g_assert (ip6_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "1001:abba::1234");
g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 56);
/* DNS Addresses */
- ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 1,
+ ASSERT (nm_setting_ip_config_get_num_dns (s_ip6) == 1,
"wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (strcmp (nm_setting_ip6_config_get_dns (s_ip6, 0), "1:2:3:4::a") == 0,
+ ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip6, 0), "1:2:3:4::a") == 0,
"wired-ipv6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value #1",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
/* DNS domains should be in IPv6, because IPv4 is disabled */
- g_assert_cmpint (nm_setting_ip6_config_get_num_dns_searches (s_ip6), ==, 3);
- g_assert_cmpstr (nm_setting_ip6_config_get_dns_search (s_ip6, 0), ==, "lorem.com");
- g_assert_cmpstr (nm_setting_ip6_config_get_dns_search (s_ip6, 1), ==, "ipsum.org");
- g_assert_cmpstr (nm_setting_ip6_config_get_dns_search (s_ip6, 2), ==, "dolor.edu");
+ g_assert_cmpint (nm_setting_ip_config_get_num_dns_searches (s_ip6), ==, 3);
+ g_assert_cmpstr (nm_setting_ip_config_get_dns_search (s_ip6, 0), ==, "lorem.com");
+ g_assert_cmpstr (nm_setting_ip_config_get_dns_search (s_ip6, 1), ==, "ipsum.org");
+ g_assert_cmpstr (nm_setting_ip_config_get_dns_search (s_ip6, 2), ==, "dolor.edu");
g_free (unmanaged);
g_free (keyfile);
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
TEST_IFCFG_WIRED_DHCP6_ONLY,
NM_SETTING_IP4_CONFIG_SETTING_NAME);
- method = nm_setting_ip4_config_get_method (s_ip4);
+ method = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0,
"wired-dhcp6-only-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DHCP6_ONLY,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* ===== IPv6 SETTING ===== */
NM_SETTING_IP6_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip6_config_get_method (s_ip6);
+ tmp = nm_setting_ip_config_get_method (s_ip6);
ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_DHCP) == 0,
"wired-dhcp6-only-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_DHCP6_ONLY,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
g_free (unmanaged);
g_free (keyfile);
test_read_noip (void)
{
NMConnection *connection;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED);
- g_assert (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED);
+ g_assert (nm_setting_ip_config_get_never_default (s_ip4) == FALSE);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6);
- g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE);
- g_assert (nm_setting_ip6_config_get_never_default (s_ip6) == FALSE);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE);
+ g_assert (nm_setting_ip_config_get_never_default (s_ip6) == FALSE);
g_free (unmanaged);
g_free (keyfile);
{
NMConnection *connection;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSetting8021x *s_8021x;
NMSetting8021x *tmp_8021x;
char *unmanaged = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wired-8021x-peap-mschapv2-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* ===== 802.1x SETTING ===== */
s_8021x = nm_connection_get_setting_802_1x (connection);
{
NMConnection *connection;
NMSettingConnection *s_con;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0,
"aliases-good-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_ALIASES_GOOD,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
- ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == expected_num_addresses,
+ ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == expected_num_addresses,
"aliases-good-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_ALIASES_GOOD,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_ADDRESSES);
/* Addresses */
for (i = 0; i < expected_num_addresses; i++) {
const char *addr;
GVariant *label;
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, i);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, i);
g_assert (ip4_addr != NULL);
addr = nm_ip_address_get_address (ip4_addr);
{
NMConnection *connection;
NMSettingConnection *s_con;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0,
"aliases-bad-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
base,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
- ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1,
+ ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 1,
"aliases-bad-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
base,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_ADDRESSES);
/* Addresses */
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert (ip4_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.1.5");
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24);
NMSettingConnection *s_con;
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wifi-open-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIFI_OPEN,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
g_free (unmanaged);
g_free (keyfile);
NMSettingConnection *s_con;
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wifi-wep-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIFI_WEP,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
g_free (unmanaged);
g_free (keyfile);
NMSettingConnection *s_con;
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIFI_WEP_ADHOC,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* Ignore auto DNS */
- ASSERT (nm_setting_ip4_config_get_ignore_auto_dns (s_ip4) == TRUE,
+ ASSERT (nm_setting_ip_config_get_ignore_auto_dns (s_ip4) == TRUE,
"wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIFI_WEP_ADHOC,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS);
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS);
/* DNS Addresses */
- ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2,
+ ASSERT (nm_setting_ip_config_get_num_dns (s_ip4) == 2,
"wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIFI_WEP_ADHOC,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 0), "4.2.2.1") == 0,
+ ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 0), "4.2.2.1") == 0,
"wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value #1",
TEST_IFCFG_WIFI_WEP_ADHOC,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 1), "4.2.2.2") == 0,
+ ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 1), "4.2.2.2") == 0,
"wifi-wep-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value #2",
TEST_IFCFG_WIFI_WEP_ADHOC,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
g_free (unmanaged);
g_free (keyfile);
NMSettingConnection *s_con;
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wifi-wpa-psk-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIFI_WPA_PSK,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
g_free (unmanaged);
g_free (keyfile);
NMSettingConnection *s_con;
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wifi-wpa-psk-adhoc-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIFI_WPA_PSK_ADHOC,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
g_free (unmanaged);
g_free (keyfile);
NMSettingConnection *s_con;
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wifi-wpa-psk-hex-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIFI_WPA_PSK_HEX,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
g_free (unmanaged);
g_free (keyfile);
{
NMConnection *connection;
NMSettingWireless *s_wireless;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSetting8021x *s_8021x;
char *unmanaged = NULL;
char *keyfile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wifi-wpa-eap-tls-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIFI_WPA_EAP_TLS,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* ===== 802.1x SETTING ===== */
s_8021x = nm_connection_get_setting_802_1x (connection);
{
NMConnection *connection;
NMSettingWireless *s_wireless;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSetting8021x *s_8021x;
char *unmanaged = NULL;
char *keyfile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wifi-wpa-eap-ttls-tls-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIFI_WPA_EAP_TTLS_TLS,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* ===== 802.1x SETTING ===== */
s_8021x = nm_connection_get_setting_802_1x (connection);
NMConnection *connection;
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSetting8021x *s_8021x;
char *unmanaged = NULL;
char *keyfile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"wifi-wep-eap-ttls-chap-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIFI_WEP_EAP_TTLS_CHAP,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* ===== 802.1x SETTING ===== */
s_wsec = nm_connection_get_setting_wireless_security (connection);
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0,
"wired-qeth-static-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_QETH_STATIC,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
g_free (unmanaged);
g_free (keyfile);
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4, *reread_s_ip4;
- NMSettingIP6Config *s_ip6, *reread_s_ip6;
+ NMSettingIPConfig *s_ip4, *reread_s_ip4;
+ NMSettingIPConfig *s_ip6, *reread_s_ip6;
static const char *mac = "31:33:33:37:be:cd";
guint32 mtu = 1492;
char *uuid;
NULL);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
- NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.1", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
addr = nm_ip_address_new (AF_INET, "1.1.1.5", 24, "1.1.1.1", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
- nm_setting_ip4_config_add_dns (s_ip4, dns1);
- nm_setting_ip4_config_add_dns (s_ip4, dns2);
+ nm_setting_ip_config_add_dns (s_ip4, dns1);
+ nm_setting_ip_config_add_dns (s_ip4, dns2);
- nm_setting_ip4_config_add_dns_search (s_ip4, dns_search1);
- nm_setting_ip4_config_add_dns_search (s_ip4, dns_search2);
+ nm_setting_ip_config_add_dns_search (s_ip4, dns_search1);
+ nm_setting_ip_config_add_dns_search (s_ip4, dns_search2);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
/* Add addresses */
addr6 = nm_ip_address_new (AF_INET6, "1003:1234:abcd::1", 11, NULL, &error);
g_assert_no_error (error);
- nm_setting_ip6_config_add_address (s_ip6, addr6);
+ nm_setting_ip_config_add_address (s_ip6, addr6);
nm_ip_address_unref (addr6);
addr6 = nm_ip_address_new (AF_INET6, "2003:1234:abcd::2", 22, NULL, &error);
g_assert_no_error (error);
- nm_setting_ip6_config_add_address (s_ip6, addr6);
+ nm_setting_ip_config_add_address (s_ip6, addr6);
nm_ip_address_unref (addr6);
addr6 = nm_ip_address_new (AF_INET6, "3003:1234:abcd::3", 33, NULL, &error);
g_assert_no_error (error);
- nm_setting_ip6_config_add_address (s_ip6, addr6);
+ nm_setting_ip_config_add_address (s_ip6, addr6);
nm_ip_address_unref (addr6);
/* Add routes */
"2222:aaaa:bbbb:cccc::", 64,
"2222:aaaa:bbbb:cccc:dddd:eeee:5555:6666", 99, &error);
g_assert_no_error (error);
- nm_setting_ip6_config_add_route (s_ip6, route6);
+ nm_setting_ip_config_add_route (s_ip6, route6);
nm_ip_route_unref (route6);
route6 = nm_ip_route_new (AF_INET6, "::", 128, "2222:aaaa::9999", 1, &error);
g_assert_no_error (error);
- nm_setting_ip6_config_add_route (s_ip6, route6);
+ nm_setting_ip_config_add_route (s_ip6, route6);
nm_ip_route_unref (route6);
/* DNS servers */
- nm_setting_ip6_config_add_dns (s_ip6, dns6_1);
- nm_setting_ip6_config_add_dns (s_ip6, dns6_2);
+ nm_setting_ip_config_add_dns (s_ip6, dns6_1);
+ nm_setting_ip_config_add_dns (s_ip6, dns6_2);
/* DNS domains */
- nm_setting_ip6_config_add_dns_search (s_ip6, dns_search3);
- nm_setting_ip6_config_add_dns_search (s_ip6, dns_search4);
+ nm_setting_ip_config_add_dns_search (s_ip6, dns_search3);
+ nm_setting_ip_config_add_dns_search (s_ip6, dns_search4);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
"wired-static-write", "failed to verify connection: %s",
*/
reread_s_ip4 = nm_connection_get_setting_ip4_config (reread);
reread_s_ip6 = nm_connection_get_setting_ip6_config (reread);
- nm_setting_ip6_config_add_dns_search (reread_s_ip6, nm_setting_ip4_config_get_dns_search (reread_s_ip4, 2));
- nm_setting_ip6_config_add_dns_search (reread_s_ip6, nm_setting_ip4_config_get_dns_search (reread_s_ip4, 3));
- nm_setting_ip4_config_remove_dns_search (reread_s_ip4, 3);
- nm_setting_ip4_config_remove_dns_search (reread_s_ip4, 2);
+ nm_setting_ip_config_add_dns_search (reread_s_ip6, nm_setting_ip_config_get_dns_search (reread_s_ip4, 2));
+ nm_setting_ip_config_add_dns_search (reread_s_ip6, nm_setting_ip_config_get_dns_search (reread_s_ip4, 3));
+ nm_setting_ip_config_remove_dns_search (reread_s_ip4, 3);
+ nm_setting_ip_config_remove_dns_search (reread_s_ip4, 2);
ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE,
"wired-static-write", "written and re-read connection weren't the same.");
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, "random-client-id-00:22:33",
- NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, "awesome-hostname",
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, TRUE,
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TRUE,
+ NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, "awesome-hostname",
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, TRUE,
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
(error && error->message) ? error->message : "(unknown)");
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
/* Save the ifcfg */
test_read_write_wired_dhcp_send_hostname (void)
{
NMConnection *connection, *reread;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
const char * dhcp_hostname = "kamil-patka";
char *written = NULL;
GError *error = NULL;
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip4);
g_assert (s_ip6);
- g_assert (nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) == TRUE);
- g_assert_cmpstr (nm_setting_ip4_config_get_dhcp_hostname (s_ip4), ==, "svata-pulec");
- g_assert_cmpstr (nm_setting_ip6_config_get_dhcp_hostname (s_ip6), ==, "svata-pulec");
+ g_assert (nm_setting_ip_config_get_dhcp_send_hostname (s_ip4) == TRUE);
+ g_assert_cmpstr (nm_setting_ip_config_get_dhcp_hostname (s_ip4), ==, "svata-pulec");
+ g_assert_cmpstr (nm_setting_ip_config_get_dhcp_hostname (s_ip6), ==, "svata-pulec");
/* Set dhcp-send-hostname=false dhcp-hostname="kamil-patka" and write the connection. */
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, FALSE, NULL);
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL);
- g_object_set (s_ip6, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, FALSE, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL);
+ g_object_set (s_ip6, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL);
success = writer_new_connection (connection,
TEST_SCRATCH_DIR "/network-scripts/",
s_ip6 = nm_connection_get_setting_ip6_config (reread);
g_assert (s_ip4);
g_assert (s_ip6);
- g_assert (nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) == FALSE);
- g_assert_cmpstr (nm_setting_ip4_config_get_dhcp_hostname (s_ip4), ==, dhcp_hostname);
- g_assert_cmpstr (nm_setting_ip6_config_get_dhcp_hostname (s_ip6), ==, dhcp_hostname);
+ g_assert (nm_setting_ip_config_get_dhcp_send_hostname (s_ip4) == FALSE);
+ g_assert_cmpstr (nm_setting_ip_config_get_dhcp_hostname (s_ip4), ==, dhcp_hostname);
+ g_assert_cmpstr (nm_setting_ip_config_get_dhcp_hostname (s_ip6), ==, dhcp_hostname);
g_object_unref (connection);
g_object_unref (reread);
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
static const char *mac = "31:33:33:37:be:cd";
char *uuid;
const char *dns6 = "fade:0102:0103::face";
g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS, mac, NULL);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
NULL);
/* Add addresses */
addr6 = nm_ip_address_new (AF_INET6, "1003:1234:abcd::1", 11, NULL, &error);
g_assert_no_error (error);
- nm_setting_ip6_config_add_address (s_ip6, addr6);
+ nm_setting_ip_config_add_address (s_ip6, addr6);
nm_ip_address_unref (addr6);
/* DNS server */
- nm_setting_ip6_config_add_dns (s_ip6, dns6);
+ nm_setting_ip_config_add_dns (s_ip6, dns6);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
"wired-static-ip6-only-write", "failed to verify connection: %s",
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
static const char *mac = "31:33:33:37:be:cd";
char *uuid;
const char *dns6 = "fade:0102:0103::face";
g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS, mac, NULL);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
NULL);
/* Add addresses */
addr6 = nm_ip_address_new (AF_INET6, "1003:1234:abcd::1", 11, gateway6, &error);
g_assert_no_error (error);
- nm_setting_ip6_config_add_address (s_ip6, addr6);
+ nm_setting_ip_config_add_address (s_ip6, addr6);
nm_ip_address_unref (addr6);
/* DNS server */
- nm_setting_ip6_config_add_dns (s_ip6, dns6);
+ nm_setting_ip_config_add_dns (s_ip6, dns6);
g_assert (nm_connection_verify (connection, &error));
/* access the gateway from the loaded connection. */
s_ip6 = nm_connection_get_setting_ip6_config (reread);
- g_assert (s_ip6 && nm_setting_ip6_config_get_num_addresses (s_ip6)==1);
- addr6 = nm_setting_ip6_config_get_address (s_ip6, 0);
+ g_assert (s_ip6 && nm_setting_ip_config_get_num_addresses (s_ip6)==1);
+ addr6 = nm_setting_ip_config_get_address (s_ip6, 0);
g_assert (addr6);
/* assert that the gateway was written and reloaded as expected */
NMConnection *connection, *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
char *testfile = NULL;
char *keyfile = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"read-write-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
- ASSERT (nm_setting_ip4_config_get_never_default (s_ip4) == FALSE,
+ ASSERT (nm_setting_ip_config_get_never_default (s_ip4) == FALSE,
"read-write-static-routes-legacy-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_READ_WRITE_STATIC_ROUTES_LEGACY,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_NEVER_DEFAULT);
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT);
/* Save the ifcfg; use a special different scratch dir to ensure that
* we can clean up after the written connection in both the original
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
static const char *mac = "31:33:33:37:be:cd";
guint32 mtu = 1492;
char *uuid;
NULL);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
NULL);
addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.1", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
addr = nm_ip_address_new (AF_INET, "1.1.1.5", 24, "1.1.1.1", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
/* Write out routes */
route = nm_ip_route_new (AF_INET, "1.2.3.0", 24, "222.173.190.239", 0, &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_route (s_ip4, route);
+ nm_setting_ip_config_add_route (s_ip4, route);
nm_ip_route_unref (route);
route = nm_ip_route_new (AF_INET, "3.2.1.0", 24, "202.254.186.190", 77, &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_route (s_ip4, route);
+ nm_setting_ip_config_add_route (s_ip4, route);
nm_ip_route_unref (route);
- nm_setting_ip4_config_add_dns (s_ip4, dns1);
- nm_setting_ip4_config_add_dns (s_ip4, dns2);
+ nm_setting_ip_config_add_dns (s_ip4, dns1);
+ nm_setting_ip_config_add_dns (s_ip4, dns2);
- nm_setting_ip4_config_add_dns_search (s_ip4, dns_search1);
- nm_setting_ip4_config_add_dns_search (s_ip4, dns_search2);
+ nm_setting_ip_config_add_dns_search (s_ip4, dns_search1);
+ nm_setting_ip_config_add_dns_search (s_ip4, dns_search2);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
NMSetting8021x *s_8021x;
char *uuid;
gboolean success;
nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
/* 802.1x setting */
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
NMSetting8021x *s_8021x;
char *uuid;
gboolean success;
nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6);
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *uuid;
int num_addresses = 4;
const char *ip[] = { "1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4" };
nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
ASSERT (s_ip4 != NULL,
"wired-aliases-write", "failed to allocate new %s setting",
NM_SETTING_IP4_CONFIG_SETTING_NAME);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
- NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
for (i = 0; i < num_addresses; i++) {
g_assert_no_error (error);
if (label[i])
nm_ip_address_set_attribute (addr, "label", g_variant_new_string (label[i]));
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
}
* verify the aliases manually.
*/
s_ip4 = nm_connection_get_setting_ip4_config (connection);
- ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == num_addresses,
+ ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == num_addresses,
"wired-aliases-write-verify-ip4", "failed to verify %s: unexpected %s / %s key value",
testfile,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_ADDRESSES);
/* Addresses */
for (i = 0; i < num_addresses; i++) {
const char *addrstr;
- addr = nm_setting_ip4_config_get_address (s_ip4, i);
+ addr = nm_setting_ip_config_get_address (s_ip4, i);
g_assert (addr != NULL);
addrstr = nm_ip_address_get_address (addr);
NMConnection *connection, *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *uuid, *testfile = NULL, *val;
gboolean success;
GError *error = NULL;
nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
- NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.254", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
addr = nm_ip_address_new (AF_INET, "2.2.2.5", 24, "2.2.2.254", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
success = nm_connection_verify (connection, &error);
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
g_bytes_unref (ssid);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
g_bytes_unref (ssid);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
nm_setting_wireless_security_set_wep_key (s_wsec, 3, "BBBBBBBBBBBBBBBBBBBBBBBBBB");
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
nm_setting_wireless_security_set_wep_key (s_wsec, 0, "0123456789abcdef0123456789");
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
/* IP Address */
addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.1", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
- nm_setting_ip4_config_add_dns (s_ip4, dns1);
+ nm_setting_ip_config_add_dns (s_ip4, dns1);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
nm_setting_wireless_security_set_wep_key (s_wsec, 0, "asdfdjaslfjasd;flasjdfl;aksdf");
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
nm_setting_wireless_security_set_wep_key (s_wsec, 3, "donec");
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
nm_setting_wireless_security_set_wep_key (s_wsec, 3, "thisismyascii");
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
NULL);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
NULL);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
success = nm_connection_verify (connection, &error);
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid, *tmp;
gboolean success;
GError *error = NULL;
}
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
nm_setting_wireless_security_add_group (s_wsec, "tkip");
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
/* IP Address */
addr = nm_ip_address_new (AF_INET, "1.1.1.3", 25, "1.1.1.1", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
- nm_setting_ip4_config_add_dns (s_ip4, dns1);
+ nm_setting_ip_config_add_dns (s_ip4, dns1);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
NMSetting8021x *s_8021x;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY, error->message);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
NMSetting8021x *s_8021x;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY, error->message);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
NMSetting8021x *s_8021x;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
nm_setting_wireless_security_add_group (s_wsec, "ccmp");
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
success = nm_connection_verify (connection, &error);
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
nm_setting_wireless_security_add_group (s_wsec, "ccmp");
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
success = nm_connection_verify (connection, &error);
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
NMSetting8021x *s_8021x;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
NULL);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
success = nm_connection_verify (connection, &error);
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
char **subchans;
gboolean success;
nm_setting_wired_add_s390_option (s_wired, "protocol", "blahbalh");
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
/* Verify */
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
char **subchans;
gboolean success;
nm_setting_wired_add_s390_option (s_wired, "ctcprot", "0");
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
/* Verify */
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
/* Verify */
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
const char *str_ssid = "foobarbaz";
GBytes *ssid;
g_free (uuid);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
/* Wifi setting */
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSettingPppoe *s_pppoe;
NMSettingPpp *s_ppp;
char *uuid;
nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
/* PPPoE setting */
{
NMConnection *connection;
NMSettingConnection *s_con;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSettingVpn *s_vpn;
char *uuid;
gboolean success;
nm_setting_vpn_add_secret (s_vpn, "password", "sup3rs3cr3t");
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
{
NMConnection *connection;
NMSettingConnection *s_con;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSettingGsm *s_gsm;
NMSettingCdma *s_cdma;
NMSettingPpp *s_ppp;
NULL);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
/* PPP setting */
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingBridge *s_bridge;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
NMIPAddress *addr;
static const char *mac = "31:33:33:37:be:cd";
NULL);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
- NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.1", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
NULL);
nmtst_assert_connection_verifies_without_normalization (connection);
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
GError *error = NULL;
nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, "random-client-id-00:22:33",
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, TRUE,
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TRUE,
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, TRUE,
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, TRUE,
NULL);
/* IP6 setting */
* the comparison can succeed. Missing IPv6 setting should have been
* written out (and re-read) as Automatic IPv6.
*/
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE,
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingBond *s_bond;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
NMSettingWired *s_wired;
char *uuid;
NMIPAddress *addr;
nm_connection_add_setting (connection, NM_SETTING (s_bond));
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
- NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.1", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
NULL);
nmtst_assert_connection_verifies_without_normalization (connection);
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingInfiniband *s_infiniband;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
const char *mac = "80:00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22";
guint32 mtu = 65520;
char *uuid;
NULL);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
- NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, "1.1.1.1", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_setting_ip_config_add_address (s_ip4, addr);
nm_ip_address_unref (addr);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
NMSettingConnection *s_con;
NMSettingWired *s_wired;
NMSettingDcb *s_dcb;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
gboolean success, ignore_error;
guint i;
char *uuid, *testfile;
nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP stuff */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
- g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
+ g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
- g_object_set (G_OBJECT (s_ip6), NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
+ g_object_set (G_OBJECT (s_ip6), NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
/* DCB */
NMSettingConnection *s_con;
NMSettingWired *s_wired;
NMSettingDcb *s_dcb;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
gboolean success, ignore_error;
char *uuid, *testfile;
nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP stuff */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
- g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
+ g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
- g_object_set (G_OBJECT (s_ip6), NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
+ g_object_set (G_OBJECT (s_ip6), NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
/* DCB */
NMSettingConnection *s_con;
NMSettingTeam *s_team;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid, *testfile = NULL, *val;
gboolean success;
GError *error = NULL;
nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
NULL);
nmtst_assert_connection_verifies_without_normalization (connection);
}
static gboolean
-write_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError **error)
+write_route_file_legacy (const char *filename, NMSettingIPConfig *s_ip4, GError **error)
{
const char *dest, *next_hop;
char **route_items;
g_return_val_if_fail (error != NULL, FALSE);
g_return_val_if_fail (*error == NULL, FALSE);
- num = nm_setting_ip4_config_get_num_routes (s_ip4);
+ num = nm_setting_ip_config_get_num_routes (s_ip4);
if (num == 0) {
unlink (filename);
return TRUE;
route_items = g_malloc0 (sizeof (char*) * (num + 1));
for (i = 0; i < num; i++) {
- route = nm_setting_ip4_config_get_route (s_ip4, i);
+ route = nm_setting_ip_config_get_route (s_ip4, i);
dest = nm_ip_route_get_dest (route);
prefix = nm_ip_route_get_prefix (route);
static gboolean
write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
{
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
const char *value;
char *addr_key, *prefix_key, *netmask_key, *gw_key, *metric_key, *tmp;
char *route_path = NULL;
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
- method = nm_setting_ip4_config_get_method (s_ip4);
+ method = nm_setting_ip_config_get_method (s_ip4);
/* Missing IP4 setting is assumed to be DHCP */
if (!method)
/* Temporarily create fake IP4 setting if missing; method set to DHCP above */
if (!s_ip4) {
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
fake_ip4 = TRUE;
}
/* Write out IPADDR<n>, PREFIX<n>, GATEWAY<n> for current IP addresses
* without labels. Unset obsolete NETMASK<n>.
*/
- num = nm_setting_ip4_config_get_num_addresses (s_ip4);
+ num = nm_setting_ip_config_get_num_addresses (s_ip4);
for (i = n = 0; i < num; i++) {
NMIPAddress *addr;
- addr = nm_setting_ip4_config_get_address (s_ip4, i);
+ addr = nm_setting_ip_config_get_address (s_ip4, i);
if (i > 0) {
GVariant *label;
g_free (gw_key);
}
- num = nm_setting_ip4_config_get_num_dns (s_ip4);
+ num = nm_setting_ip_config_get_num_dns (s_ip4);
for (i = 0; i < 254; i++) {
const char *dns;
if (i >= num)
svSetValue (ifcfg, addr_key, NULL, FALSE);
else {
- dns = nm_setting_ip4_config_get_dns (s_ip4, i);
+ dns = nm_setting_ip_config_get_dns (s_ip4, i);
svSetValue (ifcfg, addr_key, dns, FALSE);
}
g_free (addr_key);
}
- num = nm_setting_ip4_config_get_num_dns_searches (s_ip4);
+ num = nm_setting_ip_config_get_num_dns_searches (s_ip4);
if (num > 0) {
searches = g_string_new (NULL);
for (i = 0; i < num; i++) {
if (i > 0)
g_string_append_c (searches, ' ');
- g_string_append (searches, nm_setting_ip4_config_get_dns_search (s_ip4, i));
+ g_string_append (searches, nm_setting_ip_config_get_dns_search (s_ip4, i));
}
svSetValue (ifcfg, "DOMAIN", searches->str, FALSE);
g_string_free (searches, TRUE);
/* DEFROUTE; remember that it has the opposite meaning from never-default */
svSetValue (ifcfg, "DEFROUTE",
- nm_setting_ip4_config_get_never_default (s_ip4) ? "no" : "yes",
+ nm_setting_ip_config_get_never_default (s_ip4) ? "no" : "yes",
FALSE);
svSetValue (ifcfg, "PEERDNS", NULL, FALSE);
svSetValue (ifcfg, "DHCP_CLIENT_ID", NULL, FALSE);
if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
svSetValue (ifcfg, "PEERDNS",
- nm_setting_ip4_config_get_ignore_auto_dns (s_ip4) ? "no" : "yes",
+ nm_setting_ip_config_get_ignore_auto_dns (s_ip4) ? "no" : "yes",
FALSE);
svSetValue (ifcfg, "PEERROUTES",
- nm_setting_ip4_config_get_ignore_auto_routes (s_ip4) ? "no" : "yes",
+ nm_setting_ip_config_get_ignore_auto_routes (s_ip4) ? "no" : "yes",
FALSE);
- value = nm_setting_ip4_config_get_dhcp_hostname (s_ip4);
+ value = nm_setting_ip_config_get_dhcp_hostname (s_ip4);
if (value)
svSetValue (ifcfg, "DHCP_HOSTNAME", value, FALSE);
* in that case, because it is NM-specific variable
*/
svSetValue (ifcfg, "DHCP_SEND_HOSTNAME",
- nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) ? NULL : "no",
+ nm_setting_ip_config_get_dhcp_send_hostname (s_ip4) ? NULL : "no",
FALSE);
- value = nm_setting_ip4_config_get_dhcp_client_id (s_ip4);
+ value = nm_setting_ip4_config_get_dhcp_client_id (NM_SETTING_IP4_CONFIG (s_ip4));
if (value)
svSetValue (ifcfg, "DHCP_CLIENT_ID", value, FALSE);
}
svSetValue (ifcfg, "IPV4_FAILURE_FATAL",
- nm_setting_ip4_config_get_may_fail (s_ip4) ? "no" : "yes",
+ nm_setting_ip_config_get_may_fail (s_ip4) ? "no" : "yes",
FALSE);
/* Static routes - route-<name> file */
}
g_free (route_path);
- num = nm_setting_ip4_config_get_num_routes (s_ip4);
+ num = nm_setting_ip_config_get_num_routes (s_ip4);
for (i = 0; i < 256; i++) {
char buf[INET_ADDRSTRLEN];
NMIPRoute *route;
svSetValue (routefile, gw_key, NULL, FALSE);
svSetValue (routefile, metric_key, NULL, FALSE);
} else {
- route = nm_setting_ip4_config_get_route (s_ip4, i);
+ route = nm_setting_ip_config_get_route (s_ip4, i);
svSetValue (routefile, addr_key, nm_ip_route_get_dest (route), FALSE);
static void
write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path)
{
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *base_ifcfg_dir, *base_ifcfg_name, *base_name;
int i, num, base_ifcfg_name_len, base_name_len;
GDir *dir;
if (!s_ip4)
return;
- num = nm_setting_ip4_config_get_num_addresses (s_ip4);
+ num = nm_setting_ip_config_get_num_addresses (s_ip4);
for (i = 0; i < num; i++) {
GVariant *label_var;
const char *label, *p;
NMIPAddress *addr;
shvarFile *ifcfg;
- addr = nm_setting_ip4_config_get_address (s_ip4, i);
+ addr = nm_setting_ip_config_get_address (s_ip4, i);
label_var = nm_ip_address_get_attribute (addr, "label");
if (!label_var)
svSetValue (ifcfg, "DEVICE", label, FALSE);
- addr = nm_setting_ip4_config_get_address (s_ip4, i);
+ addr = nm_setting_ip_config_get_address (s_ip4, i);
svSetValue (ifcfg, "IPADDR", nm_ip_address_get_address (addr), FALSE);
tmp = g_strdup_printf ("%u", nm_ip_address_get_prefix (addr));
}
static gboolean
-write_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **error)
+write_route6_file (const char *filename, NMSettingIPConfig *s_ip6, GError **error)
{
char **route_items;
char *route_contents;
g_return_val_if_fail (error != NULL, FALSE);
g_return_val_if_fail (*error == NULL, FALSE);
- num = nm_setting_ip6_config_get_num_routes (s_ip6);
+ num = nm_setting_ip_config_get_num_routes (s_ip6);
if (num == 0) {
unlink (filename);
return TRUE;
route_items = g_malloc0 (sizeof (char*) * (num + 1));
for (i = 0; i < num; i++) {
- route = nm_setting_ip6_config_get_route (s_ip6, i);
+ route = nm_setting_ip_config_get_route (s_ip6, i);
route_items[i] = g_strdup_printf ("%s/%u via %s metric %u\n",
nm_ip_route_get_dest (route),
nm_ip_route_get_prefix (route),
static gboolean
write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
{
- NMSettingIP6Config *s_ip6;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip6;
+ NMSettingIPConfig *s_ip4;
const char *value;
char *addr_key;
guint32 i, num, num4;
return TRUE;
}
- value = nm_setting_ip6_config_get_method (s_ip6);
+ value = nm_setting_ip_config_get_method (s_ip6);
g_assert (value);
if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
svSetValue (ifcfg, "IPV6INIT", "no", FALSE);
svSetValue (ifcfg, "IPV6INIT", "yes", FALSE);
svSetValue (ifcfg, "IPV6_AUTOCONF", "no", FALSE);
svSetValue (ifcfg, "DHCPV6C", "yes", FALSE);
- hostname = nm_setting_ip6_config_get_dhcp_hostname (s_ip6);
+ hostname = nm_setting_ip_config_get_dhcp_hostname (s_ip6);
if (hostname)
svSetValue (ifcfg, "DHCP_HOSTNAME", hostname, FALSE);
} else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
}
/* Write out IP addresses */
- num = nm_setting_ip6_config_get_num_addresses (s_ip6);
+ num = nm_setting_ip_config_get_num_addresses (s_ip6);
ip_str1 = g_string_new (NULL);
ip_str2 = g_string_new (NULL);
ipv6_defaultgw = NULL;
else
ip_ptr = ip_str2;
- addr = nm_setting_ip6_config_get_address (s_ip6, i);
+ addr = nm_setting_ip_config_get_address (s_ip6, i);
if (i > 1)
g_string_append_c (ip_ptr, ' '); /* separate addresses in IPV6ADDR_SECONDARIES */
/* Write out DNS - 'DNS' key is used both for IPv4 and IPv6 */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
- num4 = s_ip4 ? nm_setting_ip4_config_get_num_dns (s_ip4) : 0; /* from where to start with IPv6 entries */
- num = nm_setting_ip6_config_get_num_dns (s_ip6);
+ num4 = s_ip4 ? nm_setting_ip_config_get_num_dns (s_ip4) : 0; /* from where to start with IPv6 entries */
+ num = nm_setting_ip_config_get_num_dns (s_ip6);
for (i = 0; i < 254; i++) {
addr_key = g_strdup_printf ("DNS%d", i + num4 + 1);
if (i >= num)
svSetValue (ifcfg, addr_key, NULL, FALSE);
else {
- dns = nm_setting_ip6_config_get_dns (s_ip6, i);
+ dns = nm_setting_ip_config_get_dns (s_ip6, i);
svSetValue (ifcfg, addr_key, dns, FALSE);
}
g_free (addr_key);
}
/* Write out DNS domains - 'DOMAIN' key is shared for both IPv4 and IPv6 domains */
- num = nm_setting_ip6_config_get_num_dns_searches (s_ip6);
+ num = nm_setting_ip_config_get_num_dns_searches (s_ip6);
if (num > 0) {
char *ip4_domains;
ip4_domains = svGetValue (ifcfg, "DOMAIN", FALSE);
for (i = 0; i < num; i++) {
if (searches->len > 0)
g_string_append_c (searches, ' ');
- g_string_append (searches, nm_setting_ip6_config_get_dns_search (s_ip6, i));
+ g_string_append (searches, nm_setting_ip_config_get_dns_search (s_ip6, i));
}
svSetValue (ifcfg, "DOMAIN", searches->str, FALSE);
g_string_free (searches, TRUE);
/* handle IPV6_DEFROUTE */
/* IPV6_DEFROUTE has the opposite meaning from 'never-default' */
- if (nm_setting_ip6_config_get_never_default(s_ip6))
+ if (nm_setting_ip_config_get_never_default(s_ip6))
svSetValue (ifcfg, "IPV6_DEFROUTE", "no", FALSE);
else
svSetValue (ifcfg, "IPV6_DEFROUTE", "yes", FALSE);
svSetValue (ifcfg, "IPV6_PEERROUTES", NULL, FALSE);
if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) {
svSetValue (ifcfg, "IPV6_PEERDNS",
- nm_setting_ip6_config_get_ignore_auto_dns (s_ip6) ? "no" : "yes",
+ nm_setting_ip_config_get_ignore_auto_dns (s_ip6) ? "no" : "yes",
FALSE);
svSetValue (ifcfg, "IPV6_PEERROUTES",
- nm_setting_ip6_config_get_ignore_auto_routes (s_ip6) ? "no" : "yes",
+ nm_setting_ip_config_get_ignore_auto_routes (s_ip6) ? "no" : "yes",
FALSE);
}
svSetValue (ifcfg, "IPV6_FAILURE_FATAL",
- nm_setting_ip6_config_get_may_fail (s_ip6) ? "no" : "yes",
+ nm_setting_ip_config_get_may_fail (s_ip6) ? "no" : "yes",
FALSE);
/* IPv6 Privacy Extensions */
svSetValue (ifcfg, "IPV6_PRIVACY", NULL, FALSE);
svSetValue (ifcfg, "IPV6_PRIVACY_PREFER_PUBLIC_IP", NULL, FALSE);
- switch (nm_setting_ip6_config_get_ip6_privacy (s_ip6)){
+ switch (nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6))){
case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED:
svSetValue (ifcfg, "IPV6_PRIVACY", "no", FALSE);
break;
nm_connection_add_setting (connection, NM_SETTING (s_wired));
}
-/* add NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME,
- * NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID in future*/
+/* add NM_SETTING_IP_CONFIG_DHCP_HOSTNAME,
+ * NM_SETTING_IP_CONFIG_DHCP_CLIENT_ID in future*/
static void
make_ip4_setting (NMConnection *connection,
const char *conn_name,
GError **error)
{
- NMSettingIP4Config *ip4_setting =
- NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
+ NMSettingIPConfig *ip4_setting =
+ NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
const char *value, *method = NULL;
gboolean is_static_block = is_static_ip4 (conn_name);
ip_block *iblock = NULL;
/* set dhcp options (dhcp_xxx) */
value = ifnet_get_data (conn_name, "dhcp");
- g_object_set (ip4_setting, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, value
+ g_object_set (ip4_setting, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, value
&& strstr (value, "nodns") ? TRUE : FALSE,
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, value
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, value
&& strstr (value, "nogateway") ? TRUE : FALSE, NULL);
if (!is_static_block) {
}
if (strstr (method, "dhcp"))
g_object_set (ip4_setting,
- NM_SETTING_IP4_CONFIG_METHOD,
+ NM_SETTING_IP_CONFIG_METHOD,
NM_SETTING_IP4_CONFIG_METHOD_AUTO,
- NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, NULL);
else if (strstr (method, "autoip")) {
g_object_set (ip4_setting,
- NM_SETTING_IP4_CONFIG_METHOD,
+ NM_SETTING_IP_CONFIG_METHOD,
NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
- NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, NULL);
nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
return;
} else if (strstr (method, "shared")) {
g_object_set (ip4_setting,
- NM_SETTING_IP4_CONFIG_METHOD,
+ NM_SETTING_IP_CONFIG_METHOD,
NM_SETTING_IP4_CONFIG_METHOD_SHARED,
- NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, NULL);
nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
return;
} else {
ip4_addr = nm_ip_address_new (AF_INET, iblock->ip, iblock->prefix, iblock->next_hop, &local);
if (iblock->next_hop)
g_object_set (ip4_setting,
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES,
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES,
TRUE, NULL);
if (ip4_addr) {
- if (!nm_setting_ip4_config_add_address (ip4_setting, ip4_addr))
+ if (!nm_setting_ip_config_add_address (ip4_setting, ip4_addr))
nm_log_warn (LOGD_SETTINGS, "ignoring duplicate IP4 address");
nm_ip_address_unref (ip4_addr);
} else {
}
g_object_set (ip4_setting,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
- NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, !has_default_ip4_route (conn_name),
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT, !has_default_ip4_route (conn_name),
NULL);
}
get_dhcp_hostname_and_client_id (&dhcp_hostname, &client_id);
if (dhcp_hostname) {
g_object_set (ip4_setting,
- NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME,
+ NM_SETTING_IP_CONFIG_DHCP_HOSTNAME,
dhcp_hostname, NULL);
nm_log_info (LOGD_SETTINGS, "DHCP hostname: %s", dhcp_hostname);
g_free (dhcp_hostname);
for (item = searches; *item; item++) {
if (strlen (*item)) {
- if (!nm_setting_ip4_config_add_dns_search (ip4_setting, *item))
+ if (!nm_setting_ip_config_add_dns_search (ip4_setting, *item))
nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *item);
}
}
}
route = nm_ip_route_new (AF_INET, iblock->ip, iblock->prefix, iblock->next_hop, metric, &local);
-
if (route) {
- if (nm_setting_ip4_config_add_route (ip4_setting, route))
+ if (nm_setting_ip_config_add_route (ip4_setting, route))
nm_log_info (LOGD_SETTINGS, "new IP4 route:%s\n", iblock->ip);
else
nm_log_warn (LOGD_SETTINGS, "duplicate IP4 route");
const char *conn_name,
GError **error)
{
- NMSettingIP6Config *s_ip6 = NULL;
+ NMSettingIPConfig *s_ip6 = NULL;
gboolean is_static_block = is_static_ip6 (conn_name);
// used to disable IPv6
ip_block *iblock;
gboolean never_default = !has_default_ip6_route (conn_name);
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
value = ifnet_get_data (conn_name, "enable_ipv6");
if (value && is_true (value))
// Currently only Manual and DHCP are supported
if (!ipv6_enabled) {
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD,
+ NM_SETTING_IP_CONFIG_METHOD,
NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL);
goto done;
} else if (!is_static_block) {
nm_log_info (LOGD_SETTINGS, "IPv6 for %s enabled, using %s", conn_name, method);
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, method,
- NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, FALSE,
- NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, FALSE,
- NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, never_default, NULL);
+ NM_SETTING_IP_CONFIG_METHOD, method,
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, FALSE,
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, FALSE,
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default, NULL);
/* Make manual settings */
if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
ip6_addr = nm_ip_address_new (AF_INET6, iblock->ip, iblock->prefix, NULL, &local);
if (ip6_addr) {
- if (nm_setting_ip6_config_add_address (s_ip6, ip6_addr)) {
+ if (nm_setting_ip_config_add_address (s_ip6, ip6_addr)) {
nm_log_info (LOGD_SETTINGS, "ipv6 addresses count: %d",
- nm_setting_ip6_config_get_num_addresses (s_ip6));
+ nm_setting_ip_config_get_num_addresses (s_ip6));
} else {
nm_log_warn (LOGD_SETTINGS, "ignoring duplicate IP6 address");
}
} else if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) {
/* - autoconf or DHCPv6 stuff goes here */
}
- // DNS Servers, set NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS TRUE here
+ // DNS Servers, set NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS TRUE here
set_ip6_dns_servers (s_ip6, conn_name);
- /* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIP4Config */
+ /* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIPConfig */
// Add routes
iblock = convert_ip6_routes_block (conn_name);
if (iblock)
- g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES,
+ g_object_set (s_ip6, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES,
TRUE, NULL);
/* Add all IPv6 routes */
while (iblock) {
route = nm_ip_route_new (AF_INET6, iblock->ip, iblock->prefix, iblock->next_hop, metric, &local);
if (route) {
- if (nm_setting_ip6_config_add_route (s_ip6, route))
+ if (nm_setting_ip_config_add_route (s_ip6, route))
nm_log_info (LOGD_SETTINGS, " new IP6 route");
else
nm_log_warn (LOGD_SETTINGS, " duplicate IP6 route");
static gboolean
write_ip4_setting (NMConnection *connection, const char *conn_name, GError **error)
{
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
const char *value;
guint32 i, num;
GString *searches;
}
routes = g_string_new (NULL);
- value = nm_setting_ip4_config_get_method (s_ip4);
+ value = nm_setting_ip_config_get_method (s_ip4);
g_assert (value);
if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
- num = nm_setting_ip4_config_get_num_addresses (s_ip4);
+ num = nm_setting_ip_config_get_num_addresses (s_ip4);
ips = g_string_new (NULL);
/* IPv4 addresses */
for (i = 0; i < num; i++) {
NMIPAddress *addr;
- addr = nm_setting_ip4_config_get_address (s_ip4, i);
+ addr = nm_setting_ip_config_get_address (s_ip4, i);
g_string_append_printf (ips, "\"%s/%u",
nm_ip_address_get_address (addr),
ifnet_set_data (conn_name, "config", "dhcp");
/* DNS Servers */
- num = nm_setting_ip4_config_get_num_dns (s_ip4);
+ num = nm_setting_ip_config_get_num_dns (s_ip4);
if (num > 0) {
dns = g_string_new (NULL);
for (i = 0; i < num; i++) {
const char *ip;
- ip = nm_setting_ip4_config_get_dns (s_ip4, i);
+ ip = nm_setting_ip_config_get_dns (s_ip4, i);
g_string_append_printf (dns, " %s", ip);
}
ifnet_set_data (conn_name, "dns_servers", dns->str);
ifnet_set_data (conn_name, "dns_servers", NULL);
/* DNS Searches */
- num = nm_setting_ip4_config_get_num_dns_searches (s_ip4);
+ num = nm_setting_ip_config_get_num_dns_searches (s_ip4);
if (num > 0) {
searches = g_string_new (NULL);
for (i = 0; i < num; i++) {
if (i > 0)
g_string_append_c (searches, ' ');
g_string_append (searches,
- nm_setting_ip4_config_get_dns_search
+ nm_setting_ip_config_get_dns_search
(s_ip4, i));
}
ifnet_set_data (conn_name, "dns_search", searches->str);
ifnet_set_data (conn_name, "dns_search", NULL);
/* FIXME Will be implemented when configuration supports it
if (!strcmp(value, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
- value = nm_setting_ip4_config_get_dhcp_hostname(s_ip4);
+ value = nm_setting_ip_config_get_dhcp_hostname(s_ip4);
if (value)
ifnet_set_data(conn_name, "DHCP_HOSTNAME", value,
FALSE);
- value = nm_setting_ip4_config_get_dhcp_client_id(s_ip4);
+ value = nm_setting_ip_config_get_dhcp_client_id(s_ip4);
if (value)
ifnet_set_data(conn_name, "DHCP_CLIENT_ID", value,
FALSE);
*/
/* Static routes */
- num = nm_setting_ip4_config_get_num_routes (s_ip4);
+ num = nm_setting_ip_config_get_num_routes (s_ip4);
if (num > 0) {
for (i = 0; i < num; i++) {
NMIPRoute *route;
const char *next_hop;
- route = nm_setting_ip4_config_get_route (s_ip4, i);
+ route = nm_setting_ip_config_get_route (s_ip4, i);
next_hop = nm_ip_route_get_next_hop (route);
if (!next_hop)
}
static gboolean
-write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **error)
+write_route6_file (NMSettingIPConfig *s_ip6, const char *conn_name, GError **error)
{
NMIPRoute *route;
const char *next_hop;
const char *old_routes;
g_return_val_if_fail (s_ip6 != NULL, FALSE);
- num = nm_setting_ip6_config_get_num_routes (s_ip6);
+ num = nm_setting_ip_config_get_num_routes (s_ip6);
if (num == 0) {
return TRUE;
}
if (old_routes)
g_string_append (routes_string, "\" ");
for (i = 0; i < num; i++) {
- route = nm_setting_ip6_config_get_route (s_ip6, i);
+ route = nm_setting_ip_config_get_route (s_ip6, i);
next_hop = nm_ip_route_get_next_hop (route);
if (!next_hop)
static gboolean
write_ip6_setting (NMConnection *connection, const char *conn_name, GError **error)
{
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
const char *value;
guint32 i, num;
GString *searches;
return FALSE;
}
- value = nm_setting_ip6_config_get_method (s_ip6);
+ value = nm_setting_ip_config_get_method (s_ip6);
g_assert (value);
if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
ifnet_set_data (conn_name, "enable_ipv6", "false");
if (!config)
config = "";
- num = nm_setting_ip6_config_get_num_addresses (s_ip6);
+ num = nm_setting_ip_config_get_num_addresses (s_ip6);
/* IPv6 addresses */
ip_str = g_string_new (NULL);
for (i = 0; i < num; i++) {
- addr = nm_setting_ip6_config_get_address (s_ip6, i);
+ addr = nm_setting_ip_config_get_address (s_ip6, i);
g_string_append_printf (ip_str, "\"%s/%u\"",
nm_ip_address_get_address (addr),
}
/* DNS Servers */
- num = nm_setting_ip6_config_get_num_dns (s_ip6);
+ num = nm_setting_ip_config_get_num_dns (s_ip6);
if (num > 0) {
const char *dns_servers = ifnet_get_data (conn_name, "dns_servers");
gchar *tmp;
if (!dns_servers)
dns_servers = "";
for (i = 0; i < num; i++) {
- dns = nm_setting_ip6_config_get_dns (s_ip6, i);
+ dns = nm_setting_ip_config_get_dns (s_ip6, i);
if (!strstr (dns_servers, dns))
g_string_append_printf (dns_string, "%s ", dns);
} else
/* DNS Searches */
- num = nm_setting_ip6_config_get_num_dns_searches (s_ip6);
+ num = nm_setting_ip_config_get_num_dns_searches (s_ip6);
if (num > 0) {
const char *ip4_domains;
const gchar *search = NULL;
search =
- nm_setting_ip6_config_get_dns_search (s_ip6, i);
+ nm_setting_ip_config_get_dns_search (s_ip6, i);
if (search && !strstr (searches->str, search)) {
if (searches->len > 0)
g_string_append_c (searches, ' ');
GError **error)
{
NMSettingConnection *s_con;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
gboolean success = FALSE;
const char *type;
gboolean no_8021x = FALSE;
}
void
-set_ip4_dns_servers (NMSettingIP4Config *s_ip4, const char *conn_name)
+set_ip4_dns_servers (NMSettingIPConfig *s_ip4, const char *conn_name)
{
const char *dns_servers;
gchar **server_list, *stripped;
length = g_strv_length (server_list);
if (length)
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS,
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS,
TRUE, NULL);
for (i = 0; i < length; i++) {
g_strstrip (server_list[i]);
nm_log_warn (LOGD_SETTINGS, "ignored dns: %s\n", server_list[i]);
continue;
}
- if (!nm_setting_ip4_config_add_dns (s_ip4, server_list[i]))
+ if (!nm_setting_ip_config_add_dns (s_ip4, server_list[i]))
nm_log_warn (LOGD_SETTINGS, "warning: duplicate DNS server %s", server_list[i]);
}
g_strfreev (server_list);
}
void
-set_ip6_dns_servers (NMSettingIP6Config *s_ip6, const char *conn_name)
+set_ip6_dns_servers (NMSettingIPConfig *s_ip6, const char *conn_name)
{
const char *dns_servers;
gchar **server_list, *stripped;
length = g_strv_length (server_list);
if (length)
- g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS,
+ g_object_set (s_ip6, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS,
TRUE, NULL);
for (i = 0; i < length; i++) {
g_strstrip (server_list[i]);
nm_log_warn (LOGD_SETTINGS, "ignored dns: %s\n", server_list[i]);
continue;
}
- if (!nm_setting_ip6_config_add_dns (s_ip6, server_list[i]))
+ if (!nm_setting_ip_config_add_dns (s_ip6, server_list[i]))
nm_log_warn (LOGD_SETTINGS, "warning: duplicate DNS server %s", server_list[i]);
}
g_strfreev (server_list);
ip_block *convert_ip6_routes_block (const char *conn_name);
void destroy_ip_block (ip_block * iblock);
-void set_ip4_dns_servers (NMSettingIP4Config * s_ip4, const char *conn_name);
-void set_ip6_dns_servers (NMSettingIP6Config * s_ip6, const char *conn_name);
+void set_ip4_dns_servers (NMSettingIPConfig * s_ip4, const char *conn_name);
+void set_ip6_dns_servers (NMSettingIPConfig * s_ip6, const char *conn_name);
gchar *strip_string (gchar *str, gchar t);
gboolean is_managed (const char *conn_name);
}
static void
-ifupdown_ip4_add_dns (NMSettingIP4Config *s_ip4, const char *dns)
+ifupdown_ip4_add_dns (NMSettingIPConfig *s_ip4, const char *dns)
{
guint32 addr;
char **list, **iter;
continue;
}
- if (!nm_setting_ip4_config_add_dns (s_ip4, *iter))
+ if (!nm_setting_ip_config_add_dns (s_ip4, *iter))
nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter);
}
g_strfreev (list);
GError **error)
{
- NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new());
+ NMSettingIPConfig *s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new());
const char *type = ifparser_getkey(block, "inet");
gboolean is_static = type && !strcmp("static", type);
if (!is_static) {
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
} else {
guint32 tmp_mask;
NMIPAddress *addr;
if (!addr)
goto error;
- if (nm_setting_ip4_config_add_address (s_ip4, addr)) {
+ if (nm_setting_ip_config_add_address (s_ip4, addr)) {
nm_log_info (LOGD_SETTINGS, "addresses count: %d",
- nm_setting_ip4_config_get_num_addresses (s_ip4));
+ nm_setting_ip_config_get_num_addresses (s_ip4));
} else {
nm_log_info (LOGD_SETTINGS, "ignoring duplicate IP4 address");
}
nameservers_v = ifparser_getkey (block, "dns-nameservers");
ifupdown_ip4_add_dns (s_ip4, nameservers_v);
- if (!nm_setting_ip4_config_get_num_dns (s_ip4))
+ if (!nm_setting_ip_config_get_num_dns (s_ip4))
nm_log_info (LOGD_SETTINGS, "No dns-nameserver configured in /etc/network/interfaces");
/* DNS searches */
g_strstrip (*iter);
if (g_ascii_isspace (*iter[0]))
continue;
- if (!nm_setting_ip4_config_add_dns_search (s_ip4, *iter))
+ if (!nm_setting_ip_config_add_dns_search (s_ip4, *iter))
nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter);
}
g_strfreev (list);
}
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
}
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
}
static void
-ifupdown_ip6_add_dns (NMSettingIP6Config *s_ip6, const char *dns)
+ifupdown_ip6_add_dns (NMSettingIPConfig *s_ip6, const char *dns)
{
struct in6_addr addr;
char **list, **iter;
continue;
}
- if (!nm_setting_ip6_config_add_dns (s_ip6, *iter))
+ if (!nm_setting_ip_config_add_dns (s_ip6, *iter))
nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter);
}
g_strfreev (list);
if_block *block,
GError **error)
{
- NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new());
+ NMSettingIPConfig *s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new());
const char *type = ifparser_getkey(block, "inet6");
gboolean is_static = type && (!strcmp("static", type) ||
!strcmp("v4tunnel", type));
if (!is_static) {
- g_object_set(s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
+ g_object_set(s_ip6, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
} else {
NMIPAddress *addr;
const char *address_v;
if (!addr)
goto error;
- if (nm_setting_ip6_config_add_address (s_ip6, addr)) {
+ if (nm_setting_ip_config_add_address (s_ip6, addr)) {
nm_log_info (LOGD_SETTINGS, "addresses count: %d",
- nm_setting_ip6_config_get_num_addresses (s_ip6));
+ nm_setting_ip_config_get_num_addresses (s_ip6));
} else {
nm_log_info (LOGD_SETTINGS, "ignoring duplicate IP6 address");
}
nameservers_v = ifparser_getkey(block, "dns-nameservers");
ifupdown_ip6_add_dns (s_ip6, nameservers_v);
- if (!nm_setting_ip6_config_get_num_dns (s_ip6))
+ if (!nm_setting_ip_config_get_num_dns (s_ip6))
nm_log_info (LOGD_SETTINGS, "No dns-nameserver configured in /etc/network/interfaces");
/* DNS searches */
g_strstrip (*iter);
if (isblank (*iter[0]))
continue;
- if (!nm_setting_ip6_config_add_dns_search (s_ip6, *iter))
+ if (!nm_setting_ip_config_add_dns_search (s_ip6, *iter))
nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter);
}
g_strfreev (list);
}
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
NULL);
}
{
NMConnection *connection;
NMSettingConnection *s_con;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSettingWired *s_wired;
char *unmanaged = NULL;
GError *error = NULL;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0,
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* IP addresses */
- ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1,
+ ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 1,
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_ADDRESSES);
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert (ip4_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "10.0.0.3");
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 8);
/* DNS Addresses */
- ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2,
+ ASSERT (nm_setting_ip_config_get_num_dns (s_ip4) == 2,
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (!strcmp (nm_setting_ip4_config_get_dns (s_ip4, 0), "10.0.0.1"),
+ ASSERT (!strcmp (nm_setting_ip_config_get_dns (s_ip4, 0), "10.0.0.1"),
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value #1",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (!strcmp (nm_setting_ip4_config_get_dns (s_ip4, 1), "10.0.0.2"),
+ ASSERT (!strcmp (nm_setting_ip_config_get_dns (s_ip4, 1), "10.0.0.2"),
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value #2",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1,
+ ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 1,
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
/* DNS search domains */
- ASSERT (nm_setting_ip4_config_get_num_dns_searches (s_ip4) == 2,
+ ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip4) == 2,
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 0);
+ tmp = nm_setting_ip_config_get_dns_search (s_ip4, 0);
ASSERT (tmp != NULL,
TEST17_NAME, "failed to verify %s: missing %s / %s key",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
ASSERT (strcmp (tmp, expected_search1) == 0,
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
- tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 1);
+ tmp = nm_setting_ip_config_get_dns_search (s_ip4, 1);
ASSERT (tmp != NULL,
TEST17_NAME, "failed to verify %s: missing %s / %s key",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
ASSERT (strcmp (tmp, expected_search2) == 0,
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
g_object_unref (connection);
}
{
NMConnection *connection;
NMSettingConnection *s_con;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
NMSettingWired *s_wired;
char *unmanaged = NULL;
GError *error = NULL;
NM_SETTING_IP6_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip6_config_get_method (s_ip6);
+ tmp = nm_setting_ip_config_get_method (s_ip6);
ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0,
TEST18_NAME,
"failed to verify %s: unexpected %s / %s key value",
file,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* IP addresses */
- ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1,
+ ASSERT (nm_setting_ip_config_get_num_addresses (s_ip6) == 1,
TEST18_NAME,
"failed to verify %s: unexpected number of %s / %s",
file,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_ADDRESSES);
- ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0);
+ ip6_addr = nm_setting_ip_config_get_address (s_ip6, 0);
g_assert (ip6_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "fc00::1");
g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 64);
/* DNS Addresses */
- ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 2,
+ ASSERT (nm_setting_ip_config_get_num_dns (s_ip6) == 2,
TEST18_NAME,
"failed to verify %s: unexpected number of %s / %s values",
file,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (!strcmp (nm_setting_ip6_config_get_dns (s_ip6, 0), "fc00::2"),
+ ASSERT (!strcmp (nm_setting_ip_config_get_dns (s_ip6, 0), "fc00::2"),
TEST18_NAME,
"failed to verify %s: unexpected %s / %s #1",
file,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (!strcmp (nm_setting_ip6_config_get_dns (s_ip6, 1), "fc00::3"),
+ ASSERT (!strcmp (nm_setting_ip_config_get_dns (s_ip6, 1), "fc00::3"),
TEST18_NAME, "failed to verify %s: unexpected %s / %s #2",
file,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
/* DNS search domains */
- ASSERT (nm_setting_ip6_config_get_num_dns_searches (s_ip6) == 2,
+ ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip6) == 2,
TEST18_NAME,
"failed to verify %s: unexpected number of %s / %s values",
file,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
- tmp = nm_setting_ip6_config_get_dns_search (s_ip6, 0);
+ tmp = nm_setting_ip_config_get_dns_search (s_ip6, 0);
ASSERT (tmp != NULL,
"wired-ipv6-manual-verify-ip6",
"failed to verify %s: missing %s / %s #1",
file,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
ASSERT (strcmp (tmp, expected_search1) == 0,
"wired-ipv6-manual-verify-ip6",
"failed to verify %s: unexpected %s / %s #1",
file,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
- tmp = nm_setting_ip6_config_get_dns_search (s_ip6, 1);
+ tmp = nm_setting_ip_config_get_dns_search (s_ip6, 1);
ASSERT (tmp != NULL,
TEST18_NAME,
"failed to verify %s: missing %s / %s #2",
file,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
ASSERT (strcmp (tmp, expected_search2) == 0,
TEST18_NAME,
"failed to verify %s: unexpected %s / %s #2",
file,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
g_free (unmanaged);
g_object_unref (connection);
test19_read_static_ipv4_plen (const char *path)
{
NMConnection *connection;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *unmanaged = NULL;
GError *error = NULL;
NMIPAddress *ip4_addr;
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* IP addresses */
- ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1,
+ ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 1,
TEST19_NAME, "failed to verify %s: unexpected %s / %s key value",
file,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_ADDRESSES);
+ NM_SETTING_IP_CONFIG_ADDRESSES);
- ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
+ ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
g_assert (ip4_addr != NULL);
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "10.0.0.3");
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 8);
TRUE,
mac_address_parser_ETHER },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_ADDRESSES,
+ NM_SETTING_IP_CONFIG_ADDRESSES,
FALSE,
ip_address_or_route_parser },
{ NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_ADDRESSES,
+ NM_SETTING_IP_CONFIG_ADDRESSES,
FALSE,
ip_address_or_route_parser },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_ROUTES,
+ NM_SETTING_IP_CONFIG_ROUTES,
FALSE,
ip_address_or_route_parser },
{ NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_ROUTES,
+ NM_SETTING_IP_CONFIG_ROUTES,
FALSE,
ip_address_or_route_parser },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS,
+ NM_SETTING_IP_CONFIG_DNS,
FALSE,
ip4_dns_parser },
{ NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS,
+ NM_SETTING_IP_CONFIG_DNS,
FALSE,
ip6_dns_parser },
{ NM_SETTING_WIRED_SETTING_NAME,
#define TEST_WIRELESS_FILE TEST_KEYFILES_DIR"/Test_Wireless_Connection"
static void
-check_ip4_address (NMSettingIP4Config *config, int idx, const char *address, int plen, const char *gateway)
+check_ip_address (NMSettingIPConfig *config, int idx, const char *address, int plen, const char *gateway)
{
- NMIPAddress *ip4 = nm_setting_ip4_config_get_address (config, idx);
+ NMIPAddress *ip4 = nm_setting_ip_config_get_address (config, idx);
g_assert (ip4);
g_assert_cmpstr (nm_ip_address_get_address (ip4), ==, address);
}
static void
-check_ip6_address (NMSettingIP6Config *config, int idx, const char *address, int plen, const char *gateway)
+check_ip_route (NMSettingIPConfig *config, int idx, const char *destination, int plen,
+ const char *next_hop, int metric)
{
- NMIPAddress *ip6 = nm_setting_ip6_config_get_address (config, idx);
-
- g_assert (ip6);
- g_assert_cmpstr (nm_ip_address_get_address (ip6), ==, address);
- g_assert_cmpint (nm_ip_address_get_prefix (ip6), ==, plen);
- g_assert_cmpstr (nm_ip_address_get_gateway (ip6), ==, gateway);
-}
-
-static void
-check_ip4_route (NMSettingIP4Config *config, int idx, const char *destination, int plen,
- const char *next_hop, int metric)
-{
- NMIPRoute *route = nm_setting_ip4_config_get_route (config, idx);
-
- g_assert (route);
- g_assert_cmpstr (nm_ip_route_get_dest (route), ==, destination);
- g_assert_cmpint (nm_ip_route_get_prefix (route), ==, plen);
- g_assert_cmpstr (nm_ip_route_get_next_hop (route), ==, next_hop);
- g_assert_cmpint (nm_ip_route_get_metric (route), ==, metric);
-}
-
-static void
-check_ip6_route (NMSettingIP6Config *config, int idx, const char *destination, int plen,
- const char *next_hop, int metric)
-{
- NMIPRoute *route = nm_setting_ip6_config_get_route (config, idx);
+ NMIPRoute *route = nm_setting_ip_config_get_route (config, idx);
g_assert (route);
g_assert_cmpstr (nm_ip_route_get_dest (route), ==, destination);
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
GError *error = NULL;
const char *mac;
char expected_mac_address[ETH_ALEN] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* DNS Addresses */
- ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2,
+ ASSERT (nm_setting_ip_config_get_num_dns (s_ip4) == 2,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 0), "4.2.2.1") == 0,
+ ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 0), "4.2.2.1") == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #1",
TEST_WIRED_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 1), "4.2.2.2") == 0,
+ ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 1), "4.2.2.2") == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #2",
TEST_WIRED_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
/* IPv4 addresses */
- g_assert (nm_setting_ip4_config_get_num_addresses (s_ip4) == 6);
- check_ip4_address (s_ip4, 0, "2.3.4.5", 24, "2.3.4.6");
- check_ip4_address (s_ip4, 1, "192.168.0.5", 24, "192.168.0.1");
- check_ip4_address (s_ip4, 2, "1.2.3.4", 16, "1.2.1.1");
- check_ip4_address (s_ip4, 3, "3.4.5.6", 16, NULL);
- check_ip4_address (s_ip4, 4, "4.5.6.7", 24, "1.2.3.4");
- check_ip4_address (s_ip4, 5, "5.6.7.8", 24, NULL);
+ g_assert (nm_setting_ip_config_get_num_addresses (s_ip4) == 6);
+ check_ip_address (s_ip4, 0, "2.3.4.5", 24, "2.3.4.6");
+ check_ip_address (s_ip4, 1, "192.168.0.5", 24, "192.168.0.1");
+ check_ip_address (s_ip4, 2, "1.2.3.4", 16, "1.2.1.1");
+ check_ip_address (s_ip4, 3, "3.4.5.6", 16, NULL);
+ check_ip_address (s_ip4, 4, "4.5.6.7", 24, "1.2.3.4");
+ check_ip_address (s_ip4, 5, "5.6.7.8", 24, NULL);
/* IPv4 routes */
- g_assert (nm_setting_ip4_config_get_num_routes (s_ip4) == 12);
- check_ip4_route (s_ip4, 0, "5.6.7.8", 32, NULL, 0);
- check_ip4_route (s_ip4, 1, "1.2.3.0", 24, "2.3.4.8", 99);
- check_ip4_route (s_ip4, 2, "1.1.1.2", 12, NULL, 0);
- check_ip4_route (s_ip4, 3, "1.1.1.3", 13, NULL, 0);
- check_ip4_route (s_ip4, 4, "1.1.1.4", 14, "2.2.2.4", 0);
- check_ip4_route (s_ip4, 5, "1.1.1.5", 15, "2.2.2.5", 0);
- check_ip4_route (s_ip4, 6, "1.1.1.6", 16, "2.2.2.6", 0);
- check_ip4_route (s_ip4, 7, "1.1.1.7", 17, NULL, 0);
- check_ip4_route (s_ip4, 8, "1.1.1.8", 18, NULL, 0);
- check_ip4_route (s_ip4, 9, "1.1.1.9", 19, NULL, 0);
- check_ip4_route (s_ip4, 10, "1.1.1.10", 20, NULL, 0);
- check_ip4_route (s_ip4, 11, "1.1.1.11", 21, NULL, 21);
+ g_assert (nm_setting_ip_config_get_num_routes (s_ip4) == 12);
+ check_ip_route (s_ip4, 0, "5.6.7.8", 32, NULL, 0);
+ check_ip_route (s_ip4, 1, "1.2.3.0", 24, "2.3.4.8", 99);
+ check_ip_route (s_ip4, 2, "1.1.1.2", 12, NULL, 0);
+ check_ip_route (s_ip4, 3, "1.1.1.3", 13, NULL, 0);
+ check_ip_route (s_ip4, 4, "1.1.1.4", 14, "2.2.2.4", 0);
+ check_ip_route (s_ip4, 5, "1.1.1.5", 15, "2.2.2.5", 0);
+ check_ip_route (s_ip4, 6, "1.1.1.6", 16, "2.2.2.6", 0);
+ check_ip_route (s_ip4, 7, "1.1.1.7", 17, NULL, 0);
+ check_ip_route (s_ip4, 8, "1.1.1.8", 18, NULL, 0);
+ check_ip_route (s_ip4, 9, "1.1.1.9", 19, NULL, 0);
+ check_ip_route (s_ip4, 10, "1.1.1.10", 20, NULL, 0);
+ check_ip_route (s_ip4, 11, "1.1.1.11", 21, NULL, 21);
/* ===== IPv6 SETTING ===== */
NM_SETTING_IP6_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip6_config_get_method (s_ip6);
+ tmp = nm_setting_ip_config_get_method (s_ip6);
ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* DNS Addresses */
- ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 2,
+ ASSERT (nm_setting_ip_config_get_num_dns (s_ip6) == 2,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (strcmp (nm_setting_ip6_config_get_dns (s_ip6, 0), "1111:dddd::aaaa") == 0,
+ ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip6, 0), "1111:dddd::aaaa") == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #1",
TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
- ASSERT (strcmp (nm_setting_ip6_config_get_dns (s_ip6, 1), "1::cafe") == 0,
+ ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip6, 1), "1::cafe") == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #2",
TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
/* DNS Searches */
- ASSERT (nm_setting_ip6_config_get_num_dns_searches (s_ip6) == 3,
+ ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip6) == 3,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
- ASSERT (!strcmp (nm_setting_ip6_config_get_dns_search (s_ip6, 0), expected6_dnssearch1),
+ ASSERT (!strcmp (nm_setting_ip_config_get_dns_search (s_ip6, 0), expected6_dnssearch1),
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #1",
TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS_SEARCH);
- ASSERT (!strcmp (nm_setting_ip6_config_get_dns_search (s_ip6, 1), expected6_dnssearch2),
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
+ ASSERT (!strcmp (nm_setting_ip_config_get_dns_search (s_ip6, 1), expected6_dnssearch2),
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #2",
TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS_SEARCH);
- ASSERT (!strcmp (nm_setting_ip6_config_get_dns_search (s_ip6, 2), expected6_dnssearch3),
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
+ ASSERT (!strcmp (nm_setting_ip_config_get_dns_search (s_ip6, 2), expected6_dnssearch3),
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #3",
TEST_WIRED_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS_SEARCH);
+ NM_SETTING_IP_CONFIG_DNS_SEARCH);
/* IPv6 addresses */
- g_assert (nm_setting_ip6_config_get_num_addresses (s_ip6) == 10);
- check_ip6_address (s_ip6, 0, "2:3:4:5:6:7:8:9", 64, "2:3:4:5:1:2:3:4");
- check_ip6_address (s_ip6, 1, "abcd:1234:ffff::cdde", 64, NULL);
- check_ip6_address (s_ip6, 2, "1:2:3:4:5:6:7:8", 96, NULL);
- check_ip6_address (s_ip6, 3, "3:4:5:6:7:8:9:0", 128, NULL);
- check_ip6_address (s_ip6, 4, "3:4:5:6:7:8:9:14", 64, NULL);
- check_ip6_address (s_ip6, 5, "3:4:5:6:7:8:9:15", 64, NULL);
- check_ip6_address (s_ip6, 6, "3:4:5:6:7:8:9:16", 66, NULL);
- check_ip6_address (s_ip6, 7, "3:4:5:6:7:8:9:17", 67, NULL);
- check_ip6_address (s_ip6, 8, "3:4:5:6:7:8:9:18", 68, NULL);
- check_ip6_address (s_ip6, 9, "3:4:5:6:7:8:9:19", 69, "1::9");
+ g_assert (nm_setting_ip_config_get_num_addresses (s_ip6) == 10);
+ check_ip_address (s_ip6, 0, "2:3:4:5:6:7:8:9", 64, "2:3:4:5:1:2:3:4");
+ check_ip_address (s_ip6, 1, "abcd:1234:ffff::cdde", 64, NULL);
+ check_ip_address (s_ip6, 2, "1:2:3:4:5:6:7:8", 96, NULL);
+ check_ip_address (s_ip6, 3, "3:4:5:6:7:8:9:0", 128, NULL);
+ check_ip_address (s_ip6, 4, "3:4:5:6:7:8:9:14", 64, NULL);
+ check_ip_address (s_ip6, 5, "3:4:5:6:7:8:9:15", 64, NULL);
+ check_ip_address (s_ip6, 6, "3:4:5:6:7:8:9:16", 66, NULL);
+ check_ip_address (s_ip6, 7, "3:4:5:6:7:8:9:17", 67, NULL);
+ check_ip_address (s_ip6, 8, "3:4:5:6:7:8:9:18", 68, NULL);
+ check_ip_address (s_ip6, 9, "3:4:5:6:7:8:9:19", 69, "1::9");
/* Route #1 */
- g_assert (nm_setting_ip6_config_get_num_routes (s_ip6) == 7);
- check_ip6_route (s_ip6, 0, "d:e:f:0:1:2:3:4", 64, "f:e:d:c:1:2:3:4", 0);
- check_ip6_route (s_ip6, 1, "a:b:c:d::", 64, "f:e:d:c:1:2:3:4", 99);
- check_ip6_route (s_ip6, 2, "8:7:6:5:4:3:2:1", 128, NULL, 0);
- check_ip6_route (s_ip6, 3, "6:7:8:9:0:1:2:3", 126, NULL, 1);
- check_ip6_route (s_ip6, 4, "7:8:9:0:1:2:3:4", 125, NULL, 5);
- check_ip6_route (s_ip6, 5, "8:9:0:1:2:3:4:5", 124, NULL, 6);
- check_ip6_route (s_ip6, 6, "8:9:0:1:2:3:4:6", 123, NULL, 0);
+ g_assert (nm_setting_ip_config_get_num_routes (s_ip6) == 7);
+ check_ip_route (s_ip6, 0, "d:e:f:0:1:2:3:4", 64, "f:e:d:c:1:2:3:4", 0);
+ check_ip_route (s_ip6, 1, "a:b:c:d::", 64, "f:e:d:c:1:2:3:4", 99);
+ check_ip_route (s_ip6, 2, "8:7:6:5:4:3:2:1", 128, NULL, 0);
+ check_ip_route (s_ip6, 3, "6:7:8:9:0:1:2:3", 126, NULL, 1);
+ check_ip_route (s_ip6, 4, "7:8:9:0:1:2:3:4", 125, NULL, 5);
+ check_ip_route (s_ip6, 5, "8:9:0:1:2:3:4:5", 124, NULL, 6);
+ check_ip_route (s_ip6, 6, "8:9:0:1:2:3:4:6", 123, NULL, 0);
g_object_unref (connection);
}
static void
-add_one_ip4_address (NMSettingIP4Config *s_ip4,
- const char *addr,
- const char *gw,
- guint32 prefix)
-{
- NMIPAddress *ip4_addr;
- GError *error = NULL;
-
- ip4_addr = nm_ip_address_new (AF_INET, addr, prefix, gw, &error);
- g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, ip4_addr);
- nm_ip_address_unref (ip4_addr);
-}
-
-static void
-add_one_ip4_route (NMSettingIP4Config *s_ip4,
- const char *dest,
- const char *nh,
- guint32 prefix,
- guint32 metric)
-{
- NMIPRoute *route;
- GError *error = NULL;
-
- route = nm_ip_route_new (AF_INET, dest, prefix, nh, metric, &error);
- g_assert_no_error (error);
- nm_setting_ip4_config_add_route (s_ip4, route);
- nm_ip_route_unref (route);
-}
-
-static void
-add_one_ip6_address (NMSettingIP6Config *s_ip6,
- const char *addr,
- guint32 prefix,
- const char *gw)
+add_one_ip_address (NMSettingIPConfig *s_ip,
+ const char *addr,
+ guint32 prefix,
+ const char *gw)
{
- NMIPAddress *ip6_addr;
+ NMIPAddress *ip_addr;
GError *error = NULL;
- ip6_addr = nm_ip_address_new (AF_INET6, addr, prefix, gw, &error);
+ ip_addr = nm_ip_address_new (NM_IS_SETTING_IP4_CONFIG (s_ip) ? AF_INET : AF_INET6,
+ addr, prefix, gw, &error);
g_assert_no_error (error);
- nm_setting_ip6_config_add_address (s_ip6, ip6_addr);
- nm_ip_address_unref (ip6_addr);
+ nm_setting_ip_config_add_address (s_ip, ip_addr);
+ nm_ip_address_unref (ip_addr);
}
static void
-add_one_ip6_route (NMSettingIP6Config *s_ip6,
- const char *dest,
- const char *nh,
- guint32 prefix,
- guint32 metric)
+add_one_ip_route (NMSettingIPConfig *s_ip,
+ const char *dest,
+ const char *nh,
+ guint32 prefix,
+ guint32 metric)
{
NMIPRoute *route;
GError *error = NULL;
- route = nm_ip_route_new (AF_INET6, dest, prefix, nh, metric, &error);
+ route = nm_ip_route_new (NM_IS_SETTING_IP4_CONFIG (s_ip) ? AF_INET : AF_INET6,
+ dest, prefix, nh, metric, &error);
g_assert_no_error (error);
- nm_setting_ip6_config_add_route (s_ip6, route);
+ nm_setting_ip_config_add_route (s_ip, route);
nm_ip_route_unref (route);
}
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
const char *mac = "99:88:77:66:55:44";
gboolean success;
/* IP4 setting */
- s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
+ s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
NULL);
/* Addresses */
- add_one_ip4_address (s_ip4, address1, address1_gw, 24);
- add_one_ip4_address (s_ip4, address2, address2_gw, 8);
+ add_one_ip_address (s_ip4, address1, 24, address1_gw);
+ add_one_ip_address (s_ip4, address2, 8, address2_gw);
/* Routes */
- add_one_ip4_route (s_ip4, route1, route1_nh, 24, 3);
- add_one_ip4_route (s_ip4, route2, route2_nh, 8, 1);
- add_one_ip4_route (s_ip4, route3, route3_nh, 7, 0);
- add_one_ip4_route (s_ip4, route4, route4_nh, 6, 4);
+ add_one_ip_route (s_ip4, route1, route1_nh, 24, 3);
+ add_one_ip_route (s_ip4, route2, route2_nh, 8, 1);
+ add_one_ip_route (s_ip4, route3, route3_nh, 7, 0);
+ add_one_ip_route (s_ip4, route4, route4_nh, 6, 4);
/* DNS servers */
- nm_setting_ip4_config_add_dns (s_ip4, dns1);
- nm_setting_ip4_config_add_dns (s_ip4, dns2);
+ nm_setting_ip_config_add_dns (s_ip4, dns1);
+ nm_setting_ip_config_add_dns (s_ip4, dns2);
/* IP6 setting */
- s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ());
+ s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
NULL);
/* Addresses */
- add_one_ip6_address (s_ip6, address6_1, 64, NULL);
- add_one_ip6_address (s_ip6, address6_2, 56, NULL);
+ add_one_ip_address (s_ip6, address6_1, 64, NULL);
+ add_one_ip_address (s_ip6, address6_2, 56, NULL);
/* Routes */
- add_one_ip6_route (s_ip6, route6_1, route6_1_nh, 64, 3);
- add_one_ip6_route (s_ip6, route6_2, route6_2_nh, 56, 1);
- add_one_ip6_route (s_ip6, route6_3, route6_3_nh, 63, 5);
- add_one_ip6_route (s_ip6, route6_4, route6_4_nh, 62, 0);
+ add_one_ip_route (s_ip6, route6_1, route6_1_nh, 64, 3);
+ add_one_ip_route (s_ip6, route6_2, route6_2_nh, 56, 1);
+ add_one_ip_route (s_ip6, route6_3, route6_3_nh, 63, 5);
+ add_one_ip_route (s_ip6, route6_4, route6_4_nh, 62, 0);
/* DNS servers */
- nm_setting_ip6_config_add_dns (s_ip6, dns6_1);
- nm_setting_ip6_config_add_dns (s_ip6, dns6_2);
+ nm_setting_ip_config_add_dns (s_ip6, dns6_1);
+ nm_setting_ip_config_add_dns (s_ip6, dns6_2);
/* DNS searches */
- nm_setting_ip6_config_add_dns_search (s_ip6, "wallaceandgromit.com");
+ nm_setting_ip_config_add_dns_search (s_ip6, "wallaceandgromit.com");
/* Write out the connection */
owner_uid = geteuid ();
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
GError *error = NULL;
const char *tmp;
const char *expected_id = "Test Wired Connection IP6";
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_IP6_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
- ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 0,
+ ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_IP6_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS);
+ NM_SETTING_IP_CONFIG_DNS);
/* ===== IPv6 SETTING ===== */
NM_SETTING_IP6_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip6_config_get_method (s_ip6);
+ tmp = nm_setting_ip_config_get_method (s_ip6);
ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0,
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRED_IP6_FILE,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
/* IPv6 address */
- g_assert (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1);
- check_ip6_address (s_ip6, 0, "abcd:1234:ffff::cdde", 64, "abcd:1234:ffff::cdd1");
+ g_assert (nm_setting_ip_config_get_num_addresses (s_ip6) == 1);
+ check_ip_address (s_ip6, 0, "abcd:1234:ffff::cdde", 64, "abcd:1234:ffff::cdd1");
g_object_unref (connection);
}
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
NMConnection *reread;
/* IP4 setting */
- s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
+ s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
NULL);
/* IP6 setting */
- s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ());
+ s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
NULL);
/* Addresses */
- add_one_ip6_address (s_ip6, address, 64, gw);
+ add_one_ip_address (s_ip6, address, 64, gw);
/* DNS servers */
- nm_setting_ip6_config_add_dns (s_ip6, dns);
+ nm_setting_ip_config_add_dns (s_ip6, dns);
/* DNS searches */
- nm_setting_ip6_config_add_dns_search (s_ip6, "wallaceandgromit.com");
+ nm_setting_ip_config_add_dns_search (s_ip6, "wallaceandgromit.com");
/* Write out the connection */
owner_uid = geteuid ();
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWireless *s_wireless;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
GError *error = NULL;
const char *bssid;
const guint8 expected_bssid[ETH_ALEN] = { 0x00, 0x1a, 0x33, 0x44, 0x99, 0x82 };
NM_SETTING_IP4_CONFIG_SETTING_NAME);
/* Method */
- tmp = nm_setting_ip4_config_get_method (s_ip4);
+ tmp = nm_setting_ip_config_get_method (s_ip4);
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
"connection-verify-wireless", "failed to verify %s: unexpected %s / %s key value",
TEST_WIRELESS_FILE,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_METHOD);
+ NM_SETTING_IP_CONFIG_METHOD);
g_object_unref (connection);
}
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWireless *s_wireless;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
const char *bssid = "aa:b9:a1:74:55:44";
GBytes *ssid;
/* IP4 setting */
- s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
+ s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
/* IP6 setting */
- s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ());
+ s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
NULL);
/* Write out the connection */
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWireless *s_wireless;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *uuid, *testfile = NULL, *tmp;
GBytes *ssid;
unsigned char tmpssid[] = { 65, 49, 50, 51, 32, 46, 92, 46, 36, 37, 126, 93 };
/* IP4 setting */
- s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
+ s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
/* Write out the connection */
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *uuid, *testfile = NULL;
GBytes *ssid;
unsigned char tmpssid[] = { 65, 49, 50, 51, 0, 50, 50 };
g_bytes_unref (ssid);
/* IP4 setting */
- s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
+ s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* Write out the connection */
owner_uid = geteuid ();
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *uuid, *testfile = NULL;
GBytes *ssid;
unsigned char tmpssid[] = { 49, 48, 49 };
g_bytes_unref (ssid);
/* IP4 setting */
- s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
+ s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* Write out the connection */
owner_uid = geteuid ();
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
char *uuid, *testfile = NULL;
GBytes *ssid;
unsigned char tmpssid[] = { 49, 49, 59, 49, 50, 59, 49, 51, 59};
g_bytes_unref (ssid);
/* IP4 setting */
- s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
+ s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* Write out the connection */
owner_uid = geteuid ();
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingBluetooth *s_bt;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSettingGsm *s_gsm;
char *uuid;
const char *bdaddr = "aa:b9:a1:74:55:44";
/* IP4 setting */
- s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
+ s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
/* GSM setting */
{
NMConnection *connection;
NMSettingConnection *s_con;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSettingGsm *s_gsm;
char *uuid;
gboolean success;
/* IP4 setting */
- s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
+ s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
/* GSM setting */
{
NMConnection *connection;
NMSettingConnection *s_con;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSetting *s_wired;
NMSetting8021x *s_8021x;
char *uuid;
g_free (uuid);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
/* Wired setting */
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingInfiniband *s_ib;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
const char *mac = "99:88:77:66:55:44:ab:bc:cd:de:ef:f0:0a:1b:2c:3d:4e:5f:6f:ba";
gboolean success;
NULL);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
- g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip6, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
/* Write out the connection */
owner_uid = geteuid ();
{
NMConnection *connection;
NMSettingConnection *s_con;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSettingBridge *s_bridge;
GError *error = NULL;
const char *expected_id = "Test Bridge Main";
/* IPv4 setting */
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4);
- g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
+ g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
/* Bridge setting */
s_bridge = nm_connection_get_setting_bridge (connection);
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingBridge *s_bridge;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
NMConnection *reread;
nm_connection_add_setting (connection, NM_SETTING (s_bridge));
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_assert (s_ip4);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
- NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
- add_one_ip4_address (s_ip4, "1.2.3.4", "1.1.1.1", 24);
+ add_one_ip_address (s_ip4, "1.2.3.4", 24, "1.1.1.1");
/* IP6 setting */
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_assert (s_ip6);
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
- g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip6, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
/* Write out the connection */
owner_uid = geteuid ();
test_read_enum_property (void)
{
NMConnection *connection;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
GError *error = NULL;
gboolean success;
/* IPv6 setting */
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6);
- g_assert_cmpint (nm_setting_ip6_config_get_ip6_privacy (s_ip6), ==, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR);
+ g_assert_cmpint (nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6)), ==, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR);
g_object_unref (connection);
}
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
char *uuid;
gboolean success;
NMConnection *reread;
nm_connection_add_setting (connection, NM_SETTING (s_wired));
/* IP6 setting */
- s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ());
+ s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
NM_SETTING_IP6_CONFIG_IP6_PRIVACY, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR,
NULL);
NM_SETTING_CONNECTION_TYPE,
setting_alias_writer },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_ADDRESSES,
+ NM_SETTING_IP_CONFIG_ADDRESSES,
addr_writer },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
"address-labels",
ip4_addr_label_writer },
{ NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_ADDRESSES,
+ NM_SETTING_IP_CONFIG_ADDRESSES,
addr_writer },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_ROUTES,
+ NM_SETTING_IP_CONFIG_ROUTES,
route_writer },
{ NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_ROUTES,
+ NM_SETTING_IP_CONFIG_ROUTES,
route_writer },
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
- NM_SETTING_IP4_CONFIG_DNS,
+ NM_SETTING_IP_CONFIG_DNS,
dns_writer },
{ NM_SETTING_IP6_CONFIG_SETTING_NAME,
- NM_SETTING_IP6_CONFIG_DNS,
+ NM_SETTING_IP_CONFIG_DNS,
dns_writer },
{ NM_SETTING_WIRELESS_SETTING_NAME,
NM_SETTING_WIRELESS_SSID,
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSupplicantConfig *config;
GHashTable *hash;
char *uuid;
g_bytes_unref (ssid);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
"wifi-open", "failed to verify connection: %s",
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSupplicantConfig *config;
GHashTable *hash;
char *uuid;
nm_setting_wireless_security_set_wep_key (s_wsec, 0, key_data);
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
detail, "failed to verify connection: %s",
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
NMSupplicantConfig *config;
GHashTable *hash;
char *uuid;
nm_setting_wireless_security_add_group (s_wsec, "ccmp");
/* IP4 setting */
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
ASSERT (nm_connection_verify (connection, &error) == TRUE,
detail, "failed to verify connection: %s",
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4, *s_ip6;
char *uuid;
connection = nm_simple_connection_new ();
s_wired = (NMSettingWired *) nm_setting_wired_new ();
nm_connection_add_setting (connection, (NMSetting *) s_wired);
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, (NMSetting *) s_ip4);
g_object_set (G_OBJECT (s_ip4),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
- s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, (NMSetting *) s_ip6);
g_object_set (G_OBJECT (s_ip6),
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
NULL);
return connection;
{
NMConnection *orig, *copy, *matched;
GSList *connections = NULL;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
orig = _match_connection_new ();
copy = nm_simple_connection_new_clone (orig);
s_ip4 = nm_connection_get_setting_ip4_config (orig);
g_assert (s_ip4);
g_object_set (G_OBJECT (s_ip4),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
NULL);
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
g_assert (matched == NULL);
{
NMConnection *orig, *copy, *matched;
GSList *connections = NULL;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
orig = _match_connection_new ();
copy = nm_simple_connection_new_clone (orig);
s_ip6 = nm_connection_get_setting_ip6_config (orig);
g_assert (s_ip6);
g_object_set (G_OBJECT (s_ip6),
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
NULL);
s_ip6 = nm_connection_get_setting_ip6_config (copy);
g_assert (s_ip6);
g_object_set (G_OBJECT (s_ip6),
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
- NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
{
NMConnection *orig, *copy, *matched;
GSList *connections = NULL;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
orig = _match_connection_new ();
copy = nm_simple_connection_new_clone (orig);
s_ip6 = nm_connection_get_setting_ip6_config (orig);
g_assert (s_ip6);
g_object_set (G_OBJECT (s_ip6),
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
NULL);
s_ip6 = nm_connection_get_setting_ip6_config (copy);
g_assert (s_ip6);
g_object_set (G_OBJECT (s_ip6),
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
NULL);
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
{
NMConnection *orig, *copy, *matched;
GSList *connections = NULL;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip6;
orig = _match_connection_new ();
copy = nm_simple_connection_new_clone (orig);
s_ip6 = nm_connection_get_setting_ip6_config (orig);
g_assert (s_ip6);
g_object_set (G_OBJECT (s_ip6),
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
NULL);
s_ip6 = nm_connection_get_setting_ip6_config (copy);
g_assert (s_ip6);
g_object_set (G_OBJECT (s_ip6),
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
NULL);
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
{
NMConnection *orig, *copy, *matched;
GSList *connections = NULL;
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
orig = _match_connection_new ();
copy = nm_simple_connection_new_clone (orig);
s_ip4 = nm_connection_get_setting_ip4_config (orig);
g_assert (s_ip4);
g_object_set (G_OBJECT (s_ip4),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
NULL);
s_ip4 = nm_connection_get_setting_ip4_config (copy);
g_assert (s_ip4);
g_object_set (G_OBJECT (s_ip4),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
- NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
matched = nm_utils_match_connection (connections, orig, FALSE, NULL, NULL);
{
NMConnection *orig, *copy, *matched;
GSList *connections = NULL;
- NMSettingIP4Config *s_ip4;
- NMSettingIP6Config *s_ip6;
+ NMSettingIPConfig *s_ip4, *s_ip6;
NMIPAddress *nm_addr;
GError *error = NULL;
s_ip6 = nm_connection_get_setting_ip6_config (orig);
g_assert (s_ip6);
g_object_set (G_OBJECT (s_ip6),
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
NULL);
s_ip6 = nm_connection_get_setting_ip6_config (copy);
g_assert (s_ip6);
g_object_set (G_OBJECT (s_ip6),
- NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
NULL);
s_ip4 = nm_connection_get_setting_ip4_config (orig);
g_assert (s_ip4);
g_object_set (G_OBJECT (s_ip4),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
NULL);
nm_addr = nm_ip_address_new (AF_INET, "1.1.1.4", 24, "1.1.1.254", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, nm_addr);
+ nm_setting_ip_config_add_address (s_ip4, nm_addr);
nm_ip_address_unref (nm_addr);
s_ip4 = nm_connection_get_setting_ip4_config (copy);
g_assert (s_ip4);
g_object_set (G_OBJECT (s_ip4),
- NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
NULL);
nm_addr = nm_ip_address_new (AF_INET, "2.2.2.4", 24, "2.2.2.254", &error);
g_assert_no_error (error);
- nm_setting_ip4_config_add_address (s_ip4, nm_addr);
+ nm_setting_ip_config_add_address (s_ip4, nm_addr);
nm_ip_address_unref (nm_addr);
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
#include <glib.h>
#include <string.h>
+#include <arpa/inet.h>
#include "NetworkManagerUtils.h"
#include "nm-ip4-config.h"