2008-07-03 16:22:17 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
2007-11-07 16:06:43 +00:00
|
|
|
|
2008-07-27 20:03:46 +00:00
|
|
|
/*
|
|
|
|
* Dan Williams <dcbw@redhat.com>
|
|
|
|
* Tambet Ingo <tambet@gmail.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* (C) Copyright 2007 - 2008 Red Hat, Inc.
|
|
|
|
* (C) Copyright 2007 - 2008 Novell, Inc.
|
|
|
|
*/
|
|
|
|
|
2008-03-13 03:11:02 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2007-11-07 16:06:43 +00:00
|
|
|
#include <dbus/dbus-glib.h>
|
|
|
|
#include "nm-setting-ip4-config.h"
|
|
|
|
#include "nm-param-spec-specialized.h"
|
|
|
|
#include "nm-utils.h"
|
2008-03-29 21:35:41 +00:00
|
|
|
#include "nm-dbus-glib-types.h"
|
2007-11-07 16:06:43 +00:00
|
|
|
|
2008-06-12 23:58:08 +00:00
|
|
|
GQuark
|
|
|
|
nm_setting_ip4_config_error_quark (void)
|
|
|
|
{
|
|
|
|
static GQuark quark;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (!quark))
|
|
|
|
quark = g_quark_from_static_string ("nm-setting-ip4-config-error-quark");
|
|
|
|
return quark;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This should really be standard. */
|
|
|
|
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
|
|
|
|
|
|
|
|
GType
|
|
|
|
nm_setting_ip4_config_error_get_type (void)
|
|
|
|
{
|
|
|
|
static GType etype = 0;
|
|
|
|
|
|
|
|
if (etype == 0) {
|
|
|
|
static const GEnumValue values[] = {
|
|
|
|
/* Unknown error. */
|
|
|
|
ENUM_ENTRY (NM_SETTING_IP4_CONFIG_ERROR_UNKNOWN, "UnknownError"),
|
|
|
|
/* The specified property was invalid. */
|
|
|
|
ENUM_ENTRY (NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY, "InvalidProperty"),
|
|
|
|
/* The specified property was missing and is required. */
|
|
|
|
ENUM_ENTRY (NM_SETTING_IP4_CONFIG_ERROR_MISSING_PROPERTY, "MissingProperty"),
|
|
|
|
/* The specified property was not allowed in combination with the current 'method' */
|
|
|
|
ENUM_ENTRY (NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD, "NotAllowedForMethod"),
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
etype = g_enum_register_static ("NMSettingIP4ConfigError", values);
|
|
|
|
}
|
|
|
|
return etype;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-07 16:06:43 +00:00
|
|
|
G_DEFINE_TYPE (NMSettingIP4Config, nm_setting_ip4_config, NM_TYPE_SETTING)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
PROP_0,
|
2008-03-13 03:11:02 +00:00
|
|
|
PROP_METHOD,
|
2007-11-07 16:06:43 +00:00
|
|
|
PROP_DNS,
|
|
|
|
PROP_DNS_SEARCH,
|
|
|
|
PROP_ADDRESSES,
|
2008-06-02 08:44:48 +00:00
|
|
|
PROP_ROUTES,
|
2008-08-06 22:23:48 +00:00
|
|
|
PROP_IGNORE_AUTO_ROUTES,
|
|
|
|
PROP_IGNORE_AUTO_DNS,
|
2008-07-03 16:22:17 +00:00
|
|
|
PROP_DHCP_CLIENT_ID,
|
|
|
|
PROP_DHCP_HOSTNAME,
|
2007-11-07 16:06:43 +00:00
|
|
|
|
|
|
|
LAST_PROP
|
|
|
|
};
|
|
|
|
|
|
|
|
NMSetting *
|
|
|
|
nm_setting_ip4_config_new (void)
|
|
|
|
{
|
|
|
|
return (NMSetting *) g_object_new (NM_TYPE_SETTING_IP4_CONFIG, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2008-06-12 23:58:08 +00:00
|
|
|
verify (NMSetting *setting, GSList *all_settings, GError **error)
|
2007-11-07 16:06:43 +00:00
|
|
|
{
|
|
|
|
NMSettingIP4Config *self = NM_SETTING_IP4_CONFIG (setting);
|
2008-07-07 18:57:37 +00:00
|
|
|
GSList *iter;
|
|
|
|
int i;
|
2007-11-07 16:06:43 +00:00
|
|
|
|
2008-06-12 23:58:08 +00:00
|
|
|
if (!self->method) {
|
|
|
|
g_set_error (error,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR_MISSING_PROPERTY,
|
|
|
|
NM_SETTING_IP4_CONFIG_METHOD);
|
2008-03-13 03:11:02 +00:00
|
|
|
return FALSE;
|
2008-06-12 23:58:08 +00:00
|
|
|
}
|
2008-03-13 03:11:02 +00:00
|
|
|
|
|
|
|
if (!strcmp (self->method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
|
2007-11-07 16:06:43 +00:00
|
|
|
if (!self->addresses) {
|
2008-06-12 23:58:08 +00:00
|
|
|
g_set_error (error,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR_MISSING_PROPERTY,
|
|
|
|
NM_SETTING_IP4_CONFIG_ADDRESSES);
|
2007-11-07 16:06:43 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2008-08-01 14:27:47 +00:00
|
|
|
} else if ( !strcmp (self->method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)
|
2008-05-29 20:53:01 +00:00
|
|
|
|| !strcmp (self->method, NM_SETTING_IP4_CONFIG_METHOD_SHARED)) {
|
2008-03-13 03:11:02 +00:00
|
|
|
if (self->dns && self->dns->len) {
|
2008-06-12 23:58:08 +00:00
|
|
|
g_set_error (error,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD,
|
|
|
|
NM_SETTING_IP4_CONFIG_DNS);
|
2008-03-13 03:11:02 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_slist_length (self->dns_search)) {
|
2008-06-12 23:58:08 +00:00
|
|
|
g_set_error (error,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD,
|
|
|
|
NM_SETTING_IP4_CONFIG_DNS_SEARCH);
|
2008-03-13 03:11:02 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_slist_length (self->addresses)) {
|
2008-06-12 23:58:08 +00:00
|
|
|
g_set_error (error,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD,
|
|
|
|
NM_SETTING_IP4_CONFIG_ADDRESSES);
|
2008-03-13 03:11:02 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2008-08-01 14:27:47 +00:00
|
|
|
} else if (!strcmp (self->method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
|
2008-03-13 03:11:02 +00:00
|
|
|
/* nothing to do */
|
|
|
|
} else {
|
2008-06-12 23:58:08 +00:00
|
|
|
g_set_error (error,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
|
|
|
|
NM_SETTING_IP4_CONFIG_METHOD);
|
2008-03-13 03:11:02 +00:00
|
|
|
return FALSE;
|
2007-11-07 16:06:43 +00:00
|
|
|
}
|
|
|
|
|
2008-07-03 16:22:17 +00:00
|
|
|
if (self->dhcp_client_id && !strlen (self->dhcp_client_id)) {
|
2008-07-27 21:24:55 +00:00
|
|
|
g_set_error (error,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
|
|
|
|
NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID);
|
2008-07-03 16:22:17 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (self->dhcp_hostname && !strlen (self->dhcp_hostname)) {
|
2008-07-27 21:24:55 +00:00
|
|
|
g_set_error (error,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
|
|
|
|
NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME);
|
2008-07-03 16:22:17 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-07-07 18:57:37 +00:00
|
|
|
/* Validate addresses */
|
|
|
|
for (iter = self->addresses, i = 0; iter; iter = g_slist_next (iter), i++) {
|
|
|
|
NMSettingIP4Address *addr = (NMSettingIP4Address *) iter->data;
|
|
|
|
|
|
|
|
if (!addr->address) {
|
2008-07-27 21:24:55 +00:00
|
|
|
g_set_error (error,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
|
|
|
|
NM_SETTING_IP4_CONFIG_ADDRESSES);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!addr->prefix || addr->prefix > 32) {
|
|
|
|
g_set_error (error,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
|
|
|
|
NM_SETTING_IP4_CONFIG_ADDRESSES);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Validate routes */
|
|
|
|
for (iter = self->routes, i = 0; iter; iter = g_slist_next (iter), i++) {
|
2008-08-06 22:23:48 +00:00
|
|
|
NMSettingIP4Route *route = (NMSettingIP4Route *) iter->data;
|
2008-07-27 21:24:55 +00:00
|
|
|
|
2008-08-06 22:23:48 +00:00
|
|
|
if (!route->address) {
|
2008-07-27 21:24:55 +00:00
|
|
|
g_set_error (error,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
|
|
|
|
NM_SETTING_IP4_CONFIG_ROUTES);
|
2008-07-07 18:57:37 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-08-06 22:23:48 +00:00
|
|
|
if (!route->prefix || route->prefix > 32) {
|
2008-07-27 21:24:55 +00:00
|
|
|
g_set_error (error,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR,
|
|
|
|
NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
|
|
|
|
NM_SETTING_IP4_CONFIG_ROUTES);
|
2008-07-07 18:57:37 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-07 16:06:43 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
nm_setting_ip4_config_init (NMSettingIP4Config *setting)
|
|
|
|
{
|
2008-10-27 17:36:18 +00:00
|
|
|
g_object_set (setting, NM_SETTING_NAME, NM_SETTING_IP4_CONFIG_SETTING_NAME, NULL);
|
2007-11-07 16:06:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
finalize (GObject *object)
|
|
|
|
{
|
|
|
|
NMSettingIP4Config *self = NM_SETTING_IP4_CONFIG (object);
|
|
|
|
|
2008-03-13 03:11:02 +00:00
|
|
|
g_free (self->method);
|
|
|
|
|
2007-11-07 16:06:43 +00:00
|
|
|
if (self->dns)
|
|
|
|
g_array_free (self->dns, TRUE);
|
|
|
|
|
|
|
|
nm_utils_slist_free (self->dns_search, g_free);
|
|
|
|
nm_utils_slist_free (self->addresses, g_free);
|
2008-07-27 21:24:55 +00:00
|
|
|
nm_utils_slist_free (self->routes, g_free);
|
2007-11-07 16:06:43 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (nm_setting_ip4_config_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_property (GObject *object, guint prop_id,
|
|
|
|
const GValue *value, GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
NMSettingIP4Config *setting = NM_SETTING_IP4_CONFIG (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2008-03-13 03:11:02 +00:00
|
|
|
case PROP_METHOD:
|
|
|
|
g_free (setting->method);
|
|
|
|
setting->method = g_value_dup_string (value);
|
2008-03-12 12:45:20 +00:00
|
|
|
break;
|
2007-11-07 16:06:43 +00:00
|
|
|
case PROP_DNS:
|
|
|
|
if (setting->dns)
|
|
|
|
g_array_free (setting->dns, TRUE);
|
|
|
|
setting->dns = g_value_dup_boxed (value);
|
|
|
|
break;
|
|
|
|
case PROP_DNS_SEARCH:
|
|
|
|
nm_utils_slist_free (setting->dns_search, g_free);
|
|
|
|
setting->dns_search = g_value_dup_boxed (value);
|
|
|
|
break;
|
|
|
|
case PROP_ADDRESSES:
|
|
|
|
nm_utils_slist_free (setting->addresses, g_free);
|
2008-05-06 Dan Williams <dcbw@redhat.com>
* src/dhcp-manager/nm-dhcp-manager.c
- (nm_dhcp_manager_get_ip4_config): clean up; update for changes to
NMIP4Config to support multiple IP addresses
* src/NetworkManagerUtils.c
- (nm_utils_merge_ip4_config): update for multiple IP addresses
* src/nm-ip4-config.c
src/nm-ip4-config.h
- Store a list of IPv4 address/netmask/gateway tuples
- (nm_ip4_config_get_gateway, nm_ip4_config_set_gateway,
nm_ip4_config_get_netmask, nm_ip4_config_set_netmask,
nm_ip4_config_get_broadcast, nm_ip4_config_set_broadcast,
nm_ip4_config_set_address): remove
- (nm_ip4_config_take_address, nm_ip4_config_add_address,
nm_ip4_config_replace_address, nm_ip4_config_get_num_addresses):
new functions; handle multiple IPv4 addresses
* src/nm-device.c
src/ppp-manager/nm-ppp-manager.c
src/vpn-manager/nm-vpn-connection.c
src/NetworkManagerPolicy.c
test/nm-tool.c
libnm-glib/libnm-glib-test.c
- update for changes to NMIP4Config for multiple IPv4 addresses
* src/NetworkManagerSystem.c
- (nm_system_device_set_ip4_route): don't add the route if any address
is on the same subnet as the destination
- (check_one_address): ignore the exact match, just match family and
interface index
- (add_ip4_addresses): add all IPv4 addresses in an NMIP4Config to
an interface
- (nm_system_device_set_from_ip4_config): use add_ip4_addresses()
- (nm_system_vpn_device_set_from_ip4_config): use add_ip4_addresses()
* introspection/nm-ip4-config.xml
- Remove 'address', 'gateway', 'netmask', and 'broadcast' properties
- Add 'addresses' property which is an array of (uuu) tuples of
address/netmask/gateway
* libnm-util/nm-setting-ip4-config.c
- (set_property): use ip-address <-> GValue converters from nm-utils.c
* libnm-glib/nm-ip4-config.c
libnm-glib/nm-ip4-config.h
- Handle D-Bus interface changes to support multiple IP addresses
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3637 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-05-06 21:53:22 +00:00
|
|
|
setting->addresses = nm_utils_ip4_addresses_from_gvalue (value);
|
2008-07-27 21:24:55 +00:00
|
|
|
break;
|
2008-06-02 08:44:48 +00:00
|
|
|
case PROP_ROUTES:
|
|
|
|
nm_utils_slist_free (setting->routes, g_free);
|
2008-08-06 22:23:48 +00:00
|
|
|
setting->routes = nm_utils_ip4_routes_from_gvalue (value);
|
2007-11-07 16:06:43 +00:00
|
|
|
break;
|
2008-08-06 22:23:48 +00:00
|
|
|
case PROP_IGNORE_AUTO_ROUTES:
|
|
|
|
setting->ignore_auto_routes = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_IGNORE_AUTO_DNS:
|
|
|
|
setting->ignore_auto_dns = g_value_get_boolean (value);
|
2008-05-23 07:35:43 +00:00
|
|
|
break;
|
2008-07-03 16:22:17 +00:00
|
|
|
case PROP_DHCP_CLIENT_ID:
|
|
|
|
g_free (setting->dhcp_client_id);
|
|
|
|
setting->dhcp_client_id = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
case PROP_DHCP_HOSTNAME:
|
|
|
|
g_free (setting->dhcp_hostname);
|
|
|
|
setting->dhcp_hostname = g_value_dup_string (value);
|
|
|
|
break;
|
2007-11-07 16:06:43 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
get_property (GObject *object, guint prop_id,
|
|
|
|
GValue *value, GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
NMSettingIP4Config *setting = NM_SETTING_IP4_CONFIG (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2008-03-13 03:11:02 +00:00
|
|
|
case PROP_METHOD:
|
|
|
|
g_value_set_string (value, setting->method);
|
2008-03-12 12:45:20 +00:00
|
|
|
break;
|
2007-11-07 16:06:43 +00:00
|
|
|
case PROP_DNS:
|
|
|
|
g_value_set_boxed (value, setting->dns);
|
|
|
|
break;
|
|
|
|
case PROP_DNS_SEARCH:
|
|
|
|
g_value_set_boxed (value, setting->dns_search);
|
|
|
|
break;
|
|
|
|
case PROP_ADDRESSES:
|
2008-05-06 Dan Williams <dcbw@redhat.com>
* src/dhcp-manager/nm-dhcp-manager.c
- (nm_dhcp_manager_get_ip4_config): clean up; update for changes to
NMIP4Config to support multiple IP addresses
* src/NetworkManagerUtils.c
- (nm_utils_merge_ip4_config): update for multiple IP addresses
* src/nm-ip4-config.c
src/nm-ip4-config.h
- Store a list of IPv4 address/netmask/gateway tuples
- (nm_ip4_config_get_gateway, nm_ip4_config_set_gateway,
nm_ip4_config_get_netmask, nm_ip4_config_set_netmask,
nm_ip4_config_get_broadcast, nm_ip4_config_set_broadcast,
nm_ip4_config_set_address): remove
- (nm_ip4_config_take_address, nm_ip4_config_add_address,
nm_ip4_config_replace_address, nm_ip4_config_get_num_addresses):
new functions; handle multiple IPv4 addresses
* src/nm-device.c
src/ppp-manager/nm-ppp-manager.c
src/vpn-manager/nm-vpn-connection.c
src/NetworkManagerPolicy.c
test/nm-tool.c
libnm-glib/libnm-glib-test.c
- update for changes to NMIP4Config for multiple IPv4 addresses
* src/NetworkManagerSystem.c
- (nm_system_device_set_ip4_route): don't add the route if any address
is on the same subnet as the destination
- (check_one_address): ignore the exact match, just match family and
interface index
- (add_ip4_addresses): add all IPv4 addresses in an NMIP4Config to
an interface
- (nm_system_device_set_from_ip4_config): use add_ip4_addresses()
- (nm_system_vpn_device_set_from_ip4_config): use add_ip4_addresses()
* introspection/nm-ip4-config.xml
- Remove 'address', 'gateway', 'netmask', and 'broadcast' properties
- Add 'addresses' property which is an array of (uuu) tuples of
address/netmask/gateway
* libnm-util/nm-setting-ip4-config.c
- (set_property): use ip-address <-> GValue converters from nm-utils.c
* libnm-glib/nm-ip4-config.c
libnm-glib/nm-ip4-config.h
- Handle D-Bus interface changes to support multiple IP addresses
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3637 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-05-06 21:53:22 +00:00
|
|
|
nm_utils_ip4_addresses_to_gvalue (setting->addresses, value);
|
2007-11-07 16:06:43 +00:00
|
|
|
break;
|
2008-06-02 08:44:48 +00:00
|
|
|
case PROP_ROUTES:
|
2008-08-06 22:23:48 +00:00
|
|
|
nm_utils_ip4_routes_to_gvalue (setting->routes, value);
|
|
|
|
break;
|
|
|
|
case PROP_IGNORE_AUTO_ROUTES:
|
|
|
|
g_value_set_boolean (value, setting->ignore_auto_routes);
|
2008-06-02 08:44:48 +00:00
|
|
|
break;
|
2008-08-06 22:23:48 +00:00
|
|
|
case PROP_IGNORE_AUTO_DNS:
|
|
|
|
g_value_set_boolean (value, setting->ignore_auto_dns);
|
2008-05-23 07:35:43 +00:00
|
|
|
break;
|
2008-07-03 16:22:17 +00:00
|
|
|
case PROP_DHCP_CLIENT_ID:
|
|
|
|
g_value_set_string (value, setting->dhcp_client_id);
|
|
|
|
break;
|
|
|
|
case PROP_DHCP_HOSTNAME:
|
|
|
|
g_value_set_string (value, setting->dhcp_hostname);
|
|
|
|
break;
|
2007-11-07 16:06:43 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
|
|
|
|
NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
|
|
|
|
|
|
|
|
/* virtual methods */
|
|
|
|
object_class->set_property = set_property;
|
|
|
|
object_class->get_property = get_property;
|
|
|
|
object_class->finalize = finalize;
|
|
|
|
parent_class->verify = verify;
|
|
|
|
|
|
|
|
/* Properties */
|
|
|
|
g_object_class_install_property
|
2008-03-13 03:11:02 +00:00
|
|
|
(object_class, PROP_METHOD,
|
|
|
|
g_param_spec_string (NM_SETTING_IP4_CONFIG_METHOD,
|
|
|
|
"Method",
|
|
|
|
"IP configuration method",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
2008-03-12 12:45:20 +00:00
|
|
|
|
2007-11-07 16:06:43 +00:00
|
|
|
g_object_class_install_property
|
|
|
|
(object_class, PROP_DNS,
|
2008-08-26 09:34:31 +00:00
|
|
|
_nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_DNS,
|
2007-11-07 16:06:43 +00:00
|
|
|
"DNS",
|
|
|
|
"List of DNS servers",
|
|
|
|
DBUS_TYPE_G_UINT_ARRAY,
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
(object_class, PROP_DNS_SEARCH,
|
2008-08-26 09:34:31 +00:00
|
|
|
_nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_DNS_SEARCH,
|
2007-11-07 16:06:43 +00:00
|
|
|
"DNS search",
|
|
|
|
"List of DNS search domains",
|
2008-03-29 21:35:41 +00:00
|
|
|
DBUS_TYPE_G_LIST_OF_STRING,
|
2007-11-07 16:06:43 +00:00
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
(object_class, PROP_ADDRESSES,
|
2008-08-26 09:34:31 +00:00
|
|
|
_nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_ADDRESSES,
|
2007-11-07 16:06:43 +00:00
|
|
|
"Addresses",
|
|
|
|
"List of NMSettingIP4Addresses",
|
2008-03-29 21:35:41 +00:00
|
|
|
DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT,
|
2007-11-07 16:06:43 +00:00
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
2008-05-23 07:35:43 +00:00
|
|
|
|
2008-06-02 08:44:48 +00:00
|
|
|
g_object_class_install_property
|
|
|
|
(object_class, PROP_ROUTES,
|
2008-08-26 09:34:31 +00:00
|
|
|
_nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_ROUTES,
|
2008-06-02 08:44:48 +00:00
|
|
|
"Routes",
|
2008-08-06 22:23:48 +00:00
|
|
|
"List of NMSettingIP4Routes",
|
2008-06-02 08:44:48 +00:00
|
|
|
DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT,
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
|
|
|
|
2008-05-23 07:35:43 +00:00
|
|
|
g_object_class_install_property
|
2008-08-06 22:23:48 +00:00
|
|
|
(object_class, PROP_IGNORE_AUTO_ROUTES,
|
|
|
|
g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES,
|
|
|
|
"Ignore automatic routes",
|
|
|
|
"Ignore automatic routes",
|
|
|
|
FALSE,
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
(object_class, PROP_IGNORE_AUTO_DNS,
|
|
|
|
g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS,
|
|
|
|
"Ignore automatic DNS",
|
|
|
|
"Ignore automatic DNS",
|
2008-05-23 07:35:43 +00:00
|
|
|
FALSE,
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
2008-07-03 16:22:17 +00:00
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
(object_class, PROP_DHCP_CLIENT_ID,
|
|
|
|
g_param_spec_string (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID,
|
|
|
|
"DHCP Client ID",
|
|
|
|
"DHCP Client ID",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
(object_class, PROP_DHCP_HOSTNAME,
|
|
|
|
g_param_spec_string (NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME,
|
|
|
|
"DHCP Hostname",
|
|
|
|
"DHCP Hostname",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
2007-11-07 16:06:43 +00:00
|
|
|
}
|
2008-07-03 16:22:17 +00:00
|
|
|
|