mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
mavlink: Check target for mavlink shell
The SERIAL_CONTROL MAVLink message now contains a target_system and target_component field that we should check. Without this we might be answering to a command on the network that is meant for another system.
This commit is contained in:
parent
96101a9c11
commit
88489ae8bd
@ -1 +1 @@
|
||||
Subproject commit f03d91ae932dd718d81f851b584dbd21cffafdd2
|
||||
Subproject commit 5571ffbcd67e19ee6c6301fe13712856906525c2
|
||||
@ -1768,6 +1768,14 @@ MavlinkReceiver::handle_message_serial_control(mavlink_message_t *msg)
|
||||
mavlink_serial_control_t serial_control_mavlink;
|
||||
mavlink_msg_serial_control_decode(msg, &serial_control_mavlink);
|
||||
|
||||
// Check if the message is targeted at us.
|
||||
if ((serial_control_mavlink.target_system != 0 &&
|
||||
mavlink_system.sysid != serial_control_mavlink.target_system) ||
|
||||
(serial_control_mavlink.target_component != 0 &&
|
||||
mavlink_system.compid != serial_control_mavlink.target_component)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// we only support shell commands
|
||||
if (serial_control_mavlink.device != SERIAL_CONTROL_DEV_SHELL
|
||||
|| (serial_control_mavlink.flags & SERIAL_CONTROL_FLAG_REPLY)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user