Routing API: drop_route
This commit is contained in:
parent
eaa3b6ad79
commit
4ffab13eeb
|
@ -476,23 +476,6 @@ output_fallback(void)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
drop_route(uip_ds6_route_t *route)
|
|
||||||
{
|
|
||||||
#if UIP_CONF_IPV6_RPL && (UIP_CONF_IPV6_RPL_LITE == 0)
|
|
||||||
|
|
||||||
/* If we are running RPL, and if we are the root of the
|
|
||||||
network, we'll trigger a global repair before we remove
|
|
||||||
the route. */
|
|
||||||
rpl_dag_t *dag;
|
|
||||||
dag = (rpl_dag_t *)route->state.dag;
|
|
||||||
if(dag != NULL && dag->instance != NULL) {
|
|
||||||
rpl_repair_root(dag->instance->instance_id);
|
|
||||||
}
|
|
||||||
#endif /* UIP_CONF_IPV6_RPL && (UIP_CONF_IPV6_RPL_LITE == 0) */
|
|
||||||
uip_ds6_route_rm(route);
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static void
|
|
||||||
annotate_transmission(uip_ipaddr_t *nexthop)
|
annotate_transmission(uip_ipaddr_t *nexthop)
|
||||||
{
|
{
|
||||||
#if TCPIP_CONF_ANNOTATE_TRANSMISSIONS
|
#if TCPIP_CONF_ANNOTATE_TRANSMISSIONS
|
||||||
|
@ -558,9 +541,11 @@ get_nexthop(uip_ipaddr_t *addr)
|
||||||
never responded to link-layer acks, we drop its route. */
|
never responded to link-layer acks, we drop its route. */
|
||||||
if(nexthop == NULL) {
|
if(nexthop == NULL) {
|
||||||
LOG_ERR("output: found dead route\n");
|
LOG_ERR("output: found dead route\n");
|
||||||
drop_route(route);
|
/* Notifiy the routing protocol that we are about to remove the route */
|
||||||
/* We don't have a nexthop to send the packet to, so we drop
|
NETSTACK_ROUTING.drop_route(route);
|
||||||
it. */
|
/* Remove the route */
|
||||||
|
uip_ds6_route_rm(route);
|
||||||
|
/* We don't have a nexthop to send the packet to, so we drop it. */
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("output: found next hop from routing table: ");
|
LOG_INFO("output: found next hop from routing table: ");
|
||||||
LOG_INFO_6ADDR(nexthop);
|
LOG_INFO_6ADDR(nexthop);
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#include "net/nbr-table.h"
|
#include "net/nbr-table.h"
|
||||||
#include "sys/stimer.h"
|
#include "sys/stimer.h"
|
||||||
#include "lib/list.h"
|
#include "lib/list.h"
|
||||||
#include "net/routing/routing.h"
|
|
||||||
|
|
||||||
#ifdef UIP_CONF_MAX_ROUTES
|
#ifdef UIP_CONF_MAX_ROUTES
|
||||||
#define UIP_MAX_ROUTES UIP_CONF_MAX_ROUTES
|
#define UIP_MAX_ROUTES UIP_CONF_MAX_ROUTES
|
||||||
|
|
|
@ -103,6 +103,11 @@ link_callback(const linkaddr_t *addr, int status, int numtx)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
drop_route(uip_ds6_route_t *route)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
const struct routing_driver nullrouting_driver = {
|
const struct routing_driver nullrouting_driver = {
|
||||||
"Null Routing",
|
"Null Routing",
|
||||||
init,
|
init,
|
||||||
|
@ -116,6 +121,7 @@ const struct routing_driver nullrouting_driver = {
|
||||||
ext_header_srh_update,
|
ext_header_srh_update,
|
||||||
ext_header_srh_get_next_hop,
|
ext_header_srh_get_next_hop,
|
||||||
link_callback,
|
link_callback,
|
||||||
|
drop_route,
|
||||||
};
|
};
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,12 @@ struct routing_driver {
|
||||||
* \param numtx The total number of transmission attempts
|
* \param numtx The total number of transmission attempts
|
||||||
*/
|
*/
|
||||||
void (* link_callback)(const linkaddr_t *addr, int status, int numtx);
|
void (* link_callback)(const linkaddr_t *addr, int status, int numtx);
|
||||||
|
/**
|
||||||
|
* Called by uIP if it has decided to drop a route because
|
||||||
|
*
|
||||||
|
* \param route The route that will be dropped after this function returns
|
||||||
|
*/
|
||||||
|
void (* drop_route)(uip_ds6_route_t *route);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ROUTING_H_ */
|
#endif /* ROUTING_H_ */
|
||||||
|
|
|
@ -371,6 +371,18 @@ local_repair(const char *str)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
drop_route(uip_ds6_route_t *route)
|
||||||
|
{
|
||||||
|
/* If we are the root of the network, trigger a global repair before
|
||||||
|
the route gets removed */
|
||||||
|
rpl_dag_t *dag;
|
||||||
|
dag = (rpl_dag_t *)route->state.dag;
|
||||||
|
if(dag != NULL && dag->instance != NULL) {
|
||||||
|
rpl_repair_root(dag->instance->instance_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
const struct routing_driver rpl_classic_driver = {
|
const struct routing_driver rpl_classic_driver = {
|
||||||
"RPL Classic",
|
"RPL Classic",
|
||||||
init,
|
init,
|
||||||
|
@ -384,6 +396,7 @@ const struct routing_driver rpl_classic_driver = {
|
||||||
rpl_ext_header_srh_update,
|
rpl_ext_header_srh_update,
|
||||||
rpl_ext_header_srh_get_next_hop,
|
rpl_ext_header_srh_get_next_hop,
|
||||||
rpl_link_callback,
|
rpl_link_callback,
|
||||||
|
drop_route,
|
||||||
};
|
};
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -193,6 +193,12 @@ init(void)
|
||||||
rpl_ns_init();
|
rpl_ns_init();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
drop_route(uip_ds6_route_t *route)
|
||||||
|
{
|
||||||
|
/* Do nothing. RPL-lite only supports non-storing mode, i.e. no routes */
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
const struct routing_driver rpl_lite_driver = {
|
const struct routing_driver rpl_lite_driver = {
|
||||||
"RPL Lite",
|
"RPL Lite",
|
||||||
init,
|
init,
|
||||||
|
@ -206,6 +212,7 @@ const struct routing_driver rpl_lite_driver = {
|
||||||
rpl_ext_header_srh_update,
|
rpl_ext_header_srh_update,
|
||||||
rpl_ext_header_srh_get_next_hop,
|
rpl_ext_header_srh_get_next_hop,
|
||||||
rpl_link_callback,
|
rpl_link_callback,
|
||||||
|
drop_route,
|
||||||
};
|
};
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue