diff options
author | Thomas Haller <thaller@redhat.com> | 2014-07-31 18:14:39 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-07-31 18:14:56 +0200 |
commit | ec2e5b5a94cc81e067ec09538d6ea0b4f407490a (patch) | |
tree | 5c31ff746c2d25a486bd49ad2ad9c187831e0d36 | |
parent | 73e4feadcdfb71eb3910ba433e7420f4235596db (diff) | |
download | NetworkManager-th/bgo733212_logging.tar.gz |
fixup! core: refactoring logging in NMDevice to use new _LOG() macrosth/bgo733212_logging
-rw-r--r-- | src/devices/nm-device.c | 410 |
1 files changed, 205 insertions, 205 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index a2e185fb9b..6f93c56e81 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -486,7 +486,7 @@ nm_device_dbus_export (NMDevice *self) g_return_if_fail (priv->path == NULL); priv->path = g_strdup_printf ("/org/freedesktop/NetworkManager/Devices/%d", devcount++); - _LOGI ("exported as %s", priv->path); + _LOGI (LOGD_DEVICE, "exported as %s", priv->path); nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, self); } @@ -577,7 +577,7 @@ nm_device_set_ip_iface (NMDevice *self, const char *iface) nm_platform_link_set_up (priv->ip_ifindex); } else { /* Device IP interface must always be a kernel network interface */ - _LOG (LOGL_WARN, LOGD_HW, "failed to look up interface index"); + _LOGW (LOGD_HW, "failed to look up interface index"); } } @@ -615,8 +615,8 @@ get_ip_iface_identifier (NMDevice *self, NMUtilsIPv6IfaceId *out_iid) hwaddr_len, out_iid); if (!success) { - _LOG (LOGL_WARN, LOGD_HW, "failed to generate interface identifier " - "for link type %u hwaddr_len %zu", link_type, hwaddr_len); + _LOGW (LOGD_HW, "failed to generate interface identifier " + "for link type %u hwaddr_len %zu", link_type, hwaddr_len); } return success; } @@ -963,11 +963,11 @@ link_disconnect_action_cb (gpointer user_data) NMDevice *self = NM_DEVICE (user_data); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - _LOGD ("link disconnected (calling deferred action) (id=%u)", priv->carrier_defer_id); + _LOGD (LOGD_DEVICE, "link disconnected (calling deferred action) (id=%u)", priv->carrier_defer_id); priv->carrier_defer_id = 0; - _LOGI ("link disconnected (calling deferred action)"); + _LOGI (LOGD_DEVICE, "link disconnected (calling deferred action)"); NM_DEVICE_GET_CLASS (self)->carrier_changed (self, FALSE); @@ -981,7 +981,7 @@ link_disconnect_action_cancel (NMDevice *self) if (priv->carrier_defer_id) { g_source_remove (priv->carrier_defer_id); - _LOGD ("link disconnected (canceling deferred action) (id=%u)", priv->carrier_defer_id); + _LOGD (LOGD_DEVICE, "link disconnected (canceling deferred action) (id=%u)", priv->carrier_defer_id); priv->carrier_defer_id = 0; } } @@ -1000,7 +1000,7 @@ nm_device_set_carrier (NMDevice *self, gboolean carrier) g_object_notify (G_OBJECT (self), NM_DEVICE_CARRIER); if (priv->carrier) { - _LOGI ("link connected"); + _LOGI (LOGD_DEVICE, "link connected"); link_disconnect_action_cancel (self); klass->carrier_changed (self, TRUE); @@ -1010,13 +1010,13 @@ nm_device_set_carrier (NMDevice *self, gboolean carrier) nm_device_remove_pending_action (self, "carrier wait", TRUE); } } else if (state <= NM_DEVICE_STATE_DISCONNECTED) { - _LOGI ("link disconnected"); + _LOGI (LOGD_DEVICE, "link disconnected"); klass->carrier_changed (self, FALSE); } else { - _LOGI ("link disconnected (deferring action for %d seconds)", LINK_DISCONNECT_DELAY); + _LOGI (LOGD_DEVICE, "link disconnected (deferring action for %d seconds)", LINK_DISCONNECT_DELAY); priv->carrier_defer_id = g_timeout_add_seconds (LINK_DISCONNECT_DELAY, link_disconnect_action_cb, self); - _LOGD ("link disconnected (deferring action for %d seconds) (id=%u)", + _LOGD (LOGD_DEVICE, "link disconnected (deferring action for %d seconds) (id=%u)", LINK_DISCONNECT_DELAY, priv->carrier_defer_id); } } @@ -1073,7 +1073,7 @@ device_link_changed (NMDevice *self, NMPlatformLink *info) } if (info->name[0] && strcmp (priv->iface, info->name) != 0) { - _LOGI ("interface index %d renamed iface from '%s' to '%s'", + _LOGI (LOGD_DEVICE, "interface index %d renamed iface from '%s' to '%s'", priv->ifindex, priv->iface, info->name); g_free (priv->iface); priv->iface = g_strdup (info->name); @@ -1105,10 +1105,10 @@ device_link_changed (NMDevice *self, NMPlatformLink *info) nm_device_master_add_slave (master, self, FALSE); nm_device_enslave_slave (master, self, NULL); } else if (master) { - _LOGI ("enslaved to non-master-type device %s; ignoring", + _LOGI (LOGD_DEVICE, "enslaved to non-master-type device %s; ignoring", nm_device_get_iface (master)); } else { - _LOGW ("enslaved to unknown device %d %s", + _LOGW (LOGD_DEVICE, "enslaved to unknown device %d %s", info->master, nm_platform_link_get_name (info->master)); } @@ -1130,7 +1130,7 @@ device_ip_link_changed (NMDevice *self, NMPlatformLink *info) NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); if (info->name[0] && g_strcmp0 (priv->ip_iface, info->name)) { - _LOGI ("interface index %d renamed ip_iface (%d) from '%s' to '%s'", + _LOGI (LOGD_DEVICE, "interface index %d renamed ip_iface (%d) from '%s' to '%s'", priv->ifindex, nm_device_get_ip_ifindex (self), priv->ip_iface, info->name); g_free (priv->ip_iface); @@ -1220,7 +1220,7 @@ slave_state_changed (NMDevice *slave, NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); gboolean release = FALSE; - _LOGD ("slave %s state change %d (%s) -> %d (%s)", + _LOGD (LOGD_DEVICE, "slave %s state change %d (%s) -> %d (%s)", nm_device_get_iface (slave), slave_old_state, state_to_string (slave_old_state), @@ -1245,7 +1245,7 @@ slave_state_changed (NMDevice *slave, nm_device_release_one_slave (self, slave, TRUE, reason); /* Bridge/bond/team interfaces are left up until manually deactivated */ if (priv->slaves == NULL && priv->state == NM_DEVICE_STATE_ACTIVATED) - _LOGD ("last slave removed; remaining activated"); + _LOGD (LOGD_DEVICE, "last slave removed; remaining activated"); } } @@ -1356,9 +1356,9 @@ nm_device_master_check_slave_physical_port (NMDevice *self, NMDevice *slave, existing_physical_port_id = nm_device_get_physical_port_id (info->slave); if (!g_strcmp0 (slave_physical_port_id, existing_physical_port_id)) { - _LOG (LOGL_WARN, log_domain, "slave %s shares a physical port with existing slave %s", - nm_device_get_ip_iface (slave), - nm_device_get_ip_iface (info->slave)); + _LOGW (log_domain, "slave %s shares a physical port with existing slave %s", + nm_device_get_ip_iface (slave), + nm_device_get_ip_iface (info->slave)); /* Since this function will get called for every slave, we only have * to warn about the first match we find; if there are other matches * later in the list, we will have already warned about them matching @@ -1433,15 +1433,15 @@ nm_device_slave_notify_enslave (NMDevice *self, gboolean success) if (!priv->enslaved) { if (success) { if (activating) { - _LOGI ("Activation: connection '%s' enslaved, continuing activation", + _LOGI (LOGD_DEVICE, "Activation: connection '%s' enslaved, continuing activation", nm_connection_get_id (connection)); } else - _LOGI ("enslaved to %s", nm_device_get_iface (priv->master)); + _LOGI (LOGD_DEVICE, "enslaved to %s", nm_device_get_iface (priv->master)); priv->enslaved = TRUE; g_object_notify (G_OBJECT (self), NM_DEVICE_MASTER); } else if (activating) { - _LOGW ("Activation: connection '%s' could not be enslaved", + _LOGW (LOGD_DEVICE, "Activation: connection '%s' could not be enslaved", nm_connection_get_id (connection)); } } @@ -1485,13 +1485,13 @@ nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason) master_status = "deactivated"; } - _LOGD ("Activation: connection '%s' master %s", + _LOGD (LOGD_DEVICE, "Activation: connection '%s' master %s", nm_connection_get_id (connection), master_status); nm_device_queue_state (self, new_state, reason); } else - _LOGI ("released from master %s", nm_device_get_iface (priv->master)); + _LOGI (LOGD_DEVICE, "released from master %s", nm_device_get_iface (priv->master)); if (priv->enslaved) { priv->enslaved = FALSE; @@ -1713,7 +1713,7 @@ nm_device_generate_connection (NMDevice *self, NMDevice *master) /* Return NULL if device is unconfigured. */ if (!device_has_config (self)) { - _LOGD ("device has no existing configuration"); + _LOGD (LOGD_DEVICE, "device has no existing configuration"); return NULL; } @@ -1739,7 +1739,7 @@ nm_device_generate_connection (NMDevice *self, NMDevice *master) connection, &error)) { - _LOGE ("master device '%s' failed to update slave connection: %s", + _LOGE (LOGD_DEVICE, "master device '%s' failed to update slave connection: %s", nm_device_get_iface (master), error ? error->message : "(unknown error)"); g_error_free (error); g_object_unref (connection); @@ -1758,7 +1758,7 @@ nm_device_generate_connection (NMDevice *self, NMDevice *master) /* Check the connection in case of update_connection() bug. */ if (!nm_connection_verify (connection, &error)) { - _LOGE ("Generated connection does not verify: %s", error->message); + _LOGE (LOGD_DEVICE, "Generated connection does not verify: %s", error->message); g_clear_error (&error); g_object_unref (connection); return NULL; @@ -1772,7 +1772,7 @@ nm_device_generate_connection (NMDevice *self, NMDevice *master) if ( g_strcmp0 (ip4_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0 && g_strcmp0 (ip6_method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0 && !nm_setting_connection_get_master (NM_SETTING_CONNECTION (s_con))) { - _LOGD ("ignoring generated connection (no IP and not slave)"); + _LOGD (LOGD_DEVICE, "ignoring generated connection (no IP and not slave)"); g_object_unref (connection); connection = NULL; } @@ -2055,7 +2055,7 @@ activation_source_schedule (NMDevice *self, GSourceFunc func, int family) } if (*act_source_id) - _LOGE ("activation stage already scheduled"); + _LOGE (LOGD_DEVICE, "activation stage already scheduled"); /* Don't bother rescheduling the same function that's about to * run anyway. Fixes issues with crappy wireless drivers sending @@ -2114,7 +2114,7 @@ master_ready_cb (NMActiveConnection *active, self, nm_active_connection_get_assumed (active) ? FALSE : TRUE); - _LOGD ("master connection ready; master device %s", + _LOGD (LOGD_DEVICE, "master connection ready; master device %s", nm_device_get_iface (priv->master)); if (priv->master_ready_id) { @@ -2154,7 +2154,7 @@ nm_device_activate_stage1_device_prepare (gpointer user_data) /* Notify the new ActiveConnection along with the state change */ g_object_notify (G_OBJECT (self), NM_DEVICE_ACTIVE_CONNECTION); - _LOGI ("Activation: Stage 1 of 5 (Device Prepare) started..."); + _LOGI (LOGD_DEVICE, "Activation: Stage 1 of 5 (Device Prepare) started..."); nm_device_state_changed (self, NM_DEVICE_STATE_PREPARE, NM_DEVICE_STATE_REASON_NONE); /* Assumed connections were already set up outside NetworkManager */ @@ -2174,7 +2174,7 @@ nm_device_activate_stage1_device_prepare (gpointer user_data) if (nm_active_connection_get_master_ready (active)) master_ready_cb (active, NULL, self); else { - _LOGD ("waiting for master connection to become ready"); + _LOGD (LOGD_DEVICE, "waiting for master connection to become ready"); /* Attach a signal handler and wait for the master connection to begin activating */ g_assert (priv->master_ready_id == 0); @@ -2188,7 +2188,7 @@ nm_device_activate_stage1_device_prepare (gpointer user_data) nm_device_activate_schedule_stage2_device_config (self); out: - _LOGI ("Activation: Stage 1 of 5 (Device Prepare) complete."); + _LOGI (LOGD_DEVICE, "Activation: Stage 1 of 5 (Device Prepare) complete."); return FALSE; } @@ -2211,7 +2211,7 @@ nm_device_activate_schedule_stage1_device_prepare (NMDevice *self) activation_source_schedule (self, nm_device_activate_stage1_device_prepare, 0); - _LOGI ("Activation: Stage 1 of 5 (Device Prepare) scheduled..."); + _LOGI (LOGD_DEVICE, "Activation: Stage 1 of 5 (Device Prepare) scheduled..."); } static NMActStageReturn @@ -2242,7 +2242,7 @@ nm_device_activate_stage2_device_config (gpointer user_data) /* Clear the activation source ID now that this stage has run */ activation_source_clear (self, FALSE, 0); - _LOGI ("Activation: Stage 2 of 5 (Device Configure) starting..."); + _LOGI (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) starting..."); nm_device_state_changed (self, NM_DEVICE_STATE_CONFIG, NM_DEVICE_STATE_REASON_NONE); /* Assumed connections were already set up outside NetworkManager */ @@ -2277,12 +2277,12 @@ nm_device_activate_stage2_device_config (gpointer user_data) nm_device_queue_recheck_assume (info->slave); } - _LOGI ("Activation: Stage 2 of 5 (Device Configure) successful."); + _LOGI (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) successful."); nm_device_activate_schedule_stage3_ip_config_start (self); out: - _LOGI ("Activation: Stage 2 of 5 (Device Configure) complete."); + _LOGI (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) complete."); return FALSE; } @@ -2305,7 +2305,7 @@ nm_device_activate_schedule_stage2_device_config (NMDevice *self) activation_source_schedule (self, nm_device_activate_stage2_device_config, 0); - _LOGI ("Activation: Stage 2 of 5 (Device Configure) scheduled..."); + _LOGI (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) scheduled..."); } /*********************************************/ @@ -2398,20 +2398,20 @@ nm_device_handle_autoip4_event (NMDevice *self, NMIP4Config *config; if (inet_pton (AF_INET, address, &lla) <= 0) { - _LOG (LOGL_ERR, LOGD_AUTOIP4, "invalid address %s received from avahi-autoipd.", address); + _LOGE (LOGD_AUTOIP4, "invalid address %s received from avahi-autoipd.", address); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_AUTOIP_ERROR); return; } if ((lla & IPV4LL_NETMASK) != IPV4LL_NETWORK) { - _LOG (LOGL_ERR, LOGD_AUTOIP4, "invalid address %s received from avahi-autoipd (not link-local).", address); + _LOGE (LOGD_AUTOIP4, "invalid address %s received from avahi-autoipd (not link-local).", address); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_AUTOIP_ERROR); return; } config = aipd_get_ip4_config (self, lla); if (config == NULL) { - _LOG (LOGL_ERR, LOGD_AUTOIP4, "failed to get autoip config"); + _LOGE (LOGD_AUTOIP4, "failed to get autoip config"); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE); return; } @@ -2421,7 +2421,7 @@ nm_device_handle_autoip4_event (NMDevice *self, nm_device_activate_schedule_ip4_config_result (self, config); } else if (priv->ip4_state == IP_DONE) { if (!ip4_config_merge_and_apply (self, config, TRUE, &reason)) { - _LOG (LOGL_ERR, LOGD_AUTOIP4, "failed to update IP4 config for autoip change."); + _LOGE (LOGD_AUTOIP4, "failed to update IP4 config for autoip change."); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); } } else @@ -2429,7 +2429,7 @@ nm_device_handle_autoip4_event (NMDevice *self, g_object_unref (config); } else { - _LOG (LOGL_WARN, LOGD_AUTOIP4, "autoip address %s no longer valid because '%s'.", address, event); + _LOGW (LOGD_AUTOIP4, "autoip address %s no longer valid because '%s'.", address, event); /* The address is gone; terminate the connection or fail activation */ nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED); @@ -2448,13 +2448,13 @@ aipd_watch_cb (GPid pid, gint status, gpointer user_data) priv->aipd_watch = 0; if (WIFEXITED (status)) - _LOG (LOGL_DEBUG, LOGD_AUTOIP4, "avahi-autoipd exited with error code %d", WEXITSTATUS (status)); + _LOGD (LOGD_AUTOIP4, "avahi-autoipd exited with error code %d", WEXITSTATUS (status)); else if (WIFSTOPPED (status)) - _LOG (LOGL_WARN, LOGD_AUTOIP4, "avahi-autoipd stopped unexpectedly with signal %d", WSTOPSIG (status)); + _LOGW (LOGD_AUTOIP4, "avahi-autoipd stopped unexpectedly with signal %d", WSTOPSIG (status)); else if (WIFSIGNALED (status)) - _LOG (LOGL_WARN, LOGD_AUTOIP4, "avahi-autoipd died with signal %d", WTERMSIG (status)); + _LOGW (LOGD_AUTOIP4, "avahi-autoipd died with signal %d", WTERMSIG (status)); else - _LOG (LOGL_WARN, LOGD_AUTOIP4, "avahi-autoipd died from an unknown cause"); + _LOGW (LOGD_AUTOIP4, "avahi-autoipd died from an unknown cause"); aipd_cleanup (self); @@ -2470,7 +2470,7 @@ aipd_timeout_cb (gpointer user_data) NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); if (priv->aipd_timeout) { - _LOG (LOGL_INFO, LOGD_AUTOIP4, "avahi-autoipd timed out."); + _LOGI (LOGD_AUTOIP4, "avahi-autoipd timed out."); priv->aipd_timeout = 0; aipd_cleanup (self); @@ -2526,9 +2526,9 @@ aipd_start (NMDevice *self, NMDeviceStateReason *reason) } if (!*aipd_binary) { - _LOG (LOGL_WARN, LOGD_DEVICE | LOGD_AUTOIP4, - "Activation: Stage 3 of 5 (IP Configure Start) failed" - " to start avahi-autoipd: not found"); + _LOGW (LOGD_DEVICE | LOGD_AUTOIP4, + "Activation: Stage 3 of 5 (IP Configure Start) failed" + " to start avahi-autoipd: not found"); *reason = NM_DEVICE_STATE_REASON_AUTOIP_START_FAILED; return NM_ACT_STAGE_RETURN_FAILURE; } @@ -2543,23 +2543,23 @@ aipd_start (NMDevice *self, NMDeviceStateReason *reason) argv[i++] = NULL; cmdline = g_strjoinv (" ", argv); - _LOG (LOGL_DEBUG, LOGD_AUTOIP4, "running: %s", cmdline); + _LOGD (LOGD_AUTOIP4, "running: %s", cmdline); g_free (cmdline); if (!g_spawn_async ("/", argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, &aipd_child_setup, NULL, &(priv->aipd_pid), &error)) { - _LOG (LOGL_WARN, LOGD_DEVICE | LOGD_AUTOIP4, - "Activation: Stage 3 of 5 (IP Configure Start) failed" - " to start avahi-autoipd: %s", - error && error->message ? error->message : "(unknown)"); + _LOGW (LOGD_DEVICE | LOGD_AUTOIP4, + "Activation: Stage 3 of 5 (IP Configure Start) failed" + " to start avahi-autoipd: %s", + error && error->message ? error->message : "(unknown)"); g_clear_error (&error); aipd_cleanup (self); return NM_ACT_STAGE_RETURN_FAILURE; } - _LOG (LOGL_INFO, LOGD_DEVICE | LOGD_AUTOIP4, - "Activation: Stage 3 of 5 (IP Configure Start) started" - " avahi-autoipd..."); + _LOGI (LOGD_DEVICE | LOGD_AUTOIP4, + "Activation: Stage 3 of 5 (IP Configure Start) started" + " avahi-autoipd..."); /* Monitor the child process so we know when it dies */ priv->aipd_watch = g_child_watch_add (priv->aipd_pid, aipd_watch_cb, self); @@ -2657,7 +2657,7 @@ dhcp4_lease_change (NMDevice *self, NMIP4Config *config) g_return_if_fail (config != NULL); if (!ip4_config_merge_and_apply (self, config, TRUE, &reason)) { - _LOG (LOGL_WARN, LOGD_DHCP4, "failed to update IPv4 config for DHCP change."); + _LOGW (LOGD_DHCP4, "failed to update IPv4 config for DHCP change."); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); } else { /* Notify dispatcher scripts of new DHCP4 config */ @@ -2711,12 +2711,12 @@ dhcp4_state_changed (NMDHCPClient *client, g_return_if_fail (nm_dhcp_client_get_ipv6 (client) == FALSE); g_return_if_fail (!ip4_config || NM_IS_IP4_CONFIG (ip4_config)); - _LOG (LOGL_DEBUG, LOGD_DHCP4, "new DHCPv4 client state %d", state); + _LOGD (LOGD_DHCP4, "new DHCPv4 client state %d", state); switch (state) { case NM_DHCP_STATE_BOUND: if (!ip4_config) { - _LOG (LOGL_WARN, LOGD_DHCP4, "failed to get IPv4 config in response to DHCP event."); + _LOGW (LOGD_DHCP4, "failed to get IPv4 config in response to DHCP event."); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE); @@ -2810,7 +2810,7 @@ nm_device_dhcp4_renew (NMDevice *self, gboolean release) g_return_val_if_fail (priv->dhcp4_client != NULL, FALSE); - _LOG (LOGL_INFO, LOGD_DHCP4, "DHCPv4 lease renewal requested"); + _LOGI (LOGD_DHCP4, "DHCPv4 lease renewal requested"); /* Terminate old DHCP instance and release the old lease */ dhcp4_cleanup (self, TRUE, release); @@ -2857,7 +2857,7 @@ reserve_shared_ip (NMDevice *self, NMSettingIP4Config *s_ip4, NMPlatformIP4Addre while (g_hash_table_lookup (shared_ips, GUINT_TO_POINTER (start + count))) { count += ntohl (0x100); if (count > ntohl (0xFE00)) { - _LOG (LOGL_ERR, LOGD_SHARING, "ran out of shared IP addresses!"); + _LOGE (LOGD_SHARING, "ran out of shared IP addresses!"); return FALSE; } } @@ -2948,8 +2948,8 @@ act_stage3_ip4_config_start (NMDevice *self, if ( strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) != 0 && priv->is_master && !priv->carrier) { - _LOG (LOGL_INFO, LOGD_IP4 | LOGD_DEVICE, - "IPv4 config waiting until carrier is on"); + _LOGI (LOGD_IP4 | LOGD_DEVICE, + "IPv4 config waiting until carrier is on"); return NM_ACT_STAGE_RETURN_WAIT; } @@ -2962,8 +2962,8 @@ act_stage3_ip4_config_start (NMDevice *self, g_slist_free (slaves); if (ready_slaves == FALSE) { - _LOG (LOGL_INFO, LOGD_DEVICE | LOGD_IP4, - "IPv4 config waiting until slaves are ready"); + _LOGI (LOGD_DEVICE | LOGD_IP4, + "IPv4 config waiting until slaves are ready"); return NM_ACT_STAGE_RETURN_WAIT; } } @@ -2989,7 +2989,7 @@ act_stage3_ip4_config_start (NMDevice *self, /* Nothing to do... */ ret = NM_ACT_STAGE_RETURN_STOP; } else - _LOG (LOGL_WARN, LOGD_IP4, "unhandled IPv4 config method '%s'; will fail", method); + _LOGW (LOGD_IP4, "unhandled IPv4 config method '%s'; will fail", method); return ret; } @@ -3079,7 +3079,7 @@ dhcp6_lease_change (NMDevice *self) NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; if (priv->dhcp6_ip6_config == NULL) { - _LOG (LOGL_WARN, LOGD_DHCP6, "failed to get DHCPv6 config for rebind"); + _LOGW (LOGD_DHCP6, "failed to get DHCPv6 config for rebind"); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED); return; } @@ -3091,7 +3091,7 @@ dhcp6_lease_change (NMDevice *self) /* Apply the updated config */ if (ip6_config_merge_and_apply (self, TRUE, &reason) == FALSE) { - _LOG (LOGL_WARN, LOGD_DHCP6, "failed to update IPv6 config in response to DHCP event."); + _LOGW (LOGD_DHCP6, "failed to update IPv6 config in response to DHCP event."); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); } else { /* Notify dispatcher scripts of new DHCPv6 config */ @@ -3162,7 +3162,7 @@ dhcp6_state_changed (NMDHCPClient *client, g_return_if_fail (nm_dhcp_client_get_ipv6 (client) == TRUE); g_return_if_fail (!ip6_config || NM_IS_IP6_CONFIG (ip6_config)); - _LOG (LOGL_DEBUG, LOGD_DHCP6, "new DHCPv6 client state %d", state); + _LOGD (LOGD_DHCP6, "new DHCPv6 client state %d", state); switch (state) { case NM_DHCP_STATE_BOUND: @@ -3285,7 +3285,7 @@ nm_device_dhcp6_renew (NMDevice *self, gboolean release) g_return_val_if_fail (priv->dhcp6_client != NULL, FALSE); - _LOG (LOGL_INFO, LOGD_DHCP6, "DHCPv6 lease renewal requested"); + _LOGI (LOGD_DHCP6, "DHCPv6 lease renewal requested"); /* Terminate old DHCP instance and release the old lease */ dhcp6_cleanup (self, TRUE, release); @@ -3338,7 +3338,7 @@ linklocal6_timeout_cb (gpointer user_data) linklocal6_cleanup (self); - _LOGD ("linklocal6: waiting for link-local addresses failed due to timeout"); + _LOGD (LOGD_DEVICE, "linklocal6: waiting for link-local addresses failed due to timeout"); nm_device_activate_schedule_ip6_config_timeout (self); return G_SOURCE_REMOVE; @@ -3361,7 +3361,7 @@ linklocal6_complete (NMDevice *self) method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP6_CONFIG); - _LOGD ("linklocal6: waiting for link-local addresses successful, continue with method %s", method); + _LOGD (LOGD_DEVICE, "linklocal6: waiting for link-local addresses successful, continue with method %s", method); if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0) { if (!addrconf6_start_with_link_ready (self)) { @@ -3390,7 +3390,7 @@ linklocal6_start (NMDevice *self) g_assert (connection); method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP6_CONFIG); - _LOGD ("linklocal6: starting IPv6 with method '%s', but the device has no link-local addresses configured. Wait.", method); + _LOGD (LOGD_DEVICE, "linklocal6: starting IPv6 with method '%s', but the device has no link-local addresses configured. Wait.", method); priv->linklocal6_timeout_id = g_timeout_add_seconds (5, linklocal6_timeout_cb, self); @@ -3578,9 +3578,9 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *self) case NM_RDISC_DHCP_LEVEL_NONE: break; default: - _LOG (LOGL_INFO, LOGD_DEVICE | LOGD_DHCP6, - "Activation: Stage 3 of 5 (IP Configure Start) starting DHCPv6" - " as requested by IPv6 router..."); + _LOGI (LOGD_DEVICE | LOGD_DHCP6, + "Activation: Stage 3 of 5 (IP Configure Start) starting DHCPv6" + " as requested by IPv6 router..."); switch (dhcp6_start (self, connection, priv->dhcp6_mode, &reason)) { case NM_ACT_STAGE_RETURN_SUCCESS: g_warn_if_reached (); @@ -3613,7 +3613,7 @@ addrconf6_start_with_link_ready (NMDevice *self) g_assert (priv->rdisc); if (!NM_DEVICE_GET_CLASS (self)->get_ip_iface_identifier (self, &iid)) { - _LOG (LOGL_WARN, LOGD_IP6, "failed to get interface identifier"); + _LOGW (LOGD_IP6, "failed to get interface identifier"); return FALSE; } nm_rdisc_set_iid (priv->rdisc, iid); @@ -3648,7 +3648,7 @@ addrconf6_start (NMDevice *self, NMSettingIP6ConfigPrivacy use_tempaddr) priv->rdisc = nm_lndp_rdisc_new (nm_device_get_ip_ifindex (self), ip_iface); if (!priv->rdisc) { - _LOG (LOGL_ERR, LOGD_IP6, "failed to start router discovery (%s)", ip_iface); + _LOGE (LOGD_IP6, "failed to start router discovery (%s)", ip_iface); return FALSE; } @@ -3828,8 +3828,8 @@ act_stage3_ip6_config_start (NMDevice *self, if ( strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) != 0 && priv->is_master && !priv->carrier) { - _LOG (LOGL_INFO, LOGD_IP6 | LOGD_DEVICE, - "IPv6 config waiting until carrier is on"); + _LOGI (LOGD_IP6 | LOGD_DEVICE, + "IPv6 config waiting until carrier is on"); return NM_ACT_STAGE_RETURN_WAIT; } @@ -3842,8 +3842,8 @@ act_stage3_ip6_config_start (NMDevice *self, g_slist_free (slaves); if (ready_slaves == FALSE) { - _LOG (LOGL_INFO, LOGD_DEVICE | LOGD_IP6, - "IPv6 config waiting until slaves are ready"); + _LOGI (LOGD_DEVICE | LOGD_IP6, + "IPv6 config waiting until slaves are ready"); return NM_ACT_STAGE_RETURN_WAIT; } } @@ -3895,7 +3895,7 @@ act_stage3_ip6_config_start (NMDevice *self, ret = NM_ACT_STAGE_RETURN_SUCCESS; } else - _LOG (LOGL_WARN, LOGD_IP6, "unhandled IPv6 config method '%s'; will fail", method); + _LOGW (LOGD_IP6, "unhandled IPv6 config method '%s'; will fail", method); /* Other methods (shared) aren't implemented yet */ @@ -4015,12 +4015,12 @@ nm_device_activate_stage3_ip_config_start (gpointer user_data) priv->ip4_state = priv->ip6_state = IP_WAIT; iface = nm_device_get_iface (self); - _LOGI ("Activation: Stage 3 of 5 (IP Configure Start) started..."); + _LOGI (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) started..."); nm_device_state_changed (self, NM_DEVICE_STATE_IP_CONFIG, NM_DEVICE_STATE_REASON_NONE); /* Device should be up before we can do anything with it */ if (!nm_platform_link_is_up (nm_device_get_ip_ifindex (self))) - _LOGW ("interface %s not up for IP configuration", nm_device_get_ip_iface (self)); + _LOGW (LOGD_DEVICE, "interface %s not up for IP configuration", nm_device_get_ip_iface (self)); /* If the device is a slave, then we don't do any IP configuration but we * use the IP config stage to indicate to the master we're ready for @@ -4035,7 +4035,7 @@ nm_device_activate_stage3_ip_config_start (gpointer user_data) if (master) { master_device = nm_active_connection_get_device (master); if (priv->ip4_state == IP_WAIT && priv->ip6_state == IP_WAIT) { - _LOGI ("Activation: connection '%s' waiting on master '%s'", + _LOGI (LOGD_DEVICE, "Activation: connection '%s' waiting on master '%s'", nm_connection_get_id (nm_device_get_connection (self)), master_device ? nm_device_get_iface (master_device) : "(unknown)"); } @@ -4056,7 +4056,7 @@ nm_device_activate_stage3_ip_config_start (gpointer user_data) } out: - _LOGI ("Activation: Stage 3 of 5 (IP Configure Start) complete."); + _LOGI (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) complete."); return FALSE; } @@ -4075,7 +4075,7 @@ fw_change_zone_cb (GError *error, gpointer user_data) activation_source_schedule (self, nm_device_activate_stage3_ip_config_start, 0); - _LOGI ("Activation: Stage 3 of 5 (IP Configure Start) scheduled."); + _LOGI (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) scheduled."); } /* @@ -4102,7 +4102,7 @@ nm_device_activate_schedule_stage3_ip_config_start (NMDevice *self) s_con = nm_connection_get_setting_connection (connection); zone = nm_setting_connection_get_zone (s_con); - _LOGD ("Activation: setting firewall zone '%s'", zone ? zone : "default"); + _LOGD (LOGD_DEVICE, "Activation: setting firewall zone '%s'", zone ? zone : "default"); priv->fw_call = nm_firewall_manager_add_or_change_zone (nm_firewall_manager_get (), nm_device_get_ip_iface (self), zone, @@ -4141,8 +4141,8 @@ nm_device_activate_ip4_config_timeout (gpointer user_data) activation_source_clear (self, FALSE, AF_INET); iface = nm_device_get_iface (self); - _LOG (LOGL_INFO, LOGD_DEVICE | LOGD_IP4, - "Activation: Stage 4 of 5 (IPv4 Configure Timeout) started..."); + _LOGI (LOGD_DEVICE | LOGD_IP4, + "Activation: Stage 4 of 5 (IPv4 Configure Timeout) started..."); ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip4_config_timeout (self, &reason); if (ret == NM_ACT_STAGE_RETURN_POSTPONE) @@ -4162,8 +4162,8 @@ nm_device_activate_ip4_config_timeout (gpointer user_data) NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE); out: - _LOG (LOGL_INFO, LOGD_DEVICE | LOGD_IP4, - "Activation: Stage 4 of 5 (IPv4 Configure Timeout) complete."); + _LOGI (LOGD_DEVICE | LOGD_IP4, + "Activation: Stage 4 of 5 (IPv4 Configure Timeout) complete."); return FALSE; } @@ -4186,8 +4186,8 @@ nm_device_activate_schedule_ip4_config_timeout (NMDevice *self) activation_source_schedule (self, nm_device_activate_ip4_config_timeout, AF_INET); - _LOG (LOGL_INFO, LOGD_DEVICE | LOGD_IP4, - "Activation: Stage 4 of 5 (IPv4 Configure Timeout) scheduled..."); + _LOGI (LOGD_DEVICE | LOGD_IP4, + "Activation: Stage 4 of 5 (IPv4 Configure Timeout) scheduled..."); } @@ -4222,8 +4222,8 @@ nm_device_activate_ip6_config_timeout (gpointer user_data) activation_source_clear (self, FALSE, AF_INET6); iface = nm_device_get_iface (self); - _LOG (LOGL_INFO, LOGD_DEVICE | LOGD_IP6, - "Activation: Stage 4 of 5 (IPv6 Configure Timeout) started..."); + _LOGI (LOGD_DEVICE | LOGD_IP6, + "Activation: Stage 4 of 5 (IPv6 Configure Timeout) started..."); ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip6_config_timeout (self, &reason); if (ret == NM_ACT_STAGE_RETURN_POSTPONE) @@ -4243,8 +4243,8 @@ nm_device_activate_ip6_config_timeout (gpointer user_data) NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE); out: - _LOG (LOGL_INFO, LOGD_DEVICE | LOGD_IP6, - "Activation: Stage 4 of 5 (IPv6 Configure Timeout) complete."); + _LOGI (LOGD_DEVICE | LOGD_IP6, + "Activation: Stage 4 of 5 (IPv6 Configure Timeout) complete."); return FALSE; } @@ -4267,8 +4267,8 @@ nm_device_activate_schedule_ip6_config_timeout (NMDevice *self) activation_source_schedule (self, nm_device_activate_ip6_config_timeout, AF_INET6); - _LOG (LOGL_INFO, LOGD_DEVICE | LOGD_IP6, - "Activation: Stage 4 of 5 (IPv6 Configure Timeout) scheduled..."); + _LOGI (LOGD_DEVICE | LOGD_IP6, + "Activation: Stage 4 of 5 (IPv6 Configure Timeout) scheduled..."); } static void @@ -4384,8 +4384,8 @@ start_sharing (NMDevice *self, NMIP4Config *config) nm_act_request_set_shared (req, TRUE); if (!nm_dnsmasq_manager_start (priv->dnsmasq_manager, config, &error)) { - _LOG (LOGL_ERR, LOGD_SHARING, "share: (%s) failed to start dnsmasq: %s", - ip_iface, (error && error->message) ? error->message : "(unknown)"); + _LOGE (LOGD_SHARING, "share: (%s) failed to start dnsmasq: %s", + ip_iface, (error && error->message) ? error->message : "(unknown)"); g_error_free (error); nm_act_request_set_shared (req, FALSE); return FALSE; @@ -4423,16 +4423,16 @@ send_arps (NMDevice *self, const char *mode_arg) ipaddr = nm_ip4_address_get_address (addr); argv[ip_arg] = (char *) nm_utils_inet4_ntop (ipaddr, NULL); - _LOG (LOGL_DEBUG, LOGD_DEVICE | LOGD_IP4, - "arping: run %s", (tmp_str = g_strjoinv (" ", (char **) argv))); + _LOGD (LOGD_DEVICE | LOGD_IP4, + "arping: run %s", (tmp_str = g_strjoinv (" ", (char **) argv))); g_spawn_async (NULL, (char **) argv, NULL, G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, nm_unblock_posix_signals, NULL, NULL, &error); if (error) { - _LOG (LOGL_WARN, LOGD_DEVICE | LOGD_IP4, - "arping: could not send ARP for local address %s: %s", - argv[ip_arg], error->message); + _LOGW (LOGD_DEVICE | LOGD_IP4, + "arping: could not send ARP for local address %s: %s", + argv[ip_arg], error->message); g_clear_error (&error); } } @@ -4504,7 +4504,7 @@ nm_device_activate_ip4_config_commit (gpointer user_data) activation_source_clear (self, FALSE, AF_INET); iface = nm_device_get_iface (self); - _LOGI ("Activation: Stage 5 of 5 (IPv4 Commit) started..."); + _LOGI (LOGD_DEVICE, "Activation: Stage 5 of 5 (IPv4 Commit) started..."); req = nm_device_get_act_request (self); g_assert (req); @@ -4513,12 +4513,12 @@ nm_device_activate_ip4_config_commit (gpointer user_data) /* Device should be up before we can do anything with it */ if (!nm_platform_link_is_up (nm_device_get_ip_ifindex (self))) - _LOGW ("interface %s not up for IP configuration", nm_device_get_ip_iface (self)); + _LOGW (LOGD_DEVICE, "interface %s not up for IP configuration", nm_device_get_ip_iface (self)); /* NULL to use the existing priv->dev_ip4_config */ if (!ip4_config_merge_and_apply (self, NULL, TRUE, &reason)) { - _LOG (LOGL_INFO, LOGD_DEVICE | LOGD_IP4, - "Activation: Stage 5 of 5 (IPv4 Commit) failed"); + _LOGI (LOGD_DEVICE | LOGD_IP4, + "Activation: Stage 5 of 5 (IPv4 Commit) failed"); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); goto out; } @@ -4528,7 +4528,7 @@ nm_device_activate_ip4_config_commit (gpointer user_data) if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED) == 0) { if (!start_sharing (self, priv->ip4_config)) { - _LOG (LOGL_WARN, LOGD_SHARING, "Activation: Stage 5 of 5 (IPv4 Commit) start sharing failed."); + _LOGW (LOGD_SHARING, "Activation: Stage 5 of 5 (IPv4 Commit) start sharing failed."); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_SHARED_START_FAILED); goto out; } @@ -4560,7 +4560,7 @@ nm_device_activate_ip4_config_commit (gpointer user_data) nm_device_state_changed (self, NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE); out: - _LOGI ("Activation: Stage 5 of 5 (IPv4 Commit) complete."); + _LOGI (LOGD_DEVICE, "Activation: Stage 5 of 5 (IPv4 Commit) complete."); return FALSE; } @@ -4579,8 +4579,8 @@ nm_device_activate_schedule_ip4_config_result (NMDevice *self, NMIP4Config *conf activation_source_schedule (self, nm_device_activate_ip4_config_commit, AF_INET); - _LOG (LOGL_INFO, LOGD_DEVICE | LOGD_IP4, - "Activation: Stage 5 of 5 (IPv4 Configure Commit) scheduled..."); + _LOGI (LOGD_DEVICE | LOGD_IP4, + "Activation: Stage 5 of 5 (IPv4 Configure Commit) scheduled..."); } gboolean @@ -4651,8 +4651,8 @@ nm_device_activate_ip6_config_commit (gpointer user_data) if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG) nm_device_state_changed (self, NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE); } else { - _LOG (LOGL_WARN, LOGD_DEVICE | LOGD_IP6, - "Activation: Stage 5 of 5 (IPv6 Commit) failed"); + _LOGW (LOGD_DEVICE | LOGD_IP6, + "Activation: Stage 5 of 5 (IPv6 Commit) failed"); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); } @@ -4738,7 +4738,7 @@ _update_ip4_address (NMDevice *self) fd = socket (PF_INET, SOCK_DGRAM, 0); if (fd < 0) { - _LOG (LOGL_ERR, LOGD_IP4, "couldn't open control socket."); + _LOGE (LOGD_IP4, "couldn't open control socket."); return; } @@ -4786,7 +4786,7 @@ delete_on_deactivate_link_delete (gpointer user_data) priv->delete_on_deactivate_data = NULL; } - _LOGD ("delete_on_deactivate: cleanup and delete virtual link #%d (id=%u)", + _LOGD (LOGD_DEVICE, "delete_on_deactivate: cleanup and delete virtual link #%d (id=%u)", data->ifindex, data->idle_add_id); nm_platform_link_delete (data->ifindex); g_free (data); @@ -4805,7 +4805,7 @@ delete_on_deactivate_unschedule (NMDevice *self) g_source_remove (data->idle_add_id); g_object_remove_weak_pointer (G_OBJECT (self), (void **) &data->device); - _LOGD ("delete_on_deactivate: cancel cleanup and delete virtual link #%d (id=%u)", + _LOGD (LOGD_DEVICE, "delete_on_deactivate: cancel cleanup and delete virtual link #%d (id=%u)", data->ifindex, data->idle_add_id); g_free (data); } @@ -4836,7 +4836,7 @@ delete_on_deactivate_check_and_schedule (NMDevice *self, int ifindex) data->idle_add_id = g_idle_add (delete_on_deactivate_link_delete, data); priv->delete_on_deactivate_data = data; - _LOGD ("delete_on_deactivate: schedule cleanup and delete virtual link #%d (id=%u)", + _LOGD (LOGD_DEVICE, "delete_on_deactivate: schedule cleanup and delete virtual link #%d (id=%u)", ifindex, data->idle_add_id); } @@ -4953,7 +4953,7 @@ _device_activate (NMDevice *self, NMActRequest *req) connection = nm_act_request_get_connection (req); g_assert (connection); - _LOGI ("Activation: starting connection '%s'", + _LOGI (LOGD_DEVICE, "Activation: starting connection '%s'", nm_connection_get_id (connection)); delete_on_deactivate_unschedule (self); @@ -4989,7 +4989,7 @@ nm_device_queue_activation (NMDevice *self, NMActRequest *req) priv->queued_act_request = g_object_ref (req); /* Deactivate existing activation request first */ - _LOGI ("disconnecting for new activation request."); + _LOGI (LOGD_DEVICE, "disconnecting for new activation request."); nm_device_state_changed (self, NM_DEVICE_STATE_DEACTIVATING, NM_DEVICE_STATE_REASON_NONE); @@ -5075,8 +5075,8 @@ nm_device_set_ip4_config (NMDevice *self, * this causes a re-read and reset. This should only happen for relevant changes */ nm_ip4_config_replace (old_config, new_config, &has_changes); if (has_changes) { - _LOG (LOGL_DEBUG, LOGD_IP4, "update IP4Config instance (%s)", - nm_ip4_config_get_dbus_path (old_config)); + _LOGD (LOGD_IP4, "update IP4Config instance (%s)", + nm_ip4_config_get_dbus_path (old_config)); } } else { has_changes = TRUE; @@ -5087,14 +5087,14 @@ nm_device_set_ip4_config (NMDevice *self, nm_ip4_config_export (new_config); } - _LOG (LOGL_DEBUG, LOGD_IP4, "set IP4Config instance (%s)", - nm_ip4_config_get_dbus_path (new_config)); + _LOGD (LOGD_IP4, "set IP4Config instance (%s)", + nm_ip4_config_get_dbus_path (new_config)); } } else if (old_config) { has_changes = TRUE; priv->ip4_config = NULL; - _LOG (LOGL_DEBUG, LOGD_IP4, "clear IP4Config instance (%s)", - nm_ip4_config_get_dbus_path (old_config)); + _LOGD (LOGD_IP4, "clear IP4Config instance (%s)", + nm_ip4_config_get_dbus_path (old_config)); /* Device config is invalid if combined config is invalid */ g_clear_object (&priv->dev_ip4_config); } @@ -5143,7 +5143,7 @@ nm_device_set_vpn4_config (NMDevice *self, NMIP4Config *config) /* NULL to use existing configs */ if (!ip4_config_merge_and_apply (self, NULL, TRUE, NULL)) - _LOG (LOGL_WARN, LOGD_IP4, "failed to set VPN routes for device"); + _LOGW (LOGD_IP4, "failed to set VPN routes for device"); } void @@ -5160,7 +5160,7 @@ nm_device_set_wwan_ip4_config (NMDevice *self, NMIP4Config *config) /* NULL to use existing configs */ if (!ip4_config_merge_and_apply (self, NULL, TRUE, NULL)) - _LOG (LOGL_WARN, LOGD_IP4, "failed to set WWAN IPv4 configuration"); + _LOGW (LOGD_IP4, "failed to set WWAN IPv4 configuration"); } static gboolean @@ -5198,8 +5198,8 @@ nm_device_set_ip6_config (NMDevice *self, * this causes a re-read and reset. This should only happen for relevant changes */ nm_ip6_config_replace (old_config, new_config, &has_changes); if (has_changes) { - _LOG (LOGL_DEBUG, LOGD_IP6, "update IP6Config instance (%s)", - nm_ip6_config_get_dbus_path (old_config)); + _LOGD (LOGD_IP6, "update IP6Config instance (%s)", + nm_ip6_config_get_dbus_path (old_config)); } } else { has_changes = TRUE; @@ -5210,14 +5210,14 @@ nm_device_set_ip6_config (NMDevice *self, nm_ip6_config_export (new_config); } - _LOG (LOGL_DEBUG, LOGD_IP4, "set IP6Config instance (%s)", - nm_ip6_config_get_dbus_path (new_config)); + _LOGD (LOGD_IP4, "set IP6Config instance (%s)", + nm_ip6_config_get_dbus_path (new_config)); } } else if (old_config) { has_changes = TRUE; priv->ip6_config = NULL; - _LOG (LOGL_DEBUG, LOGD_IP6, "clear IP6Config instance (%s)", - nm_ip6_config_get_dbus_path (old_config)); + _LOGD (LOGD_IP6, "clear IP6Config instance (%s)", + nm_ip6_config_get_dbus_path (old_config)); } if (has_changes) { @@ -5262,7 +5262,7 @@ nm_device_set_vpn6_config (NMDevice *self, NMIP6Config *config) /* NULL to use existing configs */ if (!ip6_config_merge_and_apply (self, TRUE, NULL)) - _LOG (LOGL_WARN, LOGD_IP6, "failed to set VPN routes for device"); + _LOGW (LOGD_IP6, "failed to set VPN routes for device"); } void @@ -5279,7 +5279,7 @@ nm_device_set_wwan_ip6_config (NMDevice *self, NMIP6Config *config) /* NULL to use existing configs */ if (!ip6_config_merge_and_apply (self, TRUE, NULL)) - _LOG (LOGL_WARN, LOGD_IP6, "failed to set WWAN IPv6 configuration"); + _LOGW (LOGD_IP6, "failed to set WWAN IPv6 configuration"); } NMDHCP6Config * @@ -5390,13 +5390,13 @@ ip_check_ping_watch_cb (GPid pid, gint status, gpointer user_data) if (WIFEXITED (status)) { if (WEXITSTATUS (status) == 0) - _LOG (LOGL_DEBUG, log_domain, "ping: gateway ping succeeded"); + _LOGD (log_domain, "ping: gateway ping succeeded"); else { - _LOG (LOGL_WARN, log_domain, "ping: gateway ping failed with error code %d", - WEXITSTATUS (status)); + _LOGW (log_domain, "ping: gateway ping failed with error code %d", + WEXITSTATUS (status)); } } else - _LOG (LOGL_WARN, log_domain, "ping: stopped unexpectedly with status %d", status); + _LOGW (log_domain, "ping: stopped unexpectedly with status %d", status); /* We've got connectivity, proceed to pre_up */ ip_check_gw_ping_cleanup (self); @@ -5411,7 +5411,7 @@ ip_check_ping_timeout_cb (gpointer user_data) priv->gw_ping.timeout = 0; - _LOG (LOGL_WARN, priv->gw_ping.log_domain, "ping: gateway ping timed out"); + _LOGW (priv->gw_ping.log_domain, "ping: gateway ping timed out"); ip_check_gw_ping_cleanup (self); ip_check_pre_up (self); @@ -5437,8 +5437,8 @@ spawn_ping (NMDevice *self, args[6] = str_timeout = g_strdup_printf ("%u", timeout); - _LOG (LOGL_DEBUG, log_domain, "ping: running '%s'", - (tmp_str = g_strjoinv (" ", (gchar **) args))); + _LOGD (log_domain, "ping: running '%s'", + (tmp_str = g_strjoinv (" ", (gchar **) args))); success = g_spawn_async ("/", (gchar **) args, @@ -5453,7 +5453,7 @@ spawn_ping (NMDevice *self, priv->gw_ping.watch = g_child_watch_add (priv->gw_ping.pid, ip_check_ping_watch_cb, self); priv->gw_ping.timeout = g_timeout_add_seconds (timeout + 1, ip_check_ping_timeout_cb, self); } else { - _LOG (LOGL_WARN, log_domain, "ping: could not spawn %s: %s", binary, error->message); + _LOGW (log_domain, "ping: could not spawn %s: %s", binary, error->message); g_clear_error (&error); } @@ -5557,7 +5557,7 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware) g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); - _LOG (LOGL_DEBUG, LOGD_HW, "bringing up device."); + _LOGD (LOGD_HW, "bringing up device."); if (NM_DEVICE_GET_CLASS (self)->bring_up) { if (!NM_DEVICE_GET_CLASS (self)->bring_up (self, no_firmware)) @@ -5579,9 +5579,9 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware) if (!device_is_up) { if (block) - _LOG (LOGL_WARN, LOGD_HW, "device not up after timeout!"); + _LOGW (LOGD_HW, "device not up after timeout!"); else - _LOG (LOGL_DEBUG, LOGD_HW, "device not up immediately"); + _LOGD (LOGD_HW, "device not up immediately"); return FALSE; } @@ -5645,7 +5645,7 @@ nm_device_take_down (NMDevice *self, gboolean block) g_return_if_fail (NM_IS_DEVICE (self)); - _LOG (LOGL_DEBUG, LOGD_HW, "taking down device."); + _LOGD (LOGD_HW, "taking down device."); if (NM_DEVICE_GET_CLASS (self)->take_down) { if (!NM_DEVICE_GET_CLASS (self)->take_down (self)) @@ -5667,9 +5667,9 @@ nm_device_take_down (NMDevice *self, gboolean block) if (device_is_up) { if (block) - _LOG (LOGL_WARN, LOGD_HW, "device not down after timeout!"); + _LOGW (LOGD_HW, "device not down after timeout!"); else - _LOG (LOGL_DEBUG, LOGD_HW, "device not down immediately"); + _LOGD (LOGD_HW, "device not down immediately"); } } @@ -5682,7 +5682,7 @@ take_down (NMDevice *self) return nm_platform_link_set_down (ifindex); /* devices without ifindex are always up. */ - _LOG (LOGL_DEBUG, LOGD_HW, "cannot take down device without ifindex"); + _LOGD (LOGD_HW, "cannot take down device without ifindex"); return FALSE; } @@ -5900,7 +5900,7 @@ device_ip_changed (NMPlatform *platform, int ifindex, gpointer platform_object, if (!priv->queued_ip_config_id) priv->queued_ip_config_id = g_idle_add (queued_ip_config_change, self); - _LOGD ("queued IP config change"); + _LOGD (LOGD_DEVICE, "queued IP config change"); } } @@ -5910,7 +5910,7 @@ nm_device_queued_ip_config_change_clear (NMDevice *self) NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); if (priv->queued_ip_config_id) { - _LOGD ("clearing queued IP config change"); + _LOGD (LOGD_DEVICE, "clearing queued IP config change"); g_source_remove (priv->queued_ip_config_id); priv->queued_ip_config_id = 0; } @@ -5990,7 +5990,7 @@ nm_device_set_unmanaged (NMDevice *self, now_managed = nm_device_get_managed (self); if (was_managed != now_managed) { - _LOGD ("now %s", unmanaged ? "unmanaged" : "managed"); + _LOGD (LOGD_DEVICE, "now %s", unmanaged ? "unmanaged" : "managed"); g_object_notify (G_OBJECT (self), NM_DEVICE_MANAGED); @@ -6335,11 +6335,11 @@ nm_device_add_pending_action (NMDevice *self, const char *action, gboolean asser for (iter = priv->pending_actions; iter; iter = iter->next) { if (!strcmp (action, iter->data)) { if (assert_not_yet_pending) { - _LOGW ("add_pending_action (%d): '%s' already pending", + _LOGW (LOGD_DEVICE, "add_pending_action (%d): '%s' already pending", count + g_slist_length (iter), action); g_return_val_if_reached (FALSE); } else { - _LOGD ("add_pending_action (%d): '%s' already pending (expected)", + _LOGD (LOGD_DEVICE, "add_pending_action (%d): '%s' already pending (expected)", count + g_slist_length (iter), action); } return FALSE; @@ -6350,7 +6350,7 @@ nm_device_add_pending_action (NMDevice *self, const char *action, gboolean asser priv->pending_actions = g_slist_append (priv->pending_actions, g_strdup (action)); count++; - _LOGD ("add_pending_action (%d): '%s'", count, action); + _LOGD (LOGD_DEVICE, "add_pending_action (%d): '%s'", count, action); if (count == 1) g_object_notify (G_OBJECT (self), NM_DEVICE_HAS_PENDING_ACTION); @@ -6381,7 +6381,7 @@ nm_device_remove_pending_action (NMDevice *self, const char *action, gboolean as for (iter = priv->pending_actions; iter; iter = iter->next) { if (!strcmp (action, iter->data)) { - _LOGD ("remove_pending_action (%d): '%s'", + _LOGD (LOGD_DEVICE, "remove_pending_action (%d): '%s'", count + g_slist_length (iter->next), /* length excluding 'iter' */ action); g_free (iter->data); @@ -6394,10 +6394,10 @@ nm_device_remove_pending_action (NMDevice *self, const char *action, gboolean as } if (assert_is_pending) { - _LOGW ("remove_pending_action (%d): '%s' not pending", count, action); + _LOGW (LOGD_DEVICE, "remove_pending_action (%d): '%s' not pending", count, action); g_return_val_if_reached (FALSE); } else - _LOGD ("remove_pending_action (%d): '%s' not pending (expected)", count, action); + _LOGD (LOGD_DEVICE, "remove_pending_action (%d): '%s' not pending (expected)", count, action); return FALSE; } @@ -6512,9 +6512,9 @@ nm_device_cleanup (NMDevice *self, NMDeviceStateReason reason) g_return_if_fail (NM_IS_DEVICE (self)); if (reason == NM_DEVICE_STATE_REASON_NOW_MANAGED) - _LOGI ("preparing device"); + _LOGI (LOGD_DEVICE, "preparing device"); else - _LOGI ("deactivating device (reason '%s') [%d]", reason_to_string (reason), reason); + _LOGI (LOGD_DEVICE, "deactivating device (reason '%s') [%d]", reason_to_string (reason), reason); /* Save whether or not we tried IPv6 for later */ priv = NM_DEVICE_GET_PRIVATE (self); @@ -6600,7 +6600,7 @@ _set_state_full (NMDevice *self, priv->state = state; priv->state_reason = reason; - _LOGI ("device state change: %s -> %s (reason '%s') [%d %d %d]", + _LOGI (LOGD_DEVICE, "device state change: %s -> %s (reason '%s') [%d %d %d]", state_to_string (old_state), state_to_string (state), reason_to_string (reason), @@ -6654,7 +6654,7 @@ _set_state_full (NMDevice *self, if (old_state == NM_DEVICE_STATE_UNMANAGED || priv->firmware_missing) { if (!nm_device_bring_up (self, TRUE, &no_firmware) && no_firmware) - _LOG (LOGL_WARN, LOGD_HW, "firmware may be missing."); + _LOGW (LOGD_HW, "firmware may be missing."); nm_device_set_firmware_missing (self, no_firmware ? TRUE : FALSE); } /* Ensure the device gets deactivated in response to stuff like @@ -6696,11 +6696,11 @@ _set_state_full (NMDevice *self, * reasons. */ if (nm_device_is_available (self)) { - _LOGD ("device is available, will transition to DISCONNECTED"); + _LOGD (LOGD_DEVICE, "device is available, will transition to DISCONNECTED"); nm_device_queue_state (self, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_NONE); } else { if (old_state == NM_DEVICE_STATE_UNMANAGED) - _LOGD ("device not yet available for transition to DISCONNECTED"); + _LOGD (LOGD_DEVICE, "device not yet available for transition to DISCONNECTED"); else if ( old_state > NM_DEVICE_STATE_UNAVAILABLE && nm_device_get_default_unmanaged (self)) nm_device_queue_state (self, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE); @@ -6738,14 +6738,14 @@ _set_state_full (NMDevice *self, nm_device_queue_state (self, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE); break; case NM_DEVICE_STATE_ACTIVATED: - _LOGI ("Activation: successful, device activated."); + _LOGI (LOGD_DEVICE, "Activation: successful, device activated."); nm_dispatcher_call (DISPATCHER_ACTION_UP, nm_act_request_get_connection (req), self, NULL, NULL, NULL); break; case NM_DEVICE_STATE_FAILED: connection = nm_device_get_connection (self); - _LOG (LOGL_WARN, LOGD_DEVICE | LOGD_WIFI, - "Activation: failed for connection '%s'", - connection ? nm_connection_get_id (connection) : "<unknown>"); + _LOGW (LOGD_DEVICE | LOGD_WIFI, + "Activation: failed for connection '%s'", + connection ? nm_connection_get_id (connection) : "<unknown>"); /* Notify any slaves of the unexpected failure */ nm_device_master_release_slaves (self); @@ -6777,7 +6777,7 @@ _set_state_full (NMDevice *self, break; case NM_DEVICE_STATE_SECONDARIES: ip_check_gw_ping_cleanup (self); - _LOGD ("device entered SECONDARIES state"); + _LOGD (LOGD_DEVICE, "device entered SECONDARIES state"); break; default: break; @@ -6824,7 +6824,7 @@ queued_set_state (gpointer user_data) NMDeviceStateReason new_reason; if (priv->queued_state.id) { - _LOGD ("running queued state change to %s (id %d)", + _LOGD (LOGD_DEVICE, "running queued state change to %s (id %d)", state_to_string (priv->queued_state.state), priv->queued_state.id); @@ -6865,7 +6865,7 @@ nm_device_queue_state (NMDevice *self, /* We should only ever have one delayed state transition at a time */ if (priv->queued_state.id) { - _LOGW ("overwriting previously queued state change to %s (%s)", + _LOGW (LOGD_DEVICE, "overwriting previously queued state change to %s (%s)", state_to_string (priv->queued_state.state), reason_to_string (priv->queued_state.reason)); nm_device_queued_state_clear (self); @@ -6875,7 +6875,7 @@ nm_device_queue_state (NMDevice *self, priv->queued_state.reason = reason; priv->queued_state.id = g_idle_add (queued_set_state, self); - _LOGD ("queued state change to %s due to %s (id %d)", + _LOGD (LOGD_DEVICE, "queued state change to %s due to %s (id %d)", state_to_string (state), reason_to_string (reason), priv->queued_state.id); } @@ -6898,7 +6898,7 @@ nm_device_queued_state_clear (NMDevice *self) NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); if (priv->queued_state.id) { - _LOGD ("clearing queued state transition (id %d)", + _LOGD (LOGD_DEVICE, "clearing queued state transition (id %d)", priv->queued_state.id); g_source_remove (priv->queued_state.id); nm_device_remove_pending_action (self, queued_state_to_string (priv->queued_state.state), TRUE); @@ -6950,16 +6950,16 @@ nm_device_update_hw_address (NMDevice *self) memcpy (priv->hw_addr, hwaddr, hwaddrlen); - _LOG (LOGL_DEBUG, LOGD_HW | LOGD_DEVICE, "hardware address now %s", - (tmp_str = nm_utils_hwaddr_ntoa_len (hwaddr, hwaddrlen))); + _LOGD (LOGD_HW | LOGD_DEVICE, "hardware address now %s", + (tmp_str = nm_utils_hwaddr_ntoa_len (hwaddr, hwaddrlen))); g_object_notify (G_OBJECT (self), NM_DEVICE_HW_ADDRESS); } } else { /* Invalid or no hardware address */ if (priv->hw_addr_len != 0) { memset (priv->hw_addr, 0, sizeof (priv->hw_addr)); - _LOG (LOGL_DEBUG, LOGD_HW | LOGD_DEVICE, - "previous hardware address is no longer valid"); + _LOGD (LOGD_HW | LOGD_DEVICE, + "previous hardware address is no longer valid"); g_object_notify (G_OBJECT (self), NM_DEVICE_HW_ADDRESS); } } @@ -6982,7 +6982,7 @@ nm_device_set_hw_addr (NMDevice *self, const guint8 *addr, /* Do nothing if current MAC is same */ if (cur_addr && !memcmp (cur_addr, addr, len)) { - _LOG (LOGL_DEBUG, LOGD_DEVICE | hw_log_domain, "no MAC address change needed"); + _LOGD (LOGD_DEVICE | hw_log_domain, "no MAC address change needed"); return TRUE; } @@ -6997,16 +6997,16 @@ nm_device_set_hw_addr (NMDevice *self, const guint8 *addr, nm_device_update_hw_address (self); cur_addr = nm_device_get_hw_address (self, NULL); if (memcmp (cur_addr, addr, len) == 0) { - _LOG (LOGL_INFO, LOGD_DEVICE | hw_log_domain, "%s MAC address to %s", - detail, mac_str); + _LOGI (LOGD_DEVICE | hw_log_domain, "%s MAC address to %s", + detail, mac_str); } else { - _LOG (LOGL_WARN, LOGD_DEVICE | hw_log_domain, - "new MAC address %s not successfully set", mac_str); + _LOGW (LOGD_DEVICE | hw_log_domain, + "new MAC address %s not successfully set", mac_str); success = FALSE; } } else { - _LOG (LOGL_WARN, LOGD_DEVICE | hw_log_domain, "failed to %s MAC address to %s", - detail, mac_str); + _LOGW (LOGD_DEVICE | hw_log_domain, "failed to %s MAC address to %s", + detail, mac_str); } nm_device_bring_up (self, TRUE, NULL); g_free (mac_str); @@ -7102,7 +7102,7 @@ device_get_driver_info (NMDevice *self, const char *iface, char **driver_version fd = socket (PF_INET, SOCK_DGRAM, 0); if (fd < 0) { - _LOG (LOGL_WARN, LOGD_HW, "couldn't open control socket."); + _LOGW (LOGD_HW, "couldn't open control socket."); return FALSE; } @@ -7115,8 +7115,8 @@ device_get_driver_info (NMDevice *self, const char *iface, char **driver_version errno = 0; if (ioctl (fd, SIOCETHTOOL, &req) < 0) { - _LOG (LOGL_DEBUG, LOGD_HW, "SIOCETHTOOL ioctl() failed: cmd=ETHTOOL_GDRVINFO, iface=%s, errno=%d", - iface, errno); + _LOGD (LOGD_HW, "SIOCETHTOOL ioctl() failed: cmd=ETHTOOL_GDRVINFO, iface=%s, errno=%d", + iface, errno); close (fd); return FALSE; } @@ -7149,10 +7149,10 @@ constructor (GType type, self = NM_DEVICE (object); priv = NM_DEVICE_GET_PRIVATE (self); - _LOGD ("constructor(): %s", G_OBJECT_TYPE_NAME (self)); + _LOGD (LOGD_DEVICE, "constructor(): %s", G_OBJECT_TYPE_NAME (self)); if (!priv->iface) { - _LOGE ("No device interface provided, ignoring"); + _LOGE (LOGD_DEVICE, "No device interface provided, ignoring"); goto error; } @@ -7200,10 +7200,10 @@ constructed (GObject *object) priv->ignore_carrier = nm_config_get_ignore_carrier (nm_config_get (), self); check_carrier (self); - _LOG (LOGL_INFO, LOGD_HW, - "carrier is %s%s", - priv->carrier ? "ON" : "OFF", - priv->ignore_carrier ? " (but ignored)" : ""); + _LOGI (LOGD_HW, + "carrier is %s%s", + priv->carrier ? "ON" : "OFF", + priv->ignore_carrier ? " (but ignored)" : ""); } else { /* Fake online link when carrier detection is not available. */ priv->carrier = TRUE; @@ -7293,7 +7293,7 @@ finalize (GObject *object) NMDevice *self = NM_DEVICE (object); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - _LOGD ("finalize(): %s", G_OBJECT_TYPE_NAME (self)); + _LOGD (LOGD_DEVICE, "finalize(): %s", G_OBJECT_TYPE_NAME (self)); g_slist_free_full (priv->pending_actions, g_free); g_clear_pointer (&priv->physical_port_id, g_free); @@ -7353,7 +7353,7 @@ set_property (GObject *object, guint prop_id, if (priv->iface && !strchr (priv->iface, ':')) { priv->ifindex = nm_platform_link_get_ifindex (priv->iface); if (priv->ifindex <= 0) - _LOG (LOGL_WARN, LOGD_HW, "failed to look up interface index"); + _LOGW (LOGD_HW, "failed to look up interface index"); } } break; |