From 2b23da8a23446f9c8deb8c8650528f1b09d8701d Mon Sep 17 00:00:00 2001 From: vamsi krishna Date: Tue, 19 Jul 2016 12:41:15 +0530 Subject: Set default scan IEs to the driver (QCA vendor extension) This makes wpa_supplicant set default scan IEs to the driver (if the vendor command is supported). The driver can use these IEs in the scan requests initiated by the driver itself. Also the driver can merge these IEs into further scan requests that it receives, in case if the scan request doesn't carry any of the IEs sent in this command. Signed-off-by: Jouni Malinen Git-commit: cc9985d1b1a844fddbc042abe8c4f5036c0d410b Git-repo: git://w1.fi/srv/git/hostap.git Change-Id: I21e8e31c50bb14903a14a2419a6eb5f4ae8841ef CRs-Fixed: 1049832 --- wpa_supplicant/driver_i.h | 9 +++++++++ wpa_supplicant/mbo.c | 2 ++ wpa_supplicant/scan.c | 33 +++++++++++++++++++++++++++++++++ wpa_supplicant/scan.h | 1 + wpa_supplicant/wpa_supplicant.c | 2 ++ 5 files changed, 47 insertions(+) (limited to 'wpa_supplicant') diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index 82e9a5a3..869b705f 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -950,4 +950,13 @@ static inline int wpa_drv_p2p_lo_stop(struct wpa_supplicant *wpa_s) return -1; return wpa_s->driver->p2p_lo_stop(wpa_s->drv_priv); } + +static inline int wpa_drv_set_default_scan_ies(struct wpa_supplicant *wpa_s, + const u8 *ies, size_t len) +{ + if (!wpa_s->driver->set_default_scan_ies) + return -1; + return wpa_s->driver->set_default_scan_ies(wpa_s->drv_priv, ies, len); +} + #endif /* DRIVER_I_H */ diff --git a/wpa_supplicant/mbo.c b/wpa_supplicant/mbo.c index 3292e67c..1154ab6d 100644 --- a/wpa_supplicant/mbo.c +++ b/wpa_supplicant/mbo.c @@ -18,6 +18,7 @@ #include "wpa_supplicant_i.h" #include "driver_i.h" #include "bss.h" +#include "scan.h" /* type + length + oui + oui type */ #define MBO_IE_HEADER 6 @@ -768,4 +769,5 @@ void wpas_mbo_update_cell_capa(struct wpa_supplicant *wpa_s, u8 mbo_cell_capa) cell_capa[6] = mbo_cell_capa; wpas_mbo_send_wnm_notification(wpa_s, cell_capa, 7); + wpa_supplicant_set_default_scan_ies(wpa_s); } diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 466ff5fc..09c7bd89 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -428,6 +428,39 @@ static void wpas_add_interworking_elements(struct wpa_supplicant *wpa_s, #endif /* CONFIG_INTERWORKING */ +void wpa_supplicant_set_default_scan_ies(struct wpa_supplicant *wpa_s) +{ + struct wpabuf *default_ies = NULL; + u8 ext_capab[18]; + int ext_capab_len; + enum wpa_driver_if_type type = WPA_IF_STATION; + +#ifdef CONFIG_P2P + if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT) + type = WPA_IF_P2P_CLIENT; +#endif /* CONFIG_P2P */ + + wpa_drv_get_ext_capa(wpa_s, type); + + ext_capab_len = wpas_build_ext_capab(wpa_s, ext_capab, + sizeof(ext_capab)); + if (ext_capab_len > 0 && + wpabuf_resize(&default_ies, ext_capab_len) == 0) + wpabuf_put_data(default_ies, ext_capab, ext_capab_len); + +#ifdef CONFIG_MBO + /* Send cellular capabilities for potential MBO STAs */ + if (wpabuf_resize(&default_ies, 9) == 0) + wpas_mbo_scan_ie(wpa_s, default_ies); +#endif /* CONFIG_MBO */ + + if (default_ies) + wpa_drv_set_default_scan_ies(wpa_s, wpabuf_head(default_ies), + wpabuf_len(default_ies)); + wpabuf_free(default_ies); +} + + static struct wpabuf * wpa_supplicant_extra_ies(struct wpa_supplicant *wpa_s) { struct wpabuf *extra_ie = NULL; diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h index 917ec552..a734148a 100644 --- a/wpa_supplicant/scan.h +++ b/wpa_supplicant/scan.h @@ -59,5 +59,6 @@ void filter_scan_res(struct wpa_supplicant *wpa_s, void scan_snr(struct wpa_scan_res *res); void scan_est_throughput(struct wpa_supplicant *wpa_s, struct wpa_scan_res *res); +void wpa_supplicant_set_default_scan_ies(struct wpa_supplicant *wpa_s); #endif /* SCAN_H */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 6a978667..a158501a 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -4841,6 +4841,8 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, wpas_mbo_update_non_pref_chan(wpa_s, wpa_s->conf->non_pref_chan); #endif /* CONFIG_MBO */ + wpa_supplicant_set_default_scan_ies(wpa_s); + return 0; } -- cgit v1.2.3 From 2e0692fa2acf4b8851b7bcd9564683cb2759b9a8 Mon Sep 17 00:00:00 2001 From: Lior David Date: Wed, 30 Mar 2016 14:57:31 +0300 Subject: Fix sending non-Public Action frames over P2P Device interface The P2P Device interface can only send Public Action frames. Non-Public Action frames must be sent over a group interface. The previous implementation sometimes tried to send non-Public Action frames such as GO Discoverability over the P2P Device interface, however, the source address of the frame was set to the group interface address so the code in offchannel.c knew to select the correct interface for the TX. The check breaks when the P2P Device and group interfaces have the same MAC address. In this case the frame will be sent over the P2P Device interface and the send will fail. Fix this problem in two places: 1. In offchannel, route non-Public Action frames to the GO interface when the above conditions are met. 2. When a TX_STATUS event arrives on such routed frame, it will arrive on the GO interface but it must be handled by the P2P Device interface since it has the relevant state logic. Change-Id: I616fcc75abde6f261026eb0db4bf97d5775e4f80 Signed-off-by: Lior David Git-commit: a26c9c2e710a74c7e0fc9a5bf1ddf79b2bdfc49a Git-repo: git://w1.fi/srv/git/hostap.git CRs-Fixed: 1059345 --- wpa_supplicant/events.c | 11 +++++++---- wpa_supplicant/offchannel.c | 23 ++++++++++++++++++++++- 2 files changed, 29 insertions(+), 5 deletions(-) (limited to 'wpa_supplicant') diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index d11d5646..adb59b8c 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -3585,17 +3585,20 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, #endif /* CONFIG_AP */ #ifdef CONFIG_OFFCHANNEL wpa_dbg(wpa_s, MSG_DEBUG, "EVENT_TX_STATUS pending_dst=" - MACSTR, MAC2STR(wpa_s->parent->pending_action_dst)); + MACSTR, MAC2STR(wpa_s->p2pdev->pending_action_dst)); /* * Catch TX status events for Action frames we sent via group - * interface in GO mode. + * interface in GO mode, or via standalone AP interface. + * Note, wpa_s->p2pdev will be the same as wpa_s->parent, + * except when the primary interface is used as a GO interface + * (for drivers which do not have group interface concurrency) */ if (data->tx_status.type == WLAN_FC_TYPE_MGMT && data->tx_status.stype == WLAN_FC_STYPE_ACTION && - os_memcmp(wpa_s->parent->pending_action_dst, + os_memcmp(wpa_s->p2pdev->pending_action_dst, data->tx_status.dst, ETH_ALEN) == 0) { offchannel_send_action_tx_status( - wpa_s->parent, data->tx_status.dst, + wpa_s->p2pdev, data->tx_status.dst, data->tx_status.data, data->tx_status.data_len, data->tx_status.ack ? diff --git a/wpa_supplicant/offchannel.c b/wpa_supplicant/offchannel.c index 6b3f83c4..26d41a4a 100644 --- a/wpa_supplicant/offchannel.c +++ b/wpa_supplicant/offchannel.c @@ -23,8 +23,29 @@ wpas_get_tx_interface(struct wpa_supplicant *wpa_s, const u8 *src) { struct wpa_supplicant *iface; - if (os_memcmp(src, wpa_s->own_addr, ETH_ALEN) == 0) + if (os_memcmp(src, wpa_s->own_addr, ETH_ALEN) == 0) { +#ifdef CONFIG_P2P + if (wpa_s->p2p_mgmt && wpa_s != wpa_s->parent && + wpa_s->parent->ap_iface && + os_memcmp(wpa_s->parent->own_addr, + wpa_s->own_addr, ETH_ALEN) == 0 && + wpabuf_len(wpa_s->pending_action_tx) >= 2 && + *wpabuf_head_u8(wpa_s->pending_action_tx) != + WLAN_ACTION_PUBLIC) { + /* + * When P2P Device interface has same MAC address as + * the GO interface, make sure non-Public Action frames + * are sent through the GO interface. The P2P Device + * interface can only send Public Action frames. + */ + wpa_printf(MSG_DEBUG, + "P2P: Use GO interface %s instead of interface %s for Action TX", + wpa_s->parent->ifname, wpa_s->ifname); + return wpa_s->parent; + } +#endif /* CONFIG_P2P */ return wpa_s; + } /* * Try to find a group interface that matches with the source address. -- cgit v1.2.3 From 8c633e95429cefa89026546ca80e8f54f03f862d Mon Sep 17 00:00:00 2001 From: Lior David Date: Tue, 12 Apr 2016 18:13:22 +0300 Subject: wpa_supplicant: Add wps_disabled parameter to network block Add a new parameter wps_disabled to network block (wpa_ssid). This parameter allows WPS functionality to be disabled in AP mode. Change-Id: I94aa3956665f1ee23fa80820424f5dde526d3330 Signed-off-by: Lior David Git-commit: b6317b417f5dfb16711ec1a7ab3600f77479fe20 Git-repo: git://w1.fi/srv/git/hostap.git CRs-Fixed: 1059345 --- wpa_supplicant/ap.c | 2 ++ wpa_supplicant/config.c | 1 + wpa_supplicant/config_file.c | 1 + wpa_supplicant/config_ssid.h | 8 ++++++++ wpa_supplicant/wpa_cli.c | 2 +- wpa_supplicant/wpa_supplicant.conf | 5 +++++ 6 files changed, 18 insertions(+), 1 deletion(-) (limited to 'wpa_supplicant') diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index f6abd706..803ff296 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -416,6 +416,8 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s, !(bss->wpa & 2))) goto no_wps; /* WPS2 does not allow WPA/TKIP-only * configuration */ + if (ssid->wps_disabled) + goto no_wps; bss->eap_server = 1; if (!ssid->ignore_broadcast_ssid) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index e2aa9708..da418a24 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -2055,6 +2055,7 @@ static const struct parse_data ssid_fields[] = { #endif /* CONFIG_HS20 */ { INT_RANGE(mac_addr, 0, 2) }, { INT_RANGE(pbss, 0, 2) }, + { INT_RANGE(wps_disabled, 0, 1) }, }; #undef OFFSET diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 9b4046ca..e72f8441 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -756,6 +756,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) INT(mixed_cell); INT(max_oper_chwidth); INT(pbss); + INT(wps_disabled); #ifdef CONFIG_IEEE80211W write_int(f, "ieee80211w", ssid->ieee80211w, MGMT_FRAME_PROTECTION_DEFAULT); diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h index c2af91df..1ecdfc09 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -748,6 +748,14 @@ struct wpa_ssid { * this MBSS will trigger a peering attempt. */ int no_auto_peer; + + /** + * wps_disabled - WPS disabled in AP mode + * + * 0 = WPS enabled and configured (default) + * 1 = WPS disabled + */ + int wps_disabled; }; #endif /* CONFIG_SSID_H */ diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c index 812abfc1..ccbd538e 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -1612,7 +1612,7 @@ static const char *network_fields[] = { #ifdef CONFIG_HS20 "update_identifier", #endif /* CONFIG_HS20 */ - "mac_addr", "pbss" + "mac_addr", "pbss", "wps_disabled" }; diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf index 2017a1a7..ff3aa841 100644 --- a/wpa_supplicant/wpa_supplicant.conf +++ b/wpa_supplicant/wpa_supplicant.conf @@ -1179,6 +1179,11 @@ fast_reauth=1 # Beacon interval (default: 100 TU) #beacon_int=100 +# WPS in AP mode +# 0 = WPS enabled and configured (default) +# 1 = WPS disabled +#wps_disabled=0 + # MAC address policy # 0 = use permanent MAC address # 1 = use random MAC address for each ESS connection -- cgit v1.2.3 From ed615fcb50b78c8921b0dff7b54a50f7dd754500 Mon Sep 17 00:00:00 2001 From: Lior David Date: Sat, 16 Jan 2016 18:57:54 +0200 Subject: wpa_supplicant: Configurable EAP fragment size in AP mode In wpa_supplicant AP mode, allow configuration of the EAP fragment size using the fragment_size member of network block (wpa_ssid), similar to the fragment_size in hostapd configuration. bss->fragment_size default value of 0 is treated specially in some EAP code paths (such as MTU initialization in eap_pwd_init). In order to preserve the existing behavior, bss->fragment_size will only be set if the network block specified a value different from the default which is DEFAULT_FRAGMENT_SIZE(1398) bytes. Change-Id: Id9b2361ee00b9d54c13c75d2446583edff867ade Signed-off-by: Lior David Git-commit: b94fff1d93e894b55656dea1a833b33b93e8c4f0 Git-repo: git://w1.fi/srv/git/hostap.git CRs-Fixed: 1059345 --- wpa_supplicant/ap.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'wpa_supplicant') diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index 803ff296..99d3cc35 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -446,6 +446,8 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s, os_memcpy(bss->uuid, wpa_s->conf->uuid, WPS_UUID_LEN); os_memcpy(bss->os_version, wpa_s->conf->os_version, 4); bss->pbc_in_m1 = wpa_s->conf->pbc_in_m1; + if (ssid->eap.fragment_size != DEFAULT_FRAGMENT_SIZE) + bss->fragment_size = ssid->eap.fragment_size; no_wps: #endif /* CONFIG_WPS */ -- cgit v1.2.3 From be72c3e4a10c2c44b0a2c9eb20dee525ca67aa2b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 31 May 2016 00:11:42 +0300 Subject: Report connection timeouts in CTRL-EVENT-ASSOC-REJECT Add a new "timeout" argument to the event message if the nl80211 message indicates that the connection failure is not due to an explicit AP rejection message. This makes it easier for external programs to figure out why the connection failed. Signed-off-by: Jouni Malinen Git-commit: 9a5160f5fb1b06392477154bb349cacc49b2ef16 Git-repo: git://w1.fi/srv/git/hostap.git Change-Id: Ie7a92faf217528213c793aef2a0438bf921c4ac5 CRs-Fixed: 1056212 --- wpa_supplicant/events.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'wpa_supplicant') diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index adb59b8c..fed9aca6 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -3521,13 +3521,15 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, case EVENT_ASSOC_REJECT: if (data->assoc_reject.bssid) wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_ASSOC_REJECT - "bssid=" MACSTR " status_code=%u", + "bssid=" MACSTR " status_code=%u%s", MAC2STR(data->assoc_reject.bssid), - data->assoc_reject.status_code); + data->assoc_reject.status_code, + data->assoc_reject.timed_out ? " timeout" : ""); else wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_ASSOC_REJECT - "status_code=%u", - data->assoc_reject.status_code); + "status_code=%u%s", + data->assoc_reject.status_code, + data->assoc_reject.timed_out ? " timeout" : ""); wpa_s->assoc_status_code = data->assoc_reject.status_code; wpas_notify_assoc_status_code(wpa_s); if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) -- cgit v1.2.3 From a0be99eaabec741856d0a8d9a063c324cd57d934 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 4 Jun 2016 21:30:51 +0300 Subject: mesh: Allow 160 MHz channel to be configured This allows minimal testing with 160 MHz channel with country code ZA that happens to be the only one with a non-DFS 160 MHz frequency. DFS with mesh is not yet supported. Signed-off-by: Jouni Malinen Git-commit: 331f07742f622ed6bd0019dcb574735fbbbfddde Git-repo: git://w1.fi/srv/git/hostap.git Change-Id: I79b5332364a7bc942846c0e4c8bafc08c610d2fe CRs-fixed: 1069689 --- wpa_supplicant/wpa_supplicant.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'wpa_supplicant') diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index a158501a..ef1c63fd 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2034,6 +2034,16 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, if (chwidth == VHT_CHANWIDTH_80P80MHZ) break; } + } else if (ssid->max_oper_chwidth == VHT_CHANWIDTH_160MHZ) { + if (freq->freq == 5180) { + chwidth = VHT_CHANWIDTH_160MHZ; + vht_caps |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; + seg0 = 50; + } else if (freq->freq == 5520) { + chwidth = VHT_CHANWIDTH_160MHZ; + vht_caps |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; + seg0 = 114; + } } if (hostapd_set_freq_params(&vht_freq, mode->mode, freq->freq, -- cgit v1.2.3