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.
This commit is contained in:
Andrew Zaborowski 2016-05-28 05:27:11 +02:00 committed by Denis Kenzior
parent d53873a254
commit 2e4848673a
1 changed files with 9 additions and 0 deletions

View File

@ -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: