]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Add STA node details in AP through QCA vendor subcommand
authorShiva Sankar Gajula <sgajula@codeaurora.org>
Wed, 16 Oct 2019 07:43:32 +0000 (13:13 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 25 Oct 2019 16:29:53 +0000 (19:29 +0300)
Addi STA node details in AP through QCA vendor subcommand
QCA_NL80211_VENDOR_SUBCMD_ADD_STA_NODE vendor when processing FT
protocol roaming.

Signed-off-by: Shiva Sankar Gajula <sgajula@codeaurora.org>
src/ap/ap_drv_ops.c
src/ap/wpa_auth_glue.c
src/drivers/driver_nl80211.c
src/drivers/driver_nl80211.h
src/drivers/driver_nl80211_capa.c

index de60c79fa26242829657371bcfed8699c88bc5d8..204274f0daa3d6f095bd81cfa7156ef582a86079 100644 (file)
@@ -350,7 +350,7 @@ int hostapd_add_sta_node(struct hostapd_data *hapd, const u8 *addr,
                         u16 auth_alg)
 {
        if (hapd->driver == NULL || hapd->driver->add_sta_node == NULL)
-               return 0;
+               return -EOPNOTSUPP;
        return hapd->driver->add_sta_node(hapd->drv_priv, addr, auth_alg);
 }
 
index 76f86d9d52042231cc17ccd643aa7f8104eaf739..ddab95040dd0c8ba7771546acb6542d0d1f2efe5 100644 (file)
@@ -891,18 +891,28 @@ hostapd_wpa_auth_add_sta(void *ctx, const u8 *sta_addr)
 {
        struct hostapd_data *hapd = ctx;
        struct sta_info *sta;
+       int ret;
 
        wpa_printf(MSG_DEBUG, "Add station entry for " MACSTR
                   " based on WPA authenticator callback",
                   MAC2STR(sta_addr));
-       if (hostapd_add_sta_node(hapd, sta_addr, WLAN_AUTH_FT) < 0)
+       ret = hostapd_add_sta_node(hapd, sta_addr, WLAN_AUTH_FT);
+
+       /*
+        * The expected return values from hostapd_add_sta_node() are
+        * 0: successfully added STA entry
+        * -EOPNOTSUPP: driver or driver wrapper does not support/need this
+        *      operations
+        * any other negative value: error in adding the STA entry */
+       if (ret < 0 && ret != -EOPNOTSUPP)
                return NULL;
 
        sta = ap_sta_add(hapd, sta_addr);
        if (sta == NULL)
                return NULL;
-       if (hapd->driver && hapd->driver->add_sta_node)
+       if (ret == 0)
                sta->added_unassoc = 1;
+
        sta->ft_over_ds = 1;
        if (sta->wpa_sm) {
                sta->auth_alg = WLAN_AUTH_FT;
index 6d88f786e289e685fd462988d496b8545ee28447..4c8dcad8dcaf13b8c2ca7e2a490a7216d917ede3 100644 (file)
@@ -9558,6 +9558,40 @@ fail:
        return -1;
 }
 
+
+static int nl80211_add_sta_node(void *priv, const u8 *addr, u16 auth_alg)
+{
+       struct i802_bss *bss = priv;
+       struct wpa_driver_nl80211_data *drv = bss->drv;
+       struct nl_msg *msg;
+       struct nlattr *params;
+
+       if (!drv->add_sta_node_vendor_cmd_avail)
+               return -EOPNOTSUPP;
+
+       wpa_printf(MSG_DEBUG, "nl80211: Add STA node");
+
+       if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
+           nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_QCA) ||
+           nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD,
+                       QCA_NL80211_VENDOR_SUBCMD_ADD_STA_NODE) ||
+           !(params = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA)) ||
+           (addr &&
+            nla_put(msg, QCA_WLAN_VENDOR_ATTR_ADD_STA_NODE_MAC_ADDR, ETH_ALEN,
+                    addr)) ||
+           nla_put_u16(msg, QCA_WLAN_VENDOR_ATTR_ADD_STA_NODE_AUTH_ALGO,
+                       auth_alg)) {
+               nlmsg_free(msg);
+               wpa_printf(MSG_ERROR,
+                          "%s: err in adding vendor_cmd and vendor_data",
+                          __func__);
+               return -1;
+       }
+       nla_nest_end(msg, params);
+
+       return send_and_recv_msgs(drv, msg, NULL, NULL);
+}
+
 #endif /* CONFIG_DRIVER_NL80211_QCA */
 
 
@@ -11222,6 +11256,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
        .ignore_assoc_disallow = nl80211_ignore_assoc_disallow,
 #endif /* CONFIG_MBO */
        .set_bssid_blacklist = nl80211_set_bssid_blacklist,
+       .add_sta_node = nl80211_add_sta_node,
 #endif /* CONFIG_DRIVER_NL80211_QCA */
        .configure_data_frame_filters = nl80211_configure_data_frame_filters,
        .get_ext_capab = nl80211_get_ext_capab,
index 74982694561e99c42aef7b5ea021d8439055c6aa..716504c10f940c144f38b5638e2b4fb3914046b5 100644 (file)
@@ -172,6 +172,7 @@ struct wpa_driver_nl80211_data {
        unsigned int fetch_bss_trans_status:1;
        unsigned int roam_vendor_cmd_avail:1;
        unsigned int get_supported_akm_suites_avail:1;
+       unsigned int add_sta_node_vendor_cmd_avail:1;
 
        u64 vendor_scan_cookie;
        u64 remain_on_chan_cookie;
index cd9693c908d221ee7a207051039eefcdaaa2c2e8..256e948c221d7ae5c072b8f12337ce04bd5e4d4c 100644 (file)
@@ -787,6 +787,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
                                case QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_AKMS:
                                        drv->get_supported_akm_suites_avail = 1;
                                        break;
+                               case QCA_NL80211_VENDOR_SUBCMD_ADD_STA_NODE:
+                                       drv->add_sta_node_vendor_cmd_avail = 1;
+                                       break;
 #endif /* CONFIG_DRIVER_NL80211_QCA */
                                }
                        }