Change mode config parameter from int to string

This renames "mode" to "rrm_mode", and its type from int to string.
This way, we can set the correct mode for a probe request from the STA
reported capabilities, along with the preferred order of modes, set by
the "rrm_mode" uci config.

rrm_mode is a string of possible mode letters:
'p' = passive report
'a' = active report
'b' or 't' = beacon table report.

Setting rrm_mode='pat', will try to send passive reports, if available;
if not, it will try an active report, using a beacon table if all else
fails.

If you don't include a letter, the corresponding report type will be
disabled.  An empty string will disable beacon reports.  Unrecognized
letters are ignored, as well as repeated modes.  If the configuration is
not present, a default value of 'pat' will be used.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
This commit is contained in:
Eneas U de Queiroz 2021-07-27 16:52:19 -03:00 committed by Polynomdivision
parent 276ca169a7
commit 009aab9ca4
7 changed files with 163 additions and 29 deletions

View file

@ -18,13 +18,6 @@ struct time_config_s timeout_config;
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
#ifndef BIT
#define BIT(x) (1U << (x))
#endif
#define WLAN_RRM_CAPS_BEACON_REPORT_PASSIVE BIT(4)
#define WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE BIT(5)
#define WLAN_RRM_CAPS_BEACON_REPORT_TABLE BIT(6)
static int probe_compare(probe_entry *probe1, probe_entry *probe2);
static int kick_client(ap *kicking_ap, struct client_s *client_entry, char* neighbor_report);
@ -402,11 +395,8 @@ void send_beacon_reports(struct dawn_mac bssid, int id) {
!!(i->rrm_enabled_capa & WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE),
!!(i->rrm_enabled_capa & WLAN_RRM_CAPS_BEACON_REPORT_TABLE));
#endif
if (i->rrm_enabled_capa &
(WLAN_RRM_CAPS_BEACON_REPORT_PASSIVE |
WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE |
WLAN_RRM_CAPS_BEACON_REPORT_TABLE))
ubus_send_beacon_report(i->client_addr, id);
if (i->rrm_enabled_capa & dawn_metric.rrm_mode_mask)
ubus_send_beacon_report(i, id);
i = i->next_entry_bc;
}