Question about ipv6 context binding (returning NULL)


Flavio Arieta <flavioarieta@...>
 

Hi,


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:



Thanks.
Flávio Arieta Netto.


Paul Sokolovsky
 

On Fri, 30 Jun 2017 10:06:23 -0300
Flavio Arieta <flavioarieta@gmail.com> wrote:

Hi,


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.
That means that you don't have network interfaces (i.e. network
hardware) configured, so network communication wouldn't work anyway.

[]



Am I missing something with my network interfaces or even on my
prj.conf?
Right, network interfaces are configured in prj.conf.

[]

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog