mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-09 01:50:21 +01:00
logging,config: merge branch 'th/logging-alloc-bgo772516'
https://bugzilla.gnome.org/show_bug.cgi?id=772516
This commit is contained in:
commit
ed93c168cf
23 changed files with 227 additions and 176 deletions
16
configure.ac
16
configure.ac
|
|
@ -524,16 +524,16 @@ else
|
|||
fi
|
||||
if test "$have_libaudit" = "yes"; then
|
||||
AC_DEFINE(HAVE_LIBAUDIT, 1, [Define if you have libaudit support])
|
||||
if test "$with_libaudit" = "yes-disabled-by-default"; then
|
||||
AC_DEFINE(NM_CONFIG_DEFAULT_LOGGING_AUDIT, FALSE, [The default value of the logging.audit configuration option])
|
||||
NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT='false'
|
||||
else
|
||||
AC_DEFINE(NM_CONFIG_DEFAULT_LOGGING_AUDIT, TRUE, [The default value of the logging.audit configuration option])
|
||||
NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT='true'
|
||||
fi
|
||||
if test "$with_libaudit" = "yes-disabled-by-default"; then
|
||||
AC_DEFINE(NM_CONFIG_DEFAULT_LOGGING_AUDIT, "false", [The default value of the logging.audit configuration option])
|
||||
NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT='false'
|
||||
else
|
||||
AC_DEFINE(NM_CONFIG_DEFAULT_LOGGING_AUDIT, "true", [The default value of the logging.audit configuration option])
|
||||
NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT='true'
|
||||
fi
|
||||
else
|
||||
AC_DEFINE(HAVE_LIBAUDIT, 0, [Define if you have libaudit support])
|
||||
AC_DEFINE(NM_CONFIG_DEFAULT_LOGGING_AUDIT, FALSE, [The default value of the logging.audit configuration option])
|
||||
AC_DEFINE(NM_CONFIG_DEFAULT_LOGGING_AUDIT, "false", [The default value of the logging.audit configuration option])
|
||||
NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT='false'
|
||||
fi
|
||||
AC_SUBST(NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ dev_get_attrs (GUdevDevice *udev_device,
|
|||
|
||||
path = g_udev_device_get_sysfs_path (udev_device);
|
||||
if (!path) {
|
||||
nm_log_warn (LOGD_HW, "couldn't determine device path; ignoring...");
|
||||
nm_log_warn (LOGD_PLATFORM, "couldn't determine device path; ignoring...");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -132,11 +132,11 @@ adsl_add (NMAtmManager *self, GUdevDevice *udev_device)
|
|||
|
||||
ifname = g_udev_device_get_name (udev_device);
|
||||
if (!ifname) {
|
||||
nm_log_warn (LOGD_HW, "failed to get device's interface name");
|
||||
nm_log_warn (LOGD_PLATFORM, "failed to get device's interface name");
|
||||
return;
|
||||
}
|
||||
|
||||
nm_log_dbg (LOGD_HW, "(%s): found ATM device", ifname);
|
||||
nm_log_dbg (LOGD_PLATFORM, "(%s): found ATM device", ifname);
|
||||
|
||||
atm_index_path = g_strdup_printf ("/sys/class/atm/%s/atmindex",
|
||||
NM_ASSERT_VALID_PATH_COMPONENT (ifname));
|
||||
|
|
@ -145,12 +145,12 @@ adsl_add (NMAtmManager *self, GUdevDevice *udev_device)
|
|||
10, 0, G_MAXINT,
|
||||
-1);
|
||||
if (atm_index < 0) {
|
||||
nm_log_warn (LOGD_HW, "(%s): failed to get ATM index", ifname);
|
||||
nm_log_warn (LOGD_PLATFORM, "(%s): failed to get ATM index", ifname);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dev_get_attrs (udev_device, &sysfs_path, &driver)) {
|
||||
nm_log_warn (LOGD_HW, "(%s): failed to get ATM attributes", ifname);
|
||||
nm_log_warn (LOGD_PLATFORM, "(%s): failed to get ATM attributes", ifname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ adsl_remove (NMAtmManager *self, GUdevDevice *udev_device)
|
|||
const char *iface = g_udev_device_get_name (udev_device);
|
||||
GSList *iter;
|
||||
|
||||
nm_log_dbg (LOGD_HW, "(%s): removing ATM device", iface);
|
||||
nm_log_dbg (LOGD_PLATFORM, "(%s): removing ATM device", iface);
|
||||
|
||||
for (iter = priv->devices; iter; iter = iter->next) {
|
||||
NMDevice *device = iter->data;
|
||||
|
|
@ -232,7 +232,7 @@ handle_uevent (GUdevClient *client,
|
|||
|
||||
ifindex = g_udev_device_get_property (device, "IFINDEX");
|
||||
seqnum = g_udev_device_get_seqnum (device);
|
||||
nm_log_dbg (LOGD_HW, "UDEV event: action '%s' subsys '%s' device '%s' (%s); seqnum=%" G_GUINT64_FORMAT,
|
||||
nm_log_dbg (LOGD_PLATFORM, "UDEV event: action '%s' subsys '%s' device '%s' (%s); seqnum=%" G_GUINT64_FORMAT,
|
||||
action, subsys, g_udev_device_get_name (device), ifindex ? ifindex : "unknown", seqnum);
|
||||
|
||||
if (!strcmp (action, "add"))
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ set_bond_attr (NMDevice *device, NMBondMode mode, const char *attr, const char *
|
|||
|
||||
ret = nm_platform_sysctl_master_set_option (NM_PLATFORM_GET, ifindex, attr, value);
|
||||
if (!ret)
|
||||
_LOGW (LOGD_HW, "failed to set bonding attribute '%s' to '%s'", attr, value);
|
||||
_LOGW (LOGD_PLATFORM, "failed to set bonding attribute '%s' to '%s'", attr, value);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ _update_s390_subchannels (NMDeviceEthernet *self)
|
|||
parent_path = g_udev_device_get_sysfs_path (parent);
|
||||
dir = g_dir_open (parent_path, 0, &error);
|
||||
if (!dir) {
|
||||
_LOGW (LOGD_DEVICE | LOGD_HW, "update-s390: failed to open directory '%s': %s",
|
||||
_LOGW (LOGD_DEVICE | LOGD_PLATFORM, "update-s390: failed to open directory '%s': %s",
|
||||
parent_path, error->message);
|
||||
g_clear_error (&error);
|
||||
return;
|
||||
|
|
@ -217,11 +217,11 @@ _update_s390_subchannels (NMDeviceEthernet *self)
|
|||
g_hash_table_insert (priv->s390_options, g_strdup (item), value);
|
||||
value = NULL;
|
||||
} else
|
||||
_LOGW (LOGD_DEVICE | LOGD_HW, "update-s390: error reading %s", path);
|
||||
_LOGW (LOGD_DEVICE | LOGD_PLATFORM, "update-s390: error reading %s", path);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
_LOGW (LOGD_DEVICE | LOGD_HW, "update-s390: failed reading sysfs for %s (%s)", item, error->message);
|
||||
_LOGW (LOGD_DEVICE | LOGD_PLATFORM, "update-s390: failed reading sysfs for %s (%s)", item, error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
}
|
||||
|
|
@ -246,7 +246,7 @@ _update_s390_subchannels (NMDeviceEthernet *self)
|
|||
priv->subchannels_dbus[2] = g_strdup (priv->subchan3);
|
||||
priv->subchannels_dbus[3] = NULL;
|
||||
|
||||
_LOGI (LOGD_DEVICE | LOGD_HW, "update-s390: found s390 '%s' subchannels [%s]",
|
||||
_LOGI (LOGD_DEVICE | LOGD_PLATFORM, "update-s390: found s390 '%s' subchannels [%s]",
|
||||
nm_device_get_driver ((NMDevice *) self) ?: "(unknown driver)",
|
||||
priv->subchannels);
|
||||
|
||||
|
|
@ -310,7 +310,7 @@ get_generic_capabilities (NMDevice *device)
|
|||
if (nm_platform_link_supports_carrier_detect (NM_PLATFORM_GET, nm_device_get_ifindex (device)))
|
||||
return NM_DEVICE_CAP_CARRIER_DETECT;
|
||||
else {
|
||||
_LOGI (LOGD_HW, "driver '%s' does not support carrier detection.",
|
||||
_LOGI (LOGD_PLATFORM, "driver '%s' does not support carrier detection.",
|
||||
nm_device_get_driver (device));
|
||||
return NM_DEVICE_CAP_NONE;
|
||||
}
|
||||
|
|
@ -1323,7 +1323,7 @@ deactivate (NMDevice *device)
|
|||
s_dcb = (NMSettingDcb *) nm_device_get_applied_setting (device, NM_TYPE_SETTING_DCB);
|
||||
if (s_dcb) {
|
||||
if (!nm_dcb_cleanup (nm_device_get_iface (device), &error)) {
|
||||
_LOGW (LOGD_DEVICE | LOGD_HW, "failed to disable DCB/FCoE: %s",
|
||||
_LOGW (LOGD_DEVICE | LOGD_PLATFORM, "failed to disable DCB/FCoE: %s",
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
|
@ -1528,7 +1528,7 @@ get_link_speed (NMDevice *device)
|
|||
priv->speed = speed;
|
||||
_notify (self, PROP_SPEED);
|
||||
|
||||
_LOGD (LOGD_HW | LOGD_ETHER, "speed is now %d Mb/s", speed);
|
||||
_LOGD (LOGD_PLATFORM | LOGD_ETHER, "speed is now %d Mb/s", speed);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ read_device_factory_paths (void)
|
|||
|
||||
dir = g_dir_open (NMPLUGINDIR, 0, &error);
|
||||
if (!dir) {
|
||||
nm_log_warn (LOGD_HW, "device plugin: failed to open directory %s: %s",
|
||||
nm_log_warn (LOGD_PLATFORM, "device plugin: failed to open directory %s: %s",
|
||||
NMPLUGINDIR,
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
|
|
@ -391,17 +391,17 @@ read_device_factory_paths (void)
|
|||
|
||||
if (stat (data.path, &data.st) != 0) {
|
||||
errsv = errno;
|
||||
nm_log_warn (LOGD_HW, "device plugin: skip invalid file %s (error during stat: %s)", data.path, strerror (errsv));
|
||||
nm_log_warn (LOGD_PLATFORM, "device plugin: skip invalid file %s (error during stat: %s)", data.path, strerror (errsv));
|
||||
goto NEXT;
|
||||
}
|
||||
if (!S_ISREG (data.st.st_mode))
|
||||
goto NEXT;
|
||||
if (data.st.st_uid != 0) {
|
||||
nm_log_warn (LOGD_HW, "device plugin: skip invalid file %s (file must be owned by root)", data.path);
|
||||
nm_log_warn (LOGD_PLATFORM, "device plugin: skip invalid file %s (file must be owned by root)", data.path);
|
||||
goto NEXT;
|
||||
}
|
||||
if (data.st.st_mode & (S_IWGRP | S_IWOTH | S_ISUID)) {
|
||||
nm_log_warn (LOGD_HW, "device plugin: skip invalid file %s (invalid file permissions)", data.path);
|
||||
nm_log_warn (LOGD_PLATFORM, "device plugin: skip invalid file %s (invalid file permissions)", data.path);
|
||||
goto NEXT;
|
||||
}
|
||||
|
||||
|
|
@ -443,7 +443,7 @@ _add_factory (NMDeviceFactory *factory,
|
|||
if (check_duplicates) {
|
||||
found = find_factory (link_types, setting_types);
|
||||
if (found) {
|
||||
nm_log_warn (LOGD_HW, "Loading device plugin failed: multiple plugins "
|
||||
nm_log_warn (LOGD_PLATFORM, "Loading device plugin failed: multiple plugins "
|
||||
"for same type (using '%s' instead of '%s')",
|
||||
(char *) g_object_get_data (G_OBJECT (found), PLUGIN_PATH_TAG),
|
||||
path);
|
||||
|
|
@ -459,7 +459,7 @@ _add_factory (NMDeviceFactory *factory,
|
|||
|
||||
callback (factory, user_data);
|
||||
|
||||
nm_log_info (LOGD_HW, "Loaded device plugin: %s (%s)", G_OBJECT_TYPE_NAME (factory), path);
|
||||
nm_log_info (LOGD_PLATFORM, "Loaded device plugin: %s (%s)", G_OBJECT_TYPE_NAME (factory), path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -502,12 +502,12 @@ nm_device_factory_manager_load_factories (NMDeviceFactoryManagerFactoryFunc call
|
|||
plugin = g_module_open (*path, G_MODULE_BIND_LOCAL);
|
||||
|
||||
if (!plugin) {
|
||||
nm_log_warn (LOGD_HW, "(%s): failed to load plugin: %s", item, g_module_error ());
|
||||
nm_log_warn (LOGD_PLATFORM, "(%s): failed to load plugin: %s", item, g_module_error ());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!g_module_symbol (plugin, "nm_device_factory_create", (gpointer) &create_func)) {
|
||||
nm_log_warn (LOGD_HW, "(%s): failed to find device factory creator: %s", item, g_module_error ());
|
||||
nm_log_warn (LOGD_PLATFORM, "(%s): failed to find device factory creator: %s", item, g_module_error ());
|
||||
g_module_close (plugin);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -518,7 +518,7 @@ nm_device_factory_manager_load_factories (NMDeviceFactoryManagerFactoryFunc call
|
|||
|
||||
factory = create_func (&error);
|
||||
if (!factory) {
|
||||
nm_log_warn (LOGD_HW, "(%s): failed to initialize device factory: %s",
|
||||
nm_log_warn (LOGD_PLATFORM, "(%s): failed to initialize device factory: %s",
|
||||
item, NM_G_ERROR_MSG (error));
|
||||
g_clear_error (&error);
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ clear:
|
|||
|
||||
lnk = nm_platform_link_get_lnk_gre (NM_PLATFORM_GET, ifindex, NULL);
|
||||
if (!lnk) {
|
||||
_LOGW (LOGD_HW, "could not read %s properties", "gre");
|
||||
_LOGW (LOGD_PLATFORM, "could not read %s properties", "gre");
|
||||
goto clear;
|
||||
}
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ clear:
|
|||
|
||||
lnk = nm_platform_link_get_lnk_sit (NM_PLATFORM_GET, ifindex, NULL);
|
||||
if (!lnk) {
|
||||
_LOGW (LOGD_HW, "could not read %s properties", "sit");
|
||||
_LOGW (LOGD_PLATFORM, "could not read %s properties", "sit");
|
||||
goto clear;
|
||||
}
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ clear:
|
|||
|
||||
lnk = nm_platform_link_get_lnk_ipip (NM_PLATFORM_GET, ifindex, NULL);
|
||||
if (!lnk) {
|
||||
_LOGW (LOGD_HW, "could not read %s properties", "ipip");
|
||||
_LOGW (LOGD_PLATFORM, "could not read %s properties", "ipip");
|
||||
goto clear;
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ clear:
|
|||
|
||||
lnk = nm_platform_link_get_lnk_ip6tnl (NM_PLATFORM_GET, ifindex, NULL);
|
||||
if (!lnk) {
|
||||
_LOGW (LOGD_HW, "could not read %s properties", "ip6tnl");
|
||||
_LOGW (LOGD_PLATFORM, "could not read %s properties", "ip6tnl");
|
||||
goto clear;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ update_properties (NMDevice *device)
|
|||
props = nm_platform_link_get_lnk_macvlan (NM_PLATFORM_GET, nm_device_get_ifindex (device), &plink);
|
||||
|
||||
if (!props) {
|
||||
_LOGW (LOGD_HW, "could not get %s properties", priv->props.tap ? "macvtap" : "macvlan");
|
||||
_LOGW (LOGD_PLATFORM, "could not get %s properties", priv->props.tap ? "macvtap" : "macvlan");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ update_connection (NMDevice *device, NMConnection *connection)
|
|||
}
|
||||
|
||||
if (!nm_platform_link_tun_get_properties (NM_PLATFORM_GET, nm_device_get_ifindex (device), &props)) {
|
||||
_LOGW (LOGD_HW, "failed to get TUN interface info while updating connection.");
|
||||
_LOGW (LOGD_PLATFORM, "failed to get TUN interface info while updating connection.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ get_peer (NMDeviceVeth *self)
|
|||
return priv->peer;
|
||||
|
||||
if (!nm_platform_link_veth_get_properties (NM_PLATFORM_GET, nm_device_get_ifindex (device), &peer_ifindex)) {
|
||||
_LOGW (LOGD_HW, "could not read veth properties");
|
||||
_LOGW (LOGD_PLATFORM, "could not read veth properties");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ update_properties (NMDevice *device)
|
|||
|
||||
props = nm_platform_link_get_lnk_vxlan (NM_PLATFORM_GET, nm_device_get_ifindex (device), NULL);
|
||||
if (!props) {
|
||||
_LOGW (LOGD_HW, "could not get vxlan properties");
|
||||
_LOGW (LOGD_PLATFORM, "could not get vxlan properties");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -798,7 +798,7 @@ nm_device_set_ip_iface (NMDevice *self, const char *iface)
|
|||
nm_platform_link_set_up (NM_PLATFORM_GET, priv->ip_ifindex, NULL);
|
||||
} else {
|
||||
/* Device IP interface must always be a kernel network interface */
|
||||
_LOGW (LOGD_HW, "failed to look up interface index");
|
||||
_LOGW (LOGD_PLATFORM, "failed to look up interface index");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -941,7 +941,7 @@ get_ip_iface_identifier (NMDevice *self, NMUtilsIPv6IfaceId *out_iid)
|
|||
priv->dev_id,
|
||||
out_iid);
|
||||
if (!success) {
|
||||
_LOGW (LOGD_HW, "failed to generate interface identifier "
|
||||
_LOGW (LOGD_PLATFORM, "failed to generate interface identifier "
|
||||
"for link type %u hwaddr_len %u", pllink->type, (unsigned) pllink->addr.len);
|
||||
}
|
||||
return success;
|
||||
|
|
@ -2340,7 +2340,7 @@ realize_start_setup (NMDevice *self, const NMPlatformLink *plink)
|
|||
|
||||
if (nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) {
|
||||
check_carrier (self);
|
||||
_LOGD (LOGD_HW,
|
||||
_LOGD (LOGD_PLATFORM,
|
||||
"carrier is %s%s",
|
||||
priv->carrier ? "ON" : "OFF",
|
||||
priv->ignore_carrier ? " (but ignored)" : "");
|
||||
|
|
@ -9203,12 +9203,12 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
|
|||
NM_SET_OUT (no_firmware, FALSE);
|
||||
|
||||
if (!nm_device_get_enabled (self)) {
|
||||
_LOGD (LOGD_HW, "bringing up device ignored due to disabled");
|
||||
_LOGD (LOGD_PLATFORM, "bringing up device ignored due to disabled");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ifindex = nm_device_get_ip_ifindex (self);
|
||||
_LOGD (LOGD_HW, "bringing up device %d", ifindex);
|
||||
_LOGD (LOGD_PLATFORM, "bringing up device %d", ifindex);
|
||||
if (ifindex <= 0) {
|
||||
/* assume success. */
|
||||
} else {
|
||||
|
|
@ -9234,9 +9234,9 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
|
|||
|
||||
if (!device_is_up) {
|
||||
if (block)
|
||||
_LOGW (LOGD_HW, "device not up after timeout!");
|
||||
_LOGW (LOGD_PLATFORM, "device not up after timeout!");
|
||||
else
|
||||
_LOGD (LOGD_HW, "device not up immediately");
|
||||
_LOGD (LOGD_PLATFORM, "device not up immediately");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -9285,7 +9285,7 @@ nm_device_take_down (NMDevice *self, gboolean block)
|
|||
g_return_if_fail (NM_IS_DEVICE (self));
|
||||
|
||||
ifindex = nm_device_get_ip_ifindex (self);
|
||||
_LOGD (LOGD_HW, "taking down device %d", ifindex);
|
||||
_LOGD (LOGD_PLATFORM, "taking down device %d", ifindex);
|
||||
if (ifindex <= 0) {
|
||||
/* devices without ifindex are always up. */
|
||||
return;
|
||||
|
|
@ -9308,9 +9308,9 @@ nm_device_take_down (NMDevice *self, gboolean block)
|
|||
|
||||
if (device_is_up) {
|
||||
if (block)
|
||||
_LOGW (LOGD_HW, "device not down after timeout!");
|
||||
_LOGW (LOGD_PLATFORM, "device not down after timeout!");
|
||||
else
|
||||
_LOGD (LOGD_HW, "device not down immediately");
|
||||
_LOGD (LOGD_PLATFORM, "device not down immediately");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -11285,7 +11285,7 @@ _set_state_full (NMDevice *self,
|
|||
if (reason != NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED) {
|
||||
if (old_state == NM_DEVICE_STATE_UNMANAGED || priv->firmware_missing) {
|
||||
if (!nm_device_bring_up (self, TRUE, &no_firmware) && no_firmware)
|
||||
_LOGW (LOGD_HW, "firmware may be missing.");
|
||||
_LOGW (LOGD_PLATFORM, "firmware may be missing.");
|
||||
nm_device_set_firmware_missing (self, no_firmware ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
|
|
@ -11679,7 +11679,7 @@ nm_device_update_hw_address (NMDevice *self)
|
|||
g_free (priv->hw_addr);
|
||||
priv->hw_addr = nm_utils_hwaddr_ntoa (hwaddr, hwaddrlen);
|
||||
|
||||
_LOGD (LOGD_HW | LOGD_DEVICE, "hw-addr: hardware address now %s", priv->hw_addr);
|
||||
_LOGD (LOGD_PLATFORM | LOGD_DEVICE, "hw-addr: hardware address now %s", priv->hw_addr);
|
||||
_notify (self, PROP_HW_ADDRESS);
|
||||
|
||||
if ( !priv->hw_addr_initial
|
||||
|
|
@ -11696,11 +11696,11 @@ nm_device_update_hw_address (NMDevice *self)
|
|||
} else {
|
||||
/* Invalid or no hardware address */
|
||||
if (priv->hw_addr_len != 0) {
|
||||
_LOGD (LOGD_HW | LOGD_DEVICE,
|
||||
_LOGD (LOGD_PLATFORM | LOGD_DEVICE,
|
||||
"hw-addr: failed reading current MAC address (stay with %s)",
|
||||
priv->hw_addr);
|
||||
} else {
|
||||
_LOGD (LOGD_HW | LOGD_DEVICE,
|
||||
_LOGD (LOGD_PLATFORM | LOGD_DEVICE,
|
||||
"hw-addr: failed reading current MAC address");
|
||||
}
|
||||
}
|
||||
|
|
@ -11760,7 +11760,7 @@ nm_device_update_permanent_hw_address (NMDevice *self)
|
|||
*
|
||||
* In some cases it might be necessary to know whether this is a "real" or
|
||||
* a temporary address (fake). */
|
||||
_LOGD (LOGD_HW | LOGD_ETHER, "hw-addr: %s (use current: %s)",
|
||||
_LOGD (LOGD_PLATFORM | LOGD_ETHER, "hw-addr: %s (use current: %s)",
|
||||
success_read
|
||||
? "read HW addr length of permanent MAC address differs"
|
||||
: "unable to read permanent MAC address",
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ constructed (GObject *object)
|
|||
G_OBJECT_CLASS (nm_device_wifi_parent_class)->constructed (object);
|
||||
|
||||
if (priv->capabilities & NM_WIFI_DEVICE_CAP_AP)
|
||||
_LOGI (LOGD_HW | LOGD_WIFI, "driver supports Access Point (AP) mode");
|
||||
_LOGI (LOGD_PLATFORM | LOGD_WIFI, "driver supports Access Point (AP) mode");
|
||||
|
||||
/* Connect to the supplicant manager */
|
||||
priv->sup_mgr = g_object_ref (nm_supplicant_manager_get ());
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ create_device (NMDeviceFactory *factory,
|
|||
if (!nm_platform_wifi_get_capabilities (NM_PLATFORM_GET,
|
||||
plink->ifindex,
|
||||
&capabilities)) {
|
||||
nm_log_warn (LOGD_HW | LOGD_WIFI, "(%s) failed to initialize Wi-Fi driver for ifindex %d", iface, plink->ifindex);
|
||||
nm_log_warn (LOGD_PLATFORM | LOGD_WIFI, "(%s) failed to initialize Wi-Fi driver for ifindex %d", iface, plink->ifindex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1474,12 +1474,12 @@ constructor (GType type,
|
|||
priv = NM_MODEM_GET_PRIVATE ((NMModem *) object);
|
||||
|
||||
if (!priv->data_port && !priv->control_port) {
|
||||
nm_log_err (LOGD_HW, "neither modem command nor data interface provided");
|
||||
nm_log_err (LOGD_PLATFORM, "neither modem command nor data interface provided");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!priv->path) {
|
||||
nm_log_err (LOGD_HW, "D-Bus path not provided");
|
||||
nm_log_err (LOGD_PLATFORM, "D-Bus path not provided");
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ init_auditd (NMAuditManager *self)
|
|||
|
||||
if (nm_config_data_get_value_boolean (data, NM_CONFIG_KEYFILE_GROUP_LOGGING,
|
||||
NM_CONFIG_KEYFILE_KEY_AUDIT,
|
||||
NM_CONFIG_DEFAULT_LOGGING_AUDIT)) {
|
||||
NM_CONFIG_DEFAULT_LOGGING_AUDIT_BOOL)) {
|
||||
if (priv->auditd_fd < 0) {
|
||||
priv->auditd_fd = audit_open ();
|
||||
if (priv->auditd_fd < 0)
|
||||
|
|
|
|||
|
|
@ -473,6 +473,7 @@ _nm_config_data_log_sort (const char **pa, const char **pb, gpointer dummy)
|
|||
gboolean a_is_connection, b_is_connection;
|
||||
gboolean a_is_device, b_is_device;
|
||||
gboolean a_is_intern, b_is_intern;
|
||||
gboolean a_is_main, b_is_main;
|
||||
const char *a = *pa;
|
||||
const char *b = *pb;
|
||||
|
||||
|
|
@ -531,8 +532,12 @@ _nm_config_data_log_sort (const char **pa, const char **pb, gpointer dummy)
|
|||
if (b_is_device && !a_is_device)
|
||||
return -1;
|
||||
|
||||
/* no reordering. */
|
||||
return 0;
|
||||
a_is_main = nm_streq0 (a, "main");
|
||||
b_is_main = nm_streq0 (b, "main");
|
||||
if (a_is_main != b_is_main)
|
||||
return a_is_main ? -1 : 1;
|
||||
|
||||
return g_strcmp0 (a, b);
|
||||
}
|
||||
|
||||
static struct {
|
||||
|
|
@ -544,6 +549,7 @@ static struct {
|
|||
{ NM_CONFIG_KEYFILE_GROUP_MAIN, "rc-manager", NM_CONFIG_DEFAULT_DNS_RC_MANAGER },
|
||||
{ NM_CONFIG_KEYFILE_GROUP_MAIN, "auth-polkit", NM_CONFIG_DEFAULT_AUTH_POLKIT },
|
||||
{ NM_CONFIG_KEYFILE_GROUP_LOGGING, "backend", NM_CONFIG_LOGGING_BACKEND_DEFAULT },
|
||||
{ NM_CONFIG_KEYFILE_GROUP_LOGGING, "audit", NM_CONFIG_DEFAULT_LOGGING_AUDIT },
|
||||
};
|
||||
|
||||
void
|
||||
|
|
@ -557,6 +563,8 @@ nm_config_data_log (const NMConfigData *self,
|
|||
gsize ngroups;
|
||||
guint g, k, i;
|
||||
FILE *stream = print_stream;
|
||||
gs_unref_ptrarray GPtrArray *groups_full = NULL;
|
||||
gboolean print_default = !!stream;
|
||||
|
||||
g_return_if_fail (NM_IS_CONFIG_DATA (self));
|
||||
|
||||
|
|
@ -582,18 +590,35 @@ nm_config_data_log (const NMConfigData *self,
|
|||
if (!groups)
|
||||
ngroups = 0;
|
||||
|
||||
if (groups && groups[0]) {
|
||||
g_qsort_with_data (groups, ngroups,
|
||||
sizeof (char *),
|
||||
(GCompareDataFunc) _nm_config_data_log_sort,
|
||||
NULL);
|
||||
groups_full = g_ptr_array_sized_new (ngroups + 5);
|
||||
|
||||
if (ngroups) {
|
||||
g_ptr_array_set_size (groups_full, ngroups);
|
||||
memcpy (groups_full->pdata, groups, sizeof (groups[0]) * ngroups);
|
||||
g_ptr_array_sort_with_data (groups_full, (GCompareDataFunc) _nm_config_data_log_sort, NULL);
|
||||
}
|
||||
|
||||
if (print_default) {
|
||||
for (g = 0; g < G_N_ELEMENTS (default_values); g++) {
|
||||
const char *group = default_values[g].group;
|
||||
gssize idx;
|
||||
|
||||
idx = _nm_utils_array_find_binary_search ((gconstpointer *) groups_full->pdata,
|
||||
sizeof (char *),
|
||||
groups_full->len,
|
||||
&group,
|
||||
(GCompareDataFunc) _nm_config_data_log_sort,
|
||||
NULL);
|
||||
if (idx < 0)
|
||||
g_ptr_array_insert (groups_full, (~idx), (gpointer) group);
|
||||
}
|
||||
}
|
||||
|
||||
if (!stream)
|
||||
_LOG (stream, prefix, "config-data[%p]: %lu groups", self, (unsigned long) ngroups);
|
||||
_LOG (stream, prefix, "config-data[%p]: %u groups", self, groups_full->len);
|
||||
|
||||
for (g = 0; g < ngroups; g++) {
|
||||
const char *group = groups[g];
|
||||
for (g = 0; g < groups_full->len; g++) {
|
||||
const char *group = groups_full->pdata[g];
|
||||
gs_strfreev char **keys = NULL;
|
||||
gboolean is_atomic;
|
||||
|
||||
|
|
@ -603,11 +628,13 @@ nm_config_data_log (const NMConfigData *self,
|
|||
_LOG (stream, prefix, "[%s]%s", group, is_atomic && !stream ? " # atomic section" : "");
|
||||
|
||||
/* Print default values as comments */
|
||||
for (i = 0; i < G_N_ELEMENTS (default_values); i++) {
|
||||
if ( nm_streq (default_values[i].group, group)
|
||||
&& !g_key_file_has_key (priv->keyfile, group, default_values[i].key, NULL)) {
|
||||
_LOG (stream, prefix, "%s# %s=%s", key_prefix, default_values[i].key,
|
||||
default_values[i].value);
|
||||
if (print_default) {
|
||||
for (i = 0; i < G_N_ELEMENTS (default_values); i++) {
|
||||
if ( nm_streq (default_values[i].group, group)
|
||||
&& !g_key_file_has_key (priv->keyfile, group, default_values[i].key, NULL)) {
|
||||
_LOG (stream, prefix, "%s# %s=%s", key_prefix, default_values[i].key,
|
||||
default_values[i].value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,9 @@ extern char *_nm_config_match_env;
|
|||
/*****************************************************************************/
|
||||
|
||||
#define NM_CONFIG_DEVICE_STATE_DIR ""NMRUNDIR"/devices"
|
||||
#define NM_CONFIG_DEFAULT_AUTH_POLKIT_BOOL (nm_streq0 (NM_CONFIG_DEFAULT_AUTH_POLKIT, "true"))
|
||||
|
||||
#define NM_CONFIG_DEFAULT_AUTH_POLKIT_BOOL (nm_streq (""NM_CONFIG_DEFAULT_AUTH_POLKIT, "true"))
|
||||
#define NM_CONFIG_DEFAULT_LOGGING_AUDIT_BOOL (nm_streq (""NM_CONFIG_DEFAULT_LOGGING_AUDIT, "true"))
|
||||
|
||||
typedef enum {
|
||||
NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_UNKNOWN = -1,
|
||||
|
|
|
|||
165
src/nm-logging.c
165
src/nm-logging.c
|
|
@ -40,6 +40,17 @@
|
|||
#include "nm-errors.h"
|
||||
#include "nm-core-utils.h"
|
||||
|
||||
/* often we have some static string where we need to know the maximum length.
|
||||
* _MAX_LEN() returns @max but adds a debugging assertion that @str is indeed
|
||||
* shorter then @mac. */
|
||||
#define _MAX_LEN(max, str) \
|
||||
({ \
|
||||
const char *const _str = (str); \
|
||||
\
|
||||
nm_assert (_str && strlen (str) < (max)); \
|
||||
(max); \
|
||||
})
|
||||
|
||||
void (*_nm_logging_clear_platform_logging_cache) (void);
|
||||
|
||||
static void
|
||||
|
|
@ -318,6 +329,13 @@ nm_logging_setup (const char *level,
|
|||
|
||||
bits = 0;
|
||||
|
||||
if (domains_free) {
|
||||
/* The caller didn't provide any domains to set (`nmcli general logging level DEBUG`).
|
||||
* We reset all domains that were previously set, but we still want to protect
|
||||
* VPN_PLUGIN domain. */
|
||||
protect = LOGD_VPN_PLUGIN;
|
||||
}
|
||||
|
||||
/* Check for combined domains */
|
||||
if (!g_ascii_strcasecmp (*iter, LOGD_ALL_STRING)) {
|
||||
bits = LOGD_ALL;
|
||||
|
|
@ -369,7 +387,7 @@ nm_logging_setup (const char *level,
|
|||
new_logging[i] &= ~bits;
|
||||
else {
|
||||
new_logging[i] |= bits;
|
||||
if ( protect
|
||||
if ( (protect & bits)
|
||||
&& i < LOGL_INFO)
|
||||
new_logging[i] &= ~protect;
|
||||
}
|
||||
|
|
@ -524,9 +542,22 @@ nm_logging_get_level (NMLogDomain domain)
|
|||
}
|
||||
|
||||
#if SYSTEMD_JOURNAL
|
||||
_nm_printf (4, 5)
|
||||
static void
|
||||
_iovec_set_format (struct iovec *iov, gboolean *iov_free, int i, const char *format, ...)
|
||||
_iovec_set (struct iovec *iov, const void *str, gsize len)
|
||||
{
|
||||
iov->iov_base = (void *) str;
|
||||
iov->iov_len = len;
|
||||
}
|
||||
|
||||
static void
|
||||
_iovec_set_string (struct iovec *iov, const char *str)
|
||||
{
|
||||
_iovec_set (iov, str, strlen (str));
|
||||
}
|
||||
|
||||
_nm_printf (3, 4)
|
||||
static void
|
||||
_iovec_set_format (struct iovec *iov, gpointer *iov_free, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *str;
|
||||
|
|
@ -535,26 +566,24 @@ _iovec_set_format (struct iovec *iov, gboolean *iov_free, int i, const char *for
|
|||
str = g_strdup_vprintf (format, ap);
|
||||
va_end (ap);
|
||||
|
||||
iov[i].iov_base = str;
|
||||
iov[i].iov_len = strlen (str);
|
||||
iov_free[i] = TRUE;
|
||||
_iovec_set_string (iov, str);
|
||||
*iov_free = str;
|
||||
}
|
||||
|
||||
static void
|
||||
_iovec_set_string_l (struct iovec *iov, gboolean *iov_free, int i, const char *str, gsize len)
|
||||
{
|
||||
iov[i].iov_base = (char *) str;
|
||||
iov[i].iov_len = len;
|
||||
iov_free[i] = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_iovec_set_string (struct iovec *iov, gboolean *iov_free, int i, const char *str)
|
||||
{
|
||||
_iovec_set_string_l (iov, iov_free, i, str, strlen (str));
|
||||
}
|
||||
|
||||
#define _iovec_set_literal_string(iov, iov_free, i, str) _iovec_set_string_l ((iov), (iov_free), (i), (""str""), NM_STRLEN (str))
|
||||
#define _iovec_set_format_a(iov, reserve_extra, format, ...) \
|
||||
G_STMT_START { \
|
||||
const gsize _size = (reserve_extra) + (NM_STRLEN (format) + 3); \
|
||||
char *const _buf = g_alloca (_size); \
|
||||
int _len; \
|
||||
\
|
||||
_len = g_snprintf (_buf, _size, ""format"", ##__VA_ARGS__);\
|
||||
\
|
||||
nm_assert (_len >= 0); \
|
||||
nm_assert (_len <= _size); \
|
||||
nm_assert (_len == strlen (_buf)); \
|
||||
\
|
||||
_iovec_set ((iov), _buf, _len); \
|
||||
} G_STMT_END
|
||||
#endif
|
||||
|
||||
void
|
||||
|
|
@ -569,8 +598,6 @@ _nm_log_impl (const char *file,
|
|||
{
|
||||
va_list args;
|
||||
char *msg;
|
||||
char *fullmsg;
|
||||
char s_buf_timestamp[64];
|
||||
GTimeVal tv;
|
||||
|
||||
if ((guint) level >= G_N_ELEMENTS (_nm_logging_enabled_state))
|
||||
|
|
@ -590,8 +617,15 @@ _nm_log_impl (const char *file,
|
|||
msg = g_strdup_vprintf (fmt, args);
|
||||
va_end (args);
|
||||
|
||||
#define MESSAGE_FMT "%s%-7s [%ld.%04ld] %s"
|
||||
#define MESSAGE_ARG(global, tv, msg) \
|
||||
(global).prefix, \
|
||||
(global).level_desc[level].level_str, \
|
||||
(tv).tv_sec, \
|
||||
((tv).tv_usec / 100), \
|
||||
(msg)
|
||||
|
||||
g_get_current_time (&tv);
|
||||
nm_sprintf_buf (s_buf_timestamp, " [%ld.%04ld]", tv.tv_sec, tv.tv_usec / 100);
|
||||
|
||||
switch (global.log_backend) {
|
||||
#if SYSTEMD_JOURNAL
|
||||
|
|
@ -599,28 +633,23 @@ _nm_log_impl (const char *file,
|
|||
{
|
||||
gint64 now, boottime;
|
||||
#define _NUM_MAX_FIELDS_SYSLOG_FACILITY 10
|
||||
#define _NUM_FIELDS (10 + _NUM_MAX_FIELDS_SYSLOG_FACILITY)
|
||||
int i_field = 0;
|
||||
struct iovec iov[_NUM_FIELDS];
|
||||
gboolean iov_free[_NUM_FIELDS];
|
||||
struct iovec iov_data[12 + _NUM_MAX_FIELDS_SYSLOG_FACILITY];
|
||||
struct iovec *iov = iov_data;
|
||||
gpointer iov_free_data[3];
|
||||
gpointer *iov_free = iov_free_data;
|
||||
nm_auto_free_gstring GString *s_domain_all = NULL;
|
||||
|
||||
now = nm_utils_get_monotonic_timestamp_ns ();
|
||||
boottime = nm_utils_monotonic_timestamp_as_boottime (now, 1);
|
||||
|
||||
_iovec_set_format (iov, iov_free, i_field++, "PRIORITY=%d", global.level_desc[level].syslog_level);
|
||||
_iovec_set_format (iov, iov_free, i_field++, "MESSAGE="
|
||||
"%s%-7s%s %s",
|
||||
global.prefix,
|
||||
global.level_desc[level].level_str,
|
||||
s_buf_timestamp,
|
||||
msg);
|
||||
_iovec_set_string (iov, iov_free, i_field++, syslog_identifier_full (&global));
|
||||
_iovec_set_format (iov, iov_free, i_field++, "SYSLOG_PID=%ld", (long) getpid ());
|
||||
_iovec_set_format_a (iov++, 30, "PRIORITY=%d", global.level_desc[level].syslog_level);
|
||||
_iovec_set_format (iov++, iov_free++, "MESSAGE="MESSAGE_FMT, MESSAGE_ARG (global, tv, msg));
|
||||
_iovec_set_string (iov++, syslog_identifier_full (&global));
|
||||
_iovec_set_format_a (iov++, 30, "SYSLOG_PID=%ld", (long) getpid ());
|
||||
{
|
||||
const LogDesc *diter;
|
||||
int i_domain = _NUM_MAX_FIELDS_SYSLOG_FACILITY;
|
||||
const char *s_domain_1 = NULL;
|
||||
GString *s_domain_all = NULL;
|
||||
NMLogDomain dom_all = domain;
|
||||
NMLogDomain dom = dom_all & _nm_logging_enabled_state[level];
|
||||
|
||||
|
|
@ -635,8 +664,10 @@ _nm_log_impl (const char *file,
|
|||
if (!s_domain_1)
|
||||
s_domain_1 = diter->name;
|
||||
else {
|
||||
if (!s_domain_all)
|
||||
s_domain_all = g_string_new (s_domain_1);
|
||||
if (!s_domain_all) {
|
||||
s_domain_all = g_string_new ("NM_LOG_DOMAINS=");
|
||||
g_string_append (s_domain_all, s_domain_1);
|
||||
}
|
||||
g_string_append_c (s_domain_all, ',');
|
||||
g_string_append (s_domain_all, diter->name);
|
||||
}
|
||||
|
|
@ -644,7 +675,7 @@ _nm_log_impl (const char *file,
|
|||
if (NM_FLAGS_HAS (dom, diter->num)) {
|
||||
if (i_domain > 0) {
|
||||
/* SYSLOG_FACILITY is specified multiple times for each domain that is actually enabled. */
|
||||
_iovec_set_format (iov, iov_free, i_field++, "SYSLOG_FACILITY=%s", diter->name);
|
||||
_iovec_set_format_a (iov++, _MAX_LEN (30, diter->name), "SYSLOG_FACILITY=%s", diter->name);
|
||||
i_domain--;
|
||||
}
|
||||
dom &= ~diter->num;
|
||||
|
|
@ -652,46 +683,38 @@ _nm_log_impl (const char *file,
|
|||
if (!dom && !dom_all)
|
||||
break;
|
||||
}
|
||||
if (s_domain_all) {
|
||||
_iovec_set_format (iov, iov_free, i_field++, "NM_LOG_DOMAINS=%s", s_domain_all->str);
|
||||
g_string_free (s_domain_all, TRUE);
|
||||
} else
|
||||
_iovec_set_format (iov, iov_free, i_field++, "NM_LOG_DOMAINS=%s", s_domain_1);
|
||||
if (s_domain_all)
|
||||
_iovec_set (iov++, s_domain_all->str, s_domain_all->len);
|
||||
else
|
||||
_iovec_set_format_a (iov++, _MAX_LEN (30, s_domain_1), "NM_LOG_DOMAINS=%s", s_domain_1);
|
||||
}
|
||||
_iovec_set_format (iov, iov_free, i_field++, "NM_LOG_LEVEL=%s", global.level_desc[level].name);
|
||||
_iovec_set_format_a (iov++, _MAX_LEN (15, global.level_desc[level].name), "NM_LOG_LEVEL=%s", global.level_desc[level].name);
|
||||
if (func)
|
||||
_iovec_set_format (iov, iov_free, i_field++, "CODE_FUNC=%s", func);
|
||||
_iovec_set_format (iov, iov_free, i_field++, "CODE_FILE=%s", file ?: "");
|
||||
_iovec_set_format (iov, iov_free, i_field++, "CODE_LINE=%u", line);
|
||||
_iovec_set_format (iov, iov_free, i_field++, "TIMESTAMP_MONOTONIC=%lld.%06lld", (long long) (now / NM_UTILS_NS_PER_SECOND), (long long) ((now % NM_UTILS_NS_PER_SECOND) / 1000));
|
||||
_iovec_set_format (iov, iov_free, i_field++, "TIMESTAMP_BOOTTIME=%lld.%06lld", (long long) (boottime / NM_UTILS_NS_PER_SECOND), (long long) ((boottime % NM_UTILS_NS_PER_SECOND) / 1000));
|
||||
_iovec_set_format (iov++, iov_free++, "CODE_FUNC=%s", func);
|
||||
_iovec_set_format (iov++, iov_free++, "CODE_FILE=%s", file ?: "");
|
||||
_iovec_set_format_a (iov++, 20, "CODE_LINE=%u", line);
|
||||
_iovec_set_format_a (iov++, 60, "TIMESTAMP_MONOTONIC=%lld.%06lld", (long long) (now / NM_UTILS_NS_PER_SECOND), (long long) ((now % NM_UTILS_NS_PER_SECOND) / 1000));
|
||||
_iovec_set_format_a (iov++, 60, "TIMESTAMP_BOOTTIME=%lld.%06lld", (long long) (boottime / NM_UTILS_NS_PER_SECOND), (long long) ((boottime % NM_UTILS_NS_PER_SECOND) / 1000));
|
||||
if (error != 0)
|
||||
_iovec_set_format (iov, iov_free, i_field++, "ERRNO=%d", error);
|
||||
_iovec_set_format_a (iov++, 30, "ERRNO=%d", error);
|
||||
|
||||
nm_assert (i_field <= G_N_ELEMENTS (iov));
|
||||
nm_assert (iov <= &iov_data[G_N_ELEMENTS (iov_data)]);
|
||||
nm_assert (iov_free <= &iov_free_data[G_N_ELEMENTS (iov_free_data)]);
|
||||
|
||||
sd_journal_sendv (iov, i_field);
|
||||
sd_journal_sendv (iov_data, iov - iov_data);
|
||||
|
||||
for (; i_field > 0; ) {
|
||||
i_field--;
|
||||
if (iov_free[i_field])
|
||||
g_free (iov[i_field].iov_base);
|
||||
}
|
||||
for (; --iov_free >= iov_free_data; )
|
||||
g_free (*iov_free);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case LOG_BACKEND_SYSLOG:
|
||||
syslog (global.level_desc[level].syslog_level,
|
||||
MESSAGE_FMT, MESSAGE_ARG (global, tv, msg));
|
||||
break;
|
||||
default:
|
||||
fullmsg = g_strdup_printf ("%s%-7s%s %s",
|
||||
global.prefix,
|
||||
global.level_desc[level].level_str,
|
||||
s_buf_timestamp,
|
||||
msg);
|
||||
|
||||
if (global.log_backend == LOG_BACKEND_SYSLOG)
|
||||
syslog (global.level_desc[level].syslog_level, "%s", fullmsg);
|
||||
else
|
||||
g_log (syslog_identifier_domain (&global), global.level_desc[level].g_log_level, "%s", fullmsg);
|
||||
g_free (fullmsg);
|
||||
g_log (syslog_identifier_domain (&global), global.level_desc[level].g_log_level,
|
||||
MESSAGE_FMT, MESSAGE_ARG (global, tv, msg));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ typedef enum { /*< skip >*/
|
|||
/* aliases: */
|
||||
LOGD_DHCP = LOGD_DHCP4 | LOGD_DHCP6,
|
||||
LOGD_IP = LOGD_IP4 | LOGD_IP6,
|
||||
LOGD_HW = LOGD_PLATFORM,
|
||||
} NMLogDomain;
|
||||
|
||||
/* Log levels */
|
||||
|
|
|
|||
|
|
@ -2131,10 +2131,10 @@ platform_link_added (NMManager *self,
|
|||
device = nm_device_factory_create_device (factory, plink->name, plink, NULL, &ignore, &error);
|
||||
if (!device) {
|
||||
if (!ignore) {
|
||||
_LOGW (LOGD_HW, "%s: factory failed to create device: %s",
|
||||
_LOGW (LOGD_PLATFORM, "%s: factory failed to create device: %s",
|
||||
plink->name, error->message);
|
||||
} else {
|
||||
_LOGD (LOGD_HW, "%s: factory failed to create device: %s",
|
||||
_LOGD (LOGD_PLATFORM, "%s: factory failed to create device: %s",
|
||||
plink->name, error->message);
|
||||
}
|
||||
return;
|
||||
|
|
@ -2150,7 +2150,7 @@ platform_link_added (NMManager *self,
|
|||
case NM_LINK_TYPE_OLPC_MESH:
|
||||
case NM_LINK_TYPE_TEAM:
|
||||
case NM_LINK_TYPE_WIFI:
|
||||
_LOGI (LOGD_HW, "(%s): '%s' plugin not available; creating generic device",
|
||||
_LOGI (LOGD_PLATFORM, "(%s): '%s' plugin not available; creating generic device",
|
||||
plink->name, nm_link_type_to_string (plink->type));
|
||||
nm_plugin_missing = TRUE;
|
||||
/* fall through */
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ handle_uevent (GUdevClient *client,
|
|||
subsys = g_udev_device_get_subsystem (device);
|
||||
g_return_if_fail (!g_strcmp0 (subsys, "rfkill"));
|
||||
|
||||
nm_log_dbg (LOGD_HW, "udev rfkill event: action '%s' device '%s'",
|
||||
nm_log_dbg (LOGD_PLATFORM, "udev rfkill event: action '%s' device '%s'",
|
||||
action, g_udev_device_get_name (device));
|
||||
|
||||
if (!strcmp (action, "add"))
|
||||
|
|
|
|||
|
|
@ -1003,7 +1003,7 @@ static int nl80211_wiphy_info_handler (struct nl_msg *msg, void *arg)
|
|||
case WLAN_CIPHER_SUITE_SMS4:
|
||||
break;
|
||||
default:
|
||||
nm_log_dbg (LOGD_HW | LOGD_WIFI, "Don't know the meaning of NL80211_ATTR_CIPHER_SUITE %#8.8x.", ciphers[i]);
|
||||
nm_log_dbg (LOGD_PLATFORM | LOGD_WIFI, "Don't know the meaning of NL80211_ATTR_CIPHER_SUITE %#8.8x.", ciphers[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1071,42 +1071,42 @@ wifi_nl80211_init (const char *iface, int ifindex)
|
|||
|
||||
if (nl80211_send_and_recv (nl80211, msg, nl80211_wiphy_info_handler,
|
||||
&device_info) < 0) {
|
||||
nm_log_dbg (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_dbg (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): NL80211_CMD_GET_WIPHY request failed",
|
||||
nl80211->parent.iface);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!device_info.success) {
|
||||
nm_log_dbg (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_dbg (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): NL80211_CMD_GET_WIPHY request indicated failure",
|
||||
nl80211->parent.iface);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!device_info.supported) {
|
||||
nm_log_dbg (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_dbg (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): driver does not fully support nl80211, falling back to WEXT",
|
||||
nl80211->parent.iface);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!device_info.can_scan_ssid) {
|
||||
nm_log_err (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_err (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): driver does not support SSID scans",
|
||||
nl80211->parent.iface);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (device_info.num_freqs == 0 || device_info.freqs == NULL) {
|
||||
nm_log_err (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_err (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): driver reports no supported frequencies",
|
||||
nl80211->parent.iface);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (device_info.caps == 0) {
|
||||
nm_log_err (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_err (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): driver doesn't report support of any encryption",
|
||||
nl80211->parent.iface);
|
||||
goto error;
|
||||
|
|
@ -1120,7 +1120,7 @@ wifi_nl80211_init (const char *iface, int ifindex)
|
|||
if (device_info.can_wowlan)
|
||||
nl80211->parent.get_wowlan = wifi_nl80211_get_wowlan;
|
||||
|
||||
nm_log_info (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_info (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): using nl80211 for WiFi device control",
|
||||
nl80211->parent.iface);
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ wifi_wext_get_mode (WifiData *data)
|
|||
|
||||
if (ioctl (wext->fd, SIOCGIWMODE, &wrq) < 0) {
|
||||
if (errno != ENODEV) {
|
||||
nm_log_warn (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_warn (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): error %d getting card mode",
|
||||
wext->parent.iface, errno);
|
||||
}
|
||||
|
|
@ -154,7 +154,7 @@ wifi_wext_set_mode (WifiData *data, const NM80211Mode mode)
|
|||
nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface);
|
||||
if (ioctl (wext->fd, SIOCSIWMODE, &wrq) < 0) {
|
||||
if (errno != ENODEV) {
|
||||
nm_log_err (LOGD_HW | LOGD_WIFI, "(%s): error setting mode %d",
|
||||
nm_log_err (LOGD_PLATFORM | LOGD_WIFI, "(%s): error setting mode %d",
|
||||
wext->parent.iface, mode);
|
||||
}
|
||||
return FALSE;
|
||||
|
|
@ -178,7 +178,7 @@ wifi_wext_set_powersave (WifiData *data, guint32 powersave)
|
|||
nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface);
|
||||
if (ioctl (wext->fd, SIOCSIWPOWER, &wrq) < 0) {
|
||||
if (errno != ENODEV) {
|
||||
nm_log_err (LOGD_HW | LOGD_WIFI, "(%s): error setting powersave %" G_GUINT32_FORMAT,
|
||||
nm_log_err (LOGD_PLATFORM | LOGD_WIFI, "(%s): error setting powersave %" G_GUINT32_FORMAT,
|
||||
wext->parent.iface, powersave);
|
||||
}
|
||||
return FALSE;
|
||||
|
|
@ -196,7 +196,7 @@ wifi_wext_get_freq (WifiData *data)
|
|||
memset (&wrq, 0, sizeof (struct iwreq));
|
||||
nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface);
|
||||
if (ioctl (wext->fd, SIOCGIWFREQ, &wrq) < 0) {
|
||||
nm_log_warn (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_warn (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): error getting frequency: %s",
|
||||
wext->parent.iface, strerror (errno));
|
||||
return 0;
|
||||
|
|
@ -230,7 +230,7 @@ wifi_wext_get_bssid (WifiData *data, guint8 *out_bssid)
|
|||
memset (&wrq, 0, sizeof (wrq));
|
||||
nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface);
|
||||
if (ioctl (wext->fd, SIOCGIWAP, &wrq) < 0) {
|
||||
nm_log_warn (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_warn (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): error getting associated BSSID: %s",
|
||||
wext->parent.iface, strerror (errno));
|
||||
return FALSE;
|
||||
|
|
@ -360,7 +360,7 @@ wifi_wext_get_qual (WifiData *data)
|
|||
nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface);
|
||||
|
||||
if (ioctl (wext->fd, SIOCGIWSTATS, &wrq) < 0) {
|
||||
nm_log_warn (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_warn (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): error getting signal strength: %s",
|
||||
wext->parent.iface, strerror (errno));
|
||||
return -1;
|
||||
|
|
@ -403,7 +403,7 @@ wifi_wext_set_mesh_channel (WifiData *data, guint32 channel)
|
|||
}
|
||||
|
||||
if (ioctl (wext->fd, SIOCSIWFREQ, &wrq) < 0) {
|
||||
nm_log_err (LOGD_HW | LOGD_WIFI | LOGD_OLPC,
|
||||
nm_log_err (LOGD_PLATFORM | LOGD_WIFI | LOGD_OLPC,
|
||||
"(%s): error setting channel to %d: %s",
|
||||
wext->parent.iface, channel, strerror (errno));
|
||||
return FALSE;
|
||||
|
|
@ -431,7 +431,7 @@ wifi_wext_set_mesh_ssid (WifiData *data, const guint8 *ssid, gsize len)
|
|||
return TRUE;
|
||||
|
||||
if (errno != ENODEV) {
|
||||
nm_log_err (LOGD_HW | LOGD_WIFI | LOGD_OLPC,
|
||||
nm_log_err (LOGD_PLATFORM | LOGD_WIFI | LOGD_OLPC,
|
||||
"(%s): error setting SSID to '%s': %s",
|
||||
wext->parent.iface,
|
||||
ssid ? nm_utils_escape_ssid (ssid, len) : "(null)",
|
||||
|
|
@ -482,7 +482,7 @@ wext_get_range (WifiDataWext *wext,
|
|||
success = TRUE;
|
||||
break;
|
||||
} else if (errno != EAGAIN) {
|
||||
nm_log_err (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_err (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): couldn't get driver range information (%d).",
|
||||
wext->parent.iface, errno);
|
||||
break;
|
||||
|
|
@ -492,7 +492,7 @@ wext_get_range (WifiDataWext *wext,
|
|||
}
|
||||
|
||||
if (i <= 0) {
|
||||
nm_log_warn (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_warn (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): driver took too long to respond to IWRANGE query.",
|
||||
wext->parent.iface);
|
||||
}
|
||||
|
|
@ -583,13 +583,13 @@ wifi_wext_init (const char *iface, int ifindex, gboolean check_scan)
|
|||
|
||||
memset (&range, 0, sizeof (struct iw_range));
|
||||
if (wext_get_range (wext, &range, &response_len) == FALSE) {
|
||||
nm_log_info (LOGD_HW | LOGD_WIFI, "(%s): driver WEXT range request failed",
|
||||
nm_log_info (LOGD_PLATFORM | LOGD_WIFI, "(%s): driver WEXT range request failed",
|
||||
wext->parent.iface);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((response_len < 300) || (range.we_version_compiled < 21)) {
|
||||
nm_log_info (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_info (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): driver WEXT version too old (got %d, expected >= 21)",
|
||||
wext->parent.iface,
|
||||
range.we_version_compiled);
|
||||
|
|
@ -613,7 +613,7 @@ wifi_wext_init (const char *iface, int ifindex, gboolean check_scan)
|
|||
|
||||
/* Check for scanning capability; cards that can't scan are not supported */
|
||||
if (check_scan && (wext_can_scan (wext) == FALSE)) {
|
||||
nm_log_info (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_info (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): drivers that cannot scan are unsupported",
|
||||
wext->parent.iface);
|
||||
goto error;
|
||||
|
|
@ -625,12 +625,12 @@ wifi_wext_init (const char *iface, int ifindex, gboolean check_scan)
|
|||
*/
|
||||
scan_capa_range = (struct iw_range_with_scan_capa *) ⦥
|
||||
if (scan_capa_range->scan_capa & NM_IW_SCAN_CAPA_ESSID) {
|
||||
nm_log_info (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_info (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): driver supports SSID scans (scan_capa 0x%02X).",
|
||||
wext->parent.iface,
|
||||
scan_capa_range->scan_capa);
|
||||
} else {
|
||||
nm_log_info (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_info (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): driver does not support SSID scans (scan_capa 0x%02X).",
|
||||
wext->parent.iface,
|
||||
scan_capa_range->scan_capa);
|
||||
|
|
@ -644,7 +644,7 @@ wifi_wext_init (const char *iface, int ifindex, gboolean check_scan)
|
|||
if (has_5ghz)
|
||||
wext->parent.caps |= NM_WIFI_DEVICE_CAP_FREQ_5GHZ;
|
||||
|
||||
nm_log_info (LOGD_HW | LOGD_WIFI,
|
||||
nm_log_info (LOGD_PLATFORM | LOGD_WIFI,
|
||||
"(%s): using WEXT for WiFi device control",
|
||||
wext->parent.iface);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue