From 2e4848673a387f58e6e42819a62afb0e380aee24 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Sat, 28 May 2016 05:27:11 +0200 Subject: [PATCH] network: Check for duplicates in network_seen It looks like with multiple netdev seeing the same networks we'd create multiple network_info structures for each network. Since the "networks" list (of network_info structs) is global that's probbaly not the intention here. --- src/network.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/network.c b/src/network.c index 1744f6f0..48fa151e 100644 --- a/src/network.c +++ b/src/network.c @@ -104,6 +104,15 @@ bool network_seen(uint32_t type, const char *ssid) struct timespec mtim; int err; struct network_info *info; + struct network_info search; + + search.type = type; + strncpy(search.ssid, ssid, 32); + search.ssid[32] = 0; + + info = l_queue_find(networks, network_info_match, &search); + if (info) + return true; switch(type) { case SECURITY_PSK: