@@ -31,9 +31,6 @@ LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL);
3131#include "wpa_supp_if.h"
3232#include "net_if.h"
3333
34- extern char * net_sprint_ll_addr_buf (const uint8_t * ll , uint8_t ll_len ,
35- char * buf , int buflen );
36-
3734#ifdef CONFIG_NRF70_STA_MODE
3835static struct net_if_mcast_monitor mcast_monitor ;
3936#endif /* CONFIG_NRF70_STA_MODE */
@@ -391,6 +388,7 @@ int nrf_wifi_if_send(const struct device *dev,
391388 bool locked = false;
392389 unsigned char * ra = NULL ;
393390 int peer_id = -1 ;
391+ bool authorized ;
394392
395393 if (!dev || !pkt ) {
396394 LOG_ERR ("%s: vif_ctx_zep is NULL" , __func__ );
@@ -443,13 +441,28 @@ int nrf_wifi_if_send(const struct device *dev,
443441 ra = nrf_wifi_util_get_ra (sys_dev_ctx -> vif_ctx [vif_ctx_zep -> vif_idx ], nbuf );
444442 peer_id = nrf_wifi_fmac_peer_get_id (rpu_ctx_zep -> rpu_ctx , ra );
445443 if (peer_id == -1 ) {
446- nrf_wifi_osal_log_dbg ("%s: Invalid peer" ,
447- __func__ );
448- goto out ;
444+ /* TODO: Make this an error once we fix ping_work sending packets despite
445+ * the interface being dormant
446+ */
447+ #if CONFIG_WIFI_NRF70_LOG_LEVEL >= LOG_LEVEL_DBG
448+ char ra_buf [18 ] = {0 };
449+
450+ LOG_DBG ("%s: Got packet for unknown PEER: %s" , __func__ ,
451+ nrf_wifi_sprint_ll_addr_buf (ra , 6 , ra_buf ,
452+ sizeof (ra_buf )));
453+ #endif
454+ goto drop ;
455+ }
456+
457+ /* VIF or per-peer depending on RA */
458+ if (peer_id == MAX_PEERS ) {
459+ authorized = vif_ctx_zep -> authorized ;
460+ } else {
461+ authorized = sys_dev_ctx -> tx_config .peers [peer_id ].authorized ;
449462 }
450463
451464 if ((vif_ctx_zep -> if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON ) ||
452- (!sys_dev_ctx -> tx_config . peers [ peer_id ]. authorized && !is_eapol (pkt ))) {
465+ (!authorized && !is_eapol (pkt ))) {
453466 ret = - EPERM ;
454467 goto drop ;
455468 }
@@ -495,7 +508,6 @@ static void ip_maddr_event_handler(struct net_if *iface,
495508 struct net_eth_addr mac_addr ;
496509 struct nrf_wifi_umac_mcast_cfg * mcast_info = NULL ;
497510 enum nrf_wifi_status status ;
498- uint8_t mac_string_buf [sizeof ("xx:xx:xx:xx:xx:xx" )];
499511 struct nrf_wifi_ctx_zep * rpu_ctx_zep = NULL ;
500512 int ret ;
501513
@@ -551,12 +563,15 @@ static void ip_maddr_event_handler(struct net_if *iface,
551563 vif_ctx_zep -> vif_idx ,
552564 mcast_info );
553565 if (status == NRF_WIFI_STATUS_FAIL ) {
566+ char mac_string_buf [sizeof ("xx:xx:xx:xx:xx:xx" )];
567+
554568 LOG_ERR ("%s: nrf_wifi_fmac_set_multicast failed for"
555569 " mac addr=%s" ,
556570 __func__ ,
557- net_sprint_ll_addr_buf (mac_addr .addr ,
558- WIFI_MAC_ADDR_LEN , mac_string_buf ,
559- sizeof (mac_string_buf )));
571+ nrf_wifi_sprint_ll_addr_buf (mac_addr .addr ,
572+ WIFI_MAC_ADDR_LEN ,
573+ mac_string_buf ,
574+ sizeof (mac_string_buf )));
560575 }
561576unlock :
562577 nrf_wifi_osal_mem_free (mcast_info );
0 commit comments