fix: respect DontMqttMeBro flag regardless of channel PSK (#9626)
The previous PSK check was broken from its introduction in #4643 — memcmp was used in boolean context without comparing to 0, inverting the condition. Since no one noticed for over a year, the PSK-based filtering provided no practical value. Simplifying to always respect the sender's preference is both more correct and easier to reason about.
This commit is contained in:
+2
-4
@@ -754,10 +754,8 @@ void MQTT::onSend(const meshtastic_MeshPacket &mp_encrypted, const meshtastic_Me
|
||||
if (mp_decoded.which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||
// For uplinking other's packets, check if it's not OK to MQTT or if it's an older packet without the bitfield
|
||||
bool dontUplink = !mp_decoded.decoded.has_bitfield || !(mp_decoded.decoded.bitfield & BITFIELD_OK_TO_MQTT_MASK);
|
||||
// check for the lowest bit of the data bitfield set false, and the use of one of the default keys.
|
||||
if (!isFromUs(&mp_decoded) && !isMqttServerAddressPrivate && dontUplink &&
|
||||
(ch.settings.psk.size < 2 || (ch.settings.psk.size == 16 && memcmp(ch.settings.psk.bytes, defaultpsk, 16)) ||
|
||||
(ch.settings.psk.size == 32 && memcmp(ch.settings.psk.bytes, eventpsk, 32)))) {
|
||||
// Respect the DontMqttMeBro flag for other nodes' packets on public MQTT servers
|
||||
if (!isFromUs(&mp_decoded) && !isMqttServerAddressPrivate && dontUplink) {
|
||||
LOG_INFO("MQTT onSend - Not forwarding packet due to DontMqttMeBro flag");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user