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
This commit is contained in:
90
ChangeLog
90
ChangeLog
@@ -1,3 +1,93 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2005-03-11 Ray Strode <rstrode@redhat.com>
|
2005-03-11 Ray Strode <rstrode@redhat.com>
|
||||||
|
|
||||||
Third (unfinished, partially working) cut at porting to
|
Third (unfinished, partially working) cut at porting to
|
||||||
|
@@ -70,7 +70,7 @@ void nmd_execute_scripts (NMDAction action, char *iface_name, guint32 new_ip4_ad
|
|||||||
|
|
||||||
if (!dir)
|
if (!dir)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nmd_execute_scripts(): opendir() could not open /etc/NetworkManager.d. errno = %d", errno);
|
nm_warning ("nmd_execute_scripts(): opendir() could not open /etc/NetworkManager.d. errno = %d", errno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ char * nmd_get_device_name (DBusConnection *connection, char *path)
|
|||||||
|
|
||||||
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, path, NM_DBUS_INTERFACE, "getName")))
|
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, path, NM_DBUS_INTERFACE, "getName")))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Couldn't allocate the dbus message");
|
nm_warning ("Couldn't allocate the dbus message");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,14 +135,14 @@ char * nmd_get_device_name (DBusConnection *connection, char *path)
|
|||||||
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
|
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
|
||||||
if (dbus_error_is_set (&error))
|
if (dbus_error_is_set (&error))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "%s raised: %s", error.name, error.message);
|
nm_warning ("%s raised: %s", error.name, error.message);
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reply == NULL)
|
if (reply == NULL)
|
||||||
{
|
{
|
||||||
syslog( LOG_ERR, "dbus reply message was NULL" );
|
nm_warning ("dbus reply message was NULL" );
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ char * nmd_get_device_name (DBusConnection *connection, char *path)
|
|||||||
dbus_error_init (&error);
|
dbus_error_init (&error);
|
||||||
if (!dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &dev_name, DBUS_TYPE_INVALID))
|
if (!dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &dev_name, DBUS_TYPE_INVALID))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "There was an error getting the device name from NetworkManager." );
|
nm_warning ("There was an error getting the device name from NetworkManager." );
|
||||||
dev_name = NULL;
|
dev_name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ guint32 nmd_get_device_ip4_address (DBusConnection *connection, char *path)
|
|||||||
|
|
||||||
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, path, NM_DBUS_INTERFACE, "getIP4Address")))
|
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, path, NM_DBUS_INTERFACE, "getIP4Address")))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Couldn't allocate the dbus message");
|
nm_warning ("Couldn't allocate the dbus message");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,14 +184,14 @@ guint32 nmd_get_device_ip4_address (DBusConnection *connection, char *path)
|
|||||||
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
|
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
|
||||||
if (dbus_error_is_set (&error))
|
if (dbus_error_is_set (&error))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "%s raised: %s", error.name, error.message);
|
nm_warning ("%s raised: %s", error.name, error.message);
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reply == NULL)
|
if (reply == NULL)
|
||||||
{
|
{
|
||||||
syslog( LOG_ERR, "dbus reply message was NULL" );
|
nm_warning ("dbus reply message was NULL" );
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@@ -200,7 +200,7 @@ guint32 nmd_get_device_ip4_address (DBusConnection *connection, char *path)
|
|||||||
dbus_error_init (&error);
|
dbus_error_init (&error);
|
||||||
if (!dbus_message_get_args (reply, &error, DBUS_TYPE_UINT32, &address, DBUS_TYPE_INVALID))
|
if (!dbus_message_get_args (reply, &error, DBUS_TYPE_UINT32, &address, DBUS_TYPE_INVALID))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "There was an error getting the device's IPv4 address from NetworkManager." );
|
nm_warning ("There was an error getting the device's IPv4 address from NetworkManager." );
|
||||||
address = 0;
|
address = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,20 +248,20 @@ static DBusHandlerResult nmd_dbus_filter (DBusConnection *connection, DBusMessag
|
|||||||
|
|
||||||
if (action == NMD_DEVICE_NOW_ACTIVE || action == NMD_DEVICE_NOW_INACTIVE)
|
if (action == NMD_DEVICE_NOW_ACTIVE || action == NMD_DEVICE_NOW_INACTIVE)
|
||||||
{
|
{
|
||||||
syslog (LOG_NOTICE, "Device %s (%s) is now %s.", dev_object_path, dev_iface_name,
|
nm_info ("Device %s (%s) is now %s.", dev_object_path, dev_iface_name,
|
||||||
(action == NMD_DEVICE_NOW_INACTIVE ? "down" :
|
(action == NMD_DEVICE_NOW_INACTIVE ? "down" :
|
||||||
(action == NMD_DEVICE_NOW_ACTIVE ? "up" : "error")));
|
(action == NMD_DEVICE_NOW_ACTIVE ? "up" : "error")));
|
||||||
}
|
}
|
||||||
else if (action == NMD_DEVICE_IP4_ADDRESS_CHANGE)
|
else if (action == NMD_DEVICE_IP4_ADDRESS_CHANGE)
|
||||||
{
|
{
|
||||||
syslog (LOG_NOTICE, "Device %s (%s) now has address %u.%u.%u.%u", dev_object_path, dev_iface_name,
|
nm_info ("Device %s (%s) now has address %u.%u.%u.%u", dev_object_path, dev_iface_name,
|
||||||
NIPQUAD(dev_ip4_address));
|
NIPQUAD(dev_ip4_address));
|
||||||
}
|
}
|
||||||
|
|
||||||
nmd_execute_scripts (action, dev_iface_name, dev_ip4_address);
|
nmd_execute_scripts (action, dev_iface_name, dev_ip4_address);
|
||||||
|
|
||||||
dbus_free (dev_iface_name);
|
g_free (dev_iface_name);
|
||||||
dbus_free (dev_object_path);
|
g_free (dev_object_path);
|
||||||
|
|
||||||
handled = TRUE;
|
handled = TRUE;
|
||||||
}
|
}
|
||||||
@@ -286,7 +286,7 @@ static DBusConnection *nmd_dbus_init (void)
|
|||||||
connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
|
connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
|
||||||
if (connection == NULL)
|
if (connection == NULL)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nmd_dbus_init(): could not connect to the message bus. dbus says: '%s'", error.message);
|
nm_warning ("nmd_dbus_init(): could not connect to the message bus. dbus says: '%s'", error.message);
|
||||||
dbus_error_free (&error);
|
dbus_error_free (&error);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@@ -388,7 +388,7 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
if (become_daemon && daemon (FALSE, FALSE) < 0)
|
if (become_daemon && daemon (FALSE, FALSE) < 0)
|
||||||
{
|
{
|
||||||
syslog( LOG_ERR, "NetworkManagerDispatcher could not daemonize. errno = %d", errno );
|
nm_warning ("NetworkManagerDispatcher could not daemonize. errno = %d", errno );
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
INCLUDES = -I${top_srcdir}
|
INCLUDES = -I${top_srcdir} -I${top_srcdir}/utils
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
$(DBUS_CFLAGS) \
|
$(DBUS_CFLAGS) \
|
||||||
@@ -43,7 +43,8 @@ NetworkManagerInfo_LDADD = \
|
|||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(GDK_PIXBUF_LIBS) \
|
$(GDK_PIXBUF_LIBS) \
|
||||||
$(GNOME_KEYRING_LIBS) \
|
$(GNOME_KEYRING_LIBS) \
|
||||||
$(LIBGNOMEUI_LIBS)
|
$(LIBGNOMEUI_LIBS) \
|
||||||
|
$(top_builddir)/utils/libnmutils.la
|
||||||
|
|
||||||
|
|
||||||
gladedir = $(datadir)/NetworkManagerInfo/glade
|
gladedir = $(datadir)/NetworkManagerInfo/glade
|
||||||
|
@@ -43,6 +43,7 @@
|
|||||||
#include "NetworkManagerInfoDbus.h"
|
#include "NetworkManagerInfoDbus.h"
|
||||||
#include "NetworkManagerInfo.h"
|
#include "NetworkManagerInfo.h"
|
||||||
#include "NetworkManagerInfoPassphraseDialog.h"
|
#include "NetworkManagerInfoPassphraseDialog.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
|
|
||||||
static void nmi_spawn_notification_icon (NMIAppInfo *info);
|
static void nmi_spawn_notification_icon (NMIAppInfo *info);
|
||||||
|
|
||||||
@@ -203,14 +204,14 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
if (!no_daemon && daemon (FALSE, FALSE) < 0)
|
if (!no_daemon && daemon (FALSE, FALSE) < 0)
|
||||||
{
|
{
|
||||||
syslog( LOG_ERR, "NetworkManagerInfo could not daemonize. errno = %d", errno );
|
nm_warning ("NetworkManagerInfo could not daemonize. errno = %d", errno );
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
app_info = g_new0 (NMIAppInfo, 1);
|
app_info = g_new0 (NMIAppInfo, 1);
|
||||||
if (!app_info)
|
if (!app_info)
|
||||||
{
|
{
|
||||||
syslog (LOG_CRIT, "Not enough memory for application data.");
|
nm_error ("Not enough memory for application data.");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +224,7 @@ int main( int argc, char *argv[] )
|
|||||||
dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &dbus_error);
|
dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &dbus_error);
|
||||||
if (dbus_connection == NULL)
|
if (dbus_connection == NULL)
|
||||||
{
|
{
|
||||||
syslog (LOG_CRIT, "NetworkManagerInfo could not get the system bus. Make sure the message bus daemon is running?");
|
nm_error ("NetworkManagerInfo could not get the system bus. Make sure the message bus daemon is running?");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
dbus_connection_set_change_sigpipe (TRUE);
|
dbus_connection_set_change_sigpipe (TRUE);
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include "NetworkManagerInfoDbus.h"
|
#include "NetworkManagerInfoDbus.h"
|
||||||
#include "NetworkManagerInfoPassphraseDialog.h"
|
#include "NetworkManagerInfoPassphraseDialog.h"
|
||||||
#include "NetworkManagerInfoVPN.h"
|
#include "NetworkManagerInfoVPN.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -168,7 +169,7 @@ void nmi_dbus_return_user_key (DBusConnection *connection, const char *device,
|
|||||||
|
|
||||||
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "setKeyForNetwork")))
|
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "setKeyForNetwork")))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nmi_dbus_return_user_key(): Couldn't allocate the dbus message");
|
nm_warning ("nmi_dbus_return_user_key(): Couldn't allocate the dbus message");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +181,7 @@ void nmi_dbus_return_user_key (DBusConnection *connection, const char *device,
|
|||||||
DBUS_TYPE_INVALID))
|
DBUS_TYPE_INVALID))
|
||||||
{
|
{
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
syslog (LOG_ERR, "nmi_dbus_return_user_key(): dbus could not send the message");
|
nm_warning ("nmi_dbus_return_user_key(): dbus could not send the message");
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
@@ -236,13 +237,13 @@ void nmi_dbus_signal_update_network (DBusConnection *connection, const char *net
|
|||||||
message = dbus_message_new_signal (NMI_DBUS_PATH, NMI_DBUS_INTERFACE, "WirelessNetworkUpdate");
|
message = dbus_message_new_signal (NMI_DBUS_PATH, NMI_DBUS_INTERFACE, "WirelessNetworkUpdate");
|
||||||
if (!message)
|
if (!message)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nmi_dbus_signal_update_network(): Not enough memory for new dbus message!");
|
nm_warning ("nmi_dbus_signal_update_network(): Not enough memory for new dbus message!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_append_args (message, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID);
|
dbus_message_append_args (message, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID);
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
syslog (LOG_WARNING, "nmi_dbus_signal_update_network(): Could not raise the 'WirelessNetworkUpdate' signal!");
|
nm_warning ("nmi_dbus_signal_update_network(): Could not raise the 'WirelessNetworkUpdate' signal!");
|
||||||
|
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
}
|
}
|
||||||
@@ -349,6 +350,7 @@ static DBusMessage *nmi_dbus_get_network_properties (NMIAppInfo *info, DBusMessa
|
|||||||
|
|
||||||
char *essid = NULL;
|
char *essid = NULL;
|
||||||
gint timestamp = -1;
|
gint timestamp = -1;
|
||||||
|
gint32 i;
|
||||||
char *key = NULL;
|
char *key = NULL;
|
||||||
NMEncKeyType key_type = -1;
|
NMEncKeyType key_type = -1;
|
||||||
gboolean trusted = FALSE;
|
gboolean trusted = FALSE;
|
||||||
@@ -456,10 +458,13 @@ static DBusMessage *nmi_dbus_get_network_properties (NMIAppInfo *info, DBusMessa
|
|||||||
dbus_message_iter_init_append (reply, &iter);
|
dbus_message_iter_init_append (reply, &iter);
|
||||||
|
|
||||||
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &essid);
|
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &essid);
|
||||||
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, ×tamp);
|
i = (gint32) timestamp;
|
||||||
|
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &i);
|
||||||
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &key);
|
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &key);
|
||||||
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &key_type);
|
i = (gint32) key_type;
|
||||||
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &auth_method);
|
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &i);
|
||||||
|
i = (gint32) auth_method;
|
||||||
|
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &i);
|
||||||
dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &trusted);
|
dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &trusted);
|
||||||
|
|
||||||
dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &array_iter);
|
dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &array_iter);
|
||||||
@@ -654,7 +659,7 @@ static DBusHandlerResult nmi_dbus_nmi_message_handler (DBusConnection *connectio
|
|||||||
method = dbus_message_get_member (message);
|
method = dbus_message_get_member (message);
|
||||||
path = dbus_message_get_path (message);
|
path = dbus_message_get_path (message);
|
||||||
|
|
||||||
/* syslog (LOG_WARNING, "nmi_dbus_nmi_message_handler() got method %s for path %s", method, path);*/
|
/* nm_warning ("nmi_dbus_nmi_message_handler() got method %s for path %s", method, path);*/
|
||||||
|
|
||||||
if (strcmp ("getKeyForNetwork", method) == 0)
|
if (strcmp ("getKeyForNetwork", method) == 0)
|
||||||
{
|
{
|
||||||
@@ -674,7 +679,7 @@ static DBusHandlerResult nmi_dbus_nmi_message_handler (DBusConnection *connectio
|
|||||||
}
|
}
|
||||||
else if (strcmp ("networkNotFound", method) == 0)
|
else if (strcmp ("networkNotFound", method) == 0)
|
||||||
{
|
{
|
||||||
char *network;
|
const char *network;
|
||||||
DBusError error;
|
DBusError error;
|
||||||
|
|
||||||
dbus_error_init (&error);
|
dbus_error_init (&error);
|
||||||
@@ -686,7 +691,6 @@ static DBusHandlerResult nmi_dbus_nmi_message_handler (DBusConnection *connectio
|
|||||||
dbus_error_free (&error);
|
dbus_error_free (&error);
|
||||||
text = g_strdup_printf ( "The requested wireless network '%s' does not appear to be in range. "
|
text = g_strdup_printf ( "The requested wireless network '%s' does not appear to be in range. "
|
||||||
"A different wireless network will be used if any are available.", network);
|
"A different wireless network will be used if any are available.", network);
|
||||||
dbus_free (network);
|
|
||||||
|
|
||||||
dialog = GTK_DIALOG (gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, text, NULL));
|
dialog = GTK_DIALOG (gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, text, NULL));
|
||||||
gtk_dialog_run (dialog);
|
gtk_dialog_run (dialog);
|
||||||
@@ -816,7 +820,7 @@ int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info)
|
|||||||
&dbus_error);
|
&dbus_error);
|
||||||
if (dbus_error_is_set (&dbus_error))
|
if (dbus_error_is_set (&dbus_error))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nmi_dbus_service_init() could not acquire its service. dbus_bus_acquire_service() says: '%s'", dbus_error.message);
|
nm_warning ("nmi_dbus_service_init() could not acquire its service. dbus_bus_acquire_service() says: '%s'", dbus_error.message);
|
||||||
dbus_error_free (&dbus_error);
|
dbus_error_free (&dbus_error);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@@ -831,7 +835,7 @@ int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info)
|
|||||||
|
|
||||||
if (!dbus_connection_register_object_path (dbus_connection, NMI_DBUS_PATH, &nmi_vtable, info))
|
if (!dbus_connection_register_object_path (dbus_connection, NMI_DBUS_PATH, &nmi_vtable, info))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nmi_dbus_service_init() could not register a handler for NetworkManagerInfo. Not enough memory?");
|
nm_warning ("nmi_dbus_service_init() could not register a handler for NetworkManagerInfo. Not enough memory?");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include "NetworkManagerInfoDbus.h"
|
#include "NetworkManagerInfoDbus.h"
|
||||||
#include "NetworkManagerInfoPassphraseDialog.h"
|
#include "NetworkManagerInfoPassphraseDialog.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
|
|
||||||
enum NMIPassphraseDialogKeyTypes
|
enum NMIPassphraseDialogKeyTypes
|
||||||
{
|
{
|
||||||
@@ -318,7 +319,7 @@ int nmi_passphrase_dialog_init (NMIAppInfo *info)
|
|||||||
info->passphrase_dialog = glade_xml_new(GLADEDIR"/passphrase.glade", NULL, NULL);
|
info->passphrase_dialog = glade_xml_new(GLADEDIR"/passphrase.glade", NULL, NULL);
|
||||||
if (!info->passphrase_dialog)
|
if (!info->passphrase_dialog)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Could not open the passphrase dialog glade file!");
|
nm_warning ("Could not open the passphrase dialog glade file!");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
#include "NetworkManagerInfoDbus.h"
|
#include "NetworkManagerInfoDbus.h"
|
||||||
#include "NetworkManagerInfoVPN.h"
|
#include "NetworkManagerInfoVPN.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
|
|
||||||
int nmi_vpn_init (NMIAppInfo *info)
|
int nmi_vpn_init (NMIAppInfo *info)
|
||||||
{
|
{
|
||||||
@@ -90,7 +91,7 @@ static void save_vpn_password (const char *vpn, const char *keyring, const char
|
|||||||
|
|
||||||
if (keyring_result != GNOME_KEYRING_RESULT_OK)
|
if (keyring_result != GNOME_KEYRING_RESULT_OK)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Couldn't store password in keyring, code %d",
|
nm_warning ("Couldn't store password in keyring, code %d",
|
||||||
(int) keyring_result);
|
(int) keyring_result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,7 +121,7 @@ static void response_cb (GtkWidget *dialog, int response, gpointer user_data)
|
|||||||
username = g_object_get_data (G_OBJECT (passwd_dialog), "NetworkManagerInfoVPN-username");
|
username = g_object_get_data (G_OBJECT (passwd_dialog), "NetworkManagerInfoVPN-username");
|
||||||
vpn = g_object_get_data (G_OBJECT (passwd_dialog), "NetworkManagerInfoVPN-vpn");
|
vpn = g_object_get_data (G_OBJECT (passwd_dialog), "NetworkManagerInfoVPN-vpn");
|
||||||
password = gnome_password_dialog_get_password (passwd_dialog);
|
password = gnome_password_dialog_get_password (passwd_dialog);
|
||||||
syslog (LOG_ERR, "returning VPN vpn_password for %s@%s: %s", username, vpn, password);
|
nm_warning ("returning VPN vpn_password for %s@%s: %s", username, vpn, password);
|
||||||
nmi_dbus_return_vpn_password (info->connection, info->vpn_password_message, password);
|
nmi_dbus_return_vpn_password (info->connection, info->vpn_password_message, password);
|
||||||
switch (gnome_password_dialog_get_remember (passwd_dialog))
|
switch (gnome_password_dialog_get_remember (passwd_dialog))
|
||||||
{
|
{
|
||||||
|
@@ -105,9 +105,8 @@ static char *libnm_glib_get_nm_status (DBusConnection *con)
|
|||||||
dbus_message_unref (reply);
|
dbus_message_unref (reply);
|
||||||
return g_strdup ("error");
|
return g_strdup ("error");
|
||||||
}
|
}
|
||||||
dbus_message_unref (reply);
|
|
||||||
ret = g_strdup (status);
|
ret = g_strdup (status);
|
||||||
dbus_free (status);
|
dbus_message_unref (reply);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -298,6 +297,8 @@ static DBusHandlerResult libnm_glib_dbus_filter (DBusConnection *connection, DBu
|
|||||||
|
|
||||||
if (!(dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &status_string, DBUS_TYPE_INVALID)))
|
if (!(dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &status_string, DBUS_TYPE_INVALID)))
|
||||||
status_string = g_strdup ("error");
|
status_string = g_strdup ("error");
|
||||||
|
else
|
||||||
|
status_string = g_strdup (status_string);
|
||||||
|
|
||||||
libnm_glib_update_status (ctx, status_string);
|
libnm_glib_update_status (ctx, status_string);
|
||||||
g_free (status_string);
|
g_free (status_string);
|
||||||
@@ -518,7 +519,7 @@ libnm_glib_ctx *libnm_glib_init (void)
|
|||||||
{
|
{
|
||||||
char *status_string = libnm_glib_get_nm_status (ctx->dbus_con);
|
char *status_string = libnm_glib_get_nm_status (ctx->dbus_con);
|
||||||
libnm_glib_update_status (ctx, status_string);
|
libnm_glib_update_status (ctx, status_string);
|
||||||
dbus_free (status_string);
|
g_free (status_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_thread_create (libnm_glib_dbus_worker, ctx, FALSE, &error))
|
if (!g_thread_create (libnm_glib_dbus_worker, ctx, FALSE, &error))
|
||||||
|
@@ -1433,7 +1433,7 @@ static void nmwa_dbus_update_devices (NMWirelessApplet *applet)
|
|||||||
|
|
||||||
if (!devices)
|
if (!devices)
|
||||||
{
|
{
|
||||||
dbus_free (nm_status);
|
g_free (nm_status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1479,7 +1479,7 @@ static void nmwa_dbus_update_devices (NMWirelessApplet *applet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbus_free (name);
|
g_free (name);
|
||||||
}
|
}
|
||||||
g_free (nm_act_dev);
|
g_free (nm_act_dev);
|
||||||
g_strfreev (devices);
|
g_strfreev (devices);
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "NetworkManager.h"
|
#include "NetworkManager.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
#include "NetworkManagerUtils.h"
|
#include "NetworkManagerUtils.h"
|
||||||
#include "NetworkManagerDevice.h"
|
#include "NetworkManagerDevice.h"
|
||||||
#include "NetworkManagerPolicy.h"
|
#include "NetworkManagerPolicy.h"
|
||||||
@@ -107,8 +108,9 @@ NMDevice * nm_create_device_and_add_to_list (NMData *data, const char *udi, cons
|
|||||||
*/
|
*/
|
||||||
if (!data->enable_test_devices && test_device)
|
if (!data->enable_test_devices && test_device)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_create_device_and_add_to_list(): attempt to create a test device,"
|
nm_warning ("attempted to create a test device, "
|
||||||
" but test devices were not enabled on the command line. Will not create the device.\n");
|
"but test devices were not enabled "
|
||||||
|
"on the command line.");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +125,7 @@ NMDevice * nm_create_device_and_add_to_list (NMData *data, const char *udi, cons
|
|||||||
*/
|
*/
|
||||||
if (nm_try_acquire_mutex (data->dev_list_mutex, __FUNCTION__))
|
if (nm_try_acquire_mutex (data->dev_list_mutex, __FUNCTION__))
|
||||||
{
|
{
|
||||||
syslog (LOG_INFO, "Now managing %s device '%s'.",
|
nm_info ("Now managing %s device '%s'.",
|
||||||
nm_device_is_wireless (dev) ? "wireless" : "wired", nm_device_get_iface (dev));
|
nm_device_is_wireless (dev) ? "wireless" : "wired", nm_device_get_iface (dev));
|
||||||
|
|
||||||
data->dev_list = g_slist_append (data->dev_list, dev);
|
data->dev_list = g_slist_append (data->dev_list, dev);
|
||||||
@@ -139,11 +141,11 @@ NMDevice * nm_create_device_and_add_to_list (NMData *data, const char *udi, cons
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* If we couldn't add the device to our list, free its data. */
|
/* If we couldn't add the device to our list, free its data. */
|
||||||
syslog ( LOG_ERR, "nm_create_device_and_add_to_list() could not acquire device list mutex." );
|
nm_warning ("could not acquire device list mutex." );
|
||||||
nm_device_unref (dev);
|
nm_device_unref (dev);
|
||||||
dev = NULL;
|
dev = NULL;
|
||||||
}
|
}
|
||||||
} else syslog ( LOG_ERR, "nm_create_device_and_add_to_list() could not allocate device data." );
|
} else nm_warning ("could not allocate device data." );
|
||||||
|
|
||||||
return (dev);
|
return (dev);
|
||||||
}
|
}
|
||||||
@@ -194,7 +196,7 @@ void nm_remove_device_from_list (NMData *data, const char *udi)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
||||||
} else syslog ( LOG_ERR, "nm_remove_device_from_list() could not acquire device list mutex." );
|
} else nm_warning ("could not acquire device list mutex." );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hal doesn't really give us any way to pass a GMainContext to our
|
/* Hal doesn't really give us any way to pass a GMainContext to our
|
||||||
@@ -223,7 +225,7 @@ static void nm_hal_device_added (LibHalContext *ctx, const char *udi)
|
|||||||
|
|
||||||
g_return_if_fail (data != NULL);
|
g_return_if_fail (data != NULL);
|
||||||
|
|
||||||
syslog ( LOG_DEBUG, "New device added (hal udi is '%s').", udi );
|
nm_debug ("New device added (hal udi is '%s').", udi );
|
||||||
|
|
||||||
/* Sometimes the device's properties (like net.interface) are not set up yet,
|
/* Sometimes the device's properties (like net.interface) are not set up yet,
|
||||||
* so this call will fail, and it will actually be added when hal sets the device's
|
* so this call will fail, and it will actually be added when hal sets the device's
|
||||||
@@ -247,7 +249,7 @@ static void nm_hal_device_removed (LibHalContext *ctx, const char *udi)
|
|||||||
|
|
||||||
g_return_if_fail (data != NULL);
|
g_return_if_fail (data != NULL);
|
||||||
|
|
||||||
syslog ( LOG_DEBUG, "Device removed (hal udi is '%s').", udi );
|
nm_debug ("Device removed (hal udi is '%s').", udi );
|
||||||
|
|
||||||
nm_remove_device_from_list (data, udi);
|
nm_remove_device_from_list (data, udi);
|
||||||
}
|
}
|
||||||
@@ -263,7 +265,7 @@ static void nm_hal_device_new_capability (LibHalContext *ctx, const char *udi, c
|
|||||||
|
|
||||||
g_return_if_fail (data != NULL);
|
g_return_if_fail (data != NULL);
|
||||||
|
|
||||||
/*syslog ( LOG_DEBUG, "nm_hal_device_new_capability() called with udi = %s, capability = %s", udi, capability );*/
|
/*nm_debug ("nm_hal_device_new_capability() called with udi = %s, capability = %s", udi, capability );*/
|
||||||
|
|
||||||
if (capability && ((strcmp (capability, "net.80203") == 0) || (strcmp (capability, "net.80211") == 0)))
|
if (capability && ((strcmp (capability, "net.80203") == 0) || (strcmp (capability, "net.80211") == 0)))
|
||||||
{
|
{
|
||||||
@@ -284,7 +286,7 @@ static void nm_hal_device_new_capability (LibHalContext *ctx, const char *udi, c
|
|||||||
*/
|
*/
|
||||||
static void nm_hal_device_lost_capability (LibHalContext *ctx, const char *udi, const char *capability)
|
static void nm_hal_device_lost_capability (LibHalContext *ctx, const char *udi, const char *capability)
|
||||||
{
|
{
|
||||||
/* syslog ( LOG_DEBUG, "nm_hal_device_lost_capability() called with udi = %s, capability = %s", udi, capability );*/
|
/* nm_debug ("nm_hal_device_lost_capability() called with udi = %s, capability = %s", udi, capability );*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -308,8 +310,8 @@ static void nm_add_initial_devices (NMData *data)
|
|||||||
net_devices = libhal_find_device_by_capability (data->hal_ctx, "net", &num_net_devices, &error);
|
net_devices = libhal_find_device_by_capability (data->hal_ctx, "net", &num_net_devices, &error);
|
||||||
if (dbus_error_is_set (&error))
|
if (dbus_error_is_set (&error))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_add_initial_devices() could not find existing"
|
nm_warning ("could not find existing networking devices: %s",
|
||||||
"networking devices: %s", error.message);
|
error.message);
|
||||||
dbus_error_free (&error);
|
dbus_error_free (&error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,7 +406,7 @@ gboolean nm_poll_and_update_wireless_link_state (NMData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
||||||
} else syslog ( LOG_ERR, "nm_poll_and_update_wireless_link_state() could not acquire device list mutex." );
|
} else nm_warning ("could not acquire device list mutex." );
|
||||||
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
@@ -429,7 +431,7 @@ static NMData *nm_data_new (gboolean enable_test_devices)
|
|||||||
|
|
||||||
if (pipe(data->sigterm_pipe) < 0)
|
if (pipe(data->sigterm_pipe) < 0)
|
||||||
{
|
{
|
||||||
syslog (LOG_CRIT, "Couldn't create pipe: %s", g_strerror (errno));
|
nm_error ("Couldn't create pipe: %s", g_strerror (errno));
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,7 +455,7 @@ static NMData *nm_data_new (gboolean enable_test_devices)
|
|||||||
if (!data->dev_list_mutex)
|
if (!data->dev_list_mutex)
|
||||||
{
|
{
|
||||||
nm_data_free (data);
|
nm_data_free (data);
|
||||||
syslog (LOG_ERR, "Could not initialize data structure locks.");
|
nm_warning ("could not initialize data structure locks.");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
nm_register_mutex_desc (data->dev_list_mutex, "Device List Mutex");
|
nm_register_mutex_desc (data->dev_list_mutex, "Device List Mutex");
|
||||||
@@ -464,7 +466,7 @@ static NMData *nm_data_new (gboolean enable_test_devices)
|
|||||||
if (!data->allowed_ap_list || !data->invalid_ap_list)
|
if (!data->allowed_ap_list || !data->invalid_ap_list)
|
||||||
{
|
{
|
||||||
nm_data_free (data);
|
nm_data_free (data);
|
||||||
syslog (LOG_ERR, "Could not create access point lists. Whacky stuff going on?");
|
nm_warning ("could not create access point lists.");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -508,19 +510,29 @@ static void nm_data_free (NMData *data)
|
|||||||
memset (data, 0, sizeof (NMData));
|
memset (data, 0, sizeof (NMData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void sigterm_handler (int signum)
|
static void sigterm_handler (int signum)
|
||||||
{
|
{
|
||||||
int ignore;
|
int ignore;
|
||||||
|
|
||||||
syslog (LOG_NOTICE, "Caught SIGINT/SIGTERM");
|
/* FIXME: This line is probably not a great
|
||||||
|
* thing to have in a signal handler
|
||||||
|
*/
|
||||||
|
nm_info ("Caught SIGINT/SIGTERM");
|
||||||
|
|
||||||
ignore = write (nm_data->sigterm_pipe[1], "X", 1);
|
ignore = write (nm_data->sigterm_pipe[1], "X", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean sigterm_pipe_handler (GIOChannel *src, GIOCondition condition, gpointer user_data)
|
static gboolean sigterm_pipe_handler (GIOChannel *src, GIOCondition condition, gpointer user_data)
|
||||||
{
|
{
|
||||||
NMData *data = user_data;
|
NMData *data = user_data;
|
||||||
syslog (LOG_NOTICE, "Caught terminiation signal");
|
|
||||||
|
/* FIXME: These lines are definitely not great
|
||||||
|
* things to have in a signal handler
|
||||||
|
*
|
||||||
|
* The fix is to have a pipe that non-signal handling
|
||||||
|
* code can watch and respond to.
|
||||||
|
*/
|
||||||
|
nm_info ("Caught terminiation signal");
|
||||||
if (data->active_device)
|
if (data->active_device)
|
||||||
nm_device_deactivate (data->active_device, FALSE);
|
nm_device_deactivate (data->active_device, FALSE);
|
||||||
g_main_loop_quit (data->main_loop);
|
g_main_loop_quit (data->main_loop);
|
||||||
@@ -586,8 +598,8 @@ nm_wired_link_activated (NmNetlinkMonitor *monitor,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
syslog (LOG_ERR, "unknown wired ethernet interface '%s' activated\n",
|
nm_info ("unknown wired ethernet interface '%s' "
|
||||||
interface_name);
|
"activated\n", interface_name);
|
||||||
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -606,8 +618,8 @@ nm_wired_link_deactivated (NmNetlinkMonitor *monitor,
|
|||||||
if (device != NULL)
|
if (device != NULL)
|
||||||
nm_device_set_link_active (device, FALSE);
|
nm_device_set_link_active (device, FALSE);
|
||||||
else
|
else
|
||||||
syslog (LOG_ERR, "unknown wired ethernet interface '%s' "
|
nm_info ("unknown wired ethernet interface '%s' "
|
||||||
"deactivated\n", interface_name);
|
"deactivated\n", interface_name);
|
||||||
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -619,8 +631,8 @@ nm_error_monitoring_wired_link_state (NmNetlinkMonitor *monitor,
|
|||||||
{
|
{
|
||||||
/* FIXME: Try to handle the error instead of just printing it.
|
/* FIXME: Try to handle the error instead of just printing it.
|
||||||
*/
|
*/
|
||||||
syslog (LOG_ERR, "error monitoring wired ethernet link state: %s\n",
|
nm_warning ("error monitoring wired ethernet link state: %s\n",
|
||||||
error->message);
|
error->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -636,8 +648,8 @@ nm_monitor_wired_link_state (NMData *data)
|
|||||||
|
|
||||||
if (error != NULL)
|
if (error != NULL)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "could not monitor wired ethernet devices: %s",
|
nm_warning ("could not monitor wired ethernet devices: %s",
|
||||||
error->message);
|
error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
g_object_unref (monitor);
|
g_object_unref (monitor);
|
||||||
return;
|
return;
|
||||||
@@ -655,9 +667,65 @@ nm_monitor_wired_link_state (NMData *data)
|
|||||||
|
|
||||||
nm_netlink_monitor_attach (monitor, data->main_context);
|
nm_netlink_monitor_attach (monitor, data->main_context);
|
||||||
|
|
||||||
|
/* Request initial status of cards
|
||||||
|
*/
|
||||||
|
nm_netlink_monitor_request_status (monitor, NULL);
|
||||||
|
|
||||||
data->netlink_monitor = monitor;
|
data->netlink_monitor = monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nm_info_handler (const gchar *log_domain,
|
||||||
|
GLogLevelFlags log_level,
|
||||||
|
const gchar *message,
|
||||||
|
gboolean is_daemon)
|
||||||
|
{
|
||||||
|
int syslog_priority;
|
||||||
|
|
||||||
|
switch (log_level)
|
||||||
|
{
|
||||||
|
case G_LOG_LEVEL_ERROR:
|
||||||
|
syslog_priority = LOG_CRIT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case G_LOG_LEVEL_CRITICAL:
|
||||||
|
syslog_priority = LOG_ERR;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case G_LOG_LEVEL_WARNING:
|
||||||
|
syslog_priority = LOG_WARNING;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case G_LOG_LEVEL_MESSAGE:
|
||||||
|
syslog_priority = LOG_NOTICE;
|
||||||
|
|
||||||
|
case G_LOG_LEVEL_DEBUG:
|
||||||
|
syslog_priority = LOG_DEBUG;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case G_LOG_LEVEL_INFO:
|
||||||
|
default:
|
||||||
|
syslog_priority = LOG_INFO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
syslog (syslog_priority, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nm_set_up_log_handlers (gboolean become_daemon)
|
||||||
|
{
|
||||||
|
if (become_daemon)
|
||||||
|
openlog (G_LOG_DOMAIN, LOG_CONS, LOG_DAEMON);
|
||||||
|
else
|
||||||
|
openlog (G_LOG_DOMAIN, LOG_CONS | LOG_PERROR, LOG_USER);
|
||||||
|
|
||||||
|
g_log_set_handler (G_LOG_DOMAIN,
|
||||||
|
G_LOG_LEVEL_MASK,
|
||||||
|
(GLogFunc) nm_info_handler,
|
||||||
|
GINT_TO_POINTER (become_daemon));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main
|
* main
|
||||||
*
|
*
|
||||||
@@ -675,7 +743,7 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
if ((int)getuid() != 0)
|
if ((int)getuid() != 0)
|
||||||
{
|
{
|
||||||
printf( "You must be root to run NetworkManager!\n");
|
g_printerr ("You must be root to run NetworkManager!\n");
|
||||||
return (EXIT_FAILURE);
|
return (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,8 +789,12 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
if (become_daemon && daemon (0, 0) < 0)
|
if (become_daemon && daemon (0, 0) < 0)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "NetworkManager could not daemonize. errno = %d", errno);
|
int saved_errno;
|
||||||
exit (EXIT_FAILURE);
|
|
||||||
|
saved_errno = errno;
|
||||||
|
nm_error ("NetworkManager could not daemonize: %s [error %u]",
|
||||||
|
g_strerror (saved_errno), saved_errno);
|
||||||
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_type_init ();
|
g_type_init ();
|
||||||
@@ -730,8 +802,8 @@ int main( int argc, char *argv[] )
|
|||||||
g_thread_init (NULL);
|
g_thread_init (NULL);
|
||||||
dbus_g_thread_init ();
|
dbus_g_thread_init ();
|
||||||
|
|
||||||
openlog ("NetworkManager", (become_daemon) ? LOG_CONS : LOG_CONS | LOG_PERROR, (become_daemon) ? LOG_DAEMON : LOG_USER);
|
nm_set_up_log_handlers (become_daemon);
|
||||||
syslog (LOG_NOTICE, "starting...");
|
nm_info ("starting...");
|
||||||
|
|
||||||
nm_system_init();
|
nm_system_init();
|
||||||
|
|
||||||
@@ -747,7 +819,7 @@ int main( int argc, char *argv[] )
|
|||||||
nm_data = nm_data_new (enable_test_devices);
|
nm_data = nm_data_new (enable_test_devices);
|
||||||
if (!nm_data)
|
if (!nm_data)
|
||||||
{
|
{
|
||||||
syslog (LOG_CRIT, "nm_data_new() failed... Not enough memory?");
|
nm_error ("nm_data_new() failed... Not enough memory?");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -755,25 +827,30 @@ int main( int argc, char *argv[] )
|
|||||||
nm_data->dbus_connection = nm_dbus_init (nm_data);
|
nm_data->dbus_connection = nm_dbus_init (nm_data);
|
||||||
if (!nm_data->dbus_connection)
|
if (!nm_data->dbus_connection)
|
||||||
{
|
{
|
||||||
syslog (LOG_CRIT, "nm_dbus_init() failed, exiting. Either dbus is not running, or the NetworkManager dbus security policy was not loaded.");
|
nm_error ("nm_dbus_init() failed, exiting. "
|
||||||
|
"Either dbus is not running, or the "
|
||||||
|
"NetworkManager dbus security policy "
|
||||||
|
"was not loaded.");
|
||||||
nm_data_free (nm_data);
|
nm_data_free (nm_data);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If NMI is running, grab allowed wireless network lists from it ASAP */
|
/* If NMI is running, grab allowed wireless network lists from it ASAP
|
||||||
|
*/
|
||||||
if (nm_dbus_is_info_daemon_running (nm_data->dbus_connection))
|
if (nm_dbus_is_info_daemon_running (nm_data->dbus_connection))
|
||||||
nm_policy_schedule_allowed_ap_list_update (nm_data);
|
nm_policy_schedule_allowed_ap_list_update (nm_data);
|
||||||
|
|
||||||
/* Right before we init hal, we have to make sure our mainloop integration function
|
/* Right before we init hal, we have to make sure our mainloop
|
||||||
* knows about our GMainContext. HAL doesn't give us any way to pass that into its
|
* integration function knows about our GMainContext. HAL doesn't give
|
||||||
* mainloop integration callback, so its got to be a global.
|
* us any way to pass that into its mainloop integration callback, so
|
||||||
|
* its got to be a global.
|
||||||
*/
|
*/
|
||||||
main_context = nm_data->main_context;
|
main_context = nm_data->main_context;
|
||||||
|
|
||||||
/* Initialize libhal. We get a connection to the hal daemon here. */
|
/* Initialize libhal. We get a connection to the hal daemon here. */
|
||||||
if ((ctx = libhal_ctx_new()) == NULL)
|
if ((ctx = libhal_ctx_new()) == NULL)
|
||||||
{
|
{
|
||||||
syslog (LOG_CRIT, "libhal_ctx_new() failed, exiting...");
|
nm_error ("libhal_ctx_new() failed, exiting...");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -783,7 +860,9 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
dbus_error_init (&dbus_error);
|
dbus_error_init (&dbus_error);
|
||||||
if(!libhal_ctx_init (ctx, &dbus_error)) {
|
if(!libhal_ctx_init (ctx, &dbus_error)) {
|
||||||
syslog (LOG_CRIT, "libhal_ctx_init() failed, exiting... Make sure the hal daemon is running? - %s", dbus_error.message);
|
nm_error ("libhal_ctx_init() failed: %s\n"
|
||||||
|
"Make sure the hal daemon is running?",
|
||||||
|
dbus_error.message);
|
||||||
|
|
||||||
dbus_error_free (&dbus_error);
|
dbus_error_free (&dbus_error);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
@@ -805,12 +884,14 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
if (dbus_error_is_set (&dbus_error))
|
if (dbus_error_is_set (&dbus_error))
|
||||||
{
|
{
|
||||||
syslog (LOG_CRIT, "libhal_device_property_watch_all(): %s", dbus_error.message);
|
nm_error ("libhal_device_property_watch_all(): %s",
|
||||||
|
dbus_error.message);
|
||||||
dbus_error_free (&dbus_error);
|
dbus_error_free (&dbus_error);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Grab network devices that are already present and add them to our list */
|
/* Grab network devices that are already present and add them to our
|
||||||
|
* list */
|
||||||
nm_add_initial_devices (nm_data);
|
nm_add_initial_devices (nm_data);
|
||||||
|
|
||||||
/* We run dhclient when we need to, and we don't want any stray ones
|
/* We run dhclient when we need to, and we don't want any stray ones
|
||||||
@@ -827,7 +908,8 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
if (!nm_named_manager_start (nm_data->named, &error))
|
if (!nm_named_manager_start (nm_data->named, &error))
|
||||||
{
|
{
|
||||||
syslog (LOG_CRIT, "Couldn't initialize nameserver: %s", error->message);
|
nm_error ("couldn't initialize nameserver: %s",
|
||||||
|
error->message);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,12 +917,13 @@ int main( int argc, char *argv[] )
|
|||||||
g_main_loop_run (nm_data->main_loop);
|
g_main_loop_run (nm_data->main_loop);
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
if (libhal_ctx_shutdown (nm_data->hal_ctx, &dbus_error) != 0) {
|
libhal_ctx_shutdown (nm_data->hal_ctx, &dbus_error);
|
||||||
syslog (LOG_NOTICE, "Error: libhal shutdown failed - %s", dbus_error.message);
|
|
||||||
|
|
||||||
|
if (dbus_error_is_set (&dbus_error)) {
|
||||||
|
nm_warning ("libhal shutdown failed - %s",
|
||||||
|
dbus_error.message);
|
||||||
dbus_error_free (&dbus_error);
|
dbus_error_free (&dbus_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
libhal_ctx_free (nm_data->hal_ctx);
|
libhal_ctx_free (nm_data->hal_ctx);
|
||||||
|
|
||||||
nm_data_free (nm_data);
|
nm_data_free (nm_data);
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "NetworkManagerAP.h"
|
#include "NetworkManagerAP.h"
|
||||||
#include "NetworkManagerUtils.h"
|
#include "NetworkManagerUtils.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
#include "NetworkManagerWireless.h"
|
#include "NetworkManagerWireless.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ NMAccessPoint * nm_ap_new (void)
|
|||||||
ap = g_new0 (NMAccessPoint, 1);
|
ap = g_new0 (NMAccessPoint, 1);
|
||||||
if (!ap)
|
if (!ap)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_ap_new() could not allocate a new user access point info structure. Not enough memory?");
|
nm_warning ("nm_ap_new() could not allocate a new user access point info structure. Not enough memory?");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +99,7 @@ NMAccessPoint * nm_ap_new_from_ap (NMAccessPoint *src_ap)
|
|||||||
new_ap = nm_ap_new();
|
new_ap = nm_ap_new();
|
||||||
if (!new_ap)
|
if (!new_ap)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_ap_new_from_uap() could not allocate a new user access point structure. Not enough memory?");
|
nm_warning ("nm_ap_new_from_uap() could not allocate a new user access point structure. Not enough memory?");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "NetworkManagerAPList.h"
|
#include "NetworkManagerAPList.h"
|
||||||
#include "NetworkManagerUtils.h"
|
#include "NetworkManagerUtils.h"
|
||||||
#include "NetworkManagerDbus.h"
|
#include "NetworkManagerDbus.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
|
|
||||||
|
|
||||||
struct NMAccessPointList
|
struct NMAccessPointList
|
||||||
@@ -55,7 +56,7 @@ NMAccessPointList *nm_ap_list_new (NMNetworkType type)
|
|||||||
if (!list->mutex)
|
if (!list->mutex)
|
||||||
{
|
{
|
||||||
g_free (list);
|
g_free (list);
|
||||||
syslog (LOG_ERR, "nm_ap_list_new() could not create list mutex");
|
nm_warning ("nm_ap_list_new() could not create list mutex");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
nm_register_mutex_desc (list->mutex, "AP List Mutex");
|
nm_register_mutex_desc (list->mutex, "AP List Mutex");
|
||||||
@@ -145,7 +146,7 @@ void nm_ap_list_append_ap (NMAccessPointList *list, NMAccessPoint *ap)
|
|||||||
|
|
||||||
if (!nm_ap_list_lock (list))
|
if (!nm_ap_list_lock (list))
|
||||||
{
|
{
|
||||||
syslog( LOG_ERR, "nm_ap_list_append_ap() could not acquire AP list mutex." );
|
nm_warning ("nm_ap_list_append_ap() could not acquire AP list mutex." );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +172,7 @@ void nm_ap_list_remove_ap (NMAccessPointList *list, NMAccessPoint *ap)
|
|||||||
|
|
||||||
if (!nm_ap_list_lock (list))
|
if (!nm_ap_list_lock (list))
|
||||||
{
|
{
|
||||||
syslog( LOG_ERR, "nm_ap_list_append_ap() could not acquire AP list mutex." );
|
nm_warning ("nm_ap_list_append_ap() could not acquire AP list mutex." );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,7 +361,7 @@ void nm_ap_list_populate_from_nmi (NMAccessPointList *list, NMData *data)
|
|||||||
nm_ap_list_update_network_from_nmi (list, networks[i], data);
|
nm_ap_list_update_network_from_nmi (list, networks[i], data);
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_free_string_array (networks);
|
g_strfreev (networks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,16 +697,16 @@ void nm_ap_list_print_members (NMAccessPointList *list, const char *name)
|
|||||||
if (!(iter = nm_ap_list_iter_new (list)))
|
if (!(iter = nm_ap_list_iter_new (list)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
syslog (LOG_ERR, "AP_LIST_PRINT: printing members of '%s'", name);
|
nm_warning ("AP_LIST_PRINT: printing members of '%s'", name);
|
||||||
while ((ap = nm_ap_list_iter_next (iter)))
|
while ((ap = nm_ap_list_iter_next (iter)))
|
||||||
{
|
{
|
||||||
const GTimeVal *timestamp = nm_ap_get_timestamp (ap);
|
const GTimeVal *timestamp = nm_ap_get_timestamp (ap);
|
||||||
syslog (LOG_ERR, "\t%d)\tobj=%p, essid='%s', timestamp=%ld, key='%s', enc=%d, addr=%p, strength=%d, %s=%f, rate=%d, inval=%d, mode=%d",
|
nm_warning ("\t%d)\tobj=%p, essid='%s', timestamp=%ld, key='%s', enc=%d, addr=%p, strength=%d, %s=%f, rate=%d, inval=%d, mode=%d",
|
||||||
i, ap, nm_ap_get_essid (ap), timestamp->tv_sec, nm_ap_get_enc_key_source (ap), nm_ap_get_encrypted (ap),
|
i, ap, nm_ap_get_essid (ap), timestamp->tv_sec, nm_ap_get_enc_key_source (ap), nm_ap_get_encrypted (ap),
|
||||||
nm_ap_get_address (ap), nm_ap_get_strength (ap), (nm_ap_get_freq (ap) < 20) ? "channel" : "freq", nm_ap_get_freq (ap), nm_ap_get_rate (ap),
|
nm_ap_get_address (ap), nm_ap_get_strength (ap), (nm_ap_get_freq (ap) < 20) ? "channel" : "freq", nm_ap_get_freq (ap), nm_ap_get_rate (ap),
|
||||||
nm_ap_get_invalid (ap), nm_ap_get_mode (ap));
|
nm_ap_get_invalid (ap), nm_ap_get_mode (ap));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
syslog (LOG_ERR, "AP_LIST_PRINT: done");
|
nm_warning ("AP_LIST_PRINT: done");
|
||||||
nm_ap_list_iter_free (iter);
|
nm_ap_list_iter_free (iter);
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include "NetworkManagerPolicy.h"
|
#include "NetworkManagerPolicy.h"
|
||||||
#include "nm-named-manager.h"
|
#include "nm-named-manager.h"
|
||||||
#include "../dhcpcd/client.h"
|
#include "../dhcpcd/client.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
|
|
||||||
extern gboolean get_autoip (NMDevice *dev, struct in_addr *out_ip);
|
extern gboolean get_autoip (NMDevice *dev, struct in_addr *out_ip);
|
||||||
|
|
||||||
@@ -49,7 +50,7 @@ static void set_nameservers (NMDevice *dev, void *data, int len)
|
|||||||
GPOINTER_TO_UINT (elt->data),
|
GPOINTER_TO_UINT (elt->data),
|
||||||
&error))
|
&error))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, G_GNUC_PRETTY_FUNCTION ": Couldn't remove nameserver: %s\n", error->message);
|
nm_warning ("Couldn't remove nameserver: %s\n", error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +66,7 @@ static void set_nameservers (NMDevice *dev, void *data, int len)
|
|||||||
((unsigned char *)data)[i+1],
|
((unsigned char *)data)[i+1],
|
||||||
((unsigned char *)data)[i+2],
|
((unsigned char *)data)[i+2],
|
||||||
((unsigned char *)data)[i+3]);
|
((unsigned char *)data)[i+3]);
|
||||||
syslog (LOG_ERR, G_GNUC_PRETTY_FUNCTION ": Adding nameserver: %s\n", nameserver);
|
nm_warning ("Adding nameserver: %s\n", nameserver);
|
||||||
|
|
||||||
if ((id = nm_named_manager_add_nameserver_ipv4 (dev->app_data->named,
|
if ((id = nm_named_manager_add_nameserver_ipv4 (dev->app_data->named,
|
||||||
nameserver,
|
nameserver,
|
||||||
@@ -74,7 +75,7 @@ static void set_nameservers (NMDevice *dev, void *data, int len)
|
|||||||
GUINT_TO_POINTER (id));
|
GUINT_TO_POINTER (id));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, G_GNUC_PRETTY_FUNCTION ": Couldn't add nameserver: %s\n", error->message);
|
nm_warning ("Couldn't add nameserver: %s\n", error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
}
|
}
|
||||||
g_free (nameserver);
|
g_free (nameserver);
|
||||||
@@ -94,7 +95,7 @@ static void set_domain_searches (NMDevice *dev, const char *searches_str)
|
|||||||
GPOINTER_TO_UINT (elt->data),
|
GPOINTER_TO_UINT (elt->data),
|
||||||
&error))
|
&error))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, G_GNUC_PRETTY_FUNCTION ": Couldn't remove domain search: %s\n", error->message);
|
nm_warning ("Couldn't remove domain search: %s\n", error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,14 +109,14 @@ static void set_domain_searches (NMDevice *dev, const char *searches_str)
|
|||||||
const char *search_elt = *s;
|
const char *search_elt = *s;
|
||||||
guint id;
|
guint id;
|
||||||
|
|
||||||
syslog (LOG_ERR, G_GNUC_PRETTY_FUNCTION ": Adding domain search: %s\n", search_elt);
|
nm_warning ("Adding domain search: %s\n", search_elt);
|
||||||
if ((id = nm_named_manager_add_domain_search (dev->app_data->named,
|
if ((id = nm_named_manager_add_domain_search (dev->app_data->named,
|
||||||
search_elt,
|
search_elt,
|
||||||
&error)))
|
&error)))
|
||||||
dev->app_data->domain_search_ids = g_list_append (dev->app_data->domain_search_ids, GUINT_TO_POINTER (id));
|
dev->app_data->domain_search_ids = g_list_append (dev->app_data->domain_search_ids, GUINT_TO_POINTER (id));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, G_GNUC_PRETTY_FUNCTION ": Couldn't add domain search: %s\n", error->message);
|
nm_warning ("Couldn't add domain search: %s\n", error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,7 +218,7 @@ int nm_device_dhcp_request (NMDevice *dev)
|
|||||||
|
|
||||||
if (dev->dhcp_iface)
|
if (dev->dhcp_iface)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_device_dhcp_request(): device DHCP info exists, but it should have been cleared already.\n");
|
nm_warning ("nm_device_dhcp_request(): device DHCP info exists, but it should have been cleared already.\n");
|
||||||
dhcp_interface_free (dev->dhcp_iface);
|
dhcp_interface_free (dev->dhcp_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,7 +290,7 @@ gboolean nm_device_dhcp_setup_timeouts (NMDevice *dev)
|
|||||||
}
|
}
|
||||||
if (!t1 || !t2)
|
if (!t1 || !t2)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "DHCP renew/rebind values were 0! Won't renew lease.");
|
nm_warning ("DHCP renew/rebind values were 0! Won't renew lease.");
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -165,13 +165,13 @@ static gboolean nm_dbus_send_network_not_found (gpointer user_data)
|
|||||||
NMI_DBUS_INTERFACE, "networkNotFound");
|
NMI_DBUS_INTERFACE, "networkNotFound");
|
||||||
if (message == NULL)
|
if (message == NULL)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_send_network_not_found(): Couldn't allocate the dbus message");
|
nm_warning ("nm_dbus_send_network_not_found(): Couldn't allocate the dbus message");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_append_args (message, DBUS_TYPE_STRING, &cb_data->net, DBUS_TYPE_INVALID);
|
dbus_message_append_args (message, DBUS_TYPE_STRING, &cb_data->net, DBUS_TYPE_INVALID);
|
||||||
if (!dbus_connection_send (cb_data->app_data->dbus_connection, message, NULL))
|
if (!dbus_connection_send (cb_data->app_data->dbus_connection, message, NULL))
|
||||||
syslog (LOG_WARNING, "nm_dbus_send_network_not_found(): could not send dbus message");
|
nm_warning ("nm_dbus_send_network_not_found(): could not send dbus message");
|
||||||
|
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
|
|
||||||
@@ -294,13 +294,13 @@ void nm_dbus_signal_device_status_change (DBusConnection *connection, NMDevice *
|
|||||||
signal = "DeviceActivationFailed";
|
signal = "DeviceActivationFailed";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
syslog (LOG_ERR, "nm_dbus_signal_device_status_change(): got a bad signal name");
|
nm_warning ("nm_dbus_signal_device_status_change(): got a bad signal name");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, signal)))
|
if (!(message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, signal)))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_signal_device_status_change(): Not enough memory for new dbus message!");
|
nm_warning ("nm_dbus_signal_device_status_change(): Not enough memory for new dbus message!");
|
||||||
g_free (dev_path);
|
g_free (dev_path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -322,7 +322,7 @@ void nm_dbus_signal_device_status_change (DBusConnection *connection, NMDevice *
|
|||||||
g_free (dev_path);
|
g_free (dev_path);
|
||||||
|
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
syslog (LOG_WARNING, "nm_dbus_signal_device_status_change(): Could not raise the signal!");
|
nm_warning ("nm_dbus_signal_device_status_change(): Could not raise the signal!");
|
||||||
|
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
}
|
}
|
||||||
@@ -376,7 +376,7 @@ void nm_dbus_signal_network_status_change (DBusConnection *connection, NMData *d
|
|||||||
|
|
||||||
if (!(message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "NetworkStatusChange")))
|
if (!(message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "NetworkStatusChange")))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_signal_device_status_change(): Not enough memory for new dbus message!");
|
nm_warning ("nm_dbus_signal_device_status_change(): Not enough memory for new dbus message!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,7 +385,7 @@ void nm_dbus_signal_network_status_change (DBusConnection *connection, NMData *d
|
|||||||
dbus_message_append_args (message, DBUS_TYPE_STRING, &status, DBUS_TYPE_INVALID);
|
dbus_message_append_args (message, DBUS_TYPE_STRING, &status, DBUS_TYPE_INVALID);
|
||||||
|
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
syslog (LOG_WARNING, "nm_dbus_signal_device_status_change(): Could not raise the signal!");
|
nm_warning ("nm_dbus_signal_device_status_change(): Could not raise the signal!");
|
||||||
g_free (status);
|
g_free (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,7 +413,7 @@ void nm_dbus_signal_device_ip4_address_change (DBusConnection *connection, NMDev
|
|||||||
message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "DeviceIP4AddressChange");
|
message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "DeviceIP4AddressChange");
|
||||||
if (!message)
|
if (!message)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_signal_device_ip4_address_change(): Not enough memory for new dbus message!");
|
nm_warning ("nm_dbus_signal_device_ip4_address_change(): Not enough memory for new dbus message!");
|
||||||
g_free (dev_path);
|
g_free (dev_path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -422,7 +422,7 @@ void nm_dbus_signal_device_ip4_address_change (DBusConnection *connection, NMDev
|
|||||||
g_free (dev_path);
|
g_free (dev_path);
|
||||||
|
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
syslog (LOG_WARNING, "nm_dbus_signal_device_ip4_address_change(): Could not raise the IP4AddressChange signal!");
|
nm_warning ("nm_dbus_signal_device_ip4_address_change(): Could not raise the IP4AddressChange signal!");
|
||||||
|
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
}
|
}
|
||||||
@@ -457,7 +457,7 @@ void nm_dbus_signal_wireless_network_change (DBusConnection *connection, NMDevic
|
|||||||
message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "WirelessNetworkUpdate");
|
message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "WirelessNetworkUpdate");
|
||||||
if (!message)
|
if (!message)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_signal_wireless_network_appeared(): Not enough memory for new dbus message!");
|
nm_warning ("nm_dbus_signal_wireless_network_appeared(): Not enough memory for new dbus message!");
|
||||||
g_free (dev_path);
|
g_free (dev_path);
|
||||||
g_free (ap_path);
|
g_free (ap_path);
|
||||||
return;
|
return;
|
||||||
@@ -476,7 +476,7 @@ void nm_dbus_signal_wireless_network_change (DBusConnection *connection, NMDevic
|
|||||||
dbus_message_append_args (message, DBUS_TYPE_INT32, &strength, DBUS_TYPE_INVALID);
|
dbus_message_append_args (message, DBUS_TYPE_INT32, &strength, DBUS_TYPE_INVALID);
|
||||||
|
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
syslog (LOG_WARNING, "nnm_dbus_signal_wireless_network_appeared(): Could not raise the WirelessNetworkAppeared signal!");
|
nm_warning ("nnm_dbus_signal_wireless_network_appeared(): Could not raise the WirelessNetworkAppeared signal!");
|
||||||
|
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
}
|
}
|
||||||
@@ -503,7 +503,7 @@ void nm_dbus_get_user_key_for_network (DBusConnection *connection, NMDevice *dev
|
|||||||
NMI_DBUS_INTERFACE, "getKeyForNetwork");
|
NMI_DBUS_INTERFACE, "getKeyForNetwork");
|
||||||
if (message == NULL)
|
if (message == NULL)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_get_user_key_for_network(): Couldn't allocate the dbus message");
|
nm_warning ("nm_dbus_get_user_key_for_network(): Couldn't allocate the dbus message");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,7 +515,7 @@ void nm_dbus_get_user_key_for_network (DBusConnection *connection, NMDevice *dev
|
|||||||
DBUS_TYPE_INVALID);
|
DBUS_TYPE_INVALID);
|
||||||
|
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
syslog (LOG_WARNING, "nm_dbus_get_user_key_for_network(): could not send dbus message");
|
nm_warning ("nm_dbus_get_user_key_for_network(): could not send dbus message");
|
||||||
|
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
}
|
}
|
||||||
@@ -537,12 +537,12 @@ void nm_dbus_cancel_get_user_key_for_network (DBusConnection *connection)
|
|||||||
NMI_DBUS_INTERFACE, "cancelGetKeyForNetwork");
|
NMI_DBUS_INTERFACE, "cancelGetKeyForNetwork");
|
||||||
if (message == NULL)
|
if (message == NULL)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_cancel_get_user_key_for_network(): Couldn't allocate the dbus message");
|
nm_warning ("nm_dbus_cancel_get_user_key_for_network(): Couldn't allocate the dbus message");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
syslog (LOG_WARNING, "nm_dbus_cancel_get_user_key_for_network(): could not send dbus message");
|
nm_warning ("nm_dbus_cancel_get_user_key_for_network(): could not send dbus message");
|
||||||
|
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
}
|
}
|
||||||
@@ -563,6 +563,7 @@ NMAccessPoint *nm_dbus_get_network_object (DBusConnection *connection, NMNetwork
|
|||||||
|
|
||||||
const char *essid = NULL;
|
const char *essid = NULL;
|
||||||
gint timestamp_secs = -1;
|
gint timestamp_secs = -1;
|
||||||
|
gint32 i;
|
||||||
const char *key = NULL;
|
const char *key = NULL;
|
||||||
NMEncKeyType key_type = -1;
|
NMEncKeyType key_type = -1;
|
||||||
gboolean trusted = FALSE;
|
gboolean trusted = FALSE;
|
||||||
@@ -576,7 +577,7 @@ NMAccessPoint *nm_dbus_get_network_object (DBusConnection *connection, NMNetwork
|
|||||||
|
|
||||||
if (!(message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH, NMI_DBUS_INTERFACE, "getNetworkProperties")))
|
if (!(message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH, NMI_DBUS_INTERFACE, "getNetworkProperties")))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_get_network_object(): Couldn't allocate the dbus message");
|
nm_warning ("Couldn't allocate the dbus message");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,13 +593,13 @@ NMAccessPoint *nm_dbus_get_network_object (DBusConnection *connection, NMNetwork
|
|||||||
|
|
||||||
if (dbus_error_is_set (&error))
|
if (dbus_error_is_set (&error))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_get_network_object(): %s raised '%s'", error.name, error.message);
|
nm_warning ("%s raised '%s'", error.name, error.message);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reply)
|
if (!reply)
|
||||||
{
|
{
|
||||||
syslog (LOG_NOTICE, "nm_dbus_get_network_object(): reply was NULL.");
|
nm_warning ("Reply was NULL.");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -606,13 +607,73 @@ NMAccessPoint *nm_dbus_get_network_object (DBusConnection *connection, NMNetwork
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
dbus_message_iter_init (reply, &iter);
|
dbus_message_iter_init (reply, &iter);
|
||||||
|
|
||||||
|
if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRING)
|
||||||
|
{
|
||||||
|
nm_warning ("Reply had wrong arguments: "
|
||||||
|
"(expected %u, got %u)\n", DBUS_TYPE_STRING,
|
||||||
|
dbus_message_iter_get_arg_type (&iter));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
dbus_message_iter_get_basic (&iter, &essid);
|
dbus_message_iter_get_basic (&iter, &essid);
|
||||||
dbus_message_iter_get_basic (&iter, ×tamp_secs);
|
|
||||||
|
dbus_message_iter_next (&iter);
|
||||||
|
if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_INT32)
|
||||||
|
{
|
||||||
|
nm_warning ("Reply had wrong arguments: "
|
||||||
|
"(expected %u, got %u)\n", DBUS_TYPE_INT32,
|
||||||
|
dbus_message_iter_get_arg_type (&iter));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
dbus_message_iter_get_basic (&iter, &i);
|
||||||
|
|
||||||
|
timestamp_secs = (gint32) i;
|
||||||
|
|
||||||
|
dbus_message_iter_next (&iter);
|
||||||
|
if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRING)
|
||||||
|
{
|
||||||
|
nm_warning ("Reply had wrong arguments: "
|
||||||
|
"(expected %u, got %u)\n", DBUS_TYPE_STRING,
|
||||||
|
dbus_message_iter_get_arg_type (&iter));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
dbus_message_iter_get_basic (&iter, &key);
|
dbus_message_iter_get_basic (&iter, &key);
|
||||||
dbus_message_iter_get_basic (&iter, &key_type);
|
|
||||||
dbus_message_iter_get_basic (&iter, &auth_method);
|
dbus_message_iter_next (&iter);
|
||||||
|
if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_INT32)
|
||||||
|
{
|
||||||
|
nm_warning ("Reply had wrong arguments: "
|
||||||
|
"(expected %u, got %u)\n", DBUS_TYPE_INT32,
|
||||||
|
dbus_message_iter_get_arg_type (&iter));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
dbus_message_iter_get_basic (&iter, &i);
|
||||||
|
|
||||||
|
key_type = (NMEncKeyType) i;
|
||||||
|
|
||||||
|
dbus_message_iter_next (&iter);
|
||||||
|
if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_INT32)
|
||||||
|
{
|
||||||
|
nm_warning ("Reply had wrong arguments: "
|
||||||
|
"(expected %u, got %u)\n", DBUS_TYPE_INT32,
|
||||||
|
dbus_message_iter_get_arg_type (&iter));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
dbus_message_iter_get_basic (&iter, &i);
|
||||||
|
|
||||||
|
auth_method = (NMDeviceAuthMethod) i;
|
||||||
|
|
||||||
|
dbus_message_iter_next (&iter);
|
||||||
|
if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_BOOLEAN)
|
||||||
|
{
|
||||||
|
nm_warning ("Reply had wrong arguments: "
|
||||||
|
"(expected %u, got %u)\n", DBUS_TYPE_BOOLEAN,
|
||||||
|
dbus_message_iter_get_arg_type (&iter));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
dbus_message_iter_get_basic (&iter, &trusted);
|
dbus_message_iter_get_basic (&iter, &trusted);
|
||||||
|
|
||||||
|
dbus_message_iter_next (&iter);
|
||||||
if (timestamp_secs > 0)
|
if (timestamp_secs > 0)
|
||||||
{
|
{
|
||||||
GTimeVal *timestamp = g_new0 (GTimeVal, 1);
|
GTimeVal *timestamp = g_new0 (GTimeVal, 1);
|
||||||
@@ -636,22 +697,43 @@ NMAccessPoint *nm_dbus_get_network_object (DBusConnection *connection, NMNetwork
|
|||||||
/* Get user addresses, form into a GSList, and stuff into the AP */
|
/* Get user addresses, form into a GSList, and stuff into the AP */
|
||||||
if (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_ARRAY)
|
if (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_ARRAY)
|
||||||
{
|
{
|
||||||
GSList *addr_list = NULL;
|
GSList *addr_list;
|
||||||
DBusMessageIter array_iter;
|
DBusMessageIter array_iter;
|
||||||
|
|
||||||
dbus_message_iter_recurse (&iter, &array_iter);
|
dbus_message_iter_recurse (&iter, &array_iter);
|
||||||
|
|
||||||
|
addr_list = NULL;
|
||||||
while (dbus_message_iter_get_arg_type (&array_iter) == DBUS_TYPE_STRING)
|
while (dbus_message_iter_get_arg_type (&array_iter) == DBUS_TYPE_STRING)
|
||||||
{
|
{
|
||||||
gchar *addr;
|
const gchar *addr;
|
||||||
|
|
||||||
dbus_message_iter_get_basic (&array_iter, &addr);
|
dbus_message_iter_get_basic (&array_iter, &addr);
|
||||||
if (addr && (strlen (addr) >= 11))
|
|
||||||
addr_list = g_slist_append (addr_list, g_strdup (addr));
|
if ((addr != NULL) && (strlen (addr) >= 11))
|
||||||
|
addr_list = g_slist_prepend (addr_list, g_strdup (addr));
|
||||||
|
else
|
||||||
|
nm_warning ("Expected hardware address, got '%s'",
|
||||||
|
addr);
|
||||||
|
|
||||||
|
dbus_message_iter_next (&array_iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dbus_message_iter_get_arg_type (&array_iter) != DBUS_TYPE_INVALID)
|
||||||
|
{
|
||||||
|
nm_warning ("Reply had wrong arguments: "
|
||||||
|
"(expected %u, got %u)", DBUS_TYPE_INVALID,
|
||||||
|
dbus_message_iter_get_arg_type (&array_iter));
|
||||||
|
|
||||||
|
g_slist_foreach (addr_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (addr_list);
|
||||||
|
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addr_list = g_slist_reverse (addr_list);
|
||||||
nm_ap_set_user_addresses (ap, addr_list);
|
nm_ap_set_user_addresses (ap, addr_list);
|
||||||
g_slist_foreach (addr_list, (GFunc)g_free, NULL);
|
|
||||||
|
g_slist_foreach (addr_list, (GFunc) g_free, NULL);
|
||||||
g_slist_free (addr_list);
|
g_slist_free (addr_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -685,7 +767,7 @@ gboolean nm_dbus_update_network_auth_method (DBusConnection *connection, const c
|
|||||||
message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH, NMI_DBUS_INTERFACE, "updateNetworkAuthMethod");
|
message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH, NMI_DBUS_INTERFACE, "updateNetworkAuthMethod");
|
||||||
if (!message)
|
if (!message)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_update_network_auth_method (): Couldn't allocate the dbus message");
|
nm_warning ("nm_dbus_update_network_auth_method (): Couldn't allocate the dbus message");
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -698,7 +780,7 @@ gboolean nm_dbus_update_network_auth_method (DBusConnection *connection, const c
|
|||||||
dbus_error_init (&error);
|
dbus_error_init (&error);
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_update_network_auth_method (): failed to send dbus message.");
|
nm_warning ("nm_dbus_update_network_auth_method (): failed to send dbus message.");
|
||||||
dbus_error_free (&error);
|
dbus_error_free (&error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -735,7 +817,7 @@ gboolean nm_dbus_add_network_address (DBusConnection *connection, NMNetworkType
|
|||||||
NMI_DBUS_INTERFACE, "addNetworkAddress");
|
NMI_DBUS_INTERFACE, "addNetworkAddress");
|
||||||
if (!message)
|
if (!message)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_add_network_ap_mac_address(): Couldn't allocate the dbus message");
|
nm_warning ("nm_dbus_add_network_ap_mac_address(): Couldn't allocate the dbus message");
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,7 +835,7 @@ gboolean nm_dbus_add_network_address (DBusConnection *connection, NMNetworkType
|
|||||||
dbus_error_init (&error);
|
dbus_error_init (&error);
|
||||||
if (!dbus_connection_send (connection, message, NULL))
|
if (!dbus_connection_send (connection, message, NULL))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_add_network_ap_mac_address(): failed to send dbus message.");
|
nm_warning ("nm_dbus_add_network_ap_mac_address(): failed to send dbus message.");
|
||||||
dbus_error_free (&error);
|
dbus_error_free (&error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -769,7 +851,7 @@ gboolean nm_dbus_add_network_address (DBusConnection *connection, NMNetworkType
|
|||||||
*
|
*
|
||||||
* Get all networks of a specific type from NetworkManagerInfo
|
* Get all networks of a specific type from NetworkManagerInfo
|
||||||
*
|
*
|
||||||
* NOTE: caller MUST free returned value using dbus_free_string_array()
|
* NOTE: caller MUST free returned value using g_strfreev()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
char ** nm_dbus_get_networks (DBusConnection *connection, NMNetworkType type, int *num_networks)
|
char ** nm_dbus_get_networks (DBusConnection *connection, NMNetworkType type, int *num_networks)
|
||||||
@@ -788,7 +870,7 @@ char ** nm_dbus_get_networks (DBusConnection *connection, NMNetworkType type, in
|
|||||||
NMI_DBUS_INTERFACE, "getNetworks");
|
NMI_DBUS_INTERFACE, "getNetworks");
|
||||||
if (!message)
|
if (!message)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_get_networks(): Couldn't allocate the dbus message");
|
nm_warning ("nm_dbus_get_networks(): Couldn't allocate the dbus message");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -800,9 +882,9 @@ char ** nm_dbus_get_networks (DBusConnection *connection, NMNetworkType type, in
|
|||||||
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
|
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
|
||||||
dbus_message_unref (message);
|
dbus_message_unref (message);
|
||||||
if (dbus_error_is_set (&error))
|
if (dbus_error_is_set (&error))
|
||||||
syslog (LOG_ERR, "nm_dbus_get_networks(): %s raised %s", error.name, error.message);
|
nm_warning ("nm_dbus_get_networks(): %s raised %s", error.name, error.message);
|
||||||
else if (!reply)
|
else if (!reply)
|
||||||
syslog (LOG_NOTICE, "nm_dbus_get_networks(): reply was NULL.");
|
nm_info ("nm_dbus_get_networks(): reply was NULL.");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DBusMessageIter iter, array_iter;
|
DBusMessageIter iter, array_iter;
|
||||||
@@ -816,7 +898,8 @@ char ** nm_dbus_get_networks (DBusConnection *connection, NMNetworkType type, in
|
|||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
while (dbus_message_iter_get_arg_type (&array_iter) == DBUS_TYPE_STRING) {
|
while (dbus_message_iter_get_arg_type (&array_iter) == DBUS_TYPE_STRING)
|
||||||
|
{
|
||||||
const char *value;
|
const char *value;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
@@ -824,7 +907,10 @@ char ** nm_dbus_get_networks (DBusConnection *connection, NMNetworkType type, in
|
|||||||
str = g_strdup (value);
|
str = g_strdup (value);
|
||||||
|
|
||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
|
{
|
||||||
|
g_array_free (buffer, TRUE);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
g_array_append_val (buffer, str);
|
g_array_append_val (buffer, str);
|
||||||
|
|
||||||
@@ -886,7 +972,7 @@ static DBusHandlerResult nm_dbus_nmi_filter (DBusConnection *connection, DBusMes
|
|||||||
if (!(object_path = dbus_message_get_path (message)))
|
if (!(object_path = dbus_message_get_path (message)))
|
||||||
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
||||||
|
|
||||||
/* syslog (LOG_DEBUG, "nm_dbus_nmi_filter() got method %s for path %s", method, object_path); */
|
/* nm_debug ("nm_dbus_nmi_filter() got method %s for path %s", method, object_path); */
|
||||||
|
|
||||||
dbus_error_init (&error);
|
dbus_error_init (&error);
|
||||||
|
|
||||||
@@ -898,7 +984,7 @@ static DBusHandlerResult nm_dbus_nmi_filter (DBusConnection *connection, DBusMes
|
|||||||
if (dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID))
|
if (dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID))
|
||||||
{
|
{
|
||||||
/* Update a single wireless network's data */
|
/* Update a single wireless network's data */
|
||||||
syslog (LOG_DEBUG, "NetworkManagerInfo triggered update of wireless network '%s'", network);
|
nm_debug ("NetworkManagerInfo triggered update of wireless network '%s'", network);
|
||||||
nm_ap_list_update_network_from_nmi (data->allowed_ap_list, network, data);
|
nm_ap_list_update_network_from_nmi (data->allowed_ap_list, network, data);
|
||||||
handled = TRUE;
|
handled = TRUE;
|
||||||
}
|
}
|
||||||
@@ -1094,7 +1180,7 @@ DBusConnection *nm_dbus_init (NMData *data)
|
|||||||
connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
|
connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
|
||||||
if ((connection == NULL) || dbus_error_is_set (&error))
|
if ((connection == NULL) || dbus_error_is_set (&error))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_init() could not get the system bus. Make sure the message bus daemon is running?");
|
nm_warning ("nm_dbus_init() could not get the system bus. Make sure the message bus daemon is running?");
|
||||||
connection = NULL;
|
connection = NULL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -1111,14 +1197,14 @@ DBusConnection *nm_dbus_init (NMData *data)
|
|||||||
|| !dbus_connection_register_fallback (connection, NM_DBUS_PATH_DEVICES, &devices_vtable, data)
|
|| !dbus_connection_register_fallback (connection, NM_DBUS_PATH_DEVICES, &devices_vtable, data)
|
||||||
|| !dbus_connection_register_object_path (connection, NM_DBUS_PATH_DHCP, &dhcp_vtable, data))
|
|| !dbus_connection_register_object_path (connection, NM_DBUS_PATH_DHCP, &dhcp_vtable, data))
|
||||||
{
|
{
|
||||||
syslog (LOG_CRIT, "nm_dbus_init() could not register D-BUS handlers. Cannot continue.");
|
nm_error ("nm_dbus_init() could not register D-BUS handlers. Cannot continue.");
|
||||||
connection = NULL;
|
connection = NULL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dbus_connection_add_filter (connection, nm_dbus_nmi_filter, data, NULL))
|
if (!dbus_connection_add_filter (connection, nm_dbus_nmi_filter, data, NULL))
|
||||||
{
|
{
|
||||||
syslog (LOG_CRIT, "nm_dbus_init() could not attach a dbus message filter. The NetworkManager dbus security policy may not be loaded. Restart dbus?");
|
nm_error ("nm_dbus_init() could not attach a dbus message filter. The NetworkManager dbus security policy may not be loaded. Restart dbus?");
|
||||||
connection = NULL;
|
connection = NULL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -1140,7 +1226,7 @@ DBusConnection *nm_dbus_init (NMData *data)
|
|||||||
dbus_bus_request_name (connection, NM_DBUS_SERVICE, 0, &error);
|
dbus_bus_request_name (connection, NM_DBUS_SERVICE, 0, &error);
|
||||||
if (dbus_error_is_set (&error))
|
if (dbus_error_is_set (&error))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_dbus_init() could not acquire its service. dbus_bus_acquire_service() says: '%s'", error.message);
|
nm_warning ("nm_dbus_init() could not acquire its service. dbus_bus_acquire_service() says: '%s'", error.message);
|
||||||
connection = NULL;
|
connection = NULL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@@ -217,15 +217,15 @@ NMDevice *nm_device_new (const char *iface, const char *udi, gboolean test_dev,
|
|||||||
*/
|
*/
|
||||||
if (!app_data->enable_test_devices && test_dev)
|
if (!app_data->enable_test_devices && test_dev)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_device_new(): attempt to create a test device, but test devices were not enabled"
|
nm_warning ("attempt to create a test device, but test devices were not enabled "
|
||||||
" on the command line. Will not create the device.\n");
|
"on the command line. Will not create the device.\n");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
dev = g_malloc0 (sizeof (NMDevice));
|
dev = g_malloc0 (sizeof (NMDevice));
|
||||||
if (!dev)
|
if (!dev)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_device_new() could not allocate a new device... Not enough memory?");
|
nm_warning ("could not allocate a new device... Not enough memory?");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,16 +324,16 @@ NMDevice *nm_device_new (const char *iface, const char *udi, gboolean test_dev,
|
|||||||
|
|
||||||
if (!g_thread_create (nm_device_worker, dev, FALSE, &error))
|
if (!g_thread_create (nm_device_worker, dev, FALSE, &error))
|
||||||
{
|
{
|
||||||
syslog (LOG_CRIT, "nm_device_new (): could not create device worker thread. (glib said: '%s')", error->message);
|
nm_error ("could not create device worker thread. (glib said: '%s')", error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Block until our device thread has actually had a chance to start. */
|
/* Block until our device thread has actually had a chance to start. */
|
||||||
syslog (LOG_ERR, "nm_device_new(): waiting for device's worker thread to start.\n");
|
nm_info ("waiting for device's worker thread to start.\n");
|
||||||
while (dev->worker_started == FALSE)
|
while (dev->worker_started == FALSE)
|
||||||
g_usleep (G_USEC_PER_SEC / 2);
|
g_usleep (G_USEC_PER_SEC / 2);
|
||||||
syslog (LOG_ERR, "nm_device_new(): device's worker thread started, continuing.\n");
|
nm_info ("device's worker thread started, continuing.\n");
|
||||||
|
|
||||||
return (dev);
|
return (dev);
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ static gpointer nm_device_worker (gpointer user_data)
|
|||||||
|
|
||||||
if (!dev)
|
if (!dev)
|
||||||
{
|
{
|
||||||
syslog (LOG_CRIT, "nm_device_worker(): received NULL device object, NetworkManager cannot continue.\n");
|
nm_error ("received NULL device object, NetworkManager cannot continue.\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,7 +517,7 @@ int nm_device_open_sock (void)
|
|||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
return (fd);
|
return (fd);
|
||||||
|
|
||||||
syslog (LOG_ERR, "nm_device_open_sock () could not get network control socket.");
|
nm_warning ("could not get network control socket.");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -799,19 +799,17 @@ static gboolean nm_device_probe_wired_link_state (NMDevice *dev)
|
|||||||
if (dev->removed)
|
if (dev->removed)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
carrier_path = g_strdup_printf ("/sys/sys/class/net/%s/carrier", dev->iface);
|
carrier_path = g_strdup_printf ("/sys/class/net/%s/carrier", dev->iface);
|
||||||
if (g_file_get_contents (carrier_path, &contents, &length, NULL)) {
|
if (g_file_get_contents (carrier_path, &contents, &length, NULL)) {
|
||||||
link = (gboolean) atoi (contents);
|
link = (gboolean) atoi (contents);
|
||||||
g_free (contents);
|
g_free (contents);
|
||||||
} else {
|
}
|
||||||
contents = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We say that non-carrier-detect devices always have a link, because
|
/* We say that non-carrier-detect devices always have a link, because
|
||||||
* they never get auto-selected by NM. User has to force them on us,
|
* they never get auto-selected by NM. User has to force them on us,
|
||||||
* so we just hope the user knows whether or not the cable's plugged in.
|
* so we just hope the user knows whether or not the cable's plugged in.
|
||||||
*/
|
*/
|
||||||
if ((dev->options.wired.has_carrier_detect != TRUE) || (contents == NULL))
|
if (dev->options.wired.has_carrier_detect != TRUE)
|
||||||
link = TRUE;
|
link = TRUE;
|
||||||
|
|
||||||
return (link);
|
return (link);
|
||||||
@@ -893,7 +891,7 @@ char * nm_device_get_essid (NMDevice *dev)
|
|||||||
dev->options.wireless.cur_essid = g_strdup (info.essid);
|
dev->options.wireless.cur_essid = g_strdup (info.essid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
syslog (LOG_ERR, "nm_device_get_essid(): error getting ESSID for device %s. errno = %d", nm_device_get_iface (dev), errno);
|
nm_warning ("nm_device_get_essid(): error getting ESSID for device %s. errno = %d", nm_device_get_iface (dev), errno);
|
||||||
|
|
||||||
close (sk);
|
close (sk);
|
||||||
}
|
}
|
||||||
@@ -944,7 +942,7 @@ void nm_device_set_essid (NMDevice *dev, const char *essid)
|
|||||||
|
|
||||||
err = iw_set_ext (sk, nm_device_get_iface (dev), SIOCSIWESSID, &wreq);
|
err = iw_set_ext (sk, nm_device_get_iface (dev), SIOCSIWESSID, &wreq);
|
||||||
if (err == -1)
|
if (err == -1)
|
||||||
syslog (LOG_ERR, "nm_device_set_essid(): error setting ESSID '%s' for device %s. errno = %d", safe_essid, nm_device_get_iface (dev), errno);
|
nm_warning ("nm_device_set_essid(): error setting ESSID '%s' for device %s. errno = %d", safe_essid, nm_device_get_iface (dev), errno);
|
||||||
|
|
||||||
close (sk);
|
close (sk);
|
||||||
}
|
}
|
||||||
@@ -979,7 +977,7 @@ double nm_device_get_frequency (NMDevice *dev)
|
|||||||
if (err >= 0)
|
if (err >= 0)
|
||||||
freq = iw_freq2float (&wrq.u.freq);
|
freq = iw_freq2float (&wrq.u.freq);
|
||||||
if (err == -1)
|
if (err == -1)
|
||||||
syslog (LOG_ERR, "nm_device_get_frequency(): error getting frequency for device %s. errno = %d", nm_device_get_iface (dev), errno);
|
nm_warning ("nm_device_get_frequency(): error getting frequency for device %s. errno = %d", nm_device_get_iface (dev), errno);
|
||||||
|
|
||||||
close (sk);
|
close (sk);
|
||||||
}
|
}
|
||||||
@@ -1258,11 +1256,11 @@ void nm_device_set_enc_key (NMDevice *dev, const char *key, NMDeviceAuthMethod a
|
|||||||
{
|
{
|
||||||
err = iw_set_ext (sk, nm_device_get_iface (dev), SIOCSIWENCODE, &wreq);
|
err = iw_set_ext (sk, nm_device_get_iface (dev), SIOCSIWENCODE, &wreq);
|
||||||
if (err == -1)
|
if (err == -1)
|
||||||
syslog (LOG_ERR, "nm_device_set_enc_key(): error setting key for device %s. errno = %d", nm_device_get_iface (dev), errno);
|
nm_warning ("nm_device_set_enc_key(): error setting key for device %s. errno = %d", nm_device_get_iface (dev), errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
close (sk);
|
close (sk);
|
||||||
} else syslog (LOG_ERR, "nm_device_set_enc_key(): could not get wireless control socket.");
|
} else nm_warning ("nm_device_set_enc_key(): could not get wireless control socket.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1501,7 +1499,7 @@ static void nm_device_set_up_down (NMDevice *dev, gboolean up)
|
|||||||
ifr.ifr_flags &= ~IFF_UP;
|
ifr.ifr_flags &= ~IFF_UP;
|
||||||
ifr.ifr_flags |= IFF_UP & flags;
|
ifr.ifr_flags |= IFF_UP & flags;
|
||||||
if ((err = ioctl (sk, SIOCSIFFLAGS, &ifr)))
|
if ((err = ioctl (sk, SIOCSIFFLAGS, &ifr)))
|
||||||
syslog (LOG_ERR, "nm_device_set_up_down() could not bring device %s %s. errno = %d", nm_device_get_iface (dev), (up ? "up" : "down"), errno );
|
nm_warning ("nm_device_set_up_down() could not bring device %s %s. errno = %d", nm_device_get_iface (dev), (up ? "up" : "down"), errno );
|
||||||
}
|
}
|
||||||
/* Make sure we have a valid MAC address, some cards reload firmware when they
|
/* Make sure we have a valid MAC address, some cards reload firmware when they
|
||||||
* are brought up.
|
* are brought up.
|
||||||
@@ -1510,7 +1508,7 @@ static void nm_device_set_up_down (NMDevice *dev, gboolean up)
|
|||||||
nm_device_update_hw_address(dev);
|
nm_device_update_hw_address(dev);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
syslog (LOG_ERR, "nm_device_set_up_down() could not get flags for device %s. errno = %d", nm_device_get_iface (dev), errno );
|
nm_warning ("nm_device_set_up_down() could not get flags for device %s. errno = %d", nm_device_get_iface (dev), errno );
|
||||||
|
|
||||||
close (sk);
|
close (sk);
|
||||||
}
|
}
|
||||||
@@ -1556,7 +1554,7 @@ gboolean nm_device_is_up (NMDevice *dev)
|
|||||||
if (!err)
|
if (!err)
|
||||||
return (!((ifr.ifr_flags^IFF_UP) & IFF_UP));
|
return (!((ifr.ifr_flags^IFF_UP) & IFF_UP));
|
||||||
|
|
||||||
syslog (LOG_ERR, "nm_device_is_up() could not get flags for device %s. errno = %d", nm_device_get_iface (dev), errno );
|
nm_warning ("nm_device_is_up() could not get flags for device %s. errno = %d", nm_device_get_iface (dev), errno );
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1598,7 +1596,7 @@ NMNetworkMode nm_device_get_mode (NMDevice *dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
syslog (LOG_ERR, "nm_device_get_mode (%s): error setting card to Infrastructure mode. errno = %d", nm_device_get_iface (dev), errno);
|
nm_warning ("nm_device_get_mode (%s): error setting card to Infrastructure mode. errno = %d", nm_device_get_iface (dev), errno);
|
||||||
close (sk);
|
close (sk);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1652,7 +1650,7 @@ gboolean nm_device_set_mode (NMDevice *dev, const NMNetworkMode mode)
|
|||||||
if (err == 0)
|
if (err == 0)
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
else
|
else
|
||||||
syslog (LOG_ERR, "nm_device_set_mode (%s): error setting card to Infrastructure mode. errno = %d", nm_device_get_iface (dev), errno);
|
nm_warning ("nm_device_set_mode (%s): error setting card to Infrastructure mode. errno = %d", nm_device_get_iface (dev), errno);
|
||||||
}
|
}
|
||||||
close (sk);
|
close (sk);
|
||||||
}
|
}
|
||||||
@@ -1747,7 +1745,7 @@ static gboolean nm_device_activation_handle_cancel (NMDevice *dev)
|
|||||||
/* If we were told to quit activation, stop the thread and return */
|
/* If we were told to quit activation, stop the thread and return */
|
||||||
if (dev->quit_activation)
|
if (dev->quit_activation)
|
||||||
{
|
{
|
||||||
syslog (LOG_DEBUG, "nm_device_activation_worker(%s): activation canceled.", nm_device_get_iface (dev));
|
nm_debug ("activation of device '%s' canceled.", nm_device_get_iface (dev));
|
||||||
if (nm_device_is_wireless (dev))
|
if (nm_device_is_wireless (dev))
|
||||||
nm_device_set_now_scanning (dev, FALSE);
|
nm_device_set_now_scanning (dev, FALSE);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@@ -1867,7 +1865,7 @@ static gboolean nm_device_set_wireless_config (NMDevice *dev, NMAccessPoint *ap)
|
|||||||
if (auth == NM_DEVICE_AUTH_METHOD_NONE)
|
if (auth == NM_DEVICE_AUTH_METHOD_NONE)
|
||||||
{
|
{
|
||||||
nm_ap_set_auth_method (ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
nm_ap_set_auth_method (ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
|
||||||
syslog (LOG_ERR, "Activation (%s/wireless): AP '%s' said it was encrypted, but had "
|
nm_warning ("Activation (%s/wireless): AP '%s' said it was encrypted, but had "
|
||||||
"'none' for authentication method. Using Open System authentication method.",
|
"'none' for authentication method. Using Open System authentication method.",
|
||||||
nm_device_get_iface (dev), nm_ap_get_essid (ap));
|
nm_device_get_iface (dev), nm_ap_get_essid (ap));
|
||||||
}
|
}
|
||||||
@@ -1879,7 +1877,7 @@ static gboolean nm_device_set_wireless_config (NMDevice *dev, NMAccessPoint *ap)
|
|||||||
|
|
||||||
nm_device_set_essid (dev, essid);
|
nm_device_set_essid (dev, essid);
|
||||||
|
|
||||||
syslog (LOG_INFO, "Activation (%s/wireless): using essid '%s', with %s authentication.",
|
nm_info ("Activation (%s/wireless): using essid '%s', with %s authentication.",
|
||||||
nm_device_get_iface (dev), essid, (auth == NM_DEVICE_AUTH_METHOD_NONE) ? "no" :
|
nm_device_get_iface (dev), essid, (auth == NM_DEVICE_AUTH_METHOD_NONE) ? "no" :
|
||||||
((auth == NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM) ? "Open System" :
|
((auth == NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM) ? "Open System" :
|
||||||
((auth == NM_DEVICE_AUTH_METHOD_SHARED_KEY) ? "Shared Key" : "unknown")));
|
((auth == NM_DEVICE_AUTH_METHOD_SHARED_KEY) ? "Shared Key" : "unknown")));
|
||||||
@@ -1983,7 +1981,7 @@ static gboolean nm_device_activate_wireless_adhoc (NMDevice *dev, NMAccessPoint
|
|||||||
{
|
{
|
||||||
nm_ap_set_freq (ap, freq_to_use);
|
nm_ap_set_freq (ap, freq_to_use);
|
||||||
|
|
||||||
syslog (LOG_INFO, "Will create network '%s' with frequency %f.\n", nm_ap_get_essid (ap), nm_ap_get_freq (ap));
|
nm_info ("Will create network '%s' with frequency %f.\n", nm_ap_get_essid (ap), nm_ap_get_freq (ap));
|
||||||
if ((success = nm_device_set_wireless_config (dev, ap)))
|
if ((success = nm_device_set_wireless_config (dev, ap)))
|
||||||
success = nm_device_activation_configure_ip (dev, TRUE);
|
success = nm_device_activation_configure_ip (dev, TRUE);
|
||||||
}
|
}
|
||||||
@@ -2003,20 +2001,24 @@ static gboolean AP_NEED_KEY (NMDevice *dev, NMAccessPoint *ap)
|
|||||||
|
|
||||||
if (!nm_ap_get_encrypted (ap))
|
if (!nm_ap_get_encrypted (ap))
|
||||||
{
|
{
|
||||||
syslog (LOG_NOTICE, "Activation (%s/wireless): access point '%s' is unencrypted, no key needed.",
|
nm_info ("Activation (%s/wireless): access point '%s' is "
|
||||||
nm_device_get_iface (dev), essid ? essid : "(null)");
|
"unencrypted, no key needed.",
|
||||||
|
nm_device_get_iface (dev), essid ? essid : "(null)");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (nm_ap_is_enc_key_valid (ap))
|
if (nm_ap_is_enc_key_valid (ap))
|
||||||
{
|
{
|
||||||
syslog (LOG_NOTICE, "Activation (%s/wireless): access point '%s' is encrypted, and a key exists. No new key needed.",
|
nm_info ("Activation (%s/wireless): access point '%s' "
|
||||||
nm_device_get_iface (dev), essid ? essid : "(null)");
|
"is encrypted, and a key exists. No new key needed.",
|
||||||
|
nm_device_get_iface (dev), essid ? essid : "(null)");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
syslog (LOG_NOTICE, "Activation (%s/wireless): access point '%s' is encrypted, but NO valid key exists. New key needed.",
|
nm_info ("Activation (%s/wireless): access point '%s' "
|
||||||
nm_device_get_iface (dev), essid ? essid : "(null)");
|
"is encrypted, but NO valid key exists. New key needed.",
|
||||||
|
nm_device_get_iface (dev),
|
||||||
|
essid ? essid : "(null)");
|
||||||
need_key = TRUE;
|
need_key = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2119,7 +2121,7 @@ get_ap:
|
|||||||
{
|
{
|
||||||
nm_device_set_now_scanning (dev, TRUE);
|
nm_device_set_now_scanning (dev, TRUE);
|
||||||
if (!found_ap)
|
if (!found_ap)
|
||||||
syslog (LOG_ERR, "Activation (%s/wireless): waiting for an access point.", nm_device_get_iface (dev));
|
nm_warning ("Activation (%s/wireless): waiting for an access point.", nm_device_get_iface (dev));
|
||||||
g_usleep (G_USEC_PER_SEC * 2);
|
g_usleep (G_USEC_PER_SEC * 2);
|
||||||
|
|
||||||
/* If we were told to quit activation, stop the thread and return */
|
/* If we were told to quit activation, stop the thread and return */
|
||||||
@@ -2132,7 +2134,7 @@ get_ap:
|
|||||||
found_ap = TRUE;
|
found_ap = TRUE;
|
||||||
}
|
}
|
||||||
if (found_ap)
|
if (found_ap)
|
||||||
syslog (LOG_ERR, "Activation (%s/wireless): found access point '%s' to use.", nm_device_get_iface (dev), nm_ap_get_essid (best_ap));
|
nm_warning ("Activation (%s/wireless): found access point '%s' to use.", nm_device_get_iface (dev), nm_ap_get_essid (best_ap));
|
||||||
|
|
||||||
/* Set ESSID early so that when we send out the DeviceStatusChanged signal below,
|
/* Set ESSID early so that when we send out the DeviceStatusChanged signal below,
|
||||||
* we are able to respond correctly to queries for "getActiveNetwork" against
|
* we are able to respond correctly to queries for "getActiveNetwork" against
|
||||||
@@ -2179,11 +2181,11 @@ need_key:
|
|||||||
need_key = FALSE;
|
need_key = FALSE;
|
||||||
|
|
||||||
/* Wait for the key to come back */
|
/* Wait for the key to come back */
|
||||||
syslog (LOG_DEBUG, "Activation (%s/wireless): asking for user key.", nm_device_get_iface (dev));
|
nm_debug ("Activation (%s/wireless): asking for user key.", nm_device_get_iface (dev));
|
||||||
while (!dev->options.wireless.user_key_received && !dev->quit_activation)
|
while (!dev->options.wireless.user_key_received && !dev->quit_activation)
|
||||||
g_usleep (G_USEC_PER_SEC / 2);
|
g_usleep (G_USEC_PER_SEC / 2);
|
||||||
|
|
||||||
syslog (LOG_DEBUG, "Activation (%s/wireless): user key received.", nm_device_get_iface (dev));
|
nm_debug ("Activation (%s/wireless): user key received.", nm_device_get_iface (dev));
|
||||||
|
|
||||||
/* Done waiting, grab lock again */
|
/* Done waiting, grab lock again */
|
||||||
nm_lock_mutex (dev->options.wireless.scan_mutex, __FUNCTION__);
|
nm_lock_mutex (dev->options.wireless.scan_mutex, __FUNCTION__);
|
||||||
@@ -2229,7 +2231,7 @@ try_connect:
|
|||||||
{
|
{
|
||||||
if (nm_ap_get_auth_method (best_ap) == NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM)
|
if (nm_ap_get_auth_method (best_ap) == NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM)
|
||||||
{
|
{
|
||||||
syslog (LOG_DEBUG, "Activation (%s/wireless): no hardware link to '%s' in Open System mode, trying Shared Key.",
|
nm_debug ("Activation (%s/wireless): no hardware link to '%s' in Open System mode, trying Shared Key.",
|
||||||
nm_device_get_iface (dev), nm_ap_get_essid (best_ap) ? nm_ap_get_essid (best_ap) : "(none)");
|
nm_device_get_iface (dev), nm_ap_get_essid (best_ap) ? nm_ap_get_essid (best_ap) : "(none)");
|
||||||
/* Back down to Shared Key mode */
|
/* Back down to Shared Key mode */
|
||||||
nm_ap_set_auth_method (best_ap, NM_DEVICE_AUTH_METHOD_SHARED_KEY);
|
nm_ap_set_auth_method (best_ap, NM_DEVICE_AUTH_METHOD_SHARED_KEY);
|
||||||
@@ -2239,12 +2241,12 @@ try_connect:
|
|||||||
{
|
{
|
||||||
/* Must be in Open System mode and it still didn't work, so
|
/* Must be in Open System mode and it still didn't work, so
|
||||||
* we'll invalidate the current "best" ap and get another one */
|
* we'll invalidate the current "best" ap and get another one */
|
||||||
syslog (LOG_DEBUG, "Activation (%s/wireless): no hardware link to '%s' in Shared Key mode, trying another access point.",
|
nm_debug ("Activation (%s/wireless): no hardware link to '%s' in Shared Key mode, trying another access point.",
|
||||||
nm_device_get_iface (dev), nm_ap_get_essid (best_ap) ? nm_ap_get_essid (best_ap) : "(none)");
|
nm_device_get_iface (dev), nm_ap_get_essid (best_ap) ? nm_ap_get_essid (best_ap) : "(none)");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
syslog (LOG_DEBUG, "Activation (%s/wireless): no hardware link to '%s' in non-encrypted mode.",
|
nm_debug ("Activation (%s/wireless): no hardware link to '%s' in non-encrypted mode.",
|
||||||
nm_device_get_iface (dev), nm_ap_get_essid (best_ap) ? nm_ap_get_essid (best_ap) : "(none)");
|
nm_device_get_iface (dev), nm_ap_get_essid (best_ap) ? nm_ap_get_essid (best_ap) : "(none)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2273,7 +2275,7 @@ try_connect:
|
|||||||
if ((nm_ap_get_auth_method (best_ap) == NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM) && !adhoc)
|
if ((nm_ap_get_auth_method (best_ap) == NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM) && !adhoc)
|
||||||
{
|
{
|
||||||
/* Back down to Shared Key mode */
|
/* Back down to Shared Key mode */
|
||||||
syslog (LOG_DEBUG, "Activation (%s/wireless): could not get IP configuration info for '%s' in Open System mode, trying Shared Key.",
|
nm_debug ("Activation (%s/wireless): could not get IP configuration info for '%s' in Open System mode, trying Shared Key.",
|
||||||
nm_device_get_iface (dev), nm_ap_get_essid (best_ap) ? nm_ap_get_essid (best_ap) : "(none)");
|
nm_device_get_iface (dev), nm_ap_get_essid (best_ap) ? nm_ap_get_essid (best_ap) : "(none)");
|
||||||
nm_ap_set_auth_method (best_ap, NM_DEVICE_AUTH_METHOD_SHARED_KEY);
|
nm_ap_set_auth_method (best_ap, NM_DEVICE_AUTH_METHOD_SHARED_KEY);
|
||||||
continue;
|
continue;
|
||||||
@@ -2281,7 +2283,7 @@ try_connect:
|
|||||||
else if ((nm_ap_get_auth_method (best_ap) == NM_DEVICE_AUTH_METHOD_SHARED_KEY) && !adhoc)
|
else if ((nm_ap_get_auth_method (best_ap) == NM_DEVICE_AUTH_METHOD_SHARED_KEY) && !adhoc)
|
||||||
{
|
{
|
||||||
/* Shared Key mode failed, we must have bad WEP key */
|
/* Shared Key mode failed, we must have bad WEP key */
|
||||||
syslog (LOG_DEBUG, "Activation (%s/wireless): could not get IP configuration info for '%s' in Shared Key mode, asking for new key.",
|
nm_debug ("Activation (%s/wireless): could not get IP configuration info for '%s' in Shared Key mode, asking for new key.",
|
||||||
nm_device_get_iface (dev), nm_ap_get_essid (best_ap) ? nm_ap_get_essid (best_ap) : "(none)");
|
nm_device_get_iface (dev), nm_ap_get_essid (best_ap) ? nm_ap_get_essid (best_ap) : "(none)");
|
||||||
need_key = TRUE;
|
need_key = TRUE;
|
||||||
goto need_key;
|
goto need_key;
|
||||||
@@ -2302,7 +2304,7 @@ connect_done:
|
|||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
syslog (LOG_DEBUG, "Activation (%s/wireless): Success! Connected to access point '%s' and got an IP address.",
|
nm_debug ("Activation (%s/wireless): Success! Connected to access point '%s' and got an IP address.",
|
||||||
nm_device_get_iface (dev), nm_ap_get_essid (best_ap) ? nm_ap_get_essid (best_ap) : "(none)");
|
nm_device_get_iface (dev), nm_ap_get_essid (best_ap) ? nm_ap_get_essid (best_ap) : "(none)");
|
||||||
nm_ap_unref (best_ap);
|
nm_ap_unref (best_ap);
|
||||||
}
|
}
|
||||||
@@ -2386,7 +2388,7 @@ static gboolean nm_device_activate (gpointer user_data)
|
|||||||
g_return_val_if_fail (dev != NULL, FALSE);
|
g_return_val_if_fail (dev != NULL, FALSE);
|
||||||
g_return_val_if_fail (dev->app_data != NULL, FALSE);
|
g_return_val_if_fail (dev->app_data != NULL, FALSE);
|
||||||
|
|
||||||
syslog (LOG_ERR, "Activation (%s) started...", nm_device_get_iface (dev));
|
nm_warning ("Activation (%s) started...", nm_device_get_iface (dev));
|
||||||
|
|
||||||
/* Bring the device up */
|
/* Bring the device up */
|
||||||
if (!nm_device_is_up (dev));
|
if (!nm_device_is_up (dev));
|
||||||
@@ -2402,9 +2404,9 @@ static gboolean nm_device_activate (gpointer user_data)
|
|||||||
if (nm_ap_get_user_created (best_ap))
|
if (nm_ap_get_user_created (best_ap))
|
||||||
{
|
{
|
||||||
create_network = TRUE;
|
create_network = TRUE;
|
||||||
syslog (LOG_INFO, "Creating wireless network '%s'.\n", nm_ap_get_essid (best_ap));
|
nm_info ("Creating wireless network '%s'.\n", nm_ap_get_essid (best_ap));
|
||||||
success = nm_device_activate_wireless_adhoc (dev, best_ap);
|
success = nm_device_activate_wireless_adhoc (dev, best_ap);
|
||||||
syslog (LOG_INFO, "Wireless network creation for '%s' was %s.\n", nm_ap_get_essid (best_ap), success ? "successful" : "unsuccessful");
|
nm_info ("Wireless network creation for '%s' was %s.\n", nm_ap_get_essid (best_ap), success ? "successful" : "unsuccessful");
|
||||||
}
|
}
|
||||||
nm_ap_unref (best_ap);
|
nm_ap_unref (best_ap);
|
||||||
}
|
}
|
||||||
@@ -2420,14 +2422,15 @@ static gboolean nm_device_activate (gpointer user_data)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
syslog (LOG_DEBUG, "Activation (%s) IP configuration/DHCP successful!\n", nm_device_get_iface (dev));
|
nm_info ("Activation (%s) IP configuration/DHCP successful!\n", nm_device_get_iface (dev));
|
||||||
else
|
else
|
||||||
syslog (LOG_DEBUG, "Activation (%s) IP configuration/DHCP unsuccessful! Ending activation...\n", nm_device_get_iface (dev));
|
nm_info ("Activation (%s) IP configuration/DHCP unsuccessful! Ending activation...\n",
|
||||||
|
nm_device_get_iface (dev));
|
||||||
|
|
||||||
finished = TRUE;
|
finished = TRUE;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
syslog (LOG_DEBUG, "Activation (%s) ended.\n", nm_device_get_iface (dev));
|
nm_debug ("Activation (%s) ended.\n", nm_device_get_iface (dev));
|
||||||
dev->activating = FALSE;
|
dev->activating = FALSE;
|
||||||
dev->quit_activation = FALSE;
|
dev->quit_activation = FALSE;
|
||||||
if (finished)
|
if (finished)
|
||||||
@@ -2477,7 +2480,7 @@ void nm_device_activation_cancel (NMDevice *dev)
|
|||||||
|
|
||||||
if (nm_device_is_activating (dev))
|
if (nm_device_is_activating (dev))
|
||||||
{
|
{
|
||||||
syslog (LOG_DEBUG, "nm_device_activation_cancel(%s): cancelling...", nm_device_get_iface (dev));
|
nm_debug ("nm_device_activation_cancel(%s): cancelling...", nm_device_get_iface (dev));
|
||||||
dev->quit_activation = TRUE;
|
dev->quit_activation = TRUE;
|
||||||
|
|
||||||
/* Spin until cancelled. Possible race conditions or deadlocks here.
|
/* Spin until cancelled. Possible race conditions or deadlocks here.
|
||||||
@@ -2496,7 +2499,7 @@ void nm_device_activation_cancel (NMDevice *dev)
|
|||||||
|
|
||||||
g_usleep (G_USEC_PER_SEC / 2);
|
g_usleep (G_USEC_PER_SEC / 2);
|
||||||
}
|
}
|
||||||
syslog (LOG_DEBUG, "nm_device_activation_cancel(%s): cancelled.", nm_device_get_iface (dev));
|
nm_debug ("nm_device_activation_cancel(%s): cancelled.", nm_device_get_iface (dev));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2966,7 +2969,7 @@ static gboolean nm_device_wireless_force_use (NMDevice *dev, const char *essid,
|
|||||||
if (!essid)
|
if (!essid)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
syslog (LOG_DEBUG, "Forcing AP '%s'", essid);
|
nm_debug ("Forcing AP '%s'", essid);
|
||||||
|
|
||||||
if ( key
|
if ( key
|
||||||
&& strlen (key)
|
&& strlen (key)
|
||||||
@@ -3142,7 +3145,7 @@ static void nm_device_do_pseudo_scan (NMDevice *dev)
|
|||||||
|
|
||||||
if (valid)
|
if (valid)
|
||||||
{
|
{
|
||||||
syslog(LOG_INFO, "%s: setting AP '%s' best", nm_device_get_iface (dev), nm_ap_get_essid (ap));
|
nm_info ("%s: setting AP '%s' best", nm_device_get_iface (dev), nm_ap_get_essid (ap));
|
||||||
|
|
||||||
nm_device_set_best_ap (dev, ap);
|
nm_device_set_best_ap (dev, ap);
|
||||||
nm_policy_schedule_state_update (dev->app_data);
|
nm_policy_schedule_state_update (dev->app_data);
|
||||||
@@ -3502,7 +3505,8 @@ static gboolean nm_device_wireless_scan (gpointer user_data)
|
|||||||
scan_results->scan_head.result = NULL;
|
scan_results->scan_head.result = NULL;
|
||||||
}
|
}
|
||||||
else if ((err == -1) && (errno == ETIME))
|
else if ((err == -1) && (errno == ETIME))
|
||||||
syslog (LOG_ERR, "Warning: the wireless card (%s) requires too much time for scans. Its driver needs to be fixed.", nm_device_get_iface (dev));
|
nm_warning ("The wireless card (%s) requires too much time for scans. "
|
||||||
|
"Its driver needs to be fixed.", nm_device_get_iface (dev));
|
||||||
|
|
||||||
nm_device_set_mode (dev, orig_mode);
|
nm_device_set_mode (dev, orig_mode);
|
||||||
/* Only set frequency if ad-hoc mode */
|
/* Only set frequency if ad-hoc mode */
|
||||||
@@ -3636,7 +3640,7 @@ static gboolean supports_ethtool_carrier_detect (NMDevice *dev)
|
|||||||
|
|
||||||
if ((sk = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
|
if ((sk = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "cannot open socket on interface %s for MII detect; errno=%d", nm_device_get_iface (dev), errno);
|
nm_warning ("cannot open socket on interface %s for MII detect; errno=%d", nm_device_get_iface (dev), errno);
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3687,7 +3691,7 @@ static gboolean supports_mii_carrier_detect (NMDevice *dev)
|
|||||||
|
|
||||||
if ((sk = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
|
if ((sk = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "cannot open socket on interface %s for MII detect; errno=%d", nm_device_get_iface (dev), errno);
|
nm_warning ("cannot open socket on interface %s for MII detect; errno=%d", nm_device_get_iface (dev), errno);
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include "NetworkManagerAP.h"
|
#include "NetworkManagerAP.h"
|
||||||
#include "NetworkManagerAPList.h"
|
#include "NetworkManagerAPList.h"
|
||||||
#include "NetworkManagerDbus.h"
|
#include "NetworkManagerDbus.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -128,7 +129,7 @@ static NMDevice * nm_policy_auto_get_best_device (NMData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
syslog (LOG_NOTICE, "AUTO: Best wired device = %s, best wireless device = %s (%s)", best_wired_dev ? nm_device_get_iface (best_wired_dev) : "(null)",
|
nm_info ("AUTO: Best wired device = %s, best wireless device = %s (%s)", best_wired_dev ? nm_device_get_iface (best_wired_dev) : "(null)",
|
||||||
best_wireless_dev ? nm_device_get_iface (best_wireless_dev) : "(null)", best_wireless_dev ? nm_device_get_essid (best_wireless_dev) : "null" );
|
best_wireless_dev ? nm_device_get_iface (best_wireless_dev) : "(null)", best_wireless_dev ? nm_device_get_essid (best_wireless_dev) : "null" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -208,7 +209,7 @@ static NMDevice * nm_policy_get_best_device (NMDevice *switch_to_dev, NMData *da
|
|||||||
/* Ensure we support this driver */
|
/* Ensure we support this driver */
|
||||||
if (best_dev && (nm_device_get_driver_support_level (best_dev) == NM_DRIVER_UNSUPPORTED))
|
if (best_dev && (nm_device_get_driver_support_level (best_dev) == NM_DRIVER_UNSUPPORTED))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "nm_policy_get_best_device(): tried to switch to unsupported device '%s'!\n", nm_device_get_iface (best_dev));
|
nm_warning ("nm_policy_get_best_device(): tried to switch to unsupported device '%s'!\n", nm_device_get_iface (best_dev));
|
||||||
best_dev = NULL;
|
best_dev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +262,7 @@ gboolean nm_policy_activation_finish (gpointer user_data)
|
|||||||
nm_ap_unref (ap);
|
nm_ap_unref (ap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
syslog (LOG_INFO, "Activation (%s) successful, device activated.", nm_device_get_iface (data->active_device));
|
nm_info ("Activation (%s) successful, device activated.", nm_device_get_iface (data->active_device));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEVICE_ACTIVATION_FAILED:
|
case DEVICE_ACTIVATION_FAILED:
|
||||||
@@ -278,10 +279,10 @@ gboolean nm_policy_activation_finish (gpointer user_data)
|
|||||||
/* Unref because nm_device_get_best_ap() refs it before returning. */
|
/* Unref because nm_device_get_best_ap() refs it before returning. */
|
||||||
nm_ap_unref (ap);
|
nm_ap_unref (ap);
|
||||||
}
|
}
|
||||||
syslog (LOG_INFO, "Activation (%s) failed for access point (%s)", nm_device_get_iface (dev), ap ? nm_ap_get_essid (ap) : "(none)");
|
nm_info ("Activation (%s) failed for access point (%s)", nm_device_get_iface (dev), ap ? nm_ap_get_essid (ap) : "(none)");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
syslog (LOG_INFO, "Activation (%s) failed.", nm_device_get_iface (dev));
|
nm_info ("Activation (%s) failed.", nm_device_get_iface (dev));
|
||||||
if (data->active_device == dev)
|
if (data->active_device == dev)
|
||||||
data->active_device = NULL;
|
data->active_device = NULL;
|
||||||
nm_device_deactivate (dev, FALSE);
|
nm_device_deactivate (dev, FALSE);
|
||||||
@@ -352,21 +353,21 @@ static gboolean nm_policy_state_update (gpointer user_data)
|
|||||||
if (best_dev != app_data->active_device)
|
if (best_dev != app_data->active_device)
|
||||||
{
|
{
|
||||||
if (best_dev)
|
if (best_dev)
|
||||||
syslog (LOG_INFO, " SWITCH: best device changed");
|
nm_info (" SWITCH: best device changed");
|
||||||
else
|
else
|
||||||
syslog (LOG_INFO, " SWITCH: old device no longer good, but no better device was available");
|
nm_info (" SWITCH: old device no longer good, but no better device was available");
|
||||||
do_switch = TRUE; /* Device changed */
|
do_switch = TRUE; /* Device changed */
|
||||||
}
|
}
|
||||||
else if (best_dev)
|
else if (best_dev)
|
||||||
{
|
{
|
||||||
if (nm_device_is_wireless (best_dev) && !nm_device_is_activating (best_dev) && nm_device_need_ap_switch (best_dev))
|
if (nm_device_is_wireless (best_dev) && !nm_device_is_activating (best_dev) && nm_device_need_ap_switch (best_dev))
|
||||||
{
|
{
|
||||||
syslog (LOG_INFO, " SWITCH: need to associate with new access point or create a wireless network.");
|
nm_info (" SWITCH: need to associate with new access point or create a wireless network.");
|
||||||
do_switch = TRUE;
|
do_switch = TRUE;
|
||||||
}
|
}
|
||||||
else if (!nm_device_is_activating (best_dev) && !nm_device_get_ip4_address (best_dev))
|
else if (!nm_device_is_activating (best_dev) && !nm_device_get_ip4_address (best_dev))
|
||||||
{
|
{
|
||||||
syslog (LOG_INFO, " SWITCH: need to get an IP address.");
|
nm_info (" SWITCH: need to get an IP address.");
|
||||||
do_switch = TRUE;
|
do_switch = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -472,7 +473,7 @@ static gboolean nm_policy_allowed_ap_list_update (gpointer user_data)
|
|||||||
|
|
||||||
g_return_val_if_fail (data != NULL, FALSE);
|
g_return_val_if_fail (data != NULL, FALSE);
|
||||||
|
|
||||||
syslog (LOG_INFO, "Updating allowed wireless network lists.");
|
nm_info ("Updating allowed wireless network lists.");
|
||||||
|
|
||||||
/* Query info daemon for network lists if its now running */
|
/* Query info daemon for network lists if its now running */
|
||||||
if (data->allowed_ap_list)
|
if (data->allowed_ap_list)
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "NetworkManagerSystem.h"
|
#include "NetworkManagerSystem.h"
|
||||||
#include "NetworkManagerDevice.h"
|
#include "NetworkManagerDevice.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
|
|
||||||
static int nm_system_open_sock (void)
|
static int nm_system_open_sock (void)
|
||||||
{
|
{
|
||||||
@@ -51,7 +52,7 @@ static int nm_system_open_sock (void)
|
|||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
return (fd);
|
return (fd);
|
||||||
|
|
||||||
syslog (LOG_ERR, "nm_system_open_sock() could not get network control socket.");
|
nm_warning ("nm_system_open_sock() could not get network control socket.");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,11 +77,11 @@ gboolean nm_system_device_set_ip4_address (NMDevice *dev, int ip4_address)
|
|||||||
p->sin_family = AF_INET;
|
p->sin_family = AF_INET;
|
||||||
p->sin_addr.s_addr = ip4_address;
|
p->sin_addr.s_addr = ip4_address;
|
||||||
if (ioctl (sk, SIOCSIFADDR, &ifr) == -1)
|
if (ioctl (sk, SIOCSIFADDR, &ifr) == -1)
|
||||||
syslog (LOG_ERR,"nm_system_device_set_ip4_address (%s): failed to set IPv4 address!", iface);
|
nm_warning ("nm_system_device_set_ip4_address (%s): failed to set IPv4 address!", iface);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
syslog (LOG_INFO, "Your IP address = %u.%u.%u.%u\n",
|
nm_info ("Your IP address = %u.%u.%u.%u\n",
|
||||||
((unsigned char *)&ip4_address)[0], ((unsigned char *)&ip4_address)[1],
|
((unsigned char *)&ip4_address)[0], ((unsigned char *)&ip4_address)[1],
|
||||||
((unsigned char *)&ip4_address)[2], ((unsigned char *)&ip4_address)[3]);
|
((unsigned char *)&ip4_address)[2], ((unsigned char *)&ip4_address)[3]);
|
||||||
}
|
}
|
||||||
@@ -110,7 +111,7 @@ gboolean nm_system_device_set_ip4_netmask (NMDevice *dev, int ip4_netmask)
|
|||||||
p->sin_family = AF_INET;
|
p->sin_family = AF_INET;
|
||||||
p->sin_addr.s_addr = ip4_netmask;
|
p->sin_addr.s_addr = ip4_netmask;
|
||||||
if (ioctl (sk, SIOCSIFNETMASK, &ifr) == -1)
|
if (ioctl (sk, SIOCSIFNETMASK, &ifr) == -1)
|
||||||
syslog (LOG_ERR,"nm_system_device_set_ip4_netmask (%s): failed to set IPv4 netmask! errno = %s", iface, strerror (errno));
|
nm_warning ("nm_system_device_set_ip4_netmask (%s): failed to set IPv4 netmask! errno = %s", iface, strerror (errno));
|
||||||
else
|
else
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
|
|
||||||
@@ -139,7 +140,7 @@ gboolean nm_system_device_set_ip4_broadcast (NMDevice *dev, int ip4_broadcast)
|
|||||||
p->sin_family = AF_INET;
|
p->sin_family = AF_INET;
|
||||||
p->sin_addr.s_addr = ip4_broadcast;
|
p->sin_addr.s_addr = ip4_broadcast;
|
||||||
if (ioctl (sk, SIOCSIFBRDADDR, &ifr) == -1)
|
if (ioctl (sk, SIOCSIFBRDADDR, &ifr) == -1)
|
||||||
syslog (LOG_ERR,"nm_system_device_set_ip4_netmask (%s): failed to set IPv4 netmask!", iface);
|
nm_warning ("nm_system_device_set_ip4_netmask (%s): failed to set IPv4 netmask!", iface);
|
||||||
else
|
else
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
|
|
||||||
@@ -202,11 +203,11 @@ gboolean nm_system_device_set_ip4_default_route (NMDevice *dev, int ip4_def_rout
|
|||||||
if ( ioctl (sk, SIOCADDRT, &rtent) == 0 )
|
if ( ioctl (sk, SIOCADDRT, &rtent) == 0 )
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
else
|
else
|
||||||
syslog (LOG_ERR,"nm_system_device_set_ip4_default_route (%s): failed to set IPv4 default route! errno = %d", iface, errno);
|
nm_warning ("nm_system_device_set_ip4_default_route (%s): failed to set IPv4 default route! errno = %d", iface, errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
syslog (LOG_ERR,"nm_system_device_set_ip4_default_route (%s): failed to set IPv4 default route! errno = %d", iface, errno);
|
nm_warning ("nm_system_device_set_ip4_default_route (%s): failed to set IPv4 default route! errno = %d", iface, errno);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "NetworkManager.h"
|
#include "NetworkManager.h"
|
||||||
#include "NetworkManagerUtils.h"
|
#include "NetworkManagerUtils.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
|
|
||||||
|
|
||||||
typedef struct MutexDesc
|
typedef struct MutexDesc
|
||||||
@@ -92,7 +93,7 @@ gboolean nm_try_acquire_mutex (GMutex *mutex, const char *func)
|
|||||||
if (func)
|
if (func)
|
||||||
{
|
{
|
||||||
MutexDesc *desc = nm_find_mutex_desc (mutex);
|
MutexDesc *desc = nm_find_mutex_desc (mutex);
|
||||||
syslog (LOG_DEBUG, "MUTEX: <%s %p> acquired by %s", desc ? desc->desc : "(none)", mutex, func);
|
nm_debug ("MUTEX: <%s %p> acquired by %s", desc ? desc->desc : "(none)", mutex, func);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@@ -102,7 +103,7 @@ gboolean nm_try_acquire_mutex (GMutex *mutex, const char *func)
|
|||||||
if (func)
|
if (func)
|
||||||
{
|
{
|
||||||
MutexDesc *desc = nm_find_mutex_desc (mutex);
|
MutexDesc *desc = nm_find_mutex_desc (mutex);
|
||||||
syslog (LOG_DEBUG, "MUTEX: <%s %p> FAILED to be acquired by %s", desc ? desc->desc : "(none)", mutex, func);
|
nm_debug ("MUTEX: <%s %p> FAILED to be acquired by %s", desc ? desc->desc : "(none)", mutex, func);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
@@ -121,7 +122,7 @@ void nm_lock_mutex (GMutex *mutex, const char *func)
|
|||||||
if (func)
|
if (func)
|
||||||
{
|
{
|
||||||
MutexDesc *desc = nm_find_mutex_desc (mutex);
|
MutexDesc *desc = nm_find_mutex_desc (mutex);
|
||||||
syslog (LOG_DEBUG, "MUTEX: <%s %p> being acquired by %s", desc ? desc->desc : "(none)", mutex, func);
|
nm_debug ("MUTEX: <%s %p> being acquired by %s", desc ? desc->desc : "(none)", mutex, func);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
g_mutex_lock (mutex);
|
g_mutex_lock (mutex);
|
||||||
@@ -142,7 +143,7 @@ void nm_unlock_mutex (GMutex *mutex, const char *func)
|
|||||||
if (func)
|
if (func)
|
||||||
{
|
{
|
||||||
MutexDesc *desc = nm_find_mutex_desc (mutex);
|
MutexDesc *desc = nm_find_mutex_desc (mutex);
|
||||||
syslog (LOG_DEBUG, "MUTEX: <%s %p> released by %s", desc ? desc->desc : "(none)", mutex, func);
|
nm_debug ("MUTEX: <%s %p> released by %s", desc ? desc->desc : "(none)", mutex, func);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -240,13 +241,13 @@ int nm_spawn_process (char *args)
|
|||||||
GError *error2 = NULL;
|
GError *error2 = NULL;
|
||||||
|
|
||||||
if (!g_spawn_sync ("/", argv, NULL, 0, NULL, NULL, &so, &se, &exit_status, &error2))
|
if (!g_spawn_sync ("/", argv, NULL, 0, NULL, NULL, &so, &se, &exit_status, &error2))
|
||||||
syslog (LOG_ERR, "nm_spawn_process('%s'): could not spawn process. (%s)\n", args, error2->message);
|
nm_warning ("nm_spawn_process('%s'): could not spawn process. (%s)\n", args, error2->message);
|
||||||
|
|
||||||
if (so) g_free(so);
|
if (so) g_free(so);
|
||||||
if (se) g_free(se);
|
if (se) g_free(se);
|
||||||
if (argv) g_strfreev (argv);
|
if (argv) g_strfreev (argv);
|
||||||
if (error2) g_error_free (error2);
|
if (error2) g_error_free (error2);
|
||||||
} else syslog (LOG_ERR, "nm_spawn_process('%s'): could not parse arguments (%s)\n", args, error->message);
|
} else nm_warning ("nm_spawn_process('%s'): could not parse arguments (%s)\n", args, error->message);
|
||||||
|
|
||||||
if (error) g_error_free (error);
|
if (error) g_error_free (error);
|
||||||
|
|
||||||
@@ -407,15 +408,15 @@ NMDriverSupportLevel nm_get_driver_support_level (LibHalContext *ctx, NMDevice *
|
|||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case NM_DRIVER_SEMI_SUPPORTED:
|
case NM_DRIVER_SEMI_SUPPORTED:
|
||||||
syslog (LOG_INFO, "%s: Driver support level for '%s' is semi-supported",
|
nm_info ("%s: Driver support level for '%s' is semi-supported",
|
||||||
nm_device_get_iface (dev), driver);
|
nm_device_get_iface (dev), driver);
|
||||||
break;
|
break;
|
||||||
case NM_DRIVER_FULLY_SUPPORTED:
|
case NM_DRIVER_FULLY_SUPPORTED:
|
||||||
syslog (LOG_INFO, "%s: Driver support level for '%s' is fully-supported",
|
nm_info ("%s: Driver support level for '%s' is fully-supported",
|
||||||
nm_device_get_iface (dev), driver);
|
nm_device_get_iface (dev), driver);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
syslog (LOG_INFO, "%s: Driver support level for '%s' is unsupported",
|
nm_info ("%s: Driver support level for '%s' is unsupported",
|
||||||
nm_device_get_iface (dev), driver);
|
nm_device_get_iface (dev), driver);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -140,7 +140,7 @@ int nm_wireless_qual_to_percent (const struct iw_quality *qual, const struct iw_
|
|||||||
g_return_val_if_fail (avg_qual != NULL, -1);
|
g_return_val_if_fail (avg_qual != NULL, -1);
|
||||||
|
|
||||||
#if IW_QUAL_DEBUG
|
#if IW_QUAL_DEBUG
|
||||||
syslog (LOG_DEBUG, "QL: qual %d/%u/0x%X, level %d/%u/0x%X, noise %d/%u/0x%X ** MAX: qual %d/%u/0x%X, level %d/%u/0x%X, noise %d/%u/0x%X",
|
nm_debug ("QL: qual %d/%u/0x%X, level %d/%u/0x%X, noise %d/%u/0x%X ** MAX: qual %d/%u/0x%X, level %d/%u/0x%X, noise %d/%u/0x%X",
|
||||||
(__s8)qual->qual, qual->qual, qual->qual, (__s8)qual->level, qual->level, qual->level, (__s8)qual->noise, qual->noise, qual->noise,
|
(__s8)qual->qual, qual->qual, qual->qual, (__s8)qual->level, qual->level, qual->level, (__s8)qual->noise, qual->noise, qual->noise,
|
||||||
(__s8)max_qual->qual, max_qual->qual, max_qual->qual, (__s8)max_qual->level, max_qual->level, max_qual->level, (__s8)max_qual->noise, max_qual->noise, max_qual->noise);
|
(__s8)max_qual->qual, max_qual->qual, max_qual->qual, (__s8)max_qual->level, max_qual->level, max_qual->level, (__s8)max_qual->noise, max_qual->noise, max_qual->noise);
|
||||||
#endif
|
#endif
|
||||||
@@ -192,7 +192,7 @@ syslog (LOG_DEBUG, "QL: qual %d/%u/0x%X, level %d/%u/0x%X, noise %d/%u/0x%X **
|
|||||||
((double)max_level - (double)level) /
|
((double)max_level - (double)level) /
|
||||||
((double)max_level - (double)noise)));
|
((double)max_level - (double)noise)));
|
||||||
#if IW_QUAL_DEBUG
|
#if IW_QUAL_DEBUG
|
||||||
syslog (LOG_DEBUG, "QL1: level_percent is %d. max_level %d, level %d, noise_floor %d.", level_percent, max_level, level, noise);
|
nm_debug ("QL1: level_percent is %d. max_level %d, level %d, noise_floor %d.", level_percent, max_level, level, noise);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if ((max_qual->level != 0) && !(max_qual->updated & IW_QUAL_LEVEL_INVALID) /* Valid max_qual->level as upper bound */
|
else if ((max_qual->level != 0) && !(max_qual->updated & IW_QUAL_LEVEL_INVALID) /* Valid max_qual->level as upper bound */
|
||||||
@@ -206,7 +206,7 @@ syslog (LOG_DEBUG, "QL: qual %d/%u/0x%X, level %d/%u/0x%X, noise %d/%u/0x%X **
|
|||||||
level = CLAMP (level, 0, max_qual->level);
|
level = CLAMP (level, 0, max_qual->level);
|
||||||
level_percent = (int)(100 * ((double)level / (double)max_qual->level));
|
level_percent = (int)(100 * ((double)level / (double)max_qual->level));
|
||||||
#if IW_QUAL_DEBUG
|
#if IW_QUAL_DEBUG
|
||||||
syslog (LOG_DEBUG, "QL2: level_percent is %d. max_level %d, level %d.", level_percent, max_qual->level, level);
|
nm_debug ("QL2: level_percent is %d. max_level %d, level %d.", level_percent, max_qual->level, level);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ syslog (LOG_DEBUG, "QL: qual %d/%u/0x%X, level %d/%u/0x%X, noise %d/%u/0x%X **
|
|||||||
percent = level_percent;
|
percent = level_percent;
|
||||||
|
|
||||||
#if IW_QUAL_DEBUG
|
#if IW_QUAL_DEBUG
|
||||||
syslog (LOG_DEBUG, "QL: Final quality %% is %d (%d).", percent, CLAMP (percent, 0, 100));
|
nm_debug ("QL: Final quality %% is %d (%d).", percent, CLAMP (percent, 0, 100));
|
||||||
#endif
|
#endif
|
||||||
return (CLAMP (percent, 0, 100));
|
return (CLAMP (percent, 0, 100));
|
||||||
}
|
}
|
||||||
|
29
src/autoip.c
29
src/autoip.c
@@ -33,6 +33,7 @@
|
|||||||
#include "NetworkManager.h"
|
#include "NetworkManager.h"
|
||||||
#include "NetworkManagerDevice.h"
|
#include "NetworkManagerDevice.h"
|
||||||
#include "NetworkManagerMain.h"
|
#include "NetworkManagerMain.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
|
|
||||||
// Times here are in seconds
|
// Times here are in seconds
|
||||||
#define LINKLOCAL_ADDR 0xa9fe0000
|
#define LINKLOCAL_ADDR 0xa9fe0000
|
||||||
@@ -98,7 +99,7 @@ static gboolean arp(int fd, struct sockaddr *saddr, int op,
|
|||||||
|
|
||||||
/* send it */
|
/* send it */
|
||||||
if (sendto (fd, &p, sizeof (p), 0, saddr, sizeof (*saddr)) < 0)
|
if (sendto (fd, &p, sizeof (p), 0, saddr, sizeof (*saddr)) < 0)
|
||||||
syslog (LOG_ERR, "autoip ARP sendto() failed.");
|
nm_warning ("autoip ARP sendto() failed.");
|
||||||
else
|
else
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
|
|
||||||
@@ -146,12 +147,12 @@ static int peekfd (NMDevice *dev, int sk, struct timeval *timeout)
|
|||||||
* to stop with iface->cease and check our timeout.
|
* to stop with iface->cease and check our timeout.
|
||||||
*/
|
*/
|
||||||
gettimeofday (&now, NULL);
|
gettimeofday (&now, NULL);
|
||||||
// syslog (LOG_INFO, "autoip waiting for data, overall timeout = {%ds, %dus}\n", (int)timeout->tv_sec, (int)timeout->tv_usec);
|
// nm_info ("autoip waiting for data, overall timeout = {%ds, %dus}\n", (int)timeout->tv_sec, (int)timeout->tv_usec);
|
||||||
while (timeval_subtract (&diff, timeout, &now) == 0)
|
while (timeval_subtract (&diff, timeout, &now) == 0)
|
||||||
{
|
{
|
||||||
fd_set fs;
|
fd_set fs;
|
||||||
struct timeval wait = {1, 0};
|
struct timeval wait = {1, 0};
|
||||||
// syslog (LOG_INFO, "autoip waiting for data, remaining timeout = {%ds, %dus}\n", (int)diff.tv_sec, (int)diff.tv_usec);
|
// nm_info ("autoip waiting for data, remaining timeout = {%ds, %dus}\n", (int)diff.tv_sec, (int)diff.tv_usec);
|
||||||
|
|
||||||
FD_ZERO (&fs);
|
FD_ZERO (&fs);
|
||||||
FD_SET (sk, &fs);
|
FD_SET (sk, &fs);
|
||||||
@@ -191,14 +192,14 @@ gboolean get_autoip (NMDevice *dev, struct in_addr *out_ip)
|
|||||||
/* open an ARP socket */
|
/* open an ARP socket */
|
||||||
if ((fd = socket (PF_PACKET, SOCK_PACKET, htons (ETH_P_ARP))) < 0)
|
if ((fd = socket (PF_PACKET, SOCK_PACKET, htons (ETH_P_ARP))) < 0)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "%s: Couldn't open network control socket.", nm_device_get_iface (dev));
|
nm_warning ("%s: Couldn't open network control socket.", nm_device_get_iface (dev));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bind to the ARP socket */
|
/* bind to the ARP socket */
|
||||||
if (bind (fd, &saddr, sizeof (saddr)) < 0)
|
if (bind (fd, &saddr, sizeof (saddr)) < 0)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "%s: Couldn't bind to the device.", nm_device_get_iface (dev));
|
nm_warning ("%s: Couldn't bind to the device.", nm_device_get_iface (dev));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +226,7 @@ gboolean get_autoip (NMDevice *dev, struct in_addr *out_ip)
|
|||||||
|
|
||||||
if (nprobes < PROBE_NUM)
|
if (nprobes < PROBE_NUM)
|
||||||
{
|
{
|
||||||
syslog (LOG_INFO, "autoip: Sending probe #%d for IP address %s.", nprobes, inet_ntoa (ip));
|
nm_info ("autoip: Sending probe #%d for IP address %s.", nprobes, inet_ntoa (ip));
|
||||||
arp (fd, &saddr, ARPOP_REQUEST, &addr, null_ip, &null_addr, ip);
|
arp (fd, &saddr, ARPOP_REQUEST, &addr, null_ip, &null_addr, ip);
|
||||||
nprobes++;
|
nprobes++;
|
||||||
gettimeofday (&timeout, NULL);
|
gettimeofday (&timeout, NULL);
|
||||||
@@ -245,7 +246,7 @@ gboolean get_autoip (NMDevice *dev, struct in_addr *out_ip)
|
|||||||
}
|
}
|
||||||
else if (nannounce < ANNOUNCE_NUM)
|
else if (nannounce < ANNOUNCE_NUM)
|
||||||
{
|
{
|
||||||
syslog (LOG_INFO, "autoip: Sending announce #%d for IP address %s.", nannounce, inet_ntoa (ip));
|
nm_info ("autoip: Sending announce #%d for IP address %s.", nannounce, inet_ntoa (ip));
|
||||||
arp (fd, &saddr, ARPOP_REQUEST, &addr, ip, &addr, ip);
|
arp (fd, &saddr, ARPOP_REQUEST, &addr, ip, &addr, ip);
|
||||||
nannounce++;
|
nannounce++;
|
||||||
gettimeofday (&timeout, NULL);
|
gettimeofday (&timeout, NULL);
|
||||||
@@ -260,7 +261,7 @@ gboolean get_autoip (NMDevice *dev, struct in_addr *out_ip)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
syslog (LOG_INFO, "autoip: Waiting for reply...");
|
nm_info ("autoip: Waiting for reply...");
|
||||||
err = peekfd (dev, fd, &timeout);
|
err = peekfd (dev, fd, &timeout);
|
||||||
if ((err == RET_DHCP_ERROR) || (err == RET_DHCP_CEASED))
|
if ((err == RET_DHCP_ERROR) || (err == RET_DHCP_CEASED))
|
||||||
goto out;
|
goto out;
|
||||||
@@ -268,24 +269,24 @@ gboolean get_autoip (NMDevice *dev, struct in_addr *out_ip)
|
|||||||
/* There's some data waiting for us */
|
/* There's some data waiting for us */
|
||||||
if (err == RET_DHCP_SUCCESS)
|
if (err == RET_DHCP_SUCCESS)
|
||||||
{
|
{
|
||||||
syslog (LOG_INFO, "autoip: Got some data to check for reply packet.");
|
nm_info ("autoip: Got some data to check for reply packet.");
|
||||||
|
|
||||||
/* read ARP packet */
|
/* read ARP packet */
|
||||||
if (recv (fd, &p, sizeof (p), 0) < 0)
|
if (recv (fd, &p, sizeof (p), 0) < 0)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "autoip: packet receive failure, ignoring it.");
|
nm_warning ("autoip: packet receive failure, ignoring it.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ARP_DEBUG
|
#ifdef ARP_DEBUG
|
||||||
syslog (LOG_ERR, "autoip: (%s) recv arp type=%d, op=%d, ", nm_device_get_iface (dev), ntohs(p.ethhdr.ether_type), ntohs(p.operation));
|
nm_warning ("autoip: (%s) recv arp type=%d, op=%d, ", nm_device_get_iface (dev), ntohs(p.ethhdr.ether_type), ntohs(p.operation));
|
||||||
{
|
{
|
||||||
struct in_addr a;
|
struct in_addr a;
|
||||||
memcpy (&(a.s_addr), &(p.sInaddr), sizeof (a.s_addr));
|
memcpy (&(a.s_addr), &(p.sInaddr), sizeof (a.s_addr));
|
||||||
syslog (LOG_ERR, " source = %s %02X:%02X:%02X:%02X:%02X:%02X, ", inet_ntoa (a),
|
nm_warning (" source = %s %02X:%02X:%02X:%02X:%02X:%02X, ", inet_ntoa (a),
|
||||||
p.sHaddr[0], p.sHaddr[1], p.sHaddr[2], p.sHaddr[3], p.sHaddr[4], p.sHaddr[5]);
|
p.sHaddr[0], p.sHaddr[1], p.sHaddr[2], p.sHaddr[3], p.sHaddr[4], p.sHaddr[5]);
|
||||||
memcpy (&(a.s_addr), &(p.tInaddr), sizeof (a.s_addr));
|
memcpy (&(a.s_addr), &(p.tInaddr), sizeof (a.s_addr));
|
||||||
syslog (LOG_ERR, " target = %s %02X:%02X:%02X:%02X:%02X:%02X\n", inet_ntoa (a),
|
nm_warning (" target = %s %02X:%02X:%02X:%02X:%02X:%02X\n", inet_ntoa (a),
|
||||||
p.tHaddr[0], p.tHaddr[1], p.tHaddr[2], p.tHaddr[3], p.tHaddr[4], p.tHaddr[5]);
|
p.tHaddr[0], p.tHaddr[1], p.tHaddr[2], p.tHaddr[3], p.tHaddr[4], p.tHaddr[5]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -296,7 +297,7 @@ gboolean get_autoip (NMDevice *dev, struct in_addr *out_ip)
|
|||||||
&& (memcmp (&addr, &p.tHaddr, ETH_ALEN) != 0))
|
&& (memcmp (&addr, &p.tHaddr, ETH_ALEN) != 0))
|
||||||
{
|
{
|
||||||
#ifdef ARP_DEBUG
|
#ifdef ARP_DEBUG
|
||||||
syslog(LOG_ERR, "autoip: (%s) ARP conflict for IP address %s.\n", nm_device_get_iface (dev), inet_ntoa(ip));
|
nm_warning ("autoip: (%s) ARP conflict for IP address %s.\n", nm_device_get_iface (dev), inet_ntoa(ip));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Ok, start all over again */
|
/* Ok, start all over again */
|
||||||
|
@@ -168,7 +168,7 @@ gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
|
|||||||
iface, inet_ntoa (temp_addr));
|
iface, inet_ntoa (temp_addr));
|
||||||
if ((err = nm_spawn_process (buf)))
|
if ((err = nm_spawn_process (buf)))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Error: Duplicate address '%s' detected for "
|
nm_warning ("Error: Duplicate address '%s' detected for "
|
||||||
"device '%s' \n", iface, inet_ntoa (temp_addr));
|
"device '%s' \n", iface, inet_ntoa (temp_addr));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@@ -185,7 +185,7 @@ gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
|
|||||||
g_free (s_tmp2);
|
g_free (s_tmp2);
|
||||||
if ((err = nm_spawn_process (buf)))
|
if ((err = nm_spawn_process (buf)))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Error: could not set network configuration for "
|
nm_warning ("Error: could not set network configuration for "
|
||||||
"device '%s' using command:\n '%s'",
|
"device '%s' using command:\n '%s'",
|
||||||
iface, buf);
|
iface, buf);
|
||||||
goto error;
|
goto error;
|
||||||
@@ -210,7 +210,7 @@ gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
|
|||||||
inet_ntoa (temp_addr), iface);
|
inet_ntoa (temp_addr), iface);
|
||||||
if ((err = nm_spawn_process (buf)))
|
if ((err = nm_spawn_process (buf)))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Error: could not set default route using "
|
nm_warning ("Error: could not set default route using "
|
||||||
"command:\n '%s'", buf);
|
"command:\n '%s'", buf);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@@ -426,7 +426,7 @@ void nm_system_device_update_config_info (NMDevice *dev)
|
|||||||
|
|
||||||
if (!use_dhcp && (!ip4_address || !ip4_gateway || !ip4_netmask))
|
if (!use_dhcp && (!ip4_address || !ip4_gateway || !ip4_netmask))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Error: network configuration for device '%s' was invalid (non-DHCP configuration,"
|
nm_warning ("Error: network configuration for device '%s' was invalid (non-DHCP configuration,"
|
||||||
" but no address/gateway specificed). Will use DHCP instead.\n", nm_device_get_iface (dev));
|
" but no address/gateway specificed). Will use DHCP instead.\n", nm_device_get_iface (dev));
|
||||||
use_dhcp = TRUE;
|
use_dhcp = TRUE;
|
||||||
}
|
}
|
||||||
@@ -443,12 +443,12 @@ void nm_system_device_update_config_info (NMDevice *dev)
|
|||||||
nm_device_config_set_ip4_broadcast (dev, ip4_broadcast);
|
nm_device_config_set_ip4_broadcast (dev, ip4_broadcast);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
syslog (LOG_DEBUG, "------ Config (%s)", nm_device_get_iface (dev));
|
nm_debug ("------ Config (%s)", nm_device_get_iface (dev));
|
||||||
syslog (LOG_DEBUG, " DHCP=%d\n", use_dhcp);
|
nm_debug (" DHCP=%d\n", use_dhcp);
|
||||||
syslog (LOG_DEBUG, " ADDR=%d\n", ip4_address);
|
nm_debug (" ADDR=%d\n", ip4_address);
|
||||||
syslog (LOG_DEBUG, " GW=%d\n", ip4_gateway);
|
nm_debug (" GW=%d\n", ip4_gateway);
|
||||||
syslog (LOG_DEBUG, " NM=%d\n", ip4_netmask);
|
nm_debug (" NM=%d\n", ip4_netmask);
|
||||||
syslog (LOG_DEBUG, "---------------------\n");
|
nm_debug ("---------------------\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@@ -108,7 +108,7 @@ gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
|
|||||||
char *buf;
|
char *buf;
|
||||||
char *addr, *netmask, *broadcast, *gateway;
|
char *addr, *netmask, *broadcast, *gateway;
|
||||||
|
|
||||||
syslog (LOG_WARNING, "nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n");
|
nm_warning ("nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n");
|
||||||
|
|
||||||
/* Extract the addresses back into strings */
|
/* Extract the addresses back into strings */
|
||||||
|
|
||||||
@@ -129,16 +129,16 @@ gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
|
|||||||
|
|
||||||
/* Set the IP/broadcast */
|
/* Set the IP/broadcast */
|
||||||
buf = g_strdup_printf("/sbin/ip addr add local %s dev %s broadcast %s %s", addr, iface, broadcast, iface);
|
buf = g_strdup_printf("/sbin/ip addr add local %s dev %s broadcast %s %s", addr, iface, broadcast, iface);
|
||||||
syslog (LOG_WARNING, "Running: %s", buf);
|
nm_warning ("Running: %s", buf);
|
||||||
/* Set the gateway */
|
/* Set the gateway */
|
||||||
buf = g_strdup_printf("/sbin/ip route replace default dev %s via %s", iface, gateway);
|
buf = g_strdup_printf("/sbin/ip route replace default dev %s via %s", iface, gateway);
|
||||||
syslog (LOG_WARNING, "Running: %s", buf);
|
nm_warning ("Running: %s", buf);
|
||||||
|
|
||||||
/* Inform other computers the we are on network */
|
/* Inform other computers the we are on network */
|
||||||
buf = g_strdup_printf ("/sbin/arping -q -A -c 1 -I %s %s", iface, addr);
|
buf = g_strdup_printf ("/sbin/arping -q -A -c 1 -I %s %s", iface, addr);
|
||||||
syslog (LOG_WARNING, "Running: %s", buf);
|
nm_warning ("Running: %s", buf);
|
||||||
buf = g_strdup_printf ("/sbin/arping -q -U -c 1 -I %s %s", iface, addr);
|
buf = g_strdup_printf ("/sbin/arping -q -U -c 1 -I %s %s", iface, addr);
|
||||||
syslog (LOG_WARNING, "Running: %s", buf);
|
nm_warning ("Running: %s", buf);
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ void nm_system_device_update_config_info (NMDevice *dev)
|
|||||||
if (strncmp (&buffer[strlen(confline) - strlen(nm_device_get_iface (dev))],
|
if (strncmp (&buffer[strlen(confline) - strlen(nm_device_get_iface (dev))],
|
||||||
nm_device_get_iface (dev), strlen(nm_device_get_iface (dev))) != 0)
|
nm_device_get_iface (dev), strlen(nm_device_get_iface (dev))) != 0)
|
||||||
{
|
{
|
||||||
syslog (LOG_WARNING, "System config file '%s' does not define device '%s'\n",
|
nm_warning ("System config file '%s' does not define device '%s'\n",
|
||||||
cfg_file_path, nm_device_get_iface (dev));
|
cfg_file_path, nm_device_get_iface (dev));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "NetworkManagerSystem.h"
|
#include "NetworkManagerSystem.h"
|
||||||
#include "NetworkManagerUtils.h"
|
#include "NetworkManagerUtils.h"
|
||||||
#include "NetworkManagerDevice.h"
|
#include "NetworkManagerDevice.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
#include "shvar.h"
|
#include "shvar.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -183,7 +184,7 @@ gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
|
|||||||
g_free (s_tmp2);
|
g_free (s_tmp2);
|
||||||
if ((err = nm_spawn_process (buf)))
|
if ((err = nm_spawn_process (buf)))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Error: could not set network configuration for device '%s' using command:\n '%s'", iface, buf);
|
nm_warning ("Error: could not set network configuration for device '%s' using command:\n '%s'", iface, buf);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
g_free (buf);
|
g_free (buf);
|
||||||
@@ -203,7 +204,7 @@ gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
|
|||||||
buf = g_strdup_printf ("/sbin/ip route replace default via %s dev %s", inet_ntoa (temp_addr), iface);
|
buf = g_strdup_printf ("/sbin/ip route replace default via %s dev %s", inet_ntoa (temp_addr), iface);
|
||||||
if ((err = nm_spawn_process (buf)))
|
if ((err = nm_spawn_process (buf)))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Error: could not set default route using command\n '%s'", buf);
|
nm_warning ("Error: could not set default route using command\n '%s'", buf);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
g_free (buf);
|
g_free (buf);
|
||||||
@@ -293,7 +294,7 @@ void nm_system_update_dns (void)
|
|||||||
if (nm_spawn_process ("/etc/init.d/nscd status") != 0)
|
if (nm_spawn_process ("/etc/init.d/nscd status") != 0)
|
||||||
nm_spawn_process ("/etc/init.d/nscd restart");
|
nm_spawn_process ("/etc/init.d/nscd restart");
|
||||||
|
|
||||||
syslog (LOG_ERR, "Clearing nscd hosts cache.");
|
nm_warning ("Clearing nscd hosts cache.");
|
||||||
nm_spawn_process ("/usr/sbin/nscd -i hosts");
|
nm_spawn_process ("/usr/sbin/nscd -i hosts");
|
||||||
#else
|
#else
|
||||||
nm_spawn_process ("/usr/bin/killall -q nscd");
|
nm_spawn_process ("/usr/bin/killall -q nscd");
|
||||||
@@ -332,7 +333,7 @@ void nm_system_restart_mdns_responder (void)
|
|||||||
fclose (fp);
|
fclose (fp);
|
||||||
if (res == 1)
|
if (res == 1)
|
||||||
{
|
{
|
||||||
syslog (LOG_INFO, "Restarting mDNSResponder.\n");
|
nm_info ("Restarting mDNSResponder.\n");
|
||||||
kill (pid, SIGUSR1);
|
kill (pid, SIGUSR1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -469,7 +470,7 @@ void nm_system_device_update_config_info (NMDevice *dev)
|
|||||||
|
|
||||||
if (!use_dhcp && (!ip4_address || !ip4_gateway || !ip4_netmask))
|
if (!use_dhcp && (!ip4_address || !ip4_gateway || !ip4_netmask))
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Error: network configuration for device '%s' was invalid (non-DCHP configuration,"
|
nm_warning ("Error: network configuration for device '%s' was invalid (non-DCHP configuration,"
|
||||||
" but no address/gateway specificed). Will use DHCP instead.\n", nm_device_get_iface (dev));
|
" but no address/gateway specificed). Will use DHCP instead.\n", nm_device_get_iface (dev));
|
||||||
use_dhcp = TRUE;
|
use_dhcp = TRUE;
|
||||||
}
|
}
|
||||||
@@ -486,12 +487,12 @@ void nm_system_device_update_config_info (NMDevice *dev)
|
|||||||
nm_device_config_set_ip4_broadcast (dev, ip4_broadcast);
|
nm_device_config_set_ip4_broadcast (dev, ip4_broadcast);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
syslog (LOG_DEBUG, "------ Config (%s)", nm_device_get_iface (dev));
|
nm_debug ("------ Config (%s)", nm_device_get_iface (dev));
|
||||||
syslog (LOG_DEBUG, " DHCP=%d\n", use_dhcp);
|
nm_debug (" DHCP=%d\n", use_dhcp);
|
||||||
syslog (LOG_DEBUG, " ADDR=%d\n", ip4_address);
|
nm_debug (" ADDR=%d\n", ip4_address);
|
||||||
syslog (LOG_DEBUG, " GW=%d\n", ip4_gateway);
|
nm_debug (" GW=%d\n", ip4_gateway);
|
||||||
syslog (LOG_DEBUG, " NM=%d\n", ip4_netmask);
|
nm_debug (" NM=%d\n", ip4_netmask);
|
||||||
syslog (LOG_DEBUG, "---------------------\n");
|
nm_debug ("---------------------\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@@ -96,7 +96,7 @@ void nm_system_device_flush_addresses (NMDevice *dev)
|
|||||||
*/
|
*/
|
||||||
gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
|
gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
|
||||||
{
|
{
|
||||||
syslog (LOG_WARNING, "nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n");
|
nm_warning ("nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -74,7 +74,7 @@ void ifparser_init()
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (inp == NULL)
|
if (inp == NULL)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Error: Can't open %s\n",INTERFACES);
|
nm_warning ("Error: Can't open %s\n",INTERFACES);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
first = last = NULL;
|
first = last = NULL;
|
||||||
@@ -93,7 +93,7 @@ void ifparser_init()
|
|||||||
SPACE_OR_TAB(line,space)
|
SPACE_OR_TAB(line,space)
|
||||||
if (space == NULL)
|
if (space == NULL)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Error: Can't parse interface line '%s'\n",line);
|
nm_warning ("Error: Can't parse interface line '%s'\n",line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
space[0] = '\0';
|
space[0] = '\0';
|
||||||
@@ -104,7 +104,7 @@ void ifparser_init()
|
|||||||
char *space2 = strchr(space+1,' ');
|
char *space2 = strchr(space+1,' ');
|
||||||
if (space2 == NULL)
|
if (space2 == NULL)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Error: Can't parse iface line '%s'\n",space+1);
|
nm_warning ("Error: Can't parse iface line '%s'\n",space+1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
space2[0]='\0';
|
space2[0]='\0';
|
||||||
@@ -115,7 +115,7 @@ void ifparser_init()
|
|||||||
space = strchr(space2+1,' ');
|
space = strchr(space2+1,' ');
|
||||||
if (space == NULL)
|
if (space == NULL)
|
||||||
{
|
{
|
||||||
syslog (LOG_ERR, "Error: Can't parse data '%s'\n",space2+1);
|
nm_warning ("Error: Can't parse data '%s'\n",space2+1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
space[0] = '\0';
|
space[0] = '\0';
|
||||||
|
@@ -190,8 +190,8 @@ static DBusMessage *nm_dbus_nm_set_active_device (DBusConnection *connection, DB
|
|||||||
reply = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "InvalidArguments",
|
reply = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "InvalidArguments",
|
||||||
"NetworkManager::setActiveDevice called with invalid arguments.");
|
"NetworkManager::setActiveDevice called with invalid arguments.");
|
||||||
goto out;
|
goto out;
|
||||||
} else syslog (LOG_INFO, "FORCE: device '%s'", dev_path);
|
} else nm_info ("FORCE: device '%s'", dev_path);
|
||||||
} else syslog (LOG_INFO, "FORCE: device '%s', network '%s'", dev_path, network);
|
} else nm_info ("FORCE: device '%s', network '%s'", dev_path, network);
|
||||||
|
|
||||||
dev_path = nm_dbus_unescape_object_path (dev_path);
|
dev_path = nm_dbus_unescape_object_path (dev_path);
|
||||||
|
|
||||||
@@ -224,7 +224,6 @@ out:
|
|||||||
return (reply);
|
return (reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_dbus_nm_create_wireless_network
|
* nm_dbus_nm_create_wireless_network
|
||||||
*
|
*
|
||||||
@@ -256,7 +255,7 @@ static DBusMessage *nm_dbus_nm_create_wireless_network (DBusConnection *connecti
|
|||||||
reply = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "InvalidArguments",
|
reply = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "InvalidArguments",
|
||||||
"NetworkManager::createWirelessNetwork called with invalid arguments.");
|
"NetworkManager::createWirelessNetwork called with invalid arguments.");
|
||||||
return (reply);
|
return (reply);
|
||||||
} else syslog (LOG_INFO, "Creating network '%s' on device '%s'.", network, dev_path);
|
} else nm_info ("Creating network '%s' on device '%s'.", network, dev_path);
|
||||||
|
|
||||||
dev_path = nm_dbus_unescape_object_path (dev_path);
|
dev_path = nm_dbus_unescape_object_path (dev_path);
|
||||||
dev = nm_dbus_get_device_from_object_path (data->data, dev_path);
|
dev = nm_dbus_get_device_from_object_path (data->data, dev_path);
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
#include "nm-netlink-monitor.h"
|
#include "nm-netlink-monitor.h"
|
||||||
|
#include "nm-utils.h"
|
||||||
|
|
||||||
#define NM_NETLINK_MONITOR_EVENT_CONDITIONS \
|
#define NM_NETLINK_MONITOR_EVENT_CONDITIONS \
|
||||||
((GIOCondition) (G_IO_IN | G_IO_PRI))
|
((GIOCondition) (G_IO_IN | G_IO_PRI))
|
||||||
@@ -225,7 +226,6 @@ nm_netlink_monitor_init (NmNetlinkMonitor *monitor)
|
|||||||
monitor->priv = G_TYPE_INSTANCE_GET_PRIVATE (monitor,
|
monitor->priv = G_TYPE_INSTANCE_GET_PRIVATE (monitor,
|
||||||
NM_TYPE_NETLINK_MONITOR,
|
NM_TYPE_NETLINK_MONITOR,
|
||||||
NmNetlinkMonitorPrivate);
|
NmNetlinkMonitorPrivate);
|
||||||
|
|
||||||
monitor->priv->context = NULL;
|
monitor->priv->context = NULL;
|
||||||
monitor->priv->io_channel = NULL;
|
monitor->priv->io_channel = NULL;
|
||||||
monitor->priv->event_source = NULL;
|
monitor->priv->event_source = NULL;
|
||||||
@@ -313,10 +313,113 @@ nm_netlink_monitor_detach (NmNetlinkMonitor *monitor)
|
|||||||
monitor->priv->context = NULL;
|
monitor->priv->context = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
nm_netlink_monitor_request_status (NmNetlinkMonitor *monitor)
|
nm_netlink_monitor_request_status (NmNetlinkMonitor *monitor,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
struct nlmsghdr header;
|
||||||
|
struct rtgenmsg request;
|
||||||
|
} NmNetlinkMonitorStatusPacket;
|
||||||
|
NmNetlinkMonitorStatusPacket packet = { { 0 } };
|
||||||
|
struct sockaddr_nl recipient = { 0 };
|
||||||
|
static guint32 sequence_number;
|
||||||
|
int fd, saved_errno;
|
||||||
|
ssize_t num_bytes_sent;
|
||||||
|
size_t num_bytes_to_send, total_bytes_sent;
|
||||||
|
gdouble max_wait_period, now;
|
||||||
|
const gchar *buffer;
|
||||||
|
GError *socket_error;
|
||||||
|
|
||||||
|
fd = g_io_channel_unix_get_fd (monitor->priv->io_channel);
|
||||||
|
|
||||||
|
recipient.nl_family = AF_NETLINK;
|
||||||
|
recipient.nl_pid = 0; /* going to kernel */
|
||||||
|
recipient.nl_groups = RTMGRP_LINK;
|
||||||
|
|
||||||
|
packet.header.nlmsg_len = NLMSG_LENGTH (sizeof (struct rtgenmsg));
|
||||||
|
packet.header.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
|
||||||
|
packet.header.nlmsg_type = RTM_GETLINK;
|
||||||
|
packet.header.nlmsg_pid = getpid ();
|
||||||
|
/* Might be good to generate a unique sequence number and track
|
||||||
|
the response */
|
||||||
|
packet.header.nlmsg_seq = sequence_number << 16;
|
||||||
|
sequence_number++;
|
||||||
|
|
||||||
|
packet.request.rtgen_family = AF_UNSPEC;
|
||||||
|
|
||||||
|
nm_get_timestamp (&now);
|
||||||
|
|
||||||
|
/* only block for around 1.5 seconds
|
||||||
|
* FIXME: maybe too long? */
|
||||||
|
max_wait_period = now + 1.5;
|
||||||
|
num_bytes_sent = 0;
|
||||||
|
buffer = (const gchar *) &packet;
|
||||||
|
num_bytes_to_send = sizeof (packet);
|
||||||
|
total_bytes_sent = 0;
|
||||||
|
socket_error = NULL;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
num_bytes_sent = sendto (fd,
|
||||||
|
buffer + total_bytes_sent,
|
||||||
|
num_bytes_to_send,
|
||||||
|
MSG_DONTWAIT,
|
||||||
|
(struct sockaddr *) &recipient,
|
||||||
|
sizeof (recipient));
|
||||||
|
if (num_bytes_sent < 0)
|
||||||
|
{
|
||||||
|
saved_errno = errno;
|
||||||
|
|
||||||
|
if ((saved_errno == EAGAIN) ||
|
||||||
|
(saved_errno == EWOULDBLOCK))
|
||||||
|
{
|
||||||
|
nm_get_timestamp (&now);
|
||||||
|
if ((max_wait_period - now) > G_MINDOUBLE)
|
||||||
|
{
|
||||||
|
saved_errno = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
socket_error =
|
||||||
|
g_error_new (NM_NETLINK_MONITOR_ERROR,
|
||||||
|
NM_NETLINK_MONITOR_ERROR_SENDING_TO_SOCKET,
|
||||||
|
"%s", g_strerror (saved_errno));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
total_bytes_sent += num_bytes_sent;
|
||||||
|
num_bytes_to_send -= num_bytes_sent;
|
||||||
|
|
||||||
|
nm_get_timestamp (&now);
|
||||||
|
|
||||||
|
if ((max_wait_period - now) < G_MINDOUBLE)
|
||||||
|
{
|
||||||
|
socket_error =
|
||||||
|
g_error_new (NM_NETLINK_MONITOR_ERROR,
|
||||||
|
NM_NETLINK_MONITOR_ERROR_SENDING_TO_SOCKET,
|
||||||
|
_("operation took too long"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (num_bytes_to_send > 0);
|
||||||
|
|
||||||
|
if (socket_error != NULL)
|
||||||
|
{
|
||||||
|
if (error != NULL)
|
||||||
|
g_propagate_error (error, socket_error);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_signal_emit (G_OBJECT (monitor),
|
||||||
|
nm_netlink_monitor_signals[ERROR],
|
||||||
|
0, socket_error);
|
||||||
|
g_error_free (socket_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -427,7 +530,7 @@ receive_pending_bytes (GIOChannel *channel,
|
|||||||
if (saved_errno != 0)
|
if (saved_errno != 0)
|
||||||
{
|
{
|
||||||
g_set_error (error, NM_NETLINK_MONITOR_ERROR,
|
g_set_error (error, NM_NETLINK_MONITOR_ERROR,
|
||||||
NM_NETLINK_MONITOR_ERROR_READING_SOCKET,
|
NM_NETLINK_MONITOR_ERROR_READING_FROM_SOCKET,
|
||||||
_("%s"), g_strerror (saved_errno));
|
_("%s"), g_strerror (saved_errno));
|
||||||
succeeded = FALSE;
|
succeeded = FALSE;
|
||||||
goto out;
|
goto out;
|
||||||
|
@@ -68,7 +68,8 @@ enum _NmNetlinkMonitorError
|
|||||||
NM_NETLINK_MONITOR_ERROR_BINDING_TO_SOCKET,
|
NM_NETLINK_MONITOR_ERROR_BINDING_TO_SOCKET,
|
||||||
NM_NETLINK_MONITOR_ERROR_BAD_SENDER,
|
NM_NETLINK_MONITOR_ERROR_BAD_SENDER,
|
||||||
NM_NETLINK_MONITOR_ERROR_BAD_SOCKET_DATA,
|
NM_NETLINK_MONITOR_ERROR_BAD_SOCKET_DATA,
|
||||||
NM_NETLINK_MONITOR_ERROR_READING_SOCKET
|
NM_NETLINK_MONITOR_ERROR_READING_FROM_SOCKET,
|
||||||
|
NM_NETLINK_MONITOR_ERROR_SENDING_TO_SOCKET
|
||||||
};
|
};
|
||||||
|
|
||||||
GType nm_netlink_monitor_get_type (void) G_GNUC_CONST;
|
GType nm_netlink_monitor_get_type (void) G_GNUC_CONST;
|
||||||
@@ -84,6 +85,7 @@ void nm_netlink_monitor_attach (NmNetlinkMonitor *monitor,
|
|||||||
GMainContext *context);
|
GMainContext *context);
|
||||||
void nm_netlink_monitor_detach (NmNetlinkMonitor *monitor);
|
void nm_netlink_monitor_detach (NmNetlinkMonitor *monitor);
|
||||||
|
|
||||||
void nm_netlink_monitor_request_status (NmNetlinkMonitor *monitor);
|
gboolean nm_netlink_monitor_request_status (NmNetlinkMonitor *monitor,
|
||||||
|
GError **error);
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
#endif /* NM_NETLINK_MONITOR_H */
|
#endif /* NM_NETLINK_MONITOR_H */
|
||||||
|
@@ -66,7 +66,6 @@ char * get_network_string_property (DBusConnection *connection, char *network, c
|
|||||||
if (dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &string, DBUS_TYPE_INVALID) && string)
|
if (dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &string, DBUS_TYPE_INVALID) && string)
|
||||||
{
|
{
|
||||||
ret_string = g_strdup (string);
|
ret_string = g_strdup (string);
|
||||||
dbus_free (string);
|
|
||||||
}
|
}
|
||||||
dbus_message_unref (reply);
|
dbus_message_unref (reply);
|
||||||
|
|
||||||
@@ -193,7 +192,7 @@ void get_networks_of_type (DBusConnection *connection, NMNetworkType type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_free_string_array (networks);
|
g_strfreev (networks);
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_user_key_for_network (DBusConnection *connection)
|
void get_user_key_for_network (DBusConnection *connection)
|
||||||
@@ -223,10 +222,10 @@ void get_user_key_for_network (DBusConnection *connection)
|
|||||||
void set_user_key_for_network (DBusConnection *connection, DBusMessage *message, GMainLoop *loop)
|
void set_user_key_for_network (DBusConnection *connection, DBusMessage *message, GMainLoop *loop)
|
||||||
{
|
{
|
||||||
DBusError error;
|
DBusError error;
|
||||||
char *device;
|
const char *device;
|
||||||
char *network;
|
const char *network;
|
||||||
char *passphrase;
|
const char *passphrase;
|
||||||
char *key_type_string;
|
const char *key_type_string;
|
||||||
|
|
||||||
g_return_if_fail (connection != NULL);
|
g_return_if_fail (connection != NULL);
|
||||||
g_return_if_fail (message != NULL);
|
g_return_if_fail (message != NULL);
|
||||||
@@ -241,10 +240,6 @@ void set_user_key_for_network (DBusConnection *connection, DBusMessage *message,
|
|||||||
{
|
{
|
||||||
fprintf( stderr, "Device was '%s'\nNetwork was '%s'\nPassphrase was '%s'\nKey type was '%s'\n", device, network, passphrase, key_type_string);
|
fprintf( stderr, "Device was '%s'\nNetwork was '%s'\nPassphrase was '%s'\nKey type was '%s'\n", device, network, passphrase, key_type_string);
|
||||||
|
|
||||||
dbus_free (device);
|
|
||||||
dbus_free (network);
|
|
||||||
dbus_free (passphrase);
|
|
||||||
dbus_free (key_type_string);
|
|
||||||
|
|
||||||
g_main_loop_quit (loop);
|
g_main_loop_quit (loop);
|
||||||
}
|
}
|
||||||
|
76
test/nmnetlinktest.c
Normal file
76
test/nmnetlinktest.c
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <asm/types.h>
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/netlink.h>
|
||||||
|
#include <linux/rtnetlink.h>
|
||||||
|
#include <linux/if.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <nm-netlink-monitor.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
device_added (NmNetlinkMonitor *monitor,
|
||||||
|
const gchar *device_name)
|
||||||
|
{
|
||||||
|
g_print ("interface '%s' connected\n", device_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
device_removed (NmNetlinkMonitor *monitor,
|
||||||
|
const gchar *device_name)
|
||||||
|
{
|
||||||
|
g_print ("interface '%s' disconnected\n", device_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
NmNetlinkMonitor *monitor;
|
||||||
|
GMainLoop *loop;
|
||||||
|
GError *error;
|
||||||
|
|
||||||
|
g_type_init ();
|
||||||
|
|
||||||
|
monitor = nm_netlink_monitor_new ();
|
||||||
|
|
||||||
|
error = NULL;
|
||||||
|
nm_netlink_monitor_open_connection (monitor, &error);
|
||||||
|
|
||||||
|
if (error != NULL)
|
||||||
|
{
|
||||||
|
g_printerr ("could not open connection: %s\n",
|
||||||
|
error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
loop = g_main_loop_new (NULL, FALSE);
|
||||||
|
|
||||||
|
g_signal_connect (G_OBJECT (monitor),
|
||||||
|
"interface-connected",
|
||||||
|
G_CALLBACK (device_added), NULL);
|
||||||
|
|
||||||
|
g_signal_connect (G_OBJECT (monitor),
|
||||||
|
"interface-disconnected",
|
||||||
|
G_CALLBACK (device_removed), NULL);
|
||||||
|
|
||||||
|
nm_netlink_monitor_attach (monitor, NULL);
|
||||||
|
|
||||||
|
nm_netlink_monitor_request_status (monitor, &error);
|
||||||
|
|
||||||
|
if (error != NULL)
|
||||||
|
{
|
||||||
|
g_printerr ("could not request status of interfaces: %s\n",
|
||||||
|
error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_main_loop_run (loop);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@@ -296,10 +296,10 @@ void print_device_networks (DBusConnection *connection, const char *path)
|
|||||||
|
|
||||||
fprintf( stderr, " %s (%s) Strength: %d%%\n", networks[i], name,
|
fprintf( stderr, " %s (%s) Strength: %d%%\n", networks[i], name,
|
||||||
get_object_signal_strength (connection, networks[i]) );
|
get_object_signal_strength (connection, networks[i]) );
|
||||||
dbus_free (name);
|
g_free (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_free_string_array (networks);
|
g_strfreev (networks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@ void print_devices (DBusConnection *connection)
|
|||||||
fprintf (stderr, " Device type: wireless\n");
|
fprintf (stderr, " Device type: wireless\n");
|
||||||
fprintf (stderr, " Strength: %d%%\n", get_object_signal_strength (connection, devices[i]));
|
fprintf (stderr, " Strength: %d%%\n", get_object_signal_strength (connection, devices[i]));
|
||||||
fprintf (stderr, " Active Network: '%s'\n", active_network);
|
fprintf (stderr, " Active Network: '%s'\n", active_network);
|
||||||
dbus_free (active_network);
|
g_free (active_network);
|
||||||
|
|
||||||
print_device_networks (connection, devices[i]);
|
print_device_networks (connection, devices[i]);
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
@@ -338,7 +338,7 @@ void print_devices (DBusConnection *connection)
|
|||||||
fprintf (stderr, " Device type: unknown\n");
|
fprintf (stderr, " Device type: unknown\n");
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
}
|
}
|
||||||
dbus_free_string_array (devices);
|
g_strfreev (devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@ int main( int argc, char *argv[] )
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
fprintf (stderr, "NM Status: '%s'\n", status);
|
fprintf (stderr, "NM Status: '%s'\n", status);
|
||||||
dbus_free (status);
|
g_free (status);
|
||||||
|
|
||||||
path = get_active_device (connection);
|
path = get_active_device (connection);
|
||||||
fprintf (stderr, "Active device: '%s'\n", path ? path : "(none)");
|
fprintf (stderr, "Active device: '%s'\n", path ? path : "(none)");
|
||||||
@@ -408,7 +408,7 @@ int main( int argc, char *argv[] )
|
|||||||
{
|
{
|
||||||
char *name = get_object_name (connection, path);
|
char *name = get_object_name (connection, path);
|
||||||
fprintf (stderr, "Active device name: '%s'\n", name ? name : "(none)");
|
fprintf (stderr, "Active device name: '%s'\n", name ? name : "(none)");
|
||||||
dbus_free (name);
|
g_free (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_devices (connection);
|
print_devices (connection);
|
||||||
@@ -419,7 +419,7 @@ int main( int argc, char *argv[] )
|
|||||||
set_device_network (connection, path, argv[1]);
|
set_device_network (connection, path, argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_free (path);
|
g_free (path);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,78 @@
|
|||||||
#ifndef NM_UTILS_H
|
#ifndef NM_UTILS_H
|
||||||
#define NM_UTILS_H
|
#define NM_UTILS_H
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <execinfo.h>
|
||||||
|
|
||||||
|
#define nm_print_backtrace() \
|
||||||
|
G_STMT_START \
|
||||||
|
{ \
|
||||||
|
void *_call_stack[512]; \
|
||||||
|
int _call_stack_size; \
|
||||||
|
char **_symbols; \
|
||||||
|
_call_stack_size = backtrace (_call_stack, \
|
||||||
|
G_N_ELEMENTS (_call_stack)); \
|
||||||
|
_symbols = backtrace_symbols (_call_stack, _call_stack_size); \
|
||||||
|
if (_symbols != NULL) \
|
||||||
|
{ \
|
||||||
|
int _i; \
|
||||||
|
_i = 0; \
|
||||||
|
g_critical ("traceback:\n"); \
|
||||||
|
while (_i < _call_stack_size) \
|
||||||
|
{ \
|
||||||
|
g_critical ("\t%s\n", _symbols[_i]); \
|
||||||
|
_i++; \
|
||||||
|
} \
|
||||||
|
free (_symbols); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
G_STMT_END
|
||||||
|
|
||||||
|
#define nm_get_timestamp(timestamp) \
|
||||||
|
G_STMT_START \
|
||||||
|
{ \
|
||||||
|
GTimeVal _tv; \
|
||||||
|
g_get_current_time (&_tv); \
|
||||||
|
*timestamp = (_tv.tv_sec * (1.0 * G_USEC_PER_SEC) + \
|
||||||
|
_tv.tv_usec) / G_USEC_PER_SEC; \
|
||||||
|
} \
|
||||||
|
G_STMT_END
|
||||||
|
|
||||||
|
#define nm_info(fmt, args...) \
|
||||||
|
G_STMT_START \
|
||||||
|
{ \
|
||||||
|
g_message ("<information>\t" fmt "\n", ##args); \
|
||||||
|
} G_STMT_END
|
||||||
|
|
||||||
|
#define nm_debug(fmt, args...) \
|
||||||
|
G_STMT_START \
|
||||||
|
{ \
|
||||||
|
gdouble _timestamp; \
|
||||||
|
nm_get_timestamp (&_timestamp); \
|
||||||
|
g_debug ("<debug info>\t[%f] %s (): " fmt "\n", _timestamp, \
|
||||||
|
G_GNUC_PRETTY_FUNCTION, ##args); \
|
||||||
|
} G_STMT_END
|
||||||
|
|
||||||
|
#define nm_warning(fmt, args...) \
|
||||||
|
G_STMT_START \
|
||||||
|
{ \
|
||||||
|
g_warning ("<WARNING>\t %s (): " fmt "\n", \
|
||||||
|
G_GNUC_PRETTY_FUNCTION, ##args); \
|
||||||
|
} G_STMT_END
|
||||||
|
|
||||||
|
#define nm_error(fmt, args...) \
|
||||||
|
G_STMT_START \
|
||||||
|
{ \
|
||||||
|
gdouble _timestamp; \
|
||||||
|
nm_get_timestamp (&_timestamp); \
|
||||||
|
g_critical ("<ERROR>\t[%f] %s (): " fmt "\n", _timestamp, \
|
||||||
|
G_GNUC_PRETTY_FUNCTION, ##args); \
|
||||||
|
nm_print_backtrace (); \
|
||||||
|
G_BREAKPOINT (); \
|
||||||
|
} G_STMT_END
|
||||||
|
|
||||||
|
|
||||||
gchar *nm_dbus_escape_object_path (const gchar *utf8_string);
|
gchar *nm_dbus_escape_object_path (const gchar *utf8_string);
|
||||||
gchar *nm_dbus_unescape_object_path (const gchar *object_path);
|
gchar *nm_dbus_unescape_object_path (const gchar *object_path);
|
||||||
|
|
||||||
#endif
|
#endif /* NM_UTILS_H */
|
||||||
|
Reference in New Issue
Block a user