|
@@ -3301,75 +3301,20 @@ int wpas_init_ext_pw(struct wpa_supplicant *wpa_s)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-static int wpas_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;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
static int wpas_set_wowlan_triggers(struct wpa_supplicant *wpa_s,
|
|
static int wpas_set_wowlan_triggers(struct wpa_supplicant *wpa_s,
|
|
const struct wpa_driver_capa *capa)
|
|
const struct wpa_driver_capa *capa)
|
|
{
|
|
{
|
|
- struct wowlan_triggers triggers;
|
|
|
|
- char *start, *end, *buf;
|
|
|
|
- int last, ret;
|
|
|
|
|
|
+ struct wowlan_triggers *triggers;
|
|
|
|
+ int ret = 0;
|
|
|
|
|
|
if (!wpa_s->conf->wowlan_triggers)
|
|
if (!wpa_s->conf->wowlan_triggers)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- buf = os_strdup(wpa_s->conf->wowlan_triggers);
|
|
|
|
- if (buf == NULL)
|
|
|
|
- return -1;
|
|
|
|
-
|
|
|
|
- os_memset(&triggers, 0, sizeof(triggers));
|
|
|
|
-
|
|
|
|
-#define CHECK_TRIGGER(trigger) \
|
|
|
|
- wpas_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);
|
|
|
|
- ret = -1;
|
|
|
|
- goto out;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (last)
|
|
|
|
- break;
|
|
|
|
- start = end + 1;
|
|
|
|
|
|
+ triggers = wpa_get_wowlan_triggers(wpa_s->conf->wowlan_triggers, capa);
|
|
|
|
+ if (triggers) {
|
|
|
|
+ ret = wpa_drv_wowlan(wpa_s, triggers);
|
|
|
|
+ os_free(triggers);
|
|
}
|
|
}
|
|
-#undef CHECK_TRIGGER
|
|
|
|
-
|
|
|
|
- ret = wpa_drv_wowlan(wpa_s, &triggers);
|
|
|
|
-out:
|
|
|
|
- os_free(buf);
|
|
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|