[riot-notifications] [RIOT-OS/RIOT] gnrc_netif_ethernet: fix debug output for received packet (#12250)

Martine Lenders notifications at github.com
Mon Sep 16 14:08:08 CEST 2019


<!--
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
-->

#12248 ## Contribution description
A received packet is outputted in DEBUG _after_ it was already parsed, but with a reference to the already parsed header. The result is that there can be some garbage in the output and the packet is not dumped in total. As without parsing we do not have access to the header yet, we
use the `gnrc_netif_addr_to_str()` helper function instead of parsing the destination address by hand.
<!--
Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes
-->


### Testing procedure
Compile `examples/gnrc_networking` for `native` with `ENABLE_DEBUG=1` in `sys/net/gnrc/netif/ethernet/gnrc_netif_ethernet.c`. Send some packets to the application e.g. using `ping6`. You will get something like

```
gnrc_netif_ethernet: received packet from 02:ca:6d:11:65:c4 of length 78
00000000  02  58  97  2A  A6  2D  02  CA  6D  11  65  C4  86  DD  60  00
00000010  00  00  00  18  3A  FF  FE  80  00  00  00  00  00  00  00  CA
00000020  6D  FF  FE  11  65  C4  FE  80  00  00  00  00  00  00  00  58
00000030  97  FF  FE  2A  A6  2D  88  00  5A  3A  40  00  00  00  FE  80
00000040  00  00  00  00  00  00  00  CA  6D  FF  FE  11  65  C4
```

On master however, you get something like

```
gnrc_netif_ethernet: received packet from 02:ca:6d:11:65:c4 of length 78
00000000  02  58  97  2A  A6  2D  02  CA  6D  11  65  C4  86  DD  65  C4
00000010  60  00  00  00  00  18  3A  FF  FE  80  00  00  00  00  00  00
00000020  00  CA  6D  FF  FE  11  65  C4  FE  80  00  00  00  00  00  00
00000030  00  58  97  FF  FE  2A  A6  2D  88  00  5A  3A  40  00  00  00
00000040  FE  80  00  00  00  00  00  00  00  CA  6D  FF  FE  11
```

with `65  C4` in the first line of the dump being padding added by the header parsing function and the packet ending early (incidentally `65  C4` is missing at the end in my example).

(note: the dumps are from an `samr21-xpro` running `ethos`, so your dumps might vary)
<!--
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
-->


### Issues/PRs references
Found while debugging for https://github.com/RIOT-OS/RIOT/pull/11596#issuecomment-531739735, but unrelated.
<!--
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/12250

-- Commit Summary --

  * gnrc_netif_ethernet: fix debug output for received packet

-- File Changes --

    M sys/net/gnrc/netif/ethernet/gnrc_netif_ethernet.c (16)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/12250.patch
https://github.com/RIOT-OS/RIOT/pull/12250.diff

-- 
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/pull/12250
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190916/c2f30f40/attachment.htm>


More information about the notifications mailing list