Print in debug log whether attached monitor is for global interface

It is easier to debug issues related to the wpa_supplicant control
interfaces being left behind in attached state when the debug log file
can be used to determine whether a specific monitor socket was a global
or per-interface one.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-01-18 16:23:43 +02:00
parent 7f08b2f91d
commit 0efcad2c30

View file

@ -74,7 +74,7 @@ static int wpas_ctrl_iface_global_reinit(struct wpa_global *global,
static int wpa_supplicant_ctrl_iface_attach(struct dl_list *ctrl_dst, static int wpa_supplicant_ctrl_iface_attach(struct dl_list *ctrl_dst,
struct sockaddr_un *from, struct sockaddr_un *from,
socklen_t fromlen) socklen_t fromlen, int global)
{ {
struct wpa_ctrl_dst *dst; struct wpa_ctrl_dst *dst;
char addr_txt[200]; char addr_txt[200];
@ -89,7 +89,8 @@ static int wpa_supplicant_ctrl_iface_attach(struct dl_list *ctrl_dst,
printf_encode(addr_txt, sizeof(addr_txt), printf_encode(addr_txt, sizeof(addr_txt),
(u8 *) from->sun_path, (u8 *) from->sun_path,
fromlen - offsetof(struct sockaddr_un, sun_path)); fromlen - offsetof(struct sockaddr_un, sun_path));
wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor attached %s", addr_txt); wpa_printf(MSG_DEBUG, "CTRL_IFACE %smonitor attached %s",
global ? "global " : "", addr_txt);
return 0; return 0;
} }
@ -174,7 +175,7 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
if (os_strcmp(buf, "ATTACH") == 0) { if (os_strcmp(buf, "ATTACH") == 0) {
if (wpa_supplicant_ctrl_iface_attach(&priv->ctrl_dst, &from, if (wpa_supplicant_ctrl_iface_attach(&priv->ctrl_dst, &from,
fromlen)) fromlen, 0))
reply_len = 1; reply_len = 1;
else { else {
new_attached = 1; new_attached = 1;
@ -775,7 +776,8 @@ void wpa_supplicant_ctrl_iface_wait(struct ctrl_iface_priv *priv)
if (os_strcmp(buf, "ATTACH") == 0) { if (os_strcmp(buf, "ATTACH") == 0) {
/* handle ATTACH signal of first monitor interface */ /* handle ATTACH signal of first monitor interface */
if (!wpa_supplicant_ctrl_iface_attach(&priv->ctrl_dst, if (!wpa_supplicant_ctrl_iface_attach(&priv->ctrl_dst,
&from, fromlen)) { &from, fromlen,
0)) {
if (sendto(priv->sock, "OK\n", 3, 0, if (sendto(priv->sock, "OK\n", 3, 0,
(struct sockaddr *) &from, fromlen) < (struct sockaddr *) &from, fromlen) <
0) { 0) {
@ -830,7 +832,7 @@ static void wpa_supplicant_global_ctrl_iface_receive(int sock, void *eloop_ctx,
if (os_strcmp(buf, "ATTACH") == 0) { if (os_strcmp(buf, "ATTACH") == 0) {
if (wpa_supplicant_ctrl_iface_attach(&priv->ctrl_dst, &from, if (wpa_supplicant_ctrl_iface_attach(&priv->ctrl_dst, &from,
fromlen)) fromlen, 1))
reply_len = 1; reply_len = 1;
else else
reply_len = 2; reply_len = 2;