From d76ba2b3164c71da90c2006ed442253d3a6b8c4c Mon Sep 17 00:00:00 2001 From: Aloka Dixit Date: Mon, 14 Dec 2020 18:04:28 -0800 Subject: [PATCH] nl80211: Add FILS Discovery frame configuration Add support for setting the parameters for FILS Discovery frame transmission. Signed-off-by: Aloka Dixit --- src/drivers/driver_nl80211.c | 35 +++++++++++++++++++++++++++++++ src/drivers/driver_nl80211.h | 1 + src/drivers/driver_nl80211_capa.c | 4 ++++ 3 files changed, 40 insertions(+) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 3790fe2bb..86b70d546 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4403,6 +4403,36 @@ static int nl80211_put_sae_pwe(struct nl_msg *msg, int pwe) #endif /* CONFIG_SAE */ +#ifdef CONFIG_FILS +static int nl80211_fils_discovery(struct i802_bss *bss, struct nl_msg *msg, + struct wpa_driver_ap_params *params) +{ + struct nlattr *attr; + + if (!bss->drv->fils_discovery) { + wpa_printf(MSG_ERROR, + "nl80211: Driver does not support FILS Discovery frame transmission for %s", + bss->ifname); + return -1; + } + + attr = nla_nest_start(msg, NL80211_ATTR_FILS_DISCOVERY); + if (!attr || + nla_put_u32(msg, NL80211_FILS_DISCOVERY_ATTR_INT_MIN, + params->fd_min_int) || + nla_put_u32(msg, NL80211_FILS_DISCOVERY_ATTR_INT_MAX, + params->fd_max_int) || + (params->fd_frame_tmpl && + nla_put(msg, NL80211_FILS_DISCOVERY_ATTR_TMPL, + params->fd_frame_tmpl_len, params->fd_frame_tmpl))) + return -1; + + nla_nest_end(msg, attr); + return 0; +} +#endif /* CONFIG_FILS */ + + static int wpa_driver_nl80211_set_ap(void *priv, struct wpa_driver_ap_params *params) { @@ -4688,6 +4718,11 @@ static int wpa_driver_nl80211_set_ap(void *priv, goto fail; #endif /* CONFIG_SAE */ +#ifdef CONFIG_FILS + if (params->fd_max_int && nl80211_fils_discovery(bss, msg, params) < 0) + goto fail; +#endif /* CONFIG_FILS */ + ret = send_and_recv_msgs_owner(drv, msg, get_connect_handle(bss), 1, NULL, NULL, NULL, NULL); if (ret) { diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h index 7b9be1f3a..343403017 100644 --- a/src/drivers/driver_nl80211.h +++ b/src/drivers/driver_nl80211.h @@ -175,6 +175,7 @@ struct wpa_driver_nl80211_data { unsigned int multicast_registrations:1; unsigned int no_rrm:1; unsigned int get_sta_info_vendor_cmd_avail:1; + unsigned int fils_discovery:1; u64 vendor_scan_cookie; u64 remain_on_chan_cookie; diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 6dea42f90..3296ce9d6 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -648,6 +648,10 @@ static void wiphy_info_ext_feature_flags(struct wiphy_info_data *info, if (ext_feature_isset(ext_features, len, NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS)) info->drv->multicast_registrations = 1; + + if (ext_feature_isset(ext_features, len, + NL80211_EXT_FEATURE_FILS_DISCOVERY)) + info->drv->fils_discovery = 1; }