Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark packets received via MQTT and add option to ignore them #3117

Merged
merged 3 commits into from
Jan 20, 2024

Conversation

GUVWAF
Copy link
Member

@GUVWAF GUVWAF commented Jan 20, 2024

This will use one bit in the unencrypted Meshtastic header flags (out of 4 currently unused) to mark that a packet passed via MQTT somewhere on the path towards the node. Using the LoRa config ignore_mqtt, one can then ignore packets that came via MQTT. The via_mqtt tag in the MeshPacket can also be used to show that a Traceroute did not go purely via LoRa.

Tested with three devices, 2 of which where connected to MQTT, of which one had LoRa Tx disabled. Packets received via MQTT were marked accordingly and ignored correctly. Note that the tag is only set when receiving a downlink on MQTT and not when an uplink is sent via MQTT, as it would mark the packet in memory and then also send it out marked when sending via LoRa.

Needs protobuf PR meshtastic/protobufs#423.

@andrekir
Copy link
Member

looks good!

in MQTT::onSend can we add a check for via_mqtt and return when it is tagged? this will prevent a feedback loop (causing duplicates) for packets that we now know came from MQTT.

@GUVWAF
Copy link
Member Author

GUVWAF commented Jan 20, 2024

in MQTT::onSend can we add a check for via_mqtt and return when it is tagged? this will prevent a feedback loop (causing duplicates) for packets that we now know came from MQTT.

Yes, we can do that, but we would need to create an implicit ACK in another way then, otherwise it tries to retransmit every time. Shall we just create an implicit ACK whenever it is connected to the MQTT broker?

@andrekir
Copy link
Member

Yes, we can do that, but we would need to create an implicit ACK in another way then, otherwise it tries to retransmit every time. Shall we just create an implicit ACK whenever it is connected to the MQTT broker?

yes, I believe preventing duplicates would be the priority. we're at over 85% duplicates in the public MQTT LongFast, if this is the main source it will be a big improvement.

Generate implicit ACK for packets we as an MQTT gateway sent
@GUVWAF
Copy link
Member Author

GUVWAF commented Jan 20, 2024

Implemented in 5363ad8.

@thebentern
Copy link
Contributor

2.2.19 protos yanked and reprovisioned with the new config property

@thebentern thebentern merged commit 8f6a283 into meshtastic:master Jan 20, 2024
62 checks passed
andrekir added a commit to meshtastic/Meshtastic-Android that referenced this pull request Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants