From 05e3dd4de12248a8f859e9202d6aa5c7e640bf28 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 4 Oct 2013 13:08:38 +0530 Subject: P2P: Cancel group formation timeout on client connection It was possiblle for the group formation timeout to be left running even after the P2P Client connected to the group if the WPS provisioning step was not completed cleanly (e.g., due to WSC_Done not getting received from the client). There is no need to remove the group in such case due to the initial group formation timeout, so work around this by removing that timeout on data connection. CRs-Fixed: 538026 Git-commit: eab2b50dc83e1d14dcb573dfc9b10fc6a9cb1cdd Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen Change-Id: I15e65a8e2436db5c408d5960bff6ba7af16f62c1 --- wpa_supplicant/p2p_supplicant.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 7216c3aa..ab164f64 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -5832,6 +5832,16 @@ struct wpa_ssid * wpas_p2p_get_persistent(struct wpa_supplicant *wpa_s, void wpas_p2p_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s, const u8 *addr) { + if (eloop_cancel_timeout(wpas_p2p_group_formation_timeout, + wpa_s->parent, NULL) > 0) { + /* + * This can happen if WPS provisioning step is not terminated + * cleanly (e.g., P2P Client does not send WSC_Done). Since the + * peer was able to connect, there is no need to time out group + * formation after this, though. + */ + wpa_printf(MSG_DEBUG, "P2P: Workaround - cancelled P2P group formation timeout on data connection"); + } wpa_s->global->p2p_go_wait_client.sec = 0; if (addr == NULL) return; -- cgit v1.2.3 From 67cceb9a375efc9067d3561501490bb0b50b9a15 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 7 Oct 2013 13:31:04 +0530 Subject: P2P: Extend group formation timeout on GO to first data connection Previously, GO considered the group to be fully formed at the completed of WPS provisioning step. This would leave the group running until idle timeout (which may not be enabled) or explicit removal if the client fails to connect for any reason. Since the client is expected to connect immediately after the WPS provisioning step, extend group formation timeout to cover that period until the first successfully completed data connection. This allows the GO to remove the group automatically if the client devices does not connect within P2P_MAX_INITIAL_CONN_WAIT_GO (10) seconds. Change-Id: Ia33cbf738490d89263c80a39d9044500a847b470 CRs-Fixed: 538026 Git-commit: 41f853235fe1d1fad1acecc0ee5dfe81c872c6b2 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 39 +++++++++++++++++++++++++++++++++++---- wpa_supplicant/wpa_supplicant_i.h | 1 + 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index ab164f64..f6edc54a 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -663,8 +663,10 @@ static void wpas_group_formation_completed(struct wpa_supplicant *wpa_s, */ if (wpa_s->global->p2p_group_formation) wpa_s = wpa_s->global->p2p_group_formation; - wpa_s->global->p2p_group_formation = NULL; - wpa_s->p2p_in_provisioning = 0; + if (wpa_s->p2p_go_group_formation_completed) { + wpa_s->global->p2p_group_formation = NULL; + wpa_s->p2p_in_provisioning = 0; + } if (!success) { wpa_msg(wpa_s->parent, MSG_INFO, @@ -4601,6 +4603,7 @@ void wpas_p2p_wps_success(struct wpa_supplicant *wpa_s, const u8 *peer_addr, eloop_cancel_timeout(wpas_p2p_group_formation_timeout, wpa_s->parent, NULL); + wpa_s->p2p_go_group_formation_completed = 1; if (ssid && ssid->mode == WPAS_MODE_INFRA) { /* * Use a separate timeout for initial data connection to @@ -4608,9 +4611,28 @@ void wpas_p2p_wps_success(struct wpa_supplicant *wpa_s, const u8 *peer_addr, * something goes wrong in this step before the P2P group idle * timeout mechanism is taken into use. */ + wpa_dbg(wpa_s, MSG_DEBUG, + "P2P: Re-start group formation timeout (%d seconds) as client for initial connection", + P2P_MAX_INITIAL_CONN_WAIT); eloop_register_timeout(P2P_MAX_INITIAL_CONN_WAIT, 0, wpas_p2p_group_formation_timeout, wpa_s->parent, NULL); + } else if (ssid) { + /* + * Use a separate timeout for initial data connection to + * complete to allow the group to be removed automatically if + * the client does not complete data connection successfully. + */ + wpa_dbg(wpa_s, MSG_DEBUG, + "P2P: Re-start group formation timeout (%d seconds) as GO for initial connection", + P2P_MAX_INITIAL_CONN_WAIT_GO); + eloop_register_timeout(P2P_MAX_INITIAL_CONN_WAIT_GO, 0, + wpas_p2p_group_formation_timeout, + wpa_s->parent, NULL); + /* + * Complete group formation on first successful data connection + */ + wpa_s->p2p_go_group_formation_completed = 0; } if (wpa_s->global->p2p) p2p_wps_success_cb(wpa_s->global->p2p, peer_addr); @@ -5838,9 +5860,18 @@ void wpas_p2p_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s, * This can happen if WPS provisioning step is not terminated * cleanly (e.g., P2P Client does not send WSC_Done). Since the * peer was able to connect, there is no need to time out group - * formation after this, though. + * formation after this, though. In addition, this is used with + * the initial connection wait on the GO as a separate formation + * timeout and as such, expected to be hit after the initial WPS + * provisioning step. */ - wpa_printf(MSG_DEBUG, "P2P: Workaround - cancelled P2P group formation timeout on data connection"); + wpa_printf(MSG_DEBUG, "P2P: Canceled P2P group formation timeout on data connection"); + } + if (!wpa_s->p2p_go_group_formation_completed) { + wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Marking group formation completed on GO on first data connection"); + wpa_s->p2p_go_group_formation_completed = 1; + wpa_s->global->p2p_group_formation = NULL; + wpa_s->p2p_in_provisioning = 0; } wpa_s->global->p2p_go_wait_client.sec = 0; if (addr == NULL) diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index f583626d..f0e1ebe5 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -630,6 +630,7 @@ struct wpa_supplicant { unsigned int p2p_pd_before_go_neg:1; unsigned int p2p_go_ht40:1; unsigned int user_initiated_pd:1; + unsigned int p2p_go_group_formation_completed:1; int p2p_persistent_go_freq; int p2p_persistent_id; int p2p_go_intent; -- cgit v1.2.3 From 4e5f9bfae35af09e1298e6595c127bea10726d1f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 27 Sep 2013 20:04:53 +0530 Subject: P2P: Use group formation timeout on persistent group GO Previously, GO considered the group to be fully re-invoked after starting beaconing on successful invitation exchange. This would leave the group running until idle timeout (which may not be enabled) or explicit removal if the client fails to connect for any reason. Since the client is expected to connect immediately after the invitation exchange that ends with status=0 (i.e., either client initiated the exchange or it responded with success), extend group formation timeout to cover that period until the first successfully completed data connection. This allows the GO to remove the group automatically if the client devices does not connect within P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE (15) seconds. Change-Id: I5a9622e46ff032a8297a55ba6e6d724a42834762 CRs-Fixed: 538026 Git-commit: bbc6c729a58897e9265d53d53677b3ddeda4ff94 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- wpa_supplicant/ctrl_iface.c | 3 ++- wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 2 +- wpa_supplicant/p2p_supplicant.c | 38 ++++++++++++++++++++++++++--- wpa_supplicant/p2p_supplicant.h | 3 ++- wpa_supplicant/wpa_supplicant_i.h | 1 + 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 5e5391f2..4089fb94 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -4150,7 +4150,8 @@ static int p2p_ctrl_group_add_persistent(struct wpa_supplicant *wpa_s, return -1; } - return wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, ht40, NULL); + return wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, ht40, NULL, + 0); } diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c index 6ec96dfe..52b36b4a 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c @@ -347,7 +347,7 @@ DBusMessage * wpas_dbus_handler_p2p_group_add(DBusMessage *message, goto inv_args; if (wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, 0, - NULL)) { + NULL, 0)) { reply = wpas_dbus_error_unknown_error( message, "Failed to reinvoke a persistent group"); diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index f6edc54a..ca813f12 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -71,6 +71,15 @@ #define P2P_MAX_INITIAL_CONN_WAIT_GO 10 #endif /* P2P_MAX_INITIAL_CONN_WAIT_GO */ +#ifndef P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE +/* + * How many seconds to wait for initial 4-way handshake to get completed after + * re-invocation of a persistent group on the GO when the client is expected + * to connect automatically (no user interaction). + */ +#define P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE 15 +#endif /* P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE */ + #ifndef P2P_CONCURRENT_SEARCH_DELAY #define P2P_CONCURRENT_SEARCH_DELAY 500 #endif /* P2P_CONCURRENT_SEARCH_DELAY */ @@ -894,6 +903,21 @@ static void p2p_go_configured(void *ctx, void *data) wpas_notify_p2p_group_started(wpa_s, ssid, network_id, 0); wpas_p2p_cross_connect_setup(wpa_s); wpas_p2p_set_group_idle_timeout(wpa_s); + + if (wpa_s->p2p_first_connection_timeout) { + wpa_dbg(wpa_s, MSG_DEBUG, + "P2P: Start group formation timeout of %d seconds until first data connection on GO", + wpa_s->p2p_first_connection_timeout); + wpa_s->p2p_go_group_formation_completed = 0; + wpa_s->global->p2p_group_formation = wpa_s; + eloop_cancel_timeout(wpas_p2p_group_formation_timeout, + wpa_s->parent, NULL); + eloop_register_timeout( + wpa_s->p2p_first_connection_timeout, 0, + wpas_p2p_group_formation_timeout, + wpa_s->parent, NULL); + } + return; } @@ -2576,7 +2600,8 @@ static void wpas_invitation_received(void *ctx, const u8 *sa, const u8 *bssid, if (s) { int go = s->mode == WPAS_MODE_P2P_GO; wpas_p2p_group_add_persistent( - wpa_s, s, go, go ? op_freq : 0, 0, NULL); + wpa_s, s, go, go ? op_freq : 0, 0, NULL, + go ? P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE : 0); } else if (bssid) { wpa_s->user_initiated_pd = 0; wpas_p2p_join(wpa_s, bssid, go_dev_addr, @@ -2747,7 +2772,10 @@ static void wpas_invitation_result(void *ctx, int status, const u8 *bssid, wpas_p2p_group_add_persistent(wpa_s, ssid, ssid->mode == WPAS_MODE_P2P_GO, wpa_s->p2p_persistent_go_freq, - wpa_s->p2p_go_ht40, channels); + wpa_s->p2p_go_ht40, channels, + ssid->mode == WPAS_MODE_P2P_GO ? + P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE : + 0); } @@ -4326,6 +4354,7 @@ wpas_p2p_get_group_iface(struct wpa_supplicant *wpa_s, int addr_allocated, if (!wpas_p2p_create_iface(wpa_s)) { wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use same interface for group " "operations"); + wpa_s->p2p_first_connection_timeout = 0; return wpa_s; } @@ -4344,6 +4373,7 @@ wpas_p2p_get_group_iface(struct wpa_supplicant *wpa_s, int addr_allocated, wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use separate group interface %s", group_wpa_s->ifname); + group_wpa_s->p2p_first_connection_timeout = 0; return group_wpa_s; } @@ -4442,7 +4472,8 @@ static int wpas_start_p2p_client(struct wpa_supplicant *wpa_s, int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, int addr_allocated, int freq, int ht40, - const struct p2p_channels *channels) + const struct p2p_channels *channels, + int connection_timeout) { struct p2p_go_neg_results params; int go = 0; @@ -4496,6 +4527,7 @@ int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s, if (wpa_s == NULL) return -1; + wpa_s->p2p_first_connection_timeout = connection_timeout; wpas_start_wps_go(wpa_s, ¶ms, 0); return 0; diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h index 04ba9b20..db4cadb6 100644 --- a/wpa_supplicant/p2p_supplicant.h +++ b/wpa_supplicant/p2p_supplicant.h @@ -37,7 +37,8 @@ int wpas_p2p_group_add(struct wpa_supplicant *wpa_s, int persistent_group, int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, int addr_allocated, int freq, int ht40, - const struct p2p_channels *channels); + const struct p2p_channels *channels, + int connection_timeout); struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); void wpas_p2p_wps_success(struct wpa_supplicant *wpa_s, const u8 *peer_addr, diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index f0e1ebe5..d32d4746 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -631,6 +631,7 @@ struct wpa_supplicant { unsigned int p2p_go_ht40:1; unsigned int user_initiated_pd:1; unsigned int p2p_go_group_formation_completed:1; + int p2p_first_connection_timeout; int p2p_persistent_go_freq; int p2p_persistent_id; int p2p_go_intent; -- cgit v1.2.3 From be7086c41a38c3728724f52a3b2dc96505f5b4a2 Mon Sep 17 00:00:00 2001 From: Arend van Spriel Date: Tue, 8 Oct 2013 11:07:25 +0530 Subject: TDLS: Tear down TDLS using wpas_drv_tlds_oper() if not external When the device indicates to take care of TDLS operations the TDLS setup is done calling wpas_drv_tdls_oper(). This patch does a similar thing for the teardown. This fixes failure of teardown: "TDLS: Could not find peer for link Teardown" Signed-hostap: Arend van Spriel Git-commit: 4ed8d954dd4f714ac648b25fc3ec260592fda41b Git-repo : git://w1.fi/srv/git/hostap.git CRs-fixed: 555255 Change-Id: I9134b3edece3c6e9d7fb5328910d4c9c41df4fb7 --- wpa_supplicant/ctrl_iface.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 5e5391f2..6509ab13 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -572,6 +572,7 @@ static int wpa_supplicant_ctrl_iface_tdls_teardown( struct wpa_supplicant *wpa_s, char *addr) { u8 peer[ETH_ALEN]; + int ret; if (hwaddr_aton(addr, peer)) { wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_TEARDOWN: invalid " @@ -582,8 +583,14 @@ static int wpa_supplicant_ctrl_iface_tdls_teardown( wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_TEARDOWN " MACSTR, MAC2STR(peer)); - return wpa_tdls_teardown_link(wpa_s->wpa, peer, - WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED); + if (wpa_tdls_is_external_setup(wpa_s->wpa)) + ret = wpa_tdls_teardown_link( + wpa_s->wpa, peer, + WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED); + else + ret = wpa_drv_tdls_oper(wpa_s, TDLS_TEARDOWN, peer); + + return ret; } #endif /* CONFIG_TDLS */ -- cgit v1.2.3 From e415a15c75e59bb12c1d6f424ffa2f155ebdcd3a Mon Sep 17 00:00:00 2001 From: Swaroop Golti Date: Thu, 10 Oct 2013 13:16:59 +0530 Subject: P2P: Increase Invitation Request timeouts In noisy environment peer may take more time to send Invitation Response so increase Invitation Response timeout to 500 ms in success case and also increase Invitation Request action wait time to 500 ms. This makes the Invitation Request case use the same timeout with GO Negotiation. CRs-Fixed: 538699 Git-commit: 63ce59dea8c6b458d9a0c24e91f971f461f17b79 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen Change-Id: Idd3dea0e7ed16cd7564b34dfe279a49f16f021d4 --- src/p2p/p2p_invitation.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p2p/p2p_invitation.c b/src/p2p/p2p_invitation.c index 11a7727c..858898cf 100644 --- a/src/p2p/p2p_invitation.c +++ b/src/p2p/p2p_invitation.c @@ -507,7 +507,7 @@ int p2p_invite_send(struct p2p_data *p2p, struct p2p_device *dev, dev->invitation_reqs++; if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr, p2p->cfg->dev_addr, dev->info.p2p_device_addr, - wpabuf_head(req), wpabuf_len(req), 200) < 0) { + wpabuf_head(req), wpabuf_len(req), 500) < 0) { wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Failed to send Action frame"); /* Use P2P find to recover and retry */ @@ -537,7 +537,7 @@ void p2p_invitation_req_cb(struct p2p_data *p2p, int success) */ p2p_set_state(p2p, P2P_INVITE); - p2p_set_timeout(p2p, 0, success ? 350000 : 100000); + p2p_set_timeout(p2p, 0, success ? 500000 : 100000); } -- cgit v1.2.3 From 280a501f0925c6d72a969acd0f80966b66d5edb6 Mon Sep 17 00:00:00 2001 From: Prashanth Bhatta Date: Fri, 6 Sep 2013 10:05:40 -0700 Subject: hostapd: Make install path configurable Makefile always installs to /usr/local/sbin and on some platforms, /usr/local/sbin is not in default search path. Modified the makefile such that bin path can be configurable so that build system can pass appropriate path for installation. If bin path is not specified then by default binaries are installed in /usr/local/sbin. Change-Id: I9b5c460e62778159491209edc357f8f9888fd653 --- hostapd/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hostapd/Makefile b/hostapd/Makefile index 8404e0cb..6e422a9e 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile @@ -6,6 +6,8 @@ ifndef CFLAGS CFLAGS = -MMD -O2 -Wall -g endif +export BINDIR ?= /usr/local/sbin/ + CFLAGS += -I../src CFLAGS += -I../src/utils @@ -848,9 +850,10 @@ verify_config: exit 1; \ fi -install: all - mkdir -p $(DESTDIR)/usr/local/bin - for i in $(ALL); do cp -f $$i $(DESTDIR)/usr/local/bin/$$i; done +$(DESTDIR)$(BINDIR)/%: % + install -D $(<) $(@) + +install: $(addprefix $(DESTDIR)$(BINDIR)/,$(ALL)) ../src/drivers/build.hostapd: @if [ -f ../src/drivers/build.wpa_supplicant ]; then \ -- cgit v1.2.3 From 8f951b8685ed7c7611c3af48506b464e81818f9e Mon Sep 17 00:00:00 2001 From: Hardik Kantilal Patel Date: Tue, 15 Oct 2013 15:30:23 +0530 Subject: Add disable_scan_offload parameter to wpa_supplicant.conf By default, wpa_supplicant tries to offload scanning if the driver indicates support for this (sched_scan). This configuration parameter can be used to disable this automatic offloading mechanism. Change-Id: I0dff8d8acbfb04f7b47e342b37c93d381eefb7cc CRs-fixed: 545719 --- wpa_supplicant/wpa_supplicant_template.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/wpa_supplicant/wpa_supplicant_template.conf b/wpa_supplicant/wpa_supplicant_template.conf index eee48a77..9828679f 100644 --- a/wpa_supplicant/wpa_supplicant_template.conf +++ b/wpa_supplicant/wpa_supplicant_template.conf @@ -6,3 +6,4 @@ ap_scan=1 fast_reauth=1 ### flag to avoid creating new interface for p2p p2p_no_group_iface=1 +disable_scan_offload=1 -- cgit v1.2.3 From 88e26447fd5feaf74e76644e60bcecb44324d457 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 18 Oct 2013 09:55:14 +0530 Subject: P2P: Show P2P flag in BSS entries also based on Beacon frames It is possible that a P2P GO has been discovered through a non-P2P scan that did not return P2P IE in Probe Response frames. To cover those cases, check also Beacon frame (if received) for P2P IE. Change-Id: If1d855022785f5d801e2d91c1d2fcac35760f717 CRs-Fixed: 535523 Git-commit: bb50ae439686fb69f52288a618e6d176462ab726 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- wpa_supplicant/bss.c | 37 +++++++++++++++++++++++++++++++++++++ wpa_supplicant/bss.h | 2 ++ wpa_supplicant/ctrl_iface.c | 5 ++++- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index 0e1576b0..ec640b5f 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -1000,6 +1000,43 @@ const u8 * wpa_bss_get_vendor_ie(const struct wpa_bss *bss, u32 vendor_type) } +/** + * wpa_bss_get_vendor_ie_beacon - Fetch a vendor information from a BSS entry + * @bss: BSS table entry + * @vendor_type: Vendor type (four octets starting the IE payload) + * Returns: Pointer to the information element (id field) or %NULL if not found + * + * This function returns the first matching information element in the BSS + * entry. + * + * This function is like wpa_bss_get_vendor_ie(), but uses IE buffer only + * from Beacon frames instead of either Beacon or Probe Response frames. + */ +const u8 * wpa_bss_get_vendor_ie_beacon(const struct wpa_bss *bss, + u32 vendor_type) +{ + const u8 *end, *pos; + + if (bss->beacon_ie_len == 0) + return NULL; + + pos = (const u8 *) (bss + 1); + pos += bss->ie_len; + end = pos + bss->beacon_ie_len; + + while (pos + 1 < end) { + if (pos + 2 + pos[1] > end) + break; + if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 && + vendor_type == WPA_GET_BE32(&pos[2])) + return pos; + pos += 2 + pos[1]; + } + + return NULL; +} + + /** * wpa_bss_get_vendor_ie_multi - Fetch vendor IE data from a BSS entry * @bss: BSS table entry diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h index 2b419488..0d2693fd 100644 --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h @@ -118,6 +118,8 @@ struct wpa_bss * wpa_bss_get_id_range(struct wpa_supplicant *wpa_s, unsigned int idf, unsigned int idl); const u8 * wpa_bss_get_ie(const struct wpa_bss *bss, u8 ie); const u8 * wpa_bss_get_vendor_ie(const struct wpa_bss *bss, u32 vendor_type); +const u8 * wpa_bss_get_vendor_ie_beacon(const struct wpa_bss *bss, + u32 vendor_type); struct wpabuf * wpa_bss_get_vendor_ie_multi(const struct wpa_bss *bss, u32 vendor_type); struct wpabuf * wpa_bss_get_vendor_ie_multi_beacon(const struct wpa_bss *bss, diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 369a39ed..449ad74a 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -2022,6 +2022,8 @@ static int wpa_supplicant_ctrl_iface_scan_result( const u8 *ie, *ie2, *p2p; p2p = wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE); + if (!p2p) + p2p = wpa_bss_get_vendor_ie_beacon(bss, P2P_IE_VENDOR_TYPE); if (p2p && bss->ssid_len == P2P_WILDCARD_SSID_LEN && os_memcmp(bss->ssid, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN) == 0) @@ -3214,7 +3216,8 @@ static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, return 0; pos += ret; } - if (wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE)) { + if (wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE) || + wpa_bss_get_vendor_ie_beacon(bss, P2P_IE_VENDOR_TYPE)) { ret = os_snprintf(pos, end - pos, "[P2P]"); if (ret < 0 || ret >= end - pos) return 0; -- cgit v1.2.3 From a42f46ba337bdfcbc7455375fb468d115a625d7c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 18 Oct 2013 10:02:25 +0530 Subject: P2P: Show p2p flag in debug info for scan results This makes it easier to confirm that P2P capabilities for a GO has been discovered properly. Change-Id: If214f9c8ea492fb2f13a0dbb98fd964f7d118531 CRs-Fixed: 535523 Git-commit: b16696ff72969329c9e4507f9bbcaf5882b492f7 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- wpa_supplicant/events.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 184b14ef..cd2bd1f5 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -688,10 +688,13 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s, rsn_ie_len = ie ? ie[1] : 0; wpa_dbg(wpa_s, MSG_DEBUG, "%d: " MACSTR " ssid='%s' " - "wpa_ie_len=%u rsn_ie_len=%u caps=0x%x level=%d%s", + "wpa_ie_len=%u rsn_ie_len=%u caps=0x%x level=%d%s%s", i, MAC2STR(bss->bssid), wpa_ssid_txt(bss->ssid, bss->ssid_len), wpa_ie_len, rsn_ie_len, bss->caps, bss->level, - wpa_bss_get_vendor_ie(bss, WPS_IE_VENDOR_TYPE) ? " wps" : ""); + wpa_bss_get_vendor_ie(bss, WPS_IE_VENDOR_TYPE) ? " wps" : "", + (wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE) || + wpa_bss_get_vendor_ie_beacon(bss, P2P_IE_VENDOR_TYPE)) ? + " p2p" : ""); e = wpa_blacklist_get(wpa_s, bss->bssid); if (e) { -- cgit v1.2.3 From c7f6e283ecbed797898aabf00263fd667a568ad8 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 18 Oct 2013 10:44:54 +0530 Subject: P2P: Allow GO to be discovered based on Beacon frame This fixes some P2P-join-a-group cases where GO may have been discovered based on passive scan or non-P2P scan. P2P IEs may have been received from a Beacon frame in such a case and that information can be used to create a P2P peer entry, e.g., to allow provision discovery exchange to be completed. Change-Id: I8502c61fa0f149f7636708458f5e51ca627ac6b7 CRs-Fixed: 535523 Git-commit: aaeb9c98e6aad64bbf92c7cb6ef4531c039b8a1d Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 19 +++++++++++++++++-- wpa_supplicant/scan.c | 37 +++++++++++++++++++++++++++++++++++++ wpa_supplicant/scan.h | 2 ++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index ca813f12..a285ff98 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -146,13 +146,28 @@ static void wpas_p2p_scan_res_handler(struct wpa_supplicant *wpa_s, for (i = 0; i < scan_res->num; i++) { struct wpa_scan_res *bss = scan_res->res[i]; struct os_time time_tmp_age, entry_ts; + const u8 *ies; + size_t ies_len; + time_tmp_age.sec = bss->age / 1000; time_tmp_age.usec = (bss->age % 1000) * 1000; os_time_sub(&scan_res->fetch_time, &time_tmp_age, &entry_ts); + + ies = (const u8 *) (bss + 1); + ies_len = bss->ie_len; + if (bss->beacon_ie_len > 0 && + !wpa_scan_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE) && + wpa_scan_get_vendor_ie_beacon(bss, P2P_IE_VENDOR_TYPE)) { + wpa_printf(MSG_DEBUG, "P2P: Use P2P IE(s) from Beacon frame since no P2P IE(s) in Probe Response frames received for " + MACSTR, MAC2STR(bss->bssid)); + ies = ies + ies_len; + ies_len = bss->beacon_ie_len; + } + + if (p2p_scan_res_handler(wpa_s->global->p2p, bss->bssid, bss->freq, &entry_ts, bss->level, - (const u8 *) (bss + 1), - bss->ie_len) > 0) + ies, ies_len) > 0) break; } diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 07e3e06c..25717477 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -1344,6 +1344,43 @@ const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res, } +/** + * wpa_scan_get_vendor_ie_beacon - Fetch vendor information from a scan result + * @res: Scan result entry + * @vendor_type: Vendor type (four octets starting the IE payload) + * Returns: Pointer to the information element (id field) or %NULL if not found + * + * This function returns the first matching information element in the scan + * result. + * + * This function is like wpa_scan_get_vendor_ie(), but uses IE buffer only + * from Beacon frames instead of either Beacon or Probe Response frames. + */ +const u8 * wpa_scan_get_vendor_ie_beacon(const struct wpa_scan_res *res, + u32 vendor_type) +{ + const u8 *end, *pos; + + if (res->beacon_ie_len == 0) + return NULL; + + pos = (const u8 *) (res + 1); + pos += res->ie_len; + end = pos + res->beacon_ie_len; + + while (pos + 1 < end) { + if (pos + 2 + pos[1] > end) + break; + if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 && + vendor_type == WPA_GET_BE32(&pos[2])) + return pos; + pos += 2 + pos[1]; + } + + return NULL; +} + + /** * wpa_scan_get_vendor_ie_multi - Fetch vendor IE data from a scan result * @res: Scan result entry diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h index e892479f..6eeb19a9 100644 --- a/wpa_supplicant/scan.h +++ b/wpa_supplicant/scan.h @@ -28,6 +28,8 @@ int wpa_supplicant_update_scan_results(struct wpa_supplicant *wpa_s); const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie); const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res, u32 vendor_type); +const u8 * wpa_scan_get_vendor_ie_beacon(const struct wpa_scan_res *res, + u32 vendor_type); struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res, u32 vendor_type); int wpa_supplicant_filter_bssid_match(struct wpa_supplicant *wpa_s, -- cgit v1.2.3 From ec9327ed080998bd7e9910cbadcf4735d660b83c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 18 Oct 2013 16:24:52 +0530 Subject: P2P: Do not drop P2P IEs from BSS table on non-P2P scans This could happen when non-P2P station interface runs a scan without P2P IE in the Probe Request frame. P2P GO would reply to that with a Probe Response that does not include P2P IE. Do not update the IEs in this BSS entry to avoid such loss of information that may be needed for P2P operations to determine group information. Change-Id: I2af1f4487a358da57b885ff63e879aaea4fd2508 CRs-Fixed: 535523 Git-commit: ff57398fcab817374dac975aaab3eef5bf64f381 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- wpa_supplicant/bss.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index ec640b5f..caec1bae 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -501,6 +501,22 @@ wpa_bss_update(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, wpa_bss_copy_res(bss, res, fetch_time); /* Move the entry to the end of the list */ dl_list_del(&bss->list); +#ifdef CONFIG_P2P + if (wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE) && + !wpa_scan_get_vendor_ie(res, P2P_IE_VENDOR_TYPE)) { + /* + * This can happen when non-P2P station interface runs a scan + * without P2P IE in the Probe Request frame. P2P GO would reply + * to that with a Probe Response that does not include P2P IE. + * Do not update the IEs in this BSS entry to avoid such loss of + * information that may be needed for P2P operations to + * determine group information. + */ + wpa_dbg(wpa_s, MSG_DEBUG, "BSS: Do not update scan IEs for " + MACSTR " since that would remove P2P IE information", + MAC2STR(bss->bssid)); + } else +#endif /* CONFIG_P2P */ if (bss->ie_len + bss->beacon_ie_len >= res->ie_len + res->beacon_ie_len) { os_memcpy(bss + 1, res + 1, res->ie_len + res->beacon_ie_len); -- cgit v1.2.3 From aba939ae1a67a1b77382b0bda9405242a9594164 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 18 Oct 2013 11:12:31 +0530 Subject: P2P: Do not allow P2P client connection without P2P IE from GO P2P-GROUP-STARTED event depends on having enough information about the group available. To avoid incomplete information from being delivered to upper layers, do not accept scan results without P2P IE (e.g., from a non-P2P scan) for P2P client association process. This can be of use for some join-a-group cases where non-P2P scans have generated the BSS entry for the GO. Change-Id: I42bc5c5cc17d7786eaf4018c2774bb13bb6e4be2 CRs-Fixed: 535523 Git-commit: b72e14e599785e377881a2a8cd26b42f90bdc5f6 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- wpa_supplicant/events.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 184b14ef..d30912e3 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -829,6 +829,13 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s, } #ifdef CONFIG_P2P + if (ssid->p2p_group && + !wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE) && + !wpa_bss_get_vendor_ie_beacon(bss, P2P_IE_VENDOR_TYPE)) { + wpa_dbg(wpa_s, MSG_DEBUG, " skip - no P2P IE seen"); + continue; + } + /* * TODO: skip the AP if its P2P IE has Group Formation * bit set in the P2P Group Capability Bitmap and we -- cgit v1.2.3 From 479ec34dcdc7342e2629841e69ce8dc77714b8d6 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 18 Oct 2013 11:17:03 +0530 Subject: P2P: Allow persistent group determination based on Beacon frame P2P IE may be available from a Beacon frame from a GO even if we have not yet received a Probe Response frame with P2P IE from that GO. Since all the needed information for determining the GO's P2P Device Address and group capabilities are available, use that information instead of displaying incomplete group information. Change-Id: I4eb179351b1d104d2ca31023c3405aaa570d21fc CRs-Fixed: 535523 Git-commit: 5df7414b04fc0bfa0abea1a2662746d348104972 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index a285ff98..368707ac 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -482,6 +482,9 @@ static int wpas_p2p_persistent_group(struct wpa_supplicant *wpa_s, } p2p = wpa_bss_get_vendor_ie_multi(bss, P2P_IE_VENDOR_TYPE); + if (p2p == NULL) + p2p = wpa_bss_get_vendor_ie_multi_beacon(bss, + P2P_IE_VENDOR_TYPE); if (p2p == NULL) { wpa_printf(MSG_DEBUG, "P2P: Could not figure out whether " "group is persistent - BSS " MACSTR -- cgit v1.2.3 From c89185f386408ee2201fc4f4fc50e950f894d4c3 Mon Sep 17 00:00:00 2001 From: Deepthi Gowri Date: Mon, 7 Oct 2013 13:45:26 +0530 Subject: P2P Extend postponing of concurrent scans for persistent GO Update the p2p_go_wait_client timestamp in p2p_go_configured() to address the case where the group is set up without the provisioning step. Change-Id: Idff6b55f2d572fc27ee8abcf05778a7ed5451632 CRs-Fixed: 554201 Git-commit: 6903ee6f62e4585451c1e4f90db8ca8d7cc82070 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index ca813f12..f4d2e944 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -894,6 +894,7 @@ static void p2p_go_configured(void *ctx, void *data) ""); } + os_get_time(&wpa_s->global->p2p_go_wait_client); if (params->persistent_group) network_id = wpas_p2p_store_persistent_group( wpa_s->parent, ssid, -- cgit v1.2.3 From f1fe1967707a221876d7e49378ece97160e73b32 Mon Sep 17 00:00:00 2001 From: Deepthi Gowri Date: Mon, 7 Oct 2013 13:50:54 +0530 Subject: P2P: Clear p2p_group_formation and p2p_in_provisioning on group removal Commit 41f853235fe1d1fad1acecc0ee5dfe81c872c6b2 extends group formation timeout for the first data connection to complete and resets p2p_go_group_formation_completed flag due to which p2p_in_provisioning and p2p_group_formation flags are not cleared when wpas_group_formation_completed() is called. This can result in both station scan and p2p_find failures in the case where separate P2P group interface is not used and the client does not complete 4-way handshake. Fix this by clearing p2p_group_formation and p2p_in_provisioning when such a P2P group is deleted. Change-Id: Ia1842eca41e01d6ecc07d09f4a3d9deb413acbd5 CRs-Fixed: 554197 Git-commit: acdd0fc84f01d8b5e8aa39d6e4573cee0b5ac707 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index f4d2e944..84db2c9a 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -401,6 +401,11 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s, return 1; } + if (!wpa_s->p2p_go_group_formation_completed) { + wpa_s->global->p2p_group_formation = NULL; + wpa_s->p2p_in_provisioning = 0; + } + wpa_printf(MSG_DEBUG, "P2P: Remove temporary group network"); if (ssid && (ssid->p2p_group || ssid->mode == WPAS_MODE_P2P_GROUP_FORMATION || -- cgit v1.2.3 From d14765fb4313a79a45e15e72ee130a264d1b0f13 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 25 Oct 2013 16:07:30 +0530 Subject: Fix ENABLE_NETWORK not to reconnect in disconnected state DISCONNECT followed by ENABLE_NETWORK ended up starting a scan for a new connection due to wpa_supplicant_enable_one_network() setting wpa_s->reassociate = 1. This was done regardless of wpa_s->disconnected being 1 which should imply that wpa_supplicant should not try to connect before asked explicitly with REASSOCIATE or RECONNECT. Fix this by making ENABLE_NETWORK setting of reassociate = 1 and starting of scans for connection conditional on wpa_s->disconnected == 0. This will make ENABLE_NETWORK trigger a connection only if wpa_supplicant is already in a state where it would try to connect if there are any enabled networks. Change-Id: I3f15688d7016551219182e6f8e751941b6340aa6 CRs-Fixed: 564226 Git-commit:d2592497624d7dff53e71cc01fc2d5db1e59733e Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- wpa_supplicant/wpa_supplicant.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 80f2d67d..bab3ccd1 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1807,7 +1807,7 @@ static void wpa_supplicant_enable_one_network(struct wpa_supplicant *wpa_s, * Try to reassociate since there is no current configuration and a new * network was made available. */ - if (!wpa_s->current_ssid) + if (!wpa_s->current_ssid && !wpa_s->disconnected) wpa_s->reassociate = 1; } @@ -1828,7 +1828,7 @@ void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s, } else wpa_supplicant_enable_one_network(wpa_s, ssid); - if (wpa_s->reassociate) { + if (wpa_s->reassociate && !wpa_s->disconnected) { if (wpa_s->sched_scanning) { wpa_printf(MSG_DEBUG, "Stop ongoing sched_scan to add " "new network to scan filters"); -- cgit v1.2.3 From 2a8afe5604c0b9c3b5697a54866232849b990a54 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 28 May 2013 00:35:47 +0300 Subject: WPS: Allow Device Password Id changes between PIN methods Commit b4a17a6ea74b2ffba082e05c84730e979513042c added support for the WPS Registrar to change the Device Password based on WSC specification design. However, this added validation for Registrar behavior which resulted in preventing a common P2P use case from working. Relax the validation rules for builds with P2P enabled to allow the Enrollee (P2P client) accepting M1/M2 changes in Device Password Id between Default and Registrar-specified PIN. CRs-Fixed: 538654 Git-commit: 9b1693a162d0c31752098d54181d2ef7631c6135 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- src/wps/wps_enrollee.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/wps/wps_enrollee.c b/src/wps/wps_enrollee.c index 9a62fce8..ae17a278 100644 --- a/src/wps/wps_enrollee.c +++ b/src/wps/wps_enrollee.c @@ -852,6 +852,24 @@ static int wps_process_dev_pw_id(struct wps_data *wps, const u8 *dev_pw_id) return 0; } +#ifdef CONFIG_P2P + if ((id == DEV_PW_DEFAULT && + wps->dev_pw_id == DEV_PW_REGISTRAR_SPECIFIED) || + (id == DEV_PW_REGISTRAR_SPECIFIED && + wps->dev_pw_id == DEV_PW_DEFAULT)) { + /* + * Common P2P use cases indicate whether the PIN is from the + * client or GO using Device Password Id in M1/M2 in a way that + * does not look fully compliant with WSC specification. Anyway, + * this is deployed and needs to be allowed, so ignore changes + * between Registrar-Specified and Default PIN. + */ + wpa_printf(MSG_DEBUG, "WPS: Allow PIN Device Password ID " + "change"); + return 0; + } +#endif /* CONFIG_P2P */ + wpa_printf(MSG_DEBUG, "WPS: Registrar trying to change Device Password " "ID from %u to %u", wps->dev_pw_id, id); -- cgit v1.2.3 From 08fb0f7056914bd3e57c0bf6b59aa14064b54151 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 5 Oct 2013 22:15:28 -0700 Subject: P2P: Make sure wait for the first client gets stopped If a group was removed before the wait for the first client had timed out and the client had not yet connected, p2p_go_wait_client could have been left set and with that, scan operations could be unnecessarily delayed. This fixes some undesired delays from commit c1c0b35fea656345b672984910cc3b93938bc5e5. CRs-Fixed: 554201 Git-commit: adeb4f59a22e73f0f0560ba6340a39b2e1d089e8 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 84db2c9a..5e0a6696 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -381,6 +381,12 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s, wpa_s->p2p_in_provisioning = 0; } + /* + * Make sure wait for the first client does not remain active after the + * group has been removed. + */ + wpa_s->global->p2p_go_wait_client.sec = 0; + if (removal_reason != P2P_GROUP_REMOVAL_SILENT && ssid) wpas_notify_p2p_group_removed(wpa_s, ssid, gtype); -- cgit v1.2.3 From 335ab63b68125a8db4192414d3670d4500e9ce8b Mon Sep 17 00:00:00 2001 From: Vinay Krishna Eranna Date: Tue, 29 Oct 2013 23:03:23 +0200 Subject: Update regulatory change to all virtual interface for the phy wpas_p2p_setup_channels function uses the per interface information (wpa_s->hw.modes) for setting up the available channel list for P2P operation, but if a separate P2P interface is used (e.g., p2p0 on Android), the wpa_s instance for that interface may not get an updated channel list. This can result in some operations, like "P2P_SET disallow_freq", using old channel list information (e.g., world roaming information with passive-scan/no-ibss flags) which was initialized during the start-up. This could result in P2P functionality using conflicting or obsolete channel information. To resolve this issue, update channel list information on regulatory change events to all of the virtual interfaces sharing the same phy for which the event is received. CRs-Fixed: 556398 Git-commit: 731ca6364e7e43997c2b7d715da0a7a0c5cb2ad9 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen Change-Id: I6c2f163bdf9e81d6d8d8295a1ec9bc0c57308edd --- wpa_supplicant/events.c | 56 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index eb3db1b0..d0e3f4ab 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2406,6 +2406,51 @@ static void wpa_supplicant_event_unprot_disassoc(struct wpa_supplicant *wpa_s, #endif /* CONFIG_IEEE80211W */ } +static void wpa_supplicant_update_channel_list(struct wpa_supplicant *wpa_s) +{ + const char *rn, *rn2; + struct wpa_supplicant *ifs; + + if (wpa_s->drv_priv == NULL) + return; /* Ignore event during drv initialization */ + + free_hw_features(wpa_s); + wpa_s->hw.modes = wpa_drv_get_hw_feature_data( + wpa_s, &wpa_s->hw.num_modes, &wpa_s->hw.flags); + +#ifdef CONFIG_P2P + wpas_p2p_update_channel_list(wpa_s); +#endif /* CONFIG_P2P */ + + /* + * Check other interfaces to see if they have the same radio-name. If + * so, they get updated with this same hw mode info. + */ + if (!wpa_s->driver->get_radio_name) + return; + + rn = wpa_s->driver->get_radio_name(wpa_s->drv_priv); + if (rn == NULL || rn[0] == '\0') + return; + + wpa_dbg(wpa_s, MSG_DEBUG, "Checking for other virtual interfaces " + "sharing same radio (%s) in event_channel_list_change", rn); + + for (ifs = wpa_s->global->ifaces; ifs; ifs = ifs->next) { + if (ifs == wpa_s || !ifs->driver->get_radio_name) + continue; + + rn2 = ifs->driver->get_radio_name(ifs->drv_priv); + if (rn2 && os_strcmp(rn, rn2) == 0) { + wpa_printf(MSG_DEBUG, "%s: Updating hw mode", + ifs->ifname); + free_hw_features(ifs); + ifs->hw.modes = wpa_drv_get_hw_feature_data( + ifs, &ifs->hw.num_modes, &ifs->hw.flags); + } + } +} + void wpa_supplicant_event(void *ctx, enum wpa_event_type event, union wpa_event_data *data) @@ -2968,16 +3013,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED); break; case EVENT_CHANNEL_LIST_CHANGED: - if (wpa_s->drv_priv == NULL) - break; /* Ignore event during drv initialization */ - - free_hw_features(wpa_s); - wpa_s->hw.modes = wpa_drv_get_hw_feature_data( - wpa_s, &wpa_s->hw.num_modes, &wpa_s->hw.flags); - -#ifdef CONFIG_P2P - wpas_p2p_update_channel_list(wpa_s); -#endif /* CONFIG_P2P */ + wpa_supplicant_update_channel_list(wpa_s); break; case EVENT_INTERFACE_UNAVAILABLE: #ifdef CONFIG_P2P -- cgit v1.2.3 From a9b19586456fd9ff4b502a7f07d65cacf092b34d Mon Sep 17 00:00:00 2001 From: Sunil Dutt Date: Thu, 31 Oct 2013 19:30:03 +0530 Subject: Set GTK rekey offload information after initial group key handshake The GTK rekey offload information was sent to the driver immediately after the 4-way handshake which ended up being before the initial group key exchange in the case of WPA (v1). This could result in even that initial GTK handshake being offloaded and wpa_supplicant being left in WPA_GROUP_HANDSHAKE state. Fix this by postponing the operation to happen only after the full set of initial EAPOL-Key exchanges have been completed (i.e., in the existing location for WPA2 and a after the group key handshake for WPA). Change-Id: Ieb92c44845b092072145d2943e3cde500b0a2451 CRs-Fixed: 530560 Git-commit: 392e68e81f186b0f05beb14ac2128b9d6e76fe92 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen --- src/rsn_supp/wpa.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c index e50404ce..ce3f3180 100644 --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c @@ -1132,7 +1132,8 @@ static void wpa_supplicant_process_3_of_4(struct wpa_sm *sm, goto failed; } - wpa_sm_set_rekey_offload(sm); + if (ie.gtk) + wpa_sm_set_rekey_offload(sm); return; @@ -1353,13 +1354,14 @@ static void wpa_supplicant_process_1_of_2(struct wpa_sm *sm, MAC2STR(sm->bssid), wpa_cipher_txt(sm->group_cipher)); wpa_sm_cancel_auth_timeout(sm); wpa_sm_set_state(sm, WPA_COMPLETED); - - wpa_sm_set_rekey_offload(sm); } else { wpa_supplicant_key_neg_complete(sm, sm->bssid, key_info & WPA_KEY_INFO_SECURE); } + + wpa_sm_set_rekey_offload(sm); + return; failed: -- cgit v1.2.3