diff --git a/src/agent.c b/src/agent.c index d9e58229468b191a862167ff27a7deb0a8bd6050..ef0e69e7b77ae3c1a9650e7cd13ed415229b8e9a 100644 --- a/src/agent.c +++ b/src/agent.c @@ -2604,11 +2604,28 @@ out_str: } } +static void agent_iface_disconnect_all_sta(const struct netif_ap *iface, + uint16_t reason) +{ + struct sta *sta; + + list_for_each_entry(sta, &iface->stalist, list) { + wifi_disconnect_sta(iface->name, sta->macaddr, reason); + } + +} + static void agent_init_ifaces_assoc_mode(struct agent *a) { const struct netif_ap *iface; list_for_each_entry(iface, &a->aplist, list) { + if (iface->cfg->disallow_assoc) { + agent_iface_disconnect_all_sta( + iface, + WIFI_REASON_SERVICE_NOT_AUTHORIZED_IN_THIS_LOCATION); + } + wifi_set_backhaul_bss_association_mode(iface->name, iface->cfg->disallow_assoc); } @@ -2624,6 +2641,7 @@ static void apply_iface_assocation_mode(struct agent *a, const char *ifname) } } + static void wifi_iface_event_handler(void *c, struct blob_attr *msg) { struct agent *a = (struct agent *)c; @@ -6818,8 +6836,6 @@ void run_agent(void) agent_init_wsc_attributes(w); - agent_init_ifaces_assoc_mode(w); - //memcpy(w->cntlr_almac, w->cfg.cntlr_almac, 6); //agent_config_dump(&w->cfg); @@ -6854,6 +6870,7 @@ void run_agent(void) timer_init(&w->cfg.metric_report_timer, agent_metric_report_timer_cb); agent_init_interfaces(w); + agent_init_ifaces_assoc_mode(w); /* switch to the channel according to the prefrence */ //agent_switch_according_to_pref(w); diff --git a/src/wifidefs.h b/src/wifidefs.h index b068c93aafb2335009ff48575c293d850db62422..9e47aa45a28dccfd1596e260989dcd85bbcdca3e 100644 --- a/src/wifidefs.h +++ b/src/wifidefs.h @@ -39,6 +39,7 @@ extern "C" { #define WIFI_REASON_DISASSOC_STA_HAS_LEFT 8 #define WIFI_REASON_BSS_TRANSITION_DISASSOC 12 +#define WIFI_REASON_SERVICE_NOT_AUTHORIZED_IN_THIS_LOCATION 30 /** wifi status and reason code as per IEEE802.11 Std. */ typedef uint16_t wifi_status_t, wifi_reason_t;