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

@ -19,6 +19,15 @@
// ---------------- Defines -------------------
#define MAC_LIST_LENGTH 100
#define DEFAULT_RRM_MODE_ORDER "pat"
#define RRM_MODE_COUNT 3
enum rrm_beacon_rqst_mode {
RRM_BEACON_RQST_MODE_PASSIVE,
RRM_BEACON_RQST_MODE_ACTIVE,
RRM_BEACON_RQST_MODE_BEACON_TABLE,
__RRM_BEACON_RQST_MODE_MAX
};
// ---------------- Global variables ----------------
extern struct mac_entry_s *mac_set;
@ -75,7 +84,8 @@ struct probe_metric_s {
int kicking;
int op_class;
int duration;
int mode;
int rrm_mode_mask;
int rrm_mode_order[__RRM_BEACON_RQST_MODE_MAX];
int scan_channel;
};
@ -174,6 +184,21 @@ typedef struct auth_entry_s assoc_entry;
// ---------------- Defines ----------------
#define NEIGHBOR_REPORT_LEN 200
/* Neighbor report string elements
* [Elemen ID|1][LENGTH|1][BSSID|6][BSSID INFORMATION|4][Operating Class|1][Channel Number|1][PHY Type|1][Operational Subelements]
* first two bytes are not stored
*/
#define NR_BSSID 0
#define NR_BSSID_INFO 12
#define NR_OP_CLASS 20
#define NR_CHANNEL 22
#define NR_PHY 24
#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)
// ---------------- Global variables ----------------
extern struct auth_entry_s *denied_req_set;

View file

@ -68,7 +68,7 @@ void del_client_all_interfaces(const struct dawn_mac client_addr, uint32_t reaso
*/
void update_hostapd_sockets(struct uloop_timeout *t);
void ubus_send_beacon_report(struct dawn_mac client, int id);
void ubus_send_beacon_report(client *c, int id);
void uloop_add_data_cbs();