Removed redundant code
This commit is contained in:
parent
cef95ebf9b
commit
e11b7d4fb6
3 changed files with 15 additions and 24 deletions
|
@ -533,7 +533,7 @@ rpl_find_parent_any_dag(rpl_instance_t *instance, uip_ipaddr_t *addr)
|
|||
}
|
||||
/************************************************************************/
|
||||
rpl_dag_t *
|
||||
rpl_select_dodag(rpl_instance_t * instance, rpl_parent_t *p)
|
||||
rpl_select_dodag(rpl_instance_t *instance, rpl_parent_t *p)
|
||||
{
|
||||
rpl_parent_t *last_parent;
|
||||
rpl_dag_t *dag, *end, *best_dag;
|
||||
|
@ -643,9 +643,8 @@ rpl_select_parent(rpl_dag_t *dag)
|
|||
|
||||
if(best != NULL) {
|
||||
dag->preferred_parent = best;
|
||||
} else {
|
||||
/* We should probably do something here .... */
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
/************************************************************************/
|
||||
|
@ -693,8 +692,7 @@ rpl_move_parent(rpl_dag_t *dag_src, rpl_dag_t *dag_dst, rpl_parent_t *parent)
|
|||
if(parent == dag_src->preferred_parent) {
|
||||
dag_src->preferred_parent = NULL;
|
||||
dag_src->rank = INFINITE_RANK;
|
||||
if(dag_src->joined
|
||||
&& dag_src->instance->def_route != NULL) {
|
||||
if(dag_src->joined && dag_src->instance->def_route != NULL) {
|
||||
if(dag_src->instance->def_route->isused) {
|
||||
PRINTF("RPL: Removing default route ");
|
||||
PRINT6ADDR(&parent->addr);
|
||||
|
@ -966,6 +964,7 @@ global_repair(uip_ipaddr_t *from, rpl_dag_t *dag, rpl_dio_t *dio)
|
|||
dag->instance->of->reset(dag);
|
||||
dag->min_rank = INFINITE_RANK;
|
||||
RPL_LOLLIPOP_INCREMENT(dag->instance->dtsn_out);
|
||||
|
||||
p = rpl_add_parent(dag, dio, from);
|
||||
if(p == NULL) {
|
||||
PRINTF("RPL: Failed to add a parent during the global repair\n");
|
||||
|
@ -975,6 +974,7 @@ global_repair(uip_ipaddr_t *from, rpl_dag_t *dag, rpl_dio_t *dio)
|
|||
dag->min_rank = dag->rank ;
|
||||
rpl_process_parent_event(dag->instance, p);
|
||||
}
|
||||
|
||||
PRINTF("RPL: Participating in a global repair (version=%u, rank=%hu)\n",
|
||||
dag->version, dag->rank);
|
||||
|
||||
|
@ -1137,7 +1137,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
|||
return;
|
||||
} else {
|
||||
if(RPL_LOLLIPOP_GREATER_THAN(dag->version, dio->version)) {
|
||||
/* Inconsistency detected - someone is still on old version */
|
||||
/* The DIO sender is on an older version of the DAG. */
|
||||
PRINTF("RPL: old version received => inconsistency detected\n");
|
||||
if(dag->joined) {
|
||||
rpl_reset_dio_timer(instance, 0);
|
||||
|
@ -1219,8 +1219,8 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
|||
return;
|
||||
}
|
||||
|
||||
/* We don't use route control, so we can have only one official parent */
|
||||
if(dag->joined&&(p==dag->preferred_parent)) {
|
||||
/* We don't use route control, so we can have only one official parent. */
|
||||
if(dag->joined && p == dag->preferred_parent) {
|
||||
if(should_send_dao(instance, dio, p)) {
|
||||
RPL_LOLLIPOP_INCREMENT(instance->dtsn_out);
|
||||
rpl_schedule_dao(instance);
|
||||
|
|
|
@ -51,13 +51,13 @@
|
|||
#include <string.h>
|
||||
|
||||
/************************************************************************/
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_EXT_BUF ((struct uip_ext_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_HBHO_BUF ((struct uip_hbho_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_HBHO_NEXT_BUF ((struct uip_ext_hdr *)&uip_buf[uip_l2_l3_hdr_len + RPL_OP_BY_OP_LEN])
|
||||
#define UIP_EXT_HDR_OPT_BUF ((struct uip_ext_hdr_opt *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset])
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_EXT_BUF ((struct uip_ext_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_HBHO_BUF ((struct uip_hbho_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_HBHO_NEXT_BUF ((struct uip_ext_hdr *)&uip_buf[uip_l2_l3_hdr_len + RPL_OP_BY_OP_LEN])
|
||||
#define UIP_EXT_HDR_OPT_BUF ((struct uip_ext_hdr_opt *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset])
|
||||
#define UIP_EXT_HDR_OPT_PADN_BUF ((struct uip_ext_hdr_opt_padn *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset])
|
||||
#define UIP_EXT_HDR_OPT_RPL_BUF ((struct uip_ext_hdr_opt_rpl *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset])
|
||||
#define UIP_EXT_HDR_OPT_RPL_BUF ((struct uip_ext_hdr_opt_rpl *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset])
|
||||
/************************************************************************/
|
||||
int
|
||||
rpl_verify_header(int uip_ext_opt_offset)
|
||||
|
@ -315,7 +315,7 @@ rpl_remove_header(void)
|
|||
UIP_IP_BUF->proto = UIP_HBHO_BUF->next;
|
||||
temp_len = UIP_IP_BUF->len[1];
|
||||
uip_len -= UIP_HBHO_BUF->len + 8;
|
||||
UIP_IP_BUF->len[1] -= (UIP_HBHO_BUF->len + 8);
|
||||
UIP_IP_BUF->len[1] -= UIP_HBHO_BUF->len + 8;
|
||||
if(UIP_IP_BUF->len[1] > temp_len) {
|
||||
UIP_IP_BUF->len[0]--;
|
||||
}
|
||||
|
|
|
@ -57,15 +57,6 @@ rpl_stats_t rpl_stats;
|
|||
|
||||
/************************************************************************/
|
||||
extern uip_ds6_route_t uip_ds6_routing_table[UIP_DS6_ROUTE_NB];
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UIP_EXT_BUF ((struct uip_ext_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_HBHO_BUF ((struct uip_hbho_hdr *)&uip_buf[uip_l2_l3_hdr_len])
|
||||
#define UIP_HBHO_NEXT_BUF ((struct uip_ext_hdr *)&uip_buf[uip_l2_l3_hdr_len + RPL_OP_BY_OP_LEN])
|
||||
#define UIP_EXT_HDR_OPT_BUF ((struct uip_ext_hdr_opt *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset])
|
||||
#define UIP_EXT_HDR_OPT_PADN_BUF ((struct uip_ext_hdr_opt_padn *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset])
|
||||
#define UIP_EXT_HDR_OPT_RPL_BUF ((struct uip_ext_hdr_opt_rpl *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset])
|
||||
|
||||
/************************************************************************/
|
||||
void
|
||||
rpl_purge_routes(void)
|
||||
|
|
Loading…
Reference in a new issue