-
Notifications
You must be signed in to change notification settings - Fork 2.1k
gnrc/rpl: switching between DODAGs #21759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
ea34842
b4e81da
401dd1b
be8e37a
552d63b
ff5ad54
19a4d47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,18 +25,18 @@ | |
|
||
static uint16_t calc_rank(gnrc_rpl_dodag_t *, uint16_t); | ||
static int parent_cmp(gnrc_rpl_parent_t *, gnrc_rpl_parent_t *); | ||
static gnrc_rpl_dodag_t *which_dodag(gnrc_rpl_dodag_t *, gnrc_rpl_dodag_t *); | ||
static int which_dodag(gnrc_rpl_dodag_t *, gnrc_rpl_dio_t *); | ||
static void reset(gnrc_rpl_dodag_t *); | ||
|
||
static gnrc_rpl_of_t gnrc_rpl_of0 = { | ||
.ocp = 0x0, | ||
.calc_rank = calc_rank, | ||
.parent_cmp = parent_cmp, | ||
.which_dodag = which_dodag, | ||
.reset = reset, | ||
.ocp = 0x0, | ||
.calc_rank = calc_rank, | ||
.parent_cmp = parent_cmp, | ||
.which_dodag = which_dodag, | ||
.reset = reset, | ||
.parent_state_callback = NULL, | ||
.init = NULL, | ||
.process_dio = NULL | ||
.init = NULL, | ||
.process_dio = NULL | ||
}; | ||
|
||
gnrc_rpl_of_t *gnrc_rpl_get_of0(void) | ||
|
@@ -87,9 +87,57 @@ int parent_cmp(gnrc_rpl_parent_t *parent1, gnrc_rpl_parent_t *parent2) | |
return 0; | ||
} | ||
|
||
/* Not used yet */ | ||
gnrc_rpl_dodag_t *which_dodag(gnrc_rpl_dodag_t *d1, gnrc_rpl_dodag_t *d2) | ||
int which_dodag(gnrc_rpl_dodag_t *d1, gnrc_rpl_dio_t *dio) | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we wanted to compare two |
||
(void) d2; | ||
return d1; | ||
/* parent set must not be empty */ | ||
if ((d1->node_status != GNRC_RPL_ROOT_NODE) && !d1->parents) { | ||
return 1; | ||
} | ||
|
||
/* prefer grounded dodag */ | ||
int dio_grounded = dio->g_mop_prf >> GNRC_RPL_GROUNDED_SHIFT; | ||
if (d1->grounded > dio_grounded) { | ||
return -1; | ||
} | ||
else if (dio_grounded > d1->grounded) { | ||
return 1; | ||
} | ||
|
||
int dio_prf = dio->g_mop_prf & GNRC_RPL_PRF_MASK; | ||
|
||
/* prefer dodag with more preferable root */ | ||
if (d1->prf > dio_prf) { | ||
return -1; | ||
} | ||
else if (dio_prf > d1->prf) { | ||
return 1; | ||
} | ||
|
||
/* prefer DODAG with more recent version */ | ||
if (memcmp(&d1->dodag_id, &dio->dodag_id, sizeof(ipv6_addr_t)) != 0) { | ||
if (GNRC_RPL_COUNTER_GREATER_THAN(d1->version, dio->version_number)) { | ||
return -1; | ||
} | ||
else if (GNRC_RPL_COUNTER_GREATER_THAN(dio->version_number, d1->version)) { | ||
return 1; | ||
} | ||
} | ||
|
||
/* prefer dodag with lesser resulting rank */ | ||
/* TODO: calc rank properly */ | ||
int d1_rank = d1->parents->rank; | ||
int d2_rank = byteorder_ntohs(dio->rank); | ||
if (d1_rank < d2_rank) { | ||
return -1; | ||
} | ||
else if (d2_rank < d1_rank) { | ||
return 1; | ||
} | ||
|
||
/* prefer DODAG for which there is an alternate parent */ | ||
if (d1->parents->next) { | ||
return -1; | ||
} | ||
|
||
return 0; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, different DODAG versions should be treated as different DODAGs because they affect also our parent set etc. (e.g., per RFC all parents in the parent set must be the same DODAG version).
So the old logic of just increasing our version and leaving the rest as it is wasn't really RFC conformant.Is my understanding correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version number is incremented when something happens that requires that the DODAG be rebuilt. It's not a different DODAG. One should attach to the highest version number (with lollipop numbering, I think)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that was also my understanding.
But implementation wise, I was thinking that we could still treat a new DODAG version the same as we treat joining a completely different DODAG: clear the parent set, reset trickle, reset other parameters...
The old implementation effectively also just triggered a local repair (=> implemented in RIOT as poising of all ranks and cleanup of the current dodag).
But thinking about it again now, we probably don't want to reset all parameters, like dtsn or DAO sequence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note: I don't think that increasing a DODAG version as a root is currently even implemented in RIOT.