2008-11-03 04:13:42 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
2005-05-03 Dan Williams <dcbw@redhat.com>
* Kill dhcpcd. We now use "dhcdbd", a dbus daemon that controls dhclient.
This means that NetworkManager shouldn't have DHCP issues anymore. It also
means you need dhcdbd, which you can get here (get the latest one):
http://people.redhat.com/jvdias/dhcdbd/
Technically NetworkManager can use any DHCP daemon that uses the same DBUS
interface as dhcdbd.
* Rewrite device activation to facilitate the new DHCP infrastructure and
future improvements. Its now "activation request" based, ie there is a single
activation request composed of the device, access point, and other info which
follows the entire activation process. There are 5 stages of the activation
process which correspond to:
1) Device preparation
2) Device configuration (bring it up, set ESSID/Key/etc)
3) IP Config Start (fire off DHCP if we're using it)
4) IP Config Get (grab config from DHCP or static config files)
5) IP Config Commit (set device's IP address, DNS, etc)
Note that there is no longer a "scanning" step, since the access point must
be known _before_ activation starts. If the access point drops out or does
not exist for some reason, the entire activation process fails and must be
restarted for a different access point or device.
Patch from Bill Moss:
* gnome/applet/applet.c
- Fix type of vpn_failure dialog -> vpn_banner dialog
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@597 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-03 20:41:36 +00:00
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
|
*
|
2008-06-26 18:31:52 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2005-05-03 Dan Williams <dcbw@redhat.com>
* Kill dhcpcd. We now use "dhcdbd", a dbus daemon that controls dhclient.
This means that NetworkManager shouldn't have DHCP issues anymore. It also
means you need dhcdbd, which you can get here (get the latest one):
http://people.redhat.com/jvdias/dhcdbd/
Technically NetworkManager can use any DHCP daemon that uses the same DBUS
interface as dhcdbd.
* Rewrite device activation to facilitate the new DHCP infrastructure and
future improvements. Its now "activation request" based, ie there is a single
activation request composed of the device, access point, and other info which
follows the entire activation process. There are 5 stages of the activation
process which correspond to:
1) Device preparation
2) Device configuration (bring it up, set ESSID/Key/etc)
3) IP Config Start (fire off DHCP if we're using it)
4) IP Config Get (grab config from DHCP or static config files)
5) IP Config Commit (set device's IP address, DNS, etc)
Note that there is no longer a "scanning" step, since the access point must
be known _before_ activation starts. If the access point drops out or does
not exist for some reason, the entire activation process fails and must be
restarted for a different access point or device.
Patch from Bill Moss:
* gnome/applet/applet.c
- Fix type of vpn_failure dialog -> vpn_banner dialog
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@597 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-03 20:41:36 +00:00
|
|
|
*
|
2012-02-03 14:53:09 -06:00
|
|
|
* Copyright (C) 2005 - 2012 Red Hat, Inc.
|
2008-11-03 04:13:42 +00:00
|
|
|
* Copyright (C) 2007 - 2008 Novell, Inc.
|
2005-05-03 Dan Williams <dcbw@redhat.com>
* Kill dhcpcd. We now use "dhcdbd", a dbus daemon that controls dhclient.
This means that NetworkManager shouldn't have DHCP issues anymore. It also
means you need dhcdbd, which you can get here (get the latest one):
http://people.redhat.com/jvdias/dhcdbd/
Technically NetworkManager can use any DHCP daemon that uses the same DBUS
interface as dhcdbd.
* Rewrite device activation to facilitate the new DHCP infrastructure and
future improvements. Its now "activation request" based, ie there is a single
activation request composed of the device, access point, and other info which
follows the entire activation process. There are 5 stages of the activation
process which correspond to:
1) Device preparation
2) Device configuration (bring it up, set ESSID/Key/etc)
3) IP Config Start (fire off DHCP if we're using it)
4) IP Config Get (grab config from DHCP or static config files)
5) IP Config Commit (set device's IP address, DNS, etc)
Note that there is no longer a "scanning" step, since the access point must
be known _before_ activation starts. If the access point drops out or does
not exist for some reason, the entire activation process fails and must be
restarted for a different access point or device.
Patch from Bill Moss:
* gnome/applet/applet.c
- Fix type of vpn_failure dialog -> vpn_banner dialog
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@597 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-03 20:41:36 +00:00
|
|
|
*/
|
|
|
|
|
|
2016-02-19 14:57:48 +01:00
|
|
|
#include "nm-default.h"
|
2011-03-14 01:00:56 -05:00
|
|
|
|
2016-09-28 19:37:10 +02:00
|
|
|
#include "nm-act-request.h"
|
2016-09-28 15:58:24 +02:00
|
|
|
|
2007-09-20 12:03:30 +00:00
|
|
|
#include <string.h>
|
2008-08-15 15:34:28 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
#include <unistd.h>
|
2008-03-17 19:37:23 +00:00
|
|
|
|
|
|
|
|
#include "nm-setting-wireless-security.h"
|
|
|
|
|
#include "nm-setting-8021x.h"
|
2016-11-21 00:43:52 +01:00
|
|
|
#include "devices/nm-device.h"
|
2008-03-26 13:43:01 +00:00
|
|
|
#include "nm-active-connection.h"
|
2016-11-21 00:43:52 +01:00
|
|
|
#include "settings/nm-settings-connection.h"
|
2014-07-17 17:06:44 -04:00
|
|
|
#include "nm-auth-subject.h"
|
2007-10-01 15:38:39 +00:00
|
|
|
|
2008-08-15 15:34:28 +00:00
|
|
|
typedef struct {
|
|
|
|
|
char *table;
|
|
|
|
|
char *rule;
|
|
|
|
|
} ShareRule;
|
2007-09-11 18:02:27 +00:00
|
|
|
|
2007-06-11 13:36:34 +00:00
|
|
|
typedef struct {
|
2012-08-22 09:38:01 -05:00
|
|
|
GSList *secrets_calls;
|
2008-06-10 02:02:21 +00:00
|
|
|
gboolean shared;
|
2008-08-15 15:34:28 +00:00
|
|
|
GSList *share_rules;
|
2007-06-11 13:36:34 +00:00
|
|
|
} NMActRequestPrivate;
|
2005-05-03 Dan Williams <dcbw@redhat.com>
* Kill dhcpcd. We now use "dhcdbd", a dbus daemon that controls dhclient.
This means that NetworkManager shouldn't have DHCP issues anymore. It also
means you need dhcdbd, which you can get here (get the latest one):
http://people.redhat.com/jvdias/dhcdbd/
Technically NetworkManager can use any DHCP daemon that uses the same DBUS
interface as dhcdbd.
* Rewrite device activation to facilitate the new DHCP infrastructure and
future improvements. Its now "activation request" based, ie there is a single
activation request composed of the device, access point, and other info which
follows the entire activation process. There are 5 stages of the activation
process which correspond to:
1) Device preparation
2) Device configuration (bring it up, set ESSID/Key/etc)
3) IP Config Start (fire off DHCP if we're using it)
4) IP Config Get (grab config from DHCP or static config files)
5) IP Config Commit (set device's IP address, DNS, etc)
Note that there is no longer a "scanning" step, since the access point must
be known _before_ activation starts. If the access point drops out or does
not exist for some reason, the entire activation process fails and must be
restarted for a different access point or device.
Patch from Bill Moss:
* gnome/applet/applet.c
- Fix type of vpn_failure dialog -> vpn_banner dialog
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@597 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-03 20:41:36 +00:00
|
|
|
|
2016-09-28 15:58:24 +02:00
|
|
|
struct _NMActRequest {
|
|
|
|
|
NMActiveConnection parent;
|
|
|
|
|
NMActRequestPrivate _priv;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
NMActiveConnectionClass parent;
|
|
|
|
|
} NMActRequestClass;
|
|
|
|
|
|
2013-12-18 08:46:43 -05:00
|
|
|
enum {
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_IP4_CONFIG,
|
|
|
|
|
PROP_DHCP4_CONFIG,
|
|
|
|
|
PROP_IP6_CONFIG,
|
|
|
|
|
PROP_DHCP6_CONFIG,
|
|
|
|
|
|
|
|
|
|
LAST_PROP
|
|
|
|
|
};
|
|
|
|
|
|
2016-09-28 15:58:24 +02:00
|
|
|
G_DEFINE_TYPE (NMActRequest, nm_act_request, NM_TYPE_ACTIVE_CONNECTION)
|
|
|
|
|
|
|
|
|
|
#define NM_ACT_REQUEST_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMActRequest, NM_IS_ACT_REQUEST)
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2012-08-22 09:38:01 -05:00
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
NMSettingsConnection *
|
|
|
|
|
nm_act_request_get_settings_connection (NMActRequest *req)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NULL);
|
|
|
|
|
|
|
|
|
|
return nm_active_connection_get_settings_connection (NM_ACTIVE_CONNECTION (req));
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 09:38:01 -05:00
|
|
|
NMConnection *
|
2015-07-14 16:53:24 +02:00
|
|
|
nm_act_request_get_applied_connection (NMActRequest *req)
|
2012-08-22 09:38:01 -05:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NULL);
|
|
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
return nm_active_connection_get_applied_connection (NM_ACTIVE_CONNECTION (req));
|
2012-08-22 09:38:01 -05:00
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2010-12-13 13:11:51 -06:00
|
|
|
|
settings: refactor call_id type of async functions for NMAgentManager, NMSettingsConnection and NMActRequest
Instead of having the call_id of type guint32, make it an (opaque)
pointer type.
This has the advantage of strong typing and avoids the possiblity
of reusing an invalid integer (or overflow of the call-id counter).
OTOH, it has the disadvantage, that after a call_id is disposed,
it might be reused for future invocations (because malloc might
reuse the memory).
In fact, it is always an error to use a call_id that is already
completed. This commit also adds assertions to the cancel() calls
that the provided call_id is a pending call. Hence, such a bug
will be uncovered by assertions (that only might not tigger in
certain unlikely cases where a call-id got reused).
Note that for NMAgentManager, save_secrets() and delete_secrets()
both returned a call_id. But they didn't also provide a callback when
the operation completes. So the user trying to cancel such a call,
cannot know whether the operation is still in process and he cannot
avoid triggering an assertion.
Fix that by not returning a call-id for these operations. No caller
cared about it anyway.
For NMSettingsConnection, also track the internally scheduled requests
for so that we can cancel them on dispose.
2015-09-02 22:43:04 +02:00
|
|
|
struct _NMActRequestGetSecretsCallId {
|
2011-01-27 10:41:02 -06:00
|
|
|
NMActRequest *self;
|
|
|
|
|
NMActRequestSecretsFunc callback;
|
|
|
|
|
gpointer callback_data;
|
2015-07-14 16:53:24 +02:00
|
|
|
NMSettingsConnectionCallId call_id;
|
2016-12-16 13:06:19 +01:00
|
|
|
bool has_ref;
|
settings: refactor call_id type of async functions for NMAgentManager, NMSettingsConnection and NMActRequest
Instead of having the call_id of type guint32, make it an (opaque)
pointer type.
This has the advantage of strong typing and avoids the possiblity
of reusing an invalid integer (or overflow of the call-id counter).
OTOH, it has the disadvantage, that after a call_id is disposed,
it might be reused for future invocations (because malloc might
reuse the memory).
In fact, it is always an error to use a call_id that is already
completed. This commit also adds assertions to the cancel() calls
that the provided call_id is a pending call. Hence, such a bug
will be uncovered by assertions (that only might not tigger in
certain unlikely cases where a call-id got reused).
Note that for NMAgentManager, save_secrets() and delete_secrets()
both returned a call_id. But they didn't also provide a callback when
the operation completes. So the user trying to cancel such a call,
cannot know whether the operation is still in process and he cannot
avoid triggering an assertion.
Fix that by not returning a call-id for these operations. No caller
cared about it anyway.
For NMSettingsConnection, also track the internally scheduled requests
for so that we can cancel them on dispose.
2015-09-02 22:43:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef struct _NMActRequestGetSecretsCallId GetSecretsInfo;
|
2011-01-27 10:41:02 -06:00
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
static GetSecretsInfo *
|
2016-12-16 13:06:19 +01:00
|
|
|
_get_secrets_info_new (NMActRequest *self, gboolean ref_self, NMActRequestSecretsFunc callback, gpointer callback_data)
|
2015-07-14 16:53:24 +02:00
|
|
|
{
|
|
|
|
|
GetSecretsInfo *info;
|
|
|
|
|
|
|
|
|
|
info = g_slice_new0 (GetSecretsInfo);
|
2016-12-16 13:06:19 +01:00
|
|
|
info->has_ref = ref_self;
|
|
|
|
|
info->self = ref_self ? g_object_ref (self) : self;
|
2015-07-14 16:53:24 +02:00
|
|
|
info->callback = callback;
|
|
|
|
|
info->callback_data = callback_data;
|
|
|
|
|
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
_get_secrets_info_free (GetSecretsInfo *info)
|
|
|
|
|
{
|
2016-12-16 13:06:19 +01:00
|
|
|
if (info->has_ref)
|
|
|
|
|
g_object_unref (info->self);
|
2015-07-14 16:53:24 +02:00
|
|
|
g_slice_free (GetSecretsInfo, info);
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-11 10:28:53 +00:00
|
|
|
static void
|
2011-01-27 10:41:02 -06:00
|
|
|
get_secrets_cb (NMSettingsConnection *connection,
|
settings: refactor call_id type of async functions for NMAgentManager, NMSettingsConnection and NMActRequest
Instead of having the call_id of type guint32, make it an (opaque)
pointer type.
This has the advantage of strong typing and avoids the possiblity
of reusing an invalid integer (or overflow of the call-id counter).
OTOH, it has the disadvantage, that after a call_id is disposed,
it might be reused for future invocations (because malloc might
reuse the memory).
In fact, it is always an error to use a call_id that is already
completed. This commit also adds assertions to the cancel() calls
that the provided call_id is a pending call. Hence, such a bug
will be uncovered by assertions (that only might not tigger in
certain unlikely cases where a call-id got reused).
Note that for NMAgentManager, save_secrets() and delete_secrets()
both returned a call_id. But they didn't also provide a callback when
the operation completes. So the user trying to cancel such a call,
cannot know whether the operation is still in process and he cannot
avoid triggering an assertion.
Fix that by not returning a call-id for these operations. No caller
cared about it anyway.
For NMSettingsConnection, also track the internally scheduled requests
for so that we can cancel them on dispose.
2015-09-02 22:43:04 +02:00
|
|
|
NMSettingsConnectionCallId call_id_s,
|
2011-03-31 18:39:09 -05:00
|
|
|
const char *agent_username,
|
2011-01-26 13:32:25 -06:00
|
|
|
const char *setting_name,
|
2010-12-13 13:11:51 -06:00
|
|
|
GError *error,
|
2011-01-27 10:41:02 -06:00
|
|
|
gpointer user_data)
|
2008-07-11 10:28:53 +00:00
|
|
|
{
|
2011-01-27 10:41:02 -06:00
|
|
|
GetSecretsInfo *info = user_data;
|
2015-07-14 16:53:24 +02:00
|
|
|
NMActRequestPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (info && info->call_id == call_id_s);
|
|
|
|
|
g_return_if_fail (NM_IS_ACT_REQUEST (info->self));
|
|
|
|
|
|
|
|
|
|
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
priv = NM_ACT_REQUEST_GET_PRIVATE (info->self);
|
2010-12-13 13:11:51 -06:00
|
|
|
|
2015-09-03 10:24:09 +02:00
|
|
|
g_return_if_fail (g_slist_find (priv->secrets_calls, info));
|
|
|
|
|
|
2011-01-27 10:41:02 -06:00
|
|
|
priv->secrets_calls = g_slist_remove (priv->secrets_calls, info);
|
2010-12-13 13:11:51 -06:00
|
|
|
|
2015-09-03 10:24:09 +02:00
|
|
|
if (info->callback)
|
2015-07-14 16:53:24 +02:00
|
|
|
info->callback (info->self, info, connection, error, info->callback_data);
|
|
|
|
|
|
|
|
|
|
_get_secrets_info_free (info);
|
2010-12-13 13:11:51 -06:00
|
|
|
}
|
|
|
|
|
|
2015-09-03 10:24:09 +02:00
|
|
|
/**
|
|
|
|
|
* nm_act_request_get_secrets:
|
|
|
|
|
* @self:
|
2016-12-16 13:06:19 +01:00
|
|
|
* @ref_self: if %TRUE, the pending call take a reference on @self.
|
|
|
|
|
* It also allows you to omit the @self argument in nm_act_request_cancel_secrets().
|
2015-09-03 10:24:09 +02:00
|
|
|
* @setting_name:
|
|
|
|
|
* @flags:
|
|
|
|
|
* @hint:
|
|
|
|
|
* @callback:
|
|
|
|
|
* @callback_data:
|
|
|
|
|
*
|
|
|
|
|
* Asnychronously starts the request for secrets. This function cannot
|
|
|
|
|
* fail.
|
|
|
|
|
*
|
|
|
|
|
* The return call-id can be used to cancel the request. You are
|
|
|
|
|
* only allowed to cancel a still pending operation (once).
|
|
|
|
|
* The callback will always be invoked once, even for canceling
|
|
|
|
|
* or disposing of NMActRequest.
|
|
|
|
|
*
|
|
|
|
|
* Returns: a call-id.
|
|
|
|
|
*/
|
settings: refactor call_id type of async functions for NMAgentManager, NMSettingsConnection and NMActRequest
Instead of having the call_id of type guint32, make it an (opaque)
pointer type.
This has the advantage of strong typing and avoids the possiblity
of reusing an invalid integer (or overflow of the call-id counter).
OTOH, it has the disadvantage, that after a call_id is disposed,
it might be reused for future invocations (because malloc might
reuse the memory).
In fact, it is always an error to use a call_id that is already
completed. This commit also adds assertions to the cancel() calls
that the provided call_id is a pending call. Hence, such a bug
will be uncovered by assertions (that only might not tigger in
certain unlikely cases where a call-id got reused).
Note that for NMAgentManager, save_secrets() and delete_secrets()
both returned a call_id. But they didn't also provide a callback when
the operation completes. So the user trying to cancel such a call,
cannot know whether the operation is still in process and he cannot
avoid triggering an assertion.
Fix that by not returning a call-id for these operations. No caller
cared about it anyway.
For NMSettingsConnection, also track the internally scheduled requests
for so that we can cancel them on dispose.
2015-09-02 22:43:04 +02:00
|
|
|
NMActRequestGetSecretsCallId
|
2011-01-26 18:36:08 -06:00
|
|
|
nm_act_request_get_secrets (NMActRequest *self,
|
2016-12-16 13:06:19 +01:00
|
|
|
gboolean ref_self,
|
2011-01-26 18:36:08 -06:00
|
|
|
const char *setting_name,
|
2014-07-07 10:11:46 -04:00
|
|
|
NMSecretAgentGetSecretsFlags flags,
|
2011-01-26 18:36:08 -06:00
|
|
|
const char *hint,
|
|
|
|
|
NMActRequestSecretsFunc callback,
|
|
|
|
|
gpointer callback_data)
|
|
|
|
|
{
|
2011-01-27 10:41:02 -06:00
|
|
|
NMActRequestPrivate *priv;
|
|
|
|
|
GetSecretsInfo *info;
|
settings: refactor call_id type of async functions for NMAgentManager, NMSettingsConnection and NMActRequest
Instead of having the call_id of type guint32, make it an (opaque)
pointer type.
This has the advantage of strong typing and avoids the possiblity
of reusing an invalid integer (or overflow of the call-id counter).
OTOH, it has the disadvantage, that after a call_id is disposed,
it might be reused for future invocations (because malloc might
reuse the memory).
In fact, it is always an error to use a call_id that is already
completed. This commit also adds assertions to the cancel() calls
that the provided call_id is a pending call. Hence, such a bug
will be uncovered by assertions (that only might not tigger in
certain unlikely cases where a call-id got reused).
Note that for NMAgentManager, save_secrets() and delete_secrets()
both returned a call_id. But they didn't also provide a callback when
the operation completes. So the user trying to cancel such a call,
cannot know whether the operation is still in process and he cannot
avoid triggering an assertion.
Fix that by not returning a call-id for these operations. No caller
cared about it anyway.
For NMSettingsConnection, also track the internally scheduled requests
for so that we can cancel them on dispose.
2015-09-02 22:43:04 +02:00
|
|
|
NMSettingsConnectionCallId call_id_s;
|
2015-07-14 16:53:24 +02:00
|
|
|
NMSettingsConnection *settings_connection;
|
|
|
|
|
NMConnection *applied_connection;
|
2013-06-19 17:51:09 -05:00
|
|
|
const char *hints[2] = { hint, NULL };
|
2011-01-26 18:36:08 -06:00
|
|
|
|
2016-12-16 12:50:05 +01:00
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (self), NULL);
|
2011-01-26 18:36:08 -06:00
|
|
|
|
2011-01-27 10:41:02 -06:00
|
|
|
priv = NM_ACT_REQUEST_GET_PRIVATE (self);
|
|
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
settings_connection = nm_act_request_get_settings_connection (self);
|
|
|
|
|
applied_connection = nm_act_request_get_applied_connection (self);
|
|
|
|
|
|
2016-12-16 13:06:19 +01:00
|
|
|
info = _get_secrets_info_new (self, ref_self, callback, callback_data);
|
2015-07-14 16:53:24 +02:00
|
|
|
|
|
|
|
|
priv->secrets_calls = g_slist_append (priv->secrets_calls, info);
|
2011-01-27 10:41:02 -06:00
|
|
|
|
2013-11-05 14:36:38 -05:00
|
|
|
if (nm_active_connection_get_user_requested (NM_ACTIVE_CONNECTION (self)))
|
2014-07-07 10:11:46 -04:00
|
|
|
flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED;
|
2012-06-27 09:42:47 -05:00
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
call_id_s = nm_settings_connection_get_secrets (settings_connection,
|
|
|
|
|
applied_connection,
|
settings: refactor call_id type of async functions for NMAgentManager, NMSettingsConnection and NMActRequest
Instead of having the call_id of type guint32, make it an (opaque)
pointer type.
This has the advantage of strong typing and avoids the possiblity
of reusing an invalid integer (or overflow of the call-id counter).
OTOH, it has the disadvantage, that after a call_id is disposed,
it might be reused for future invocations (because malloc might
reuse the memory).
In fact, it is always an error to use a call_id that is already
completed. This commit also adds assertions to the cancel() calls
that the provided call_id is a pending call. Hence, such a bug
will be uncovered by assertions (that only might not tigger in
certain unlikely cases where a call-id got reused).
Note that for NMAgentManager, save_secrets() and delete_secrets()
both returned a call_id. But they didn't also provide a callback when
the operation completes. So the user trying to cancel such a call,
cannot know whether the operation is still in process and he cannot
avoid triggering an assertion.
Fix that by not returning a call-id for these operations. No caller
cared about it anyway.
For NMSettingsConnection, also track the internally scheduled requests
for so that we can cancel them on dispose.
2015-09-02 22:43:04 +02:00
|
|
|
nm_active_connection_get_subject (NM_ACTIVE_CONNECTION (self)),
|
|
|
|
|
setting_name,
|
|
|
|
|
flags,
|
|
|
|
|
hints,
|
|
|
|
|
get_secrets_cb,
|
2015-07-14 16:53:24 +02:00
|
|
|
info);
|
|
|
|
|
info->call_id = call_id_s;
|
|
|
|
|
g_return_val_if_fail (call_id_s, NULL);
|
settings: refactor call_id type of async functions for NMAgentManager, NMSettingsConnection and NMActRequest
Instead of having the call_id of type guint32, make it an (opaque)
pointer type.
This has the advantage of strong typing and avoids the possiblity
of reusing an invalid integer (or overflow of the call-id counter).
OTOH, it has the disadvantage, that after a call_id is disposed,
it might be reused for future invocations (because malloc might
reuse the memory).
In fact, it is always an error to use a call_id that is already
completed. This commit also adds assertions to the cancel() calls
that the provided call_id is a pending call. Hence, such a bug
will be uncovered by assertions (that only might not tigger in
certain unlikely cases where a call-id got reused).
Note that for NMAgentManager, save_secrets() and delete_secrets()
both returned a call_id. But they didn't also provide a callback when
the operation completes. So the user trying to cancel such a call,
cannot know whether the operation is still in process and he cannot
avoid triggering an assertion.
Fix that by not returning a call-id for these operations. No caller
cared about it anyway.
For NMSettingsConnection, also track the internally scheduled requests
for so that we can cancel them on dispose.
2015-09-02 22:43:04 +02:00
|
|
|
return info;
|
2011-01-26 18:36:08 -06:00
|
|
|
}
|
|
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
static void
|
|
|
|
|
_do_cancel_secrets (NMActRequest *self, GetSecretsInfo *info, gboolean is_disposing)
|
|
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
|
|
|
|
|
|
|
|
|
|
nm_assert (info && info->self == self);
|
|
|
|
|
nm_assert (g_slist_find (priv->secrets_calls, info));
|
|
|
|
|
|
|
|
|
|
priv->secrets_calls = g_slist_remove (priv->secrets_calls, info);
|
|
|
|
|
|
|
|
|
|
nm_settings_connection_cancel_secrets (nm_act_request_get_settings_connection (self), info->call_id);
|
|
|
|
|
|
|
|
|
|
if (info->callback) {
|
|
|
|
|
gs_free_error GError *error = NULL;
|
|
|
|
|
|
2015-09-24 13:14:14 +02:00
|
|
|
nm_utils_error_set_cancelled (&error, is_disposing, "NMActRequest");
|
2015-07-14 16:53:24 +02:00
|
|
|
info->callback (self, info, NULL, error, info->callback_data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_get_secrets_info_free (info);
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-16 13:06:19 +01:00
|
|
|
/**
|
|
|
|
|
* nm_act_request_cancel_secrets:
|
|
|
|
|
* @self: The #NMActRequest. Note that this argument can be %NULL if, and only if
|
|
|
|
|
* the call_id was created with @take_ref.
|
|
|
|
|
* @call_id:
|
|
|
|
|
*
|
|
|
|
|
* You are only allowed to cancel the call once, and only before the callback
|
|
|
|
|
* is already invoked. Note that cancelling causes the callback to be invoked
|
|
|
|
|
* synchronously.
|
|
|
|
|
*/
|
2010-12-13 13:11:51 -06:00
|
|
|
void
|
settings: refactor call_id type of async functions for NMAgentManager, NMSettingsConnection and NMActRequest
Instead of having the call_id of type guint32, make it an (opaque)
pointer type.
This has the advantage of strong typing and avoids the possiblity
of reusing an invalid integer (or overflow of the call-id counter).
OTOH, it has the disadvantage, that after a call_id is disposed,
it might be reused for future invocations (because malloc might
reuse the memory).
In fact, it is always an error to use a call_id that is already
completed. This commit also adds assertions to the cancel() calls
that the provided call_id is a pending call. Hence, such a bug
will be uncovered by assertions (that only might not tigger in
certain unlikely cases where a call-id got reused).
Note that for NMAgentManager, save_secrets() and delete_secrets()
both returned a call_id. But they didn't also provide a callback when
the operation completes. So the user trying to cancel such a call,
cannot know whether the operation is still in process and he cannot
avoid triggering an assertion.
Fix that by not returning a call-id for these operations. No caller
cared about it anyway.
For NMSettingsConnection, also track the internally scheduled requests
for so that we can cancel them on dispose.
2015-09-02 22:43:04 +02:00
|
|
|
nm_act_request_cancel_secrets (NMActRequest *self, NMActRequestGetSecretsCallId call_id)
|
2010-12-13 13:11:51 -06:00
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv;
|
|
|
|
|
|
settings: refactor call_id type of async functions for NMAgentManager, NMSettingsConnection and NMActRequest
Instead of having the call_id of type guint32, make it an (opaque)
pointer type.
This has the advantage of strong typing and avoids the possiblity
of reusing an invalid integer (or overflow of the call-id counter).
OTOH, it has the disadvantage, that after a call_id is disposed,
it might be reused for future invocations (because malloc might
reuse the memory).
In fact, it is always an error to use a call_id that is already
completed. This commit also adds assertions to the cancel() calls
that the provided call_id is a pending call. Hence, such a bug
will be uncovered by assertions (that only might not tigger in
certain unlikely cases where a call-id got reused).
Note that for NMAgentManager, save_secrets() and delete_secrets()
both returned a call_id. But they didn't also provide a callback when
the operation completes. So the user trying to cancel such a call,
cannot know whether the operation is still in process and he cannot
avoid triggering an assertion.
Fix that by not returning a call-id for these operations. No caller
cared about it anyway.
For NMSettingsConnection, also track the internally scheduled requests
for so that we can cancel them on dispose.
2015-09-02 22:43:04 +02:00
|
|
|
g_return_if_fail (call_id);
|
2010-12-13 13:11:51 -06:00
|
|
|
|
2016-12-16 13:06:19 +01:00
|
|
|
if (self) {
|
|
|
|
|
g_return_if_fail (NM_IS_ACT_REQUEST (self));
|
|
|
|
|
g_return_if_fail (self == call_id->self);
|
|
|
|
|
} else {
|
|
|
|
|
g_return_if_fail (call_id->has_ref);
|
|
|
|
|
g_return_if_fail (NM_IS_ACT_REQUEST (call_id->self));
|
|
|
|
|
self = call_id->self;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
priv = NM_ACT_REQUEST_GET_PRIVATE (self);
|
|
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
if (!g_slist_find (priv->secrets_calls, call_id))
|
2015-09-03 10:24:09 +02:00
|
|
|
g_return_if_reached ();
|
2011-01-27 10:41:02 -06:00
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
_do_cancel_secrets (self, call_id, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
nm_act_request_clear_secrets (NMActRequest *self)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (NM_IS_ACT_REQUEST (self));
|
|
|
|
|
|
|
|
|
|
nm_active_connection_clear_secrets ((NMActiveConnection *) self);
|
2008-07-11 10:28:53 +00:00
|
|
|
}
|
2008-03-20 19:56:12 +00:00
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2010-12-13 13:11:51 -06:00
|
|
|
|
2008-08-15 15:34:28 +00:00
|
|
|
static void
|
|
|
|
|
clear_share_rules (NMActRequest *req)
|
|
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req);
|
|
|
|
|
GSList *iter;
|
|
|
|
|
|
|
|
|
|
for (iter = priv->share_rules; iter; iter = g_slist_next (iter)) {
|
|
|
|
|
ShareRule *rule = (ShareRule *) iter->data;
|
|
|
|
|
|
|
|
|
|
g_free (rule->table);
|
|
|
|
|
g_free (rule->rule);
|
|
|
|
|
g_free (rule);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_slist_free (priv->share_rules);
|
|
|
|
|
priv->share_rules = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
void
|
|
|
|
|
nm_act_request_set_shared (NMActRequest *req, gboolean shared)
|
|
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req);
|
|
|
|
|
GSList *list, *iter;
|
2008-08-15 15:34:28 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
g_return_if_fail (NM_IS_ACT_REQUEST (req));
|
|
|
|
|
|
|
|
|
|
NM_ACT_REQUEST_GET_PRIVATE (req)->shared = shared;
|
|
|
|
|
|
|
|
|
|
/* Tear the rules down in reverse order when sharing is stopped */
|
|
|
|
|
list = g_slist_copy (priv->share_rules);
|
|
|
|
|
if (!shared)
|
|
|
|
|
list = g_slist_reverse (list);
|
|
|
|
|
|
|
|
|
|
/* Send the rules to iptables */
|
|
|
|
|
for (iter = list; iter; iter = g_slist_next (iter)) {
|
|
|
|
|
ShareRule *rule = (ShareRule *) iter->data;
|
|
|
|
|
char *envp[1] = { NULL };
|
2013-08-29 14:56:59 -04:00
|
|
|
gs_strfreev char **argv = NULL;
|
|
|
|
|
gs_free char *cmd = NULL;
|
2010-12-13 13:11:51 -06:00
|
|
|
|
|
|
|
|
cmd = g_strdup_printf ("%s --table %s %s %s",
|
|
|
|
|
IPTABLES_PATH,
|
|
|
|
|
rule->table,
|
|
|
|
|
shared ? "--insert" : "--delete",
|
|
|
|
|
rule->rule);
|
|
|
|
|
if (!cmd)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
argv = g_strsplit (cmd, " ", 0);
|
|
|
|
|
if (argv && argv[0]) {
|
|
|
|
|
int status;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
nm_log_info (LOGD_SHARING, "Executing: %s", cmd);
|
|
|
|
|
if (!g_spawn_sync ("/", argv, envp, G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
|
2015-01-12 15:43:56 -05:00
|
|
|
NULL, NULL, NULL, NULL, &status, &error)) {
|
2016-02-28 18:12:28 +01:00
|
|
|
nm_log_warn (LOGD_SHARING, "Error executing command: %s",
|
|
|
|
|
error->message);
|
2010-12-13 13:11:51 -06:00
|
|
|
g_clear_error (&error);
|
|
|
|
|
} else if (WEXITSTATUS (status)) {
|
|
|
|
|
nm_log_warn (LOGD_SHARING, "** Command returned exit status %d.",
|
|
|
|
|
WEXITSTATUS (status));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_slist_free (list);
|
|
|
|
|
|
|
|
|
|
/* Clear the share rule list when sharing is stopped */
|
|
|
|
|
if (!shared)
|
|
|
|
|
clear_share_rules (req);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
|
nm_act_request_get_shared (NMActRequest *req)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
|
|
|
|
|
|
|
|
|
|
return NM_ACT_REQUEST_GET_PRIVATE (req)->shared;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
nm_act_request_add_share_rule (NMActRequest *req,
|
|
|
|
|
const char *table,
|
|
|
|
|
const char *table_rule)
|
|
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req);
|
|
|
|
|
ShareRule *rule;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_ACT_REQUEST (req));
|
|
|
|
|
g_return_if_fail (table != NULL);
|
|
|
|
|
g_return_if_fail (table_rule != NULL);
|
|
|
|
|
|
|
|
|
|
rule = g_malloc0 (sizeof (ShareRule));
|
|
|
|
|
rule->table = g_strdup (table);
|
|
|
|
|
rule->rule = g_strdup (table_rule);
|
2016-01-21 16:39:55 +01:00
|
|
|
priv->share_rules = g_slist_prepend (priv->share_rules, rule);
|
2010-12-13 13:11:51 -06:00
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2010-12-13 13:11:51 -06:00
|
|
|
|
2013-12-18 08:46:43 -05:00
|
|
|
static void
|
|
|
|
|
device_notify (GObject *object,
|
|
|
|
|
GParamSpec *pspec,
|
|
|
|
|
gpointer self)
|
|
|
|
|
{
|
|
|
|
|
g_object_notify (self, pspec->name);
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
static void
|
2013-09-27 14:40:18 -05:00
|
|
|
device_state_changed (NMActiveConnection *active,
|
|
|
|
|
NMDevice *device,
|
|
|
|
|
NMDeviceState new_state,
|
|
|
|
|
NMDeviceState old_state)
|
2010-12-13 13:11:51 -06:00
|
|
|
{
|
2014-02-27 09:09:43 -06:00
|
|
|
NMActiveConnectionState cur_ac_state = nm_active_connection_get_state (active);
|
2012-08-22 16:59:11 -05:00
|
|
|
NMActiveConnectionState ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
|
2010-12-13 13:11:51 -06:00
|
|
|
|
2014-02-26 13:18:16 -06:00
|
|
|
/* Decide which device state changes to handle when this active connection
|
|
|
|
|
* is not the device's current request. Two cases here: (a) the AC is
|
|
|
|
|
* pending and not yet active, and (b) the AC was active but the device is
|
|
|
|
|
* entering DISCONNECTED state (which clears the device's current AC before
|
|
|
|
|
* emitting the state change signal).
|
2014-02-27 09:09:43 -06:00
|
|
|
*/
|
|
|
|
|
if (NM_ACTIVE_CONNECTION (nm_device_get_act_request (device)) != active) {
|
2014-02-26 13:18:16 -06:00
|
|
|
/* Some other request is activating; this one must be pending */
|
|
|
|
|
if (new_state >= NM_DEVICE_STATE_PREPARE)
|
2014-02-27 09:09:43 -06:00
|
|
|
return;
|
2014-02-26 13:18:16 -06:00
|
|
|
else if (new_state == NM_DEVICE_STATE_DISCONNECTED) {
|
|
|
|
|
/* This request hasn't started activating yet; the device is
|
|
|
|
|
* disconnecting and cleaning up a previous activation request.
|
|
|
|
|
*/
|
|
|
|
|
if (cur_ac_state < NM_ACTIVE_CONNECTION_STATE_ACTIVATING)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Catch device disconnections after this request has been active */
|
|
|
|
|
}
|
2014-02-27 09:09:43 -06:00
|
|
|
|
2014-02-26 13:18:16 -06:00
|
|
|
/* All states < DISCONNECTED are fatal and handled */
|
2014-02-27 09:09:43 -06:00
|
|
|
}
|
2014-02-19 13:09:17 -06:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
/* Set NMActiveConnection state based on the device's state */
|
2013-09-27 14:40:18 -05:00
|
|
|
switch (new_state) {
|
2010-12-13 13:11:51 -06:00
|
|
|
case NM_DEVICE_STATE_PREPARE:
|
|
|
|
|
case NM_DEVICE_STATE_CONFIG:
|
|
|
|
|
case NM_DEVICE_STATE_NEED_AUTH:
|
|
|
|
|
case NM_DEVICE_STATE_IP_CONFIG:
|
2011-03-17 12:42:38 -05:00
|
|
|
case NM_DEVICE_STATE_IP_CHECK:
|
|
|
|
|
case NM_DEVICE_STATE_SECONDARIES:
|
2012-08-22 16:59:11 -05:00
|
|
|
ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATING;
|
2010-12-13 13:11:51 -06:00
|
|
|
break;
|
|
|
|
|
case NM_DEVICE_STATE_ACTIVATED:
|
2012-08-22 16:59:11 -05:00
|
|
|
ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED;
|
2013-12-18 08:46:43 -05:00
|
|
|
|
|
|
|
|
g_signal_connect (device, "notify::" NM_DEVICE_IP4_CONFIG,
|
|
|
|
|
G_CALLBACK (device_notify), active);
|
|
|
|
|
g_signal_connect (device, "notify::" NM_DEVICE_DHCP4_CONFIG,
|
|
|
|
|
G_CALLBACK (device_notify), active);
|
|
|
|
|
g_signal_connect (device, "notify::" NM_DEVICE_IP6_CONFIG,
|
|
|
|
|
G_CALLBACK (device_notify), active);
|
|
|
|
|
g_signal_connect (device, "notify::" NM_DEVICE_DHCP6_CONFIG,
|
|
|
|
|
G_CALLBACK (device_notify), active);
|
2010-12-13 13:11:51 -06:00
|
|
|
break;
|
2011-03-17 14:23:21 -05:00
|
|
|
case NM_DEVICE_STATE_DEACTIVATING:
|
2012-08-22 16:59:11 -05:00
|
|
|
ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATING;
|
|
|
|
|
break;
|
|
|
|
|
case NM_DEVICE_STATE_FAILED:
|
|
|
|
|
case NM_DEVICE_STATE_DISCONNECTED:
|
2013-05-02 14:39:51 -05:00
|
|
|
case NM_DEVICE_STATE_UNMANAGED:
|
|
|
|
|
case NM_DEVICE_STATE_UNAVAILABLE:
|
2012-08-22 16:59:11 -05:00
|
|
|
ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATED;
|
2013-12-18 08:46:43 -05:00
|
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (device, G_CALLBACK (device_notify), active);
|
2011-03-17 14:23:21 -05:00
|
|
|
break;
|
2010-12-13 13:11:51 -06:00
|
|
|
default:
|
2012-08-22 16:59:11 -05:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( ac_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED
|
|
|
|
|
|| ac_state == NM_ACTIVE_CONNECTION_STATE_UNKNOWN) {
|
2013-09-27 14:40:18 -05:00
|
|
|
nm_active_connection_set_default (active, FALSE);
|
|
|
|
|
nm_active_connection_set_default6 (active, FALSE);
|
2010-12-13 13:11:51 -06:00
|
|
|
}
|
|
|
|
|
|
2013-09-27 14:40:18 -05:00
|
|
|
nm_active_connection_set_state (active, ac_state);
|
2010-12-13 13:11:51 -06:00
|
|
|
}
|
|
|
|
|
|
2013-08-28 09:08:43 -05:00
|
|
|
static void
|
|
|
|
|
master_failed (NMActiveConnection *self)
|
|
|
|
|
{
|
|
|
|
|
NMDevice *device;
|
|
|
|
|
NMDeviceState device_state;
|
|
|
|
|
|
|
|
|
|
/* If the connection has an active device, fail it */
|
|
|
|
|
device = nm_active_connection_get_device (self);
|
|
|
|
|
if (device) {
|
|
|
|
|
device_state = nm_device_get_state (device);
|
|
|
|
|
if (nm_device_is_activating (device) || (device_state == NM_DEVICE_STATE_ACTIVATED)) {
|
act-request: queue failing the slave when master fails
We might be already handling a state change:
Aug 17 05:26:34 dacan.local NetworkManager[618]: (devices/nm-device.c:10982):
_set_state_full: runtime check failed: (priv->in_state_changed == FALSE)
(gdb) bt
#0 0x00007fc218dad643 in g_logv (log_domain=0x7fc21c0db3c3 "NetworkManager", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7ffe6f0b30d0) at gmessages.c:1086
#1 0x00007fc218dad7bf in g_log (log_domain=log_domain@entry=0x7fc21c0db3c3 "NetworkManager", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x7fc218e1b70f "%s") at gmessages.c:1119
#2 0x00007fc218dadb16 in g_warn_message (domain=domain@entry=0x7fc21c0db3c3 "NetworkManager", file=file@entry=0x7fc21c0d6597 "devices/nm-device.c", line=line@entry=10982, func=func@entry=0x7fc21c0dabf0 <__FUNCTION__.42233> "_set_state_full", warnexpr=warnexpr@entry=0x7fc21c0d95a0 "priv->in_state_changed == FALSE") at gmessages.c:1152
#3 0x00007fc21bf79bd6 in _set_state_full (self=0x7fc21ccd88b0 [NMDeviceEthernet], state=NM_DEVICE_STATE_FAILED, reason=NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED, quitting=0) at devices/nm-device.c:10982
#7 0x00007fc2190bdd9f in <emit signal notify:master on instance 0x7fc21ccd88b0 [NMDeviceEthernet]> (instance=instance@entry=0x7fc21ccd88b0, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3439
#4 0x00007fc2190a3908 in g_closure_invoke (closure=0x7fc21cd009e0, return_value=return_value@entry=0x0, n_param_values=2, param_values=param_values@entry=0x7ffe6f0b34b0, invocation_hint=invocation_hint@entry=0x7ffe6f0b3450) at gclosure.c:801
#5 0x00007fc2190b5a1d in signal_emit_unlocked_R (node=node@entry=0x7fc21cb66500, detail=detail@entry=588, instance=instance@entry=0x7fc21ccd88b0, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7ffe6f0b34b0)
at gsignal.c:3627
#6 0x00007fc2190bdab1 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7ffe6f0b3640) at gsignal.c:3383
#8 0x00007fc2190a7fd4 in g_object_dispatch_properties_changed (object=0x7fc21ccd88b0 [NMDeviceEthernet], n_pspecs=<optimized out>, pspecs=<optimized out>) at gobject.c:1061
#9 0x00007fc2190aa619 in g_object_notify_by_pspec (pspec=<optimized out>, object=0x7fc21ccd88b0 [NMDeviceEthernet]) at gobject.c:1155
#10 0x00007fc2190aa619 in g_object_notify_by_pspec (object=object@entry=0x7fc21ccd88b0 [NMDeviceEthernet], pspec=<optimized out>) at gobject.c:1264
#11 0x00007fc21bf7de3f in nm_device_master_enslave_slave (prop=PROP_MASTER, obj=0x7fc21ccd88b0 [NMDeviceEthernet]) at devices/nm-device.c:103
#12 0x00007fc21bf7de3f in nm_device_master_enslave_slave (success=1, self=0x7fc21ccd88b0 [NMDeviceEthernet]) at devices/nm-device.c:2757
#13 0x00007fc21bf7de3f in nm_device_master_enslave_slave (self=0x7fc21cd42810 [NMDeviceBond], slave=0x7fc21ccd88b0 [NMDeviceEthernet], connection=<optimized out>) at devices/nm-device.c:1300
#14 0x00007fc2167c8dcc in ffi_call_unix64 () at ../src/x86/unix64.S:76
#15 0x00007fc2167c86f5 in ffi_call (cif=cif@entry=0x7ffe6f0b3a10, fn=<optimized out>, rvalue=0x7ffe6f0b3980, avalue=avalue@entry=0x7ffe6f0b3900) at ../src/x86/ffi64.c:522
#20 0x00007fc2190be2e8 in <emit signal 0x7fc21c0ea3d5 "state-changed" on instance 0x7fc21ccd88b0 [NMDeviceEthernet]> (instance=instance@entry=0x7fc21ccd88b0, detailed_signal=detailed_signal@entry=0x7fc21c0ea3d5 "state-changed") at gsignal.c:3479
#16 0x00007fc2190a4148 in g_cclosure_marshal_generic (closure=0x7fc21cc84de0, return_gvalue=0x0, n_param_values=<optimized out>, param_values=<optimized out>, invocation_hint=<optimized out>, marshal_data=0x0) at gclosure.c:1487
#17 0x00007fc2190a3908 in g_closure_invoke (closure=0x7fc21cc84de0, return_value=return_value@entry=0x0, n_param_values=4, param_values=param_values@entry=0x7ffe6f0b3c10, invocation_hint=invocation_hint@entry=0x7ffe6f0b3bb0) at gclosure.c:801
#18 0x00007fc2190b5a1d in signal_emit_unlocked_R (node=node@entry=0x7fc21cbeef20, detail=detail@entry=0, instance=instance@entry=0x7fc21ccd88b0, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7ffe6f0b3c10) at gsignal.c:3627
#19 0x00007fc2190bdab1 in g_signal_emit_valist (instance=instance@entry=0x7fc21ccd88b0, signal_id=signal_id@entry=112, detail=detail@entry=0, var_args=var_args@entry=0x7ffe6f0b3e48) at gsignal.c:3383
#21 0x00007fc21bf79e3d in _set_state_full (self=self@entry=0x7fc21ccd88b0 [NMDeviceEthernet], state=state@entry=NM_DEVICE_STATE_IP_CONFIG, reason=reason@entry=NM_DEVICE_STATE_REASON_NONE, quitting=quitting@entry=0) at devices/nm-device.c:11123
#22 0x00007fc21bf7a707 in nm_device_state_changed (self=self@entry=0x7fc21ccd88b0 [NMDeviceEthernet], state=state@entry=NM_DEVICE_STATE_IP_CONFIG, reason=reason@entry=NM_DEVICE_STATE_REASON_NONE) at devices/nm-device.c:11308
#23 0x00007fc21bf7e92f in activate_stage3_ip_config_start (self=0x7fc21ccd88b0 [NMDeviceEthernet]) at devices/nm-device.c:6759
#24 0x00007fc21bf68dac in activation_source_handle_cb (self=0x7fc21ccd88b0 [NMDeviceEthernet], family=family@entry=2) at devices/nm-device.c:3627
#25 0x00007fc21bf68e6e in activation_source_handle_cb4 (user_data=<optimized out>) at devices/nm-device.c:3564
#26 0x00007fc218da6d7a in g_main_context_dispatch (context=0x7fc21cb6e000) at gmain.c:3152
#27 0x00007fc218da6d7a in g_main_context_dispatch (context=context@entry=0x7fc21cb6e000) at gmain.c:3767
#28 0x00007fc218da70b8 in g_main_context_iterate (context=0x7fc21cb6e000, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3838
#29 0x00007fc218da738a in g_main_loop_run (loop=0x7fc21cb6c8c0) at gmain.c:4032
#30 0x00007fc21bf4a23e in main (argc=1, argv=0x7ffe6f0b43e8) at main.c:411
(gdb)
https://bugzilla.redhat.com/show_bug.cgi?id=1367702
2016-08-17 13:49:43 +02:00
|
|
|
nm_device_queue_state (device,
|
|
|
|
|
NM_DEVICE_STATE_FAILED,
|
|
|
|
|
NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED);
|
2013-08-28 09:08:43 -05:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If no device, or the device wasn't active, just move to deactivated state */
|
|
|
|
|
nm_active_connection_set_state (self, NM_ACTIVE_CONNECTION_STATE_DEACTIVATED);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2010-12-13 13:11:51 -06:00
|
|
|
|
2016-09-28 16:13:44 +02:00
|
|
|
static void
|
|
|
|
|
get_property (GObject *object, guint prop_id,
|
|
|
|
|
GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
2017-01-19 09:56:15 +01:00
|
|
|
NMActiveConnection *active;
|
2016-09-28 16:13:44 +02:00
|
|
|
NMDevice *device;
|
2017-01-19 09:56:15 +01:00
|
|
|
char *name;
|
2016-09-28 16:13:44 +02:00
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_IP4_CONFIG:
|
2017-01-19 09:56:15 +01:00
|
|
|
name = NM_DEVICE_IP4_CONFIG;
|
2016-09-28 16:13:44 +02:00
|
|
|
break;
|
|
|
|
|
case PROP_DHCP4_CONFIG:
|
2017-01-19 09:56:15 +01:00
|
|
|
name = NM_DEVICE_DHCP4_CONFIG;
|
2016-09-28 16:13:44 +02:00
|
|
|
break;
|
|
|
|
|
case PROP_IP6_CONFIG:
|
2017-01-19 09:56:15 +01:00
|
|
|
name = NM_DEVICE_IP6_CONFIG;
|
2016-09-28 16:13:44 +02:00
|
|
|
break;
|
|
|
|
|
case PROP_DHCP6_CONFIG:
|
2017-01-19 09:56:15 +01:00
|
|
|
name = NM_DEVICE_DHCP6_CONFIG;
|
2016-09-28 16:13:44 +02:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2017-01-19 09:56:15 +01:00
|
|
|
return;
|
2016-09-28 16:13:44 +02:00
|
|
|
}
|
2017-01-19 09:56:15 +01:00
|
|
|
|
|
|
|
|
active = NM_ACTIVE_CONNECTION (object);
|
|
|
|
|
device = nm_active_connection_get_device (active);
|
|
|
|
|
if ( !device
|
|
|
|
|
|| !NM_IN_SET (nm_active_connection_get_state (active),
|
|
|
|
|
NM_ACTIVE_CONNECTION_STATE_ACTIVATED,
|
|
|
|
|
NM_ACTIVE_CONNECTION_STATE_DEACTIVATING)) {
|
|
|
|
|
g_value_set_string (value, "/");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_object_get_property (G_OBJECT (device), name, value);
|
2016-09-28 16:13:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nm_act_request_init (NMActRequest *req)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-23 10:00:08 -06:00
|
|
|
/**
|
|
|
|
|
* nm_act_request_new:
|
|
|
|
|
*
|
2015-07-14 16:53:24 +02:00
|
|
|
* @settings_connection: (allow-none): the connection to activate @device with
|
2016-09-07 17:47:26 +02:00
|
|
|
* @applied_connection: (allow-none): the applied connection
|
2012-02-23 10:00:08 -06:00
|
|
|
* @specific_object: the object path of the specific object (ie, WiFi access point,
|
|
|
|
|
* etc) that will be used to activate @connection and @device
|
2013-07-29 13:11:47 -05:00
|
|
|
* @subject: the #NMAuthSubject representing the requestor of the activation
|
2017-03-07 11:04:36 +01:00
|
|
|
* @activation_type: the #NMActivationType.
|
2014-10-15 21:17:45 -05:00
|
|
|
* @device: the device/interface to configure according to @connection
|
2012-02-23 10:00:08 -06:00
|
|
|
*
|
2016-09-07 17:47:26 +02:00
|
|
|
* Creates a new device-based activation request. If an applied connection is
|
|
|
|
|
* supplied, it shall not be modified by the caller afterwards.
|
2012-02-23 10:00:08 -06:00
|
|
|
*
|
|
|
|
|
* Returns: the new activation request on success, %NULL on error.
|
|
|
|
|
*/
|
2010-12-13 13:11:51 -06:00
|
|
|
NMActRequest *
|
2015-07-14 16:53:24 +02:00
|
|
|
nm_act_request_new (NMSettingsConnection *settings_connection,
|
2016-09-07 17:47:26 +02:00
|
|
|
NMConnection *applied_connection,
|
2010-12-13 13:11:51 -06:00
|
|
|
const char *specific_object,
|
2013-07-29 13:11:47 -05:00
|
|
|
NMAuthSubject *subject,
|
2017-03-07 11:04:36 +01:00
|
|
|
NMActivationType activation_type,
|
2013-07-29 16:26:09 -05:00
|
|
|
NMDevice *device)
|
2010-12-13 13:11:51 -06:00
|
|
|
{
|
2015-07-14 16:53:24 +02:00
|
|
|
g_return_val_if_fail (!settings_connection || NM_IS_SETTINGS_CONNECTION (settings_connection), NULL);
|
2014-10-15 21:17:45 -05:00
|
|
|
g_return_val_if_fail (NM_IS_DEVICE (device), NULL);
|
2013-07-29 13:11:47 -05:00
|
|
|
g_return_val_if_fail (NM_IS_AUTH_SUBJECT (subject), NULL);
|
|
|
|
|
|
|
|
|
|
return (NMActRequest *) g_object_new (NM_TYPE_ACT_REQUEST,
|
2016-09-07 17:47:26 +02:00
|
|
|
NM_ACTIVE_CONNECTION_INT_APPLIED_CONNECTION, applied_connection,
|
2015-07-14 16:53:24 +02:00
|
|
|
NM_ACTIVE_CONNECTION_INT_SETTINGS_CONNECTION, settings_connection,
|
2013-07-29 13:11:47 -05:00
|
|
|
NM_ACTIVE_CONNECTION_INT_DEVICE, device,
|
|
|
|
|
NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, specific_object,
|
|
|
|
|
NM_ACTIVE_CONNECTION_INT_SUBJECT, subject,
|
2017-03-07 11:04:36 +01:00
|
|
|
NM_ACTIVE_CONNECTION_INT_ACTIVATION_TYPE, (int) activation_type,
|
2013-07-29 13:11:47 -05:00
|
|
|
NULL);
|
2010-12-13 13:11:51 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
dispose (GObject *object)
|
|
|
|
|
{
|
2015-07-14 16:53:24 +02:00
|
|
|
NMActRequest *self = NM_ACT_REQUEST (object);
|
|
|
|
|
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
|
|
|
|
|
|
|
|
|
|
/* Kill any in-progress secrets requests */
|
|
|
|
|
while (priv->secrets_calls)
|
|
|
|
|
_do_cancel_secrets (self, priv->secrets_calls->data, TRUE);
|
2010-12-13 13:11:51 -06:00
|
|
|
|
|
|
|
|
/* Clear any share rules */
|
2012-08-22 09:38:01 -05:00
|
|
|
if (priv->share_rules) {
|
|
|
|
|
nm_act_request_set_shared (NM_ACT_REQUEST (object), FALSE);
|
|
|
|
|
clear_share_rules (NM_ACT_REQUEST (object));
|
|
|
|
|
}
|
2010-12-13 13:11:51 -06:00
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object);
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-11 13:36:34 +00:00
|
|
|
static void
|
|
|
|
|
nm_act_request_class_init (NMActRequestClass *req_class)
|
2005-05-03 Dan Williams <dcbw@redhat.com>
* Kill dhcpcd. We now use "dhcdbd", a dbus daemon that controls dhclient.
This means that NetworkManager shouldn't have DHCP issues anymore. It also
means you need dhcdbd, which you can get here (get the latest one):
http://people.redhat.com/jvdias/dhcdbd/
Technically NetworkManager can use any DHCP daemon that uses the same DBUS
interface as dhcdbd.
* Rewrite device activation to facilitate the new DHCP infrastructure and
future improvements. Its now "activation request" based, ie there is a single
activation request composed of the device, access point, and other info which
follows the entire activation process. There are 5 stages of the activation
process which correspond to:
1) Device preparation
2) Device configuration (bring it up, set ESSID/Key/etc)
3) IP Config Start (fire off DHCP if we're using it)
4) IP Config Get (grab config from DHCP or static config files)
5) IP Config Commit (set device's IP address, DNS, etc)
Note that there is no longer a "scanning" step, since the access point must
be known _before_ activation starts. If the access point drops out or does
not exist for some reason, the entire activation process fails and must be
restarted for a different access point or device.
Patch from Bill Moss:
* gnome/applet/applet.c
- Fix type of vpn_failure dialog -> vpn_banner dialog
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@597 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-03 20:41:36 +00:00
|
|
|
{
|
2007-06-11 13:36:34 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (req_class);
|
2013-08-28 09:08:43 -05:00
|
|
|
NMActiveConnectionClass *active_class = NM_ACTIVE_CONNECTION_CLASS (req_class);
|
2005-05-03 Dan Williams <dcbw@redhat.com>
* Kill dhcpcd. We now use "dhcdbd", a dbus daemon that controls dhclient.
This means that NetworkManager shouldn't have DHCP issues anymore. It also
means you need dhcdbd, which you can get here (get the latest one):
http://people.redhat.com/jvdias/dhcdbd/
Technically NetworkManager can use any DHCP daemon that uses the same DBUS
interface as dhcdbd.
* Rewrite device activation to facilitate the new DHCP infrastructure and
future improvements. Its now "activation request" based, ie there is a single
activation request composed of the device, access point, and other info which
follows the entire activation process. There are 5 stages of the activation
process which correspond to:
1) Device preparation
2) Device configuration (bring it up, set ESSID/Key/etc)
3) IP Config Start (fire off DHCP if we're using it)
4) IP Config Get (grab config from DHCP or static config files)
5) IP Config Commit (set device's IP address, DNS, etc)
Note that there is no longer a "scanning" step, since the access point must
be known _before_ activation starts. If the access point drops out or does
not exist for some reason, the entire activation process fails and must be
restarted for a different access point or device.
Patch from Bill Moss:
* gnome/applet/applet.c
- Fix type of vpn_failure dialog -> vpn_banner dialog
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@597 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-03 20:41:36 +00:00
|
|
|
|
2008-03-20 19:56:12 +00:00
|
|
|
/* virtual methods */
|
2007-09-14 19:43:28 +00:00
|
|
|
object_class->dispose = dispose;
|
2013-12-18 08:46:43 -05:00
|
|
|
object_class->get_property = get_property;
|
2013-08-28 09:08:43 -05:00
|
|
|
active_class->master_failed = master_failed;
|
2013-09-27 14:40:18 -05:00
|
|
|
active_class->device_state_changed = device_state_changed;
|
2013-12-18 08:46:43 -05:00
|
|
|
|
|
|
|
|
/* properties */
|
|
|
|
|
g_object_class_override_property (object_class, PROP_IP4_CONFIG,
|
|
|
|
|
NM_ACTIVE_CONNECTION_IP4_CONFIG);
|
|
|
|
|
g_object_class_override_property (object_class, PROP_DHCP4_CONFIG,
|
|
|
|
|
NM_ACTIVE_CONNECTION_DHCP4_CONFIG);
|
|
|
|
|
g_object_class_override_property (object_class, PROP_IP6_CONFIG,
|
|
|
|
|
NM_ACTIVE_CONNECTION_IP6_CONFIG);
|
|
|
|
|
g_object_class_override_property (object_class, PROP_DHCP6_CONFIG,
|
|
|
|
|
NM_ACTIVE_CONNECTION_DHCP6_CONFIG);
|
2005-05-03 Dan Williams <dcbw@redhat.com>
* Kill dhcpcd. We now use "dhcdbd", a dbus daemon that controls dhclient.
This means that NetworkManager shouldn't have DHCP issues anymore. It also
means you need dhcdbd, which you can get here (get the latest one):
http://people.redhat.com/jvdias/dhcdbd/
Technically NetworkManager can use any DHCP daemon that uses the same DBUS
interface as dhcdbd.
* Rewrite device activation to facilitate the new DHCP infrastructure and
future improvements. Its now "activation request" based, ie there is a single
activation request composed of the device, access point, and other info which
follows the entire activation process. There are 5 stages of the activation
process which correspond to:
1) Device preparation
2) Device configuration (bring it up, set ESSID/Key/etc)
3) IP Config Start (fire off DHCP if we're using it)
4) IP Config Get (grab config from DHCP or static config files)
5) IP Config Commit (set device's IP address, DNS, etc)
Note that there is no longer a "scanning" step, since the access point must
be known _before_ activation starts. If the access point drops out or does
not exist for some reason, the entire activation process fails and must be
restarted for a different access point or device.
Patch from Bill Moss:
* gnome/applet/applet.c
- Fix type of vpn_failure dialog -> vpn_banner dialog
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@597 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-03 20:41:36 +00:00
|
|
|
}
|
|
|
|
|
|