Harden firmware recovery and retries

Improve companion BLE delivery and idempotent remote CLI retries, make FPF7 persistence atomic with FPF6 migration, verify staged OTA data on resume, and clarify filter policy wildcard and BlackHole semantics.
This commit is contained in:
mikecarper committed 2026-08-07 16:24:53 -07:00
1 parent 7f56da7a34
commit 11b692abfa
37 files changed
+1666 -307

No files matched your search

+18 -2
View File
@@ -16,19 +16,22 @@ struct DeferredCliCommand {
bool pending;
int client_index;
uint32_t sender_timestamp;
uint32_t request_id;
uint8_t path_hash_size;
uint8_t secret[PUB_KEY_SIZE];
char command[MAX_PACKET_PAYLOAD + 1];
DeferredCliCommand()
: pending(false), client_index(-1), sender_timestamp(0), path_hash_size(1) {
: pending(false), client_index(-1), sender_timestamp(0), request_id(0),
path_hash_size(1) {
memset(secret, 0, sizeof(secret));
command[0] = 0;
}
bool enqueue(int new_client_index, uint32_t new_sender_timestamp,
uint8_t new_path_hash_size, const uint8_t* new_secret,
const char* new_command, size_t command_len) {
const char* new_command, size_t command_len,
uint32_t new_request_id = 0) {
if (pending || new_secret == NULL || new_command == NULL
|| command_len >= sizeof(command)) {
return false;
@@ -36,6 +39,8 @@ struct DeferredCliCommand {
client_index = new_client_index;
sender_timestamp = new_sender_timestamp;
request_id = new_request_id != 0
? new_request_id : new_sender_timestamp;
path_hash_size = new_path_hash_size;
memcpy(secret, new_secret, sizeof(secret));
memcpy(command, new_command, command_len);
@@ -44,10 +49,21 @@ struct DeferredCliCommand {
return true;
}
bool matches(int other_client_index, uint32_t other_request_id,
const char* other_command, size_t other_command_len) const {
return pending && other_command != NULL
&& client_index == other_client_index
&& request_id == other_request_id
&& other_command_len < sizeof(command)
&& command[other_command_len] == 0
&& memcmp(command, other_command, other_command_len) == 0;
}
void clear() {
pending = false;
client_index = -1;
sender_timestamp = 0;
request_id = 0;
path_hash_size = 1;
memset(secret, 0, sizeof(secret));
memset(command, 0, sizeof(command));