mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-11 07:32:14 +00:00
Only accept PKI messages for MQTT downlink if we know transmitter and receiver (#4498)
This commit is contained in:
parent
7a65c8838d
commit
a85df199a5
@ -164,10 +164,14 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length)
|
||||
|
||||
// PKI messages get accepted even if we can't decrypt
|
||||
if (router && p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag &&
|
||||
strcmp(e.channel_id, "PKI") == 0)
|
||||
router->enqueueReceivedMessage(p);
|
||||
// ignore messages if we don't have the channel key
|
||||
else if (router && perhapsDecode(p))
|
||||
strcmp(e.channel_id, "PKI") == 0) {
|
||||
meshtastic_NodeInfoLite *tx = nodeDB->getMeshNode(getFrom(p));
|
||||
meshtastic_NodeInfoLite *rx = nodeDB->getMeshNode(p->to);
|
||||
// Only accept PKI messages if we have both the sender and receiver in our nodeDB, as then it's likely
|
||||
// they discovered each other via a channel we have downlink enabled for
|
||||
if (tx && tx->has_user && rx && rx->has_user)
|
||||
router->enqueueReceivedMessage(p);
|
||||
} else if (router && perhapsDecode(p)) // ignore messages if we don't have the channel key
|
||||
router->enqueueReceivedMessage(p);
|
||||
else
|
||||
packetPool.release(p);
|
||||
|
Loading…
Reference in New Issue
Block a user