]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
MBO: Track STA cellular data capability from association request
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 22 Feb 2016 11:03:28 +0000 (13:03 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 22 Feb 2016 17:53:05 +0000 (19:53 +0200)
This makes hostapd parse the MBO attribute in (Re)Association Request
frame and track the cellular data capability (mbo_cell_capa=<val> in STA
control interface command).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
hostapd/Android.mk
hostapd/Makefile
src/ap/ctrl_iface_ap.c
src/ap/drv_callbacks.c
src/ap/ieee802_11.c
src/ap/mbo_ap.c [new file with mode: 0644]
src/ap/mbo_ap.h [new file with mode: 0644]
src/ap/sta_info.h
wpa_supplicant/Android.mk
wpa_supplicant/Makefile

index 7048484618db292ec9a2dd15defa981f46cd202d..42d85a4c5396dc6db6723923ea53f9bcae09bb76 100644 (file)
@@ -265,6 +265,7 @@ endif
 
 ifdef CONFIG_MBO
 L_CFLAGS += -DCONFIG_MBO
+OBJS += src/ap/mbo_ap.c
 endif
 
 ifdef CONFIG_FST
index 43a96a525e55ab4846ce3a88c24c48bf4a38f9e9..62f3b32446ea05ecaf308eb209ee02703f23b817 100644 (file)
@@ -284,6 +284,7 @@ endif
 
 ifdef CONFIG_MBO
 CFLAGS += -DCONFIG_MBO
+OBJS += ../src/ap/mbo_ap.o
 endif
 
 include ../src/drivers/drivers.mak
index 4f93ac203cac8b6ef20c8901f7b174e9fbb43b0d..a95230e06899aed822686e12b5c30e40ccb8abbf 100644 (file)
@@ -22,6 +22,7 @@
 #include "p2p_hostapd.h"
 #include "ctrl_iface_ap.h"
 #include "ap_drv_ops.h"
+#include "mbo_ap.h"
 
 
 static int hostapd_get_sta_tx_rx(struct hostapd_data *hapd,
@@ -161,6 +162,10 @@ static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
                        len += res;
        }
 
+       res = mbo_ap_get_info(sta, buf + len, buflen - len);
+       if (res >= 0)
+               len += res;
+
        return len;
 }
 
index 9f53660a001718f17e8d170480f629b522f35d80..db18f29747060e3868e6265c52e6cfc767d6ecca 100644 (file)
@@ -34,6 +34,7 @@
 #include "hw_features.h"
 #include "dfs.h"
 #include "beacon.h"
+#include "mbo_ap.h"
 
 
 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
@@ -173,6 +174,8 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
                sta->mb_ies = NULL;
 #endif /* CONFIG_FST */
 
+       mbo_ap_check_sta_assoc(hapd, sta, &elems);
+
        if (hapd->conf->wpa) {
                if (ie == NULL || ielen == 0) {
 #ifdef CONFIG_WPS
index 251c1a909a3f31bafa387b5f64a24901a55e7742..3ac225deb6a4bece56a41e0d866439779bb6a23e 100644 (file)
@@ -42,6 +42,7 @@
 #include "hw_features.h"
 #include "ieee802_11.h"
 #include "dfs.h"
+#include "mbo_ap.h"
 
 
 u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid)
@@ -1713,6 +1714,8 @@ static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
                sta->mb_ies = NULL;
 #endif /* CONFIG_FST */
 
+       mbo_ap_check_sta_assoc(hapd, sta, &elems);
+
        return WLAN_STATUS_SUCCESS;
 }
 
