Potential bug on limited output with `wpa_cli list_networks`

Jouni Malinen j at w1.fi
Sun Oct 9 07:08:26 PDT 2016


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.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list