From 1ebb59588cdf923d21c8cc3b276a48bb2e3e3496 Mon Sep 17 00:00:00 2001 From: Alberto Fanjul Date: Sun, 20 Nov 2022 12:52:53 +0100 Subject: [PATCH] print dhcp commands --- src/wifi/wifid-supplicant.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/wifi/wifid-supplicant.c b/src/wifi/wifid-supplicant.c index 0bc2ff3f..c83750c1 100644 --- a/src/wifi/wifid-supplicant.c +++ b/src/wifi/wifid-supplicant.c @@ -414,6 +414,22 @@ static int supplicant_group_spawn_dhcp_server(struct supplicant_group *g, } argv[i] = NULL; + i = 0; + size_t size = 0; + while (argv[i]) { + size += strlen(argv[i++]) + 1; + } + + gchar* dhcp_command = malloc(size); + i = 0; + strcpy(dhcp_command, argv[i++]); + while (argv[i]) { + strcat(dhcp_command, " "); + strcat(dhcp_command, argv[i++]); + } + log_debug("dhcp command:%s", dhcp_command); + g_free(dhcp_command); + if (execvpe(argv[0], argv, environ)< 0) { log_error("dhcp failed (%d): %m", errno); } @@ -483,6 +499,22 @@ static int supplicant_group_spawn_dhcp_client(struct supplicant_group *g) } argv[i] = NULL; + i = 0; + size_t size = 0; + while (argv[i]) { + size += strlen(argv[i++]) + 1; + } + + gchar* dhcp_command = malloc(size); + i = 0; + strcpy(dhcp_command, argv[i++]); + while (argv[i]) { + strcat(dhcp_command, " "); + strcat(dhcp_command, argv[i++]); + } + log_debug("dhcp command:%s", dhcp_command); + g_free(dhcp_command); + if (execvpe(argv[0], argv, environ) < 0) { log_error("dhcp failed (%d): %m", errno); }