Dear RIOTers, for the past 2 weeks or so, I have been unable to wrap my head around a bug in my AODVv2 code which prevented any unicast messages (i.e. Route Reply packets) from being sent. There’s a high probability that some of this is my fault, but at this point, I’m wondering whether the current status of the NDP implementation might have something to do with it as well.
The problem is as follows: Whenever a Route Request (RREQ) Packet arrives at its Target Node (TargNode), the Target Node answers with a Route Reply (RREP) packet, basically saying “here I am, you’ve found a route to me, start sending your data”- While RREQs are broadcasted, a RREP is unicast back to the Originating Node (OrigNode), hop by hop. When a RREQ arrives at TargNode, it stores a route towards OrigNode in its routing table, with the 1 hop neighbor that sent the RREQ as the next hop towards OrigNode. So, when a RREP has to be sent, the next hop towards OrigNode is looked up and destiny_socket_sendto(_sock_snd, buffer, length, 0, &next_hop, sizeof next_hop) is called. In consequence, ipv6_send_packet() is called, which asks the Neighbor Cache whether it knows about next_hop. Usually, the Neighbor Cache does not know about next_hop, even though it should. This leads to AODVv2 being called through the invocation of ip_get_next_hop(*next_hop) again. And while AODVv2 knows next_hop as a, well, next hop, it does not have a dedicated routing table entry towards next_hop (and manually adding one as soon as I get a packet from next_hop is prone to sequence number inconsistencies and other fuckups), so it starts a (non-blocking) route discovery for next_hop and returns -1. Oops. The code where this happens can be found in .
I’ve tried to figure out if I did something wrong and how to make this work, but I’m a bit stuck. So, my questions are:
- did I do something fundamentally wrong? if not:
- did I miss any pull requests that might fix this? If no, are any planned in the near future? (i.e. what’s the status?)
- if all else fails, can I manually add a NDP entry for next_hop as soon as I get a packet from next_hop or will this just lead to me shooting myself in the foot more creatively?
- I’m using https://github.com/RIOT-OS/RIOT/pull/873
- I’m fairly certain that my code used to work, but that was before the build system was changed fundamentally (no more external modules…), so it’s a bit of a pain to revert.
I’d be very very grateful for any help.
 actually, next_hop is stored in a struct sockaddr6_t, but I’ve simplified that for better readability  https://github.com/Lotterleben/RIOT/blob/aodvv2-clean/sys/net/routing/aodvv2/aodv.c