+#ifdef CONFIG_IEEE80211R
+static void wpa_assoc_set_ft_params(struct wpa_supplicant *wpa_s,
+ const u8 *ftie, const u8 *mdie)
+{
+ const u8 *mobility_domain = NULL;
+ const u8 *r0kh_id = NULL;
+ size_t r0kh_id_len = 0;
+ const u8 *r1kh_id = NULL;
+ struct rsn_ftie *hdr;
+ const u8 *pos, *end;
+
+ if (mdie == NULL || ftie == NULL)
+ return;
+
+ if (mdie[1] >= MOBILITY_DOMAIN_ID_LEN) {
+ mobility_domain = mdie + 2;
+#ifdef CONFIG_SME
+ wpa_s->sme.ft_used = 1;
+ os_memcpy(wpa_s->sme.mobility_domain, mobility_domain, 2);
+#endif /* CONFIG_SME */
+ }
+ if (ftie[1] >= sizeof(struct rsn_ftie)) {
+ end = ftie + 2 + ftie[1];
+ hdr = (struct rsn_ftie *) (ftie + 2);
+ pos = (const u8 *) (hdr + 1);
+ while (pos + 1 < end) {
+ if (pos + 2 + pos[1] > end)
+ break;
+ if (pos[0] == FTIE_SUBELEM_R1KH_ID &&
+ pos[1] == FT_R1KH_ID_LEN)
+ r1kh_id = pos + 2;
+ else if (pos[0] == FTIE_SUBELEM_R0KH_ID &&
+ pos[1] >= 1 && pos[1] <= FT_R0KH_ID_MAX_LEN) {
+ r0kh_id = pos + 2;
+ r0kh_id_len = pos[1];
+ }
+ pos += 2 + pos[1];
+ }
+ }
+ wpa_sm_set_ft_params(wpa_s->wpa, mobility_domain, r0kh_id,
+ r0kh_id_len, r1kh_id);
+}
+#endif /* CONFIG_IEEE80211R */
+