[riot-notifications] [RIOT-OS/RIOT] GCOAP Error from gnrc_sock_udp (#8287)

Josar notifications at github.com
Tue Dec 19 14:03:58 CET 2017


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

```
So the question is where are these values assigned to the sock, so I can investigate this further.
And what could cause this strange behavior.

Thanks in advance
Josua Arndt

Answer from the mailing list:

> 
> 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



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

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

#### Steps to reproduce the issue
<!--
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.
-->
Run gcoap example without debug.

#### Expected results
<!--
Example: The gnrc_networking application builds on samr21-xpro.
-->
With debug enabled and debug dsiabled answering coap request should work.

#### Actual results
<!--
Please paste or specifically describe the actual output.
-->
Does not. 
#### Versions
<!--
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).
-->
Riot on atxmega256a3u with an at86rf233.
RPI with openlabs transeiver and libcoap.

<!-- 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/8287
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20171219/82799a2c/attachment.html>


More information about the notifications mailing list