From 920ac37a4042e63c88af2a55a2d5e74daee934d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvin=20=C5=A0ipraga?= Date: Thu, 27 May 2021 16:22:29 +0200 Subject: [PATCH] station: update current BSS frequency on netdev channel switch event If the connected BSS changes channel, netdev will emit an event with the new channel's frequency. In response, have station change the frequency of the connected scan_bss struct and inform network about the update. --- src/station.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/station.c b/src/station.c index 553d4cae..83c21b66 100644 --- a/src/station.c +++ b/src/station.c @@ -2316,6 +2316,16 @@ static void station_event_roamed(struct station *station, struct scan_bss *new) station_roamed(station); } +static void station_event_channel_switched(struct station *station, + const uint32_t freq) +{ + struct network *network = station->connected_network; + + station->connected_bss->frequency = freq; + + network_bss_update(network, station->connected_bss); +} + static void station_rssi_level_changed(struct station *station, uint8_t level_idx); @@ -2594,6 +2604,9 @@ static void station_netdev_event(struct netdev *netdev, enum netdev_event event, case NETDEV_EVENT_ROAMED: station_event_roamed(station, (struct scan_bss *) event_data); break; + case NETDEV_EVENT_CHANNEL_SWITCHED: + station_event_channel_switched(station, l_get_u32(event_data)); + break; } }