[riot-notifications] [RIOT-OS/RIOT] at86rf2xx: unable to send packets with empty payloads (#11163)

Martine Lenders notifications at github.com
Tue Mar 12 15:30:41 CET 2019


<!--
====================================
IF YOUR ISSUE IS RELATED TO SECURITY
====================================
please submit it to the security mailing-list security at riot-os.org.

If your issue is a question related to the usage of RIOT, please submit it to
the user mailing-list users at riot-os.org or to the developer mailing-list
devel at riot-os.org.
-->

#### Description
It is not possible to send an UDP packet with an empty payload via an `at86rf2xx`-shipping board (considering #11161 is merged), as an assertion in the device driver is hit. I was able to find the same problem in `cc2420` but did not check any more devices.

I am raising this issue instead of fixing it, since I'm not sure where to fix it exactly, as I see three possible solutions. The assert (see "Actual results" section) itself is correct, so the deepest level to fix this would be to add a check for `len` in `at86rf2xx_sram_write()`.

https://github.com/RIOT-OS/RIOT/blob/b50ad9ed4cecf367f05e009f63b8fa5b5cc0b06e/drivers/at86rf2xx/at86rf2xx_internal.c#L71-L81

or ` at86rf2xx_tx_load()` if we just want to solve this for sending specifically by checking there for `len` 

https://github.com/RIOT-OS/RIOT/blob/b50ad9ed4cecf367f05e009f63b8fa5b5cc0b06e/drivers/at86rf2xx/at86rf2xx.c#L158-L164

However, one typically knows what they are doing when they are sending with the device driver directly, so maybe we rather want to fix the `netdev` interface handling of the device(s) by checking in this loop for `iol->iol_len == 0`.

https://github.com/RIOT-OS/RIOT/blob/b50ad9ed4cecf367f05e009f63b8fa5b5cc0b06e/drivers/at86rf2xx/at86rf2xx_netdev.c#L102-L110

Lastly, we could just fix it in GNRC, which would be the least intrusive fix, as we only need to fix the `gnrc_pktsnip_t` to `iolist_t` conversion instead of checking all device drivers somewhere here

https://github.com/RIOT-OS/RIOT/blob/b50ad9ed4cecf367f05e009f63b8fa5b5cc0b06e/sys/net/gnrc/netif/ieee802154/gnrc_netif_ieee802154.c#L265-L290

(which would however remove the advantage of mapping the `gnrc_pktsnip_t` list directly to `iolist_t`).

<!--
Example: Cannot build gnrc_networking application for samr21-xpro board.
-->

#### Steps to reproduce the issue
Merge #11161 and try to send a UDP packet with empty payload using `gnrc_networking` on `samr21-xpro` (with other boards the actual result might differ):

```
udp send ff02::1 1337 ""
```

<!--
Try to describe as precisely as possible here the steps required to reproduce
the issue. Here you can also describe your hardware configuration, the network
setup, etc.
-->

#### Expected results
The packet is sent and can be received by another radio (or sniffed with a sniffer).
<!--
Example: The gnrc_networking application builds on samr21-xpro.
-->

#### Actual results
The node aborts on a failed assertion in this line

https://github.com/RIOT-OS/RIOT/blob/b50ad9ed4cecf367f05e009f63b8fa5b5cc0b06e/cpu/sam0_common/periph/spi.c#L162

<!--
Please paste or specifically describe the actual output.
-->

#### Versions
Current master (b50ad9ed4cecf367f05e009f63b8fa5b5cc0b06e) with #11161 merged.
<!--
Operating system: Mac OSX, Linux, Vagrant VM
Build environment: GCC, CLang versions (you can run the following command from
the RIOT base directory: ./dist/tools/ci/print_toolchain_versions.sh).
-->

<!-- Thanks for contributing! -->


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/issues/11163
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190312/6dbb6852/attachment.html>


More information about the notifications mailing list