mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-07 00:31:11 +00:00
libnm-core: extract NMSettingIPConfig superclass out of IP4, IP6 classes
Split a base NMSettingIPConfig class out of NMSettingIP4Config and NMSettingIP6Config, and update things accordingly. Further simplifications of now-redundant IPv4-vs-IPv6 code are possible, and should happen in the future.
This commit is contained in:
parent
39709fdc2e
commit
3f30c6f1c2
|
@ -2889,7 +2889,7 @@ check_and_convert_vlan_prio_maps (const char *prio_map,
|
|||
static gboolean
|
||||
add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
gboolean ret;
|
||||
|
||||
if (!ip4addr)
|
||||
|
@ -2897,13 +2897,13 @@ add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection)
|
|||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
if (!s_ip4) {
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NULL);
|
||||
}
|
||||
ret = nm_setting_ip4_config_add_address (s_ip4, ip4addr);
|
||||
ret = nm_setting_ip_config_add_address (s_ip4, ip4addr);
|
||||
nm_ip_address_unref (ip4addr);
|
||||
|
||||
return ret;
|
||||
|
@ -2912,7 +2912,7 @@ add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection)
|
|||
static gboolean
|
||||
add_ip6_address_to_connection (NMIPAddress *ip6addr, NMConnection *connection)
|
||||
{
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
gboolean ret;
|
||||
|
||||
if (!ip6addr)
|
||||
|
@ -2920,13 +2920,13 @@ add_ip6_address_to_connection (NMIPAddress *ip6addr, NMConnection *connection)
|
|||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
if (!s_ip6) {
|
||||
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
|
||||
NULL);
|
||||
}
|
||||
ret = nm_setting_ip6_config_add_address (s_ip6, ip6addr);
|
||||
ret = nm_setting_ip_config_add_address (s_ip6, ip6addr);
|
||||
nm_ip_address_unref (ip6addr);
|
||||
|
||||
return ret;
|
||||
|
@ -8107,8 +8107,7 @@ editor_init_new_connection (NmCli *nmc, NMConnection *connection)
|
|||
static void
|
||||
editor_init_existing_connection (NMConnection *connection)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4, *s_ip6;
|
||||
NMSettingWireless *s_wireless;
|
||||
NMSettingConnection *s_con;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
@ -251,64 +252,64 @@ NmcOutputField nmc_fields_setting_wireless_security[] = {
|
|||
|
||||
/* Available fields for NM_SETTING_IP4_CONFIG_SETTING_NAME */
|
||||
NmcOutputField nmc_fields_setting_ip4_config[] = {
|
||||
SETTING_FIELD ("name", 8), /* 0 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_METHOD, 10), /* 1 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_DNS, 20), /* 2 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_DNS_SEARCH, 15), /* 3 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_ADDRESSES, 20), /* 4 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_ROUTES, 20), /* 5 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, 15), /* 8 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, 19), /* 9 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, 14), /* 10 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, 15), /* 11 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_MAY_FAIL, 12), /* 12 */
|
||||
SETTING_FIELD ("name", 8), /* 0 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_METHOD, 10), /* 1 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS, 20), /* 2 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_SEARCH, 15), /* 3 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_ADDRESSES, 20), /* 4 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTES, 20), /* 5 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */
|
||||
SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, 15), /* 8 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, 19), /* 9 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, 14), /* 10 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, 15), /* 11 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL, 12), /* 12 */
|
||||
{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
|
||||
};
|
||||
#define NMC_FIELDS_SETTING_IP4_CONFIG_ALL "name"","\
|
||||
NM_SETTING_IP4_CONFIG_METHOD","\
|
||||
NM_SETTING_IP4_CONFIG_DNS","\
|
||||
NM_SETTING_IP4_CONFIG_DNS_SEARCH","\
|
||||
NM_SETTING_IP4_CONFIG_ADDRESSES","\
|
||||
NM_SETTING_IP4_CONFIG_ROUTES","\
|
||||
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES","\
|
||||
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS","\
|
||||
NM_SETTING_IP_CONFIG_METHOD","\
|
||||
NM_SETTING_IP_CONFIG_DNS","\
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH","\
|
||||
NM_SETTING_IP_CONFIG_ADDRESSES","\
|
||||
NM_SETTING_IP_CONFIG_ROUTES","\
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES","\
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS","\
|
||||
NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID","\
|
||||
NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME","\
|
||||
NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME","\
|
||||
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT","\
|
||||
NM_SETTING_IP4_CONFIG_MAY_FAIL
|
||||
NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME","\
|
||||
NM_SETTING_IP_CONFIG_DHCP_HOSTNAME","\
|
||||
NM_SETTING_IP_CONFIG_NEVER_DEFAULT","\
|
||||
NM_SETTING_IP_CONFIG_MAY_FAIL
|
||||
#define NMC_FIELDS_SETTING_IP4_CONFIG_COMMON NMC_FIELDS_SETTING_IP4_CONFIG_ALL
|
||||
|
||||
/* Available fields for NM_SETTING_IP6_CONFIG_SETTING_NAME */
|
||||
NmcOutputField nmc_fields_setting_ip6_config[] = {
|
||||
SETTING_FIELD ("name", 8), /* 0 */
|
||||
SETTING_FIELD (NM_SETTING_IP6_CONFIG_METHOD, 10), /* 1 */
|
||||
SETTING_FIELD (NM_SETTING_IP6_CONFIG_DNS, 20), /* 2 */
|
||||
SETTING_FIELD (NM_SETTING_IP6_CONFIG_DNS_SEARCH, 15), /* 3 */
|
||||
SETTING_FIELD (NM_SETTING_IP6_CONFIG_ADDRESSES, 20), /* 4 */
|
||||
SETTING_FIELD (NM_SETTING_IP6_CONFIG_ROUTES, 20), /* 5 */
|
||||
SETTING_FIELD (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */
|
||||
SETTING_FIELD (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */
|
||||
SETTING_FIELD (NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, 15), /* 8 */
|
||||
SETTING_FIELD (NM_SETTING_IP6_CONFIG_MAY_FAIL, 12), /* 9 */
|
||||
SETTING_FIELD (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, 15), /* 10 */
|
||||
SETTING_FIELD (NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, 14), /* 11 */
|
||||
SETTING_FIELD ("name", 8), /* 0 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_METHOD, 10), /* 1 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS, 20), /* 2 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_SEARCH, 15), /* 3 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_ADDRESSES, 20), /* 4 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTES, 20), /* 5 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, 19), /* 6 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, 16), /* 7 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, 15), /* 8 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL, 12), /* 9 */
|
||||
SETTING_FIELD (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, 15), /* 10 */
|
||||
SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, 14), /* 11 */
|
||||
{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
|
||||
};
|
||||
#define NMC_FIELDS_SETTING_IP6_CONFIG_ALL "name"","\
|
||||
NM_SETTING_IP6_CONFIG_METHOD","\
|
||||
NM_SETTING_IP6_CONFIG_DNS","\
|
||||
NM_SETTING_IP6_CONFIG_DNS_SEARCH","\
|
||||
NM_SETTING_IP6_CONFIG_ADDRESSES","\
|
||||
NM_SETTING_IP6_CONFIG_ROUTES","\
|
||||
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES","\
|
||||
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS","\
|
||||
NM_SETTING_IP6_CONFIG_NEVER_DEFAULT","\
|
||||
NM_SETTING_IP6_CONFIG_MAY_FAIL","\
|
||||
NM_SETTING_IP_CONFIG_METHOD","\
|
||||
NM_SETTING_IP_CONFIG_DNS","\
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH","\
|
||||
NM_SETTING_IP_CONFIG_ADDRESSES","\
|
||||
NM_SETTING_IP_CONFIG_ROUTES","\
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES","\
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS","\
|
||||
NM_SETTING_IP_CONFIG_NEVER_DEFAULT","\
|
||||
NM_SETTING_IP_CONFIG_MAY_FAIL","\
|
||||
NM_SETTING_IP6_CONFIG_IP6_PRIVACY","\
|
||||
NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME
|
||||
NM_SETTING_IP_CONFIG_DHCP_HOSTNAME
|
||||
#define NMC_FIELDS_SETTING_IP6_CONFIG_COMMON NMC_FIELDS_SETTING_IP4_CONFIG_ALL
|
||||
|
||||
/* Available fields for NM_SETTING_SERIAL_SETTING_NAME */
|
||||
|
@ -1199,23 +1200,23 @@ nmc_property_ib_get_p_key (NMSetting *setting)
|
|||
DEFINE_GETTER (nmc_property_ib_get_parent, NM_SETTING_INFINIBAND_PARENT)
|
||||
|
||||
/* --- NM_SETTING_IP4_CONFIG_SETTING_NAME property get functions --- */
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_method, NM_SETTING_IP4_CONFIG_METHOD)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_dns, NM_SETTING_IP4_CONFIG_DNS)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_dns_search, NM_SETTING_IP4_CONFIG_DNS_SEARCH)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_method, NM_SETTING_IP_CONFIG_METHOD)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_dns, NM_SETTING_IP_CONFIG_DNS)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_dns_search, NM_SETTING_IP_CONFIG_DNS_SEARCH)
|
||||
|
||||
static char *
|
||||
nmc_property_ipv4_get_addresses (NMSetting *setting)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (setting);
|
||||
NMSettingIPConfig *s_ip4 = NM_SETTING_IP_CONFIG (setting);
|
||||
GString *printable;
|
||||
guint32 num_addresses, i;
|
||||
NMIPAddress *addr;
|
||||
|
||||
printable = g_string_new (NULL);
|
||||
|
||||
num_addresses = nm_setting_ip4_config_get_num_addresses (s_ip4);
|
||||
num_addresses = nm_setting_ip_config_get_num_addresses (s_ip4);
|
||||
for (i = 0; i < num_addresses; i++) {
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, i);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, i);
|
||||
|
||||
if (printable->len > 0)
|
||||
g_string_append (printable, "; ");
|
||||
|
@ -1240,16 +1241,16 @@ nmc_property_ipv4_get_addresses (NMSetting *setting)
|
|||
static char *
|
||||
nmc_property_ipv4_get_routes (NMSetting *setting)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (setting);
|
||||
NMSettingIPConfig *s_ip4 = NM_SETTING_IP_CONFIG (setting);
|
||||
GString *printable;
|
||||
guint32 num_routes, i;
|
||||
NMIPRoute *route;
|
||||
|
||||
printable = g_string_new (NULL);
|
||||
|
||||
num_routes = nm_setting_ip4_config_get_num_routes (s_ip4);
|
||||
num_routes = nm_setting_ip_config_get_num_routes (s_ip4);
|
||||
for (i = 0; i < num_routes; i++) {
|
||||
route = nm_setting_ip4_config_get_route (s_ip4, i);
|
||||
route = nm_setting_ip_config_get_route (s_ip4, i);
|
||||
|
||||
if (printable->len > 0)
|
||||
g_string_append (printable, "; ");
|
||||
|
@ -1274,32 +1275,32 @@ nmc_property_ipv4_get_routes (NMSetting *setting)
|
|||
return g_string_free (printable, FALSE);
|
||||
}
|
||||
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_routes, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_dns, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_routes, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_dns, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_dhcp_client_id, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_dhcp_send_hostname, NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_dhcp_hostname, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_never_default, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_may_fail, NM_SETTING_IP4_CONFIG_MAY_FAIL)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_dhcp_send_hostname, NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_dhcp_hostname, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_never_default, NM_SETTING_IP_CONFIG_NEVER_DEFAULT)
|
||||
DEFINE_GETTER (nmc_property_ipv4_get_may_fail, NM_SETTING_IP_CONFIG_MAY_FAIL)
|
||||
|
||||
/* --- NM_SETTING_IP6_CONFIG_SETTING_NAME property get functions --- */
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_method, NM_SETTING_IP6_CONFIG_METHOD)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_dns, NM_SETTING_IP6_CONFIG_DNS)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_dns_search, NM_SETTING_IP6_CONFIG_DNS_SEARCH)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_method, NM_SETTING_IP_CONFIG_METHOD)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_dns, NM_SETTING_IP_CONFIG_DNS)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_dns_search, NM_SETTING_IP_CONFIG_DNS_SEARCH)
|
||||
|
||||
static char *
|
||||
nmc_property_ipv6_get_addresses (NMSetting *setting)
|
||||
{
|
||||
NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting);
|
||||
NMSettingIPConfig *s_ip6 = NM_SETTING_IP_CONFIG (setting);
|
||||
GString *printable;
|
||||
guint32 num_addresses, i;
|
||||
NMIPAddress *addr;
|
||||
|
||||
printable = g_string_new (NULL);
|
||||
|
||||
num_addresses = nm_setting_ip6_config_get_num_addresses (s_ip6);
|
||||
num_addresses = nm_setting_ip_config_get_num_addresses (s_ip6);
|
||||
for (i = 0; i < num_addresses; i++) {
|
||||
addr = nm_setting_ip6_config_get_address (s_ip6, i);
|
||||
addr = nm_setting_ip_config_get_address (s_ip6, i);
|
||||
|
||||
if (printable->len > 0)
|
||||
g_string_append (printable, "; ");
|
||||
|
@ -1324,16 +1325,16 @@ nmc_property_ipv6_get_addresses (NMSetting *setting)
|
|||
static char *
|
||||
nmc_property_ipv6_get_routes (NMSetting *setting)
|
||||
{
|
||||
NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting);
|
||||
NMSettingIPConfig *s_ip6 = NM_SETTING_IP_CONFIG (setting);
|
||||
GString *printable;
|
||||
guint32 num_routes, i;
|
||||
NMIPRoute *route;
|
||||
|
||||
printable = g_string_new (NULL);
|
||||
|
||||
num_routes = nm_setting_ip6_config_get_num_routes (s_ip6);
|
||||
num_routes = nm_setting_ip_config_get_num_routes (s_ip6);
|
||||
for (i = 0; i < num_routes; i++) {
|
||||
route = nm_setting_ip6_config_get_route (s_ip6, i);
|
||||
route = nm_setting_ip_config_get_route (s_ip6, i);
|
||||
|
||||
if (printable->len > 0)
|
||||
g_string_append (printable, "; ");
|
||||
|
@ -1358,11 +1359,11 @@ nmc_property_ipv6_get_routes (NMSetting *setting)
|
|||
return g_string_free (printable, FALSE);
|
||||
}
|
||||
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_routes, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_dns, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_never_default, NM_SETTING_IP6_CONFIG_NEVER_DEFAULT)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_may_fail, NM_SETTING_IP6_CONFIG_MAY_FAIL)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_dhcp_hostname, NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_routes, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_dns, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_never_default, NM_SETTING_IP_CONFIG_NEVER_DEFAULT)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_may_fail, NM_SETTING_IP_CONFIG_MAY_FAIL)
|
||||
DEFINE_GETTER (nmc_property_ipv6_get_dhcp_hostname, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME)
|
||||
|
||||
static char *
|
||||
nmc_property_ipv6_get_ip6_privacy (NMSetting *setting)
|
||||
|
@ -1696,19 +1697,19 @@ ipv4_addresses_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_dat
|
|||
/* If we have some IP addresses set method to 'manual'.
|
||||
* Else if the method was 'manual', change it back to 'auto'.
|
||||
*/
|
||||
if (nm_setting_ip4_config_get_num_addresses (NM_SETTING_IP4_CONFIG (object))) {
|
||||
if (g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
|
||||
if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) {
|
||||
if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
|
||||
if (!answered) {
|
||||
answered = TRUE;
|
||||
answer = get_answer ("ipv4.method", "manual");
|
||||
}
|
||||
if (answer)
|
||||
g_object_set (object, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
|
||||
g_object_set (object, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
|
||||
}
|
||||
} else {
|
||||
answered = FALSE;
|
||||
if (!g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
|
||||
g_object_set (object, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
if (!g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
|
||||
g_object_set (object, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
}
|
||||
|
||||
g_signal_handlers_unblock_by_func (object, G_CALLBACK (ipv4_method_changed_cb), NULL);
|
||||
|
@ -1724,8 +1725,8 @@ ipv4_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
|
|||
g_signal_handlers_block_by_func (object, G_CALLBACK (ipv4_addresses_changed_cb), NULL);
|
||||
|
||||
/* If method != manual, remove addresses (save them for restoring them later when method becomes 'manual' */
|
||||
if (g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
|
||||
if (nm_setting_ip4_config_get_num_addresses (NM_SETTING_IP4_CONFIG (object))) {
|
||||
if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
|
||||
if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) {
|
||||
if (!answered) {
|
||||
answered = TRUE;
|
||||
answer = get_answer ("ipv4.addresses", NULL);
|
||||
|
@ -1733,14 +1734,14 @@ ipv4_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
|
|||
if (answer) {
|
||||
if (G_IS_VALUE (&value))
|
||||
g_value_unset (&value);
|
||||
nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP4_CONFIG_ADDRESSES, &value);
|
||||
g_object_set (object, NM_SETTING_IP4_CONFIG_ADDRESSES, NULL, NULL);
|
||||
nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value);
|
||||
g_object_set (object, NM_SETTING_IP_CONFIG_ADDRESSES, NULL, NULL);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
answered = FALSE;
|
||||
if (G_IS_VALUE (&value)) {
|
||||
nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP4_CONFIG_ADDRESSES, &value);
|
||||
nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value);
|
||||
g_value_unset (&value);
|
||||
}
|
||||
}
|
||||
|
@ -1759,19 +1760,19 @@ ipv6_addresses_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_dat
|
|||
/* If we have some IP addresses set method to 'manual'.
|
||||
* Else if the method was 'manual', change it back to 'auto'.
|
||||
*/
|
||||
if (nm_setting_ip6_config_get_num_addresses (NM_SETTING_IP6_CONFIG (object))) {
|
||||
if (g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
|
||||
if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) {
|
||||
if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
|
||||
if (!answered) {
|
||||
answered = TRUE;
|
||||
answer = get_answer ("ipv6.method", "manual");
|
||||
}
|
||||
if (answer)
|
||||
g_object_set (object, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL);
|
||||
g_object_set (object, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL);
|
||||
}
|
||||
} else {
|
||||
answered = FALSE;
|
||||
if (!g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL))
|
||||
g_object_set (object, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
|
||||
if (!g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL))
|
||||
g_object_set (object, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
|
||||
}
|
||||
|
||||
g_signal_handlers_unblock_by_func (object, G_CALLBACK (ipv6_method_changed_cb), NULL);
|
||||
|
@ -1787,8 +1788,8 @@ ipv6_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
|
|||
g_signal_handlers_block_by_func (object, G_CALLBACK (ipv6_addresses_changed_cb), NULL);
|
||||
|
||||
/* If method != manual, remove addresses (save them for restoring them later when method becomes 'manual' */
|
||||
if (g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
|
||||
if (nm_setting_ip6_config_get_num_addresses (NM_SETTING_IP6_CONFIG (object))) {
|
||||
if (g_strcmp0 (nm_setting_ip_config_get_method (NM_SETTING_IP_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
|
||||
if (nm_setting_ip_config_get_num_addresses (NM_SETTING_IP_CONFIG (object))) {
|
||||
if (!answered) {
|
||||
answered = TRUE;
|
||||
answer = get_answer ("ipv6.addresses", NULL);
|
||||
|
@ -1796,14 +1797,14 @@ ipv6_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
|
|||
if (answer) {
|
||||
if (G_IS_VALUE (&value))
|
||||
g_value_unset (&value);
|
||||
nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP6_CONFIG_ADDRESSES, &value);
|
||||
g_object_set (object, NM_SETTING_IP6_CONFIG_ADDRESSES, NULL, NULL);
|
||||
nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value);
|
||||
g_object_set (object, NM_SETTING_IP_CONFIG_ADDRESSES, NULL, NULL);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
answered = FALSE;
|
||||
if (G_IS_VALUE (&value)) {
|
||||
nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP6_CONFIG_ADDRESSES, &value);
|
||||
nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP_CONFIG_ADDRESSES, &value);
|
||||
g_value_unset (&value);
|
||||
}
|
||||
}
|
||||
|
@ -1867,24 +1868,24 @@ connection_master_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_
|
|||
}
|
||||
|
||||
void
|
||||
nmc_setting_ip4_connect_handlers (NMSettingIP4Config *setting)
|
||||
nmc_setting_ip4_connect_handlers (NMSettingIPConfig *setting)
|
||||
{
|
||||
g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
|
||||
|
||||
g_signal_connect (setting, "notify::" NM_SETTING_IP4_CONFIG_ADDRESSES,
|
||||
g_signal_connect (setting, "notify::" NM_SETTING_IP_CONFIG_ADDRESSES,
|
||||
G_CALLBACK (ipv4_addresses_changed_cb), NULL);
|
||||
g_signal_connect (setting, "notify::" NM_SETTING_IP4_CONFIG_METHOD,
|
||||
g_signal_connect (setting, "notify::" NM_SETTING_IP_CONFIG_METHOD,
|
||||
G_CALLBACK (ipv4_method_changed_cb), NULL);
|
||||
}
|
||||
|
||||
void
|
||||
nmc_setting_ip6_connect_handlers (NMSettingIP6Config *setting)
|
||||
nmc_setting_ip6_connect_handlers (NMSettingIPConfig *setting)
|
||||
{
|
||||
g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
|
||||
|
||||
g_signal_connect (setting, "notify::" NM_SETTING_IP6_CONFIG_ADDRESSES,
|
||||
g_signal_connect (setting, "notify::" NM_SETTING_IP_CONFIG_ADDRESSES,
|
||||
G_CALLBACK (ipv6_addresses_changed_cb), NULL);
|
||||
g_signal_connect (setting, "notify::" NM_SETTING_IP6_CONFIG_METHOD,
|
||||
g_signal_connect (setting, "notify::" NM_SETTING_IP_CONFIG_METHOD,
|
||||
G_CALLBACK (ipv6_method_changed_cb), NULL);
|
||||
}
|
||||
|
||||
|
@ -1918,15 +1919,15 @@ nmc_setting_custom_init (NMSetting *setting)
|
|||
g_return_if_fail (NM_IS_SETTING (setting));
|
||||
|
||||
if (NM_IS_SETTING_IP4_CONFIG (setting)) {
|
||||
g_object_set (NM_SETTING_IP4_CONFIG (setting),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
g_object_set (NM_SETTING_IP_CONFIG (setting),
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
nmc_setting_ip4_connect_handlers (NM_SETTING_IP4_CONFIG (setting));
|
||||
nmc_setting_ip4_connect_handlers (NM_SETTING_IP_CONFIG (setting));
|
||||
} else if (NM_IS_SETTING_IP6_CONFIG (setting)) {
|
||||
g_object_set (NM_SETTING_IP6_CONFIG (setting),
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
g_object_set (NM_SETTING_IP_CONFIG (setting),
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
nmc_setting_ip6_connect_handlers (NM_SETTING_IP6_CONFIG (setting));
|
||||
nmc_setting_ip6_connect_handlers (NM_SETTING_IP_CONFIG (setting));
|
||||
} else if (NM_IS_SETTING_WIRELESS (setting)) {
|
||||
g_object_set (NM_SETTING_WIRELESS (setting),
|
||||
NM_SETTING_WIRELESS_MODE, NM_SETTING_WIRELESS_MODE_INFRA,
|
||||
|
@ -3151,14 +3152,14 @@ nmc_property_ipv4_set_dns (NMSetting *setting, const char *prop, const char *val
|
|||
g_strfreev (strv);
|
||||
return FALSE;
|
||||
}
|
||||
nm_setting_ip4_config_add_dns (NM_SETTING_IP4_CONFIG (setting), addr);
|
||||
nm_setting_ip_config_add_dns (NM_SETTING_IP_CONFIG (setting), addr);
|
||||
}
|
||||
g_strfreev (strv);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_validate_and_remove_ipv4_dns (NMSettingIP4Config *setting,
|
||||
_validate_and_remove_ipv4_dns (NMSettingIPConfig *setting,
|
||||
const char *dns,
|
||||
GError **error)
|
||||
{
|
||||
|
@ -3170,15 +3171,15 @@ _validate_and_remove_ipv4_dns (NMSettingIP4Config *setting,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
ret = nm_setting_ip4_config_remove_dns_by_value (setting, dns);
|
||||
ret = nm_setting_ip_config_remove_dns_by_value (setting, dns);
|
||||
if (!ret)
|
||||
g_set_error (error, 1, 0, _("the property doesn't contain DNS server '%s'"), dns);
|
||||
return ret;
|
||||
}
|
||||
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_dns,
|
||||
NM_SETTING_IP4_CONFIG,
|
||||
nm_setting_ip4_config_get_num_dns,
|
||||
nm_setting_ip4_config_remove_dns,
|
||||
NM_SETTING_IP_CONFIG,
|
||||
nm_setting_ip_config_get_num_dns,
|
||||
nm_setting_ip_config_remove_dns,
|
||||
_validate_and_remove_ipv4_dns)
|
||||
|
||||
static const char *
|
||||
|
@ -3204,20 +3205,20 @@ nmc_property_ipv4_set_dns_search (NMSetting *setting, const char *prop, const ch
|
|||
}
|
||||
|
||||
while (strv && strv[i])
|
||||
nm_setting_ip4_config_add_dns_search (NM_SETTING_IP4_CONFIG (setting), strv[i++]);
|
||||
nm_setting_ip_config_add_dns_search (NM_SETTING_IP_CONFIG (setting), strv[i++]);
|
||||
g_strfreev (strv);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_validate_and_remove_ipv4_dns_search (NMSettingIP4Config *setting,
|
||||
_validate_and_remove_ipv4_dns_search (NMSettingIPConfig *setting,
|
||||
const char *dns_search,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret;
|
||||
|
||||
ret = nm_setting_ip4_config_remove_dns_search_by_value (setting, dns_search);
|
||||
ret = nm_setting_ip_config_remove_dns_search_by_value (setting, dns_search);
|
||||
if (!ret)
|
||||
g_set_error (error, 1, 0,
|
||||
_("the property doesn't contain DNS search domain '%s'"),
|
||||
|
@ -3225,9 +3226,9 @@ _validate_and_remove_ipv4_dns_search (NMSettingIP4Config *setting,
|
|||
return ret;
|
||||
}
|
||||
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_dns_search,
|
||||
NM_SETTING_IP4_CONFIG,
|
||||
nm_setting_ip4_config_get_num_dns_searches,
|
||||
nm_setting_ip4_config_remove_dns_search,
|
||||
NM_SETTING_IP_CONFIG,
|
||||
nm_setting_ip_config_get_num_dns_searches,
|
||||
nm_setting_ip_config_remove_dns_search,
|
||||
_validate_and_remove_ipv4_dns_search)
|
||||
|
||||
/* 'addresses' */
|
||||
|
@ -3252,7 +3253,7 @@ nmc_property_ipv4_set_addresses (NMSetting *setting, const char *prop, const cha
|
|||
g_strfreev (strv);
|
||||
return FALSE;
|
||||
}
|
||||
nm_setting_ip4_config_add_address (NM_SETTING_IP4_CONFIG (setting), ip4addr);
|
||||
nm_setting_ip_config_add_address (NM_SETTING_IP_CONFIG (setting), ip4addr);
|
||||
nm_ip_address_unref (ip4addr);
|
||||
}
|
||||
g_strfreev (strv);
|
||||
|
@ -3260,7 +3261,7 @@ nmc_property_ipv4_set_addresses (NMSetting *setting, const char *prop, const cha
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_validate_and_remove_ipv4_address (NMSettingIP4Config *setting,
|
||||
_validate_and_remove_ipv4_address (NMSettingIPConfig *setting,
|
||||
const char *address,
|
||||
GError **error)
|
||||
{
|
||||
|
@ -3271,7 +3272,7 @@ _validate_and_remove_ipv4_address (NMSettingIP4Config *setting,
|
|||
if (!ip4addr)
|
||||
return FALSE;
|
||||
|
||||
ret = nm_setting_ip4_config_remove_address_by_value (setting, ip4addr);
|
||||
ret = nm_setting_ip_config_remove_address_by_value (setting, ip4addr);
|
||||
if (!ret)
|
||||
g_set_error (error, 1, 0,
|
||||
_("the property doesn't contain IP address '%s'"), address);
|
||||
|
@ -3279,9 +3280,9 @@ _validate_and_remove_ipv4_address (NMSettingIP4Config *setting,
|
|||
return ret;
|
||||
}
|
||||
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_addresses,
|
||||
NM_SETTING_IP4_CONFIG,
|
||||
nm_setting_ip4_config_get_num_addresses,
|
||||
nm_setting_ip4_config_remove_address,
|
||||
NM_SETTING_IP_CONFIG,
|
||||
nm_setting_ip_config_get_num_addresses,
|
||||
nm_setting_ip_config_remove_address,
|
||||
_validate_and_remove_ipv4_address)
|
||||
|
||||
static const char *
|
||||
|
@ -3350,7 +3351,7 @@ nmc_property_ipv4_set_routes (NMSetting *setting, const char *prop, const char *
|
|||
g_strfreev (strv);
|
||||
return FALSE;
|
||||
}
|
||||
nm_setting_ip4_config_add_route (NM_SETTING_IP4_CONFIG (setting), ip4route);
|
||||
nm_setting_ip_config_add_route (NM_SETTING_IP_CONFIG (setting), ip4route);
|
||||
nm_ip_route_unref (ip4route);
|
||||
}
|
||||
g_strfreev (strv);
|
||||
|
@ -3358,7 +3359,7 @@ nmc_property_ipv4_set_routes (NMSetting *setting, const char *prop, const char *
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_validate_and_remove_ipv4_route (NMSettingIP4Config *setting,
|
||||
_validate_and_remove_ipv4_route (NMSettingIPConfig *setting,
|
||||
const char *route,
|
||||
GError **error)
|
||||
{
|
||||
|
@ -3369,16 +3370,16 @@ _validate_and_remove_ipv4_route (NMSettingIP4Config *setting,
|
|||
if (!ip4route)
|
||||
return FALSE;
|
||||
|
||||
ret = nm_setting_ip4_config_remove_route_by_value (setting, ip4route);
|
||||
ret = nm_setting_ip_config_remove_route_by_value (setting, ip4route);
|
||||
if (!ret)
|
||||
g_set_error (error, 1, 0, _("the property doesn't contain route '%s'"), route);
|
||||
nm_ip_route_unref (ip4route);
|
||||
return ret;
|
||||
}
|
||||
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv4_remove_routes,
|
||||
NM_SETTING_IP4_CONFIG,
|
||||
nm_setting_ip4_config_get_num_routes,
|
||||
nm_setting_ip4_config_remove_route,
|
||||
NM_SETTING_IP_CONFIG,
|
||||
nm_setting_ip_config_get_num_routes,
|
||||
nm_setting_ip_config_remove_route,
|
||||
_validate_and_remove_ipv4_route)
|
||||
|
||||
static const char *
|
||||
|
@ -3465,14 +3466,14 @@ nmc_property_ipv6_set_dns (NMSetting *setting, const char *prop, const char *val
|
|||
g_strfreev (strv);
|
||||
return FALSE;
|
||||
}
|
||||
nm_setting_ip6_config_add_dns (NM_SETTING_IP6_CONFIG (setting), addr);
|
||||
nm_setting_ip_config_add_dns (NM_SETTING_IP_CONFIG (setting), addr);
|
||||
}
|
||||
g_strfreev (strv);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_validate_and_remove_ipv6_dns (NMSettingIP6Config *setting,
|
||||
_validate_and_remove_ipv6_dns (NMSettingIPConfig *setting,
|
||||
const char *dns,
|
||||
GError **error)
|
||||
{
|
||||
|
@ -3484,15 +3485,15 @@ _validate_and_remove_ipv6_dns (NMSettingIP6Config *setting,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
ret = nm_setting_ip6_config_remove_dns_by_value (setting, dns);
|
||||
ret = nm_setting_ip_config_remove_dns_by_value (setting, dns);
|
||||
if (!ret)
|
||||
g_set_error (error, 1, 0, _("the property doesn't contain DNS server '%s'"), dns);
|
||||
return ret;
|
||||
}
|
||||
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_dns,
|
||||
NM_SETTING_IP6_CONFIG,
|
||||
nm_setting_ip6_config_get_num_dns,
|
||||
nm_setting_ip6_config_remove_dns,
|
||||
NM_SETTING_IP_CONFIG,
|
||||
nm_setting_ip_config_get_num_dns,
|
||||
nm_setting_ip_config_remove_dns,
|
||||
_validate_and_remove_ipv6_dns)
|
||||
|
||||
static const char *
|
||||
|
@ -3524,20 +3525,20 @@ nmc_property_ipv6_set_dns_search (NMSetting *setting, const char *prop, const ch
|
|||
}
|
||||
|
||||
while (strv && strv[i])
|
||||
nm_setting_ip6_config_add_dns_search (NM_SETTING_IP6_CONFIG (setting), strv[i++]);
|
||||
nm_setting_ip_config_add_dns_search (NM_SETTING_IP_CONFIG (setting), strv[i++]);
|
||||
g_strfreev (strv);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_validate_and_remove_ipv6_dns_search (NMSettingIP6Config *setting,
|
||||
_validate_and_remove_ipv6_dns_search (NMSettingIPConfig *setting,
|
||||
const char *dns_search,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret;
|
||||
|
||||
ret = nm_setting_ip6_config_remove_dns_search_by_value (setting, dns_search);
|
||||
ret = nm_setting_ip_config_remove_dns_search_by_value (setting, dns_search);
|
||||
if (!ret)
|
||||
g_set_error (error, 1, 0,
|
||||
_("the property doesn't contain DNS search domain '%s'"),
|
||||
|
@ -3545,9 +3546,9 @@ _validate_and_remove_ipv6_dns_search (NMSettingIP6Config *setting,
|
|||
return ret;
|
||||
}
|
||||
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_dns_search,
|
||||
NM_SETTING_IP6_CONFIG,
|
||||
nm_setting_ip6_config_get_num_dns_searches,
|
||||
nm_setting_ip6_config_remove_dns_search,
|
||||
NM_SETTING_IP_CONFIG,
|
||||
nm_setting_ip_config_get_num_dns_searches,
|
||||
nm_setting_ip_config_remove_dns_search,
|
||||
_validate_and_remove_ipv6_dns_search)
|
||||
|
||||
/* 'addresses' */
|
||||
|
@ -3572,7 +3573,7 @@ nmc_property_ipv6_set_addresses (NMSetting *setting, const char *prop, const cha
|
|||
g_strfreev (strv);
|
||||
return FALSE;
|
||||
}
|
||||
nm_setting_ip6_config_add_address (NM_SETTING_IP6_CONFIG (setting), ip6addr);
|
||||
nm_setting_ip_config_add_address (NM_SETTING_IP_CONFIG (setting), ip6addr);
|
||||
nm_ip_address_unref (ip6addr);
|
||||
}
|
||||
g_strfreev (strv);
|
||||
|
@ -3580,7 +3581,7 @@ nmc_property_ipv6_set_addresses (NMSetting *setting, const char *prop, const cha
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_validate_and_remove_ipv6_address (NMSettingIP6Config *setting,
|
||||
_validate_and_remove_ipv6_address (NMSettingIPConfig *setting,
|
||||
const char *address,
|
||||
GError **error)
|
||||
{
|
||||
|
@ -3591,16 +3592,16 @@ _validate_and_remove_ipv6_address (NMSettingIP6Config *setting,
|
|||
if (!ip6addr)
|
||||
return FALSE;
|
||||
|
||||
ret = nm_setting_ip6_config_remove_address_by_value (setting, ip6addr);
|
||||
ret = nm_setting_ip_config_remove_address_by_value (setting, ip6addr);
|
||||
if (!ret)
|
||||
g_set_error (error, 1, 0, _("the property doesn't contain IP address '%s'"), address);
|
||||
nm_ip_address_unref (ip6addr);
|
||||
return ret;
|
||||
}
|
||||
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_addresses,
|
||||
NM_SETTING_IP6_CONFIG,
|
||||
nm_setting_ip6_config_get_num_addresses,
|
||||
nm_setting_ip6_config_remove_address,
|
||||
NM_SETTING_IP_CONFIG,
|
||||
nm_setting_ip_config_get_num_addresses,
|
||||
nm_setting_ip_config_remove_address,
|
||||
_validate_and_remove_ipv6_address)
|
||||
|
||||
static const char *
|
||||
|
@ -3634,7 +3635,7 @@ nmc_property_ipv6_set_routes (NMSetting *setting, const char *prop, const char *
|
|||
g_strfreev (strv);
|
||||
return FALSE;
|
||||
}
|
||||
nm_setting_ip6_config_add_route (NM_SETTING_IP6_CONFIG (setting), ip6route);
|
||||
nm_setting_ip_config_add_route (NM_SETTING_IP_CONFIG (setting), ip6route);
|
||||
nm_ip_route_unref (ip6route);
|
||||
}
|
||||
g_strfreev (strv);
|
||||
|
@ -3642,7 +3643,7 @@ nmc_property_ipv6_set_routes (NMSetting *setting, const char *prop, const char *
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_validate_and_remove_ipv6_route (NMSettingIP6Config *setting,
|
||||
_validate_and_remove_ipv6_route (NMSettingIPConfig *setting,
|
||||
const char *route,
|
||||
GError **error)
|
||||
{
|
||||
|
@ -3653,16 +3654,16 @@ _validate_and_remove_ipv6_route (NMSettingIP6Config *setting,
|
|||
if (!ip6route)
|
||||
return FALSE;
|
||||
|
||||
ret = nm_setting_ip6_config_remove_route_by_value (setting, ip6route);
|
||||
ret = nm_setting_ip_config_remove_route_by_value (setting, ip6route);
|
||||
if (!ret)
|
||||
g_set_error (error, 1, 0, _("the property doesn't contain route '%s'"), route);
|
||||
nm_ip_route_unref (ip6route);
|
||||
return ret;
|
||||
}
|
||||
DEFINE_REMOVER_INDEX_OR_VALUE (nmc_property_ipv6_remove_routes,
|
||||
NM_SETTING_IP6_CONFIG,
|
||||
nm_setting_ip6_config_get_num_routes,
|
||||
nm_setting_ip6_config_remove_route,
|
||||
NM_SETTING_IP_CONFIG,
|
||||
nm_setting_ip_config_get_num_routes,
|
||||
nm_setting_ip_config_remove_route,
|
||||
_validate_and_remove_ipv6_route)
|
||||
|
||||
static const char *
|
||||
|
@ -4695,6 +4696,8 @@ nmc_add_prop_funcs (char *key,
|
|||
|
||||
/* concatenate setting name and property name */
|
||||
#define GLUE(A,B) (g_strconcat ((NM_SETTING_##A##_SETTING_NAME),(NM_SETTING_##A##_##B), NULL))
|
||||
#define GLUE_IP(A,B) (g_strconcat ((NM_SETTING_IP##A##_CONFIG_SETTING_NAME),(NM_SETTING_IP_CONFIG_##B), NULL))
|
||||
|
||||
void
|
||||
nmc_properties_init (void)
|
||||
{
|
||||
|
@ -5420,49 +5423,49 @@ nmc_properties_init (void)
|
|||
NULL);
|
||||
|
||||
/* Add editable properties for NM_SETTING_IP4_CONFIG_SETTING_NAME */
|
||||
nmc_add_prop_funcs (GLUE (IP4_CONFIG, METHOD),
|
||||
nmc_add_prop_funcs (GLUE_IP (4, METHOD),
|
||||
nmc_property_ipv4_get_method,
|
||||
nmc_property_ipv4_set_method,
|
||||
NULL,
|
||||
NULL,
|
||||
nmc_property_ipv4_allowed_method,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP4_CONFIG, DNS),
|
||||
nmc_add_prop_funcs (GLUE_IP (4, DNS),
|
||||
nmc_property_ipv4_get_dns,
|
||||
nmc_property_ipv4_set_dns,
|
||||
nmc_property_ipv4_remove_dns,
|
||||
nmc_property_ipv4_describe_dns,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP4_CONFIG, DNS_SEARCH),
|
||||
nmc_add_prop_funcs (GLUE_IP (4, DNS_SEARCH),
|
||||
nmc_property_ipv4_get_dns_search,
|
||||
nmc_property_ipv4_set_dns_search,
|
||||
nmc_property_ipv4_remove_dns_search,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP4_CONFIG, ADDRESSES),
|
||||
nmc_add_prop_funcs (GLUE_IP (4, ADDRESSES),
|
||||
nmc_property_ipv4_get_addresses,
|
||||
nmc_property_ipv4_set_addresses,
|
||||
nmc_property_ipv4_remove_addresses,
|
||||
nmc_property_ipv4_describe_addresses,
|
||||
NULL,
|
||||
nmc_property_out2in_addresses);
|
||||
nmc_add_prop_funcs (GLUE (IP4_CONFIG, ROUTES),
|
||||
nmc_add_prop_funcs (GLUE_IP (4, ROUTES),
|
||||
nmc_property_ipv4_get_routes,
|
||||
nmc_property_ipv4_set_routes,
|
||||
nmc_property_ipv4_remove_routes,
|
||||
nmc_property_ipv4_describe_routes,
|
||||
NULL,
|
||||
nmc_property_out2in_routes);
|
||||
nmc_add_prop_funcs (GLUE (IP4_CONFIG, IGNORE_AUTO_ROUTES),
|
||||
nmc_add_prop_funcs (GLUE_IP (4, IGNORE_AUTO_ROUTES),
|
||||
nmc_property_ipv4_get_ignore_auto_routes,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP4_CONFIG, IGNORE_AUTO_DNS),
|
||||
nmc_add_prop_funcs (GLUE_IP (4, IGNORE_AUTO_DNS),
|
||||
nmc_property_ipv4_get_ignore_auto_dns,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
|
@ -5476,28 +5479,28 @@ nmc_properties_init (void)
|
|||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_SEND_HOSTNAME),
|
||||
nmc_add_prop_funcs (GLUE_IP (4, DHCP_SEND_HOSTNAME),
|
||||
nmc_property_ipv4_get_dhcp_send_hostname,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_HOSTNAME),
|
||||
nmc_add_prop_funcs (GLUE_IP (4, DHCP_HOSTNAME),
|
||||
nmc_property_ipv4_get_dhcp_hostname,
|
||||
nmc_property_set_string,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP4_CONFIG, NEVER_DEFAULT),
|
||||
nmc_add_prop_funcs (GLUE_IP (4, NEVER_DEFAULT),
|
||||
nmc_property_ipv4_get_never_default,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP4_CONFIG, MAY_FAIL),
|
||||
nmc_add_prop_funcs (GLUE_IP (4, MAY_FAIL),
|
||||
nmc_property_ipv4_get_may_fail,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
|
@ -5506,63 +5509,63 @@ nmc_properties_init (void)
|
|||
NULL);
|
||||
|
||||
/* Add editable properties for NM_SETTING_IP6_CONFIG_SETTING_NAME */
|
||||
nmc_add_prop_funcs (GLUE (IP6_CONFIG, METHOD),
|
||||
nmc_add_prop_funcs (GLUE_IP (6, METHOD),
|
||||
nmc_property_ipv6_get_method,
|
||||
nmc_property_ipv6_set_method,
|
||||
NULL,
|
||||
NULL,
|
||||
nmc_property_ipv6_allowed_method,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP6_CONFIG, DNS),
|
||||
nmc_add_prop_funcs (GLUE_IP (6, DNS),
|
||||
nmc_property_ipv6_get_dns,
|
||||
nmc_property_ipv6_set_dns,
|
||||
nmc_property_ipv6_remove_dns,
|
||||
nmc_property_ipv6_describe_dns,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP6_CONFIG, DNS_SEARCH),
|
||||
nmc_add_prop_funcs (GLUE_IP (6, DNS_SEARCH),
|
||||
nmc_property_ipv6_get_dns_search,
|
||||
nmc_property_ipv6_set_dns_search,
|
||||
nmc_property_ipv6_remove_dns_search,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP6_CONFIG, ADDRESSES),
|
||||
nmc_add_prop_funcs (GLUE_IP (6, ADDRESSES),
|
||||
nmc_property_ipv6_get_addresses,
|
||||
nmc_property_ipv6_set_addresses,
|
||||
nmc_property_ipv6_remove_addresses,
|
||||
nmc_property_ipv6_describe_addresses,
|
||||
NULL,
|
||||
nmc_property_out2in_addresses);
|
||||
nmc_add_prop_funcs (GLUE (IP6_CONFIG, ROUTES),
|
||||
nmc_add_prop_funcs (GLUE_IP (6, ROUTES),
|
||||
nmc_property_ipv6_get_routes,
|
||||
nmc_property_ipv6_set_routes,
|
||||
nmc_property_ipv6_remove_routes,
|
||||
nmc_property_ipv6_describe_routes,
|
||||
NULL,
|
||||
nmc_property_out2in_routes);
|
||||
nmc_add_prop_funcs (GLUE (IP6_CONFIG, IGNORE_AUTO_ROUTES),
|
||||
nmc_add_prop_funcs (GLUE_IP (6, IGNORE_AUTO_ROUTES),
|
||||
nmc_property_ipv6_get_ignore_auto_routes,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP6_CONFIG, IGNORE_AUTO_DNS),
|
||||
nmc_add_prop_funcs (GLUE_IP (6, IGNORE_AUTO_DNS),
|
||||
nmc_property_ipv6_get_ignore_auto_dns,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP6_CONFIG, NEVER_DEFAULT),
|
||||
nmc_add_prop_funcs (GLUE_IP (6, NEVER_DEFAULT),
|
||||
nmc_property_ipv6_get_never_default,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (IP6_CONFIG, MAY_FAIL),
|
||||
nmc_add_prop_funcs (GLUE_IP (6, MAY_FAIL),
|
||||
nmc_property_ipv6_get_may_fail,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
|
@ -5576,7 +5579,7 @@ nmc_properties_init (void)
|
|||
NULL,
|
||||
NULL,
|
||||
nmc_property_out2in_cut_paren);
|
||||
nmc_add_prop_funcs (GLUE (IP6_CONFIG, DHCP_HOSTNAME),
|
||||
nmc_add_prop_funcs (GLUE_IP (6, DHCP_HOSTNAME),
|
||||
nmc_property_ipv6_get_dhcp_hostname,
|
||||
nmc_property_set_string,
|
||||
NULL,
|
||||
|
@ -6715,7 +6718,7 @@ setting_wireless_security_details (NMSetting *setting, NmCli *nmc, const char *o
|
|||
static gboolean
|
||||
setting_ip4_config_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (setting);
|
||||
NMSettingIPConfig *s_ip4 = NM_SETTING_IP_CONFIG (setting);
|
||||
NmcOutputField *tmpl, *arr;
|
||||
size_t tmpl_len;
|
||||
|
||||
|
@ -6752,7 +6755,7 @@ setting_ip4_config_details (NMSetting *setting, NmCli *nmc, const char *one_pro
|
|||
static gboolean
|
||||
setting_ip6_config_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets)
|
||||
{
|
||||
NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting);
|
||||
NMSettingIPConfig *s_ip6 = NM_SETTING_IP_CONFIG (setting);
|
||||
NmcOutputField *tmpl, *arr;
|
||||
size_t tmpl_len;
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ void nmc_properties_cleanup (void);
|
|||
|
||||
NMSetting *nmc_setting_new_for_name (const char *name);
|
||||
void nmc_setting_custom_init (NMSetting *setting);
|
||||
void nmc_setting_ip4_connect_handlers (NMSettingIP4Config *setting);
|
||||
void nmc_setting_ip6_connect_handlers (NMSettingIP6Config *setting);
|
||||
void nmc_setting_ip4_connect_handlers (NMSettingIPConfig *setting);
|
||||
void nmc_setting_ip6_connect_handlers (NMSettingIPConfig *setting);
|
||||
void nmc_setting_wireless_connect_handlers (NMSettingWireless *setting);
|
||||
void nmc_setting_connection_connect_handlers (NMSettingConnection *setting, NMConnection *connection);
|
||||
|
||||
|
|
|
@ -59,12 +59,12 @@ static gboolean
|
|||
nmt_page_ip4_show_by_default (NmtEditorPage *page)
|
||||
{
|
||||
NMConnection *conn;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
|
||||
conn = nmt_editor_page_get_connection (page);
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (conn);
|
||||
if ( !g_strcmp0 (nm_setting_ip4_config_get_method (s_ip4), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)
|
||||
|| nm_setting_ip4_config_get_num_addresses (s_ip4))
|
||||
if ( !g_strcmp0 (nm_setting_ip_config_get_method (s_ip4), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)
|
||||
|| nm_setting_ip_config_get_num_addresses (s_ip4))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -115,22 +115,22 @@ nmt_page_ip4_constructed (GObject *object)
|
|||
{
|
||||
NmtPageIP4 *ip4 = NMT_PAGE_IP4 (object);
|
||||
NmtPageGrid *grid;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NmtNewtWidget *widget, *button;
|
||||
NMConnection *conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip4));
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (conn);
|
||||
if (!s_ip4) {
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
g_object_set (G_OBJECT (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
nm_connection_add_setting (conn, (NMSetting *) s_ip4);
|
||||
}
|
||||
|
||||
widget = nmt_newt_popup_new (ip4methods);
|
||||
g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_METHOD,
|
||||
g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_METHOD,
|
||||
widget, "active-id",
|
||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
nmt_editor_page_set_header_widget (NMT_EDITOR_PAGE (ip4), widget);
|
||||
|
@ -139,27 +139,27 @@ nmt_page_ip4_constructed (GObject *object)
|
|||
|
||||
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4_WITH_PREFIX);
|
||||
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET,
|
||||
s_ip4, NM_SETTING_IP4_CONFIG_ADDRESSES,
|
||||
s_ip4, NM_SETTING_IP_CONFIG_ADDRESSES,
|
||||
widget, "strings",
|
||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
nmt_page_grid_append (grid, _("Addresses"), widget, NULL);
|
||||
|
||||
widget = nmt_ip_entry_new (25, AF_INET, FALSE, TRUE);
|
||||
nm_editor_bind_ip_gateway_to_string (AF_INET,
|
||||
s_ip4, NM_SETTING_IP4_CONFIG_ADDRESSES,
|
||||
s_ip4, NM_SETTING_IP_CONFIG_ADDRESSES,
|
||||
widget, "text",
|
||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
nmt_page_grid_append (grid, _("Gateway"), widget, NULL);
|
||||
|
||||
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4);
|
||||
nm_editor_bind_ip_addresses_to_strv (AF_INET,
|
||||
s_ip4, NM_SETTING_IP4_CONFIG_DNS,
|
||||
s_ip4, NM_SETTING_IP_CONFIG_DNS,
|
||||
widget, "strings",
|
||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
nmt_page_grid_append (grid, _("DNS servers"), widget, NULL);
|
||||
|
||||
widget = nmt_address_list_new (NMT_ADDRESS_LIST_HOSTNAME);
|
||||
g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_DNS_SEARCH,
|
||||
g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_DNS_SEARCH,
|
||||
widget, "strings",
|
||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
nmt_page_grid_append (grid, _("Search domains"), widget, NULL);
|
||||
|
@ -170,7 +170,7 @@ nmt_page_ip4_constructed (GObject *object)
|
|||
"text", "",
|
||||
"style", NMT_NEWT_LABEL_PLAIN,
|
||||
NULL);
|
||||
g_object_bind_property_full (s_ip4, NM_SETTING_IP4_CONFIG_ROUTES,
|
||||
g_object_bind_property_full (s_ip4, NM_SETTING_IP_CONFIG_ROUTES,
|
||||
widget, "text",
|
||||
G_BINDING_SYNC_CREATE,
|
||||
ip4_routes_transform_to_description,
|
||||
|
@ -180,7 +180,7 @@ nmt_page_ip4_constructed (GObject *object)
|
|||
nmt_page_grid_append (grid, _("Routing"), widget, button);
|
||||
|
||||
widget = nmt_newt_checkbox_new (_("Never use this network for default route"));
|
||||
g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT,
|
||||
g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_NEVER_DEFAULT,
|
||||
widget, "active",
|
||||
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
||||
nmt_page_grid_append (grid, NULL, widget, NULL);
|
||||
|
@ -188,7 +188,7 @@ nmt_page_ip4_constructed (GObject *object)
|
|||
nmt_page_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);
|
||||
|
||||
widget = nmt_newt_checkbox_new (_("Require IPv4 addressing for this connection"));
|
||||
g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_MAY_FAIL,
|
||||
g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_MAY_FAIL,
|
||||
widget, "active",
|
||||
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL |
|
||||
G_BINDING_INVERT_BOOLEAN);
|
||||
|
|
|
@ -59,12 +59,12 @@ static gboolean
|
|||
nmt_page_ip6_show_by_default (NmtEditorPage *page)
|
||||
{
|
||||
NMConnection *conn;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
|
||||
conn = nmt_editor_page_get_connection (page);
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (conn);
|
||||
if ( !g_strcmp0 (nm_setting_ip6_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)
|
||||
|| nm_setting_ip6_config_get_num_addresses (s_ip6))
|
||||
if ( !g_strcmp0 (nm_setting_ip_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)
|
||||
|| nm_setting_ip_config_get_num_addresses (s_ip6))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -115,22 +115,22 @@ nmt_page_ip6_constructed (GObject *object)
|
|||
{
|
||||
NmtPageIP6 *ip6 = NMT_PAGE_IP6 (object);
|
||||
NmtPageGrid *grid;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
NmtNewtWidget *widget, *button;
|
||||
NMConnection *conn;
|
||||
|
||||
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip6));
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (conn);
|
||||
if (!s_ip6) {
|
||||
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
|
||||
g_object_set (G_OBJECT (s_ip6),
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
nm_connection_add_setting (conn, (NMSetting *) s_ip6);
|
||||
}
|
||||
|
||||
widget = nmt_newt_popup_new (ip6methods);
|
||||
g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_METHOD,
|
||||
g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_METHOD,
|
||||
widget, "active-id",
|
||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
nmt_editor_page_set_header_widget (NMT_EDITOR_PAGE (ip6), widget);
|
||||
|
@ -139,27 +139,27 @@ nmt_page_ip6_constructed (GObject *object)
|
|||
|
||||
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6_WITH_PREFIX);
|
||||
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET6,
|
||||
s_ip6, NM_SETTING_IP6_CONFIG_ADDRESSES,
|
||||
s_ip6, NM_SETTING_IP_CONFIG_ADDRESSES,
|
||||
widget, "strings",
|
||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
nmt_page_grid_append (grid, _("Addresses"), widget, NULL);
|
||||
|
||||
widget = nmt_ip_entry_new (25, AF_INET6, FALSE, TRUE);
|
||||
nm_editor_bind_ip_gateway_to_string (AF_INET6,
|
||||
s_ip6, NM_SETTING_IP6_CONFIG_ADDRESSES,
|
||||
s_ip6, NM_SETTING_IP_CONFIG_ADDRESSES,
|
||||
widget, "text",
|
||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
nmt_page_grid_append (grid, _("Gateway"), widget, NULL);
|
||||
|
||||
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6);
|
||||
nm_editor_bind_ip_addresses_to_strv (AF_INET6,
|
||||
s_ip6, NM_SETTING_IP6_CONFIG_DNS,
|
||||
s_ip6, NM_SETTING_IP_CONFIG_DNS,
|
||||
widget, "strings",
|
||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
nmt_page_grid_append (grid, _("DNS servers"), widget, NULL);
|
||||
|
||||
widget = nmt_address_list_new (NMT_ADDRESS_LIST_HOSTNAME);
|
||||
g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_DNS_SEARCH,
|
||||
g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_DNS_SEARCH,
|
||||
widget, "strings",
|
||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
nmt_page_grid_append (grid, _("Search domains"), widget, NULL);
|
||||
|
@ -168,7 +168,7 @@ nmt_page_ip6_constructed (GObject *object)
|
|||
"text", "",
|
||||
"style", NMT_NEWT_LABEL_PLAIN,
|
||||
NULL);
|
||||
g_object_bind_property_full (s_ip6, NM_SETTING_IP6_CONFIG_ROUTES,
|
||||
g_object_bind_property_full (s_ip6, NM_SETTING_IP_CONFIG_ROUTES,
|
||||
widget, "text",
|
||||
G_BINDING_SYNC_CREATE,
|
||||
ip6_routes_transform_to_description,
|
||||
|
@ -178,7 +178,7 @@ nmt_page_ip6_constructed (GObject *object)
|
|||
nmt_page_grid_append (grid, _("Routing"), widget, button);
|
||||
|
||||
widget = nmt_newt_checkbox_new (_("Never use this network for default route"));
|
||||
g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_NEVER_DEFAULT,
|
||||
g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_NEVER_DEFAULT,
|
||||
widget, "active",
|
||||
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
||||
nmt_page_grid_append (grid, NULL, widget, NULL);
|
||||
|
@ -186,7 +186,7 @@ nmt_page_ip6_constructed (GObject *object)
|
|||
nmt_page_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);
|
||||
|
||||
widget = nmt_newt_checkbox_new (_("Require IPv6 addressing for this connection"));
|
||||
g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_MAY_FAIL,
|
||||
g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_MAY_FAIL,
|
||||
widget, "active",
|
||||
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL |
|
||||
G_BINDING_INVERT_BOOLEAN);
|
||||
|
|
|
@ -77,21 +77,15 @@ save_routes_and_exit (NmtNewtButton *button,
|
|||
{
|
||||
NmtRouteEditor *editor = user_data;
|
||||
NmtRouteEditorPrivate *priv = NMT_ROUTE_EDITOR_GET_PRIVATE (editor);
|
||||
const char *property;
|
||||
GBinding *binding;
|
||||
GPtrArray *routes;
|
||||
|
||||
if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting))
|
||||
property = NM_SETTING_IP4_CONFIG_ROUTES;
|
||||
else
|
||||
property = NM_SETTING_IP6_CONFIG_ROUTES;
|
||||
|
||||
/* Because of the complicated dbus-glib GTypes, it's easier to cheat
|
||||
* and use GBinding to do this than it is to copy the value by hand.
|
||||
*/
|
||||
binding = g_object_bind_property (priv->edit_setting, property,
|
||||
priv->orig_setting, property,
|
||||
G_BINDING_SYNC_CREATE);
|
||||
g_object_unref (binding);
|
||||
g_object_get (priv->edit_setting,
|
||||
NM_SETTING_IP_CONFIG_ROUTES, &routes,
|
||||
NULL);
|
||||
g_object_set (priv->orig_setting,
|
||||
NM_SETTING_IP_CONFIG_ROUTES, routes,
|
||||
NULL);
|
||||
g_ptr_array_unref (routes);
|
||||
|
||||
nmt_newt_form_quit (NMT_NEWT_FORM (editor));
|
||||
}
|
||||
|
@ -106,17 +100,13 @@ nmt_route_editor_constructed (GObject *object)
|
|||
if (G_OBJECT_CLASS (nmt_route_editor_parent_class)->constructed)
|
||||
G_OBJECT_CLASS (nmt_route_editor_parent_class)->constructed (object);
|
||||
|
||||
if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting)) {
|
||||
if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting))
|
||||
routes = nmt_route_table_new (AF_INET);
|
||||
g_object_bind_property (priv->edit_setting, NM_SETTING_IP4_CONFIG_ROUTES,
|
||||
routes, "routes",
|
||||
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
||||
} else {
|
||||
else
|
||||
routes = nmt_route_table_new (AF_INET6);
|
||||
g_object_bind_property (priv->edit_setting, NM_SETTING_IP6_CONFIG_ROUTES,
|
||||
routes, "routes",
|
||||
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
||||
}
|
||||
g_object_bind_property (priv->edit_setting, NM_SETTING_IP_CONFIG_ROUTES,
|
||||
routes, "routes",
|
||||
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
||||
|
||||
vbox = nmt_newt_grid_new ();
|
||||
nmt_newt_grid_add (NMT_NEWT_GRID (vbox), routes, 0, 0);
|
||||
|
|
|
@ -86,7 +86,7 @@ add_connection (GDBusProxy *proxy, const char *con_name)
|
|||
/* Build up the 'ipv4' Setting */
|
||||
g_variant_builder_init (&setting_builder, G_VARIANT_TYPE ("a{sv}"));
|
||||
g_variant_builder_add (&setting_builder, "{sv}",
|
||||
NM_SETTING_IP4_CONFIG_METHOD,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
g_variant_new_string (NM_SETTING_IP4_CONFIG_METHOD_AUTO));
|
||||
g_variant_builder_add (&connection_builder, "{sa{sv}}",
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
|
|
|
@ -86,7 +86,7 @@ add_connection (NMClient *client, GMainLoop *loop, const char *con_name)
|
|||
/* Build up the 'ipv4' Setting */
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
g_object_set (G_OBJECT (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
|
|
|
@ -631,8 +631,7 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
|
|||
NMSettingConnection *s_con = nm_connection_get_setting_connection (self);
|
||||
const char *default_ip4_method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
|
||||
const char *default_ip6_method = NULL;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4, *s_ip6;
|
||||
NMSetting *setting;
|
||||
|
||||
if (parameters)
|
||||
|
@ -663,7 +662,7 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
|
|||
setting = nm_setting_ip4_config_new ();
|
||||
|
||||
g_object_set (setting,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, default_ip4_method,
|
||||
NM_SETTING_IP_CONFIG_METHOD, default_ip4_method,
|
||||
NULL);
|
||||
nm_connection_add_setting (self, setting);
|
||||
}
|
||||
|
@ -671,8 +670,8 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
|
|||
setting = nm_setting_ip6_config_new ();
|
||||
|
||||
g_object_set (setting,
|
||||
NM_SETTING_IP6_CONFIG_METHOD, default_ip6_method,
|
||||
NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
|
||||
NM_SETTING_IP_CONFIG_METHOD, default_ip6_method,
|
||||
NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
|
||||
NULL);
|
||||
nm_connection_add_setting (self, setting);
|
||||
}
|
||||
|
@ -740,8 +739,7 @@ _nm_connection_verify (NMConnection *connection, GError **error)
|
|||
{
|
||||
NMConnectionPrivate *priv;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4, *s_ip6;
|
||||
GHashTableIter iter;
|
||||
gpointer value;
|
||||
GSList *all_settings = NULL, *setting_i;
|
||||
|
@ -1739,14 +1737,19 @@ nm_connection_get_setting_infiniband (NMConnection *connection)
|
|||
*
|
||||
* A shortcut to return any #NMSettingIP4Config the connection might contain.
|
||||
*
|
||||
* Returns: (transfer none): an #NMSettingIP4Config if the connection contains one, otherwise %NULL
|
||||
* Note that it returns the value as type #NMSettingIPConfig, since the vast
|
||||
* majority of IPv4-setting-related methods are on that type, not
|
||||
* #NMSettingIP4Config.
|
||||
*
|
||||
* Returns: (type NMSettingIP4Config) (transfer none): an #NMSettingIP4Config if the
|
||||
* connection contains one, otherwise %NULL
|
||||
**/
|
||||
NMSettingIP4Config *
|
||||
NMSettingIPConfig *
|
||||
nm_connection_get_setting_ip4_config (NMConnection *connection)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
|
||||
|
||||
return (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
|
||||
return (NMSettingIPConfig *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1755,14 +1758,19 @@ nm_connection_get_setting_ip4_config (NMConnection *connection)
|
|||
*
|
||||
* A shortcut to return any #NMSettingIP6Config the connection might contain.
|
||||
*
|
||||
* Returns: (transfer none): an #NMSettingIP6Config if the connection contains one, otherwise %NULL
|
||||
* Note that it returns the value as type #NMSettingIPConfig, since the vast
|
||||
* majority of IPv6-setting-related methods are on that type, not
|
||||
* #NMSettingIP6Config.
|
||||
*
|
||||
* Returns: (type NMSettingIP6Config) (transfer none): an #NMSettingIP6Config if the
|
||||
* connection contains one, otherwise %NULL
|
||||
**/
|
||||
NMSettingIP6Config *
|
||||
NMSettingIPConfig *
|
||||
nm_connection_get_setting_ip6_config (NMConnection *connection)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
|
||||
|
||||
return (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
|
||||
return (NMSettingIPConfig *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -193,8 +193,8 @@ NMSettingDcb * nm_connection_get_setting_dcb (NMConnec
|
|||
NMSettingGeneric * nm_connection_get_setting_generic (NMConnection *connection);
|
||||
NMSettingGsm * nm_connection_get_setting_gsm (NMConnection *connection);
|
||||
NMSettingInfiniband * nm_connection_get_setting_infiniband (NMConnection *connection);
|
||||
NMSettingIP4Config * nm_connection_get_setting_ip4_config (NMConnection *connection);
|
||||
NMSettingIP6Config * nm_connection_get_setting_ip6_config (NMConnection *connection);
|
||||
NMSettingIPConfig * nm_connection_get_setting_ip4_config (NMConnection *connection);
|
||||
NMSettingIPConfig * nm_connection_get_setting_ip6_config (NMConnection *connection);
|
||||
NMSettingOlpcMesh * nm_connection_get_setting_olpc_mesh (NMConnection *connection);
|
||||
NMSettingPpp * nm_connection_get_setting_ppp (NMConnection *connection);
|
||||
NMSettingPppoe * nm_connection_get_setting_pppoe (NMConnection *connection);
|
||||
|
|
|
@ -40,6 +40,7 @@ typedef struct _NMSettingDcb NMSettingDcb;
|
|||
typedef struct _NMSettingGeneric NMSettingGeneric;
|
||||
typedef struct _NMSettingGsm NMSettingGsm;
|
||||
typedef struct _NMSettingInfiniband NMSettingInfiniband;
|
||||
typedef struct _NMSettingIPConfig NMSettingIPConfig;
|
||||
typedef struct _NMSettingIP4Config NMSettingIP4Config;
|
||||
typedef struct _NMSettingIP6Config NMSettingIP6Config;
|
||||
typedef struct _NMSettingOlpcMesh NMSettingOlpcMesh;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -127,6 +127,94 @@ void nm_ip_route_set_attribute (NMIPRoute *route,
|
|||
const char *name,
|
||||
GVariant *value);
|
||||
|
||||
|
||||
#define NM_TYPE_SETTING_IP_CONFIG (nm_setting_ip_config_get_type ())
|
||||
#define NM_SETTING_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfig))
|
||||
#define NM_SETTING_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_IPCONFIG, NMSettingIPConfigClass))
|
||||
#define NM_IS_SETTING_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_IP_CONFIG))
|
||||
#define NM_IS_SETTING_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_IP_CONFIG))
|
||||
#define NM_SETTING_IP_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfigClass))
|
||||
|
||||
#define NM_SETTING_IP_CONFIG_METHOD "method"
|
||||
#define NM_SETTING_IP_CONFIG_DNS "dns"
|
||||
#define NM_SETTING_IP_CONFIG_DNS_SEARCH "dns-search"
|
||||
#define NM_SETTING_IP_CONFIG_ADDRESSES "addresses"
|
||||
#define NM_SETTING_IP_CONFIG_ROUTES "routes"
|
||||
#define NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
|
||||
#define NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns"
|
||||
#define NM_SETTING_IP_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
|
||||
#define NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname"
|
||||
#define NM_SETTING_IP_CONFIG_NEVER_DEFAULT "never-default"
|
||||
#define NM_SETTING_IP_CONFIG_MAY_FAIL "may-fail"
|
||||
|
||||
struct _NMSettingIPConfig {
|
||||
NMSetting parent;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
NMSettingClass parent;
|
||||
|
||||
/* Padding for future expansion */
|
||||
gpointer padding[8];
|
||||
} NMSettingIPConfigClass;
|
||||
|
||||
GType nm_setting_ip_config_get_type (void);
|
||||
|
||||
const char *nm_setting_ip_config_get_method (NMSettingIPConfig *setting);
|
||||
|
||||
guint nm_setting_ip_config_get_num_dns (NMSettingIPConfig *setting);
|
||||
const char *nm_setting_ip_config_get_dns (NMSettingIPConfig *setting,
|
||||
int i);
|
||||
gboolean nm_setting_ip_config_add_dns (NMSettingIPConfig *setting,
|
||||
const char *dns);
|
||||
void nm_setting_ip_config_remove_dns (NMSettingIPConfig *setting,
|
||||
int i);
|
||||
gboolean nm_setting_ip_config_remove_dns_by_value (NMSettingIPConfig *setting,
|
||||
const char *dns);
|
||||
void nm_setting_ip_config_clear_dns (NMSettingIPConfig *setting);
|
||||
|
||||
guint nm_setting_ip_config_get_num_dns_searches (NMSettingIPConfig *setting);
|
||||
const char *nm_setting_ip_config_get_dns_search (NMSettingIPConfig *setting,
|
||||
int i);
|
||||
gboolean nm_setting_ip_config_add_dns_search (NMSettingIPConfig *setting,
|
||||
const char *dns_search);
|
||||
void nm_setting_ip_config_remove_dns_search (NMSettingIPConfig *setting,
|
||||
int i);
|
||||
gboolean nm_setting_ip_config_remove_dns_search_by_value (NMSettingIPConfig *setting,
|
||||
const char *dns_search);
|
||||
void nm_setting_ip_config_clear_dns_searches (NMSettingIPConfig *setting);
|
||||
|
||||
guint nm_setting_ip_config_get_num_addresses (NMSettingIPConfig *setting);
|
||||
NMIPAddress *nm_setting_ip_config_get_address (NMSettingIPConfig *setting,
|
||||
int i);
|
||||
gboolean nm_setting_ip_config_add_address (NMSettingIPConfig *setting,
|
||||
NMIPAddress *address);
|
||||
void nm_setting_ip_config_remove_address (NMSettingIPConfig *setting,
|
||||
int i);
|
||||
gboolean nm_setting_ip_config_remove_address_by_value (NMSettingIPConfig *setting,
|
||||
NMIPAddress *address);
|
||||
void nm_setting_ip_config_clear_addresses (NMSettingIPConfig *setting);
|
||||
|
||||
guint nm_setting_ip_config_get_num_routes (NMSettingIPConfig *setting);
|
||||
NMIPRoute *nm_setting_ip_config_get_route (NMSettingIPConfig *setting,
|
||||
int i);
|
||||
gboolean nm_setting_ip_config_add_route (NMSettingIPConfig *setting,
|
||||
NMIPRoute *route);
|
||||
void nm_setting_ip_config_remove_route (NMSettingIPConfig *setting,
|
||||
int i);
|
||||
gboolean nm_setting_ip_config_remove_route_by_value (NMSettingIPConfig *setting,
|
||||
NMIPRoute *route);
|
||||
void nm_setting_ip_config_clear_routes (NMSettingIPConfig *setting);
|
||||
|
||||
gboolean nm_setting_ip_config_get_ignore_auto_routes (NMSettingIPConfig *setting);
|
||||
gboolean nm_setting_ip_config_get_ignore_auto_dns (NMSettingIPConfig *setting);
|
||||
|
||||
const char *nm_setting_ip_config_get_dhcp_hostname (NMSettingIPConfig *setting);
|
||||
gboolean nm_setting_ip_config_get_dhcp_send_hostname (NMSettingIPConfig *setting);
|
||||
|
||||
gboolean nm_setting_ip_config_get_never_default (NMSettingIPConfig *setting);
|
||||
gboolean nm_setting_ip_config_get_may_fail (NMSettingIPConfig *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NM_SETTING_IP_CONFIG_H */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,7 +27,6 @@
|
|||
#error "Only <NetworkManager.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "nm-setting.h"
|
||||
#include "nm-setting-ip-config.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -41,18 +40,7 @@ G_BEGIN_DECLS
|
|||
|
||||
#define NM_SETTING_IP4_CONFIG_SETTING_NAME "ipv4"
|
||||
|
||||
#define NM_SETTING_IP4_CONFIG_METHOD "method"
|
||||
#define NM_SETTING_IP4_CONFIG_DNS "dns"
|
||||
#define NM_SETTING_IP4_CONFIG_DNS_SEARCH "dns-search"
|
||||
#define NM_SETTING_IP4_CONFIG_ADDRESSES "addresses"
|
||||
#define NM_SETTING_IP4_CONFIG_ROUTES "routes"
|
||||
#define NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
|
||||
#define NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns"
|
||||
#define NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID "dhcp-client-id"
|
||||
#define NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname"
|
||||
#define NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
|
||||
#define NM_SETTING_IP4_CONFIG_NEVER_DEFAULT "never-default"
|
||||
#define NM_SETTING_IP4_CONFIG_MAY_FAIL "may-fail"
|
||||
|
||||
/**
|
||||
* NM_SETTING_IP4_CONFIG_METHOD_AUTO:
|
||||
|
@ -99,11 +87,11 @@ G_BEGIN_DECLS
|
|||
#define NM_SETTING_IP4_CONFIG_METHOD_DISABLED "disabled"
|
||||
|
||||
struct _NMSettingIP4Config {
|
||||
NMSetting parent;
|
||||
NMSettingIPConfig parent;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
NMSettingClass parent;
|
||||
NMSettingIPConfigClass parent;
|
||||
|
||||
/*< private >*/
|
||||
gpointer padding[4];
|
||||
|
@ -111,46 +99,9 @@ typedef struct {
|
|||
|
||||
GType nm_setting_ip4_config_get_type (void);
|
||||
|
||||
NMSetting * nm_setting_ip4_config_new (void);
|
||||
const char * nm_setting_ip4_config_get_method (NMSettingIP4Config *setting);
|
||||
NMSetting *nm_setting_ip4_config_new (void);
|
||||
|
||||
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);
|
||||
const char *nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -26,9 +26,6 @@
|
|||
#error "Only <NetworkManager.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "nm-setting.h"
|
||||
#include "nm-setting-ip-config.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -42,18 +39,7 @@ G_BEGIN_DECLS
|
|||
|
||||
#define NM_SETTING_IP6_CONFIG_SETTING_NAME "ipv6"
|
||||
|
||||
#define NM_SETTING_IP6_CONFIG_METHOD "method"
|
||||
#define NM_SETTING_IP6_CONFIG_DNS "dns"
|
||||
#define NM_SETTING_IP6_CONFIG_DNS_SEARCH "dns-search"
|
||||
#define NM_SETTING_IP6_CONFIG_ADDRESSES "addresses"
|
||||
#define NM_SETTING_IP6_CONFIG_ROUTES "routes"
|
||||
#define NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
|
||||
#define NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns"
|
||||
#define NM_SETTING_IP6_CONFIG_NEVER_DEFAULT "never-default"
|
||||
#define NM_SETTING_IP6_CONFIG_MAY_FAIL "may-fail"
|
||||
#define NM_SETTING_IP6_CONFIG_IP6_PRIVACY "ip6-privacy"
|
||||
#define NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
|
||||
|
||||
#define NM_SETTING_IP6_CONFIG_IP6_PRIVACY "ip6-privacy"
|
||||
|
||||
/**
|
||||
* NM_SETTING_IP6_CONFIG_METHOD_IGNORE:
|
||||
|
@ -129,11 +115,11 @@ typedef enum {
|
|||
} NMSettingIP6ConfigPrivacy;
|
||||
|
||||
struct _NMSettingIP6Config {
|
||||
NMSetting parent;
|
||||
NMSettingIPConfig parent;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
NMSettingClass parent;
|
||||
NMSettingIPConfigClass parent;
|
||||
|
||||
/*< private >*/
|
||||
gpointer padding[4];
|
||||
|
@ -141,42 +127,8 @@ typedef struct {
|
|||
|
||||
GType nm_setting_ip6_config_get_type (void);
|
||||
|
||||
NMSetting * nm_setting_ip6_config_new (void);
|
||||
const char * nm_setting_ip6_config_get_method (NMSettingIP6Config *setting);
|
||||
NMSetting *nm_setting_ip6_config_new (void);
|
||||
|
||||
guint32 nm_setting_ip6_config_get_num_dns (NMSettingIP6Config *setting);
|
||||
const char * nm_setting_ip6_config_get_dns (NMSettingIP6Config *setting, guint32 i);
|
||||
gboolean nm_setting_ip6_config_add_dns (NMSettingIP6Config *setting, const char *dns);
|
||||
void nm_setting_ip6_config_remove_dns (NMSettingIP6Config *setting, guint32 i);
|
||||
gboolean nm_setting_ip6_config_remove_dns_by_value (NMSettingIP6Config *setting, const char *dns);
|
||||
void nm_setting_ip6_config_clear_dns (NMSettingIP6Config *setting);
|
||||
|
||||
guint32 nm_setting_ip6_config_get_num_dns_searches (NMSettingIP6Config *setting);
|
||||
const char * nm_setting_ip6_config_get_dns_search (NMSettingIP6Config *setting, guint32 i);
|
||||
gboolean nm_setting_ip6_config_add_dns_search (NMSettingIP6Config *setting, const char *dns_search);
|
||||
void nm_setting_ip6_config_remove_dns_search (NMSettingIP6Config *setting, guint32 i);
|
||||
gboolean nm_setting_ip6_config_remove_dns_search_by_value (NMSettingIP6Config *setting, const char *dns_search);
|
||||
void nm_setting_ip6_config_clear_dns_searches (NMSettingIP6Config *setting);
|
||||
|
||||
guint32 nm_setting_ip6_config_get_num_addresses (NMSettingIP6Config *setting);
|
||||
NMIPAddress * nm_setting_ip6_config_get_address (NMSettingIP6Config *setting, guint32 i);
|
||||
gboolean nm_setting_ip6_config_add_address (NMSettingIP6Config *setting, NMIPAddress *address);
|
||||
void nm_setting_ip6_config_remove_address (NMSettingIP6Config *setting, guint32 i);
|
||||
gboolean nm_setting_ip6_config_remove_address_by_value (NMSettingIP6Config *setting, NMIPAddress *address);
|
||||
void nm_setting_ip6_config_clear_addresses (NMSettingIP6Config *setting);
|
||||
|
||||
guint32 nm_setting_ip6_config_get_num_routes (NMSettingIP6Config *setting);
|
||||
NMIPRoute * nm_setting_ip6_config_get_route (NMSettingIP6Config *setting, guint32 i);
|
||||
gboolean nm_setting_ip6_config_add_route (NMSettingIP6Config *setting, NMIPRoute *route);
|
||||
void nm_setting_ip6_config_remove_route (NMSettingIP6Config *setting, guint32 i);
|
||||
gboolean nm_setting_ip6_config_remove_route_by_value (NMSettingIP6Config *setting, NMIPRoute *route);
|
||||
void nm_setting_ip6_config_clear_routes (NMSettingIP6Config *setting);
|
||||
gboolean nm_setting_ip6_config_get_ignore_auto_routes (NMSettingIP6Config *setting);
|
||||
|
||||
gboolean nm_setting_ip6_config_get_ignore_auto_dns (NMSettingIP6Config *setting);
|
||||
const char * nm_setting_ip6_config_get_dhcp_hostname (NMSettingIP6Config *setting);
|
||||
gboolean nm_setting_ip6_config_get_never_default (NMSettingIP6Config *setting);
|
||||
gboolean nm_setting_ip6_config_get_may_fail (NMSettingIP6Config *setting);
|
||||
NMSettingIP6ConfigPrivacy nm_setting_ip6_config_get_ip6_privacy (NMSettingIP6Config *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <uuid/uuid.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ test_setting_vpn_modify_during_foreach (void)
|
|||
static void
|
||||
test_setting_ip4_config_labels (void)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMIPAddress *addr;
|
||||
GVariant *label;
|
||||
GPtrArray *addrs;
|
||||
|
@ -332,21 +332,21 @@ test_setting_ip4_config_labels (void)
|
|||
GVariant *dict, *setting_dict, *value;
|
||||
GError *error = NULL;
|
||||
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
g_object_set (G_OBJECT (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NULL);
|
||||
|
||||
/* addr 1 */
|
||||
addr = nm_ip_address_new (AF_INET, "1.1.1.1", 24, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
nm_setting_ip4_config_add_address (s_ip4, addr);
|
||||
nm_setting_ip_config_add_address (s_ip4, addr);
|
||||
nm_ip_address_unref (addr);
|
||||
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, 0);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, 0);
|
||||
label = nm_ip_address_get_attribute (addr, "label");
|
||||
g_assert (label == NULL);
|
||||
|
||||
|
@ -355,12 +355,12 @@ test_setting_ip4_config_labels (void)
|
|||
g_assert_no_error (error);
|
||||
nm_ip_address_set_attribute (addr, "label", g_variant_new_string ("eth0:1"));
|
||||
|
||||
nm_setting_ip4_config_add_address (s_ip4, addr);
|
||||
nm_setting_ip_config_add_address (s_ip4, addr);
|
||||
nm_ip_address_unref (addr);
|
||||
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, 1);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, 1);
|
||||
label = nm_ip_address_get_attribute (addr, "label");
|
||||
g_assert (label != NULL);
|
||||
g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1");
|
||||
|
@ -370,27 +370,27 @@ test_setting_ip4_config_labels (void)
|
|||
g_assert_no_error (error);
|
||||
nm_ip_address_set_attribute (addr, "label", NULL);
|
||||
|
||||
nm_setting_ip4_config_add_address (s_ip4, addr);
|
||||
nm_setting_ip_config_add_address (s_ip4, addr);
|
||||
nm_ip_address_unref (addr);
|
||||
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, 2);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, 2);
|
||||
label = nm_ip_address_get_attribute (addr, "label");
|
||||
g_assert (label == NULL);
|
||||
|
||||
/* Remove addr 1 and re-verify remaining addresses */
|
||||
nm_setting_ip4_config_remove_address (s_ip4, 0);
|
||||
nm_setting_ip_config_remove_address (s_ip4, 0);
|
||||
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, 0);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, 0);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "2.2.2.2");
|
||||
label = nm_ip_address_get_attribute (addr, "label");
|
||||
g_assert (label != NULL);
|
||||
g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1");
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, 1);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, 1);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "3.3.3.3");
|
||||
label = nm_ip_address_get_attribute (addr, "label");
|
||||
g_assert (label == NULL);
|
||||
|
@ -422,40 +422,40 @@ test_setting_ip4_config_labels (void)
|
|||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (conn);
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, 0);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, 0);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "2.2.2.2");
|
||||
label = nm_ip_address_get_attribute (addr, "label");
|
||||
g_assert (label != NULL);
|
||||
g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1");
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, 1);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, 1);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "3.3.3.3");
|
||||
label = nm_ip_address_get_attribute (addr, "label");
|
||||
g_assert (label == NULL);
|
||||
|
||||
/* Test explicit property assignment */
|
||||
g_object_get (G_OBJECT (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_ADDRESSES, &addrs,
|
||||
NM_SETTING_IP_CONFIG_ADDRESSES, &addrs,
|
||||
NULL);
|
||||
|
||||
nm_setting_ip4_config_clear_addresses (s_ip4);
|
||||
g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 0);
|
||||
nm_setting_ip_config_clear_addresses (s_ip4);
|
||||
g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 0);
|
||||
|
||||
g_object_set (G_OBJECT (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_ADDRESSES, addrs,
|
||||
NM_SETTING_IP_CONFIG_ADDRESSES, addrs,
|
||||
NULL);
|
||||
g_ptr_array_unref (addrs);
|
||||
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 2);
|
||||
g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 2);
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, 0);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, 0);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "2.2.2.2");
|
||||
label = nm_ip_address_get_attribute (addr, "label");
|
||||
g_assert (label != NULL);
|
||||
g_assert_cmpstr (g_variant_get_string (label, NULL), ==, "eth0:1");
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, 1);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, 1);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (addr), ==, "3.3.3.3");
|
||||
label = nm_ip_address_get_attribute (addr, "label");
|
||||
g_assert (label == NULL);
|
||||
|
@ -996,8 +996,8 @@ new_test_connection (void)
|
|||
|
||||
setting = nm_setting_ip4_config_new ();
|
||||
g_object_set (G_OBJECT (setting),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, "eyeofthetiger",
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, "eyeofthetiger",
|
||||
NULL);
|
||||
nm_connection_add_setting (connection, setting);
|
||||
|
||||
|
@ -1045,7 +1045,7 @@ new_connection_dict (char **out_uuid,
|
|||
/* IP6 */
|
||||
g_variant_builder_init (&setting_builder, NM_VARIANT_TYPE_SETTING);
|
||||
g_variant_builder_add (&setting_builder, "{sv}",
|
||||
NM_SETTING_IP6_CONFIG_METHOD,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
g_variant_new_string (*out_expected_ip6_method));
|
||||
g_variant_builder_add (&conn_builder, "{sa{sv}}",
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
|
@ -1062,7 +1062,7 @@ test_connection_replace_settings (void)
|
|||
GError *error = NULL;
|
||||
gboolean success;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
char *uuid = NULL;
|
||||
const char *expected_id = NULL, *expected_method = NULL;
|
||||
|
||||
|
@ -1086,7 +1086,7 @@ test_connection_replace_settings (void)
|
|||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
g_assert (s_ip6);
|
||||
g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, expected_method);
|
||||
g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, expected_method);
|
||||
|
||||
g_free (uuid);
|
||||
g_variant_unref (new_settings);
|
||||
|
@ -1217,7 +1217,7 @@ test_connection_new_from_dbus (void)
|
|||
GVariant *new_settings;
|
||||
GError *error = NULL;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
char *uuid = NULL;
|
||||
const char *expected_id = NULL, *expected_method = NULL;
|
||||
|
||||
|
@ -1239,7 +1239,7 @@ test_connection_new_from_dbus (void)
|
|||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
g_assert (s_ip6);
|
||||
g_assert_cmpstr (nm_setting_ip6_config_get_method (s_ip6), ==, expected_method);
|
||||
g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip6), ==, expected_method);
|
||||
|
||||
g_free (uuid);
|
||||
g_variant_unref (new_settings);
|
||||
|
@ -1630,18 +1630,18 @@ test_connection_diff_a_only (void)
|
|||
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN },
|
||||
} },
|
||||
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, {
|
||||
{ NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP4_CONFIG_DNS, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP4_CONFIG_DNS_SEARCH, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP4_CONFIG_ADDRESSES, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP4_CONFIG_ROUTES, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP_CONFIG_DNS, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP_CONFIG_DNS_SEARCH, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP_CONFIG_ADDRESSES, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP_CONFIG_ROUTES, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP4_CONFIG_MAY_FAIL, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP_CONFIG_NEVER_DEFAULT, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_IP_CONFIG_MAY_FAIL, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN },
|
||||
} },
|
||||
};
|
||||
|
@ -1681,11 +1681,11 @@ test_connection_diff_different (void)
|
|||
{
|
||||
NMConnection *a, *b;
|
||||
GHashTable *out_diffs = NULL;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
gboolean same;
|
||||
const DiffSetting settings[] = {
|
||||
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, {
|
||||
{ NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A | NM_SETTING_DIFF_RESULT_IN_B },
|
||||
{ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A | NM_SETTING_DIFF_RESULT_IN_B },
|
||||
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN },
|
||||
} },
|
||||
};
|
||||
|
@ -1695,7 +1695,7 @@ test_connection_diff_different (void)
|
|||
s_ip4 = nm_connection_get_setting_ip4_config (a);
|
||||
g_assert (s_ip4);
|
||||
g_object_set (G_OBJECT (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NULL);
|
||||
|
||||
same = nm_connection_diff (a, b, NM_SETTING_COMPARE_FLAG_EXACT, &out_diffs);
|
||||
|
@ -1766,7 +1766,7 @@ test_connection_diff_inferrable (void)
|
|||
gboolean same;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWired *s_wired;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
char *uuid;
|
||||
const DiffSetting settings[] = {
|
||||
{ NM_SETTING_CONNECTION_SETTING_NAME, {
|
||||
|
@ -1794,7 +1794,7 @@ test_connection_diff_inferrable (void)
|
|||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (a);
|
||||
g_assert (s_ip4);
|
||||
g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TRUE, NULL);
|
||||
g_object_set (G_OBJECT (s_ip4), NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, TRUE, NULL);
|
||||
|
||||
/* Make sure the diff returns no results as secrets are ignored */
|
||||
same = nm_connection_diff (a, b, NM_SETTING_COMPARE_FLAG_INFERRABLE, &out_diffs);
|
||||
|
@ -1836,11 +1836,11 @@ add_generic_settings (NMConnection *connection, const char *ctype)
|
|||
g_free (uuid);
|
||||
|
||||
setting = nm_setting_ip4_config_new ();
|
||||
g_object_set (setting, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (setting, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
nm_connection_add_setting (connection, setting);
|
||||
|
||||
setting = nm_setting_ip6_config_new ();
|
||||
g_object_set (setting, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (setting, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
|
||||
nm_connection_add_setting (connection, setting);
|
||||
}
|
||||
|
||||
|
@ -2446,7 +2446,7 @@ test_setting_ip4_changed_signal (void)
|
|||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMIPAddress *addr;
|
||||
NMIPRoute *route;
|
||||
GError *error = NULL;
|
||||
|
@ -2457,53 +2457,53 @@ test_setting_ip4_changed_signal (void)
|
|||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_add_dns (s_ip4, "11.22.0.0"));
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_remove_dns (s_ip4, 0));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_add_dns (s_ip4, "11.22.0.0"));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_remove_dns (s_ip4, 0));
|
||||
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip4_config_remove_dns (s_ip4, 1));
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns->len*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns (s_ip4, 1));
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
nm_setting_ip4_config_add_dns (s_ip4, "33.44.0.0");
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_clear_dns (s_ip4));
|
||||
nm_setting_ip_config_add_dns (s_ip4, "33.44.0.0");
|
||||
ASSERT_CHANGED (nm_setting_ip_config_clear_dns (s_ip4));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_add_dns_search (s_ip4, "foobar.com"));
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_remove_dns_search (s_ip4, 0));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_add_dns_search (s_ip4, "foobar.com"));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_remove_dns_search (s_ip4, 0));
|
||||
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip4_config_remove_dns_search (s_ip4, 1));
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns_search->len*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns_search (s_ip4, 1));
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_add_dns_search (s_ip4, "foobar.com"));
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_clear_dns_searches (s_ip4));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_add_dns_search (s_ip4, "foobar.com"));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_clear_dns_searches (s_ip4));
|
||||
|
||||
addr = nm_ip_address_new (AF_INET, "22.33.0.0", 24, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_add_address (s_ip4, addr));
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_remove_address (s_ip4, 0));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_add_address (s_ip4, addr));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_remove_address (s_ip4, 0));
|
||||
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*addr != NULL*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip4_config_remove_address (s_ip4, 1));
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->addresses->len*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip_config_remove_address (s_ip4, 1));
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
nm_setting_ip4_config_add_address (s_ip4, addr);
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_clear_addresses (s_ip4));
|
||||
nm_setting_ip_config_add_address (s_ip4, addr);
|
||||
ASSERT_CHANGED (nm_setting_ip_config_clear_addresses (s_ip4));
|
||||
|
||||
route = nm_ip_route_new (AF_INET, "22.33.0.0", 24, NULL, 0, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_add_route (s_ip4, route));
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_remove_route (s_ip4, 0));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_add_route (s_ip4, route));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_remove_route (s_ip4, 0));
|
||||
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip4_config_remove_route (s_ip4, 1));
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->routes->len*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip_config_remove_route (s_ip4, 1));
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
nm_setting_ip4_config_add_route (s_ip4, route);
|
||||
ASSERT_CHANGED (nm_setting_ip4_config_clear_routes (s_ip4));
|
||||
nm_setting_ip_config_add_route (s_ip4, route);
|
||||
ASSERT_CHANGED (nm_setting_ip_config_clear_routes (s_ip4));
|
||||
|
||||
nm_ip_address_unref (addr);
|
||||
nm_ip_route_unref (route);
|
||||
|
@ -2515,7 +2515,7 @@ test_setting_ip6_changed_signal (void)
|
|||
{
|
||||
NMConnection *connection;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
NMIPAddress *addr;
|
||||
NMIPRoute *route;
|
||||
GError *error = NULL;
|
||||
|
@ -2526,54 +2526,54 @@ test_setting_ip6_changed_signal (void)
|
|||
(GCallback) test_connection_changed_cb,
|
||||
&changed);
|
||||
|
||||
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_add_dns (s_ip6, "1:2:3::4:5:6"));
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_remove_dns (s_ip6, 0));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_add_dns (s_ip6, "1:2:3::4:5:6"));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_remove_dns (s_ip6, 0));
|
||||
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip6_config_remove_dns (s_ip6, 1));
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns->len*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns (s_ip6, 1));
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
nm_setting_ip6_config_add_dns (s_ip6, "1:2:3::4:5:6");
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_clear_dns (s_ip6));
|
||||
nm_setting_ip_config_add_dns (s_ip6, "1:2:3::4:5:6");
|
||||
ASSERT_CHANGED (nm_setting_ip_config_clear_dns (s_ip6));
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_add_dns_search (s_ip6, "foobar.com"));
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_remove_dns_search (s_ip6, 0));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_add_dns_search (s_ip6, "foobar.com"));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_remove_dns_search (s_ip6, 0));
|
||||
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip6_config_remove_dns_search (s_ip6, 1));
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns_search->len*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns_search (s_ip6, 1));
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
nm_setting_ip6_config_add_dns_search (s_ip6, "foobar.com");
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_clear_dns_searches (s_ip6));
|
||||
nm_setting_ip_config_add_dns_search (s_ip6, "foobar.com");
|
||||
ASSERT_CHANGED (nm_setting_ip_config_clear_dns_searches (s_ip6));
|
||||
|
||||
addr = nm_ip_address_new (AF_INET6, "1:2:3::4:5:6", 64, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_add_address (s_ip6, addr));
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_remove_address (s_ip6, 0));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_add_address (s_ip6, addr));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_remove_address (s_ip6, 0));
|
||||
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip6_config_remove_address (s_ip6, 1));
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->addresses->len*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip_config_remove_address (s_ip6, 1));
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
nm_setting_ip6_config_add_address (s_ip6, addr);
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_clear_addresses (s_ip6));
|
||||
nm_setting_ip_config_add_address (s_ip6, addr);
|
||||
ASSERT_CHANGED (nm_setting_ip_config_clear_addresses (s_ip6));
|
||||
|
||||
route = nm_ip_route_new (AF_INET6, "1:2:3::4:5:6", 128, NULL, 0, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_add_route (s_ip6, route));
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_remove_route (s_ip6, 0));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_add_route (s_ip6, route));
|
||||
ASSERT_CHANGED (nm_setting_ip_config_remove_route (s_ip6, 0));
|
||||
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*elt != NULL*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip6_config_remove_route (s_ip6, 1));
|
||||
g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->routes->len*");
|
||||
ASSERT_UNCHANGED (nm_setting_ip_config_remove_route (s_ip6, 1));
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
nm_setting_ip6_config_add_route (s_ip6, route);
|
||||
ASSERT_CHANGED (nm_setting_ip6_config_clear_routes (s_ip6));
|
||||
nm_setting_ip_config_add_route (s_ip6, route);
|
||||
ASSERT_CHANGED (nm_setting_ip_config_clear_routes (s_ip6));
|
||||
|
||||
nm_ip_address_unref (addr);
|
||||
nm_ip_route_unref (route);
|
||||
|
@ -2834,12 +2834,12 @@ test_connection_normalize_virtual_iface_name (void)
|
|||
|
||||
nm_connection_add_setting (con,
|
||||
g_object_new (NM_TYPE_SETTING_IP4_CONFIG,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NULL));
|
||||
|
||||
nm_connection_add_setting (con,
|
||||
g_object_new (NM_TYPE_SETTING_IP6_CONFIG,
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NULL));
|
||||
|
||||
s_vlan = nm_connection_get_setting_vlan (con);
|
||||
|
|
|
@ -125,7 +125,7 @@ make_tls_connection (const char *detail, NMSetting8021xCKScheme scheme)
|
|||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
|
||||
ASSERT (nm_connection_verify (connection, &error) == TRUE,
|
||||
detail, "failed to verify connection: %s",
|
||||
|
@ -293,7 +293,7 @@ make_tls_phase2_connection (const char *detail, NMSetting8021xCKScheme scheme)
|
|||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
|
||||
ASSERT (nm_connection_verify (connection, &error) == TRUE,
|
||||
detail, "failed to verify connection: %s",
|
||||
|
|
|
@ -551,74 +551,45 @@ global:
|
|||
nm_setting_infiniband_get_type;
|
||||
nm_setting_infiniband_get_virtual_interface_name;
|
||||
nm_setting_infiniband_new;
|
||||
nm_setting_ip4_config_add_address;
|
||||
nm_setting_ip4_config_add_dns;
|
||||
nm_setting_ip4_config_add_dns_search;
|
||||
nm_setting_ip4_config_add_route;
|
||||
nm_setting_ip4_config_clear_addresses;
|
||||
nm_setting_ip4_config_clear_dns;
|
||||
nm_setting_ip4_config_clear_dns_searches;
|
||||
nm_setting_ip4_config_clear_routes;
|
||||
nm_setting_ip4_config_get_address;
|
||||
nm_setting_ip4_config_get_dhcp_client_id;
|
||||
nm_setting_ip4_config_get_dhcp_hostname;
|
||||
nm_setting_ip4_config_get_dhcp_send_hostname;
|
||||
nm_setting_ip4_config_get_dns;
|
||||
nm_setting_ip4_config_get_dns_search;
|
||||
nm_setting_ip4_config_get_ignore_auto_dns;
|
||||
nm_setting_ip4_config_get_ignore_auto_routes;
|
||||
nm_setting_ip4_config_get_may_fail;
|
||||
nm_setting_ip4_config_get_method;
|
||||
nm_setting_ip4_config_get_never_default;
|
||||
nm_setting_ip4_config_get_num_addresses;
|
||||
nm_setting_ip4_config_get_num_dns;
|
||||
nm_setting_ip4_config_get_num_dns_searches;
|
||||
nm_setting_ip4_config_get_num_routes;
|
||||
nm_setting_ip4_config_get_route;
|
||||
nm_setting_ip4_config_get_type;
|
||||
nm_setting_ip4_config_new;
|
||||
nm_setting_ip4_config_remove_address;
|
||||
nm_setting_ip4_config_remove_address_by_value;
|
||||
nm_setting_ip4_config_remove_dns;
|
||||
nm_setting_ip4_config_remove_dns_by_value;
|
||||
nm_setting_ip4_config_remove_dns_search;
|
||||
nm_setting_ip4_config_remove_dns_search_by_value;
|
||||
nm_setting_ip4_config_remove_route;
|
||||
nm_setting_ip4_config_remove_route_by_value;
|
||||
nm_setting_ip6_config_add_address;
|
||||
nm_setting_ip6_config_add_dns;
|
||||
nm_setting_ip6_config_add_dns_search;
|
||||
nm_setting_ip6_config_add_route;
|
||||
nm_setting_ip6_config_clear_addresses;
|
||||
nm_setting_ip6_config_clear_dns;
|
||||
nm_setting_ip6_config_clear_dns_searches;
|
||||
nm_setting_ip6_config_clear_routes;
|
||||
nm_setting_ip6_config_get_address;
|
||||
nm_setting_ip6_config_get_dhcp_hostname;
|
||||
nm_setting_ip6_config_get_dns;
|
||||
nm_setting_ip6_config_get_dns_search;
|
||||
nm_setting_ip6_config_get_ignore_auto_dns;
|
||||
nm_setting_ip6_config_get_ignore_auto_routes;
|
||||
nm_setting_ip6_config_get_ip6_privacy;
|
||||
nm_setting_ip6_config_get_may_fail;
|
||||
nm_setting_ip6_config_get_method;
|
||||
nm_setting_ip6_config_get_never_default;
|
||||
nm_setting_ip6_config_get_num_addresses;
|
||||
nm_setting_ip6_config_get_num_dns;
|
||||
nm_setting_ip6_config_get_num_dns_searches;
|
||||
nm_setting_ip6_config_get_num_routes;
|
||||
nm_setting_ip6_config_get_route;
|
||||
nm_setting_ip6_config_get_type;
|
||||
nm_setting_ip6_config_new;
|
||||
nm_setting_ip6_config_privacy_get_type;
|
||||
nm_setting_ip6_config_remove_address;
|
||||
nm_setting_ip6_config_remove_address_by_value;
|
||||
nm_setting_ip6_config_remove_dns;
|
||||
nm_setting_ip6_config_remove_dns_by_value;
|
||||
nm_setting_ip6_config_remove_dns_search;
|
||||
nm_setting_ip6_config_remove_dns_search_by_value;
|
||||
nm_setting_ip6_config_remove_route;
|
||||
nm_setting_ip6_config_remove_route_by_value;
|
||||
nm_setting_ip_config_add_address;
|
||||
nm_setting_ip_config_add_dns;
|
||||
nm_setting_ip_config_add_dns_search;
|
||||
nm_setting_ip_config_add_route;
|
||||
nm_setting_ip_config_clear_addresses;
|
||||
nm_setting_ip_config_clear_dns;
|
||||
nm_setting_ip_config_clear_dns_searches;
|
||||
nm_setting_ip_config_clear_routes;
|
||||
nm_setting_ip_config_get_address;
|
||||
nm_setting_ip_config_get_dhcp_hostname;
|
||||
nm_setting_ip_config_get_dhcp_send_hostname;
|
||||
nm_setting_ip_config_get_dns;
|
||||
nm_setting_ip_config_get_dns_search;
|
||||
nm_setting_ip_config_get_ignore_auto_dns;
|
||||
nm_setting_ip_config_get_ignore_auto_routes;
|
||||
nm_setting_ip_config_get_may_fail;
|
||||
nm_setting_ip_config_get_method;
|
||||
nm_setting_ip_config_get_never_default;
|
||||
nm_setting_ip_config_get_num_addresses;
|
||||
nm_setting_ip_config_get_num_dns;
|
||||
nm_setting_ip_config_get_num_dns_searches;
|
||||
nm_setting_ip_config_get_num_routes;
|
||||
nm_setting_ip_config_get_route;
|
||||
nm_setting_ip_config_get_type;
|
||||
nm_setting_ip_config_remove_address;
|
||||
nm_setting_ip_config_remove_address_by_value;
|
||||
nm_setting_ip_config_remove_dns;
|
||||
nm_setting_ip_config_remove_dns_by_value;
|
||||
nm_setting_ip_config_remove_dns_search;
|
||||
nm_setting_ip_config_remove_dns_search_by_value;
|
||||
nm_setting_ip_config_remove_route;
|
||||
nm_setting_ip_config_remove_route_by_value;
|
||||
nm_setting_lookup_type;
|
||||
nm_setting_olpc_mesh_get_channel;
|
||||
nm_setting_olpc_mesh_get_dhcp_anycast_address;
|
||||
|
|
|
@ -59,6 +59,7 @@ libnm-core/nm-setting-connection.c
|
|||
libnm-core/nm-setting-dcb.c
|
||||
libnm-core/nm-setting-gsm.c
|
||||
libnm-core/nm-setting-infiniband.c
|
||||
libnm-core/nm-setting-ip-config.c
|
||||
libnm-core/nm-setting-ip4-config.c
|
||||
libnm-core/nm-setting-ip6-config.c
|
||||
libnm-core/nm-setting-olpc-mesh.c
|
||||
|
|
|
@ -1212,8 +1212,7 @@ nm_utils_get_ip_config_method (NMConnection *connection,
|
|||
GType ip_setting_type)
|
||||
{
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4, *s_ip6;
|
||||
const char *method;
|
||||
|
||||
s_con = nm_connection_get_setting_connection (connection);
|
||||
|
@ -1226,7 +1225,7 @@ nm_utils_get_ip_config_method (NMConnection *connection,
|
|||
else {
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
g_return_val_if_fail (s_ip4 != NULL, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
|
||||
method = nm_setting_ip4_config_get_method (s_ip4);
|
||||
method = nm_setting_ip_config_get_method (s_ip4);
|
||||
g_return_val_if_fail (method != NULL, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
|
||||
|
||||
return method;
|
||||
|
@ -1240,7 +1239,7 @@ nm_utils_get_ip_config_method (NMConnection *connection,
|
|||
else {
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
g_return_val_if_fail (s_ip6 != NULL, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
|
||||
method = nm_setting_ip6_config_get_method (s_ip6);
|
||||
method = nm_setting_ip_config_get_method (s_ip6);
|
||||
g_return_val_if_fail (method != NULL, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
|
||||
|
||||
return method;
|
||||
|
@ -1387,12 +1386,12 @@ check_ip6_method (NMConnection *orig,
|
|||
{
|
||||
GHashTable *props;
|
||||
const char *orig_ip6_method, *candidate_ip6_method;
|
||||
NMSettingIP6Config *candidate_ip6;
|
||||
NMSettingIPConfig *candidate_ip6;
|
||||
gboolean allow = FALSE;
|
||||
|
||||
props = check_property_in_hash (settings,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_METHOD);
|
||||
NM_SETTING_IP_CONFIG_METHOD);
|
||||
if (!props)
|
||||
return TRUE;
|
||||
|
||||
|
@ -1408,7 +1407,7 @@ check_ip6_method (NMConnection *orig,
|
|||
|
||||
if ( strcmp (orig_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0
|
||||
&& strcmp (candidate_ip6_method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0
|
||||
&& (!candidate_ip6 || nm_setting_ip6_config_get_may_fail (candidate_ip6))) {
|
||||
&& (!candidate_ip6 || nm_setting_ip_config_get_may_fail (candidate_ip6))) {
|
||||
allow = TRUE;
|
||||
}
|
||||
|
||||
|
@ -1425,7 +1424,7 @@ check_ip6_method (NMConnection *orig,
|
|||
if (allow) {
|
||||
remove_from_hash (settings, props,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_METHOD);
|
||||
NM_SETTING_IP_CONFIG_METHOD);
|
||||
}
|
||||
return allow;
|
||||
}
|
||||
|
@ -1438,11 +1437,11 @@ check_ip4_method (NMConnection *orig,
|
|||
{
|
||||
GHashTable *props;
|
||||
const char *orig_ip4_method, *candidate_ip4_method;
|
||||
NMSettingIP4Config *candidate_ip4;
|
||||
NMSettingIPConfig *candidate_ip4;
|
||||
|
||||
props = check_property_in_hash (settings,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_METHOD);
|
||||
NM_SETTING_IP_CONFIG_METHOD);
|
||||
if (!props)
|
||||
return TRUE;
|
||||
|
||||
|
@ -1457,11 +1456,11 @@ check_ip4_method (NMConnection *orig,
|
|||
|
||||
if ( strcmp (orig_ip4_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0
|
||||
&& strcmp (candidate_ip4_method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0
|
||||
&& (!candidate_ip4 || nm_setting_ip4_config_get_may_fail (candidate_ip4))
|
||||
&& (!candidate_ip4 || nm_setting_ip_config_get_may_fail (candidate_ip4))
|
||||
&& (device_has_carrier == FALSE)) {
|
||||
remove_from_hash (settings, props,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_METHOD);
|
||||
NM_SETTING_IP_CONFIG_METHOD);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
|
@ -211,16 +211,16 @@ pan_connection_check_create (NMBluezDevice *self)
|
|||
/* Setting: IPv4 */
|
||||
setting = nm_setting_ip4_config_new ();
|
||||
g_object_set (G_OBJECT (setting),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP4_CONFIG_MAY_FAIL, FALSE,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_MAY_FAIL, FALSE,
|
||||
NULL);
|
||||
nm_connection_add_setting (connection, setting);
|
||||
|
||||
/* Setting: IPv6 */
|
||||
setting = nm_setting_ip6_config_new ();
|
||||
g_object_set (G_OBJECT (setting),
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
|
||||
NULL);
|
||||
nm_connection_add_setting (connection, setting);
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "nm-device-gre.h"
|
||||
#include "nm-device-private.h"
|
||||
|
|
|
@ -2106,8 +2106,7 @@ gboolean
|
|||
nm_device_ip_config_should_fail (NMDevice *self, gboolean ip6)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4, *s_ip6;
|
||||
|
||||
g_return_val_if_fail (self != NULL, TRUE);
|
||||
|
||||
|
@ -2117,11 +2116,11 @@ nm_device_ip_config_should_fail (NMDevice *self, gboolean ip6)
|
|||
/* Fail the connection if the failed IP method is required to complete */
|
||||
if (ip6) {
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
if (!nm_setting_ip6_config_get_may_fail (s_ip6))
|
||||
if (!nm_setting_ip_config_get_may_fail (s_ip6))
|
||||
return TRUE;
|
||||
} else {
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
if (!nm_setting_ip4_config_get_may_fail (s_ip4))
|
||||
if (!nm_setting_ip_config_get_may_fail (s_ip4))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2778,7 +2777,7 @@ dhcp4_start (NMDevice *self,
|
|||
NMDeviceStateReason *reason)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
const guint8 *hw_addr;
|
||||
size_t hw_addr_len = 0;
|
||||
GByteArray *tmp = NULL;
|
||||
|
@ -2804,9 +2803,9 @@ dhcp4_start (NMDevice *self,
|
|||
tmp,
|
||||
nm_connection_get_uuid (connection),
|
||||
nm_device_get_priority (self),
|
||||
nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4),
|
||||
nm_setting_ip4_config_get_dhcp_hostname (s_ip4),
|
||||
nm_setting_ip4_config_get_dhcp_client_id (s_ip4),
|
||||
nm_setting_ip_config_get_dhcp_send_hostname (s_ip4),
|
||||
nm_setting_ip_config_get_dhcp_hostname (s_ip4),
|
||||
nm_setting_ip4_config_get_dhcp_client_id (NM_SETTING_IP4_CONFIG (s_ip4)),
|
||||
priv->dhcp_timeout,
|
||||
priv->dhcp_anycast_address);
|
||||
|
||||
|
@ -2864,16 +2863,16 @@ release_shared_ip (gpointer data)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
reserve_shared_ip (NMDevice *self, NMSettingIP4Config *s_ip4, NMPlatformIP4Address *address)
|
||||
reserve_shared_ip (NMDevice *self, NMSettingIPConfig *s_ip4, NMPlatformIP4Address *address)
|
||||
{
|
||||
if (G_UNLIKELY (shared_ips == NULL))
|
||||
shared_ips = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
|
||||
memset (address, 0, sizeof (*address));
|
||||
|
||||
if (s_ip4 && nm_setting_ip4_config_get_num_addresses (s_ip4)) {
|
||||
if (s_ip4 && nm_setting_ip_config_get_num_addresses (s_ip4)) {
|
||||
/* Use the first user-supplied address */
|
||||
NMIPAddress *user = nm_setting_ip4_config_get_address (s_ip4, 0);
|
||||
NMIPAddress *user = nm_setting_ip_config_get_address (s_ip4, 0);
|
||||
|
||||
g_assert (user);
|
||||
nm_ip_address_get_address_binary (user, &address->address);
|
||||
|
@ -2964,8 +2963,7 @@ connection_ip6_method_requires_carrier (NMConnection *connection,
|
|||
static gboolean
|
||||
connection_requires_carrier (NMConnection *connection)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4, *s_ip6;
|
||||
gboolean ip4_carrier_wanted, ip6_carrier_wanted;
|
||||
gboolean ip4_used = FALSE, ip6_used = FALSE;
|
||||
|
||||
|
@ -2975,7 +2973,7 @@ connection_requires_carrier (NMConnection *connection)
|
|||
* requires a carrier regardless of the IPv6 method.
|
||||
*/
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
if (s_ip4 && !nm_setting_ip4_config_get_may_fail (s_ip4))
|
||||
if (s_ip4 && !nm_setting_ip_config_get_may_fail (s_ip4))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2985,7 +2983,7 @@ connection_requires_carrier (NMConnection *connection)
|
|||
* requires a carrier regardless of the IPv4 method.
|
||||
*/
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
if (s_ip6 && !nm_setting_ip6_config_get_may_fail (s_ip6))
|
||||
if (s_ip6 && !nm_setting_ip_config_get_may_fail (s_ip6))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -3320,7 +3318,7 @@ dhcp6_start (NMDevice *self,
|
|||
guint32 dhcp_opt,
|
||||
NMDeviceStateReason *reason)
|
||||
{
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
GByteArray *tmp = NULL;
|
||||
|
@ -3358,11 +3356,11 @@ dhcp6_start (NMDevice *self,
|
|||
tmp,
|
||||
nm_connection_get_uuid (connection),
|
||||
nm_device_get_priority (self),
|
||||
nm_setting_ip6_config_get_dhcp_hostname (s_ip6),
|
||||
nm_setting_ip_config_get_dhcp_hostname (s_ip6),
|
||||
priv->dhcp_timeout,
|
||||
priv->dhcp_anycast_address,
|
||||
(dhcp_opt == NM_RDISC_DHCP_LEVEL_OTHERCONF) ? TRUE : FALSE,
|
||||
nm_setting_ip6_config_get_ip6_privacy (s_ip6));
|
||||
nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6)));
|
||||
if (tmp)
|
||||
g_byte_array_free (tmp, TRUE);
|
||||
|
||||
|
@ -3373,8 +3371,8 @@ dhcp6_start (NMDevice *self,
|
|||
self);
|
||||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
if (!nm_setting_ip6_config_get_may_fail (s_ip6) ||
|
||||
!strcmp (nm_setting_ip6_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_DHCP))
|
||||
if (!nm_setting_ip_config_get_may_fail (s_ip6) ||
|
||||
!strcmp (nm_setting_ip_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_DHCP))
|
||||
nm_device_add_pending_action (self, PENDING_ACTION_DHCP6, TRUE);
|
||||
|
||||
/* DHCP devices will be notified by the DHCP manager when stuff happens */
|
||||
|
@ -3858,7 +3856,7 @@ addrconf6_start (NMDevice *self, NMSettingIP6ConfigPrivacy use_tempaddr)
|
|||
priv->rdisc_use_tempaddr = use_tempaddr;
|
||||
print_support_extended_ifa_flags (use_tempaddr);
|
||||
|
||||
if (!nm_setting_ip6_config_get_may_fail (nm_connection_get_setting_ip6_config (connection)))
|
||||
if (!nm_setting_ip_config_get_may_fail (nm_connection_get_setting_ip6_config (connection)))
|
||||
nm_device_add_pending_action (self, PENDING_ACTION_AUTOCONF6, TRUE);
|
||||
|
||||
/* ensure link local is ready... */
|
||||
|
@ -4116,10 +4114,10 @@ act_stage3_ip6_config_start (NMDevice *self,
|
|||
*/
|
||||
ip6_privacy = ip6_use_tempaddr ();
|
||||
if (ip6_privacy == NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN) {
|
||||
NMSettingIP6Config *s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
NMSettingIPConfig *s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
|
||||
if (s_ip6)
|
||||
ip6_privacy = nm_setting_ip6_config_get_ip6_privacy (s_ip6);
|
||||
ip6_privacy = nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6));
|
||||
}
|
||||
ip6_privacy = use_tempaddr_clamp (ip6_privacy);
|
||||
|
||||
|
@ -4648,7 +4646,7 @@ send_arps (NMDevice *self, const char *mode_arg)
|
|||
const char *argv[] = { NULL, mode_arg, "-q", "-I", nm_device_get_ip_iface (self), "-c", "1", NULL, NULL };
|
||||
int ip_arg = G_N_ELEMENTS (argv) - 2;
|
||||
NMConnection *connection;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
int i, num;
|
||||
NMIPAddress *addr;
|
||||
GError *error = NULL;
|
||||
|
@ -4659,7 +4657,7 @@ send_arps (NMDevice *self, const char *mode_arg)
|
|||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
if (!s_ip4)
|
||||
return;
|
||||
num = nm_setting_ip4_config_get_num_addresses (s_ip4);
|
||||
num = nm_setting_ip_config_get_num_addresses (s_ip4);
|
||||
if (num == 0)
|
||||
return;
|
||||
|
||||
|
@ -4671,7 +4669,7 @@ send_arps (NMDevice *self, const char *mode_arg)
|
|||
|
||||
for (i = 0; i < num; i++) {
|
||||
gs_free char *tmp_str = NULL;
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, i);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, i);
|
||||
argv[ip_arg] = nm_ip_address_get_address (addr);
|
||||
|
||||
_LOGD (LOGD_DEVICE | LOGD_IP4,
|
||||
|
@ -4719,7 +4717,7 @@ arp_announce (NMDevice *self)
|
|||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMConnection *connection;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
int num;
|
||||
|
||||
arp_cleanup (self);
|
||||
|
@ -4733,7 +4731,7 @@ arp_announce (NMDevice *self)
|
|||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
if (!s_ip4)
|
||||
return;
|
||||
num = nm_setting_ip4_config_get_num_addresses (s_ip4);
|
||||
num = nm_setting_ip_config_get_num_addresses (s_ip4);
|
||||
if (num == 0)
|
||||
return;
|
||||
|
||||
|
|
|
@ -2809,14 +2809,14 @@ act_stage3_ip4_config_start (NMDevice *device,
|
|||
NMDeviceStateReason *reason)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
const char *method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
|
||||
|
||||
connection = nm_device_get_connection (device);
|
||||
g_assert (connection);
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
if (s_ip4)
|
||||
method = nm_setting_ip4_config_get_method (s_ip4);
|
||||
method = nm_setting_ip_config_get_method (s_ip4);
|
||||
|
||||
/* Indicate that a critical protocol is about to start */
|
||||
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0)
|
||||
|
@ -2831,14 +2831,14 @@ act_stage3_ip6_config_start (NMDevice *device,
|
|||
NMDeviceStateReason *reason)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
const char *method = NM_SETTING_IP6_CONFIG_METHOD_AUTO;
|
||||
|
||||
connection = nm_device_get_connection (device);
|
||||
g_assert (connection);
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
if (s_ip6)
|
||||
method = nm_setting_ip6_config_get_method (s_ip6);
|
||||
method = nm_setting_ip_config_get_method (s_ip6);
|
||||
|
||||
/* Indicate that a critical protocol is about to start */
|
||||
if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0 ||
|
||||
|
@ -2938,7 +2938,7 @@ static NMActStageReturn
|
|||
act_stage4_ip4_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
gboolean may_fail = FALSE, chain_up = FALSE;
|
||||
NMActStageReturn ret;
|
||||
|
||||
|
@ -2946,7 +2946,7 @@ act_stage4_ip4_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
|
|||
g_assert (connection);
|
||||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
may_fail = nm_setting_ip4_config_get_may_fail (s_ip4);
|
||||
may_fail = nm_setting_ip_config_get_may_fail (s_ip4);
|
||||
|
||||
ret = handle_ip_config_timeout (NM_DEVICE_WIFI (device), connection, may_fail, &chain_up, reason);
|
||||
if (chain_up)
|
||||
|
@ -2959,7 +2959,7 @@ static NMActStageReturn
|
|||
act_stage4_ip6_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
gboolean may_fail = FALSE, chain_up = FALSE;
|
||||
NMActStageReturn ret;
|
||||
|
||||
|
@ -2967,7 +2967,7 @@ act_stage4_ip6_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
|
|||
g_assert (connection);
|
||||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
may_fail = nm_setting_ip6_config_get_may_fail (s_ip6);
|
||||
may_fail = nm_setting_ip_config_get_may_fail (s_ip6);
|
||||
|
||||
ret = handle_ip_config_timeout (NM_DEVICE_WIFI (device), connection, may_fail, &chain_up, reason);
|
||||
if (chain_up)
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <glib/gi18n.h>
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "nm-modem-broadband.h"
|
||||
|
|
|
@ -235,26 +235,25 @@ nm_modem_get_connection_ip_type (NMModem *self,
|
|||
GError **error)
|
||||
{
|
||||
NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4, *s_ip6;
|
||||
const char *method;
|
||||
gboolean ip4 = TRUE, ip6 = TRUE;
|
||||
gboolean ip4_may_fail = TRUE, ip6_may_fail = TRUE;
|
||||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
if (s_ip4) {
|
||||
method = nm_setting_ip4_config_get_method (s_ip4);
|
||||
method = nm_setting_ip_config_get_method (s_ip4);
|
||||
if (g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0)
|
||||
ip4 = FALSE;
|
||||
ip4_may_fail = nm_setting_ip4_config_get_may_fail (s_ip4);
|
||||
ip4_may_fail = nm_setting_ip_config_get_may_fail (s_ip4);
|
||||
}
|
||||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
if (s_ip6) {
|
||||
method = nm_setting_ip6_config_get_method (s_ip6);
|
||||
method = nm_setting_ip_config_get_method (s_ip6);
|
||||
if (g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0)
|
||||
ip6 = FALSE;
|
||||
ip6_may_fail = nm_setting_ip6_config_get_may_fail (s_ip6);
|
||||
ip6_may_fail = nm_setting_ip_config_get_may_fail (s_ip6);
|
||||
}
|
||||
|
||||
if (ip4 && !ip6) {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <glib/gi18n.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "nm-dhcp-dhclient-utils.h"
|
||||
#include "nm-ip4-config.h"
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "nm-logging.h"
|
||||
#include "nm-dhcp-utils.h"
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "nm-dhcp-dhclient-utils.h"
|
||||
#include "nm-utils.h"
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "nm-ip4-config.h"
|
||||
|
||||
|
@ -296,7 +297,7 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex)
|
|||
}
|
||||
|
||||
void
|
||||
nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, int default_route_metric)
|
||||
nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, int default_route_metric)
|
||||
{
|
||||
guint naddresses, nroutes, nnameservers, nsearches;
|
||||
int i;
|
||||
|
@ -304,20 +305,22 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
|
|||
if (!setting)
|
||||
return;
|
||||
|
||||
g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (config));
|
||||
|
||||
naddresses = nm_setting_ip4_config_get_num_addresses (setting);
|
||||
nroutes = nm_setting_ip4_config_get_num_routes (setting);
|
||||
nnameservers = nm_setting_ip4_config_get_num_dns (setting);
|
||||
nsearches = nm_setting_ip4_config_get_num_dns_searches (setting);
|
||||
naddresses = nm_setting_ip_config_get_num_addresses (setting);
|
||||
nroutes = nm_setting_ip_config_get_num_routes (setting);
|
||||
nnameservers = nm_setting_ip_config_get_num_dns (setting);
|
||||
nsearches = nm_setting_ip_config_get_num_dns_searches (setting);
|
||||
|
||||
/* Gateway */
|
||||
if (nm_setting_ip4_config_get_never_default (setting))
|
||||
if (nm_setting_ip_config_get_never_default (setting))
|
||||
nm_ip4_config_set_never_default (config, TRUE);
|
||||
else if (nm_setting_ip4_config_get_ignore_auto_routes (setting))
|
||||
else if (nm_setting_ip_config_get_ignore_auto_routes (setting))
|
||||
nm_ip4_config_set_never_default (config, FALSE);
|
||||
for (i = 0; i < naddresses; i++) {
|
||||
const char *gateway_str = nm_ip_address_get_gateway (nm_setting_ip4_config_get_address (setting, i));
|
||||
const char *gateway_str = nm_ip_address_get_gateway (nm_setting_ip_config_get_address (setting, i));
|
||||
guint32 gateway;
|
||||
|
||||
if (gateway_str) {
|
||||
|
@ -329,7 +332,7 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
|
|||
|
||||
/* Addresses */
|
||||
for (i = 0; i < naddresses; i++) {
|
||||
NMIPAddress *s_addr = nm_setting_ip4_config_get_address (setting, i);
|
||||
NMIPAddress *s_addr = nm_setting_ip_config_get_address (setting, i);
|
||||
GVariant *label;
|
||||
NMPlatformIP4Address address;
|
||||
|
||||
|
@ -348,10 +351,10 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
|
|||
}
|
||||
|
||||
/* Routes */
|
||||
if (nm_setting_ip4_config_get_ignore_auto_routes (setting))
|
||||
if (nm_setting_ip_config_get_ignore_auto_routes (setting))
|
||||
nm_ip4_config_reset_routes (config);
|
||||
for (i = 0; i < nroutes; i++) {
|
||||
NMIPRoute *s_route = nm_setting_ip4_config_get_route (setting, i);
|
||||
NMIPRoute *s_route = nm_setting_ip_config_get_route (setting, i);
|
||||
NMPlatformIP4Route route;
|
||||
|
||||
memset (&route, 0, sizeof (route));
|
||||
|
@ -367,7 +370,7 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
|
|||
}
|
||||
|
||||
/* DNS */
|
||||
if (nm_setting_ip4_config_get_ignore_auto_dns (setting)) {
|
||||
if (nm_setting_ip_config_get_ignore_auto_dns (setting)) {
|
||||
nm_ip4_config_reset_nameservers (config);
|
||||
nm_ip4_config_reset_domains (config);
|
||||
nm_ip4_config_reset_searches (config);
|
||||
|
@ -375,11 +378,11 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
|
|||
for (i = 0; i < nnameservers; i++) {
|
||||
guint32 ip;
|
||||
|
||||
if (inet_pton (AF_INET, nm_setting_ip4_config_get_dns (setting, i), &ip) == 1)
|
||||
if (inet_pton (AF_INET, nm_setting_ip_config_get_dns (setting, i), &ip) == 1)
|
||||
nm_ip4_config_add_nameserver (config, ip);
|
||||
}
|
||||
for (i = 0; i < nsearches; i++)
|
||||
nm_ip4_config_add_search (config, nm_setting_ip4_config_get_dns_search (setting, i));
|
||||
nm_ip4_config_add_search (config, nm_setting_ip_config_get_dns_search (setting, i));
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (config));
|
||||
}
|
||||
|
@ -387,17 +390,17 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, i
|
|||
NMSetting *
|
||||
nm_ip4_config_create_setting (const NMIP4Config *config)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
guint32 gateway;
|
||||
guint naddresses, nroutes, nnameservers, nsearches;
|
||||
const char *method = NULL;
|
||||
int i;
|
||||
|
||||
s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
|
||||
s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
|
||||
if (!config) {
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
|
||||
NULL);
|
||||
return NM_SETTING (s_ip4);
|
||||
}
|
||||
|
@ -433,14 +436,14 @@ nm_ip4_config_create_setting (const NMIP4Config *config)
|
|||
if (*address->label)
|
||||
nm_ip_address_set_attribute (s_addr, "label", g_variant_new_string (address->label));
|
||||
|
||||
nm_setting_ip4_config_add_address (s_ip4, s_addr);
|
||||
nm_setting_ip_config_add_address (s_ip4, s_addr);
|
||||
nm_ip_address_unref (s_addr);
|
||||
}
|
||||
|
||||
/* Use 'disabled' if the method wasn't previously set */
|
||||
if (!method)
|
||||
method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, method, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, method, NULL);
|
||||
|
||||
/* Routes */
|
||||
for (i = 0; i < nroutes; i++) {
|
||||
|
@ -459,7 +462,7 @@ nm_ip4_config_create_setting (const NMIP4Config *config)
|
|||
&route->network, route->plen,
|
||||
&route->gateway, route->metric,
|
||||
NULL);
|
||||
nm_setting_ip4_config_add_route (s_ip4, s_route);
|
||||
nm_setting_ip_config_add_route (s_ip4, s_route);
|
||||
nm_ip_route_unref (s_route);
|
||||
}
|
||||
|
||||
|
@ -467,12 +470,12 @@ nm_ip4_config_create_setting (const NMIP4Config *config)
|
|||
for (i = 0; i < nnameservers; i++) {
|
||||
guint32 nameserver = nm_ip4_config_get_nameserver (config, i);
|
||||
|
||||
nm_setting_ip4_config_add_dns (s_ip4, nm_utils_inet4_ntop (nameserver, NULL));
|
||||
nm_setting_ip_config_add_dns (s_ip4, nm_utils_inet4_ntop (nameserver, NULL));
|
||||
}
|
||||
for (i = 0; i < nsearches; i++) {
|
||||
const char *search = nm_ip4_config_get_search (config, i);
|
||||
|
||||
nm_setting_ip4_config_add_dns_search (s_ip4, search);
|
||||
nm_setting_ip_config_add_dns_search (s_ip4, search);
|
||||
}
|
||||
|
||||
return NM_SETTING (s_ip4);
|
||||
|
|
|
@ -61,7 +61,7 @@ const char * nm_ip4_config_get_dbus_path (const NMIP4Config *config);
|
|||
/* Integration with nm-platform and nm-setting */
|
||||
NMIP4Config *nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf);
|
||||
gboolean nm_ip4_config_commit (const NMIP4Config *config, int ifindex);
|
||||
void nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting, int default_route_metric);
|
||||
void nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, int default_route_metric);
|
||||
NMSetting *nm_ip4_config_create_setting (const NMIP4Config *config);
|
||||
|
||||
/* Utility functions */
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "nm-ip6-config.h"
|
||||
|
||||
|
@ -400,7 +401,7 @@ nm_ip6_config_commit (const NMIP6Config *config, int ifindex)
|
|||
}
|
||||
|
||||
void
|
||||
nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, int default_route_metric)
|
||||
nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIPConfig *setting, int default_route_metric)
|
||||
{
|
||||
guint naddresses, nroutes, nnameservers, nsearches;
|
||||
int i;
|
||||
|
@ -408,20 +409,22 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
|
|||
if (!setting)
|
||||
return;
|
||||
|
||||
naddresses = nm_setting_ip6_config_get_num_addresses (setting);
|
||||
nroutes = nm_setting_ip6_config_get_num_routes (setting);
|
||||
nnameservers = nm_setting_ip6_config_get_num_dns (setting);
|
||||
nsearches = nm_setting_ip6_config_get_num_dns_searches (setting);
|
||||
g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
|
||||
|
||||
naddresses = nm_setting_ip_config_get_num_addresses (setting);
|
||||
nroutes = nm_setting_ip_config_get_num_routes (setting);
|
||||
nnameservers = nm_setting_ip_config_get_num_dns (setting);
|
||||
nsearches = nm_setting_ip_config_get_num_dns_searches (setting);
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (config));
|
||||
|
||||
/* Gateway */
|
||||
if (nm_setting_ip6_config_get_never_default (setting))
|
||||
if (nm_setting_ip_config_get_never_default (setting))
|
||||
nm_ip6_config_set_never_default (config, TRUE);
|
||||
else if (nm_setting_ip6_config_get_ignore_auto_routes (setting))
|
||||
else if (nm_setting_ip_config_get_ignore_auto_routes (setting))
|
||||
nm_ip6_config_set_never_default (config, FALSE);
|
||||
for (i = 0; i < naddresses; i++) {
|
||||
const char *gateway_str = nm_ip_address_get_gateway (nm_setting_ip6_config_get_address (setting, i));
|
||||
const char *gateway_str = nm_ip_address_get_gateway (nm_setting_ip_config_get_address (setting, i));
|
||||
struct in6_addr gateway;
|
||||
|
||||
if (gateway_str) {
|
||||
|
@ -433,7 +436,7 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
|
|||
|
||||
/* Addresses */
|
||||
for (i = 0; i < naddresses; i++) {
|
||||
NMIPAddress *s_addr = nm_setting_ip6_config_get_address (setting, i);
|
||||
NMIPAddress *s_addr = nm_setting_ip_config_get_address (setting, i);
|
||||
NMPlatformIP6Address address;
|
||||
|
||||
memset (&address, 0, sizeof (address));
|
||||
|
@ -447,10 +450,10 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
|
|||
}
|
||||
|
||||
/* Routes */
|
||||
if (nm_setting_ip6_config_get_ignore_auto_routes (setting))
|
||||
if (nm_setting_ip_config_get_ignore_auto_routes (setting))
|
||||
nm_ip6_config_reset_routes (config);
|
||||
for (i = 0; i < nroutes; i++) {
|
||||
NMIPRoute *s_route = nm_setting_ip6_config_get_route (setting, i);
|
||||
NMIPRoute *s_route = nm_setting_ip_config_get_route (setting, i);
|
||||
NMPlatformIP6Route route;
|
||||
|
||||
memset (&route, 0, sizeof (route));
|
||||
|
@ -466,7 +469,7 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
|
|||
}
|
||||
|
||||
/* DNS */
|
||||
if (nm_setting_ip6_config_get_ignore_auto_dns (setting)) {
|
||||
if (nm_setting_ip_config_get_ignore_auto_dns (setting)) {
|
||||
nm_ip6_config_reset_nameservers (config);
|
||||
nm_ip6_config_reset_domains (config);
|
||||
nm_ip6_config_reset_searches (config);
|
||||
|
@ -474,11 +477,11 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
|
|||
for (i = 0; i < nnameservers; i++) {
|
||||
struct in6_addr ip;
|
||||
|
||||
if (inet_pton (AF_INET6, nm_setting_ip6_config_get_dns (setting, i), &ip) == 1)
|
||||
if (inet_pton (AF_INET6, nm_setting_ip_config_get_dns (setting, i), &ip) == 1)
|
||||
nm_ip6_config_add_nameserver (config, &ip);
|
||||
}
|
||||
for (i = 0; i < nsearches; i++)
|
||||
nm_ip6_config_add_search (config, nm_setting_ip6_config_get_dns_search (setting, i));
|
||||
nm_ip6_config_add_search (config, nm_setting_ip_config_get_dns_search (setting, i));
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (config));
|
||||
}
|
||||
|
@ -486,17 +489,17 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, i
|
|||
NMSetting *
|
||||
nm_ip6_config_create_setting (const NMIP6Config *config)
|
||||
{
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
const struct in6_addr *gateway;
|
||||
guint naddresses, nroutes, nnameservers, nsearches;
|
||||
const char *method = NULL;
|
||||
int i;
|
||||
|
||||
s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ());
|
||||
s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
|
||||
|
||||
if (!config) {
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
|
||||
NULL);
|
||||
return NM_SETTING (s_ip6);
|
||||
}
|
||||
|
@ -530,14 +533,14 @@ nm_ip6_config_create_setting (const NMIP6Config *config)
|
|||
method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
|
||||
|
||||
s_addr = nm_ip_address_new_binary (AF_INET6, &address->address, address->plen, gateway, NULL);
|
||||
nm_setting_ip6_config_add_address (s_ip6, s_addr);
|
||||
nm_setting_ip_config_add_address (s_ip6, s_addr);
|
||||
nm_ip_address_unref (s_addr);
|
||||
}
|
||||
|
||||
/* Use 'ignore' if the method wasn't previously set */
|
||||
if (!method)
|
||||
method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
|
||||
g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, method, NULL);
|
||||
g_object_set (s_ip6, NM_SETTING_IP_CONFIG_METHOD, method, NULL);
|
||||
|
||||
/* Routes */
|
||||
for (i = 0; i < nroutes; i++) {
|
||||
|
@ -560,7 +563,7 @@ nm_ip6_config_create_setting (const NMIP6Config *config)
|
|||
&route->network, route->plen,
|
||||
&route->gateway, route->metric,
|
||||
NULL);
|
||||
nm_setting_ip6_config_add_route (s_ip6, s_route);
|
||||
nm_setting_ip_config_add_route (s_ip6, s_route);
|
||||
nm_ip_route_unref (s_route);
|
||||
}
|
||||
|
||||
|
@ -568,12 +571,12 @@ nm_ip6_config_create_setting (const NMIP6Config *config)
|
|||
for (i = 0; i < nnameservers; i++) {
|
||||
const struct in6_addr *nameserver = nm_ip6_config_get_nameserver (config, i);
|
||||
|
||||
nm_setting_ip6_config_add_dns (s_ip6, nm_utils_inet6_ntop (nameserver, NULL));
|
||||
nm_setting_ip_config_add_dns (s_ip6, nm_utils_inet6_ntop (nameserver, NULL));
|
||||
}
|
||||
for (i = 0; i < nsearches; i++) {
|
||||
const char *search = nm_ip6_config_get_search (config, i);
|
||||
|
||||
nm_setting_ip6_config_add_dns_search (s_ip6, search);
|
||||
nm_setting_ip_config_add_dns_search (s_ip6, search);
|
||||
}
|
||||
|
||||
return NM_SETTING (s_ip6);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define __NETWORKMANAGER_IP6_CONFIG_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "nm-types.h"
|
||||
#include "nm-setting-ip6-config.h"
|
||||
|
@ -60,7 +61,7 @@ const char * nm_ip6_config_get_dbus_path (const NMIP6Config *config);
|
|||
/* Integration with nm-platform and nm-setting */
|
||||
NMIP6Config *nm_ip6_config_capture (int ifindex, gboolean capture_resolv_conf, NMSettingIP6ConfigPrivacy use_temporary);
|
||||
gboolean nm_ip6_config_commit (const NMIP6Config *config, int ifindex);
|
||||
void nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting, int default_route_metric);
|
||||
void nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIPConfig *setting, int default_route_metric);
|
||||
NMSetting *nm_ip6_config_create_setting (const NMIP6Config *config);
|
||||
|
||||
/* Utility functions */
|
||||
|
|
|
@ -110,7 +110,7 @@ get_best_ip4_device (NMPolicy *self, gboolean fully_activated)
|
|||
NMDeviceState state = nm_device_get_state (dev);
|
||||
NMActRequest *req;
|
||||
NMConnection *connection;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
int prio;
|
||||
const char *method = NULL;
|
||||
|
||||
|
@ -151,7 +151,7 @@ get_best_ip4_device (NMPolicy *self, gboolean fully_activated)
|
|||
/* 'never-default' devices can't ever be the default */
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
g_assert (s_ip4);
|
||||
if (nm_setting_ip4_config_get_never_default (s_ip4))
|
||||
if (nm_setting_ip_config_get_never_default (s_ip4))
|
||||
continue;
|
||||
|
||||
prio = nm_device_get_priority (dev);
|
||||
|
@ -194,7 +194,7 @@ get_best_ip6_device (NMPolicy *self, gboolean fully_activated)
|
|||
NMDeviceState state = nm_device_get_state (dev);
|
||||
NMActRequest *req;
|
||||
NMConnection *connection;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
int prio;
|
||||
const char *method = NULL;
|
||||
|
||||
|
@ -231,7 +231,7 @@ get_best_ip6_device (NMPolicy *self, gboolean fully_activated)
|
|||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
g_assert (s_ip6);
|
||||
if (nm_setting_ip6_config_get_never_default (s_ip6))
|
||||
if (nm_setting_ip_config_get_never_default (s_ip6))
|
||||
continue;
|
||||
|
||||
prio = nm_device_get_priority (dev);
|
||||
|
@ -539,7 +539,7 @@ get_best_ip4_config (NMPolicy *policy,
|
|||
NMVpnConnection *candidate;
|
||||
NMIP4Config *vpn_ip4;
|
||||
NMConnection *tmp;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMVpnConnectionState vpn_state;
|
||||
|
||||
if (!NM_IS_VPN_CONNECTION (active))
|
||||
|
@ -565,7 +565,7 @@ get_best_ip4_config (NMPolicy *policy,
|
|||
|
||||
/* Check the user's preference from the NMConnection */
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (tmp);
|
||||
if (nm_setting_ip4_config_get_never_default (s_ip4))
|
||||
if (nm_setting_ip_config_get_never_default (s_ip4))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -751,7 +751,7 @@ get_best_ip6_config (NMPolicy *policy,
|
|||
NMVpnConnection *candidate;
|
||||
NMIP6Config *vpn_ip6;
|
||||
NMConnection *tmp;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
NMVpnConnectionState vpn_state;
|
||||
|
||||
if (!NM_IS_VPN_CONNECTION (active))
|
||||
|
@ -777,7 +777,7 @@ get_best_ip6_config (NMPolicy *policy,
|
|||
|
||||
/* Check the user's preference from the NMConnection */
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (tmp);
|
||||
if (nm_setting_ip6_config_get_never_default (s_ip6))
|
||||
if (nm_setting_ip_config_get_never_default (s_ip6))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ ip4_setting_add_from_block (const GPtrArray *block,
|
|||
NMConnection *connection,
|
||||
GError **error)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4 = NULL;
|
||||
NMSettingIPConfig *s_ip4 = NULL;
|
||||
NMIPAddress *addr;
|
||||
const char *s_method = NULL;
|
||||
const char *s_ipaddr = NULL;
|
||||
|
@ -296,10 +296,10 @@ ip4_setting_add_from_block (const GPtrArray *block,
|
|||
goto error;
|
||||
}
|
||||
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
|
||||
if (!g_ascii_strcasecmp (s_method, "dhcp")) {
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
goto success;
|
||||
} else if (g_ascii_strcasecmp (s_method, "static") != 0) {
|
||||
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
|
@ -309,7 +309,7 @@ ip4_setting_add_from_block (const GPtrArray *block,
|
|||
}
|
||||
|
||||
/* Static configuration stuff */
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
|
||||
|
||||
/* IP address */
|
||||
if (!s_ipaddr || !nm_utils_ipaddr_valid (AF_INET, s_ipaddr)) {
|
||||
|
@ -355,13 +355,13 @@ ip4_setting_add_from_block (const GPtrArray *block,
|
|||
goto error;
|
||||
}
|
||||
|
||||
nm_setting_ip4_config_add_address (s_ip4, addr);
|
||||
nm_setting_ip_config_add_address (s_ip4, addr);
|
||||
nm_ip_address_unref (addr);
|
||||
|
||||
if (s_dns1)
|
||||
nm_setting_ip4_config_add_dns (s_ip4, s_dns1);
|
||||
nm_setting_ip_config_add_dns (s_ip4, s_dns1);
|
||||
if (s_dns2)
|
||||
nm_setting_ip4_config_add_dns (s_ip4, s_dns2);
|
||||
nm_setting_ip_config_add_dns (s_ip4, s_dns2);
|
||||
|
||||
success:
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
|
|
@ -71,7 +71,7 @@ test_read_ibft_dhcp (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWired *s_wired;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
GError *error = NULL;
|
||||
const char *mac_address;
|
||||
const char *expected_mac_address = "00:33:21:98:b9:f1";
|
||||
|
@ -105,7 +105,7 @@ test_read_ibft_dhcp (void)
|
|||
/* ===== IPv4 SETTING ===== */
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
g_assert (s_ip4);
|
||||
g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
|
||||
g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ test_read_ibft_static (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWired *s_wired;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
GError *error = NULL;
|
||||
const char *mac_address;
|
||||
const char *expected_mac_address = "00:33:21:98:b9:f0";
|
||||
|
@ -151,14 +151,14 @@ test_read_ibft_static (void)
|
|||
/* ===== IPv4 SETTING ===== */
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
g_assert (s_ip4);
|
||||
g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
|
||||
g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
|
||||
|
||||
g_assert_cmpint (nm_setting_ip4_config_get_num_dns (s_ip4), ==, 2);
|
||||
g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 0), ==, "10.16.255.2");
|
||||
g_assert_cmpstr (nm_setting_ip4_config_get_dns (s_ip4, 1), ==, "10.16.255.3");
|
||||
g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 2);
|
||||
g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 0), ==, "10.16.255.2");
|
||||
g_assert_cmpstr (nm_setting_ip_config_get_dns (s_ip4, 1), ==, "10.16.255.3");
|
||||
|
||||
g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 1);
|
||||
ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
|
||||
g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1);
|
||||
ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
|
||||
g_assert (ip4_addr);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.32.72");
|
||||
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 22);
|
||||
|
@ -217,7 +217,7 @@ test_read_ibft_vlan (void)
|
|||
NMSettingConnection *s_con;
|
||||
NMSettingWired *s_wired;
|
||||
NMSettingVlan *s_vlan;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
const char *mac_address;
|
||||
const char *expected_mac_address = "00:33:21:98:b9:f0";
|
||||
NMIPAddress *ip4_addr;
|
||||
|
@ -250,12 +250,12 @@ test_read_ibft_vlan (void)
|
|||
/* ===== IPv4 SETTING ===== */
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
g_assert (s_ip4);
|
||||
g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
|
||||
g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
|
||||
|
||||
g_assert_cmpint (nm_setting_ip4_config_get_num_dns (s_ip4), ==, 0);
|
||||
g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 0);
|
||||
|
||||
g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 1);
|
||||
ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
|
||||
g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1);
|
||||
ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
|
||||
g_assert (ip4_addr);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "192.168.6.200");
|
||||
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 24);
|
||||
|
|
|
@ -540,7 +540,7 @@ out:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
read_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError **error)
|
||||
read_route_file_legacy (const char *filename, NMSettingIPConfig *s_ip4, GError **error)
|
||||
{
|
||||
char *contents = NULL;
|
||||
gsize len = 0;
|
||||
|
@ -670,7 +670,7 @@ read_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError
|
|||
g_free (next_hop);
|
||||
goto error;
|
||||
}
|
||||
if (!nm_setting_ip4_config_add_route (s_ip4, route))
|
||||
if (!nm_setting_ip_config_add_route (s_ip4, route))
|
||||
PARSE_WARNING ("duplicate IP4 route");
|
||||
}
|
||||
|
||||
|
@ -771,7 +771,7 @@ error:
|
|||
#define IPV6_ADDR_REGEX "[0-9A-Fa-f:.]+"
|
||||
|
||||
static gboolean
|
||||
read_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **error)
|
||||
read_route6_file (const char *filename, NMSettingIPConfig *s_ip6, GError **error)
|
||||
{
|
||||
char *contents = NULL;
|
||||
gsize len = 0;
|
||||
|
@ -898,7 +898,7 @@ read_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **erro
|
|||
g_free (next_hop);
|
||||
if (!route)
|
||||
goto error;
|
||||
if (!nm_setting_ip6_config_add_route (s_ip6, route))
|
||||
if (!nm_setting_ip_config_add_route (s_ip6, route))
|
||||
PARSE_WARNING ("duplicate IP6 route");
|
||||
}
|
||||
|
||||
|
@ -923,7 +923,7 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
const char *network_file,
|
||||
GError **error)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4 = NULL;
|
||||
NMSettingIPConfig *s_ip4 = NULL;
|
||||
char *value = NULL;
|
||||
char *route_path = NULL;
|
||||
char *method;
|
||||
|
@ -932,7 +932,7 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
shvarFile *route_ifcfg;
|
||||
gboolean never_default = FALSE;
|
||||
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
|
||||
/* First check if DEFROUTE is set for this device; DEFROUTE has the
|
||||
* opposite meaning from never-default. The default if DEFROUTE is not
|
||||
|
@ -975,15 +975,15 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
} else if (!g_ascii_strcasecmp (value, "autoip")) {
|
||||
g_free (value);
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
|
||||
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
|
||||
NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default,
|
||||
NULL);
|
||||
return NM_SETTING (s_ip4);
|
||||
} else if (!g_ascii_strcasecmp (value, "shared")) {
|
||||
g_free (value);
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_SHARED,
|
||||
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_SHARED,
|
||||
NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default,
|
||||
NULL);
|
||||
return NM_SETTING (s_ip4);
|
||||
} else {
|
||||
|
@ -995,11 +995,11 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
g_free (value);
|
||||
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, method,
|
||||
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "PEERDNS", TRUE),
|
||||
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "PEERROUTES", TRUE),
|
||||
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default,
|
||||
NM_SETTING_IP4_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV4_FAILURE_FATAL", FALSE),
|
||||
NM_SETTING_IP_CONFIG_METHOD, method,
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "PEERDNS", TRUE),
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "PEERROUTES", TRUE),
|
||||
NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default,
|
||||
NM_SETTING_IP_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV4_FAILURE_FATAL", FALSE),
|
||||
NULL);
|
||||
|
||||
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0)
|
||||
|
@ -1009,11 +1009,11 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
|
||||
value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE);
|
||||
if (value && strlen (value))
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, value, NULL);
|
||||
g_free (value);
|
||||
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME,
|
||||
NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME,
|
||||
svTrueValue (ifcfg, "DHCP_SEND_HOSTNAME", TRUE),
|
||||
NULL);
|
||||
|
||||
|
@ -1042,7 +1042,7 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!nm_setting_ip4_config_add_address (s_ip4, addr))
|
||||
if (!nm_setting_ip_config_add_address (s_ip4, addr))
|
||||
PARSE_WARNING ("duplicate IP4 address");
|
||||
nm_ip_address_unref (addr);
|
||||
}
|
||||
|
@ -1057,7 +1057,7 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
value = svGetValue (ifcfg, tag, FALSE);
|
||||
if (value) {
|
||||
if (nm_utils_ipaddr_valid (AF_INET, value)) {
|
||||
if (!nm_setting_ip4_config_add_dns (s_ip4, value))
|
||||
if (!nm_setting_ip_config_add_dns (s_ip4, value))
|
||||
PARSE_WARNING ("duplicate DNS server %s", tag);
|
||||
} else if (nm_utils_ipaddr_valid (AF_INET6, value)) {
|
||||
/* Ignore IPv6 addresses */
|
||||
|
@ -1084,7 +1084,7 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
char **item;
|
||||
for (item = searches; *item; item++) {
|
||||
if (strlen (*item)) {
|
||||
if (!nm_setting_ip4_config_add_dns_search (s_ip4, *item))
|
||||
if (!nm_setting_ip_config_add_dns_search (s_ip4, *item))
|
||||
PARSE_WARNING ("duplicate DNS domain '%s'", *item);
|
||||
}
|
||||
}
|
||||
|
@ -1117,7 +1117,7 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
if (!route)
|
||||
break;
|
||||
|
||||
if (!nm_setting_ip4_config_add_route (s_ip4, route))
|
||||
if (!nm_setting_ip_config_add_route (s_ip4, route))
|
||||
PARSE_WARNING ("duplicate IP4 route");
|
||||
nm_ip_route_unref (route);
|
||||
}
|
||||
|
@ -1129,7 +1129,7 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
}
|
||||
|
||||
/* Legacy value NM used for a while but is incorrect (rh #459370) */
|
||||
if (!nm_setting_ip4_config_get_num_dns_searches (s_ip4)) {
|
||||
if (!nm_setting_ip_config_get_num_dns_searches (s_ip4)) {
|
||||
value = svGetValue (ifcfg, "SEARCH", FALSE);
|
||||
if (value) {
|
||||
char **searches = NULL;
|
||||
|
@ -1139,7 +1139,7 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
char **item;
|
||||
for (item = searches; *item; item++) {
|
||||
if (strlen (*item)) {
|
||||
if (!nm_setting_ip4_config_add_dns_search (s_ip4, *item))
|
||||
if (!nm_setting_ip_config_add_dns_search (s_ip4, *item))
|
||||
PARSE_WARNING ("duplicate DNS search '%s'", *item);
|
||||
}
|
||||
}
|
||||
|
@ -1158,7 +1158,7 @@ done:
|
|||
}
|
||||
|
||||
static void
|
||||
read_aliases (NMSettingIP4Config *s_ip4, const char *filename, const char *network_file)
|
||||
read_aliases (NMSettingIPConfig *s_ip4, const char *filename, const char *network_file)
|
||||
{
|
||||
GDir *dir;
|
||||
char *dirname, *base;
|
||||
|
@ -1169,10 +1169,10 @@ read_aliases (NMSettingIP4Config *s_ip4, const char *filename, const char *netwo
|
|||
g_return_if_fail (s_ip4 != NULL);
|
||||
g_return_if_fail (filename != NULL);
|
||||
|
||||
if (nm_setting_ip4_config_get_num_addresses (s_ip4) == 0)
|
||||
if (nm_setting_ip_config_get_num_addresses (s_ip4) == 0)
|
||||
return;
|
||||
|
||||
base_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
|
||||
base_addr = nm_setting_ip_config_get_address (s_ip4, 0);
|
||||
|
||||
dirname = g_path_get_dirname (filename);
|
||||
g_return_if_fail (dirname != NULL);
|
||||
|
@ -1236,7 +1236,7 @@ read_aliases (NMSettingIP4Config *s_ip4, const char *filename, const char *netwo
|
|||
svCloseFile (parsed);
|
||||
if (ok) {
|
||||
nm_ip_address_set_attribute (addr, "label", g_variant_new_string (device));
|
||||
if (!nm_setting_ip4_config_add_address (s_ip4, addr))
|
||||
if (!nm_setting_ip_config_add_address (s_ip4, addr))
|
||||
PARSE_WARNING ("duplicate IP4 address in alias file %s", item);
|
||||
} else {
|
||||
PARSE_WARNING ("error reading IP4 address from alias file '%s': %s",
|
||||
|
@ -1264,7 +1264,7 @@ make_ip6_setting (shvarFile *ifcfg,
|
|||
const char *network_file,
|
||||
GError **error)
|
||||
{
|
||||
NMSettingIP6Config *s_ip6 = NULL;
|
||||
NMSettingIPConfig *s_ip6 = NULL;
|
||||
char *value = NULL;
|
||||
char *str_value;
|
||||
char *route6_path = NULL;
|
||||
|
@ -1279,7 +1279,7 @@ make_ip6_setting (shvarFile *ifcfg,
|
|||
char *ip6_privacy_str;
|
||||
NMSettingIP6ConfigPrivacy ip6_privacy_val;
|
||||
|
||||
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
|
||||
|
||||
/* First check if IPV6_DEFROUTE is set for this device; IPV6_DEFROUTE has the
|
||||
* opposite meaning from never-default. The default if IPV6_DEFROUTE is not
|
||||
|
@ -1376,11 +1376,11 @@ make_ip6_setting (shvarFile *ifcfg,
|
|||
g_free (ip6_privacy_str);
|
||||
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP6_CONFIG_METHOD, method,
|
||||
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "IPV6_PEERDNS", TRUE),
|
||||
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "IPV6_PEERROUTES", TRUE),
|
||||
NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, never_default,
|
||||
NM_SETTING_IP6_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV6_FAILURE_FATAL", FALSE),
|
||||
NM_SETTING_IP_CONFIG_METHOD, method,
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "IPV6_PEERDNS", TRUE),
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "IPV6_PEERROUTES", TRUE),
|
||||
NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default,
|
||||
NM_SETTING_IP_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV6_FAILURE_FATAL", FALSE),
|
||||
NM_SETTING_IP6_CONFIG_IP6_PRIVACY, ip6_privacy_val,
|
||||
NULL);
|
||||
|
||||
|
@ -1393,7 +1393,7 @@ make_ip6_setting (shvarFile *ifcfg,
|
|||
/* METHOD_AUTO may trigger DHCPv6, so save the hostname to send to DHCP */
|
||||
value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE);
|
||||
if (value && value[0])
|
||||
g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, value, NULL);
|
||||
g_object_set (s_ip6, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, value, NULL);
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
|
@ -1422,7 +1422,7 @@ make_ip6_setting (shvarFile *ifcfg,
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (!nm_setting_ip6_config_add_address (s_ip6, addr))
|
||||
if (!nm_setting_ip_config_add_address (s_ip6, addr))
|
||||
PARSE_WARNING ("duplicate IP6 address");
|
||||
nm_ip_address_unref (addr);
|
||||
}
|
||||
|
@ -1442,7 +1442,7 @@ make_ip6_setting (shvarFile *ifcfg,
|
|||
}
|
||||
|
||||
if (nm_utils_ipaddr_valid (AF_INET6, value)) {
|
||||
if (!nm_setting_ip6_config_add_dns (s_ip6, value))
|
||||
if (!nm_setting_ip_config_add_dns (s_ip6, value))
|
||||
PARSE_WARNING ("duplicate DNS server %s", tag);
|
||||
} else if (nm_utils_ipaddr_valid (AF_INET, value)) {
|
||||
/* Ignore IPv4 addresses */
|
||||
|
@ -1457,7 +1457,7 @@ make_ip6_setting (shvarFile *ifcfg,
|
|||
g_free (value);
|
||||
}
|
||||
|
||||
/* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIP4Config */
|
||||
/* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIPConfig */
|
||||
|
||||
/* Read static routes from route6-<interface> file */
|
||||
route6_path = utils_get_route6_path (ifcfg->fileName);
|
||||
|
@ -4604,7 +4604,7 @@ check_dns_search_domains (shvarFile *ifcfg, NMSetting *s_ip4, NMSetting *s_ip6)
|
|||
/* If there is no IPv4 config or it doesn't contain DNS searches,
|
||||
* read DOMAIN and put the domains into IPv6.
|
||||
*/
|
||||
if (!s_ip4 || nm_setting_ip4_config_get_num_dns_searches (NM_SETTING_IP4_CONFIG (s_ip4)) == 0) {
|
||||
if (!s_ip4 || nm_setting_ip_config_get_num_dns_searches (NM_SETTING_IP_CONFIG (s_ip4)) == 0) {
|
||||
/* DNS searches */
|
||||
char *value = svGetValue (ifcfg, "DOMAIN", FALSE);
|
||||
if (value) {
|
||||
|
@ -4613,7 +4613,7 @@ check_dns_search_domains (shvarFile *ifcfg, NMSetting *s_ip4, NMSetting *s_ip6)
|
|||
char **item;
|
||||
for (item = searches; *item; item++) {
|
||||
if (strlen (*item)) {
|
||||
if (!nm_setting_ip6_config_add_dns_search (NM_SETTING_IP6_CONFIG (s_ip6), *item))
|
||||
if (!nm_setting_ip_config_add_dns_search (NM_SETTING_IP_CONFIG (s_ip6), *item))
|
||||
PARSE_WARNING ("duplicate DNS domain '%s'", *item);
|
||||
}
|
||||
}
|
||||
|
@ -4794,7 +4794,7 @@ connection_from_file (const char *filename,
|
|||
connection = NULL;
|
||||
goto done;
|
||||
} else {
|
||||
read_aliases (NM_SETTING_IP4_CONFIG (s_ip4), filename, network_file);
|
||||
read_aliases (NM_SETTING_IP_CONFIG (s_ip4), filename, network_file);
|
||||
nm_connection_add_setting (connection, s_ip4);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1741,7 +1741,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
write_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError **error)
|
||||
write_route_file_legacy (const char *filename, NMSettingIPConfig *s_ip4, GError **error)
|
||||
{
|
||||
const char *dest, *next_hop;
|
||||
char **route_items;
|
||||
|
@ -1756,7 +1756,7 @@ write_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError
|
|||
g_return_val_if_fail (error != NULL, FALSE);
|
||||
g_return_val_if_fail (*error == NULL, FALSE);
|
||||
|
||||
num = nm_setting_ip4_config_get_num_routes (s_ip4);
|
||||
num = nm_setting_ip_config_get_num_routes (s_ip4);
|
||||
if (num == 0) {
|
||||
unlink (filename);
|
||||
return TRUE;
|
||||
|
@ -1764,7 +1764,7 @@ write_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError
|
|||
|
||||
route_items = g_malloc0 (sizeof (char*) * (num + 1));
|
||||
for (i = 0; i < num; i++) {
|
||||
route = nm_setting_ip4_config_get_route (s_ip4, i);
|
||||
route = nm_setting_ip_config_get_route (s_ip4, i);
|
||||
|
||||
dest = nm_ip_route_get_dest (route);
|
||||
prefix = nm_ip_route_get_prefix (route);
|
||||
|
@ -1794,7 +1794,7 @@ error:
|
|||
static gboolean
|
||||
write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
const char *value;
|
||||
char *addr_key, *prefix_key, *netmask_key, *gw_key, *metric_key, *tmp;
|
||||
char *route_path = NULL;
|
||||
|
@ -1807,7 +1807,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
if (s_ip4)
|
||||
method = nm_setting_ip4_config_get_method (s_ip4);
|
||||
method = nm_setting_ip_config_get_method (s_ip4);
|
||||
|
||||
/* Missing IP4 setting is assumed to be DHCP */
|
||||
if (!method)
|
||||
|
@ -1850,7 +1850,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
|
||||
/* Temporarily create fake IP4 setting if missing; method set to DHCP above */
|
||||
if (!s_ip4) {
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
fake_ip4 = TRUE;
|
||||
}
|
||||
|
||||
|
@ -1877,11 +1877,11 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
/* Write out IPADDR<n>, PREFIX<n>, GATEWAY<n> for current IP addresses
|
||||
* without labels. Unset obsolete NETMASK<n>.
|
||||
*/
|
||||
num = nm_setting_ip4_config_get_num_addresses (s_ip4);
|
||||
num = nm_setting_ip_config_get_num_addresses (s_ip4);
|
||||
for (i = n = 0; i < num; i++) {
|
||||
NMIPAddress *addr;
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, i);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, i);
|
||||
|
||||
if (i > 0) {
|
||||
GVariant *label;
|
||||
|
@ -1943,7 +1943,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
g_free (gw_key);
|
||||
}
|
||||
|
||||
num = nm_setting_ip4_config_get_num_dns (s_ip4);
|
||||
num = nm_setting_ip_config_get_num_dns (s_ip4);
|
||||
for (i = 0; i < 254; i++) {
|
||||
const char *dns;
|
||||
|
||||
|
@ -1952,19 +1952,19 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
if (i >= num)
|
||||
svSetValue (ifcfg, addr_key, NULL, FALSE);
|
||||
else {
|
||||
dns = nm_setting_ip4_config_get_dns (s_ip4, i);
|
||||
dns = nm_setting_ip_config_get_dns (s_ip4, i);
|
||||
svSetValue (ifcfg, addr_key, dns, FALSE);
|
||||
}
|
||||
g_free (addr_key);
|
||||
}
|
||||
|
||||
num = nm_setting_ip4_config_get_num_dns_searches (s_ip4);
|
||||
num = nm_setting_ip_config_get_num_dns_searches (s_ip4);
|
||||
if (num > 0) {
|
||||
searches = g_string_new (NULL);
|
||||
for (i = 0; i < num; i++) {
|
||||
if (i > 0)
|
||||
g_string_append_c (searches, ' ');
|
||||
g_string_append (searches, nm_setting_ip4_config_get_dns_search (s_ip4, i));
|
||||
g_string_append (searches, nm_setting_ip_config_get_dns_search (s_ip4, i));
|
||||
}
|
||||
svSetValue (ifcfg, "DOMAIN", searches->str, FALSE);
|
||||
g_string_free (searches, TRUE);
|
||||
|
@ -1973,7 +1973,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
|
||||
/* DEFROUTE; remember that it has the opposite meaning from never-default */
|
||||
svSetValue (ifcfg, "DEFROUTE",
|
||||
nm_setting_ip4_config_get_never_default (s_ip4) ? "no" : "yes",
|
||||
nm_setting_ip_config_get_never_default (s_ip4) ? "no" : "yes",
|
||||
FALSE);
|
||||
|
||||
svSetValue (ifcfg, "PEERDNS", NULL, FALSE);
|
||||
|
@ -1981,14 +1981,14 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
svSetValue (ifcfg, "DHCP_CLIENT_ID", NULL, FALSE);
|
||||
if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
|
||||
svSetValue (ifcfg, "PEERDNS",
|
||||
nm_setting_ip4_config_get_ignore_auto_dns (s_ip4) ? "no" : "yes",
|
||||
nm_setting_ip_config_get_ignore_auto_dns (s_ip4) ? "no" : "yes",
|
||||
FALSE);
|
||||
|
||||
svSetValue (ifcfg, "PEERROUTES",
|
||||
nm_setting_ip4_config_get_ignore_auto_routes (s_ip4) ? "no" : "yes",
|
||||
nm_setting_ip_config_get_ignore_auto_routes (s_ip4) ? "no" : "yes",
|
||||
FALSE);
|
||||
|
||||
value = nm_setting_ip4_config_get_dhcp_hostname (s_ip4);
|
||||
value = nm_setting_ip_config_get_dhcp_hostname (s_ip4);
|
||||
if (value)
|
||||
svSetValue (ifcfg, "DHCP_HOSTNAME", value, FALSE);
|
||||
|
||||
|
@ -1996,16 +1996,16 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
* in that case, because it is NM-specific variable
|
||||
*/
|
||||
svSetValue (ifcfg, "DHCP_SEND_HOSTNAME",
|
||||
nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) ? NULL : "no",
|
||||
nm_setting_ip_config_get_dhcp_send_hostname (s_ip4) ? NULL : "no",
|
||||
FALSE);
|
||||
|
||||
value = nm_setting_ip4_config_get_dhcp_client_id (s_ip4);
|
||||
value = nm_setting_ip4_config_get_dhcp_client_id (NM_SETTING_IP4_CONFIG (s_ip4));
|
||||
if (value)
|
||||
svSetValue (ifcfg, "DHCP_CLIENT_ID", value, FALSE);
|
||||
}
|
||||
|
||||
svSetValue (ifcfg, "IPV4_FAILURE_FATAL",
|
||||
nm_setting_ip4_config_get_may_fail (s_ip4) ? "no" : "yes",
|
||||
nm_setting_ip_config_get_may_fail (s_ip4) ? "no" : "yes",
|
||||
FALSE);
|
||||
|
||||
/* Static routes - route-<name> file */
|
||||
|
@ -2028,7 +2028,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
}
|
||||
g_free (route_path);
|
||||
|
||||
num = nm_setting_ip4_config_get_num_routes (s_ip4);
|
||||
num = nm_setting_ip_config_get_num_routes (s_ip4);
|
||||
for (i = 0; i < 256; i++) {
|
||||
char buf[INET_ADDRSTRLEN];
|
||||
NMIPRoute *route;
|
||||
|
@ -2045,7 +2045,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
svSetValue (routefile, gw_key, NULL, FALSE);
|
||||
svSetValue (routefile, metric_key, NULL, FALSE);
|
||||
} else {
|
||||
route = nm_setting_ip4_config_get_route (s_ip4, i);
|
||||
route = nm_setting_ip_config_get_route (s_ip4, i);
|
||||
|
||||
svSetValue (routefile, addr_key, nm_ip_route_get_dest (route), FALSE);
|
||||
|
||||
|
@ -2096,7 +2096,7 @@ out:
|
|||
static void
|
||||
write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
char *base_ifcfg_dir, *base_ifcfg_name, *base_name;
|
||||
int i, num, base_ifcfg_name_len, base_name_len;
|
||||
GDir *dir;
|
||||
|
@ -2134,7 +2134,7 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path)
|
|||
if (!s_ip4)
|
||||
return;
|
||||
|
||||
num = nm_setting_ip4_config_get_num_addresses (s_ip4);
|
||||
num = nm_setting_ip_config_get_num_addresses (s_ip4);
|
||||
for (i = 0; i < num; i++) {
|
||||
GVariant *label_var;
|
||||
const char *label, *p;
|
||||
|
@ -2142,7 +2142,7 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path)
|
|||
NMIPAddress *addr;
|
||||
shvarFile *ifcfg;
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, i);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, i);
|
||||
|
||||
label_var = nm_ip_address_get_attribute (addr, "label");
|
||||
if (!label_var)
|
||||
|
@ -2165,7 +2165,7 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path)
|
|||
|
||||
svSetValue (ifcfg, "DEVICE", label, FALSE);
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, i);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, i);
|
||||
svSetValue (ifcfg, "IPADDR", nm_ip_address_get_address (addr), FALSE);
|
||||
|
||||
tmp = g_strdup_printf ("%u", nm_ip_address_get_prefix (addr));
|
||||
|
@ -2183,7 +2183,7 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
write_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **error)
|
||||
write_route6_file (const char *filename, NMSettingIPConfig *s_ip6, GError **error)
|
||||
{
|
||||
char **route_items;
|
||||
char *route_contents;
|
||||
|
@ -2196,7 +2196,7 @@ write_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **err
|
|||
g_return_val_if_fail (error != NULL, FALSE);
|
||||
g_return_val_if_fail (*error == NULL, FALSE);
|
||||
|
||||
num = nm_setting_ip6_config_get_num_routes (s_ip6);
|
||||
num = nm_setting_ip_config_get_num_routes (s_ip6);
|
||||
if (num == 0) {
|
||||
unlink (filename);
|
||||
return TRUE;
|
||||
|
@ -2204,7 +2204,7 @@ write_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **err
|
|||
|
||||
route_items = g_malloc0 (sizeof (char*) * (num + 1));
|
||||
for (i = 0; i < num; i++) {
|
||||
route = nm_setting_ip6_config_get_route (s_ip6, i);
|
||||
route = nm_setting_ip_config_get_route (s_ip6, i);
|
||||
route_items[i] = g_strdup_printf ("%s/%u via %s metric %u\n",
|
||||
nm_ip_route_get_dest (route),
|
||||
nm_ip_route_get_prefix (route),
|
||||
|
@ -2231,8 +2231,8 @@ error:
|
|||
static gboolean
|
||||
write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
||||
{
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
const char *value;
|
||||
char *addr_key;
|
||||
guint32 i, num, num4;
|
||||
|
@ -2256,7 +2256,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
value = nm_setting_ip6_config_get_method (s_ip6);
|
||||
value = nm_setting_ip_config_get_method (s_ip6);
|
||||
g_assert (value);
|
||||
if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
|
||||
svSetValue (ifcfg, "IPV6INIT", "no", FALSE);
|
||||
|
@ -2271,7 +2271,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
svSetValue (ifcfg, "IPV6INIT", "yes", FALSE);
|
||||
svSetValue (ifcfg, "IPV6_AUTOCONF", "no", FALSE);
|
||||
svSetValue (ifcfg, "DHCPV6C", "yes", FALSE);
|
||||
hostname = nm_setting_ip6_config_get_dhcp_hostname (s_ip6);
|
||||
hostname = nm_setting_ip_config_get_dhcp_hostname (s_ip6);
|
||||
if (hostname)
|
||||
svSetValue (ifcfg, "DHCP_HOSTNAME", hostname, FALSE);
|
||||
} else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
|
||||
|
@ -2289,7 +2289,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
}
|
||||
|
||||
/* Write out IP addresses */
|
||||
num = nm_setting_ip6_config_get_num_addresses (s_ip6);
|
||||
num = nm_setting_ip_config_get_num_addresses (s_ip6);
|
||||
ip_str1 = g_string_new (NULL);
|
||||
ip_str2 = g_string_new (NULL);
|
||||
ipv6_defaultgw = NULL;
|
||||
|
@ -2299,7 +2299,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
else
|
||||
ip_ptr = ip_str2;
|
||||
|
||||
addr = nm_setting_ip6_config_get_address (s_ip6, i);
|
||||
addr = nm_setting_ip_config_get_address (s_ip6, i);
|
||||
|
||||
if (i > 1)
|
||||
g_string_append_c (ip_ptr, ' '); /* separate addresses in IPV6ADDR_SECONDARIES */
|
||||
|
@ -2319,22 +2319,22 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
|
||||
/* Write out DNS - 'DNS' key is used both for IPv4 and IPv6 */
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
num4 = s_ip4 ? nm_setting_ip4_config_get_num_dns (s_ip4) : 0; /* from where to start with IPv6 entries */
|
||||
num = nm_setting_ip6_config_get_num_dns (s_ip6);
|
||||
num4 = s_ip4 ? nm_setting_ip_config_get_num_dns (s_ip4) : 0; /* from where to start with IPv6 entries */
|
||||
num = nm_setting_ip_config_get_num_dns (s_ip6);
|
||||
for (i = 0; i < 254; i++) {
|
||||
addr_key = g_strdup_printf ("DNS%d", i + num4 + 1);
|
||||
|
||||
if (i >= num)
|
||||
svSetValue (ifcfg, addr_key, NULL, FALSE);
|
||||
else {
|
||||
dns = nm_setting_ip6_config_get_dns (s_ip6, i);
|
||||
dns = nm_setting_ip_config_get_dns (s_ip6, i);
|
||||
svSetValue (ifcfg, addr_key, dns, FALSE);
|
||||
}
|
||||
g_free (addr_key);
|
||||
}
|
||||
|
||||
/* Write out DNS domains - 'DOMAIN' key is shared for both IPv4 and IPv6 domains */
|
||||
num = nm_setting_ip6_config_get_num_dns_searches (s_ip6);
|
||||
num = nm_setting_ip_config_get_num_dns_searches (s_ip6);
|
||||
if (num > 0) {
|
||||
char *ip4_domains;
|
||||
ip4_domains = svGetValue (ifcfg, "DOMAIN", FALSE);
|
||||
|
@ -2342,7 +2342,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
for (i = 0; i < num; i++) {
|
||||
if (searches->len > 0)
|
||||
g_string_append_c (searches, ' ');
|
||||
g_string_append (searches, nm_setting_ip6_config_get_dns_search (s_ip6, i));
|
||||
g_string_append (searches, nm_setting_ip_config_get_dns_search (s_ip6, i));
|
||||
}
|
||||
svSetValue (ifcfg, "DOMAIN", searches->str, FALSE);
|
||||
g_string_free (searches, TRUE);
|
||||
|
@ -2351,7 +2351,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
|
||||
/* handle IPV6_DEFROUTE */
|
||||
/* IPV6_DEFROUTE has the opposite meaning from 'never-default' */
|
||||
if (nm_setting_ip6_config_get_never_default(s_ip6))
|
||||
if (nm_setting_ip_config_get_never_default(s_ip6))
|
||||
svSetValue (ifcfg, "IPV6_DEFROUTE", "no", FALSE);
|
||||
else
|
||||
svSetValue (ifcfg, "IPV6_DEFROUTE", "yes", FALSE);
|
||||
|
@ -2360,22 +2360,22 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
svSetValue (ifcfg, "IPV6_PEERROUTES", NULL, FALSE);
|
||||
if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) {
|
||||
svSetValue (ifcfg, "IPV6_PEERDNS",
|
||||
nm_setting_ip6_config_get_ignore_auto_dns (s_ip6) ? "no" : "yes",
|
||||
nm_setting_ip_config_get_ignore_auto_dns (s_ip6) ? "no" : "yes",
|
||||
FALSE);
|
||||
|
||||
svSetValue (ifcfg, "IPV6_PEERROUTES",
|
||||
nm_setting_ip6_config_get_ignore_auto_routes (s_ip6) ? "no" : "yes",
|
||||
nm_setting_ip_config_get_ignore_auto_routes (s_ip6) ? "no" : "yes",
|
||||
FALSE);
|
||||
}
|
||||
|
||||
svSetValue (ifcfg, "IPV6_FAILURE_FATAL",
|
||||
nm_setting_ip6_config_get_may_fail (s_ip6) ? "no" : "yes",
|
||||
nm_setting_ip_config_get_may_fail (s_ip6) ? "no" : "yes",
|
||||
FALSE);
|
||||
|
||||
/* IPv6 Privacy Extensions */
|
||||
svSetValue (ifcfg, "IPV6_PRIVACY", NULL, FALSE);
|
||||
svSetValue (ifcfg, "IPV6_PRIVACY_PREFER_PUBLIC_IP", NULL, FALSE);
|
||||
switch (nm_setting_ip6_config_get_ip6_privacy (s_ip6)){
|
||||
switch (nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6))){
|
||||
case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED:
|
||||
svSetValue (ifcfg, "IPV6_PRIVACY", "no", FALSE);
|
||||
break;
|
||||
|
|
|
@ -544,25 +544,25 @@ make_wired_connection_setting (NMConnection *connection,
|
|||
nm_connection_add_setting (connection, NM_SETTING (s_wired));
|
||||
}
|
||||
|
||||
/* add NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME,
|
||||
* NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID in future*/
|
||||
/* add NM_SETTING_IP_CONFIG_DHCP_HOSTNAME,
|
||||
* NM_SETTING_IP_CONFIG_DHCP_CLIENT_ID in future*/
|
||||
static void
|
||||
make_ip4_setting (NMConnection *connection,
|
||||
const char *conn_name,
|
||||
GError **error)
|
||||
{
|
||||
|
||||
NMSettingIP4Config *ip4_setting =
|
||||
NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
|
||||
NMSettingIPConfig *ip4_setting =
|
||||
NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
const char *value, *method = NULL;
|
||||
gboolean is_static_block = is_static_ip4 (conn_name);
|
||||
ip_block *iblock = NULL;
|
||||
|
||||
/* set dhcp options (dhcp_xxx) */
|
||||
value = ifnet_get_data (conn_name, "dhcp");
|
||||
g_object_set (ip4_setting, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, value
|
||||
g_object_set (ip4_setting, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, value
|
||||
&& strstr (value, "nodns") ? TRUE : FALSE,
|
||||
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, value
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, value
|
||||
&& strstr (value, "nogateway") ? TRUE : FALSE, NULL);
|
||||
|
||||
if (!is_static_block) {
|
||||
|
@ -575,21 +575,21 @@ make_ip4_setting (NMConnection *connection,
|
|||
}
|
||||
if (strstr (method, "dhcp"))
|
||||
g_object_set (ip4_setting,
|
||||
NM_SETTING_IP4_CONFIG_METHOD,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
|
||||
NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, NULL);
|
||||
else if (strstr (method, "autoip")) {
|
||||
g_object_set (ip4_setting,
|
||||
NM_SETTING_IP4_CONFIG_METHOD,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
|
||||
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
|
||||
NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, NULL);
|
||||
nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
|
||||
return;
|
||||
} else if (strstr (method, "shared")) {
|
||||
g_object_set (ip4_setting,
|
||||
NM_SETTING_IP4_CONFIG_METHOD,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP4_CONFIG_METHOD_SHARED,
|
||||
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL);
|
||||
NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, NULL);
|
||||
nm_connection_add_setting (connection, NM_SETTING (ip4_setting));
|
||||
return;
|
||||
} else {
|
||||
|
@ -618,11 +618,11 @@ make_ip4_setting (NMConnection *connection,
|
|||
ip4_addr = nm_ip_address_new (AF_INET, iblock->ip, iblock->prefix, iblock->next_hop, &local);
|
||||
if (iblock->next_hop)
|
||||
g_object_set (ip4_setting,
|
||||
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES,
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES,
|
||||
TRUE, NULL);
|
||||
|
||||
if (ip4_addr) {
|
||||
if (!nm_setting_ip4_config_add_address (ip4_setting, ip4_addr))
|
||||
if (!nm_setting_ip_config_add_address (ip4_setting, ip4_addr))
|
||||
nm_log_warn (LOGD_SETTINGS, "ignoring duplicate IP4 address");
|
||||
nm_ip_address_unref (ip4_addr);
|
||||
} else {
|
||||
|
@ -636,8 +636,8 @@ make_ip4_setting (NMConnection *connection,
|
|||
|
||||
}
|
||||
g_object_set (ip4_setting,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, !has_default_ip4_route (conn_name),
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_NEVER_DEFAULT, !has_default_ip4_route (conn_name),
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -648,7 +648,7 @@ make_ip4_setting (NMConnection *connection,
|
|||
get_dhcp_hostname_and_client_id (&dhcp_hostname, &client_id);
|
||||
if (dhcp_hostname) {
|
||||
g_object_set (ip4_setting,
|
||||
NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME,
|
||||
NM_SETTING_IP_CONFIG_DHCP_HOSTNAME,
|
||||
dhcp_hostname, NULL);
|
||||
nm_log_info (LOGD_SETTINGS, "DHCP hostname: %s", dhcp_hostname);
|
||||
g_free (dhcp_hostname);
|
||||
|
@ -679,7 +679,7 @@ make_ip4_setting (NMConnection *connection,
|
|||
|
||||
for (item = searches; *item; item++) {
|
||||
if (strlen (*item)) {
|
||||
if (!nm_setting_ip4_config_add_dns_search (ip4_setting, *item))
|
||||
if (!nm_setting_ip_config_add_dns_search (ip4_setting, *item))
|
||||
nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *item);
|
||||
}
|
||||
}
|
||||
|
@ -711,9 +711,8 @@ make_ip4_setting (NMConnection *connection,
|
|||
}
|
||||
|
||||
route = nm_ip_route_new (AF_INET, iblock->ip, iblock->prefix, iblock->next_hop, metric, &local);
|
||||
|
||||
if (route) {
|
||||
if (nm_setting_ip4_config_add_route (ip4_setting, route))
|
||||
if (nm_setting_ip_config_add_route (ip4_setting, route))
|
||||
nm_log_info (LOGD_SETTINGS, "new IP4 route:%s\n", iblock->ip);
|
||||
else
|
||||
nm_log_warn (LOGD_SETTINGS, "duplicate IP4 route");
|
||||
|
@ -737,7 +736,7 @@ make_ip6_setting (NMConnection *connection,
|
|||
const char *conn_name,
|
||||
GError **error)
|
||||
{
|
||||
NMSettingIP6Config *s_ip6 = NULL;
|
||||
NMSettingIPConfig *s_ip6 = NULL;
|
||||
gboolean is_static_block = is_static_ip6 (conn_name);
|
||||
|
||||
// used to disable IPv6
|
||||
|
@ -747,7 +746,7 @@ make_ip6_setting (NMConnection *connection,
|
|||
ip_block *iblock;
|
||||
gboolean never_default = !has_default_ip6_route (conn_name);
|
||||
|
||||
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
|
||||
|
||||
value = ifnet_get_data (conn_name, "enable_ipv6");
|
||||
if (value && is_true (value))
|
||||
|
@ -757,7 +756,7 @@ make_ip6_setting (NMConnection *connection,
|
|||
// Currently only Manual and DHCP are supported
|
||||
if (!ipv6_enabled) {
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP6_CONFIG_METHOD,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL);
|
||||
goto done;
|
||||
} else if (!is_static_block) {
|
||||
|
@ -774,10 +773,10 @@ make_ip6_setting (NMConnection *connection,
|
|||
nm_log_info (LOGD_SETTINGS, "IPv6 for %s enabled, using %s", conn_name, method);
|
||||
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP6_CONFIG_METHOD, method,
|
||||
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, FALSE,
|
||||
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, FALSE,
|
||||
NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, never_default, NULL);
|
||||
NM_SETTING_IP_CONFIG_METHOD, method,
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, FALSE,
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, FALSE,
|
||||
NM_SETTING_IP_CONFIG_NEVER_DEFAULT, never_default, NULL);
|
||||
|
||||
/* Make manual settings */
|
||||
if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
|
||||
|
@ -797,9 +796,9 @@ make_ip6_setting (NMConnection *connection,
|
|||
|
||||
ip6_addr = nm_ip_address_new (AF_INET6, iblock->ip, iblock->prefix, NULL, &local);
|
||||
if (ip6_addr) {
|
||||
if (nm_setting_ip6_config_add_address (s_ip6, ip6_addr)) {
|
||||
if (nm_setting_ip_config_add_address (s_ip6, ip6_addr)) {
|
||||
nm_log_info (LOGD_SETTINGS, "ipv6 addresses count: %d",
|
||||
nm_setting_ip6_config_get_num_addresses (s_ip6));
|
||||
nm_setting_ip_config_get_num_addresses (s_ip6));
|
||||
} else {
|
||||
nm_log_warn (LOGD_SETTINGS, "ignoring duplicate IP6 address");
|
||||
}
|
||||
|
@ -817,15 +816,15 @@ make_ip6_setting (NMConnection *connection,
|
|||
} else if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) {
|
||||
/* - autoconf or DHCPv6 stuff goes here */
|
||||
}
|
||||
// DNS Servers, set NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS TRUE here
|
||||
// DNS Servers, set NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS TRUE here
|
||||
set_ip6_dns_servers (s_ip6, conn_name);
|
||||
|
||||
/* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIP4Config */
|
||||
/* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIPConfig */
|
||||
|
||||
// Add routes
|
||||
iblock = convert_ip6_routes_block (conn_name);
|
||||
if (iblock)
|
||||
g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES,
|
||||
g_object_set (s_ip6, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES,
|
||||
TRUE, NULL);
|
||||
/* Add all IPv6 routes */
|
||||
while (iblock) {
|
||||
|
@ -855,7 +854,7 @@ make_ip6_setting (NMConnection *connection,
|
|||
|
||||
route = nm_ip_route_new (AF_INET6, iblock->ip, iblock->prefix, iblock->next_hop, metric, &local);
|
||||
if (route) {
|
||||
if (nm_setting_ip6_config_add_route (s_ip6, route))
|
||||
if (nm_setting_ip_config_add_route (s_ip6, route))
|
||||
nm_log_info (LOGD_SETTINGS, " new IP6 route");
|
||||
else
|
||||
nm_log_warn (LOGD_SETTINGS, " duplicate IP6 route");
|
||||
|
@ -2373,7 +2372,7 @@ write_wired_setting (NMConnection *connection,
|
|||
static gboolean
|
||||
write_ip4_setting (NMConnection *connection, const char *conn_name, GError **error)
|
||||
{
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
const char *value;
|
||||
guint32 i, num;
|
||||
GString *searches;
|
||||
|
@ -2392,17 +2391,17 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err
|
|||
}
|
||||
routes = g_string_new (NULL);
|
||||
|
||||
value = nm_setting_ip4_config_get_method (s_ip4);
|
||||
value = nm_setting_ip_config_get_method (s_ip4);
|
||||
g_assert (value);
|
||||
if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
|
||||
|
||||
num = nm_setting_ip4_config_get_num_addresses (s_ip4);
|
||||
num = nm_setting_ip_config_get_num_addresses (s_ip4);
|
||||
ips = g_string_new (NULL);
|
||||
/* IPv4 addresses */
|
||||
for (i = 0; i < num; i++) {
|
||||
NMIPAddress *addr;
|
||||
|
||||
addr = nm_setting_ip4_config_get_address (s_ip4, i);
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, i);
|
||||
|
||||
g_string_append_printf (ips, "\"%s/%u",
|
||||
nm_ip_address_get_address (addr),
|
||||
|
@ -2426,13 +2425,13 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err
|
|||
ifnet_set_data (conn_name, "config", "dhcp");
|
||||
|
||||
/* DNS Servers */
|
||||
num = nm_setting_ip4_config_get_num_dns (s_ip4);
|
||||
num = nm_setting_ip_config_get_num_dns (s_ip4);
|
||||
if (num > 0) {
|
||||
dns = g_string_new (NULL);
|
||||
for (i = 0; i < num; i++) {
|
||||
const char *ip;
|
||||
|
||||
ip = nm_setting_ip4_config_get_dns (s_ip4, i);
|
||||
ip = nm_setting_ip_config_get_dns (s_ip4, i);
|
||||
g_string_append_printf (dns, " %s", ip);
|
||||
}
|
||||
ifnet_set_data (conn_name, "dns_servers", dns->str);
|
||||
|
@ -2441,14 +2440,14 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err
|
|||
ifnet_set_data (conn_name, "dns_servers", NULL);
|
||||
|
||||
/* DNS Searches */
|
||||
num = nm_setting_ip4_config_get_num_dns_searches (s_ip4);
|
||||
num = nm_setting_ip_config_get_num_dns_searches (s_ip4);
|
||||
if (num > 0) {
|
||||
searches = g_string_new (NULL);
|
||||
for (i = 0; i < num; i++) {
|
||||
if (i > 0)
|
||||
g_string_append_c (searches, ' ');
|
||||
g_string_append (searches,
|
||||
nm_setting_ip4_config_get_dns_search
|
||||
nm_setting_ip_config_get_dns_search
|
||||
(s_ip4, i));
|
||||
}
|
||||
ifnet_set_data (conn_name, "dns_search", searches->str);
|
||||
|
@ -2457,12 +2456,12 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err
|
|||
ifnet_set_data (conn_name, "dns_search", NULL);
|
||||
/* FIXME Will be implemented when configuration supports it
|
||||
if (!strcmp(value, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
|
||||
value = nm_setting_ip4_config_get_dhcp_hostname(s_ip4);
|
||||
value = nm_setting_ip_config_get_dhcp_hostname(s_ip4);
|
||||
if (value)
|
||||
ifnet_set_data(conn_name, "DHCP_HOSTNAME", value,
|
||||
FALSE);
|
||||
|
||||
value = nm_setting_ip4_config_get_dhcp_client_id(s_ip4);
|
||||
value = nm_setting_ip_config_get_dhcp_client_id(s_ip4);
|
||||
if (value)
|
||||
ifnet_set_data(conn_name, "DHCP_CLIENT_ID", value,
|
||||
FALSE);
|
||||
|
@ -2470,13 +2469,13 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err
|
|||
*/
|
||||
|
||||
/* Static routes */
|
||||
num = nm_setting_ip4_config_get_num_routes (s_ip4);
|
||||
num = nm_setting_ip_config_get_num_routes (s_ip4);
|
||||
if (num > 0) {
|
||||
for (i = 0; i < num; i++) {
|
||||
NMIPRoute *route;
|
||||
const char *next_hop;
|
||||
|
||||
route = nm_setting_ip4_config_get_route (s_ip4, i);
|
||||
route = nm_setting_ip_config_get_route (s_ip4, i);
|
||||
|
||||
next_hop = nm_ip_route_get_next_hop (route);
|
||||
if (!next_hop)
|
||||
|
@ -2500,7 +2499,7 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err
|
|||
}
|
||||
|
||||
static gboolean
|
||||
write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **error)
|
||||
write_route6_file (NMSettingIPConfig *s_ip6, const char *conn_name, GError **error)
|
||||
{
|
||||
NMIPRoute *route;
|
||||
const char *next_hop;
|
||||
|
@ -2509,7 +2508,7 @@ write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **er
|
|||
const char *old_routes;
|
||||
|
||||
g_return_val_if_fail (s_ip6 != NULL, FALSE);
|
||||
num = nm_setting_ip6_config_get_num_routes (s_ip6);
|
||||
num = nm_setting_ip_config_get_num_routes (s_ip6);
|
||||
if (num == 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -2519,7 +2518,7 @@ write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **er
|
|||
if (old_routes)
|
||||
g_string_append (routes_string, "\" ");
|
||||
for (i = 0; i < num; i++) {
|
||||
route = nm_setting_ip6_config_get_route (s_ip6, i);
|
||||
route = nm_setting_ip_config_get_route (s_ip6, i);
|
||||
|
||||
next_hop = nm_ip_route_get_next_hop (route);
|
||||
if (!next_hop)
|
||||
|
@ -2540,7 +2539,7 @@ write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **er
|
|||
static gboolean
|
||||
write_ip6_setting (NMConnection *connection, const char *conn_name, GError **error)
|
||||
{
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
const char *value;
|
||||
guint32 i, num;
|
||||
GString *searches;
|
||||
|
@ -2554,7 +2553,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
value = nm_setting_ip6_config_get_method (s_ip6);
|
||||
value = nm_setting_ip_config_get_method (s_ip6);
|
||||
g_assert (value);
|
||||
if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
|
||||
ifnet_set_data (conn_name, "enable_ipv6", "false");
|
||||
|
@ -2588,12 +2587,12 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err
|
|||
|
||||
if (!config)
|
||||
config = "";
|
||||
num = nm_setting_ip6_config_get_num_addresses (s_ip6);
|
||||
num = nm_setting_ip_config_get_num_addresses (s_ip6);
|
||||
|
||||
/* IPv6 addresses */
|
||||
ip_str = g_string_new (NULL);
|
||||
for (i = 0; i < num; i++) {
|
||||
addr = nm_setting_ip6_config_get_address (s_ip6, i);
|
||||
addr = nm_setting_ip_config_get_address (s_ip6, i);
|
||||
|
||||
g_string_append_printf (ip_str, "\"%s/%u\"",
|
||||
nm_ip_address_get_address (addr),
|
||||
|
@ -2606,7 +2605,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err
|
|||
}
|
||||
|
||||
/* DNS Servers */
|
||||
num = nm_setting_ip6_config_get_num_dns (s_ip6);
|
||||
num = nm_setting_ip_config_get_num_dns (s_ip6);
|
||||
if (num > 0) {
|
||||
const char *dns_servers = ifnet_get_data (conn_name, "dns_servers");
|
||||
gchar *tmp;
|
||||
|
@ -2616,7 +2615,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err
|
|||
if (!dns_servers)
|
||||
dns_servers = "";
|
||||
for (i = 0; i < num; i++) {
|
||||
dns = nm_setting_ip6_config_get_dns (s_ip6, i);
|
||||
dns = nm_setting_ip_config_get_dns (s_ip6, i);
|
||||
|
||||
if (!strstr (dns_servers, dns))
|
||||
g_string_append_printf (dns_string, "%s ", dns);
|
||||
|
@ -2628,7 +2627,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err
|
|||
|
||||
} else
|
||||
/* DNS Searches */
|
||||
num = nm_setting_ip6_config_get_num_dns_searches (s_ip6);
|
||||
num = nm_setting_ip_config_get_num_dns_searches (s_ip6);
|
||||
if (num > 0) {
|
||||
const char *ip4_domains;
|
||||
|
||||
|
@ -2640,7 +2639,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err
|
|||
const gchar *search = NULL;
|
||||
|
||||
search =
|
||||
nm_setting_ip6_config_get_dns_search (s_ip6, i);
|
||||
nm_setting_ip_config_get_dns_search (s_ip6, i);
|
||||
if (search && !strstr (searches->str, search)) {
|
||||
if (searches->len > 0)
|
||||
g_string_append_c (searches, ' ');
|
||||
|
@ -2686,7 +2685,7 @@ ifnet_update_parsers_by_connection (NMConnection *connection,
|
|||
GError **error)
|
||||
{
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
gboolean success = FALSE;
|
||||
const char *type;
|
||||
gboolean no_8021x = FALSE;
|
||||
|
|
|
@ -651,7 +651,7 @@ destroy_ip_block (ip_block * iblock)
|
|||
}
|
||||
|
||||
void
|
||||
set_ip4_dns_servers (NMSettingIP4Config *s_ip4, const char *conn_name)
|
||||
set_ip4_dns_servers (NMSettingIPConfig *s_ip4, const char *conn_name)
|
||||
{
|
||||
const char *dns_servers;
|
||||
gchar **server_list, *stripped;
|
||||
|
@ -668,7 +668,7 @@ set_ip4_dns_servers (NMSettingIP4Config *s_ip4, const char *conn_name)
|
|||
|
||||
length = g_strv_length (server_list);
|
||||
if (length)
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS,
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS,
|
||||
TRUE, NULL);
|
||||
for (i = 0; i < length; i++) {
|
||||
g_strstrip (server_list[i]);
|
||||
|
@ -679,14 +679,14 @@ set_ip4_dns_servers (NMSettingIP4Config *s_ip4, const char *conn_name)
|
|||
nm_log_warn (LOGD_SETTINGS, "ignored dns: %s\n", server_list[i]);
|
||||
continue;
|
||||
}
|
||||
if (!nm_setting_ip4_config_add_dns (s_ip4, server_list[i]))
|
||||
if (!nm_setting_ip_config_add_dns (s_ip4, server_list[i]))
|
||||
nm_log_warn (LOGD_SETTINGS, "warning: duplicate DNS server %s", server_list[i]);
|
||||
}
|
||||
g_strfreev (server_list);
|
||||
}
|
||||
|
||||
void
|
||||
set_ip6_dns_servers (NMSettingIP6Config *s_ip6, const char *conn_name)
|
||||
set_ip6_dns_servers (NMSettingIPConfig *s_ip6, const char *conn_name)
|
||||
{
|
||||
const char *dns_servers;
|
||||
gchar **server_list, *stripped;
|
||||
|
@ -704,7 +704,7 @@ set_ip6_dns_servers (NMSettingIP6Config *s_ip6, const char *conn_name)
|
|||
|
||||
length = g_strv_length (server_list);
|
||||
if (length)
|
||||
g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS,
|
||||
g_object_set (s_ip6, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS,
|
||||
TRUE, NULL);
|
||||
for (i = 0; i < length; i++) {
|
||||
g_strstrip (server_list[i]);
|
||||
|
@ -715,7 +715,7 @@ set_ip6_dns_servers (NMSettingIP6Config *s_ip6, const char *conn_name)
|
|||
nm_log_warn (LOGD_SETTINGS, "ignored dns: %s\n", server_list[i]);
|
||||
continue;
|
||||
}
|
||||
if (!nm_setting_ip6_config_add_dns (s_ip6, server_list[i]))
|
||||
if (!nm_setting_ip_config_add_dns (s_ip6, server_list[i]))
|
||||
nm_log_warn (LOGD_SETTINGS, "warning: duplicate DNS server %s", server_list[i]);
|
||||
}
|
||||
g_strfreev (server_list);
|
||||
|
|
|
@ -53,8 +53,8 @@ ip_block *convert_ip4_routes_block (const char *conn_name);
|
|||
ip_block *convert_ip6_routes_block (const char *conn_name);
|
||||
void destroy_ip_block (ip_block * iblock);
|
||||
|
||||
void set_ip4_dns_servers (NMSettingIP4Config * s_ip4, const char *conn_name);
|
||||
void set_ip6_dns_servers (NMSettingIP6Config * s_ip6, const char *conn_name);
|
||||
void set_ip4_dns_servers (NMSettingIPConfig * s_ip4, const char *conn_name);
|
||||
void set_ip6_dns_servers (NMSettingIPConfig * s_ip6, const char *conn_name);
|
||||
|
||||
gchar *strip_string (gchar *str, gchar t);
|
||||
gboolean is_managed (const char *conn_name);
|
||||
|
|
|
@ -410,7 +410,7 @@ update_wired_setting_from_if_block(NMConnection *connection,
|
|||
}
|
||||
|
||||
static void
|
||||
ifupdown_ip4_add_dns (NMSettingIP4Config *s_ip4, const char *dns)
|
||||
ifupdown_ip4_add_dns (NMSettingIPConfig *s_ip4, const char *dns)
|
||||
{
|
||||
guint32 addr;
|
||||
char **list, **iter;
|
||||
|
@ -428,7 +428,7 @@ ifupdown_ip4_add_dns (NMSettingIP4Config *s_ip4, const char *dns)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!nm_setting_ip4_config_add_dns (s_ip4, *iter))
|
||||
if (!nm_setting_ip_config_add_dns (s_ip4, *iter))
|
||||
nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter);
|
||||
}
|
||||
g_strfreev (list);
|
||||
|
@ -440,12 +440,12 @@ update_ip4_setting_from_if_block(NMConnection *connection,
|
|||
GError **error)
|
||||
{
|
||||
|
||||
NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new());
|
||||
NMSettingIPConfig *s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new());
|
||||
const char *type = ifparser_getkey(block, "inet");
|
||||
gboolean is_static = type && !strcmp("static", type);
|
||||
|
||||
if (!is_static) {
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
} else {
|
||||
guint32 tmp_mask;
|
||||
NMIPAddress *addr;
|
||||
|
@ -490,9 +490,9 @@ update_ip4_setting_from_if_block(NMConnection *connection,
|
|||
if (!addr)
|
||||
goto error;
|
||||
|
||||
if (nm_setting_ip4_config_add_address (s_ip4, addr)) {
|
||||
if (nm_setting_ip_config_add_address (s_ip4, addr)) {
|
||||
nm_log_info (LOGD_SETTINGS, "addresses count: %d",
|
||||
nm_setting_ip4_config_get_num_addresses (s_ip4));
|
||||
nm_setting_ip_config_get_num_addresses (s_ip4));
|
||||
} else {
|
||||
nm_log_info (LOGD_SETTINGS, "ignoring duplicate IP4 address");
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ update_ip4_setting_from_if_block(NMConnection *connection,
|
|||
nameservers_v = ifparser_getkey (block, "dns-nameservers");
|
||||
ifupdown_ip4_add_dns (s_ip4, nameservers_v);
|
||||
|
||||
if (!nm_setting_ip4_config_get_num_dns (s_ip4))
|
||||
if (!nm_setting_ip_config_get_num_dns (s_ip4))
|
||||
nm_log_info (LOGD_SETTINGS, "No dns-nameserver configured in /etc/network/interfaces");
|
||||
|
||||
/* DNS searches */
|
||||
|
@ -515,13 +515,13 @@ update_ip4_setting_from_if_block(NMConnection *connection,
|
|||
g_strstrip (*iter);
|
||||
if (g_ascii_isspace (*iter[0]))
|
||||
continue;
|
||||
if (!nm_setting_ip4_config_add_dns_search (s_ip4, *iter))
|
||||
if (!nm_setting_ip_config_add_dns_search (s_ip4, *iter))
|
||||
nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter);
|
||||
}
|
||||
g_strfreev (list);
|
||||
}
|
||||
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
|
||||
}
|
||||
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
@ -533,7 +533,7 @@ error:
|
|||
}
|
||||
|
||||
static void
|
||||
ifupdown_ip6_add_dns (NMSettingIP6Config *s_ip6, const char *dns)
|
||||
ifupdown_ip6_add_dns (NMSettingIPConfig *s_ip6, const char *dns)
|
||||
{
|
||||
struct in6_addr addr;
|
||||
char **list, **iter;
|
||||
|
@ -551,7 +551,7 @@ ifupdown_ip6_add_dns (NMSettingIP6Config *s_ip6, const char *dns)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!nm_setting_ip6_config_add_dns (s_ip6, *iter))
|
||||
if (!nm_setting_ip_config_add_dns (s_ip6, *iter))
|
||||
nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter);
|
||||
}
|
||||
g_strfreev (list);
|
||||
|
@ -562,13 +562,13 @@ update_ip6_setting_from_if_block(NMConnection *connection,
|
|||
if_block *block,
|
||||
GError **error)
|
||||
{
|
||||
NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new());
|
||||
NMSettingIPConfig *s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new());
|
||||
const char *type = ifparser_getkey(block, "inet6");
|
||||
gboolean is_static = type && (!strcmp("static", type) ||
|
||||
!strcmp("v4tunnel", type));
|
||||
|
||||
if (!is_static) {
|
||||
g_object_set(s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set(s_ip6, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
|
||||
} else {
|
||||
NMIPAddress *addr;
|
||||
const char *address_v;
|
||||
|
@ -603,9 +603,9 @@ update_ip6_setting_from_if_block(NMConnection *connection,
|
|||
if (!addr)
|
||||
goto error;
|
||||
|
||||
if (nm_setting_ip6_config_add_address (s_ip6, addr)) {
|
||||
if (nm_setting_ip_config_add_address (s_ip6, addr)) {
|
||||
nm_log_info (LOGD_SETTINGS, "addresses count: %d",
|
||||
nm_setting_ip6_config_get_num_addresses (s_ip6));
|
||||
nm_setting_ip_config_get_num_addresses (s_ip6));
|
||||
} else {
|
||||
nm_log_info (LOGD_SETTINGS, "ignoring duplicate IP6 address");
|
||||
}
|
||||
|
@ -617,7 +617,7 @@ update_ip6_setting_from_if_block(NMConnection *connection,
|
|||
nameservers_v = ifparser_getkey(block, "dns-nameservers");
|
||||
ifupdown_ip6_add_dns (s_ip6, nameservers_v);
|
||||
|
||||
if (!nm_setting_ip6_config_get_num_dns (s_ip6))
|
||||
if (!nm_setting_ip_config_get_num_dns (s_ip6))
|
||||
nm_log_info (LOGD_SETTINGS, "No dns-nameserver configured in /etc/network/interfaces");
|
||||
|
||||
/* DNS searches */
|
||||
|
@ -628,14 +628,14 @@ update_ip6_setting_from_if_block(NMConnection *connection,
|
|||
g_strstrip (*iter);
|
||||
if (isblank (*iter[0]))
|
||||
continue;
|
||||
if (!nm_setting_ip6_config_add_dns_search (s_ip6, *iter))
|
||||
if (!nm_setting_ip_config_add_dns_search (s_ip6, *iter))
|
||||
nm_log_warn (LOGD_SETTINGS, " duplicate DNS domain '%s'", *iter);
|
||||
}
|
||||
g_strfreev (list);
|
||||
}
|
||||
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -459,7 +459,7 @@ test17_read_static_ipv4 (const char *path)
|
|||
{
|
||||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingWired *s_wired;
|
||||
char *unmanaged = NULL;
|
||||
GError *error = NULL;
|
||||
|
@ -525,81 +525,81 @@ test17_read_static_ipv4 (const char *path)
|
|||
NM_SETTING_IP4_CONFIG_SETTING_NAME);
|
||||
|
||||
/* Method */
|
||||
tmp = nm_setting_ip4_config_get_method (s_ip4);
|
||||
tmp = nm_setting_ip_config_get_method (s_ip4);
|
||||
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0,
|
||||
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
|
||||
file,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_METHOD);
|
||||
NM_SETTING_IP_CONFIG_METHOD);
|
||||
|
||||
/* IP addresses */
|
||||
ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1,
|
||||
ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 1,
|
||||
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
|
||||
file,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_ADDRESSES);
|
||||
NM_SETTING_IP_CONFIG_ADDRESSES);
|
||||
|
||||
ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
|
||||
ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
|
||||
g_assert (ip4_addr != NULL);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "10.0.0.3");
|
||||
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 8);
|
||||
|
||||
/* DNS Addresses */
|
||||
ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2,
|
||||
ASSERT (nm_setting_ip_config_get_num_dns (s_ip4) == 2,
|
||||
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
|
||||
file,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
ASSERT (!strcmp (nm_setting_ip4_config_get_dns (s_ip4, 0), "10.0.0.1"),
|
||||
ASSERT (!strcmp (nm_setting_ip_config_get_dns (s_ip4, 0), "10.0.0.1"),
|
||||
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value #1",
|
||||
file,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
ASSERT (!strcmp (nm_setting_ip4_config_get_dns (s_ip4, 1), "10.0.0.2"),
|
||||
ASSERT (!strcmp (nm_setting_ip_config_get_dns (s_ip4, 1), "10.0.0.2"),
|
||||
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value #2",
|
||||
file,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1,
|
||||
ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 1,
|
||||
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
|
||||
file,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
/* DNS search domains */
|
||||
ASSERT (nm_setting_ip4_config_get_num_dns_searches (s_ip4) == 2,
|
||||
ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip4) == 2,
|
||||
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
|
||||
file,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 0);
|
||||
tmp = nm_setting_ip_config_get_dns_search (s_ip4, 0);
|
||||
ASSERT (tmp != NULL,
|
||||
TEST17_NAME, "failed to verify %s: missing %s / %s key",
|
||||
file,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS_SEARCH);
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
ASSERT (strcmp (tmp, expected_search1) == 0,
|
||||
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
|
||||
file,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS_SEARCH);
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
|
||||
tmp = nm_setting_ip4_config_get_dns_search (s_ip4, 1);
|
||||
tmp = nm_setting_ip_config_get_dns_search (s_ip4, 1);
|
||||
ASSERT (tmp != NULL,
|
||||
TEST17_NAME, "failed to verify %s: missing %s / %s key",
|
||||
file,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS_SEARCH);
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
|
||||
ASSERT (strcmp (tmp, expected_search2) == 0,
|
||||
TEST17_NAME, "failed to verify %s: unexpected %s / %s key value",
|
||||
file,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS_SEARCH);
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ test18_read_static_ipv6 (const char *path)
|
|||
{
|
||||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
NMSettingWired *s_wired;
|
||||
char *unmanaged = NULL;
|
||||
GError *error = NULL;
|
||||
|
@ -681,85 +681,85 @@ test18_read_static_ipv6 (const char *path)
|
|||
NM_SETTING_IP6_CONFIG_SETTING_NAME);
|
||||
|
||||
/* Method */
|
||||
tmp = nm_setting_ip6_config_get_method (s_ip6);
|
||||
tmp = nm_setting_ip_config_get_method (s_ip6);
|
||||
ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0,
|
||||
TEST18_NAME,
|
||||
"failed to verify %s: unexpected %s / %s key value",
|
||||
file,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_METHOD);
|
||||
NM_SETTING_IP_CONFIG_METHOD);
|
||||
|
||||
/* IP addresses */
|
||||
ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1,
|
||||
ASSERT (nm_setting_ip_config_get_num_addresses (s_ip6) == 1,
|
||||
TEST18_NAME,
|
||||
"failed to verify %s: unexpected number of %s / %s",
|
||||
file,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_ADDRESSES);
|
||||
NM_SETTING_IP_CONFIG_ADDRESSES);
|
||||
|
||||
ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0);
|
||||
ip6_addr = nm_setting_ip_config_get_address (s_ip6, 0);
|
||||
g_assert (ip6_addr != NULL);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (ip6_addr), ==, "fc00::1");
|
||||
g_assert_cmpint (nm_ip_address_get_prefix (ip6_addr), ==, 64);
|
||||
|
||||
/* DNS Addresses */
|
||||
ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 2,
|
||||
ASSERT (nm_setting_ip_config_get_num_dns (s_ip6) == 2,
|
||||
TEST18_NAME,
|
||||
"failed to verify %s: unexpected number of %s / %s values",
|
||||
file,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
ASSERT (!strcmp (nm_setting_ip6_config_get_dns (s_ip6, 0), "fc00::2"),
|
||||
ASSERT (!strcmp (nm_setting_ip_config_get_dns (s_ip6, 0), "fc00::2"),
|
||||
TEST18_NAME,
|
||||
"failed to verify %s: unexpected %s / %s #1",
|
||||
file,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
ASSERT (!strcmp (nm_setting_ip6_config_get_dns (s_ip6, 1), "fc00::3"),
|
||||
ASSERT (!strcmp (nm_setting_ip_config_get_dns (s_ip6, 1), "fc00::3"),
|
||||
TEST18_NAME, "failed to verify %s: unexpected %s / %s #2",
|
||||
file,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
/* DNS search domains */
|
||||
ASSERT (nm_setting_ip6_config_get_num_dns_searches (s_ip6) == 2,
|
||||
ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip6) == 2,
|
||||
TEST18_NAME,
|
||||
"failed to verify %s: unexpected number of %s / %s values",
|
||||
file,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
|
||||
tmp = nm_setting_ip6_config_get_dns_search (s_ip6, 0);
|
||||
tmp = nm_setting_ip_config_get_dns_search (s_ip6, 0);
|
||||
ASSERT (tmp != NULL,
|
||||
"wired-ipv6-manual-verify-ip6",
|
||||
"failed to verify %s: missing %s / %s #1",
|
||||
file,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
|
||||
ASSERT (strcmp (tmp, expected_search1) == 0,
|
||||
"wired-ipv6-manual-verify-ip6",
|
||||
"failed to verify %s: unexpected %s / %s #1",
|
||||
file,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
|
||||
tmp = nm_setting_ip6_config_get_dns_search (s_ip6, 1);
|
||||
tmp = nm_setting_ip_config_get_dns_search (s_ip6, 1);
|
||||
ASSERT (tmp != NULL,
|
||||
TEST18_NAME,
|
||||
"failed to verify %s: missing %s / %s #2",
|
||||
file,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
|
||||
ASSERT (strcmp (tmp, expected_search2) == 0,
|
||||
TEST18_NAME,
|
||||
"failed to verify %s: unexpected %s / %s #2",
|
||||
file,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
|
||||
g_free (unmanaged);
|
||||
g_object_unref (connection);
|
||||
|
@ -769,7 +769,7 @@ static void
|
|||
test19_read_static_ipv4_plen (const char *path)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
char *unmanaged = NULL;
|
||||
GError *error = NULL;
|
||||
NMIPAddress *ip4_addr;
|
||||
|
@ -801,13 +801,13 @@ test19_read_static_ipv4_plen (const char *path)
|
|||
NM_SETTING_IP4_CONFIG_SETTING_NAME);
|
||||
|
||||
/* IP addresses */
|
||||
ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 1,
|
||||
ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 1,
|
||||
TEST19_NAME, "failed to verify %s: unexpected %s / %s key value",
|
||||
file,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_ADDRESSES);
|
||||
NM_SETTING_IP_CONFIG_ADDRESSES);
|
||||
|
||||
ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0);
|
||||
ip4_addr = nm_setting_ip_config_get_address (s_ip4, 0);
|
||||
g_assert (ip4_addr != NULL);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (ip4_addr), ==, "10.0.0.3");
|
||||
g_assert_cmpint (nm_ip_address_get_prefix (ip4_addr), ==, 8);
|
||||
|
|
|
@ -879,27 +879,27 @@ static KeyParser key_parsers[] = {
|
|||
TRUE,
|
||||
mac_address_parser_ETHER },
|
||||
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_ADDRESSES,
|
||||
NM_SETTING_IP_CONFIG_ADDRESSES,
|
||||
FALSE,
|
||||
ip_address_or_route_parser },
|
||||
{ NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_ADDRESSES,
|
||||
NM_SETTING_IP_CONFIG_ADDRESSES,
|
||||
FALSE,
|
||||
ip_address_or_route_parser },
|
||||
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_ROUTES,
|
||||
NM_SETTING_IP_CONFIG_ROUTES,
|
||||
FALSE,
|
||||
ip_address_or_route_parser },
|
||||
{ NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_ROUTES,
|
||||
NM_SETTING_IP_CONFIG_ROUTES,
|
||||
FALSE,
|
||||
ip_address_or_route_parser },
|
||||
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS,
|
||||
NM_SETTING_IP_CONFIG_DNS,
|
||||
FALSE,
|
||||
ip4_dns_parser },
|
||||
{ NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS,
|
||||
NM_SETTING_IP_CONFIG_DNS,
|
||||
FALSE,
|
||||
ip6_dns_parser },
|
||||
{ NM_SETTING_WIRED_SETTING_NAME,
|
||||
|
|
|
@ -38,9 +38,9 @@
|
|||
#define TEST_WIRELESS_FILE TEST_KEYFILES_DIR"/Test_Wireless_Connection"
|
||||
|
||||
static void
|
||||
check_ip4_address (NMSettingIP4Config *config, int idx, const char *address, int plen, const char *gateway)
|
||||
check_ip_address (NMSettingIPConfig *config, int idx, const char *address, int plen, const char *gateway)
|
||||
{
|
||||
NMIPAddress *ip4 = nm_setting_ip4_config_get_address (config, idx);
|
||||
NMIPAddress *ip4 = nm_setting_ip_config_get_address (config, idx);
|
||||
|
||||
g_assert (ip4);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (ip4), ==, address);
|
||||
|
@ -49,34 +49,10 @@ check_ip4_address (NMSettingIP4Config *config, int idx, const char *address, int
|
|||
}
|
||||
|
||||
static void
|
||||
check_ip6_address (NMSettingIP6Config *config, int idx, const char *address, int plen, const char *gateway)
|
||||
check_ip_route (NMSettingIPConfig *config, int idx, const char *destination, int plen,
|
||||
const char *next_hop, int metric)
|
||||
{
|
||||
NMIPAddress *ip6 = nm_setting_ip6_config_get_address (config, idx);
|
||||
|
||||
g_assert (ip6);
|
||||
g_assert_cmpstr (nm_ip_address_get_address (ip6), ==, address);
|
||||
g_assert_cmpint (nm_ip_address_get_prefix (ip6), ==, plen);
|
||||
g_assert_cmpstr (nm_ip_address_get_gateway (ip6), ==, gateway);
|
||||
}
|
||||
|
||||
static void
|
||||
check_ip4_route (NMSettingIP4Config *config, int idx, const char *destination, int plen,
|
||||
const char *next_hop, int metric)
|
||||
{
|
||||
NMIPRoute *route = nm_setting_ip4_config_get_route (config, idx);
|
||||
|
||||
g_assert (route);
|
||||
g_assert_cmpstr (nm_ip_route_get_dest (route), ==, destination);
|
||||
g_assert_cmpint (nm_ip_route_get_prefix (route), ==, plen);
|
||||
g_assert_cmpstr (nm_ip_route_get_next_hop (route), ==, next_hop);
|
||||
g_assert_cmpint (nm_ip_route_get_metric (route), ==, metric);
|
||||
}
|
||||
|
||||
static void
|
||||
check_ip6_route (NMSettingIP6Config *config, int idx, const char *destination, int plen,
|
||||
const char *next_hop, int metric)
|
||||
{
|
||||
NMIPRoute *route = nm_setting_ip6_config_get_route (config, idx);
|
||||
NMIPRoute *route = nm_setting_ip_config_get_route (config, idx);
|
||||
|
||||
g_assert (route);
|
||||
g_assert_cmpstr (nm_ip_route_get_dest (route), ==, destination);
|
||||
|
@ -107,8 +83,8 @@ test_read_valid_wired_connection (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWired *s_wired;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
GError *error = NULL;
|
||||
const char *mac;
|
||||
char expected_mac_address[ETH_ALEN] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
|
||||
|
@ -242,55 +218,55 @@ test_read_valid_wired_connection (void)
|
|||
NM_SETTING_IP4_CONFIG_SETTING_NAME);
|
||||
|
||||
/* Method */
|
||||
tmp = nm_setting_ip4_config_get_method (s_ip4);
|
||||
tmp = nm_setting_ip_config_get_method (s_ip4);
|
||||
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0,
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
|
||||
TEST_WIRED_FILE,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_METHOD);
|
||||
NM_SETTING_IP_CONFIG_METHOD);
|
||||
|
||||
/* DNS Addresses */
|
||||
ASSERT (nm_setting_ip4_config_get_num_dns (s_ip4) == 2,
|
||||
ASSERT (nm_setting_ip_config_get_num_dns (s_ip4) == 2,
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
|
||||
TEST_WIRED_FILE,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 0), "4.2.2.1") == 0,
|
||||
ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 0), "4.2.2.1") == 0,
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #1",
|
||||
TEST_WIRED_FILE,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
ASSERT (strcmp (nm_setting_ip4_config_get_dns (s_ip4, 1), "4.2.2.2") == 0,
|
||||
ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip4, 1), "4.2.2.2") == 0,
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #2",
|
||||
TEST_WIRED_FILE,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
/* IPv4 addresses */
|
||||
g_assert (nm_setting_ip4_config_get_num_addresses (s_ip4) == 6);
|
||||
check_ip4_address (s_ip4, 0, "2.3.4.5", 24, "2.3.4.6");
|
||||
check_ip4_address (s_ip4, 1, "192.168.0.5", 24, "192.168.0.1");
|
||||
check_ip4_address (s_ip4, 2, "1.2.3.4", 16, "1.2.1.1");
|
||||
check_ip4_address (s_ip4, 3, "3.4.5.6", 16, NULL);
|
||||
check_ip4_address (s_ip4, 4, "4.5.6.7", 24, "1.2.3.4");
|
||||
check_ip4_address (s_ip4, 5, "5.6.7.8", 24, NULL);
|
||||
g_assert (nm_setting_ip_config_get_num_addresses (s_ip4) == 6);
|
||||
check_ip_address (s_ip4, 0, "2.3.4.5", 24, "2.3.4.6");
|
||||
check_ip_address (s_ip4, 1, "192.168.0.5", 24, "192.168.0.1");
|
||||
check_ip_address (s_ip4, 2, "1.2.3.4", 16, "1.2.1.1");
|
||||
check_ip_address (s_ip4, 3, "3.4.5.6", 16, NULL);
|
||||
check_ip_address (s_ip4, 4, "4.5.6.7", 24, "1.2.3.4");
|
||||
check_ip_address (s_ip4, 5, "5.6.7.8", 24, NULL);
|
||||
|
||||
/* IPv4 routes */
|
||||
g_assert (nm_setting_ip4_config_get_num_routes (s_ip4) == 12);
|
||||
check_ip4_route (s_ip4, 0, "5.6.7.8", 32, NULL, 0);
|
||||
check_ip4_route (s_ip4, 1, "1.2.3.0", 24, "2.3.4.8", 99);
|
||||
check_ip4_route (s_ip4, 2, "1.1.1.2", 12, NULL, 0);
|
||||
check_ip4_route (s_ip4, 3, "1.1.1.3", 13, NULL, 0);
|
||||
check_ip4_route (s_ip4, 4, "1.1.1.4", 14, "2.2.2.4", 0);
|
||||
check_ip4_route (s_ip4, 5, "1.1.1.5", 15, "2.2.2.5", 0);
|
||||
check_ip4_route (s_ip4, 6, "1.1.1.6", 16, "2.2.2.6", 0);
|
||||
check_ip4_route (s_ip4, 7, "1.1.1.7", 17, NULL, 0);
|
||||
check_ip4_route (s_ip4, 8, "1.1.1.8", 18, NULL, 0);
|
||||
check_ip4_route (s_ip4, 9, "1.1.1.9", 19, NULL, 0);
|
||||
check_ip4_route (s_ip4, 10, "1.1.1.10", 20, NULL, 0);
|
||||
check_ip4_route (s_ip4, 11, "1.1.1.11", 21, NULL, 21);
|
||||
g_assert (nm_setting_ip_config_get_num_routes (s_ip4) == 12);
|
||||
check_ip_route (s_ip4, 0, "5.6.7.8", 32, NULL, 0);
|
||||
check_ip_route (s_ip4, 1, "1.2.3.0", 24, "2.3.4.8", 99);
|
||||
check_ip_route (s_ip4, 2, "1.1.1.2", 12, NULL, 0);
|
||||
check_ip_route (s_ip4, 3, "1.1.1.3", 13, NULL, 0);
|
||||
check_ip_route (s_ip4, 4, "1.1.1.4", 14, "2.2.2.4", 0);
|
||||
check_ip_route (s_ip4, 5, "1.1.1.5", 15, "2.2.2.5", 0);
|
||||
check_ip_route (s_ip4, 6, "1.1.1.6", 16, "2.2.2.6", 0);
|
||||
check_ip_route (s_ip4, 7, "1.1.1.7", 17, NULL, 0);
|
||||
check_ip_route (s_ip4, 8, "1.1.1.8", 18, NULL, 0);
|
||||
check_ip_route (s_ip4, 9, "1.1.1.9", 19, NULL, 0);
|
||||
check_ip_route (s_ip4, 10, "1.1.1.10", 20, NULL, 0);
|
||||
check_ip_route (s_ip4, 11, "1.1.1.11", 21, NULL, 21);
|
||||
|
||||
/* ===== IPv6 SETTING ===== */
|
||||
|
||||
|
@ -301,139 +277,110 @@ test_read_valid_wired_connection (void)
|
|||
NM_SETTING_IP6_CONFIG_SETTING_NAME);
|
||||
|
||||
/* Method */
|
||||
tmp = nm_setting_ip6_config_get_method (s_ip6);
|
||||
tmp = nm_setting_ip_config_get_method (s_ip6);
|
||||
ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0,
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
|
||||
TEST_WIRED_FILE,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_METHOD);
|
||||
NM_SETTING_IP_CONFIG_METHOD);
|
||||
|
||||
/* DNS Addresses */
|
||||
ASSERT (nm_setting_ip6_config_get_num_dns (s_ip6) == 2,
|
||||
ASSERT (nm_setting_ip_config_get_num_dns (s_ip6) == 2,
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
|
||||
TEST_WIRED_FILE,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
ASSERT (strcmp (nm_setting_ip6_config_get_dns (s_ip6, 0), "1111:dddd::aaaa") == 0,
|
||||
ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip6, 0), "1111:dddd::aaaa") == 0,
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #1",
|
||||
TEST_WIRED_FILE,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
ASSERT (strcmp (nm_setting_ip6_config_get_dns (s_ip6, 1), "1::cafe") == 0,
|
||||
ASSERT (strcmp (nm_setting_ip_config_get_dns (s_ip6, 1), "1::cafe") == 0,
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #2",
|
||||
TEST_WIRED_FILE,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
/* DNS Searches */
|
||||
ASSERT (nm_setting_ip6_config_get_num_dns_searches (s_ip6) == 3,
|
||||
ASSERT (nm_setting_ip_config_get_num_dns_searches (s_ip6) == 3,
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
|
||||
TEST_WIRED_FILE,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
|
||||
ASSERT (!strcmp (nm_setting_ip6_config_get_dns_search (s_ip6, 0), expected6_dnssearch1),
|
||||
ASSERT (!strcmp (nm_setting_ip_config_get_dns_search (s_ip6, 0), expected6_dnssearch1),
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #1",
|
||||
TEST_WIRED_FILE,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
ASSERT (!strcmp (nm_setting_ip6_config_get_dns_search (s_ip6, 1), expected6_dnssearch2),
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
ASSERT (!strcmp (nm_setting_ip_config_get_dns_search (s_ip6, 1), expected6_dnssearch2),
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #2",
|
||||
TEST_WIRED_FILE,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
ASSERT (!strcmp (nm_setting_ip6_config_get_dns_search (s_ip6, 2), expected6_dnssearch3),
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
ASSERT (!strcmp (nm_setting_ip_config_get_dns_search (s_ip6, 2), expected6_dnssearch3),
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value #3",
|
||||
TEST_WIRED_FILE,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS_SEARCH);
|
||||
NM_SETTING_IP_CONFIG_DNS_SEARCH);
|
||||
|
||||
/* IPv6 addresses */
|
||||
g_assert (nm_setting_ip6_config_get_num_addresses (s_ip6) == 10);
|
||||
check_ip6_address (s_ip6, 0, "2:3:4:5:6:7:8:9", 64, "2:3:4:5:1:2:3:4");
|
||||
check_ip6_address (s_ip6, 1, "abcd:1234:ffff::cdde", 64, NULL);
|
||||
check_ip6_address (s_ip6, 2, "1:2:3:4:5:6:7:8", 96, NULL);
|
||||
check_ip6_address (s_ip6, 3, "3:4:5:6:7:8:9:0", 128, NULL);
|
||||
check_ip6_address (s_ip6, 4, "3:4:5:6:7:8:9:14", 64, NULL);
|
||||
check_ip6_address (s_ip6, 5, "3:4:5:6:7:8:9:15", 64, NULL);
|
||||
check_ip6_address (s_ip6, 6, "3:4:5:6:7:8:9:16", 66, NULL);
|
||||
check_ip6_address (s_ip6, 7, "3:4:5:6:7:8:9:17", 67, NULL);
|
||||
check_ip6_address (s_ip6, 8, "3:4:5:6:7:8:9:18", 68, NULL);
|
||||
check_ip6_address (s_ip6, 9, "3:4:5:6:7:8:9:19", 69, "1::9");
|
||||
g_assert (nm_setting_ip_config_get_num_addresses (s_ip6) == 10);
|
||||
check_ip_address (s_ip6, 0, "2:3:4:5:6:7:8:9", 64, "2:3:4:5:1:2:3:4");
|
||||
check_ip_address (s_ip6, 1, "abcd:1234:ffff::cdde", 64, NULL);
|
||||
check_ip_address (s_ip6, 2, "1:2:3:4:5:6:7:8", 96, NULL);
|
||||
check_ip_address (s_ip6, 3, "3:4:5:6:7:8:9:0", 128, NULL);
|
||||
check_ip_address (s_ip6, 4, "3:4:5:6:7:8:9:14", 64, NULL);
|
||||
check_ip_address (s_ip6, 5, "3:4:5:6:7:8:9:15", 64, NULL);
|
||||
check_ip_address (s_ip6, 6, "3:4:5:6:7:8:9:16", 66, NULL);
|
||||
check_ip_address (s_ip6, 7, "3:4:5:6:7:8:9:17", 67, NULL);
|
||||
check_ip_address (s_ip6, 8, "3:4:5:6:7:8:9:18", 68, NULL);
|
||||
check_ip_address (s_ip6, 9, "3:4:5:6:7:8:9:19", 69, "1::9");
|
||||
|
||||
/* Route #1 */
|
||||
g_assert (nm_setting_ip6_config_get_num_routes (s_ip6) == 7);
|
||||
check_ip6_route (s_ip6, 0, "d:e:f:0:1:2:3:4", 64, "f:e:d:c:1:2:3:4", 0);
|
||||
check_ip6_route (s_ip6, 1, "a:b:c:d::", 64, "f:e:d:c:1:2:3:4", 99);
|
||||
check_ip6_route (s_ip6, 2, "8:7:6:5:4:3:2:1", 128, NULL, 0);
|
||||
check_ip6_route (s_ip6, 3, "6:7:8:9:0:1:2:3", 126, NULL, 1);
|
||||
check_ip6_route (s_ip6, 4, "7:8:9:0:1:2:3:4", 125, NULL, 5);
|
||||
check_ip6_route (s_ip6, 5, "8:9:0:1:2:3:4:5", 124, NULL, 6);
|
||||
check_ip6_route (s_ip6, 6, "8:9:0:1:2:3:4:6", 123, NULL, 0);
|
||||
g_assert (nm_setting_ip_config_get_num_routes (s_ip6) == 7);
|
||||
check_ip_route (s_ip6, 0, "d:e:f:0:1:2:3:4", 64, "f:e:d:c:1:2:3:4", 0);
|
||||
check_ip_route (s_ip6, 1, "a:b:c:d::", 64, "f:e:d:c:1:2:3:4", 99);
|
||||
check_ip_route (s_ip6, 2, "8:7:6:5:4:3:2:1", 128, NULL, 0);
|
||||
check_ip_route (s_ip6, 3, "6:7:8:9:0:1:2:3", 126, NULL, 1);
|
||||
check_ip_route (s_ip6, 4, "7:8:9:0:1:2:3:4", 125, NULL, 5);
|
||||
check_ip_route (s_ip6, 5, "8:9:0:1:2:3:4:5", 124, NULL, 6);
|
||||
check_ip_route (s_ip6, 6, "8:9:0:1:2:3:4:6", 123, NULL, 0);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
add_one_ip4_address (NMSettingIP4Config *s_ip4,
|
||||
const char *addr,
|
||||
const char *gw,
|
||||
guint32 prefix)
|
||||
add_one_ip_address (NMSettingIPConfig *s_ip,
|
||||
const char *addr,
|
||||
guint32 prefix,
|
||||
const char *gw)
|
||||
{
|
||||
NMIPAddress *ip4_addr;
|
||||
NMIPAddress *ip_addr;
|
||||
GError *error = NULL;
|
||||
|
||||
ip4_addr = nm_ip_address_new (AF_INET, addr, prefix, gw, &error);
|
||||
ip_addr = nm_ip_address_new (NM_IS_SETTING_IP4_CONFIG (s_ip) ? AF_INET : AF_INET6,
|
||||
addr, prefix, gw, &error);
|
||||
g_assert_no_error (error);
|
||||
nm_setting_ip4_config_add_address (s_ip4, ip4_addr);
|
||||
nm_ip_address_unref (ip4_addr);
|
||||
nm_setting_ip_config_add_address (s_ip, ip_addr);
|
||||
nm_ip_address_unref (ip_addr);
|
||||
}
|
||||
|
||||
static void
|
||||
add_one_ip4_route (NMSettingIP4Config *s_ip4,
|
||||
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_INET, dest, prefix, nh, metric, &error);
|
||||
route = nm_ip_route_new (NM_IS_SETTING_IP4_CONFIG (s_ip) ? AF_INET : AF_INET6,
|
||||
dest, prefix, nh, metric, &error);
|
||||
g_assert_no_error (error);
|
||||
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)
|
||||
{
|
||||
NMIPAddress *ip6_addr;
|
||||
GError *error = NULL;
|
||||
|
||||
ip6_addr = nm_ip_address_new (AF_INET6, addr, prefix, gw, &error);
|
||||
g_assert_no_error (error);
|
||||
nm_setting_ip6_config_add_address (s_ip6, ip6_addr);
|
||||
nm_ip_address_unref (ip6_addr);
|
||||
}
|
||||
|
||||
static void
|
||||
add_one_ip6_route (NMSettingIP6Config *s_ip6,
|
||||
const char *dest,
|
||||
const char *nh,
|
||||
guint32 prefix,
|
||||
guint32 metric)
|
||||
{
|
||||
NMIPRoute *route;
|
||||
GError *error = NULL;
|
||||
|
||||
route = nm_ip_route_new (AF_INET6, dest, prefix, nh, metric, &error);
|
||||
g_assert_no_error (error);
|
||||
nm_setting_ip6_config_add_route (s_ip6, route);
|
||||
nm_setting_ip_config_add_route (s_ip, route);
|
||||
nm_ip_route_unref (route);
|
||||
}
|
||||
|
||||
|
@ -444,8 +391,8 @@ test_write_wired_connection (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWired *s_wired;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
char *uuid;
|
||||
const char *mac = "99:88:77:66:55:44";
|
||||
gboolean success;
|
||||
|
@ -511,52 +458,52 @@ test_write_wired_connection (void)
|
|||
|
||||
/* IP4 setting */
|
||||
|
||||
s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
|
||||
s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NULL);
|
||||
|
||||
/* Addresses */
|
||||
add_one_ip4_address (s_ip4, address1, address1_gw, 24);
|
||||
add_one_ip4_address (s_ip4, address2, address2_gw, 8);
|
||||
add_one_ip_address (s_ip4, address1, 24, address1_gw);
|
||||
add_one_ip_address (s_ip4, address2, 8, address2_gw);
|
||||
|
||||
/* Routes */
|
||||
add_one_ip4_route (s_ip4, route1, route1_nh, 24, 3);
|
||||
add_one_ip4_route (s_ip4, route2, route2_nh, 8, 1);
|
||||
add_one_ip4_route (s_ip4, route3, route3_nh, 7, 0);
|
||||
add_one_ip4_route (s_ip4, route4, route4_nh, 6, 4);
|
||||
add_one_ip_route (s_ip4, route1, route1_nh, 24, 3);
|
||||
add_one_ip_route (s_ip4, route2, route2_nh, 8, 1);
|
||||
add_one_ip_route (s_ip4, route3, route3_nh, 7, 0);
|
||||
add_one_ip_route (s_ip4, route4, route4_nh, 6, 4);
|
||||
|
||||
/* DNS servers */
|
||||
nm_setting_ip4_config_add_dns (s_ip4, dns1);
|
||||
nm_setting_ip4_config_add_dns (s_ip4, dns2);
|
||||
nm_setting_ip_config_add_dns (s_ip4, dns1);
|
||||
nm_setting_ip_config_add_dns (s_ip4, dns2);
|
||||
|
||||
/* IP6 setting */
|
||||
|
||||
s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ());
|
||||
s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
|
||||
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
|
||||
NULL);
|
||||
|
||||
/* Addresses */
|
||||
add_one_ip6_address (s_ip6, address6_1, 64, NULL);
|
||||
add_one_ip6_address (s_ip6, address6_2, 56, NULL);
|
||||
add_one_ip_address (s_ip6, address6_1, 64, NULL);
|
||||
add_one_ip_address (s_ip6, address6_2, 56, NULL);
|
||||
|
||||
/* Routes */
|
||||
add_one_ip6_route (s_ip6, route6_1, route6_1_nh, 64, 3);
|
||||
add_one_ip6_route (s_ip6, route6_2, route6_2_nh, 56, 1);
|
||||
add_one_ip6_route (s_ip6, route6_3, route6_3_nh, 63, 5);
|
||||
add_one_ip6_route (s_ip6, route6_4, route6_4_nh, 62, 0);
|
||||
add_one_ip_route (s_ip6, route6_1, route6_1_nh, 64, 3);
|
||||
add_one_ip_route (s_ip6, route6_2, route6_2_nh, 56, 1);
|
||||
add_one_ip_route (s_ip6, route6_3, route6_3_nh, 63, 5);
|
||||
add_one_ip_route (s_ip6, route6_4, route6_4_nh, 62, 0);
|
||||
|
||||
/* DNS servers */
|
||||
nm_setting_ip6_config_add_dns (s_ip6, dns6_1);
|
||||
nm_setting_ip6_config_add_dns (s_ip6, dns6_2);
|
||||
nm_setting_ip_config_add_dns (s_ip6, dns6_1);
|
||||
nm_setting_ip_config_add_dns (s_ip6, dns6_2);
|
||||
|
||||
/* DNS searches */
|
||||
nm_setting_ip6_config_add_dns_search (s_ip6, "wallaceandgromit.com");
|
||||
nm_setting_ip_config_add_dns_search (s_ip6, "wallaceandgromit.com");
|
||||
|
||||
/* Write out the connection */
|
||||
owner_uid = geteuid ();
|
||||
|
@ -592,8 +539,8 @@ test_read_ip6_wired_connection (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWired *s_wired;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
GError *error = NULL;
|
||||
const char *tmp;
|
||||
const char *expected_id = "Test Wired Connection IP6";
|
||||
|
@ -657,18 +604,18 @@ test_read_ip6_wired_connection (void)
|
|||
NM_SETTING_IP4_CONFIG_SETTING_NAME);
|
||||
|
||||
/* Method */
|
||||
tmp = nm_setting_ip4_config_get_method (s_ip4);
|
||||
tmp = nm_setting_ip_config_get_method (s_ip4);
|
||||
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0,
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
|
||||
TEST_WIRED_IP6_FILE,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_METHOD);
|
||||
NM_SETTING_IP_CONFIG_METHOD);
|
||||
|
||||
ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 0,
|
||||
ASSERT (nm_setting_ip_config_get_num_addresses (s_ip4) == 0,
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
|
||||
TEST_WIRED_IP6_FILE,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS);
|
||||
NM_SETTING_IP_CONFIG_DNS);
|
||||
|
||||
/* ===== IPv6 SETTING ===== */
|
||||
|
||||
|
@ -679,16 +626,16 @@ test_read_ip6_wired_connection (void)
|
|||
NM_SETTING_IP6_CONFIG_SETTING_NAME);
|
||||
|
||||
/* Method */
|
||||
tmp = nm_setting_ip6_config_get_method (s_ip6);
|
||||
tmp = nm_setting_ip_config_get_method (s_ip6);
|
||||
ASSERT (strcmp (tmp, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0,
|
||||
"connection-verify-wired", "failed to verify %s: unexpected %s / %s key value",
|
||||
TEST_WIRED_IP6_FILE,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_METHOD);
|
||||
NM_SETTING_IP_CONFIG_METHOD);
|
||||
|
||||
/* IPv6 address */
|
||||
g_assert (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1);
|
||||
check_ip6_address (s_ip6, 0, "abcd:1234:ffff::cdde", 64, "abcd:1234:ffff::cdd1");
|
||||
g_assert (nm_setting_ip_config_get_num_addresses (s_ip6) == 1);
|
||||
check_ip_address (s_ip6, 0, "abcd:1234:ffff::cdde", 64, "abcd:1234:ffff::cdd1");
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
@ -699,8 +646,8 @@ test_write_ip6_wired_connection (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWired *s_wired;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
char *uuid;
|
||||
gboolean success;
|
||||
NMConnection *reread;
|
||||
|
@ -735,30 +682,30 @@ test_write_ip6_wired_connection (void)
|
|||
|
||||
/* IP4 setting */
|
||||
|
||||
s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
|
||||
s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
|
||||
NULL);
|
||||
|
||||
/* IP6 setting */
|
||||
|
||||
s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ());
|
||||
s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
|
||||
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
|
||||
NULL);
|
||||
|
||||
/* Addresses */
|
||||
add_one_ip6_address (s_ip6, address, 64, gw);
|
||||
add_one_ip_address (s_ip6, address, 64, gw);
|
||||
|
||||
/* DNS servers */
|
||||
nm_setting_ip6_config_add_dns (s_ip6, dns);
|
||||
nm_setting_ip_config_add_dns (s_ip6, dns);
|
||||
|
||||
/* DNS searches */
|
||||
nm_setting_ip6_config_add_dns_search (s_ip6, "wallaceandgromit.com");
|
||||
nm_setting_ip_config_add_dns_search (s_ip6, "wallaceandgromit.com");
|
||||
|
||||
/* Write out the connection */
|
||||
owner_uid = geteuid ();
|
||||
|
@ -949,7 +896,7 @@ test_read_valid_wireless_connection (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWireless *s_wireless;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
GError *error = NULL;
|
||||
const char *bssid;
|
||||
const guint8 expected_bssid[ETH_ALEN] = { 0x00, 0x1a, 0x33, 0x44, 0x99, 0x82 };
|
||||
|
@ -1045,12 +992,12 @@ test_read_valid_wireless_connection (void)
|
|||
NM_SETTING_IP4_CONFIG_SETTING_NAME);
|
||||
|
||||
/* Method */
|
||||
tmp = nm_setting_ip4_config_get_method (s_ip4);
|
||||
tmp = nm_setting_ip_config_get_method (s_ip4);
|
||||
ASSERT (strcmp (tmp, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0,
|
||||
"connection-verify-wireless", "failed to verify %s: unexpected %s / %s key value",
|
||||
TEST_WIRELESS_FILE,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_METHOD);
|
||||
NM_SETTING_IP_CONFIG_METHOD);
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
@ -1061,8 +1008,8 @@ test_write_wireless_connection (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWireless *s_wireless;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
char *uuid;
|
||||
const char *bssid = "aa:b9:a1:74:55:44";
|
||||
GBytes *ssid;
|
||||
|
@ -1109,20 +1056,20 @@ test_write_wireless_connection (void)
|
|||
|
||||
/* IP4 setting */
|
||||
|
||||
s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
|
||||
s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
|
||||
/* IP6 setting */
|
||||
|
||||
s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ());
|
||||
s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
|
||||
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
|
||||
/* Write out the connection */
|
||||
|
@ -1199,7 +1146,7 @@ test_write_string_ssid (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWireless *s_wireless;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
char *uuid, *testfile = NULL, *tmp;
|
||||
GBytes *ssid;
|
||||
unsigned char tmpssid[] = { 65, 49, 50, 51, 32, 46, 92, 46, 36, 37, 126, 93 };
|
||||
|
@ -1236,11 +1183,11 @@ test_write_string_ssid (void)
|
|||
|
||||
/* IP4 setting */
|
||||
|
||||
s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
|
||||
s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
|
||||
/* Write out the connection */
|
||||
|
@ -1322,7 +1269,7 @@ test_write_intlist_ssid (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWireless *s_wifi;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
char *uuid, *testfile = NULL;
|
||||
GBytes *ssid;
|
||||
unsigned char tmpssid[] = { 65, 49, 50, 51, 0, 50, 50 };
|
||||
|
@ -1362,10 +1309,10 @@ test_write_intlist_ssid (void)
|
|||
g_bytes_unref (ssid);
|
||||
|
||||
/* IP4 setting */
|
||||
s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
|
||||
s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
g_assert (s_ip4);
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
|
||||
/* Write out the connection */
|
||||
owner_uid = geteuid ();
|
||||
|
@ -1483,7 +1430,7 @@ test_write_intlike_ssid (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWireless *s_wifi;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
char *uuid, *testfile = NULL;
|
||||
GBytes *ssid;
|
||||
unsigned char tmpssid[] = { 49, 48, 49 };
|
||||
|
@ -1522,10 +1469,10 @@ test_write_intlike_ssid (void)
|
|||
g_bytes_unref (ssid);
|
||||
|
||||
/* IP4 setting */
|
||||
s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
|
||||
s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
g_assert (s_ip4);
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
|
||||
/* Write out the connection */
|
||||
owner_uid = geteuid ();
|
||||
|
@ -1569,7 +1516,7 @@ test_write_intlike_ssid_2 (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWireless *s_wifi;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
char *uuid, *testfile = NULL;
|
||||
GBytes *ssid;
|
||||
unsigned char tmpssid[] = { 49, 49, 59, 49, 50, 59, 49, 51, 59};
|
||||
|
@ -1608,10 +1555,10 @@ test_write_intlike_ssid_2 (void)
|
|||
g_bytes_unref (ssid);
|
||||
|
||||
/* IP4 setting */
|
||||
s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
|
||||
s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
g_assert (s_ip4);
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
|
||||
/* Write out the connection */
|
||||
owner_uid = geteuid ();
|
||||
|
@ -1816,7 +1763,7 @@ test_write_bt_dun_connection (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingBluetooth *s_bt;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingGsm *s_gsm;
|
||||
char *uuid;
|
||||
const char *bdaddr = "aa:b9:a1:74:55:44";
|
||||
|
@ -1857,11 +1804,11 @@ test_write_bt_dun_connection (void)
|
|||
|
||||
/* IP4 setting */
|
||||
|
||||
s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
|
||||
s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
|
||||
/* GSM setting */
|
||||
|
@ -2065,7 +2012,7 @@ test_write_gsm_connection (void)
|
|||
{
|
||||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingGsm *s_gsm;
|
||||
char *uuid;
|
||||
gboolean success;
|
||||
|
@ -2095,11 +2042,11 @@ test_write_gsm_connection (void)
|
|||
|
||||
/* IP4 setting */
|
||||
|
||||
s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
|
||||
s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
|
||||
/* GSM setting */
|
||||
|
@ -2401,7 +2348,7 @@ create_wired_tls_connection (NMSetting8021xCKScheme scheme)
|
|||
{
|
||||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSetting *s_wired;
|
||||
NMSetting8021x *s_8021x;
|
||||
char *uuid;
|
||||
|
@ -2425,9 +2372,9 @@ create_wired_tls_connection (NMSetting8021xCKScheme scheme)
|
|||
g_free (uuid);
|
||||
|
||||
/* IP4 setting */
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
g_assert (s_ip4);
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
/* Wired setting */
|
||||
|
@ -2704,8 +2651,8 @@ test_write_infiniband_connection (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingInfiniband *s_ib;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
char *uuid;
|
||||
const char *mac = "99:88:77:66:55:44:ab:bc:cd:de:ef:f0:0a:1b:2c:3d:4e:5f:6f:ba";
|
||||
gboolean success;
|
||||
|
@ -2745,16 +2692,16 @@ test_write_infiniband_connection (void)
|
|||
NULL);
|
||||
|
||||
/* IP4 setting */
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
g_assert (s_ip4);
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
|
||||
/* IP6 setting */
|
||||
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
|
||||
g_assert (s_ip6);
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
|
||||
g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip6, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
|
||||
|
||||
/* Write out the connection */
|
||||
owner_uid = geteuid ();
|
||||
|
@ -2785,7 +2732,7 @@ test_read_bridge_main (void)
|
|||
{
|
||||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingBridge *s_bridge;
|
||||
GError *error = NULL;
|
||||
const char *expected_id = "Test Bridge Main";
|
||||
|
@ -2809,7 +2756,7 @@ test_read_bridge_main (void)
|
|||
/* IPv4 setting */
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
g_assert (s_ip4);
|
||||
g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
|
||||
g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
|
||||
|
||||
/* Bridge setting */
|
||||
s_bridge = nm_connection_get_setting_bridge (connection);
|
||||
|
@ -2830,8 +2777,8 @@ test_write_bridge_main (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingBridge *s_bridge;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
char *uuid;
|
||||
gboolean success;
|
||||
NMConnection *reread;
|
||||
|
@ -2864,21 +2811,21 @@ test_write_bridge_main (void)
|
|||
nm_connection_add_setting (connection, NM_SETTING (s_bridge));
|
||||
|
||||
/* IP4 setting */
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
g_assert (s_ip4);
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
|
||||
NULL);
|
||||
|
||||
add_one_ip4_address (s_ip4, "1.2.3.4", "1.1.1.1", 24);
|
||||
add_one_ip_address (s_ip4, "1.2.3.4", 24, "1.1.1.1");
|
||||
|
||||
/* IP6 setting */
|
||||
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
|
||||
g_assert (s_ip6);
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
|
||||
g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip6, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
|
||||
|
||||
/* Write out the connection */
|
||||
owner_uid = geteuid ();
|
||||
|
@ -3401,7 +3348,7 @@ static void
|
|||
test_read_enum_property (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
||||
|
@ -3415,7 +3362,7 @@ test_read_enum_property (void)
|
|||
/* IPv6 setting */
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
g_assert (s_ip6);
|
||||
g_assert_cmpint (nm_setting_ip6_config_get_ip6_privacy (s_ip6), ==, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR);
|
||||
g_assert_cmpint (nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6)), ==, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR);
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
@ -3426,7 +3373,7 @@ test_write_enum_property (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWired *s_wired;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
char *uuid;
|
||||
gboolean success;
|
||||
NMConnection *reread;
|
||||
|
@ -3455,10 +3402,10 @@ test_write_enum_property (void)
|
|||
nm_connection_add_setting (connection, NM_SETTING (s_wired));
|
||||
|
||||
/* IP6 setting */
|
||||
s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ());
|
||||
s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP6_CONFIG_IP6_PRIVACY, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR,
|
||||
NULL);
|
||||
|
||||
|
|
|
@ -578,25 +578,25 @@ static KeyWriter key_writers[] = {
|
|||
NM_SETTING_CONNECTION_TYPE,
|
||||
setting_alias_writer },
|
||||
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_ADDRESSES,
|
||||
NM_SETTING_IP_CONFIG_ADDRESSES,
|
||||
addr_writer },
|
||||
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
"address-labels",
|
||||
ip4_addr_label_writer },
|
||||
{ NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_ADDRESSES,
|
||||
NM_SETTING_IP_CONFIG_ADDRESSES,
|
||||
addr_writer },
|
||||
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_ROUTES,
|
||||
NM_SETTING_IP_CONFIG_ROUTES,
|
||||
route_writer },
|
||||
{ NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_ROUTES,
|
||||
NM_SETTING_IP_CONFIG_ROUTES,
|
||||
route_writer },
|
||||
{ NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_DNS,
|
||||
NM_SETTING_IP_CONFIG_DNS,
|
||||
dns_writer },
|
||||
{ NM_SETTING_IP6_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_DNS,
|
||||
NM_SETTING_IP_CONFIG_DNS,
|
||||
dns_writer },
|
||||
{ NM_SETTING_WIRELESS_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SSID,
|
||||
|
|
|
@ -108,7 +108,7 @@ test_wifi_open (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWireless *s_wifi;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSupplicantConfig *config;
|
||||
GHashTable *hash;
|
||||
char *uuid;
|
||||
|
@ -149,10 +149,10 @@ test_wifi_open (void)
|
|||
g_bytes_unref (ssid);
|
||||
|
||||
/* IP4 setting */
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
|
||||
ASSERT (nm_connection_verify (connection, &error) == TRUE,
|
||||
"wifi-open", "failed to verify connection: %s",
|
||||
|
@ -203,7 +203,7 @@ test_wifi_wep_key (const char *detail,
|
|||
NMSettingConnection *s_con;
|
||||
NMSettingWireless *s_wifi;
|
||||
NMSettingWirelessSecurity *s_wsec;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSupplicantConfig *config;
|
||||
GHashTable *hash;
|
||||
char *uuid;
|
||||
|
@ -254,10 +254,10 @@ test_wifi_wep_key (const char *detail,
|
|||
nm_setting_wireless_security_set_wep_key (s_wsec, 0, key_data);
|
||||
|
||||
/* IP4 setting */
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
|
||||
ASSERT (nm_connection_verify (connection, &error) == TRUE,
|
||||
detail, "failed to verify connection: %s",
|
||||
|
@ -340,7 +340,7 @@ test_wifi_wpa_psk (const char *detail,
|
|||
NMSettingConnection *s_con;
|
||||
NMSettingWireless *s_wifi;
|
||||
NMSettingWirelessSecurity *s_wsec;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSupplicantConfig *config;
|
||||
GHashTable *hash;
|
||||
char *uuid;
|
||||
|
@ -397,10 +397,10 @@ test_wifi_wpa_psk (const char *detail,
|
|||
nm_setting_wireless_security_add_group (s_wsec, "ccmp");
|
||||
|
||||
/* IP4 setting */
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
|
||||
|
||||
ASSERT (nm_connection_verify (connection, &error) == TRUE,
|
||||
detail, "failed to verify connection: %s",
|
||||
|
|
|
@ -288,8 +288,7 @@ _match_connection_new (void)
|
|||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWired *s_wired;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4, *s_ip6;
|
||||
char *uuid;
|
||||
|
||||
connection = nm_simple_connection_new ();
|
||||
|
@ -308,16 +307,16 @@ _match_connection_new (void)
|
|||
s_wired = (NMSettingWired *) nm_setting_wired_new ();
|
||||
nm_connection_add_setting (connection, (NMSetting *) s_wired);
|
||||
|
||||
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
nm_connection_add_setting (connection, (NMSetting *) s_ip4);
|
||||
g_object_set (G_OBJECT (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
|
||||
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
|
||||
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
|
||||
nm_connection_add_setting (connection, (NMSetting *) s_ip6);
|
||||
g_object_set (G_OBJECT (s_ip6),
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
|
||||
return connection;
|
||||
|
@ -328,7 +327,7 @@ test_connection_match_basic (void)
|
|||
{
|
||||
NMConnection *orig, *copy, *matched;
|
||||
GSList *connections = NULL;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
|
||||
orig = _match_connection_new ();
|
||||
copy = nm_simple_connection_new_clone (orig);
|
||||
|
@ -341,7 +340,7 @@ test_connection_match_basic (void)
|
|||
s_ip4 = nm_connection_get_setting_ip4_config (orig);
|
||||
g_assert (s_ip4);
|
||||
g_object_set (G_OBJECT (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
|
||||
NULL);
|
||||
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
|
||||
g_assert (matched == NULL);
|
||||
|
@ -356,7 +355,7 @@ test_connection_match_ip6_method (void)
|
|||
{
|
||||
NMConnection *orig, *copy, *matched;
|
||||
GSList *connections = NULL;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
|
||||
orig = _match_connection_new ();
|
||||
copy = nm_simple_connection_new_clone (orig);
|
||||
|
@ -369,14 +368,14 @@ test_connection_match_ip6_method (void)
|
|||
s_ip6 = nm_connection_get_setting_ip6_config (orig);
|
||||
g_assert (s_ip6);
|
||||
g_object_set (G_OBJECT (s_ip6),
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
|
||||
NULL);
|
||||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (copy);
|
||||
g_assert (s_ip6);
|
||||
g_object_set (G_OBJECT (s_ip6),
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
|
||||
NULL);
|
||||
|
||||
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
|
||||
|
@ -392,7 +391,7 @@ test_connection_match_ip6_method_ignore (void)
|
|||
{
|
||||
NMConnection *orig, *copy, *matched;
|
||||
GSList *connections = NULL;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
|
||||
orig = _match_connection_new ();
|
||||
copy = nm_simple_connection_new_clone (orig);
|
||||
|
@ -404,13 +403,13 @@ test_connection_match_ip6_method_ignore (void)
|
|||
s_ip6 = nm_connection_get_setting_ip6_config (orig);
|
||||
g_assert (s_ip6);
|
||||
g_object_set (G_OBJECT (s_ip6),
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
|
||||
NULL);
|
||||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (copy);
|
||||
g_assert (s_ip6);
|
||||
g_object_set (G_OBJECT (s_ip6),
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
|
||||
NULL);
|
||||
|
||||
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
|
||||
|
@ -426,7 +425,7 @@ test_connection_match_ip6_method_ignore_auto (void)
|
|||
{
|
||||
NMConnection *orig, *copy, *matched;
|
||||
GSList *connections = NULL;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
|
||||
orig = _match_connection_new ();
|
||||
copy = nm_simple_connection_new_clone (orig);
|
||||
|
@ -438,13 +437,13 @@ test_connection_match_ip6_method_ignore_auto (void)
|
|||
s_ip6 = nm_connection_get_setting_ip6_config (orig);
|
||||
g_assert (s_ip6);
|
||||
g_object_set (G_OBJECT (s_ip6),
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NULL);
|
||||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (copy);
|
||||
g_assert (s_ip6);
|
||||
g_object_set (G_OBJECT (s_ip6),
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
|
||||
NULL);
|
||||
|
||||
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
|
||||
|
@ -461,7 +460,7 @@ test_connection_match_ip4_method (void)
|
|||
{
|
||||
NMConnection *orig, *copy, *matched;
|
||||
GSList *connections = NULL;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
|
||||
orig = _match_connection_new ();
|
||||
copy = nm_simple_connection_new_clone (orig);
|
||||
|
@ -474,14 +473,14 @@ test_connection_match_ip4_method (void)
|
|||
s_ip4 = nm_connection_get_setting_ip4_config (orig);
|
||||
g_assert (s_ip4);
|
||||
g_object_set (G_OBJECT (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
|
||||
NULL);
|
||||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (copy);
|
||||
g_assert (s_ip4);
|
||||
g_object_set (G_OBJECT (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
|
||||
NULL);
|
||||
|
||||
matched = nm_utils_match_connection (connections, orig, FALSE, NULL, NULL);
|
||||
|
@ -574,8 +573,7 @@ test_connection_no_match_ip4_addr (void)
|
|||
{
|
||||
NMConnection *orig, *copy, *matched;
|
||||
GSList *connections = NULL;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
NMSettingIPConfig *s_ip4, *s_ip6;
|
||||
NMIPAddress *nm_addr;
|
||||
GError *error = NULL;
|
||||
|
||||
|
@ -589,34 +587,34 @@ test_connection_no_match_ip4_addr (void)
|
|||
s_ip6 = nm_connection_get_setting_ip6_config (orig);
|
||||
g_assert (s_ip6);
|
||||
g_object_set (G_OBJECT (s_ip6),
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
|
||||
NULL);
|
||||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (copy);
|
||||
g_assert (s_ip6);
|
||||
g_object_set (G_OBJECT (s_ip6),
|
||||
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
|
||||
NULL);
|
||||
|
||||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (orig);
|
||||
g_assert (s_ip4);
|
||||
g_object_set (G_OBJECT (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NULL);
|
||||
nm_addr = nm_ip_address_new (AF_INET, "1.1.1.4", 24, "1.1.1.254", &error);
|
||||
g_assert_no_error (error);
|
||||
nm_setting_ip4_config_add_address (s_ip4, nm_addr);
|
||||
nm_setting_ip_config_add_address (s_ip4, nm_addr);
|
||||
nm_ip_address_unref (nm_addr);
|
||||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (copy);
|
||||
g_assert (s_ip4);
|
||||
g_object_set (G_OBJECT (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||
NULL);
|
||||
nm_addr = nm_ip_address_new (AF_INET, "2.2.2.4", 24, "2.2.2.254", &error);
|
||||
g_assert_no_error (error);
|
||||
nm_setting_ip4_config_add_address (s_ip4, nm_addr);
|
||||
nm_setting_ip_config_add_address (s_ip4, nm_addr);
|
||||
nm_ip_address_unref (nm_addr);
|
||||
|
||||
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-ip4-config.h"
|
||||
|
|
Loading…
Reference in a new issue