Skip to content

Commit a301972

Browse files
ben-sembira-1peterbarker
authored andcommitted
GCS_MAVLink: add option to accept unsigned packets on any mavlink connection
1 parent ebc7e13 commit a301972

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

libraries/GCS_MAVLink/GCS.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,14 @@ class GCS_MAVLINK
516516
virtual bool persist_streamrates() const { return false; }
517517
void handle_request_data_stream(const mavlink_message_t &msg);
518518

519+
AP_Int16 options;
520+
enum class Option : uint16_t {
521+
MAVLINK2_SIGNING_DISABLED = (1U << 0),
522+
};
523+
bool option_enabled(Option option) const {
524+
return options & static_cast<uint16_t>(option);
525+
}
526+
519527
virtual void handle_command_ack(const mavlink_message_t &msg);
520528
void handle_set_mode(const mavlink_message_t &msg);
521529
void handle_command_int(const mavlink_message_t &msg);

libraries/GCS_MAVLink/GCS_MAVLink_Parameters.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,18 @@ const AP_Param::GroupInfo GCS_MAVLINK::var_info[] = {
202202
// @RebootRequired: True
203203
// @User: Advanced
204204
AP_GROUPINFO("_ADSB", 10, GCS_MAVLINK, streamRates[GCS_MAVLINK::STREAM_ADSB], DRATE(GCS_MAVLINK::STREAM_ADSB)),
205+
206+
// ------------
207+
// IMPORTANT: Add new stream rates *before* the _OPTIONS parameter.
208+
// ------------
209+
210+
// @Param: _OPTIONS
211+
// @DisplayName: Bitmask for configuring this telemetry channel
212+
// @Description: Bitmask for configuring this telemetry channel. For having effect on all channels, set the relevant mask in all MAVx_OPTIONS parameters. Keep in mind that part of the flags may require a reboot to take action.
213+
// @RebootRequired: True
214+
// @User: Standard
215+
// @Bitmask: 0:Accept unsigned MAVLink2 messages
216+
AP_GROUPINFO("_OPTIONS", 20, GCS_MAVLINK, options, 0),
205217
AP_GROUPEND
206218
};
207219
#undef DRATE

libraries/GCS_MAVLink/GCS_Signing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static bool accept_unsigned_callback(const mavlink_status_t *status, uint32_t ms
133133
void GCS_MAVLINK::load_signing_key(void)
134134
{
135135
struct SigningKey key;
136-
if (!signing_key_load(key)) {
136+
if (option_enabled(Option::MAVLINK2_SIGNING_DISABLED) || !signing_key_load(key)) {
137137
return;
138138
}
139139
memcpy(signing.secret_key, key.secret_key, 32);

0 commit comments

Comments
 (0)