Re-enable beaconing on interface disable+enable

This is a step towards enabling hostapd to restart AP mode functionality
if the interface is disabled and re-enabled, e.g., with ifconfig down
and up. This commit takes care of beaconining only which may be
sufficient for open mode connection, but not for WPA2 cases.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-02-10 18:13:04 +02:00 committed by Jouni Malinen
parent fc99fab7e5
commit f33c8606f4
5 changed files with 20 additions and 1 deletions

View file

@ -1055,6 +1055,8 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
params.beacon_ies = beacon;
params.proberesp_ies = proberesp;
params.assocresp_ies = assocresp;
params.reenable = hapd->reenable_beacon;
hapd->reenable_beacon = 0;
if (iface->current_mode &&
hostapd_set_freq_params(&freq, iconf->hw_mode, iface->freq,

View file

@ -1210,9 +1210,19 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
#endif /* NEED_AP_MLME */
case EVENT_INTERFACE_ENABLED:
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.
*/
hapd->reenable_beacon = 1;
ieee802_11_set_beacon(hapd);
}
break;
case EVENT_INTERFACE_DISABLED:
wpa_msg(hapd->msg_ctx, MSG_INFO, INTERFACE_DISABLED);
hapd->disabled = 1;
break;
#ifdef CONFIG_ACS
case EVENT_ACS_CHANNEL_SELECTED:

View file

@ -105,6 +105,8 @@ struct hostapd_data {
struct hostapd_bss_config *conf;
int interface_added; /* virtual interface added for this BSS */
unsigned int started:1;
unsigned int disabled:1;
unsigned int reenable_beacon:1;
u8 own_addr[ETH_ALEN];

View file

@ -1031,6 +1031,11 @@ struct wpa_driver_ap_params {
* freq - Channel parameters for dynamic bandwidth changes
*/
struct hostapd_freq_params *freq;
/**
* reenable - Whether this is to re-enable beaconing
*/
int reenable;
};
struct wpa_driver_mesh_bss_params {

View file

@ -3270,7 +3270,7 @@ static int wpa_driver_nl80211_set_ap(void *priv,
u32 suites[10], suite;
u32 ver;
beacon_set = bss->beacon_set;
beacon_set = params->reenable ? 0 : bss->beacon_set;
wpa_printf(MSG_DEBUG, "nl80211: Set beacon (beacon_set=%d)",
beacon_set);