ctrl: Print the source address of the received commands

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>
This commit is contained in:
xinpeng wang 2022-01-05 16:54:59 +08:00 committed by Jouni Malinen
parent f942149684
commit 0aae045af0
4 changed files with 9 additions and 1 deletions

View file

@ -10697,7 +10697,7 @@ fail:
#endif /* CONFIG_FILS */ #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 || if (os_strcmp(cmd, "PING") == 0 ||
os_strncmp(cmd, "BSS ", 4) == 0 || os_strncmp(cmd, "BSS ", 4) == 0 ||

View file

@ -122,6 +122,8 @@ void wpa_supplicant_global_ctrl_iface_deinit(
void wpas_ctrl_radio_work_flush(struct wpa_supplicant *wpa_s); void wpas_ctrl_radio_work_flush(struct wpa_supplicant *wpa_s);
int wpas_ctrl_cmd_debug_level(const char *cmd);
#else /* CONFIG_CTRL_IFACE */ #else /* CONFIG_CTRL_IFACE */
static inline struct ctrl_iface_priv * static inline struct ctrl_iface_priv *

View file

@ -337,6 +337,9 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
else else
reply_len = 2; reply_len = 2;
} else { } 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 = wpa_supplicant_ctrl_iface_process(wpa_s, pos,
&reply_len); &reply_len);
} }

View file

@ -178,6 +178,9 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
else else
reply_len = 2; reply_len = 2;
} else { } 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_buf = wpa_supplicant_ctrl_iface_process(wpa_s, buf,
&reply_len); &reply_len);
reply = reply_buf; reply = reply_buf;