wpa_supplicant: Add an option to specify SSID in neighbor report requests
Allow supplying an SSID for the SSID IE. If not supplied, no SSID IE is sent, and the request implies the current SSID. Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
This commit is contained in:
parent
fad14af93a
commit
4c4b230527
3 changed files with 32 additions and 14 deletions
|
@ -6838,11 +6838,26 @@ static void wpas_ctrl_neighbor_rep_cb(void *ctx, struct wpabuf *neighbor_rep)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int wpas_ctrl_iface_send_neigbor_rep(struct wpa_supplicant *wpa_s)
|
static int wpas_ctrl_iface_send_neigbor_rep(struct wpa_supplicant *wpa_s,
|
||||||
|
char *cmd)
|
||||||
{
|
{
|
||||||
return wpas_rrm_send_neighbor_rep_request(wpa_s,
|
struct wpa_ssid ssid;
|
||||||
wpas_ctrl_neighbor_rep_cb,
|
struct wpa_ssid *ssid_p = NULL;
|
||||||
wpa_s);
|
int ret = 0;
|
||||||
|
|
||||||
|
if (os_strncmp(cmd, " ssid=", 6) == 0) {
|
||||||
|
ssid.ssid_len = os_strlen(cmd + 6);
|
||||||
|
if (ssid.ssid_len > 32)
|
||||||
|
return -1;
|
||||||
|
ssid.ssid = (u8 *) (cmd + 6);
|
||||||
|
ssid_p = &ssid;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = wpas_rrm_send_neighbor_rep_request(wpa_s, ssid_p,
|
||||||
|
wpas_ctrl_neighbor_rep_cb,
|
||||||
|
wpa_s);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7449,7 +7464,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
|
||||||
if (wpas_ctrl_vendor_elem_remove(wpa_s, buf + 19) < 0)
|
if (wpas_ctrl_vendor_elem_remove(wpa_s, buf + 19) < 0)
|
||||||
reply_len = -1;
|
reply_len = -1;
|
||||||
} else if (os_strncmp(buf, "NEIGHBOR_REP_REQUEST", 20) == 0) {
|
} else if (os_strncmp(buf, "NEIGHBOR_REP_REQUEST", 20) == 0) {
|
||||||
if (wpas_ctrl_iface_send_neigbor_rep(wpa_s))
|
if (wpas_ctrl_iface_send_neigbor_rep(wpa_s, buf + 20))
|
||||||
reply_len = -1;
|
reply_len = -1;
|
||||||
} else {
|
} else {
|
||||||
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
|
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
|
||||||
|
|
|
@ -4994,6 +4994,8 @@ void wpas_rrm_process_neighbor_rep(struct wpa_supplicant *wpa_s,
|
||||||
/**
|
/**
|
||||||
* wpas_rrm_send_neighbor_rep_request - Request a neighbor report from our AP
|
* wpas_rrm_send_neighbor_rep_request - Request a neighbor report from our AP
|
||||||
* @wpa_s: Pointer to wpa_supplicant
|
* @wpa_s: Pointer to wpa_supplicant
|
||||||
|
* @ssid: if not null, this is sent in the request. Otherwise, no SSID IE
|
||||||
|
* is sent in the request.
|
||||||
* @cb: Callback function to be called once the requested report arrives, or
|
* @cb: Callback function to be called once the requested report arrives, or
|
||||||
* timed out after RRM_NEIGHBOR_REPORT_TIMEOUT seconds.
|
* timed out after RRM_NEIGHBOR_REPORT_TIMEOUT seconds.
|
||||||
* In the former case, 'neighbor_rep' is a newly allocated wpabuf, and it's
|
* In the former case, 'neighbor_rep' is a newly allocated wpabuf, and it's
|
||||||
|
@ -5005,9 +5007,9 @@ void wpas_rrm_process_neighbor_rep(struct wpa_supplicant *wpa_s,
|
||||||
* In case there is a previous request which has not been answered yet, the
|
* In case there is a previous request which has not been answered yet, the
|
||||||
* new request fails. The caller may retry after RRM_NEIGHBOR_REPORT_TIMEOUT.
|
* new request fails. The caller may retry after RRM_NEIGHBOR_REPORT_TIMEOUT.
|
||||||
* Request must contain a callback function.
|
* Request must contain a callback function.
|
||||||
* The Neighbor Report Request sent to the AP will specify the current SSID.
|
|
||||||
*/
|
*/
|
||||||
int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
|
int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
|
||||||
|
const struct wpa_ssid *ssid,
|
||||||
void (*cb)(void *ctx,
|
void (*cb)(void *ctx,
|
||||||
struct wpabuf *neighbor_rep),
|
struct wpabuf *neighbor_rep),
|
||||||
void *cb_ctx)
|
void *cb_ctx)
|
||||||
|
@ -5047,8 +5049,8 @@ int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 5 = action category + action code + dialog token + IE hdr */
|
/* 3 = action category + action code + dialog token */
|
||||||
buf = wpabuf_alloc(5 + wpa_s->current_ssid->ssid_len);
|
buf = wpabuf_alloc(3 + (ssid ? 2 + ssid->ssid_len : 0));
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"RRM: Failed to allocate Neighbor Report Request");
|
"RRM: Failed to allocate Neighbor Report Request");
|
||||||
|
@ -5056,17 +5058,17 @@ int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
|
||||||
}
|
}
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "RRM: Neighbor report request (for %s), token=%d",
|
wpa_printf(MSG_DEBUG, "RRM: Neighbor report request (for %s), token=%d",
|
||||||
wpa_ssid_txt(wpa_s->current_ssid->ssid,
|
(ssid ? wpa_ssid_txt(ssid->ssid, ssid->ssid_len) : ""),
|
||||||
wpa_s->current_ssid->ssid_len),
|
|
||||||
wpa_s->rrm.next_neighbor_rep_token);
|
wpa_s->rrm.next_neighbor_rep_token);
|
||||||
|
|
||||||
wpabuf_put_u8(buf, WLAN_ACTION_RADIO_MEASUREMENT);
|
wpabuf_put_u8(buf, WLAN_ACTION_RADIO_MEASUREMENT);
|
||||||
wpabuf_put_u8(buf, WLAN_RRM_NEIGHBOR_REPORT_REQUEST);
|
wpabuf_put_u8(buf, WLAN_RRM_NEIGHBOR_REPORT_REQUEST);
|
||||||
wpabuf_put_u8(buf, wpa_s->rrm.next_neighbor_rep_token);
|
wpabuf_put_u8(buf, wpa_s->rrm.next_neighbor_rep_token);
|
||||||
wpabuf_put_u8(buf, WLAN_EID_SSID);
|
if (ssid) {
|
||||||
wpabuf_put_u8(buf, wpa_s->current_ssid->ssid_len);
|
wpabuf_put_u8(buf, WLAN_EID_SSID);
|
||||||
wpabuf_put_data(buf, wpa_s->current_ssid->ssid,
|
wpabuf_put_u8(buf, ssid->ssid_len);
|
||||||
wpa_s->current_ssid->ssid_len);
|
wpabuf_put_data(buf, ssid->ssid, ssid->ssid_len);
|
||||||
|
}
|
||||||
|
|
||||||
wpa_s->rrm.next_neighbor_rep_token++;
|
wpa_s->rrm.next_neighbor_rep_token++;
|
||||||
|
|
||||||
|
|
|
@ -1026,6 +1026,7 @@ void wpas_rrm_reset(struct wpa_supplicant *wpa_s);
|
||||||
void wpas_rrm_process_neighbor_rep(struct wpa_supplicant *wpa_s,
|
void wpas_rrm_process_neighbor_rep(struct wpa_supplicant *wpa_s,
|
||||||
const u8 *report, size_t report_len);
|
const u8 *report, size_t report_len);
|
||||||
int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
|
int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
|
||||||
|
const struct wpa_ssid *ssid,
|
||||||
void (*cb)(void *ctx,
|
void (*cb)(void *ctx,
|
||||||
struct wpabuf *neighbor_rep),
|
struct wpabuf *neighbor_rep),
|
||||||
void *cb_ctx);
|
void *cb_ctx);
|
||||||
|
|
Loading…
Reference in a new issue