[PATCH 2/2] Use parent interface if available when logging ctrl_iface send failures.

Toby Gray toby.gray at realvnc.com
Tue Oct 14 13:34:43 EDT 2014


This is needed to not re-use wpa_s after it has been deleted if it is
a P2P group interface and the command was P2P_REMOVE_GROUP.

Signed-off-by: Toby Gray <toby.gray at realvnc.com>
---
 wpa_supplicant/ctrl_iface_unix.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/ctrl_iface_unix.c b/wpa_supplicant/ctrl_iface_unix.c
index 40082e2..2b53ee1 100644
--- a/wpa_supplicant/ctrl_iface_unix.c
+++ b/wpa_supplicant/ctrl_iface_unix.c
@@ -152,6 +152,7 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
 					      void *sock_ctx)
 {
 	struct wpa_supplicant *wpa_s = eloop_ctx;
+	struct wpa_supplicant *parent = wpa_s->parent;
 	struct ctrl_iface_priv *priv = sock_ctx;
 	char buf[4096];
 	int res;
@@ -208,7 +209,11 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
 		if (sendto(sock, reply, reply_len, 0, (struct sockaddr *) &from,
 			   fromlen) < 0) {
 			int _errno = errno;
-			wpa_dbg(wpa_s, MSG_DEBUG,
+			/*
+			 * Need to use the parent context here as wpa_s might have
+			 * been deleted in wpa_supplicant_ctrl_iface_process.
+			 */
+			wpa_dbg(parent ? parent : wpa_s, MSG_DEBUG,
 				"ctrl_iface sendto failed: %d - %s",
 				_errno, strerror(_errno));
 			if (_errno == ENOBUFS || _errno == EAGAIN) {
-- 
1.8.3.4



More information about the HostAP mailing list