Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmake/protobuf.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
message(STATUS "Fetching protobufs ...")
FetchContent_Declare(
Protobuf
GIT_REPOSITORY "https://github.com/meshtastic/protobufs"
GIT_TAG v2.7.8
GIT_REPOSITORY "https://github.com/RCGV1/protobufs-fork"
# Packet authenticity policy and XEdDSA capability from protobufs#983.
GIT_TAG 19ab2d2711050cb462f0f57507f75b47bfa6832c
)
FetchContent_MakeAvailable(Protobuf)
Binary file added docs/validation/packet-auth/confirm-strict.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/validation/packet-auth/dropdown-open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/validation/packet-auth/modal-balanced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 83 additions & 1 deletion generated/ui_240x320/ui_tabview_settings.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#include "ui.h"
#include "graphics/view/TFT/PacketAuthUI.h"
#include "lv_i18n.h"
#include "styles.h"

lv_obj_t *ui_PacketAuthButton;
lv_obj_t *ui_PacketAuthLabel;
lv_obj_t *ui_PacketAuthPanel;
lv_obj_t *ui_PacketAuthDropdown;
lv_obj_t *ui_PacketAuthDescription;
lv_obj_t *ui_PacketAuthWarning;
lv_obj_t *ui_PacketAuthOkButton;
lv_obj_t *ui_PacketAuthOkLabel;
lv_obj_t *ui_PacketAuthCancelButton;

lv_obj_t * ui_AdvancedSettingsPanel;
lv_obj_t * ui_SettingsTabView;
Expand Down Expand Up @@ -747,4 +760,73 @@ void create_tabview_settings()
lv_obj_set_align(ui_RemoteHardwareLabel, LV_ALIGN_LEFT_MID);
lv_label_set_long_mode(ui_RemoteHardwareLabel, LV_LABEL_LONG_DOT);
lv_label_set_text(ui_RemoteHardwareLabel, "Remote Hardware");
}

