Skip to content

Commit

Permalink
RPL Poison update
Browse files Browse the repository at this point in the history
rpl_control_poison() by count 1 will trigger faster DIO Poison.
RPL trigger a RPL_EVENT_POISON_READY when poison count reach zero.
  • Loading branch information
Juha Heiuskanen committed Jan 19, 2021
1 parent 9e27a77 commit 66378d1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/RPL/rpl_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ typedef enum rpl_event {
RPL_EVENT_LOCAL_REPAIR_START, /* RPL start scanning new parent by multicast DIS user can disable beacon request responser here*/
RPL_EVENT_LOCAL_REPAIR_NO_MORE_DIS, /* RPL not sending DIS anymore user can report bootstrap error */
RPL_EVENT_DAO_PARENT_ADD, /* RPL indicate that DAO downward Parent has been added */
RPL_EVENT_POISON_FINISHED, /* RPL have finished Dodag Poison proces */
} rpl_event_t;

typedef void rpl_domain_callback_t(rpl_event_t event, void *handle);
Expand Down Expand Up @@ -200,6 +201,7 @@ const rpl_dodag_conf_t *rpl_control_get_dodag_config(const struct rpl_instance *
const uint8_t *rpl_control_preferred_parent_addr(const struct rpl_instance *instance, bool global);
uint16_t rpl_control_current_rank(const struct rpl_instance *instance);
uint8_t rpl_policy_mrhof_parent_set_size_get(const rpl_domain_t *domain);
void rpl_control_instant_poison(struct protocol_interface_info_entry *cur, rpl_domain_t *domain);

#else /* HAVE_RPL */

Expand All @@ -211,6 +213,7 @@ uint8_t rpl_policy_mrhof_parent_set_size_get(const rpl_domain_t *domain);
#define rpl_control_address_register_done(interface, ll_addr, status) (false)
#define rpl_policy_mrhof_parent_set_size_get(domain) (0)
#define rpl_control_set_mrhof_parent_set_size(parent_set_size)
#define rpl_control_instant_poison(cur, domain) ((void) 0)
#endif /* HAVE_RPL */

#endif /* RPL_CONTROL_H_ */
12 changes: 12 additions & 0 deletions source/RPL/rpl_upward.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,14 @@ void rpl_instance_poison(rpl_instance_t *instance, uint8_t count)
rpl_instance_inconsistency(instance);
}

void rpl_control_instant_poison(protocol_interface_info_entry_t *cur, rpl_domain_t *domain)
{
ns_list_foreach(rpl_instance_t, instance, &domain->instances) {
rpl_instance_poison(instance, 1);
rpl_instance_dio_trigger(instance, cur, NULL);
}
}

void rpl_instance_force_leaf(rpl_instance_t *instance)
{
instance->current_rank = RPL_RANK_INFINITE;
Expand Down Expand Up @@ -1620,6 +1628,10 @@ void rpl_instance_dio_trigger(rpl_instance_t *instance, protocol_interface_info_
instance->poison_count--;
rank = RPL_RANK_INFINITE;
tr_debug("Poison count -> set RPL_RANK_INFINITE");
if (instance->poison_count == 0) {
//Report RPL user that Poison message is triggered
rpl_control_event(instance->domain, RPL_EVENT_POISON_FINISHED);
}
}

// Always send config in unicasts (as required), never in multicasts (optional)
Expand Down
5 changes: 5 additions & 0 deletions test/nanostack/unittest/stub/rpl_upward_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,4 +508,9 @@ bool rpl_instance_possible_better_candidate(const rpl_instance_t *instance, rpl_
return false;
}

void rpl_control_instant_poison(struct protocol_interface_info_entry *cur, rpl_domain_t *domain)
{

}

#endif /* HAVE_RPL */

0 comments on commit 66378d1

Please sign in to comment.