wpa_supplicant: Update to 07-Jul-2012 TOT
commit a5ed45586c63ffd8f9d2b44e27c251d7bacbeaf4
Author: Jouni Malinen <j@w1.fi>
Date: Sat Jul 7 13:01:45 2012 +0300
WPS SSDP: Fix socket leaks on error paths
Change-Id: I0864aac7fc88fa2a60f5cca7d524b94363410c85
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c
index 37b3f7b..0509767 100644
--- a/src/p2p/p2p_sd.c
+++ b/src/p2p/p2p_sd.c
@@ -364,9 +364,14 @@
"previous SD response");
wpabuf_free(p2p->sd_resp);
}
+ p2p->sd_resp = wpabuf_dup(resp_tlvs);
+ if (p2p->sd_resp == NULL) {
+ wpa_msg(p2p->cfg->msg_ctx, MSG_ERROR, "P2P: Failed to "
+ "allocate SD response fragmentation area");
+ return;
+ }
os_memcpy(p2p->sd_resp_addr, dst, ETH_ALEN);
p2p->sd_resp_dialog_token = dialog_token;
- p2p->sd_resp = wpabuf_dup(resp_tlvs);
p2p->sd_resp_pos = 0;
p2p->sd_frag_id = 0;
resp = p2p_build_sd_response(dialog_token, WLAN_STATUS_SUCCESS,
@@ -404,9 +409,18 @@
u16 slen;
u16 update_indic;
+#ifdef ANDROID_P2P
+ if (p2p->state != P2P_SD_DURING_FIND) {
+ wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
+ "P2P: #### Not ignoring unexpected GAS Initial Response from "
+ MACSTR " state %d", MAC2STR(sa), p2p->state);
+ }
+ if (p2p->sd_peer == NULL ||
+#else
if (p2p->state != P2P_SD_DURING_FIND || p2p->sd_peer == NULL ||
+#endif
os_memcmp(sa, p2p->sd_peer->info.p2p_device_addr, ETH_ALEN) != 0) {
- wpa_msg(p2p->cfg->msg_ctx, MSG_ERROR,
+ wpa_msg(p2p->cfg->msg_ctx, MSG_INFO,
"P2P: Ignore unexpected GAS Initial Response from "
MACSTR, MAC2STR(sa));
return;
@@ -645,9 +659,18 @@
wpa_hexdump(MSG_DEBUG, "P2P: RX GAS Comeback Response", data, len);
- if (p2p->state != P2P_SD_DURING_FIND || p2p->sd_peer == NULL ||
- os_memcmp(sa, p2p->sd_peer->info.p2p_device_addr, ETH_ALEN) != 0) {
+#ifdef ANDROID_P2P
+ if (p2p->state != P2P_SD_DURING_FIND) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
+ "P2P: #### Not ignoring unexpected GAS Comeback Response from "
+ MACSTR " state %d", MAC2STR(sa), p2p->state);
+ }
+ if (p2p->sd_peer == NULL ||
+#else
+ if (p2p->state != P2P_SD_DURING_FIND || p2p->sd_peer == NULL ||
+#endif
+ os_memcmp(sa, p2p->sd_peer->info.p2p_device_addr, ETH_ALEN) != 0) {
+ wpa_msg(p2p->cfg->msg_ctx, MSG_INFO,
"P2P: Ignore unexpected GAS Comeback Response from "
MACSTR, MAC2STR(sa));
return;
@@ -842,7 +865,7 @@
{
struct p2p_sd_query *q;
#ifdef ANDROID_P2P
- /* Currently, supplicant doesn't support more than one pending broadcast SD request.
+ /* Currently, supplicant doesn't support more than one pending broadcast SD request.
* So reject if application is registering another one before cancelling the existing one.
*/
for (q = p2p->sd_queries; q; q = q->next) {
@@ -872,7 +895,7 @@
q->next = p2p->sd_queries;
p2p->sd_queries = q;
- wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Added SD Query %p for_all_peers %d", q, q->for_all_peers);
+ wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Added SD Query %p", q);
if (dst == NULL) {
struct p2p_device *dev;
@@ -893,24 +916,10 @@
int p2p_sd_cancel_request(struct p2p_data *p2p, void *req)
{
if (p2p_unlink_sd_query(p2p, req)) {
-#ifdef ANDROID_P2P
- struct p2p_device *dev;
- struct p2p_sd_query *q = (struct p2p_sd_query *)req;
-#endif
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Cancel pending SD query %p", req);
#ifdef ANDROID_P2P
- /* If the request is a bcast query, then clear the
- * P2P_DEV_SD_INFO flag so that when new sd query is registered,
- * we will send the SD request frames to peer devices.
- */
- if(q->for_all_peers) {
- p2p->sd_dev_list = NULL;
- dl_list_for_each(dev, &p2p->devices,
- struct p2p_device, list) {
- dev->flags &= ~P2P_DEV_SD_INFO;
- }
- }
+ p2p->sd_dev_list = NULL;
#endif
p2p_free_sd_query(req);
return 0;