mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 04:40:09 +01:00
olpc-mesh: update logging
This commit is contained in:
parent
75fa7b804d
commit
796671d424
1 changed files with 33 additions and 26 deletions
|
|
@ -19,7 +19,7 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* (C) Copyright 2005 - 2008 Red Hat, Inc.
|
||||
* (C) Copyright 2005 - 2010 Red Hat, Inc.
|
||||
* (C) Copyright 2008 Collabora Ltd.
|
||||
* (C) Copyright 2009 One Laptop per Child
|
||||
*/
|
||||
|
|
@ -42,6 +42,7 @@
|
|||
#include "nm-device-interface.h"
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-logging.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-activation-request.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
|
|
@ -157,7 +158,7 @@ real_get_generic_capabilities (NMDevice *dev)
|
|||
|
||||
fd = socket (PF_INET, SOCK_DGRAM, 0);
|
||||
if (fd < 0) {
|
||||
nm_warning ("couldn't open control socket.");
|
||||
nm_log_warn (LOGD_OLPC_MESH, "couldn't open control socket.");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -168,13 +169,14 @@ real_get_generic_capabilities (NMDevice *dev)
|
|||
wrq.u.data.length = sizeof (struct iw_range);
|
||||
|
||||
if (ioctl (fd, SIOCGIWRANGE, &wrq) < 0) {
|
||||
nm_warning ("couldn't get driver range information.");
|
||||
nm_log_warn (LOGD_OLPC_MESH, "couldn't get driver range information.");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((wrq.u.data.length < 300) || (range.we_version_compiled < 16)) {
|
||||
nm_warning ("%s: driver's Wireless Extensions version (%d) is too old.",
|
||||
iface, range.we_version_compiled);
|
||||
nm_log_warn (LOGD_OLPC_MESH,
|
||||
"(%s): driver's Wireless Extensions version (%d) is too old.",
|
||||
iface, range.we_version_compiled);
|
||||
goto out;
|
||||
} else {
|
||||
caps |= NM_DEVICE_CAP_NM_SUPPORTED;
|
||||
|
|
@ -404,7 +406,7 @@ create_socket_with_request (NMDevice *self, struct iwreq *req)
|
|||
|
||||
sk = socket (AF_INET, SOCK_DGRAM, 0);
|
||||
if (!sk) {
|
||||
nm_error ("Couldn't create socket: %d.", errno);
|
||||
nm_log_err (LOGD_OLPC_MESH, "Couldn't create socket: %d.", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -430,8 +432,8 @@ nm_device_olpc_mesh_get_channel (NMDeviceOlpcMesh *self)
|
|||
return 0;
|
||||
|
||||
if ((ioctl (sk, SIOCGIWFREQ, &req)) != 0) {
|
||||
nm_warning ("%s: failed to get channel (errno: %d))",
|
||||
nm_device_get_iface (NM_DEVICE (self)), errno);
|
||||
nm_log_warn (LOGD_OLPC_MESH, "(%s): failed to get channel (errno: %d)",
|
||||
nm_device_get_iface (NM_DEVICE (self)), errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -469,10 +471,10 @@ nm_device_olpc_mesh_set_channel (NMDeviceOlpcMesh *self, guint32 channel)
|
|||
req.u.freq.m = channel;
|
||||
}
|
||||
|
||||
if (ioctl (sk, SIOCSIWFREQ, &req) != 0)
|
||||
nm_warning ("%s: failed to set to channel %d (errno: %d))",
|
||||
nm_device_get_iface (NM_DEVICE (self)), channel, errno);
|
||||
else
|
||||
if (ioctl (sk, SIOCSIWFREQ, &req) != 0) {
|
||||
nm_log_warn (LOGD_OLPC_MESH, "(%s): failed to set to channel %d (errno: %d)",
|
||||
nm_device_get_iface (NM_DEVICE (self)), channel, errno);
|
||||
} else
|
||||
g_object_notify (G_OBJECT (self), NM_DEVICE_OLPC_MESH_ACTIVE_CHANNEL);
|
||||
|
||||
close (sk);
|
||||
|
|
@ -492,7 +494,7 @@ nm_device_olpc_mesh_set_ssid (NMDeviceOlpcMesh *self, const GByteArray * ssid)
|
|||
|
||||
sk = socket (AF_INET, SOCK_DGRAM, 0);
|
||||
if (!sk) {
|
||||
nm_error ("Couldn't create socket: %d.", errno);
|
||||
nm_log_err (LOGD_OLPC_MESH, "Couldn't create socket: %d.", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -524,9 +526,10 @@ nm_device_olpc_mesh_set_ssid (NMDeviceOlpcMesh *self, const GByteArray * ssid)
|
|||
|
||||
if (ioctl (sk, SIOCSIWESSID, &wrq) < 0) {
|
||||
if (errno != ENODEV) {
|
||||
nm_warning ("error setting SSID to '%s' for device %s: %s",
|
||||
nm_log_err (LOGD_OLPC_MESH, "(%s): error setting SSID to '%s': %s",
|
||||
iface,
|
||||
ssid ? nm_utils_escape_ssid (ssid->data, ssid->len) : "(null)",
|
||||
iface, strerror (errno));
|
||||
strerror (errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -554,7 +557,7 @@ real_update_hw_address (NMDevice *dev)
|
|||
|
||||
fd = socket (PF_INET, SOCK_DGRAM, 0);
|
||||
if (fd < 0) {
|
||||
g_warning ("could not open control socket.");
|
||||
nm_log_warn (LOGD_OLPC_MESH, "could not open control socket.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -562,8 +565,8 @@ real_update_hw_address (NMDevice *dev)
|
|||
strncpy (req.ifr_name, nm_device_get_iface (dev), IFNAMSIZ);
|
||||
ret = ioctl (fd, SIOCGIFHWADDR, &req);
|
||||
if (ret) {
|
||||
nm_warning ("%s: (%s) error getting hardware address: %d",
|
||||
__func__, nm_device_get_iface (dev), errno);
|
||||
nm_log_warn (LOGD_OLPC_MESH, "(%s): error getting hardware address: %d",
|
||||
nm_device_get_iface (dev), errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -585,17 +588,20 @@ real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
|||
|
||||
/* disconnect companion device, if it is connected */
|
||||
if (nm_device_get_act_request (NM_DEVICE (priv->companion))) {
|
||||
nm_warning ("disconnecting companion device");
|
||||
nm_log_info (LOGD_OLPC_MESH, "(%s): disconnecting companion device %s",
|
||||
nm_device_get_iface (dev),
|
||||
nm_device_get_iface (priv->companion));
|
||||
/* FIXME: VPN stuff here is a bug; but we can't really change API now... */
|
||||
nm_device_state_changed (NM_DEVICE (priv->companion),
|
||||
NM_DEVICE_STATE_DISCONNECTED,
|
||||
NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED);
|
||||
nm_warning ("companion disconnected");
|
||||
nm_log_info (LOGD_OLPC_MESH, "(%s): companion %s disconnected",
|
||||
nm_device_get_iface (dev),
|
||||
nm_device_get_iface (priv->companion));
|
||||
}
|
||||
|
||||
|
||||
/* wait with continuing configuration untill the companion device is done
|
||||
* scanning */
|
||||
/* wait with continuing configuration untill the companion device is done scanning */
|
||||
g_object_get (priv->companion, "scanning", &scanning, NULL);
|
||||
if (scanning) {
|
||||
priv->stage1_waiting = TRUE;
|
||||
|
|
@ -823,7 +829,8 @@ companion_state_changed_cb (NMDeviceWifi *companion,
|
|||
|| state > NM_DEVICE_STATE_ACTIVATED)
|
||||
return;
|
||||
|
||||
nm_debug ("disconnecting mesh due to companion connectivity");
|
||||
nm_log_dbg (LOGD_OLPC_MESH, "(%s): disconnecting mesh due to companion connectivity",
|
||||
nm_device_get_iface (NM_DEVICE (self)));
|
||||
/* FIXME: VPN stuff here is a bug; but we can't really change API now... */
|
||||
nm_device_state_changed (NM_DEVICE (self),
|
||||
NM_DEVICE_STATE_DISCONNECTED,
|
||||
|
|
@ -887,9 +894,9 @@ is_companion (NMDeviceOlpcMesh *self, NMDevice *other)
|
|||
NM_DEVICE_STATE_DISCONNECTED,
|
||||
NM_DEVICE_STATE_REASON_NONE);
|
||||
|
||||
nm_info ("(%s): found companion WiFi device %s",
|
||||
nm_device_get_iface (NM_DEVICE (self)),
|
||||
nm_device_get_iface (other));
|
||||
nm_log_info (LOGD_OLPC_MESH, "(%s): found companion WiFi device %s",
|
||||
nm_device_get_iface (NM_DEVICE (self)),
|
||||
nm_device_get_iface (other));
|
||||
|
||||
g_signal_connect (G_OBJECT (other), "state-changed",
|
||||
G_CALLBACK (companion_state_changed_cb), self);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue