]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Unauthorize pending P2P GO Neg peer on p2p_cancel
authorSudhakar Swaminathan <Sudhakar.Swaminathan@Atheros.com>
Fri, 17 Dec 2010 13:05:35 +0000 (15:05 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 17 Dec 2010 13:05:35 +0000 (15:05 +0200)
If there is a pending GO Negotiation when p2p_cancel is used,
unauthorize the peer to avoid immediate reconnection from being
accepted without a new p2p_connect command.

src/p2p/p2p.c
src/p2p/p2p.h
wpa_supplicant/p2p_supplicant.c

index a088826b6e45c85119803bc431c4fcc901a1c0c9..7e0ccf39e304cee2d8d8415ee5cbaa40c8cec794 100644 (file)
@@ -3211,3 +3211,11 @@ void p2p_set_best_channels(struct p2p_data *p2p, int freq_24, int freq_5,
        p2p->best_freq_5 = freq_5;
        p2p->best_freq_overall = freq_overall;
 }
+
+
+const u8 * p2p_get_go_neg_peer(struct p2p_data *p2p)
+{
+       if (p2p == NULL || p2p->go_neg_peer == NULL)
+               return NULL;
+       return p2p->go_neg_peer->p2p_device_addr;
+}
index bab4939a291ae40b34c96b0a4aa2acbf9cfad943..ba88f74f4b763e4117e731db91f4d7aed667f489 100644 (file)
@@ -1322,4 +1322,6 @@ void p2p_update_channel_list(struct p2p_data *p2p, struct p2p_channels *chan);
 void p2p_set_best_channels(struct p2p_data *p2p, int freq_24, int freq_5,
                           int freq_overall);
 
+const u8 * p2p_get_go_neg_peer(struct p2p_data *p2p);
+
 #endif /* P2P_H */
index 94f8cec1a402d70732bbdbdc0b38b439613183f6..42c2a397b9bd4faa7df7075c7a366212e5c84bfd 100644 (file)
@@ -3948,6 +3948,7 @@ int wpas_p2p_cancel(struct wpa_supplicant *wpa_s)
 {
        struct wpa_global *global = wpa_s->global;
        int found = 0;
+       const u8 *peer;
 
        wpa_printf(MSG_DEBUG, "P2P: Request to cancel group formation");
 
@@ -3955,6 +3956,13 @@ int wpas_p2p_cancel(struct wpa_supplicant *wpa_s)
            !is_zero_ether_addr(wpa_s->pending_interface_addr))
                found = 1;
 
+       peer = p2p_get_go_neg_peer(global->p2p);
+       if (peer) {
+               wpa_printf(MSG_DEBUG, "P2P: Unauthorize pending GO Neg peer "
+                          MACSTR, MAC2STR(peer));
+               p2p_unauthorize(global->p2p, peer);
+       }
+
        wpas_p2p_stop_find(wpa_s);
 
        for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {