[pkg-wpa-devel] r892 - in /wpasupplicant/branches/upstream/current/wpa_supplicant: ChangeLog ctrl_iface_unix.c

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Sun Nov 18 06:53:28 UTC 2007


Author: kelmo-guest
Date: Sun Nov 18 06:53:28 2007
New Revision: 892

URL: http://svn.debian.org/wsvn/?sc=1&rev=892
Log:
[svn-upgrade] Integrating new upstream version, wpasupplicant (0.6.1~git20071118.orig)

Modified:
    wpasupplicant/branches/upstream/current/wpa_supplicant/ChangeLog
    wpasupplicant/branches/upstream/current/wpa_supplicant/ctrl_iface_unix.c

Modified: wpasupplicant/branches/upstream/current/wpa_supplicant/ChangeLog
URL: http://svn.debian.org/wsvn/wpasupplicant/branches/upstream/current/wpa_supplicant/ChangeLog?rev=892&op=diff
==============================================================================
--- wpasupplicant/branches/upstream/current/wpa_supplicant/ChangeLog (original)
+++ wpasupplicant/branches/upstream/current/wpa_supplicant/ChangeLog Sun Nov 18 06:53:28 2007
@@ -21,6 +21,9 @@
 	* fixed an integer overflow issue in the ASN.1 parser used by the
 	  (experimental) internal TLS implementation to avoid a potential
 	  buffer read overflow
+	* fixed a race condition with -W option (wait for a control interface
+	  monitor before starting) that could have caused the first messages to
+	  be lost
 
 2007-05-28 - v0.6.0
 	* added network configuration parameter 'frequency' for setting

Modified: wpasupplicant/branches/upstream/current/wpa_supplicant/ctrl_iface_unix.c
URL: http://svn.debian.org/wsvn/wpasupplicant/branches/upstream/current/wpa_supplicant/ctrl_iface_unix.c?rev=892&op=diff
==============================================================================
--- wpasupplicant/branches/upstream/current/wpa_supplicant/ctrl_iface_unix.c (original)
+++ wpasupplicant/branches/upstream/current/wpa_supplicant/ctrl_iface_unix.c Sun Nov 18 06:53:28 2007
@@ -532,9 +532,42 @@
 
 void wpa_supplicant_ctrl_iface_wait(struct ctrl_iface_priv *priv)
 {
-	wpa_printf(MSG_DEBUG, "CTRL_IFACE - %s - wait for monitor",
-		   priv->wpa_s->ifname);
-	eloop_wait_for_read_sock(priv->sock);
+	char buf[256];
+	int res;
+	struct sockaddr_un from;
+	socklen_t fromlen = sizeof(from);
+
+	for (;;) {
+		wpa_printf(MSG_DEBUG, "CTRL_IFACE - %s - wait for monitor to "
+			   "attach", priv->wpa_s->ifname);
+		eloop_wait_for_read_sock(priv->sock);
+
+		res = recvfrom(priv->sock, buf, sizeof(buf) - 1, 0,
+			       (struct sockaddr *) &from, &fromlen);
+		if (res < 0) {
+			perror("recvfrom(ctrl_iface)");
+			continue;
+		}
+		buf[res] = '\0';
+
+		if (os_strcmp(buf, "ATTACH") == 0) {
+			/* handle ATTACH signal of first monitor interface */
+			if (!wpa_supplicant_ctrl_iface_attach(priv, &from,
+							      fromlen)) {
+				sendto(priv->sock, "OK\n", 3, 0,
+				       (struct sockaddr *) &from, fromlen);
+				/* OK to continue */
+				return;
+			} else {
+				sendto(priv->sock, "FAIL\n", 5, 0,
+				       (struct sockaddr *) &from, fromlen);
+			}
+		} else {
+			/* return FAIL for all other signals */
+			sendto(priv->sock, "FAIL\n", 5, 0,
+			       (struct sockaddr *) &from, fromlen);
+		}
+	}
 }
 
 




More information about the Pkg-wpa-devel mailing list