2005-12-31 08:21:24 +00:00
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* Dan Williams <dcbw@redhat.com>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*
|
|
|
|
|
* (C) Copyright 2005 Red Hat, Inc.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <glib/gi18n.h>
|
|
|
|
|
#include <dbus/dbus.h>
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <net/ethernet.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
#include "nm-device-802-3-ethernet.h"
|
2007-02-05 12:14:09 +00:00
|
|
|
#include "nm-device-interface.h"
|
2005-12-31 08:21:24 +00:00
|
|
|
#include "nm-device-private.h"
|
|
|
|
|
#include "NetworkManagerMain.h"
|
|
|
|
|
#include "nm-activation-request.h"
|
|
|
|
|
#include "NetworkManagerUtils.h"
|
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
|
|
|
#include "NetworkManagerPolicy.h"
|
2006-11-25 15:41:04 +00:00
|
|
|
#include "nm-supplicant-manager.h"
|
2005-12-31 08:21:24 +00:00
|
|
|
#include "nm-utils.h"
|
2006-01-26 21:55:11 +00:00
|
|
|
#include "kernel-types.h"
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
static gboolean impl_device_802_3_ethernet_activate (NMDevice8023Ethernet *device,
|
|
|
|
|
gboolean user_requested,
|
|
|
|
|
GError **err);
|
|
|
|
|
|
|
|
|
|
#include "nm-device-802-3-ethernet-glue.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (NMDevice8023Ethernet, nm_device_802_3_ethernet, NM_TYPE_DEVICE)
|
|
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
#define NM_DEVICE_802_3_ETHERNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_802_3_ETHERNET, NMDevice8023EthernetPrivate))
|
|
|
|
|
|
|
|
|
|
struct _NMDevice8023EthernetPrivate
|
|
|
|
|
{
|
|
|
|
|
gboolean dispose_has_run;
|
|
|
|
|
|
|
|
|
|
struct ether_addr hw_addr;
|
2006-01-03 17:07:07 +00:00
|
|
|
char * carrier_file_path;
|
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
|
|
|
gulong link_connected_id;
|
|
|
|
|
gulong link_disconnected_id;
|
2007-01-04 12:06:26 +00:00
|
|
|
guint link_source_id;
|
2006-11-25 15:41:04 +00:00
|
|
|
|
|
|
|
|
NMSupplicantInterface * sup_iface;
|
2005-12-31 08:21:24 +00:00
|
|
|
};
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
enum {
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_HW_ADDRESS,
|
|
|
|
|
PROP_SPEED,
|
|
|
|
|
|
|
|
|
|
LAST_PROP
|
|
|
|
|
};
|
|
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
static gboolean supports_mii_carrier_detect (NMDevice8023Ethernet *dev);
|
|
|
|
|
static gboolean supports_ethtool_carrier_detect (NMDevice8023Ethernet *dev);
|
|
|
|
|
|
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 nm_device_802_3_ethernet_link_activated (NmNetlinkMonitor *monitor,
|
|
|
|
|
GObject *obj,
|
|
|
|
|
NMDevice8023Ethernet *self);
|
|
|
|
|
static void nm_device_802_3_ethernet_link_deactivated (NmNetlinkMonitor *monitor,
|
|
|
|
|
GObject *obj,
|
|
|
|
|
NMDevice8023Ethernet *self);
|
|
|
|
|
|
2006-11-25 15:41:04 +00:00
|
|
|
static void supplicant_iface_state_cb (NMSupplicantInterface * iface,
|
|
|
|
|
guint32 new_state,
|
|
|
|
|
guint32 old_state,
|
|
|
|
|
NMDevice80211Wireless *self);
|
|
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nm_device_802_3_ethernet_init (NMDevice8023Ethernet * self)
|
|
|
|
|
{
|
|
|
|
|
self->priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self);
|
|
|
|
|
self->priv->dispose_has_run = FALSE;
|
2007-01-04 12:06:26 +00:00
|
|
|
self->priv->link_source_id = 0;
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
memset (&(self->priv->hw_addr), 0, sizeof (struct ether_addr));
|
2007-02-05 12:14:09 +00:00
|
|
|
|
|
|
|
|
nm_device_set_device_type (NM_DEVICE (self), DEVICE_TYPE_802_3_ETHERNET);
|
2005-12-31 08:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
real_init (NMDevice *dev)
|
|
|
|
|
{
|
|
|
|
|
NMDevice8023Ethernet * self = NM_DEVICE_802_3_ETHERNET (dev);
|
|
|
|
|
NMData * app_data;
|
|
|
|
|
NmNetlinkMonitor * monitor;
|
2006-11-25 15:41:04 +00:00
|
|
|
NMSupplicantManager * sup_mgr;
|
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
|
|
|
|
|
|
|
|
app_data = nm_device_get_app_data (NM_DEVICE (self));
|
|
|
|
|
monitor = app_data->netlink_monitor;
|
|
|
|
|
|
|
|
|
|
self->priv->link_connected_id =
|
|
|
|
|
g_signal_connect (G_OBJECT (monitor), "interface-connected",
|
|
|
|
|
G_CALLBACK (nm_device_802_3_ethernet_link_activated), self);
|
|
|
|
|
|
|
|
|
|
self->priv->link_disconnected_id =
|
|
|
|
|
g_signal_connect (G_OBJECT (monitor), "interface-disconnected",
|
|
|
|
|
G_CALLBACK (nm_device_802_3_ethernet_link_deactivated), self);
|
2006-11-25 15:41:04 +00:00
|
|
|
|
|
|
|
|
sup_mgr = nm_supplicant_manager_get ();
|
|
|
|
|
self->priv->sup_iface = nm_supplicant_manager_get_iface (sup_mgr,
|
2007-02-05 12:14:09 +00:00
|
|
|
nm_device_get_iface (NM_DEVICE (self)),
|
|
|
|
|
FALSE);
|
2006-11-25 15:41:04 +00:00
|
|
|
if (self->priv->sup_iface == NULL) {
|
|
|
|
|
nm_warning ("Couldn't initialize supplicant interface for %s.",
|
|
|
|
|
nm_device_get_iface (NM_DEVICE (self)));
|
|
|
|
|
} else {
|
|
|
|
|
g_signal_connect (G_OBJECT (self->priv->sup_iface),
|
|
|
|
|
"state",
|
|
|
|
|
G_CALLBACK (supplicant_iface_state_cb),
|
|
|
|
|
self);
|
|
|
|
|
}
|
|
|
|
|
g_object_unref (sup_mgr);
|
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
|
|
|
|
|
nm_device_802_3_ethernet_link_activated (NmNetlinkMonitor *monitor,
|
|
|
|
|
GObject *obj,
|
|
|
|
|
NMDevice8023Ethernet *self)
|
|
|
|
|
{
|
2006-12-28 22:13:59 +00:00
|
|
|
NMDevice * dev = NM_DEVICE (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
|
|
|
/* Make sure signal is for us */
|
2006-12-28 22:13:59 +00:00
|
|
|
if (dev != NM_DEVICE (obj))
|
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
|
|
|
return;
|
|
|
|
|
|
2006-12-28 22:13:59 +00:00
|
|
|
nm_device_set_active_link (dev, TRUE);
|
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
|
|
|
|
|
nm_device_802_3_ethernet_link_deactivated (NmNetlinkMonitor *monitor,
|
|
|
|
|
GObject *obj,
|
|
|
|
|
NMDevice8023Ethernet *self)
|
|
|
|
|
{
|
2006-12-28 22:13:59 +00:00
|
|
|
NMDevice * dev = NM_DEVICE (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
|
|
|
/* Make sure signal is for us */
|
2006-12-28 22:13:59 +00:00
|
|
|
if (dev != NM_DEVICE (obj))
|
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
|
|
|
return;
|
|
|
|
|
|
2006-12-28 22:13:59 +00:00
|
|
|
nm_device_set_active_link (dev, FALSE);
|
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
|
|
|
}
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2006-01-03 17:07:07 +00:00
|
|
|
static gboolean
|
|
|
|
|
probe_link (NMDevice8023Ethernet *self)
|
|
|
|
|
{
|
2006-01-11 Robert Love <rml@novell.com>
* configure.in: Add the gcc flags '-Wshadow' and '-Wfloat-equal'.
* gnome/applet/applet.c, gnome/vpn-properties/nm-vpn-properties.c,
src/NetworkManagerAPList.c, src/NetworkManagerDbus.c,
src/NetworkManagerPolicy.c, src/NetworkManagerSystem.c,
src/nm-dbus-device.c, src/nm-device-802-3-ethernet.c,
src/nm-ip4-config.c, src/vpn-manager/nm-vpn-manager.c,
test/nmtestdevices.c: Fix shadowed variable usage as appropriate.
* src/nm-device-802-11-wireless.c: Fix floating point comparison by
comparing values within DBL_EPSILON. Also fix shadowed variable
usage.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1318 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-01-11 21:07:29 +00:00
|
|
|
gboolean have_link = FALSE;
|
2006-01-03 17:07:07 +00:00
|
|
|
gchar * contents;
|
|
|
|
|
gsize length;
|
|
|
|
|
|
|
|
|
|
if (nm_device_get_removed (NM_DEVICE (self)))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (g_file_get_contents (self->priv->carrier_file_path, &contents, &length, NULL))
|
|
|
|
|
{
|
2006-01-11 Robert Love <rml@novell.com>
* configure.in: Add the gcc flags '-Wshadow' and '-Wfloat-equal'.
* gnome/applet/applet.c, gnome/vpn-properties/nm-vpn-properties.c,
src/NetworkManagerAPList.c, src/NetworkManagerDbus.c,
src/NetworkManagerPolicy.c, src/NetworkManagerSystem.c,
src/nm-dbus-device.c, src/nm-device-802-3-ethernet.c,
src/nm-ip4-config.c, src/vpn-manager/nm-vpn-manager.c,
test/nmtestdevices.c: Fix shadowed variable usage as appropriate.
* src/nm-device-802-11-wireless.c: Fix floating point comparison by
comparing values within DBL_EPSILON. Also fix shadowed variable
usage.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1318 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-01-11 21:07:29 +00:00
|
|
|
have_link = (gboolean) atoi (contents);
|
2006-01-03 17:07:07 +00:00
|
|
|
g_free (contents);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We say that non-carrier-detect devices always have a link, because
|
2006-01-11 Robert Love <rml@novell.com>
* configure.in: Add the gcc flags '-Wshadow' and '-Wfloat-equal'.
* gnome/applet/applet.c, gnome/vpn-properties/nm-vpn-properties.c,
src/NetworkManagerAPList.c, src/NetworkManagerDbus.c,
src/NetworkManagerPolicy.c, src/NetworkManagerSystem.c,
src/nm-dbus-device.c, src/nm-device-802-3-ethernet.c,
src/nm-ip4-config.c, src/vpn-manager/nm-vpn-manager.c,
test/nmtestdevices.c: Fix shadowed variable usage as appropriate.
* src/nm-device-802-11-wireless.c: Fix floating point comparison by
comparing values within DBL_EPSILON. Also fix shadowed variable
usage.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1318 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-01-11 21:07:29 +00:00
|
|
|
* they never get auto-selected by NM. The user has to force them on us,
|
2006-01-03 17:07:07 +00:00
|
|
|
* so we just hope the user knows whether or not the cable's plugged in.
|
|
|
|
|
*/
|
2006-01-11 Robert Love <rml@novell.com>
* configure.in: Add the gcc flags '-Wshadow' and '-Wfloat-equal'.
* gnome/applet/applet.c, gnome/vpn-properties/nm-vpn-properties.c,
src/NetworkManagerAPList.c, src/NetworkManagerDbus.c,
src/NetworkManagerPolicy.c, src/NetworkManagerSystem.c,
src/nm-dbus-device.c, src/nm-device-802-3-ethernet.c,
src/nm-ip4-config.c, src/vpn-manager/nm-vpn-manager.c,
test/nmtestdevices.c: Fix shadowed variable usage as appropriate.
* src/nm-device-802-11-wireless.c: Fix floating point comparison by
comparing values within DBL_EPSILON. Also fix shadowed variable
usage.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1318 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-01-11 21:07:29 +00:00
|
|
|
if (!have_link && !(nm_device_get_capabilities (NM_DEVICE (self)) & NM_DEVICE_CAP_CARRIER_DETECT))
|
|
|
|
|
have_link = TRUE;
|
2006-01-03 17:07:07 +00:00
|
|
|
|
2006-01-11 Robert Love <rml@novell.com>
* configure.in: Add the gcc flags '-Wshadow' and '-Wfloat-equal'.
* gnome/applet/applet.c, gnome/vpn-properties/nm-vpn-properties.c,
src/NetworkManagerAPList.c, src/NetworkManagerDbus.c,
src/NetworkManagerPolicy.c, src/NetworkManagerSystem.c,
src/nm-dbus-device.c, src/nm-device-802-3-ethernet.c,
src/nm-ip4-config.c, src/vpn-manager/nm-vpn-manager.c,
test/nmtestdevices.c: Fix shadowed variable usage as appropriate.
* src/nm-device-802-11-wireless.c: Fix floating point comparison by
comparing values within DBL_EPSILON. Also fix shadowed variable
usage.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1318 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-01-11 21:07:29 +00:00
|
|
|
return have_link;
|
2006-01-03 17:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
real_update_link (NMDevice *dev)
|
|
|
|
|
{
|
|
|
|
|
NMDevice8023Ethernet * self = NM_DEVICE_802_3_ETHERNET (dev);
|
|
|
|
|
|
|
|
|
|
nm_device_set_active_link (NM_DEVICE (self), probe_link (self));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_device_802_3_periodic_update
|
|
|
|
|
*
|
|
|
|
|
* Periodically update device statistics and link state.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static gboolean
|
|
|
|
|
nm_device_802_3_periodic_update (gpointer data)
|
|
|
|
|
{
|
|
|
|
|
NMDevice8023Ethernet * self = NM_DEVICE_802_3_ETHERNET (data);
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (self != NULL, TRUE);
|
|
|
|
|
|
|
|
|
|
nm_device_set_active_link (NM_DEVICE (self), probe_link (self));
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
real_start (NMDevice *dev)
|
|
|
|
|
{
|
2007-01-04 12:06:26 +00:00
|
|
|
NMDevice8023Ethernet * self = NM_DEVICE_802_3_ETHERNET (dev);
|
|
|
|
|
guint id;
|
2006-01-03 17:07:07 +00:00
|
|
|
|
|
|
|
|
self->priv->carrier_file_path = g_strdup_printf ("/sys/class/net/%s/carrier",
|
|
|
|
|
nm_device_get_iface (NM_DEVICE (dev)));
|
|
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
/* Peridoically update link status */
|
|
|
|
|
id = g_timeout_add (2000, nm_device_802_3_periodic_update, self);
|
|
|
|
|
self->priv->link_source_id = id;
|
2006-01-03 17:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-02-05 12:14:09 +00:00
|
|
|
NMDevice8023Ethernet *
|
|
|
|
|
nm_device_802_3_ethernet_new (const char *iface,
|
|
|
|
|
const char *udi,
|
|
|
|
|
const char *driver,
|
|
|
|
|
gboolean test_dev,
|
|
|
|
|
NMData *app_data)
|
|
|
|
|
{
|
|
|
|
|
GObject *obj;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (iface != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (udi != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (driver != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (app_data != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
obj = g_object_new (NM_TYPE_DEVICE_802_3_ETHERNET,
|
|
|
|
|
NM_DEVICE_INTERFACE_UDI, udi,
|
|
|
|
|
NM_DEVICE_INTERFACE_IFACE, iface,
|
|
|
|
|
NM_DEVICE_INTERFACE_DRIVER, driver,
|
|
|
|
|
NM_DEVICE_INTERFACE_APP_DATA, app_data,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
return NM_DEVICE_802_3_ETHERNET (obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-02-09 08:50:35 +00:00
|
|
|
void
|
|
|
|
|
nm_device_802_3_ethernet_activate (NMDevice8023Ethernet *self,
|
|
|
|
|
gboolean user_requested)
|
|
|
|
|
{
|
|
|
|
|
NMDevice *device;
|
|
|
|
|
NMActRequest *req;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_DEVICE_802_3_ETHERNET (self));
|
|
|
|
|
|
|
|
|
|
device = NM_DEVICE (self);
|
|
|
|
|
req = nm_act_request_new (nm_device_get_app_data (device),
|
|
|
|
|
device,
|
|
|
|
|
NULL,
|
|
|
|
|
user_requested);
|
|
|
|
|
|
|
|
|
|
nm_device_activate (device, req);
|
|
|
|
|
nm_act_request_unref (req);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
static gboolean
|
|
|
|
|
impl_device_802_3_ethernet_activate (NMDevice8023Ethernet *device,
|
|
|
|
|
gboolean user_requested,
|
|
|
|
|
GError **err)
|
|
|
|
|
{
|
|
|
|
|
nm_device_802_3_ethernet_activate (device, user_requested);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
/*
|
2006-01-10 21:15:54 +00:00
|
|
|
* nm_device_802_3_ethernet_get_address
|
2005-12-31 08:21:24 +00:00
|
|
|
*
|
|
|
|
|
* Get a device's hardware address
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
nm_device_802_3_ethernet_get_address (NMDevice8023Ethernet *self, struct ether_addr *addr)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (self != NULL);
|
|
|
|
|
g_return_if_fail (addr != NULL);
|
|
|
|
|
|
|
|
|
|
memcpy (addr, &(self->priv->hw_addr), sizeof (struct ether_addr));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-02-05 12:14:09 +00:00
|
|
|
static void
|
|
|
|
|
real_set_hw_address (NMDevice *dev)
|
2006-01-10 21:15:54 +00:00
|
|
|
{
|
2007-02-05 12:14:09 +00:00
|
|
|
NMDevice8023Ethernet *self = NM_DEVICE_802_3_ETHERNET (dev);
|
2006-01-10 21:15:54 +00:00
|
|
|
struct ifreq req;
|
|
|
|
|
NMSock *sk;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
sk = nm_dev_sock_open (dev, DEV_GENERAL, __FUNCTION__, NULL);
|
|
|
|
|
if (!sk)
|
|
|
|
|
return;
|
2007-02-05 12:14:09 +00:00
|
|
|
|
2006-01-10 21:15:54 +00:00
|
|
|
memset (&req, 0, sizeof (struct ifreq));
|
|
|
|
|
strncpy (req.ifr_name, nm_device_get_iface (dev), sizeof (req.ifr_name) - 1);
|
|
|
|
|
|
|
|
|
|
ret = ioctl (nm_dev_sock_get_fd (sk), SIOCGIFHWADDR, &req);
|
2007-02-05 12:14:09 +00:00
|
|
|
if (ret == 0)
|
|
|
|
|
memcpy (&(self->priv->hw_addr), &(req.ifr_hwaddr.sa_data), sizeof (struct ether_addr));
|
2006-01-10 21:15:54 +00:00
|
|
|
|
2006-01-10 21:36:31 +00:00
|
|
|
nm_dev_sock_close (sk);
|
2006-01-10 21:15:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
|
NMDevice8023Ethernet * self = NM_DEVICE_802_3_ETHERNET (dev);
|
|
|
|
|
guint32 caps = NM_DEVICE_CAP_NONE;
|
|
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-28 22:13:59 +00:00
|
|
|
static gboolean
|
|
|
|
|
real_can_interrupt_activation (NMDevice *dev)
|
|
|
|
|
{
|
|
|
|
|
gboolean interrupt = FALSE;
|
|
|
|
|
|
|
|
|
|
/* Devices that support carrier detect can interrupt activation
|
|
|
|
|
* if the link becomes inactive.
|
|
|
|
|
*/
|
|
|
|
|
if (nm_device_get_capabilities (dev) & NM_DEVICE_CAP_CARRIER_DETECT) {
|
|
|
|
|
if (nm_device_has_active_link (dev) == FALSE) {
|
|
|
|
|
interrupt = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return interrupt;
|
|
|
|
|
}
|
|
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
static void
|
|
|
|
|
nm_device_802_3_ethernet_dispose (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
NMDevice8023Ethernet * self = NM_DEVICE_802_3_ETHERNET (object);
|
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
|
|
|
NMData * data = nm_device_get_app_data (NM_DEVICE (self));
|
2006-11-25 15:41:04 +00:00
|
|
|
NMSupplicantManager * sup_mgr;
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
if (self->priv->dispose_has_run)
|
|
|
|
|
/* If dispose did already run, return. */
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Make sure dispose does not run twice. */
|
|
|
|
|
self->priv->dispose_has_run = TRUE;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* In dispose, you are supposed to free all types referenced from this
|
|
|
|
|
* object which might themselves hold a reference to self. Generally,
|
|
|
|
|
* the most simple solution is to unref all members on which you own a
|
|
|
|
|
* reference.
|
|
|
|
|
*/
|
2006-11-25 15:41:04 +00:00
|
|
|
sup_mgr = nm_supplicant_manager_get ();
|
|
|
|
|
nm_supplicant_manager_release_iface (sup_mgr, self->priv->sup_iface);
|
|
|
|
|
self->priv->sup_iface = NULL;
|
|
|
|
|
g_object_unref (sup_mgr);
|
2005-12-31 08:21:24 +00:00
|
|
|
|
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
|
|
|
g_signal_handler_disconnect (G_OBJECT (data->netlink_monitor),
|
|
|
|
|
self->priv->link_connected_id);
|
|
|
|
|
g_signal_handler_disconnect (G_OBJECT (data->netlink_monitor),
|
|
|
|
|
self->priv->link_disconnected_id);
|
|
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
if (self->priv->link_source_id) {
|
|
|
|
|
g_source_remove (self->priv->link_source_id);
|
|
|
|
|
self->priv->link_source_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->dispose (object);
|
2005-12-31 08:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nm_device_802_3_ethernet_finalize (GObject *object)
|
|
|
|
|
{
|
2007-02-12 09:23:43 +00:00
|
|
|
NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (object);
|
2005-12-31 08:21:24 +00:00
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
g_free (priv->carrier_file_path);
|
2006-01-03 17:07:07 +00:00
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
G_OBJECT_CLASS (nm_device_802_3_ethernet_parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
get_property (GObject *object, guint prop_id,
|
|
|
|
|
GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
2007-02-16 11:23:49 +00:00
|
|
|
NMDevice8023Ethernet *device = NM_DEVICE_802_3_ETHERNET (object);
|
|
|
|
|
struct ether_addr hw_addr;
|
|
|
|
|
char hw_addr_buf[20];
|
2007-02-12 09:23:43 +00:00
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2007-02-16 11:23:49 +00:00
|
|
|
case PROP_HW_ADDRESS:
|
|
|
|
|
memset (hw_addr_buf, 0, 20);
|
|
|
|
|
nm_device_802_3_ethernet_get_address (device, &hw_addr);
|
|
|
|
|
iw_ether_ntop (&hw_addr, hw_addr_buf);
|
|
|
|
|
g_value_set_string (value, &hw_addr_buf[0]);
|
|
|
|
|
break;
|
2007-02-12 09:23:43 +00:00
|
|
|
case PROP_SPEED:
|
2007-02-16 11:23:49 +00:00
|
|
|
g_value_set_int (value, nm_device_802_3_ethernet_get_speed (device));
|
2007-02-12 09:23:43 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2005-12-31 08:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *klass)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
|
|
|
|
|
2007-02-05 12:14:09 +00:00
|
|
|
g_type_class_add_private (object_class, sizeof (NMDevice8023EthernetPrivate));
|
|
|
|
|
|
|
|
|
|
/* virtual methods */
|
2007-02-12 09:23:43 +00:00
|
|
|
object_class->get_property = get_property;
|
2005-12-31 08:21:24 +00:00
|
|
|
object_class->dispose = nm_device_802_3_ethernet_dispose;
|
|
|
|
|
object_class->finalize = nm_device_802_3_ethernet_finalize;
|
|
|
|
|
|
2006-01-03 17:07:07 +00:00
|
|
|
parent_class->get_generic_capabilities = real_get_generic_capabilities;
|
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
|
|
|
parent_class->init = real_init;
|
2006-01-03 17:07:07 +00:00
|
|
|
parent_class->start = real_start;
|
|
|
|
|
parent_class->update_link = real_update_link;
|
2006-12-28 22:13:59 +00:00
|
|
|
parent_class->can_interrupt_activation = real_can_interrupt_activation;
|
2007-02-05 12:14:09 +00:00
|
|
|
parent_class->set_hw_address = real_set_hw_address;
|
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,
|
2007-02-16 11:23:49 +00:00
|
|
|
g_param_spec_string (NM_DEVICE_802_3_ETHERNET_HW_ADDRESS,
|
|
|
|
|
"MAC Address",
|
|
|
|
|
"Hardware MAC address",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READABLE));
|
2007-02-12 09:23:43 +00:00
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_SPEED,
|
|
|
|
|
g_param_spec_int (NM_DEVICE_802_3_ETHERNET_SPEED,
|
2007-02-16 11:23:49 +00:00
|
|
|
"Speed",
|
|
|
|
|
"Speed",
|
|
|
|
|
0, G_MAXINT32, 0,
|
|
|
|
|
G_PARAM_READABLE));
|
2007-02-12 09:23:43 +00:00
|
|
|
|
|
|
|
|
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
|
|
|
|
&dbus_glib_nm_device_802_3_ethernet_object_info);
|
2005-12-31 08:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-11-25 15:41:04 +00:00
|
|
|
/****************************************************************************
|
|
|
|
|
* WPA Supplicant control stuff
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
supplicant_iface_state_cb (NMSupplicantInterface * iface,
|
|
|
|
|
guint32 new_state,
|
|
|
|
|
guint32 old_state,
|
|
|
|
|
NMDevice80211Wireless *self)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (self != NULL);
|
|
|
|
|
|
|
|
|
|
nm_info ("(%s) supplicant interface is now in state %d (from %d).",
|
|
|
|
|
nm_device_get_iface (NM_DEVICE (self)),
|
|
|
|
|
new_state,
|
|
|
|
|
old_state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
/**************************************/
|
|
|
|
|
/* Ethtool capability detection */
|
|
|
|
|
/**************************************/
|
|
|
|
|
#include <linux/sockios.h>
|
|
|
|
|
#include <linux/ethtool.h>
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
supports_ethtool_carrier_detect (NMDevice8023Ethernet *self)
|
|
|
|
|
{
|
|
|
|
|
NMSock * sk;
|
|
|
|
|
struct ifreq ifr;
|
|
|
|
|
gboolean supports_ethtool = FALSE;
|
|
|
|
|
struct ethtool_cmd edata;
|
|
|
|
|
const char * iface;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (self != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
iface = nm_device_get_iface (NM_DEVICE (self));
|
|
|
|
|
if ((sk = nm_dev_sock_open (NM_DEVICE (self), DEV_GENERAL, __func__, NULL)) == NULL)
|
|
|
|
|
{
|
2006-03-02 Robert Love <rml@novell.com>
Add support for retrieving both the per-device speed and the
per-network maximum supported rate. Then change the getProperties
DBUS API for both networks and devices to report this informaiton.
Finally, display the information via both nm-applet and nm-tool:
* gnome/applet/applet-dbus-devices.c: Grab the speed from getProperties
and set it.
* gnome/applet/applet.c: Display the device's speed in the 'Connection
Information' dialog.
* gnome/applet/applet.glade: Update the UI to show per-device speed.
* gnome/applet/nm-device.c, gnome/applet/nm-device.h: Add interfaces
network_device_get_speed() and network_device_set_speed() for
retrieving and setting, respectively, a network device's current
speed.
* src/nm-dbus-device.c: Send the device's speed on getProperties.
* src/nm-device-802-11-wireless.c: Return the rate in Mb/s, not Kb/s,
in the function nm_device_802_11_wireless_get_bitrate() -- it does
not matter (yet) what the units are, because we only feed it its own
output. Implement SIOCGIRATE and set the per-network maximum
supported rate during scanning.
* src/nm-device-802-11-wireless.h: Export the function
nm_device_802_11_wireless_get_bitrate().
* src/nm-device-802-3-ethernet.c, src/nm-device-802-3-ethernet.h: Add
function nm_device_802_3_ethernet_get_speed() for returning an
802.3's current speed, in Mb/s.
* test/nm-tool.c: Display the per-device current speed, if available,
and the per-network maximum rate.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-02 23:01:33 +00:00
|
|
|
nm_warning ("cannot open socket on interface %s for ethtool detect: %s",
|
|
|
|
|
iface, strerror (errno));
|
2005-12-31 08:21:24 +00:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strncpy (ifr.ifr_name, iface, sizeof(ifr.ifr_name) - 1);
|
|
|
|
|
edata.cmd = ETHTOOL_GLINK;
|
|
|
|
|
ifr.ifr_data = (char *) &edata;
|
2006-05-25 22:37:41 +00:00
|
|
|
|
|
|
|
|
nm_ioctl_info ("%s: About to ETHTOOL\n", iface);
|
2005-12-31 08:21:24 +00:00
|
|
|
if (ioctl (nm_dev_sock_get_fd (sk), SIOCETHTOOL, &ifr) == -1)
|
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
|
|
supports_ethtool = TRUE;
|
|
|
|
|
|
|
|
|
|
out:
|
2006-05-25 22:37:41 +00:00
|
|
|
nm_ioctl_info ("%s: Done with ETHTOOL\n", iface);
|
2005-12-31 08:21:24 +00:00
|
|
|
nm_dev_sock_close (sk);
|
|
|
|
|
return supports_ethtool;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-03-02 Robert Love <rml@novell.com>
Add support for retrieving both the per-device speed and the
per-network maximum supported rate. Then change the getProperties
DBUS API for both networks and devices to report this informaiton.
Finally, display the information via both nm-applet and nm-tool:
* gnome/applet/applet-dbus-devices.c: Grab the speed from getProperties
and set it.
* gnome/applet/applet.c: Display the device's speed in the 'Connection
Information' dialog.
* gnome/applet/applet.glade: Update the UI to show per-device speed.
* gnome/applet/nm-device.c, gnome/applet/nm-device.h: Add interfaces
network_device_get_speed() and network_device_set_speed() for
retrieving and setting, respectively, a network device's current
speed.
* src/nm-dbus-device.c: Send the device's speed on getProperties.
* src/nm-device-802-11-wireless.c: Return the rate in Mb/s, not Kb/s,
in the function nm_device_802_11_wireless_get_bitrate() -- it does
not matter (yet) what the units are, because we only feed it its own
output. Implement SIOCGIRATE and set the per-network maximum
supported rate during scanning.
* src/nm-device-802-11-wireless.h: Export the function
nm_device_802_11_wireless_get_bitrate().
* src/nm-device-802-3-ethernet.c, src/nm-device-802-3-ethernet.h: Add
function nm_device_802_3_ethernet_get_speed() for returning an
802.3's current speed, in Mb/s.
* test/nm-tool.c: Display the per-device current speed, if available,
and the per-network maximum rate.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-03-02 23:01:33 +00:00
|
|
|
int
|
|
|
|
|
nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *self)
|
|
|
|
|
{
|
|
|
|
|
NMSock * sk;
|
|
|
|
|
struct ifreq ifr;
|
|
|
|
|
struct ethtool_cmd edata;
|
|
|
|
|
const char * iface;
|
|
|
|
|
int speed = 0;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (self != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
iface = nm_device_get_iface (NM_DEVICE (self));
|
|
|
|
|
if ((sk = nm_dev_sock_open (NM_DEVICE (self), DEV_GENERAL, __func__, NULL)) == NULL)
|
|
|
|
|
{
|
|
|
|
|
nm_warning ("cannot open socket on interface %s for ethtool: %s",
|
|
|
|
|
iface, strerror (errno));
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strncpy (ifr.ifr_name, iface, sizeof (ifr.ifr_name) - 1);
|
|
|
|
|
edata.cmd = ETHTOOL_GSET;
|
|
|
|
|
ifr.ifr_data = (char *) &edata;
|
|
|
|
|
if (ioctl (nm_dev_sock_get_fd (sk), SIOCETHTOOL, &ifr) == -1)
|
|
|
|
|
goto out;
|
|
|
|
|
speed = edata.speed;
|
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
nm_dev_sock_close (sk);
|
|
|
|
|
return speed;
|
|
|
|
|
}
|
|
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
/**************************************/
|
|
|
|
|
/* MII capability detection */
|
|
|
|
|
/**************************************/
|
|
|
|
|
#include <linux/mii.h>
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
mdio_read (NMDevice8023Ethernet *self, NMSock *sk, struct ifreq *ifr, int location)
|
|
|
|
|
{
|
|
|
|
|
struct mii_ioctl_data *mii;
|
|
|
|
|
int val = -1;
|
|
|
|
|
const char * iface;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (sk != NULL, -1);
|
|
|
|
|
g_return_val_if_fail (ifr != NULL, -1);
|
|
|
|
|
|
|
|
|
|
iface = nm_device_get_iface (NM_DEVICE (self));
|
|
|
|
|
|
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;
|
|
|
|
|
|
2006-05-25 22:37:41 +00:00
|
|
|
nm_ioctl_info ("%s: About to GET MIIREG\n", iface);
|
2005-12-31 08:21:24 +00:00
|
|
|
if (ioctl (nm_dev_sock_get_fd (sk), SIOCGMIIREG, ifr) >= 0)
|
|
|
|
|
val = mii->val_out;
|
2006-05-25 22:37:41 +00:00
|
|
|
nm_ioctl_info ("%s: Done with GET MIIREG\n", iface);
|
2005-12-31 08:21:24 +00:00
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
supports_mii_carrier_detect (NMDevice8023Ethernet *self)
|
|
|
|
|
{
|
|
|
|
|
NMSock * sk;
|
|
|
|
|
struct ifreq ifr;
|
|
|
|
|
int bmsr;
|
|
|
|
|
gboolean supports_mii = FALSE;
|
|
|
|
|
int err;
|
|
|
|
|
const char * iface;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (self != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
iface = nm_device_get_iface (NM_DEVICE (self));
|
|
|
|
|
if ((sk = nm_dev_sock_open (NM_DEVICE (self), DEV_GENERAL, __FUNCTION__, NULL)) == NULL)
|
|
|
|
|
{
|
|
|
|
|
nm_warning ("cannot open socket on interface %s for MII detect; errno=%d",
|
|
|
|
|
iface, errno);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strncpy (ifr.ifr_name, iface, sizeof (ifr.ifr_name) - 1);
|
2006-05-25 22:37:41 +00:00
|
|
|
nm_ioctl_info ("%s: About to GET MIIPHY\n", iface);
|
2005-12-31 08:21:24 +00:00
|
|
|
err = ioctl (nm_dev_sock_get_fd (sk), SIOCGMIIPHY, &ifr);
|
2006-05-25 22:37:41 +00:00
|
|
|
nm_ioctl_info ("%s: Done with GET MIIPHY\n", iface);
|
|
|
|
|
|
2005-12-31 08:21:24 +00:00
|
|
|
if (err < 0)
|
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
|
|
/* If we can read the BMSR register, we assume that the card supports MII link detection */
|
|
|
|
|
bmsr = mdio_read (self, sk, &ifr, MII_BMSR);
|
|
|
|
|
supports_mii = (bmsr != -1) ? TRUE : FALSE;
|
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
nm_dev_sock_close (sk);
|
|
|
|
|
return supports_mii;
|
|
|
|
|
}
|