P2P: Send STA connected/disconnected events to parent ctrl_iface
authorDmitry Shmidt <dimitrysh@google.com>
Thu, 21 Jul 2011 22:19:46 +0000 (15:19 -0700)
committerJouni Malinen <j@w1.fi>
Fri, 25 Nov 2011 21:56:13 +0000 (23:56 +0200)
Send the connection events from P2P group to both the group interface
and parent interface ctrl_ifaces to make it easier for external monitor
programs to see these events without having to listen to all group
interfaces when virtual group interfaces are used.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
src/ap/hostapd.h
src/ap/sta_info.c
wpa_supplicant/ap.c

index 5401e80..c9bec4f 100644 (file)
@@ -82,6 +82,7 @@ struct hostapd_data {
                                 struct sta_info *sta, int reassoc);
 
        void *msg_ctx; /* ctx for wpa_msg() calls */
+       void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
 
        struct radius_client_data *radius;
        u32 acct_session_id_hi, acct_session_id_lo;
index dc689ba..a9981cc 100644 (file)
@@ -786,11 +786,25 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
                else
                        wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED
                                MACSTR, MAC2STR(sta->addr));
+               if (hapd->msg_ctx_parent &&
+                   hapd->msg_ctx_parent != hapd->msg_ctx && dev_addr)
+                       wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
+                               AP_STA_CONNECTED MACSTR " dev_addr=" MACSTR,
+                               MAC2STR(sta->addr), MAC2STR(dev_addr));
+               else if (hapd->msg_ctx_parent &&
+                        hapd->msg_ctx_parent != hapd->msg_ctx)
+                       wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
+                               AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));
 
                sta->flags |= WLAN_STA_AUTHORIZED;
        } else {
                wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED MACSTR,
                        MAC2STR(sta->addr));
+               if (hapd->msg_ctx_parent &&
+                   hapd->msg_ctx_parent != hapd->msg_ctx)
+                       wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
+                               AP_STA_DISCONNECTED MACSTR,
+                               MAC2STR(sta->addr));
                sta->flags &= ~WLAN_STA_AUTHORIZED;
        }
 
index 7acbefe..de7c277 100644 (file)
@@ -490,6 +490,7 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
                }
 
                hapd_iface->bss[i]->msg_ctx = wpa_s;
+               hapd_iface->bss[i]->msg_ctx_parent = wpa_s->parent;
                hapd_iface->bss[i]->public_action_cb = ap_public_action_rx;
                hapd_iface->bss[i]->public_action_cb_ctx = wpa_s;
                hapd_iface->bss[i]->vendor_action_cb = ap_vendor_action_rx;