mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
commit
6f7992dd12
@ -190,6 +190,8 @@ uint8_t rpl_init(transceiver_type_t trans, uint16_t rpl_address)
|
||||
return SIXLOWERROR_ADDRESS;
|
||||
}
|
||||
|
||||
rpl_instances_init();
|
||||
|
||||
/* initialize routing table */
|
||||
rpl_clear_routing_table();
|
||||
init_trickle();
|
||||
@ -724,7 +726,10 @@ void recv_rpl_dio(void)
|
||||
parent->rank = rpl_dio_buf->rank;
|
||||
rpl_parent_update(parent);
|
||||
|
||||
if (rpl_equal_id(&parent->addr, &my_dodag->my_preferred_parent->addr) && (parent->dtsn != rpl_dio_buf->dtsn)) {
|
||||
if (my_dodag->my_preferred_parent == NULL) {
|
||||
DEBUG("my dodag has no preferred_parent yet - seems to be odd since I have a parent...\n");
|
||||
}
|
||||
else if (rpl_equal_id(&parent->addr, &my_dodag->my_preferred_parent->addr) && (parent->dtsn != rpl_dio_buf->dtsn)) {
|
||||
delay_dao();
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,11 @@ rpl_instance_t instances[RPL_MAX_INSTANCES];
|
||||
rpl_dodag_t dodags[RPL_MAX_DODAGS];
|
||||
rpl_parent_t parents[RPL_MAX_PARENTS];
|
||||
|
||||
void rpl_instances_init(void)
|
||||
{
|
||||
memset(instances, 0, sizeof(rpl_instance_t) * RPL_MAX_INSTANCES);
|
||||
}
|
||||
|
||||
rpl_instance_t *rpl_new_instance(uint8_t instanceid)
|
||||
{
|
||||
rpl_instance_t *inst;
|
||||
@ -156,6 +161,7 @@ rpl_parent_t *rpl_new_parent(rpl_dodag_t *dodag, ipv6_addr_t *address, uint16_t
|
||||
parent->addr = *address;
|
||||
parent->rank = rank;
|
||||
parent->dodag = dodag;
|
||||
parent->lifetime = dodag->default_lifetime * dodag->lifetime_unit;
|
||||
/* dtsn is set at the end of recv_dio function */
|
||||
parent->dtsn = 0;
|
||||
return parent;
|
||||
@ -315,7 +321,7 @@ void rpl_join_dodag(rpl_dodag_t *dodag, ipv6_addr_t *parent, uint16_t parent_ran
|
||||
return;
|
||||
}
|
||||
|
||||
preferred_parent = rpl_new_parent(my_dodag, parent, parent_rank);
|
||||
preferred_parent = rpl_new_parent(dodag, parent, parent_rank);
|
||||
|
||||
if (preferred_parent == NULL) {
|
||||
rpl_del_dodag(my_dodag);
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ipv6.h"
|
||||
#include "rpl_structs.h"
|
||||
|
||||
void rpl_instances_init(void);
|
||||
rpl_instance_t *rpl_new_instance(uint8_t instanceid);
|
||||
rpl_instance_t *rpl_get_instance(uint8_t instanceid);
|
||||
rpl_instance_t *rpl_get_my_instance(void);
|
||||
|
Loading…
Reference in New Issue
Block a user