Cumulative patch from commit a94737ea38a44ba7c8d4e48dd824c67a5b70bee3
a94737ea Android: P2P: Remember country locale
5e2c3490 Android: Add driver_cmd for arbitrary driver commands
0de38036 Android: Add P2P/WPS wrappers for private lib
92ecda40 hostapd: Set proper VHT capabilities
77a3e796 hostapd: Fix set beacon in multiple BSSID scenario
179fc552 TDLS: Do not reenable TDLS link on retransmitted setup frame
cc14091e VHT: Fix memory leak in STA entry
Change-Id: I38d0200c426d6f6671b8f2899b9236c4c135788a
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 298c0fa..0e0dae4 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -878,8 +878,10 @@
void ieee802_11_set_beacons(struct hostapd_iface *iface)
{
size_t i;
- for (i = 0; i < iface->num_bss; i++)
- ieee802_11_set_beacon(iface->bss[i]);
+ for (i = 0; i < iface->num_bss; i++) {
+ if (iface->bss[i]->started)
+ ieee802_11_set_beacon(iface->bss[i]);
+ }
}
@@ -888,7 +890,7 @@
{
size_t i;
for (i = 0; i < iface->num_bss; i++)
- if (iface->bss[i]->beacon_set_done)
+ if (iface->bss[i]->beacon_set_done && iface->bss[i]->started)
ieee802_11_set_beacon(iface->bss[i]);
}
diff --git a/src/ap/ieee802_11_vht.c b/src/ap/ieee802_11_vht.c
index 38590a3..60e6b57 100644
--- a/src/ap/ieee802_11_vht.c
+++ b/src/ap/ieee802_11_vht.c
@@ -35,7 +35,7 @@
cap = (struct ieee80211_vht_capabilities *) pos;
os_memset(cap, 0, sizeof(*cap));
cap->vht_capabilities_info = host_to_le32(
- hapd->iface->current_mode->vht_capab);
+ hapd->iface->conf->vht_capab);
/* Supported MCS set comes from hw */
os_memcpy(&cap->vht_supported_mcs_set,
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index a6775f3..9d28d9c 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -262,6 +262,7 @@
wpabuf_free(sta->hs20_ie);
os_free(sta->ht_capabilities);
+ os_free(sta->vht_capabilities);
hostapd_free_psk_list(sta->psk);
os_free(sta->identity);
os_free(sta->radius_cui);
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 3937fa5..3502eb8 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2674,18 +2674,19 @@
* DEPRECATED - use set_ap() instead
*/
int (*set_authmode)(void *priv, int authmode);
+
#ifdef ANDROID
/**
- * driver_cmd - execute driver-specific command
- * @priv: private driver interface data
- * @cmd: command to execute
- * @buf: return buffer
- * @buf_len: buffer length
- *
+ * driver_cmd - Execute driver-specific command
+ * @priv: Private driver interface data
+ * @cmd: Command to execute
+ * @buf: Return buffer
+ * @buf_len: Buffer length
* Returns: 0 on success, -1 on failure
*/
- int (*driver_cmd)(void *priv, char *cmd, char *buf, size_t buf_len);
-#endif
+ int (*driver_cmd)(void *priv, char *cmd, char *buf, size_t buf_len);
+#endif /* ANDROID */
+
/**
* set_rekey_info - Set rekey information
* @priv: Private driver interface data
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index fd05149..eaca172 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -362,20 +362,18 @@
static int android_pno_start(struct i802_bss *bss,
struct wpa_driver_scan_params *params);
static int android_pno_stop(struct i802_bss *bss);
+extern int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf,
+ size_t buf_len);
#endif /* ANDROID */
#ifdef ANDROID_P2P
int wpa_driver_set_p2p_noa(void *priv, u8 count, int start, int duration);
int wpa_driver_get_p2p_noa(void *priv, u8 *buf, size_t len);
int wpa_driver_set_p2p_ps(void *priv, int legacy_ps, int opp_ps, int ctwindow);
int wpa_driver_set_ap_wps_p2p_ie(void *priv, const struct wpabuf *beacon,
- const struct wpabuf *proberesp,
- const struct wpabuf *assocresp);
+ const struct wpabuf *proberesp,
+ const struct wpabuf *assocresp);
+#endif /* ANDROID_P2P */
-#endif
-#ifdef ANDROID
-extern int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf,
- size_t buf_len);
-#endif
static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx);
static void del_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx);
static int have_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx);
@@ -10622,12 +10620,13 @@
wpa_printf(MSG_DEBUG, "nl80211: set_p2p_powersave (legacy_ps=%d "
"opp_ps=%d ctwindow=%d)", legacy_ps, opp_ps, ctwindow);
- if (opp_ps != -1 || ctwindow != -1)
+ if (opp_ps != -1 || ctwindow != -1) {
#ifdef ANDROID_P2P
wpa_driver_set_p2p_ps(priv, legacy_ps, opp_ps, ctwindow);
-#else
+#else /* ANDROID_P2P */
return -1; /* Not yet supported */
-#endif
+#endif /* ANDROID_P2P */
+ }
if (legacy_ps == -1)
return 0;
@@ -11453,8 +11452,8 @@
.set_noa = wpa_driver_set_p2p_noa,
.get_noa = wpa_driver_get_p2p_noa,
.set_ap_wps_ie = wpa_driver_set_ap_wps_p2p_ie,
-#endif
+#endif /* ANDROID_P2P */
#ifdef ANDROID
.driver_cmd = wpa_driver_nl80211_driver_cmd,
-#endif
+#endif /* ANDROID */
};
diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 616997f..efc6431 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -1839,7 +1839,7 @@
int ielen;
u16 status;
const u8 *pos;
- int ret;
+ int ret = 0;
wpa_printf(MSG_DEBUG, "TDLS: Received TDLS Setup Response / TPK M2 "
"(Peer " MACSTR ")", MAC2STR(src_addr));
@@ -2056,11 +2056,19 @@
return -1;
}
- ret = wpa_tdls_enable_link(sm, peer);
- if (ret < 0) {
- wpa_printf(MSG_DEBUG, "TDLS: Could not enable link");
- wpa_tdls_do_teardown(sm, peer,
- WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
+ if (!peer->tpk_success) {
+ /*
+ * Enable Link only when tpk_success is 0, signifying that this
+ * processing of TPK M2 frame is not because of a retransmission
+ * during TDLS setup handshake.
+ */
+ ret = wpa_tdls_enable_link(sm, peer);
+ if (ret < 0) {
+ wpa_printf(MSG_DEBUG, "TDLS: Could not enable link");
+ wpa_tdls_do_teardown(
+ sm, peer,
+ WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
+ }
}
return ret;
@@ -2084,7 +2092,7 @@
u16 status;
const u8 *pos;
u32 lifetime;
- int ret;
+ int ret = 0;
wpa_printf(MSG_DEBUG, "TDLS: Received TDLS Setup Confirm / TPK M3 "
"(Peer " MACSTR ")", MAC2STR(src_addr));
@@ -2201,11 +2209,19 @@
}
skip_rsn:
- ret = wpa_tdls_enable_link(sm, peer);
- if (ret < 0) {
- wpa_printf(MSG_DEBUG, "TDLS: Could not enable link");
- wpa_tdls_do_teardown(sm, peer,
- WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
+ if (!peer->tpk_success) {
+ /*
+ * Enable Link only when tpk_success is 0, signifying that this
+ * processing of TPK M3 frame is not because of a retransmission
+ * during TDLS setup handshake.
+ */
+ ret = wpa_tdls_enable_link(sm, peer);
+ if (ret < 0) {
+ wpa_printf(MSG_DEBUG, "TDLS: Could not enable link");
+ wpa_tdls_do_teardown(
+ sm, peer,
+ WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
+ }
}
return ret;
error:
@@ -2306,7 +2322,7 @@
* Disable previous link to allow renegotiation to be completed
* on AP path.
*/
- wpa_sm_tdls_oper(sm, TDLS_DISABLE_LINK, peer->addr);
+ wpa_tdls_disable_peer_link(sm, peer);
}
}
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 008406a..4e344b8 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -5176,11 +5176,11 @@
p2p_set_country(p2p, country);
}
}
- ret = sprintf(buf, "%s\n", "OK");
+ ret = os_snprintf(buf, buflen, "%s\n", "OK");
}
return ret;
}
-#endif
+#endif /* ANDROID */
static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
@@ -5778,7 +5778,7 @@
} else if (os_strncmp(buf, "DRIVER ", 7) == 0) {
reply_len = wpa_supplicant_driver_cmd(wpa_s, buf + 7, reply,
reply_size);
-#endif
+#endif /* ANDROID */
} else if (os_strcmp(buf, "REAUTHENTICATE") == 0) {
pmksa_cache_clear_current(wpa_s->wpa);
eapol_sm_request_reauth(wpa_s->eapol);
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index f83ab29..7f196de 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -673,7 +673,7 @@
return -1;
return wpa_s->driver->driver_cmd(wpa_s->drv_priv, cmd, buf, buf_len);
}
-#endif
+#endif /* ANDROID */
static inline void wpa_drv_set_rekey_info(struct wpa_supplicant *wpa_s,
const u8 *kek, const u8 *kck,
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 5d14e23..aabaa3c 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -2415,23 +2415,9 @@
#ifdef ANDROID
static int wpa_cli_cmd_driver(struct wpa_ctrl *ctrl, int argc, char *argv[])
{
- char cmd[256];
- int i;
- int len;
-
- if (argc < 1) {
- printf("Invalid DRIVER command: needs one argument (cmd)\n");
- return -1;
- }
-
- len = os_snprintf(cmd, sizeof(cmd), "DRIVER %s", argv[0]);
- for (i=1; i < argc; i++)
- len += os_snprintf(cmd + len, sizeof(cmd) - len, " %s", argv[i]);
- cmd[sizeof(cmd) - 1] = '\0';
- printf("%s: %s\n", __func__, cmd);
- return wpa_ctrl_command(ctrl, cmd);
+ return wpa_cli_cmd(ctrl, "DRIVER", 1, argc, argv);
}
-#endif
+#endif /* ANDROID */
static int wpa_cli_cmd_flush(struct wpa_ctrl *ctrl, int argc, char *argv[])
@@ -2904,10 +2890,9 @@
{ "flush", wpa_cli_cmd_flush, NULL, cli_cmd_flag_none,
"= flush wpa_supplicant state" },
#ifdef ANDROID
- { "driver", wpa_cli_cmd_driver, NULL,
- cli_cmd_flag_none,
+ { "driver", wpa_cli_cmd_driver, NULL, cli_cmd_flag_none,
"<command> = driver private commands" },
-#endif
+#endif /* ANDROID */
{ NULL, NULL, NULL, cli_cmd_flag_none, NULL }
};