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];