TheThingsArchive / ttn

The Things Network Stack V2
https://www.thethingsnetwork.org
MIT License
461 stars 276 forks source link

DevStatusReq downlink without any application data uses uplink's application port instead of port 0 #570

Closed avbentem closed 7 years ago

avbentem commented 7 years ago

This is a bug report for the Backend (and the Console).

Example:

  1. Node sends 403A140126C0820002005629CDB1F73640BEDEF047 which is an Unconfirmed Uplink for application port 2, with the FCtrl.ADR bit set.

  2. In the gateway traffic, TTN Console shows it's responding with 603A140126200300022A0F94A8:

  3. 603A140126200300022A0F94A8 decodes to an Unconfirmed Data Down without any application data, but with FPort set to 2:

    Message Type = Data
      PHYPayload = 603A140126200300022A0F94A8
    
    ( PHYPayload = MHDR[1] | MACPayload[..] | MIC[4] )
            MHDR = 60
      MACPayload = 3A14012620030002
             MIC = 2A0F94A8
    
    ( MACPayload = FHDR | FPort | FRMPayload )
            FHDR = 3A140126200300
           FPort = 02
      FRMPayload = 
    
          ( FHDR = DevAddr[4] | FCtrl[1] | FCnt[2] | FOpts[0..15] )
         DevAddr = 2601143A (Big Endian)
           FCtrl = 20
            FCnt = 0003 (Big Endian)
           FOpts = 
    
    Message Type = Unconfirmed Data Down
       Direction = down
            FCnt = 3
       FCtrl.ACK = true
       FCtrl.ADR = false
  4. In the application data, TTN Console shows that the downlink was using port 0 (which it should, but did not, so maybe there's a bug in Console as well?):

Environment

htdvisser commented 7 years ago

Confirmed. Shouldn't be too hard to fix.