diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 0aa92a28c..4c1e42260 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -5148,6 +5148,7 @@ static const struct global_parse_data global_fields[] = { { INT_RANGE(disable_btm, 0, 1), CFG_CHANGED_DISABLE_BTM }, { INT_RANGE(extended_key_id, 0, 1), 0 }, #endif /* CONFIG_WNM */ + { INT_RANGE(wowlan_disconnect_on_deinit, 0, 1), 0}, }; #undef FUNC diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index d128cd9bf..611b99318 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -1599,6 +1599,15 @@ struct wpa_config { * 1 = use Extended Key ID when possible */ int extended_key_id; + + /** + * wowlan_disconnect_on_deinit - Trigger disconnect on wpa_supplicant + * interface deinit even if the driver has enabled WoWLAN. + * + * 0 = Do not disconnect + * 1 = Trigger disconnection + */ + int wowlan_disconnect_on_deinit; }; diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index cb04a78a2..9ddd9ecfd 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -1620,6 +1620,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) if (config->extended_key_id != DEFAULT_EXTENDED_KEY_ID) fprintf(f, "extended_key_id=%d\n", config->extended_key_id); + if (config->wowlan_disconnect_on_deinit) + fprintf(f, "wowlan_disconnect_on_deinit=%d\n", + config->wowlan_disconnect_on_deinit); } #endif /* CONFIG_NO_CONFIG_WRITE */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index c3e747260..9f474fd0d 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -6669,8 +6669,12 @@ static void wpa_supplicant_deinit_iface(struct wpa_supplicant *wpa_s, wpa_s->disconnected = 1; if (wpa_s->drv_priv) { - /* Don't deauthenticate if WoWLAN is enabled */ - if (!wpa_drv_get_wowlan(wpa_s)) { + /* + * Don't deauthenticate if WoWLAN is enable and not explicitly + * been configured to disconnect. + */ + if (!wpa_drv_get_wowlan(wpa_s) || + wpa_s->conf->wowlan_disconnect_on_deinit) { wpa_supplicant_deauthenticate( wpa_s, WLAN_REASON_DEAUTH_LEAVING);