Add POLL_STA command to check connectivity in AP mode
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 8 Apr 2016 16:37:08 +0000 (19:37 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 8 Apr 2016 21:30:49 +0000 (00:30 +0300)
The hostapd "POLL_STA <addr>" control interface command can be used to
check whether an associated station ACKs a QoS Data frame. The received
ACK for such a frame is reported as an event message ("AP-STA-POLL-OK
<addr>").

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
hostapd/ctrl_iface.c
src/ap/ctrl_iface_ap.c
src/ap/ctrl_iface_ap.h
src/ap/ieee802_11.c
src/common/wpa_ctrl.h

index a87f117..6f22f65 100644 (file)
@@ -2153,6 +2153,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
        } else if (os_strncmp(buf, "DISASSOCIATE ", 13) == 0) {
                if (hostapd_ctrl_iface_disassociate(hapd, buf + 13))
                        reply_len = -1;
+       } else if (os_strncmp(buf, "POLL_STA ", 9) == 0) {
+               if (hostapd_ctrl_iface_poll_sta(hapd, buf + 9))
+                       reply_len = -1;
        } else if (os_strcmp(buf, "STOP_AP") == 0) {
                if (hostapd_ctrl_iface_stop_ap(hapd))
                        reply_len = -1;
index fffb175..917341c 100644 (file)
@@ -429,6 +429,27 @@ int hostapd_ctrl_iface_disassociate(struct hostapd_data *hapd,
 }
 
 
+int hostapd_ctrl_iface_poll_sta(struct hostapd_data *hapd,
+                               const char *txtaddr)
+{
+       u8 addr[ETH_ALEN];
+       struct sta_info *sta;
+
+       wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "CTRL_IFACE POLL_STA %s", txtaddr);
+
+       if (hwaddr_aton(txtaddr, addr))
+               return -1;
+
+       sta = ap_get_sta(hapd, addr);
+       if (!sta)
+               return -1;
+
+       hostapd_drv_poll_client(hapd, hapd->own_addr, addr,
+                               sta->flags & WLAN_STA_WMM);
+       return 0;
+}
+
+
 int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf,
                              size_t buflen)
 {
index 3ad622f..6095d7d 100644 (file)
@@ -19,6 +19,8 @@ int hostapd_ctrl_iface_deauthenticate(struct hostapd_data *hapd,
                                      const char *txtaddr);
 int hostapd_ctrl_iface_disassociate(struct hostapd_data *hapd,
                                    const char *txtaddr);
+int hostapd_ctrl_iface_poll_sta(struct hostapd_data *hapd,
+                               const char *txtaddr);
 int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf,
                              size_t buflen);
 int hostapd_parse_csa_settings(const char *pos,
index aa2b965..fa0e6a3 100644 (file)
@@ -3013,6 +3013,8 @@ void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr)
        }
        if (sta == NULL)
                return;
+       wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POLL_OK MACSTR,
+               MAC2STR(sta->addr));
        if (!(sta->flags & WLAN_STA_PENDING_POLL))
                return;
 
index 20cd5ae..438131f 100644 (file)
@@ -245,6 +245,7 @@ extern "C" {
 #define AP_STA_CONNECTED "AP-STA-CONNECTED "
 #define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED "
 #define AP_STA_POSSIBLE_PSK_MISMATCH "AP-STA-POSSIBLE-PSK-MISMATCH "
+#define AP_STA_POLL_OK "AP-STA-POLL-OK "
 
 #define AP_REJECTED_MAX_STA "AP-REJECTED-MAX-STA "
 #define AP_REJECTED_BLOCKED_STA "AP-REJECTED-BLOCKED-STA "