TheThingsNetwork / lorawan-stack

The Things Stack, an Open Source LoRaWAN Network Server
https://www.thethingsindustries.com/stack/
Apache License 2.0
936 stars 302 forks source link

MAC command are transmitted to the AS, without f_port field #3511

Closed Oliv4945 closed 3 years ago

Oliv4945 commented 3 years ago

Summary

MAC commands sent by the device on f_port = 0 creates a message forwarded to the application server:

  1. I am not sure that MAC commands on port 0 should trigger messages toward user application server
  2. The f_port key is not present, maybe because of the way protobuf MessageToJson() handles 0 values (see here)
  3. The payload is surprising, looks like a MAC command argument without the command itself. ex: 0x55F2

Steps to Reproduce

  1. join a device to the network
  2. observe traffic sent to the AS

ex, f_port is missing:

  "uplink_message":{
    "session_key_id":"AXXfpZy9b2H2fvkvESX14Q==",
    "f_cnt":3,
    "frm_payload":"VfI=",
    "rx_metadata":[
      {
        "gateway_ids":{
          "gateway_id":"gateway-us",
          "eui":"----------------"
        },
        "timestamp":2943015087,
        "rssi":-48,
        "channel_rssi":-48,
        "snr":10.2,
        "uplink_token":"ChgKFgoKZ2F0ZXdheS11cxII3q2+78AP/uUQr7Gr+woaDAid3dj9BRCKnqijASCY1/nK06gP",
        "channel_index":5
      }
    ]
  }

What do you want to see instead?

  1. It might be better to avoid forwarding the message to the user, especially because the payload does not make any sense
  2. If the message is forwarded please add the f_port: 0 fields

Environment

TTI hosted LNS, v3.10.0

Can you do this yourself and submit a Pull Request?

No, sorry

rvolosatovs commented 3 years ago

This will be fixed in 3.11 by this commit https://github.com/TheThingsNetwork/lorawan-stack/pull/3263/commits/e36086b417d76c9dd2fca121a25fa2d0be34308d