2007-09-20 Tambet Ingo <tambet@gmail.com>

* libnm-util/nm-setting.h: Change the type of
        * NMSettingVPN->routes to
        GSList.

        * libnm-util/nm-setting.c (setting_vpn_destroy): Free routes
        * too.

        * src/nm-manager.c (connection_get_settings_cb): No need to use
        * weakref,
        just use (g_object_set_data_full).

        * src/vpn-manager/nm-vpn-connection.c
        * (nm_vpn_connection_get_routes): Now
        that NMSettingVPN->routes is a GSList, convert it to char **.
        (nm_vpn_connection_ip4_config_get): Free routes when done.
        (nm_vpn_connection_activate): Ditto.

        * src/nm-device-802-11-wireless.c
        * (real_connection_secrets_updated)
        (real_act_stage2_config): Use defined setting names.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2832 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Tambet Ingo
2007-09-20 11:52:51 +00:00
parent 73792d12eb
commit 3f19c07885
6 changed files with 54 additions and 19 deletions

View File

@@ -1,3 +1,21 @@
2007-09-20 Tambet Ingo <tambet@gmail.com>
* libnm-util/nm-setting.h: Change the type of NMSettingVPN->routes to
GSList.
* libnm-util/nm-setting.c (setting_vpn_destroy): Free routes too.
* src/nm-manager.c (connection_get_settings_cb): No need to use weakref,
just use (g_object_set_data_full).
* src/vpn-manager/nm-vpn-connection.c (nm_vpn_connection_get_routes): Now
that NMSettingVPN->routes is a GSList, convert it to char **.
(nm_vpn_connection_ip4_config_get): Free routes when done.
(nm_vpn_connection_activate): Ditto.
* src/nm-device-802-11-wireless.c (real_connection_secrets_updated)
(real_act_stage2_config): Use defined setting names.
2007-09-20 Dan Williams <dcbw@redhat.com>
* src/nm-device-802-11-wireless.c

View File

@@ -1167,6 +1167,11 @@ setting_vpn_destroy (NMSetting *setting)
g_free (self->service_type);
if (self->routes) {
g_slist_foreach (self->routes, (GFunc) g_free, NULL);
g_slist_free (self->routes);
}
g_slice_free (NMSettingVPN, self);
}

View File

@@ -221,7 +221,7 @@ typedef struct {
NMSetting parent;
char *service_type;
char **routes;
GSList *routes;
} NMSettingVPN;
NMSetting *nm_setting_vpn_new (void);

View File

@@ -2427,7 +2427,7 @@ real_connection_secrets_updated (NMDevice *dev,
if (nm_device_get_state (dev) != NM_DEVICE_STATE_NEED_AUTH)
return;
if (strcmp (setting_name, "802-11-wireless-security") != 0) {
if (strcmp (setting_name, NM_SETTING_WIRELESS_SECURITY) != 0) {
nm_warning ("Ignoring updated secrets for setting '%s'.", setting_name);
return;
}
@@ -2465,7 +2465,7 @@ real_act_stage2_config (NMDevice *dev)
connection = nm_act_request_get_connection (req);
g_assert (connection);
s_connection = (NMSettingConnection *) nm_connection_get_setting (connection, "connection");
s_connection = (NMSettingConnection *) nm_connection_get_setting (connection, NM_SETTING_CONNECTION);
g_assert (s_connection);
/* If we need secrets, get them */

View File

@@ -244,14 +244,6 @@ free_get_settings_info (gpointer data)
g_slice_free (GetSettingsInfo, data);
}
static void
destroy_connection_proxy (gpointer data, GObject *object)
{
DBusGProxy *proxy = DBUS_G_PROXY (data);
g_object_unref (proxy);
}
static void
connection_get_settings_cb (DBusGProxy *proxy,
DBusGProxyCall *call_id,
@@ -284,8 +276,8 @@ connection_get_settings_cb (DBusGProxy *proxy,
if (connection == NULL)
goto out;
g_object_set_data (G_OBJECT (connection), CONNECTION_PROXY_TAG, proxy);
g_object_weak_ref (G_OBJECT (connection), destroy_connection_proxy, proxy);
g_object_set_data_full (G_OBJECT (connection), CONNECTION_PROXY_TAG, proxy,
(GDestroyNotify) g_object_unref);
priv = NM_MANAGER_GET_PRIVATE (manager);
if (strcmp (bus_name, NM_DBUS_SERVICE_USER_SETTINGS) == 0) {

View File

@@ -138,9 +138,21 @@ nm_vpn_connection_get_routes (NMVPNConnection *connection)
{
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
NMSettingVPN *setting;
char **routes;
int i;
GSList *iter;
setting = (NMSettingVPN *) nm_connection_get_setting (priv->connection, NM_SETTING_VPN);
return setting->routes;
routes = g_new (gchar*, g_slist_length (setting->routes) + 1);
i = 0;
for (iter = setting->routes; iter; iter = iter->next)
routes[i++] = g_strdup (iter->data);
routes[i] = NULL;
return routes;
}
static GHashTable *
@@ -226,6 +238,7 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
NMIP4Config *config;
GValue *val;
const char *banner = NULL;
char **routes;
int i;
nm_info ("VPN connection '%s' (IP Config Get) reply received.",
@@ -297,10 +310,9 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
priv->ip4_config = config;
if (nm_system_vpn_device_set_from_ip4_config (priv->parent_dev,
priv->tundev,
priv->ip4_config,
nm_vpn_connection_get_routes (connection))) {
routes = nm_vpn_connection_get_routes (connection);
if (nm_system_vpn_device_set_from_ip4_config (priv->parent_dev, priv->tundev, priv->ip4_config, routes)) {
nm_info ("VPN connection '%s' (IP Config Get) complete.",
nm_vpn_connection_get_name (connection));
nm_vpn_connection_set_state (connection, NM_VPN_CONNECTION_STATE_ACTIVATED);
@@ -309,6 +321,9 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
nm_vpn_connection_get_name (connection));
nm_vpn_connection_set_state (connection, NM_VPN_CONNECTION_STATE_FAILED);
}
if (routes)
g_strfreev (routes);
}
static gboolean
@@ -358,6 +373,7 @@ nm_vpn_connection_activate (NMVPNConnection *connection)
{
NMVPNConnectionPrivate *priv;
NMDBusManager *dbus_mgr;
char **routes;
g_return_if_fail (NM_IS_VPN_CONNECTION (connection));
g_return_if_fail (nm_vpn_connection_get_state (connection) == NM_VPN_CONNECTION_STATE_PREPARE);
@@ -387,12 +403,16 @@ nm_vpn_connection_activate (NMVPNConnection *connection)
G_CALLBACK (nm_vpn_connection_ip4_config_get),
connection, NULL);
routes = nm_vpn_connection_get_routes (connection);
org_freedesktop_NetworkManager_VPN_Plugin_connect_async (priv->proxy,
nm_vpn_connection_get_vpn_data (connection),
nm_vpn_connection_get_routes (connection),
routes,
nm_vpn_connection_connect_cb,
connection);
if (routes)
g_strfreev (routes);
nm_vpn_connection_set_state (connection, NM_VPN_CONNECTION_STATE_CONNECT);
}