2004-06-24 14:18:37 +00:00
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* Dan Williams <dcbw@redhat.com>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*
|
|
|
|
|
* (C) Copyright 2004 Red Hat, Inc.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/socket.h>
|
2004-07-06 01:34:10 +00:00
|
|
|
#include <linux/sockios.h>
|
2004-09-08 18:14:42 +00:00
|
|
|
#include <syslog.h>
|
2005-03-26 03:42:05 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
#include <string.h>
|
2005-04-03 02:10:27 +00:00
|
|
|
#include <signal.h>
|
2005-04-06 16:45:48 +00:00
|
|
|
#include <iwlib.h>
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
#include "NetworkManager.h"
|
|
|
|
|
#include "NetworkManagerUtils.h"
|
2005-03-14 Ray Strode <rstrode@redhat.com>
Fourth (probably working) cut at porting to
dbus 0.30 api and new hal. This cut adds
some new logging macros to make debugging
easier.
* dispatcher-daemon/NetworkManagerDispatcher.c:
* info-daemon/NetworkmanagerInfo.c:
* info-daemon/NetworkManagerInfoPassphraseDialog.c:
* info-daemon/NetworkManagerInfoVPN.c:
* src/NetworkManager.c:
* src/NetworkManagerAP.c:
* src/NetworkManagerAPList.c:
* src/NetworkManagerDHCP.c:
* src/NetworkManagerDbus.c:
* src/NetworkManagerDevice.c:
* src/NetworkManagerPolicy.c:
* src/NetworkManagerSystem.c:
* src/NetworkManagerUtils.c:
* src/NetworkManagerWireless.c:
* src/autoip.c:
* src/nm-dbus-nm.c:
* src/backends/NetworkManagerDebian.c:
* src/backends/NetworkManagerGentoo.c:
* src/backends/NetworkManagerRedHat.c:
* src/backends/NetworkManagerSlackware.c:
use new logging macros.
* dispatcher-daemon/NetworkManagerDispatcher.c:
(nmd_dbus_filter): s/dbus_free/g_free/
* info-daemon/Makefile.am: link in utils library.
* info-daemon/NetworkmanagerInfo.c: use new logging
macros.
(nmi_dbus_get_network): don't assume enumerations
are 32-bit.
(nmi_dbus_nmi_message_handler): don't free what
doesn't belong to us.
* libnm_glib/libnm_glib.c:
(libnm_glib_get_nm_status):
(libnm_glib_init): don't free what doesn't
belong to us.
(libnm_glib_dbus): strdup result, so it doesn't get
lost when message is unref'd.
* panel-applet/NMWirelessAppletDbus.c:
(nmwa_dbus_update_devices): s/dbus_free/g_free/
* src/NetworkManager.c:
(nm_monitor_wired_link_state): request initial status
dump of all cards when we start up, instead of relying
on /sys/.../carrier.
(nm_info_handler), (nm_set_up_log_handlers):
log handlers to specify what syslog priorites
the logging macros default to.
* src/NetworkManagerAPList.c:
(nm_ap_list_populate_from_nmi):
s/dbus_free_string_array/g_strfreev/
* src/NetworkManagerDbus.c:
(nm_dbus_get_network_object):
validate d-bus message argument types.
Advance message iterator after reading argument,
prepend instead of append to GSList.
* src/NetworkManagerDevice.c:
(nm_device_probe_wired_link_status):
remove redundant /sys in /sys path. remove wrong
contents == NULL means has carrier assumption.
* src/nm-netlink-monitor.c
(nm_netlink_monitor_request_status): implement
function to ask kernel to dump interface link
status over netlink socket.
* test/*.c: s/dbus_free/g_free/
* utils/nm-utils.h:
(nm_print_backtrace): new macro to print backtrace.
(nm_get_timestamp): new macro to get sub-second precise
unix timestamp.
(nm_info), (nm_debug), (nm_warning), (nm_error):
new logging functions. nm_info just prints,
nm_debug includes timestamp and function,
nm_warning includes function, nm_error includes
backtrace and sigtrap.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@497 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-15 05:30:15 +00:00
|
|
|
#include "nm-utils.h"
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
|
2005-04-06 16:45:48 +00:00
|
|
|
struct NMSock
|
|
|
|
|
{
|
|
|
|
|
int fd;
|
|
|
|
|
char *func;
|
|
|
|
|
char *desc;
|
|
|
|
|
NMDevice *dev;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static GSList *sock_list = NULL;
|
|
|
|
|
static GStaticMutex sock_list_mutex = G_STATIC_MUTEX_INIT;
|
|
|
|
|
|
2005-02-02 21:49:14 +00:00
|
|
|
typedef struct MutexDesc
|
|
|
|
|
{
|
|
|
|
|
GMutex *mutex;
|
|
|
|
|
char *desc;
|
|
|
|
|
} MutexDesc;
|
|
|
|
|
|
|
|
|
|
GSList *mutex_descs = NULL;
|
|
|
|
|
|
|
|
|
|
/*#define LOCKING_DEBUG*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static MutexDesc *nm_find_mutex_desc (GMutex *mutex)
|
|
|
|
|
{
|
|
|
|
|
GSList *elt;
|
|
|
|
|
|
|
|
|
|
for (elt = mutex_descs; elt; elt = g_slist_next (elt))
|
|
|
|
|
{
|
|
|
|
|
MutexDesc *desc = (MutexDesc *)(elt->data);
|
|
|
|
|
if (desc && (desc->mutex == mutex))
|
|
|
|
|
return desc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_register_mutex_desc
|
|
|
|
|
*
|
|
|
|
|
* Associate a description with a particular mutex.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void nm_register_mutex_desc (GMutex *mutex, char *string)
|
|
|
|
|
{
|
|
|
|
|
if (!(nm_find_mutex_desc (mutex)))
|
|
|
|
|
{
|
|
|
|
|
MutexDesc *desc = g_malloc0 (sizeof (MutexDesc));
|
|
|
|
|
desc->mutex = mutex;
|
|
|
|
|
desc->desc = g_strdup (string);
|
|
|
|
|
mutex_descs = g_slist_append (mutex_descs, desc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-11 Dan Williams <dcbw@redhat.com>
* info-daemon/NetworkManagerInfo.c:
- (main): clean up Seth's code style
* info-daemon/NetworkManagerInfoDbus.c:
- Use the more aptly-named path/service/interface constants from NetworkManager
- Don't return empty strings ("") as object paths ever, instead return errors
* panel-applet/NMWirelessApplet.c:
- Clean up Seth's code style
* src/NetworkManager.[ch]
- (nm_remove_device_from_list): remove anything having to do with pending_device
- (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon
* src/NetworkManagerAPList.[ch]
- Move Iter struct right above the iter functions to preserve opacity
- (nm_ap_list_remove_ap): implement
- (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(),
remove AP if NetworkManagerInfo doesn't know anything about it
- (nm_ap_list_diff): user NMAPList iterators
- (nm_ap_list_print_members): implement debugging function
* src/NetworkManagerDbus.[ch]
- (nm_dbus_nm_get_active_device): remove anything to do with pending_device
- (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused),
and move the actual key setting stuff into NetworkManagerDevice.c
- (nm_dbus_get_network_priority): return -1 now on errors
- (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to
get lost, and force the active device to update its "best" ap when AP lists change
- (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status"
method call due to pending_device member removal
* src/NetworkManagerDevice.[ch]
- Move NMDevice structure to the top
- Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure
- Remove Pending Action stuff from everywhere
- (nm_device_activation_*): We now "begin" activation and start a thread to do the
activation for us. This thread blocks until all conditions for activation have
been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and
then setup up the interface and runs dhclient. We have to do this because there
is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot
run our main loop and respond to dbus method calls or HAL device removals/inserts
- (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we
can tell nm_device_activation_worker() that we've got a key
- (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure
- (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when
diffing (AP appear/disappear signal functions make sure the AP is actually in the device's
list)
- (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here
* src/NetworkManagerPolicy.c
- Remove anything to do with pending_device
- Adjust device activation to deal with activation-in-worker-thread
* src/NetworkManagerUtils.c
- Clean up locking debugging a bit
* src/NetworkManagerWireless.[ch]
- (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function
was badly named and is better as a device function
* panel-applet/.cvsignore: add
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
/*
|
|
|
|
|
* nm_try_acquire_mutex
|
|
|
|
|
*
|
|
|
|
|
* Tries to acquire a given mutex, sleeping a bit between tries.
|
|
|
|
|
*
|
|
|
|
|
* Returns: FALSE if mutex was not acquired
|
|
|
|
|
* TRUE if mutex was successfully acquired
|
|
|
|
|
*/
|
|
|
|
|
gboolean nm_try_acquire_mutex (GMutex *mutex, const char *func)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (mutex != NULL, FALSE);
|
|
|
|
|
|
2005-02-02 21:49:14 +00:00
|
|
|
if (g_mutex_trylock (mutex))
|
2004-06-24 14:18:37 +00:00
|
|
|
{
|
2004-08-24 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerAP.[ch]
- Add a "enc_method_good" member and accessors to an Access Point
to signal when we've found the correct encryption method
for an access point
- Add a "timestamp" member and accessors, remove "priority" member
and accessors (use timestamps instead)
- Rename "wep_key"->"enc_key"
- (nm_ap_get_enc_key_hashed): new, return the correct mangled key
for a specified encryption method using the access points
source encryption key/passphrase
* src/NetworkManagerAPList.c
- When updating a network with dbus, grab timestamp now instead of
priority
* src/NetworkManagerDBus.[ch]
- Add signal for "DeviceActivating"
- Switch priority->timestamp
* src/NetworkManagerDevice.c
- Change references of "wep_key" -> "enc_key" or "key"
- Signal DeviceActivating when starting activation
- When activating a wireless device, if the access point we are connecting
to is encrypted, and we have a source key, try to generate a mangled
key and use that (ie, generate real WEP key from a passphrase)
- Rework device activation to fallback to other encryption methods if
a previous one didn't work (ie, try mangling a key as a 104-bit passphrase
first, then if that doesn't work fall back to direct hex key).
- (nm_device_update_best_ap): fix a deadlock, and use timestamps instead of
priority. We now prefer the latest access point used, rather than using
a priority scheme
- (nm_device_do_normal_scan): make the encryption method "unknown" on access
points we've just discovered, and merge in correct info from the global
access point lists
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@68 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-25 22:41:12 +00:00
|
|
|
#ifdef LOCKING_DEBUG
|
2005-02-02 21:49:14 +00:00
|
|
|
if (func)
|
|
|
|
|
{
|
|
|
|
|
MutexDesc *desc = nm_find_mutex_desc (mutex);
|
2005-03-14 Ray Strode <rstrode@redhat.com>
Fourth (probably working) cut at porting to
dbus 0.30 api and new hal. This cut adds
some new logging macros to make debugging
easier.
* dispatcher-daemon/NetworkManagerDispatcher.c:
* info-daemon/NetworkmanagerInfo.c:
* info-daemon/NetworkManagerInfoPassphraseDialog.c:
* info-daemon/NetworkManagerInfoVPN.c:
* src/NetworkManager.c:
* src/NetworkManagerAP.c:
* src/NetworkManagerAPList.c:
* src/NetworkManagerDHCP.c:
* src/NetworkManagerDbus.c:
* src/NetworkManagerDevice.c:
* src/NetworkManagerPolicy.c:
* src/NetworkManagerSystem.c:
* src/NetworkManagerUtils.c:
* src/NetworkManagerWireless.c:
* src/autoip.c:
* src/nm-dbus-nm.c:
* src/backends/NetworkManagerDebian.c:
* src/backends/NetworkManagerGentoo.c:
* src/backends/NetworkManagerRedHat.c:
* src/backends/NetworkManagerSlackware.c:
use new logging macros.
* dispatcher-daemon/NetworkManagerDispatcher.c:
(nmd_dbus_filter): s/dbus_free/g_free/
* info-daemon/Makefile.am: link in utils library.
* info-daemon/NetworkmanagerInfo.c: use new logging
macros.
(nmi_dbus_get_network): don't assume enumerations
are 32-bit.
(nmi_dbus_nmi_message_handler): don't free what
doesn't belong to us.
* libnm_glib/libnm_glib.c:
(libnm_glib_get_nm_status):
(libnm_glib_init): don't free what doesn't
belong to us.
(libnm_glib_dbus): strdup result, so it doesn't get
lost when message is unref'd.
* panel-applet/NMWirelessAppletDbus.c:
(nmwa_dbus_update_devices): s/dbus_free/g_free/
* src/NetworkManager.c:
(nm_monitor_wired_link_state): request initial status
dump of all cards when we start up, instead of relying
on /sys/.../carrier.
(nm_info_handler), (nm_set_up_log_handlers):
log handlers to specify what syslog priorites
the logging macros default to.
* src/NetworkManagerAPList.c:
(nm_ap_list_populate_from_nmi):
s/dbus_free_string_array/g_strfreev/
* src/NetworkManagerDbus.c:
(nm_dbus_get_network_object):
validate d-bus message argument types.
Advance message iterator after reading argument,
prepend instead of append to GSList.
* src/NetworkManagerDevice.c:
(nm_device_probe_wired_link_status):
remove redundant /sys in /sys path. remove wrong
contents == NULL means has carrier assumption.
* src/nm-netlink-monitor.c
(nm_netlink_monitor_request_status): implement
function to ask kernel to dump interface link
status over netlink socket.
* test/*.c: s/dbus_free/g_free/
* utils/nm-utils.h:
(nm_print_backtrace): new macro to print backtrace.
(nm_get_timestamp): new macro to get sub-second precise
unix timestamp.
(nm_info), (nm_debug), (nm_warning), (nm_error):
new logging functions. nm_info just prints,
nm_debug includes timestamp and function,
nm_warning includes function, nm_error includes
backtrace and sigtrap.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@497 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-15 05:30:15 +00:00
|
|
|
nm_debug ("MUTEX: <%s %p> acquired by %s", desc ? desc->desc : "(none)", mutex, func);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
2005-02-02 21:49:14 +00:00
|
|
|
#endif
|
|
|
|
|
return (TRUE);
|
2004-06-24 14:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-10-13 20:57:23 +00:00
|
|
|
#ifdef LOCKING_DEBUG
|
2005-02-02 21:49:14 +00:00
|
|
|
if (func)
|
|
|
|
|
{
|
|
|
|
|
MutexDesc *desc = nm_find_mutex_desc (mutex);
|
2005-03-14 Ray Strode <rstrode@redhat.com>
Fourth (probably working) cut at porting to
dbus 0.30 api and new hal. This cut adds
some new logging macros to make debugging
easier.
* dispatcher-daemon/NetworkManagerDispatcher.c:
* info-daemon/NetworkmanagerInfo.c:
* info-daemon/NetworkManagerInfoPassphraseDialog.c:
* info-daemon/NetworkManagerInfoVPN.c:
* src/NetworkManager.c:
* src/NetworkManagerAP.c:
* src/NetworkManagerAPList.c:
* src/NetworkManagerDHCP.c:
* src/NetworkManagerDbus.c:
* src/NetworkManagerDevice.c:
* src/NetworkManagerPolicy.c:
* src/NetworkManagerSystem.c:
* src/NetworkManagerUtils.c:
* src/NetworkManagerWireless.c:
* src/autoip.c:
* src/nm-dbus-nm.c:
* src/backends/NetworkManagerDebian.c:
* src/backends/NetworkManagerGentoo.c:
* src/backends/NetworkManagerRedHat.c:
* src/backends/NetworkManagerSlackware.c:
use new logging macros.
* dispatcher-daemon/NetworkManagerDispatcher.c:
(nmd_dbus_filter): s/dbus_free/g_free/
* info-daemon/Makefile.am: link in utils library.
* info-daemon/NetworkmanagerInfo.c: use new logging
macros.
(nmi_dbus_get_network): don't assume enumerations
are 32-bit.
(nmi_dbus_nmi_message_handler): don't free what
doesn't belong to us.
* libnm_glib/libnm_glib.c:
(libnm_glib_get_nm_status):
(libnm_glib_init): don't free what doesn't
belong to us.
(libnm_glib_dbus): strdup result, so it doesn't get
lost when message is unref'd.
* panel-applet/NMWirelessAppletDbus.c:
(nmwa_dbus_update_devices): s/dbus_free/g_free/
* src/NetworkManager.c:
(nm_monitor_wired_link_state): request initial status
dump of all cards when we start up, instead of relying
on /sys/.../carrier.
(nm_info_handler), (nm_set_up_log_handlers):
log handlers to specify what syslog priorites
the logging macros default to.
* src/NetworkManagerAPList.c:
(nm_ap_list_populate_from_nmi):
s/dbus_free_string_array/g_strfreev/
* src/NetworkManagerDbus.c:
(nm_dbus_get_network_object):
validate d-bus message argument types.
Advance message iterator after reading argument,
prepend instead of append to GSList.
* src/NetworkManagerDevice.c:
(nm_device_probe_wired_link_status):
remove redundant /sys in /sys path. remove wrong
contents == NULL means has carrier assumption.
* src/nm-netlink-monitor.c
(nm_netlink_monitor_request_status): implement
function to ask kernel to dump interface link
status over netlink socket.
* test/*.c: s/dbus_free/g_free/
* utils/nm-utils.h:
(nm_print_backtrace): new macro to print backtrace.
(nm_get_timestamp): new macro to get sub-second precise
unix timestamp.
(nm_info), (nm_debug), (nm_warning), (nm_error):
new logging functions. nm_info just prints,
nm_debug includes timestamp and function,
nm_warning includes function, nm_error includes
backtrace and sigtrap.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@497 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-15 05:30:15 +00:00
|
|
|
nm_debug ("MUTEX: <%s %p> FAILED to be acquired by %s", desc ? desc->desc : "(none)", mutex, func);
|
2005-02-02 21:49:14 +00:00
|
|
|
}
|
2004-10-13 20:57:23 +00:00
|
|
|
#endif
|
2004-06-24 14:18:37 +00:00
|
|
|
return (FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-02-02 21:49:14 +00:00
|
|
|
/*
|
|
|
|
|
* nm_lock_mutex
|
|
|
|
|
*
|
|
|
|
|
* Blocks until a mutex is grabbed, with debugging.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void nm_lock_mutex (GMutex *mutex, const char *func)
|
|
|
|
|
{
|
|
|
|
|
#ifdef LOCKING_DEBUG
|
|
|
|
|
if (func)
|
|
|
|
|
{
|
|
|
|
|
MutexDesc *desc = nm_find_mutex_desc (mutex);
|
2005-03-14 Ray Strode <rstrode@redhat.com>
Fourth (probably working) cut at porting to
dbus 0.30 api and new hal. This cut adds
some new logging macros to make debugging
easier.
* dispatcher-daemon/NetworkManagerDispatcher.c:
* info-daemon/NetworkmanagerInfo.c:
* info-daemon/NetworkManagerInfoPassphraseDialog.c:
* info-daemon/NetworkManagerInfoVPN.c:
* src/NetworkManager.c:
* src/NetworkManagerAP.c:
* src/NetworkManagerAPList.c:
* src/NetworkManagerDHCP.c:
* src/NetworkManagerDbus.c:
* src/NetworkManagerDevice.c:
* src/NetworkManagerPolicy.c:
* src/NetworkManagerSystem.c:
* src/NetworkManagerUtils.c:
* src/NetworkManagerWireless.c:
* src/autoip.c:
* src/nm-dbus-nm.c:
* src/backends/NetworkManagerDebian.c:
* src/backends/NetworkManagerGentoo.c:
* src/backends/NetworkManagerRedHat.c:
* src/backends/NetworkManagerSlackware.c:
use new logging macros.
* dispatcher-daemon/NetworkManagerDispatcher.c:
(nmd_dbus_filter): s/dbus_free/g_free/
* info-daemon/Makefile.am: link in utils library.
* info-daemon/NetworkmanagerInfo.c: use new logging
macros.
(nmi_dbus_get_network): don't assume enumerations
are 32-bit.
(nmi_dbus_nmi_message_handler): don't free what
doesn't belong to us.
* libnm_glib/libnm_glib.c:
(libnm_glib_get_nm_status):
(libnm_glib_init): don't free what doesn't
belong to us.
(libnm_glib_dbus): strdup result, so it doesn't get
lost when message is unref'd.
* panel-applet/NMWirelessAppletDbus.c:
(nmwa_dbus_update_devices): s/dbus_free/g_free/
* src/NetworkManager.c:
(nm_monitor_wired_link_state): request initial status
dump of all cards when we start up, instead of relying
on /sys/.../carrier.
(nm_info_handler), (nm_set_up_log_handlers):
log handlers to specify what syslog priorites
the logging macros default to.
* src/NetworkManagerAPList.c:
(nm_ap_list_populate_from_nmi):
s/dbus_free_string_array/g_strfreev/
* src/NetworkManagerDbus.c:
(nm_dbus_get_network_object):
validate d-bus message argument types.
Advance message iterator after reading argument,
prepend instead of append to GSList.
* src/NetworkManagerDevice.c:
(nm_device_probe_wired_link_status):
remove redundant /sys in /sys path. remove wrong
contents == NULL means has carrier assumption.
* src/nm-netlink-monitor.c
(nm_netlink_monitor_request_status): implement
function to ask kernel to dump interface link
status over netlink socket.
* test/*.c: s/dbus_free/g_free/
* utils/nm-utils.h:
(nm_print_backtrace): new macro to print backtrace.
(nm_get_timestamp): new macro to get sub-second precise
unix timestamp.
(nm_info), (nm_debug), (nm_warning), (nm_error):
new logging functions. nm_info just prints,
nm_debug includes timestamp and function,
nm_warning includes function, nm_error includes
backtrace and sigtrap.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@497 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-15 05:30:15 +00:00
|
|
|
nm_debug ("MUTEX: <%s %p> being acquired by %s", desc ? desc->desc : "(none)", mutex, func);
|
2005-02-02 21:49:14 +00:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
g_mutex_lock (mutex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
/*
|
|
|
|
|
* nm_unlock_mutex
|
|
|
|
|
*
|
|
|
|
|
* Simply unlocks a mutex, balances nm_try_acquire_mutex()
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void nm_unlock_mutex (GMutex *mutex, const char *func)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (mutex != NULL);
|
|
|
|
|
|
2004-08-11 Dan Williams <dcbw@redhat.com>
* info-daemon/NetworkManagerInfo.c:
- (main): clean up Seth's code style
* info-daemon/NetworkManagerInfoDbus.c:
- Use the more aptly-named path/service/interface constants from NetworkManager
- Don't return empty strings ("") as object paths ever, instead return errors
* panel-applet/NMWirelessApplet.c:
- Clean up Seth's code style
* src/NetworkManager.[ch]
- (nm_remove_device_from_list): remove anything having to do with pending_device
- (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon
* src/NetworkManagerAPList.[ch]
- Move Iter struct right above the iter functions to preserve opacity
- (nm_ap_list_remove_ap): implement
- (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(),
remove AP if NetworkManagerInfo doesn't know anything about it
- (nm_ap_list_diff): user NMAPList iterators
- (nm_ap_list_print_members): implement debugging function
* src/NetworkManagerDbus.[ch]
- (nm_dbus_nm_get_active_device): remove anything to do with pending_device
- (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused),
and move the actual key setting stuff into NetworkManagerDevice.c
- (nm_dbus_get_network_priority): return -1 now on errors
- (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to
get lost, and force the active device to update its "best" ap when AP lists change
- (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status"
method call due to pending_device member removal
* src/NetworkManagerDevice.[ch]
- Move NMDevice structure to the top
- Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure
- Remove Pending Action stuff from everywhere
- (nm_device_activation_*): We now "begin" activation and start a thread to do the
activation for us. This thread blocks until all conditions for activation have
been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and
then setup up the interface and runs dhclient. We have to do this because there
is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot
run our main loop and respond to dbus method calls or HAL device removals/inserts
- (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we
can tell nm_device_activation_worker() that we've got a key
- (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure
- (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when
diffing (AP appear/disappear signal functions make sure the AP is actually in the device's
list)
- (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here
* src/NetworkManagerPolicy.c
- Remove anything to do with pending_device
- Adjust device activation to deal with activation-in-worker-thread
* src/NetworkManagerUtils.c
- Clean up locking debugging a bit
* src/NetworkManagerWireless.[ch]
- (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function
was badly named and is better as a device function
* panel-applet/.cvsignore: add
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
|
|
|
#ifdef LOCKING_DEBUG
|
2005-02-02 21:49:14 +00:00
|
|
|
if (func)
|
|
|
|
|
{
|
|
|
|
|
MutexDesc *desc = nm_find_mutex_desc (mutex);
|
2005-03-14 Ray Strode <rstrode@redhat.com>
Fourth (probably working) cut at porting to
dbus 0.30 api and new hal. This cut adds
some new logging macros to make debugging
easier.
* dispatcher-daemon/NetworkManagerDispatcher.c:
* info-daemon/NetworkmanagerInfo.c:
* info-daemon/NetworkManagerInfoPassphraseDialog.c:
* info-daemon/NetworkManagerInfoVPN.c:
* src/NetworkManager.c:
* src/NetworkManagerAP.c:
* src/NetworkManagerAPList.c:
* src/NetworkManagerDHCP.c:
* src/NetworkManagerDbus.c:
* src/NetworkManagerDevice.c:
* src/NetworkManagerPolicy.c:
* src/NetworkManagerSystem.c:
* src/NetworkManagerUtils.c:
* src/NetworkManagerWireless.c:
* src/autoip.c:
* src/nm-dbus-nm.c:
* src/backends/NetworkManagerDebian.c:
* src/backends/NetworkManagerGentoo.c:
* src/backends/NetworkManagerRedHat.c:
* src/backends/NetworkManagerSlackware.c:
use new logging macros.
* dispatcher-daemon/NetworkManagerDispatcher.c:
(nmd_dbus_filter): s/dbus_free/g_free/
* info-daemon/Makefile.am: link in utils library.
* info-daemon/NetworkmanagerInfo.c: use new logging
macros.
(nmi_dbus_get_network): don't assume enumerations
are 32-bit.
(nmi_dbus_nmi_message_handler): don't free what
doesn't belong to us.
* libnm_glib/libnm_glib.c:
(libnm_glib_get_nm_status):
(libnm_glib_init): don't free what doesn't
belong to us.
(libnm_glib_dbus): strdup result, so it doesn't get
lost when message is unref'd.
* panel-applet/NMWirelessAppletDbus.c:
(nmwa_dbus_update_devices): s/dbus_free/g_free/
* src/NetworkManager.c:
(nm_monitor_wired_link_state): request initial status
dump of all cards when we start up, instead of relying
on /sys/.../carrier.
(nm_info_handler), (nm_set_up_log_handlers):
log handlers to specify what syslog priorites
the logging macros default to.
* src/NetworkManagerAPList.c:
(nm_ap_list_populate_from_nmi):
s/dbus_free_string_array/g_strfreev/
* src/NetworkManagerDbus.c:
(nm_dbus_get_network_object):
validate d-bus message argument types.
Advance message iterator after reading argument,
prepend instead of append to GSList.
* src/NetworkManagerDevice.c:
(nm_device_probe_wired_link_status):
remove redundant /sys in /sys path. remove wrong
contents == NULL means has carrier assumption.
* src/nm-netlink-monitor.c
(nm_netlink_monitor_request_status): implement
function to ask kernel to dump interface link
status over netlink socket.
* test/*.c: s/dbus_free/g_free/
* utils/nm-utils.h:
(nm_print_backtrace): new macro to print backtrace.
(nm_get_timestamp): new macro to get sub-second precise
unix timestamp.
(nm_info), (nm_debug), (nm_warning), (nm_error):
new logging functions. nm_info just prints,
nm_debug includes timestamp and function,
nm_warning includes function, nm_error includes
backtrace and sigtrap.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@497 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-15 05:30:15 +00:00
|
|
|
nm_debug ("MUTEX: <%s %p> released by %s", desc ? desc->desc : "(none)", mutex, func);
|
2005-02-02 21:49:14 +00:00
|
|
|
}
|
2004-08-11 Dan Williams <dcbw@redhat.com>
* info-daemon/NetworkManagerInfo.c:
- (main): clean up Seth's code style
* info-daemon/NetworkManagerInfoDbus.c:
- Use the more aptly-named path/service/interface constants from NetworkManager
- Don't return empty strings ("") as object paths ever, instead return errors
* panel-applet/NMWirelessApplet.c:
- Clean up Seth's code style
* src/NetworkManager.[ch]
- (nm_remove_device_from_list): remove anything having to do with pending_device
- (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon
* src/NetworkManagerAPList.[ch]
- Move Iter struct right above the iter functions to preserve opacity
- (nm_ap_list_remove_ap): implement
- (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(),
remove AP if NetworkManagerInfo doesn't know anything about it
- (nm_ap_list_diff): user NMAPList iterators
- (nm_ap_list_print_members): implement debugging function
* src/NetworkManagerDbus.[ch]
- (nm_dbus_nm_get_active_device): remove anything to do with pending_device
- (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused),
and move the actual key setting stuff into NetworkManagerDevice.c
- (nm_dbus_get_network_priority): return -1 now on errors
- (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to
get lost, and force the active device to update its "best" ap when AP lists change
- (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status"
method call due to pending_device member removal
* src/NetworkManagerDevice.[ch]
- Move NMDevice structure to the top
- Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure
- Remove Pending Action stuff from everywhere
- (nm_device_activation_*): We now "begin" activation and start a thread to do the
activation for us. This thread blocks until all conditions for activation have
been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and
then setup up the interface and runs dhclient. We have to do this because there
is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot
run our main loop and respond to dbus method calls or HAL device removals/inserts
- (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we
can tell nm_device_activation_worker() that we've got a key
- (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure
- (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when
diffing (AP appear/disappear signal functions make sure the AP is actually in the device's
list)
- (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here
* src/NetworkManagerPolicy.c
- Remove anything to do with pending_device
- Adjust device activation to deal with activation-in-worker-thread
* src/NetworkManagerUtils.c
- Clean up locking debugging a bit
* src/NetworkManagerWireless.[ch]
- (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function
was badly named and is better as a device function
* panel-applet/.cvsignore: add
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
|
|
|
#endif
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
g_mutex_unlock (mutex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-04-06 16:45:48 +00:00
|
|
|
/*
|
|
|
|
|
* nm_dev_sock_open
|
|
|
|
|
*
|
|
|
|
|
* Open a socket to a network device and store some debug info about it.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
NMSock *nm_dev_sock_open (NMDevice *dev, SockType type, const char *func_name, const char *desc)
|
|
|
|
|
{
|
|
|
|
|
NMSock *sock = NULL;
|
|
|
|
|
|
|
|
|
|
sock = g_malloc0 (sizeof (NMSock));
|
|
|
|
|
|
|
|
|
|
sock->fd = -1;
|
|
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case DEV_WIRELESS:
|
|
|
|
|
sock->fd = iw_sockets_open ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DEV_GENERAL:
|
|
|
|
|
if ((sock->fd = socket (PF_INET, SOCK_DGRAM, 0)) < 0)
|
|
|
|
|
if ((sock->fd = socket (PF_PACKET, SOCK_DGRAM, 0)) < 0)
|
|
|
|
|
sock->fd = socket (PF_INET6, SOCK_DGRAM, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NETWORK_CONTROL:
|
|
|
|
|
sock->fd = socket (AF_PACKET, SOCK_PACKET, htons (ETH_P_ALL));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sock->fd < 0)
|
|
|
|
|
{
|
|
|
|
|
g_free (sock);
|
|
|
|
|
nm_warning ("Could not open control socket for device '%s'.", dev ? nm_device_get_iface (dev) : "none");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sock->func = func_name ? g_strdup (func_name) : NULL;
|
|
|
|
|
sock->desc = desc ? g_strdup (desc) : NULL;
|
|
|
|
|
sock->dev = dev;
|
|
|
|
|
if (sock->dev)
|
|
|
|
|
nm_device_ref (sock->dev);
|
|
|
|
|
|
|
|
|
|
/* Add the sock to our global sock list for tracking */
|
|
|
|
|
g_static_mutex_lock (&sock_list_mutex);
|
|
|
|
|
sock_list = g_slist_append (sock_list, sock);
|
|
|
|
|
g_static_mutex_unlock (&sock_list_mutex);
|
|
|
|
|
|
|
|
|
|
return sock;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dev_sock_close
|
|
|
|
|
*
|
|
|
|
|
* Close a socket and free its debug data.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void nm_dev_sock_close (NMSock *sock)
|
|
|
|
|
{
|
|
|
|
|
GSList *elt;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (sock != NULL);
|
|
|
|
|
|
|
|
|
|
close (sock->fd);
|
|
|
|
|
g_free (sock->func);
|
|
|
|
|
g_free (sock->desc);
|
|
|
|
|
if (sock->dev)
|
|
|
|
|
nm_device_unref (sock->dev);
|
|
|
|
|
|
|
|
|
|
memset (sock, 0, sizeof (NMSock));
|
|
|
|
|
|
|
|
|
|
g_static_mutex_lock (&sock_list_mutex);
|
|
|
|
|
for (elt = sock_list; elt; elt = g_slist_next (elt))
|
|
|
|
|
{
|
|
|
|
|
NMSock *temp_sock = (NMSock *)(elt->data);
|
|
|
|
|
if (temp_sock == sock)
|
|
|
|
|
{
|
|
|
|
|
sock_list = g_slist_remove_link (sock_list, elt);
|
|
|
|
|
g_slist_free (elt);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
g_static_mutex_unlock (&sock_list_mutex);
|
|
|
|
|
|
|
|
|
|
g_free (sock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dev_sock_get_fd
|
|
|
|
|
*
|
|
|
|
|
* Return the fd associated with an NMSock
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
int nm_dev_sock_get_fd (NMSock *sock)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (sock != NULL, -1);
|
|
|
|
|
|
|
|
|
|
return sock->fd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_print_open_socks
|
|
|
|
|
*
|
|
|
|
|
* Print a list of currently open and registered NMSocks.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void nm_print_open_socks (void)
|
|
|
|
|
{
|
|
|
|
|
GSList *elt = NULL;
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
nm_debug ("Open Sockets List:");
|
|
|
|
|
g_static_mutex_lock (&sock_list_mutex);
|
|
|
|
|
for (elt = sock_list; elt; elt = g_slist_next (elt))
|
|
|
|
|
{
|
|
|
|
|
NMSock *sock = (NMSock *)(elt->data);
|
|
|
|
|
if (sock)
|
|
|
|
|
{
|
|
|
|
|
i++;
|
|
|
|
|
nm_debug (" %d: %s fd:%d F:'%s' D:'%s'", i, sock->dev ? nm_device_get_iface (sock->dev) : "",
|
|
|
|
|
sock->fd, sock->func, sock->desc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
g_static_mutex_unlock (&sock_list_mutex);
|
|
|
|
|
nm_debug ("Open Sockets List Done.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
/*
|
|
|
|
|
* nm_null_safe_strcmp
|
|
|
|
|
*
|
|
|
|
|
* Doesn't freaking segfault if s1/s2 are NULL
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
int nm_null_safe_strcmp (const char *s1, const char *s2)
|
|
|
|
|
{
|
|
|
|
|
if (!s1 && !s2)
|
|
|
|
|
return 0;
|
|
|
|
|
if (!s1 && s2)
|
|
|
|
|
return -1;
|
|
|
|
|
if (s1 && !s2)
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
return (strcmp (s1, s2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-07-06 01:34:10 +00:00
|
|
|
/*
|
|
|
|
|
* nm_ethernet_address_is_valid
|
|
|
|
|
*
|
|
|
|
|
* Compares an ethernet address against known invalid addresses.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2005-05-03 Dan Williams <dcbw@redhat.com>
* Kill dhcpcd. We now use "dhcdbd", a dbus daemon that controls dhclient.
This means that NetworkManager shouldn't have DHCP issues anymore. It also
means you need dhcdbd, which you can get here (get the latest one):
http://people.redhat.com/jvdias/dhcdbd/
Technically NetworkManager can use any DHCP daemon that uses the same DBUS
interface as dhcdbd.
* Rewrite device activation to facilitate the new DHCP infrastructure and
future improvements. Its now "activation request" based, ie there is a single
activation request composed of the device, access point, and other info which
follows the entire activation process. There are 5 stages of the activation
process which correspond to:
1) Device preparation
2) Device configuration (bring it up, set ESSID/Key/etc)
3) IP Config Start (fire off DHCP if we're using it)
4) IP Config Get (grab config from DHCP or static config files)
5) IP Config Commit (set device's IP address, DNS, etc)
Note that there is no longer a "scanning" step, since the access point must
be known _before_ activation starts. If the access point drops out or does
not exist for some reason, the entire activation process fails and must be
restarted for a different access point or device.
Patch from Bill Moss:
* gnome/applet/applet.c
- Fix type of vpn_failure dialog -> vpn_banner dialog
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@597 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-03 20:41:36 +00:00
|
|
|
gboolean nm_ethernet_address_is_valid (const struct ether_addr *test_addr)
|
2004-07-06 01:34:10 +00:00
|
|
|
{
|
|
|
|
|
gboolean valid = FALSE;
|
|
|
|
|
struct ether_addr invalid_addr1 = { {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} };
|
|
|
|
|
struct ether_addr invalid_addr2 = { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
|
|
|
|
|
struct ether_addr invalid_addr3 = { {0x44, 0x44, 0x44, 0x44, 0x44, 0x44} };
|
2005-02-11 14:54:40 +00:00
|
|
|
struct ether_addr invalid_addr4 = { {0x00, 0x30, 0xb4, 0x00, 0x00, 0x00} }; /* prism54 dummy MAC */
|
2004-07-06 01:34:10 +00:00
|
|
|
|
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
- Turn on warnings
* src/NetworkManager.c
- nm_create_device_and_add_to_list(): call nm_device_deactivate() rather
that doing the deactivation ourselves
- Cancel an pending actions on a device if its being removed
- Break up link state checking a bit, make non-active wireless cards
deactivated to save power
- Remove unused variables
* src/NetworkManager.h
- Add support for "pending" device
* src/NetworkManagerAP.h
src/NetworkManagerAP.c
- Add support for determining whether and AP has encryption enabled or not
- AP address is now "struct ether_addr" rather than a string
* src/NetworkManagerDbus.h
src/NetworkManagerDbus.c
- Add signal NeedKeyForNetwork, method SetKeyForNetwork (testing only)
- Changes for AP address from struct ether_addr->string
* src/NetworkManagerDevice.h
src/NetworkManagerDevice.c
- Remove unused variables, fix warnings
- Add support for Pending Actions (things that block a device from being "active"
until they are completed).
- First pending action: Get a WEP key from the user
- Add nm_device_is_wire[d|less](), rename nm_device_is_wireless()
- Clean up explicit testing of dev->iface_type to use nm_device_is_wireless()
- Update wireless link checking to try to determine if the AP we are associated
with is correct, but the WEP key we are using is just wrong. If its wrong,
trigger the GetUserKey pending action on the device
- If dhclient can't get an IP address, it brings the device down. Bring it back
up in that case, otherwise we can't scan or link-check on it
- Add IP address change notifications at appropriate points (still needs some work)
- Add nm_device_need_ap_switch(), checks whether we need to switch access points or not
* src/NetworkManagerPolicy.h
src/NetworkManagerPolicy.c
- Split out "best" access point determiniation into separate function
- Make device activation 2-stage: first the device is pending, then
in the next iteration through it becomes "active" unless it has
pending actions
* src/NetworkManagerUtils.h
src/NetworkManagerUtils.c
- Clean up unused variables and warnings
- Wrap our debug macros in {} to prevent possible confusion
* src/NetworkManagerWireless.c
- Forgot to return current best priority, which lead to last available AP always
being chosen no matter what its priority was. Corrected.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@15 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-15 16:51:48 +00:00
|
|
|
g_return_val_if_fail (test_addr != NULL, FALSE);
|
2004-07-06 01:34:10 +00:00
|
|
|
|
|
|
|
|
/* Compare the AP address the card has with invalid ethernet MAC addresses. */
|
|
|
|
|
if ( (memcmp(test_addr, &invalid_addr1, sizeof(struct ether_addr)) != 0)
|
|
|
|
|
&& (memcmp(test_addr, &invalid_addr2, sizeof(struct ether_addr)) != 0)
|
2005-02-11 14:54:40 +00:00
|
|
|
&& (memcmp(test_addr, &invalid_addr3, sizeof(struct ether_addr)) != 0)
|
|
|
|
|
&& (memcmp(test_addr, &invalid_addr4, sizeof(struct ether_addr)) != 0)
|
|
|
|
|
&& ((test_addr->ether_addr_octet[0] & 1) == 0)) /* Multicast addresses */
|
2004-07-06 01:34:10 +00:00
|
|
|
valid = TRUE;
|
|
|
|
|
|
|
|
|
|
return (valid);
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-24 14:18:37 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_dispose_scan_results
|
|
|
|
|
*
|
|
|
|
|
* Free memory used by the wireless scan results structure
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void nm_dispose_scan_results (wireless_scan *result_list)
|
|
|
|
|
{
|
|
|
|
|
wireless_scan *tmp = result_list;
|
|
|
|
|
|
|
|
|
|
while (tmp)
|
|
|
|
|
{
|
|
|
|
|
wireless_scan *tmp2 = tmp;
|
|
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
free (tmp2);
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-07-06 01:34:10 +00:00
|
|
|
|
2004-08-12 Dan Williams <dcbw@redhat.com>
* info-daemon/passphrase.glade
- Set window title to " "
* panel-applet/Makefile.am
panel-applet/keyring.png
- Deliver to correct place
* panel-applet/NMWirelessApplet.[ch]
- Add comments
- Remove applet->have_active_device as its no longer used
- (nmwa_load_theme): load keyring.png too
- (error_dialog): remove
- (show_warning_dialog): subsume functionality of error dialog too
- (nmwa_destroy, nmwa_new): create and dispose of an application-wide GConfClient
- (nmwa_handle_network_choice): add to deal with user clicking on an item from
the networks menu
- (nmwa_menu_item_activated): GtkMenuItem "activate" signal handler
- (nmwa_button_clicked, nmwa_setup_widgets): create and populate the menu on startup
and when we get broadcasts of changed wireless access points only, not when the
user clicks on the button to display the menu (too long of a wait)
- (nmwa_add_menu_item): Make active network bold, and place a keyring icon beside
networks that are encrypted
- (nmwa_dispose_menu, nmwa_menu_item_data_free): dispose of the data we place on each
menu item with g_object_set_data()
* panel-applet/NMWirelessAppletDbus.[ch]
- (nmwa_dbus_get_bool): add method to return boolean value from dbus message
- (nmwa_dbus_get_active_network): add (nmwa_dbus_get_string() wrapper to get active network)
- (nmwa_dbus_add_networks_to_menu): clean up, only show one instance of each ESSID in the menu
- (nmwa_dbus_set_network): force NetworkManager to use a particular network for wireless cards
- (nmwa_dbus_init, nmwa_dbus_filter): Trap network appear/disappear and device
activation/deactivation signals and rebuild the menu when they happen
* src/NetworkManager.c
- (main): use new nm_spawn_process() rather than system()
* src/NetworkManagerDbus.c
- (nm_dbus_devices_handle_request): don't compare AP structure addresses directly, but essids
instead. Since we can now force best_aps to stick around, the AP structure to which
dev->options.wireless.best_ap points to won't necessarily be in the device's device list
if a scan has happened since the best_ap was frozen. Also add "setNetwork" method
to freeze the best_ap.
* src/NetworkManagerDevice.[ch]
- (nm_device_activation_worker): Use new nm_spawn_process() call rather than system()
- (nm_device_*_best_ap): add freeze/unfreeze/get_frozen functions, and don't really update
the best_ap in nm_device_update_best_ap() if the best_ap is frozen AND in the device's
ap list
* src/NetworkManagerUtils.[ch]
- (nm_spawn_process): add replacement for system() usage
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@48 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-12 19:58:01 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_spawn_process
|
|
|
|
|
*
|
|
|
|
|
* Wrap g_spawn_sync in a usable manner
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
int nm_spawn_process (char *args)
|
|
|
|
|
{
|
|
|
|
|
gint num_args;
|
2004-10-28 19:49:55 +00:00
|
|
|
char **argv = NULL;
|
|
|
|
|
int exit_status = -1;
|
2004-10-12 11:15:47 +00:00
|
|
|
GError *error = NULL;
|
2004-10-28 19:49:55 +00:00
|
|
|
char *so = NULL;
|
|
|
|
|
char *se = NULL;
|
|
|
|
|
|
2004-08-12 Dan Williams <dcbw@redhat.com>
* info-daemon/passphrase.glade
- Set window title to " "
* panel-applet/Makefile.am
panel-applet/keyring.png
- Deliver to correct place
* panel-applet/NMWirelessApplet.[ch]
- Add comments
- Remove applet->have_active_device as its no longer used
- (nmwa_load_theme): load keyring.png too
- (error_dialog): remove
- (show_warning_dialog): subsume functionality of error dialog too
- (nmwa_destroy, nmwa_new): create and dispose of an application-wide GConfClient
- (nmwa_handle_network_choice): add to deal with user clicking on an item from
the networks menu
- (nmwa_menu_item_activated): GtkMenuItem "activate" signal handler
- (nmwa_button_clicked, nmwa_setup_widgets): create and populate the menu on startup
and when we get broadcasts of changed wireless access points only, not when the
user clicks on the button to display the menu (too long of a wait)
- (nmwa_add_menu_item): Make active network bold, and place a keyring icon beside
networks that are encrypted
- (nmwa_dispose_menu, nmwa_menu_item_data_free): dispose of the data we place on each
menu item with g_object_set_data()
* panel-applet/NMWirelessAppletDbus.[ch]
- (nmwa_dbus_get_bool): add method to return boolean value from dbus message
- (nmwa_dbus_get_active_network): add (nmwa_dbus_get_string() wrapper to get active network)
- (nmwa_dbus_add_networks_to_menu): clean up, only show one instance of each ESSID in the menu
- (nmwa_dbus_set_network): force NetworkManager to use a particular network for wireless cards
- (nmwa_dbus_init, nmwa_dbus_filter): Trap network appear/disappear and device
activation/deactivation signals and rebuild the menu when they happen
* src/NetworkManager.c
- (main): use new nm_spawn_process() rather than system()
* src/NetworkManagerDbus.c
- (nm_dbus_devices_handle_request): don't compare AP structure addresses directly, but essids
instead. Since we can now force best_aps to stick around, the AP structure to which
dev->options.wireless.best_ap points to won't necessarily be in the device's device list
if a scan has happened since the best_ap was frozen. Also add "setNetwork" method
to freeze the best_ap.
* src/NetworkManagerDevice.[ch]
- (nm_device_activation_worker): Use new nm_spawn_process() call rather than system()
- (nm_device_*_best_ap): add freeze/unfreeze/get_frozen functions, and don't really update
the best_ap in nm_device_update_best_ap() if the best_ap is frozen AND in the device's
ap list
* src/NetworkManagerUtils.[ch]
- (nm_spawn_process): add replacement for system() usage
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@48 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-12 19:58:01 +00:00
|
|
|
g_return_val_if_fail (args != NULL, -1);
|
|
|
|
|
|
2004-10-28 19:49:55 +00:00
|
|
|
if (g_shell_parse_argv (args, &num_args, &argv, &error))
|
2004-08-12 Dan Williams <dcbw@redhat.com>
* info-daemon/passphrase.glade
- Set window title to " "
* panel-applet/Makefile.am
panel-applet/keyring.png
- Deliver to correct place
* panel-applet/NMWirelessApplet.[ch]
- Add comments
- Remove applet->have_active_device as its no longer used
- (nmwa_load_theme): load keyring.png too
- (error_dialog): remove
- (show_warning_dialog): subsume functionality of error dialog too
- (nmwa_destroy, nmwa_new): create and dispose of an application-wide GConfClient
- (nmwa_handle_network_choice): add to deal with user clicking on an item from
the networks menu
- (nmwa_menu_item_activated): GtkMenuItem "activate" signal handler
- (nmwa_button_clicked, nmwa_setup_widgets): create and populate the menu on startup
and when we get broadcasts of changed wireless access points only, not when the
user clicks on the button to display the menu (too long of a wait)
- (nmwa_add_menu_item): Make active network bold, and place a keyring icon beside
networks that are encrypted
- (nmwa_dispose_menu, nmwa_menu_item_data_free): dispose of the data we place on each
menu item with g_object_set_data()
* panel-applet/NMWirelessAppletDbus.[ch]
- (nmwa_dbus_get_bool): add method to return boolean value from dbus message
- (nmwa_dbus_get_active_network): add (nmwa_dbus_get_string() wrapper to get active network)
- (nmwa_dbus_add_networks_to_menu): clean up, only show one instance of each ESSID in the menu
- (nmwa_dbus_set_network): force NetworkManager to use a particular network for wireless cards
- (nmwa_dbus_init, nmwa_dbus_filter): Trap network appear/disappear and device
activation/deactivation signals and rebuild the menu when they happen
* src/NetworkManager.c
- (main): use new nm_spawn_process() rather than system()
* src/NetworkManagerDbus.c
- (nm_dbus_devices_handle_request): don't compare AP structure addresses directly, but essids
instead. Since we can now force best_aps to stick around, the AP structure to which
dev->options.wireless.best_ap points to won't necessarily be in the device's device list
if a scan has happened since the best_ap was frozen. Also add "setNetwork" method
to freeze the best_ap.
* src/NetworkManagerDevice.[ch]
- (nm_device_activation_worker): Use new nm_spawn_process() call rather than system()
- (nm_device_*_best_ap): add freeze/unfreeze/get_frozen functions, and don't really update
the best_ap in nm_device_update_best_ap() if the best_ap is frozen AND in the device's
ap list
* src/NetworkManagerUtils.[ch]
- (nm_spawn_process): add replacement for system() usage
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@48 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-12 19:58:01 +00:00
|
|
|
{
|
2004-10-28 19:49:55 +00:00
|
|
|
GError *error2 = NULL;
|
2004-10-12 11:15:47 +00:00
|
|
|
|
2004-10-28 19:49:55 +00:00
|
|
|
if (!g_spawn_sync ("/", argv, NULL, 0, NULL, NULL, &so, &se, &exit_status, &error2))
|
2005-03-14 Ray Strode <rstrode@redhat.com>
Fourth (probably working) cut at porting to
dbus 0.30 api and new hal. This cut adds
some new logging macros to make debugging
easier.
* dispatcher-daemon/NetworkManagerDispatcher.c:
* info-daemon/NetworkmanagerInfo.c:
* info-daemon/NetworkManagerInfoPassphraseDialog.c:
* info-daemon/NetworkManagerInfoVPN.c:
* src/NetworkManager.c:
* src/NetworkManagerAP.c:
* src/NetworkManagerAPList.c:
* src/NetworkManagerDHCP.c:
* src/NetworkManagerDbus.c:
* src/NetworkManagerDevice.c:
* src/NetworkManagerPolicy.c:
* src/NetworkManagerSystem.c:
* src/NetworkManagerUtils.c:
* src/NetworkManagerWireless.c:
* src/autoip.c:
* src/nm-dbus-nm.c:
* src/backends/NetworkManagerDebian.c:
* src/backends/NetworkManagerGentoo.c:
* src/backends/NetworkManagerRedHat.c:
* src/backends/NetworkManagerSlackware.c:
use new logging macros.
* dispatcher-daemon/NetworkManagerDispatcher.c:
(nmd_dbus_filter): s/dbus_free/g_free/
* info-daemon/Makefile.am: link in utils library.
* info-daemon/NetworkmanagerInfo.c: use new logging
macros.
(nmi_dbus_get_network): don't assume enumerations
are 32-bit.
(nmi_dbus_nmi_message_handler): don't free what
doesn't belong to us.
* libnm_glib/libnm_glib.c:
(libnm_glib_get_nm_status):
(libnm_glib_init): don't free what doesn't
belong to us.
(libnm_glib_dbus): strdup result, so it doesn't get
lost when message is unref'd.
* panel-applet/NMWirelessAppletDbus.c:
(nmwa_dbus_update_devices): s/dbus_free/g_free/
* src/NetworkManager.c:
(nm_monitor_wired_link_state): request initial status
dump of all cards when we start up, instead of relying
on /sys/.../carrier.
(nm_info_handler), (nm_set_up_log_handlers):
log handlers to specify what syslog priorites
the logging macros default to.
* src/NetworkManagerAPList.c:
(nm_ap_list_populate_from_nmi):
s/dbus_free_string_array/g_strfreev/
* src/NetworkManagerDbus.c:
(nm_dbus_get_network_object):
validate d-bus message argument types.
Advance message iterator after reading argument,
prepend instead of append to GSList.
* src/NetworkManagerDevice.c:
(nm_device_probe_wired_link_status):
remove redundant /sys in /sys path. remove wrong
contents == NULL means has carrier assumption.
* src/nm-netlink-monitor.c
(nm_netlink_monitor_request_status): implement
function to ask kernel to dump interface link
status over netlink socket.
* test/*.c: s/dbus_free/g_free/
* utils/nm-utils.h:
(nm_print_backtrace): new macro to print backtrace.
(nm_get_timestamp): new macro to get sub-second precise
unix timestamp.
(nm_info), (nm_debug), (nm_warning), (nm_error):
new logging functions. nm_info just prints,
nm_debug includes timestamp and function,
nm_warning includes function, nm_error includes
backtrace and sigtrap.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@497 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-15 05:30:15 +00:00
|
|
|
nm_warning ("nm_spawn_process('%s'): could not spawn process. (%s)\n", args, error2->message);
|
2004-08-12 Dan Williams <dcbw@redhat.com>
* info-daemon/passphrase.glade
- Set window title to " "
* panel-applet/Makefile.am
panel-applet/keyring.png
- Deliver to correct place
* panel-applet/NMWirelessApplet.[ch]
- Add comments
- Remove applet->have_active_device as its no longer used
- (nmwa_load_theme): load keyring.png too
- (error_dialog): remove
- (show_warning_dialog): subsume functionality of error dialog too
- (nmwa_destroy, nmwa_new): create and dispose of an application-wide GConfClient
- (nmwa_handle_network_choice): add to deal with user clicking on an item from
the networks menu
- (nmwa_menu_item_activated): GtkMenuItem "activate" signal handler
- (nmwa_button_clicked, nmwa_setup_widgets): create and populate the menu on startup
and when we get broadcasts of changed wireless access points only, not when the
user clicks on the button to display the menu (too long of a wait)
- (nmwa_add_menu_item): Make active network bold, and place a keyring icon beside
networks that are encrypted
- (nmwa_dispose_menu, nmwa_menu_item_data_free): dispose of the data we place on each
menu item with g_object_set_data()
* panel-applet/NMWirelessAppletDbus.[ch]
- (nmwa_dbus_get_bool): add method to return boolean value from dbus message
- (nmwa_dbus_get_active_network): add (nmwa_dbus_get_string() wrapper to get active network)
- (nmwa_dbus_add_networks_to_menu): clean up, only show one instance of each ESSID in the menu
- (nmwa_dbus_set_network): force NetworkManager to use a particular network for wireless cards
- (nmwa_dbus_init, nmwa_dbus_filter): Trap network appear/disappear and device
activation/deactivation signals and rebuild the menu when they happen
* src/NetworkManager.c
- (main): use new nm_spawn_process() rather than system()
* src/NetworkManagerDbus.c
- (nm_dbus_devices_handle_request): don't compare AP structure addresses directly, but essids
instead. Since we can now force best_aps to stick around, the AP structure to which
dev->options.wireless.best_ap points to won't necessarily be in the device's device list
if a scan has happened since the best_ap was frozen. Also add "setNetwork" method
to freeze the best_ap.
* src/NetworkManagerDevice.[ch]
- (nm_device_activation_worker): Use new nm_spawn_process() call rather than system()
- (nm_device_*_best_ap): add freeze/unfreeze/get_frozen functions, and don't really update
the best_ap in nm_device_update_best_ap() if the best_ap is frozen AND in the device's
ap list
* src/NetworkManagerUtils.[ch]
- (nm_spawn_process): add replacement for system() usage
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@48 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-12 19:58:01 +00:00
|
|
|
|
2004-10-28 19:49:55 +00:00
|
|
|
if (so) g_free(so);
|
|
|
|
|
if (se) g_free(se);
|
|
|
|
|
if (argv) g_strfreev (argv);
|
|
|
|
|
if (error2) g_error_free (error2);
|
2005-03-14 Ray Strode <rstrode@redhat.com>
Fourth (probably working) cut at porting to
dbus 0.30 api and new hal. This cut adds
some new logging macros to make debugging
easier.
* dispatcher-daemon/NetworkManagerDispatcher.c:
* info-daemon/NetworkmanagerInfo.c:
* info-daemon/NetworkManagerInfoPassphraseDialog.c:
* info-daemon/NetworkManagerInfoVPN.c:
* src/NetworkManager.c:
* src/NetworkManagerAP.c:
* src/NetworkManagerAPList.c:
* src/NetworkManagerDHCP.c:
* src/NetworkManagerDbus.c:
* src/NetworkManagerDevice.c:
* src/NetworkManagerPolicy.c:
* src/NetworkManagerSystem.c:
* src/NetworkManagerUtils.c:
* src/NetworkManagerWireless.c:
* src/autoip.c:
* src/nm-dbus-nm.c:
* src/backends/NetworkManagerDebian.c:
* src/backends/NetworkManagerGentoo.c:
* src/backends/NetworkManagerRedHat.c:
* src/backends/NetworkManagerSlackware.c:
use new logging macros.
* dispatcher-daemon/NetworkManagerDispatcher.c:
(nmd_dbus_filter): s/dbus_free/g_free/
* info-daemon/Makefile.am: link in utils library.
* info-daemon/NetworkmanagerInfo.c: use new logging
macros.
(nmi_dbus_get_network): don't assume enumerations
are 32-bit.
(nmi_dbus_nmi_message_handler): don't free what
doesn't belong to us.
* libnm_glib/libnm_glib.c:
(libnm_glib_get_nm_status):
(libnm_glib_init): don't free what doesn't
belong to us.
(libnm_glib_dbus): strdup result, so it doesn't get
lost when message is unref'd.
* panel-applet/NMWirelessAppletDbus.c:
(nmwa_dbus_update_devices): s/dbus_free/g_free/
* src/NetworkManager.c:
(nm_monitor_wired_link_state): request initial status
dump of all cards when we start up, instead of relying
on /sys/.../carrier.
(nm_info_handler), (nm_set_up_log_handlers):
log handlers to specify what syslog priorites
the logging macros default to.
* src/NetworkManagerAPList.c:
(nm_ap_list_populate_from_nmi):
s/dbus_free_string_array/g_strfreev/
* src/NetworkManagerDbus.c:
(nm_dbus_get_network_object):
validate d-bus message argument types.
Advance message iterator after reading argument,
prepend instead of append to GSList.
* src/NetworkManagerDevice.c:
(nm_device_probe_wired_link_status):
remove redundant /sys in /sys path. remove wrong
contents == NULL means has carrier assumption.
* src/nm-netlink-monitor.c
(nm_netlink_monitor_request_status): implement
function to ask kernel to dump interface link
status over netlink socket.
* test/*.c: s/dbus_free/g_free/
* utils/nm-utils.h:
(nm_print_backtrace): new macro to print backtrace.
(nm_get_timestamp): new macro to get sub-second precise
unix timestamp.
(nm_info), (nm_debug), (nm_warning), (nm_error):
new logging functions. nm_info just prints,
nm_debug includes timestamp and function,
nm_warning includes function, nm_error includes
backtrace and sigtrap.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@497 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-15 05:30:15 +00:00
|
|
|
} else nm_warning ("nm_spawn_process('%s'): could not parse arguments (%s)\n", args, error->message);
|
2004-10-28 19:49:55 +00:00
|
|
|
|
|
|
|
|
if (error) g_error_free (error);
|
|
|
|
|
|
|
|
|
|
return (exit_status);
|
2004-08-12 Dan Williams <dcbw@redhat.com>
* info-daemon/passphrase.glade
- Set window title to " "
* panel-applet/Makefile.am
panel-applet/keyring.png
- Deliver to correct place
* panel-applet/NMWirelessApplet.[ch]
- Add comments
- Remove applet->have_active_device as its no longer used
- (nmwa_load_theme): load keyring.png too
- (error_dialog): remove
- (show_warning_dialog): subsume functionality of error dialog too
- (nmwa_destroy, nmwa_new): create and dispose of an application-wide GConfClient
- (nmwa_handle_network_choice): add to deal with user clicking on an item from
the networks menu
- (nmwa_menu_item_activated): GtkMenuItem "activate" signal handler
- (nmwa_button_clicked, nmwa_setup_widgets): create and populate the menu on startup
and when we get broadcasts of changed wireless access points only, not when the
user clicks on the button to display the menu (too long of a wait)
- (nmwa_add_menu_item): Make active network bold, and place a keyring icon beside
networks that are encrypted
- (nmwa_dispose_menu, nmwa_menu_item_data_free): dispose of the data we place on each
menu item with g_object_set_data()
* panel-applet/NMWirelessAppletDbus.[ch]
- (nmwa_dbus_get_bool): add method to return boolean value from dbus message
- (nmwa_dbus_get_active_network): add (nmwa_dbus_get_string() wrapper to get active network)
- (nmwa_dbus_add_networks_to_menu): clean up, only show one instance of each ESSID in the menu
- (nmwa_dbus_set_network): force NetworkManager to use a particular network for wireless cards
- (nmwa_dbus_init, nmwa_dbus_filter): Trap network appear/disappear and device
activation/deactivation signals and rebuild the menu when they happen
* src/NetworkManager.c
- (main): use new nm_spawn_process() rather than system()
* src/NetworkManagerDbus.c
- (nm_dbus_devices_handle_request): don't compare AP structure addresses directly, but essids
instead. Since we can now force best_aps to stick around, the AP structure to which
dev->options.wireless.best_ap points to won't necessarily be in the device's device list
if a scan has happened since the best_ap was frozen. Also add "setNetwork" method
to freeze the best_ap.
* src/NetworkManagerDevice.[ch]
- (nm_device_activation_worker): Use new nm_spawn_process() call rather than system()
- (nm_device_*_best_ap): add freeze/unfreeze/get_frozen functions, and don't really update
the best_ap in nm_device_update_best_ap() if the best_ap is frozen AND in the device's
ap list
* src/NetworkManagerUtils.[ch]
- (nm_spawn_process): add replacement for system() usage
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@48 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-12 19:58:01 +00:00
|
|
|
}
|
2004-08-16 19:46:43 +00:00
|
|
|
|
2004-10-21 17:42:14 +00:00
|
|
|
|
|
|
|
|
typedef struct driver_support
|
|
|
|
|
{
|
|
|
|
|
char *name;
|
|
|
|
|
NMDriverSupportLevel level;
|
|
|
|
|
} driver_support;
|
|
|
|
|
|
2004-11-06 02:44:17 +00:00
|
|
|
|
|
|
|
|
/* Blacklist of unsupported wireless drivers */
|
|
|
|
|
static driver_support wireless_driver_blacklist[] =
|
2004-10-21 17:42:14 +00:00
|
|
|
{
|
|
|
|
|
{NULL, NM_DRIVER_UNSUPPORTED}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2004-11-06 02:44:17 +00:00
|
|
|
/* Blacklist of unsupported wired drivers. Drivers/cards that don't support
|
|
|
|
|
* link detection should be blacklisted.
|
|
|
|
|
*/
|
2004-10-21 17:42:14 +00:00
|
|
|
static driver_support wired_driver_blacklist[] =
|
|
|
|
|
{
|
|
|
|
|
/* Completely unsupported drivers */
|
|
|
|
|
{NULL, NM_DRIVER_UNSUPPORTED}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_get_device_driver_name
|
|
|
|
|
*
|
2005-05-06 Dan Williams <dcbw@redhat.com>
* gnome/applet/applet-dbus-device.c
gnome/applet/applet-dbus-info.c
gnome/applet/applet-dbus.c
gnome/applet/applet.c
gnome/applet/applet.h
- (nmwa_get_device_for_nm_device) -> (nmwa_get_device_for_nm_path)
* gnome/applet/applet-dbus.c
- (nmwa_dbus_filter): trap DeviceCarrierOn/DeviceCarrierOff signals
so we notice when wired device's carriers come back on. Should
fix issue with wired devices being grayed out even if the cable
is in, for devices that support carrier detection.
* gnome/applet/applet.c
- (nmwa_driver_notify): bash focus-stealing prevention in the face
- (nmwa_act_stage_to_pixbuf): Clarify wireless ACT_STAGE_DEVICE_CONFIG
tooltip message
- (nmwa_menu_item_activate, nmwa_menu_add_device_item, nmwa_menu_item_data_free):
Fix situation where applet wouldn't respond to menu selections
* src/NetworkManager.c
src/NetworkManagerDevice.c
src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- (nm_dbus_signal_device_status_change) -> (nm_dbus_schedule_device_status_change_signal)
* src/NetworkManagerDbus.c
- (nm_dbus_send_network_not_found, nm_dbus_schedule_network_not_found_signal):
Remove, no longer used or relevant
- (nm_dbus_signal_device_status_change): Better signal enum->string matching
- (nm_dbus_schedule_device_status_change_signal): add
* src/NetworkManagerDevice.c
- (nm_device_worker_thread_stop): don't try to join a NULL worker thread
- (nm_device_set_link_active): Fix up switching for non-carrier-detect devices,
ie don't deactivate them unless explicitly told to by the user. Also send
CARRIER_OFF / CARRIER_ON signals when link changes
- (nm_device_set_essid, nm_device_set_enc_key, nm_device_is_up, nm_device_set_mode):
Don't print error message when device is no longer around
- (nm_device_deactivate): kill any current DHCP process attached to this device,
not just during activation
* src/NetworkManagerPolicy.c
- (nm_policy_auto_get_best_device): Ignore semi-supported devices completely from
auto-device-selection.
- (nm_policy_device_change_check): Don't interrupt semi-supported devices
* src/NetworkManagerSystem.c
- (nm_system_device_set_up_down_with_iface): Quiet first warning message when device
is no longer present (Bill Moss)
* src/backends/shvar.c
- (svOpenFile): Open read-only to make SELinux happy
* src/backends/NetworkManagerRedHat.c
- (nm_system_device_get_system_config): Use SYSCONFDIR rather than hardcoding
the path to the ifcfg-* files
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@613 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-06 21:20:42 +00:00
|
|
|
* Get the device's driver name from HAL.
|
2004-10-21 17:42:14 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2005-05-06 Dan Williams <dcbw@redhat.com>
* gnome/applet/applet-dbus-device.c
gnome/applet/applet-dbus-info.c
gnome/applet/applet-dbus.c
gnome/applet/applet.c
gnome/applet/applet.h
- (nmwa_get_device_for_nm_device) -> (nmwa_get_device_for_nm_path)
* gnome/applet/applet-dbus.c
- (nmwa_dbus_filter): trap DeviceCarrierOn/DeviceCarrierOff signals
so we notice when wired device's carriers come back on. Should
fix issue with wired devices being grayed out even if the cable
is in, for devices that support carrier detection.
* gnome/applet/applet.c
- (nmwa_driver_notify): bash focus-stealing prevention in the face
- (nmwa_act_stage_to_pixbuf): Clarify wireless ACT_STAGE_DEVICE_CONFIG
tooltip message
- (nmwa_menu_item_activate, nmwa_menu_add_device_item, nmwa_menu_item_data_free):
Fix situation where applet wouldn't respond to menu selections
* src/NetworkManager.c
src/NetworkManagerDevice.c
src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- (nm_dbus_signal_device_status_change) -> (nm_dbus_schedule_device_status_change_signal)
* src/NetworkManagerDbus.c
- (nm_dbus_send_network_not_found, nm_dbus_schedule_network_not_found_signal):
Remove, no longer used or relevant
- (nm_dbus_signal_device_status_change): Better signal enum->string matching
- (nm_dbus_schedule_device_status_change_signal): add
* src/NetworkManagerDevice.c
- (nm_device_worker_thread_stop): don't try to join a NULL worker thread
- (nm_device_set_link_active): Fix up switching for non-carrier-detect devices,
ie don't deactivate them unless explicitly told to by the user. Also send
CARRIER_OFF / CARRIER_ON signals when link changes
- (nm_device_set_essid, nm_device_set_enc_key, nm_device_is_up, nm_device_set_mode):
Don't print error message when device is no longer around
- (nm_device_deactivate): kill any current DHCP process attached to this device,
not just during activation
* src/NetworkManagerPolicy.c
- (nm_policy_auto_get_best_device): Ignore semi-supported devices completely from
auto-device-selection.
- (nm_policy_device_change_check): Don't interrupt semi-supported devices
* src/NetworkManagerSystem.c
- (nm_system_device_set_up_down_with_iface): Quiet first warning message when device
is no longer present (Bill Moss)
* src/backends/shvar.c
- (svOpenFile): Open read-only to make SELinux happy
* src/backends/NetworkManagerRedHat.c
- (nm_system_device_get_system_config): Use SYSCONFDIR rather than hardcoding
the path to the ifcfg-* files
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@613 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-06 21:20:42 +00:00
|
|
|
static char *nm_get_device_driver_name (LibHalContext *ctx, NMDevice *dev)
|
2004-10-21 17:42:14 +00:00
|
|
|
{
|
2004-11-06 02:44:17 +00:00
|
|
|
char *udi = NULL;
|
|
|
|
|
char *driver_name = NULL;
|
2004-10-21 17:42:14 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (ctx != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (dev != NULL, NULL);
|
|
|
|
|
|
2005-03-24 18:56:23 +00:00
|
|
|
if ((udi = nm_device_get_udi (dev)))
|
2004-10-21 17:42:14 +00:00
|
|
|
{
|
2005-03-24 18:56:23 +00:00
|
|
|
char *parent_udi = libhal_device_get_property_string (ctx, udi, "info.parent", NULL);
|
|
|
|
|
|
|
|
|
|
if (parent_udi && libhal_device_property_exists (ctx, parent_udi, "info.linux.driver", NULL))
|
|
|
|
|
driver_name = libhal_device_get_property_string (ctx, parent_udi, "info.linux.driver", NULL);
|
2005-04-15 20:00:28 +00:00
|
|
|
g_free(parent_udi);
|
2004-10-21 17:42:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (driver_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_get_wireless_driver_support_level
|
|
|
|
|
*
|
2004-11-06 02:44:17 +00:00
|
|
|
* Blacklist certain wireless devices.
|
2004-10-21 17:42:14 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2005-06-21 15:07:01 +00:00
|
|
|
static NMDriverSupportLevel nm_get_wireless_driver_support_level (LibHalContext *ctx, NMDevice *dev, char **driver)
|
2004-10-21 17:42:14 +00:00
|
|
|
{
|
2004-11-07 14:48:07 +00:00
|
|
|
NMDriverSupportLevel level = NM_DRIVER_FULLY_SUPPORTED;
|
2004-10-21 17:42:14 +00:00
|
|
|
char *driver_name = NULL;
|
|
|
|
|
|
2005-02-10 15:07:35 +00:00
|
|
|
g_return_val_if_fail (ctx != NULL, NM_DRIVER_UNSUPPORTED);
|
|
|
|
|
g_return_val_if_fail (dev != NULL, NM_DRIVER_UNSUPPORTED);
|
|
|
|
|
g_return_val_if_fail (driver != NULL, NM_DRIVER_UNSUPPORTED);
|
|
|
|
|
g_return_val_if_fail (*driver == NULL, NM_DRIVER_UNSUPPORTED);
|
2004-10-21 17:42:14 +00:00
|
|
|
|
|
|
|
|
if ((driver_name = nm_get_device_driver_name (ctx, dev)))
|
|
|
|
|
{
|
2005-02-10 15:07:35 +00:00
|
|
|
driver_support *drv;
|
|
|
|
|
for (drv = &wireless_driver_blacklist[0]; drv->name; drv++)
|
2004-10-21 17:42:14 +00:00
|
|
|
{
|
2005-02-10 15:07:35 +00:00
|
|
|
if (!strcmp (drv->name, driver_name))
|
2004-10-21 17:42:14 +00:00
|
|
|
{
|
2005-02-10 15:07:35 +00:00
|
|
|
level = drv->level;
|
2004-10-21 17:42:14 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-02-10 15:07:35 +00:00
|
|
|
*driver = g_strdup (driver_name);
|
2004-10-21 17:42:14 +00:00
|
|
|
g_free (driver_name);
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-31 Dan Williams <dcbw@redhat.com>
Tighten up handling of wireless devices that don't support wireless
scanning (ie, Orinoco). Due to restructuring of code, these devices
hadn't been doing pseudo-scanning for a while either and would just
spin waiting for an access point. They are now manual devices where
the user must choose the access point from the menu every time. All
"allowed" access points are listed in the applet's menu regardless
of whether or not they can be seen by the card, since it can't scan
anyway.
* src/NetworkManager.c
- (nm_wireless_link_state_handle): new function, but only update
the "best" ap for non-scanning devices when its not activating,
and when no device is being forced on the card
- (nm_link_state_monitor): split wireless link state handling out
into separate function
* src/NetworkManagerDevice.c
- (nm_device_copy_allowed_to_dev_list): new function
- (nm_device_new): populate non-scanning cards' AP lists with
access points from the "allowed" list
- (nm_device_new): don't start a scanning timeout for devices that
can't scan
- (nm_device_activation_schedule_finish): new parameter, should be
the AP that failed to be connected to, pass it on to the
activation finish function in NetworkManagerPolicy.c
- (nm_device_activate_wireless): don't ever try to get a new AP
for non-scanning devices, just fail. The user must choose
a new access point manually.
- (nm_device_activate): grab the AP that failed connection and
pass it on
- (nm_device_update_best_ap): Clear the best AP if we don't have
a link to it, user must manually choose a new one
- (nm_device_do_pseudo_scan): remove function
- (nm_device_wireless_process_scan_results): remove bits for non-
scanning cards since they never get here
- (nm_device_wireless_scan): remove bits for non-scanning devices,
and fake the scan list for test devices a bit earlier
* src/NetworkManagerPolicy.c
- (nm_policy_activation_finish): use the failed_ap that we get
passed rather than getting the best_ap from the card, which
may have changed since we were scheduled
- (nm_policy_allowed_ap_list_update): for non-scanning devices,
update their scan list directly from the allowed list when
we get updates to the allowed list from NetworkManagerInfo
* src/NetworkManagerPolicy.h
- New member for failed access point in NMActivationResult
-------------------------------------
Driver Notification patch: notifies the user when their driver
sucks. Gives them the option to ignore further insertions
of the card that has the sucky driver.
* NetworkManager.h
- Remove the SEMI_SUPPORTED member from the NMDriverSupportLevel
enum and replace it with NO_CARRIER_DETECT and
NO_WIRELESS_SCAN
* panel-applet/NMWirelessApplet.[ch]
- Merge essid.glade -> wireless-applet.glade
- Implement the "Your driver sucks" notification dialog
* panel-applet/NMWirelessAppletDbus.c
- Change stuff from getSupportsCarrierDetect->getDriverSupportLevel
- Grab hardware address for each device from NM too
- Check whether the driver for each device sucks or not whenever
a new device is noticed
* panel-applet/NMWirelessAppletOtherNetworkDialog.c
- Deal with stuff being in wireless-applet.glade now rather than essid.glade
* src/NetworkManager.c
- Fix a double-unref on device removal
* src/NetworkManagerUtils.c
- Set appropriate driver support level on a device that doesn't
support scanning or carrier detection
* src/nm-dbus-device.c
- New "getHWAddress" dbus method on devices
- getSupportsCarrierDetect -> getDriverSupportLevel
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@534 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-31 21:02:21 +00:00
|
|
|
/* Check for carrier detection support */
|
|
|
|
|
if ((level != NM_DRIVER_UNSUPPORTED) && !nm_device_get_supports_wireless_scan (dev))
|
|
|
|
|
level = NM_DRIVER_NO_WIRELESS_SCAN;
|
|
|
|
|
|
2004-10-21 17:42:14 +00:00
|
|
|
return (level);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_get_wired_driver_support_level
|
|
|
|
|
*
|
|
|
|
|
* Blacklist certain devices.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2005-06-21 15:07:01 +00:00
|
|
|
static NMDriverSupportLevel nm_get_wired_driver_support_level (LibHalContext *ctx, NMDevice *dev, char **driver)
|
2004-10-21 17:42:14 +00:00
|
|
|
{
|
|
|
|
|
NMDriverSupportLevel level = NM_DRIVER_FULLY_SUPPORTED;
|
|
|
|
|
char *driver_name = NULL;
|
|
|
|
|
char *usb_test;
|
2004-10-28 19:49:55 +00:00
|
|
|
char *udi;
|
2004-10-21 17:42:14 +00:00
|
|
|
|
2005-02-10 15:07:35 +00:00
|
|
|
g_return_val_if_fail (ctx != NULL, NM_DRIVER_UNSUPPORTED);
|
|
|
|
|
g_return_val_if_fail (dev != NULL, NM_DRIVER_UNSUPPORTED);
|
|
|
|
|
g_return_val_if_fail (driver != NULL, NM_DRIVER_UNSUPPORTED);
|
|
|
|
|
g_return_val_if_fail (*driver == NULL, NM_DRIVER_UNSUPPORTED);
|
2004-10-21 17:42:14 +00:00
|
|
|
|
|
|
|
|
if ((driver_name = nm_get_device_driver_name (ctx, dev)))
|
|
|
|
|
{
|
2005-02-10 15:07:35 +00:00
|
|
|
driver_support *drv;
|
|
|
|
|
for (drv = &wired_driver_blacklist[0]; drv->name; drv++)
|
2004-10-21 17:42:14 +00:00
|
|
|
{
|
2005-02-10 15:07:35 +00:00
|
|
|
if (!strcmp (drv->name, driver_name))
|
2004-10-21 17:42:14 +00:00
|
|
|
{
|
2005-02-10 15:07:35 +00:00
|
|
|
level = drv->level;
|
2004-10-21 17:42:14 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-02-10 15:07:35 +00:00
|
|
|
*driver = g_strdup (driver_name);
|
2004-10-21 17:42:14 +00:00
|
|
|
g_free (driver_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* cipsec devices are also explicitly unsupported at this time */
|
|
|
|
|
if (strstr (nm_device_get_iface (dev), "cipsec"))
|
|
|
|
|
level = NM_DRIVER_UNSUPPORTED;
|
|
|
|
|
|
|
|
|
|
/* Ignore Ethernet-over-USB devices too for the moment (Red Hat #135722) */
|
2004-10-28 19:49:55 +00:00
|
|
|
udi = nm_device_get_udi (dev);
|
2005-03-08 03:44:27 +00:00
|
|
|
if ( libhal_device_property_exists (ctx, udi, "usb.interface.class", NULL)
|
|
|
|
|
&& (usb_test = libhal_device_get_property_string (ctx, udi, "usb.interface.class", NULL)))
|
2004-10-21 17:42:14 +00:00
|
|
|
{
|
2005-03-08 03:44:27 +00:00
|
|
|
libhal_free_string (usb_test);
|
2004-10-21 17:42:14 +00:00
|
|
|
level = NM_DRIVER_UNSUPPORTED;
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-31 Dan Williams <dcbw@redhat.com>
Tighten up handling of wireless devices that don't support wireless
scanning (ie, Orinoco). Due to restructuring of code, these devices
hadn't been doing pseudo-scanning for a while either and would just
spin waiting for an access point. They are now manual devices where
the user must choose the access point from the menu every time. All
"allowed" access points are listed in the applet's menu regardless
of whether or not they can be seen by the card, since it can't scan
anyway.
* src/NetworkManager.c
- (nm_wireless_link_state_handle): new function, but only update
the "best" ap for non-scanning devices when its not activating,
and when no device is being forced on the card
- (nm_link_state_monitor): split wireless link state handling out
into separate function
* src/NetworkManagerDevice.c
- (nm_device_copy_allowed_to_dev_list): new function
- (nm_device_new): populate non-scanning cards' AP lists with
access points from the "allowed" list
- (nm_device_new): don't start a scanning timeout for devices that
can't scan
- (nm_device_activation_schedule_finish): new parameter, should be
the AP that failed to be connected to, pass it on to the
activation finish function in NetworkManagerPolicy.c
- (nm_device_activate_wireless): don't ever try to get a new AP
for non-scanning devices, just fail. The user must choose
a new access point manually.
- (nm_device_activate): grab the AP that failed connection and
pass it on
- (nm_device_update_best_ap): Clear the best AP if we don't have
a link to it, user must manually choose a new one
- (nm_device_do_pseudo_scan): remove function
- (nm_device_wireless_process_scan_results): remove bits for non-
scanning cards since they never get here
- (nm_device_wireless_scan): remove bits for non-scanning devices,
and fake the scan list for test devices a bit earlier
* src/NetworkManagerPolicy.c
- (nm_policy_activation_finish): use the failed_ap that we get
passed rather than getting the best_ap from the card, which
may have changed since we were scheduled
- (nm_policy_allowed_ap_list_update): for non-scanning devices,
update their scan list directly from the allowed list when
we get updates to the allowed list from NetworkManagerInfo
* src/NetworkManagerPolicy.h
- New member for failed access point in NMActivationResult
-------------------------------------
Driver Notification patch: notifies the user when their driver
sucks. Gives them the option to ignore further insertions
of the card that has the sucky driver.
* NetworkManager.h
- Remove the SEMI_SUPPORTED member from the NMDriverSupportLevel
enum and replace it with NO_CARRIER_DETECT and
NO_WIRELESS_SCAN
* panel-applet/NMWirelessApplet.[ch]
- Merge essid.glade -> wireless-applet.glade
- Implement the "Your driver sucks" notification dialog
* panel-applet/NMWirelessAppletDbus.c
- Change stuff from getSupportsCarrierDetect->getDriverSupportLevel
- Grab hardware address for each device from NM too
- Check whether the driver for each device sucks or not whenever
a new device is noticed
* panel-applet/NMWirelessAppletOtherNetworkDialog.c
- Deal with stuff being in wireless-applet.glade now rather than essid.glade
* src/NetworkManager.c
- Fix a double-unref on device removal
* src/NetworkManagerUtils.c
- Set appropriate driver support level on a device that doesn't
support scanning or carrier detection
* src/nm-dbus-device.c
- New "getHWAddress" dbus method on devices
- getSupportsCarrierDetect -> getDriverSupportLevel
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@534 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-31 21:02:21 +00:00
|
|
|
/* Check for carrier detection support */
|
|
|
|
|
if ((level != NM_DRIVER_UNSUPPORTED) && !nm_device_get_supports_carrier_detect(dev))
|
|
|
|
|
level = NM_DRIVER_NO_CARRIER_DETECT;
|
|
|
|
|
|
2004-10-21 17:42:14 +00:00
|
|
|
return (level);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* nm_get_driver_support_level
|
|
|
|
|
*
|
|
|
|
|
* Return the driver support level for a particular device.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
NMDriverSupportLevel nm_get_driver_support_level (LibHalContext *ctx, NMDevice *dev)
|
|
|
|
|
{
|
2005-02-10 15:07:35 +00:00
|
|
|
char *driver = NULL;
|
|
|
|
|
NMDriverSupportLevel level = NM_DRIVER_UNSUPPORTED;
|
2004-10-21 17:42:14 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (ctx != NULL, NM_DRIVER_UNSUPPORTED);
|
|
|
|
|
g_return_val_if_fail (dev != NULL, NM_DRIVER_UNSUPPORTED);
|
|
|
|
|
|
|
|
|
|
if (nm_device_is_wireless (dev))
|
2005-02-10 15:07:35 +00:00
|
|
|
level = nm_get_wireless_driver_support_level (ctx, dev, &driver);
|
2004-10-21 17:42:14 +00:00
|
|
|
else if (nm_device_is_wired (dev))
|
2005-02-10 15:07:35 +00:00
|
|
|
level = nm_get_wired_driver_support_level (ctx, dev, &driver);
|
2004-10-21 17:42:14 +00:00
|
|
|
|
|
|
|
|
switch (level)
|
|
|
|
|
{
|
2005-03-31 Dan Williams <dcbw@redhat.com>
Tighten up handling of wireless devices that don't support wireless
scanning (ie, Orinoco). Due to restructuring of code, these devices
hadn't been doing pseudo-scanning for a while either and would just
spin waiting for an access point. They are now manual devices where
the user must choose the access point from the menu every time. All
"allowed" access points are listed in the applet's menu regardless
of whether or not they can be seen by the card, since it can't scan
anyway.
* src/NetworkManager.c
- (nm_wireless_link_state_handle): new function, but only update
the "best" ap for non-scanning devices when its not activating,
and when no device is being forced on the card
- (nm_link_state_monitor): split wireless link state handling out
into separate function
* src/NetworkManagerDevice.c
- (nm_device_copy_allowed_to_dev_list): new function
- (nm_device_new): populate non-scanning cards' AP lists with
access points from the "allowed" list
- (nm_device_new): don't start a scanning timeout for devices that
can't scan
- (nm_device_activation_schedule_finish): new parameter, should be
the AP that failed to be connected to, pass it on to the
activation finish function in NetworkManagerPolicy.c
- (nm_device_activate_wireless): don't ever try to get a new AP
for non-scanning devices, just fail. The user must choose
a new access point manually.
- (nm_device_activate): grab the AP that failed connection and
pass it on
- (nm_device_update_best_ap): Clear the best AP if we don't have
a link to it, user must manually choose a new one
- (nm_device_do_pseudo_scan): remove function
- (nm_device_wireless_process_scan_results): remove bits for non-
scanning cards since they never get here
- (nm_device_wireless_scan): remove bits for non-scanning devices,
and fake the scan list for test devices a bit earlier
* src/NetworkManagerPolicy.c
- (nm_policy_activation_finish): use the failed_ap that we get
passed rather than getting the best_ap from the card, which
may have changed since we were scheduled
- (nm_policy_allowed_ap_list_update): for non-scanning devices,
update their scan list directly from the allowed list when
we get updates to the allowed list from NetworkManagerInfo
* src/NetworkManagerPolicy.h
- New member for failed access point in NMActivationResult
-------------------------------------
Driver Notification patch: notifies the user when their driver
sucks. Gives them the option to ignore further insertions
of the card that has the sucky driver.
* NetworkManager.h
- Remove the SEMI_SUPPORTED member from the NMDriverSupportLevel
enum and replace it with NO_CARRIER_DETECT and
NO_WIRELESS_SCAN
* panel-applet/NMWirelessApplet.[ch]
- Merge essid.glade -> wireless-applet.glade
- Implement the "Your driver sucks" notification dialog
* panel-applet/NMWirelessAppletDbus.c
- Change stuff from getSupportsCarrierDetect->getDriverSupportLevel
- Grab hardware address for each device from NM too
- Check whether the driver for each device sucks or not whenever
a new device is noticed
* panel-applet/NMWirelessAppletOtherNetworkDialog.c
- Deal with stuff being in wireless-applet.glade now rather than essid.glade
* src/NetworkManager.c
- Fix a double-unref on device removal
* src/NetworkManagerUtils.c
- Set appropriate driver support level on a device that doesn't
support scanning or carrier detection
* src/nm-dbus-device.c
- New "getHWAddress" dbus method on devices
- getSupportsCarrierDetect -> getDriverSupportLevel
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@534 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-31 21:02:21 +00:00
|
|
|
case NM_DRIVER_NO_CARRIER_DETECT:
|
|
|
|
|
nm_info ("%s: Driver '%s' does not support carrier detection.\n"
|
|
|
|
|
"\tYou must switch to it manually.", nm_device_get_iface (dev), driver);
|
|
|
|
|
break;
|
|
|
|
|
case NM_DRIVER_NO_WIRELESS_SCAN:
|
|
|
|
|
nm_info ("%s: Driver '%s' does not support wireless scanning.\n"
|
|
|
|
|
"\tNetworkManager will not be able to fully use the card.",
|
|
|
|
|
nm_device_get_iface (dev), driver);
|
2004-10-21 17:42:14 +00:00
|
|
|
break;
|
|
|
|
|
case NM_DRIVER_FULLY_SUPPORTED:
|
2005-03-14 Ray Strode <rstrode@redhat.com>
Fourth (probably working) cut at porting to
dbus 0.30 api and new hal. This cut adds
some new logging macros to make debugging
easier.
* dispatcher-daemon/NetworkManagerDispatcher.c:
* info-daemon/NetworkmanagerInfo.c:
* info-daemon/NetworkManagerInfoPassphraseDialog.c:
* info-daemon/NetworkManagerInfoVPN.c:
* src/NetworkManager.c:
* src/NetworkManagerAP.c:
* src/NetworkManagerAPList.c:
* src/NetworkManagerDHCP.c:
* src/NetworkManagerDbus.c:
* src/NetworkManagerDevice.c:
* src/NetworkManagerPolicy.c:
* src/NetworkManagerSystem.c:
* src/NetworkManagerUtils.c:
* src/NetworkManagerWireless.c:
* src/autoip.c:
* src/nm-dbus-nm.c:
* src/backends/NetworkManagerDebian.c:
* src/backends/NetworkManagerGentoo.c:
* src/backends/NetworkManagerRedHat.c:
* src/backends/NetworkManagerSlackware.c:
use new logging macros.
* dispatcher-daemon/NetworkManagerDispatcher.c:
(nmd_dbus_filter): s/dbus_free/g_free/
* info-daemon/Makefile.am: link in utils library.
* info-daemon/NetworkmanagerInfo.c: use new logging
macros.
(nmi_dbus_get_network): don't assume enumerations
are 32-bit.
(nmi_dbus_nmi_message_handler): don't free what
doesn't belong to us.
* libnm_glib/libnm_glib.c:
(libnm_glib_get_nm_status):
(libnm_glib_init): don't free what doesn't
belong to us.
(libnm_glib_dbus): strdup result, so it doesn't get
lost when message is unref'd.
* panel-applet/NMWirelessAppletDbus.c:
(nmwa_dbus_update_devices): s/dbus_free/g_free/
* src/NetworkManager.c:
(nm_monitor_wired_link_state): request initial status
dump of all cards when we start up, instead of relying
on /sys/.../carrier.
(nm_info_handler), (nm_set_up_log_handlers):
log handlers to specify what syslog priorites
the logging macros default to.
* src/NetworkManagerAPList.c:
(nm_ap_list_populate_from_nmi):
s/dbus_free_string_array/g_strfreev/
* src/NetworkManagerDbus.c:
(nm_dbus_get_network_object):
validate d-bus message argument types.
Advance message iterator after reading argument,
prepend instead of append to GSList.
* src/NetworkManagerDevice.c:
(nm_device_probe_wired_link_status):
remove redundant /sys in /sys path. remove wrong
contents == NULL means has carrier assumption.
* src/nm-netlink-monitor.c
(nm_netlink_monitor_request_status): implement
function to ask kernel to dump interface link
status over netlink socket.
* test/*.c: s/dbus_free/g_free/
* utils/nm-utils.h:
(nm_print_backtrace): new macro to print backtrace.
(nm_get_timestamp): new macro to get sub-second precise
unix timestamp.
(nm_info), (nm_debug), (nm_warning), (nm_error):
new logging functions. nm_info just prints,
nm_debug includes timestamp and function,
nm_warning includes function, nm_error includes
backtrace and sigtrap.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@497 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-15 05:30:15 +00:00
|
|
|
nm_info ("%s: Driver support level for '%s' is fully-supported",
|
2005-02-10 15:07:35 +00:00
|
|
|
nm_device_get_iface (dev), driver);
|
2004-10-21 17:42:14 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
2005-03-14 Ray Strode <rstrode@redhat.com>
Fourth (probably working) cut at porting to
dbus 0.30 api and new hal. This cut adds
some new logging macros to make debugging
easier.
* dispatcher-daemon/NetworkManagerDispatcher.c:
* info-daemon/NetworkmanagerInfo.c:
* info-daemon/NetworkManagerInfoPassphraseDialog.c:
* info-daemon/NetworkManagerInfoVPN.c:
* src/NetworkManager.c:
* src/NetworkManagerAP.c:
* src/NetworkManagerAPList.c:
* src/NetworkManagerDHCP.c:
* src/NetworkManagerDbus.c:
* src/NetworkManagerDevice.c:
* src/NetworkManagerPolicy.c:
* src/NetworkManagerSystem.c:
* src/NetworkManagerUtils.c:
* src/NetworkManagerWireless.c:
* src/autoip.c:
* src/nm-dbus-nm.c:
* src/backends/NetworkManagerDebian.c:
* src/backends/NetworkManagerGentoo.c:
* src/backends/NetworkManagerRedHat.c:
* src/backends/NetworkManagerSlackware.c:
use new logging macros.
* dispatcher-daemon/NetworkManagerDispatcher.c:
(nmd_dbus_filter): s/dbus_free/g_free/
* info-daemon/Makefile.am: link in utils library.
* info-daemon/NetworkmanagerInfo.c: use new logging
macros.
(nmi_dbus_get_network): don't assume enumerations
are 32-bit.
(nmi_dbus_nmi_message_handler): don't free what
doesn't belong to us.
* libnm_glib/libnm_glib.c:
(libnm_glib_get_nm_status):
(libnm_glib_init): don't free what doesn't
belong to us.
(libnm_glib_dbus): strdup result, so it doesn't get
lost when message is unref'd.
* panel-applet/NMWirelessAppletDbus.c:
(nmwa_dbus_update_devices): s/dbus_free/g_free/
* src/NetworkManager.c:
(nm_monitor_wired_link_state): request initial status
dump of all cards when we start up, instead of relying
on /sys/.../carrier.
(nm_info_handler), (nm_set_up_log_handlers):
log handlers to specify what syslog priorites
the logging macros default to.
* src/NetworkManagerAPList.c:
(nm_ap_list_populate_from_nmi):
s/dbus_free_string_array/g_strfreev/
* src/NetworkManagerDbus.c:
(nm_dbus_get_network_object):
validate d-bus message argument types.
Advance message iterator after reading argument,
prepend instead of append to GSList.
* src/NetworkManagerDevice.c:
(nm_device_probe_wired_link_status):
remove redundant /sys in /sys path. remove wrong
contents == NULL means has carrier assumption.
* src/nm-netlink-monitor.c
(nm_netlink_monitor_request_status): implement
function to ask kernel to dump interface link
status over netlink socket.
* test/*.c: s/dbus_free/g_free/
* utils/nm-utils.h:
(nm_print_backtrace): new macro to print backtrace.
(nm_get_timestamp): new macro to get sub-second precise
unix timestamp.
(nm_info), (nm_debug), (nm_warning), (nm_error):
new logging functions. nm_info just prints,
nm_debug includes timestamp and function,
nm_warning includes function, nm_error includes
backtrace and sigtrap.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@497 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-15 05:30:15 +00:00
|
|
|
nm_info ("%s: Driver support level for '%s' is unsupported",
|
2005-02-10 15:07:35 +00:00
|
|
|
nm_device_get_iface (dev), driver);
|
2004-10-21 17:42:14 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-10 15:07:35 +00:00
|
|
|
g_free (driver);
|
2004-10-21 17:42:14 +00:00
|
|
|
return (level);
|
|
|
|
|
}
|
2005-03-26 03:42:05 +00:00
|
|
|
|
|
|
|
|
static inline int nm_timeval_cmp(const struct timeval *a,
|
|
|
|
|
const struct timeval *b)
|
|
|
|
|
{
|
|
|
|
|
int x;
|
|
|
|
|
x = a->tv_sec - b->tv_sec;
|
|
|
|
|
x *= G_USEC_PER_SEC;
|
|
|
|
|
if (x)
|
|
|
|
|
return x;
|
|
|
|
|
x = a->tv_usec - b->tv_usec;
|
|
|
|
|
if (x)
|
|
|
|
|
return x;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int nm_timeval_has_passed(const struct timeval *a)
|
|
|
|
|
{
|
|
|
|
|
struct timeval current;
|
|
|
|
|
|
|
|
|
|
gettimeofday(¤t, NULL);
|
|
|
|
|
|
|
|
|
|
return (nm_timeval_cmp(¤t, a) >= 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void nm_timeval_add(struct timeval *a,
|
|
|
|
|
const struct timeval *b)
|
|
|
|
|
{
|
|
|
|
|
struct timeval b1;
|
|
|
|
|
|
|
|
|
|
memmove(&b1, b, sizeof b1);
|
|
|
|
|
|
|
|
|
|
/* normalize a and b to be positive for everything */
|
|
|
|
|
while (a->tv_usec < 0)
|
|
|
|
|
{
|
|
|
|
|
a->tv_sec--;
|
|
|
|
|
a->tv_usec += G_USEC_PER_SEC;
|
|
|
|
|
}
|
|
|
|
|
while (b1.tv_usec < 0)
|
|
|
|
|
{
|
|
|
|
|
b1.tv_sec--;
|
|
|
|
|
b1.tv_usec += G_USEC_PER_SEC;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* now add secs and usecs */
|
|
|
|
|
a->tv_sec += b1.tv_sec;
|
|
|
|
|
a->tv_usec += b1.tv_usec;
|
|
|
|
|
|
|
|
|
|
/* and handle our overflow */
|
|
|
|
|
if (a->tv_usec > G_USEC_PER_SEC)
|
|
|
|
|
{
|
|
|
|
|
a->tv_sec++;
|
|
|
|
|
a->tv_usec -= G_USEC_PER_SEC;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void nm_v_wait_for_completion_or_timeout(
|
|
|
|
|
const int max_tries,
|
|
|
|
|
const struct timeval *max_time,
|
|
|
|
|
const guint interval_usecs,
|
|
|
|
|
nm_completion_func test_func,
|
|
|
|
|
nm_completion_func action_func,
|
2005-04-28 02:50:54 +00:00
|
|
|
nm_completion_args args)
|
2005-03-26 03:42:05 +00:00
|
|
|
{
|
|
|
|
|
int try;
|
|
|
|
|
gboolean finished = FALSE;
|
|
|
|
|
struct timeval finish_time;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (test_func || action_func);
|
|
|
|
|
|
|
|
|
|
if (max_time) {
|
|
|
|
|
gettimeofday(&finish_time, NULL);
|
|
|
|
|
nm_timeval_add(&finish_time, max_time);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try = -1;
|
|
|
|
|
while (!finished &&
|
|
|
|
|
(max_tries == NM_COMPLETION_TRIES_INFINITY || try < max_tries))
|
|
|
|
|
{
|
|
|
|
|
if (max_time && nm_timeval_has_passed(&finish_time))
|
|
|
|
|
break;
|
|
|
|
|
try++;
|
|
|
|
|
if (test_func)
|
|
|
|
|
{
|
|
|
|
|
finished = (*test_func)(try, args);
|
|
|
|
|
if (finished)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-03 Dan Williams <dcbw@redhat.com>
* Kill dhcpcd. We now use "dhcdbd", a dbus daemon that controls dhclient.
This means that NetworkManager shouldn't have DHCP issues anymore. It also
means you need dhcdbd, which you can get here (get the latest one):
http://people.redhat.com/jvdias/dhcdbd/
Technically NetworkManager can use any DHCP daemon that uses the same DBUS
interface as dhcdbd.
* Rewrite device activation to facilitate the new DHCP infrastructure and
future improvements. Its now "activation request" based, ie there is a single
activation request composed of the device, access point, and other info which
follows the entire activation process. There are 5 stages of the activation
process which correspond to:
1) Device preparation
2) Device configuration (bring it up, set ESSID/Key/etc)
3) IP Config Start (fire off DHCP if we're using it)
4) IP Config Get (grab config from DHCP or static config files)
5) IP Config Commit (set device's IP address, DNS, etc)
Note that there is no longer a "scanning" step, since the access point must
be known _before_ activation starts. If the access point drops out or does
not exist for some reason, the entire activation process fails and must be
restarted for a different access point or device.
Patch from Bill Moss:
* gnome/applet/applet.c
- Fix type of vpn_failure dialog -> vpn_banner dialog
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@597 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-05-03 20:41:36 +00:00
|
|
|
/* #define NM_SLEEP_DEBUG */
|
2005-03-26 03:42:05 +00:00
|
|
|
#ifdef NM_SLEEP_DEBUG
|
|
|
|
|
syslog (LOG_INFO, "sleeping or %d usecs", interval_usecs);
|
|
|
|
|
#endif
|
|
|
|
|
g_usleep(interval_usecs);
|
|
|
|
|
if (action_func)
|
|
|
|
|
finished = (*action_func)(try, args);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-28 02:50:54 +00:00
|
|
|
/* these should probably be moved to NetworkManagerUtils.h as macros
|
|
|
|
|
* since they don't do varargs stuff any more */
|
2005-03-26 03:42:05 +00:00
|
|
|
void nm_wait_for_completion_or_timeout(
|
|
|
|
|
const int max_tries,
|
|
|
|
|
const struct timeval *max_time,
|
|
|
|
|
const guint interval_usecs,
|
|
|
|
|
nm_completion_func test_func,
|
|
|
|
|
nm_completion_func action_func,
|
2005-04-28 02:50:54 +00:00
|
|
|
nm_completion_args args)
|
2005-03-26 03:42:05 +00:00
|
|
|
{
|
|
|
|
|
nm_v_wait_for_completion_or_timeout(max_tries, max_time,
|
|
|
|
|
interval_usecs, test_func,
|
2005-04-28 02:50:54 +00:00
|
|
|
action_func, args);
|
2005-03-26 03:42:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_wait_for_completion(
|
|
|
|
|
const int max_tries,
|
|
|
|
|
const guint interval_usecs,
|
|
|
|
|
nm_completion_func test_func,
|
|
|
|
|
nm_completion_func action_func,
|
2005-04-28 02:50:54 +00:00
|
|
|
nm_completion_args args)
|
2005-03-26 03:42:05 +00:00
|
|
|
{
|
|
|
|
|
nm_v_wait_for_completion_or_timeout(max_tries, NULL,
|
|
|
|
|
interval_usecs, test_func,
|
2005-04-28 02:50:54 +00:00
|
|
|
action_func, args);
|
2005-03-26 03:42:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nm_wait_for_timeout(
|
|
|
|
|
const struct timeval *max_time,
|
|
|
|
|
const guint interval_usecs,
|
|
|
|
|
nm_completion_func test_func,
|
|
|
|
|
nm_completion_func action_func,
|
2005-04-28 02:50:54 +00:00
|
|
|
nm_completion_args args)
|
2005-03-26 03:42:05 +00:00
|
|
|
{
|
2005-04-28 02:50:54 +00:00
|
|
|
nm_v_wait_for_completion_or_timeout(-1, max_time, interval_usecs,
|
|
|
|
|
test_func, action_func, args);
|
2005-03-26 03:42:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* you can use these, but they're really just examples */
|
2005-04-28 02:50:54 +00:00
|
|
|
gboolean nm_completion_boolean_test(int tries, nm_completion_args args)
|
2005-03-26 03:42:05 +00:00
|
|
|
{
|
2005-04-28 02:50:54 +00:00
|
|
|
gboolean *condition = (gboolean *)args[0];
|
|
|
|
|
char *message = (char *)args[1];
|
2005-06-10 03:47:47 +00:00
|
|
|
int log_level = GPOINTER_TO_INT (args[2]);
|
|
|
|
|
int log_interval = GPOINTER_TO_INT (args[3]);
|
2005-03-26 03:42:05 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (condition != NULL, TRUE);
|
|
|
|
|
|
|
|
|
|
if (message)
|
|
|
|
|
if ((log_interval == 0 && tries == 0) || (log_interval != 0 && tries % log_interval == 0))
|
|
|
|
|
{
|
|
|
|
|
if (log_level == LOG_WARNING)
|
|
|
|
|
nm_warning_str (message);
|
|
|
|
|
else if (log_level == LOG_ERR)
|
|
|
|
|
nm_error_str (message);
|
|
|
|
|
else if (log_level == LOG_DEBUG)
|
|
|
|
|
nm_debug_str (message);
|
|
|
|
|
else
|
|
|
|
|
nm_info_str (message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (*condition)
|
|
|
|
|
return TRUE;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-28 02:50:54 +00:00
|
|
|
gboolean nm_completion_boolean_function1_test(int tries,
|
|
|
|
|
nm_completion_args args)
|
2005-03-26 03:42:05 +00:00
|
|
|
{
|
2005-04-28 02:50:54 +00:00
|
|
|
nm_completion_boolean_function_1 condition = args[0];
|
|
|
|
|
char *message = args[1];
|
2005-06-10 03:47:47 +00:00
|
|
|
int log_level = GPOINTER_TO_INT (args[2]);
|
|
|
|
|
int log_interval = GPOINTER_TO_INT (args[3]);
|
2005-04-28 02:50:54 +00:00
|
|
|
u_int64_t arg0;
|
|
|
|
|
|
|
|
|
|
memcpy(&arg0, &args[4], sizeof (arg0));
|
2005-03-26 03:42:05 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (condition, TRUE);
|
|
|
|
|
|
|
|
|
|
if (message)
|
|
|
|
|
if ((log_interval == 0 && tries == 0)
|
|
|
|
|
|| (log_interval != 0 && tries % log_interval == 0))
|
|
|
|
|
syslog(log_level, message);
|
|
|
|
|
|
|
|
|
|
if (!(*condition)(arg0))
|
|
|
|
|
return TRUE;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-28 02:50:54 +00:00
|
|
|
gboolean nm_completion_boolean_function2_test(int tries,
|
|
|
|
|
nm_completion_args args)
|
2005-03-26 03:42:05 +00:00
|
|
|
{
|
2005-04-28 02:50:54 +00:00
|
|
|
nm_completion_boolean_function_2 condition = args[0];
|
|
|
|
|
char *message = args[1];
|
2005-06-10 03:47:47 +00:00
|
|
|
int log_level = GPOINTER_TO_INT (args[2]);
|
|
|
|
|
int log_interval = GPOINTER_TO_INT (args[3]);
|
2005-04-28 02:50:54 +00:00
|
|
|
u_int64_t arg0, arg1;
|
|
|
|
|
|
|
|
|
|
memcpy(&arg0, &args[4], sizeof (arg0));
|
|
|
|
|
memcpy(&arg1, &args[4]+sizeof (arg0), sizeof (arg1));
|
2005-03-26 03:42:05 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (condition, TRUE);
|
|
|
|
|
|
|
|
|
|
if (message)
|
|
|
|
|
if ((log_interval == 0 && tries == 0)
|
|
|
|
|
|| (log_interval != 0 && tries % log_interval == 0))
|
|
|
|
|
syslog(log_level, message);
|
|
|
|
|
|
|
|
|
|
if (!(*condition)(arg0, arg1))
|
|
|
|
|
return TRUE;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|