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
|
|
|
/* nm-dhcp-manager.c - Handle the DHCP daemon for NetworkManager
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2005 Dan Williams
|
|
|
|
|
*
|
|
|
|
|
* 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, 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
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef NM_DHCP_MANAGER_H
|
|
|
|
|
#define NM_DHCP_MANAGER_H
|
|
|
|
|
|
2007-02-05 09:42:19 +00:00
|
|
|
#include <glib/gtypes.h>
|
|
|
|
|
#include <glib-object.h>
|
2008-07-03 16:22:17 +00:00
|
|
|
|
|
|
|
|
#include <nm-setting-ip4-config.h>
|
|
|
|
|
|
2007-02-05 09:42:19 +00:00
|
|
|
#include "nm-ip4-config.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
|
|
|
|
2008-07-16 20:39:58 +00:00
|
|
|
#define NM_DHCP_MANAGER_RUN_DIR LOCALSTATEDIR "/run"
|
|
|
|
|
|
2007-02-05 09:42:19 +00:00
|
|
|
#define NM_TYPE_DHCP_MANAGER (nm_dhcp_manager_get_type ())
|
|
|
|
|
#define NM_DHCP_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP_MANAGER, NMDHCPManager))
|
|
|
|
|
#define NM_DHCP_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DHCP_MANAGER, NMDHCPManagerClass))
|
|
|
|
|
#define NM_IS_DHCP_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DHCP_MANAGER))
|
|
|
|
|
#define NM_IS_DHCP_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_DHCP_MANAGER))
|
|
|
|
|
#define NM_DHCP_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DHCP_MANAGER, NMDHCPManagerClass))
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
2007-08-12 22:41:16 +00:00
|
|
|
DHC_NBI=0, /* no broadcast interfaces found */
|
|
|
|
|
DHC_PREINIT, /* configuration started */
|
|
|
|
|
DHC_BOUND, /* lease obtained */
|
2008-07-16 20:39:58 +00:00
|
|
|
DHC_IPV4LL, /* IPv4LL address obtained */
|
2007-08-12 22:41:16 +00:00
|
|
|
DHC_RENEW, /* lease renewed */
|
|
|
|
|
DHC_REBOOT, /* have valid lease, but now obtained a different one */
|
|
|
|
|
DHC_REBIND, /* new, different lease */
|
|
|
|
|
DHC_STOP, /* remove old lease */
|
|
|
|
|
DHC_MEDIUM, /* media selection begun */
|
|
|
|
|
DHC_TIMEOUT, /* timed out contacting DHCP server */
|
|
|
|
|
DHC_FAIL, /* all attempts to contact server timed out, sleeping */
|
|
|
|
|
DHC_EXPIRE, /* lease has expired, renewing */
|
|
|
|
|
DHC_RELEASE, /* releasing lease */
|
|
|
|
|
DHC_START, /* sent when dhclient started OK */
|
|
|
|
|
DHC_ABEND, /* dhclient exited abnormally */
|
|
|
|
|
DHC_END, /* dhclient exited normally */
|
|
|
|
|
DHC_END_OPTIONS, /* last option in subscription sent */
|
2007-02-05 09:42:19 +00:00
|
|
|
} NMDHCPState;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
GObject parent;
|
|
|
|
|
} NMDHCPManager;
|
2006-03-06 20:21:19 +00:00
|
|
|
|
2007-02-05 09:42:19 +00:00
|
|
|
typedef struct {
|
|
|
|
|
GObjectClass parent;
|
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-02-05 09:42:19 +00:00
|
|
|
/* Signals */
|
|
|
|
|
void (*state_changed) (NMDHCPManager *manager, char *iface, NMDHCPState state);
|
|
|
|
|
void (*timeout) (NMDHCPManager *manager, char *iface);
|
|
|
|
|
} NMDHCPManagerClass;
|
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-07-16 20:39:58 +00:00
|
|
|
typedef struct {
|
|
|
|
|
char * iface;
|
|
|
|
|
guchar state;
|
|
|
|
|
GPid pid;
|
|
|
|
|
char * pid_file;
|
|
|
|
|
char * conf_file;
|
|
|
|
|
char * lease_file;
|
|
|
|
|
guint timeout_id;
|
|
|
|
|
guint watch_id;
|
|
|
|
|
NMDHCPManager * manager;
|
|
|
|
|
GHashTable * options;
|
|
|
|
|
} NMDHCPDevice;
|
|
|
|
|
|
2007-02-05 09:42:19 +00:00
|
|
|
GType nm_dhcp_manager_get_type (void);
|
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-02-05 09:42:19 +00:00
|
|
|
NMDHCPManager *nm_dhcp_manager_get (void);
|
2007-08-12 22:41:16 +00:00
|
|
|
gboolean nm_dhcp_manager_begin_transaction (NMDHCPManager *manager,
|
|
|
|
|
const char *iface,
|
2008-07-03 16:22:17 +00:00
|
|
|
NMSettingIP4Config *s_ip4,
|
2007-08-12 22:41:16 +00:00
|
|
|
guint32 timeout);
|
2007-02-05 09:42:19 +00:00
|
|
|
void nm_dhcp_manager_cancel_transaction (NMDHCPManager *manager,
|
2007-08-12 22:41:16 +00:00
|
|
|
const char *iface);
|
|
|
|
|
NMIP4Config * nm_dhcp_manager_get_ip4_config (NMDHCPManager *manager, const char *iface);
|
2007-02-05 09:42:19 +00:00
|
|
|
NMDHCPState nm_dhcp_manager_get_state_for_device (NMDHCPManager *manager, const char *iface);
|
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-08-12 22:41:16 +00:00
|
|
|
gboolean nm_dhcp_manager_process_signal (NMDHCPManager *manager, DBusMessage *message);
|
|
|
|
|
|
2008-07-16 20:39:58 +00:00
|
|
|
gboolean nm_dhcp_client_start (NMDHCPDevice *device, NMSettingIP4Config *s_ip4);
|
|
|
|
|
void nm_dhcp_client_stop (const char * iface,
|
|
|
|
|
pid_t pid,
|
|
|
|
|
gboolean blocking);
|
|
|
|
|
|
2007-02-05 09:42:19 +00:00
|
|
|
#endif /* NM_DHCP_MANAGER_H */
|