From 7a76385ec9f9f208cfb2706b4f8b1352e69e6fa0 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Tue, 19 Dec 2023 10:08:23 -0800 Subject: [PATCH] knownnetworks: Add UPDATED event If a known network is modified on disk known networks does not have any way of notifying other modules. This will be needed to support a corner case in DPP if a profile exists but is overwritten after DPP configuration. Add this event to known networks and handle it in network.c (though nothing needs to be done in that case). --- src/knownnetworks.c | 4 ++++ src/knownnetworks.h | 1 + src/network.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/knownnetworks.c b/src/knownnetworks.c index d4d50a6f..04ce74ec 100644 --- a/src/knownnetworks.c +++ b/src/knownnetworks.c @@ -468,6 +468,10 @@ void known_network_update(struct network_info *network, known_network_set_autoconnect(network, new->is_autoconnectable); memcpy(&network->config, new, sizeof(struct network_config)); + + WATCHLIST_NOTIFY(&known_network_watches, + known_networks_watch_func_t, + KNOWN_NETWORKS_EVENT_UPDATED, network); } bool known_networks_foreach(known_networks_foreach_func_t function, diff --git a/src/knownnetworks.h b/src/knownnetworks.h index 0a5c9e25..e8ffac0b 100644 --- a/src/knownnetworks.h +++ b/src/knownnetworks.h @@ -35,6 +35,7 @@ struct network_info; enum known_networks_event { KNOWN_NETWORKS_EVENT_ADDED, KNOWN_NETWORKS_EVENT_REMOVED, + KNOWN_NETWORKS_EVENT_UPDATED, }; struct network_info_ops { diff --git a/src/network.c b/src/network.c index 3918ae08..4723334e 100644 --- a/src/network.c +++ b/src/network.c @@ -2033,6 +2033,8 @@ static void known_networks_changed(enum known_networks_event event, case KNOWN_NETWORKS_EVENT_REMOVED: station_foreach(emit_known_network_removed, (void *) info); break; + case KNOWN_NETWORKS_EVENT_UPDATED: + break; } }