nl80211: skip event notifications in wpa_supplicant scan result reply
authorJo-Philipp Wich <jo@mein.io>
Tue, 16 Jan 2018 12:44:21 +0000 (13:44 +0100)
committerJo-Philipp Wich <jo@mein.io>
Tue, 16 Jan 2018 13:03:37 +0000 (14:03 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
iwinfo_nl80211.c

index 27765317d071dc2e9173a4fa4e2f2da4782fdaca..904461082623b1a3d1ddea970a38fcdf8d18009f 100644 (file)
@@ -2209,8 +2209,12 @@ static int nl80211_get_scanlist_wpactl(const char *ifname, char *buf, int *len)
        }
 
        /* receive and parse scan results if the wait above didn't time out */
-       if (ready && nl80211_wpactl_recv(sock, reply, sizeof(reply)) > 0)
+       while (ready && nl80211_wpactl_recv(sock, reply, sizeof(reply)) > 0)
        {
+               /* received an event notification, receive again */
+               if (reply[0] == '<')
+                       continue;
+
                nl80211_get_quality_max(ifname, &qmax);
 
                for (line = strtok_r(reply, "\n", &pos);
@@ -2288,6 +2292,7 @@ static int nl80211_get_scanlist_wpactl(const char *ifname, char *buf, int *len)
                }
 
                *len = count * sizeof(struct iwinfo_scanlist_entry);
+               break;
        }
 
        close(sock);