]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Specify frequency when sending Probe Response frame
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Wed, 10 Jun 2015 08:43:35 +0000 (11:43 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 14 Jun 2015 20:16:55 +0000 (23:16 +0300)
If the RX frequency of the Probe Request frame is known, specify it when
sending the Probe Response frame. This is needed when the Probe Request
frame is received on another virtual interface, for example, when a GO
or P2PS client are discoverable on the group operating channel.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
src/p2p/p2p.c
src/p2p/p2p.h
wpa_supplicant/ap.c
wpa_supplicant/driver_i.h
wpa_supplicant/p2p_supplicant.c

index a450d92ea09f11342681bb14f40ee93d30c19208..a1ac80794c8a44d02a6a3c8e6685dbd1d9b8d255 100644 (file)
@@ -2440,7 +2440,7 @@ p2p_reply_probe(struct p2p_data *p2p, const u8 *addr, const u8 *dst,
        wpabuf_put_buf(buf, ies);
        wpabuf_free(ies);
 
-       p2p->cfg->send_probe_resp(p2p->cfg->cb_ctx, buf);
+       p2p->cfg->send_probe_resp(p2p->cfg->cb_ctx, buf, rx_freq);
 
        wpabuf_free(buf);
 
index b4407f0dbcfd6c6ee37c4872ef8aa69b52363d3c..67b8bdb6919c584ac81cdc53899f5a78d6acdcd5 100644 (file)
@@ -570,12 +570,14 @@ struct p2p_config {
         * send_probe_resp - Transmit a Probe Response frame
         * @ctx: Callback context from cb_ctx
         * @buf: Probe Response frame (including the header and body)
+        * @freq: Forced frequency (in MHz) to use or 0.
         * Returns: 0 on success, -1 on failure
         *
         * This function is used to reply to Probe Request frames that were
         * indicated with a call to p2p_probe_req_rx(). The response is to be
-        * sent on the same channel or to be dropped if the driver is not
-        * anymore listening to Probe Request frames.
+        * sent on the same channel, unless otherwise specified, or to be
+        * dropped if the driver is not listening to Probe Request frames
+        * anymore.
         *
         * Alternatively, the responsibility for building the Probe Response
         * frames in Listen state may be in another system component in which
@@ -586,7 +588,8 @@ struct p2p_config {
         * Request frames must be indicated by calling p2p_probe_req_rx() even
         * if this send_probe_resp() is not used.
         */
-       int (*send_probe_resp)(void *ctx, const struct wpabuf *buf);
+       int (*send_probe_resp)(void *ctx, const struct wpabuf *buf,
+                              unsigned int freq);
 
        /**
         * send_action - Transmit an Action frame
index 15192d1594a9d8e0a80d7522e71dba4224b9ff3f..f3960c5ebf313ec8ac89865c05482a0ca4057332 100644 (file)
@@ -485,8 +485,13 @@ static int ap_probe_req_rx(void *ctx, const u8 *sa, const u8 *da,
                           int ssi_signal)
 {
        struct wpa_supplicant *wpa_s = ctx;
+       unsigned int freq = 0;
+
+       if (wpa_s->ap_iface)
+               freq = wpa_s->ap_iface->freq;
+
        return wpas_p2p_probe_req_rx(wpa_s, sa, da, bssid, ie, ie_len,
-                                    0, ssi_signal);
+                                    freq, ssi_signal);
 }
 
 
index b5b34c2f7b9ce015d8b5e15b196b8f7b30ec1d20..1fcb18067edc7c35190977f526727253d62db5c1 100644 (file)
@@ -286,11 +286,13 @@ static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
 }
 
 static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
-                                   const u8 *data, size_t data_len, int noack)
+                                   const u8 *data, size_t data_len, int noack,
+                                   unsigned int freq)
 {
        if (wpa_s->driver->send_mlme)
                return wpa_s->driver->send_mlme(wpa_s->drv_priv,
-                                               data, data_len, noack, 0);
+                                               data, data_len, noack,
+                                               freq);
        return -1;
 }
 
index a12ffb9437d69de4ec606a9633fb45924e955b4a..df7565f1760fa87b3d9d7e6afc3cd6a6900a5de7 100644 (file)
@@ -2397,10 +2397,12 @@ static void wpas_stop_listen(void *ctx)
 }
 
 
-static int wpas_send_probe_resp(void *ctx, const struct wpabuf *buf)
+static int wpas_send_probe_resp(void *ctx, const struct wpabuf *buf,
+                               unsigned int freq)
 {
        struct wpa_supplicant *wpa_s = ctx;
-       return wpa_drv_send_mlme(wpa_s, wpabuf_head(buf), wpabuf_len(buf), 1);
+       return wpa_drv_send_mlme(wpa_s, wpabuf_head(buf), wpabuf_len(buf), 1,
+                                freq);
 }