mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
netconfig: Add multiple levels to IWD_DHCP_DEBUG
Allows granularly specifying the DHCP logging level. This allows the user to tailor the output to what they need. By default, always display info, errors and warnings to match the rest of iwd. Setting `IWD_DHCP_DEBUG` to "debug", "info", "warn", "error" will limit the logging to that level or higher allowing the default logging verbosity to be reduced. Setting `IWD_DHCP_DEBUG` to "1" as per the current behavior will continue to enable debug level logging.
This commit is contained in:
parent
f370b1b960
commit
28d13f9a43
@ -1621,6 +1621,8 @@ struct netconfig *netconfig_new(uint32_t ifindex)
|
||||
struct netdev *netdev = netdev_find(ifindex);
|
||||
struct netconfig *netconfig;
|
||||
struct l_icmp6_client *icmp6;
|
||||
const char *debug_level = NULL;
|
||||
int dhcp_priority = L_LOG_INFO;
|
||||
|
||||
if (!netconfig_list)
|
||||
return NULL;
|
||||
@ -1640,9 +1642,22 @@ struct netconfig *netconfig_new(uint32_t ifindex)
|
||||
netconfig_ipv4_dhcp_event_handler,
|
||||
netconfig, NULL);
|
||||
|
||||
if (getenv("IWD_DHCP_DEBUG"))
|
||||
l_dhcp_client_set_debug(netconfig->dhcp_client, do_debug,
|
||||
"[DHCPv4] ", NULL);
|
||||
debug_level = getenv("IWD_DHCP_DEBUG");
|
||||
if (debug_level != NULL) {
|
||||
if (!strcmp("debug", debug_level))
|
||||
dhcp_priority = L_LOG_DEBUG;
|
||||
else if (!strcmp("info", debug_level))
|
||||
dhcp_priority = L_LOG_INFO;
|
||||
else if (!strcmp("warn", debug_level))
|
||||
dhcp_priority = L_LOG_WARNING;
|
||||
else if (!strcmp("error", debug_level))
|
||||
dhcp_priority = L_LOG_ERR;
|
||||
else /* Default for backwards compatibility */
|
||||
dhcp_priority = L_LOG_DEBUG;
|
||||
}
|
||||
|
||||
l_dhcp_client_set_debug(netconfig->dhcp_client, do_debug,
|
||||
"[DHCPv4] ", NULL, dhcp_priority);
|
||||
|
||||
netconfig->dhcp6_client = l_dhcp6_client_new(ifindex);
|
||||
l_dhcp6_client_set_event_handler(netconfig->dhcp6_client,
|
||||
|
Loading…
Reference in New Issue
Block a user