* 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:
bg- 2007-05-08 08:36:00 +00:00
parent 67e23ee564
commit b10eea85f5

View file

@ -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
PRINTF("SKIP %d.%d.%d.%d\n", uip_ipaddr_to_quad(next_gw));
return UIP_FW_OK;
#endif
} else {
if (cc2420_check_remote(route->nexthop.u16[1]) == REMOTE_YES) {
PRINTF("LOST %d.%d\n",
route->nexthop.u16[1] & 0xff, route->nexthop.u16[1] >> 8);
/* Send bad route notification? */
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 if (cc2420_check_remote(route->nexthop.u16[1]) == REMOTE_YES) {
h.dst = route->nexthop.u16[1]; PRINTF("LOST %d.%d\n",
} route->nexthop.u16[1] & 0xff, route->nexthop.u16[1] >> 8);
if (tcpip_is_forwarding && cc2420_is_input)
uaodv_bad_route(route);
else
uaodv_request_route_to(next_gw);
return UIP_FW_DROPPED;
} else {
h.dst = route->nexthop.u16[1];
uaodv_rt_lru(route);
} }
} }
} }