Merge upstream/dev (2 commits) [upstream-sync]
pub-release / release (push) Canceled after 21m30s

This commit is contained in:
upstream-sync-bot committed 2026-11-27 17:05:12 +00:00
commit ba6f6cd073
5 files changed
+8 -2

No files matched your search

+1
View File
@@ -397,6 +397,7 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr
}
client = acl.putClient(sender, 0); // add to contacts (if not already known)
if (client == NULL) return 0;
if (sender_timestamp <= client->last_timestamp) {
MESH_DEBUG_PRINTLN("Possible login replay attack!");
return 0; // FATAL: client table is full -OR- replay attack
+2
View File
@@ -378,6 +378,8 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m
}
client = acl.putClient(sender, 0); // add to known clients (if not already known)
if (client == NULL) return;
if (sender_timestamp <= client->last_timestamp) {
MESH_DEBUG_PRINTLN("possible replay attack!");
return;
+1
View File
@@ -392,6 +392,7 @@ uint8_t SensorMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t*
}
client = acl.putClient(sender, PERM_RECV_ALERTS_HI | PERM_RECV_ALERTS_LO); // add to contacts (if not already known)
if (client == NULL) return 0;
if (sender_timestamp <= client->last_timestamp) {
MESH_DEBUG_PRINTLN("Possible login replay attack!");
return 0; // FATAL: client table is full -OR- replay attack
+3 -1
View File
@@ -219,7 +219,7 @@ ClientInfo* ClientACL::getClient(const uint8_t* pubkey, int key_len) {
ClientInfo* ClientACL::putClient(const mesh::Identity& id, uint8_t init_perms) {
uint32_t min_time = 0xFFFFFFFF;
ClientInfo* oldest = &clients[MAX_CLIENTS - 1];
ClientInfo* oldest = NULL;
for (int i = 0; i < num_clients; i++) {
if (id.matches(clients[i].id)) return &clients[i]; // already known
if (!clients[i].isAdmin() && clients[i].last_activity < min_time) {
@@ -232,6 +232,7 @@ ClientInfo* ClientACL::putClient(const mesh::Identity& id, uint8_t init_perms) {
if (num_clients < MAX_CLIENTS) {
c = &clients[num_clients++];
} else {
if (oldest == NULL) return NULL; // every entry is an admin, so don't evict
c = oldest; // evict least active contact
orphanTimestamp(c);
}
@@ -268,6 +269,7 @@ bool ClientACL::applyPermissions(const mesh::LocalIdentity& self_id, const uint8
mesh::Identity id(pubkey);
c = putClient(id, 0);
if (c == NULL) return false; // couldn't put client
c->permissions = perms; // update their permissions
self_id.calcSharedSecret(c->shared_secret, pubkey);
+1 -1
View File
@@ -86,7 +86,7 @@ public:
void persistTimestamp(ClientInfo* c, uint32_t sender_timestamp, uint32_t now);
ClientInfo* getClient(const uint8_t* pubkey, int key_len);
ClientInfo* putClient(const mesh::Identity& id, uint8_t init_perms);
ClientInfo* putClient(const mesh::Identity& id, uint8_t init_perms); // returns NULL if table is full and all entries are admins
bool applyPermissions(const mesh::LocalIdentity& self_id, const uint8_t* pubkey, int key_len, uint8_t perms);
int getNumClients() const { return num_clients; }