hostapd: Refactor interface enable/disable into separate helper functions
Driver events for interface enable/disable are currently handled on interface level with one hostapd_data instance under consideration. In order to extend it for MLO, this needs to be done for each of the affiliated links. Hence, refactor the code into a helper function which can be used later. No functionality change. Support for MLO will be added in a subsequent change. Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
This commit is contained in:
parent
8324947a67
commit
e9984e3db2
1 changed files with 34 additions and 22 deletions
|
@ -2432,6 +2432,38 @@ static void hostapd_event_color_change(struct hostapd_data *hapd, bool success)
|
||||||
#endif /* CONFIG_IEEE80211AX */
|
#endif /* CONFIG_IEEE80211AX */
|
||||||
|
|
||||||
|
|
||||||
|
static void hostapd_iface_enable(struct hostapd_data *hapd)
|
||||||
|
{
|
||||||
|
wpa_msg(hapd->msg_ctx, MSG_INFO, INTERFACE_ENABLED);
|
||||||
|
if (hapd->disabled && hapd->started) {
|
||||||
|
hapd->disabled = 0;
|
||||||
|
/*
|
||||||
|
* Try to re-enable interface if the driver stopped it
|
||||||
|
* when the interface got disabled.
|
||||||
|
*/
|
||||||
|
if (hapd->wpa_auth)
|
||||||
|
wpa_auth_reconfig_group_keys(hapd->wpa_auth);
|
||||||
|
else
|
||||||
|
hostapd_reconfig_encryption(hapd);
|
||||||
|
hapd->reenable_beacon = 1;
|
||||||
|
ieee802_11_set_beacon(hapd);
|
||||||
|
#ifdef NEED_AP_MLME
|
||||||
|
} else if (hapd->disabled && hapd->iface->cac_started) {
|
||||||
|
wpa_printf(MSG_DEBUG, "DFS: restarting pending CAC");
|
||||||
|
hostapd_handle_dfs(hapd->iface);
|
||||||
|
#endif /* NEED_AP_MLME */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void hostapd_iface_disable(struct hostapd_data *hapd)
|
||||||
|
{
|
||||||
|
hostapd_free_stas(hapd);
|
||||||
|
wpa_msg(hapd->msg_ctx, MSG_INFO, INTERFACE_DISABLED);
|
||||||
|
hapd->disabled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||||
union wpa_event_data *data)
|
union wpa_event_data *data)
|
||||||
{
|
{
|
||||||
|
@ -2709,30 +2741,10 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||||
break;
|
break;
|
||||||
#endif /* NEED_AP_MLME */
|
#endif /* NEED_AP_MLME */
|
||||||
case EVENT_INTERFACE_ENABLED:
|
case EVENT_INTERFACE_ENABLED:
|
||||||
wpa_msg(hapd->msg_ctx, MSG_INFO, INTERFACE_ENABLED);
|
hostapd_iface_enable(hapd);
|
||||||
if (hapd->disabled && hapd->started) {
|
|
||||||
hapd->disabled = 0;
|
|
||||||
/*
|
|
||||||
* Try to re-enable interface if the driver stopped it
|
|
||||||
* when the interface got disabled.
|
|
||||||
*/
|
|
||||||
if (hapd->wpa_auth)
|
|
||||||
wpa_auth_reconfig_group_keys(hapd->wpa_auth);
|
|
||||||
else
|
|
||||||
hostapd_reconfig_encryption(hapd);
|
|
||||||
hapd->reenable_beacon = 1;
|
|
||||||
ieee802_11_set_beacon(hapd);
|
|
||||||
#ifdef NEED_AP_MLME
|
|
||||||
} else if (hapd->disabled && hapd->iface->cac_started) {
|
|
||||||
wpa_printf(MSG_DEBUG, "DFS: restarting pending CAC");
|
|
||||||
hostapd_handle_dfs(hapd->iface);
|
|
||||||
#endif /* NEED_AP_MLME */
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case EVENT_INTERFACE_DISABLED:
|
case EVENT_INTERFACE_DISABLED:
|
||||||
hostapd_free_stas(hapd);
|
hostapd_iface_disable(hapd);
|
||||||
wpa_msg(hapd->msg_ctx, MSG_INFO, INTERFACE_DISABLED);
|
|
||||||
hapd->disabled = 1;
|
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_ACS
|
#ifdef CONFIG_ACS
|
||||||
case EVENT_ACS_CHANNEL_SELECTED:
|
case EVENT_ACS_CHANNEL_SELECTED:
|
||||||
|
|
Loading…
Reference in a new issue