2007-09-26 15:38:51 +00:00
|
|
|
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
2004-06-24 14:18:37 +00:00
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* Dan Williams <dcbw@redhat.com>
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
|
|
|
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*
|
2005-08-17 04:19:43 +00:00
|
|
|
* (C) Copyright 2005 Red Hat, Inc.
|
2004-06-24 14:18:37 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/stat.h>
|
2004-06-24 17:55:51 +00:00
|
|
|
#include <signal.h>
|
2004-06-24 14:18:37 +00:00
|
|
|
#include <fcntl.h>
|
2004-07-06 01:34:10 +00:00
|
|
|
#include <sys/select.h>
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
#include "NetworkManagerPolicy.h"
|
|
|
|
|
#include "NetworkManagerUtils.h"
|
|
|
|
|
#include "NetworkManagerAP.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
|
|
|
#include "nm-activation-request.h"
|
2005-03-14 Ray Strode <rstrode@redhat.com>
Fourth (probably working) cut at porting to
dbus 0.30 api and new hal. This cut adds
some new logging macros to make debugging
easier.
* dispatcher-daemon/NetworkManagerDispatcher.c:
* info-daemon/NetworkmanagerInfo.c:
* info-daemon/NetworkManagerInfoPassphraseDialog.c:
* info-daemon/NetworkManagerInfoVPN.c:
* src/NetworkManager.c:
* src/NetworkManagerAP.c:
* src/NetworkManagerAPList.c:
* src/NetworkManagerDHCP.c:
* src/NetworkManagerDbus.c:
* src/NetworkManagerDevice.c:
* src/NetworkManagerPolicy.c:
* src/NetworkManagerSystem.c:
* src/NetworkManagerUtils.c:
* src/NetworkManagerWireless.c:
* src/autoip.c:
* src/nm-dbus-nm.c:
* src/backends/NetworkManagerDebian.c:
* src/backends/NetworkManagerGentoo.c:
* src/backends/NetworkManagerRedHat.c:
* src/backends/NetworkManagerSlackware.c:
use new logging macros.
* dispatcher-daemon/NetworkManagerDispatcher.c:
(nmd_dbus_filter): s/dbus_free/g_free/
* info-daemon/Makefile.am: link in utils library.
* info-daemon/NetworkmanagerInfo.c: use new logging
macros.
(nmi_dbus_get_network): don't assume enumerations
are 32-bit.
(nmi_dbus_nmi_message_handler): don't free what
doesn't belong to us.
* libnm_glib/libnm_glib.c:
(libnm_glib_get_nm_status):
(libnm_glib_init): don't free what doesn't
belong to us.
(libnm_glib_dbus): strdup result, so it doesn't get
lost when message is unref'd.
* panel-applet/NMWirelessAppletDbus.c:
(nmwa_dbus_update_devices): s/dbus_free/g_free/
* src/NetworkManager.c:
(nm_monitor_wired_link_state): request initial status
dump of all cards when we start up, instead of relying
on /sys/.../carrier.
(nm_info_handler), (nm_set_up_log_handlers):
log handlers to specify what syslog priorites
the logging macros default to.
* src/NetworkManagerAPList.c:
(nm_ap_list_populate_from_nmi):
s/dbus_free_string_array/g_strfreev/
* src/NetworkManagerDbus.c:
(nm_dbus_get_network_object):
validate d-bus message argument types.
Advance message iterator after reading argument,
prepend instead of append to GSList.
* src/NetworkManagerDevice.c:
(nm_device_probe_wired_link_status):
remove redundant /sys in /sys path. remove wrong
contents == NULL means has carrier assumption.
* src/nm-netlink-monitor.c
(nm_netlink_monitor_request_status): implement
function to ask kernel to dump interface link
status over netlink socket.
* test/*.c: s/dbus_free/g_free/
* utils/nm-utils.h:
(nm_print_backtrace): new macro to print backtrace.
(nm_get_timestamp): new macro to get sub-second precise
unix timestamp.
(nm_info), (nm_debug), (nm_warning), (nm_error):
new logging functions. nm_info just prints,
nm_debug includes timestamp and function,
nm_warning includes function, nm_error includes
backtrace and sigtrap.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@497 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-15 05:30:15 +00:00
|
|
|
#include "nm-utils.h"
|
2007-02-09 08:50:35 +00:00
|
|
|
#include "nm-device-interface.h"
|
2005-12-31 08:21:24 +00:00
|
|
|
#include "nm-device-802-11-wireless.h"
|
|
|
|
|
#include "nm-device-802-3-ethernet.h"
|
2006-10-13 19:41:47 +00:00
|
|
|
#include "nm-dbus-manager.h"
|
2007-11-07 16:06:43 +00:00
|
|
|
#include "nm-setting-connection.h"
|
2007-12-06 14:51:43 +00:00
|
|
|
#include "NetworkManagerSystem.h"
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
struct NMPolicy {
|
|
|
|
|
NMManager *manager;
|
|
|
|
|
guint device_state_changed_idle_id;
|
|
|
|
|
};
|
|
|
|
|
|
2007-10-08 18:07:36 +00:00
|
|
|
#define INVALID_TAG "invalid"
|
|
|
|
|
|
2007-02-09 08:50:35 +00:00
|
|
|
static void schedule_change_check (NMPolicy *policy);
|
|
|
|
|
|
2007-10-08 15:09:50 +00:00
|
|
|
static const char *
|
2007-11-15 15:52:42 +00:00
|
|
|
get_connection_id (NMConnection *connection)
|
2007-10-08 15:09:50 +00:00
|
|
|
{
|
|
|
|
|
NMSettingConnection *s_con;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
|
|
|
|
|
|
2007-11-07 16:06:43 +00:00
|
|
|
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
|
2007-10-08 15:09:50 +00:00
|
|
|
g_return_val_if_fail (s_con != NULL, NULL);
|
|
|
|
|
|
2007-11-15 15:52:42 +00:00
|
|
|
return s_con->id;
|
2007-10-08 15:09:50 +00:00
|
|
|
}
|
|
|
|
|
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
/*
|
2004-08-26 20:05:24 +00:00
|
|
|
* nm_policy_auto_get_best_device
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
*
|
2004-08-26 20:05:24 +00:00
|
|
|
* Find the best device to use, regardless of whether we are
|
|
|
|
|
* "locked" on one device at this time.
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2007-09-09 22:18:42 +00:00
|
|
|
static NMDevice *
|
|
|
|
|
nm_policy_auto_get_best_device (NMPolicy *policy,
|
2007-09-10 19:11:40 +00:00
|
|
|
NMConnection **connection,
|
|
|
|
|
char **specific_object)
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
{
|
2007-09-26 15:38:51 +00:00
|
|
|
GSList *connections;
|
2005-12-31 08:21:24 +00:00
|
|
|
GSList * elt;
|
|
|
|
|
NMDevice8023Ethernet * best_wired_dev = NULL;
|
|
|
|
|
guint best_wired_prio = 0;
|
2007-09-09 22:18:42 +00:00
|
|
|
NMConnection * best_wired_connection = NULL;
|
2007-09-10 19:11:40 +00:00
|
|
|
char * best_wired_specific_object = NULL;
|
2005-12-31 08:21:24 +00:00
|
|
|
NMDevice80211Wireless * best_wireless_dev = NULL;
|
|
|
|
|
guint best_wireless_prio = 0;
|
2007-09-09 22:18:42 +00:00
|
|
|
NMConnection * best_wireless_connection = NULL;
|
2007-09-10 19:11:40 +00:00
|
|
|
char * best_wireless_specific_object = NULL;
|
2005-12-31 08:21:24 +00:00
|
|
|
NMDevice * highest_priority_dev = NULL;
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
|
2007-09-09 22:18:42 +00:00
|
|
|
g_return_val_if_fail (connection != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (*connection == NULL, NULL);
|
2007-09-10 19:11:40 +00:00
|
|
|
g_return_val_if_fail (specific_object != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (*specific_object == NULL, NULL);
|
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-09 08:50:35 +00:00
|
|
|
if (nm_manager_get_state (policy->manager) == NM_STATE_ASLEEP)
|
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
|
|
|
return NULL;
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
|
2007-09-26 15:38:51 +00:00
|
|
|
/* System connections first, then user connections */
|
|
|
|
|
connections = nm_manager_get_connections (policy->manager, NM_CONNECTION_TYPE_SYSTEM);
|
|
|
|
|
connections = g_slist_concat (connections, nm_manager_get_connections (policy->manager, NM_CONNECTION_TYPE_USER));
|
|
|
|
|
|
2007-10-08 18:07:36 +00:00
|
|
|
/* Remove connections that are in the invalid list. */
|
|
|
|
|
elt = connections;
|
|
|
|
|
while (elt) {
|
|
|
|
|
NMConnection *iter_connection = NM_CONNECTION (elt->data);
|
|
|
|
|
GSList *next = g_slist_next (elt);
|
|
|
|
|
|
|
|
|
|
if (g_object_get_data (G_OBJECT (iter_connection), INVALID_TAG)) {
|
|
|
|
|
connections = g_slist_remove_link (connections, elt);
|
|
|
|
|
g_object_unref (iter_connection);
|
|
|
|
|
g_slist_free (elt);
|
|
|
|
|
}
|
|
|
|
|
elt = next;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-09 08:50:35 +00:00
|
|
|
for (elt = nm_manager_get_devices (policy->manager); elt; elt = elt->next) {
|
2007-09-09 22:18:42 +00:00
|
|
|
NMConnection *tmp_con = NULL;
|
2007-09-10 19:11:40 +00:00
|
|
|
char *tmp_obj = NULL;
|
2007-09-09 22:18:42 +00:00
|
|
|
gboolean link_active;
|
|
|
|
|
guint prio = 0;
|
|
|
|
|
NMDevice * dev = (NMDevice *)(elt->data);
|
|
|
|
|
guint32 caps;
|
2004-10-21 17:42:14 +00:00
|
|
|
|
2005-03-11 20:12:57 +00:00
|
|
|
link_active = nm_device_has_active_link (dev);
|
2005-10-09 04:39:49 +00:00
|
|
|
caps = nm_device_get_capabilities (dev);
|
|
|
|
|
|
2007-09-26 15:38:51 +00:00
|
|
|
tmp_con = nm_device_get_best_connection (dev, connections, &tmp_obj);
|
2007-09-24 21:50:11 +00:00
|
|
|
if (tmp_con == NULL) {
|
|
|
|
|
NMActRequest *req = nm_device_get_act_request (dev);
|
|
|
|
|
|
|
|
|
|
/* If the device is activating, the NMConnection it's got is the
|
|
|
|
|
* best one. In other words, follow activation of a particular
|
|
|
|
|
* NMConnection through to success/failure rather than cutting it
|
|
|
|
|
* off if it becomes invalid
|
|
|
|
|
*/
|
|
|
|
|
tmp_con = req ? nm_act_request_get_connection (req) : NULL;
|
|
|
|
|
if (!tmp_con)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
|
2007-02-09 08:50:35 +00:00
|
|
|
if (NM_IS_DEVICE_802_3_ETHERNET (dev)) {
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
if (link_active)
|
|
|
|
|
prio += 1;
|
|
|
|
|
|
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
|
|
|
if (nm_device_get_act_request (dev) && link_active)
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
prio += 1;
|
|
|
|
|
|
2007-09-09 22:18:42 +00:00
|
|
|
if (prio > best_wired_prio) {
|
2005-12-31 08:21:24 +00:00
|
|
|
best_wired_dev = NM_DEVICE_802_3_ETHERNET (dev);
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
best_wired_prio = prio;
|
2007-09-09 22:18:42 +00:00
|
|
|
best_wired_connection = tmp_con;
|
2007-09-10 19:11:40 +00:00
|
|
|
best_wired_specific_object = tmp_obj;
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
}
|
2007-09-24 21:50:11 +00:00
|
|
|
} else if ( NM_IS_DEVICE_802_11_WIRELESS (dev)
|
|
|
|
|
&& nm_manager_wireless_enabled (policy->manager)) {
|
2005-10-10 12:57:49 +00:00
|
|
|
/* Bump by 1 so that _something_ gets chosen every time */
|
|
|
|
|
prio += 1;
|
|
|
|
|
|
2005-10-09 04:39:49 +00:00
|
|
|
if (link_active)
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
prio += 1;
|
|
|
|
|
|
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
|
|
|
if (nm_device_get_act_request (dev) && link_active)
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
prio += 3;
|
|
|
|
|
|
2007-09-09 22:18:42 +00:00
|
|
|
if (prio > best_wireless_prio) {
|
2005-12-31 08:21:24 +00:00
|
|
|
best_wireless_dev = NM_DEVICE_802_11_WIRELESS (dev);
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
best_wireless_prio = prio;
|
2007-09-09 22:18:42 +00:00
|
|
|
best_wireless_connection = tmp_con;
|
2007-09-10 19:11:40 +00:00
|
|
|
best_wireless_specific_object = tmp_obj;
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-09 22:18:42 +00:00
|
|
|
if (best_wired_dev) {
|
2005-12-31 08:21:24 +00:00
|
|
|
highest_priority_dev = NM_DEVICE (best_wired_dev);
|
2007-10-06 13:35:28 +00:00
|
|
|
*connection = g_object_ref (best_wired_connection);
|
2007-09-10 19:11:40 +00:00
|
|
|
*specific_object = best_wired_specific_object;
|
2007-09-09 22:18:42 +00:00
|
|
|
} else if (best_wireless_dev) {
|
2006-12-19 19:15:31 +00:00
|
|
|
gboolean can_activate;
|
|
|
|
|
|
|
|
|
|
can_activate = nm_device_802_11_wireless_can_activate (best_wireless_dev);
|
2007-09-09 22:18:42 +00:00
|
|
|
if (can_activate) {
|
2005-12-31 08:21:24 +00:00
|
|
|
highest_priority_dev = NM_DEVICE (best_wireless_dev);
|
2007-10-06 13:35:28 +00:00
|
|
|
*connection = g_object_ref (best_wireless_connection);
|
2007-09-10 19:11:40 +00:00
|
|
|
*specific_object = best_wireless_specific_object;
|
2007-09-09 22:18:42 +00:00
|
|
|
}
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
}
|
|
|
|
|
|
2007-10-06 13:35:28 +00:00
|
|
|
g_slist_foreach (connections, (GFunc) g_object_unref, NULL);
|
|
|
|
|
g_slist_free (connections);
|
|
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
if (FALSE) {
|
2007-09-09 22:18:42 +00:00
|
|
|
nm_info ("AUTO: Best wired device = %s, best wireless device = %s, best connection name = '%s'",
|
2007-06-27 16:18:52 +00:00
|
|
|
best_wired_dev ? nm_device_get_iface (NM_DEVICE (best_wired_dev)) : "(null)",
|
|
|
|
|
best_wireless_dev ? nm_device_get_iface (NM_DEVICE (best_wireless_dev)) : "(null)",
|
2007-11-15 15:52:42 +00:00
|
|
|
*connection ? get_connection_id (*connection) : "(none)");
|
2007-06-27 16:18:52 +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
|
|
|
|
2007-09-09 22:18:42 +00:00
|
|
|
return *connection ? highest_priority_dev : NULL;
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
}
|
|
|
|
|
|
2004-08-26 20:05:24 +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
|
|
|
* nm_policy_device_change_check
|
2004-08-26 20:05:24 +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
|
|
|
* Figures out which interface to switch the active
|
|
|
|
|
* network connection to if our global network state has changed.
|
|
|
|
|
* Global network state changes are triggered by:
|
|
|
|
|
* 1) insertion/deletion of interfaces
|
|
|
|
|
* 2) link state change of an interface
|
|
|
|
|
* 3) wireless network topology changes
|
2004-08-26 20:05:24 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2006-01-22 22:40:14 +00:00
|
|
|
static gboolean
|
2007-01-04 12:06:26 +00:00
|
|
|
nm_policy_device_change_check (gpointer user_data)
|
2004-08-26 20:05:24 +00:00
|
|
|
{
|
2007-02-09 08:50:35 +00:00
|
|
|
NMPolicy *policy = (NMPolicy *) user_data;
|
2007-06-13 11:58:25 +00:00
|
|
|
GSList *iter;
|
2007-10-01 15:38:39 +00:00
|
|
|
guint32 caps;
|
2007-10-08 15:09:50 +00:00
|
|
|
NMConnection *connection = NULL;
|
|
|
|
|
NMConnection *old_connection = NULL;
|
|
|
|
|
NMActRequest *old_act_req = NULL;
|
2007-09-10 19:11:40 +00:00
|
|
|
char * specific_object = NULL;
|
2007-09-09 22:18:42 +00:00
|
|
|
NMDevice * new_dev = NULL;
|
|
|
|
|
NMDevice * old_dev = NULL;
|
|
|
|
|
gboolean do_switch = FALSE;
|
2004-08-26 20:05:24 +00:00
|
|
|
|
2007-06-13 11:58:25 +00:00
|
|
|
switch (nm_manager_get_state (policy->manager)) {
|
|
|
|
|
case NM_STATE_CONNECTED:
|
|
|
|
|
old_dev = nm_manager_get_active_device (policy->manager);
|
2007-12-05 17:33:55 +00:00
|
|
|
|
|
|
|
|
/* Don't touch devices that are not upped/downed automatically */
|
|
|
|
|
if (!NM_IS_DEVICE_802_3_ETHERNET (old_dev) && !NM_IS_DEVICE_802_11_WIRELESS (old_dev))
|
|
|
|
|
goto out;
|
|
|
|
|
|
2007-10-01 15:38:39 +00:00
|
|
|
caps = nm_device_get_capabilities (old_dev);
|
|
|
|
|
|
|
|
|
|
/* Don't interrupt semi-supported devices. If the user chose
|
|
|
|
|
* one, they must explicitly choose to move to another device, we're not
|
|
|
|
|
* going to move for them.
|
|
|
|
|
*/
|
|
|
|
|
if ((NM_IS_DEVICE_802_3_ETHERNET (old_dev) && !(caps & NM_DEVICE_CAP_CARRIER_DETECT))) {
|
|
|
|
|
nm_info ("Old device '%s' was semi-supported and user chosen, won't"
|
|
|
|
|
" change unless told to.",
|
|
|
|
|
nm_device_get_iface (old_dev));
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
2007-06-13 11:58:25 +00:00
|
|
|
break;
|
|
|
|
|
case NM_STATE_CONNECTING:
|
|
|
|
|
for (iter = nm_manager_get_devices (policy->manager); iter; iter = iter->next) {
|
2007-10-01 15:38:39 +00:00
|
|
|
NMDevice *d = NM_DEVICE (iter->data);
|
|
|
|
|
|
|
|
|
|
if (nm_device_is_activating (d)) {
|
|
|
|
|
if (nm_device_can_interrupt_activation (d)) {
|
|
|
|
|
old_dev = d;
|
|
|
|
|
break;
|
|
|
|
|
} else
|
|
|
|
|
goto out;
|
2007-06-13 11:58:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2007-09-25 06:34:05 +00:00
|
|
|
case NM_STATE_DISCONNECTED:
|
2007-10-01 15:38:39 +00:00
|
|
|
if (nm_manager_activation_pending (policy->manager)) {
|
|
|
|
|
nm_info ("There is a pending activation, won't change.");
|
|
|
|
|
goto out;
|
2007-09-25 06:34:05 +00:00
|
|
|
}
|
|
|
|
|
break;
|
2007-06-13 11:58:25 +00:00
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2004-09-12 03:06:44 +00:00
|
|
|
|
2007-09-10 19:11:40 +00:00
|
|
|
new_dev = nm_policy_auto_get_best_device (policy, &connection, &specific_object);
|
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-08 15:09:50 +00:00
|
|
|
if (old_dev) {
|
|
|
|
|
old_act_req = nm_device_get_act_request (old_dev);
|
|
|
|
|
if (old_act_req)
|
|
|
|
|
old_connection = nm_act_request_get_connection (old_act_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
|
|
|
/* Four cases here:
|
|
|
|
|
*
|
|
|
|
|
* 1) old device is NULL, new device is NULL - we aren't currently connected to anything, and we
|
|
|
|
|
* can't find anything to connect to. Do nothing.
|
|
|
|
|
*
|
2006-05-28 20:08:11 +00:00
|
|
|
* 2) old device is NULL, new device is good - we aren't currently connected to anything, but
|
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
|
|
|
* we have something we can connect to. Connect to it.
|
|
|
|
|
*
|
|
|
|
|
* 3) old device is good, new device is NULL - have a current connection, but it's no good since
|
|
|
|
|
* auto device picking didn't come up with the save device. Terminate current connection.
|
|
|
|
|
*
|
|
|
|
|
* 4) old device is good, new device is good - have a current connection, and auto device picking
|
|
|
|
|
* came up with a device too. More considerations:
|
|
|
|
|
* a) different devices? activate new device
|
|
|
|
|
* b) same device, different access points? activate new device
|
|
|
|
|
* c) same device, same access point? do nothing
|
2004-08-31 Dan Williams <dcbw@redhat.com>
* Remove 'debug' extern global from all files since we now
use syslog()
* src/NetworkManager.[ch]
- Break out routine that get the net.interface property from HAL,
removing that logic from nm_create_device_and_add_to_list()
- (nm_create_device_and_add_to_list): make this a bit more general so
it doesn't do the talking to HAL. Also add arguments to facilitate
the create of test devices.
- (nm_data_mark_state_changed): rename from nm_data_set_state_modified()
- (nm_data_new, main, nm_print_usage): add new argument "--enable-test-devices"
which makes NetworkManager listen for dbus commands to create test
devices, which have no backing hardware. Use when you're on a plane
for example, and/or forgot your wireless card at home. Test devices
_cannot_ be created unless NM is started with --enable-test-devices.
* src/NetworkManagerDbus.[ch]
- New "getLinkActive" method for devices
- New "setLinkActive" method for devices (only works on test devices)
- New "createTestDevice" method on NetworkManager object to create a test
device of a specified type (ie wired, wireless). UDI is created from
scratch, as is the interface name. Only works when NM is started with
--enable-test-devices switch.
- New "removeTestDevice" method on NetworkManager object which removes a
test device. Only works when NM is started with --enable-test-devices
* src/NetworkManagerDevice.[ch]
- Logic to facilitate test devices. Add variables to NMDevice struct to indicate
whether a device is a test device or not, and what its link status is.
- Deal with test devices in most functions. For those that work directly on hardware
special-case test devices.
- (nm_device_new): don't create a test device if test devices weren't enabled on the
command-line.
- (nm_device_update_link_active): split out logic for wired and wireless device link
checking to separate functions to facilitate test device link checking.
- (nm_device_set_enc_key): Since some drivers for wireless cards are daft and
don't make a distinction between System Authentication and Encryption
(namely Cisco aironet), we use Open System auth when setting a WEP key
on the card. We don't deal with Shared Key auth yet.
- (nm_device_activation_worker): split the activation cancel check logic out into
a separate routine nm_device_activation_cancel_if_needed()
- (nm_device_activation_signal_cancel): rename from nm_device_activation_cancel()
- (nm_device_fake_ap_list): Test wireless devices obviously cannot scan, so create
a list of fake access points that they can "see"
- (nm_device_is_test_device): return whether or not a device is a test device
* src/NetworkManagerPolicy.c
- (nm_policy_get_best_device): attempt to deal with wireless network selection,
previously if you "locked"/forced NM to use a wireless device but then
selected a wireless network for NM to use, it would switch to a wired device.
So, if the active device is wireless and it has a "forced" best AP, use it
if the "forced" best AP is still valid
- (nm_state_modification_monitor): deal with NULL best devices, for example
there were no usable network devices, or the last one was removed
* src/backends/NetworkManager*.c
- Deal with test devices, mostly just return success for operations like getting
a DHCP address
* test/nmtestdevices.c
- Test tool to create/remove/link-switch test devices
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@112 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-31 16:09:15 +00:00
|
|
|
*/
|
2004-08-26 20:05:24 +00:00
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
if (!old_dev && !new_dev) {
|
2006-01-06 22:04:03 +00:00
|
|
|
; /* Do nothing, wait for something like link-state to change, or an access point to be found */
|
2007-01-04 12:06:26 +00:00
|
|
|
} else if (!old_dev && new_dev) {
|
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
|
|
|
/* Activate new device */
|
2007-10-08 15:09:50 +00:00
|
|
|
nm_info ("SWITCH: no current connection, found better connection '%s (%s)'.",
|
2007-11-15 15:52:42 +00:00
|
|
|
connection ? get_connection_id (connection) : "(none)",
|
2007-10-08 15:09:50 +00:00
|
|
|
nm_device_get_iface (new_dev));
|
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
|
|
|
do_switch = TRUE;
|
2007-01-04 12:06:26 +00:00
|
|
|
} else if (old_dev && !new_dev) {
|
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
|
|
|
/* Terminate current connection */
|
2007-10-08 15:09:50 +00:00
|
|
|
nm_info ("SWITCH: terminating current connection '%s (%s)' because it's"
|
|
|
|
|
" no longer valid.",
|
2007-11-15 15:52:42 +00:00
|
|
|
old_connection ? get_connection_id (old_connection) : "(none)",
|
2007-10-08 15:09:50 +00:00
|
|
|
nm_device_get_iface (old_dev));
|
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
|
|
|
do_switch = TRUE;
|
2007-01-04 12:06:26 +00:00
|
|
|
} else if (old_dev && new_dev) {
|
2007-10-08 15:09:50 +00:00
|
|
|
gboolean old_user_requested = nm_act_request_get_user_requested (old_act_req);
|
|
|
|
|
gboolean old_has_link = nm_device_has_active_link (old_dev);
|
2005-08-17 04:23:25 +00:00
|
|
|
|
2007-02-05 12:14:09 +00:00
|
|
|
if (NM_IS_DEVICE_802_3_ETHERNET (old_dev)) {
|
2006-01-16 19:10:10 +00:00
|
|
|
/* Only switch if the old device was not user requested, and we are switching to
|
2005-08-17 04:23:25 +00:00
|
|
|
* a new device. Note that new_dev will never be wireless since automatic device picking
|
|
|
|
|
* above will prefer a wired device to a wireless device.
|
|
|
|
|
*/
|
2007-01-04 12:06:26 +00:00
|
|
|
if ((!old_user_requested || !old_has_link) && (new_dev != old_dev)) {
|
2007-10-08 15:09:50 +00:00
|
|
|
nm_info ("SWITCH: found better connection '%s (%s)' than "
|
|
|
|
|
" current connection '%s (%s)'.",
|
2007-11-15 15:52:42 +00:00
|
|
|
connection ? get_connection_id (connection) : "(none)",
|
2007-01-04 12:06:26 +00:00
|
|
|
nm_device_get_iface (new_dev),
|
2007-11-15 15:52:42 +00:00
|
|
|
old_connection ? get_connection_id (old_connection) : "(none)",
|
2007-01-04 12:06:26 +00:00
|
|
|
nm_device_get_iface (old_dev));
|
2005-08-17 04:23:25 +00:00
|
|
|
do_switch = TRUE;
|
|
|
|
|
}
|
2007-02-05 12:14:09 +00:00
|
|
|
} else if (NM_IS_DEVICE_802_11_WIRELESS (old_dev)) {
|
2005-08-17 04:23:25 +00:00
|
|
|
/* Only switch if the old device's wireless config is invalid */
|
2007-02-05 12:14:09 +00:00
|
|
|
if (NM_IS_DEVICE_802_11_WIRELESS (new_dev)) {
|
2007-05-07 15:17:45 +00:00
|
|
|
NMAccessPoint *old_ap = nm_device_802_11_wireless_get_activation_ap (NM_DEVICE_802_11_WIRELESS (old_dev));
|
2007-09-21 03:15:47 +00:00
|
|
|
int old_mode = nm_ap_get_mode (old_ap);
|
2007-09-25 06:34:05 +00:00
|
|
|
gboolean same_activating = FALSE;
|
2006-05-28 20:08:11 +00:00
|
|
|
|
2007-09-25 06:34:05 +00:00
|
|
|
/* Don't interrupt activation of a wireless device by
|
|
|
|
|
* trying to auto-activate any connection on that device.
|
2006-05-28 20:08:11 +00:00
|
|
|
*/
|
2007-10-01 15:38:39 +00:00
|
|
|
if (old_dev == new_dev && nm_device_is_activating (new_dev))
|
|
|
|
|
same_activating = TRUE;
|
2006-05-28 20:08:11 +00:00
|
|
|
|
2007-09-25 06:34:05 +00:00
|
|
|
if (!same_activating && !old_has_link && (old_mode != IW_MODE_ADHOC)) {
|
2007-11-07 16:06:43 +00:00
|
|
|
NMSettingConnection * new_sc = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
|
|
|
|
|
NMSettingConnection * old_sc = (NMSettingConnection *) nm_connection_get_setting (old_connection, NM_TYPE_SETTING_CONNECTION);
|
2007-06-27 16:18:52 +00:00
|
|
|
|
2006-01-09 05:11:29 +00:00
|
|
|
nm_info ("SWITCH: found better connection '%s/%s'"
|
|
|
|
|
" than current connection '%s/%s'. "
|
2007-09-21 03:15:47 +00:00
|
|
|
"have_link=%d",
|
2007-06-27 16:18:52 +00:00
|
|
|
nm_device_get_iface (new_dev),
|
2007-11-15 15:52:42 +00:00
|
|
|
new_sc->id,
|
2007-06-27 16:18:52 +00:00
|
|
|
nm_device_get_iface (old_dev),
|
2007-11-15 15:52:42 +00:00
|
|
|
old_sc->id,
|
2007-09-21 03:15:47 +00:00
|
|
|
old_has_link);
|
2005-08-17 04:23:25 +00:00
|
|
|
do_switch = TRUE;
|
|
|
|
|
}
|
2007-02-05 12:14:09 +00:00
|
|
|
} else if (NM_IS_DEVICE_802_3_ETHERNET (new_dev)) {
|
2007-01-04 12:06:26 +00:00
|
|
|
/* Always prefer Ethernet over wireless, unless the user explicitly switched away. */
|
|
|
|
|
if (!old_user_requested)
|
2005-08-17 04:23:25 +00:00
|
|
|
do_switch = TRUE;
|
2005-03-31 Dan Williams <dcbw@redhat.com>
Tighten up handling of wireless devices that don't support wireless
scanning (ie, Orinoco). Due to restructuring of code, these devices
hadn't been doing pseudo-scanning for a while either and would just
spin waiting for an access point. They are now manual devices where
the user must choose the access point from the menu every time. All
"allowed" access points are listed in the applet's menu regardless
of whether or not they can be seen by the card, since it can't scan
anyway.
* src/NetworkManager.c
- (nm_wireless_link_state_handle): new function, but only update
the "best" ap for non-scanning devices when its not activating,
and when no device is being forced on the card
- (nm_link_state_monitor): split wireless link state handling out
into separate function
* src/NetworkManagerDevice.c
- (nm_device_copy_allowed_to_dev_list): new function
- (nm_device_new): populate non-scanning cards' AP lists with
access points from the "allowed" list
- (nm_device_new): don't start a scanning timeout for devices that
can't scan
- (nm_device_activation_schedule_finish): new parameter, should be
the AP that failed to be connected to, pass it on to the
activation finish function in NetworkManagerPolicy.c
- (nm_device_activate_wireless): don't ever try to get a new AP
for non-scanning devices, just fail. The user must choose
a new access point manually.
- (nm_device_activate): grab the AP that failed connection and
pass it on
- (nm_device_update_best_ap): Clear the best AP if we don't have
a link to it, user must manually choose a new one
- (nm_device_do_pseudo_scan): remove function
- (nm_device_wireless_process_scan_results): remove bits for non-
scanning cards since they never get here
- (nm_device_wireless_scan): remove bits for non-scanning devices,
and fake the scan list for test devices a bit earlier
* src/NetworkManagerPolicy.c
- (nm_policy_activation_finish): use the failed_ap that we get
passed rather than getting the best_ap from the card, which
may have changed since we were scheduled
- (nm_policy_allowed_ap_list_update): for non-scanning devices,
update their scan list directly from the allowed list when
we get updates to the allowed list from NetworkManagerInfo
* src/NetworkManagerPolicy.h
- New member for failed access point in NMActivationResult
-------------------------------------
Driver Notification patch: notifies the user when their driver
sucks. Gives them the option to ignore further insertions
of the card that has the sucky driver.
* NetworkManager.h
- Remove the SEMI_SUPPORTED member from the NMDriverSupportLevel
enum and replace it with NO_CARRIER_DETECT and
NO_WIRELESS_SCAN
* panel-applet/NMWirelessApplet.[ch]
- Merge essid.glade -> wireless-applet.glade
- Implement the "Your driver sucks" notification dialog
* panel-applet/NMWirelessAppletDbus.c
- Change stuff from getSupportsCarrierDetect->getDriverSupportLevel
- Grab hardware address for each device from NM too
- Check whether the driver for each device sucks or not whenever
a new device is noticed
* panel-applet/NMWirelessAppletOtherNetworkDialog.c
- Deal with stuff being in wireless-applet.glade now rather than essid.glade
* src/NetworkManager.c
- Fix a double-unref on device removal
* src/NetworkManagerUtils.c
- Set appropriate driver support level on a device that doesn't
support scanning or carrier detection
* src/nm-dbus-device.c
- New "getHWAddress" dbus method on devices
- getSupportsCarrierDetect -> getDriverSupportLevel
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@534 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-31 21:02:21 +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
|
|
|
}
|
|
|
|
|
}
|
2005-01-21 19:32:08 +00:00
|
|
|
|
2007-08-13 01:57:15 +00:00
|
|
|
if (do_switch) {
|
2007-10-06 13:35:28 +00:00
|
|
|
// FIXME: remove old_dev deactivation when multiple device support lands
|
|
|
|
|
if (old_dev)
|
2007-08-13 01:57:15 +00:00
|
|
|
nm_device_interface_deactivate (NM_DEVICE_INTERFACE (old_dev));
|
|
|
|
|
|
2007-12-27 08:06:27 +00:00
|
|
|
if (new_dev) {
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
gboolean success;
|
|
|
|
|
|
|
|
|
|
success = nm_manager_activate_device (policy->manager,
|
|
|
|
|
new_dev,
|
|
|
|
|
connection,
|
|
|
|
|
specific_object,
|
|
|
|
|
FALSE,
|
|
|
|
|
&error);
|
|
|
|
|
if (!success) {
|
|
|
|
|
nm_warning ("Failed to automatically activate device %s: (%d) %s",
|
|
|
|
|
nm_device_get_iface (new_dev),
|
|
|
|
|
error->code,
|
|
|
|
|
error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-01-07 18:07:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
out:
|
2007-10-06 13:35:28 +00:00
|
|
|
if (connection)
|
|
|
|
|
g_object_unref (connection);
|
2005-01-07 18:07:06 +00:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2007-12-06 14:51:43 +00:00
|
|
|
static void
|
|
|
|
|
global_state_changed (NMManager *manager, NMState state, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
if (state == NM_STATE_CONNECTED)
|
|
|
|
|
nm_system_restart_mdns_responder ();
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
static void
|
|
|
|
|
device_change_check_done (gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMPolicy *policy = (NMPolicy *) user_data;
|
|
|
|
|
policy->device_state_changed_idle_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
schedule_change_check (NMPolicy *policy)
|
|
|
|
|
{
|
|
|
|
|
if (policy->device_state_changed_idle_id > 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
policy->device_state_changed_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
|
|
|
|
|
nm_policy_device_change_check,
|
|
|
|
|
policy,
|
|
|
|
|
device_change_check_done);
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-08 18:07:36 +00:00
|
|
|
static NMConnection *
|
|
|
|
|
get_device_connection (NMDevice *device)
|
|
|
|
|
{
|
|
|
|
|
NMActRequest *req;
|
|
|
|
|
|
|
|
|
|
req = nm_device_get_act_request (device);
|
|
|
|
|
if (!req)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
return nm_act_request_get_connection (req);
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
static void
|
|
|
|
|
device_state_changed (NMDevice *device, NMDeviceState state, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMPolicy *policy = (NMPolicy *) user_data;
|
2007-10-08 18:07:36 +00:00
|
|
|
NMConnection *connection = get_device_connection (device);
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2007-10-08 18:07:36 +00:00
|
|
|
if ((state == NM_DEVICE_STATE_FAILED) || (state == NM_DEVICE_STATE_CANCELLED)) {
|
2007-02-08 15:34:26 +00:00
|
|
|
schedule_change_check (policy);
|
2007-10-08 18:07:36 +00:00
|
|
|
|
|
|
|
|
/* Mark the connection invalid so it doesn't get automatically chosen */
|
|
|
|
|
if (connection) {
|
|
|
|
|
g_object_set_data (G_OBJECT (connection), INVALID_TAG, GUINT_TO_POINTER (TRUE));
|
2007-11-15 15:52:42 +00:00
|
|
|
nm_info ("Marking connection '%s' invalid.", get_connection_id (connection));
|
2007-10-08 18:07:36 +00:00
|
|
|
}
|
|
|
|
|
} else if (state == NM_DEVICE_STATE_ACTIVATED) {
|
|
|
|
|
/* Clear the invalid tag on the connection */
|
|
|
|
|
if (connection)
|
|
|
|
|
g_object_set_data (G_OBJECT (connection), INVALID_TAG, NULL);
|
|
|
|
|
}
|
2007-02-08 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
device_carrier_changed (NMDevice *device, gboolean carrier_on, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMPolicy *policy = (NMPolicy *) user_data;
|
|
|
|
|
|
|
|
|
|
schedule_change_check (policy);
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-09 08:50:35 +00:00
|
|
|
static void
|
|
|
|
|
wireless_networks_changed (NMDevice80211Wireless *device, NMAccessPoint *ap, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMPolicy *policy = (NMPolicy *) user_data;
|
|
|
|
|
|
|
|
|
|
schedule_change_check (policy);
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
static void
|
|
|
|
|
device_added (NMManager *manager, NMDevice *device, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMPolicy *policy = (NMPolicy *) user_data;
|
|
|
|
|
|
|
|
|
|
g_signal_connect (device, "state-changed",
|
|
|
|
|
G_CALLBACK (device_state_changed),
|
|
|
|
|
policy);
|
|
|
|
|
|
|
|
|
|
g_signal_connect (device, "carrier-changed",
|
|
|
|
|
G_CALLBACK (device_carrier_changed),
|
|
|
|
|
policy);
|
|
|
|
|
|
|
|
|
|
if (NM_IS_DEVICE_802_11_WIRELESS (device)) {
|
2007-10-03 18:20:35 +00:00
|
|
|
g_signal_connect (device, "access-point-added",
|
2007-02-08 15:34:26 +00:00
|
|
|
G_CALLBACK (wireless_networks_changed),
|
|
|
|
|
policy);
|
2007-10-03 18:20:35 +00:00
|
|
|
g_signal_connect (device, "access-point-removed",
|
2007-02-08 15:34:26 +00:00
|
|
|
G_CALLBACK (wireless_networks_changed),
|
|
|
|
|
policy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
schedule_change_check (policy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
device_removed (NMManager *manager, NMDevice *device, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMPolicy *policy = (NMPolicy *) user_data;
|
|
|
|
|
|
|
|
|
|
schedule_change_check (policy);
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-07 23:33:28 +00:00
|
|
|
static void
|
|
|
|
|
connections_added (NMManager *manager,
|
|
|
|
|
NMConnectionType connection_type,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMPolicy *policy = (NMPolicy *) user_data;
|
|
|
|
|
|
|
|
|
|
schedule_change_check (policy);
|
|
|
|
|
}
|
|
|
|
|
|
2007-05-07 15:17:45 +00:00
|
|
|
static void
|
2007-08-13 01:45:47 +00:00
|
|
|
connection_added (NMManager *manager,
|
|
|
|
|
NMConnection *connection,
|
2007-10-06 04:26:33 +00:00
|
|
|
NMConnectionType connection_type,
|
2007-08-13 01:45:47 +00:00
|
|
|
gpointer user_data)
|
2007-05-07 15:17:45 +00:00
|
|
|
{
|
2007-09-11 23:25:00 +00:00
|
|
|
NMPolicy *policy = (NMPolicy *) user_data;
|
|
|
|
|
|
|
|
|
|
schedule_change_check (policy);
|
2007-08-13 01:45:47 +00:00
|
|
|
}
|
|
|
|
|
|
2007-10-06 04:31:13 +00:00
|
|
|
static void
|
|
|
|
|
connection_updated (NMManager *manager,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
NMConnectionType connection_type,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMPolicy *policy = (NMPolicy *) user_data;
|
|
|
|
|
|
|
|
|
|
schedule_change_check (policy);
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-13 01:45:47 +00:00
|
|
|
static void
|
|
|
|
|
connection_removed (NMManager *manager,
|
|
|
|
|
NMConnection *connection,
|
2007-10-06 04:26:33 +00:00
|
|
|
NMConnectionType connection_type,
|
2007-08-13 01:45:47 +00:00
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
2007-09-11 23:25:00 +00:00
|
|
|
NMPolicy *policy = (NMPolicy *) user_data;
|
2007-10-06 04:26:33 +00:00
|
|
|
GSList *iter;
|
|
|
|
|
|
|
|
|
|
/* If the connection just removed was active, deactive it */
|
|
|
|
|
for (iter = nm_manager_get_devices (manager); iter; iter = g_slist_next (iter)) {
|
|
|
|
|
NMDevice *device = (NMDevice *) iter->data;
|
|
|
|
|
NMActRequest *req = nm_device_get_act_request (device);
|
|
|
|
|
NMConnection *dev_connection;
|
|
|
|
|
|
|
|
|
|
if (!req)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
dev_connection = nm_act_request_get_connection (req);
|
|
|
|
|
if (dev_connection == connection)
|
|
|
|
|
nm_device_interface_deactivate (NM_DEVICE_INTERFACE (device));
|
|
|
|
|
}
|
2007-09-11 23:25:00 +00:00
|
|
|
|
|
|
|
|
schedule_change_check (policy);
|
2007-05-07 15:17:45 +00:00
|
|
|
}
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
NMPolicy *
|
|
|
|
|
nm_policy_new (NMManager *manager)
|
|
|
|
|
{
|
|
|
|
|
NMPolicy *policy;
|
2007-12-06 14:51:43 +00:00
|
|
|
static gboolean initialized = FALSE;
|
2007-02-08 15:34:26 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (NM_IS_MANAGER (manager), NULL);
|
2007-12-06 14:51:43 +00:00
|
|
|
g_return_val_if_fail (initialized == FALSE, NULL);
|
2007-02-08 15:34:26 +00:00
|
|
|
|
|
|
|
|
policy = g_slice_new (NMPolicy);
|
|
|
|
|
policy->manager = g_object_ref (manager);
|
2007-10-10 08:55:22 +00:00
|
|
|
policy->device_state_changed_idle_id = 0;
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2007-12-06 14:51:43 +00:00
|
|
|
g_signal_connect (manager, "state-change", G_CALLBACK (global_state_changed), policy);
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
g_signal_connect (manager, "device-added",
|
|
|
|
|
G_CALLBACK (device_added), policy);
|
|
|
|
|
|
|
|
|
|
g_signal_connect (manager, "device-removed",
|
|
|
|
|
G_CALLBACK (device_removed), policy);
|
|
|
|
|
|
2007-10-07 23:33:28 +00:00
|
|
|
/* Large batch of connections added, manager doesn't want us to
|
|
|
|
|
* process each one individually.
|
|
|
|
|
*/
|
|
|
|
|
g_signal_connect (manager, "connections-added",
|
|
|
|
|
G_CALLBACK (connections_added), policy);
|
|
|
|
|
|
|
|
|
|
/* Single connection added */
|
2007-08-13 01:45:47 +00:00
|
|
|
g_signal_connect (manager, "connection-added",
|
|
|
|
|
G_CALLBACK (connection_added), policy);
|
|
|
|
|
|
2007-10-06 04:31:13 +00:00
|
|
|
g_signal_connect (manager, "connection-updated",
|
|
|
|
|
G_CALLBACK (connection_updated), policy);
|
|
|
|
|
|
2007-08-13 01:45:47 +00:00
|
|
|
g_signal_connect (manager, "connection-removed",
|
|
|
|
|
G_CALLBACK (connection_removed), policy);
|
2007-05-07 15:17:45 +00:00
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
return policy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
nm_policy_destroy (NMPolicy *policy)
|
|
|
|
|
{
|
|
|
|
|
if (policy) {
|
|
|
|
|
g_object_unref (policy->manager);
|
|
|
|
|
g_slice_free (NMPolicy, policy);
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-08-15 01:59:19 +00:00
|
|
|
|