diff --git a/src/ap/mbo_ap.c b/src/ap/mbo_ap.c
new file mode 100644 (file)
index 0000000..940f693
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * hostapd - MBO
+ * Copyright (c) 2016, Qualcomm Atheros, Inc.
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#include "utils/includes.h"
+
+#include "utils/common.h"
+#include "common/ieee802_11_defs.h"
+#include "common/ieee802_11_common.h"
+#include "hostapd.h"
+#include "sta_info.h"
+#include "mbo_ap.h"
+
+
+void mbo_ap_check_sta_assoc(struct hostapd_data *hapd, struct sta_info *sta,
+                           struct ieee802_11_elems *elems)
+{
+       const u8 *pos, *attr;
+       size_t len;
+
+       if (!hapd->conf->mbo_enabled || !elems->mbo)
+               return;
+
+       pos = elems->mbo + 4;
+       len = elems->mbo_len - 4;
+       wpa_hexdump(MSG_DEBUG, "MBO: Association Request attributes", pos, len);
+
+       attr = get_ie(pos, len, MBO_ATTR_ID_CELL_DATA_CAPA);
+       if (attr && attr[1] >= 1)
+               sta->cell_capa = attr[2];
+}
+
+
+int mbo_ap_get_info(struct sta_info *sta, char *buf, size_t buflen)
+{
+       int ret;
+
+       if (!sta->cell_capa)
+               return 0;
+
+       ret = os_snprintf(buf, buflen, "mbo_cell_capa=%u\n", sta->cell_capa);
+       if (os_snprintf_error(buflen, ret))
+               return 0;
+       return ret;
+}
diff --git a/src/ap/mbo_ap.h b/src/ap/mbo_ap.h
new file mode 100644 (file)
index 0000000..9c6aeda
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * MBO related functions and structures
+ * Copyright (c) 2016, Qualcomm Atheros, Inc.
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#ifndef MBO_AP_H
+#define MBO_AP_H
+
+struct hostapd_data;
+struct sta_info;
+struct ieee802_11_elems;
+
+#ifdef CONFIG_MBO
+
+void mbo_ap_check_sta_assoc(struct hostapd_data *hapd, struct sta_info *sta,
+                           struct ieee802_11_elems *elems);
+int mbo_ap_get_info(struct sta_info *sta, char *buf, size_t buflen);
+
+#else /* CONFIG_MBO */
+
+static inline void mbo_ap_check_sta_assoc(struct hostapd_data *hapd,
+                                         struct sta_info *sta,
+                                         struct ieee802_11_elems *elems)
+{
+}
+
+static inline int mbo_ap_get_info(struct sta_info *sta, char *buf,
+                                 size_t buflen)
+{
+       return 0;
+}
+
+#endif /* CONFIG_MBO */
+
+#endif /* MBO_AP_H */
index d36302f95a7c649536467d38bfe784867ac7b66e..0dd545a9669005dcac975360b9a11777d1638eb8 100644 (file)
@@ -174,6 +174,11 @@ struct sta_info {
        u16 last_seq_ctrl;
        /* Last Authentication/(Re)Association Request/Action frame subtype */
        u8 last_subtype;
+
+#ifdef CONFIG_MBO
+       u8 cell_capa; /* 0 = unknown (not an MBO STA); otherwise,
+                      * enum mbo_cellular_capa values */
+#endif /* CONFIG_MBO */
 };
 
 
index c4e8c9f772209031046fa22faaf75bdf1cfeb344..9adc491e0d9001c841ec0ac4843a972016aeefa1 100644 (file)
@@ -806,6 +806,9 @@ endif
 ifdef CONFIG_WNM
 OBJS += src/ap/wnm_ap.c
 endif
+ifdef CONFIG_MBO
+OBJS += src/ap/mbo_ap.c
+endif
 ifdef CONFIG_CTRL_IFACE
 OBJS += src/ap/ctrl_iface_ap.c
 endif
index 3f6038a290e3b7024aebd82a4d4aafb4324c60d4..28ae1728f1963533d87807c53f9651832a8b1c23 100644 (file)
@@ -848,6 +848,9 @@ endif
 ifdef CONFIG_WNM
 OBJS += ../src/ap/wnm_ap.o
 endif
+ifdef CONFIG_MBO
+OBJS += ../src/ap/mbo_ap.o
+endif
 ifdef CONFIG_CTRL_IFACE
 OBJS += ../src/ap/ctrl_iface_ap.o
 endif