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
|
|
|
*
|
2010-04-07 11:36:38 -07:00
|
|
|
* Copyright (C) 2005 - 2010 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
|
|
|
*/
|
|
|
|
|
|
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>
|
2007-10-01 15:38:39 +00:00
|
|
|
#include <dbus/dbus-glib.h>
|
2008-03-17 19:37:23 +00:00
|
|
|
|
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
|
|
|
#include "nm-activation-request.h"
|
2007-09-11 18:02:27 +00:00
|
|
|
#include "nm-marshal.h"
|
2010-04-07 11:36:38 -07:00
|
|
|
#include "nm-logging.h"
|
2008-03-17 19:37:23 +00:00
|
|
|
#include "nm-setting-wireless-security.h"
|
|
|
|
|
#include "nm-setting-8021x.h"
|
2008-03-20 19:56:12 +00:00
|
|
|
#include "nm-dbus-manager.h"
|
|
|
|
|
#include "nm-device.h"
|
|
|
|
|
#include "nm-properties-changed-signal.h"
|
2008-03-26 13:43:01 +00:00
|
|
|
#include "nm-active-connection.h"
|
2008-03-29 21:35:41 +00:00
|
|
|
#include "nm-dbus-glib-types.h"
|
2011-01-25 12:41:03 -06:00
|
|
|
#include "nm-active-connection-glue.h"
|
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-10-01 15:38:39 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
G_DEFINE_TYPE (NMActRequest, nm_act_request, G_TYPE_OBJECT)
|
2009-06-11 00:39:12 -04:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
#define NM_ACT_REQUEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
|
|
|
|
NM_TYPE_ACT_REQUEST, \
|
|
|
|
|
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
|
|
|
|
2007-09-11 18:02:27 +00:00
|
|
|
enum {
|
2008-03-20 19:56:12 +00:00
|
|
|
PROPERTIES_CHANGED,
|
2007-09-11 18:02:27 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
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 {
|
2008-07-31 21:57:03 +00:00
|
|
|
gboolean disposed;
|
|
|
|
|
|
2007-06-11 13:36:34 +00:00
|
|
|
NMConnection *connection;
|
2010-12-13 13:11:51 -06:00
|
|
|
|
|
|
|
|
NMAgentManager *agent_mgr;
|
|
|
|
|
GSList *secrets_calls;
|
2008-07-31 21:57:03 +00:00
|
|
|
|
2007-08-28 14:47:31 +00:00
|
|
|
char *specific_object;
|
2008-03-20 19:56:12 +00:00
|
|
|
NMDevice *device;
|
2007-06-11 13:36:34 +00:00
|
|
|
gboolean user_requested;
|
2008-03-20 19:56:12 +00:00
|
|
|
|
2008-04-22 00:28:02 +00:00
|
|
|
NMActiveConnectionState state;
|
|
|
|
|
gboolean is_default;
|
2010-04-15 15:26:11 -07:00
|
|
|
gboolean is_default6;
|
2008-06-10 02:02:21 +00:00
|
|
|
gboolean shared;
|
2008-08-15 15:34:28 +00:00
|
|
|
GSList *share_rules;
|
2008-04-22 00:28:02 +00:00
|
|
|
|
2008-03-20 19:56:12 +00:00
|
|
|
char *ac_path;
|
2009-08-05 18:03:09 -04:00
|
|
|
|
|
|
|
|
gboolean assumed;
|
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
|
|
|
|
2008-03-20 19:56:12 +00:00
|
|
|
enum {
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_CONNECTION,
|
|
|
|
|
PROP_SPECIFIC_OBJECT,
|
|
|
|
|
PROP_DEVICES,
|
2008-04-22 00:28:02 +00:00
|
|
|
PROP_STATE,
|
|
|
|
|
PROP_DEFAULT,
|
2010-04-15 15:26:11 -07:00
|
|
|
PROP_DEFAULT6,
|
2008-03-26 13:43:01 +00:00
|
|
|
PROP_VPN,
|
2008-03-20 19:56:12 +00:00
|
|
|
|
|
|
|
|
LAST_PROP
|
|
|
|
|
};
|
|
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
/*******************************************************************/
|
|
|
|
|
|
2008-07-11 10:28:53 +00:00
|
|
|
static void
|
2010-12-13 13:11:51 -06:00
|
|
|
get_secrets_cb (NMAgentManager *manager,
|
|
|
|
|
guint32 call_id,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
GError *error,
|
|
|
|
|
gpointer user_data,
|
|
|
|
|
gpointer user_data2,
|
|
|
|
|
gpointer user_data3)
|
2008-07-11 10:28:53 +00:00
|
|
|
{
|
|
|
|
|
NMActRequest *self = NM_ACT_REQUEST (user_data);
|
|
|
|
|
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
|
2010-12-13 13:11:51 -06:00
|
|
|
NMActRequestSecretsFunc callback = user_data2;
|
2008-07-11 10:28:53 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
priv->secrets_calls = g_slist_remove (priv->secrets_calls, GUINT_TO_POINTER (call_id));
|
2008-07-11 10:28:53 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
callback (self, call_id, connection, error, user_data3);
|
|
|
|
|
}
|
2008-07-11 10:28:53 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
guint32
|
|
|
|
|
nm_act_request_get_secrets (NMActRequest *self,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
const char *setting_name,
|
2011-01-18 14:57:44 -06:00
|
|
|
guint32 flags,
|
2010-12-13 13:11:51 -06:00
|
|
|
const char *hint,
|
|
|
|
|
NMActRequestSecretsFunc callback,
|
|
|
|
|
gpointer callback_data)
|
|
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv;
|
|
|
|
|
guint32 call_id;
|
2010-04-15 15:26:11 -07:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
g_return_val_if_fail (self, 0);
|
|
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (self), 0);
|
|
|
|
|
|
|
|
|
|
priv = NM_ACT_REQUEST_GET_PRIVATE (self);
|
|
|
|
|
|
|
|
|
|
/* If given a connection (ie, called from an NMVpnConnection) then
|
|
|
|
|
* use that, otherwise use the private connection.
|
|
|
|
|
*
|
|
|
|
|
* FIXME: this is icky, and should go away when NMVPNConnection finally
|
|
|
|
|
* uses NMActRequest for activation tracking instead of impersonating one
|
|
|
|
|
* itself.
|
|
|
|
|
*/
|
|
|
|
|
call_id = nm_agent_manager_get_secrets (priv->agent_mgr,
|
|
|
|
|
connection ? connection : priv->connection,
|
|
|
|
|
setting_name,
|
2011-01-18 14:57:44 -06:00
|
|
|
flags,
|
2010-12-13 13:11:51 -06:00
|
|
|
hint,
|
|
|
|
|
get_secrets_cb,
|
|
|
|
|
self,
|
|
|
|
|
callback,
|
|
|
|
|
callback_data);
|
|
|
|
|
if (call_id > 0)
|
|
|
|
|
priv->secrets_calls = g_slist_append (priv->secrets_calls, GUINT_TO_POINTER (call_id));
|
|
|
|
|
|
|
|
|
|
return call_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
nm_act_request_cancel_secrets (NMActRequest *self, guint32 call_id)
|
|
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (self);
|
|
|
|
|
g_return_if_fail (NM_IS_ACT_REQUEST (self));
|
|
|
|
|
g_return_if_fail (call_id > 0);
|
|
|
|
|
|
|
|
|
|
priv = NM_ACT_REQUEST_GET_PRIVATE (self);
|
|
|
|
|
|
|
|
|
|
if (g_slist_find (priv->secrets_calls, GUINT_TO_POINTER (call_id))) {
|
|
|
|
|
priv->secrets_calls = g_slist_remove (priv->secrets_calls, GUINT_TO_POINTER (call_id));
|
|
|
|
|
nm_agent_manager_cancel_secrets (priv->agent_mgr, call_id);
|
2010-04-15 15:26:11 -07:00
|
|
|
}
|
2008-07-11 10:28:53 +00:00
|
|
|
}
|
2008-03-20 19:56:12 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
/*******************************************************************/
|
|
|
|
|
|
|
|
|
|
NMConnection *
|
|
|
|
|
nm_act_request_get_connection (NMActRequest *req)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_ACT_REQUEST_GET_PRIVATE (req)->connection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *
|
|
|
|
|
nm_act_request_get_specific_object (NMActRequest *req)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_ACT_REQUEST_GET_PRIVATE (req)->specific_object;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
nm_act_request_set_specific_object (NMActRequest *req,
|
|
|
|
|
const char *specific_object)
|
2008-03-20 19:56:12 +00:00
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv;
|
|
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
g_return_if_fail (NM_IS_ACT_REQUEST (req));
|
|
|
|
|
g_return_if_fail (specific_object != NULL);
|
2008-03-20 19:56:12 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
priv = NM_ACT_REQUEST_GET_PRIVATE (req);
|
2008-03-20 19:56:12 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
if (priv->specific_object)
|
|
|
|
|
g_free (priv->specific_object);
|
|
|
|
|
priv->specific_object = g_strdup (specific_object);
|
|
|
|
|
}
|
2008-03-20 19:56:12 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
gboolean
|
|
|
|
|
nm_act_request_get_user_requested (NMActRequest *req)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
|
2008-04-22 00:28:02 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
return NM_ACT_REQUEST_GET_PRIVATE (req)->user_requested;
|
|
|
|
|
}
|
2008-04-22 00:28:02 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
const char *
|
|
|
|
|
nm_act_request_get_active_connection_path (NMActRequest *req)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NULL);
|
2008-03-20 19:56:12 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
return NM_ACT_REQUEST_GET_PRIVATE (req)->ac_path;
|
2008-03-20 19:56:12 +00:00
|
|
|
}
|
|
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
void
|
|
|
|
|
nm_act_request_set_default (NMActRequest *req, gboolean is_default)
|
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
|
|
|
{
|
2010-12-13 13:11:51 -06:00
|
|
|
NMActRequestPrivate *priv;
|
2008-03-26 13:43:01 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
g_return_if_fail (NM_IS_ACT_REQUEST (req));
|
2008-03-26 13:43:01 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
priv = NM_ACT_REQUEST_GET_PRIVATE (req);
|
|
|
|
|
if (priv->is_default == is_default)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
priv->is_default = is_default;
|
|
|
|
|
g_object_notify (G_OBJECT (req), NM_ACTIVE_CONNECTION_DEFAULT);
|
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
|
|
|
}
|
|
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
gboolean
|
|
|
|
|
nm_act_request_get_default (NMActRequest *req)
|
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
|
|
|
{
|
2010-12-13 13:11:51 -06:00
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
|
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
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
return NM_ACT_REQUEST_GET_PRIVATE (req)->is_default;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
nm_act_request_set_default6 (NMActRequest *req, gboolean is_default6)
|
|
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_ACT_REQUEST (req));
|
|
|
|
|
|
|
|
|
|
priv = NM_ACT_REQUEST_GET_PRIVATE (req);
|
|
|
|
|
if (priv->is_default6 == is_default6)
|
2008-07-31 21:57:03 +00:00
|
|
|
return;
|
|
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
priv->is_default6 = is_default6;
|
|
|
|
|
g_object_notify (G_OBJECT (req), NM_ACTIVE_CONNECTION_DEFAULT6);
|
|
|
|
|
}
|
2007-09-14 19:43:28 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
gboolean
|
|
|
|
|
nm_act_request_get_default6 (NMActRequest *req)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
|
2008-04-22 02:40:47 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
return NM_ACT_REQUEST_GET_PRIVATE (req)->is_default6;
|
|
|
|
|
}
|
2008-08-15 15:34:28 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
GObject *
|
|
|
|
|
nm_act_request_get_device (NMActRequest *req)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
|
2007-09-25 07:06:28 +00:00
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
return G_OBJECT (NM_ACT_REQUEST_GET_PRIVATE (req)->device);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
|
nm_act_request_get_assumed (NMActRequest *req)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
|
|
|
|
|
|
|
|
|
|
return NM_ACT_REQUEST_GET_PRIVATE (req)->assumed;
|
2007-09-14 19:43:28 +00:00
|
|
|
}
|
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
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-14 19:43:28 +00:00
|
|
|
static void
|
2010-12-13 13:11:51 -06:00
|
|
|
share_child_setup (gpointer user_data G_GNUC_UNUSED)
|
2007-09-14 19:43:28 +00:00
|
|
|
{
|
2010-12-13 13:11:51 -06:00
|
|
|
/* We are in the child process at this point */
|
|
|
|
|
pid_t pid = getpid ();
|
|
|
|
|
setpgid (pid, pid);
|
|
|
|
|
}
|
2007-08-28 14:47:31 +00:00
|
|
|
|
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 };
|
|
|
|
|
char **argv;
|
|
|
|
|
char *cmd;
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
share_child_setup, NULL, NULL, NULL, &status, &error)) {
|
|
|
|
|
nm_log_warn (LOGD_SHARING, "Error executing command: (%d) %s",
|
|
|
|
|
error ? error->code : -1,
|
|
|
|
|
(error && error->message) ? error->message : "(unknown)");
|
|
|
|
|
g_clear_error (&error);
|
|
|
|
|
} else if (WEXITSTATUS (status)) {
|
|
|
|
|
nm_log_warn (LOGD_SHARING, "** Command returned exit status %d.",
|
|
|
|
|
WEXITSTATUS (status));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
g_free (cmd);
|
|
|
|
|
if (argv)
|
|
|
|
|
g_strfreev (argv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
priv->share_rules = g_slist_append (priv->share_rules, rule);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/********************************************************************/
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
device_state_changed (NMDevice *device,
|
|
|
|
|
NMDeviceState new_state,
|
|
|
|
|
NMDeviceState old_state,
|
|
|
|
|
NMDeviceStateReason reason,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMActRequest *self = NM_ACT_REQUEST (user_data);
|
|
|
|
|
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
|
|
|
|
|
NMActiveConnectionState new_ac_state;
|
|
|
|
|
gboolean new_default = FALSE, new_default6 = FALSE;
|
|
|
|
|
|
|
|
|
|
/* Set NMActiveConnection state based on the device's state */
|
|
|
|
|
switch (new_state) {
|
|
|
|
|
case NM_DEVICE_STATE_PREPARE:
|
|
|
|
|
case NM_DEVICE_STATE_CONFIG:
|
|
|
|
|
case NM_DEVICE_STATE_NEED_AUTH:
|
|
|
|
|
case NM_DEVICE_STATE_IP_CONFIG:
|
|
|
|
|
new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATING;
|
|
|
|
|
break;
|
|
|
|
|
case NM_DEVICE_STATE_ACTIVATED:
|
|
|
|
|
new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED;
|
|
|
|
|
new_default = priv->is_default;
|
|
|
|
|
new_default6 = priv->is_default6;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
new_ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (new_ac_state != priv->state) {
|
|
|
|
|
priv->state = new_ac_state;
|
|
|
|
|
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (new_default != priv->is_default) {
|
|
|
|
|
priv->is_default = new_default;
|
|
|
|
|
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (new_default6 != priv->is_default6) {
|
|
|
|
|
priv->is_default6 = new_default6;
|
|
|
|
|
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT6);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/********************************************************************/
|
|
|
|
|
|
|
|
|
|
NMActRequest *
|
|
|
|
|
nm_act_request_new (NMConnection *connection,
|
|
|
|
|
const char *specific_object,
|
|
|
|
|
NMAgentManager *agent_mgr,
|
|
|
|
|
gboolean user_requested,
|
|
|
|
|
gboolean assumed,
|
|
|
|
|
gpointer *device)
|
|
|
|
|
{
|
|
|
|
|
GObject *object;
|
|
|
|
|
NMActRequestPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
|
|
|
|
|
g_return_val_if_fail (NM_IS_AGENT_MANAGER (agent_mgr), NULL);
|
|
|
|
|
g_return_val_if_fail (NM_DEVICE (device), NULL);
|
|
|
|
|
|
|
|
|
|
object = g_object_new (NM_TYPE_ACT_REQUEST, NULL);
|
|
|
|
|
if (!object)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
priv = NM_ACT_REQUEST_GET_PRIVATE (object);
|
|
|
|
|
|
|
|
|
|
priv->connection = g_object_ref (connection);
|
|
|
|
|
if (specific_object)
|
|
|
|
|
priv->specific_object = g_strdup (specific_object);
|
|
|
|
|
|
|
|
|
|
priv->agent_mgr = g_object_ref (agent_mgr);
|
|
|
|
|
|
|
|
|
|
priv->device = NM_DEVICE (device);
|
|
|
|
|
g_signal_connect (device, "state-changed",
|
|
|
|
|
G_CALLBACK (device_state_changed),
|
|
|
|
|
NM_ACT_REQUEST (object));
|
|
|
|
|
|
|
|
|
|
priv->user_requested = user_requested;
|
|
|
|
|
priv->assumed = assumed;
|
|
|
|
|
|
|
|
|
|
return NM_ACT_REQUEST (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nm_act_request_init (NMActRequest *req)
|
|
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req);
|
|
|
|
|
NMDBusManager *dbus_mgr;
|
|
|
|
|
|
|
|
|
|
priv->ac_path = nm_active_connection_get_next_object_path ();
|
|
|
|
|
priv->state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
|
|
|
|
|
|
|
|
|
|
dbus_mgr = nm_dbus_manager_get ();
|
|
|
|
|
dbus_g_connection_register_g_object (nm_dbus_manager_get_connection (dbus_mgr),
|
|
|
|
|
priv->ac_path,
|
|
|
|
|
G_OBJECT (req));
|
|
|
|
|
g_object_unref (dbus_mgr);
|
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
|
|
|
static void
|
|
|
|
|
get_property (GObject *object, guint prop_id,
|
|
|
|
|
GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object);
|
|
|
|
|
GPtrArray *devices;
|
|
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_CONNECTION:
|
|
|
|
|
g_value_set_boxed (value, nm_connection_get_path (priv->connection));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_SPECIFIC_OBJECT:
|
|
|
|
|
if (priv->specific_object)
|
|
|
|
|
g_value_set_boxed (value, priv->specific_object);
|
|
|
|
|
else
|
|
|
|
|
g_value_set_boxed (value, "/");
|
|
|
|
|
break;
|
|
|
|
|
case PROP_DEVICES:
|
|
|
|
|
devices = g_ptr_array_sized_new (1);
|
2009-06-11 00:39:12 -04:00
|
|
|
g_ptr_array_add (devices, g_strdup (nm_device_get_path (priv->device)));
|
2008-03-20 19:56:12 +00:00
|
|
|
g_value_take_boxed (value, devices);
|
|
|
|
|
break;
|
2008-04-22 00:28:02 +00:00
|
|
|
case PROP_STATE:
|
|
|
|
|
g_value_set_uint (value, priv->state);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_DEFAULT:
|
|
|
|
|
g_value_set_boolean (value, priv->is_default);
|
|
|
|
|
break;
|
2010-04-15 15:26:11 -07:00
|
|
|
case PROP_DEFAULT6:
|
|
|
|
|
g_value_set_boolean (value, priv->is_default6);
|
|
|
|
|
break;
|
2008-03-26 13:43:01 +00:00
|
|
|
case PROP_VPN:
|
|
|
|
|
g_value_set_boolean (value, FALSE);
|
|
|
|
|
break;
|
2008-03-20 19:56:12 +00:00
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
static void
|
|
|
|
|
dispose (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object);
|
|
|
|
|
GSList *iter;
|
|
|
|
|
|
|
|
|
|
if (priv->disposed) {
|
|
|
|
|
G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
priv->disposed = TRUE;
|
|
|
|
|
|
|
|
|
|
g_assert (priv->connection);
|
|
|
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (G_OBJECT (priv->device),
|
|
|
|
|
G_CALLBACK (device_state_changed),
|
|
|
|
|
NM_ACT_REQUEST (object));
|
|
|
|
|
|
|
|
|
|
/* Clear any share rules */
|
|
|
|
|
nm_act_request_set_shared (NM_ACT_REQUEST (object), FALSE);
|
|
|
|
|
|
|
|
|
|
g_object_unref (priv->connection);
|
|
|
|
|
|
|
|
|
|
for (iter = priv->secrets_calls; iter; iter = g_slist_next (iter)) {
|
|
|
|
|
nm_agent_manager_cancel_secrets (priv->agent_mgr,
|
|
|
|
|
GPOINTER_TO_UINT (iter->data));
|
|
|
|
|
}
|
|
|
|
|
g_slist_free (priv->secrets_calls);
|
|
|
|
|
g_object_unref (priv->agent_mgr);
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object);
|
|
|
|
|
|
|
|
|
|
g_free (priv->specific_object);
|
|
|
|
|
g_free (priv->ac_path);
|
|
|
|
|
|
|
|
|
|
clear_share_rules (NM_ACT_REQUEST (object));
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (nm_act_request_parent_class)->finalize (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);
|
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
|
|
|
g_type_class_add_private (req_class, sizeof (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
|
|
|
|
2008-03-20 19:56:12 +00:00
|
|
|
/* virtual methods */
|
|
|
|
|
object_class->get_property = get_property;
|
2007-09-14 19:43:28 +00:00
|
|
|
object_class->dispose = dispose;
|
2007-06-11 13:36:34 +00:00
|
|
|
object_class->finalize = finalize;
|
2007-09-11 18:02:27 +00:00
|
|
|
|
2008-03-20 19:56:12 +00:00
|
|
|
/* properties */
|
2011-01-25 15:41:03 -06:00
|
|
|
nm_active_connection_install_properties (object_class,
|
|
|
|
|
PROP_CONNECTION,
|
|
|
|
|
PROP_SPECIFIC_OBJECT,
|
|
|
|
|
PROP_DEVICES,
|
|
|
|
|
PROP_STATE,
|
|
|
|
|
PROP_DEFAULT,
|
|
|
|
|
PROP_DEFAULT6,
|
|
|
|
|
PROP_VPN);
|
2008-03-20 19:56:12 +00:00
|
|
|
|
2007-09-11 18:02:27 +00:00
|
|
|
/* Signals */
|
2008-03-20 19:56:12 +00:00
|
|
|
signals[PROPERTIES_CHANGED] =
|
|
|
|
|
nm_properties_changed_signal_new (object_class,
|
2011-01-25 15:41:03 -06:00
|
|
|
G_STRUCT_OFFSET (NMActRequestClass, properties_changed));
|
2007-02-16 11:23:49 +00:00
|
|
|
|
2011-01-25 15:41:03 -06:00
|
|
|
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (req_class),
|
|
|
|
|
&dbus_glib_nm_active_connection_object_info);
|
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
|
|
|
}
|
|
|
|
|
|