cpu/nrf52/radio/nrf802154: fix beacon acceptance
Contribution description
The nrf802154_radio.c file implements a frame filter on the MAC sublayer as mentioned in IEEE 802.15.4-2020 in Section 6.7.2 Reception and rejection. For beacon frames (section e), it should check if source PAN ID matches the PAN ID of the device. This is currently not the case and beacon frames get filtered out.
This PR implements the PAN ID check, while also confirming that source PAN ID is present in the first place.
Testing procedure
Tests provided in the first commit. (requires two nrf52 devices)
Issues/PRs references
It looks like this is your first Pull Request? It looks very good for a first PR :) You probably noticed the failed "static tests", this is due to some coding conventions (like no trailing whitespaces at the end of the line). You can find some more information about that here: https://github.com/RIOT-OS/RIOT/blob/master/CONTRIBUTING.md#coding-conventions
You can perform these static tests on your local machine before publishing a Pull Request (however this is no guarantuee that the tests here won't fail. Sometimes something slips though and that's okay :) ).
I'll try to give this a try next week. However I don't know much about 802.15.4.
For the test program, it might be good to add one or two commands to send frames without PAN ID or with a mismatched PAN ID to see if the code you added will correctly handles these cases (even though they shouldn't occur in the first place).
I tested the PR today and everything works as expected.
My only two remaining remarks are:
-
The beacon function in the test program is called
send, which doesn't make it super obvious that it'll send a beacon.bcnsndwould follow the "scheme" set bytxtsndorbeaconsend, which is a bit nicer to remember. Maybe as a description you could writeSend an IEEE 802.15.4 beaconinstead ofsending Beacon. -
While you're at it, you could add a sentence to the
Aboutsection in the README file to specify for which devices this test works. I first grabbed an nRF52DK with the nRF52832, which does not support IEEE 802.15.4. Something like "Supported are for example nRF52840 based boards."
Murdock results
:heavy_check_mark: PASSED
a5823397bc4b7044e3f09e53ad87affb0c721f75 cpu/nrf52/radio/nrf802154: fix beacon frame acceptance in _l2filter
| Success | Failures | Total | Runtime |
|---|---|---|---|
| 10271 | 0 | 10271 | 08m:25s |
Artifacts
@crasbe I think your two comments have been addressed, right?
Yes 👍
Congratz on your first merged PR, @Lukas-Luger :tada: