Skip to content

Commit 0a6fb58

Browse files
author
Juha Heiskanen
committed
RPL parent update handle update
Do not trig DAO or Address reg when RPL candidate is gone. Address registration is only done when selected a new parent. Change-Id: I84f799c0ab35b0498007651785a73e81a65705f7
1 parent 59b145b commit 0a6fb58

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,7 @@ static void ws_bootstrap_rpl_callback(rpl_event_t event, void *handle)
20662066
*
20672067
*/
20682068

2069-
} else if (event == RPL_EVENT_DAO_PARENT_SWITCH) {
2069+
} else if (event == RPL_EVENT_DAO_PARENT_ADD) {
20702070
ws_address_registration_update(cur);
20712071
}
20722072
cur->ws_info->rpl_state = event;

source/RPL/rpl_control.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ typedef enum rpl_event {
3535
RPL_EVENT_DAO_DONE, /* Simplistic trigger for bootstrap advance - a DAO registration completed */
3636
RPL_EVENT_LOCAL_REPAIR_START, /* RPL start scanning new parent by multicast DIS user can disable beacon request responser here*/
3737
RPL_EVENT_LOCAL_REPAIR_NO_MORE_DIS, /* RPL not sending DIS anymore user can report bootstrap error */
38-
RPL_EVENT_DAO_PARENT_SWITCH, /* RPL indicate that DAO downward Parent state have been updated */
38+
RPL_EVENT_DAO_PARENT_ADD, /* RPL indicate that DAO downward Parent has been added */
3939
} rpl_event_t;
4040

4141
typedef void rpl_domain_callback_t(rpl_event_t event, void *handle);

source/RPL/rpl_downward.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,20 +192,18 @@ static bool rpl_instance_parent_selection_ready(rpl_instance_t *instance)
192192

193193
void rpl_downward_neighbour_gone(rpl_instance_t *instance, rpl_neighbour_t *neighbour)
194194
{
195-
if (neighbour->dao_path_control == 0) {
196-
return;
197-
}
198-
neighbour->old_dao_path_control = neighbour->dao_path_control;
199-
neighbour->dao_path_control = 0;
200-
rpl_downward_process_dao_parent_changes(instance);
195+
196+
// Currently don't need to do anything - caller is expected to
197+
// trigger parent selection, which will do everything required.
198+
(void) instance;
199+
(void) neighbour;
201200
}
202201

203202
void rpl_downward_process_dao_parent_changes(rpl_instance_t *instance)
204203
{
205-
uint8_t mop = rpl_instance_mop(instance);
206204
bool storing;
207205

208-
switch (mop) {
206+
switch (rpl_instance_mop(instance)) {
209207
case RPL_MODE_NON_STORING:
210208
storing = false;
211209
break;
@@ -219,6 +217,7 @@ void rpl_downward_process_dao_parent_changes(rpl_instance_t *instance)
219217

220218
bool bits_removed = false;
221219
uint8_t bits_added = 0;
220+
222221
ns_list_foreach(rpl_neighbour_t, neighbour, &instance->candidate_neighbours) {
223222
if (neighbour->old_dao_path_control != neighbour->dao_path_control) {
224223
if (neighbour->old_dao_path_control & ~ neighbour->dao_path_control) {
@@ -230,11 +229,21 @@ void rpl_downward_process_dao_parent_changes(rpl_instance_t *instance)
230229
}
231230
}
232231
}
233-
tr_debug("removed=%x, added=%x", bits_removed, bits_added);
232+
234233
if (!(bits_removed || bits_added)) {
235234
return;
236235
}
237236

237+
tr_debug("removed=%x, added=%x", bits_removed, bits_added);
238+
239+
ns_list_foreach(rpl_neighbour_t, neighbour, &instance->candidate_neighbours) {
240+
if (neighbour->dao_path_control != 0 && neighbour->old_dao_path_control == 0) {
241+
//Candidate has become a DAO parent
242+
rpl_control_event(instance->domain, RPL_EVENT_DAO_PARENT_ADD);
243+
break;
244+
}
245+
}
246+
238247
if (storing) {
239248
/* XXX more complicated - No-Paths to people losing stuff, etc.
240249
* Need to think a bit about what each parent would have had.
@@ -253,8 +262,8 @@ void rpl_downward_process_dao_parent_changes(rpl_instance_t *instance)
253262
}
254263
}
255264
}
256-
//GENERATE PARENT Update event
257-
rpl_control_event(instance->domain, RPL_EVENT_DAO_PARENT_SWITCH);
265+
266+
//Trig DAO allways after change
258267
rpl_instance_dao_trigger(instance, 0);
259268
}
260269
}

0 commit comments

Comments
 (0)