From 8a5e75f60f7a8ae1562e0ab82c6b2a2eb57350f3 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Thu, 21 Jul 2011 15:19:46 -0700 Subject: [PATCH] P2P: Send STA connected/disconnected events to parent ctrl_iface 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 --- src/ap/hostapd.h | 1 + src/ap/sta_info.c | 14 ++++++++++++++ wpa_supplicant/ap.c | 1 + 3 files changed, 16 insertions(+) diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index 5401e8048..c9bec4ff1 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -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; diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c index dc689ba34..a9981cce4 100644 --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -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; } diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index 7acbefe56..de7c27710 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -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;