+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
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.
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <syslog.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
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;
}
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);
}
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);
}
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;
}
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);
}
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);
}
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;
}
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));
}
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);
}
}
}
+ 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;
}
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:
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;
}
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:
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);
}
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);
#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>
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;
}
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);
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);
}
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)
{
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);
}
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);
}
*/
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);
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);
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." );
}
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
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);
}
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);
*/
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 );
}
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 );
*/
}
}
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);
}
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);
}
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);
}
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);
}
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);
}
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"
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
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);
}
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);
/* 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;
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);
}
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:
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);
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;
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;
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);
}
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;
}
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;
}
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);
}
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;
}
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);
}
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;
}
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);
}
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;
}
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);
}
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;
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);
}
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!");
g_free (dev_path);
g_free (ap_path);
return;
g_free (dev_path);
if (!dbus_connection_send (connection, message, NULL))
- NM_DEBUG_PRINT ("nnm_dbus_signal_wireless_network_disappeared(): Could not raise the WirelessNetworkDisappeared signal!\n");
+ syslog (LOG_WARNING, "nnm_dbus_signal_wireless_network_disappeared(): Could not raise the WirelessNetworkDisappeared signal!");
dbus_message_unref (message);
}
if (dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &key, DBUS_TYPE_INVALID))
{
nm_device_pending_action_set_user_key (dev, key);
- fprintf (stderr, "dbus user key callback got key '%s'\n", key );
+ syslog (LOG_DEBUG, "dbus user key callback got key '%s'", key );
dbus_free (key);
dbus_pending_call_unref (pending);
}
NMI_DBUS_INTERFACE, "getKeyForNetwork");
if (message == NULL)
{
- NM_DEBUG_PRINT ("nm_dbus_get_user_key_for_network(): Couldn't allocate the dbus message\n");
+ syslog (LOG_ERR, "nm_dbus_get_user_key_for_network(): Couldn't allocate the dbus message");
return;
}
DBUS_TYPE_INVALID);
if (!dbus_connection_send (connection, message, NULL))
- NM_DEBUG_PRINT ("nm_dbus_get_user_key_for_network(): could not send dbus message\n");
+ syslog (LOG_WARNING, "nm_dbus_get_user_key_for_network(): could not send dbus message");
/* For asynchronous replies, disabled for now */
#if 0
if (!dbus_connection_send_with_reply (connection, message, pending, -1))
{
- 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;
}
NMI_DBUS_INTERFACE, "cancelGetKeyForNetwork");
if (message == NULL)
{
- NM_DEBUG_PRINT ("nm_dbus_cancel_get_user_key_for_network(): Couldn't allocate the dbus message\n");
+ syslog (LOG_ERR, "nm_dbus_cancel_get_user_key_for_network(): Couldn't allocate the dbus message");
return;
}
if (!dbus_connection_send (connection, message, NULL))
- NM_DEBUG_PRINT ("nm_dbus_cancel_get_user_key_for_network(): could not send dbus message\n");
+ syslog (LOG_WARNING, "nm_dbus_cancel_get_user_key_for_network(): could not send dbus message");
dbus_message_unref (message);
}
NMI_DBUS_INTERFACE, "getNetworkEssid");
if (!message)
{
- NM_DEBUG_PRINT ("nm_dbus_get_network_essid(): Couldn't allocate the dbus message\n");
+ syslog (LOG_ERR, "nm_dbus_get_network_essid(): Couldn't allocate the dbus message");
return (NULL);
}
dbus_error_init (&error);
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
if (dbus_error_is_set (&error))
- NM_DEBUG_PRINT_2 ("nm_dbus_get_network_essid(): %s raised %s\n", error.name, error.message)
+ syslog (LOG_ERR, "nm_dbus_get_network_essid(): %s raised %s", error.name, error.message);
else if (!reply)
- NM_DEBUG_PRINT ("nm_dbus_get_network_essid(): reply was NULL.\n")
+ syslog (LOG_NOTICE, "nm_dbus_get_network_essid(): reply was NULL.");
else
{
char *dbus_string;
NMI_DBUS_INTERFACE, "getNetworkKey");
if (!message)
{
- NM_DEBUG_PRINT ("nm_dbus_get_network_key(): Couldn't allocate the dbus message\n");
+ syslog (LOG_ERR, "nm_dbus_get_network_key(): Couldn't allocate the dbus message");
return (NULL);
}
dbus_error_init (&error);
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
if (dbus_error_is_set (&error))
- NM_DEBUG_PRINT_2 ("nm_dbus_get_network_key(): %s raised %s\n", error.name, error.message)
+ syslog (LOG_ERR, "nm_dbus_get_network_key(): %s raised %s", error.name, error.message);
else if (!reply)
- NM_DEBUG_PRINT ("nm_dbus_get_network_key(): reply was NULL.\n")
+ syslog (LOG_NOTICE, "nm_dbus_get_network_key(): reply was NULL.");
else
{
char *dbus_string;
NMI_DBUS_INTERFACE, "getNetworkPriority");
if (!message)
{
- NM_DEBUG_PRINT ("nm_dbus_get_network_priority(): Couldn't allocate the dbus message\n");
+ syslog (LOG_ERR, "nm_dbus_get_network_priority(): Couldn't allocate the dbus message");
return (-1);
}
dbus_error_init (&error);
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
if (dbus_error_is_set (&error))
- NM_DEBUG_PRINT_2 ("nm_dbus_get_network_priority(): %s raised %s\n", error.name, error.message)
+ syslog (LOG_ERR, "nm_dbus_get_network_priority(): %s raised %s", error.name, error.message);
else if (!reply)
- NM_DEBUG_PRINT ("nm_dbus_get_network_priority(): reply was NULL.\n")
+ syslog (LOG_NOTICE, "nm_dbus_get_network_priority(): reply was NULL.");
else
{
dbus_error_init (&error);
NMI_DBUS_INTERFACE, "getNetworks");
if (!message)
{
- NM_DEBUG_PRINT ("nm_dbus_get_networks(): Couldn't allocate the dbus message\n");
+ syslog (LOG_ERR, "nm_dbus_get_networks(): Couldn't allocate the dbus message");
return (NULL);
}
dbus_error_init (&error);
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
if (dbus_error_is_set (&error))
- NM_DEBUG_PRINT_2 ("nm_dbus_get_networks(): %s raised %s\n", error.name, error.message)
+ syslog (LOG_ERR, "nm_dbus_get_networks(): %s raised %s", error.name, error.message);
else if (!reply)
- NM_DEBUG_PRINT ("nm_dbus_get_networks(): reply was NULL.\n")
+ syslog (LOG_NOTICE, "nm_dbus_get_networks(): reply was NULL.");
else
{
DBusMessageIter iter;
if (!(object_path = dbus_message_get_path (message)))
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
- /* NM_DEBUG_PRINT_2 ("nm_dbus_nmi_filter() got method %s for path %s\n", method, object_path); /**/
+ /* syslog (LOG_DEBUG, "nm_dbus_nmi_filter() got method %s for path %s", method, object_path); /**/
if ( (strcmp (object_path, NMI_DBUS_PATH) == 0)
&& dbus_message_is_signal (message, NMI_DBUS_INTERFACE, "TrustedNetworkUpdate"))
if (!dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID))
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
-fprintf( stderr, "update of network '%s'\n", network);
+ syslog( LOG_DEBUG, "update of network '%s'", network);
nm_ap_list_update_network (list, network, data);
dbus_free (network);
&& nm_device_is_wireless (data->active_device)
&& !nm_device_activating (data->active_device))
{
-fprintf( stderr, "updating active device's best ap\n");
+ syslog( LOG_DEBUG, "updating active device's best ap");
nm_device_update_best_ap (data->active_device);
nm_data_set_state_modified (data, TRUE);
-fprintf( stderr, "Device's best ap now '%s'\n", nm_ap_get_essid (nm_device_get_best_ap (data->active_device)));
+ syslog( LOG_DEBUG, "Device's best ap now '%s'", nm_ap_get_essid (nm_device_get_best_ap (data->active_device)));
}
handled = TRUE;
}
method = dbus_message_get_member (message);
path = dbus_message_get_path (message);
- /* NM_DEBUG_PRINT_2 ("nm_dbus_nm_message_handler() got method %s for path %s\n", method, path); /**/
+ /* syslog (LOG_DEBUG, "nm_dbus_nm_message_handler() got method %s for path %s", method, path); /**/
if (strcmp ("getActiveDevice", method) == 0)
reply_message = nm_dbus_nm_get_active_device (connection, message, data);
if ((ap = nm_ap_list_get_ap_by_essid (nm_device_ap_list_get (data->active_device), network)))
{
-fprintf (stderr, "Forcing AP '%s'\n", nm_ap_get_essid (ap));
+ syslog (LOG_DEBUG, "Forcing AP '%s'", nm_ap_get_essid (ap));
nm_device_freeze_best_ap (data->active_device);
nm_device_set_best_ap (data->active_device, ap);
nm_data_set_state_modified (data, TRUE);
method = dbus_message_get_member (message);
path = dbus_message_get_path (message);
- /*NM_DEBUG_PRINT_2 ("nm_dbus_devices_message_handler() got method %s for path %s\n", method, path);*/
+ /*syslog (LOG_DEBUG, "nm_dbus_devices_message_handler() got method %s for path %s", method, path);*/
if ((reply_message = nm_dbus_devices_handle_request (connection, data, message, path, method)))
{
connection = dbus_bus_get (DBUS_BUS_SYSTEM, &dbus_error);
if (connection == NULL)
{
- NM_DEBUG_PRINT ("nm_dbus_init() could not get the system bus. Make sure the message bus daemon is running?\n");
+ syslog (LOG_ERR, "nm_dbus_init() could not get the system bus. Make sure the message bus daemon is running?");
return (NULL);
}
success = dbus_connection_register_object_path (connection, NM_DBUS_PATH, &nm_vtable, data);
if (!success)
{
- NM_DEBUG_PRINT ("nm_dbus_init() could not register a handler for NetworkManager. Not enough memory?\n");
+ syslog (LOG_ERR, "nm_dbus_init() could not register a handler for NetworkManager. Not enough memory?");
return (NULL);
}
success = dbus_connection_register_fallback (connection, NM_DBUS_PATH_DEVICES, &devices_vtable, data);
if (!success)
{
- NM_DEBUG_PRINT ("nm_dbus_init() could not register a handler for NetworkManager devices. Not enough memory?\n");
+ syslog (LOG_ERR, "nm_dbus_init() could not register a handler for NetworkManager devices. Not enough memory?");
return (NULL);
}
dbus_bus_acquire_service (connection, NM_DBUS_SERVICE, 0, &dbus_error);
if (dbus_error_is_set (&dbus_error))
{
- NM_DEBUG_PRINT_1 ("nm_dbus_init() could not acquire its service. dbus_bus_acquire_service() says: '%s'\n", dbus_error.message);
+ syslog (LOG_ERR, "nm_dbus_init() could not acquire its service. dbus_bus_acquire_service() says: '%s'", dbus_error.message);
return (NULL);
}
dev = g_new0 (NMDevice, 1);
if (!dev)
{
- NM_DEBUG_PRINT("nm_device_new() could not allocate a new device... Not enough memory?\n");
+ syslog (LOG_ERR, "nm_device_new() could not allocate a new device... Not enough memory?");
return (NULL);
}
dev->options.wireless.cur_essid = g_strdup (essid);
}
else
- NM_DEBUG_PRINT_2 ("nm_device_get_essid(): error setting ESSID for device %s. errno = %d\n", nm_device_get_iface (dev), errno);
+ syslog (LOG_ERR, "nm_device_get_essid(): error setting ESSID for device %s. errno = %d", nm_device_get_iface (dev), errno);
close (iwlib_socket);
}
err = iw_set_ext (iwlib_socket, nm_device_get_iface (dev), SIOCSIWESSID, &wreq);
if (err == -1)
- NM_DEBUG_PRINT_2 ("nm_device_set_essid(): error setting ESSID for device %s. errno = %d\n", nm_device_get_iface (dev), errno);
+ syslog (LOG_ERR, "nm_device_set_essid(): error setting ESSID for device %s. errno = %d", nm_device_get_iface (dev), errno);
close (iwlib_socket);
}
{
err = iw_set_ext (iwlib_socket, nm_device_get_iface (dev), SIOCSIWENCODE, &wreq);
if (err == -1)
- NM_DEBUG_PRINT_2 ("nm_device_set_wep_key(): error setting key for device %s. errno = %d\n", nm_device_get_iface (dev), errno);
+ syslog (LOG_ERR, "nm_device_set_wep_key(): error setting key for device %s. errno = %d", nm_device_get_iface (dev), errno);
}
close (iwlib_socket);
- } else NM_DEBUG_PRINT ("nm_device_set_wep_key(): could not get wireless control socket.\n");
+ } else syslog (LOG_ERR, "nm_device_set_wep_key(): could not get wireless control socket.");
}
ifr.ifr_flags |= IFF_UP & flags;
err = ioctl (iface_fd, SIOCSIFFLAGS, &ifr);
if (err)
- NM_DEBUG_PRINT_3 ("nm_device_set_up_down() could not bring device %s %s. errno = %d\n", nm_device_get_iface (dev), (up ? "up" : "down"), errno );
+ 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 );
}
}
else
- NM_DEBUG_PRINT_2 ("nm_device_set_up_down() could not get flags for device %s. errno = %d\n", nm_device_get_iface (dev), errno );
+ syslog (LOG_ERR, "nm_device_set_up_down() could not get flags for device %s. errno = %d", nm_device_get_iface (dev), errno );
close (iface_fd);
}
if (!err)
return (!((ifr.ifr_flags^IFF_UP) & IFF_UP));
- NM_DEBUG_PRINT_2 ("nm_device_is_up() could not get flags for device %s. errno = %d\n", nm_device_get_iface (dev), errno );
+ syslog (LOG_ERR, "nm_device_is_up() could not get flags for device %s. errno = %d", nm_device_get_iface (dev), errno );
return (FALSE);
}
if (!g_thread_create (nm_device_activation_worker, dev, FALSE, &error))
{
- NM_DEBUG_PRINT ("nm_device_activation_begin(): could not create activation worker thread.\n");
+ syslog (LOG_CRIT, "nm_device_activation_begin(): could not create activation worker thread.");
return (FALSE);
}
nm_device_bring_down (dev);
nm_device_set_essid (dev, nm_ap_get_essid (best_ap));
- NM_DEBUG_PRINT_2 ("nm_device_wireless_activate(%s) using essid '%s'\n", nm_device_get_iface (dev), nm_ap_get_essid (best_ap));
+ syslog (LOG_INFO, "nm_device_wireless_activate(%s) using essid '%s'", nm_device_get_iface (dev), nm_ap_get_essid (best_ap));
/* Bring the device up */
if (!nm_device_is_up (dev));
g_return_val_if_fail (dev != NULL, NULL);
g_return_val_if_fail (dev->app_data != NULL, NULL);
-fprintf( stderr, "nm_device_activation_worker (%s) started...\n", nm_device_get_iface (dev));
+ syslog( LOG_DEBUG, "nm_device_activation_worker (%s) started...", nm_device_get_iface (dev));
dev->activating = TRUE;
/* If its a wireless device, set the ESSID and WEP key */
/* If we were told to quit activation, stop the thread and return */
if (dev->quit_activation)
{
-fprintf( stderr, "nm_device_activation_worker(%s): activation canceled 1\n", nm_device_get_iface (dev));
+ syslog( LOG_DEBUG, "nm_device_activation_worker(%s): activation canceled 1", nm_device_get_iface (dev));
dev->just_activated = FALSE;
nm_device_unref (dev);
return (NULL);
}
-fprintf (stderr, "nm_device_activation_worker(%s): user key received!\n", nm_device_get_iface (dev));
+ syslog (LOG_DEBUG, "nm_device_activation_worker(%s): user key received!", nm_device_get_iface (dev));
}
nm_device_activate_wireless (dev);
/* If we were told to quit activation, stop the thread and return */
if (dev->quit_activation)
{
-fprintf( stderr, "nm_device_activation_worker(%s): activation canceled 1.5\n", nm_device_get_iface (dev));
+ syslog( LOG_DEBUG, "nm_device_activation_worker(%s): activation canceled 1.5", nm_device_get_iface (dev));
dev->just_activated = FALSE;
nm_device_unref (dev);
return (NULL);
/* If we were told to quit activation, stop the thread and return */
if (dev->quit_activation)
{
-fprintf( stderr, "nm_device_activation_worker(%s): activation canceled 2\n", nm_device_get_iface (dev));
+ syslog( LOG_DEBUG, "nm_device_activation_worker(%s): activation canceled 2", nm_device_get_iface (dev));
dev->just_activated = FALSE;
nm_device_unref (dev);
return (NULL);
/* If we were told to quit activation, stop the thread and return */
if (dev->quit_activation)
{
-fprintf( stderr, "nm_device_activation_worker(%s): activation canceled 3\n", nm_device_get_iface (dev));
+ syslog( LOG_DEBUG, "nm_device_activation_worker(%s): activation canceled 3", nm_device_get_iface (dev));
dev->just_activated = FALSE;
nm_device_unref (dev);
return (NULL);
}
dev->just_activated = TRUE;
-fprintf( stderr, "nm_device_activation_worker(%s): device activated\n", nm_device_get_iface (dev));
+ syslog( LOG_DEBUG, "nm_device_activation_worker(%s): device activated", nm_device_get_iface (dev));
nm_device_update_ip4_address (dev);
dev->activating = FALSE;
{
g_return_if_fail (dev != NULL);
-fprintf( stderr, "nm_device_activation_cancel(%s): canceled\n", nm_device_get_iface (dev));
+ syslog( LOG_DEBUG, "nm_device_activation_cancel(%s): canceled", nm_device_get_iface (dev));
dev->quit_activation = TRUE;
}
nm_device_update_best_ap (dev);
}
else
- NM_DEBUG_PRINT_1 ("nm_device_do_normal_scan() could not get a control socket for the wireless card %s.\n", nm_device_get_iface (dev) );
+ syslog (LOG_ERR, "nm_device_do_normal_scan() could not get a control socket for the wireless card %s.", nm_device_get_iface (dev) );
}
if (valid)
{
- NM_DEBUG_PRINT_2("%s: setting AP '%s' best\n", nm_device_get_iface (dev), nm_ap_get_essid (ap));
+ syslog(LOG_INFO, "%s: setting AP '%s' best", nm_device_get_iface (dev), nm_ap_get_essid (ap));
nm_device_set_best_ap (dev, ap);
nm_data_set_state_modified (dev->app_data, TRUE);
data[1] = location;
if (ioctl (sockfd, new_ioctl_nums ? 0x8948 : SIOCDEVPRIVATE + 1, ifr) < 0)
{
- NM_DEBUG_PRINT_2("SIOCGMIIREG on %s failed: %s\n", ifr->ifr_name, strerror (errno));
+ syslog(LOG_ERR, "SIOCGMIIREG on %s failed: %s", ifr->ifr_name, strerror (errno));
return -1;
}
return data[3];
sockfd = socket (AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0)
{
- NM_DEBUG_PRINT_2("cannot open socket on interface %s; errno=%d", nm_device_get_iface (dev), errno);
+ syslog (LOG_ERR, "cannot open socket on interface %s; errno=%d", nm_device_get_iface (dev), errno);
return (FALSE);
}
new_ioctl_nums = FALSE;
else
{
- NM_DEBUG_PRINT_2("SIOCGMIIPHY on %s failed: %s", ifr.ifr_name, strerror (errno));
+ syslog (LOG_ERR, "SIOCGMIIPHY on %s failed: %s", ifr.ifr_name, strerror (errno));
close (sockfd);
return (FALSE);
}
element = g_slist_next (element);
}
- NM_DEBUG_PRINT_1 ("Best wired device = %s\n", best_wired_dev ? nm_device_get_iface (best_wired_dev) : "(null)");
- NM_DEBUG_PRINT_2 ("Best wireless device = %s (%s)\n", best_wireless_dev ? nm_device_get_iface (best_wireless_dev) : "(null)",
+ syslog (LOG_NOTICE, "Best wired device = %s", best_wired_dev ? nm_device_get_iface (best_wired_dev) : "(null)");
+ syslog (LOG_NOTICE, "Best wireless device = %s (%s)", best_wireless_dev ? nm_device_get_iface (best_wireless_dev) : "(null)",
best_wireless_dev ? nm_device_get_essid (best_wireless_dev) : "null" );
if (best_wireless_dev || best_wired_dev)
|| ( best_dev && nm_device_is_wireless (best_dev) && !nm_device_activating (best_dev)
&& (nm_device_need_ap_switch (best_dev) || (nm_device_get_ip4_address (best_dev) == 0))))
{
- NM_DEBUG_PRINT_1 ("nm_state_modification_monitor(): beginning activation for device '%s'\n", best_dev ? nm_device_get_iface (best_dev) : "(null)");
+ syslog (LOG_INFO, "nm_state_modification_monitor(): beginning activation for device '%s'", best_dev ? nm_device_get_iface (best_dev) : "(null)");
/* Deactivate the old device */
if (data->active_device)
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
}
else
- NM_DEBUG_PRINT("nm_state_modification_monitor() could not get device list mutex\n");
+ syslog( LOG_ERR, "nm_state_modification_monitor() could not get device list mutex");
}
else if (data->active_device && nm_device_just_activated (data->active_device))
{
nm_dbus_signal_device_now_active (data->dbus_connection, data->active_device);
- NM_DEBUG_PRINT_1 ("nm_state_modification_monitor() activated device %s\n", nm_device_get_iface (data->active_device));
+ syslog (LOG_INFO, "nm_state_modification_monitor() activated device %s", nm_device_get_iface (data->active_device));
}
return (TRUE);
data->allowed_ap_list = g_slist_append (data->allowed_ap_list, ap);
/*
- NM_DEBUG_PRINT_3( "FOUND: allowed ap, prio=%d essid=%s wep_key=%s\n", prio_num, essid, wep_key );
+ syslog( LOG_DEBUG, "FOUND: allowed ap, prio=%d essid=%s wep_key=%s", prio_num, essid, wep_key );
*/
}
}
fclose (ap_file);
}
else
- NM_DEBUG_PRINT_2( "nm_policy_update_allowed_access_points() could not open allowed ap list file %s. errno %d\n", NM_ALLOWED_AP_FILE, errno );
+ syslog( LOG_WARNING, "nm_policy_update_allowed_access_points() could not open allowed ap list file %s. errno %d", NM_ALLOWED_AP_FILE, errno );
nm_unlock_mutex (data->allowed_ap_list_mutex, __FUNCTION__);
}
else
- NM_DEBUG_PRINT( "nm_policy_update_allowed_access_points() could not lock allowed ap list mutex\n" );
+ syslog( LOG_ERR, "nm_policy_update_allowed_access_points() could not lock allowed ap list mutex" );
}
#endif
if (g_mutex_trylock (mutex))
{
#ifdef LOCKING_DEBUG
- if (func) NM_DEBUG_PRINT_2 ("MUTEX: %s got mutex 0x%X\n", func, mutex);
+ if (func) syslog (LOG_DEBUG, "MUTEX: %s got mutex 0x%X", func, mutex);
#endif
return (TRUE);
}
g_return_if_fail (mutex != NULL);
#ifdef LOCKING_DEBUG
- if (func) NM_DEBUG_PRINT_2 ("MUTEX: %s released mutex 0x%X\n", func, mutex);
+ if (func) syslog (LOG_DEBUG, "MUTEX: %s released mutex 0x%X", func, mutex);
#endif
g_mutex_unlock (mutex);
if (fd >= 0)
return (fd);
- NM_DEBUG_PRINT ("nm_get_network_control_socket() could not get network control socket.\n");
+ syslog (LOG_ERR, "nm_get_network_control_socket() could not get network control socket.");
return (-1);
}
#include <glib.h>
#include <stdio.h>
+#include <syslog.h>
#include <net/ethernet.h>
#include <iwlib.h>
#include "NetworkManager.h"
#include "NetworkManagerDevice.h"
-#define NM_DEBUG_PRINT(s) { if (debug) fprintf(stderr, s); }
-#define NM_DEBUG_PRINT_1(s, a) { if (debug) fprintf(stderr, s, a); }
-#define NM_DEBUG_PRINT_2(s, a, b) { if (debug) fprintf(stderr, s, a, b); }
-#define NM_DEBUG_PRINT_3(s, a, b, c) { if (debug) fprintf(stderr, s, a, b, c); }
-#define NM_DEBUG_PRINT_4(s, a, b, c, d) { if (debug) fprintf(stderr, s, a, b, c, d); }
-
-
gboolean nm_try_acquire_mutex (GMutex *mutex, const char *func);
void nm_unlock_mutex (GMutex *mutex, const char *func);
nm_unlock_mutex (data->dev_list_mutex, __FUNCTION__);
}
else
- NM_DEBUG_PRINT( "nm_wireless_scan_monitor() could not acquire device list mutex.\n" );
+ syslog( LOG_ERR, "nm_wireless_scan_monitor() could not acquire device list mutex." );
return (TRUE);
}