Hi, there is a bug in neighbor_add method by my opinion.
aodv_neighbor.c - neighbor_add{
-----------------------------------
u_int32_t seqno = 0;
.
.
.
if (rt->dest_seqno != 0)
seqno = rt->dest_seqno;
rt_table_update(rt, source, 1, seqno, ACTIVE_ROUTE_TIMEOUT,
VALID, rt->flags);
}
----------------------
}
Preconditions:
- node B has sequence number y
- node A had valid route to node B with latest sequence number y, but route entry is invalid(expired) now, so sequence number was increased to y+1 and marked as invalid
When node A now receives AODV control packet directly from node B, it marks route entry to B as active and valid, with sequence number in route entry still y+1. BUT sequence number of node B is still y, not y+1. This can create routing loops.
Better test is
if (rt->state == VALID)
seqno = rt->dest_seqno;