fix: keep feature-complete release builds within flash limits

This commit is contained in:
mikecarper committed 2026-10-20 11:19:27 -07:00
1 parent bc1176c7f4
commit 805dd2cbdf
17 files changed
+735 -300

No files matched your search

+1
View File
@@ -479,6 +479,7 @@ jobs:
python3 -B test/test_common_prefs_uncertain_reply.py -v
python3 -B test/test_common_prefs_apply_reply.py -v
python3 -B test/test_common_prefs_commit.py -v
python3 -B test/test_common_cli_retry_tail.py -v
python3 -B test/test_common_prefs_legacy_rxgain.py -v
python3 -B test/test_flood_policy_capacity.py -v
python3 -B test/test_flood_rule_layout.py -v
+70 -28
View File
@@ -1977,6 +1977,75 @@ static bool writeCommonPrefsImage(Writer& writer, NodePrefs* prefs) {
}
#endif
// This canonical retry/flood span contains no padding. Guard every boundary
// before replacing its field writes with one bounded LittleFS transaction write.
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#endif
template <typename Writer>
static void writeCommonRetryPrefs(Writer& writer, NodePrefs* prefs) {
static_assert(offsetof(NodePrefs, direct_retry_attempts) == offsetof(NodePrefs, retry_preset)
+ sizeof(prefs->retry_preset), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, direct_retry_base_ms) == offsetof(NodePrefs, direct_retry_attempts)
+ sizeof(prefs->direct_retry_attempts), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, direct_retry_step_ms) == offsetof(NodePrefs, direct_retry_base_ms)
+ sizeof(prefs->direct_retry_base_ms), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, direct_retry_snr_margin_x4) == offsetof(NodePrefs, direct_retry_step_ms)
+ sizeof(prefs->direct_retry_step_ms), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, direct_retry_cr4_snr_x4) == offsetof(NodePrefs, direct_retry_snr_margin_x4)
+ sizeof(prefs->direct_retry_snr_margin_x4), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, direct_retry_cr5_snr_x4) == offsetof(NodePrefs, direct_retry_cr4_snr_x4)
+ sizeof(prefs->direct_retry_cr4_snr_x4), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, direct_retry_cr7_snr_x4) == offsetof(NodePrefs, direct_retry_cr5_snr_x4)
+ sizeof(prefs->direct_retry_cr5_snr_x4), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, direct_retry_cr8_snr_x4) == offsetof(NodePrefs, direct_retry_cr7_snr_x4)
+ sizeof(prefs->direct_retry_cr7_snr_x4), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, direct_retry_enabled) == offsetof(NodePrefs, direct_retry_cr8_snr_x4)
+ sizeof(prefs->direct_retry_cr8_snr_x4), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, direct_retry_cr_enabled) == offsetof(NodePrefs, direct_retry_enabled)
+ sizeof(prefs->direct_retry_enabled), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, direct_retry_prefs_magic) == offsetof(NodePrefs, direct_retry_cr_enabled)
+ sizeof(prefs->direct_retry_cr_enabled), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, flood_retry_attempts) == offsetof(NodePrefs, direct_retry_prefs_magic)
+ sizeof(prefs->direct_retry_prefs_magic), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, flood_retry_max_path) == offsetof(NodePrefs, flood_retry_attempts)
+ sizeof(prefs->flood_retry_attempts), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, flood_retry_prefixes) == offsetof(NodePrefs, flood_retry_max_path)
+ sizeof(prefs->flood_retry_max_path), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, flood_retry_bridge_enabled) == offsetof(NodePrefs, flood_retry_prefixes)
+ sizeof(prefs->flood_retry_prefixes), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, flood_retry_bridge_buckets) == offsetof(NodePrefs, flood_retry_bridge_enabled)
+ sizeof(prefs->flood_retry_bridge_enabled), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, flood_retry_ignore_prefixes) == offsetof(NodePrefs, flood_retry_bridge_buckets)
+ sizeof(prefs->flood_retry_bridge_buckets), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, flood_retry_advert_enabled) == offsetof(NodePrefs, flood_retry_ignore_prefixes)
+ sizeof(prefs->flood_retry_ignore_prefixes), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, battery_alert_enabled) == offsetof(NodePrefs, flood_retry_advert_enabled)
+ sizeof(prefs->flood_retry_advert_enabled), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, battery_alert_low_percent) == offsetof(NodePrefs, battery_alert_enabled)
+ sizeof(prefs->battery_alert_enabled), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, battery_alert_critical_percent) == offsetof(NodePrefs, battery_alert_low_percent)
+ sizeof(prefs->battery_alert_low_percent), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, direct_retry_recent_enabled) == offsetof(NodePrefs, battery_alert_critical_percent)
+ sizeof(prefs->battery_alert_critical_percent), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, flood_channel_data_enabled) == offsetof(NodePrefs, direct_retry_recent_enabled)
+ sizeof(prefs->direct_retry_recent_enabled), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, legacy_flood_channel_block_max_hops) == offsetof(NodePrefs, flood_channel_data_enabled)
+ sizeof(prefs->flood_channel_data_enabled), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, flood_channel_data_max_hops) == offsetof(NodePrefs, legacy_flood_channel_block_max_hops)
+ sizeof(prefs->legacy_flood_channel_block_max_hops), "Common preference retry tail has padding or changed order");
static_assert(offsetof(NodePrefs, telemetry_access) == offsetof(NodePrefs, flood_channel_data_max_hops)
+ sizeof(prefs->flood_channel_data_max_hops), "Common preference retry tail has padding or changed order");
constexpr size_t first = offsetof(NodePrefs, retry_preset);
constexpr size_t size = offsetof(NodePrefs, telemetry_access)
+ sizeof(prefs->telemetry_access) - first;
writer.write(reinterpret_cast<const uint8_t*>(prefs) + first, size);
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
void CommonCLI::savePrefs(FILESYSTEM* fs, PrefsSaveRouting::Scope scope) {
const PrefsSaveRouting::Plan plan = PrefsSaveRouting::planFor(scope);
if (plan.common) {
@@ -2066,34 +2135,7 @@ void CommonCLI::savePrefs(FILESYSTEM* fs, PrefsSaveRouting::Scope scope) {
file.write((uint8_t *)&_prefs->cad_enabled, sizeof(_prefs->cad_enabled)); // 294
// next: 295
markDirectRetryPrefsValid(_prefs);
file.write((uint8_t *)&_prefs->retry_preset, sizeof(_prefs->retry_preset)); // 295
file.write((uint8_t *)&_prefs->direct_retry_attempts, sizeof(_prefs->direct_retry_attempts)); // 296
file.write((uint8_t *)&_prefs->direct_retry_base_ms, sizeof(_prefs->direct_retry_base_ms)); // 297
file.write((uint8_t *)&_prefs->direct_retry_step_ms, sizeof(_prefs->direct_retry_step_ms)); // 299
file.write((uint8_t *)&_prefs->direct_retry_snr_margin_x4, sizeof(_prefs->direct_retry_snr_margin_x4)); // 301
file.write((uint8_t *)&_prefs->direct_retry_cr4_snr_x4, sizeof(_prefs->direct_retry_cr4_snr_x4)); // 303
file.write((uint8_t *)&_prefs->direct_retry_cr5_snr_x4, sizeof(_prefs->direct_retry_cr5_snr_x4)); // 304
file.write((uint8_t *)&_prefs->direct_retry_cr7_snr_x4, sizeof(_prefs->direct_retry_cr7_snr_x4)); // 305
file.write((uint8_t *)&_prefs->direct_retry_cr8_snr_x4, sizeof(_prefs->direct_retry_cr8_snr_x4)); // 306
file.write((uint8_t *)&_prefs->direct_retry_enabled, sizeof(_prefs->direct_retry_enabled)); // 307
file.write((uint8_t *)&_prefs->direct_retry_cr_enabled, sizeof(_prefs->direct_retry_cr_enabled)); // 308
file.write((uint8_t *)&_prefs->direct_retry_prefs_magic, sizeof(_prefs->direct_retry_prefs_magic)); // 309
file.write((uint8_t *)&_prefs->flood_retry_attempts, sizeof(_prefs->flood_retry_attempts)); // 311
file.write((uint8_t *)&_prefs->flood_retry_max_path, sizeof(_prefs->flood_retry_max_path)); // 312
file.write((uint8_t *)&_prefs->flood_retry_prefixes[0][0], sizeof(_prefs->flood_retry_prefixes)); // 313
file.write((uint8_t *)&_prefs->flood_retry_bridge_enabled, sizeof(_prefs->flood_retry_bridge_enabled));
file.write((uint8_t *)&_prefs->flood_retry_bridge_buckets[0][0][0], sizeof(_prefs->flood_retry_bridge_buckets));
file.write((uint8_t *)&_prefs->flood_retry_ignore_prefixes[0][0], sizeof(_prefs->flood_retry_ignore_prefixes));
file.write((uint8_t *)&_prefs->flood_retry_advert_enabled, sizeof(_prefs->flood_retry_advert_enabled));
file.write((uint8_t *)&_prefs->battery_alert_enabled, sizeof(_prefs->battery_alert_enabled));
file.write((uint8_t *)&_prefs->battery_alert_low_percent, sizeof(_prefs->battery_alert_low_percent));
file.write((uint8_t *)&_prefs->battery_alert_critical_percent, sizeof(_prefs->battery_alert_critical_percent));
file.write((uint8_t *)&_prefs->direct_retry_recent_enabled, sizeof(_prefs->direct_retry_recent_enabled));
file.write((uint8_t *)&_prefs->flood_channel_data_enabled, sizeof(_prefs->flood_channel_data_enabled));
file.write((uint8_t *)&_prefs->legacy_flood_channel_block_max_hops,
sizeof(_prefs->legacy_flood_channel_block_max_hops));
file.write((uint8_t *)&_prefs->flood_channel_data_max_hops, sizeof(_prefs->flood_channel_data_max_hops));
file.write((uint8_t *)&_prefs->telemetry_access, sizeof(_prefs->telemetry_access)); // 674
writeCommonRetryPrefs(file, _prefs); // Same canonical retry/flood bytes; no file-format change.
#if defined(ENABLE_OTA)
file.write((uint8_t *)&_prefs->ota_autofetch, sizeof(_prefs->ota_autofetch)); // 675
file.write((uint8_t *)&_prefs->ota_autoinstall, sizeof(_prefs->ota_autoinstall)); // 676
+44 -46
View File
@@ -15,93 +15,91 @@ FILESYSTEM* settings_fs = nullptr;
const char* const path = "/leds_v1";
const char* const backup = "/leds_v1.bak";
void encode(bool on, uint8_t (&data)[8]) {
const uint8_t value = on ? 1 : 0;
const uint8_t image[] = {'L', 'E', 'D', 1, value,
static_cast<uint8_t>(value ^ 0xff), 0, 0};
memcpy(data, image, sizeof(data));
}
const uint8_t images[2][8] = {
{'L', 'E', 'D', 1, 0, 0xff, 0, 0},
{'L', 'E', 'D', 1, 1, 0xfe, 0, 0}};
bool readSetting(const char* name, bool& on) {
if (!settings_fs) return false;
// Return the saved value, or -1 for an absent or invalid image. Comparing the
// two canonical images shares the write format without a second encoder.
int readSetting(const char* name) {
if (!settings_fs) return -1;
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
File file(*settings_fs);
if (!file.open(name, FILE_O_READ)) return false;
if (!file.open(name, FILE_O_READ)) return -1;
#else
File file = settings_fs->open(name, "r");
if (!file) return false;
if (!file) return -1;
#endif
uint8_t data[8], expected[8];
uint8_t data[8];
const bool complete = file.size() == sizeof(data)
&& file.read(data, sizeof(data)) == sizeof(data);
file.close();
if (!complete || data[4] > 1) return false;
encode(data[4] != 0, expected);
if (memcmp(data, expected, sizeof(data)) != 0) return false;
on = data[4] != 0;
return true;
if (!complete || data[4] > 1
|| memcmp(data, images[data[4]], sizeof(data)) != 0) return -1;
return data[4];
}
bool saveSetting(bool on) {
if (!settings_fs) return false;
uint8_t data[8];
encode(on, data);
const uint8_t* data = images[on ? 1 : 0];
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
AtomicFileWriter file(settings_fs, path);
#else
ContactFileTransaction file(settings_fs, path);
#endif
if (!file || file.write(data, sizeof(data)) != sizeof(data) || !file.commit())
if (!file || file.write(data, sizeof(images[0])) != sizeof(images[0]) || !file.commit())
return false;
bool checked = !on;
return readSetting(path, checked) && checked == on;
return readSetting(path) == int(on);
}
} // namespace
void beginSettings(MainBoard& board, FILESYSTEM* fs) {
main_board = &board;
settings_fs = fs;
bool on = true;
if (!readSetting(path, on) && readSetting(backup, on)) {
int setting = readSetting(path);
if (setting < 0 && (setting = readSetting(backup)) >= 0) {
// Recover the rename gap without discarding the last complete preference.
if ((!fs->exists(path) || fs->remove(path)) && fs->rename(backup, path)) {
bool checked = !on;
if (!readSetting(path, checked) || checked != on) settings_fs = nullptr;
if (readSetting(path) != setting) settings_fs = nullptr;
} else {
settings_fs = nullptr;
}
}
setEnabled(on);
setEnabled(setting != 0);
board.applyLedPolicy();
applyStatusPolicy();
}
// Keep the uncommon filesystem transaction out of the large STM32 CLI
// dispatcher, while retaining ordinary inlining choices elsewhere.
#if defined(STM32_PLATFORM)
__attribute__((noinline))
#endif
bool handleCommand(const char* command, char* reply, size_t capacity) {
if (!command || !reply || capacity == 0) return false;
const bool get = strncmp(command, "get ", 4) == 0;
const bool set = strncmp(command, "set ", 4) == 0;
if ((!get && !set) || strncmp(command + 4, "leds", 4) != 0) return false;
const bool get = command[0] == 'g';
if ((!get && command[0] != 's')
|| strncmp(command + 1, "et leds", 7) != 0) return false;
const char* value = command + 8;
if (*value && *value != ' ' && *value != '\t') return false;
const char* message;
if (get) {
if (*value) snprintf(reply, capacity, "Error: usage get leds");
else snprintf(reply, capacity, "> %s", enabled() ? "on" : "off");
return true;
message = *value ? "Error: usage get leds" : enabled() ? "> on" : "> off";
} else {
while (*value == ' ' || *value == '\t') ++value;
const bool on = strcmp(value, "on") == 0;
if (!on && strcmp(value, "off") != 0) {
message = "Error: usage set leds on|off";
} else if (!main_board || !saveSetting(on)) {
message = "Error: LED setting save unconfirmed; reboot may differ";
} else {
setEnabled(on);
main_board->applyLedPolicy();
applyStatusPolicy();
message = "OK";
}
}
while (*value == ' ' || *value == '\t') ++value;
if (strcmp(value, "on") != 0 && strcmp(value, "off") != 0) {
snprintf(reply, capacity, "Error: usage set leds on|off");
return true;
}
const bool on = strcmp(value, "on") == 0;
if (!main_board || !saveSetting(on)) {
snprintf(reply, capacity, "Error: LED setting save unconfirmed; reboot may differ");
return true;
}
setEnabled(on);
main_board->applyLedPolicy();
applyStatusPolicy();
snprintf(reply, capacity, "OK");
snprintf(reply, capacity, "%s", message);
return true;
}
} } // namespace mesh::leds
+153 -191
View File
@@ -85,186 +85,117 @@ inline const char* ota_target_env_name(uint32_t target_id, char* buffer, size_t
};
enum { DECODE_CHUNK_BYTES = 4096 };
static const uint16_t OFFSETS[] = {
0, 1066, 2165, 2715,
0, 1610,
};
static const uint16_t RAW_LENGTHS[] = {
4087, 4061, 2042,
3942,
};
static const uint16_t FIRSTS[] = {
0, 274, 536, 683,
0, 683,
};
// 2715 encoded bytes; 3 independent chunks, at most 4096 decoded bytes.
// 1610 encoded bytes; 1 independent chunks, at most 4096 decoded bytes.
static const uint8_t NAMES[] = {
0xad, 0x57, 0x57, 0x9b, 0xa3, 0x38, 0x10, 0xd4, 0xe5, 0xbb, 0xc9, 0x39, 0x3a, 0x6f, 0xce, 0x36,
0xde, 0xf8, 0x76, 0x69, 0x73, 0xce, 0x8f, 0xfd, 0xc9, 0x20, 0xaf, 0xf9, 0x0c, 0x88, 0x93, 0x34,
0xe9, 0xdf, 0xdf, 0x08, 0x31, 0xb8, 0xd1, 0xca, 0x6c, 0xde, 0x09, 0xc2, 0x1a, 0xba, 0xaa, 0xab,
0xab, 0x1b, 0x44, 0xee, 0x0e, 0x8e, 0x14, 0x83, 0xbb, 0xfc, 0x15, 0xbd, 0xf2, 0xba, 0x0f, 0x3e,
0x8f, 0x53, 0x9a, 0x84, 0x3c, 0x01, 0x41, 0x83, 0x90, 0xc3, 0x20, 0x62, 0xa4, 0xb1, 0x27, 0x07,
0x64, 0x61, 0x1c, 0x4a, 0x09, 0x31, 0x0f, 0x58, 0x4c, 0x16, 0x5e, 0xb1, 0x94, 0x51, 0xc5, 0x04,
0x59, 0x10, 0xf9, 0x0a, 0xf8, 0x40, 0x32, 0xb1, 0xcf, 0x04, 0xc4, 0xff, 0x29, 0x45, 0x16, 0x39,
0x8f, 0xc1, 0x7c, 0x40, 0xb6, 0xad,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xbd, 0x51, 0x43,
0x6e, 0x84, 0x5d, 0xe6, 0x80, 0x0f, 0x19, 0xdd, 0xb7, 0xd2, 0xbc, 0x34, 0x6d, 0xa9, 0xff, 0xff,
0x43, 0xb2, 0xb9, 0xfc, 0xaa, 0x6b, 0xa2, 0x5a, 0xce, 0xd8, 0x98, 0x2d, 0x55, 0x23, 0x17, 0x07,
0xed, 0x0c, 0xff, 0x1a, 0xf1, 0x57, 0x32, 0xd5, 0x33, 0xdf, 0x42, 0x59, 0xbf, 0x7e, 0x0f, 0x2b,
0x02, 0xfa, 0xde, 0x09, 0x46, 0xc1, 0x8b, 0x99, 0xe4, 0xdf, 0xf9, 0x8a, 0x81, 0xb4, 0x54, 0xb0,
0x5f, 0xbe, 0x52, 0xb4, 0x76, 0xff, 0xb1, 0x1b, 0x76, 0x8b, 0x0e, 0xbc, 0xe1, 0x11, 0x93, 0x49,
0x9d, 0x0b, 0x38, 0xcd, 0x3a, 0x68, 0xc7, 0x96, 0xd5, 0x87, 0x22, 0x71, 0x8a, 0x9b, 0xa7, 0x13,
0xcb, 0xb2, 0x54, 0x0b, 0xec, 0x07, 0x3c, 0x45, 0x74, 0xac, 0x8c, 0x56, 0xd5, 0x41, 0x0b, 0x64,
0x7f, 0x85, 0x1f, 0x18, 0x23, 0xb4, 0x12, 0xb4, 0xb4, 0x23, 0x94, 0xdb, 0x50, 0xc0, 0xd2, 0x2c,
0xa1, 0x24, 0xb5, 0xd2, 0x62, 0x5a, 0x59, 0x2d, 0x75, 0xc9, 0x4f, 0xea, 0xe0, 0x68, 0xb4, 0xff,
0xf1, 0x13, 0xcc, 0xa7, 0x76, 0xbd, 0x48, 0x4b, 0xe8, 0x3f,
};
// Rare display lookup: one heap buffer, each candidate chunk decoded once.
// Keep complete names private until both ID and caller capacity are validated.
@@ -282,31 +213,62 @@ inline const char* ota_target_env_name(uint32_t target_id, char* buffer, size_t
if (tinf_uncompress_exact(raw, &produced, NAMES + OFFSETS[group],
OFFSETS[group + 1] - OFFSETS[group]) != TINF_OK ||
produced != RAW_LENGTHS[group]) return nullptr;
const uint8_t* record = raw;
if (produced < 3) return nullptr;
const unsigned suffix_count = raw[0];
const size_t suffix_bytes = (size_t)raw[1] | (size_t)raw[2] << 8;
if (!suffix_count || suffix_bytes > produced - 3) return nullptr;
const uint8_t* suffixes = raw + 3;
const uint8_t* record = suffixes + suffix_bytes;
const uint8_t* end = raw + produced;
const uint8_t* checked_suffix = suffixes;
for (unsigned n = 0; n < suffix_count; n++) {
while (checked_suffix < record && *checked_suffix) checked_suffix++;
if (checked_suffix == record) return nullptr;
checked_suffix++;
}
if (checked_suffix != record) return nullptr;
size_t previous_length = 0;
for (unsigned row = FIRSTS[group]; row < FIRSTS[group + 1]; row++) {
unsigned row = FIRSTS[group];
while (row < FIRSTS[group + 1]) {
if (record == end) return nullptr;
size_t length = *record++;
if (length > previous_length || length >= sizeof(name)) return nullptr;
size_t base_length = *record++;
if (base_length > previous_length || base_length >= sizeof(name)) return nullptr;
while (record < end && *record) {
if (length + 1 >= sizeof(name)) return nullptr;
name[length++] = (char)*record++;
if (base_length + 1 >= sizeof(name)) return nullptr;
name[base_length++] = (char)*record++;
}
if (record == end) return nullptr;
record++;
name[length] = 0;
previous_length = length;
if (FINGERPRINTS[row] != fingerprint) continue;
uint8_t hash[4];
mesh::Utils::sha256(hash, sizeof(hash), (const uint8_t*)name, length);
const uint32_t id = (uint32_t)hash[0] | (uint32_t)hash[1] << 8 |
(uint32_t)hash[2] << 16 | (uint32_t)hash[3] << 24;
if (id != target_id) continue;
if (length >= capacity) return nullptr;
memcpy(buffer, name, length + 1);
return buffer;
previous_length = base_length;
if (record == end) return nullptr;
const unsigned aliases = *record++;
if (!aliases || aliases > FIRSTS[group + 1] - row || aliases > (size_t)(end - record)) return nullptr;
for (unsigned alias = 0; alias < aliases; alias++, row++) {
const unsigned suffix_index = *record++;
if (suffix_index >= suffix_count) return nullptr;
if (FINGERPRINTS[row] != fingerprint) continue;
const uint8_t* suffix = suffixes;
for (unsigned n = 0; n < suffix_index; n++) {
while (*suffix) suffix++;
suffix++;
}
size_t length = base_length;
while (*suffix) {
if (length + 1 >= sizeof(name)) return nullptr;
name[length++] = (char)*suffix++;
}
name[length] = 0;
uint8_t hash[4];
mesh::Utils::sha256(hash, sizeof(hash), (const uint8_t*)name, length);
const uint32_t id = (uint32_t)hash[0] | (uint32_t)hash[1] << 8 |
(uint32_t)hash[2] << 16 | (uint32_t)hash[3] << 24;
if (id != target_id) continue;
if (length >= capacity) return nullptr;
memcpy(buffer, name, length + 1);
return buffer;
}
}
if (record != end) return nullptr;
}
return nullptr;
#else
+31 -6
View File
@@ -4,8 +4,9 @@
namespace mesh { namespace ui {
namespace {
FILESYSTEM* settings_fs = nullptr;
bool pairing_available = false;
#ifdef MESHCORE_HAS_REAL_DISPLAY
FILESYSTEM* settings_fs = nullptr;
const char* const path = "/display_prefs";
const char* const backup = "/display_prefs.bak";
const char* const temporary = "/display_prefs.tmp";
@@ -78,15 +79,21 @@ bool savePrefs(const DisplayPowerPrefs& prefs) {
settings_fs->remove(backup);
return true;
}
#endif // MESHCORE_HAS_REAL_DISPLAY
}
bool loadDisplayPowerSettings(FILESYSTEM* fs, bool pairing_supported, bool wake_on_boot) {
#ifdef MESHCORE_HAS_REAL_DISPLAY
settings_fs = fs;
#else
(void)fs;
#endif
pairing_available = pairing_supported;
DisplayPowerPrefs prefs;
prefs.wake_on_boot = wake_on_boot;
if (pairing_supported) prefs.battery.mode = prefs.usb.mode = DisplayMode::ButtonPairing;
displayPowerPrefs() = prefs;
#ifdef MESHCORE_HAS_REAL_DISPLAY
if (!fs) return false;
bool loaded = readPrefs(path, prefs);
if (!loaded && readPrefs(backup, prefs)) {
@@ -101,6 +108,11 @@ bool loadDisplayPowerSettings(FILESYSTEM* fs, bool pairing_supported, bool wake_
}
displayPowerPrefs() = prefs;
return true;
#else
// Headless commands already report unsupported. Preserve runtime defaults
// without retaining or touching a display-only persistent store.
return false;
#endif
}
bool displayPairingSupported() { return pairing_available; }
@@ -111,11 +123,29 @@ void migrateLegacyDisplayTimeout(uint16_t seconds) {
if (seconds) prefs.battery.seconds = prefs.usb.seconds = seconds;
// Keep the old behavior in memory even if flash is temporarily unavailable.
displayPowerPrefs() = prefs;
#ifdef MESHCORE_HAS_REAL_DISPLAY
savePrefs(prefs);
#endif
}
bool handleDisplayPowerCommand(const char* command, char* reply, size_t reply_size,
bool inbox_supported) {
#ifndef MESHCORE_HAS_REAL_DISPLAY
(void)inbox_supported;
if ((command[0] != 'g' && command[0] != 's')
|| strncmp(command + 1, "et display.", 11) != 0) return false;
const char* key = command + 12;
const bool usb = strncmp(key, "usb.", 4) == 0;
if (usb) key += 4;
size_t length;
if (strncmp(key, "mode", 4) == 0) length = 4;
else if (strncmp(key, "timeout", 7) == 0) length = 7;
else if (!usb && strncmp(key, "inbox", 5) == 0) length = 5;
else return false;
if (key[length] && key[length] != ' ') return false;
snprintf(reply, reply_size, "Error: display unsupported");
return true;
#else
const bool get = strncmp(command, "get ", 4) == 0;
const bool set = strncmp(command, "set ", 4) == 0;
if (!get && !set) return false;
@@ -129,11 +159,6 @@ bool handleDisplayPowerCommand(const char* command, char* reply, size_t reply_si
}
}
if (index < 0) return false;
#ifndef MESHCORE_HAS_REAL_DISPLAY
(void)inbox_supported;
snprintf(reply, reply_size, "Error: display unsupported");
return true;
#else
auto candidate = displayPowerPrefs();
auto& profile = index < 2 ? candidate.battery : candidate.usb;
const char* value = key + strlen(keys[index]);
+1
View File
@@ -8,6 +8,7 @@ namespace mesh { namespace ui {
// Separate, versioned file: existing node and MQTT preference layouts stay
// readable by older firmware. Returns true when a saved profile was loaded.
// Companion startup enables a timed boot screen without changing saved modes.
// Headless builds initialize runtime defaults and never access this file.
bool loadDisplayPowerSettings(FILESYSTEM* fs, bool pairing_supported,
bool wake_on_boot = false);
bool handleDisplayPowerCommand(const char* command, char* reply, size_t reply_size,
+7
View File
@@ -8,3 +8,10 @@
namespace mesh { namespace power {
inline bool handleRegulatorCommand(const char*, char*, size_t) { return false; }
}}
// LED persistence has its own executable coverage in test_led_settings.py.
// These command-dispatch fixtures likewise leave unrelated LED commands to
// that subsystem instead of requiring a board/filesystem implementation.
namespace mesh { namespace leds {
inline bool handleCommand(const char*, char*, size_t) { return false; }
}}
+149
View File
@@ -0,0 +1,149 @@
"""Keep canonical retry preference bytes while batching their atomic write."""
from pathlib import Path
import shutil
import subprocess
import tempfile
import unittest
ROOT = Path(__file__).resolve().parents[1]
PREFIX = r'''
#include <cstdint>
#include <cstddef>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <limits>
#define DEFAULT_POWERSAVING_ENABLED 0
#define DEFAULT_ADVERT_LOC_POLICY 0
#ifndef FLOOD_RETRY_PREFIX_SLOTS
#define FLOOD_RETRY_PREFIX_SLOTS 8
#define FLOOD_RETRY_PREFIX_LEN 3
#define FLOOD_RETRY_BRIDGE_BUCKETS 6
#define FLOOD_RETRY_BUCKET_PREFIXES 17
#define FLOOD_RETRY_IGNORE_PREFIXES 8
#endif
namespace mesh { namespace bridge {constexpr uint8_t ESPNOW_FORMAT_WRAPPED=0;} struct RepeaterRadioTiming {static constexpr uint8_t DEFAULT_RX_WATCHDOG_ENABLED=1;}; }
class ConfigSerializer {public:virtual void structure() {} uint8_t base_padding[3] = {};};
'''
WRITER = r'''
struct Writer {
std::vector<uint8_t> bytes;size_t budget=std::numeric_limits<size_t>::max();bool okay=true;
__attribute__((noinline)) size_t write(const uint8_t* p,size_t n) {
if(!okay)return 0;const size_t used=std::min(n,budget);bytes.insert(bytes.end(),p,p+used);budget-=used;
if(used!=n)okay=false;return used;
}
bool commit()const{return okay;}
};
'''
REFERENCE_WRITES = r'''
writer.write((uint8_t *)&prefs->retry_preset, sizeof(prefs->retry_preset)); // 295
writer.write((uint8_t *)&prefs->direct_retry_attempts, sizeof(prefs->direct_retry_attempts)); // 296
writer.write((uint8_t *)&prefs->direct_retry_base_ms, sizeof(prefs->direct_retry_base_ms)); // 297
writer.write((uint8_t *)&prefs->direct_retry_step_ms, sizeof(prefs->direct_retry_step_ms)); // 299
writer.write((uint8_t *)&prefs->direct_retry_snr_margin_x4, sizeof(prefs->direct_retry_snr_margin_x4)); // 301
writer.write((uint8_t *)&prefs->direct_retry_cr4_snr_x4, sizeof(prefs->direct_retry_cr4_snr_x4)); // 303
writer.write((uint8_t *)&prefs->direct_retry_cr5_snr_x4, sizeof(prefs->direct_retry_cr5_snr_x4)); // 304
writer.write((uint8_t *)&prefs->direct_retry_cr7_snr_x4, sizeof(prefs->direct_retry_cr7_snr_x4)); // 305
writer.write((uint8_t *)&prefs->direct_retry_cr8_snr_x4, sizeof(prefs->direct_retry_cr8_snr_x4)); // 306
writer.write((uint8_t *)&prefs->direct_retry_enabled, sizeof(prefs->direct_retry_enabled)); // 307
writer.write((uint8_t *)&prefs->direct_retry_cr_enabled, sizeof(prefs->direct_retry_cr_enabled)); // 308
writer.write((uint8_t *)&prefs->direct_retry_prefs_magic, sizeof(prefs->direct_retry_prefs_magic)); // 309
writer.write((uint8_t *)&prefs->flood_retry_attempts, sizeof(prefs->flood_retry_attempts)); // 311
writer.write((uint8_t *)&prefs->flood_retry_max_path, sizeof(prefs->flood_retry_max_path)); // 312
writer.write((uint8_t *)&prefs->flood_retry_prefixes[0][0], sizeof(prefs->flood_retry_prefixes)); // 313
writer.write((uint8_t *)&prefs->flood_retry_bridge_enabled, sizeof(prefs->flood_retry_bridge_enabled));
writer.write((uint8_t *)&prefs->flood_retry_bridge_buckets[0][0][0], sizeof(prefs->flood_retry_bridge_buckets));
writer.write((uint8_t *)&prefs->flood_retry_ignore_prefixes[0][0], sizeof(prefs->flood_retry_ignore_prefixes));
writer.write((uint8_t *)&prefs->flood_retry_advert_enabled, sizeof(prefs->flood_retry_advert_enabled));
writer.write((uint8_t *)&prefs->battery_alert_enabled, sizeof(prefs->battery_alert_enabled));
writer.write((uint8_t *)&prefs->battery_alert_low_percent, sizeof(prefs->battery_alert_low_percent));
writer.write((uint8_t *)&prefs->battery_alert_critical_percent, sizeof(prefs->battery_alert_critical_percent));
writer.write((uint8_t *)&prefs->direct_retry_recent_enabled, sizeof(prefs->direct_retry_recent_enabled));
writer.write((uint8_t *)&prefs->flood_channel_data_enabled, sizeof(prefs->flood_channel_data_enabled));
writer.write((uint8_t *)&prefs->legacy_flood_channel_block_max_hops,
sizeof(prefs->legacy_flood_channel_block_max_hops));
writer.write((uint8_t *)&prefs->flood_channel_data_max_hops, sizeof(prefs->flood_channel_data_max_hops));
writer.write((uint8_t *)&prefs->telemetry_access, sizeof(prefs->telemetry_access)); // 674
'''
CHECKS = r'''
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
int main(){
NodePrefs prefs;uint32_t state=1;size_t length=0;
for(unsigned seed=0;seed<32;seed++) {
Writer expected;
auto* first=reinterpret_cast<uint8_t*>(&prefs)+__builtin_offsetof(NodePrefs,retry_preset);
const size_t size=__builtin_offsetof(NodePrefs,telemetry_access)+sizeof(prefs.telemetry_access)-__builtin_offsetof(NodePrefs,retry_preset);
for(size_t i=0;i<size;i++){state=state*1664525u+1013904223u;first[i]=uint8_t(state>>24);}
reference(expected,&prefs);length=expected.bytes.size();assert(expected.commit());
Writer actual;writeCommonRetryPrefs(actual,&prefs);assert(actual.commit()&&actual.bytes==expected.bytes);
for(size_t limit=0;limit<=length;limit++){
Writer a,b;a.budget=b.budget=limit;reference(a,&prefs);writeCommonRetryPrefs(b,&prefs);
assert(a.bytes==b.bytes&&a.commit()==b.commit());assert(a.commit()==(limit==length));
}
}
printf("PASS: exact canonical %zu-byte tail, 32 arbitrary states, every cumulative short-write boundary\n",length);
}
#pragma GCC diagnostic pop
'''
def fixture(padded=False):
header = (ROOT / "src/helpers/CommonCLI.h").read_text()
begin = header.index("class NodePrefs : public ConfigSerializer")
begin = header.index("public:", begin)
end = header.index("\nprivate:", begin)
declarations = "class NodePrefs : public ConfigSerializer {\n" + header[begin:end] + "\n};\n"
if padded:
original = " uint8_t direct_retry_attempts = 0;"
assert original in declarations
declarations = declarations.replace(original, original + "\n uint8_t layout_break = 0;", 1)
source = (ROOT / "src/helpers/CommonCLI.cpp").read_text()
begin = source.index("// This canonical retry/flood span contains no padding.")
end = source.index("void CommonCLI::savePrefs(FILESYSTEM* fs", begin)
helper = source[begin:end]
return (PREFIX + declarations + helper + WRITER
+ "void reference(Writer& writer, NodePrefs* prefs) {\n"
+ REFERENCE_WRITES + "}\n" + CHECKS)
class CommonRetryTailTests(unittest.TestCase):
def compile(self, work, definitions=(), padded=False):
compiler = shutil.which("g++") or shutil.which("clang++")
self.assertIsNotNone(compiler, "native C++ compiler required")
cpp, executable = work / "tail.cpp", work / "tail"
cpp.write_text(fixture(padded))
result = subprocess.run([
compiler, "-std=c++17", "-O1", "-Wall", "-Wextra", "-Werror",
"-Wno-misleading-indentation", "-fsanitize=address,undefined",
"-fno-sanitize-recover=all", "-fno-pie", "-no-pie", *definitions,
str(cpp), "-o", str(executable),
], capture_output=True, text=True, timeout=60)
return result, executable
def test_actual_members_match_old_bytes_and_every_short_write_boundary(self):
for definitions in ((), ("-DENABLE_OTA=1", "-DRAK_4631=1"), (
"-DFLOOD_RETRY_PREFIX_SLOTS=3", "-DFLOOD_RETRY_PREFIX_LEN=5",
"-DFLOOD_RETRY_BRIDGE_BUCKETS=2", "-DFLOOD_RETRY_BUCKET_PREFIXES=7",
"-DFLOOD_RETRY_IGNORE_PREFIXES=4")):
with self.subTest(definitions=definitions), tempfile.TemporaryDirectory() as directory:
result, executable = self.compile(Path(directory), definitions)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
checked = subprocess.run([str(executable)], capture_output=True, text=True, timeout=30)
self.assertEqual(checked.returncode, 0, checked.stdout + checked.stderr)
self.assertIn("exact canonical", checked.stdout)
def test_changed_member_layout_refuses_to_compile(self):
with tempfile.TemporaryDirectory() as directory:
result, _ = self.compile(Path(directory), padded=True)
self.assertNotEqual(result.returncode, 0)
self.assertIn("retry tail has padding or changed order", result.stderr)
if __name__ == "__main__":
unittest.main()
+1 -1
View File
@@ -58,7 +58,7 @@ def actual_harness():
'SERIALIZER': 'template<typename Writer>\n' + extract_braced(
source, 'static bool writeCommonPrefsImage('),
'STORE': extract_braced(source, 'class CommonPrefsFileStore'),
'METHODS': methods,
'METHODS': ("\n#include <stddef.h>\ntemplate<typename Writer>\n" + extract_braced(source, "static void writeCommonRetryPrefs(") + "\n" + methods),
'SET_DEBUG': extract_braced(source, 'if (strncmp(config, "usb.debug", 9)'),
'SET_MASTER': extract_braced(source, 'if (strncmp(config, "usb.logging", 11)'),
'GET_DEBUG': extract_braced(source, 'if (strcmp(config, "usb.debug") == 0)'),
+1 -1
View File
@@ -155,7 +155,7 @@ class CommonRadioPersistenceTest(unittest.TestCase):
'bool CommonCLI::savePrimaryRadioParams('))
serializer = 'template<typename Writer>\n' + extract_braced(source, 'static bool writeCommonPrefsImage(')
tail = extract_braced(source, 'if (file.available() >= (int)sizeof(_prefs->bridge_format))')
code = HARNESS.replace('@FIELDS@',fields).replace('@METHODS@',methods)
code = HARNESS.replace('@FIELDS@',fields).replace('@METHODS@',("\n#include <stddef.h>\ntemplate<typename Writer>\n" + extract_braced(source, "static void writeCommonRetryPrefs(") + "\n" + methods))
code = code.replace('@SERIALIZER@',serializer).replace('@TAIL@',tail)
sanitizer_flags = [] if os.name == 'nt' else [
'-fsanitize=address,undefined', '-fno-sanitize-recover=all',
+1 -1
View File
@@ -318,7 +318,7 @@ class CommonUsbDebugTest(unittest.TestCase):
'SERIALIZER': 'template<typename Writer>\n' + extract_braced(
source, 'static bool writeCommonPrefsImage('),
'STORE': extract_braced(source, 'class CommonPrefsFileStore'),
'METHODS': methods,
'METHODS': ("\n#include <stddef.h>\ntemplate<typename Writer>\n" + extract_braced(source, "static void writeCommonRetryPrefs(") + "\n" + methods),
'DYNAMIC': extract_braced(header, 'class BridgePrefs :'),
'SET_DEBUG': extract_braced(source, 'if (strncmp(config, "usb.debug", 9)'),
'SET_MASTER': extract_braced(source, 'if (strncmp(config, "usb.logging", 11)'),
+81 -2
View File
@@ -28,14 +28,17 @@ struct File {
struct FakeFS {
std::map<std::string, std::vector<uint8_t>> files;
bool fail_write = false, fail_publish = false;
bool exists(const char* name) { return files.count(name); }
bool remove(const char* name) { files.erase(name); return true; }
unsigned calls = 0;
bool exists(const char* name) { ++calls; return files.count(name); }
bool remove(const char* name) { ++calls; files.erase(name); return true; }
bool rename(const char* from, const char* to) {
++calls;
if (fail_publish && std::string(from) == "/display_prefs.tmp") return false;
if (!exists(from) || exists(to)) return false;
files[to] = files[from]; files.erase(from); return true;
}
File open(const char* name, const char* mode, bool = false) {
++calls;
if (*mode == 'w') files[name].clear();
if (!exists(name)) return {};
return File{this, name};
@@ -326,6 +329,61 @@ int main() {
'''
HEADLESS_TEST = r'''
#include <cassert>
#include <helpers/ui/DisplayPowerSettings.h>
using namespace mesh::ui;
int main() {
FakeFS fs;
fs.files["/display_prefs"] = {'D', 'P', 2, 5, 42, 0, 1, 57, 0, 2, 0, 0};
fs.files["/display_prefs.bak"] = {'b', 'a', 'c', 'k', 'u', 'p'};
fs.files["/display_prefs.tmp"] = {'t', 'e', 'm', 'p'};
const auto original = fs.files;
for (bool pairing : {false, true}) for (bool wake : {false, true}) {
displayPowerPrefs().battery = {DisplayMode::Off, 123};
displayPowerPrefs().usb = {DisplayMode::On, 456};
displayPowerPrefs().inbox = DisplayInboxMode::Unread;
assert(!loadDisplayPowerSettings(&fs, pairing, wake));
const auto& prefs = displayPowerPrefs();
const auto mode = pairing ? DisplayMode::ButtonPairing : DisplayMode::Button;
assert(prefs.battery.mode == mode && prefs.usb.mode == mode);
assert(prefs.battery.seconds == 15 && prefs.usb.seconds == 15);
assert(prefs.inbox == DisplayInboxMode::History && prefs.wake_on_boot == wake);
assert(displayPairingSupported() == pairing);
for (const char* key : {"display.mode", "display.timeout", "display.usb.mode",
"display.usb.timeout", "display.inbox"}) {
for (const char* prefix : {"get ", "set "}) for (const char* suffix : {"", " off", " typo"}) {
char reply[160] = {};
const std::string text = std::string(prefix) + key + suffix;
assert(handleDisplayPowerCommand(text.c_str(), reply, sizeof(reply), true));
assert(std::string(reply) == "Error: display unsupported");
}
}
char reply[32] = "untouched";
assert(!handleDisplayPowerCommand("get display.model", reply, sizeof(reply)));
assert(std::string(reply) == "untouched");
char bounded[3] = {'x', 'y', 'z'};
assert(handleDisplayPowerCommand("get display.mode", bounded, 1));
assert(bounded[0] == 0 && bounded[1] == 'y' && bounded[2] == 'z');
migrateLegacyDisplayTimeout(0);
assert(displayPowerPrefs().battery.mode == DisplayMode::On);
assert(displayPowerPrefs().usb.mode == DisplayMode::On);
migrateLegacyDisplayTimeout(42);
assert(displayPowerPrefs().battery.mode == DisplayMode::Automatic);
assert(displayPowerPrefs().usb.mode == DisplayMode::Automatic);
assert(displayPowerPrefs().battery.seconds == 42 && displayPowerPrefs().usb.seconds == 42);
assert(displayPowerPrefs().wake_on_boot == wake && displayPairingSupported() == pairing);
migrateLegacyDisplayTimeout(3601);
assert(displayPowerPrefs().battery.seconds == 42 && displayPowerPrefs().usb.seconds == 42);
assert(fs.calls == 0 && fs.files == original);
assert(!loadDisplayPowerSettings(nullptr, pairing, wake));
assert(displayPowerPrefs().battery.mode == mode && displayPowerPrefs().wake_on_boot == wake);
assert(fs.calls == 0 && fs.files == original);
}
}
'''
class DisplayPowerTest(unittest.TestCase):
def test_companion_boot_wake_is_transport_and_layout_independent(self):
mesh = (ROOT / "examples/companion_radio/MyMesh.cpp").read_text()
@@ -344,6 +402,27 @@ class DisplayPowerTest(unittest.TestCase):
infrastructure = (ROOT / "src/helpers/CommonCLI.cpp").read_text()
self.assertIn("loadDisplayPowerSettings(fs, false);", infrastructure)
def test_headless_defaults_commands_and_legacy_migration_do_not_touch_files(self):
compiler = shutil.which("g++") or shutil.which("clang++")
self.assertIsNotNone(compiler, "host C++ compiler required")
with tempfile.TemporaryDirectory(prefix="mesh-headless-display-test-") as name:
work = Path(name)
(work / "helpers").mkdir()
(work / "helpers/IdentityStore.h").write_text(FS_STUB)
(work / "test.cpp").write_text(HEADLESS_TEST)
for label, definitions in (("absent", ()), ("null", ("-DDISPLAY_CLASS=NullDisplayDriver",))):
with self.subTest(display=label):
executable = work / (label + ".exe")
result = subprocess.run([
compiler, "-std=c++17", "-Wall", "-Wextra", "-Werror",
*definitions, "-I" + str(work), "-I" + str(ROOT / "src"),
str(work / "test.cpp"), str(ROOT / "src/helpers/ui/DisplayPowerSettings.cpp"),
"-o", str(executable),
], capture_output=True, text=True, timeout=60)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
result = subprocess.run([str(executable)], capture_output=True, text=True, timeout=10)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
def test_policy_and_persistent_commands(self):
compiler = shutil.which("g++") or shutil.which("clang++")
self.assertIsNotNone(compiler, "host C++ compiler required")
+1 -1
View File
@@ -238,7 +238,7 @@ def persistence_harness():
"SERIALIZER": "template<typename Writer>\n" + extract_braced(
source, "static bool writeCommonPrefsImage("),
"STORE": extract_braced(source, "class CommonPrefsFileStore"),
"METHODS": methods,
"METHODS": ("\n#include <stddef.h>\ntemplate<typename Writer>\n" + extract_braced(source, "static void writeCommonRetryPrefs(") + "\n" + methods),
"DYNAMIC": "", "SET_DEBUG": "", "SET_MASTER": "",
"GET_DEBUG": "", "GET_MASTER": "",
}
+73 -1
View File
@@ -124,7 +124,7 @@ class OtaTargetNameTest(unittest.TestCase):
def test_rak_full_lookup_fails_closed_without_heap_and_keeps_every_name(self):
flags = ["-DOTA_TARGET_NAME_FRONT_CODED=1", "-DOTA_RAK15002_SD_STORE=1", "-DCOMPANION_RADIO_FULL=1"]
data, offsets, lengths, firsts = gen_targets.compressed_name_chunks(
data, offsets, lengths, firsts = gen_targets.grouped_name_chunks(
self.rows, gen_targets.RAK_FULL_NAME_DECODE_CHUNK_SIZE)
ordinary = gen_targets.compressed_name_chunks(self.rows)
self.assertGreater(len(ordinary[0]) - len(data), 1500)
@@ -134,6 +134,76 @@ class OtaTargetNameTest(unittest.TestCase):
self.assertEqual(self.compile_and_lookup(flags + ["-DOTA_TEST_MALLOC_FAIL=1"],
[self.rows[0][0], 0]), ["?", "?"])
def grouped_roundtrip(self, rows, chunk_size=4096):
data, offsets, lengths, firsts = gen_targets.grouped_name_chunks(rows, chunk_size)
names = []
for group, length in enumerate(lengths):
raw = zlib.decompress(data[offsets[group]:offsets[group + 1]], -15)
self.assertEqual(len(raw), length)
self.assertLessEqual(length, chunk_size)
count, dictionary_bytes = raw[0], int.from_bytes(raw[1:3], "little")
dictionary_end = 3 + dictionary_bytes
dictionary = raw[3:dictionary_end].split(b"\0")
self.assertEqual(dictionary[-1], b"")
self.assertEqual(len(dictionary) - 1, count)
position, previous, row = dictionary_end, b"", firsts[group]
while row < firsts[group + 1]:
prefix = raw[position]
self.assertLessEqual(prefix, len(previous))
end = raw.index(0, position + 1)
previous = previous[:prefix] + raw[position + 1:end]
aliases = raw[end + 1]
self.assertGreater(aliases, 0)
position = end + 2
for index in raw[position:position + aliases]:
self.assertLess(index, count)
names.append((previous + dictionary[index]).decode("utf-8"))
position += aliases; row += aliases
self.assertEqual(row, firsts[group + 1])
self.assertEqual(position, len(raw))
self.assertEqual(names, [name for _, name in rows])
return data, lengths
def test_rak_full_grouped_roles_keep_all_names_in_same_scratch_and_save_flash(self):
data, lengths = self.grouped_roundtrip(self.rows)
previous = gen_targets.compressed_name_chunks(self.rows, 4096)
self.assertGreater(len(previous[0]) - len(data), 1000)
self.assertLessEqual(max(lengths), 4096)
# Unusual/legacy names stay complete; larger future inventories restart
# board prefixes and carry a complete suffix dictionary in each chunk.
future = gen_targets.target_rows(
[f"board_{i:04d}_{role}" for i in range(700)
for role in ("repeater", "companion_radio_usb", "room_server")]
+ ["legacy_without_role", "odd_BOARD_repeatr", "case_Companion_ble"])
_, chunks = self.grouped_roundtrip(future)
self.assertGreater(len(chunks), 1)
def test_grouped_decoder_rejects_bad_dictionary_prefix_count_and_role_index(self):
from zopfli_compress import raw_deflate_compress
rows = gen_targets.target_rows(["hello"])
header = gen_targets.generate_header(rows)
data, offsets, lengths, firsts = gen_targets.grouped_name_chunks(rows)
raw = zlib.decompress(data, -15)
invalid = []
for offset, value in ((0, 0), (1, 255), (3, 88), (4, 255), (-2, 0), (-1, 255)):
changed = bytearray(raw); changed[offset] = value; invalid.append(bytes(changed))
invalid.append(raw[:-1])
for changed in invalid:
stream = raw_deflate_compress(changed, numiterations=1000)
altered = re.sub(
r"(static const uint8_t NAMES\[\] = \{).*?(\n \};)",
lambda match: match[1] + "\n " + ", ".join(f"0x{byte:02x}" for byte in stream) + "," + match[2],
header, count=1, flags=re.S)
altered = re.sub(
r"(static const uint16_t OFFSETS\[\] = \{).*?(\n \};)",
lambda match: match[1] + f"\n 0, {len(stream)}," + match[2], altered, count=1, flags=re.S)
altered = re.sub(
r"(static const uint16_t RAW_LENGTHS\[\] = \{).*?(\n \};)",
lambda match: match[1] + f"\n {len(changed)}," + match[2], altered, count=1, flags=re.S)
with self.subTest(raw=changed.hex()):
flags = ["-DOTA_TARGET_NAME_FRONT_CODED=1", "-DOTA_RAK15002_SD_STORE=1", "-DCOMPANION_RADIO_FULL=1"]
self.assertEqual(self.compile_and_lookup(flags, [rows[0][0]], altered), ["?"])
def test_rak_full_fingerprint_collisions_verify_the_entire_target_id(self):
flags = ["-DOTA_TARGET_NAME_FRONT_CODED=1", "-DOTA_RAK15002_SD_STORE=1", "-DCOMPANION_RADIO_FULL=1"]
known = {target for target, _ in self.rows}
@@ -198,6 +268,8 @@ class OtaTargetNameTest(unittest.TestCase):
with self.subTest(name=name):
with self.assertRaises(ValueError):
gen_targets.compressed_name_chunks([(1, name)])
with self.assertRaises(ValueError):
gen_targets.grouped_name_chunks([(1, name)])
if __name__ == "__main__":
+1 -1
View File
@@ -80,7 +80,7 @@ def common_code():
"FIELDS": fields, "CONSTANTS": constants, "HELPERS": helpers,
"LEGACY": extract_braced(header, "struct LegacyObserverTail") + ";",
"SERIALIZER": "template<typename Writer>\n" + extract_braced(source, "static bool writeCommonPrefsImage("),
"STORE": extract_braced(source, "class CommonPrefsFileStore"), "METHODS": methods,
"STORE": extract_braced(source, "class CommonPrefsFileStore"), "METHODS": ("\n#include <stddef.h>\ntemplate<typename Writer>\n" + extract_braced(source, "static void writeCommonRetryPrefs(") + "\n" + methods),
"DYNAMIC": extract_braced(header, "class BridgePrefs :"),
"SET_DEBUG": "", "SET_MASTER": "", "GET_DEBUG": "", "GET_MASTER": "",
}.items():
+1 -1
View File
@@ -216,7 +216,7 @@ def production_harness(source, header):
'SERIALIZER': 'template<typename Writer>\n' + extract_braced(
source, 'static bool writeCommonPrefsImage('),
'STORE': extract_braced(source, 'class CommonPrefsFileStore'),
'METHODS': methods,
'METHODS': ("\n#include <stddef.h>\ntemplate<typename Writer>\n" + extract_braced(source, "static void writeCommonRetryPrefs(") + "\n" + methods),
'DYNAMIC': extract_braced(header, 'class RepeatPrefs :'),
'SET_DEBUG': extract_braced(setter, branch), 'SET_MASTER': '',
'GET_DEBUG': extract_braced(getter, branch), 'GET_MASTER': '',
+119 -20
View File
@@ -15,6 +15,9 @@ from __future__ import annotations
import json
import os
import re
from collections import Counter
from itertools import groupby
import subprocess
import sys
from functools import lru_cache
@@ -126,11 +129,76 @@ def _compressed_name_chunks(rows, max_chunk_size):
return bytes(data), tuple(offsets), tuple(len(raw) for raw in raw_chunks), tuple(firsts)
def grouped_name_chunks(rows, max_chunk_size=RAK_FULL_NAME_DECODE_CHUNK_SIZE):
"""Share complete role suffixes and contiguous board prefixes, retaining order.
Each independent chunk contains its own bounded suffix dictionary followed
by board groups. One record reconstructs a board base, then lists every role
index for that contiguous run. IDs/names remain byte-for-byte unchanged.
"""
return _grouped_name_chunks(tuple(rows), max_chunk_size)
@lru_cache(maxsize=8)
def _grouped_name_chunks(rows, max_chunk_size):
sys.path.insert(0, str(ROOT / "scripts"))
from zopfli_compress import MAXIMUM_ITERATIONS, raw_deflate_compress
if not rows or max_chunk_size < 1024 or max_chunk_size > 65535:
raise ValueError("OTA grouped-name chunk size or inventory is invalid")
parts = []
for _, name in rows:
encoded = name.encode("utf-8")
if b"\0" in encoded or len(encoded) > 255:
raise ValueError(f"OTA target name is not encodable: {name!r}")
role = re.search(r"_(?:companion(?:_radio)?|comp_radio|repeater|repeatr|room_server|room_svr|sensor|kiss_modem|terminal_chat|term_chat|partition_expander)(?:_|$)", name, re.I)
parts.append((name[:role.start()], name[role.start():]) if role else (name, ""))
frequency = Counter(suffix for _, suffix in parts if suffix)
suffixes = sorted(frequency)
# Leave at least half the same scratch buffer for records. Rare/future
# suffixes can stay in the board base without losing or renaming a target.
while len(suffixes) > 254 or 1 + sum(len(s.encode("utf-8")) + 1 for s in suffixes) > max_chunk_size // 2:
suffixes.remove(min(suffixes, key=lambda suffix: (frequency[suffix], -len(suffix), suffix)))
suffixes.insert(0, "")
indices = {suffix: index for index, suffix in enumerate(suffixes)}
dictionary = b"".join(suffix.encode("utf-8") + b"\0" for suffix in suffixes)
header = bytes([len(suffixes)]) + len(dictionary).to_bytes(2, "little") + dictionary
chosen = [(base, suffix) if suffix in indices else (name, "")
for (_, name), (base, suffix) in zip(rows, parts)]
records = []
for base, run in groupby(chosen, key=lambda part: part[0]):
roles = [indices[suffix] for _, suffix in run]
for start in range(0, len(roles), 255):
records.append((base.encode("utf-8"), bytes(roles[start:start + 255])))
raw_chunks, firsts, row = [], [0], 0
current, previous = bytearray(header), b""
for base, roles in records:
prefix = 0
while prefix < min(len(previous), len(base)) and previous[prefix] == base[prefix]:
prefix += 1
record = bytes([prefix]) + base[prefix:] + b"\0" + bytes([len(roles)]) + roles
if len(current) + len(record) > max_chunk_size:
raw_chunks.append(bytes(current)); firsts.append(row)
current, previous = bytearray(header), b""
record = b"\0" + base + b"\0" + bytes([len(roles)]) + roles
if len(header) + len(record) > max_chunk_size:
raise ValueError("OTA board-name group exceeds its bounded chunk")
current.extend(record); previous = base; row += len(roles)
raw_chunks.append(bytes(current)); firsts.append(len(rows))
data, offsets = bytearray(), [0]
for raw in raw_chunks:
data.extend(raw_deflate_compress(raw, numiterations=MAXIMUM_ITERATIONS)); offsets.append(len(data))
if len(data) > 65535 or len(rows) > 65535:
raise ValueError("OTA grouped-name data exceeds uint16_t restart offsets")
return bytes(data), tuple(offsets), tuple(map(len, raw_chunks)), tuple(firsts)
def generate_header(rows):
capacity = max((len(name.encode("utf-8")) + 1 for _, name in rows), default=1)
def chunk_tables(chunk_size):
data, offsets, raw_lengths, firsts = compressed_name_chunks(rows, chunk_size)
def chunk_tables(chunk_size, grouped=False):
codec = grouped_name_chunks if grouped else compressed_name_chunks
data, offsets, raw_lengths, firsts = codec(rows, chunk_size)
lines = [f" enum {{ DECODE_CHUNK_BYTES = {chunk_size} }};"]
for name, values in (("OFFSETS", offsets), ("RAW_LENGTHS", raw_lengths), ("FIRSTS", firsts)):
lines += [f" static const uint16_t {name}[] = {{"]
@@ -188,7 +256,7 @@ def generate_header(rows):
]
out += [" " + ", ".join(f"0x{tid & 0xff:02x}" for tid, _ in rows[i:i + 16]) + ","
for i in range(0, len(rows), 16)]
out += [" };"] + chunk_tables(RAK_FULL_NAME_DECODE_CHUNK_SIZE)
out += [" };"] + chunk_tables(RAK_FULL_NAME_DECODE_CHUNK_SIZE, grouped=True)
out += [
" // Rare display lookup: one heap buffer, each candidate chunk decoded once.",
" // Keep complete names private until both ID and caller capacity are validated.",
@@ -206,31 +274,62 @@ def generate_header(rows):
" if (tinf_uncompress_exact(raw, &produced, NAMES + OFFSETS[group],",
" OFFSETS[group + 1] - OFFSETS[group]) != TINF_OK ||",
" produced != RAW_LENGTHS[group]) return nullptr;",
" const uint8_t* record = raw;",
" if (produced < 3) return nullptr;",
" const unsigned suffix_count = raw[0];",
" const size_t suffix_bytes = (size_t)raw[1] | (size_t)raw[2] << 8;",
" if (!suffix_count || suffix_bytes > produced - 3) return nullptr;",
" const uint8_t* suffixes = raw + 3;",
" const uint8_t* record = suffixes + suffix_bytes;",
" const uint8_t* end = raw + produced;",
" const uint8_t* checked_suffix = suffixes;",
" for (unsigned n = 0; n < suffix_count; n++) {",
" while (checked_suffix < record && *checked_suffix) checked_suffix++;",
" if (checked_suffix == record) return nullptr;",
" checked_suffix++;",
" }",
" if (checked_suffix != record) return nullptr;",
" size_t previous_length = 0;",
" for (unsigned row = FIRSTS[group]; row < FIRSTS[group + 1]; row++) {",
" unsigned row = FIRSTS[group];",
" while (row < FIRSTS[group + 1]) {",
" if (record == end) return nullptr;",
" size_t length = *record++;",
" if (length > previous_length || length >= sizeof(name)) return nullptr;",
" size_t base_length = *record++;",
" if (base_length > previous_length || base_length >= sizeof(name)) return nullptr;",
" while (record < end && *record) {",
" if (length + 1 >= sizeof(name)) return nullptr;",
" name[length++] = (char)*record++;",
" if (base_length + 1 >= sizeof(name)) return nullptr;",
" name[base_length++] = (char)*record++;",
" }",
" if (record == end) return nullptr;",
" record++;",
" name[length] = 0;",
" previous_length = length;",
" if (FINGERPRINTS[row] != fingerprint) continue;",
" uint8_t hash[4];",
" mesh::Utils::sha256(hash, sizeof(hash), (const uint8_t*)name, length);",
" const uint32_t id = (uint32_t)hash[0] | (uint32_t)hash[1] << 8 |",
" (uint32_t)hash[2] << 16 | (uint32_t)hash[3] << 24;",
" if (id != target_id) continue;",
" if (length >= capacity) return nullptr;",
" memcpy(buffer, name, length + 1);",
" return buffer;",
" previous_length = base_length;",
" if (record == end) return nullptr;",
" const unsigned aliases = *record++;",
" if (!aliases || aliases > FIRSTS[group + 1] - row || aliases > (size_t)(end - record)) return nullptr;",
" for (unsigned alias = 0; alias < aliases; alias++, row++) {",
" const unsigned suffix_index = *record++;",
" if (suffix_index >= suffix_count) return nullptr;",
" if (FINGERPRINTS[row] != fingerprint) continue;",
" const uint8_t* suffix = suffixes;",
" for (unsigned n = 0; n < suffix_index; n++) {",
" while (*suffix) suffix++;",
" suffix++;",
" }",
" size_t length = base_length;",
" while (*suffix) {",
" if (length + 1 >= sizeof(name)) return nullptr;",
" name[length++] = (char)*suffix++;",
" }",
" name[length] = 0;",
" uint8_t hash[4];",
" mesh::Utils::sha256(hash, sizeof(hash), (const uint8_t*)name, length);",
" const uint32_t id = (uint32_t)hash[0] | (uint32_t)hash[1] << 8 |",
" (uint32_t)hash[2] << 16 | (uint32_t)hash[3] << 24;",
" if (id != target_id) continue;",
" if (length >= capacity) return nullptr;",
" memcpy(buffer, name, length + 1);",
" return buffer;",
" }",
" }",
" if (record != end) return nullptr;",
" }",
" return nullptr;",
"#else",