eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 28d13f9a433e6554f9a210e9382ffd0e7879b45d
parent f370b1b960fe9f0cb82bc965e38df50c525335d1
Author: Michael Johnson <mjohnson459@gmail.com>
Date:   Wed, 18 May 2022 15:39:14 +0100

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.

Diffstat:
Msrc/netconfig.c | 21++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/netconfig.c b/src/netconfig.c @@ -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,