Skip to content

Commit 27290bb

Browse files
author
Hasnain Virk
committed
Adding valid frequency check for RXParamSetup cmd
We must check for a valid value of a frequency being sent by the network server.
1 parent ffb0698 commit 27290bb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ void LoRaMac::on_radio_tx_done(lorawan_time_t timestamp)
666666
_params.timers.aggregated_last_tx_time = timestamp;
667667
}
668668

669-
void LoRaMac::on_radio_rx_done(const uint8_t* const payload, uint16_t size,
669+
void LoRaMac::on_radio_rx_done(const uint8_t *const payload, uint16_t size,
670670
int16_t rssi, int8_t snr)
671671
{
672672
if (_device_class == CLASS_C && !_continuous_rx2_window_open) {

features/lorawan/lorastack/phy/LoRaPHY.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,10 @@ uint8_t LoRaPHY::accept_rx_param_setup_req(rx_param_setup_req_t* params)
10341034
{
10351035
uint8_t status = 0x07;
10361036

1037+
if (lookup_band_for_frequency(params->frequency) < 0) {
1038+
status &= 0xFE;
1039+
}
1040+
10371041
// Verify radio frequency
10381042
if (_radio->check_rf_frequency(params->frequency) == false) {
10391043
status &= 0xFE; // Channel frequency KO

0 commit comments

Comments
 (0)