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

Relay MAC commands sent as a response to a relay forward request are ignored #15

Closed
adriansmares opened this issue Sep 14, 2023 · 3 comments

Comments

@adriansmares
Copy link

adriansmares commented Sep 14, 2023

When LBM is compiled with relay RX support, LBM will ignore relay MAC commands (FPort 0) which are sent as a response to a uplink forwarding request (FPort 226). This happens because the following part of the MAC command parser checks the TX port instead of the RX port:

#if defined( RELAY_RX )
default: {
if( ( lr1_mac->tx_fport_present == true ) && ( lr1_mac->tx_fport == FPORT_RELAY ) )
{
lr1_mac->nwk_payload_size = 0; // Don't process data on FPORT 226 as MAC command
}
else
{
const bool mac_is_known = relay_rx_mac_parser( lr1_mac );
if( mac_is_known == false )
{
lr1_mac->nwk_payload_size = 0;
SMTC_MODEM_HAL_TRACE_PRINTF( " Unknown mac command %02x\n", cmd_identifier );
}
}
}
break;

I think this is a mistake, as non-relay MAC commands are processed, but relay MAC commands themselves cannot be sent as a response to a relay forwarding request. A possible fixup may be to check the RX metadata instead:

if( ( lr1_mac->rx_down_data.rx_metadata.rx_fport_present == true ) && ( lr1_mac->rx_down_data.rx_metadata.rx_fport == FPORT_RELAY ) )
@lbm-team
Copy link
Contributor

Hello @adriansmares,

Thanks for the catch!
It will be fixed in the next release.
In the meantime, your proposal is valid.

@lbm-team
Copy link
Contributor

Hello,

This issue was solved in the release v4.4.0-feature-relay.
I will let you close the issue if the fix is ok for you.

@adriansmares
Copy link
Author

The fix looks good to me and I cannot reproduce this anymore in v4.4.0-feature-relay 👍 .

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

No branches or pull requests

2 participants