[riot-devel] GCOAP Error from gnrc_sock_udp

smlng s at mlng.net
Tue Dec 19 13:51:53 CET 2017


Hi Josua,

thanks for reporting the issue, please also consider to open one on Github, which allows
proper tracking of the issue.

> On 19. Dec 2017, at 13:32, Arndt, Josua <jarndt at ias.rwth-aachen.de> wrote:
> 
> Hello I got an strange behavior when compiling the gcoap example. Maye someone has an idea.
>  
> I run Riot on an atxmega256a3u with an at86rf233.
>  
> When I compile with ENABLE_DEBUG (1) tin gcoap.c then everything works as expected and I am able to get .well-known/core information from the node.
> But when I disable debug I always get the error -EPROTO  from gnrc_sock_udp.  
> Which checks 
>  
> if (
>         (sock->remote.family != AF_UNSPEC) &&  /* check remote end-point if set */
>         ((sock->remote.port != byteorder_ntohs(hdr->src_port)) ||
>         /* We only have IPv6 for now, so just comparing the whole end point
>          * should suffice */
>         ((memcmp(&sock->remote.addr, &ipv6_addr_unspecified,
>                  sizeof(ipv6_addr_t)) != 0) &&
>          (memcmp(&sock->remote.addr, &tmp.addr, sizeof(ipv6_addr_t)) != 0)))) {
>  
> With debug:
> _recv_ieee802154: received packet from 18:c0:ff:ee:1a:c0:ff:ee of length 65
> 00000000  6F  00  08  E0  8B  21  A5  00  00  00  00  00  00  00  00  00
> 00000010  00  00  00  00  01  21  A5  00  00  00  00  00  00  20  28  3C
> 00000020  DC  25  BB  61  3E  F0  81  3D  16  33  F2  6F  50  01  73  6A
> 00000030  BB  2E  77  65  6C  6C  2D  6B  6E  6F  77  6E  04  63  6F  72
> 00000040  65
> _recv_ieee802154: reallocating.
> Address Format specified unspecified 0, Format 0
> Port 0 != 33085
> IP good ipv6_addr_unspecified: 0
> IP good tmp.addr: 1
>  
> Without Debug:
> _recv_ieee802154: received packet from 18:c0:ff:ee:1a:c0:ff:ee of length 65
> 00000000  6F  00  05  01  10  21  A5  00  00  00  00  00  00  00  00  00
> 00000010  00  00  00  00  01  21  A5  00  00  00  00  00  00  20  28  3C
> 00000020  DC  25  BB  61  3E  F0  83  5E  16  33  F0  4E  50  01  73  6A
> 00000030  BB  2E  77  65  6C  6C  2D  6B  6E  6F  77  6E  04  63  6F  72
> 00000040  65
> _recv_ieee802154: reallocating.
> Address Format specified unspecified 1, Format -29115
> Port 41 != 33630
> IP good ipv6_addr_unspecified: 1
> IP good tmp.addr: 1
> 

This looks like some memory is used without proper initialisation. When compiled with debug
symbols and output, memory is likely zeroed but w/o debug it's not. Hence, you get arbitrary
ports and IPv6 addresses and formats, e.g., port 41 or format -29115, here.

Cheers,
  Sebastian



More information about the devel mailing list