From 8ae3d0d0e5b0b4e1518c1382f4948a6e917214c3 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 17 Jun 2020 12:09:30 +1000 Subject: [PATCH 1/2] GCS_MAVLink: don't learn a route to the broadcast component Using a component ID of 0 for your source is invalid according to common.xml However, some clients do use it. This stops us learning a route to that client for the broadcast client for our own system ID. --- libraries/GCS_MAVLink/MAVLink_routing.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libraries/GCS_MAVLink/MAVLink_routing.cpp b/libraries/GCS_MAVLink/MAVLink_routing.cpp index fbfbf46f8782d..90033b7c5fb22 100644 --- a/libraries/GCS_MAVLink/MAVLink_routing.cpp +++ b/libraries/GCS_MAVLink/MAVLink_routing.cpp @@ -266,9 +266,20 @@ bool MAVLink_routing::find_by_mavtype(uint8_t mavtype, uint8_t &sysid, uint8_t & void MAVLink_routing::learn_route(mavlink_channel_t in_channel, const mavlink_message_t &msg) { uint8_t i; - if (msg.sysid == 0 || - (msg.sysid == mavlink_system.sysid && - msg.compid == mavlink_system.compid)) { + if (msg.sysid == 0) { + // don't learn routes to the broadcast system + return; + } + if (msg.sysid == mavlink_system.sysid && + msg.compid == mavlink_system.compid) { + // don't learn routes to ourself. We know where we are. + return; + } + if (msg.sysid == mavlink_system.sysid && + msg.compid == MAV_COMP_ID_ALL) { + // don't learn routes to the broadcast component ID for our + // own system id. We should still broadcast these, but we + // should also process them locally. return; } for (i=0; i Date: Fri, 9 Oct 2020 17:54:44 +1100 Subject: [PATCH 2/2] GCS_MAVLink: process messages sent to broadcast system .... even if we've forwarded them to someone else. --- libraries/GCS_MAVLink/MAVLink_routing.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/GCS_MAVLink/MAVLink_routing.cpp b/libraries/GCS_MAVLink/MAVLink_routing.cpp index 90033b7c5fb22..54d922f81e842 100644 --- a/libraries/GCS_MAVLink/MAVLink_routing.cpp +++ b/libraries/GCS_MAVLink/MAVLink_routing.cpp @@ -177,7 +177,8 @@ bool MAVLink_routing::check_and_forward(mavlink_channel_t in_channel, const mavl } } - if (!forwarded && match_system) { + if ((!forwarded && match_system) || + broadcast_system) { process_locally = true; }