Skip to content

Commit ac4a76e

Browse files
committed
Fixed promiscuous/sniffer mode
Promiscuous mode was dropping Wi-SUN packets
1 parent ac7c90a commit ac4a76e

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

source/MAC/IEEE802_15_4/mac_mcps_sap.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,11 @@ static void mac_data_interface_frame_handler(mac_pre_parsed_frame_t *buf)
987987
mcps_sap_pre_parsed_frame_buffer_free(buf);
988988
return;
989989
}
990-
//Sniffer Should push here data to stack!!!!
990+
/* push data to stack if sniffer mode is enabled */
991+
if (rf_mac_setup->macProminousMode) {
992+
mac_nap_tun_data_handler(buf, rf_mac_setup);
993+
return;
994+
}
991995
mac_api_t *mac = get_sw_mac_api(rf_mac_setup);
992996
if (!mac || (rf_mac_setup->mac_mlme_scan_resp && buf->fcf_dsn.frametype != MAC_FRAME_BEACON)) {
993997
mcps_sap_pre_parsed_frame_buffer_free(buf);

source/MAC/IEEE802_15_4/mac_pd_sap.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -760,26 +760,23 @@ int8_t mac_pd_sap_data_cb(void *identifier, arm_phy_sap_msg_t *message)
760760
buffer->mac_payload_length -= (buffer->security_aux_header_length + mic_len);
761761
}
762762

763+
//Do not accept command frame with length 0
764+
if (fcf_read.frametype == FC_CMD_FRAME && length == 0) {
765+
goto ERROR_HANDLER;
766+
}
763767

764-
}
765-
//Do not accept commend frame with length 0
766-
if (fcf_read.frametype == FC_CMD_FRAME && length == 0) {
767-
goto ERROR_HANDLER;
768-
}
769-
770-
//Parse IE Elements
771-
if (!mac_header_information_elements_parse(buffer)) {
772-
goto ERROR_HANDLER;
768+
//Parse IE Elements
769+
if (!mac_header_information_elements_parse(buffer)) {
770+
goto ERROR_HANDLER;
771+
}
773772
}
774773

775774
if (!rf_ptr->macProminousMode && buffer->fcf_dsn.frametype == FC_ACK_FRAME) {
776775
if (mac_data_interface_tx_done_by_ack_cb(rf_ptr, buffer)) {
777776
mcps_sap_pre_parsed_frame_buffer_free(buffer);
778777
}
779778
return 0;
780-
781779
} else {
782-
783780
if (mcps_sap_pd_ind(buffer) == 0) {
784781
return 0;
785782
}

0 commit comments

Comments
 (0)