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:
18
ChangeLog
18
ChangeLog
@@ -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>
|
2007-09-20 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* src/nm-device-802-11-wireless.c
|
* src/nm-device-802-11-wireless.c
|
||||||
|
@@ -1167,6 +1167,11 @@ setting_vpn_destroy (NMSetting *setting)
|
|||||||
|
|
||||||
g_free (self->service_type);
|
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);
|
g_slice_free (NMSettingVPN, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -221,7 +221,7 @@ typedef struct {
|
|||||||
NMSetting parent;
|
NMSetting parent;
|
||||||
|
|
||||||
char *service_type;
|
char *service_type;
|
||||||
char **routes;
|
GSList *routes;
|
||||||
} NMSettingVPN;
|
} NMSettingVPN;
|
||||||
|
|
||||||
NMSetting *nm_setting_vpn_new (void);
|
NMSetting *nm_setting_vpn_new (void);
|
||||||
|
@@ -2427,7 +2427,7 @@ real_connection_secrets_updated (NMDevice *dev,
|
|||||||
if (nm_device_get_state (dev) != NM_DEVICE_STATE_NEED_AUTH)
|
if (nm_device_get_state (dev) != NM_DEVICE_STATE_NEED_AUTH)
|
||||||
return;
|
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);
|
nm_warning ("Ignoring updated secrets for setting '%s'.", setting_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2465,7 +2465,7 @@ real_act_stage2_config (NMDevice *dev)
|
|||||||
connection = nm_act_request_get_connection (req);
|
connection = nm_act_request_get_connection (req);
|
||||||
g_assert (connection);
|
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);
|
g_assert (s_connection);
|
||||||
|
|
||||||
/* If we need secrets, get them */
|
/* If we need secrets, get them */
|
||||||
|
@@ -244,14 +244,6 @@ free_get_settings_info (gpointer data)
|
|||||||
g_slice_free (GetSettingsInfo, 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
|
static void
|
||||||
connection_get_settings_cb (DBusGProxy *proxy,
|
connection_get_settings_cb (DBusGProxy *proxy,
|
||||||
DBusGProxyCall *call_id,
|
DBusGProxyCall *call_id,
|
||||||
@@ -284,8 +276,8 @@ connection_get_settings_cb (DBusGProxy *proxy,
|
|||||||
if (connection == NULL)
|
if (connection == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
g_object_set_data (G_OBJECT (connection), CONNECTION_PROXY_TAG, proxy);
|
g_object_set_data_full (G_OBJECT (connection), CONNECTION_PROXY_TAG, proxy,
|
||||||
g_object_weak_ref (G_OBJECT (connection), destroy_connection_proxy, proxy);
|
(GDestroyNotify) g_object_unref);
|
||||||
|
|
||||||
priv = NM_MANAGER_GET_PRIVATE (manager);
|
priv = NM_MANAGER_GET_PRIVATE (manager);
|
||||||
if (strcmp (bus_name, NM_DBUS_SERVICE_USER_SETTINGS) == 0) {
|
if (strcmp (bus_name, NM_DBUS_SERVICE_USER_SETTINGS) == 0) {
|
||||||
|
@@ -138,9 +138,21 @@ nm_vpn_connection_get_routes (NMVPNConnection *connection)
|
|||||||
{
|
{
|
||||||
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
|
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
|
||||||
NMSettingVPN *setting;
|
NMSettingVPN *setting;
|
||||||
|
char **routes;
|
||||||
|
int i;
|
||||||
|
GSList *iter;
|
||||||
|
|
||||||
setting = (NMSettingVPN *) nm_connection_get_setting (priv->connection, NM_SETTING_VPN);
|
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 *
|
static GHashTable *
|
||||||
@@ -226,6 +238,7 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
|
|||||||
NMIP4Config *config;
|
NMIP4Config *config;
|
||||||
GValue *val;
|
GValue *val;
|
||||||
const char *banner = NULL;
|
const char *banner = NULL;
|
||||||
|
char **routes;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
nm_info ("VPN connection '%s' (IP Config Get) reply received.",
|
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 = NM_VPN_CONNECTION_GET_PRIVATE (connection);
|
||||||
priv->ip4_config = config;
|
priv->ip4_config = config;
|
||||||
|
|
||||||
if (nm_system_vpn_device_set_from_ip4_config (priv->parent_dev,
|
routes = nm_vpn_connection_get_routes (connection);
|
||||||
priv->tundev,
|
|
||||||
priv->ip4_config,
|
if (nm_system_vpn_device_set_from_ip4_config (priv->parent_dev, priv->tundev, priv->ip4_config, routes)) {
|
||||||
nm_vpn_connection_get_routes (connection))) {
|
|
||||||
nm_info ("VPN connection '%s' (IP Config Get) complete.",
|
nm_info ("VPN connection '%s' (IP Config Get) complete.",
|
||||||
nm_vpn_connection_get_name (connection));
|
nm_vpn_connection_get_name (connection));
|
||||||
nm_vpn_connection_set_state (connection, NM_VPN_CONNECTION_STATE_ACTIVATED);
|
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_get_name (connection));
|
||||||
nm_vpn_connection_set_state (connection, NM_VPN_CONNECTION_STATE_FAILED);
|
nm_vpn_connection_set_state (connection, NM_VPN_CONNECTION_STATE_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (routes)
|
||||||
|
g_strfreev (routes);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -358,6 +373,7 @@ nm_vpn_connection_activate (NMVPNConnection *connection)
|
|||||||
{
|
{
|
||||||
NMVPNConnectionPrivate *priv;
|
NMVPNConnectionPrivate *priv;
|
||||||
NMDBusManager *dbus_mgr;
|
NMDBusManager *dbus_mgr;
|
||||||
|
char **routes;
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_VPN_CONNECTION (connection));
|
g_return_if_fail (NM_IS_VPN_CONNECTION (connection));
|
||||||
g_return_if_fail (nm_vpn_connection_get_state (connection) == NM_VPN_CONNECTION_STATE_PREPARE);
|
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),
|
G_CALLBACK (nm_vpn_connection_ip4_config_get),
|
||||||
connection, NULL);
|
connection, NULL);
|
||||||
|
|
||||||
|
routes = nm_vpn_connection_get_routes (connection);
|
||||||
org_freedesktop_NetworkManager_VPN_Plugin_connect_async (priv->proxy,
|
org_freedesktop_NetworkManager_VPN_Plugin_connect_async (priv->proxy,
|
||||||
nm_vpn_connection_get_vpn_data (connection),
|
nm_vpn_connection_get_vpn_data (connection),
|
||||||
nm_vpn_connection_get_routes (connection),
|
routes,
|
||||||
nm_vpn_connection_connect_cb,
|
nm_vpn_connection_connect_cb,
|
||||||
connection);
|
connection);
|
||||||
|
|
||||||
|
if (routes)
|
||||||
|
g_strfreev (routes);
|
||||||
|
|
||||||
nm_vpn_connection_set_state (connection, NM_VPN_CONNECTION_STATE_CONNECT);
|
nm_vpn_connection_set_state (connection, NM_VPN_CONNECTION_STATE_CONNECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user