From e4a76018fdb1550f95dba6641df9e75c4840d390 Mon Sep 17 00:00:00 2001 From: Tim Kourt Date: Thu, 15 Nov 2018 12:54:24 -0800 Subject: [PATCH] scan: Make periodic scan optional --- src/scan.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/scan.c b/src/scan.c index 065df944..913058eb 100644 --- a/src/scan.c +++ b/src/scan.c @@ -2,7 +2,7 @@ * * Wireless daemon for Linux * - * Copyright (C) 2015 Intel Corporation. All rights reserved. + * Copyright (C) 2015-2018 Intel Corporation. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -654,11 +654,26 @@ static bool scan_periodic_send_start(struct scan_context *sc) return true; } +static bool scan_periodic_is_disabled(void) +{ + const struct l_settings *config = iwd_get_config(); + bool disabled; + + if (!l_settings_get_bool(config, "Scan", "disable_periodic_scan", + &disabled)) + return false; + + return disabled; +} + void scan_periodic_start(uint32_t ifindex, scan_trigger_func_t trigger, scan_notify_func_t func, void *userdata) { struct scan_context *sc; + if (scan_periodic_is_disabled()) + return; + sc = l_queue_find(scan_contexts, scan_context_match, L_UINT_TO_PTR(ifindex));