From ccbd32503b540b03fe268eda2ee4c674c78611af Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Wed, 3 Feb 2021 10:02:40 -0600 Subject: [PATCH] scan: Pass the frequencies scanned to notify cb --- src/p2p.c | 2 ++ src/rrm.c | 4 +++- src/scan.c | 21 +++++++++++++-------- src/scan.h | 1 + src/station.c | 17 ++++++++++++----- src/wsc.c | 5 ++++- 6 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/p2p.c b/src/p2p.c index 6932033c..5e091f54 100644 --- a/src/p2p.c +++ b/src/p2p.c @@ -1283,6 +1283,7 @@ static void p2p_scan_destroy(void *user_data) static void p2p_provision_scan_start(struct p2p_device *dev); static bool p2p_provision_scan_notify(int err, struct l_queue *bss_list, + const struct scan_freq_set *freqs, void *user_data) { struct p2p_device *dev = user_data; @@ -3312,6 +3313,7 @@ static bool p2p_peer_update_existing(struct scan_bss *bss, } static bool p2p_scan_notify(int err, struct l_queue *bss_list, + const struct scan_freq_set *freqs, void *user_data) { struct p2p_device *dev = user_data; diff --git a/src/rrm.c b/src/rrm.c index 3cf6b785..1a9ab140 100644 --- a/src/rrm.c +++ b/src/rrm.c @@ -388,7 +388,9 @@ static void rrm_handle_beacon_table(struct rrm_state *rrm, l_error("Error reporting beacon table results"); } -static bool rrm_scan_results(int err, struct l_queue *bss_list, void *userdata) +static bool rrm_scan_results(int err, struct l_queue *bss_list, + const struct scan_freq_set *freqs, + void *userdata) { struct rrm_state *rrm = userdata; struct rrm_beacon_req_info *beacon = l_container_of(rrm->pending, diff --git a/src/scan.c b/src/scan.c index 76be8ba2..e4e69f4a 100644 --- a/src/scan.c +++ b/src/scan.c @@ -160,7 +160,7 @@ static void scan_request_failed(struct scan_context *sc, if (sr->trigger) sr->trigger(err, sr->userdata); else if (sr->callback) - sr->callback(err, NULL, sr->userdata); + sr->callback(err, NULL, NULL, sr->userdata); wiphy_radio_work_done(sc->wiphy, sr->work.id); } @@ -683,6 +683,7 @@ static void scan_periodic_triggered(int err, void *user_data) } static bool scan_periodic_notify(int err, struct l_queue *bss_list, + const struct scan_freq_set *freqs, void *user_data) { struct scan_context *sc = user_data; @@ -690,7 +691,7 @@ static bool scan_periodic_notify(int err, struct l_queue *bss_list, scan_periodic_rearm(sc); if (sc->sp.callback) - return sc->sp.callback(err, bss_list, sc->sp.userdata); + return sc->sp.callback(err, bss_list, freqs, sc->sp.userdata); return false; } @@ -1496,6 +1497,7 @@ static void discover_hidden_network_bsses(struct scan_context *sc, static void scan_finished(struct scan_context *sc, int err, struct l_queue *bss_list, + const struct scan_freq_set *freqs, struct scan_request *sr) { bool new_owner = false; @@ -1509,7 +1511,8 @@ static void scan_finished(struct scan_context *sc, sc->work_started = false; if (sr->callback) - new_owner = sr->callback(err, bss_list, sr->userdata); + new_owner = sr->callback(err, bss_list, + freqs, sr->userdata); /* * Can start a new scan now that we've removed this one from @@ -1520,7 +1523,8 @@ static void scan_finished(struct scan_context *sc, */ wiphy_radio_work_done(sc->wiphy, sr->work.id); } else if (sc->sp.callback) - new_owner = sc->sp.callback(err, bss_list, sc->sp.userdata); + new_owner = sc->sp.callback(err, bss_list, + freqs, sc->sp.userdata); if (bss_list && !new_owner) l_queue_destroy(bss_list, @@ -1537,7 +1541,8 @@ static void get_scan_done(void *user) sc->get_scan_cmd_id = 0; if (l_queue_peek_head(sc->requests) == results->sr) - scan_finished(sc, 0, results->bss_list, results->sr); + scan_finished(sc, 0, results->bss_list, + results->freqs, results->sr); else l_queue_destroy(results->bss_list, (l_queue_destroy_func_t) scan_bss_free); @@ -1652,7 +1657,7 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data) sc->triggered = false; if (!sr->callback) { - scan_finished(sc, -ECANCELED, NULL, sr); + scan_finished(sc, -ECANCELED, NULL, NULL, sr); break; } @@ -1675,7 +1680,7 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data) /* An external scan may have flushed our results */ if (sc->started && scan_parse_flush_flag_from_msg(msg)) - scan_finished(sc, -EAGAIN, NULL, sr); + scan_finished(sc, -EAGAIN, NULL, NULL, sr); else send_next = true; @@ -1739,7 +1744,7 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data) if (sc->triggered) { sc->triggered = false; - scan_finished(sc, -ECANCELED, NULL, sr); + scan_finished(sc, -ECANCELED, NULL, NULL, sr); } else { /* * If this was an external scan that got aborted diff --git a/src/scan.h b/src/scan.h index b44dd36d..2fb677a8 100644 --- a/src/scan.h +++ b/src/scan.h @@ -103,6 +103,7 @@ struct scan_parameters { typedef void (*scan_func_t)(struct l_genl_msg *msg, void *user_data); typedef void (*scan_trigger_func_t)(int, void *); typedef bool (*scan_notify_func_t)(int err, struct l_queue *bss_list, + const struct scan_freq_set *freqs, void *userdata); typedef void (*scan_destroy_func_t)(void *userdata); typedef void (*scan_freq_set_func_t)(uint32_t freq, void *userdata); diff --git a/src/station.c b/src/station.c index df7140c0..370b55f4 100644 --- a/src/station.c +++ b/src/station.c @@ -1016,7 +1016,9 @@ not_supported: return NULL; } -static bool new_scan_results(int err, struct l_queue *bss_list, void *userdata) +static bool new_scan_results(int err, struct l_queue *bss_list, + const struct scan_freq_set *freqs, + void *userdata) { struct station *station = userdata; bool autoconnect; @@ -1082,7 +1084,8 @@ static uint32_t station_scan_trigger(struct station *station, } static bool station_quick_scan_results(int err, struct l_queue *bss_list, - void *userdata) + const struct scan_freq_set *freqs, + void *userdata) { struct station *station = userdata; bool autoconnect; @@ -1676,6 +1679,7 @@ static void station_roam_scan_triggered(int err, void *user_data) } static bool station_roam_scan_notify(int err, struct l_queue *bss_list, + const struct scan_freq_set *freqs, void *userdata) { struct station *station = userdata; @@ -2583,8 +2587,9 @@ static void station_hidden_network_scan_triggered(int err, void *user_data) } static bool station_hidden_network_scan_results(int err, - struct l_queue *bss_list, - void *userdata) + struct l_queue *bss_list, + const struct scan_freq_set *freqs, + void *userdata) { struct station *station = userdata; struct network *network_psk; @@ -2992,7 +2997,9 @@ static void station_dbus_scan_triggered(int err, void *user_data) static bool station_dbus_scan_subset(struct station *station); -static bool station_dbus_scan_results(int err, struct l_queue *bss_list, void *userdata) +static bool station_dbus_scan_results(int err, struct l_queue *bss_list, + const struct scan_freq_set *freqs, + void *userdata) { struct station *station = userdata; unsigned int next_idx = station->dbus_scan_subset_idx + 1; diff --git a/src/wsc.c b/src/wsc.c index 5ba63a64..4811ddef 100644 --- a/src/wsc.c +++ b/src/wsc.c @@ -683,6 +683,7 @@ static void pin_timeout(struct l_timeout *timeout, void *user_data) } static bool push_button_scan_results(int err, struct l_queue *bss_list, + const struct scan_freq_set *freqs, void *userdata) { struct wsc_station_dbus *wsc = userdata; @@ -837,7 +838,9 @@ static bool authorized_macs_contains(const uint8_t *authorized_macs, return false; } -static bool pin_scan_results(int err, struct l_queue *bss_list, void *userdata) +static bool pin_scan_results(int err, struct l_queue *bss_list, + const struct scan_freq_set *freqs, + void *userdata) { static const uint8_t wildcard_address[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };