Potential bug on limited output with `wpa_cli list_networks`

Luke Swart luke at lukeswart.net
Fri Feb 17 23:50:15 PST 2017


Hi Jouni,

I noticed that `wpa_cli list_networks` no longer has such limited
output! I tried using the suggestions from your email to implement this
myself - unfortunately my C skills are not too good. But I now have 161
networks configured, and they are all listed in the output of the
`wpa_cli list_networks` command :-)

I'm not sure who fixed this, but it has definitely made my life easier
:-) I really enjoy the simplicity of using wpa_cli to manage my wifi
connections, and I am glad that I can continue using it as my list of
networks continues to grow.

Is there a donation page for this project, or a recommended project that
I can donate to? I would love to make a humble monetary donation in
support of the community.

Thanks,
Luke

On 10/09/2016 07:08 AM, Jouni Malinen wrote:
> On Sat, Oct 01, 2016 at 03:55:55PM -0700, Luke Swart wrote:
>> Is there a way to make `wpa_cli list_networks` output all of my
>> configured networks? I think I am encountering a bug where the output of
>> `wpa_cli list_networks` is limited to ~125 networks. I have ~150
>> networks configured under my
>> `/etc/wpa_supplicant/wpa_supplicant-wlp4s0.conf`, so my last ~25
>> networks are not being listed by wpa_cli's list_networks.
> No, this is not going to work for cases where the output of the
> LIST_NETWORKS commands would be larger than the maximum response length
> and there is not any convenient mechanism for making that work either..
> In other words, support for arbitrary number of network profiles would
> require a new design to iterate through the networks with multiple
> commands similarly to what the BSS command does for scan results
> (SCAN_RESULTS command has a similar limit on how many results can be
> reported in the response).
>
>> And Earnestly pointed out that this might be the section of code that is
>> limiting the output:
>> https://w1.fi/cgit/hostap/tree/wpa_supplicant/wpa_cli.c#n217 Perhaps it
>> has something to do with the buffer being limited to 4096 chars?
> Yes, that's the maximum response buffer length on the wpa_cli side.
> wpa_supplicant has a similar limit for building the response.
>
>> If interested, here is a comment about the bigger problem that I am
>> trying to solve:
>> https://gist.github.com/buhman/7162560#gistcomment-1878112 where I am
>> trying to search for a network's id (which is an integer that is
>> assigned from wpa_cli) by searching for the SSID. For example, if I want
>> to enable/disable a network called "tullys coffeehouse", I'll need to
>> grep/search my list of networks for something like "tully", get the id
>> (ie 144), then run `wpa_cli enable_network 144`.
> For cases where large number of network profiles make the LIST_NETWORK
> output too long, the best option would be to add new commands as noted
> above. E.g., "NETWORK FIRST", "NETWORK NEXT-<id>" and design similar to
> the BSS command as implemented in wpa_supplicant_ctrl_iface_bss().
>
>
> Or alternatively, if you have D-Bus running on the system, you should be
> able to perform the same operation through the D-Bus interface provided
> by wpa_supplicant where this type of output buffer limit should not
> apply.
>





More information about the Hostap mailing list