7712ce51985fbd1bae9605ee0adce561fc45c63d
[openwrt/staging/blogic.git] /
1 From: Jouni Malinen <j@w1.fi>
2 Date: Fri, 22 Sep 2017 12:06:37 +0300
3 Subject: [PATCH] FT: Do not allow multiple Reassociation Response frames
4
5 The driver is expected to not report a second association event without
6 the station having explicitly request a new association. As such, this
7 case should not be reachable. However, since reconfiguring the same
8 pairwise or group keys to the driver could result in nonce reuse issues,
9 be extra careful here and do an additional state check to avoid this
10 even if the local driver ends up somehow accepting an unexpected
11 Reassociation Response frame.
12
13 Signed-off-by: Jouni Malinen <j@w1.fi>
14 ---
15
16 --- a/src/rsn_supp/wpa.c
17 +++ b/src/rsn_supp/wpa.c
18 @@ -2637,6 +2637,9 @@ void wpa_sm_notify_disassoc(struct wpa_s
19 #ifdef CONFIG_FILS
20 sm->fils_completed = 0;
21 #endif /* CONFIG_FILS */
22 +#ifdef CONFIG_IEEE80211R
23 + sm->ft_reassoc_completed = 0;
24 +#endif /* CONFIG_IEEE80211R */
25
26 /* Keys are not needed in the WPA state machine anymore */
27 wpa_sm_drop_sa(sm);
28 --- a/src/rsn_supp/wpa_ft.c
29 +++ b/src/rsn_supp/wpa_ft.c
30 @@ -153,6 +153,7 @@ static u8 * wpa_ft_gen_req_ies(struct wp
31 u16 capab;
32
33 sm->ft_completed = 0;
34 + sm->ft_reassoc_completed = 0;
35
36 buf_len = 2 + sizeof(struct rsn_mdie) + 2 + sizeof(struct rsn_ftie) +
37 2 + sm->r0kh_id_len + ric_ies_len + 100;
38 @@ -687,6 +688,11 @@ int wpa_ft_validate_reassoc_resp(struct
39 return -1;
40 }
41
42 + if (sm->ft_reassoc_completed) {
43 + wpa_printf(MSG_DEBUG, "FT: Reassociation has already been completed for this FT protocol instance - ignore unexpected retransmission");
44 + return 0;
45 + }
46 +
47 if (wpa_ft_parse_ies(ies, ies_len, &parse) < 0) {
48 wpa_printf(MSG_DEBUG, "FT: Failed to parse IEs");
49 return -1;
50 @@ -787,6 +793,8 @@ int wpa_ft_validate_reassoc_resp(struct
51 return -1;
52 }
53
54 + sm->ft_reassoc_completed = 1;
55 +
56 if (wpa_ft_process_gtk_subelem(sm, parse.gtk, parse.gtk_len) < 0)
57 return -1;
58
59 --- a/src/rsn_supp/wpa_i.h
60 +++ b/src/rsn_supp/wpa_i.h
61 @@ -128,6 +128,7 @@ struct wpa_sm {
62 size_t r0kh_id_len;
63 u8 r1kh_id[FT_R1KH_ID_LEN];
64 int ft_completed;
65 + int ft_reassoc_completed;
66 int over_the_ds_in_progress;
67 u8 target_ap[ETH_ALEN]; /* over-the-DS target AP */
68 int set_ptk_after_assoc;