mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-10 06:39:25 +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:
Submodule mavlink/include/mavlink/v2.0 updated: f03d91ae93...5571ffbcd6
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user