diff options
| author | Dmitry Shmidt <dimitrysh@google.com> | 2014-09-03 14:58:37 -0700 |
|---|---|---|
| committer | Dmitry Shmidt <dimitrysh@google.com> | 2014-09-03 15:18:01 -0700 |
| commit | 0207e233ee2e741f7b2c124c1366e905ebb634c8 (patch) | |
| tree | c04915519563043cdf24dbab763f9d5ffb104d97 /src/common | |
| parent | 57cea1a480975338d84f7bbc229b4dc76e030600 (diff) | |
| download | android_external_wpa_supplicant_8-0207e233ee2e741f7b2c124c1366e905ebb634c8.tar.gz android_external_wpa_supplicant_8-0207e233ee2e741f7b2c124c1366e905ebb634c8.tar.bz2 android_external_wpa_supplicant_8-0207e233ee2e741f7b2c124c1366e905ebb634c8.zip | |
hostapd: Add wowlan_triggers config param
New kernels in wiphy_suspend() will call cfg80211_leave_all()
that will eventually end up in cfg80211_stop_ap() unless
wowlan_triggers were set.
Bug: 17269024
Change-Id: I14d2191eda090cd86cabe1e5f059975fdf2f69e8
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/wpa_common.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c index 7aeb706c..998a51a8 100644 --- a/src/common/wpa_common.c +++ b/src/common/wpa_common.c @@ -14,6 +14,7 @@ #include "crypto/sha256.h" #include "crypto/aes_wrap.h" #include "crypto/crypto.h" +#include "drivers/driver.h" #include "ieee802_11_defs.h" #include "defs.h" #include "wpa_common.h" @@ -1496,3 +1497,78 @@ int wpa_select_ap_group_cipher(int wpa, int wpa_pairwise, int rsn_pairwise) return WPA_CIPHER_CCMP_256; return WPA_CIPHER_CCMP; } + + +static int wpa_check_wowlan_trigger(const char *start, const char *trigger, + int capa_trigger, u8 *param_trigger) +{ + if (os_strcmp(start, trigger) != 0) + return 0; + if (!capa_trigger) + return 0; + + *param_trigger = 1; + return 1; +} + + +struct wowlan_triggers *wpa_get_wowlan_triggers(const char *wowlan_triggers, + struct wpa_driver_capa *capa) +{ + struct wowlan_triggers *triggers; + char *start, *end, *buf; + int last; + + if (!wowlan_triggers) + return NULL; + + buf = os_strdup(wowlan_triggers); + if (buf == NULL) + return NULL; + + triggers = os_zalloc(sizeof(*triggers)); + if (triggers == NULL) + goto out; + +#define CHECK_TRIGGER(trigger) \ + wpa_check_wowlan_trigger(start, #trigger, \ + capa->wowlan_triggers.trigger, \ + &triggers->trigger) + + start = buf; + while (*start != '\0') { + while (isblank(*start)) + start++; + if (*start == '\0') + break; + end = start; + while (!isblank(*end) && *end != '\0') + end++; + last = *end == '\0'; + *end = '\0'; + + if (!CHECK_TRIGGER(any) && + !CHECK_TRIGGER(disconnect) && + !CHECK_TRIGGER(magic_pkt) && + !CHECK_TRIGGER(gtk_rekey_failure) && + !CHECK_TRIGGER(eap_identity_req) && + !CHECK_TRIGGER(four_way_handshake) && + !CHECK_TRIGGER(rfkill_release)) { + wpa_printf(MSG_DEBUG, + "Unknown/unsupported wowlan trigger '%s'", + start); + os_free(triggers); + triggers = NULL; + goto out; + } + + if (last) + break; + start = end + 1; + } +#undef CHECK_TRIGGER + +out: + os_free(buf); + return triggers; +} |
