Commit 7b55ca0d authored by Dan Williams's avatar Dan Williams

2008-07-27 Dan Williams <dcbw@redhat.com>

	* libnm-util/nm-setting-ip6-config.c
		- (set_property): add missing break that caused routes to be overwritten
			with addresses

	* libnm-util/nm-setting-ip6-config.c
		- (verify): validate routes and return GError everywhere on invalid setting
		- (finalize): don't leak routes
		- (set_property): add missing break that caused routes to be overwritten
			with addresses



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3865 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 6e45c715
2008-07-27 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-ip6-config.c
- (set_property): add missing break that caused routes to be overwritten
with addresses
* libnm-util/nm-setting-ip6-config.c
- (verify): validate routes and return GError everywhere on invalid setting
- (finalize): don't leak routes
- (set_property): add missing break that caused routes to be overwritten
with addresses
2008-07-27 Dan Williams <dcbw@redhat.com>
* libnm-util/*
......
......@@ -148,12 +148,18 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
}
if (self->dhcp_client_id && !strlen (self->dhcp_client_id)) {
g_warning ("invalid DHCP client ID");
g_set_error (error,
NM_SETTING_IP4_CONFIG_ERROR,
NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID);
return FALSE;
}
if (self->dhcp_hostname && !strlen (self->dhcp_hostname)) {
g_warning ("invalid DHCP client ID");
g_set_error (error,
NM_SETTING_IP4_CONFIG_ERROR,
NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME);
return FALSE;
}
......@@ -162,13 +168,39 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
NMSettingIP4Address *addr = (NMSettingIP4Address *) iter->data;
if (!addr->address) {
g_warning ("invalid IP4 address #%d", i);
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++) {
NMSettingIP4Address *addr = (NMSettingIP4Address *) iter->data;
if (!addr->address) {
g_set_error (error,
NM_SETTING_IP4_CONFIG_ERROR,
NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
NM_SETTING_IP4_CONFIG_ROUTES);
return FALSE;
}
if (!addr->prefix || addr->prefix > 32) {
g_warning ("invalid IP4 address prefix %d for address #%d",
addr->prefix, i);
g_set_error (error,
NM_SETTING_IP4_CONFIG_ERROR,
NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
NM_SETTING_IP4_CONFIG_ROUTES);
return FALSE;
}
}
......@@ -195,6 +227,7 @@ finalize (GObject *object)
nm_utils_slist_free (self->dns_search, g_free);
nm_utils_slist_free (self->addresses, g_free);
nm_utils_slist_free (self->routes, g_free);
G_OBJECT_CLASS (nm_setting_ip4_config_parent_class)->finalize (object);
}
......@@ -222,6 +255,7 @@ set_property (GObject *object, guint prop_id,
case PROP_ADDRESSES:
nm_utils_slist_free (setting->addresses, g_free);
setting->addresses = nm_utils_ip4_addresses_from_gvalue (value);
break;
case PROP_ROUTES:
nm_utils_slist_free (setting->routes, g_free);
setting->routes = nm_utils_ip4_addresses_from_gvalue (value);
......
......@@ -204,6 +204,7 @@ set_property (GObject *object, guint prop_id,
case PROP_ADDRESSES:
nm_utils_slist_free (setting->addresses, g_free);
setting->addresses = nm_utils_ip6_addresses_from_gvalue (value);
break;
case PROP_ROUTES:
nm_utils_slist_free (setting->routes, g_free);
setting->routes = nm_utils_ip6_addresses_from_gvalue (value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment