Adding valid frequency check for RXParamSetup cmd

We must check for a valid value of a frequency being sent
by the network server.
pull/7191/head
Hasnain Virk 2018-06-11 15:44:35 +03:00
parent ffb0698ce7
commit 27290bb12f
2 changed files with 5 additions and 1 deletions

View File

@ -666,7 +666,7 @@ void LoRaMac::on_radio_tx_done(lorawan_time_t timestamp)
_params.timers.aggregated_last_tx_time = timestamp; _params.timers.aggregated_last_tx_time = timestamp;
} }
void LoRaMac::on_radio_rx_done(const uint8_t* const payload, uint16_t size, void LoRaMac::on_radio_rx_done(const uint8_t *const payload, uint16_t size,
int16_t rssi, int8_t snr) int16_t rssi, int8_t snr)
{ {
if (_device_class == CLASS_C && !_continuous_rx2_window_open) { if (_device_class == CLASS_C && !_continuous_rx2_window_open) {

View File

@ -1034,6 +1034,10 @@ uint8_t LoRaPHY::accept_rx_param_setup_req(rx_param_setup_req_t* params)
{ {
uint8_t status = 0x07; uint8_t status = 0x07;
if (lookup_band_for_frequency(params->frequency) < 0) {
status &= 0xFE;
}
// Verify radio frequency // Verify radio frequency
if (_radio->check_rf_frequency(params->frequency) == false) { if (_radio->check_rf_frequency(params->frequency) == false) {
status &= 0xFE; // Channel frequency KO status &= 0xFE; // Channel frequency KO