Fwd: truncated events from WPA supplicant

Johannes Berg johannes at sipsolutions.net
Mon Sep 20 01:54:17 PDT 2021


On Tue, 2021-09-14 at 22:33 +0300, Ros Spolyak wrote:
> I have subscribed to WPA events in my application and often the
> received events are truncated. The rest of the time events are
> correct. Example,
> <3>CTRL-EVENT-BSS-RE event received (len 20)
> <3>CTRL-EVENT-DISCON event received (len 20)
> 
> The code I am using:
>   if (wpa_ctrl_pending(ctrl_conn_g) > 0) {
>     char buf[256] = {0};
>     size_t len = sizeof(buf) - 1;
> 
>     while (wpa_ctrl_recv(ctrl_conn_g, buf, &len) == 0) {
>       buf[len] = '\0';
>       printf("'%s' event received (len %u)", buf, len);

You need to reset 'len' for each loop iteration?

johannes




More information about the Hostap mailing list