diff --git a/src/agent.c b/src/agent.c index 1ca65a857141ddbd60098bf88da39623a63ca094..091d1eb1f74f4d009bd15a74f5e8f9bea6272017 100644 --- a/src/agent.c +++ b/src/agent.c @@ -1287,8 +1287,24 @@ static int update_sta_entry(struct agent *a, struct netif_ap *ap, struct wifi_st s->rx_fail_pkts = e->stats.rx_fail_pkts; s->rtx_pkts = e->stats.tx_retry_pkts; - memcpy(s->bssid, e->bssid, 6); + + if (!!(e->caps.valid & WIFI_CAP_RM_VALID)) { + if (wifi_cap_isset(e->cbitmap, WIFI_CAP_RM_BCN_ACTIVE)) { + s->rrm_mode |= NBR_PARAM_BCN_ACTIVE; + s->supports_bcnreport = true; + } + + if (wifi_cap_isset(e->cbitmap, WIFI_CAP_RM_BCN_PASSIVE)) { + s->rrm_mode |= NBR_PARAM_BCN_PASSIVE; + s->supports_bcnreport = true; + } + + if (wifi_cap_isset(e->cbitmap, WIFI_CAP_RM_BCN_TABLE)) { + s->rrm_mode |= NBR_PARAM_BCN_TABLE; + s->supports_bcnreport = true; + } + } #ifdef UBUS_STA_INFO wifiagent_log_stainfo(ap->agent, s); #endif @@ -1301,7 +1317,8 @@ static int update_sta_entry(struct agent *a, struct netif_ap *ap, struct wifi_st static int agent_req_beacon_metrics(struct agent *a, struct netif_ap *ap, uint8_t *sta_addr, uint8_t opclass, - uint8_t channel, uint8_t *bssid, uint8_t reporting_detail, + uint8_t channel, uint8_t *bssid, + uint8_t rrm_mode, uint8_t reporting_detail, uint8_t ssid_len, char *ssid, uint8_t num_report, uint8_t *report, uint8_t num_element, uint8_t *element) { @@ -1322,6 +1339,7 @@ static int agent_req_beacon_metrics(struct agent *a, param.report = report; param.num_element = num_element; param.element = element; + param.rrm_mode = rrm_mode; return wifi_req_neighbor(ap->ifname, sta_addr, ¶m); } @@ -1346,6 +1364,7 @@ static void wifi_sta_bcn_req(atimer_t *t) agent_req_beacon_metrics(a, breq->ap, s->macaddr, breq->opclass, breq->channel, breq->bssid, + s->rrm_mode, breq->reporting_detail, breq->ssid_len, breq->ssid, 0, NULL, breq->num_element, breq->element); diff --git a/src/agent.h b/src/agent.h index 48f944f4789f6bbab99eb41d5cd8860a1c5db299..b8814114646c6179b644405e02c7f228a58d7f4b 100644 --- a/src/agent.h +++ b/src/agent.h @@ -494,6 +494,7 @@ struct sta { int inform_leaving; /** flag indicating leaving BSS */ bool wait_for_cntlr_nbr; /** awaiting pref nbr from cntlr */ bool supports_bcnreport; /** supports 11K beacon reporting */ + uint8_t rrm_mode; /** bitmap for ACTIVE/PASSIVE/TABLE */ atimer_t sta_timer; /** periodic run */ atimer_t sta_bcn_req_timer; /** enqueue bcn requests */ struct list_head sta_nbrlist; /** neighbor BSSs as seen by this STA */ diff --git a/src/wifi.h b/src/wifi.h index 66575bf94236d8e3175f7ae4cae779f1a31f4691..ed926e4fa5a2480d68d2fa0b7b062bf602de05d0 100644 --- a/src/wifi.h +++ b/src/wifi.h @@ -49,10 +49,17 @@ struct wifi_radio_status { uint32_t bandwidth; }; +enum nbr_param_bcn_mode { + NBR_PARAM_BCN_ACTIVE = 1 << 0, + NBR_PARAM_BCN_PASSIVE = 1 << 1, + NBR_PARAM_BCN_TABLE = 1 << 2, +}; + struct wifi_request_neighbor_param { uint8_t opclass; uint8_t channel; uint8_t *bssid; + uint8_t rrm_mode; uint8_t reporting_detail; uint8_t ssid_len; char *ssid; diff --git a/src/wifi_ubus.c b/src/wifi_ubus.c index 890b356c23f340c9230d9fec46397e75eb8c7a34..47f6e6fd7de61f60282e8d75d427899e8ca810bd 100644 --- a/src/wifi_ubus.c +++ b/src/wifi_ubus.c @@ -1718,10 +1718,16 @@ int wifi_ubus_req_neighbor(struct ubus_context *ubus_ctx, const char *ifname, blobmsg_add_string(&bb, "bssid", bssid_macstr); } - /* TODO: revisit */ - /* Set mode to PASSIVE/100ms explicitly */ + /* Start with passive mode by default */ blobmsg_add_string(&bb, "mode", "passive"); blobmsg_add_u32(&bb, "duration", 100); + if (!(param->rrm_mode & NBR_PARAM_BCN_PASSIVE)) { + /* passive not supported, check for active but keep passive otherwise */ + if (param->rrm_mode & NBR_PARAM_BCN_ACTIVE) { + blobmsg_add_string(&bb, "mode", "active"); + blobmsg_add_u32(&bb, "duration", 20); + } + } if (param->reporting_detail) blobmsg_add_u32(&bb, "reporting_detail", param->reporting_detail);