Skip to content

Commit f24623a

Browse files
author
Kimmo Vaisanen
committed
LoRa: Stop processing MAC commands if command id is unknown
The length of a MAC command is not explicitly given and must be implicitly known by the MAC implementation. Therefore unknown MAC commands cannot be skipped and the first unknown MAC command terminates the processing of the MAC command sequence. This commit fixes the bug where MAC command processing was not terminated when unknown MAC command was received.
1 parent 56117a8 commit f24623a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

features/lorawan/lorastack/mac/LoRaMacCommand.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, ui
304304
break;
305305
default:
306306
// Unknown command. ABORT MAC commands processing
307-
ret_value = LORAWAN_STATUS_UNSUPPORTED;
307+
tr_error("Invalid MAC command (0x%X)!", payload[mac_index]);
308+
return LORAWAN_STATUS_UNSUPPORTED;
308309
}
309310
}
310311
return ret_value;

0 commit comments

Comments
 (0)