From 76b34132a5c1df4f6ef82304724b9e723f0dadce Mon Sep 17 00:00:00 2001 From: Oleg Date: Fri, 9 Jul 2021 12:03:07 +0300 Subject: [PATCH] mavlink: fix incorrect rejection of forwarded alien commands --- src/modules/mavlink/mavlink_receiver.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 14d57b362b..38a4c52a5d 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -462,7 +462,11 @@ void MavlinkReceiver::handle_message_command_both(mavlink_message_t *msg, const uint8_t result = vehicle_command_ack_s::VEHICLE_RESULT_ACCEPTED; if (!target_ok) { - acknowledge(msg->sysid, msg->compid, cmd_mavlink.command, vehicle_command_ack_s::VEHICLE_RESULT_FAILED); + if (!_mavlink->get_forwarding_on()) { + // Reject alien commands only if there is no forwarding enabled + acknowledge(msg->sysid, msg->compid, cmd_mavlink.command, vehicle_command_ack_s::VEHICLE_RESULT_FAILED); + } + return; }