Commit a4afafce authored by Dan Willemsen's avatar Dan Willemsen Committed by Dan Williams
Browse files

2004-08-23 Dan Willemsen <dan@willemsen.us>

	* dispatcher-daemon/NetworkManagerDispatcher.c
	  info-daemon/NetworkManagerInfo.[ch]
	  info-daemon/NetworkManagerInfoDbus.c
	  info-daemon/NetworkManagerInfoPassphraseDialog.c
	  src/NetworkManager.c
	  src/NetworkManagerAP.c
	  src/NetworkManagerAPList.c
	  src/NetworkManagerDbus.c
	  src/NetworkManagerDevice.c
	  src/NetworkManagerPolicy.c
	  src/NetworkManagerUtils.[ch]
	  src/NetworkManagerWireless.c
		- Used syslog functions for logging instead of NM_DEBUG_DISPLAY & fprintf

	* src/NetworkManager.c
		- Fixed usage wording for --no-daemon


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@61 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 07258fd5
2004-08-23 Dan Willemsen <dan@willemsen.us>
* dispatcher-daemon/NetworkManagerDispatcher.c
info-daemon/NetworkManagerInfo.[ch]
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoPassphraseDialog.c
src/NetworkManager.c
src/NetworkManagerAP.c
src/NetworkManagerAPList.c
src/NetworkManagerDbus.c
src/NetworkManagerDevice.c
src/NetworkManagerPolicy.c
src/NetworkManagerUtils.[ch]
src/NetworkManagerWireless.c
- Used syslog functions for logging instead of NM_DEBUG_DISPLAY & fprintf
* src/NetworkManager.c
- Fixed usage wording for --no-daemon
2004-08-23 Dan Williams <dcbw@redhat.com>
* panel-applet/NMWirelessApplet.c
......
......@@ -28,14 +28,11 @@ Wireless link checking could be enhanced to check the signal strength of an acce
There is currently no logic to gracefully recover from a crashed/killed dbus or hal. While we don't depend as heavily on NetworkManagerInfo, we need to make sure that we can operate effectively when it's not there. There are dbus functions for notification when services come up and go away which could be used here. Remeber that when dbus dies, hal also dies at the moment.
- Proper logging support
We need to replace NM_DEBUG_PRINT with proper logging support to syslog or something.
- Deal with blank ESSIDs
Access points can be set not to broadcast their ESSIDs, which the client must know. These appear as blank ESSIDs to cards doing wireless scanning, even though the rest of the AP's information is known (channel, rate, etc). There has to be a way to deal with this as many companies do not broadcast ESSIDs for security measures. Workarounds for this practice could include brute-forcing the Allowed Networks list if no suitable wireless network is found to begin with. Obviously, there would be no way to detect if a WEP key was wrong, because unless the ESSID and WEP key are both correct, we cannot associate with the access point to see if we have a link. Code exists to do this for wireless cards that do not support wireless scanning, and this code could be adapted.
- Shorten standoff time between Pending and Active device promotion
Currently, there is a 2 second wait between when a device is set as the Pending device, to when it may be promoted to Active device. 2 seconds is not technically necessary, the only reason to wait is that the GLib main loop must run at least once to deliver and receive queued up messages. This wait is also only necessary for wireless cards, where we may need to request a key from the user. This wait should be eliminated without breaking the Pending/Active device mechanism.
......
......@@ -27,6 +27,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
......@@ -67,7 +68,7 @@ void nmd_execute_scripts (NMDAction action, char *iface_name, guint32 new_ip4_ad
if (!dir)
{
fprintf (stderr, "nmd_execute_scripts(): opendir() could not open /etc/NetworkManager.d. errno = %d\n", errno);
syslog (LOG_ERR, "nmd_execute_scripts(): opendir() could not open /etc/NetworkManager.d. errno = %d", errno);
return;
}
......@@ -124,7 +125,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")))
{
fprintf (stderr, "Couldn't allocate the dbus message\n");
syslog (LOG_ERR, "Couldn't allocate the dbus message");
return (NULL);
}
......@@ -132,14 +133,14 @@ char * nmd_get_device_name (DBusConnection *connection, char *path)
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
if (dbus_error_is_set (&error))
{
fprintf (stderr, "%s raised:\n %s\n\n", error.name, error.message);
syslog (LOG_ERR, "%s raised: %s", error.name, error.message);
dbus_message_unref (message);
return (NULL);
}
if (reply == NULL)
{
fprintf( stderr, "dbus reply message was NULL\n" );
syslog( LOG_ERR, "dbus reply message was NULL" );
dbus_message_unref (message);
return (NULL);
}
......@@ -148,7 +149,7 @@ char * nmd_get_device_name (DBusConnection *connection, char *path)
dbus_error_init (&error);
if (!dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &dev_name, DBUS_TYPE_INVALID))
{
fprintf (stderr, "There was an error getting the device name from NetworkManager." );
syslog (LOG_ERR, "There was an error getting the device name from NetworkManager." );
dev_name = NULL;
}
......@@ -173,7 +174,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")))
{
fprintf (stderr, "Couldn't allocate the dbus message\n");
syslog (LOG_ERR, "Couldn't allocate the dbus message");
return (0);
}
......@@ -181,14 +182,14 @@ guint32 nmd_get_device_ip4_address (DBusConnection *connection, char *path)
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
if (dbus_error_is_set (&error))
{
fprintf (stderr, "%s raised:\n %s\n\n", error.name, error.message);
syslog (LOG_ERR, "%s raised: %s", error.name, error.message);
dbus_message_unref (message);
return (0);
}
if (reply == NULL)
{
fprintf( stderr, "dbus reply message was NULL\n" );
syslog( LOG_ERR, "dbus reply message was NULL" );
dbus_message_unref (message);
return (0);
}
......@@ -197,7 +198,7 @@ guint32 nmd_get_device_ip4_address (DBusConnection *connection, char *path)
dbus_error_init (&error);
if (!dbus_message_get_args (reply, &error, DBUS_TYPE_UINT32, &address, DBUS_TYPE_INVALID))
{
fprintf (stderr, "There was an error getting the device's IPv4 address from NetworkManager." );
syslog (LOG_ERR, "There was an error getting the device's IPv4 address from NetworkManager." );
address = 0;
}
......@@ -240,13 +241,13 @@ static DBusHandlerResult nmd_dbus_filter (DBusConnection *connection, DBusMessag
if (action == NMD_DEVICE_NOW_ACTIVE || action == NMD_DEVICE_NOW_INACTIVE)
{
fprintf (stderr, "Device %s (%s) is now %s.\n", dev_object_path, dev_iface_name,
syslog (LOG_NOTICE, "Device %s (%s) is now %s.", dev_object_path, dev_iface_name,
(action == NMD_DEVICE_NOW_INACTIVE ? "down" :
(action == NMD_DEVICE_NOW_ACTIVE ? "up" : "error")));
}
else if (action == NMD_DEVICE_IP4_ADDRESS_CHANGE)
{
fprintf (stderr, "Device %s (%s) now has address %u.%u.%u.%u\n", dev_object_path, dev_iface_name,
syslog (LOG_NOTICE, "Device %s (%s) now has address %u.%u.%u.%u", dev_object_path, dev_iface_name,
NIPQUAD(dev_ip4_address));
}
......@@ -278,7 +279,7 @@ static DBusConnection *nmd_dbus_init (void)
connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
if (connection == NULL)
{
fprintf (stderr, "nmd_dbus_init(): could not connect to the message bus. dbus says: '%s'\n", error.message);
syslog (LOG_ERR, "nmd_dbus_init(): could not connect to the message bus. dbus says: '%s'", error.message);
dbus_error_free (&error);
return (NULL);
}
......@@ -376,13 +377,15 @@ int main( int argc, char *argv[] )
}
}
openlog("NetworkManagerDispatcher", (become_daemon) ? LOG_CONS : LOG_CONS | LOG_PERROR, (become_daemon) ? LOG_DAEMON : LOG_USER);
if (become_daemon)
{
int child_pid;
if (chdir ("/") < 0)
{
fprintf( stderr, "NetworkManagerDispatcher could not chdir to /. errno=%d", errno);
syslog( LOG_CRIT, "NetworkManagerDispatcher could not chdir to /. errno=%d", errno);
return 1;
}
......@@ -390,7 +393,7 @@ int main( int argc, char *argv[] )
switch (child_pid)
{
case -1:
fprintf( stderr, "NetworkManagerDispatcher could not daemonize. errno = %d\n", errno );
syslog( LOG_ERR, "NetworkManagerDispatcher could not daemonize. errno = %d", errno );
break;
case 0:
......
......@@ -184,13 +184,15 @@ int main( int argc, char *argv[] )
GNOME_PARAM_HUMAN_READABLE_NAME, "Network Manager User Info Service",
NULL);
openlog("NetworkManagerInfo", (no_daemon) ? LOG_CONS | LOG_PERROR : LOG_CONS, (no_daemon) ? LOG_USER : LOG_DAEMON);
if (!no_daemon)
{
int child_pid;
if (chdir ("/") < 0)
{
fprintf( stderr, "NetworkManagerInfo could not chdir to /. errno=%d", errno);
syslog( LOG_CRIT, "NetworkManagerInfo could not chdir to /. errno=%d", errno);
return 1;
}
......@@ -198,7 +200,7 @@ int main( int argc, char *argv[] )
switch (child_pid)
{
case -1:
fprintf( stderr, "NetworkManagerInfo could not daemonize. errno = %d\n", errno );
syslog( LOG_ERR, "NetworkManagerInfo could not daemonize. errno = %d", errno );
break;
case 0:
......@@ -214,7 +216,7 @@ int main( int argc, char *argv[] )
app_info = g_new0 (NMIAppInfo, 1);
if (!app_info)
{
fprintf (stderr, "Not enough memory for application data.\n");
syslog (LOG_CRIT, "Not enough memory for application data.");
exit (1);
}
......@@ -227,7 +229,7 @@ int main( int argc, char *argv[] )
dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &dbus_error);
if (dbus_connection == NULL)
{
fprintf (stderr, "NetworkManagerInfo could not get the system bus. Make sure the message bus daemon is running?\n");
syslog (LOG_CRIT, "NetworkManagerInfo could not get the system bus. Make sure the message bus daemon is running?");
exit (1);
}
dbus_connection_set_change_sigpipe (TRUE);
......
......@@ -23,6 +23,7 @@
#ifndef NETWORK_MANAGER_INFO_H
#define NETWORK_MANAGER_INFO_H
#include <syslog.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glade/glade.h>
......
......@@ -126,7 +126,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")))
{
fprintf (stderr, "nmi_dbus_return_user_key(): Couldn't allocate the dbus message\n");
syslog (LOG_ERR, "nmi_dbus_return_user_key(): Couldn't allocate the dbus message");
return;
}
......@@ -137,7 +137,7 @@ void nmi_dbus_return_user_key (DBusConnection *connection, const char *device,
DBUS_TYPE_INVALID))
{
if (!dbus_connection_send (connection, message, NULL))
fprintf (stderr, "nmi_dbus_return_user_key(): dbus could not send the message\n");
syslog (LOG_ERR, "nmi_dbus_return_user_key(): dbus could not send the message");
}
dbus_message_unref (message);
......@@ -171,13 +171,13 @@ void nmi_dbus_signal_update_network (DBusConnection *connection, const char *net
message = dbus_message_new_signal (NMI_DBUS_PATH, NMI_DBUS_INTERFACE, signal);
if (!message)
{
fprintf (stderr, "nmi_dbus_signal_update_network(): Not enough memory for new dbus message!\n");
syslog (LOG_ERR, "nmi_dbus_signal_update_network(): Not enough memory for new dbus message!");
return;
}
dbus_message_append_args (message, DBUS_TYPE_STRING, network, DBUS_TYPE_INVALID);
if (!dbus_connection_send (connection, message, NULL))
fprintf (stderr, "nmi_dbus_signal_update_network(): Could not raise the '%s' signal!\n", signal);
syslog (LOG_WARNING, "nmi_dbus_signal_update_network(): Could not raise the '%s' signal!", signal);
dbus_message_unref (message);
}
......@@ -471,7 +471,7 @@ static DBusHandlerResult nmi_dbus_nmi_message_handler (DBusConnection *connectio
method = dbus_message_get_member (message);
path = dbus_message_get_path (message);
/* fprintf (stderr, "nmi_dbus_nmi_message_handler() got method %s for path %s\n", method, path); */
/* syslog (LOG_DEBUG, "nmi_dbus_nmi_message_handler() got method %s for path %s", method, path); */
if (strcmp ("getKeyForNetwork", method) == 0)
{
......@@ -579,13 +579,13 @@ int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info)
dbus_bus_acquire_service (dbus_connection, NMI_DBUS_SERVICE, 0, &dbus_error);
if (dbus_error_is_set (&dbus_error))
{
fprintf (stderr, "nmi_dbus_service_init() could not acquire its service. dbus_bus_acquire_service() says: '%s'\n", dbus_error.message);
syslog (LOG_ERR, "nmi_dbus_service_init() could not acquire its service. dbus_bus_acquire_service() says: '%s'", dbus_error.message);
return (-1);
}
if (!dbus_connection_register_object_path (dbus_connection, NMI_DBUS_PATH, &nmi_vtable, info))
{
fprintf (stderr, "nmi_dbus_service_init() could not register a handler for NetworkManagerInfo. Not enough memory?\n");
syslog (LOG_ERR, "nmi_dbus_service_init() could not register a handler for NetworkManagerInfo. Not enough memory?");
return (-1);
}
......
......@@ -208,7 +208,7 @@ int nmi_passphrase_dialog_init (NMIAppInfo *info)
info->passphrase_dialog = glade_xml_new(GLADEDIR"/passphrase.glade", NULL, NULL);
if (!info->passphrase_dialog)
{
fprintf (stderr, "Could not open the passphrase dialog glade file!\n");
syslog (LOG_ERR, "Could not open the passphrase dialog glade file!");
return (-1);
}
......
......@@ -91,7 +91,7 @@ NMDevice * nm_create_device_and_add_to_list (NMData *data, const char *udi)
*/
if (nm_try_acquire_mutex (data->dev_list_mutex, __FUNCTION__))
{
NM_DEBUG_PRINT_2( "nm_create_device_and_add_to_list(): adding device '%s' (%s)\n",
syslog( LOG_INFO, "nm_create_device_and_add_to_list(): adding device '%s' (%s)",
nm_device_get_iface (dev), nm_device_is_wireless (dev) ? "wireless" : "wired" );
data->dev_list = g_slist_append (data->dev_list, dev);
......@@ -99,8 +99,8 @@ NMDevice * nm_create_device_and_add_to_list (NMData *data, const char *udi)
success = TRUE;
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
} else NM_DEBUG_PRINT( "nm_create_device_and_add_to_list() could not acquire device list mutex.\n" );
} else NM_DEBUG_PRINT( "nm_create_device_and_add_to_list() could not allocate device data.\n" );
} else syslog( LOG_ERR, "nm_create_device_and_add_to_list() could not acquire device list mutex." );
} else syslog( LOG_ERR, "nm_create_device_and_add_to_list() could not allocate device data." );
hal_free_string (iface_name);
......@@ -164,7 +164,7 @@ void nm_remove_device_from_list (NMData *data, const char *udi)
element = g_slist_next (element);
}
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
} else NM_DEBUG_PRINT( "nm_remove_device_from_list() could not acquire device list mutex.\n" );
} else syslog( LOG_ERR, "nm_remove_device_from_list() could not acquire device list mutex." );
}
......@@ -188,7 +188,7 @@ static void nm_hal_device_added (LibHalContext *ctx, const char *udi)
g_return_if_fail (data != NULL);
NM_DEBUG_PRINT_1( "nm_hal_device_added() called with udi = %s\n", udi );
syslog( LOG_DEBUG, "nm_hal_device_added() called with udi = %s", udi );
/* 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
......@@ -208,7 +208,7 @@ static void nm_hal_device_removed (LibHalContext *ctx, const char *udi)
g_return_if_fail (data != NULL);
NM_DEBUG_PRINT_1( "nm_hal_device_removed() called with udi = %s\n", udi );
syslog( LOG_DEBUG, "nm_hal_device_removed() called with udi = %s", udi );
nm_remove_device_from_list (data, udi);
}
......@@ -224,7 +224,7 @@ static void nm_hal_device_new_capability (LibHalContext *ctx, const char *udi, c
g_return_if_fail (data != NULL);
NM_DEBUG_PRINT_2( "nm_hal_device_new_capability() called with udi = %s, capability = %s\n", udi, capability );
syslog( LOG_DEBUG, "nm_hal_device_new_capability() called with udi = %s, capability = %s", udi, capability );
if (capability && (strcmp (capability, "net.ethernet") == 0))
nm_create_device_and_add_to_list (data, udi);
......@@ -237,7 +237,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)
{
NM_DEBUG_PRINT_2( "nm_hal_device_lost_capability() called with udi = %s, capability = %s\n", udi, capability );
syslog( LOG_DEBUG, "nm_hal_device_lost_capability() called with udi = %s, capability = %s", udi, capability );
}
......@@ -248,7 +248,7 @@ static void nm_hal_device_lost_capability (LibHalContext *ctx, const char *udi,
static void nm_hal_device_property_modified (LibHalContext *ctx, const char *udi, const char *key, dbus_bool_t is_removed, dbus_bool_t is_added)
{
/*
NM_DEBUG_PRINT_4( "nm_hal_device_property_modified() called with udi = %s, key = %s, is_removed = %d, is_added = %d\n", udi, key, is_removed, is_added );
syslog( LOG_DEBUG, "nm_hal_device_property_modified() called with udi = %s, key = %s, is_removed = %d, is_added = %d", udi, key, is_removed, is_added );
*/
}
......@@ -345,7 +345,7 @@ gboolean nm_link_state_monitor (gpointer user_data)
}
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
} else NM_DEBUG_PRINT( "nm_link_state_monitor() could not acquire device list mutex.\n" );
} else syslog( LOG_ERR, "nm_link_state_monitor() could not acquire device list mutex." );
return (TRUE);
}
......@@ -379,7 +379,7 @@ static NMData *nm_data_new (void)
data = g_new0 (NMData, 1);
if (!data)
{
NM_DEBUG_PRINT("Could not allocate our NetworkManager data... Not enough memory?\n");
syslog( LOG_ERR, "Could not allocate our NetworkManager data... Not enough memory?");
return (NULL);
}
......@@ -388,7 +388,7 @@ static NMData *nm_data_new (void)
if (!data->dev_list_mutex)
{
nm_data_free (data);
NM_DEBUG_PRINT("Could not create device list mutex. Whacky shit going on?\n");
syslog( LOG_ERR, "Could not create device list mutex. Whacky shit going on?");
return (NULL);
}
......@@ -397,7 +397,7 @@ static NMData *nm_data_new (void)
if (!data->state_modified_mutex)
{
nm_data_free (data);
NM_DEBUG_PRINT("Could not create state_modified mutex. Whacky stuff going on?\n");
syslog( LOG_ERR, "Could not create state_modified mutex. Whacky stuff going on?");
return (NULL);
}
......@@ -409,7 +409,7 @@ static NMData *nm_data_new (void)
if (!data->trusted_ap_list || !data->preferred_ap_list || !data->invalid_ap_list)
{
nm_data_free (data);
NM_DEBUG_PRINT("Could not create access point lists. Whacky stuff going on?\n");
syslog( LOG_ERR, "Could not create access point lists. Whacky stuff going on?");
return (NULL);
}
......@@ -483,7 +483,7 @@ static void nm_print_usage (void)
fprintf (stderr, "\n" "usage : NetworkManager [--no-daemon] [--help]\n");
fprintf (stderr,
"\n"
" --no-daemon Become a daemon\n"
" --no-daemon Don't become a daemon\n"
" --help Show this information and exit\n"
"\n"
"NetworkManager monitors all network connections and automatically\n"
......@@ -547,6 +547,9 @@ int main( int argc, char *argv[] )
if (!g_thread_supported ())
g_thread_init (NULL);
openlog ("NetworkManager", (become_daemon) ? LOG_CONS : LOG_CONS | LOG_PERROR, (become_daemon) ? LOG_DAEMON : LOG_USER);
syslog (LOG_NOTICE, "starting...");
/* Load all network device kernel modules.
* NOTE: this hack is temporary until device modules get loaded
* on startup by something else. The problem is that unless
......@@ -559,7 +562,7 @@ int main( int argc, char *argv[] )
nm_data = nm_data_new ();
if (!nm_data)
{
NM_DEBUG_PRINT("nm_data_new() failed... Not enough memory?\n");
syslog( LOG_CRIT, "nm_data_new() failed... Not enough memory?");
exit (EXIT_FAILURE);
}
......@@ -567,6 +570,7 @@ int main( int argc, char *argv[] )
nm_data->dbus_connection = nm_dbus_init (nm_data);
if (!nm_data->dbus_connection)
{
syslog( LOG_CRIT, "nm_dbus_init() failed, exiting");
hal_shutdown (nm_data->hal_ctx);
nm_data_free (nm_data);
exit (EXIT_FAILURE);
......@@ -577,7 +581,7 @@ int main( int argc, char *argv[] )
/* Initialize libhal. We get a connection to the hal daemon here. */
if ((ctx = hal_initialize (&hal_functions, FALSE)) == NULL)
{
NM_DEBUG_PRINT("hal_initialize() failed, exiting... Make sure the hal daemon is running?\n");
syslog( LOG_CRIT, "hal_initialize() failed, exiting... Make sure the hal daemon is running?");
exit (EXIT_FAILURE);
}
nm_data->hal_ctx = ctx;
......@@ -614,7 +618,7 @@ int main( int argc, char *argv[] )
if (chdir ("/") < 0)
{
fprintf( stderr, "NetworkManager could not chdir to /. errno=%d", errno);
syslog( LOG_CRIT, "NetworkManager could not chdir to /. errno=%d", errno);
return (1);
}
......@@ -622,7 +626,7 @@ int main( int argc, char *argv[] )
switch (child_pid)
{
case -1:
fprintf( stderr, "NetworkManager could not daemonize. errno = %d\n", errno );
syslog( LOG_ERR, "NetworkManager could not daemonize. errno = %d", errno );
break;
case 0:
......@@ -639,6 +643,8 @@ int main( int argc, char *argv[] )
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
syslog (LOG_NOTICE, "exiting");
/* Kill the watch functions */
g_source_remove (link_source);
g_source_remove (policy_source);
......
......@@ -59,7 +59,7 @@ NMAccessPoint * nm_ap_new (void)
ap = g_new0 (NMAccessPoint, 1);
if (!ap)
NM_DEBUG_PRINT( "nm_ap_new() could not allocate a new user access point info structure. Not enough memory?" )
syslog( LOG_ERR, "nm_ap_new() could not allocate a new user access point info structure. Not enough memory?" );
ap->priority = NM_AP_PRIORITY_WORST;
ap->refcount = 1;
......@@ -86,7 +86,7 @@ NMAccessPoint * nm_ap_new_from_ap (NMAccessPoint *src_ap)
new_ap = nm_ap_new();
if (!new_ap)
NM_DEBUG_PRINT( "nm_ap_new_from_uap() could not allocate a new user access point info structure. Not enough memory?" )
syslog( LOG_ERR, "nm_ap_new_from_uap() could not allocate a new user access point info structure. Not enough memory?" );
new_ap->refcount = 1;
......
......@@ -55,7 +55,7 @@ NMAccessPointList *nm_ap_list_new (NMNetworkType type)
if (!list->mutex)
{
g_free (list);
NM_DEBUG_PRINT ("nm_ap_list_new() could not create list mutex\n");
syslog (LOG_ERR, "nm_ap_list_new() could not create list mutex");
return (NULL);
}
......@@ -130,7 +130,7 @@ void nm_ap_list_append_ap (NMAccessPointList *list, NMAccessPoint *ap)
if (!nm_try_acquire_mutex (list->mutex, __FUNCTION__))
{
NM_DEBUG_PRINT( "nm_ap_list_append_ap() could not acquire AP list mutex.\n" );
syslog( LOG_ERR, "nm_ap_list_append_ap() could not acquire AP list mutex." );
return;
}
......@@ -156,7 +156,7 @@ void nm_ap_list_remove_ap (NMAccessPointList *list, NMAccessPoint *ap)
if (!nm_try_acquire_mutex (list->mutex, __FUNCTION__))
{
NM_DEBUG_PRINT( "nm_ap_list_append_ap() could not acquire AP list mutex.\n" );
syslog( LOG_ERR, "nm_ap_list_append_ap() could not acquire AP list mutex." );
return;
}
......@@ -463,15 +463,15 @@ void nm_ap_list_print_members (NMAccessPointList *list, const char *name)
if (!(iter = nm_ap_list_iter_new (list)))
return;
fprintf (stderr, "AP_LIST_PRINT: printing members of '%s'\n", name);
syslog (LOG_DEBUG, "AP_LIST_PRINT: printing members of '%s'", name);
while ((ap = nm_ap_list_iter_next (iter)))
{
fprintf (stderr, "\t%d)\tessid='%s', prio=%d, key='%s', enc=%d, addr=0x%X, qual=%d, freq=%f, rate=%d, inval=%d\n",
syslog (LOG_DEBUG, "\t%d)\tessid='%s', prio=%d, key='%s', enc=%d, addr=0x%X, qual=%d, freq=%f, rate=%d, inval=%d",
i, nm_ap_get_essid (ap), nm_ap_get_priority (ap), nm_ap_get_wep_key (ap), nm_ap_get_encrypted (ap),
nm_ap_get_address (ap), nm_ap_get_quality (ap), nm_ap_get_freq (ap), nm_ap_get_rate (ap),
nm_ap_get_invalid (ap));
i++;
}
fprintf (stderr, "AP_LIST_PRINT: done\n");
syslog (LOG_DEBUG, "AP_LIST_PRINT: done");
nm_ap_list_iter_free (iter);
}
......@@ -286,7 +286,7 @@ void nm_dbus_signal_device_no_longer_active (DBusConnection *connection, NMDevic
message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "DeviceNoLongerActive");
if (!message)
{
NM_DEBUG_PRINT ("nm_dbus_signal_device_no_longer_active(): Not enough memory for new dbus message!\n");
syslog (LOG_ERR, "nm_dbus_signal_device_no_longer_active(): Not enough memory for new dbus message!");
g_free (dev_path);
return;
}
......@@ -295,7 +295,7 @@ void nm_dbus_signal_device_no_longer_active (DBusConnection *connection, NMDevic
g_free (dev_path);
if (!dbus_connection_send (connection, message, NULL))
NM_DEBUG_PRINT ("nm_dbus_signal_device_no_longer_active(): Could not raise the DeviceNoLongerActive signal!\n");
syslog (LOG_WARNING, "nm_dbus_signal_device_no_longer_active(): Could not raise the DeviceNoLongerActive signal!");
dbus_message_unref (message);
}
......@@ -321,7 +321,7 @@ void nm_dbus_signal_device_now_active (DBusConnection *connection, NMDevice *dev
message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "DeviceNowActive");
if (!message)
{
NM_DEBUG_PRINT ("nm_dbus_signal_device_now_active(): Not enough memory for new dbus message!\n");
syslog (LOG_ERR, "nm_dbus_signal_device_now_active(): Not enough memory for new dbus message!");
g_free (dev_path);
return;
}
......@@ -330,7 +330,7 @@ void nm_dbus_signal_device_now_active (DBusConnection *connection, NMDevice *dev
g_free (dev_path);
if (!dbus_connection_send (connection, message, NULL))
NM_DEBUG_PRINT ("nm_dbus_signal_device_now_active(): Could not raise the DeviceNowActive signal!\n");
syslog (LOG_WARNING, "nm_dbus_signal_device_now_active(): Could not raise the DeviceNowActive signal!");
dbus_message_unref (message);
}
......@@ -356,7 +356,7 @@ void nm_dbus_signal_device_ip4_address_change (DBusConnection *connection, NMDev
message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "DeviceIP4AddressChange");
if (!message)
{
NM_DEBUG_PRINT ("nm_dbus_signal_device_ip4_address_change(): Not enough memory for new dbus message!\n");
syslog (LOG_ERR, "nm_dbus_signal_device_ip4_address_change(): Not enough memory for new dbus message!");
g_free (dev_path);
return;
}
......@@ -365,7 +365,7 @@ void nm_dbus_signal_device_ip4_address_change (DBusConnection *connection, NMDev
g_free (dev_path);
if (!dbus_connection_send (connection, message, NULL))
NM_DEBUG_PRINT ("nm_dbus_signal_device_ip4_address_change(): Could not raise the IP4AddressChange signal!\n");
syslog (LOG_WARNING, "nm_dbus_signal_device_ip4_address_change(): Could not raise the IP4AddressChange signal!");
dbus_message_unref (message);
}
......@@ -399,7 +399,7 @@ void nm_dbus_signal_wireless_network_appeared (DBusConnection *connection, NMDev
message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "WirelessNetworkAppeared");
if (!message)
{
NM_DEBUG_PRINT ("nm_dbus_signal_wireless_network_appeared(): Not enough memory for new dbus message!\n");
syslog (LOG_ERR, "nm_dbus_signal_wireless_network_appeared(): Not enough memory for new dbus message!");
g_free (dev_path);
g_free (ap_path);
return;
......@@ -413,7 +413,7 @@ void nm_dbus_signal_wireless_network_appeared (DBusConnection *connection, NMDev
g_free (dev_path);
if (!dbus_connection_send (connection, message, NULL))
NM_DEBUG_PRINT ("nnm_dbus_signal_wireless_network_appeared(): Could not raise the WirelessNetworkAppeared signal!\n");
syslog (LOG_WARNING, "nnm_dbus_signal_wireless_network_appeared(): Could not raise the WirelessNetworkAppeared signal!");
dbus_message_unref (message);
}
......@@ -447,7 +447,7 @@ void nm_dbus_signal_wireless_network_disappeared (DBusConnection *connection, NM
message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "WirelessNetworkDisappeared");
if (!message)
{
NM_DEBUG_PRINT ("nm_dbus_signal_wireless_network_disappeared(): Not enough memory for new dbus message!\n");
syslog (LOG_ERR, "nm_dbus_signal_wireless_network_disappeared(): Not enough memory for new dbus message!");