* Add attribute to track bad routes and necessary support for this.
* Revamp forwarding to deal with bad routes or request new routes as appropriate.
This commit is contained in:
parent
67e23ee564
commit
b10eea85f5
1 changed files with 18 additions and 18 deletions
|
@ -55,27 +55,27 @@ cc2420_send_uaodv(void)
|
||||||
if (cc2420_check_remote(next_gw->u16[1]) == REMOTE_NO)
|
if (cc2420_check_remote(next_gw->u16[1]) == REMOTE_NO)
|
||||||
h.dst = next_gw->u16[1]; /* local, use ucast */
|
h.dst = next_gw->u16[1]; /* local, use ucast */
|
||||||
else { /* remote or unknown */
|
else { /* remote or unknown */
|
||||||
struct uaodv_rt_entry *route = uaodv_request_route_to(next_gw);
|
struct uaodv_rt_entry *route = uaodv_rt_lookup_any(next_gw);
|
||||||
|
|
||||||
if (route == NULL) {
|
if (route == NULL || route->is_bad) {
|
||||||
h.dst = next_gw->u16[1]; /* try local while waiting for route */
|
if (tcpip_is_forwarding && cc2420_is_input)
|
||||||
#if 0
|
uaodv_bad_route(route);
|
||||||
PRINTF("SKIP %d.%d.%d.%d\n", uip_ipaddr_to_quad(next_gw));
|
else
|
||||||
return UIP_FW_OK;
|
uaodv_request_route_to(next_gw);
|
||||||
#endif
|
return UIP_FW_DROPPED;
|
||||||
} else {
|
} else if (cc2420_check_remote(route->nexthop.u16[1]) == REMOTE_YES) {
|
||||||
if (cc2420_check_remote(route->nexthop.u16[1]) == REMOTE_YES) {
|
|
||||||
PRINTF("LOST %d.%d\n",
|
PRINTF("LOST %d.%d\n",
|
||||||
route->nexthop.u16[1] & 0xff, route->nexthop.u16[1] >> 8);
|
route->nexthop.u16[1] & 0xff, route->nexthop.u16[1] >> 8);
|
||||||
/* Send bad route notification? */
|
if (tcpip_is_forwarding && cc2420_is_input)
|
||||||
uaodv_bad_route(route);
|
uaodv_bad_route(route);
|
||||||
uaodv_rt_remove(route);
|
else
|
||||||
h.dst = 0xffff; /* revert to bcast */
|
uaodv_request_route_to(next_gw);
|
||||||
} else /* unknown */ {
|
return UIP_FW_DROPPED;
|
||||||
/* This will implicitly update neigbour table. */
|
} else {
|
||||||
h.dst = route->nexthop.u16[1];
|
h.dst = route->nexthop.u16[1];
|
||||||
|
uaodv_rt_lru(route);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue