Re: [PATCH] `iwlist scan` fails with many networks available
From: Johannes Berg <johannes@sipsolutions.net>
Date: 2019-08-21 07:59:39
Also in:
linux-wireless, lkml
On Tue, 2019-08-13 at 00:43 +0000, James Nylen wrote:
quoted
I suppose we could consider applying a workaround like this if it has a condition checking that the buffer passed in is the maximum possible buffer (65535 bytes, due to iw_point::length being u16)This is what the latest patch does (attached to my email from yesterday / https://lkml.org/lkml/2019/8/10/452 ).
Hmm, yes, you're right. I evidently missed the comparisons to 0xFFFF there, sorry about that.
If you'd like to apply it, I'm happy to make any needed revisions. Otherwise I'm going to have to keep patching my kernels for this issue, unfortunately I don't have the time to try to get wicd to migrate to a better solution.
Not sure which would be easier, but ok :-)
Can you please fix the patch to
1) use /* */ style comments (see
https://www.kernel.org/doc/html/latest/process/coding-style.html)
2) remove extra braces (also per coding style)
3) use U16_MAX instead of 0xFFFF
I'd also consider renaming "maybe_current_ev" to "next_ev" or something
shorter anyway, and would probably argue that rewriting this
+ if (IS_ERR(maybe_current_ev)) {
+ err = PTR_ERR(maybe_current_ev);
+ if (err == -E2BIG) {
+ // Last BSS failed to copy into buffer. As
+ // above, only report an error if `iwlist` will
+ // retry again with a larger buffer.
+ if (len >= 0xFFFF) {
+ err = 0;
+ }
+ }
break;
+ } else {
+ current_ev = maybe_current_ev;
}
to something like
next_ev = ...
if (IS_ERR(next_ev)) {
err = PTR_ERR(next_ev);
/* mask error and truncate in case buffer cannot be
* increased
*/
if (err == -E2BIG && len < U16_MAX)
err = 0;
break;
}
current_ev = next_ev;
could be more readable, but that's just editorial really.
Thanks,
johannes