Skip to content

Commit c9b56de

Browse files
VivekUppundanashif
authored andcommitted
drivers: wifi: nrfwifi: Promiscuous mode filtering support in driver
This set of changes brings in promiscuous mode filtering support in driver. Since, firmware would be unable to filter packets due to connection issues, the filtering support for promiscuous mode is moved to the driver. Signed-off-by: Vivekananda Uppunda <[email protected]>
1 parent 17c15e3 commit c9b56de

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

drivers/wifi/nrfwifi/src/fmac_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
715715
callbk_fns.if_carr_state_chg_callbk_fn = nrf_wifi_if_carr_state_chg;
716716
callbk_fns.rx_frm_callbk_fn = nrf_wifi_if_rx_frm;
717717
#if defined(CONFIG_NRF70_RAW_DATA_RX) || defined(CONFIG_NRF70_PROMISC_DATA_RX)
718-
callbk_fns.rx_sniffer_frm_callbk_fn = nrf_wifi_if_sniffer_rx_frm;
718+
callbk_fns.sniffer_callbk_fn = nrf_wifi_if_sniffer_rx_frm;
719719
#endif /* CONFIG_NRF70_RAW_DATA_RX || CONFIG_NRF70_PROMISC_DATA_RX */
720720
#endif
721721
rx_buf_pools[0].num_bufs = rx1_num_bufs;

drivers/wifi/nrfwifi/src/wifi_mgmt.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,21 @@ int nrf_wifi_filter(const struct device *dev,
935935
def_dev_ctx = wifi_dev_priv(fmac_dev_ctx);
936936

937937
if (filter->oper == WIFI_MGMT_SET) {
938+
/**
939+
* If promiscuous mode is enabled, filter settings
940+
* cannot be plumbed to the lower layers as that might
941+
* affect connectivity. Save the filter settings in the
942+
* driver and filter packet type on packet receive by
943+
* checking the 802.11 header in the packet
944+
*/
945+
if (((def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->mode) &
946+
(NRF_WIFI_PROMISCUOUS_MODE)) == NRF_WIFI_PROMISCUOUS_MODE) {
947+
def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->packet_filter =
948+
filter->filter;
949+
ret = 0;
950+
goto out;
951+
}
952+
938953
/**
939954
* In case a user sets data + management + ctrl bits
940955
* or all the filter bits. Map it to bit 0 set to

0 commit comments

Comments
 (0)