Relay NotifyNewEndDeviceReq payload incorrectly formatted
Summary
The payload of the Relay MAC command NotifyNewEndDeviceReq is not correctly formatted/parsed on TTS.
Steps to Reproduce
- Register two devices on the console on LW v1.0.4.
- Set one device as the serving device (relay):
ttn-lw-cli relays create <app-id> <device-id> --mode.serving - Set other device as the served device (node):
ttn-lw-cli relays create <app-id> <device-id> --mode.served.mode.always --mode.served.serving-device-id <device-id> - Set uplink rule for serving device to allow served device to use the relay:
ttn-lw-cli relays uplink-forwarding-rules create <app-id> <device-id> 0 --device-id <device-id> - Let the end-device join the network through a normal gateway.
- Send an uplink from the end-device through the relay, such that
NotifyNewEndDeviceReqis triggered.
Current Result
NotifyNewEndDeviceReq payload formatted as per TS011 paragraph 10.7
First four bytes DevAddr, last two bytes PowerLevel
Served device DevAddr copied from Console: 260B470F
Relay log:
18:51:49.983 > [MAC] 46
18:51:49.983 > [Pay] 0f 47 0b 26 76 00
Relay console log:
{
"name": "ns.mac.relay_notify_new_end_device.indication",
"time": "2024-10-09T16:51:50.829305191Z",
"identifiers": [
{
"device_ids": {
"device_id": "relay",
"application_ids": {
"application_id": "xxx"
},
"dev_eui": "750110000008E7A4",
"join_eui": "CE77157000000000",
"dev_addr": "260B3F14"
}
}
],
"data": {
"@type": "type.googleapis.com/ttn.lorawan.v3.MACCommand.RelayNotifyNewEndDeviceReq",
"dev_addr": "0076260B",
"snr": -5,
"rssi": -71
},
"correlation_ids": [
"gs:uplink:01J9S33AQ31XBJG162AKNSFDJS"
],
"origin": "ip-10-100-12-21.eu-west-1.compute.internal",
"context": {
"tenant-id": "CgN0dG4="
},
"visibility": {
"rights": [
"RIGHT_APPLICATION_TRAFFIC_READ"
]
},
"unique_id": "01J9S33AXDX7VPSENRNCGBVJ99"
}
Notice that the dev_addr field of RelayNotifyNewEndDeviceReq is not correct (as well as snr/rssi but those are not so easy to see).
NotifyNewEndDeviceReq payload swapped formatting
First two bytes PowerLevel, last four bytes DevAddr
Served device DevAddr copied from Console: 260B01C7
Relay log:
18:51:49.983 > [MAC] 46
18:51:49.983 > [Pay] 36 00 c7 01 0b 26
Relay console log:
{
"name": "ns.mac.relay_notify_new_end_device.indication",
"time": "2024-10-09T16:58:32.273130864Z",
"identifiers": [
{
"device_ids": {
"device_id": "relay",
"application_ids": {
"application_id": "relay-test-radiolib"
},
"dev_eui": "750110000008E7A4",
"join_eui": "CE77157000000000",
"dev_addr": "260B4801"
}
}
],
"data": {
"@type": "type.googleapis.com/ttn.lorawan.v3.MACCommand.RelayNotifyNewEndDeviceReq",
"dev_addr": "260B01C7",
"snr": 2,
"rssi": -16
},
"correlation_ids": [
"gs:uplink:01J9S3FJR578V4E7QA9CZ3F8F0"
],
"origin": "ip-10-100-5-143.eu-west-1.compute.internal",
"context": {
"tenant-id": "CgN0dG4="
},
"visibility": {
"rights": [
"RIGHT_APPLICATION_TRAFFIC_READ"
]
},
"unique_id": "01J9S3FJYHNEES6YQCSZZ3BDA5"
}
Notice that this swapped formatting yields the expected result on the console.
Expected Result
The formatting as per TS011 paragraph 10.7 should be the correct formatting (and therefore the decoding on TTS should be corrected).
Relevant Logs
No response
URL
No response
Deployment
The Things Stack Community Edition
The Things Stack Version
3.32.1
Client Name and Version
The Things Network Command-line Interface: ttn-lw-cli
Version: 3.31.1
Build date: 2024-08-01T15:00:26Z
Git commit: e351ea62e
Go version: go1.21.12
OS/Arch: windows/amd64
Other Information
No response
Proposed Fix
Swap the payload fields of NotifyNewEndDeviceReq.
Contributing
- [X] I can help by doing more research.
- [ ] I can help by implementing a fix after the proposal above is approved.
- [X] I can help by testing the fix before it's released.
Validation
- [ ] The fix is tested in a staging environment.
- [ ] The fix is documented in The Things Stack Documentation
Code of Conduct
- [X] I agree to follow TTN's Community Code of Conduct.