]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
ctrl: Print the source address of the received commands
authorxinpeng wang <wangxinpeng@uniontech.com>
Wed, 5 Jan 2022 08:54:59 +0000 (16:54 +0800)
committerJouni Malinen <j@w1.fi>
Mon, 18 Apr 2022 14:57:21 +0000 (17:57 +0300)
Sometimes there is a program error to send a large number of commands to
wpa_supplicant, and the source address can help quickly find the program
that sends commands.

Signed-off-by: xinpeng wang <wangxinpeng@uniontech.com>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/ctrl_iface.h
wpa_supplicant/ctrl_iface_udp.c
wpa_supplicant/ctrl_iface_unix.c

index bc7b8e46f51fa0196f77021c125c17147925963f..70538b578b24c60a0e063e42f1c986cdb46ea5a4 100644 (file)
@@ -10697,7 +10697,7 @@ fail:
 #endif /* CONFIG_FILS */
 
 
-static int wpas_ctrl_cmd_debug_level(const char *cmd)
+int wpas_ctrl_cmd_debug_level(const char *cmd)
 {
        if (os_strcmp(cmd, "PING") == 0 ||
            os_strncmp(cmd, "BSS ", 4) == 0 ||
index dfbd25a03b1b077a93d6d3e4d547f30887b2dcdb..9842ea1e71e67a771da785162358a4d5de586040 100644 (file)
@@ -122,6 +122,8 @@ void wpa_supplicant_global_ctrl_iface_deinit(
 
 void wpas_ctrl_radio_work_flush(struct wpa_supplicant *wpa_s);
 
+int wpas_ctrl_cmd_debug_level(const char *cmd);
+
 #else /* CONFIG_CTRL_IFACE */
 
 static inline struct ctrl_iface_priv *
index 1cbf7fa28d3f9bdd7ff508b8c85654b9f474d063..1178f406cc16b85d524b2cf5c0451f75d497d689 100644 (file)
@@ -337,6 +337,9 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
                else
                        reply_len = 2;
        } else {
+               sockaddr_print(wpas_ctrl_cmd_debug_level(buf),
+                              "Control interface recv command from:",
+                              &from, fromlen);
                reply = wpa_supplicant_ctrl_iface_process(wpa_s, pos,
                                                          &reply_len);
        }
index 639573dae75ea99c7468207987d39d2676b6ee53..2052873d57f0f0b8558b6355bb5d60ae56bc6ea6 100644 (file)
@@ -178,6 +178,9 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
                else
                        reply_len = 2;
        } else {
+               sockaddr_print(wpas_ctrl_cmd_debug_level(buf),
+                              "Control interface recv command from:",
+                              &from, fromlen);
                reply_buf = wpa_supplicant_ctrl_iface_process(wpa_s, buf,
                                                              &reply_len);
                reply = reply_buf;