nl80211: Add support for starting FTM responder

Add support for starting FTM responder when in AP mode. This just sends
the appropriate NEW/SET_BEACON command to the driver with the LCI/civic
location data.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
This commit is contained in:
Johannes Berg 2018-12-03 19:06:22 +02:00 committed by Jouni Malinen
parent d2c4d1ee11
commit 5b82cdbe8b
2 changed files with 29 additions and 2 deletions

View file

@ -4037,7 +4037,7 @@ static int wpa_driver_nl80211_set_ap(void *priv,
struct wpa_driver_nl80211_data *drv = bss->drv;
struct nl_msg *msg;
u8 cmd = NL80211_CMD_NEW_BEACON;
int ret;
int ret = -ENOBUFS;
int beacon_set;
int num_suites;
int smps_mode;
@ -4243,6 +4243,29 @@ static int wpa_driver_nl80211_set_ap(void *priv,
goto fail;
}
if (params->ftm_responder) {
struct nlattr *ftm;
if (!(drv->capa.flags & WPA_DRIVER_FLAGS_FTM_RESPONDER)) {
ret = -ENOTSUP;
goto fail;
}
ftm = nla_nest_start(msg, NL80211_ATTR_FTM_RESPONDER);
if (!ftm ||
nla_put_flag(msg, NL80211_FTM_RESP_ATTR_ENABLED) ||
(params->lci &&
nla_put(msg, NL80211_FTM_RESP_ATTR_LCI,
wpabuf_len(params->lci),
wpabuf_head(params->lci))) ||
(params->civic &&
nla_put(msg, NL80211_FTM_RESP_ATTR_CIVICLOC,
wpabuf_len(params->civic),
wpabuf_head(params->civic))))
goto fail;
nla_nest_end(msg, ftm);
}
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
if (ret) {
wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
@ -4294,7 +4317,7 @@ static int wpa_driver_nl80211_set_ap(void *priv,
return ret;
fail:
nlmsg_free(msg);
return -ENOBUFS;
return ret;
}

View file

@ -428,6 +428,10 @@ static void wiphy_info_ext_feature_flags(struct wiphy_info_data *info,
NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION))
capa->flags |= WPA_DRIVER_FLAGS_OCE_STA;
#endif /* CONFIG_MBO */
if (ext_feature_isset(ext_features, len,
NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER))
capa->flags |= WPA_DRIVER_FLAGS_FTM_RESPONDER;
}