mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-12 16:12:07 +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
|
// PKI messages get accepted even if we can't decrypt
|
||||||
if (router && p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag &&
|
if (router && p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag &&
|
||||||
strcmp(e.channel_id, "PKI") == 0)
|
strcmp(e.channel_id, "PKI") == 0) {
|
||||||
router->enqueueReceivedMessage(p);
|
meshtastic_NodeInfoLite *tx = nodeDB->getMeshNode(getFrom(p));
|
||||||
// ignore messages if we don't have the channel key
|
meshtastic_NodeInfoLite *rx = nodeDB->getMeshNode(p->to);
|
||||||
else if (router && perhapsDecode(p))
|
// 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);
|
router->enqueueReceivedMessage(p);
|
||||||
else
|
else
|
||||||
packetPool.release(p);
|
packetPool.release(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user