Question about ipv6 context binding (returning NULL)

Flavio Arieta <flavioarieta@...>


I'm making a application to send IPv6 using UDP but got stuck when trying to assing a socket to a local address using net_context_bind().

I followed the /samples/net/echo_client/src/echo-client.c as a example, but it seems that when it reaches net_if_ipv6_addr_lookup() both __net_if_start and __net_if_end are equal, so the function returns NULL.

The address on addr6 inside of the lookup is "2001:db8::1" which I'v set on the CONFIG_NET_APP_MY_IPV6_ADDR on my prj.conf, so it is searching for the right address.

Steps to add my address:
1. Added the ipv6 to my net_if with net_if_ipv6_addr_add with net_if_get_default() and "2001:db8::1"
2. Created a net_context udp_recv6 with { 0 } 
3. Executed net_context_get(AF_INET6, SOCK_DGRAM, IPPROTO_UDP, udp_recv6)
4. Executed net_context_setup_pools
5. Tryied to bind using net_context_bind(*udp_recv6, (struct sockaddr *)&my_addr6, sizeof(struct sockaddr_in6))

On step 5 the error occurs.

Function calls:
net_context_bind -> net_if_ipv6_addr_lookup
Here the latter function returns ENOENT since ifaddr is NULL.

Am I missing something with my network interfaces or even on my prj.conf?

Link to my configuration file:

Flávio Arieta Netto.

Join to automatically receive all group messages.