1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

rpl: check all dodags when receiving DIS messages

This commit is contained in:
Cenk Gündoğan 2015-03-17 13:14:48 +01:00
parent 52017a967a
commit 1cd351e6b0

View File

@ -874,15 +874,11 @@ void rpl_recv_DAO(void)
void rpl_recv_DIS(void) void rpl_recv_DIS(void)
{ {
rpl_dodag_t *my_dodag = rpl_get_my_dodag();
if (my_dodag == NULL) {
return;
}
ipv6_buf = get_rpl_ipv6_buf(); ipv6_buf = get_rpl_ipv6_buf();
rpl_dis_buf = get_rpl_dis_buf(); rpl_dis_buf = get_rpl_dis_buf();
int len = DIS_BASE_LEN; int len = DIS_BASE_LEN;
rpl_dodag_t *dodag, *end;
uint8_t options_missing = 1;
while (len < (NTOHS(ipv6_buf->length) - ICMPV6_HDR_LEN)) { while (len < (NTOHS(ipv6_buf->length) - ICMPV6_HDR_LEN)) {
rpl_opt_buf = get_rpl_opt_buf(len); rpl_opt_buf = get_rpl_opt_buf(len);
@ -899,6 +895,7 @@ void rpl_recv_DIS(void)
} }
case (RPL_OPT_SOLICITED_INFO): { case (RPL_OPT_SOLICITED_INFO): {
options_missing = 0;
len += RPL_OPT_SOLICITED_INFO_LEN; len += RPL_OPT_SOLICITED_INFO_LEN;
/* extract and check */ /* extract and check */
@ -909,21 +906,28 @@ void rpl_recv_DIS(void)
rpl_opt_solicited_buf = get_rpl_opt_solicited_buf(len); rpl_opt_solicited_buf = get_rpl_opt_solicited_buf(len);
if (rpl_opt_solicited_buf->VID_Flags & RPL_DIS_I_MASK) { for (dodag = rpl_dodags, end = dodag + RPL_MAX_DODAGS; dodag < end; dodag++) {
if (my_dodag->instance->id != rpl_opt_solicited_buf->rplinstanceid) { if (dodag->joined) {
return; if (rpl_opt_solicited_buf->VID_Flags & RPL_DIS_I_MASK) {
} if (dodag->instance->id != rpl_opt_solicited_buf->rplinstanceid) {
} continue;
}
}
if (rpl_opt_solicited_buf->VID_Flags & RPL_DIS_D_MASK) { if (rpl_opt_solicited_buf->VID_Flags & RPL_DIS_D_MASK) {
if (!rpl_equal_id(&my_dodag->dodag_id, &rpl_opt_solicited_buf->dodagid)) { if (!rpl_equal_id(&dodag->dodag_id, &rpl_opt_solicited_buf->dodagid)) {
return; continue;
} }
} }
if (rpl_opt_solicited_buf->VID_Flags & RPL_DIS_V_MASK) { if (rpl_opt_solicited_buf->VID_Flags & RPL_DIS_V_MASK) {
if (my_dodag->version != rpl_opt_solicited_buf->version) { if (dodag->version != rpl_opt_solicited_buf->version) {
return; continue;
}
}
rpl_send_DIO(dodag, &ipv6_buf->srcaddr);
trickle_reset_timer(&dodag->trickle);
} }
} }
@ -935,8 +939,14 @@ void rpl_recv_DIS(void)
} }
} }
rpl_send_DIO(my_dodag, &ipv6_buf->srcaddr); if (options_missing) {
for (dodag = rpl_dodags, end = dodag + RPL_MAX_DODAGS; dodag < end; dodag++) {
if (dodag->joined) {
rpl_send_DIO(dodag, &ipv6_buf->srcaddr);
trickle_reset_timer(&dodag->trickle);
}
}
}
} }
void rpl_recv_DAO_ACK(void) void rpl_recv_DAO_ACK(void)