chirpstack-mqtt-forwarder icon indicating copy to clipboard operation
chirpstack-mqtt-forwarder copied to clipboard

Add filter for non lorawan packet

Open steph10200 opened this issue 1 month ago • 1 comments

Hi,

Following this post on my chirpstack support question

It would be interesting to be able to add a filter on the mqtt forwarder to eliminate at the source (on the gateway) packets that do not correspond to lorawan frames.

eg :

kerlink lorafwd sent to mqtt-forwarder invalid packets :

2025-10-21T18:48:28.313205+00:00 klk-wiis-0840F3 lorafwd[1554]: <4> Invalid PHY payload size 
2025-10-21T18:48:28.314194+00:00 klk-wiis-0840F3 lorafwd[1554]: <6> Uplink message (C14E) sent 
2025-10-21T18:48:28.317337+00:00 klk-wiis-0840F3 lorafwd[1554]: <6> Uplink message (C14E) acknowledged in 3.79914 ms 

and mqtt forward this packet "invalid PHY" ( but also another )

2025-10-21T18:48:31.412347+00:00 klk-wiis-0840F3 chirpstack-mqtt-forwarder[1459]: PUSH_DATA received, random_token: 20417, remote: 127.0.0.1:55334 
2025-10-21T18:48:31.412422+00:00 klk-wiis-0840F3 chirpstack-mqtt-forwarder[1459]: Sending PUSH_ACK, random_token: 20417 remote: 127.0.0.1:55334 
2025-10-21T18:48:31.412754+00:00 klk-wiis-0840F3 chirpstack-mqtt-forwarder[1459]: Sending uplink event, uplink_id: 3565471015, topic: eu868/gateway/7076ff00560840f3/event/up 
2025-10-21T18:48:31.414452+00:00 klk-wiis-0840F3 chirpstack-mqtt-forwarder[1459]: Publish. Topic = eu868/gateway/7076ff00560840f3/event/up, Pkid = 0, Payload Size = 97

The filter on the devaddr is not sufficient because the packets still pass. This creates huge MQTT traffic and unnecessary processing load on the central ChirpStack server and also a significant volume of data on the mobile network connection (since the gateway is connected via LTE).

-- Steph --

steph10200 avatar Oct 27 '25 16:10 steph10200

I've already implemented this in the filter crate: https://github.com/chirpstack/chirpstack/commit/775e4401792889494194bccbe12e39295d02ec12

Once that has been published, I will integrate here.

brocaar avatar Oct 28 '25 12:10 brocaar