Allows granularly specifying the DHCP logging level. This allows the
user to tailor the output to what they need. By default always display
errors and warnings.
1 = INFO
2 = DEBUG
---
src/netconfig.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/netconfig.c b/src/netconfig.c
index 6694a0e9..7dd35b2f 100644
--- 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_WARNING;
if (!netconfig_list)
return NULL;
@@ -1640,9 +1642,18 @@ 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)
+ {
+ // Convert from user 1 or 2 to L_LOG_*
+ if (*debug_level == '1')
+ dhcp_priority = L_LOG_INFO;
+ else if (*debug_level == '2')
+ 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,
--
2.25.1
Show replies by date
Use ``1`` and ``2`` for debug level to maintain compatibility with
existing settings.
---
src/iwd.debug.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/iwd.debug.rst b/src/iwd.debug.rst
index 5a805562..e218c4a8 100644
--- a/src/iwd.debug.rst
+++ b/src/iwd.debug.rst
@@ -34,7 +34,7 @@ ENVIRONMENT
*$IWD_GENL_DEBUG* set to ``1`` enables printing Generic Netlink communication with the
kernel.
-*$IWD_DHCP_DEBUG* set to ``1`` enables DHCP debugging.
+*$IWD_DHCP_DEBUG* set to ``1`` (info) or ``2`` (debug) to enabled DHCP logging.
*$IWD_TLS_DEBUG* set to ``1`` enables TLS debugging.
--
2.25.1