ui_PacketAuthButton = lv_btn_create(objects.tab_page_basic_settings);
lv_obj_set_size(ui_PacketAuthButton, lv_pct(95), 30);
lv_obj_add_flag(ui_PacketAuthButton, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_SCROLL_ON_FOCUS);
add_style_settings_button_style(ui_PacketAuthButton);
lv_obj_set_style_shadow_width(ui_PacketAuthButton, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_PacketAuthLabel = lv_label_create(ui_PacketAuthButton);
lv_obj_set_width(ui_PacketAuthLabel, lv_pct(100));
lv_label_set_long_mode(ui_PacketAuthLabel, LV_LABEL_LONG_DOT);
lv_label_set_text(ui_PacketAuthLabel, _("Packet authenticity: Balanced"));
lv_obj_set_style_align(ui_PacketAuthLabel, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);

ui_PacketAuthPanel = lv_obj_create(objects.main_screen);
// Keep enough vertical room for the expanded selector, wrapped copy, and
// actions. 236px fits the 240px landscape display with a small margin.
lv_obj_set_size(ui_PacketAuthPanel, lv_pct(90), 236);
lv_obj_set_style_align(ui_PacketAuthPanel, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_flag(ui_PacketAuthPanel, LV_OBJ_FLAG_HIDDEN);
lv_obj_clear_flag(ui_PacketAuthPanel, LV_OBJ_FLAG_SCROLLABLE);
add_style_settings_panel_style(ui_PacketAuthPanel);
lv_obj_set_style_border_width(ui_PacketAuthPanel, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_color(ui_PacketAuthPanel, lv_color_hex(0x216ad8), LV_PART_MAIN | LV_STATE_DEFAULT);
// This is a modal settings panel; keep the form beneath it from bleeding through its text.
lv_obj_set_style_bg_opa(ui_PacketAuthPanel, LV_OPA_COVER, LV_PART_MAIN | LV_STATE_DEFAULT);

lv_obj_t *title = lv_label_create(ui_PacketAuthPanel);
lv_label_set_text(title, _("Packet authenticity"));
lv_obj_set_style_align(title, LV_ALIGN_TOP_MID, LV_PART_MAIN | LV_STATE_DEFAULT);

ui_PacketAuthDropdown = lv_dropdown_create(ui_PacketAuthPanel);
lv_dropdown_set_options(ui_PacketAuthDropdown, _("Balanced\nCompatible\nStrict"));
lv_obj_set_pos(ui_PacketAuthDropdown, 0, 25);
lv_obj_set_size(ui_PacketAuthDropdown, lv_pct(100), 30);
// The default theme adds generous line spacing, causing the list to
// cover the description and action buttons. Compact the list so all
// three choices stay inside the modal's reserved selector area.
lv_obj_t *packetAuthList = lv_dropdown_get_list(ui_PacketAuthDropdown);
lv_obj_set_style_text_line_space(packetAuthList, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(packetAuthList, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(packetAuthList, 2, LV_PART_MAIN | LV_STATE_DEFAULT);

ui_PacketAuthDescription = lv_label_create(ui_PacketAuthPanel);
// Leave the selector's expanded list clear of the explanatory copy.
lv_obj_set_pos(ui_PacketAuthDescription, 0, 112);
lv_obj_set_width(ui_PacketAuthDescription, lv_pct(100));
lv_label_set_long_mode(ui_PacketAuthDescription, LV_LABEL_LONG_WRAP);
lv_label_set_text(ui_PacketAuthDescription, _("Prefer signed packets (recommended)."));

ui_PacketAuthWarning = lv_label_create(ui_PacketAuthPanel);
lv_obj_set_pos(ui_PacketAuthWarning, 0, 98);
lv_obj_set_width(ui_PacketAuthWarning, lv_pct(100));
lv_label_set_long_mode(ui_PacketAuthWarning, LV_LABEL_LONG_WRAP);
lv_label_set_text(ui_PacketAuthWarning, _("Unsigned broadcasts filtered."));
lv_obj_set_style_text_color(ui_PacketAuthWarning, lv_color_hex(0xeb533f), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_flag(ui_PacketAuthWarning, LV_OBJ_FLAG_HIDDEN);

ui_PacketAuthOkButton = lv_btn_create(ui_PacketAuthPanel);
lv_obj_set_size(ui_PacketAuthOkButton, lv_pct(47), 30);
lv_obj_set_style_align(ui_PacketAuthOkButton, LV_ALIGN_BOTTOM_LEFT, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_PacketAuthOkLabel = lv_label_create(ui_PacketAuthOkButton);
lv_label_set_text(ui_PacketAuthOkLabel, _("Save"));
lv_obj_center(ui_PacketAuthOkLabel);

ui_PacketAuthCancelButton = lv_btn_create(ui_PacketAuthPanel);
lv_obj_set_size(ui_PacketAuthCancelButton, lv_pct(47), 30);
lv_obj_set_style_align(ui_PacketAuthCancelButton, LV_ALIGN_BOTTOM_RIGHT, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_t *cancelLabel = lv_label_create(ui_PacketAuthCancelButton);
lv_label_set_text(cancelLabel, _("Cancel"));
lv_obj_center(cancelLabel);
}
84 changes: 83 additions & 1 deletion generated/ui_320x240/ui_tabview_settings.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#include "ui.h"
#include "graphics/view/TFT/PacketAuthUI.h"
#include "lv_i18n.h"
#include "styles.h"

lv_obj_t *ui_PacketAuthButton;
lv_obj_t *ui_PacketAuthLabel;
lv_obj_t *ui_PacketAuthPanel;
lv_obj_t *ui_PacketAuthDropdown;
lv_obj_t *ui_PacketAuthDescription;
lv_obj_t *ui_PacketAuthWarning;
lv_obj_t *ui_PacketAuthOkButton;
lv_obj_t *ui_PacketAuthOkLabel;
lv_obj_t *ui_PacketAuthCancelButton;

lv_obj_t * ui_AdvancedSettingsPanel;
lv_obj_t * ui_SettingsTabView;
Expand Down Expand Up @@ -747,4 +760,73 @@ void create_tabview_settings()
lv_obj_set_align(ui_RemoteHardwareLabel, LV_ALIGN_LEFT_MID);
lv_label_set_long_mode(ui_RemoteHardwareLabel, LV_LABEL_LONG_DOT);
lv_label_set_text(ui_RemoteHardwareLabel, "Remote Hardware");
}

ui_PacketAuthButton = lv_btn_create(objects.tab_page_basic_settings);
lv_obj_set_size(ui_PacketAuthButton, lv_pct(95), 30);
lv_obj_add_flag(ui_PacketAuthButton, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_SCROLL_ON_FOCUS);
add_style_settings_button_style(ui_PacketAuthButton);
lv_obj_set_style_shadow_width(ui_PacketAuthButton, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_PacketAuthLabel = lv_label_create(ui_PacketAuthButton);
lv_obj_set_width(ui_PacketAuthLabel, lv_pct(100));
lv_label_set_long_mode(ui_PacketAuthLabel, LV_LABEL_LONG_DOT);
lv_label_set_text(ui_PacketAuthLabel, _("Packet authenticity: Balanced"));
lv_obj_set_style_align(ui_PacketAuthLabel, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);

ui_PacketAuthPanel = lv_obj_create(objects.main_screen);
// Keep enough vertical room for the expanded selector, wrapped copy, and
// actions. 236px fits the 240px landscape display with a small margin.
lv_obj_set_size(ui_PacketAuthPanel, lv_pct(90), 236);
lv_obj_set_style_align(ui_PacketAuthPanel, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_flag(ui_PacketAuthPanel, LV_OBJ_FLAG_HIDDEN);
lv_obj_clear_flag(ui_PacketAuthPanel, LV_OBJ_FLAG_SCROLLABLE);
add_style_settings_panel_style(ui_PacketAuthPanel);
lv_obj_set_style_border_width(ui_PacketAuthPanel, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_color(ui_PacketAuthPanel, lv_color_hex(0x216ad8), LV_PART_MAIN | LV_STATE_DEFAULT);
// This is a modal settings panel; keep the form beneath it from bleeding through its text.
lv_obj_set_style_bg_opa(ui_PacketAuthPanel, LV_OPA_COVER, LV_PART_MAIN | LV_STATE_DEFAULT);

lv_obj_t *title = lv_label_create(ui_PacketAuthPanel);
lv_label_set_text(title, _("Packet authenticity"));
lv_obj_set_style_align(title, LV_ALIGN_TOP_MID, LV_PART_MAIN | LV_STATE_DEFAULT);

ui_PacketAuthDropdown = lv_dropdown_create(ui_PacketAuthPanel);
lv_dropdown_set_options(ui_PacketAuthDropdown, _("Balanced\nCompatible\nStrict"));
lv_obj_set_pos(ui_PacketAuthDropdown, 0, 25);
lv_obj_set_size(ui_PacketAuthDropdown, lv_pct(100), 30);
// The default theme adds generous line spacing, causing the list to
// cover the description and action buttons. Compact the list so all
// three choices stay inside the modal's reserved selector area.
lv_obj_t *packetAuthList = lv_dropdown_get_list(ui_PacketAuthDropdown);
lv_obj_set_style_text_line_space(packetAuthList, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(packetAuthList, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(packetAuthList, 2, LV_PART_MAIN | LV_STATE_DEFAULT);

ui_PacketAuthDescription = lv_label_create(ui_PacketAuthPanel);
// Leave the selector's expanded list clear of the explanatory copy.
lv_obj_set_pos(ui_PacketAuthDescription, 0, 112);
lv_obj_set_width(ui_PacketAuthDescription, lv_pct(100));
lv_label_set_long_mode(ui_PacketAuthDescription, LV_LABEL_LONG_WRAP);
lv_label_set_text(ui_PacketAuthDescription, _("Prefer signed packets (recommended)."));

ui_PacketAuthWarning = lv_label_create(ui_PacketAuthPanel);
lv_obj_set_pos(ui_PacketAuthWarning, 0, 98);
lv_obj_set_width(ui_PacketAuthWarning, lv_pct(100));
lv_label_set_long_mode(ui_PacketAuthWarning, LV_LABEL_LONG_WRAP);
lv_label_set_text(ui_PacketAuthWarning, _("Unsigned broadcasts filtered."));
lv_obj_set_style_text_color(ui_PacketAuthWarning, lv_color_hex(0xeb533f), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_flag(ui_PacketAuthWarning, LV_OBJ_FLAG_HIDDEN);

ui_PacketAuthOkButton = lv_btn_create(ui_PacketAuthPanel);
lv_obj_set_size(ui_PacketAuthOkButton, lv_pct(47), 30);
lv_obj_set_style_align(ui_PacketAuthOkButton, LV_ALIGN_BOTTOM_LEFT, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_PacketAuthOkLabel = lv_label_create(ui_PacketAuthOkButton);
lv_label_set_text(ui_PacketAuthOkLabel, _("Save"));
lv_obj_center(ui_PacketAuthOkLabel);

ui_PacketAuthCancelButton = lv_btn_create(ui_PacketAuthPanel);
lv_obj_set_size(ui_PacketAuthCancelButton, lv_pct(47), 30);
lv_obj_set_style_align(ui_PacketAuthCancelButton, LV_ALIGN_BOTTOM_RIGHT, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_t *cancelLabel = lv_label_create(ui_PacketAuthCancelButton);
lv_label_set_text(cancelLabel, _("Cancel"));
lv_obj_center(cancelLabel);
}
2 changes: 1 addition & 1 deletion include/graphics/common/MeshtasticView.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class MeshtasticView : public DeviceGUI
virtual bool setupUIConfig(const meshtastic_DeviceUIConfig &uiconfig) { return true; }
virtual void setMyInfo(uint32_t nodeNum);
virtual void setDeviceMetaData(int hw_model, const char *version, bool has_bluetooth, bool has_wifi, bool has_eth,
bool can_shutdown);
bool can_shutdown, bool has_xeddsa);
virtual void addOrUpdateNode(uint32_t nodeNum, uint8_t channel, uint32_t lastHeard, eRole role, bool hasKey, bool viaMqtt);
virtual void addOrUpdateNode(uint32_t nodeNum, uint8_t channel, uint32_t lastHeard, const meshtastic_User &cfg);
virtual void addNode(uint32_t nodeNum, uint8_t channel, const char *userShort, const char *userLong, uint32_t lastHeard,
Expand Down
40 changes: 40 additions & 0 deletions include/graphics/view/TFT/PacketAuthPolicy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#pragma once

#include <stdint.h>

namespace PacketAuthPolicy
{
enum class Selection : uint8_t {
Balanced = 0,
Compatible = 1,
Strict = 2,
};

constexpr Selection fromWireValue(uint32_t value)
{
return value <= static_cast<uint32_t>(Selection::Strict) ? static_cast<Selection>(value) : Selection::Balanced;
}

constexpr uint32_t toWireValue(Selection selection)
{
return static_cast<uint32_t>(selection);
}

constexpr bool requiresStrictConfirmation(Selection current, Selection requested)
{
return requested == Selection::Strict && current != Selection::Strict;
}

constexpr const char *label(Selection selection)
{
switch (selection) {
case Selection::Compatible:
return "Compatible";
case Selection::Strict:
return "Strict";
case Selection::Balanced:
default:
return "Balanced";
}
}
} // namespace PacketAuthPolicy
21 changes: 21 additions & 0 deletions include/graphics/view/TFT/PacketAuthUI.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

#include "lvgl.h"

#ifdef __cplusplus
extern "C" {
#endif

extern lv_obj_t *ui_PacketAuthButton;
extern lv_obj_t *ui_PacketAuthLabel;
extern lv_obj_t *ui_PacketAuthPanel;
extern lv_obj_t *ui_PacketAuthDropdown;
extern lv_obj_t *ui_PacketAuthDescription;
extern lv_obj_t *ui_PacketAuthWarning;
extern lv_obj_t *ui_PacketAuthOkButton;
extern lv_obj_t *ui_PacketAuthOkLabel;
extern lv_obj_t *ui_PacketAuthCancelButton;

#ifdef __cplusplus
}
#endif
15 changes: 12 additions & 3 deletions include/graphics/view/TFT/TFTView_320x240.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class TFTView_320x240 : public MeshtasticView

// methods to update view
void setMyInfo(uint32_t nodeNum) override;
void setDeviceMetaData(int hw_model, const char *version, bool has_bluetooth, bool has_wifi, bool has_eth,
bool can_shutdown) override;
void setDeviceMetaData(int hw_model, const char *version, bool has_bluetooth, bool has_wifi, bool has_eth, bool can_shutdown,
bool has_xeddsa) override;
void addOrUpdateNode(uint32_t nodeNum, uint8_t channel, uint32_t lastHeard, const meshtastic_User &cfg) override;
void addNode(uint32_t nodeNum, uint8_t channel, const char *userShort, const char *userLong, uint32_t lastHeard, eRole role,
bool hasKey, bool unmessagable) override;
Expand Down Expand Up @@ -98,6 +98,7 @@ class TFTView_320x240 : public MeshtasticView
eLanguage,
eScreenTimeout,
eScreenLock,
ePacketAuthPolicy,
eScreenBrightness,
eTheme,
eInputControl,
Expand Down Expand Up @@ -255,6 +256,8 @@ class TFTView_320x240 : public MeshtasticView
void clearChatHistory(void);
void showLoRaFrequency(const meshtastic_Config_LoRaConfig &cfg);
void setBellText(bool banner, bool sound);
void updatePacketAuthAvailability(void);
void closePacketAuthPanel(void);
void setChannelName(const meshtastic_Channel &ch);
uint32_t timestamp(char *buf, uint32_t time, bool update);
void updateLocationMap(uint32_t objects);
Expand Down Expand Up @@ -322,6 +325,10 @@ class TFTView_320x240 : public MeshtasticView
static void ui_event_calibration_button(lv_event_t *e);
static void ui_event_timeout_button(lv_event_t *e);
static void ui_event_screen_lock_button(lv_event_t *e);
static void ui_event_packet_auth_button(lv_event_t *e);
static void ui_event_packet_auth_dropdown(lv_event_t *e);
static void ui_event_packet_auth_ok(lv_event_t *e);
static void ui_event_packet_auth_cancel(lv_event_t *e);
static void ui_event_input_button(lv_event_t *e);
static void ui_event_alert_button(lv_event_t *e);
static void ui_event_backup_button(lv_event_t *e);
Expand Down Expand Up @@ -421,6 +428,8 @@ class TFTView_320x240 : public MeshtasticView
static uint32_t pinKeys; // number of keys pressed (lock screen)
static bool screenLocked; // screen lock active
static bool screenUnlockRequest; // screen unlock request (via button)
bool hasXeddsa = false; // connected firmware can verify packet signatures
bool strictConfirmationPending = false; // Strict requires a second, explicit confirmation
uint32_t selectedHops; // remember selected choice
bool chooseNodeSignalScanner; // chose a target node for signal scanner
bool chooseNodeTraceRoute; // chose a target node for trace route
Expand All @@ -444,4 +453,4 @@ class TFTView_320x240 : public MeshtasticView
};

meshtastic_DeviceProfile_full db{}; // full copy of the node's configuration db (except nodeinfos) plus ui data
};
};
2 changes: 1 addition & 1 deletion source/comms/ethernet/EthClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool EthClient::connect(void)
{
if (clientStatus != eConnected) {
setConnectionStatus(eConnecting, "Connecting...");
if (client->connect(server, SERVER_PORT)) {
if (client->connect(server, serverPort)) {
ILOG_INFO("EthClient connected!");
setConnectionStatus(eConnected, "Connected!");
} else {
Expand Down
Loading
Loading