cetic / 6lbr

A deployment-ready 6LoWPAN Border Router solution based on Contiki
github.com/cetic/6lbr/wiki
Other
337 stars 194 forks source link

Neighbor cache can only hold one IP per link local address #309

Closed sbungartz closed 6 years ago

sbungartz commented 7 years ago

Hello, I could not manage to set up 6lbr in SMART_BRIDGE mode (develop branch) on a Raspberry Pi to reach IP addresses NDP_Proxied IPs from docker containers on a host in my network.

This led me to take a look at the source and I was surprised to see, that the IPv6 neighbor cache implemented in core/net/ipv6/uip-ds6-nbr.c is uniquely indexed on the link local address. In my understanding it should be very well possible to have multiple IP entries for the same link local address in an IPv6 neighbor cache. Or am I mistaken? In fact, ip -6 neigh yields lots of duplicate lladdrs for me and seems to be just fine with it.

This limitation already becomes a problem when you have hosts with Privacy Extensions enabled on your network, since they will configure two IP addresses but only one of them can ever be stored by 6lbr at the same time - an issue I have also encountered already when trying to reach my dev machine from 6LoWPAN.

Could you tell me if you think this is a bug and if there is a mode/configuration where this would not be an issue? Thanks!

laurentderu commented 7 years ago

The limitation of one IP address per MAC address is indeed a limitation of the current neighbor table implementation of Contiki, even having both a link local and a global address should not be possible, but there is a loophole allowing this. This is an oversimplification that is perfectly fine for RPL network, but breaks when using more vanilla IPv6 configuration.

There is a workaround implemented in 6LBR, but it's rather limited. There is also a PR pending in Contiki about that topic, see https://github.com/contiki-os/contiki/pull/2098 , that should provide a more comprehensive fix, but I did not had time to look at it in depth yet. And I'm a bit reluctant to merge it into 6LBR blindly as it could stealthy break many things.

But if you're adventurous you could merge it and try if it solves your problem, in the mean time I will try to find some time to carefully review it.