2008-06-10 15:54:23 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
2005-12-31 08:21:24 +00:00
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
2008-06-26 18:31:52 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2005-12-31 08:21:24 +00:00
|
|
|
*
|
2011-01-10 23:39:12 -06:00
|
|
|
* Copyright (C) 2005 - 2011 Red Hat, Inc.
|
2008-11-03 04:13:42 +00:00
|
|
|
* Copyright (C) 2006 - 2008 Novell, Inc.
|
2005-12-31 08:21:24 +00:00
|
|
|
*/
|
|
|
|
|
|
2011-03-14 01:00:56 -05:00
|
|
|
#include "config.h"
|
2005-12-31 08:21:24 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
#include <glib/gi18n.h>
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <net/ethernet.h>
|
|
|
|
|
#include <stdlib.h>
|
2008-09-19 17:12:15 +00:00
|
|
|
#include <linux/types.h>
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
#include <linux/sockios.h>
|
2008-10-27 10:50:21 +00:00
|
|
|
#include <linux/version.h>
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
#include <linux/ethtool.h>
|
2008-03-14 20:37:48 +00:00
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
#include <unistd.h>
|
2009-09-28 11:09:31 -07:00
|
|
|
#include <linux/if.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 <errno.h>
|
2011-06-30 12:54:18 +02:00
|
|
|
#include <netinet/ether.h>
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2010-06-25 19:49:39 -07:00
|
|
|
#include <gudev/gudev.h>
|
|
|
|
|
|
2008-12-31 18:57:36 -05:00
|
|
|
#include "nm-glib-compat.h"
|
2008-06-10 15:54:23 +00:00
|
|
|
#include "nm-device-ethernet.h"
|
2005-12-31 08:21:24 +00:00
|
|
|
#include "nm-device-private.h"
|
|
|
|
|
#include "nm-activation-request.h"
|
|
|
|
|
#include "NetworkManagerUtils.h"
|
2006-11-25 15:41:04 +00:00
|
|
|
#include "nm-supplicant-manager.h"
|
2008-03-18 22:19:09 +00:00
|
|
|
#include "nm-supplicant-interface.h"
|
|
|
|
|
#include "nm-supplicant-config.h"
|
2010-03-02 15:06:14 -08:00
|
|
|
#include "nm-system.h"
|
2007-11-07 16:06:43 +00:00
|
|
|
#include "nm-setting-connection.h"
|
|
|
|
|
#include "nm-setting-wired.h"
|
2008-03-18 22:19:09 +00:00
|
|
|
#include "nm-setting-8021x.h"
|
2008-03-11 16:37:41 +00:00
|
|
|
#include "nm-setting-pppoe.h"
|
2011-10-18 13:48:45 +02:00
|
|
|
#include "nm-setting-bond.h"
|
2008-03-11 16:37:41 +00:00
|
|
|
#include "ppp-manager/nm-ppp-manager.h"
|
2010-04-07 13:24:25 -07:00
|
|
|
#include "nm-logging.h"
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
#include "nm-properties-changed-signal.h"
|
2011-10-10 16:00:28 -04:00
|
|
|
#include "nm-utils.h"
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2008-06-10 15:54:23 +00:00
|
|
|
#include "nm-device-ethernet-glue.h"
|
2007-02-12 09:23:43 +00:00
|
|
|
|
|
|
|
|
|
2011-10-14 10:13:49 -04:00
|
|
|
G_DEFINE_TYPE (NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE_WIRED)
|
2007-02-12 09:23:43 +00:00
|
|
|
|
2008-06-10 15:54:23 +00:00
|
|
|
#define NM_DEVICE_ETHERNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate))
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2008-03-18 22:19:09 +00:00
|
|
|
#define WIRED_SECRETS_TRIES "wired-secrets-tries"
|
|
|
|
|
|
2008-04-02 17:44:52 +00:00
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
NM_ETHERNET_ERROR_CONNECTION_NOT_WIRED = 0,
|
|
|
|
|
NM_ETHERNET_ERROR_CONNECTION_INVALID,
|
|
|
|
|
NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE,
|
|
|
|
|
} NMEthernetError;
|
|
|
|
|
|
|
|
|
|
#define NM_ETHERNET_ERROR (nm_ethernet_error_quark ())
|
|
|
|
|
#define NM_TYPE_ETHERNET_ERROR (nm_ethernet_error_get_type ())
|
|
|
|
|
|
2011-12-07 13:15:23 +01:00
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
NM_ETHERNET_TYPE_UNSPEC = 0,
|
|
|
|
|
NM_ETHERNET_TYPE_BOND,
|
|
|
|
|
} NMEthernetType;
|
|
|
|
|
|
2008-03-18 22:19:09 +00:00
|
|
|
typedef struct Supplicant {
|
|
|
|
|
NMSupplicantManager *mgr;
|
|
|
|
|
NMSupplicantInterface *iface;
|
|
|
|
|
|
|
|
|
|
/* signal handler ids */
|
2008-09-25 10:02:28 +00:00
|
|
|
guint iface_error_id;
|
|
|
|
|
guint iface_state_id;
|
|
|
|
|
|
|
|
|
|
/* Timeouts and idles */
|
|
|
|
|
guint iface_con_error_cb_id;
|
|
|
|
|
guint con_timeout_id;
|
2008-03-18 22:19:09 +00:00
|
|
|
} Supplicant;
|
|
|
|
|
|
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
|
|
|
typedef struct {
|
2010-09-27 09:53:51 +02:00
|
|
|
guint8 perm_hw_addr[ETH_ALEN]; /* Permanent MAC address */
|
|
|
|
|
guint8 initial_hw_addr[ETH_ALEN]; /* Initial MAC address (as seen when NM starts) */
|
2006-11-25 15:41:04 +00:00
|
|
|
|
2008-03-18 22:19:09 +00:00
|
|
|
Supplicant supplicant;
|
2009-09-28 12:57:18 -07:00
|
|
|
guint supplicant_timeout_id;
|
2008-03-11 16:37:41 +00:00
|
|
|
|
2010-06-25 19:49:39 -07:00
|
|
|
/* s390 */
|
|
|
|
|
char * subchan1;
|
|
|
|
|
char * subchan2;
|
|
|
|
|
char * subchan3;
|
2010-06-25 21:44:01 -07:00
|
|
|
char * subchannels; /* Composite used for checking unmanaged specs */
|
2010-06-25 19:49:39 -07:00
|
|
|
|
2008-03-11 16:37:41 +00:00
|
|
|
/* PPPoE */
|
|
|
|
|
NMPPPManager *ppp_manager;
|
|
|
|
|
NMIP4Config *pending_ip4_config;
|
2011-12-07 13:15:23 +01:00
|
|
|
|
|
|
|
|
NMEthernetType type;
|
2008-06-10 15:54:23 +00:00
|
|
|
} NMDeviceEthernetPrivate;
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
enum {
|
|
|
|
|
PROPERTIES_CHANGED,
|
|
|
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
enum {
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_HW_ADDRESS,
|
2010-06-22 14:21:25 +02:00
|
|
|
PROP_PERM_HW_ADDRESS,
|
2007-02-12 09:23:43 +00:00
|
|
|
PROP_SPEED,
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
PROP_CARRIER,
|
2007-02-12 09:23:43 +00:00
|
|
|
|
|
|
|
|
LAST_PROP
|
|
|
|
|
};
|
|
|
|
|
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
|
2008-06-10 15:54:23 +00:00
|
|
|
static gboolean supports_mii_carrier_detect (NMDeviceEthernet *dev);
|
|
|
|
|
static gboolean supports_ethtool_carrier_detect (NMDeviceEthernet *dev);
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2008-04-02 17:44:52 +00:00
|
|
|
static GQuark
|
|
|
|
|
nm_ethernet_error_quark (void)
|
|
|
|
|
{
|
|
|
|
|
static GQuark quark = 0;
|
|
|
|
|
if (!quark)
|
|
|
|
|
quark = g_quark_from_static_string ("nm-ethernet-error");
|
|
|
|
|
return quark;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This should really be standard. */
|
|
|
|
|
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
|
|
|
|
|
|
|
|
|
|
static GType
|
|
|
|
|
nm_ethernet_error_get_type (void)
|
|
|
|
|
{
|
|
|
|
|
static GType etype = 0;
|
|
|
|
|
|
|
|
|
|
if (etype == 0) {
|
|
|
|
|
static const GEnumValue values[] = {
|
|
|
|
|
/* Connection was not a wired connection. */
|
|
|
|
|
ENUM_ENTRY (NM_ETHERNET_ERROR_CONNECTION_NOT_WIRED, "ConnectionNotWired"),
|
|
|
|
|
/* Connection was not a valid wired connection. */
|
|
|
|
|
ENUM_ENTRY (NM_ETHERNET_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
|
|
|
|
|
/* Connection does not apply to this device. */
|
|
|
|
|
ENUM_ENTRY (NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE, "ConnectionIncompatible"),
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
|
};
|
|
|
|
|
etype = g_enum_register_static ("NMEthernetError", values);
|
|
|
|
|
}
|
|
|
|
|
return etype;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-25 19:49:39 -07:00
|
|
|
static void
|
|
|
|
|
_update_s390_subchannels (NMDeviceEthernet *self)
|
|
|
|
|
{
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
|
|
|
|
const char *iface;
|
|
|
|
|
GUdevClient *client;
|
|
|
|
|
GUdevDevice *dev;
|
2010-11-19 16:17:40 -06:00
|
|
|
GUdevDevice *parent = NULL;
|
2010-06-25 19:49:39 -07:00
|
|
|
const char *parent_path, *item, *driver;
|
|
|
|
|
const char *subsystems[] = { "net", NULL };
|
|
|
|
|
GDir *dir;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
iface = nm_device_get_iface (NM_DEVICE (self));
|
|
|
|
|
|
|
|
|
|
client = g_udev_client_new (subsystems);
|
|
|
|
|
if (!client) {
|
|
|
|
|
nm_log_warn (LOGD_DEVICE | LOGD_HW, "(%s): failed to initialize GUdev client", iface);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dev = g_udev_client_query_by_subsystem_and_name (client, "net", iface);
|
|
|
|
|
if (!dev) {
|
|
|
|
|
nm_log_warn (LOGD_DEVICE | LOGD_HW, "(%s): failed to find device with udev", iface);
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Try for the "ccwgroup" parent */
|
|
|
|
|
parent = g_udev_device_get_parent_with_subsystem (dev, "ccwgroup", NULL);
|
|
|
|
|
if (!parent) {
|
|
|
|
|
/* FIXME: whatever 'lcs' devices' subsystem is here... */
|
|
|
|
|
if (!parent) {
|
|
|
|
|
/* Not an s390 device */
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parent_path = g_udev_device_get_sysfs_path (parent);
|
|
|
|
|
dir = g_dir_open (parent_path, 0, &error);
|
|
|
|
|
if (!dir) {
|
|
|
|
|
nm_log_warn (LOGD_DEVICE | LOGD_HW, "(%s): failed to open directory '%s': %s",
|
|
|
|
|
iface, parent_path,
|
|
|
|
|
error && error->message ? error->message : "(unknown)");
|
|
|
|
|
g_clear_error (&error);
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* FIXME: we probably care about ordering here to ensure that we map
|
|
|
|
|
* cdev0 -> subchan1, cdev1 -> subchan2, etc.
|
|
|
|
|
*/
|
|
|
|
|
while ((item = g_dir_read_name (dir))) {
|
|
|
|
|
char buf[50];
|
|
|
|
|
char *cdev_path;
|
|
|
|
|
|
|
|
|
|
if (strncmp (item, "cdev", 4))
|
|
|
|
|
continue; /* Not a subchannel link */
|
|
|
|
|
|
|
|
|
|
cdev_path = g_strdup_printf ("%s/%s", parent_path, item);
|
|
|
|
|
|
|
|
|
|
memset (buf, 0, sizeof (buf));
|
|
|
|
|
errno = 0;
|
|
|
|
|
if (readlink (cdev_path, &buf[0], sizeof (buf) - 1) >= 0) {
|
|
|
|
|
if (!priv->subchan1)
|
|
|
|
|
priv->subchan1 = g_path_get_basename (buf);
|
|
|
|
|
else if (!priv->subchan2)
|
|
|
|
|
priv->subchan2 = g_path_get_basename (buf);
|
|
|
|
|
else if (!priv->subchan3)
|
|
|
|
|
priv->subchan3 = g_path_get_basename (buf);
|
|
|
|
|
} else {
|
|
|
|
|
nm_log_warn (LOGD_DEVICE | LOGD_HW,
|
2011-03-19 12:44:14 -05:00
|
|
|
"(%s): failed to read cdev link '%s': %d",
|
2010-06-25 19:49:39 -07:00
|
|
|
iface, cdev_path, errno);
|
|
|
|
|
}
|
|
|
|
|
g_free (cdev_path);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
g_dir_close (dir);
|
|
|
|
|
|
2010-06-25 21:44:01 -07:00
|
|
|
if (priv->subchan3) {
|
|
|
|
|
priv->subchannels = g_strdup_printf ("%s,%s,%s",
|
|
|
|
|
priv->subchan1,
|
|
|
|
|
priv->subchan2,
|
|
|
|
|
priv->subchan3);
|
|
|
|
|
} else if (priv->subchan2) {
|
|
|
|
|
priv->subchannels = g_strdup_printf ("%s,%s",
|
|
|
|
|
priv->subchan1,
|
|
|
|
|
priv->subchan2);
|
|
|
|
|
} else
|
|
|
|
|
priv->subchannels = g_strdup (priv->subchan1);
|
|
|
|
|
|
2010-06-25 21:46:57 -07:00
|
|
|
driver = nm_device_get_driver (NM_DEVICE (self));
|
|
|
|
|
nm_log_info (LOGD_DEVICE | LOGD_HW,
|
|
|
|
|
"(%s): found s390 '%s' subchannels [%s]",
|
|
|
|
|
iface, driver ? driver : "(unknown driver)", priv->subchannels);
|
|
|
|
|
|
2010-06-25 19:49:39 -07:00
|
|
|
out:
|
|
|
|
|
if (parent)
|
|
|
|
|
g_object_unref (parent);
|
|
|
|
|
if (dev)
|
|
|
|
|
g_object_unref (dev);
|
|
|
|
|
g_object_unref (client);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static GObject*
|
|
|
|
|
constructor (GType type,
|
|
|
|
|
guint n_construct_params,
|
|
|
|
|
GObjectConstructParam *construct_params)
|
2005-12-31 08:21:24 +00:00
|
|
|
{
|
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
|
|
|
GObject *object;
|
2009-09-14 12:12:33 -07:00
|
|
|
NMDeviceEthernetPrivate *priv;
|
|
|
|
|
NMDevice *self;
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2008-06-10 15:54:23 +00:00
|
|
|
object = G_OBJECT_CLASS (nm_device_ethernet_parent_class)->constructor (type,
|
2009-08-03 17:15:03 -04:00
|
|
|
n_construct_params,
|
|
|
|
|
construct_params);
|
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
|
|
|
if (!object)
|
|
|
|
|
return NULL;
|
2007-02-05 12:14:09 +00:00
|
|
|
|
2009-09-14 12:12:33 -07:00
|
|
|
self = NM_DEVICE (object);
|
|
|
|
|
priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2007-11-29 14:38:07 +00:00
|
|
|
|
2011-12-07 13:15:23 +01:00
|
|
|
// FIXME: Convert this into a no-export property so type can be specified
|
|
|
|
|
// when the device is created.
|
|
|
|
|
if (!strcmp(nm_device_get_driver (self), "bonding"))
|
|
|
|
|
priv->type = NM_ETHERNET_TYPE_BOND;
|
|
|
|
|
else
|
|
|
|
|
priv->type = NM_ETHERNET_TYPE_UNSPEC;
|
|
|
|
|
|
2011-10-21 16:13:14 -04:00
|
|
|
nm_log_dbg (LOGD_HW | LOGD_ETHER, "(%s): kernel ifindex %d",
|
2010-04-21 14:58:25 -07:00
|
|
|
nm_device_get_iface (NM_DEVICE (self)),
|
|
|
|
|
nm_device_get_ifindex (NM_DEVICE (self)));
|
2010-04-08 09:30:05 -07:00
|
|
|
|
2010-06-25 19:49:39 -07:00
|
|
|
/* s390 stuff */
|
|
|
|
|
_update_s390_subchannels (NM_DEVICE_ETHERNET (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
|
|
|
return object;
|
2005-12-31 08:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
2011-01-18 18:35:35 -06:00
|
|
|
static void
|
|
|
|
|
clear_secrets_tries (NMDevice *device)
|
|
|
|
|
{
|
|
|
|
|
NMActRequest *req;
|
|
|
|
|
NMConnection *connection;
|
|
|
|
|
|
|
|
|
|
req = nm_device_get_act_request (device);
|
|
|
|
|
if (req) {
|
|
|
|
|
connection = nm_act_request_get_connection (req);
|
|
|
|
|
/* Clear wired secrets tries on success, failure, or when deactivating */
|
|
|
|
|
g_object_set_data (G_OBJECT (connection), WIRED_SECRETS_TRIES, NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
device_state_changed (NMDevice *device,
|
|
|
|
|
NMDeviceState new_state,
|
|
|
|
|
NMDeviceState old_state,
|
|
|
|
|
NMDeviceStateReason reason,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
2011-12-07 13:15:23 +01:00
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2011-01-18 18:35:35 -06:00
|
|
|
|
|
|
|
|
switch (new_state) {
|
|
|
|
|
case NM_DEVICE_STATE_ACTIVATED:
|
|
|
|
|
case NM_DEVICE_STATE_FAILED:
|
|
|
|
|
case NM_DEVICE_STATE_DISCONNECTED:
|
|
|
|
|
clear_secrets_tries (device);
|
|
|
|
|
break;
|
2011-12-07 13:15:23 +01:00
|
|
|
|
|
|
|
|
case NM_DEVICE_STATE_UNAVAILABLE:
|
|
|
|
|
switch (priv->type) {
|
|
|
|
|
case NM_ETHERNET_TYPE_BOND:
|
|
|
|
|
/* Use NM_DEVICE_STATE_REASON_CARRIER to make sure num retries is reset */
|
2011-12-08 11:46:58 -06:00
|
|
|
nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_CARRIER);
|
2011-12-07 13:15:23 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2011-01-18 18:35:35 -06:00
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-05 Dan Williams <dcbw@redhat.com>
Process netlink messages in device subclasses rather than in
NetworkManager.c. Also add support for recognizing Wireless Events.
* configure.in
- Find GLIB_GENMARSHAL
* src/Makefile.am
- Since we're marshalling custom types for wireless event signals,
we get to create our own marshallers using GLIB_GENMARSHAL
* src/NetworkManager.c
- (nm_monitor_wired_link_state): renamed to nm_monitor_setup
- (nm_monitor_setup): renamed from nm_monitor_wired_link_state, and
cut down somewhat. We no longer process signals here.
- (nm_data_new): create the netlink monitor here, and remove a
useless call to nm_policy_schedule_device_change_check()
- (nm_data_free): get rid of the netlink monitor here
- (nm_device_link_activated, nm_device_link_deactivated): removed
- (main): don't create the netlink monitor here, let nm_data_new
do that. Call nm_policy_schedule_device_change_check() right
before we jump to the mainloop to figure out which device
to use first
* src/NetworkManagerSystem.[ch]
- (nm_system_get_rtnl_index_from_iface, nm_system_get_iface_from_rtnl_index):
convert back and forth from interface names to interface
indexes
* src/nm-device-802-11-wireless.c
- (real_init): connect to wireless-event signals from the netlink
monitor object
- (nm_device_802_11_wireless_event): new function, schedule handler
for wireless event signals from the netlink monitor object. We
want the handler to run in the device's context
- (wireless_event_helper): handle wireless-event signals from netlink
- (nm_device_802_11_wireless_dispose): disconnect wireless-event
signal handler
* src/nm-device-802-11-wireless.h
- remove unused prototype for nm_device_802_11_wireless_new
* src/nm-device-802-3-ethernet.c
- (real_init): new function; set up signal handlers for link events
- (nm_device_802_3_ethernet_link_activated): new function, schedule
handler for netlink link activated events on device's main loop
- (link_activated_helper): when we get a link activated event, set
the device's link to be active
- (nm_device_802_3_ethernet_link_deactivated): new function; schedule
handler for netlink link deactivated events on device's main loop
- (link_deactivated_helper): when we get a link deactivated event, set
the device's link to be inactive
- (nm_device_802_3_ethernet_dispose): disconnect signal handler on
dispose
* src/nm-device-802-3-ethernet.h
- remove unused prototype for nm_device_802_3_ethernet_new
* src/nm-device.[ch]
- (nm_get_device_by_iface_locked): variant of nm_get_device_by_iface
but locks the device list
- (nm_device_set_active_link): a little bit of cleanup and de-indenting
* src/nm-netlink-monitor.[ch]
- (nm_netlink_monitor_class_install_signals): New signal
"wireless-event"
- (nm_netlink_monitor_new): keep reference to NMData so we can get
at the device list
- (nm_netlink_monitor_event_handler): expand for wireless events too
* src/nm-marshal-main.c
- Include generated nm-marshal.c and nm-marshal.h
* src/nm-marshal.list
- List of custom marshal functions
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1555 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-06 01:10:58 +00:00
|
|
|
static void
|
2008-06-10 15:54:23 +00:00
|
|
|
nm_device_ethernet_init (NMDeviceEthernet * self)
|
2006-03-05 Dan Williams <dcbw@redhat.com>
Process netlink messages in device subclasses rather than in
NetworkManager.c. Also add support for recognizing Wireless Events.
* configure.in
- Find GLIB_GENMARSHAL
* src/Makefile.am
- Since we're marshalling custom types for wireless event signals,
we get to create our own marshallers using GLIB_GENMARSHAL
* src/NetworkManager.c
- (nm_monitor_wired_link_state): renamed to nm_monitor_setup
- (nm_monitor_setup): renamed from nm_monitor_wired_link_state, and
cut down somewhat. We no longer process signals here.
- (nm_data_new): create the netlink monitor here, and remove a
useless call to nm_policy_schedule_device_change_check()
- (nm_data_free): get rid of the netlink monitor here
- (nm_device_link_activated, nm_device_link_deactivated): removed
- (main): don't create the netlink monitor here, let nm_data_new
do that. Call nm_policy_schedule_device_change_check() right
before we jump to the mainloop to figure out which device
to use first
* src/NetworkManagerSystem.[ch]
- (nm_system_get_rtnl_index_from_iface, nm_system_get_iface_from_rtnl_index):
convert back and forth from interface names to interface
indexes
* src/nm-device-802-11-wireless.c
- (real_init): connect to wireless-event signals from the netlink
monitor object
- (nm_device_802_11_wireless_event): new function, schedule handler
for wireless event signals from the netlink monitor object. We
want the handler to run in the device's context
- (wireless_event_helper): handle wireless-event signals from netlink
- (nm_device_802_11_wireless_dispose): disconnect wireless-event
signal handler
* src/nm-device-802-11-wireless.h
- remove unused prototype for nm_device_802_11_wireless_new
* src/nm-device-802-3-ethernet.c
- (real_init): new function; set up signal handlers for link events
- (nm_device_802_3_ethernet_link_activated): new function, schedule
handler for netlink link activated events on device's main loop
- (link_activated_helper): when we get a link activated event, set
the device's link to be active
- (nm_device_802_3_ethernet_link_deactivated): new function; schedule
handler for netlink link deactivated events on device's main loop
- (link_deactivated_helper): when we get a link deactivated event, set
the device's link to be inactive
- (nm_device_802_3_ethernet_dispose): disconnect signal handler on
dispose
* src/nm-device-802-3-ethernet.h
- remove unused prototype for nm_device_802_3_ethernet_new
* src/nm-device.[ch]
- (nm_get_device_by_iface_locked): variant of nm_get_device_by_iface
but locks the device list
- (nm_device_set_active_link): a little bit of cleanup and de-indenting
* src/nm-netlink-monitor.[ch]
- (nm_netlink_monitor_class_install_signals): New signal
"wireless-event"
- (nm_netlink_monitor_new): keep reference to NMData so we can get
at the device list
- (nm_netlink_monitor_event_handler): expand for wireless events too
* src/nm-marshal-main.c
- Include generated nm-marshal.c and nm-marshal.h
* src/nm-marshal.list
- List of custom marshal functions
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1555 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-06 01:10:58 +00:00
|
|
|
{
|
2011-01-18 18:35:35 -06:00
|
|
|
g_signal_connect (self, "state-changed", G_CALLBACK (device_state_changed), NULL);
|
2006-03-05 Dan Williams <dcbw@redhat.com>
Process netlink messages in device subclasses rather than in
NetworkManager.c. Also add support for recognizing Wireless Events.
* configure.in
- Find GLIB_GENMARSHAL
* src/Makefile.am
- Since we're marshalling custom types for wireless event signals,
we get to create our own marshallers using GLIB_GENMARSHAL
* src/NetworkManager.c
- (nm_monitor_wired_link_state): renamed to nm_monitor_setup
- (nm_monitor_setup): renamed from nm_monitor_wired_link_state, and
cut down somewhat. We no longer process signals here.
- (nm_data_new): create the netlink monitor here, and remove a
useless call to nm_policy_schedule_device_change_check()
- (nm_data_free): get rid of the netlink monitor here
- (nm_device_link_activated, nm_device_link_deactivated): removed
- (main): don't create the netlink monitor here, let nm_data_new
do that. Call nm_policy_schedule_device_change_check() right
before we jump to the mainloop to figure out which device
to use first
* src/NetworkManagerSystem.[ch]
- (nm_system_get_rtnl_index_from_iface, nm_system_get_iface_from_rtnl_index):
convert back and forth from interface names to interface
indexes
* src/nm-device-802-11-wireless.c
- (real_init): connect to wireless-event signals from the netlink
monitor object
- (nm_device_802_11_wireless_event): new function, schedule handler
for wireless event signals from the netlink monitor object. We
want the handler to run in the device's context
- (wireless_event_helper): handle wireless-event signals from netlink
- (nm_device_802_11_wireless_dispose): disconnect wireless-event
signal handler
* src/nm-device-802-11-wireless.h
- remove unused prototype for nm_device_802_11_wireless_new
* src/nm-device-802-3-ethernet.c
- (real_init): new function; set up signal handlers for link events
- (nm_device_802_3_ethernet_link_activated): new function, schedule
handler for netlink link activated events on device's main loop
- (link_activated_helper): when we get a link activated event, set
the device's link to be active
- (nm_device_802_3_ethernet_link_deactivated): new function; schedule
handler for netlink link deactivated events on device's main loop
- (link_deactivated_helper): when we get a link deactivated event, set
the device's link to be inactive
- (nm_device_802_3_ethernet_dispose): disconnect signal handler on
dispose
* src/nm-device-802-3-ethernet.h
- remove unused prototype for nm_device_802_3_ethernet_new
* src/nm-device.[ch]
- (nm_get_device_by_iface_locked): variant of nm_get_device_by_iface
but locks the device list
- (nm_device_set_active_link): a little bit of cleanup and de-indenting
* src/nm-netlink-monitor.[ch]
- (nm_netlink_monitor_class_install_signals): New signal
"wireless-event"
- (nm_netlink_monitor_new): keep reference to NMData so we can get
at the device list
- (nm_netlink_monitor_event_handler): expand for wireless events too
* src/nm-marshal-main.c
- Include generated nm-marshal.c and nm-marshal.h
* src/nm-marshal.list
- List of custom marshal functions
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1555 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-06 01:10:58 +00:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static gboolean
|
|
|
|
|
real_is_up (NMDevice *device)
|
|
|
|
|
{
|
2008-06-10 15:54:23 +00:00
|
|
|
if (!NM_DEVICE_ETHERNET_GET_PRIVATE (device)->supplicant.mgr)
|
2008-04-28 Dan Williams <dcbw@redhat.com>
Fix the device up/down ambiguities. Up/down state used to be a
conglomeration of hardware state (IFF_UP) and any device-specific things
(supplicant, periodic timers, etc) that the device used to indicate
readiness. Unfortunately, if the hardware was already IFF_UP for some
reason, then the device specific stuff wouldn't get run, and the device
would be stuck.
* src/nm-device.c
src/nm-device.h
- Create hw_is_up, hw_bring_up, and hw_take_down
- Rename bring_down -> take_down
- (real_hw_is_up): check interface flags for IFF_UP
- (nm_device_hw_is_up): let subclasses figure out their own HW state
- (nm_device_is_up): make static; only used locally
- (nm_device_hw_bring_up): update the hardware and IPv4 addresses even
if the device is already up; if the device isn't up, bring it up
- (nm_device_hw_take_down): just take down hardware
- (nm_device_bring_up): bring up HW first, then device specific stuff
- (nm_device_take_down): always deactivate device when called; always
try to take hardware down too
- (nm_device_state_changed): take device down when entering unmanaged
state from a higher state
* src/nm-device-802-11-wireless.c
- (real_hw_is_up, real_hw_bring_up, real_hw_take_down): implement; just
check IFF_UP really
- (real_take_down, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): fix some messages
* src/nm-device-802-3-ethernet.c
- (real_hw_is_up, real_hw_bring_up, real_hw_take_down): implement; just
check IFF_UP really
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3618 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 15:36:29 +00:00
|
|
|
return FALSE;
|
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
|
|
|
|
2008-04-30 13:48:35 +00:00
|
|
|
return TRUE;
|
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
|
|
|
}
|
2006-01-03 17:07:07 +00:00
|
|
|
|
2007-03-12 04:49:29 +00:00
|
|
|
static gboolean
|
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
|
|
|
real_bring_up (NMDevice *dev)
|
2006-01-03 17:07:07 +00:00
|
|
|
{
|
2008-06-10 15:54:23 +00:00
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (dev);
|
2007-03-12 04:49:29 +00:00
|
|
|
|
2008-03-18 22:19:09 +00:00
|
|
|
priv->supplicant.mgr = nm_supplicant_manager_get ();
|
2006-01-03 17:07:07 +00:00
|
|
|
|
2008-04-28 Dan Williams <dcbw@redhat.com>
Fix the device up/down ambiguities. Up/down state used to be a
conglomeration of hardware state (IFF_UP) and any device-specific things
(supplicant, periodic timers, etc) that the device used to indicate
readiness. Unfortunately, if the hardware was already IFF_UP for some
reason, then the device specific stuff wouldn't get run, and the device
would be stuck.
* src/nm-device.c
src/nm-device.h
- Create hw_is_up, hw_bring_up, and hw_take_down
- Rename bring_down -> take_down
- (real_hw_is_up): check interface flags for IFF_UP
- (nm_device_hw_is_up): let subclasses figure out their own HW state
- (nm_device_is_up): make static; only used locally
- (nm_device_hw_bring_up): update the hardware and IPv4 addresses even
if the device is already up; if the device isn't up, bring it up
- (nm_device_hw_take_down): just take down hardware
- (nm_device_bring_up): bring up HW first, then device specific stuff
- (nm_device_take_down): always deactivate device when called; always
try to take hardware down too
- (nm_device_state_changed): take device down when entering unmanaged
state from a higher state
* src/nm-device-802-11-wireless.c
- (real_hw_is_up, real_hw_bring_up, real_hw_take_down): implement; just
check IFF_UP really
- (real_take_down, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): fix some messages
* src/nm-device-802-3-ethernet.c
- (real_hw_is_up, real_hw_bring_up, real_hw_take_down): implement; just
check IFF_UP really
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3618 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 15:36:29 +00:00
|
|
|
return priv->supplicant.mgr ? TRUE : FALSE;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2008-04-28 Dan Williams <dcbw@redhat.com>
Fix the device up/down ambiguities. Up/down state used to be a
conglomeration of hardware state (IFF_UP) and any device-specific things
(supplicant, periodic timers, etc) that the device used to indicate
readiness. Unfortunately, if the hardware was already IFF_UP for some
reason, then the device specific stuff wouldn't get run, and the device
would be stuck.
* src/nm-device.c
src/nm-device.h
- Create hw_is_up, hw_bring_up, and hw_take_down
- Rename bring_down -> take_down
- (real_hw_is_up): check interface flags for IFF_UP
- (nm_device_hw_is_up): let subclasses figure out their own HW state
- (nm_device_is_up): make static; only used locally
- (nm_device_hw_bring_up): update the hardware and IPv4 addresses even
if the device is already up; if the device isn't up, bring it up
- (nm_device_hw_take_down): just take down hardware
- (nm_device_bring_up): bring up HW first, then device specific stuff
- (nm_device_take_down): always deactivate device when called; always
try to take hardware down too
- (nm_device_state_changed): take device down when entering unmanaged
state from a higher state
* src/nm-device-802-11-wireless.c
- (real_hw_is_up, real_hw_bring_up, real_hw_take_down): implement; just
check IFF_UP really
- (real_take_down, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): fix some messages
* src/nm-device-802-3-ethernet.c
- (real_hw_is_up, real_hw_bring_up, real_hw_take_down): implement; just
check IFF_UP really
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3618 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 15:36:29 +00:00
|
|
|
real_take_down (NMDevice *dev)
|
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
|
|
|
{
|
2008-06-10 15:54:23 +00:00
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (dev);
|
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
|
|
|
|
2008-03-18 22:19:09 +00:00
|
|
|
if (priv->supplicant.mgr) {
|
|
|
|
|
g_object_unref (priv->supplicant.mgr);
|
|
|
|
|
priv->supplicant.mgr = NULL;
|
2007-08-17 21:31:59 +00:00
|
|
|
}
|
2006-01-03 17:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
2009-07-07 14:57:05 -04:00
|
|
|
NMDevice *
|
2008-06-10 15:54:23 +00:00
|
|
|
nm_device_ethernet_new (const char *udi,
|
2007-11-29 14:38:07 +00:00
|
|
|
const char *iface,
|
2010-04-21 14:58:25 -07:00
|
|
|
const char *driver)
|
2007-02-05 12:14:09 +00:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (udi != NULL, NULL);
|
2007-11-29 14:38:07 +00:00
|
|
|
g_return_val_if_fail (iface != NULL, NULL);
|
2007-02-05 12:14:09 +00:00
|
|
|
g_return_val_if_fail (driver != NULL, NULL);
|
|
|
|
|
|
2009-07-07 14:57:05 -04:00
|
|
|
return (NMDevice *) g_object_new (NM_TYPE_DEVICE_ETHERNET,
|
2011-11-18 00:34:08 -06:00
|
|
|
NM_DEVICE_UDI, udi,
|
|
|
|
|
NM_DEVICE_IFACE, iface,
|
|
|
|
|
NM_DEVICE_DRIVER, driver,
|
|
|
|
|
NM_DEVICE_TYPE_DESC, "Ethernet",
|
|
|
|
|
NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_ETHERNET,
|
2009-07-07 14:57:05 -04:00
|
|
|
NULL);
|
2007-02-05 12:14:09 +00:00
|
|
|
}
|
|
|
|
|
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
/* Returns speed in Mb/s */
|
|
|
|
|
static guint32
|
2008-06-10 15:54:23 +00:00
|
|
|
nm_device_ethernet_get_speed (NMDeviceEthernet *self)
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
{
|
2008-03-13 19:31:08 +00:00
|
|
|
int fd;
|
|
|
|
|
struct ifreq ifr;
|
2008-03-14 20:37:48 +00:00
|
|
|
struct ethtool_cmd edata = {
|
|
|
|
|
.cmd = ETHTOOL_GSET,
|
|
|
|
|
};
|
2008-03-13 19:31:08 +00:00
|
|
|
guint32 speed = 0;
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
|
2008-03-13 19:31:08 +00:00
|
|
|
g_return_val_if_fail (self != NULL, 0);
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
|
2008-03-13 19:31:08 +00:00
|
|
|
fd = socket (PF_INET, SOCK_DGRAM, 0);
|
|
|
|
|
if (fd < 0) {
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_warn (LOGD_HW, "couldn't open control socket.");
|
2008-03-13 19:31:08 +00:00
|
|
|
return 0;
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
}
|
|
|
|
|
|
2008-03-13 19:31:08 +00:00
|
|
|
memset (&ifr, 0, sizeof (struct ifreq));
|
2008-03-14 20:37:48 +00:00
|
|
|
strncpy (ifr.ifr_name, nm_device_get_iface (NM_DEVICE (self)), IFNAMSIZ);
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
ifr.ifr_data = (char *) &edata;
|
2008-03-14 20:37:48 +00:00
|
|
|
|
2008-10-30 05:52:20 +00:00
|
|
|
if (ioctl (fd, SIOCETHTOOL, &ifr) < 0)
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
goto out;
|
|
|
|
|
|
2008-10-27 10:50:21 +00:00
|
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
|
|
|
|
|
speed = edata.speed;
|
|
|
|
|
#else
|
|
|
|
|
speed = ethtool_cmd_speed (&edata);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (speed == G_MAXUINT16 || speed == G_MAXUINT32)
|
|
|
|
|
speed = 0;
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
|
|
|
|
|
out:
|
2008-03-13 19:31:08 +00:00
|
|
|
close (fd);
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
return speed;
|
|
|
|
|
}
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2010-06-24 15:14:53 -07:00
|
|
|
static void
|
|
|
|
|
_update_hw_addr (NMDeviceEthernet *self, const guint8 *addr)
|
|
|
|
|
{
|
2011-10-14 10:13:49 -04:00
|
|
|
guint8 *current_addr;
|
2010-06-24 15:14:53 -07:00
|
|
|
|
|
|
|
|
g_return_if_fail (addr != NULL);
|
|
|
|
|
|
2011-10-14 10:13:49 -04:00
|
|
|
current_addr = nm_device_wired_get_hwaddr (NM_DEVICE_WIRED (self));
|
|
|
|
|
|
|
|
|
|
if (memcmp (current_addr, addr, ETH_ALEN)) {
|
|
|
|
|
memcpy (current_addr, addr, ETH_ALEN);
|
2010-06-24 15:14:53 -07:00
|
|
|
g_object_notify (G_OBJECT (self), NM_DEVICE_ETHERNET_HW_ADDRESS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
_set_hw_addr (NMDeviceEthernet *self, const guint8 *addr, const char *detail)
|
|
|
|
|
{
|
|
|
|
|
NMDevice *dev = NM_DEVICE (self);
|
2011-10-14 10:13:49 -04:00
|
|
|
guint8 *current_addr;
|
2010-06-24 15:14:53 -07:00
|
|
|
const char *iface;
|
|
|
|
|
char *mac_str = NULL;
|
|
|
|
|
gboolean success = FALSE;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (addr != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
iface = nm_device_get_iface (dev);
|
|
|
|
|
|
|
|
|
|
/* Do nothing if current MAC is same */
|
2011-10-14 10:13:49 -04:00
|
|
|
current_addr = nm_device_wired_get_hwaddr (NM_DEVICE_WIRED (self));
|
|
|
|
|
if (!memcmp (current_addr, addr, ETH_ALEN)) {
|
2011-03-19 12:44:14 -05:00
|
|
|
nm_log_dbg (LOGD_DEVICE | LOGD_ETHER, "(%s): no MAC address change needed", iface);
|
2010-06-24 15:14:53 -07:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-14 10:13:49 -04:00
|
|
|
mac_str = g_strdup_printf ("%02X:%02X:%02X:%02X:%02X:%02X",
|
|
|
|
|
addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
|
|
|
|
|
|
2010-06-24 15:14:53 -07:00
|
|
|
/* Can't change MAC address while device is up */
|
2011-10-14 10:13:49 -04:00
|
|
|
nm_device_hw_take_down (dev, FALSE);
|
2010-06-24 15:14:53 -07:00
|
|
|
|
2011-07-22 14:09:16 -05:00
|
|
|
success = nm_system_iface_set_mac (nm_device_get_ip_ifindex (dev), (struct ether_addr *) addr);
|
2010-06-24 15:14:53 -07:00
|
|
|
if (success) {
|
|
|
|
|
/* MAC address succesfully changed; update the current MAC to match */
|
|
|
|
|
_update_hw_addr (self, addr);
|
|
|
|
|
nm_log_info (LOGD_DEVICE | LOGD_ETHER, "(%s): %s MAC address to %s",
|
|
|
|
|
iface, detail, mac_str);
|
|
|
|
|
} else {
|
|
|
|
|
nm_log_warn (LOGD_DEVICE | LOGD_ETHER, "(%s): failed to %s MAC address to %s",
|
|
|
|
|
iface, detail, mac_str);
|
|
|
|
|
}
|
2011-10-14 10:13:49 -04:00
|
|
|
nm_device_hw_bring_up (dev, FALSE, NULL);
|
2010-06-24 15:14:53 -07:00
|
|
|
g_free (mac_str);
|
|
|
|
|
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-05 12:14:09 +00:00
|
|
|
static void
|
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
|
|
|
real_update_hw_address (NMDevice *dev)
|
2006-01-10 21:15:54 +00:00
|
|
|
{
|
2011-10-14 10:13:49 -04:00
|
|
|
guint8 *hw_addr, old_addr[ETH_ALEN];
|
2007-02-05 12:14:09 +00:00
|
|
|
|
2011-10-14 10:13:49 -04:00
|
|
|
hw_addr = nm_device_wired_get_hwaddr (NM_DEVICE_WIRED (dev));
|
|
|
|
|
memcpy (old_addr, hw_addr, ETH_ALEN);
|
2010-06-24 15:14:53 -07:00
|
|
|
|
2011-10-14 10:13:49 -04:00
|
|
|
NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->update_hw_address (dev);
|
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
|
|
|
|
2011-10-14 10:13:49 -04:00
|
|
|
hw_addr = nm_device_wired_get_hwaddr (NM_DEVICE_WIRED (dev));
|
|
|
|
|
if (memcmp (old_addr, hw_addr, ETH_ALEN))
|
|
|
|
|
g_object_notify (G_OBJECT (dev), NM_DEVICE_ETHERNET_HW_ADDRESS);
|
2006-01-10 21:15:54 +00:00
|
|
|
}
|
2008-03-13 19:31:08 +00:00
|
|
|
|
2010-06-22 14:21:25 +02:00
|
|
|
static void
|
2010-06-24 14:21:49 -07:00
|
|
|
real_update_permanent_hw_address (NMDevice *dev)
|
2010-06-22 14:21:25 +02:00
|
|
|
{
|
|
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev);
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
|
|
|
|
struct ifreq req;
|
|
|
|
|
struct ethtool_perm_addr *epaddr = NULL;
|
2010-06-24 15:14:53 -07:00
|
|
|
int fd, ret;
|
2010-06-22 14:21:25 +02:00
|
|
|
|
|
|
|
|
fd = socket (PF_INET, SOCK_DGRAM, 0);
|
|
|
|
|
if (fd < 0) {
|
|
|
|
|
nm_log_warn (LOGD_HW, "couldn't open control socket.");
|
|
|
|
|
return;
|
2008-03-13 19:31:08 +00:00
|
|
|
}
|
2006-01-10 21:15:54 +00:00
|
|
|
|
2010-06-22 14:21:25 +02:00
|
|
|
/* Get permanent MAC address */
|
|
|
|
|
memset (&req, 0, sizeof (struct ifreq));
|
|
|
|
|
strncpy (req.ifr_name, nm_device_get_iface (dev), IFNAMSIZ);
|
2010-06-24 15:14:53 -07:00
|
|
|
|
|
|
|
|
epaddr = g_malloc0 (sizeof (struct ethtool_perm_addr) + ETH_ALEN);
|
2010-06-22 14:21:25 +02:00
|
|
|
epaddr->cmd = ETHTOOL_GPERMADDR;
|
|
|
|
|
epaddr->size = ETH_ALEN;
|
2010-06-24 15:14:53 -07:00
|
|
|
req.ifr_data = (void *) epaddr;
|
|
|
|
|
|
2010-06-22 14:21:25 +02:00
|
|
|
errno = 0;
|
2010-06-24 15:14:53 -07:00
|
|
|
ret = ioctl (fd, SIOCETHTOOL, &req);
|
2010-06-24 15:18:53 -07:00
|
|
|
if ((ret < 0) || !nm_ethernet_address_is_valid ((struct ether_addr *) epaddr->data)) {
|
2011-10-14 10:13:49 -04:00
|
|
|
guint8 *current_addr;
|
|
|
|
|
|
2010-06-24 15:14:53 -07:00
|
|
|
nm_log_err (LOGD_HW | LOGD_ETHER, "(%s): unable to read permanent MAC address (error %d)",
|
|
|
|
|
nm_device_get_iface (dev), errno);
|
|
|
|
|
/* Fall back to current address */
|
2011-10-14 10:13:49 -04:00
|
|
|
current_addr = nm_device_wired_get_hwaddr (NM_DEVICE_WIRED (self));
|
|
|
|
|
memcpy (epaddr->data, current_addr, ETH_ALEN);
|
2010-06-22 14:21:25 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-24 15:14:53 -07:00
|
|
|
if (memcmp (&priv->perm_hw_addr, epaddr->data, ETH_ALEN)) {
|
|
|
|
|
memcpy (&priv->perm_hw_addr, epaddr->data, ETH_ALEN);
|
2010-06-22 14:21:25 +02:00
|
|
|
g_object_notify (G_OBJECT (dev), NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS);
|
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-03-13 19:31:08 +00:00
|
|
|
close (fd);
|
2006-01-10 21:15:54 +00:00
|
|
|
}
|
2008-03-13 19:31:08 +00:00
|
|
|
|
2010-09-27 09:53:51 +02:00
|
|
|
static void
|
|
|
|
|
real_update_initial_hw_address (NMDevice *dev)
|
|
|
|
|
{
|
|
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev);
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2011-10-14 10:13:49 -04:00
|
|
|
guint8 *current_addr;
|
2010-09-27 09:53:51 +02:00
|
|
|
char *mac_str = NULL;
|
|
|
|
|
guint8 *addr = priv->initial_hw_addr;
|
|
|
|
|
guint8 zero[ETH_ALEN] = {0,0,0,0,0,0};
|
|
|
|
|
|
|
|
|
|
/* This sets initial MAC address from current MAC address. It should only
|
|
|
|
|
* be called from NMDevice constructor() to really get the initial address.
|
|
|
|
|
*/
|
2011-10-14 10:13:49 -04:00
|
|
|
current_addr = nm_device_wired_get_hwaddr (NM_DEVICE_WIRED (self));
|
|
|
|
|
if (!memcmp (current_addr, &zero, ETH_ALEN))
|
2010-09-27 09:53:51 +02:00
|
|
|
real_update_hw_address (dev);
|
|
|
|
|
|
2011-10-14 10:13:49 -04:00
|
|
|
if (memcmp (&priv->initial_hw_addr, current_addr, ETH_ALEN))
|
|
|
|
|
memcpy (&priv->initial_hw_addr, current_addr, ETH_ALEN);
|
2010-09-27 09:53:51 +02:00
|
|
|
|
|
|
|
|
mac_str = g_strdup_printf ("%02X:%02X:%02X:%02X:%02X:%02X",
|
|
|
|
|
addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
|
|
|
|
|
|
|
|
|
|
nm_log_dbg (LOGD_DEVICE | LOGD_ETHER, "(%s): read initial MAC address %s",
|
|
|
|
|
nm_device_get_iface (dev), mac_str);
|
|
|
|
|
|
|
|
|
|
g_free (mac_str);
|
|
|
|
|
}
|
|
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
static guint32
|
2006-01-03 17:07:07 +00:00
|
|
|
real_get_generic_capabilities (NMDevice *dev)
|
2005-12-31 08:21:24 +00:00
|
|
|
{
|
2010-06-22 14:21:25 +02:00
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev);
|
|
|
|
|
guint32 caps = NM_DEVICE_CAP_NONE;
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
/* cipsec devices are also explicitly unsupported at this time */
|
|
|
|
|
if (strstr (nm_device_get_iface (dev), "cipsec"))
|
|
|
|
|
return NM_DEVICE_CAP_NONE;
|
|
|
|
|
|
|
|
|
|
if (supports_ethtool_carrier_detect (self) || supports_mii_carrier_detect (self))
|
|
|
|
|
caps |= NM_DEVICE_CAP_CARRIER_DETECT;
|
|
|
|
|
|
2006-05-13 19:06:05 +00:00
|
|
|
caps |= NM_DEVICE_CAP_NM_SUPPORTED;
|
2006-01-03 17:47:38 +00:00
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
return caps;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-09 17:53:01 -05:00
|
|
|
static gboolean
|
|
|
|
|
match_subchans (NMDeviceEthernet *self, NMSettingWired *s_wired, gboolean *try_mac)
|
|
|
|
|
{
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
|
|
|
|
const GPtrArray *subchans;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
*try_mac = TRUE;
|
|
|
|
|
|
|
|
|
|
subchans = nm_setting_wired_get_s390_subchannels (s_wired);
|
|
|
|
|
if (!subchans)
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
/* connection requires subchannels but the device has none */
|
|
|
|
|
if (!priv->subchannels)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* Make sure each subchannel in the connection is a subchannel of this device */
|
|
|
|
|
for (i = 0; i < subchans->len; i++) {
|
|
|
|
|
const char *candidate = g_ptr_array_index (subchans, i);
|
|
|
|
|
|
|
|
|
|
if ( (priv->subchan1 && !strcmp (priv->subchan1, candidate))
|
|
|
|
|
|| (priv->subchan2 && !strcmp (priv->subchan2, candidate))
|
|
|
|
|
|| (priv->subchan3 && !strcmp (priv->subchan3, candidate)))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
return FALSE; /* a subchannel was not found */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*try_mac = FALSE;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-07 13:15:20 +01:00
|
|
|
static gboolean
|
|
|
|
|
match_ethernet_connection (NMDevice *device, NMConnection *connection,
|
|
|
|
|
gboolean check_blacklist, GError **error)
|
|
|
|
|
{
|
|
|
|
|
const char *iface;
|
|
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
|
|
|
|
NMSettingWired *s_wired;
|
|
|
|
|
|
|
|
|
|
s_wired = nm_connection_get_setting_wired (connection);
|
|
|
|
|
|
|
|
|
|
iface = nm_connection_get_virtual_iface_name (connection);
|
|
|
|
|
if (iface && strcmp (nm_device_get_iface (device), iface))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (nm_connection_is_type (connection, NM_SETTING_PPPOE_SETTING_NAME)) {
|
|
|
|
|
/* NOP */
|
|
|
|
|
} else if (nm_connection_is_type (connection, NM_SETTING_BOND_SETTING_NAME)) {
|
|
|
|
|
/* NOP */
|
|
|
|
|
} else if (nm_connection_is_type (connection, NM_SETTING_WIRED_SETTING_NAME)) {
|
|
|
|
|
if (!s_wired) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
NM_ETHERNET_ERROR, NM_ETHERNET_ERROR_CONNECTION_INVALID,
|
|
|
|
|
"The connection was not a valid wired connection.");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
NM_ETHERNET_ERROR, NM_ETHERNET_ERROR_CONNECTION_NOT_WIRED,
|
|
|
|
|
"The connection was not a wired, bond, or PPPoE connection.");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (s_wired) {
|
|
|
|
|
const GByteArray *mac;
|
|
|
|
|
gboolean try_mac = TRUE;
|
|
|
|
|
const GSList *mac_blacklist, *mac_blacklist_iter;
|
|
|
|
|
|
|
|
|
|
if (!match_subchans (self, s_wired, &try_mac)) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
NM_ETHERNET_ERROR, NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE,
|
|
|
|
|
"The connection's s390 subchannels did not match this device.");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mac = nm_setting_wired_get_mac_address (s_wired);
|
|
|
|
|
if (try_mac && mac && memcmp (mac->data, &priv->perm_hw_addr, ETH_ALEN)) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
NM_ETHERNET_ERROR, NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE,
|
|
|
|
|
"The connection's MAC address did not match this device.");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!check_blacklist)
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
/* Check for MAC address blacklist */
|
|
|
|
|
mac_blacklist = nm_setting_wired_get_mac_address_blacklist (s_wired);
|
|
|
|
|
for (mac_blacklist_iter = mac_blacklist; mac_blacklist_iter;
|
|
|
|
|
mac_blacklist_iter = g_slist_next (mac_blacklist_iter)) {
|
|
|
|
|
struct ether_addr addr;
|
|
|
|
|
|
|
|
|
|
if (!ether_aton_r (mac_blacklist_iter->data, &addr)) {
|
|
|
|
|
g_warn_if_reached ();
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
if (memcmp (&addr, &priv->perm_hw_addr, ETH_ALEN) == 0) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
NM_ETHERNET_ERROR, NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE,
|
|
|
|
|
"The connection's MAC address (%s) is blacklisted in %s.",
|
|
|
|
|
(char *) mac_blacklist_iter->data, NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-19 15:13:13 +00:00
|
|
|
static NMConnection *
|
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
|
|
|
real_get_best_auto_connection (NMDevice *dev,
|
|
|
|
|
GSList *connections,
|
|
|
|
|
char **specific_object)
|
2007-09-09 22:18:42 +00:00
|
|
|
{
|
2008-01-19 15:13:13 +00:00
|
|
|
GSList *iter;
|
2007-09-09 22:18:42 +00:00
|
|
|
|
2008-01-19 15:13:13 +00:00
|
|
|
for (iter = connections; iter; iter = g_slist_next (iter)) {
|
|
|
|
|
NMConnection *connection = NM_CONNECTION (iter->data);
|
|
|
|
|
NMSettingConnection *s_con;
|
2007-09-09 22:18:42 +00:00
|
|
|
|
2011-12-05 12:27:47 +01:00
|
|
|
s_con = nm_connection_get_setting_connection (connection);
|
2008-01-19 15:13:13 +00:00
|
|
|
g_assert (s_con);
|
2007-09-09 22:18:42 +00:00
|
|
|
|
2011-12-07 13:15:20 +01:00
|
|
|
if ( nm_setting_connection_get_autoconnect (s_con)
|
|
|
|
|
&& match_ethernet_connection (dev, connection, TRUE, NULL))
|
|
|
|
|
return connection;
|
2008-01-19 15:13:13 +00:00
|
|
|
}
|
2011-12-07 13:15:20 +01:00
|
|
|
|
2008-01-19 15:13:13 +00:00
|
|
|
return NULL;
|
2007-09-09 22:18:42 +00:00
|
|
|
}
|
|
|
|
|
|
2008-03-18 22:19:09 +00:00
|
|
|
/* FIXME: Move it to nm-device.c and then get rid of all foo_device_get_setting() all around.
|
|
|
|
|
It's here now to keep the patch short. */
|
|
|
|
|
static NMSetting *
|
|
|
|
|
device_get_setting (NMDevice *device, GType setting_type)
|
|
|
|
|
{
|
|
|
|
|
NMActRequest *req;
|
|
|
|
|
NMSetting *setting = NULL;
|
|
|
|
|
|
|
|
|
|
req = nm_device_get_act_request (device);
|
|
|
|
|
if (req) {
|
|
|
|
|
NMConnection *connection;
|
|
|
|
|
|
|
|
|
|
connection = nm_act_request_get_connection (req);
|
|
|
|
|
if (connection)
|
|
|
|
|
setting = nm_connection_get_setting (connection, setting_type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return setting;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* 802.1X */
|
|
|
|
|
|
|
|
|
|
static void
|
2008-06-10 15:54:23 +00:00
|
|
|
remove_supplicant_timeouts (NMDeviceEthernet *self)
|
2008-03-18 22:19:09 +00:00
|
|
|
{
|
2008-06-10 15:54:23 +00:00
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
if (priv->supplicant.con_timeout_id) {
|
|
|
|
|
g_source_remove (priv->supplicant.con_timeout_id);
|
|
|
|
|
priv->supplicant.con_timeout_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-28 12:57:18 -07:00
|
|
|
if (priv->supplicant_timeout_id) {
|
|
|
|
|
g_source_remove (priv->supplicant_timeout_id);
|
|
|
|
|
priv->supplicant_timeout_id = 0;
|
2008-03-18 22:19:09 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-25 10:02:28 +00:00
|
|
|
static void
|
|
|
|
|
remove_supplicant_interface_error_handler (NMDeviceEthernet *self)
|
2008-03-18 22:19:09 +00:00
|
|
|
{
|
2008-06-10 15:54:23 +00:00
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
if (priv->supplicant.iface_error_id != 0) {
|
|
|
|
|
g_signal_handler_disconnect (priv->supplicant.iface, priv->supplicant.iface_error_id);
|
|
|
|
|
priv->supplicant.iface_error_id = 0;
|
|
|
|
|
}
|
2008-09-25 10:02:28 +00:00
|
|
|
|
|
|
|
|
if (priv->supplicant.iface_con_error_cb_id > 0) {
|
|
|
|
|
g_source_remove (priv->supplicant.iface_con_error_cb_id);
|
|
|
|
|
priv->supplicant.iface_con_error_cb_id = 0;
|
|
|
|
|
}
|
2008-03-18 22:19:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2008-09-25 10:02:28 +00:00
|
|
|
supplicant_interface_release (NMDeviceEthernet *self)
|
2008-03-18 22:19:09 +00:00
|
|
|
{
|
2008-06-10 15:54:23 +00:00
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
remove_supplicant_timeouts (self);
|
2008-09-25 10:02:28 +00:00
|
|
|
remove_supplicant_interface_error_handler (self);
|
|
|
|
|
|
2008-03-18 22:19:09 +00:00
|
|
|
if (priv->supplicant.iface_state_id > 0) {
|
|
|
|
|
g_signal_handler_disconnect (priv->supplicant.iface, priv->supplicant.iface_state_id);
|
|
|
|
|
priv->supplicant.iface_state_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (priv->supplicant.iface) {
|
|
|
|
|
nm_supplicant_interface_disconnect (priv->supplicant.iface);
|
2010-10-06 11:05:21 -05:00
|
|
|
nm_supplicant_manager_iface_release (priv->supplicant.mgr, priv->supplicant.iface);
|
2008-03-18 22:19:09 +00:00
|
|
|
priv->supplicant.iface = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 13:11:51 -06:00
|
|
|
static void
|
|
|
|
|
wired_secrets_cb (NMActRequest *req,
|
|
|
|
|
guint32 call_id,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
GError *error,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMDevice *dev = NM_DEVICE (user_data);
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (req == nm_device_get_act_request (dev));
|
|
|
|
|
g_return_if_fail (nm_device_get_state (dev) == NM_DEVICE_STATE_NEED_AUTH);
|
|
|
|
|
g_return_if_fail (nm_act_request_get_connection (req) == connection);
|
|
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
|
nm_log_warn (LOGD_ETHER, "%s", error->message);
|
|
|
|
|
nm_device_state_changed (dev,
|
|
|
|
|
NM_DEVICE_STATE_FAILED,
|
|
|
|
|
NM_DEVICE_STATE_REASON_NO_SECRETS);
|
|
|
|
|
} else
|
|
|
|
|
nm_device_activate_schedule_stage1_device_prepare (dev);
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-18 22:19:09 +00:00
|
|
|
static gboolean
|
|
|
|
|
link_timeout_cb (gpointer user_data)
|
|
|
|
|
{
|
2008-06-10 15:54:23 +00:00
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (user_data);
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
NMDevice *dev = NM_DEVICE (self);
|
|
|
|
|
NMActRequest *req;
|
|
|
|
|
NMConnection *connection;
|
|
|
|
|
const char *setting_name;
|
|
|
|
|
|
2009-09-28 12:57:18 -07:00
|
|
|
priv->supplicant_timeout_id = 0;
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
req = nm_device_get_act_request (dev);
|
|
|
|
|
|
|
|
|
|
if (nm_device_get_state (dev) == NM_DEVICE_STATE_ACTIVATED) {
|
2008-07-11 10:28:53 +00:00
|
|
|
nm_device_state_changed (dev, NM_DEVICE_STATE_DISCONNECTED,
|
|
|
|
|
NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT);
|
2008-03-18 22:19:09 +00:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Disconnect event during initial authentication and credentials
|
|
|
|
|
* ARE checked - we are likely to have wrong key. Ask the user for
|
|
|
|
|
* another one.
|
|
|
|
|
*/
|
|
|
|
|
if (nm_device_get_state (dev) != NM_DEVICE_STATE_CONFIG)
|
|
|
|
|
goto time_out;
|
|
|
|
|
|
|
|
|
|
connection = nm_act_request_get_connection (req);
|
|
|
|
|
nm_connection_clear_secrets (connection);
|
|
|
|
|
setting_name = nm_connection_need_secrets (connection, NULL);
|
|
|
|
|
if (!setting_name)
|
|
|
|
|
goto time_out;
|
|
|
|
|
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_info (LOGD_DEVICE | LOGD_ETHER,
|
|
|
|
|
"Activation (%s/wired): disconnected during authentication,"
|
|
|
|
|
" asking for new key.",
|
|
|
|
|
nm_device_get_iface (dev));
|
2008-09-25 10:02:28 +00:00
|
|
|
supplicant_interface_release (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2008-07-11 10:28:53 +00:00
|
|
|
nm_device_state_changed (dev, NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT);
|
2009-06-11 00:39:12 -04:00
|
|
|
nm_act_request_get_secrets (req,
|
|
|
|
|
setting_name,
|
2011-03-29 22:53:22 -05:00
|
|
|
NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW,
|
2009-06-11 00:39:12 -04:00
|
|
|
NULL,
|
2010-12-13 13:11:51 -06:00
|
|
|
wired_secrets_cb,
|
|
|
|
|
self);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
time_out:
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_warn (LOGD_DEVICE | LOGD_ETHER,
|
|
|
|
|
"(%s): link timed out.", nm_device_get_iface (dev));
|
2008-07-11 10:28:53 +00:00
|
|
|
nm_device_state_changed (dev, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static NMSupplicantConfig *
|
2008-06-10 15:54:23 +00:00
|
|
|
build_supplicant_config (NMDeviceEthernet *self)
|
2008-03-18 22:19:09 +00:00
|
|
|
{
|
|
|
|
|
const char *con_path;
|
2008-07-11 10:28:53 +00:00
|
|
|
NMSupplicantConfig *config = NULL;
|
2008-03-18 22:19:09 +00:00
|
|
|
NMSetting8021x *security;
|
|
|
|
|
NMConnection *connection;
|
|
|
|
|
|
2011-12-05 12:27:49 +01:00
|
|
|
connection = nm_device_get_connection (NM_DEVICE (self));
|
2009-10-05 11:22:20 +02:00
|
|
|
g_return_val_if_fail (connection, NULL);
|
|
|
|
|
con_path = nm_connection_get_path (connection);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
config = nm_supplicant_config_new ();
|
|
|
|
|
if (!config)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2011-12-05 12:27:47 +01:00
|
|
|
security = nm_connection_get_setting_802_1x (connection);
|
2008-07-11 10:28:53 +00:00
|
|
|
if (!nm_supplicant_config_add_setting_8021x (config, security, con_path, TRUE)) {
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_warn (LOGD_DEVICE, "Couldn't add 802.1X security setting to supplicant config.");
|
2008-07-11 10:28:53 +00:00
|
|
|
g_object_unref (config);
|
|
|
|
|
config = NULL;
|
|
|
|
|
}
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2008-07-11 10:28:53 +00:00
|
|
|
return config;
|
2008-03-18 22:19:09 +00:00
|
|
|
}
|
|
|
|
|
|
2010-10-06 11:05:21 -05:00
|
|
|
static void
|
|
|
|
|
supplicant_iface_state_cb (NMSupplicantInterface *iface,
|
|
|
|
|
guint32 new_state,
|
|
|
|
|
guint32 old_state,
|
|
|
|
|
gpointer user_data)
|
2008-03-18 22:19:09 +00:00
|
|
|
{
|
2010-10-06 11:05:21 -05:00
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (user_data);
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
|
|
|
|
NMDevice *device = NM_DEVICE (self);
|
|
|
|
|
NMSupplicantConfig *config;
|
|
|
|
|
gboolean success = FALSE;
|
|
|
|
|
NMDeviceState devstate;
|
|
|
|
|
|
|
|
|
|
if (new_state == old_state)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
nm_log_info (LOGD_DEVICE | LOGD_ETHER,
|
|
|
|
|
"(%s): supplicant interface state: %s -> %s",
|
|
|
|
|
nm_device_get_iface (device),
|
|
|
|
|
nm_supplicant_interface_state_to_string (old_state),
|
|
|
|
|
nm_supplicant_interface_state_to_string (new_state));
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2010-10-06 11:05:21 -05:00
|
|
|
devstate = nm_device_get_state (device);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2010-10-06 11:05:21 -05:00
|
|
|
switch (new_state) {
|
|
|
|
|
case NM_SUPPLICANT_INTERFACE_STATE_READY:
|
|
|
|
|
config = build_supplicant_config (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
if (config) {
|
|
|
|
|
success = nm_supplicant_interface_set_config (priv->supplicant.iface, config);
|
|
|
|
|
g_object_unref (config);
|
|
|
|
|
|
2010-04-07 13:24:25 -07:00
|
|
|
if (!success) {
|
|
|
|
|
nm_log_err (LOGD_DEVICE | LOGD_ETHER,
|
|
|
|
|
"Activation (%s/wired): couldn't send security "
|
|
|
|
|
"configuration to the supplicant.",
|
2010-10-06 11:05:21 -05:00
|
|
|
nm_device_get_iface (device));
|
2010-04-07 13:24:25 -07:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
nm_log_warn (LOGD_DEVICE | LOGD_ETHER,
|
|
|
|
|
"Activation (%s/wired): couldn't build security configuration.",
|
2010-10-06 11:05:21 -05:00
|
|
|
nm_device_get_iface (device));
|
2010-04-07 13:24:25 -07:00
|
|
|
}
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2010-10-06 11:05:21 -05:00
|
|
|
if (!success) {
|
|
|
|
|
nm_device_state_changed (device,
|
|
|
|
|
NM_DEVICE_STATE_FAILED,
|
|
|
|
|
NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NM_SUPPLICANT_INTERFACE_STATE_COMPLETED:
|
|
|
|
|
remove_supplicant_interface_error_handler (self);
|
|
|
|
|
remove_supplicant_timeouts (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
/* If this is the initial association during device activation,
|
|
|
|
|
* schedule the next activation stage.
|
|
|
|
|
*/
|
2010-10-06 11:05:21 -05:00
|
|
|
if (devstate == NM_DEVICE_STATE_CONFIG) {
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_info (LOGD_DEVICE | LOGD_ETHER,
|
|
|
|
|
"Activation (%s/wired) Stage 2 of 5 (Device Configure) successful.",
|
2010-10-06 11:05:21 -05:00
|
|
|
nm_device_get_iface (device));
|
|
|
|
|
nm_device_activate_schedule_stage3_ip_config_start (device);
|
2008-03-18 22:19:09 +00:00
|
|
|
}
|
2010-10-06 11:05:21 -05:00
|
|
|
break;
|
|
|
|
|
case NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED:
|
|
|
|
|
if ((devstate == NM_DEVICE_STATE_ACTIVATED) || nm_device_is_activating (device)) {
|
2008-03-18 22:19:09 +00:00
|
|
|
/* Start the link timeout so we allow some time for reauthentication */
|
2009-09-28 12:57:18 -07:00
|
|
|
if (!priv->supplicant_timeout_id)
|
2010-10-06 11:05:21 -05:00
|
|
|
priv->supplicant_timeout_id = g_timeout_add_seconds (15, link_timeout_cb, device);
|
2008-03-18 22:19:09 +00:00
|
|
|
}
|
2010-10-06 11:05:21 -05:00
|
|
|
break;
|
|
|
|
|
case NM_SUPPLICANT_INTERFACE_STATE_DOWN:
|
|
|
|
|
supplicant_interface_release (self);
|
|
|
|
|
remove_supplicant_timeouts (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2010-10-06 11:05:21 -05:00
|
|
|
if ((devstate == NM_DEVICE_STATE_ACTIVATED) || nm_device_is_activating (device)) {
|
|
|
|
|
nm_device_state_changed (device,
|
|
|
|
|
NM_DEVICE_STATE_FAILED,
|
|
|
|
|
NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2008-03-18 22:19:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
supplicant_iface_connection_error_cb_handler (gpointer user_data)
|
|
|
|
|
{
|
2008-06-10 15:54:23 +00:00
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (user_data);
|
2008-09-25 10:02:28 +00:00
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2008-09-25 10:02:28 +00:00
|
|
|
supplicant_interface_release (self);
|
2008-07-11 10:28:53 +00:00
|
|
|
nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2008-09-25 10:02:28 +00:00
|
|
|
priv->supplicant.iface_con_error_cb_id = 0;
|
2008-03-18 22:19:09 +00:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
supplicant_iface_connection_error_cb (NMSupplicantInterface *iface,
|
|
|
|
|
const char *name,
|
|
|
|
|
const char *message,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
2008-09-25 10:02:28 +00:00
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (user_data);
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
|
|
|
|
guint id;
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_warn (LOGD_DEVICE | LOGD_ETHER,
|
|
|
|
|
"Activation (%s/wired): association request to the supplicant failed: %s - %s",
|
|
|
|
|
nm_device_get_iface (NM_DEVICE (self)), name, message);
|
2008-09-25 10:02:28 +00:00
|
|
|
|
|
|
|
|
if (priv->supplicant.iface_con_error_cb_id)
|
|
|
|
|
g_source_remove (priv->supplicant.iface_con_error_cb_id);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2008-09-25 10:02:28 +00:00
|
|
|
id = g_idle_add (supplicant_iface_connection_error_cb_handler, self);
|
|
|
|
|
priv->supplicant.iface_con_error_cb_id = id;
|
2008-03-18 22:19:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static NMActStageReturn
|
2008-06-10 15:54:23 +00:00
|
|
|
handle_auth_or_fail (NMDeviceEthernet *self,
|
2008-03-18 22:19:09 +00:00
|
|
|
NMActRequest *req,
|
|
|
|
|
gboolean new_secrets)
|
|
|
|
|
{
|
|
|
|
|
const char *setting_name;
|
|
|
|
|
guint32 tries;
|
|
|
|
|
NMConnection *connection;
|
|
|
|
|
|
|
|
|
|
connection = nm_act_request_get_connection (req);
|
|
|
|
|
g_assert (connection);
|
|
|
|
|
|
|
|
|
|
tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (connection), WIRED_SECRETS_TRIES));
|
|
|
|
|
if (tries > 3)
|
|
|
|
|
return NM_ACT_STAGE_RETURN_FAILURE;
|
|
|
|
|
|
2008-07-11 10:28:53 +00:00
|
|
|
nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_NONE);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
nm_connection_clear_secrets (connection);
|
|
|
|
|
setting_name = nm_connection_need_secrets (connection, NULL);
|
|
|
|
|
if (setting_name) {
|
2011-03-29 22:53:22 -05:00
|
|
|
NMSettingsGetSecretsFlags flags = NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION;
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
/* If the caller doesn't necessarily want completely new secrets,
|
|
|
|
|
* only ask for new secrets after the first failure.
|
|
|
|
|
*/
|
2011-01-18 14:57:44 -06:00
|
|
|
if (new_secrets || tries)
|
2011-03-29 22:53:22 -05:00
|
|
|
flags |= NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW;
|
2011-01-26 18:36:08 -06:00
|
|
|
nm_act_request_get_secrets (req, setting_name, flags, NULL, wired_secrets_cb, self);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (connection), WIRED_SECRETS_TRIES, GUINT_TO_POINTER (++tries));
|
2010-04-07 13:24:25 -07:00
|
|
|
} else {
|
|
|
|
|
nm_log_info (LOGD_DEVICE, "Cleared secrets, but setting didn't need any secrets.");
|
|
|
|
|
}
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
return NM_ACT_STAGE_RETURN_POSTPONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
supplicant_connection_timeout_cb (gpointer user_data)
|
|
|
|
|
{
|
2008-06-10 15:54:23 +00:00
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (user_data);
|
2008-09-25 10:02:28 +00:00
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
NMDevice *device = NM_DEVICE (self);
|
|
|
|
|
NMActRequest *req;
|
|
|
|
|
const char *iface;
|
|
|
|
|
|
2008-09-25 10:02:28 +00:00
|
|
|
priv->supplicant.con_timeout_id = 0;
|
|
|
|
|
|
2008-03-18 22:19:09 +00:00
|
|
|
iface = nm_device_get_iface (device);
|
|
|
|
|
|
|
|
|
|
/* Authentication failed, encryption key is probably bad */
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_warn (LOGD_DEVICE | LOGD_ETHER,
|
|
|
|
|
"Activation (%s/wired): association took too long.", iface);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2008-09-25 10:02:28 +00:00
|
|
|
supplicant_interface_release (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
req = nm_device_get_act_request (device);
|
|
|
|
|
g_assert (req);
|
|
|
|
|
|
2010-04-07 13:24:25 -07:00
|
|
|
if (handle_auth_or_fail (self, req, TRUE) == NM_ACT_STAGE_RETURN_POSTPONE) {
|
|
|
|
|
nm_log_info (LOGD_DEVICE | LOGD_ETHER,
|
|
|
|
|
"Activation (%s/wired): asking for new secrets", iface);
|
|
|
|
|
} else
|
2008-07-11 10:28:53 +00:00
|
|
|
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_NO_SECRETS);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2008-06-10 15:54:23 +00:00
|
|
|
supplicant_interface_init (NMDeviceEthernet *self)
|
2008-03-18 22:19:09 +00:00
|
|
|
{
|
2008-06-10 15:54:23 +00:00
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
const char *iface;
|
|
|
|
|
|
|
|
|
|
iface = nm_device_get_iface (NM_DEVICE (self));
|
|
|
|
|
|
|
|
|
|
/* Create supplicant interface */
|
2010-10-06 11:05:21 -05:00
|
|
|
priv->supplicant.iface = nm_supplicant_manager_iface_get (priv->supplicant.mgr, iface, FALSE);
|
2008-03-18 22:19:09 +00:00
|
|
|
if (!priv->supplicant.iface) {
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_err (LOGD_DEVICE | LOGD_ETHER,
|
|
|
|
|
"Couldn't initialize supplicant interface for %s.",
|
|
|
|
|
iface);
|
2008-09-25 10:02:28 +00:00
|
|
|
supplicant_interface_release (self);
|
2008-03-18 22:19:09 +00:00
|
|
|
return FALSE;
|
2008-03-11 16:37:41 +00:00
|
|
|
}
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
/* Listen for it's state signals */
|
|
|
|
|
priv->supplicant.iface_state_id = g_signal_connect (priv->supplicant.iface,
|
2010-10-06 11:05:21 -05:00
|
|
|
"state",
|
|
|
|
|
G_CALLBACK (supplicant_iface_state_cb),
|
|
|
|
|
self);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
/* Hook up error signal handler to capture association errors */
|
|
|
|
|
priv->supplicant.iface_error_id = g_signal_connect (priv->supplicant.iface,
|
2010-10-06 11:05:21 -05:00
|
|
|
"connection-error",
|
|
|
|
|
G_CALLBACK (supplicant_iface_connection_error_cb),
|
|
|
|
|
self);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
/* Set up a timeout on the connection attempt to fail it after 25 seconds */
|
2008-12-31 18:57:36 -05:00
|
|
|
priv->supplicant.con_timeout_id = g_timeout_add_seconds (25, supplicant_connection_timeout_cb, self);
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
return TRUE;
|
2008-03-11 16:37:41 +00:00
|
|
|
}
|
|
|
|
|
|
2010-06-22 14:21:25 +02:00
|
|
|
static NMActStageReturn
|
|
|
|
|
real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
|
|
|
|
{
|
|
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev);
|
|
|
|
|
NMActRequest *req;
|
|
|
|
|
NMSettingWired *s_wired;
|
|
|
|
|
const GByteArray *cloned_mac;
|
|
|
|
|
NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
|
|
|
|
|
|
|
|
|
req = nm_device_get_act_request (NM_DEVICE (self));
|
|
|
|
|
g_return_val_if_fail (req != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
|
|
|
|
|
|
|
|
|
s_wired = NM_SETTING_WIRED (device_get_setting (dev, NM_TYPE_SETTING_WIRED));
|
|
|
|
|
g_assert (s_wired);
|
|
|
|
|
|
2010-06-24 15:14:53 -07:00
|
|
|
/* Set device MAC address if the connection wants to change it */
|
2010-06-22 14:21:25 +02:00
|
|
|
cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
|
2010-06-24 15:14:53 -07:00
|
|
|
if (cloned_mac && (cloned_mac->len == ETH_ALEN))
|
|
|
|
|
_set_hw_addr (self, (const guint8 *) cloned_mac->data, "set");
|
2010-06-22 14:21:25 +02:00
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-18 22:19:09 +00:00
|
|
|
static NMActStageReturn
|
2008-07-11 10:28:53 +00:00
|
|
|
nm_8021x_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
2008-03-18 22:19:09 +00:00
|
|
|
{
|
|
|
|
|
NMConnection *connection;
|
|
|
|
|
NMSetting8021x *security;
|
|
|
|
|
const char *setting_name;
|
|
|
|
|
const char *iface;
|
|
|
|
|
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
|
|
|
|
|
2011-12-05 12:27:49 +01:00
|
|
|
connection = nm_device_get_connection (NM_DEVICE (self));
|
2011-12-05 12:27:47 +01:00
|
|
|
security = nm_connection_get_setting_802_1x (connection);
|
2008-03-18 22:19:09 +00:00
|
|
|
if (!security) {
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_err (LOGD_DEVICE, "Invalid or missing 802.1X security");
|
2008-07-11 10:28:53 +00:00
|
|
|
*reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
|
2008-03-18 22:19:09 +00:00
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
iface = nm_device_get_iface (NM_DEVICE (self));
|
|
|
|
|
|
|
|
|
|
/* If we need secrets, get them */
|
|
|
|
|
setting_name = nm_connection_need_secrets (connection, NULL);
|
|
|
|
|
if (setting_name) {
|
2008-07-11 10:28:53 +00:00
|
|
|
NMActRequest *req = nm_device_get_act_request (NM_DEVICE (self));
|
|
|
|
|
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_info (LOGD_DEVICE | LOGD_ETHER,
|
|
|
|
|
"Activation (%s/wired): connection '%s' has security, but secrets are required.",
|
2011-03-08 13:41:28 +01:00
|
|
|
iface, nm_connection_get_id (connection));
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2008-07-11 10:28:53 +00:00
|
|
|
ret = handle_auth_or_fail (self, req, FALSE);
|
|
|
|
|
if (ret != NM_ACT_STAGE_RETURN_POSTPONE)
|
|
|
|
|
*reason = NM_DEVICE_STATE_REASON_NO_SECRETS;
|
2008-03-18 22:19:09 +00:00
|
|
|
} else {
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_info (LOGD_DEVICE | LOGD_ETHER,
|
|
|
|
|
"Activation (%s/wired): connection '%s' requires no security. No secrets needed.",
|
2011-03-08 13:41:28 +01:00
|
|
|
iface, nm_connection_get_id (connection));
|
2008-03-18 22:19:09 +00:00
|
|
|
|
|
|
|
|
if (supplicant_interface_init (self))
|
|
|
|
|
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
2008-07-11 10:28:53 +00:00
|
|
|
else
|
|
|
|
|
*reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
|
2008-03-18 22:19:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2008-03-11 16:37:41 +00:00
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* PPPoE */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
ppp_state_changed (NMPPPManager *ppp_manager, NMPPPStatus status, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMDevice *device = NM_DEVICE (user_data);
|
|
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
|
case NM_PPP_STATUS_DISCONNECT:
|
2008-07-11 10:28:53 +00:00
|
|
|
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_PPP_DISCONNECT);
|
2008-03-11 16:37:41 +00:00
|
|
|
break;
|
|
|
|
|
case NM_PPP_STATUS_DEAD:
|
2008-07-11 10:28:53 +00:00
|
|
|
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_PPP_FAILED);
|
2008-03-11 16:37:41 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
ppp_ip4_config (NMPPPManager *ppp_manager,
|
2011-10-09 22:50:04 -05:00
|
|
|
const char *iface,
|
|
|
|
|
NMIP4Config *config,
|
|
|
|
|
gpointer user_data)
|
2008-03-11 16:37:41 +00:00
|
|
|
{
|
|
|
|
|
NMDevice *device = NM_DEVICE (user_data);
|
|
|
|
|
|
2009-09-09 07:44:21 -07:00
|
|
|
/* Ignore PPP IP4 events that come in after initial configuration */
|
2011-10-09 23:48:13 -05:00
|
|
|
if (nm_device_activate_ip4_state_in_conf (device)) {
|
2011-10-09 22:50:04 -05:00
|
|
|
nm_device_set_ip_iface (device, iface);
|
|
|
|
|
nm_device_activate_schedule_ip4_config_result (device, config);
|
|
|
|
|
}
|
2008-03-11 16:37:41 +00:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static NMActStageReturn
|
2009-08-17 15:35:02 -05:00
|
|
|
pppoe_stage3_ip4_config_start (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
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-06-10 15:54:23 +00:00
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2008-10-02 17:10:00 +00:00
|
|
|
NMConnection *connection;
|
|
|
|
|
NMSettingPPPOE *s_pppoe;
|
2008-03-11 16:37:41 +00:00
|
|
|
NMActRequest *req;
|
|
|
|
|
GError *err = NULL;
|
2008-07-11 10:28:53 +00:00
|
|
|
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
2008-03-11 16:37:41 +00:00
|
|
|
|
|
|
|
|
req = nm_device_get_act_request (NM_DEVICE (self));
|
|
|
|
|
g_assert (req);
|
|
|
|
|
|
2008-10-02 17:10:00 +00:00
|
|
|
connection = nm_act_request_get_connection (req);
|
|
|
|
|
g_assert (req);
|
|
|
|
|
|
2011-12-05 12:27:47 +01:00
|
|
|
s_pppoe = nm_connection_get_setting_pppoe (connection);
|
2008-10-02 17:10:00 +00:00
|
|
|
g_assert (s_pppoe);
|
|
|
|
|
|
2008-08-04 21:37:11 +00:00
|
|
|
priv->ppp_manager = nm_ppp_manager_new (nm_device_get_iface (NM_DEVICE (self)));
|
2009-11-22 23:56:16 -08:00
|
|
|
if (nm_ppp_manager_start (priv->ppp_manager, req, nm_setting_pppoe_get_username (s_pppoe), 30, &err)) {
|
2008-03-11 16:37:41 +00:00
|
|
|
g_signal_connect (priv->ppp_manager, "state-changed",
|
|
|
|
|
G_CALLBACK (ppp_state_changed),
|
|
|
|
|
self);
|
|
|
|
|
g_signal_connect (priv->ppp_manager, "ip4-config",
|
|
|
|
|
G_CALLBACK (ppp_ip4_config),
|
|
|
|
|
self);
|
|
|
|
|
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
|
|
|
|
} else {
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_warn (LOGD_DEVICE, "(%s): PPPoE failed to start: %s",
|
|
|
|
|
nm_device_get_iface (NM_DEVICE (self)), err->message);
|
2008-03-11 16:37:41 +00:00
|
|
|
g_error_free (err);
|
|
|
|
|
|
|
|
|
|
g_object_unref (priv->ppp_manager);
|
|
|
|
|
priv->ppp_manager = NULL;
|
|
|
|
|
|
2008-07-11 10:28:53 +00:00
|
|
|
*reason = NM_DEVICE_STATE_REASON_PPP_START_FAILED;
|
2008-03-11 16:37:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static NMActStageReturn
|
2008-07-11 10:28:53 +00:00
|
|
|
real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
2008-03-11 16:37:41 +00:00
|
|
|
{
|
2009-08-17 15:35:02 -05:00
|
|
|
NMSettingConnection *s_con;
|
2008-10-26 17:41:37 +00:00
|
|
|
const char *connection_type;
|
2009-08-17 15:35:02 -05:00
|
|
|
NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
2008-03-11 16:37:41 +00:00
|
|
|
|
2008-07-11 10:28:53 +00:00
|
|
|
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
|
|
|
|
|
2009-08-17 15:35:02 -05:00
|
|
|
s_con = NM_SETTING_CONNECTION (device_get_setting (device, NM_TYPE_SETTING_CONNECTION));
|
|
|
|
|
g_assert (s_con);
|
2008-03-11 16:37:41 +00:00
|
|
|
|
2009-08-17 15:35:02 -05:00
|
|
|
/* 802.1x has to run before any IP configuration since the 802.1x auth
|
|
|
|
|
* process opens the port up for normal traffic.
|
|
|
|
|
*/
|
|
|
|
|
connection_type = nm_setting_connection_get_connection_type (s_con);
|
2008-10-26 17:41:37 +00:00
|
|
|
if (!strcmp (connection_type, NM_SETTING_WIRED_SETTING_NAME)) {
|
2008-03-18 22:19:09 +00:00
|
|
|
NMSetting8021x *security;
|
|
|
|
|
|
|
|
|
|
security = (NMSetting8021x *) device_get_setting (device, NM_TYPE_SETTING_802_1X);
|
|
|
|
|
if (security)
|
2008-07-11 10:28:53 +00:00
|
|
|
ret = nm_8021x_stage2_config (NM_DEVICE_ETHERNET (device), reason);
|
2008-03-11 16:37:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-17 15:35:02 -05:00
|
|
|
static NMActStageReturn
|
2011-10-09 22:50:04 -05:00
|
|
|
real_act_stage3_ip4_config_start (NMDevice *device,
|
|
|
|
|
NMIP4Config **out_config,
|
|
|
|
|
NMDeviceStateReason *reason)
|
2009-08-17 15:35:02 -05:00
|
|
|
{
|
|
|
|
|
NMSettingConnection *s_con;
|
|
|
|
|
const char *connection_type;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
|
|
|
|
|
|
|
|
|
s_con = NM_SETTING_CONNECTION (device_get_setting (device, NM_TYPE_SETTING_CONNECTION));
|
|
|
|
|
g_assert (s_con);
|
|
|
|
|
|
|
|
|
|
connection_type = nm_setting_connection_get_connection_type (s_con);
|
|
|
|
|
if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME))
|
|
|
|
|
return pppoe_stage3_ip4_config_start (NM_DEVICE_ETHERNET (device), reason);
|
|
|
|
|
|
2011-10-09 22:50:04 -05:00
|
|
|
return NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->act_stage3_ip4_config_start (device, out_config, reason);
|
2009-08-17 15:35:02 -05:00
|
|
|
}
|
|
|
|
|
|
2011-10-09 22:50:04 -05:00
|
|
|
static void
|
|
|
|
|
real_ip4_config_pre_commit (NMDevice *device, NMIP4Config *config)
|
2008-03-11 16:37:41 +00:00
|
|
|
{
|
2011-10-09 22:50:04 -05:00
|
|
|
NMConnection *connection;
|
|
|
|
|
NMSettingWired *s_wired;
|
|
|
|
|
guint32 mtu;
|
2009-08-17 19:48:42 -05:00
|
|
|
|
2011-10-09 22:50:04 -05:00
|
|
|
/* MTU only set for plain ethernet */
|
|
|
|
|
if (NM_DEVICE_ETHERNET_GET_PRIVATE (device)->ppp_manager)
|
|
|
|
|
return;
|
2009-08-17 19:48:42 -05:00
|
|
|
|
2011-12-05 12:27:49 +01:00
|
|
|
connection = nm_device_get_connection (device);
|
2011-10-09 22:50:04 -05:00
|
|
|
g_assert (connection);
|
|
|
|
|
s_wired = nm_connection_get_setting_wired (connection);
|
|
|
|
|
g_assert (s_wired);
|
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
|
|
|
|
2011-10-09 22:50:04 -05:00
|
|
|
/* MTU override */
|
|
|
|
|
mtu = nm_setting_wired_get_mtu (s_wired);
|
|
|
|
|
if (mtu)
|
|
|
|
|
nm_ip4_config_set_mtu (config, mtu);
|
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-11 16:37:41 +00:00
|
|
|
static void
|
2011-02-24 11:27:42 -06:00
|
|
|
real_deactivate (NMDevice *device)
|
2008-03-11 16:37:41 +00:00
|
|
|
{
|
2010-06-24 15:14:53 -07:00
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2008-03-11 16:37:41 +00:00
|
|
|
|
2011-01-18 18:35:35 -06:00
|
|
|
/* Clear wired secrets tries when deactivating */
|
|
|
|
|
clear_secrets_tries (device);
|
|
|
|
|
|
2008-03-11 16:37:41 +00:00
|
|
|
if (priv->pending_ip4_config) {
|
|
|
|
|
g_object_unref (priv->pending_ip4_config);
|
|
|
|
|
priv->pending_ip4_config = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (priv->ppp_manager) {
|
|
|
|
|
g_object_unref (priv->ppp_manager);
|
|
|
|
|
priv->ppp_manager = NULL;
|
|
|
|
|
}
|
2008-03-18 22:19:09 +00:00
|
|
|
|
2010-06-24 15:14:53 -07:00
|
|
|
supplicant_interface_release (self);
|
2010-06-22 14:21:25 +02:00
|
|
|
|
2010-09-27 09:53:51 +02:00
|
|
|
/* Reset MAC address back to initial address */
|
|
|
|
|
_set_hw_addr (self, priv->initial_hw_addr, "reset");
|
2008-03-11 16:37:41 +00:00
|
|
|
}
|
|
|
|
|
|
2008-04-02 17:44:52 +00:00
|
|
|
static gboolean
|
|
|
|
|
real_check_connection_compatible (NMDevice *device,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
2011-12-07 13:15:20 +01:00
|
|
|
return match_ethernet_connection (device, connection, TRUE, error);
|
2008-04-02 17:44:52 +00:00
|
|
|
}
|
|
|
|
|
|
2011-01-10 23:39:12 -06:00
|
|
|
static gboolean
|
|
|
|
|
real_complete_connection (NMDevice *device,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
const char *specific_object,
|
|
|
|
|
const GSList *existing_connections,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
|
|
|
|
|
NMSettingWired *s_wired;
|
|
|
|
|
NMSettingPPPOE *s_pppoe;
|
|
|
|
|
const GByteArray *setting_mac;
|
|
|
|
|
|
2011-12-05 12:27:47 +01:00
|
|
|
s_pppoe = nm_connection_get_setting_pppoe (connection);
|
2011-01-10 23:39:12 -06:00
|
|
|
|
|
|
|
|
/* We can't telepathically figure out the service name or username, so if
|
|
|
|
|
* those weren't given, we can't complete the connection.
|
|
|
|
|
*/
|
|
|
|
|
if (s_pppoe && !nm_setting_verify (NM_SETTING (s_pppoe), NULL, error))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* Default to an ethernet-only connection, but if a PPPoE setting was given
|
|
|
|
|
* then PPPoE should be our connection type.
|
|
|
|
|
*/
|
2011-01-13 13:28:52 -06:00
|
|
|
nm_utils_complete_generic (connection,
|
2011-03-28 10:42:19 -05:00
|
|
|
s_pppoe ? NM_SETTING_PPPOE_SETTING_NAME : NM_SETTING_WIRED_SETTING_NAME,
|
2011-01-13 13:28:52 -06:00
|
|
|
existing_connections,
|
|
|
|
|
s_pppoe ? _("PPPoE connection %d") : _("Wired connection %d"),
|
2011-02-25 11:58:16 -06:00
|
|
|
NULL,
|
|
|
|
|
s_pppoe ? FALSE : TRUE); /* No IPv6 by default yet for PPPoE */
|
2011-01-10 23:39:12 -06:00
|
|
|
|
2011-12-05 12:27:47 +01:00
|
|
|
s_wired = nm_connection_get_setting_wired (connection);
|
2011-01-10 23:39:12 -06:00
|
|
|
if (!s_wired) {
|
|
|
|
|
s_wired = (NMSettingWired *) nm_setting_wired_new ();
|
|
|
|
|
nm_connection_add_setting (connection, NM_SETTING (s_wired));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setting_mac = nm_setting_wired_get_mac_address (s_wired);
|
|
|
|
|
if (setting_mac) {
|
|
|
|
|
/* Make sure the setting MAC (if any) matches the device's permanent MAC */
|
|
|
|
|
if (memcmp (setting_mac->data, priv->perm_hw_addr, ETH_ALEN)) {
|
|
|
|
|
g_set_error_literal (error,
|
|
|
|
|
NM_SETTING_WIRED_ERROR,
|
|
|
|
|
NM_SETTING_WIRED_ERROR_INVALID_PROPERTY,
|
|
|
|
|
NM_SETTING_WIRED_MAC_ADDRESS);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
GByteArray *mac;
|
|
|
|
|
const guint8 null_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
|
|
|
|
|
|
|
|
|
|
/* Lock the connection to this device by default */
|
|
|
|
|
if (memcmp (priv->perm_hw_addr, null_mac, ETH_ALEN)) {
|
|
|
|
|
mac = g_byte_array_sized_new (ETH_ALEN);
|
|
|
|
|
g_byte_array_append (mac, priv->perm_hw_addr, ETH_ALEN);
|
|
|
|
|
g_object_set (G_OBJECT (s_wired), NM_SETTING_WIRED_MAC_ADDRESS, mac, NULL);
|
|
|
|
|
g_byte_array_free (mac, TRUE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-11 00:39:12 -04:00
|
|
|
static gboolean
|
|
|
|
|
spec_match_list (NMDevice *device, const GSList *specs)
|
|
|
|
|
{
|
2010-05-26 16:28:51 -07:00
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
|
2009-06-11 00:39:12 -04:00
|
|
|
char *hwaddr;
|
|
|
|
|
gboolean matched;
|
|
|
|
|
|
2011-10-10 16:00:28 -04:00
|
|
|
hwaddr = nm_utils_hwaddr_ntoa (&priv->perm_hw_addr, ARPHRD_ETHER);
|
2009-06-11 00:39:12 -04:00
|
|
|
matched = nm_match_spec_hwaddr (specs, hwaddr);
|
|
|
|
|
g_free (hwaddr);
|
|
|
|
|
|
2010-06-25 21:44:01 -07:00
|
|
|
if (!matched && priv->subchannels)
|
|
|
|
|
matched = nm_match_spec_s390_subchannels (specs, priv->subchannels);
|
2010-05-26 16:28:51 -07:00
|
|
|
|
2009-06-11 00:39:12 -04:00
|
|
|
return matched;
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-03 17:15:03 -04:00
|
|
|
static NMConnection *
|
|
|
|
|
connection_match_config (NMDevice *self, const GSList *connections)
|
|
|
|
|
{
|
2011-10-14 10:13:49 -04:00
|
|
|
const GSList *iter;
|
2011-12-07 13:15:20 +01:00
|
|
|
GSList *ether_matches;
|
2011-10-14 10:13:49 -04:00
|
|
|
NMConnection *match;
|
2009-08-03 17:15:03 -04:00
|
|
|
|
2011-10-14 10:13:49 -04:00
|
|
|
/* First narrow @connections down to those that match in their
|
|
|
|
|
* NMSettingWired configuration.
|
|
|
|
|
*/
|
2011-12-07 13:15:20 +01:00
|
|
|
ether_matches = NULL;
|
2011-10-14 10:13:49 -04:00
|
|
|
for (iter = connections; iter; iter = iter->next) {
|
2009-08-03 17:15:03 -04:00
|
|
|
NMConnection *candidate = NM_CONNECTION (iter->data);
|
|
|
|
|
|
|
|
|
|
/* Can't assume 802.1x or PPPoE connections; they have too much state
|
|
|
|
|
* that's impossible to get on-the-fly from PPPoE or the supplicant.
|
|
|
|
|
*/
|
2011-12-05 12:27:47 +01:00
|
|
|
if ( nm_connection_get_setting_802_1x (candidate)
|
|
|
|
|
|| nm_connection_get_setting_pppoe (candidate))
|
2009-08-03 17:15:03 -04:00
|
|
|
continue;
|
|
|
|
|
|
2011-12-07 13:15:20 +01:00
|
|
|
if (!match_ethernet_connection (self, candidate, FALSE, NULL))
|
2009-08-03 17:15:03 -04:00
|
|
|
continue;
|
|
|
|
|
|
2011-12-07 13:15:20 +01:00
|
|
|
ether_matches = g_slist_prepend (ether_matches, candidate);
|
2009-08-03 17:15:03 -04:00
|
|
|
}
|
|
|
|
|
|
2011-10-14 10:13:49 -04:00
|
|
|
/* Now pass those to the super method, which will check IP config */
|
2011-12-07 13:15:20 +01:00
|
|
|
ether_matches = g_slist_reverse (ether_matches);
|
|
|
|
|
match = NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->connection_match_config (self, ether_matches);
|
|
|
|
|
g_slist_free (ether_matches);
|
2011-10-14 10:13:49 -04:00
|
|
|
|
|
|
|
|
return match;
|
2009-08-03 17:15:03 -04:00
|
|
|
}
|
|
|
|
|
|
2007-09-13 18:09:28 +00:00
|
|
|
static void
|
2009-07-07 14:39:08 -04:00
|
|
|
dispose (GObject *object)
|
2007-09-13 18:09:28 +00:00
|
|
|
{
|
2008-09-25 10:02:28 +00:00
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (object);
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2007-09-13 18:09:28 +00:00
|
|
|
|
2010-06-25 19:49:39 -07:00
|
|
|
g_free (priv->subchan1);
|
|
|
|
|
g_free (priv->subchan2);
|
|
|
|
|
g_free (priv->subchan3);
|
2010-06-25 21:44:01 -07:00
|
|
|
g_free (priv->subchannels);
|
2010-06-25 19:49:39 -07:00
|
|
|
|
2008-06-10 15:54:23 +00:00
|
|
|
G_OBJECT_CLASS (nm_device_ethernet_parent_class)->dispose (object);
|
2007-09-13 18:09:28 +00:00
|
|
|
}
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
static void
|
|
|
|
|
get_property (GObject *object, guint prop_id,
|
2009-09-14 12:54:09 -07:00
|
|
|
GValue *value, GParamSpec *pspec)
|
2007-02-12 09:23:43 +00:00
|
|
|
{
|
2009-09-14 12:54:09 -07:00
|
|
|
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (object);
|
|
|
|
|
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
2011-10-14 10:13:49 -04:00
|
|
|
guint8 *current_addr;
|
2007-02-12 09:23:43 +00:00
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2007-02-16 11:23:49 +00:00
|
|
|
case PROP_HW_ADDRESS:
|
2011-10-14 10:13:49 -04:00
|
|
|
current_addr = nm_device_wired_get_hwaddr (NM_DEVICE_WIRED (self));
|
|
|
|
|
g_value_take_string (value, nm_utils_hwaddr_ntoa (current_addr, ARPHRD_ETHER));
|
2007-02-16 11:23:49 +00:00
|
|
|
break;
|
2010-06-22 14:21:25 +02:00
|
|
|
case PROP_PERM_HW_ADDRESS:
|
2011-10-10 16:00:28 -04:00
|
|
|
g_value_take_string (value, nm_utils_hwaddr_ntoa (&priv->perm_hw_addr, ARPHRD_ETHER));
|
2007-02-16 11:23:49 +00:00
|
|
|
break;
|
2007-02-12 09:23:43 +00:00
|
|
|
case PROP_SPEED:
|
2009-09-14 12:54:09 -07:00
|
|
|
g_value_set_uint (value, nm_device_ethernet_get_speed (self));
|
2007-02-12 09:23:43 +00:00
|
|
|
break;
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
case PROP_CARRIER:
|
2011-10-14 10:13:49 -04:00
|
|
|
g_value_set_boolean (value, nm_device_wired_get_carrier (NM_DEVICE_WIRED (self)));
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
break;
|
2007-02-12 09:23:43 +00:00
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2005-12-31 08:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
2009-06-11 00:39:12 -04:00
|
|
|
static void
|
|
|
|
|
set_property (GObject *object, guint prop_id,
|
|
|
|
|
const GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
static void
|
2008-06-10 15:54:23 +00:00
|
|
|
nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
|
2005-12-31 08:21:24 +00:00
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
|
|
|
|
|
2008-06-10 15:54:23 +00:00
|
|
|
g_type_class_add_private (object_class, sizeof (NMDeviceEthernetPrivate));
|
2007-02-05 12:14:09 +00:00
|
|
|
|
|
|
|
|
/* virtual methods */
|
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
|
|
|
object_class->constructor = constructor;
|
2009-07-07 14:39:08 -04:00
|
|
|
object_class->dispose = dispose;
|
2007-02-12 09:23:43 +00:00
|
|
|
object_class->get_property = get_property;
|
2009-06-11 00:39:12 -04:00
|
|
|
object_class->set_property = set_property;
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2006-01-03 17:07:07 +00:00
|
|
|
parent_class->get_generic_capabilities = real_get_generic_capabilities;
|
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
|
|
|
parent_class->is_up = real_is_up;
|
|
|
|
|
parent_class->bring_up = real_bring_up;
|
2008-04-28 Dan Williams <dcbw@redhat.com>
Fix the device up/down ambiguities. Up/down state used to be a
conglomeration of hardware state (IFF_UP) and any device-specific things
(supplicant, periodic timers, etc) that the device used to indicate
readiness. Unfortunately, if the hardware was already IFF_UP for some
reason, then the device specific stuff wouldn't get run, and the device
would be stuck.
* src/nm-device.c
src/nm-device.h
- Create hw_is_up, hw_bring_up, and hw_take_down
- Rename bring_down -> take_down
- (real_hw_is_up): check interface flags for IFF_UP
- (nm_device_hw_is_up): let subclasses figure out their own HW state
- (nm_device_is_up): make static; only used locally
- (nm_device_hw_bring_up): update the hardware and IPv4 addresses even
if the device is already up; if the device isn't up, bring it up
- (nm_device_hw_take_down): just take down hardware
- (nm_device_bring_up): bring up HW first, then device specific stuff
- (nm_device_take_down): always deactivate device when called; always
try to take hardware down too
- (nm_device_state_changed): take device down when entering unmanaged
state from a higher state
* src/nm-device-802-11-wireless.c
- (real_hw_is_up, real_hw_bring_up, real_hw_take_down): implement; just
check IFF_UP really
- (real_take_down, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): fix some messages
* src/nm-device-802-3-ethernet.c
- (real_hw_is_up, real_hw_bring_up, real_hw_take_down): implement; just
check IFF_UP really
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3618 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-29 15:36:29 +00:00
|
|
|
parent_class->take_down = real_take_down;
|
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
|
|
|
parent_class->update_hw_address = real_update_hw_address;
|
2010-06-24 14:21:49 -07:00
|
|
|
parent_class->update_permanent_hw_address = real_update_permanent_hw_address;
|
2010-09-27 09:53:51 +02:00
|
|
|
parent_class->update_initial_hw_address = real_update_initial_hw_address;
|
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
|
|
|
parent_class->get_best_auto_connection = real_get_best_auto_connection;
|
2008-04-02 17:44:52 +00:00
|
|
|
parent_class->check_connection_compatible = real_check_connection_compatible;
|
2011-01-10 23:39:12 -06:00
|
|
|
parent_class->complete_connection = real_complete_connection;
|
2008-03-11 16:37:41 +00:00
|
|
|
|
2010-06-22 14:21:25 +02:00
|
|
|
parent_class->act_stage1_prepare = real_act_stage1_prepare;
|
2008-03-11 16:37:41 +00:00
|
|
|
parent_class->act_stage2_config = real_act_stage2_config;
|
2009-08-17 15:35:02 -05:00
|
|
|
parent_class->act_stage3_ip4_config_start = real_act_stage3_ip4_config_start;
|
2011-10-09 22:50:04 -05:00
|
|
|
parent_class->ip4_config_pre_commit = real_ip4_config_pre_commit;
|
2011-02-24 11:27:42 -06:00
|
|
|
parent_class->deactivate = real_deactivate;
|
2009-06-11 00:39:12 -04:00
|
|
|
parent_class->spec_match_list = spec_match_list;
|
2009-08-03 17:15:03 -04:00
|
|
|
parent_class->connection_match_config = connection_match_config;
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
/* properties */
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_HW_ADDRESS,
|
2008-06-10 15:54:23 +00:00
|
|
|
g_param_spec_string (NM_DEVICE_ETHERNET_HW_ADDRESS,
|
2010-06-22 14:21:25 +02:00
|
|
|
"Active MAC Address",
|
|
|
|
|
"Currently set hardware MAC address",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READABLE));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_PERM_HW_ADDRESS,
|
|
|
|
|
g_param_spec_string (NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS,
|
|
|
|
|
"Permanent MAC Address",
|
|
|
|
|
"Permanent hardware MAC address",
|
2007-02-16 11:23:49 +00:00
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READABLE));
|
2007-02-12 09:23:43 +00:00
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_SPEED,
|
2008-06-10 15:54:23 +00:00
|
|
|
g_param_spec_uint (NM_DEVICE_ETHERNET_SPEED,
|
2007-02-16 11:23:49 +00:00
|
|
|
"Speed",
|
|
|
|
|
"Speed",
|
2007-10-27 02:58:32 +00:00
|
|
|
0, G_MAXUINT32, 0,
|
2007-02-16 11:23:49 +00:00
|
|
|
G_PARAM_READABLE));
|
2007-02-12 09:23:43 +00:00
|
|
|
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_CARRIER,
|
2008-06-10 15:54:23 +00:00
|
|
|
g_param_spec_boolean (NM_DEVICE_ETHERNET_CARRIER,
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
"Carrier",
|
|
|
|
|
"Carrier",
|
|
|
|
|
FALSE,
|
|
|
|
|
G_PARAM_READABLE));
|
|
|
|
|
|
|
|
|
|
/* Signals */
|
|
|
|
|
signals[PROPERTIES_CHANGED] =
|
|
|
|
|
nm_properties_changed_signal_new (object_class,
|
2008-06-10 15:54:23 +00:00
|
|
|
G_STRUCT_OFFSET (NMDeviceEthernetClass, properties_changed));
|
2008-03-12 Dan Williams <dcbw@redhat.com>
Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
convert the libnm-glib NMDevice8023Ethernet to cached properties
* introspection/nm-device-802-3-ethernet.xml
- New 'Carrier' property
- New 'PropertiesChanged' signal
* introspection/nm-device.xml
- Remove 'Carrier' property
- Remove 'CarrierChanged' signal
* src/nm-device-interface.c
src/nm-device-interface.h
- (nm_device_interface_init): remove 'carrier' property and
'carrier-changed' signal
* src/nm-device.c
src/nm-device.h
- (nm_device_get_carrier, nm_device_set_carrier): remove
- (nm_device_activate_stage5_ip_config_commit): don't bother updating
the link here; wired device will handle that
- (handle_dhcp_lease_change): don't bother updating link here
- (get_property, nm_device_class_init): remove carrier property
* src/nm-device-802-11-wireless.c
- (real_update_link, nm_device_802_11_wireless_class_init): remove
real_update_link(); wireless devices don't use carrier at all
- (link_timeout_cb, supplicant_iface_state_cb_handler,
supplicant_iface_connection_state_cb_handler,
supplicant_mgr_state_cb_handler): remove anything to do with carrier
* src/nm-device-802-3-ethernet.c
src/nm-device-802-3-ethernet.h
- (nm_device_802_3_ethernet_carrier_on,
nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
instead of nm_device_set_carrier()
- (device_state_changed): update link from sysfs on activation;
replaces real_update_link()
- (real_update_link): remove, replaced by device_state_changed()
- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
- (real_get_generic_capabilities, real_can_interrupt_activation): use
new get_carrier function
- (get_property): add 'carrier' property
- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
hook into property-changed signal helper
* src/NetworkManagerPolicy.c
- (device_carrier_changed): will only ever be called with a wired device
- (device_added): only hook up to carrier-changed for wired devices
* libnm-glib/nm-device.c
libnm-glib/nm-device.h
- (constructor, nm_device_class_init): remove carrier-changed signal
- (device_carrier_changed_proxy): remove; unused
- (nm_device_get_carrier): remove; carrier a property of wired devices
* libnm-glib/nm-device-802-3-ethernet.c
libnm-glib/nm-device-802-3-ethernet.h
- Convert to cached properties like AP and Wireless objects
- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
instead of a 'char *', return value should not be freed
- (nm_device_802_3_ethernet_get_carrier): return current carrier status
- (constructor): hook into properties-changed helper
- (set_property, get_property): new functions
- (nm_device_802_3_ethernet_class_init): export GObject properties
* test/nm-tool.c
- (detail_device): strdup the wired hardware address too since it's
cached now
* libnm-glib/libnm-glib-test.c
- (dump_wired): strdup the wired hardware address too since it's
cached now
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-12 16:12:39 +00:00
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
2008-06-10 15:54:23 +00:00
|
|
|
&dbus_glib_nm_device_ethernet_object_info);
|
2008-04-02 17:44:52 +00:00
|
|
|
|
|
|
|
|
dbus_g_error_domain_register (NM_ETHERNET_ERROR, NULL, NM_TYPE_ETHERNET_ERROR);
|
2005-12-31 08:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************/
|
|
|
|
|
/* Ethtool capability detection */
|
|
|
|
|
/**************************************/
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2008-06-10 15:54:23 +00:00
|
|
|
supports_ethtool_carrier_detect (NMDeviceEthernet *self)
|
2005-12-31 08:21:24 +00:00
|
|
|
{
|
2008-03-13 19:31:08 +00:00
|
|
|
int fd;
|
|
|
|
|
struct ifreq ifr;
|
|
|
|
|
gboolean supports_ethtool = FALSE;
|
|
|
|
|
struct ethtool_cmd edata;
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (self != NULL, FALSE);
|
|
|
|
|
|
2008-03-13 19:31:08 +00:00
|
|
|
fd = socket (PF_INET, SOCK_DGRAM, 0);
|
|
|
|
|
if (fd < 0) {
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_err (LOGD_HW, "couldn't open control socket.");
|
2005-12-31 08:21:24 +00:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-13 19:31:08 +00:00
|
|
|
memset (&ifr, 0, sizeof (struct ifreq));
|
2008-03-14 20:37:48 +00:00
|
|
|
strncpy (ifr.ifr_name, nm_device_get_iface (NM_DEVICE (self)), IFNAMSIZ);
|
2008-03-13 19:31:08 +00:00
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
edata.cmd = ETHTOOL_GLINK;
|
|
|
|
|
ifr.ifr_data = (char *) &edata;
|
2006-05-25 22:37:41 +00:00
|
|
|
|
2010-04-08 09:22:52 -07:00
|
|
|
errno = 0;
|
|
|
|
|
if (ioctl (fd, SIOCETHTOOL, &ifr) < 0) {
|
|
|
|
|
nm_log_dbg (LOGD_HW | LOGD_ETHER, "SIOCETHTOOL failed: %d", errno);
|
2005-12-31 08:21:24 +00:00
|
|
|
goto out;
|
2010-04-08 09:22:52 -07:00
|
|
|
}
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
supports_ethtool = TRUE;
|
|
|
|
|
|
|
|
|
|
out:
|
2008-03-13 19:31:08 +00:00
|
|
|
close (fd);
|
2010-04-08 09:22:52 -07:00
|
|
|
nm_log_dbg (LOGD_HW | LOGD_ETHER, "ethtool %s supported",
|
|
|
|
|
supports_ethtool ? "is" : "not");
|
2005-12-31 08:21:24 +00:00
|
|
|
return supports_ethtool;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************/
|
|
|
|
|
/* MII capability detection */
|
|
|
|
|
/**************************************/
|
2007-12-07 12:33:13 +00:00
|
|
|
#define _LINUX_IF_H
|
2005-12-31 08:21:24 +00:00
|
|
|
#include <linux/mii.h>
|
2007-12-07 12:33:13 +00:00
|
|
|
#undef _LINUX_IF_H
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
static int
|
2008-06-10 15:54:23 +00:00
|
|
|
mdio_read (NMDeviceEthernet *self, int fd, struct ifreq *ifr, int location)
|
2005-12-31 08:21:24 +00:00
|
|
|
{
|
|
|
|
|
struct mii_ioctl_data *mii;
|
|
|
|
|
int val = -1;
|
|
|
|
|
|
2008-03-13 19:31:08 +00:00
|
|
|
g_return_val_if_fail (fd >= 0, -1);
|
2005-12-31 08:21:24 +00:00
|
|
|
g_return_val_if_fail (ifr != NULL, -1);
|
|
|
|
|
|
2006-01-11 22:41:53 +00:00
|
|
|
mii = (struct mii_ioctl_data *) &ifr->ifr_ifru;
|
2005-12-31 08:21:24 +00:00
|
|
|
mii->reg_num = location;
|
|
|
|
|
|
2010-04-08 09:22:52 -07:00
|
|
|
errno = 0;
|
|
|
|
|
if (ioctl (fd, SIOCGMIIREG, ifr) == 0) {
|
|
|
|
|
nm_log_dbg (LOGD_HW | LOGD_ETHER, "SIOCGMIIREG result 0x%X", mii->val_out);
|
2005-12-31 08:21:24 +00:00
|
|
|
val = mii->val_out;
|
2010-04-08 09:22:52 -07:00
|
|
|
} else {
|
|
|
|
|
nm_log_dbg (LOGD_HW | LOGD_ETHER, "SIOCGMIIREG failed: %d", errno);
|
|
|
|
|
}
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2008-06-10 15:54:23 +00:00
|
|
|
supports_mii_carrier_detect (NMDeviceEthernet *self)
|
2005-12-31 08:21:24 +00:00
|
|
|
{
|
2008-10-30 05:52:20 +00:00
|
|
|
int fd, bmsr;
|
2008-03-13 19:31:08 +00:00
|
|
|
struct ifreq ifr;
|
|
|
|
|
gboolean supports_mii = FALSE;
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (self != NULL, FALSE);
|
|
|
|
|
|
2008-03-13 19:31:08 +00:00
|
|
|
fd = socket (PF_INET, SOCK_DGRAM, 0);
|
|
|
|
|
if (fd < 0) {
|
2010-04-07 13:24:25 -07:00
|
|
|
nm_log_err (LOGD_HW, "couldn't open control socket.");
|
2011-03-14 01:05:51 -05:00
|
|
|
return FALSE;
|
2005-12-31 08:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
2008-03-13 19:31:08 +00:00
|
|
|
memset (&ifr, 0, sizeof (struct ifreq));
|
2008-03-14 20:37:48 +00:00
|
|
|
strncpy (ifr.ifr_name, nm_device_get_iface (NM_DEVICE (self)), IFNAMSIZ);
|
2006-05-25 22:37:41 +00:00
|
|
|
|
2010-04-08 09:22:52 -07:00
|
|
|
errno = 0;
|
|
|
|
|
if (ioctl (fd, SIOCGMIIPHY, &ifr) < 0) {
|
|
|
|
|
nm_log_dbg (LOGD_HW | LOGD_ETHER, "SIOCGMIIPHY failed: %d", errno);
|
2005-12-31 08:21:24 +00:00
|
|
|
goto out;
|
2010-04-08 09:22:52 -07:00
|
|
|
}
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
/* If we can read the BMSR register, we assume that the card supports MII link detection */
|
2008-03-13 19:31:08 +00:00
|
|
|
bmsr = mdio_read (self, fd, &ifr, MII_BMSR);
|
2005-12-31 08:21:24 +00:00
|
|
|
supports_mii = (bmsr != -1) ? TRUE : FALSE;
|
2010-04-08 09:22:52 -07:00
|
|
|
nm_log_dbg (LOGD_HW | LOGD_ETHER, "MII %s supported",
|
|
|
|
|
supports_mii ? "is" : "not");
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
out:
|
2008-03-13 19:31:08 +00:00
|
|
|
close (fd);
|
2005-12-31 08:21:24 +00:00
|
|
|
return supports_mii;
|
|
|
|
|
}
|