2008-11-03 04:13:42 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
*
|
2009-05-20 12:02:18 -04:00
|
|
|
* Copyright (C) 2007 - 2009 Novell, Inc.
|
|
|
|
|
* Copyright (C) 2007 - 2009 Red Hat, Inc.
|
2008-11-03 04:13:42 +00:00
|
|
|
*/
|
2007-08-15 07:52:25 +00:00
|
|
|
|
2007-10-09 08:57:35 +00:00
|
|
|
#include <netinet/ether.h>
|
2007-02-08 15:34:26 +00:00
|
|
|
#include <string.h>
|
2008-11-21 18:11:15 +00:00
|
|
|
#include <dbus/dbus-glib-lowlevel.h>
|
|
|
|
|
#include <dbus/dbus-glib.h>
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2008-12-31 18:57:36 -05:00
|
|
|
#include "nm-glib-compat.h"
|
2007-02-08 15:34:26 +00:00
|
|
|
#include "nm-manager.h"
|
|
|
|
|
#include "nm-utils.h"
|
|
|
|
|
#include "nm-dbus-manager.h"
|
2008-03-26 13:43:01 +00:00
|
|
|
#include "nm-vpn-manager.h"
|
2009-01-19 11:01:00 +02:00
|
|
|
#include "nm-modem-manager.h"
|
2009-05-14 13:59:03 -04:00
|
|
|
#include "nm-device-bt.h"
|
2007-02-09 08:50:35 +00:00
|
|
|
#include "nm-device-interface.h"
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
#include "nm-device-private.h"
|
2009-02-16 18:47:03 -05:00
|
|
|
#include "nm-device-ethernet.h"
|
2008-06-10 16:32:39 +00:00
|
|
|
#include "nm-device-wifi.h"
|
2007-02-08 15:34:26 +00:00
|
|
|
#include "NetworkManagerSystem.h"
|
2007-10-15 14:46:37 +00:00
|
|
|
#include "nm-properties-changed-signal.h"
|
2009-05-14 13:59:03 -04:00
|
|
|
#include "nm-setting-bluetooth.h"
|
2007-11-07 16:06:43 +00:00
|
|
|
#include "nm-setting-connection.h"
|
|
|
|
|
#include "nm-setting-wireless.h"
|
2008-03-26 13:43:01 +00:00
|
|
|
#include "nm-setting-vpn.h"
|
2007-10-01 15:38:39 +00:00
|
|
|
#include "nm-marshal.h"
|
2008-03-29 21:35:41 +00:00
|
|
|
#include "nm-dbus-glib-types.h"
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
#include "nm-hal-manager.h"
|
2009-03-16 14:31:28 +02:00
|
|
|
#include "nm-hostname-provider.h"
|
2009-05-13 21:32:56 -04:00
|
|
|
#include "nm-bluez-manager.h"
|
|
|
|
|
#include "nm-bluez-common.h"
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2008-07-09 14:05:49 +00:00
|
|
|
#define NM_AUTOIP_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd"
|
|
|
|
|
#define NM_AUTOIP_DBUS_IFACE "org.freedesktop.nm_avahi_autoipd"
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
static gboolean impl_manager_get_devices (NMManager *manager, GPtrArray **devices, GError **err);
|
2008-03-19 20:58:21 +00:00
|
|
|
static void impl_manager_activate_connection (NMManager *manager,
|
2008-03-20 19:56:12 +00:00
|
|
|
const char *service_name,
|
|
|
|
|
const char *connection_path,
|
|
|
|
|
const char *device_path,
|
|
|
|
|
const char *specific_object_path,
|
2007-10-01 15:38:39 +00:00
|
|
|
DBusGMethodInvocation *context);
|
|
|
|
|
|
2008-03-20 19:56:12 +00:00
|
|
|
static gboolean impl_manager_deactivate_connection (NMManager *manager,
|
|
|
|
|
const char *connection_path,
|
|
|
|
|
GError **error);
|
2007-10-03 14:48:25 +00:00
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
static gboolean impl_manager_sleep (NMManager *manager, gboolean sleep, GError **err);
|
|
|
|
|
|
2008-02-06 16:50:43 +00:00
|
|
|
static gboolean poke_system_settings_daemon_cb (gpointer user_data);
|
|
|
|
|
|
2007-08-15 07:52:25 +00:00
|
|
|
/* Legacy 0.6 compatibility interface */
|
|
|
|
|
|
|
|
|
|
static gboolean impl_manager_legacy_sleep (NMManager *manager, GError **err);
|
|
|
|
|
static gboolean impl_manager_legacy_wake (NMManager *manager, GError **err);
|
2007-09-24 21:26:56 +00:00
|
|
|
static gboolean impl_manager_legacy_state (NMManager *manager, guint32 *state, GError **err);
|
2007-08-15 07:52:25 +00:00
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
#include "nm-manager-glue.h"
|
|
|
|
|
|
2008-02-20 22:37:39 +00:00
|
|
|
static void nm_manager_connections_destroy (NMManager *manager, NMConnectionScope scope);
|
2007-02-08 15:34:26 +00:00
|
|
|
static void manager_set_wireless_enabled (NMManager *manager, gboolean enabled);
|
|
|
|
|
|
2007-10-01 15:38:39 +00:00
|
|
|
static void connection_added_default_handler (NMManager *manager,
|
|
|
|
|
NMConnection *connection,
|
2008-02-20 22:37:39 +00:00
|
|
|
NMConnectionScope scope);
|
2007-10-01 15:38:39 +00:00
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
static void hal_manager_udi_added_cb (NMHalManager *hal_mgr,
|
|
|
|
|
const char *udi,
|
2009-02-16 18:47:03 -05:00
|
|
|
const char *originating_device,
|
|
|
|
|
gpointer general_type_ptr,
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
NMDeviceCreatorFn creator_fn,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
|
|
static void hal_manager_udi_removed_cb (NMHalManager *hal_mgr,
|
|
|
|
|
const char *udi,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
|
|
static void hal_manager_rfkill_changed_cb (NMHalManager *hal_mgr,
|
2009-02-10 23:06:24 -05:00
|
|
|
RfKillState state,
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
|
|
static void hal_manager_hal_reappeared_cb (NMHalManager *hal_mgr,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
2009-05-13 21:32:56 -04:00
|
|
|
static void bluez_manager_bdaddr_added_cb (NMBluezManager *bluez_mgr,
|
|
|
|
|
const char *bdaddr,
|
2009-05-14 13:59:03 -04:00
|
|
|
const char *name,
|
|
|
|
|
const char *object_path,
|
|
|
|
|
guint32 uuids,
|
|
|
|
|
NMManager *manager);
|
2009-05-13 21:32:56 -04:00
|
|
|
|
|
|
|
|
static void bluez_manager_bdaddr_removed_cb (NMBluezManager *bluez_mgr,
|
|
|
|
|
const char *bdaddr,
|
2009-05-14 13:59:03 -04:00
|
|
|
const char *object_path,
|
2009-05-13 21:32:56 -04:00
|
|
|
gpointer user_data);
|
|
|
|
|
|
2009-05-20 12:02:18 -04:00
|
|
|
static void bluez_manager_resync_devices (NMManager *self);
|
|
|
|
|
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
static void system_settings_properties_changed_cb (DBusGProxy *proxy,
|
|
|
|
|
GHashTable *properties,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
2009-02-16 18:47:03 -05:00
|
|
|
static void add_device (NMManager *self, NMDevice *device);
|
2009-01-19 11:01:00 +02:00
|
|
|
|
2009-03-16 14:31:28 +02:00
|
|
|
static void hostname_provider_init (NMHostnameProvider *provider_class);
|
|
|
|
|
|
2008-12-31 18:57:36 -05:00
|
|
|
#define SSD_POKE_INTERVAL 120
|
2009-02-16 18:47:03 -05:00
|
|
|
#define ORIGDEV_TAG "originating-device"
|
2007-10-01 15:38:39 +00:00
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
DBusGMethodInvocation *context;
|
2008-02-20 22:37:39 +00:00
|
|
|
NMConnectionScope scope;
|
2007-10-01 15:38:39 +00:00
|
|
|
char *connection_path;
|
|
|
|
|
char *specific_object_path;
|
2008-03-26 13:43:01 +00:00
|
|
|
char *device_path;
|
2007-10-01 15:38:39 +00:00
|
|
|
guint timeout_id;
|
|
|
|
|
} PendingConnectionInfo;
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
typedef struct {
|
|
|
|
|
GSList *devices;
|
2007-09-25 16:47:53 +00:00
|
|
|
NMState state;
|
2007-09-09 22:18:42 +00:00
|
|
|
|
2008-01-02 13:42:52 +00:00
|
|
|
NMDBusManager *dbus_mgr;
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
NMHalManager *hal_mgr;
|
2009-05-13 21:32:56 -04:00
|
|
|
NMBluezManager *bluez_mgr;
|
2008-01-02 13:42:52 +00:00
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
GHashTable *user_connections;
|
|
|
|
|
DBusGProxy *user_proxy;
|
2007-09-09 22:18:42 +00:00
|
|
|
|
|
|
|
|
GHashTable *system_connections;
|
|
|
|
|
DBusGProxy *system_proxy;
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
DBusGProxy *system_props_proxy;
|
|
|
|
|
GSList *unmanaged_udis;
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
char *hostname;
|
2007-09-09 22:18:42 +00:00
|
|
|
|
2007-10-01 15:38:39 +00:00
|
|
|
PendingConnectionInfo *pending_connection_info;
|
2007-02-08 15:34:26 +00:00
|
|
|
gboolean wireless_enabled;
|
2007-10-15 14:46:37 +00:00
|
|
|
gboolean wireless_hw_enabled;
|
2007-02-08 15:34:26 +00:00
|
|
|
gboolean sleeping;
|
2008-02-06 16:50:43 +00:00
|
|
|
|
|
|
|
|
guint poke_id;
|
2008-05-22 14:22:31 +00:00
|
|
|
guint sync_devices_id;
|
2008-03-26 13:43:01 +00:00
|
|
|
|
|
|
|
|
NMVPNManager *vpn_manager;
|
|
|
|
|
guint vpn_manager_id;
|
|
|
|
|
|
2009-01-19 11:01:00 +02:00
|
|
|
NMModemManager *modem_manager;
|
|
|
|
|
guint modem_added_id;
|
|
|
|
|
guint modem_removed_id;
|
|
|
|
|
|
2008-07-09 14:05:49 +00:00
|
|
|
DBusGProxy *aipd_proxy;
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
gboolean disposed;
|
2007-02-08 15:34:26 +00:00
|
|
|
} NMManagerPrivate;
|
|
|
|
|
|
|
|
|
|
#define NM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MANAGER, NMManagerPrivate))
|
|
|
|
|
|
2009-03-16 14:31:28 +02:00
|
|
|
G_DEFINE_TYPE_EXTENDED (NMManager, nm_manager, G_TYPE_OBJECT, 0,
|
|
|
|
|
G_IMPLEMENT_INTERFACE (NM_TYPE_HOSTNAME_PROVIDER,
|
|
|
|
|
hostname_provider_init))
|
2007-02-08 15:34:26 +00:00
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
DEVICE_ADDED,
|
|
|
|
|
DEVICE_REMOVED,
|
2008-03-07 23:17:48 +00:00
|
|
|
STATE_CHANGED,
|
|
|
|
|
STATE_CHANGE, /* DEPRECATED */
|
2007-10-15 14:46:37 +00:00
|
|
|
PROPERTIES_CHANGED,
|
2007-10-07 23:33:28 +00:00
|
|
|
CONNECTIONS_ADDED,
|
2007-06-22 15:09:02 +00:00
|
|
|
CONNECTION_ADDED,
|
2007-10-06 04:28:46 +00:00
|
|
|
CONNECTION_UPDATED,
|
2007-06-22 15:09:02 +00:00
|
|
|
CONNECTION_REMOVED,
|
2007-02-08 15:34:26 +00:00
|
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_STATE,
|
|
|
|
|
PROP_WIRELESS_ENABLED,
|
2007-10-15 14:46:37 +00:00
|
|
|
PROP_WIRELESS_HARDWARE_ENABLED,
|
2008-03-20 19:56:12 +00:00
|
|
|
PROP_ACTIVE_CONNECTIONS,
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
/* Not exported */
|
|
|
|
|
PROP_HOSTNAME,
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
LAST_PROP
|
|
|
|
|
};
|
|
|
|
|
|
2007-12-27 08:06:27 +00:00
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
NM_MANAGER_ERROR_UNKNOWN_CONNECTION = 0,
|
|
|
|
|
NM_MANAGER_ERROR_UNKNOWN_DEVICE,
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
NM_MANAGER_ERROR_UNMANAGED_DEVICE,
|
2007-12-27 08:06:27 +00:00
|
|
|
NM_MANAGER_ERROR_INVALID_SERVICE,
|
|
|
|
|
NM_MANAGER_ERROR_SYSTEM_CONNECTION,
|
|
|
|
|
NM_MANAGER_ERROR_PERMISSION_DENIED,
|
2008-03-20 19:56:12 +00:00
|
|
|
NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE,
|
2008-04-29 15:19:31 +00:00
|
|
|
NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE,
|
2007-12-27 08:06:27 +00:00
|
|
|
} NMManagerError;
|
|
|
|
|
|
|
|
|
|
#define NM_MANAGER_ERROR (nm_manager_error_quark ())
|
|
|
|
|
#define NM_TYPE_MANAGER_ERROR (nm_manager_error_get_type ())
|
|
|
|
|
|
|
|
|
|
static GQuark
|
|
|
|
|
nm_manager_error_quark (void)
|
|
|
|
|
{
|
|
|
|
|
static GQuark quark = 0;
|
|
|
|
|
if (!quark)
|
|
|
|
|
quark = g_quark_from_static_string ("nm-manager-error");
|
|
|
|
|
return quark;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This should really be standard. */
|
|
|
|
|
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
|
|
|
|
|
|
|
|
|
|
static GType
|
|
|
|
|
nm_manager_error_get_type (void)
|
|
|
|
|
{
|
|
|
|
|
static GType etype = 0;
|
|
|
|
|
|
|
|
|
|
if (etype == 0) {
|
|
|
|
|
static const GEnumValue values[] = {
|
|
|
|
|
/* Connection was not provided by any known settings service. */
|
|
|
|
|
ENUM_ENTRY (NM_MANAGER_ERROR_UNKNOWN_CONNECTION, "UnknownConnection"),
|
|
|
|
|
/* Unknown device. */
|
|
|
|
|
ENUM_ENTRY (NM_MANAGER_ERROR_UNKNOWN_DEVICE, "UnknownDevice"),
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
/* Unmanaged device. */
|
|
|
|
|
ENUM_ENTRY (NM_MANAGER_ERROR_UNMANAGED_DEVICE, "UnmanagedDevice"),
|
2007-12-27 08:06:27 +00:00
|
|
|
/* Invalid settings service (not a recognized system or user
|
|
|
|
|
* settings service name)
|
|
|
|
|
*/
|
|
|
|
|
ENUM_ENTRY (NM_MANAGER_ERROR_INVALID_SERVICE, "InvalidService"),
|
|
|
|
|
/* Connection was superceded by a system connection. */
|
|
|
|
|
ENUM_ENTRY (NM_MANAGER_ERROR_SYSTEM_CONNECTION, "SystemConnection"),
|
|
|
|
|
/* User does not have the permission to activate this connection. */
|
|
|
|
|
ENUM_ENTRY (NM_MANAGER_ERROR_PERMISSION_DENIED, "PermissionDenied"),
|
2008-03-20 19:56:12 +00:00
|
|
|
/* The connection was not active. */
|
|
|
|
|
ENUM_ENTRY (NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE, "ConnectionNotActive"),
|
2008-04-30 15:39:11 +00:00
|
|
|
/* The manager is already in the requested sleep state */
|
2008-04-29 15:19:31 +00:00
|
|
|
ENUM_ENTRY (NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE, "AlreadyAsleepOrAwake"),
|
|
|
|
|
{ 0, 0, 0 },
|
2007-12-27 08:06:27 +00:00
|
|
|
};
|
|
|
|
|
etype = g_enum_register_static ("NMManagerError", values);
|
|
|
|
|
}
|
|
|
|
|
return etype;
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
static void
|
|
|
|
|
vpn_manager_connection_deactivated_cb (NMVPNManager *manager,
|
|
|
|
|
NMVPNConnection *vpn,
|
|
|
|
|
NMVPNConnectionState state,
|
|
|
|
|
NMVPNConnectionStateReason reason,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
g_object_notify (G_OBJECT (user_data), NM_MANAGER_ACTIVE_CONNECTIONS);
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-19 11:01:00 +02:00
|
|
|
static void
|
|
|
|
|
modem_added (NMModemManager *modem_manager,
|
|
|
|
|
NMDevice *modem,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMDeviceType type;
|
|
|
|
|
const char *type_name;
|
|
|
|
|
|
|
|
|
|
type = nm_device_get_device_type (NM_DEVICE (modem));
|
|
|
|
|
if (type == NM_DEVICE_TYPE_GSM)
|
|
|
|
|
type_name = "GSM modem";
|
|
|
|
|
else if (type == NM_DEVICE_TYPE_CDMA)
|
|
|
|
|
type_name = "CDMA modem";
|
|
|
|
|
else
|
|
|
|
|
type_name = "Unknown modem";
|
|
|
|
|
|
2009-02-16 18:47:03 -05:00
|
|
|
add_device (NM_MANAGER (user_data), NM_DEVICE (g_object_ref (modem)));
|
2009-01-19 11:01:00 +02:00
|
|
|
}
|
|
|
|
|
|
2009-05-20 12:02:18 -04:00
|
|
|
static void
|
|
|
|
|
nm_manager_update_state (NMManager *manager)
|
|
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv;
|
|
|
|
|
NMState new_state = NM_STATE_DISCONNECTED;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_MANAGER (manager));
|
|
|
|
|
|
|
|
|
|
priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
|
|
|
|
|
if (priv->sleeping) {
|
|
|
|
|
new_state = NM_STATE_ASLEEP;
|
|
|
|
|
} else {
|
|
|
|
|
GSList *iter;
|
|
|
|
|
|
|
|
|
|
for (iter = priv->devices; iter; iter = iter->next) {
|
|
|
|
|
NMDevice *dev = NM_DEVICE (iter->data);
|
|
|
|
|
|
|
|
|
|
if (nm_device_get_state (dev) == NM_DEVICE_STATE_ACTIVATED) {
|
|
|
|
|
new_state = NM_STATE_CONNECTED;
|
|
|
|
|
break;
|
|
|
|
|
} else if (nm_device_is_activating (dev)) {
|
|
|
|
|
new_state = NM_STATE_CONNECTING;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (priv->state != new_state) {
|
|
|
|
|
priv->state = new_state;
|
|
|
|
|
g_object_notify (G_OBJECT (manager), NM_MANAGER_STATE);
|
|
|
|
|
|
|
|
|
|
g_signal_emit (manager, signals[STATE_CHANGED], 0, priv->state);
|
|
|
|
|
|
|
|
|
|
/* Emit StateChange too for backwards compatibility */
|
|
|
|
|
g_signal_emit (manager, signals[STATE_CHANGE], 0, priv->state);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
manager_device_state_changed (NMDevice *device,
|
|
|
|
|
NMDeviceState new_state,
|
|
|
|
|
NMDeviceState old_state,
|
|
|
|
|
NMDeviceStateReason reason,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMManager *manager = NM_MANAGER (user_data);
|
|
|
|
|
|
|
|
|
|
switch (new_state) {
|
|
|
|
|
case NM_DEVICE_STATE_UNMANAGED:
|
|
|
|
|
case NM_DEVICE_STATE_UNAVAILABLE:
|
|
|
|
|
case NM_DEVICE_STATE_DISCONNECTED:
|
|
|
|
|
case NM_DEVICE_STATE_PREPARE:
|
|
|
|
|
case NM_DEVICE_STATE_FAILED:
|
|
|
|
|
g_object_notify (G_OBJECT (manager), NM_MANAGER_ACTIVE_CONNECTIONS);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nm_manager_update_state (manager);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Removes a device from a device list; returns the start of the new device list */
|
|
|
|
|
static GSList *
|
|
|
|
|
remove_one_device (NMManager *manager, GSList *list, NMDevice *device)
|
|
|
|
|
{
|
|
|
|
|
if (nm_device_get_managed (device))
|
|
|
|
|
nm_device_set_managed (device, FALSE, NM_DEVICE_STATE_REASON_REMOVED);
|
|
|
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (device, manager_device_state_changed, manager);
|
|
|
|
|
|
|
|
|
|
g_signal_emit (manager, signals[DEVICE_REMOVED], 0, device);
|
|
|
|
|
g_object_unref (device);
|
|
|
|
|
|
|
|
|
|
return g_slist_remove (list, device);
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-19 11:01:00 +02:00
|
|
|
static void
|
|
|
|
|
modem_removed (NMModemManager *modem_manager,
|
|
|
|
|
NMDevice *modem,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
2009-05-20 12:02:18 -04:00
|
|
|
NMManager *self = NM_MANAGER (user_data);
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
2009-01-19 11:01:00 +02:00
|
|
|
|
2009-05-20 12:02:18 -04:00
|
|
|
priv->devices = remove_one_device (self, priv->devices, modem);
|
2009-01-19 11:01:00 +02:00
|
|
|
}
|
|
|
|
|
|
2008-07-09 14:05:49 +00:00
|
|
|
static void
|
|
|
|
|
aipd_handle_event (DBusGProxy *proxy,
|
|
|
|
|
const char *event,
|
|
|
|
|
const char *iface,
|
|
|
|
|
const char *address,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMManager *manager = NM_MANAGER (user_data);
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
GSList *iter;
|
|
|
|
|
gboolean handled;
|
|
|
|
|
|
|
|
|
|
if (!event || !iface) {
|
|
|
|
|
nm_warning ("Incomplete message received from avahi-autoipd");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (strcmp (event, "BIND") != 0)
|
|
|
|
|
&& (strcmp (event, "CONFLICT") != 0)
|
|
|
|
|
&& (strcmp (event, "UNBIND") != 0)
|
|
|
|
|
&& (strcmp (event, "STOP") != 0)) {
|
|
|
|
|
nm_warning ("Unknown event '%s' received from avahi-autoipd", event);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
|
|
|
|
|
NMDevice *candidate = NM_DEVICE (iter->data);
|
|
|
|
|
|
|
|
|
|
if (!strcmp (nm_device_get_iface (candidate), iface)) {
|
|
|
|
|
nm_device_handle_autoip4_event (candidate, event, address);
|
|
|
|
|
handled = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!handled)
|
|
|
|
|
nm_warning ("Unhandled avahi-autoipd event for '%s'", iface);
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-16 14:31:28 +02:00
|
|
|
static const char *
|
|
|
|
|
hostname_provider_get_hostname (NMHostnameProvider *provider)
|
|
|
|
|
{
|
|
|
|
|
return NM_MANAGER_GET_PRIVATE (provider)->hostname;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
hostname_provider_init (NMHostnameProvider *provider_class)
|
|
|
|
|
{
|
|
|
|
|
provider_class->get_hostname = hostname_provider_get_hostname;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
static void
|
2007-02-09 08:50:35 +00:00
|
|
|
nm_manager_init (NMManager *manager)
|
2007-02-08 15:34:26 +00:00
|
|
|
{
|
2007-02-09 08:50:35 +00:00
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
2008-07-09 14:05:49 +00:00
|
|
|
DBusGConnection *g_connection;
|
2008-03-26 13:43:01 +00:00
|
|
|
guint id;
|
2007-02-09 08:50:35 +00:00
|
|
|
|
|
|
|
|
priv->wireless_enabled = TRUE;
|
2007-10-15 14:46:37 +00:00
|
|
|
priv->wireless_hw_enabled = TRUE;
|
2007-02-09 08:50:35 +00:00
|
|
|
priv->sleeping = FALSE;
|
2007-09-25 16:47:53 +00:00
|
|
|
priv->state = NM_STATE_DISCONNECTED;
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2008-01-02 13:42:52 +00:00
|
|
|
priv->dbus_mgr = nm_dbus_manager_get ();
|
|
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
priv->user_connections = g_hash_table_new_full (g_str_hash,
|
|
|
|
|
g_str_equal,
|
|
|
|
|
g_free,
|
|
|
|
|
g_object_unref);
|
2007-09-09 22:18:42 +00:00
|
|
|
|
|
|
|
|
priv->system_connections = g_hash_table_new_full (g_str_hash,
|
|
|
|
|
g_str_equal,
|
|
|
|
|
g_free,
|
|
|
|
|
g_object_unref);
|
2008-03-26 13:43:01 +00:00
|
|
|
|
2009-01-19 11:01:00 +02:00
|
|
|
priv->modem_manager = nm_modem_manager_get ();
|
|
|
|
|
priv->modem_added_id = g_signal_connect (priv->modem_manager, "device-added",
|
|
|
|
|
G_CALLBACK (modem_added), manager);
|
|
|
|
|
priv->modem_removed_id = g_signal_connect (priv->modem_manager, "device-removed",
|
|
|
|
|
G_CALLBACK (modem_removed), manager);
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
priv->vpn_manager = nm_vpn_manager_get ();
|
|
|
|
|
id = g_signal_connect (G_OBJECT (priv->vpn_manager), "connection-deactivated",
|
|
|
|
|
G_CALLBACK (vpn_manager_connection_deactivated_cb), manager);
|
|
|
|
|
priv->vpn_manager_id = id;
|
2008-07-09 14:05:49 +00:00
|
|
|
|
|
|
|
|
g_connection = nm_dbus_manager_get_connection (priv->dbus_mgr);
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
|
|
|
|
|
/* avahi-autoipd stuff */
|
2008-07-09 14:05:49 +00:00
|
|
|
priv->aipd_proxy = dbus_g_proxy_new_for_name (g_connection,
|
|
|
|
|
NM_AUTOIP_DBUS_SERVICE,
|
|
|
|
|
"/",
|
|
|
|
|
NM_AUTOIP_DBUS_IFACE);
|
|
|
|
|
if (priv->aipd_proxy) {
|
2008-08-26 09:34:31 +00:00
|
|
|
dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_STRING_STRING,
|
2008-07-09 14:05:49 +00:00
|
|
|
G_TYPE_NONE,
|
|
|
|
|
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
|
|
|
|
|
G_TYPE_INVALID);
|
|
|
|
|
|
|
|
|
|
dbus_g_proxy_add_signal (priv->aipd_proxy,
|
|
|
|
|
"Event",
|
|
|
|
|
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
|
|
|
|
|
G_TYPE_INVALID);
|
|
|
|
|
|
|
|
|
|
dbus_g_proxy_connect_signal (priv->aipd_proxy, "Event",
|
|
|
|
|
G_CALLBACK (aipd_handle_event),
|
|
|
|
|
manager,
|
|
|
|
|
NULL);
|
|
|
|
|
} else
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
nm_warning ("%s: could not initialize avahi-autoipd D-Bus proxy", __func__);
|
|
|
|
|
|
|
|
|
|
/* System settings stuff */
|
|
|
|
|
priv->system_props_proxy = dbus_g_proxy_new_for_name (g_connection,
|
|
|
|
|
NM_DBUS_SERVICE_SYSTEM_SETTINGS,
|
|
|
|
|
NM_DBUS_PATH_SETTINGS,
|
|
|
|
|
"org.freedesktop.NetworkManagerSettings.System");
|
|
|
|
|
if (priv->system_props_proxy) {
|
|
|
|
|
dbus_g_object_register_marshaller (g_cclosure_marshal_VOID__BOXED,
|
|
|
|
|
G_TYPE_NONE, G_TYPE_VALUE, G_TYPE_INVALID);
|
|
|
|
|
dbus_g_proxy_add_signal (priv->system_props_proxy, "PropertiesChanged",
|
|
|
|
|
DBUS_TYPE_G_MAP_OF_VARIANT, G_TYPE_INVALID);
|
|
|
|
|
dbus_g_proxy_connect_signal (priv->system_props_proxy, "PropertiesChanged",
|
|
|
|
|
G_CALLBACK (system_settings_properties_changed_cb),
|
|
|
|
|
manager,
|
|
|
|
|
NULL);
|
|
|
|
|
} else
|
|
|
|
|
nm_warning ("%s: could not initialize system settings properties D-Bus proxy", __func__);
|
2007-02-08 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
|
2007-09-25 16:47:53 +00:00
|
|
|
NMState
|
|
|
|
|
nm_manager_get_state (NMManager *manager)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_MANAGER (manager), NM_STATE_UNKNOWN);
|
|
|
|
|
|
|
|
|
|
return NM_MANAGER_GET_PRIVATE (manager)->state;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-01 15:38:39 +00:00
|
|
|
static void
|
2007-10-08 16:27:07 +00:00
|
|
|
pending_connection_info_destroy (PendingConnectionInfo *info)
|
2007-10-01 15:38:39 +00:00
|
|
|
{
|
|
|
|
|
if (!info)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (info->timeout_id)
|
|
|
|
|
g_source_remove (info->timeout_id);
|
|
|
|
|
|
|
|
|
|
g_free (info->connection_path);
|
|
|
|
|
g_free (info->specific_object_path);
|
2008-03-26 13:43:01 +00:00
|
|
|
g_free (info->device_path);
|
2007-10-01 15:38:39 +00:00
|
|
|
|
|
|
|
|
g_slice_free (PendingConnectionInfo, info);
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
static void
|
2008-03-26 13:43:01 +00:00
|
|
|
dispose (GObject *object)
|
2007-02-08 15:34:26 +00:00
|
|
|
{
|
2007-03-05 08:49:30 +00:00
|
|
|
NMManager *manager = NM_MANAGER (object);
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
if (priv->disposed) {
|
|
|
|
|
G_OBJECT_CLASS (nm_manager_parent_class)->dispose (object);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
priv->disposed = TRUE;
|
|
|
|
|
|
2007-10-08 16:27:07 +00:00
|
|
|
pending_connection_info_destroy (priv->pending_connection_info);
|
|
|
|
|
priv->pending_connection_info = NULL;
|
2007-10-01 15:38:39 +00:00
|
|
|
|
2008-05-22 14:22:31 +00:00
|
|
|
if (priv->sync_devices_id) {
|
|
|
|
|
g_source_remove (priv->sync_devices_id);
|
|
|
|
|
priv->sync_devices_id = 0;
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (g_slist_length (priv->devices)) {
|
2009-05-20 12:02:18 -04:00
|
|
|
NMDevice *device = NM_DEVICE (priv->devices->data);
|
|
|
|
|
|
|
|
|
|
priv->devices = remove_one_device (manager, priv->devices, device);
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
}
|
2008-02-06 16:50:43 +00:00
|
|
|
|
2008-02-20 22:37:39 +00:00
|
|
|
nm_manager_connections_destroy (manager, NM_CONNECTION_SCOPE_USER);
|
2007-09-06 19:13:00 +00:00
|
|
|
g_hash_table_destroy (priv->user_connections);
|
|
|
|
|
priv->user_connections = NULL;
|
2007-06-22 15:09:02 +00:00
|
|
|
|
2008-02-20 22:37:39 +00:00
|
|
|
nm_manager_connections_destroy (manager, NM_CONNECTION_SCOPE_SYSTEM);
|
2007-09-09 22:18:42 +00:00
|
|
|
g_hash_table_destroy (priv->system_connections);
|
|
|
|
|
priv->system_connections = NULL;
|
|
|
|
|
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
g_free (priv->hostname);
|
|
|
|
|
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
if (priv->system_props_proxy) {
|
|
|
|
|
g_object_unref (priv->system_props_proxy);
|
|
|
|
|
priv->system_props_proxy = NULL;
|
|
|
|
|
}
|
|
|
|
|
g_slist_foreach (priv->unmanaged_udis, (GFunc) g_free, NULL);
|
|
|
|
|
g_slist_free (priv->unmanaged_udis);
|
|
|
|
|
|
2008-02-06 16:50:43 +00:00
|
|
|
if (priv->poke_id) {
|
|
|
|
|
g_source_remove (priv->poke_id);
|
|
|
|
|
priv->poke_id = 0;
|
|
|
|
|
}
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
if (priv->vpn_manager_id) {
|
|
|
|
|
g_source_remove (priv->vpn_manager_id);
|
|
|
|
|
priv->vpn_manager_id = 0;
|
|
|
|
|
}
|
|
|
|
|
g_object_unref (priv->vpn_manager);
|
|
|
|
|
|
2009-01-19 11:01:00 +02:00
|
|
|
if (priv->modem_added_id) {
|
|
|
|
|
g_source_remove (priv->modem_added_id);
|
|
|
|
|
priv->modem_added_id = 0;
|
|
|
|
|
}
|
|
|
|
|
if (priv->modem_removed_id) {
|
|
|
|
|
g_source_remove (priv->modem_removed_id);
|
|
|
|
|
priv->modem_removed_id = 0;
|
|
|
|
|
}
|
|
|
|
|
g_object_unref (priv->modem_manager);
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
g_object_unref (priv->dbus_mgr);
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
g_object_unref (priv->hal_mgr);
|
2009-05-13 21:32:56 -04:00
|
|
|
g_object_unref (priv->bluez_mgr);
|
2008-01-02 13:42:52 +00:00
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
G_OBJECT_CLASS (nm_manager_parent_class)->dispose (object);
|
2007-02-08 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_property (GObject *object, guint prop_id,
|
|
|
|
|
const GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_WIRELESS_ENABLED:
|
|
|
|
|
manager_set_wireless_enabled (NM_MANAGER (object), g_value_get_boolean (value));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
static GPtrArray *
|
|
|
|
|
get_active_connections (NMManager *manager, NMConnection *filter)
|
|
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
NMVPNManager *vpn_manager;
|
|
|
|
|
GPtrArray *active;
|
|
|
|
|
GSList *iter;
|
|
|
|
|
|
|
|
|
|
active = g_ptr_array_sized_new (3);
|
|
|
|
|
|
|
|
|
|
/* Add active device connections */
|
|
|
|
|
for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
|
|
|
|
|
NMActRequest *req;
|
|
|
|
|
const char *path;
|
|
|
|
|
|
|
|
|
|
req = nm_device_get_act_request (NM_DEVICE (iter->data));
|
|
|
|
|
if (!req)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (!filter || (nm_act_request_get_connection (req) == filter)) {
|
|
|
|
|
path = nm_act_request_get_active_connection_path (req);
|
|
|
|
|
g_ptr_array_add (active, g_strdup (path));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add active VPN connections */
|
|
|
|
|
vpn_manager = nm_vpn_manager_get ();
|
|
|
|
|
nm_vpn_manager_add_active_connections (vpn_manager, filter, active);
|
|
|
|
|
g_object_unref (vpn_manager);
|
|
|
|
|
|
|
|
|
|
return active;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
static void
|
|
|
|
|
get_property (GObject *object, guint prop_id,
|
|
|
|
|
GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
2008-03-26 13:43:01 +00:00
|
|
|
NMManager *self = NM_MANAGER (object);
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
2007-02-08 15:34:26 +00:00
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_STATE:
|
2008-03-26 13:43:01 +00:00
|
|
|
nm_manager_update_state (self);
|
2007-09-25 16:47:53 +00:00
|
|
|
g_value_set_uint (value, priv->state);
|
2007-02-08 15:34:26 +00:00
|
|
|
break;
|
|
|
|
|
case PROP_WIRELESS_ENABLED:
|
|
|
|
|
g_value_set_boolean (value, priv->wireless_enabled);
|
|
|
|
|
break;
|
2007-10-15 14:46:37 +00:00
|
|
|
case PROP_WIRELESS_HARDWARE_ENABLED:
|
|
|
|
|
g_value_set_boolean (value, priv->wireless_hw_enabled);
|
|
|
|
|
break;
|
2008-03-26 13:43:01 +00:00
|
|
|
case PROP_ACTIVE_CONNECTIONS:
|
|
|
|
|
g_value_take_boxed (value, get_active_connections (self, NULL));
|
2008-03-20 19:56:12 +00:00
|
|
|
break;
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
case PROP_HOSTNAME:
|
|
|
|
|
g_value_set_string (value, priv->hostname);
|
|
|
|
|
break;
|
2007-02-08 15:34:26 +00:00
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nm_manager_class_init (NMManagerClass *manager_class)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (manager_class);
|
|
|
|
|
|
|
|
|
|
g_type_class_add_private (manager_class, sizeof (NMManagerPrivate));
|
|
|
|
|
|
|
|
|
|
/* virtual methods */
|
2007-10-01 15:38:39 +00:00
|
|
|
manager_class->connection_added = connection_added_default_handler;
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
object_class->set_property = set_property;
|
|
|
|
|
object_class->get_property = get_property;
|
2008-03-26 13:43:01 +00:00
|
|
|
object_class->dispose = dispose;
|
2007-02-08 15:34:26 +00:00
|
|
|
|
|
|
|
|
/* properties */
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_STATE,
|
|
|
|
|
g_param_spec_uint (NM_MANAGER_STATE,
|
|
|
|
|
"State",
|
|
|
|
|
"Current state",
|
|
|
|
|
0, 5, 0, /* FIXME */
|
|
|
|
|
G_PARAM_READABLE));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_WIRELESS_ENABLED,
|
|
|
|
|
g_param_spec_boolean (NM_MANAGER_WIRELESS_ENABLED,
|
|
|
|
|
"WirelessEnabled",
|
|
|
|
|
"Is wireless enabled",
|
|
|
|
|
TRUE,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
2007-10-15 14:46:37 +00:00
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_WIRELESS_HARDWARE_ENABLED,
|
|
|
|
|
g_param_spec_boolean (NM_MANAGER_WIRELESS_HARDWARE_ENABLED,
|
|
|
|
|
"WirelessHardwareEnabled",
|
|
|
|
|
"RF kill state",
|
|
|
|
|
TRUE,
|
2008-03-24 02:58:57 +00:00
|
|
|
G_PARAM_READABLE));
|
2007-10-15 14:46:37 +00:00
|
|
|
|
2008-03-20 19:56:12 +00:00
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_ACTIVE_CONNECTIONS,
|
|
|
|
|
g_param_spec_boxed (NM_MANAGER_ACTIVE_CONNECTIONS,
|
|
|
|
|
"Active connections",
|
|
|
|
|
"Active connections",
|
2008-03-29 21:35:41 +00:00
|
|
|
DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH,
|
2008-03-20 19:56:12 +00:00
|
|
|
G_PARAM_READABLE));
|
|
|
|
|
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
/* Hostname is not exported over D-Bus */
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_HOSTNAME,
|
|
|
|
|
g_param_spec_string (NM_MANAGER_HOSTNAME,
|
|
|
|
|
"Hostname",
|
|
|
|
|
"Hostname",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READABLE | NM_PROPERTY_PARAM_NO_EXPORT));
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
/* signals */
|
|
|
|
|
signals[DEVICE_ADDED] =
|
|
|
|
|
g_signal_new ("device-added",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (NMManagerClass, device_added),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
g_cclosure_marshal_VOID__OBJECT,
|
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
G_TYPE_OBJECT);
|
|
|
|
|
|
|
|
|
|
signals[DEVICE_REMOVED] =
|
|
|
|
|
g_signal_new ("device-removed",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (NMManagerClass, device_removed),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
g_cclosure_marshal_VOID__OBJECT,
|
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
G_TYPE_OBJECT);
|
|
|
|
|
|
2008-03-07 23:17:48 +00:00
|
|
|
signals[STATE_CHANGED] =
|
|
|
|
|
g_signal_new ("state-changed",
|
2007-02-08 15:34:26 +00:00
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
2008-03-07 23:17:48 +00:00
|
|
|
G_STRUCT_OFFSET (NMManagerClass, state_changed),
|
2007-02-08 15:34:26 +00:00
|
|
|
NULL, NULL,
|
2007-02-12 09:23:43 +00:00
|
|
|
g_cclosure_marshal_VOID__UINT,
|
2007-02-08 15:34:26 +00:00
|
|
|
G_TYPE_NONE, 1,
|
2007-02-12 09:23:43 +00:00
|
|
|
G_TYPE_UINT);
|
|
|
|
|
|
2007-10-15 14:46:37 +00:00
|
|
|
signals[PROPERTIES_CHANGED] =
|
|
|
|
|
nm_properties_changed_signal_new (object_class,
|
|
|
|
|
G_STRUCT_OFFSET (NMManagerClass, properties_changed));
|
|
|
|
|
|
2007-10-07 23:33:28 +00:00
|
|
|
signals[CONNECTIONS_ADDED] =
|
|
|
|
|
g_signal_new ("connections-added",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (NMManagerClass, connections_added),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
g_cclosure_marshal_VOID__UINT,
|
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
G_TYPE_UINT);
|
|
|
|
|
|
2007-06-22 15:09:02 +00:00
|
|
|
signals[CONNECTION_ADDED] =
|
|
|
|
|
g_signal_new ("connection-added",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (NMManagerClass, connection_added),
|
|
|
|
|
NULL, NULL,
|
2008-08-26 09:34:31 +00:00
|
|
|
_nm_marshal_VOID__OBJECT_UINT,
|
2007-10-01 15:38:39 +00:00
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
|
G_TYPE_OBJECT, G_TYPE_UINT);
|
2007-06-22 15:09:02 +00:00
|
|
|
|
2007-10-06 04:28:46 +00:00
|
|
|
signals[CONNECTION_UPDATED] =
|
|
|
|
|
g_signal_new ("connection-updated",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (NMManagerClass, connection_updated),
|
|
|
|
|
NULL, NULL,
|
2008-08-26 09:34:31 +00:00
|
|
|
_nm_marshal_VOID__OBJECT_UINT,
|
2007-10-06 04:28:46 +00:00
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
|
G_TYPE_OBJECT, G_TYPE_UINT);
|
|
|
|
|
|
2007-06-22 15:09:02 +00:00
|
|
|
signals[CONNECTION_REMOVED] =
|
|
|
|
|
g_signal_new ("connection-removed",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (NMManagerClass, connection_removed),
|
|
|
|
|
NULL, NULL,
|
2008-08-26 09:34:31 +00:00
|
|
|
_nm_marshal_VOID__OBJECT_UINT,
|
2007-10-01 15:38:39 +00:00
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
|
G_TYPE_OBJECT, G_TYPE_UINT);
|
2007-06-22 15:09:02 +00:00
|
|
|
|
2008-03-07 23:17:48 +00:00
|
|
|
/* StateChange is DEPRECATED */
|
|
|
|
|
signals[STATE_CHANGE] =
|
|
|
|
|
g_signal_new ("state-change",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
0, NULL, NULL,
|
|
|
|
|
g_cclosure_marshal_VOID__UINT,
|
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
G_TYPE_UINT);
|
|
|
|
|
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (manager_class),
|
|
|
|
|
&dbus_glib_nm_manager_object_info);
|
2007-12-27 08:06:27 +00:00
|
|
|
|
|
|
|
|
dbus_g_error_domain_register (NM_MANAGER_ERROR, NULL, NM_TYPE_MANAGER_ERROR);
|
2007-02-08 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
|
2008-02-20 22:37:39 +00:00
|
|
|
static NMConnectionScope
|
2008-02-21 03:04:18 +00:00
|
|
|
get_scope_for_proxy (DBusGProxy *proxy)
|
2007-10-07 23:33:28 +00:00
|
|
|
{
|
|
|
|
|
const char *bus_name = dbus_g_proxy_get_bus_name (proxy);
|
|
|
|
|
|
|
|
|
|
if (strcmp (bus_name, NM_DBUS_SERVICE_USER_SETTINGS) == 0)
|
2008-02-20 22:37:39 +00:00
|
|
|
return NM_CONNECTION_SCOPE_USER;
|
2007-10-07 23:33:28 +00:00
|
|
|
else if (strcmp (bus_name, NM_DBUS_SERVICE_SYSTEM_SETTINGS) == 0)
|
2008-02-20 22:37:39 +00:00
|
|
|
return NM_CONNECTION_SCOPE_SYSTEM;
|
2007-10-07 23:33:28 +00:00
|
|
|
|
2008-02-20 22:37:39 +00:00
|
|
|
return NM_CONNECTION_SCOPE_UNKNOWN;
|
2007-10-07 23:33:28 +00:00
|
|
|
}
|
|
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
typedef struct GetSettingsInfo {
|
|
|
|
|
NMManager *manager;
|
|
|
|
|
NMConnection *connection;
|
2007-10-07 23:33:28 +00:00
|
|
|
DBusGProxy *proxy;
|
|
|
|
|
DBusGProxyCall *call;
|
2007-10-19 04:55:05 +00:00
|
|
|
DBusGProxy *secrets_proxy;
|
2007-10-07 23:33:28 +00:00
|
|
|
GSList **calls;
|
2008-10-21 11:11:43 +00:00
|
|
|
NMConnectionScope scope;
|
2007-09-03 01:12:23 +00:00
|
|
|
} GetSettingsInfo;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
free_get_settings_info (gpointer data)
|
|
|
|
|
{
|
|
|
|
|
GetSettingsInfo *info = (GetSettingsInfo *) data;
|
|
|
|
|
|
2007-10-07 23:33:28 +00:00
|
|
|
/* If this was the last pending call for a batch of GetSettings calls,
|
|
|
|
|
* send out the connections-added signal.
|
|
|
|
|
*/
|
|
|
|
|
if (info->calls) {
|
|
|
|
|
*(info->calls) = g_slist_remove (*(info->calls), info->call);
|
|
|
|
|
if (g_slist_length (*(info->calls)) == 0) {
|
|
|
|
|
g_slist_free (*(info->calls));
|
2008-06-05 13:16:02 +00:00
|
|
|
g_slice_free (GSList, (gpointer) info->calls);
|
2008-10-21 11:11:43 +00:00
|
|
|
g_signal_emit (info->manager, signals[CONNECTIONS_ADDED], 0, info->scope);
|
2009-05-20 12:02:18 -04:00
|
|
|
|
2009-05-19 15:20:20 -04:00
|
|
|
/* Update the Bluetooth connections for all the new connections */
|
2009-05-20 12:02:18 -04:00
|
|
|
bluez_manager_resync_devices (info->manager);
|
2007-10-07 23:33:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
if (info->manager) {
|
|
|
|
|
g_object_unref (info->manager);
|
|
|
|
|
info->manager = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (info->connection) {
|
|
|
|
|
g_object_unref (info->connection);
|
|
|
|
|
info->connection = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_slice_free (GetSettingsInfo, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
connection_get_settings_cb (DBusGProxy *proxy,
|
|
|
|
|
DBusGProxyCall *call_id,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
GetSettingsInfo *info = (GetSettingsInfo *) user_data;
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
GHashTable *settings = NULL;
|
|
|
|
|
NMConnection *connection;
|
2008-02-20 22:37:39 +00:00
|
|
|
NMConnectionScope scope;
|
2007-09-03 01:12:23 +00:00
|
|
|
NMManager *manager;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (info != NULL);
|
|
|
|
|
|
|
|
|
|
if (!dbus_g_proxy_end_call (proxy, call_id, &err,
|
2008-03-29 21:35:41 +00:00
|
|
|
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &settings,
|
2007-09-03 01:12:23 +00:00
|
|
|
G_TYPE_INVALID)) {
|
|
|
|
|
nm_warning ("Couldn't retrieve connection settings: %s.", err->message);
|
|
|
|
|
g_error_free (err);
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
manager = info->manager;
|
|
|
|
|
connection = info->connection;
|
|
|
|
|
if (connection == NULL) {
|
|
|
|
|
const char *path = dbus_g_proxy_get_path (proxy);
|
|
|
|
|
NMManagerPrivate *priv;
|
2008-06-12 23:58:08 +00:00
|
|
|
GError *error = NULL;
|
2008-10-21 11:11:43 +00:00
|
|
|
NMConnection *existing = NULL;
|
2008-06-12 23:58:08 +00:00
|
|
|
|
|
|
|
|
connection = nm_connection_new_from_hash (settings, &error);
|
|
|
|
|
if (connection == NULL) {
|
|
|
|
|
nm_warning ("%s: Invalid connection: '%s' / '%s' invalid: %d",
|
|
|
|
|
__func__,
|
|
|
|
|
g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)),
|
|
|
|
|
error->message, error->code);
|
|
|
|
|
g_error_free (error);
|
2007-09-03 01:12:23 +00:00
|
|
|
goto out;
|
2008-06-12 23:58:08 +00:00
|
|
|
}
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2008-02-21 03:04:18 +00:00
|
|
|
scope = get_scope_for_proxy (proxy);
|
|
|
|
|
|
|
|
|
|
nm_connection_set_path (connection, path);
|
|
|
|
|
nm_connection_set_scope (connection, scope);
|
|
|
|
|
|
2007-09-27 02:18:49 +00:00
|
|
|
g_object_set_data_full (G_OBJECT (connection),
|
|
|
|
|
NM_MANAGER_CONNECTION_PROXY_TAG,
|
|
|
|
|
proxy,
|
|
|
|
|
(GDestroyNotify) g_object_unref);
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2007-10-19 04:55:05 +00:00
|
|
|
g_object_set_data_full (G_OBJECT (connection),
|
|
|
|
|
NM_MANAGER_CONNECTION_SECRETS_PROXY_TAG,
|
|
|
|
|
info->secrets_proxy,
|
|
|
|
|
(GDestroyNotify) g_object_unref);
|
|
|
|
|
|
2008-10-21 11:11:43 +00:00
|
|
|
/* Add the new connection to the internal hashes only if the same
|
|
|
|
|
* connection isn't already there.
|
|
|
|
|
*/
|
2007-09-03 01:12:23 +00:00
|
|
|
priv = NM_MANAGER_GET_PRIVATE (manager);
|
2008-02-20 22:37:39 +00:00
|
|
|
switch (scope) {
|
|
|
|
|
case NM_CONNECTION_SCOPE_USER:
|
2008-10-21 11:11:43 +00:00
|
|
|
existing = g_hash_table_lookup (priv->user_connections, path);
|
2008-11-19 16:20:47 +00:00
|
|
|
if (!existing || !nm_connection_compare (existing, connection, NM_SETTING_COMPARE_FLAG_EXACT)) {
|
2008-10-21 11:11:43 +00:00
|
|
|
g_hash_table_insert (priv->user_connections,
|
|
|
|
|
g_strdup (path),
|
|
|
|
|
connection);
|
|
|
|
|
existing = NULL;
|
|
|
|
|
} else {
|
|
|
|
|
g_object_unref (connection);
|
|
|
|
|
}
|
2007-10-07 23:33:28 +00:00
|
|
|
break;
|
2008-02-20 22:37:39 +00:00
|
|
|
case NM_CONNECTION_SCOPE_SYSTEM:
|
2008-10-21 11:11:43 +00:00
|
|
|
existing = g_hash_table_lookup (priv->system_connections, path);
|
2008-11-19 16:20:47 +00:00
|
|
|
if (!existing || !nm_connection_compare (existing, connection, NM_SETTING_COMPARE_FLAG_EXACT)) {
|
2008-10-21 11:11:43 +00:00
|
|
|
g_hash_table_insert (priv->system_connections,
|
|
|
|
|
g_strdup (path),
|
|
|
|
|
connection);
|
|
|
|
|
existing = NULL;
|
|
|
|
|
} else {
|
|
|
|
|
g_object_unref (connection);
|
|
|
|
|
}
|
2007-10-07 23:33:28 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
nm_warning ("Connection wasn't a user connection or a system connection.");
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
break;
|
2007-09-14 19:36:00 +00:00
|
|
|
}
|
2007-09-11 23:28:41 +00:00
|
|
|
|
2007-10-07 23:33:28 +00:00
|
|
|
/* If the connection-added signal is supposed to be batched, don't
|
2008-10-21 11:11:43 +00:00
|
|
|
* emit the single connection-added here. Also, don't emit the signal
|
|
|
|
|
* if the connection wasn't actually added to the system or user hashes.
|
2007-10-07 23:33:28 +00:00
|
|
|
*/
|
2009-05-19 15:20:20 -04:00
|
|
|
if (!info->calls && !existing) {
|
2008-02-20 22:37:39 +00:00
|
|
|
g_signal_emit (manager, signals[CONNECTION_ADDED], 0, connection, scope);
|
2009-05-19 15:20:20 -04:00
|
|
|
/* Update the Bluetooth connections for that single new connection */
|
2009-05-20 12:02:18 -04:00
|
|
|
bluez_manager_resync_devices (manager);
|
2009-05-19 15:20:20 -04:00
|
|
|
}
|
2007-09-03 01:12:23 +00:00
|
|
|
} else {
|
|
|
|
|
// FIXME: merge settings? or just replace?
|
|
|
|
|
nm_warning ("%s (#%d): implement merge settings", __func__, __LINE__);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
out:
|
2007-12-12 22:40:42 +00:00
|
|
|
if (settings)
|
|
|
|
|
g_hash_table_destroy (settings);
|
|
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-06 04:28:46 +00:00
|
|
|
static NMConnection *
|
|
|
|
|
get_connection_for_proxy (NMManager *manager,
|
|
|
|
|
DBusGProxy *proxy,
|
2008-02-21 03:04:18 +00:00
|
|
|
GHashTable **out_hash)
|
2007-10-06 04:28:46 +00:00
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
2007-10-07 23:33:28 +00:00
|
|
|
NMConnection *connection = NULL;
|
2007-10-06 04:28:46 +00:00
|
|
|
const char *path = dbus_g_proxy_get_path (proxy);
|
|
|
|
|
|
2008-02-21 03:04:18 +00:00
|
|
|
switch (get_scope_for_proxy (proxy)) {
|
2008-02-20 22:37:39 +00:00
|
|
|
case NM_CONNECTION_SCOPE_USER:
|
2007-10-07 23:33:28 +00:00
|
|
|
*out_hash = priv->user_connections;
|
|
|
|
|
connection = g_hash_table_lookup (priv->user_connections, path);
|
|
|
|
|
break;
|
2008-02-20 22:37:39 +00:00
|
|
|
case NM_CONNECTION_SCOPE_SYSTEM:
|
2007-10-07 23:33:28 +00:00
|
|
|
*out_hash = priv->system_connections;
|
|
|
|
|
connection = g_hash_table_lookup (priv->system_connections, path);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
nm_warning ("Connection wasn't a user connection or a system connection.");
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
break;
|
2007-10-06 04:28:46 +00:00
|
|
|
}
|
2007-10-07 23:33:28 +00:00
|
|
|
return connection;
|
2007-10-06 04:28:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
remove_connection (NMManager *manager,
|
|
|
|
|
NMConnection *connection,
|
2008-02-21 03:04:18 +00:00
|
|
|
GHashTable *hash)
|
2007-10-06 04:28:46 +00:00
|
|
|
{
|
|
|
|
|
/* Destroys the connection, then associated DBusGProxy due to the
|
|
|
|
|
* weak reference notify function placed on the connection when it
|
|
|
|
|
* was created.
|
|
|
|
|
*/
|
|
|
|
|
g_object_ref (connection);
|
2008-02-21 03:04:18 +00:00
|
|
|
g_hash_table_remove (hash, nm_connection_get_path (connection));
|
|
|
|
|
g_signal_emit (manager, signals[CONNECTION_REMOVED], 0,
|
|
|
|
|
connection,
|
|
|
|
|
nm_connection_get_scope (connection));
|
2007-10-06 04:28:46 +00:00
|
|
|
g_object_unref (connection);
|
2009-05-20 12:02:18 -04:00
|
|
|
|
|
|
|
|
bluez_manager_resync_devices (manager);
|
2007-10-06 04:28:46 +00:00
|
|
|
}
|
|
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
static void
|
|
|
|
|
connection_removed_cb (DBusGProxy *proxy, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMManager * manager = NM_MANAGER (user_data);
|
|
|
|
|
NMConnection *connection = NULL;
|
|
|
|
|
GHashTable *hash = NULL;
|
|
|
|
|
|
2008-02-21 03:04:18 +00:00
|
|
|
connection = get_connection_for_proxy (manager, proxy, &hash);
|
2007-10-06 04:28:46 +00:00
|
|
|
if (connection)
|
2008-02-21 03:04:18 +00:00
|
|
|
remove_connection (manager, connection, hash);
|
2007-10-06 04:28:46 +00:00
|
|
|
}
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2007-10-06 04:28:46 +00:00
|
|
|
static void
|
|
|
|
|
connection_updated_cb (DBusGProxy *proxy, GHashTable *settings, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMManager *manager = NM_MANAGER (user_data);
|
|
|
|
|
NMConnection *new_connection;
|
|
|
|
|
NMConnection *old_connection;
|
|
|
|
|
GHashTable *hash;
|
|
|
|
|
gboolean valid = FALSE;
|
2008-06-12 23:58:08 +00:00
|
|
|
GError *error = NULL;
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2008-02-21 03:04:18 +00:00
|
|
|
old_connection = get_connection_for_proxy (manager, proxy, &hash);
|
|
|
|
|
g_return_if_fail (old_connection != NULL);
|
2007-10-06 04:28:46 +00:00
|
|
|
|
2008-06-12 23:58:08 +00:00
|
|
|
new_connection = nm_connection_new_from_hash (settings, &error);
|
2007-10-06 04:28:46 +00:00
|
|
|
if (!new_connection) {
|
|
|
|
|
/* New connection invalid, remove existing connection */
|
2008-06-12 23:58:08 +00:00
|
|
|
nm_warning ("%s: Invalid connection: '%s' / '%s' invalid: %d",
|
|
|
|
|
__func__,
|
|
|
|
|
g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)),
|
|
|
|
|
error->message, error->code);
|
|
|
|
|
g_error_free (error);
|
2008-02-21 03:04:18 +00:00
|
|
|
remove_connection (manager, old_connection, hash);
|
2007-10-06 04:28:46 +00:00
|
|
|
return;
|
2007-09-03 01:12:23 +00:00
|
|
|
}
|
2007-10-06 04:28:46 +00:00
|
|
|
g_object_unref (new_connection);
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2008-11-19 15:09:05 +00:00
|
|
|
valid = nm_connection_replace_settings (old_connection, settings, NULL);
|
2007-10-06 04:28:46 +00:00
|
|
|
if (valid) {
|
2008-02-21 03:04:18 +00:00
|
|
|
g_signal_emit (manager, signals[CONNECTION_UPDATED], 0,
|
|
|
|
|
old_connection,
|
|
|
|
|
nm_connection_get_scope (old_connection));
|
2009-05-20 12:02:18 -04:00
|
|
|
|
|
|
|
|
bluez_manager_resync_devices (manager);
|
2007-10-06 04:28:46 +00:00
|
|
|
} else {
|
2008-02-21 03:04:18 +00:00
|
|
|
remove_connection (manager, old_connection, hash);
|
2007-10-06 04:28:46 +00:00
|
|
|
}
|
2007-09-03 01:12:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2007-10-07 23:33:28 +00:00
|
|
|
internal_new_connection_cb (DBusGProxy *proxy,
|
|
|
|
|
const char *path,
|
|
|
|
|
NMManager *manager,
|
|
|
|
|
GSList **calls)
|
2007-09-03 01:12:23 +00:00
|
|
|
{
|
2007-10-07 23:33:28 +00:00
|
|
|
struct GetSettingsInfo *info;
|
2007-09-03 01:12:23 +00:00
|
|
|
DBusGProxy *con_proxy;
|
|
|
|
|
DBusGConnection * g_connection;
|
|
|
|
|
DBusGProxyCall *call;
|
2007-10-19 04:55:05 +00:00
|
|
|
DBusGProxy *secrets_proxy;
|
2008-01-02 13:42:52 +00:00
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2008-01-02 13:42:52 +00:00
|
|
|
g_connection = nm_dbus_manager_get_connection (priv->dbus_mgr);
|
2007-09-03 01:12:23 +00:00
|
|
|
con_proxy = dbus_g_proxy_new_for_name (g_connection,
|
2007-10-07 23:33:28 +00:00
|
|
|
dbus_g_proxy_get_bus_name (proxy),
|
2007-09-03 01:12:23 +00:00
|
|
|
path,
|
2007-09-09 14:48:31 +00:00
|
|
|
NM_DBUS_IFACE_SETTINGS_CONNECTION);
|
2007-09-03 01:12:23 +00:00
|
|
|
if (!con_proxy) {
|
|
|
|
|
nm_warning ("Error: could not init user connection proxy");
|
2007-10-19 04:55:05 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
secrets_proxy = dbus_g_proxy_new_for_name (g_connection,
|
|
|
|
|
dbus_g_proxy_get_bus_name (proxy),
|
|
|
|
|
path,
|
|
|
|
|
NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS);
|
|
|
|
|
if (!secrets_proxy) {
|
|
|
|
|
nm_warning ("Error: could not init user connection secrets proxy");
|
|
|
|
|
g_object_unref (con_proxy);
|
2007-09-03 01:12:23 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dbus_g_proxy_add_signal (con_proxy, "Updated",
|
2008-03-29 21:35:41 +00:00
|
|
|
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT,
|
2007-09-03 01:12:23 +00:00
|
|
|
G_TYPE_INVALID);
|
2007-10-06 04:28:46 +00:00
|
|
|
dbus_g_proxy_connect_signal (con_proxy, "Updated",
|
|
|
|
|
G_CALLBACK (connection_updated_cb),
|
|
|
|
|
manager,
|
|
|
|
|
NULL);
|
2007-09-03 01:12:23 +00:00
|
|
|
|
|
|
|
|
dbus_g_proxy_add_signal (con_proxy, "Removed", G_TYPE_INVALID, G_TYPE_INVALID);
|
|
|
|
|
dbus_g_proxy_connect_signal (con_proxy, "Removed",
|
|
|
|
|
G_CALLBACK (connection_removed_cb),
|
|
|
|
|
manager,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
info = g_slice_new0 (GetSettingsInfo);
|
|
|
|
|
info->manager = g_object_ref (manager);
|
2007-10-07 23:33:28 +00:00
|
|
|
info->calls = calls;
|
2008-10-21 11:11:43 +00:00
|
|
|
info->scope = get_scope_for_proxy (con_proxy);
|
2007-09-03 01:12:23 +00:00
|
|
|
call = dbus_g_proxy_begin_call (con_proxy, "GetSettings",
|
|
|
|
|
connection_get_settings_cb,
|
|
|
|
|
info,
|
|
|
|
|
free_get_settings_info,
|
|
|
|
|
G_TYPE_INVALID);
|
2007-10-07 23:33:28 +00:00
|
|
|
info->call = call;
|
|
|
|
|
info->proxy = con_proxy;
|
2007-10-19 04:55:05 +00:00
|
|
|
info->secrets_proxy = secrets_proxy;
|
2007-10-07 23:33:28 +00:00
|
|
|
if (info->calls)
|
|
|
|
|
*(info->calls) = g_slist_prepend (*(info->calls), call);
|
2007-09-03 01:12:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
list_connections_cb (DBusGProxy *proxy,
|
|
|
|
|
DBusGProxyCall *call_id,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMManager *manager = NM_MANAGER (user_data);
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
GPtrArray *ops;
|
2007-10-07 23:33:28 +00:00
|
|
|
GSList **calls = NULL;
|
2007-09-03 01:12:23 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (!dbus_g_proxy_end_call (proxy, call_id, &err,
|
|
|
|
|
DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH, &ops,
|
|
|
|
|
G_TYPE_INVALID)) {
|
|
|
|
|
nm_warning ("Couldn't retrieve connections: %s.", err->message);
|
|
|
|
|
g_error_free (err);
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-07 23:33:28 +00:00
|
|
|
/* Keep track of all calls made here; don't want to emit connection-added for
|
|
|
|
|
* each one, but emit connections-added when they are all done.
|
|
|
|
|
*/
|
|
|
|
|
calls = g_slice_new0 (GSList *);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < ops->len; i++) {
|
2008-06-05 13:16:02 +00:00
|
|
|
char *op = g_ptr_array_index (ops, i);
|
|
|
|
|
|
|
|
|
|
internal_new_connection_cb (proxy, op, manager, calls);
|
|
|
|
|
g_free (op);
|
2007-10-07 23:33:28 +00:00
|
|
|
}
|
2007-09-03 01:12:23 +00:00
|
|
|
|
|
|
|
|
g_ptr_array_free (ops, TRUE);
|
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-07 23:33:28 +00:00
|
|
|
static void
|
|
|
|
|
new_connection_cb (DBusGProxy *proxy, const char *path, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
internal_new_connection_cb (proxy, path, NM_MANAGER (user_data), NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
static void
|
2007-09-09 22:18:42 +00:00
|
|
|
query_connections (NMManager *manager,
|
2008-02-20 22:37:39 +00:00
|
|
|
NMConnectionScope scope)
|
2007-09-03 01:12:23 +00:00
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv;
|
|
|
|
|
DBusGProxyCall *call;
|
2007-09-09 22:18:42 +00:00
|
|
|
DBusGProxy ** proxy;
|
|
|
|
|
const char * service;
|
2007-09-03 01:12:23 +00:00
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_MANAGER (manager));
|
|
|
|
|
|
2007-09-10 18:31:56 +00:00
|
|
|
priv = NM_MANAGER_GET_PRIVATE (manager);
|
2008-02-20 22:37:39 +00:00
|
|
|
if (scope == NM_CONNECTION_SCOPE_USER) {
|
2007-09-09 22:18:42 +00:00
|
|
|
proxy = &priv->user_proxy;
|
|
|
|
|
service = NM_DBUS_SERVICE_USER_SETTINGS;
|
2008-02-20 22:37:39 +00:00
|
|
|
} else if (scope == NM_CONNECTION_SCOPE_SYSTEM) {
|
2007-09-09 22:18:42 +00:00
|
|
|
proxy = &priv->system_proxy;
|
|
|
|
|
service = NM_DBUS_SERVICE_SYSTEM_SETTINGS;
|
|
|
|
|
} else {
|
2008-02-20 22:37:39 +00:00
|
|
|
nm_warning ("Unknown NMConnectionScope %d", scope);
|
2007-09-09 22:18:42 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!*proxy) {
|
2007-09-03 01:12:23 +00:00
|
|
|
DBusGConnection * g_connection;
|
|
|
|
|
|
2008-01-02 13:42:52 +00:00
|
|
|
g_connection = nm_dbus_manager_get_connection (priv->dbus_mgr);
|
2007-09-09 22:18:42 +00:00
|
|
|
*proxy = dbus_g_proxy_new_for_name (g_connection,
|
|
|
|
|
service,
|
|
|
|
|
NM_DBUS_PATH_SETTINGS,
|
|
|
|
|
NM_DBUS_IFACE_SETTINGS);
|
|
|
|
|
if (!*proxy) {
|
|
|
|
|
nm_warning ("Error: could not init settings proxy");
|
2007-09-03 01:12:23 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-09 22:18:42 +00:00
|
|
|
dbus_g_proxy_add_signal (*proxy,
|
2007-09-03 01:12:23 +00:00
|
|
|
"NewConnection",
|
|
|
|
|
DBUS_TYPE_G_OBJECT_PATH,
|
|
|
|
|
G_TYPE_INVALID);
|
|
|
|
|
|
2007-09-09 22:18:42 +00:00
|
|
|
dbus_g_proxy_connect_signal (*proxy, "NewConnection",
|
2007-09-03 01:12:23 +00:00
|
|
|
G_CALLBACK (new_connection_cb),
|
|
|
|
|
manager,
|
|
|
|
|
NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* grab connections */
|
2007-09-09 22:18:42 +00:00
|
|
|
call = dbus_g_proxy_begin_call (*proxy, "ListConnections",
|
2007-09-03 01:12:23 +00:00
|
|
|
list_connections_cb,
|
|
|
|
|
manager,
|
|
|
|
|
NULL,
|
|
|
|
|
G_TYPE_INVALID);
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
static NMDevice *
|
|
|
|
|
nm_manager_get_device_by_udi (NMManager *manager, const char *udi)
|
|
|
|
|
{
|
|
|
|
|
GSList *iter;
|
|
|
|
|
|
|
|
|
|
for (iter = NM_MANAGER_GET_PRIVATE (manager)->devices; iter; iter = iter->next) {
|
|
|
|
|
if (!strcmp (nm_device_get_udi (NM_DEVICE (iter->data)), udi))
|
|
|
|
|
return NM_DEVICE (iter->data);
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2008-05-22 14:22:31 +00:00
|
|
|
static gboolean
|
|
|
|
|
nm_manager_udi_is_managed (NMManager *self, const char *udi)
|
|
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
|
|
|
|
GSList *iter;
|
|
|
|
|
|
|
|
|
|
for (iter = priv->unmanaged_udis; iter; iter = iter->next) {
|
|
|
|
|
if (!strcmp (udi, iter->data))
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
static void
|
|
|
|
|
handle_unmanaged_devices (NMManager *manager, GPtrArray *ops)
|
|
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
int i;
|
|
|
|
|
GSList *unmanaged = NULL, *iter;
|
|
|
|
|
|
|
|
|
|
g_slist_foreach (priv->unmanaged_udis, (GFunc) g_free, NULL);
|
|
|
|
|
g_slist_free (priv->unmanaged_udis);
|
|
|
|
|
priv->unmanaged_udis = NULL;
|
|
|
|
|
|
|
|
|
|
/* Mark unmanaged devices */
|
|
|
|
|
for (i = 0; ops && (i < ops->len); i++) {
|
|
|
|
|
NMDevice *device;
|
|
|
|
|
const char *udi = g_ptr_array_index (ops, i);
|
|
|
|
|
|
|
|
|
|
priv->unmanaged_udis = g_slist_prepend (priv->unmanaged_udis, g_strdup (udi));
|
|
|
|
|
|
|
|
|
|
device = nm_manager_get_device_by_udi (manager, udi);
|
|
|
|
|
if (device) {
|
|
|
|
|
unmanaged = g_slist_prepend (unmanaged, device);
|
2008-10-11 19:57:45 +00:00
|
|
|
nm_device_set_managed (device, FALSE, NM_DEVICE_STATE_REASON_NOW_UNMANAGED);
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Mark managed devices */
|
|
|
|
|
for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
|
|
|
|
|
NMDevice *device = NM_DEVICE (iter->data);
|
|
|
|
|
|
|
|
|
|
if (!g_slist_find (unmanaged, device))
|
2008-10-11 19:57:45 +00:00
|
|
|
nm_device_set_managed (device, TRUE, NM_DEVICE_STATE_REASON_NOW_MANAGED);
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_slist_free (unmanaged);
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
static void
|
|
|
|
|
handle_hostname (NMManager *manager, const char *hostname)
|
|
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
|
|
|
|
|
if (!hostname && !priv->hostname)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (hostname && priv->hostname && !strcmp (hostname, priv->hostname))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
g_free (priv->hostname);
|
|
|
|
|
priv->hostname = (hostname && strlen (hostname)) ? g_strdup (hostname) : NULL;
|
|
|
|
|
g_object_notify (G_OBJECT (manager), NM_MANAGER_HOSTNAME);
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
static void
|
|
|
|
|
system_settings_properties_changed_cb (DBusGProxy *proxy,
|
|
|
|
|
GHashTable *properties,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMManager *manager = NM_MANAGER (user_data);
|
|
|
|
|
GValue *value;
|
|
|
|
|
|
|
|
|
|
value = g_hash_table_lookup (properties, "UnmanagedDevices");
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
if (value && G_VALUE_HOLDS (value, DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH))
|
|
|
|
|
handle_unmanaged_devices (manager, g_value_get_boxed (value));
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
value = g_hash_table_lookup (properties, "Hostname");
|
|
|
|
|
if (value && G_VALUE_HOLDS (value, G_TYPE_STRING))
|
|
|
|
|
handle_hostname (manager, g_value_get_string (value));
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
system_settings_get_unmanaged_devices_cb (DBusGProxy *proxy,
|
|
|
|
|
DBusGProxyCall *call_id,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMManager *manager = NM_MANAGER (user_data);
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
GValue value = { 0, };
|
|
|
|
|
|
|
|
|
|
if (!dbus_g_proxy_end_call (proxy, call_id, &error,
|
|
|
|
|
G_TYPE_VALUE, &value,
|
|
|
|
|
G_TYPE_INVALID)) {
|
|
|
|
|
nm_warning ("%s: Error getting unmanaged devices from the system "
|
|
|
|
|
"settings service: (%d) %s",
|
|
|
|
|
__func__, error->code, error->message);
|
|
|
|
|
g_error_free (error);
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
g_object_unref (proxy);
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-05 13:16:02 +00:00
|
|
|
if (G_VALUE_HOLDS (&value, DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH))
|
|
|
|
|
handle_unmanaged_devices (manager, g_value_get_boxed (&value));
|
|
|
|
|
|
|
|
|
|
g_value_unset (&value);
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
g_object_unref (proxy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
system_settings_get_hostname_cb (DBusGProxy *proxy,
|
|
|
|
|
DBusGProxyCall *call_id,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMManager *manager = NM_MANAGER (user_data);
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
GValue value = { 0, };
|
|
|
|
|
|
|
|
|
|
if (!dbus_g_proxy_end_call (proxy, call_id, &error,
|
|
|
|
|
G_TYPE_VALUE, &value,
|
|
|
|
|
G_TYPE_INVALID)) {
|
|
|
|
|
nm_warning ("%s: Error getting hostname from the system settings service: (%d) %s",
|
|
|
|
|
__func__, error->code, error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
g_object_unref (proxy);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
if (G_VALUE_HOLDS (&value, G_TYPE_STRING))
|
|
|
|
|
handle_hostname (manager, g_value_get_string (&value));
|
|
|
|
|
|
|
|
|
|
g_value_unset (&value);
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
g_object_unref (proxy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
query_system_settings_property (NMManager *manager,
|
|
|
|
|
const char *property,
|
|
|
|
|
DBusGProxyCallNotify callback)
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
DBusGConnection *g_connection;
|
|
|
|
|
DBusGProxy *get_proxy;
|
|
|
|
|
|
|
|
|
|
g_connection = nm_dbus_manager_get_connection (priv->dbus_mgr);
|
|
|
|
|
|
|
|
|
|
/* Get unmanaged devices */
|
|
|
|
|
get_proxy = dbus_g_proxy_new_for_name (g_connection,
|
|
|
|
|
NM_DBUS_SERVICE_SYSTEM_SETTINGS,
|
|
|
|
|
NM_DBUS_PATH_SETTINGS,
|
|
|
|
|
"org.freedesktop.DBus.Properties");
|
|
|
|
|
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
dbus_g_proxy_begin_call (get_proxy, "Get", callback, manager, NULL,
|
|
|
|
|
G_TYPE_STRING, NM_DBUS_IFACE_SETTINGS_SYSTEM,
|
|
|
|
|
G_TYPE_STRING, property,
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
G_TYPE_INVALID);
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
static void
|
|
|
|
|
nm_manager_name_owner_changed (NMDBusManager *mgr,
|
|
|
|
|
const char *name,
|
|
|
|
|
const char *old,
|
|
|
|
|
const char *new,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
2008-02-06 16:50:43 +00:00
|
|
|
NMManager *manager = NM_MANAGER (user_data);
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
2007-09-03 01:12:23 +00:00
|
|
|
gboolean old_owner_good = (old && (strlen (old) > 0));
|
|
|
|
|
gboolean new_owner_good = (new && (strlen (new) > 0));
|
|
|
|
|
|
|
|
|
|
if (strcmp (name, NM_DBUS_SERVICE_USER_SETTINGS) == 0) {
|
|
|
|
|
if (!old_owner_good && new_owner_good) {
|
|
|
|
|
/* User Settings service appeared, update stuff */
|
2008-02-20 22:37:39 +00:00
|
|
|
query_connections (manager, NM_CONNECTION_SCOPE_USER);
|
2007-09-03 01:12:23 +00:00
|
|
|
} else {
|
|
|
|
|
/* User Settings service disappeared, throw them away (?) */
|
2008-02-20 22:37:39 +00:00
|
|
|
nm_manager_connections_destroy (manager, NM_CONNECTION_SCOPE_USER);
|
2009-05-20 12:02:18 -04:00
|
|
|
bluez_manager_resync_devices (manager);
|
2007-09-09 22:18:42 +00:00
|
|
|
}
|
|
|
|
|
} else if (strcmp (name, NM_DBUS_SERVICE_SYSTEM_SETTINGS) == 0) {
|
|
|
|
|
if (!old_owner_good && new_owner_good) {
|
2008-02-06 16:50:43 +00:00
|
|
|
if (priv->poke_id) {
|
|
|
|
|
g_source_remove (priv->poke_id);
|
|
|
|
|
priv->poke_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-09 22:18:42 +00:00
|
|
|
/* System Settings service appeared, update stuff */
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
query_system_settings_property (manager, "UnmanagedDevices", system_settings_get_unmanaged_devices_cb);
|
|
|
|
|
query_system_settings_property (manager, "Hostname", system_settings_get_hostname_cb);
|
2008-02-20 22:37:39 +00:00
|
|
|
query_connections (manager, NM_CONNECTION_SCOPE_SYSTEM);
|
2007-09-09 22:18:42 +00:00
|
|
|
} else {
|
|
|
|
|
/* System Settings service disappeared, throw them away (?) */
|
2008-02-20 22:37:39 +00:00
|
|
|
nm_manager_connections_destroy (manager, NM_CONNECTION_SCOPE_SYSTEM);
|
2009-05-20 12:02:18 -04:00
|
|
|
bluez_manager_resync_devices (manager);
|
2008-02-06 16:50:43 +00:00
|
|
|
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
if (priv->system_props_proxy) {
|
|
|
|
|
g_object_unref (priv->system_props_proxy);
|
|
|
|
|
priv->system_props_proxy = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-06 16:50:43 +00:00
|
|
|
if (priv->poke_id)
|
|
|
|
|
g_source_remove (priv->poke_id);
|
|
|
|
|
|
|
|
|
|
/* Poke the system settings daemon so that it gets activated by dbus
|
|
|
|
|
* system bus activation.
|
|
|
|
|
*/
|
|
|
|
|
priv->poke_id = g_idle_add (poke_system_settings_daemon_cb, (gpointer) manager);
|
2007-09-03 01:12:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-06 16:50:43 +00:00
|
|
|
static gboolean
|
|
|
|
|
poke_system_settings_daemon_cb (gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMManager *manager = NM_MANAGER (user_data);
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
DBusGConnection *g_connection;
|
|
|
|
|
DBusGProxy *proxy;
|
|
|
|
|
|
|
|
|
|
g_connection = nm_dbus_manager_get_connection (priv->dbus_mgr);
|
|
|
|
|
proxy = dbus_g_proxy_new_for_name (g_connection,
|
|
|
|
|
NM_DBUS_SERVICE_SYSTEM_SETTINGS,
|
|
|
|
|
NM_DBUS_PATH_SETTINGS,
|
|
|
|
|
NM_DBUS_IFACE_SETTINGS);
|
|
|
|
|
if (!proxy) {
|
|
|
|
|
nm_warning ("Error: could not init system settings daemon proxy");
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nm_info ("Trying to start the system settings daemon...");
|
|
|
|
|
dbus_g_proxy_call_no_reply (proxy, "ListConnections", G_TYPE_INVALID);
|
|
|
|
|
g_object_unref (proxy);
|
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
/* Reschedule the poke */
|
2008-12-31 18:57:36 -05:00
|
|
|
priv->poke_id = g_timeout_add_seconds (SSD_POKE_INTERVAL, poke_system_settings_daemon_cb, (gpointer) manager);
|
2008-02-06 16:50:43 +00:00
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-10 19:51:25 +00:00
|
|
|
static gboolean
|
2007-09-03 01:12:23 +00:00
|
|
|
initial_get_connections (gpointer user_data)
|
|
|
|
|
{
|
2008-02-06 16:50:43 +00:00
|
|
|
NMManager *manager = NM_MANAGER (user_data);
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2008-10-20 11:49:00 +00:00
|
|
|
if (nm_dbus_manager_name_has_owner (priv->dbus_mgr,
|
2008-02-06 16:50:43 +00:00
|
|
|
NM_DBUS_SERVICE_SYSTEM_SETTINGS)) {
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
query_system_settings_property (manager, "UnmanagedDevices", system_settings_get_unmanaged_devices_cb);
|
|
|
|
|
query_system_settings_property (manager, "Hostname", system_settings_get_hostname_cb);
|
2008-02-20 22:37:39 +00:00
|
|
|
query_connections (manager, NM_CONNECTION_SCOPE_SYSTEM);
|
2008-02-06 16:50:43 +00:00
|
|
|
} else {
|
|
|
|
|
/* Try to activate the system settings daemon */
|
|
|
|
|
priv->poke_id = g_idle_add (poke_system_settings_daemon_cb, (gpointer) manager);
|
|
|
|
|
}
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2008-10-20 11:49:00 +00:00
|
|
|
if (nm_dbus_manager_name_has_owner (priv->dbus_mgr,
|
2007-10-07 23:33:28 +00:00
|
|
|
NM_DBUS_SERVICE_USER_SETTINGS))
|
2008-02-20 22:37:39 +00:00
|
|
|
query_connections (manager, NM_CONNECTION_SCOPE_USER);
|
2007-10-07 23:33:28 +00:00
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2008-05-22 14:22:31 +00:00
|
|
|
static void
|
|
|
|
|
sync_devices (NMManager *self)
|
|
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
2009-03-31 13:10:00 -04:00
|
|
|
GSList *keep = NULL, *gone = NULL, *iter;
|
2008-05-22 14:22:31 +00:00
|
|
|
|
2009-03-06 17:19:17 -05:00
|
|
|
/* Keep devices still known to HAL; get rid of ones HAL no longer knows about */
|
|
|
|
|
for (iter = priv->devices; iter; iter = iter->next) {
|
2008-05-22 14:22:31 +00:00
|
|
|
NMDevice *device = NM_DEVICE (iter->data);
|
|
|
|
|
const char *udi = nm_device_get_udi (device);
|
|
|
|
|
|
|
|
|
|
if (nm_hal_manager_udi_exists (priv->hal_mgr, udi)) {
|
2008-10-11 19:57:45 +00:00
|
|
|
if (nm_manager_udi_is_managed (self, udi))
|
|
|
|
|
nm_device_set_managed (device, TRUE, NM_DEVICE_STATE_REASON_NOW_MANAGED);
|
|
|
|
|
else
|
|
|
|
|
nm_device_set_managed (device, FALSE, NM_DEVICE_STATE_REASON_NOW_UNMANAGED);
|
2009-03-31 13:10:00 -04:00
|
|
|
keep = g_slist_append (keep, device);
|
2009-03-06 17:19:17 -05:00
|
|
|
} else
|
2009-03-31 13:10:00 -04:00
|
|
|
gone = g_slist_append (gone, device);
|
2008-05-22 14:22:31 +00:00
|
|
|
}
|
2009-03-06 17:19:17 -05:00
|
|
|
g_slist_free (priv->devices);
|
2009-03-31 13:10:00 -04:00
|
|
|
priv->devices = keep;
|
|
|
|
|
|
|
|
|
|
/* Dispose of devices no longer present */
|
2009-05-20 12:02:18 -04:00
|
|
|
while (g_slist_length (gone))
|
|
|
|
|
gone = remove_one_device (self, gone, NM_DEVICE (gone->data));
|
2008-05-22 14:22:31 +00:00
|
|
|
|
2009-03-06 17:19:17 -05:00
|
|
|
/* Ask HAL for new devices */
|
2008-05-22 14:22:31 +00:00
|
|
|
nm_hal_manager_query_devices (priv->hal_mgr);
|
2009-05-13 21:32:56 -04:00
|
|
|
|
|
|
|
|
/* Ask for new bluetooth devices */
|
2009-05-20 12:02:18 -04:00
|
|
|
bluez_manager_resync_devices (self);
|
2008-05-22 14:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
static gboolean
|
2008-05-22 14:22:31 +00:00
|
|
|
deferred_sync_devices (gpointer user_data)
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
{
|
|
|
|
|
NMManager *self = NM_MANAGER (user_data);
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
|
|
|
|
|
2008-05-22 14:22:31 +00:00
|
|
|
priv->sync_devices_id = 0;
|
|
|
|
|
sync_devices (self);
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2007-10-01 15:38:39 +00:00
|
|
|
NMManager *
|
2008-08-04 22:24:58 +00:00
|
|
|
nm_manager_get (void)
|
2007-02-08 15:34:26 +00:00
|
|
|
{
|
2008-08-04 22:24:58 +00:00
|
|
|
static NMManager *singleton = NULL;
|
2008-01-02 13:42:52 +00:00
|
|
|
NMManagerPrivate *priv;
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2008-08-04 22:24:58 +00:00
|
|
|
if (singleton)
|
|
|
|
|
return g_object_ref (singleton);
|
|
|
|
|
|
|
|
|
|
singleton = (NMManager *) g_object_new (NM_TYPE_MANAGER, NULL);
|
|
|
|
|
g_assert (singleton);
|
|
|
|
|
|
|
|
|
|
priv = NM_MANAGER_GET_PRIVATE (singleton);
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2008-01-02 13:42:52 +00:00
|
|
|
dbus_g_connection_register_g_object (nm_dbus_manager_get_connection (priv->dbus_mgr),
|
2007-09-03 01:12:23 +00:00
|
|
|
NM_DBUS_PATH,
|
2008-08-04 22:24:58 +00:00
|
|
|
G_OBJECT (singleton));
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2008-01-02 13:42:52 +00:00
|
|
|
g_signal_connect (priv->dbus_mgr,
|
2007-09-03 01:12:23 +00:00
|
|
|
"name-owner-changed",
|
|
|
|
|
G_CALLBACK (nm_manager_name_owner_changed),
|
2008-08-04 22:24:58 +00:00
|
|
|
singleton);
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2008-08-04 22:24:58 +00:00
|
|
|
g_idle_add ((GSourceFunc) initial_get_connections, singleton);
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
priv->hal_mgr = nm_hal_manager_new ();
|
2008-08-04 22:24:58 +00:00
|
|
|
priv->sync_devices_id = g_idle_add (deferred_sync_devices, singleton);
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
|
|
|
|
|
g_signal_connect (priv->hal_mgr,
|
|
|
|
|
"udi-added",
|
|
|
|
|
G_CALLBACK (hal_manager_udi_added_cb),
|
2008-08-04 22:24:58 +00:00
|
|
|
singleton);
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
|
|
|
|
|
g_signal_connect (priv->hal_mgr,
|
|
|
|
|
"udi-removed",
|
|
|
|
|
G_CALLBACK (hal_manager_udi_removed_cb),
|
2008-08-04 22:24:58 +00:00
|
|
|
singleton);
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
|
|
|
|
|
g_signal_connect (priv->hal_mgr,
|
|
|
|
|
"rfkill-changed",
|
|
|
|
|
G_CALLBACK (hal_manager_rfkill_changed_cb),
|
2008-08-04 22:24:58 +00:00
|
|
|
singleton);
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
|
|
|
|
|
g_signal_connect (priv->hal_mgr,
|
|
|
|
|
"hal-reappeared",
|
|
|
|
|
G_CALLBACK (hal_manager_hal_reappeared_cb),
|
2008-08-04 22:24:58 +00:00
|
|
|
singleton);
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
|
2009-05-13 21:32:56 -04:00
|
|
|
priv->bluez_mgr = nm_bluez_manager_get ();
|
|
|
|
|
|
|
|
|
|
g_signal_connect (priv->bluez_mgr,
|
|
|
|
|
"bdaddr-added",
|
|
|
|
|
G_CALLBACK (bluez_manager_bdaddr_added_cb),
|
|
|
|
|
singleton);
|
|
|
|
|
|
|
|
|
|
g_signal_connect (priv->bluez_mgr,
|
|
|
|
|
"bdaddr-removed",
|
|
|
|
|
G_CALLBACK (bluez_manager_bdaddr_removed_cb),
|
|
|
|
|
singleton);
|
|
|
|
|
|
2008-08-04 22:24:58 +00:00
|
|
|
return singleton;
|
2007-02-08 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
|
2007-10-07 23:33:28 +00:00
|
|
|
static void
|
|
|
|
|
emit_removed (gpointer key, gpointer value, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMManager *manager = NM_MANAGER (user_data);
|
|
|
|
|
NMConnection *connection = NM_CONNECTION (value);
|
|
|
|
|
|
2008-02-21 03:04:18 +00:00
|
|
|
g_signal_emit (manager, signals[CONNECTION_REMOVED], 0,
|
|
|
|
|
connection,
|
|
|
|
|
nm_connection_get_scope (connection));
|
2007-10-07 23:33:28 +00:00
|
|
|
}
|
|
|
|
|
|
2007-06-22 15:09:02 +00:00
|
|
|
static void
|
2007-09-09 22:18:42 +00:00
|
|
|
nm_manager_connections_destroy (NMManager *manager,
|
2008-02-20 22:37:39 +00:00
|
|
|
NMConnectionScope scope)
|
2007-06-22 15:09:02 +00:00
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
|
2008-02-20 22:37:39 +00:00
|
|
|
if (scope == NM_CONNECTION_SCOPE_USER) {
|
2007-10-07 23:33:28 +00:00
|
|
|
if (priv->user_connections) {
|
|
|
|
|
g_hash_table_foreach (priv->user_connections, emit_removed, manager);
|
2007-09-09 22:18:42 +00:00
|
|
|
g_hash_table_remove_all (priv->user_connections);
|
2007-10-07 23:33:28 +00:00
|
|
|
}
|
2007-09-03 01:12:23 +00:00
|
|
|
|
2007-09-09 22:18:42 +00:00
|
|
|
if (priv->user_proxy) {
|
|
|
|
|
g_object_unref (priv->user_proxy);
|
|
|
|
|
priv->user_proxy = NULL;
|
|
|
|
|
}
|
2008-02-20 22:37:39 +00:00
|
|
|
} else if (scope == NM_CONNECTION_SCOPE_SYSTEM) {
|
2007-10-07 23:33:28 +00:00
|
|
|
if (priv->system_connections) {
|
|
|
|
|
g_hash_table_foreach (priv->system_connections, emit_removed, manager);
|
2007-09-09 22:18:42 +00:00
|
|
|
g_hash_table_remove_all (priv->system_connections);
|
2007-10-07 23:33:28 +00:00
|
|
|
}
|
2007-09-09 22:18:42 +00:00
|
|
|
|
|
|
|
|
if (priv->system_proxy) {
|
|
|
|
|
g_object_unref (priv->system_proxy);
|
|
|
|
|
priv->system_proxy = NULL;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2008-02-20 22:37:39 +00:00
|
|
|
nm_warning ("Unknown NMConnectionScope %d", scope);
|
2007-09-03 01:12:23 +00:00
|
|
|
}
|
2007-06-22 15:09:02 +00:00
|
|
|
}
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
static void
|
|
|
|
|
manager_set_wireless_enabled (NMManager *manager, gboolean enabled)
|
|
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
GSList *iter;
|
|
|
|
|
|
|
|
|
|
if (priv->wireless_enabled == enabled)
|
|
|
|
|
return;
|
|
|
|
|
|
2007-10-16 19:30:29 +00:00
|
|
|
/* Can't set wireless enabled if it's disabled in hardware */
|
|
|
|
|
if (!priv->wireless_hw_enabled && enabled)
|
|
|
|
|
return;
|
|
|
|
|
|
2007-02-08 15:34:26 +00:00
|
|
|
priv->wireless_enabled = enabled;
|
|
|
|
|
|
2007-10-15 14:46:37 +00:00
|
|
|
g_object_notify (G_OBJECT (manager), NM_MANAGER_WIRELESS_ENABLED);
|
|
|
|
|
|
2007-10-16 19:30:29 +00:00
|
|
|
/* Don't touch devices if asleep/networking disabled */
|
|
|
|
|
if (priv->sleeping)
|
|
|
|
|
return;
|
|
|
|
|
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
/* enable/disable wireless devices as required */
|
2007-02-08 15:34:26 +00:00
|
|
|
for (iter = priv->devices; iter; iter = iter->next) {
|
2008-06-10 16:32:39 +00:00
|
|
|
if (NM_IS_DEVICE_WIFI (iter->data))
|
|
|
|
|
nm_device_wifi_set_enabled (NM_DEVICE_WIFI (iter->data), enabled);
|
2007-02-08 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-08 15:09:33 +00:00
|
|
|
static void
|
|
|
|
|
manager_hidden_ap_found (NMDeviceInterface *device,
|
|
|
|
|
NMAccessPoint *ap,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMManager *manager = NM_MANAGER (user_data);
|
|
|
|
|
const struct ether_addr *ap_addr;
|
|
|
|
|
const GByteArray *ap_ssid;
|
|
|
|
|
GSList *iter;
|
|
|
|
|
GSList *connections;
|
|
|
|
|
gboolean done = FALSE;
|
|
|
|
|
|
|
|
|
|
ap_ssid = nm_ap_get_ssid (ap);
|
|
|
|
|
if (ap_ssid && ap_ssid->len)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ap_addr = nm_ap_get_address (ap);
|
|
|
|
|
g_assert (ap_addr);
|
|
|
|
|
|
|
|
|
|
/* Look for this AP's BSSID in the seen-bssids list of a connection,
|
|
|
|
|
* and if a match is found, copy over the SSID */
|
2008-02-20 22:37:39 +00:00
|
|
|
connections = nm_manager_get_connections (manager, NM_CONNECTION_SCOPE_SYSTEM);
|
|
|
|
|
connections = g_slist_concat (connections, nm_manager_get_connections (manager, NM_CONNECTION_SCOPE_USER));
|
2007-10-08 15:09:33 +00:00
|
|
|
|
|
|
|
|
for (iter = connections; iter && !done; iter = g_slist_next (iter)) {
|
|
|
|
|
NMConnection *connection = NM_CONNECTION (iter->data);
|
|
|
|
|
NMSettingWireless *s_wireless;
|
2008-10-28 19:26:00 +00:00
|
|
|
const GByteArray *ssid;
|
|
|
|
|
guint32 num_bssids;
|
|
|
|
|
guint32 i;
|
|
|
|
|
|
2007-11-07 16:06:43 +00:00
|
|
|
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
|
2008-10-28 19:26:00 +00:00
|
|
|
if (!s_wireless)
|
|
|
|
|
goto next;
|
|
|
|
|
|
|
|
|
|
num_bssids = nm_setting_wireless_get_num_seen_bssids (s_wireless);
|
|
|
|
|
if (num_bssids < 1)
|
2007-10-08 15:09:33 +00:00
|
|
|
goto next;
|
|
|
|
|
|
2008-10-28 19:26:00 +00:00
|
|
|
ssid = nm_setting_wireless_get_ssid (s_wireless);
|
|
|
|
|
g_assert (ssid);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < num_bssids; i++) {
|
|
|
|
|
const char *seen_bssid = nm_setting_wireless_get_seen_bssid (s_wireless, i);
|
2007-10-08 15:09:33 +00:00
|
|
|
struct ether_addr seen_addr;
|
|
|
|
|
|
2008-10-28 19:26:00 +00:00
|
|
|
if (!ether_aton_r (seen_bssid, &seen_addr))
|
2007-10-08 15:09:33 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (memcmp (ap_addr, &seen_addr, sizeof (struct ether_addr)))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* Copy the SSID from the connection to the AP */
|
2008-10-28 19:26:00 +00:00
|
|
|
nm_ap_set_ssid (ap, ssid);
|
2007-10-08 15:09:33 +00:00
|
|
|
done = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
next:
|
|
|
|
|
g_object_unref (connection);
|
|
|
|
|
}
|
|
|
|
|
g_slist_free (connections);
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
static void
|
2009-02-16 18:47:03 -05:00
|
|
|
add_device (NMManager *self, NMDevice *device)
|
2007-02-08 15:34:26 +00:00
|
|
|
{
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
2009-02-18 14:21:02 -05:00
|
|
|
const char *iface, *driver;
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
priv->devices = g_slist_append (priv->devices, device);
|
2007-02-08 15:34:26 +00:00
|
|
|
|
|
|
|
|
g_signal_connect (device, "state-changed",
|
2009-02-16 18:47:03 -05:00
|
|
|
G_CALLBACK (manager_device_state_changed),
|
|
|
|
|
self);
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
|
2007-10-08 15:09:33 +00:00
|
|
|
/* Attach to the access-point-added signal so that the manager can fill
|
|
|
|
|
* non-SSID-broadcasting APs with an SSID.
|
|
|
|
|
*/
|
2008-06-10 16:32:39 +00:00
|
|
|
if (NM_IS_DEVICE_WIFI (device)) {
|
2007-10-08 15:09:33 +00:00
|
|
|
g_signal_connect (device, "hidden-ap-found",
|
2009-02-16 18:47:03 -05:00
|
|
|
G_CALLBACK (manager_hidden_ap_found),
|
|
|
|
|
self);
|
2007-10-08 15:09:33 +00:00
|
|
|
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
/* Set initial rfkill state */
|
2008-06-10 16:32:39 +00:00
|
|
|
nm_device_wifi_set_enabled (NM_DEVICE_WIFI (device), priv->wireless_enabled);
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
}
|
|
|
|
|
|
2009-01-19 11:01:00 +02:00
|
|
|
iface = nm_device_get_iface (device);
|
2009-02-18 14:21:02 -05:00
|
|
|
driver = nm_device_get_driver (NM_DEVICE (device));
|
|
|
|
|
if (!driver)
|
|
|
|
|
driver = "unknown";
|
|
|
|
|
|
2009-02-16 18:47:03 -05:00
|
|
|
if (NM_IS_DEVICE_ETHERNET (device))
|
2009-02-18 14:21:02 -05:00
|
|
|
nm_info ("(%s): new Ethernet device (driver: '%s')", iface, driver);
|
2009-02-16 18:47:03 -05:00
|
|
|
else if (NM_IS_DEVICE_WIFI (device))
|
2009-02-18 14:21:02 -05:00
|
|
|
nm_info ("(%s): new 802.11 WiFi device (driver: '%s')", iface, driver);
|
2009-02-16 18:47:03 -05:00
|
|
|
else if (nm_device_get_device_type (device) == NM_DEVICE_TYPE_GSM)
|
2009-02-18 14:21:02 -05:00
|
|
|
nm_info ("(%s): new GSM device (driver: '%s')", iface, driver);
|
2009-02-16 18:47:03 -05:00
|
|
|
else if (nm_device_get_device_type (device) == NM_DEVICE_TYPE_CDMA)
|
2009-02-18 14:21:02 -05:00
|
|
|
nm_info ("(%s): new CDMA device (driver: '%s')", iface, driver);
|
2009-05-19 15:20:20 -04:00
|
|
|
else if (nm_device_get_device_type (device) == NM_DEVICE_TYPE_BT)
|
|
|
|
|
nm_info ("(%s): new Bluetooth device", iface);
|
2009-02-16 18:47:03 -05:00
|
|
|
else
|
|
|
|
|
g_assert_not_reached ();
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
|
2008-01-02 13:42:52 +00:00
|
|
|
dbus_g_connection_register_g_object (nm_dbus_manager_get_connection (priv->dbus_mgr),
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
nm_device_get_udi (NM_DEVICE (device)),
|
2009-01-19 11:01:00 +02:00
|
|
|
G_OBJECT (device));
|
|
|
|
|
nm_info ("(%s): exported as %s", iface, nm_device_get_udi (device));
|
2008-01-02 13:42:52 +00:00
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
g_signal_emit (self, signals[DEVICE_ADDED], 0, device);
|
2007-02-08 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
|
2009-05-19 15:20:20 -04:00
|
|
|
static gboolean
|
|
|
|
|
bdaddr_matches_connection (NMSettingBluetooth *s_bt, const char *bdaddr)
|
|
|
|
|
{
|
|
|
|
|
const GByteArray *arr;
|
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
|
|
arr = nm_setting_bluetooth_get_bdaddr (s_bt);
|
|
|
|
|
|
|
|
|
|
if ( arr != NULL
|
|
|
|
|
&& arr->len == ETH_ALEN) {
|
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
|
|
str = g_strdup_printf ("%02X:%02X:%02X:%02X:%02X:%02X",
|
|
|
|
|
arr->data[0],
|
|
|
|
|
arr->data[1],
|
|
|
|
|
arr->data[2],
|
|
|
|
|
arr->data[3],
|
|
|
|
|
arr->data[4],
|
|
|
|
|
arr->data[5]);
|
|
|
|
|
ret = g_str_equal (str, bdaddr);
|
|
|
|
|
g_free (str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-20 12:02:18 -04:00
|
|
|
static NMConnection *
|
|
|
|
|
bluez_manager_find_connection (NMManager *manager,
|
|
|
|
|
const char *bdaddr,
|
|
|
|
|
guint32 capabilities)
|
2009-05-14 13:59:03 -04:00
|
|
|
{
|
2009-05-20 12:02:18 -04:00
|
|
|
NMConnection *found = NULL;
|
2009-05-14 13:59:03 -04:00
|
|
|
GSList *connections, *l;
|
|
|
|
|
|
2009-05-19 15:20:20 -04:00
|
|
|
connections = nm_manager_get_connections (manager, NM_CONNECTION_SCOPE_SYSTEM);
|
2009-05-20 12:02:18 -04:00
|
|
|
connections = g_slist_concat (connections, nm_manager_get_connections (manager, NM_CONNECTION_SCOPE_USER));
|
2009-05-19 15:20:20 -04:00
|
|
|
|
2009-05-14 13:59:03 -04:00
|
|
|
for (l = connections; l != NULL; l = l->next) {
|
2009-05-20 12:02:18 -04:00
|
|
|
NMConnection *candidate = NM_CONNECTION (l->data);
|
2009-05-14 13:59:03 -04:00
|
|
|
NMSettingConnection *s_con;
|
|
|
|
|
NMSettingBluetooth *s_bt;
|
|
|
|
|
const char *con_type;
|
|
|
|
|
const char *bt_type;
|
|
|
|
|
|
2009-05-20 12:02:18 -04:00
|
|
|
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (candidate, NM_TYPE_SETTING_CONNECTION));
|
2009-05-14 13:59:03 -04:00
|
|
|
g_assert (s_con);
|
|
|
|
|
con_type = nm_setting_connection_get_connection_type (s_con);
|
|
|
|
|
g_assert (con_type);
|
|
|
|
|
if (!g_str_equal (con_type, NM_SETTING_BLUETOOTH_SETTING_NAME))
|
|
|
|
|
continue;
|
|
|
|
|
|
2009-05-20 12:02:18 -04:00
|
|
|
s_bt = (NMSettingBluetooth *) nm_connection_get_setting (candidate, NM_TYPE_SETTING_BLUETOOTH);
|
2009-05-14 13:59:03 -04:00
|
|
|
if (!s_bt)
|
|
|
|
|
continue;
|
|
|
|
|
|
2009-05-19 15:20:20 -04:00
|
|
|
if (!bdaddr_matches_connection (s_bt, bdaddr))
|
2009-05-14 13:59:03 -04:00
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
bt_type = nm_setting_bluetooth_get_connection_type (s_bt);
|
|
|
|
|
if ( g_str_equal (bt_type, NM_SETTING_BLUETOOTH_TYPE_DUN)
|
2009-05-20 12:02:18 -04:00
|
|
|
&& !(capabilities & NM_BT_CAPABILITY_DUN))
|
2009-05-14 13:59:03 -04:00
|
|
|
continue;
|
|
|
|
|
if ( g_str_equal (bt_type, NM_SETTING_BLUETOOTH_TYPE_PANU)
|
2009-05-20 12:02:18 -04:00
|
|
|
&& !(capabilities & NM_BT_CAPABILITY_NAP))
|
2009-05-14 13:59:03 -04:00
|
|
|
continue;
|
|
|
|
|
|
2009-05-20 12:02:18 -04:00
|
|
|
found = candidate;
|
2009-05-14 13:59:03 -04:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_slist_free (connections);
|
|
|
|
|
return found;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-20 12:02:18 -04:00
|
|
|
static void
|
|
|
|
|
bluez_manager_resync_devices (NMManager *self)
|
|
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
|
|
|
|
GSList *iter, *gone = NULL, *keep = NULL;;
|
|
|
|
|
|
|
|
|
|
/* Remove devices from the device list that don't have a corresponding connection */
|
|
|
|
|
for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
|
|
|
|
|
NMDevice *candidate = NM_DEVICE (iter->data);
|
|
|
|
|
guint32 uuids;
|
|
|
|
|
const char *bdaddr;
|
|
|
|
|
|
|
|
|
|
if (NM_IS_DEVICE_BT (candidate)) {
|
|
|
|
|
uuids = nm_device_bt_get_capabilities (NM_DEVICE_BT (candidate));
|
|
|
|
|
bdaddr = nm_device_bt_get_hw_address (NM_DEVICE_BT (candidate));
|
|
|
|
|
|
|
|
|
|
if (bluez_manager_find_connection (self, bdaddr, uuids))
|
|
|
|
|
keep = g_slist_prepend (keep, candidate);
|
|
|
|
|
else
|
|
|
|
|
gone = g_slist_prepend (gone, candidate);
|
|
|
|
|
} else
|
|
|
|
|
keep = g_slist_prepend (keep, candidate);
|
|
|
|
|
}
|
|
|
|
|
g_slist_free (priv->devices);
|
|
|
|
|
priv->devices = keep;
|
|
|
|
|
|
|
|
|
|
while (g_slist_length (gone))
|
|
|
|
|
gone = remove_one_device (self, gone, NM_DEVICE (gone->data));
|
|
|
|
|
|
|
|
|
|
/* Now look for devices without connections */
|
|
|
|
|
nm_bluez_manager_query_devices (priv->bluez_mgr);
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-13 21:32:56 -04:00
|
|
|
static void
|
|
|
|
|
bluez_manager_bdaddr_added_cb (NMBluezManager *bluez_mgr,
|
|
|
|
|
const char *bdaddr,
|
2009-05-14 13:59:03 -04:00
|
|
|
const char *name,
|
|
|
|
|
const char *object_path,
|
|
|
|
|
guint32 capabilities,
|
|
|
|
|
NMManager *manager)
|
2009-05-13 21:32:56 -04:00
|
|
|
{
|
2009-05-14 13:59:03 -04:00
|
|
|
NMDeviceBt *device;
|
|
|
|
|
gboolean has_dun = (capabilities & NM_BT_CAPABILITY_DUN);
|
|
|
|
|
gboolean has_nap = (capabilities & NM_BT_CAPABILITY_NAP);
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (bdaddr != NULL);
|
|
|
|
|
g_return_if_fail (name != NULL);
|
|
|
|
|
g_return_if_fail (object_path != NULL);
|
|
|
|
|
g_return_if_fail (capabilities != NM_BT_CAPABILITY_NONE);
|
2009-05-13 21:32:56 -04:00
|
|
|
|
2009-05-14 13:59:03 -04:00
|
|
|
/* Make sure the device is not already in the device list */
|
|
|
|
|
if (nm_manager_get_device_by_udi (manager, object_path))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (has_dun == FALSE && has_nap == FALSE)
|
|
|
|
|
return;
|
|
|
|
|
|
2009-05-20 12:02:18 -04:00
|
|
|
if (!bluez_manager_find_connection (manager, bdaddr, capabilities))
|
2009-05-14 13:59:03 -04:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
device = nm_device_bt_new (object_path, bdaddr, name, capabilities, TRUE);
|
|
|
|
|
if (!device)
|
|
|
|
|
return;
|
|
|
|
|
|
2009-05-20 12:02:18 -04:00
|
|
|
g_message ("%s: BT device %s added (%s%s%s)",
|
|
|
|
|
__func__,
|
|
|
|
|
bdaddr,
|
|
|
|
|
has_dun ? "DUN" : "",
|
|
|
|
|
has_dun && has_nap ? " " : "",
|
|
|
|
|
has_nap ? "NAP" : "");
|
|
|
|
|
|
2009-05-14 13:59:03 -04:00
|
|
|
add_device (manager, NM_DEVICE (device));
|
2009-05-13 21:32:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
bluez_manager_bdaddr_removed_cb (NMBluezManager *bluez_mgr,
|
2009-05-14 13:59:03 -04:00
|
|
|
const char *bdaddr,
|
2009-05-20 12:02:18 -04:00
|
|
|
const char *object_path,
|
|
|
|
|
gpointer user_data)
|
2009-05-13 21:32:56 -04:00
|
|
|
{
|
2009-05-14 13:59:03 -04:00
|
|
|
NMManager *self = NM_MANAGER (user_data);
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
|
|
|
|
GSList *iter;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (bdaddr != NULL);
|
|
|
|
|
g_return_if_fail (object_path != NULL);
|
|
|
|
|
|
2009-05-13 21:32:56 -04:00
|
|
|
g_message ("%s: BT device %s removed", __func__, bdaddr);
|
2009-05-14 13:59:03 -04:00
|
|
|
|
|
|
|
|
for (iter = priv->devices; iter; iter = iter->next) {
|
|
|
|
|
NMDevice *device = NM_DEVICE (iter->data);
|
|
|
|
|
|
|
|
|
|
if (!strcmp (nm_device_get_udi (device), object_path)) {
|
2009-05-20 12:02:18 -04:00
|
|
|
priv->devices = remove_one_device (self, priv->devices, device);
|
2009-05-14 13:59:03 -04:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-13 21:32:56 -04:00
|
|
|
}
|
|
|
|
|
|
2009-01-19 11:01:00 +02:00
|
|
|
static void
|
|
|
|
|
hal_manager_udi_added_cb (NMHalManager *hal_mgr,
|
|
|
|
|
const char *udi,
|
2009-02-16 18:47:03 -05:00
|
|
|
const char *originating_device,
|
|
|
|
|
gpointer general_type_ptr,
|
2009-01-19 11:01:00 +02:00
|
|
|
NMDeviceCreatorFn creator_fn,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMManager *self = NM_MANAGER (user_data);
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
|
|
|
|
GObject *device;
|
|
|
|
|
|
|
|
|
|
if (priv->sleeping)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Make sure the device is not already in the device list */
|
|
|
|
|
if (nm_manager_get_device_by_udi (self, udi))
|
|
|
|
|
return;
|
|
|
|
|
|
2009-02-16 18:47:03 -05:00
|
|
|
device = creator_fn (hal_mgr, udi, originating_device, nm_manager_udi_is_managed (self, udi));
|
2009-01-19 11:01:00 +02:00
|
|
|
if (!device)
|
|
|
|
|
return;
|
|
|
|
|
|
2009-02-16 18:47:03 -05:00
|
|
|
add_device (self, NM_DEVICE (device));
|
2009-01-19 11:01:00 +02:00
|
|
|
}
|
|
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
static void
|
|
|
|
|
hal_manager_udi_removed_cb (NMHalManager *manager,
|
|
|
|
|
const char *udi,
|
|
|
|
|
gpointer user_data)
|
2007-02-08 15:34:26 +00:00
|
|
|
{
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
NMManager *self = NM_MANAGER (user_data);
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
2007-02-08 15:34:26 +00:00
|
|
|
GSList *iter;
|
|
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
g_return_if_fail (udi != NULL);
|
2007-02-08 15:34:26 +00:00
|
|
|
|
|
|
|
|
for (iter = priv->devices; iter; iter = iter->next) {
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
NMDevice *device = NM_DEVICE (iter->data);
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
if (!strcmp (nm_device_get_udi (device), udi)) {
|
2009-05-20 12:02:18 -04:00
|
|
|
priv->devices = remove_one_device (self, priv->devices, device);
|
2007-02-08 15:34:26 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
static void
|
|
|
|
|
hal_manager_rfkill_changed_cb (NMHalManager *hal_mgr,
|
2009-02-10 23:06:24 -05:00
|
|
|
RfKillState state,
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
gpointer user_data)
|
2007-02-08 15:34:26 +00:00
|
|
|
{
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
NMManager *self = NM_MANAGER (user_data);
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
2009-02-10 23:06:24 -05:00
|
|
|
gboolean enabled = (state == RFKILL_UNBLOCKED);
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
if (priv->wireless_hw_enabled != enabled) {
|
|
|
|
|
nm_info ("Wireless now %s by radio killswitch", enabled ? "enabled" : "disabled");
|
|
|
|
|
priv->wireless_hw_enabled = enabled;
|
|
|
|
|
g_object_notify (G_OBJECT (self), NM_MANAGER_WIRELESS_HARDWARE_ENABLED);
|
|
|
|
|
|
|
|
|
|
manager_set_wireless_enabled (self, enabled);
|
|
|
|
|
}
|
2007-02-08 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
static void
|
|
|
|
|
hal_manager_hal_reappeared_cb (NMHalManager *hal_mgr,
|
|
|
|
|
gpointer user_data)
|
2007-02-12 09:23:43 +00:00
|
|
|
{
|
2008-05-22 14:22:31 +00:00
|
|
|
sync_devices (NM_MANAGER (user_data));
|
2007-02-12 09:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
GSList *
|
|
|
|
|
nm_manager_get_devices (NMManager *manager)
|
2007-02-08 15:34:26 +00:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_MANAGER (manager), NULL);
|
|
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
return NM_MANAGER_GET_PRIVATE (manager)->devices;
|
2007-02-08 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
static gboolean
|
|
|
|
|
impl_manager_get_devices (NMManager *manager, GPtrArray **devices, GError **err)
|
2007-08-26 15:55:27 +00:00
|
|
|
{
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
2007-08-26 15:55:27 +00:00
|
|
|
GSList *iter;
|
|
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
*devices = g_ptr_array_sized_new (g_slist_length (priv->devices));
|
2007-08-26 15:55:27 +00:00
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
for (iter = priv->devices; iter; iter = iter->next)
|
|
|
|
|
g_ptr_array_add (*devices, g_strdup (nm_device_get_udi (NM_DEVICE (iter->data))));
|
2007-08-26 15:55:27 +00:00
|
|
|
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
return TRUE;
|
2007-08-26 15:55:27 +00:00
|
|
|
}
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
static NMActRequest *
|
|
|
|
|
nm_manager_get_act_request_by_path (NMManager *manager,
|
|
|
|
|
const char *path,
|
|
|
|
|
NMDevice **device)
|
|
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
GSList *iter;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (manager != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (device != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (*device == NULL, NULL);
|
|
|
|
|
|
|
|
|
|
for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
|
|
|
|
|
NMActRequest *req;
|
|
|
|
|
const char *ac_path;
|
|
|
|
|
|
|
|
|
|
req = nm_device_get_act_request (NM_DEVICE (iter->data));
|
|
|
|
|
if (!req)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
ac_path = nm_act_request_get_active_connection_path (req);
|
|
|
|
|
if (!strcmp (path, ac_path)) {
|
|
|
|
|
*device = NM_DEVICE (iter->data);
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
|
internal_activate_device (NMManager *manager,
|
|
|
|
|
NMDevice *device,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
const char *specific_object,
|
|
|
|
|
gboolean user_requested,
|
|
|
|
|
GError **error)
|
2007-10-01 15:38:39 +00:00
|
|
|
{
|
|
|
|
|
NMActRequest *req;
|
2008-01-18 02:54:55 +00:00
|
|
|
NMDeviceInterface *dev_iface;
|
2007-10-01 15:38:39 +00:00
|
|
|
gboolean success;
|
2007-08-26 15:55:27 +00:00
|
|
|
|
2008-03-20 19:56:12 +00:00
|
|
|
g_return_val_if_fail (NM_IS_MANAGER (manager), NULL);
|
|
|
|
|
g_return_val_if_fail (NM_IS_DEVICE (device), NULL);
|
|
|
|
|
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
|
2007-10-01 15:38:39 +00:00
|
|
|
|
2008-01-18 02:54:55 +00:00
|
|
|
dev_iface = NM_DEVICE_INTERFACE (device);
|
|
|
|
|
|
2008-04-02 17:44:52 +00:00
|
|
|
/* Ensure the requested connection is compatible with the device */
|
|
|
|
|
if (!nm_device_interface_check_connection_compatible (dev_iface, connection, error))
|
2008-03-20 19:56:12 +00:00
|
|
|
return NULL;
|
2007-12-27 08:06:27 +00:00
|
|
|
|
2008-07-11 10:28:53 +00:00
|
|
|
/* Tear down any existing connection */
|
|
|
|
|
if (nm_device_get_act_request (device)) {
|
|
|
|
|
nm_device_state_changed (device,
|
|
|
|
|
NM_DEVICE_STATE_DISCONNECTED,
|
|
|
|
|
NM_DEVICE_STATE_REASON_NONE);
|
|
|
|
|
}
|
2008-03-07 Dan Williams <dcbw@redhat.com>
First pass of multiple active device support. Expect bugs.
* src/nm-ip4-config.c
src/nm-ip4-config.h
- (nm_ip4_config_get_secondary, nm_ip4_config_set_secondary): remove;
there are better ways to do this in the named manager
* src/nm-device.c
src/nm-device.h
- (nm_device_can_activate): return whether the device can activate a
connection right now; taking into account things like carrier state
and rfkill state
- (nm_device_get_best_auto_connection): renamed from
nm_device_get_best_connection
- (real_act_stage4_get_ip4_config): MTU stuff is now handled in the
device subclasses themselves, so that each device can override the
MTU from it's NMSetting subclass if needed
- (nm_device_set_ip4_config): set MTU when setting up routes and stuff
in NetworkManagerSystem.c, not here
* src/named-manager/nm-named-manager.c
src/named-manager/nm-named-manager.h
- (nm_named_manager_name_owner_changed,
nm_named_manager_dbus_connection_changed): fix for changes to
rewrite_resolv_conf()
- (compute_nameservers): don't need the NMNamedManager at all, remove
from parameter list
- (merge_one_ip4_config): new function; merge ip4 configs together
- (rewrite_resolv_conf): write out resolv.conf from all the stored
ip4 configs; the VPN config takes precedence, then the best
device config, then the rest of the configs
- (get_domain_for_config): take the NMNamedManager as an argument
to check whether the config is the VPN config
- (add_ip4_config_to_named): fixups for removal of the 'secondary'
attribute from ip4 configs
- (add_all_ip4_configs_to_named): add all the configs in priority order
- (remove_ip4_config_from_named): fix for changes to
get_domain_for_config()
- (nm_named_manager_add_ip4_config): assign the config to the right slot
based on its type; callers must pass in the type now
- (get_last_default_domain): remove, unused
- (nm_named_manager_remove_ip4_config): handle config slots correctly
* src/nm-device-802-11-wireless.c
- (real_can_activate): new function
- (real_get_best_auto_connection): renamed from real_get_best_connection
- (real_act_stage4_get_ip4_config): handle MTU override
* src/nm-device-802-3-ethernet.c
- (real_can_activate): new function
- (real_get_best_auto_connection): renamed from real_get_best_connection
- (real_act_stage4_get_ip4_config): new function; handle MTU override
* src/vpn-manager/nm-vpn-connection.c
- (nm_vpn_connection_ip4_config_get): don't need to set the 'secondary'
attribute on the ip4 config
* src/NetworkManagerPolicy.c
- (nm_policy_auto_get_best_device): remove
- (nm_policy_device_change_check): remove
- (update_default_route): new function; set the default route via
the specified device
- (get_device_priority): new function; return the priority number of
a device type WRT which one should have the default route. Order is
(highest to lowest) wired, wireless, GSM, CDMA.
- (update_routing_and_dns): new function; determine which device should
have the default route, then update the routing table and DNS
- (maybe_auto_activate_device): new function; if a device is now
available for activation, find out what connection it would like to
activate and do it
- (schedule_activate_check): new function; if a device can be activated
now, schedule the activation. Each device may have only one
pending activation at a given time.
- (device_state_changed): if activation was canceled, try again,
possibly with another connection; if the device was activated,
update routing and DNS; if the device was deactivated, try again
with another connection
- (device_carrier_changed): if there is no carrier, deactivate the
device; otherwise schedule an activation check for the device
- (wireless_networks_changed): schedule an activation check for the
device
- (device_added): keep track of the signal handler IDs so they can
be removed when the device goes away
- (device_removed): remove any signal handlers that might be attached
to the device; update routing and DNS
- (schedule_activate_all): new function
- (connections_added, connection_added, connection_updated): when
connections change, schedule all devices for an activation check
- (connection_removed): when a device is deactivated because its
connection was removed, schedule another activation check for it
- (nm_policy_destroy): destroy pending activations and disconnect
all device signal handlers
* src/nm-manager.c
- (nm_manager_activate_device): if the device was already actived,
deactivate it
- (deactivate_old_device): remove
- (connection_added_default_handler, impl_manager_activate_device):
don't deactivate other devices when activating this one
* src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerSuSE.c
src/backends/NetworkManagerDebian.c
- (nm_system_get_mtu): remove; MTU should be provided through the
distro's system settings service plugin instead
- (nm_system_device_add_default_route_via_device): remove
- (nm_system_device_add_default_route_via_device_with_iface): remove
- (nm_system_device_replace_default_route): new function; call
generic implementation
* src/backends/NetworkManagerGeneric.c
src/backends/NetworkManagerGeneric.h
- (nm_generic_device_add_default_route_via_device,
nm_generic_device_add_default_route_via_device_with_iface): remove
- (nm_generic_device_replace_default_route): replace the default route
with the given route via some gateway
* src/NetworkManagerSystem.c
src/NetworkManagerSystem.h
- (nm_system_device_set_from_ip4_config): let the policy handle updates
to routing and DNS; but set the MTU here
- (nm_system_vpn_device_set_from_ip4_config): set the route with the
ip_iface of the active device; use the standard MTU setting function
- (nm_system_set_mtu): remove
- (nm_system_device_set_mtu): consolidate MTU setting code in one place
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3391 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-07 19:41:32 +00:00
|
|
|
|
2008-03-20 19:56:12 +00:00
|
|
|
req = nm_act_request_new (connection, specific_object, user_requested, (gpointer) device);
|
2008-01-18 02:54:55 +00:00
|
|
|
success = nm_device_interface_activate (dev_iface, req, error);
|
2007-10-01 15:38:39 +00:00
|
|
|
g_object_unref (req);
|
|
|
|
|
|
2008-04-02 17:44:52 +00:00
|
|
|
return success ? nm_act_request_get_active_connection_path (req) : NULL;
|
2007-10-01 15:38:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
wait_for_connection_expired (gpointer data)
|
|
|
|
|
{
|
|
|
|
|
NMManager *manager = NM_MANAGER (data);
|
2007-10-08 16:27:07 +00:00
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
PendingConnectionInfo *info = priv->pending_connection_info;
|
2007-12-27 08:06:27 +00:00
|
|
|
GError *error = NULL;
|
2007-10-01 15:38:39 +00:00
|
|
|
|
2007-10-10 20:45:15 +00:00
|
|
|
g_return_val_if_fail (info != NULL, FALSE);
|
|
|
|
|
|
2007-12-27 08:06:27 +00:00
|
|
|
g_set_error (&error,
|
|
|
|
|
NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_CONNECTION,
|
|
|
|
|
"%s", "Connection was not provided by any settings service");
|
2008-03-26 13:43:01 +00:00
|
|
|
nm_warning ("Connection (%d) %s failed to activate (timeout): (%d) %s",
|
|
|
|
|
info->scope, info->connection_path, error->code, error->message);
|
2007-12-27 08:06:27 +00:00
|
|
|
dbus_g_method_return_error (info->context, error);
|
|
|
|
|
g_error_free (error);
|
2007-10-01 15:38:39 +00:00
|
|
|
|
|
|
|
|
info->timeout_id = 0;
|
2007-10-08 16:27:07 +00:00
|
|
|
pending_connection_info_destroy (priv->pending_connection_info);
|
|
|
|
|
priv->pending_connection_info = NULL;
|
2007-10-01 15:38:39 +00:00
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
const char *
|
|
|
|
|
nm_manager_activate_connection (NMManager *manager,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
const char *specific_object,
|
|
|
|
|
const char *device_path,
|
|
|
|
|
gboolean user_requested,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
NMDevice *device = NULL;
|
|
|
|
|
char *path = NULL;
|
|
|
|
|
NMSettingConnection *s_con;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (manager != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (connection != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (error != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (*error == NULL, NULL);
|
|
|
|
|
|
|
|
|
|
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
|
|
|
|
|
g_assert (s_con);
|
|
|
|
|
|
2008-10-26 17:41:37 +00:00
|
|
|
if (!strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_VPN_SETTING_NAME)) {
|
2008-03-26 13:43:01 +00:00
|
|
|
NMActRequest *req;
|
|
|
|
|
NMVPNManager *vpn_manager;
|
|
|
|
|
|
|
|
|
|
/* VPN connection */
|
|
|
|
|
req = nm_manager_get_act_request_by_path (manager, specific_object, &device);
|
|
|
|
|
if (!req) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE,
|
|
|
|
|
"%s", "Base connection for VPN connection not active.");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!device) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_DEVICE,
|
|
|
|
|
"%s", "Source connection had no active device.");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vpn_manager = nm_vpn_manager_get ();
|
|
|
|
|
path = (char *) nm_vpn_manager_activate_connection (vpn_manager,
|
|
|
|
|
connection,
|
|
|
|
|
req,
|
|
|
|
|
device,
|
|
|
|
|
error);
|
|
|
|
|
g_object_unref (vpn_manager);
|
|
|
|
|
} else {
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
NMDeviceState state;
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
/* Device-based connection */
|
2008-04-29 Dan Williams <dcbw@redhat.com>
Handle HAL dropouts better; allow NM to start up even if HAL isn't up yet.
* marshallers/nm-marshal.list
- Add marshaller
* src/NetworkManager.c
- (main): let the NMManager handle the NMHalManager
* src/nm-hal-manager.c
src/nm-hal-manager.h
- convert to a GObject, and emit singals when stuff changes. Let the
NMManager handle the signals, instead of the NMHalManager calling
into the NMManager.
* src/nm-manager.c
src/nm-manager.h
- (remove_one_device): consolidate device removals here
- (dispose): use remove_one_device()
- (nm_manager_get_device_by_udi): make static
- (deferred_hal_manager_query_devices): idle handler to query the HAL
manager for devices at startup or wakeup time
- (nm_manager_new): create and monitor the HAL manager
- (hal_manager_udi_added_cb): new function; do what
nm_manager_add_device() used to do when signalled by the hal manager
- (hal_manager_udi_removed_cb): new function; do what
nm_manager_remove_device() used to do when signalled by the hal
manager
- (hal_manager_rfkill_changed_cb): handle rfkill changes from the
hal manager
- (hal_manager_hal_reappeared_cb): when HAL comes back, remove devices
in our device list that aren't known to HAL
- (impl_manager_sleep): on wakeup, re-add devices from an idle handler;
see comments on nm-hal-manager.c::nm_manager_state_changed() a few
commits ago
- (nm_manager_get_device_by_path, nm_manager_is_udi_managed,
nm_manager_activation_pending, nm_manager_wireless_enabled,
nm_manager_wireless_hardware_enabled,
nm_manager_set_wireless_hardware_enabled): remove, unused
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3619 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 23:03:00 +00:00
|
|
|
device = nm_manager_get_device_by_udi (manager, device_path);
|
2008-03-26 13:43:01 +00:00
|
|
|
if (!device) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_DEVICE,
|
|
|
|
|
"%s", "Device not found");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
- Remove the DOWN and CANCELLED device states
- Add UNMANAGED and UNAVAILABLE device states
- Document the device states
* introspection/nm-device.xml
src/nm-device-interface.c
src/nm-device-interface.h
- Add the 'managed' property
* test/nm-tool.c
- (detail_device): print out device state
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_get_system_config, nm_system_device_get_disabled
nm_system_device_free_system_config): remove; they were unused and
their functionality should be re-implemented in each distro's
system settings service plugin
* src/nm-gsm-device.c
src/nm-gsm-device.h
src/nm-cdma-device.c
src/nm-cdma-device.h
- (*_new): take the 'managed' argument
* src/nm-device.c
- (nm_device_set_address): remove, fold into nm_device_bring_up()
- (nm_device_init): start in unmanaged state, not disconnected
- (constructor): don't start device until the system settings service
has had a chance to figure out if the device is managed or not
- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
don't set device state here, let callers handle that as appropriate
- (nm_device_dispose): don't touch the device if it's not managed
- (set_property, get_property, nm_device_class_init): implement the
'managed' property
- (nm_device_state_changed): bring the device up if its now managed,
and deactivate it if it used to be active
- (nm_device_get_managed, nm_device_set_managed): do the right thing
with the managed state
* src/nm-hal-manager.c
- (wired_device_creator, wireless_device_creator, modem_device_creator):
take initial managed state and pass it along to device constructors
- (create_device_and_add_to_list): get managed state and pass to
type creators
* src/nm-device-802-11-wireless.c
- (real_can_activate): fold in most of
nm_device_802_11_wireless_can_activate()
- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
- (link_timeout_cb): instead of deactivating, change device state and
let the device state handler to it
- (real_update_hw_address): clean up
- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
handler to transition to DISCONNECTED if the device isn't rfkilled
* src/nm-device-802-3-ethernet.c
- (set_carrier): move above callers and get rid of prototype
- (device_state_changed): when entering UNAVAILABLE state, schedule an
idle handler to transition to DISCONNECTED if the device has a
carrier
- (real_update_hw_address): clean up
- (link_timeout_cb, ppp_state_changed): change state instead of calling
deactivation directly as deactivation doesn't change state anymore
* src/NetworkManagerPolicy.c
- (schedule_activate_check): yay, remove wireless_enabled hack since
the NMManager and wireless devices work that out themselves now
- (device_state_changed): change to a switch and update for new device
states
- (device_carrier_changed): remove; device handles this now through
state changes
- (device_added): don't care about carrier any more; the initial
activation check will happen when the device transitions to
DISCONNECTED
* src/nm-manager.c
- (dispose): clear unmanaged devices
- (handle_unmanaged_devices): update unmanaged device list and toggle
the managed property on each device when needed
- (system_settings_properties_changed_cb): handle signals from the
system settings service
- (system_settings_get_unmanaged_devices_cb): handle callback from
getting the unmanaged device list method call
- (query_unmanaged_devices): ask the system settings service for its
list of unmanaged devices
- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
devices
- (manager_set_wireless_enabled): push rfkill state down to wireless
devices directly and let them handle the necessary state transitions
- (manager_device_state_changed): update for new device states
- (nm_manager_add_device): set initial rfkill state on wireless devices
- (nm_manager_remove_device): don't touch the device if it's unmanaged
- (nm_manager_activate_connection): return error if the device is
unmanaged
- (nm_manager_sleep): handle new device states correctly; don't change
the state of unavailable/unmanaged devices
* libnm-glib/nm-device-802-11-wireless.c
- (state_changed_cb): update for new device states
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
|
|
|
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (device));
|
|
|
|
|
if (state < NM_DEVICE_STATE_DISCONNECTED) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNMANAGED_DEVICE,
|
|
|
|
|
"%s", "Device not managed by NetworkManager");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
path = (char *) internal_activate_device (manager,
|
|
|
|
|
device,
|
|
|
|
|
connection,
|
|
|
|
|
specific_object,
|
|
|
|
|
user_requested,
|
|
|
|
|
error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return path;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-01 15:38:39 +00:00
|
|
|
static void
|
|
|
|
|
connection_added_default_handler (NMManager *manager,
|
|
|
|
|
NMConnection *connection,
|
2008-02-20 22:37:39 +00:00
|
|
|
NMConnectionScope scope)
|
2007-10-01 15:38:39 +00:00
|
|
|
{
|
2007-10-08 16:27:07 +00:00
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
2007-10-10 20:45:15 +00:00
|
|
|
PendingConnectionInfo *info = priv->pending_connection_info;
|
2008-03-20 19:56:12 +00:00
|
|
|
const char *path;
|
2007-12-27 08:06:27 +00:00
|
|
|
GError *error = NULL;
|
2007-10-01 15:38:39 +00:00
|
|
|
|
2007-10-10 20:45:15 +00:00
|
|
|
if (!info)
|
2007-10-01 15:38:39 +00:00
|
|
|
return;
|
|
|
|
|
|
2008-02-20 22:37:39 +00:00
|
|
|
if (scope != info->scope)
|
2007-10-01 15:38:39 +00:00
|
|
|
return;
|
|
|
|
|
|
2008-02-21 03:04:18 +00:00
|
|
|
if (strcmp (info->connection_path, nm_connection_get_path (connection)))
|
2007-10-01 15:38:39 +00:00
|
|
|
return;
|
|
|
|
|
|
2007-10-10 20:45:15 +00:00
|
|
|
/* Will destroy below; can't be valid during the initial activation start */
|
|
|
|
|
priv->pending_connection_info = NULL;
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
path = nm_manager_activate_connection (manager,
|
|
|
|
|
connection,
|
|
|
|
|
info->specific_object_path,
|
|
|
|
|
info->device_path,
|
|
|
|
|
TRUE,
|
|
|
|
|
&error);
|
2008-03-20 21:20:32 +00:00
|
|
|
if (path) {
|
2008-03-20 19:56:12 +00:00
|
|
|
dbus_g_method_return (info->context, path);
|
2008-03-20 21:20:32 +00:00
|
|
|
g_object_notify (G_OBJECT (manager), NM_MANAGER_ACTIVE_CONNECTIONS);
|
|
|
|
|
} else {
|
2007-12-27 08:06:27 +00:00
|
|
|
dbus_g_method_return_error (info->context, error);
|
2008-03-26 13:43:01 +00:00
|
|
|
nm_warning ("Connection (%d) %s failed to activate: (%d) %s",
|
|
|
|
|
scope, info->connection_path, error->code, error->message);
|
2007-12-27 08:06:27 +00:00
|
|
|
g_error_free (error);
|
2007-02-08 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
|
2007-10-08 16:27:07 +00:00
|
|
|
pending_connection_info_destroy (info);
|
2007-10-01 15:38:39 +00:00
|
|
|
}
|
|
|
|
|
|
2008-11-21 18:11:15 +00:00
|
|
|
static gboolean
|
|
|
|
|
is_user_request_authorized (NMManager *manager,
|
|
|
|
|
DBusGMethodInvocation *context,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
DBusConnection *connection;
|
|
|
|
|
char *sender = NULL;
|
|
|
|
|
gulong sender_uid = G_MAXULONG;
|
|
|
|
|
DBusError dbus_error;
|
|
|
|
|
char *service_owner = NULL;
|
|
|
|
|
const char *service_name;
|
|
|
|
|
gulong service_uid = G_MAXULONG;
|
|
|
|
|
gboolean success = FALSE;
|
|
|
|
|
|
|
|
|
|
/* Ensure the request to activate the user connection came from the
|
|
|
|
|
* same session as the user settings service. FIXME: use ConsoleKit
|
|
|
|
|
* too.
|
|
|
|
|
*/
|
|
|
|
|
if (!priv->user_proxy) {
|
|
|
|
|
g_set_error (error, NM_MANAGER_ERROR,
|
|
|
|
|
NM_MANAGER_ERROR_INVALID_SERVICE,
|
|
|
|
|
"%s", "No user settings service available");
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sender = dbus_g_method_get_sender (context);
|
|
|
|
|
if (!sender) {
|
|
|
|
|
g_set_error (error, NM_MANAGER_ERROR,
|
|
|
|
|
NM_MANAGER_ERROR_PERMISSION_DENIED,
|
|
|
|
|
"%s", "Could not determine D-Bus requestor");
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connection = nm_dbus_manager_get_dbus_connection (priv->dbus_mgr);
|
|
|
|
|
if (!connection) {
|
|
|
|
|
g_set_error (error, NM_MANAGER_ERROR,
|
|
|
|
|
NM_MANAGER_ERROR_PERMISSION_DENIED,
|
|
|
|
|
"%s", "Could not get the D-Bus system bus");
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dbus_error_init (&dbus_error);
|
|
|
|
|
/* FIXME: do this async */
|
|
|
|
|
sender_uid = dbus_bus_get_unix_user (connection, sender, &dbus_error);
|
|
|
|
|
if (dbus_error_is_set (&dbus_error)) {
|
|
|
|
|
dbus_error_free (&dbus_error);
|
|
|
|
|
g_set_error (error, NM_MANAGER_ERROR,
|
|
|
|
|
NM_MANAGER_ERROR_PERMISSION_DENIED,
|
|
|
|
|
"%s", "Could not determine the Unix user ID of the requestor");
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-10 06:31:50 -05:00
|
|
|
/* Let root activate anything.
|
|
|
|
|
* FIXME: use a PolicyKit permission instead
|
|
|
|
|
*/
|
|
|
|
|
if (0 == sender_uid) {
|
|
|
|
|
success = TRUE;
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-21 18:11:15 +00:00
|
|
|
service_name = dbus_g_proxy_get_bus_name (priv->user_proxy);
|
|
|
|
|
if (!service_name) {
|
|
|
|
|
g_set_error (error, NM_MANAGER_ERROR,
|
|
|
|
|
NM_MANAGER_ERROR_PERMISSION_DENIED,
|
|
|
|
|
"%s", "Could not determine user settings service name");
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
service_owner = nm_dbus_manager_get_name_owner (priv->dbus_mgr, service_name, NULL);
|
|
|
|
|
if (!service_owner) {
|
|
|
|
|
g_set_error (error, NM_MANAGER_ERROR,
|
|
|
|
|
NM_MANAGER_ERROR_PERMISSION_DENIED,
|
|
|
|
|
"%s", "Could not determine D-Bus owner of the user settings service");
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dbus_error_init (&dbus_error);
|
|
|
|
|
/* FIXME: do this async */
|
|
|
|
|
service_uid = dbus_bus_get_unix_user (connection, service_owner, &dbus_error);
|
|
|
|
|
if (dbus_error_is_set (&dbus_error)) {
|
|
|
|
|
dbus_error_free (&dbus_error);
|
|
|
|
|
g_set_error (error, NM_MANAGER_ERROR,
|
|
|
|
|
NM_MANAGER_ERROR_PERMISSION_DENIED,
|
|
|
|
|
"%s", "Could not determine the Unix UID of the sender of the request");
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* And finally, the actual UID check */
|
|
|
|
|
if (sender_uid != service_uid) {
|
|
|
|
|
g_set_error (error, NM_MANAGER_ERROR,
|
|
|
|
|
NM_MANAGER_ERROR_PERMISSION_DENIED,
|
|
|
|
|
"%s", "Requestor UID does not match the UID of the user settings service");
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
success = TRUE;
|
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
g_free (sender);
|
|
|
|
|
g_free (service_owner);
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-01 15:38:39 +00:00
|
|
|
static void
|
2008-03-19 20:58:21 +00:00
|
|
|
impl_manager_activate_connection (NMManager *manager,
|
2008-11-21 18:11:15 +00:00
|
|
|
const char *service_name,
|
|
|
|
|
const char *connection_path,
|
|
|
|
|
const char *device_path,
|
|
|
|
|
const char *specific_object_path,
|
|
|
|
|
DBusGMethodInvocation *context)
|
2007-10-01 15:38:39 +00:00
|
|
|
{
|
2008-03-26 13:43:01 +00:00
|
|
|
NMConnectionScope scope = NM_CONNECTION_SCOPE_UNKNOWN;
|
2007-10-01 15:38:39 +00:00
|
|
|
NMConnection *connection;
|
2007-12-27 08:06:27 +00:00
|
|
|
GError *error = NULL;
|
2007-10-16 18:59:36 +00:00
|
|
|
char *real_sop = NULL;
|
2008-03-26 13:43:01 +00:00
|
|
|
char *path = NULL;
|
2007-10-01 15:38:39 +00:00
|
|
|
|
2008-11-21 18:11:15 +00:00
|
|
|
if (!strcmp (service_name, NM_DBUS_SERVICE_USER_SETTINGS)) {
|
|
|
|
|
if (!is_user_request_authorized (manager, context, &error))
|
|
|
|
|
goto err;
|
|
|
|
|
|
2008-02-20 22:37:39 +00:00
|
|
|
scope = NM_CONNECTION_SCOPE_USER;
|
2008-11-21 18:11:15 +00:00
|
|
|
} else if (!strcmp (service_name, NM_DBUS_SERVICE_SYSTEM_SETTINGS))
|
2008-02-20 22:37:39 +00:00
|
|
|
scope = NM_CONNECTION_SCOPE_SYSTEM;
|
2007-10-01 15:38:39 +00:00
|
|
|
else {
|
2007-12-27 08:06:27 +00:00
|
|
|
g_set_error (&error,
|
|
|
|
|
NM_MANAGER_ERROR, NM_MANAGER_ERROR_INVALID_SERVICE,
|
|
|
|
|
"%s", "Invalid settings service name");
|
2007-10-01 15:38:39 +00:00
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-16 18:59:36 +00:00
|
|
|
/* "/" is special-cased to NULL to get through D-Bus */
|
|
|
|
|
if (specific_object_path && strcmp (specific_object_path, "/"))
|
|
|
|
|
real_sop = g_strdup (specific_object_path);
|
|
|
|
|
|
2008-02-20 22:37:39 +00:00
|
|
|
connection = nm_manager_get_connection_by_object_path (manager, scope, connection_path);
|
2007-10-01 15:38:39 +00:00
|
|
|
if (connection) {
|
2008-03-26 13:43:01 +00:00
|
|
|
path = (char *) nm_manager_activate_connection (manager,
|
|
|
|
|
connection,
|
|
|
|
|
real_sop,
|
|
|
|
|
device_path,
|
|
|
|
|
TRUE,
|
|
|
|
|
&error);
|
2008-03-20 21:20:32 +00:00
|
|
|
if (path) {
|
2008-03-20 19:56:12 +00:00
|
|
|
dbus_g_method_return (context, path);
|
2008-03-20 21:20:32 +00:00
|
|
|
g_object_notify (G_OBJECT (manager), NM_MANAGER_ACTIVE_CONNECTIONS);
|
|
|
|
|
}
|
2007-10-01 15:38:39 +00:00
|
|
|
} else {
|
|
|
|
|
PendingConnectionInfo *info;
|
2007-10-08 16:27:07 +00:00
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
|
|
|
|
|
if (priv->pending_connection_info) {
|
|
|
|
|
pending_connection_info_destroy (priv->pending_connection_info);
|
|
|
|
|
priv->pending_connection_info = NULL;
|
|
|
|
|
}
|
2007-10-01 15:38:39 +00:00
|
|
|
|
|
|
|
|
/* Don't have the connection quite yet, probably created by
|
|
|
|
|
* the client on-the-fly. Defer the activation until we have it
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
info = g_slice_new0 (PendingConnectionInfo);
|
|
|
|
|
info->context = context;
|
2008-03-26 13:43:01 +00:00
|
|
|
info->device_path = g_strdup (device_path);
|
2008-02-20 22:37:39 +00:00
|
|
|
info->scope = scope;
|
2007-10-01 15:38:39 +00:00
|
|
|
info->connection_path = g_strdup (connection_path);
|
2007-10-16 18:59:36 +00:00
|
|
|
info->specific_object_path = g_strdup (real_sop);
|
2008-12-31 18:57:36 -05:00
|
|
|
info->timeout_id = g_timeout_add_seconds (5, wait_for_connection_expired, manager);
|
2007-10-01 15:38:39 +00:00
|
|
|
|
2007-10-08 16:27:07 +00:00
|
|
|
// FIXME: should probably be per-device, not global to the manager
|
2007-10-01 15:38:39 +00:00
|
|
|
NM_MANAGER_GET_PRIVATE (manager)->pending_connection_info = info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err:
|
2007-12-27 08:06:27 +00:00
|
|
|
if (error) {
|
|
|
|
|
dbus_g_method_return_error (context, error);
|
2008-03-26 13:43:01 +00:00
|
|
|
nm_warning ("Connection (%d) %s failed to activate: (%d) %s",
|
|
|
|
|
scope, connection_path, error->code, error->message);
|
2007-12-27 08:06:27 +00:00
|
|
|
g_error_free (error);
|
2007-10-01 15:38:39 +00:00
|
|
|
}
|
2007-10-16 18:59:36 +00:00
|
|
|
|
|
|
|
|
g_free (real_sop);
|
2007-02-08 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
gboolean
|
|
|
|
|
nm_manager_deactivate_connection (NMManager *manager,
|
|
|
|
|
const char *connection_path,
|
2008-10-11 19:57:45 +00:00
|
|
|
NMDeviceStateReason reason,
|
2008-03-26 13:43:01 +00:00
|
|
|
GError **error)
|
2007-10-03 14:48:25 +00:00
|
|
|
{
|
2008-03-20 19:56:12 +00:00
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
2008-03-26 13:43:01 +00:00
|
|
|
NMVPNManager *vpn_manager;
|
2007-10-03 14:48:25 +00:00
|
|
|
GSList *iter;
|
2008-03-26 13:43:01 +00:00
|
|
|
gboolean success = FALSE;
|
2008-10-11 19:57:45 +00:00
|
|
|
NMVPNConnectionStateReason vpn_reason = NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED;
|
2007-10-03 14:48:25 +00:00
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
/* Check for device connections first */
|
2007-10-03 14:48:25 +00:00
|
|
|
for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
|
2008-03-20 19:56:12 +00:00
|
|
|
NMDevice *device = NM_DEVICE (iter->data);
|
|
|
|
|
NMActRequest *req;
|
2007-10-03 14:48:25 +00:00
|
|
|
|
2008-03-20 19:56:12 +00:00
|
|
|
req = nm_device_get_act_request (device);
|
|
|
|
|
if (!req)
|
2007-10-03 14:48:25 +00:00
|
|
|
continue;
|
|
|
|
|
|
2008-03-20 19:56:12 +00:00
|
|
|
if (!strcmp (connection_path, nm_act_request_get_active_connection_path (req))) {
|
2008-07-11 10:28:53 +00:00
|
|
|
nm_device_state_changed (device,
|
|
|
|
|
NM_DEVICE_STATE_DISCONNECTED,
|
2008-10-11 19:57:45 +00:00
|
|
|
reason);
|
2008-03-26 13:43:01 +00:00
|
|
|
success = TRUE;
|
|
|
|
|
goto done;
|
2008-03-20 19:56:12 +00:00
|
|
|
}
|
2007-10-03 14:48:25 +00:00
|
|
|
}
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
/* Check for VPN connections next */
|
|
|
|
|
vpn_manager = nm_vpn_manager_get ();
|
2008-10-11 19:57:45 +00:00
|
|
|
if (reason == NM_DEVICE_STATE_REASON_CONNECTION_REMOVED)
|
|
|
|
|
vpn_reason = NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED;
|
|
|
|
|
if (nm_vpn_manager_deactivate_connection (vpn_manager, connection_path, vpn_reason)) {
|
2008-03-26 13:43:01 +00:00
|
|
|
success = TRUE;
|
|
|
|
|
} else {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE,
|
|
|
|
|
"%s", "The connection was not active.");
|
|
|
|
|
}
|
|
|
|
|
g_object_unref (vpn_manager);
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
g_object_notify (G_OBJECT (manager), NM_MANAGER_ACTIVE_CONNECTIONS);
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
impl_manager_deactivate_connection (NMManager *manager,
|
|
|
|
|
const char *connection_path,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
2008-10-11 19:57:45 +00:00
|
|
|
return nm_manager_deactivate_connection (manager,
|
|
|
|
|
connection_path,
|
|
|
|
|
NM_DEVICE_STATE_REASON_USER_REQUESTED,
|
|
|
|
|
error);
|
2007-10-03 14:48:25 +00:00
|
|
|
}
|
|
|
|
|
|
2008-04-29 15:19:31 +00:00
|
|
|
static gboolean
|
|
|
|
|
impl_manager_sleep (NMManager *manager, gboolean sleep, GError **error)
|
2007-02-08 15:34:26 +00:00
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv;
|
|
|
|
|
|
2008-04-29 15:19:31 +00:00
|
|
|
g_return_val_if_fail (NM_IS_MANAGER (manager), FALSE);
|
2007-02-08 15:34:26 +00:00
|
|
|
|
|
|
|
|
priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
|
2008-04-29 15:19:31 +00:00
|
|
|
if (priv->sleeping == sleep) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
NM_MANAGER_ERROR, NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE,
|
|
|
|
|
"Already %s", sleep ? "asleep" : "awake");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2007-02-08 15:34:26 +00:00
|
|
|
|
|
|
|
|
priv->sleeping = sleep;
|
|
|
|
|
|
|
|
|
|
if (sleep) {
|
|
|
|
|
GSList *iter;
|
|
|
|
|
|
2008-04-29 15:19:31 +00:00
|
|
|
nm_info ("Sleeping...");
|
2007-02-08 15:34:26 +00:00
|
|
|
|
|
|
|
|
/* Just deactivate and down all devices from the device list,
|
|
|
|
|
* we'll remove them in 'wake' for speed's sake.
|
|
|
|
|
*/
|
2008-04-29 15:19:31 +00:00
|
|
|
for (iter = priv->devices; iter; iter = iter->next)
|
2008-10-11 19:57:45 +00:00
|
|
|
nm_device_set_managed (NM_DEVICE (iter->data), FALSE, NM_DEVICE_STATE_REASON_SLEEPING);
|
2007-02-08 15:34:26 +00:00
|
|
|
} else {
|
2008-04-29 15:19:31 +00:00
|
|
|
nm_info ("Waking up...");
|
2007-02-08 15:34:26 +00:00
|
|
|
|
2008-05-22 14:27:40 +00:00
|
|
|
sync_devices (manager);
|
|
|
|
|
if (priv->sync_devices_id) {
|
|
|
|
|
g_source_remove (priv->sync_devices_id);
|
|
|
|
|
priv->sync_devices_id = 0;
|
|
|
|
|
}
|
2007-02-08 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
|
2007-09-25 16:47:53 +00:00
|
|
|
nm_manager_update_state (manager);
|
2007-02-12 09:23:43 +00:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-15 07:52:25 +00:00
|
|
|
/* Legacy 0.6 compatibility interface */
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2008-04-29 15:19:31 +00:00
|
|
|
impl_manager_legacy_sleep (NMManager *manager, GError **error)
|
2007-08-15 07:52:25 +00:00
|
|
|
{
|
2008-04-29 15:19:31 +00:00
|
|
|
return impl_manager_sleep (manager, TRUE, error);
|
2007-08-15 07:52:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2008-04-29 15:19:31 +00:00
|
|
|
impl_manager_legacy_wake (NMManager *manager, GError **error)
|
2007-08-15 07:52:25 +00:00
|
|
|
{
|
2008-04-29 15:19:31 +00:00
|
|
|
return impl_manager_sleep (manager, FALSE, error);
|
2007-08-15 07:52:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2007-09-24 21:26:56 +00:00
|
|
|
impl_manager_legacy_state (NMManager *manager, guint32 *state, GError **err)
|
2007-08-15 07:52:25 +00:00
|
|
|
{
|
2007-09-25 16:47:53 +00:00
|
|
|
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
|
|
|
|
|
|
|
|
|
nm_manager_update_state (manager);
|
|
|
|
|
*state = priv->state;
|
2007-09-24 21:26:56 +00:00
|
|
|
return TRUE;
|
2007-08-15 07:52:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-06-22 15:09:02 +00:00
|
|
|
/* Connections */
|
|
|
|
|
|
2007-10-06 13:27:51 +00:00
|
|
|
static int
|
|
|
|
|
connection_sort (gconstpointer pa, gconstpointer pb)
|
|
|
|
|
{
|
|
|
|
|
NMConnection *a = NM_CONNECTION (pa);
|
|
|
|
|
NMSettingConnection *con_a;
|
|
|
|
|
NMConnection *b = NM_CONNECTION (pb);
|
|
|
|
|
NMSettingConnection *con_b;
|
|
|
|
|
|
2007-11-07 16:06:43 +00:00
|
|
|
con_a = (NMSettingConnection *) nm_connection_get_setting (a, NM_TYPE_SETTING_CONNECTION);
|
2007-10-06 13:27:51 +00:00
|
|
|
g_assert (con_a);
|
2007-11-07 16:06:43 +00:00
|
|
|
con_b = (NMSettingConnection *) nm_connection_get_setting (b, NM_TYPE_SETTING_CONNECTION);
|
2007-10-06 13:27:51 +00:00
|
|
|
g_assert (con_b);
|
|
|
|
|
|
2008-10-26 17:41:37 +00:00
|
|
|
if (nm_setting_connection_get_autoconnect (con_a) != nm_setting_connection_get_autoconnect (con_b)) {
|
|
|
|
|
if (nm_setting_connection_get_autoconnect (con_a))
|
2007-10-06 13:27:51 +00:00
|
|
|
return -1;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-26 17:41:37 +00:00
|
|
|
if (nm_setting_connection_get_timestamp (con_a) > nm_setting_connection_get_timestamp (con_b))
|
2007-10-06 13:27:51 +00:00
|
|
|
return -1;
|
2008-10-26 17:41:37 +00:00
|
|
|
else if (nm_setting_connection_get_timestamp (con_a) == nm_setting_connection_get_timestamp (con_b))
|
2007-10-06 13:27:51 +00:00
|
|
|
return 0;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
static void
|
|
|
|
|
connections_to_slist (gpointer key, gpointer value, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
GSList **list = (GSList **) user_data;
|
|
|
|
|
|
2007-10-06 13:27:51 +00:00
|
|
|
*list = g_slist_insert_sorted (*list, g_object_ref (value), connection_sort);
|
2007-09-03 01:12:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns a GSList of referenced NMConnection objects, caller must
|
|
|
|
|
* unref the connections in the list and destroy the list.
|
|
|
|
|
*/
|
2007-06-22 15:09:02 +00:00
|
|
|
GSList *
|
2007-09-09 22:18:42 +00:00
|
|
|
nm_manager_get_connections (NMManager *manager,
|
2008-02-20 22:37:39 +00:00
|
|
|
NMConnectionScope scope)
|
2007-06-22 15:09:02 +00:00
|
|
|
{
|
2007-09-03 01:12:23 +00:00
|
|
|
NMManagerPrivate *priv;
|
|
|
|
|
GSList *list = NULL;
|
|
|
|
|
|
2007-06-22 15:09:02 +00:00
|
|
|
g_return_val_if_fail (NM_IS_MANAGER (manager), NULL);
|
|
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
priv = NM_MANAGER_GET_PRIVATE (manager);
|
2008-02-20 22:37:39 +00:00
|
|
|
if (scope == NM_CONNECTION_SCOPE_USER)
|
2007-09-09 22:18:42 +00:00
|
|
|
g_hash_table_foreach (priv->user_connections, connections_to_slist, &list);
|
2008-02-20 22:37:39 +00:00
|
|
|
else if (scope == NM_CONNECTION_SCOPE_SYSTEM)
|
2007-09-09 22:18:42 +00:00
|
|
|
g_hash_table_foreach (priv->system_connections, connections_to_slist, &list);
|
|
|
|
|
else
|
2008-02-20 22:37:39 +00:00
|
|
|
nm_warning ("Unknown NMConnectionScope %d", scope);
|
2007-09-03 01:12:23 +00:00
|
|
|
return list;
|
2007-06-22 15:09:02 +00:00
|
|
|
}
|
|
|
|
|
|
2007-09-09 22:18:42 +00:00
|
|
|
NMConnection *
|
|
|
|
|
nm_manager_get_connection_by_object_path (NMManager *manager,
|
2008-02-20 22:37:39 +00:00
|
|
|
NMConnectionScope scope,
|
2007-09-09 22:18:42 +00:00
|
|
|
const char *path)
|
|
|
|
|
{
|
|
|
|
|
NMManagerPrivate *priv;
|
|
|
|
|
NMConnection *connection = NULL;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (NM_IS_MANAGER (manager), NULL);
|
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
priv = NM_MANAGER_GET_PRIVATE (manager);
|
2008-02-20 22:37:39 +00:00
|
|
|
if (scope == NM_CONNECTION_SCOPE_USER)
|
2007-09-09 22:18:42 +00:00
|
|
|
connection = (NMConnection *) g_hash_table_lookup (priv->user_connections, path);
|
2008-02-20 22:37:39 +00:00
|
|
|
else if (scope == NM_CONNECTION_SCOPE_SYSTEM)
|
2007-09-09 22:18:42 +00:00
|
|
|
connection = (NMConnection *) g_hash_table_lookup (priv->system_connections, path);
|
|
|
|
|
else
|
2008-02-20 22:37:39 +00:00
|
|
|
nm_warning ("Unknown NMConnectionScope %d", scope);
|
2007-09-09 22:18:42 +00:00
|
|
|
return connection;
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-26 13:43:01 +00:00
|
|
|
GPtrArray *
|
|
|
|
|
nm_manager_get_active_connections_by_connection (NMManager *manager,
|
|
|
|
|
NMConnection *connection)
|
|
|
|
|
{
|
|
|
|
|
return get_active_connections (manager, connection);
|
|
|
|
|
}
|
|
|
|
|
|