Message ID | 20240807181427.170515-2-prestwoj@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [01/14] network: add network_bss_list_prune | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
prestwoj/iwd-ci-gitlint | success | GitLint |
Hi James, On 8/7/24 1:14 PM, James Prestwood wrote: > Use this to clear only entires that were not found in the newest > scan results. > --- > src/station.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/station.c b/src/station.c > index e373b03b..2c4d686b 100644 > --- a/src/station.c > +++ b/src/station.c > @@ -943,7 +943,7 @@ void station_set_scan_results(struct station *station, > l_queue_foreach_remove(new_bss_list, bss_free_if_ssid_not_utf8, NULL); > > while ((network = l_queue_pop_head(station->networks_sorted))) > - network_bss_list_clear(network); > + network_bss_list_prune(network, new_bss_list); You're sending the new list without vetting whether the SSID matches the network. That will likely come to haunt you later. > > l_queue_clear(station->hidden_bss_list_sorted, NULL); > Regards, -Denis
Hi Denis, On 8/8/24 7:29 AM, Denis Kenzior wrote: > Hi James, > > On 8/7/24 1:14 PM, James Prestwood wrote: >> Use this to clear only entires that were not found in the newest >> scan results. >> --- >> src/station.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/src/station.c b/src/station.c >> index e373b03b..2c4d686b 100644 >> --- a/src/station.c >> +++ b/src/station.c >> @@ -943,7 +943,7 @@ void station_set_scan_results(struct station >> *station, >> l_queue_foreach_remove(new_bss_list, bss_free_if_ssid_not_utf8, >> NULL); >> while ((network = l_queue_pop_head(station->networks_sorted))) >> - network_bss_list_clear(network); >> + network_bss_list_prune(network, new_bss_list); > > You're sending the new list without vetting whether the SSID matches > the network. That will likely come to haunt you later. Yes, one of several problems with this. Its also ~O(N^2) so with v2 I'll be using a different approach. Slightly more optimized, and fixes the issue you mentioned. > >> l_queue_clear(station->hidden_bss_list_sorted, NULL); > Regards, > -Denis
diff --git a/src/station.c b/src/station.c index e373b03b..2c4d686b 100644 --- a/src/station.c +++ b/src/station.c @@ -943,7 +943,7 @@ void station_set_scan_results(struct station *station, l_queue_foreach_remove(new_bss_list, bss_free_if_ssid_not_utf8, NULL); while ((network = l_queue_pop_head(station->networks_sorted))) - network_bss_list_clear(network); + network_bss_list_prune(network, new_bss_list); l_queue_clear(station->hidden_bss_list_sorted, NULL);