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.
This commit is contained in:
Alvin Šipraga 2021-05-27 16:22:29 +02:00 committed by Denis Kenzior
parent 5eb0b7ca8e
commit 920ac37a40
1 changed files with 13 additions and 0 deletions

View File

@ -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;
}
}