Skip to content

Commit 5739b4a

Browse files
author
Mika Tervonen
committed
Fixed aro registration error
RPL was left neighbor information if there was ARO error and that neighbor was deleted. This caused loops in stack
1 parent 7ebaa8e commit 5739b4a

File tree

7 files changed

+24
-1
lines changed

7 files changed

+24
-1
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,6 @@ static bool ws_bootstrap_neighbor_info_request(struct protocol_interface_info_en
12761276

12771277
neighbor_buffer->ws_neighbor = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, neighbor_buffer->neighbor->index);
12781278
if (!neighbor_buffer->ws_neighbor) {
1279-
mac_helper_devicetable_remove(interface->mac_api, neighbor_buffer->neighbor->index);
12801279
mac_neighbor_table_neighbor_remove(mac_neighbor_info(interface), neighbor_buffer->neighbor);
12811280
return false;
12821281
}
@@ -1551,6 +1550,7 @@ int ws_bootstrap_neighbor_remove(protocol_interface_info_entry_t *cur, const uin
15511550
tr_warn("ARO registration Failure %s", trace_ipv6(ll_address));
15521551

15531552
blacklist_update(ll_address, false);
1553+
rpl_control_neighbor_delete(cur, ll_address);
15541554

15551555
mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_entry_get_by_ll64(mac_neighbor_info(cur), ll_address, false, NULL);
15561556

source/RPL/rpl_control.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@ bool rpl_control_is_dodag_parent(protocol_interface_info_entry_t *interface, con
237237
}
238238
return false;
239239
}
240+
void rpl_control_neighbor_delete(protocol_interface_info_entry_t *interface, const uint8_t ll_addr[16])
241+
{
242+
// go through instances and delete address.
243+
ns_list_foreach(struct rpl_instance, instance, &interface->rpl_domain->instances) {
244+
rpl_instance_neighbor_delete(instance, ll_addr);
245+
}
246+
return;
247+
}
240248

241249
/* Address changes need to trigger DAO target re-evaluation */
242250
static void rpl_control_addr_notifier(struct protocol_interface_info_entry *interface, const if_address_entry_t *addr, if_address_callback_t reason)

source/RPL/rpl_control.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ void rpl_control_unpublish_address(rpl_domain_t *domain, const uint8_t addr[16])
150150
void rpl_control_register_address(struct protocol_interface_info_entry *interface, if_address_entry_t *addr);
151151
void rpl_control_address_register_done(struct buffer *buf, uint8_t status);
152152
bool rpl_control_is_dodag_parent(struct protocol_interface_info_entry *interface, const uint8_t ll_addr[16]);
153+
void rpl_control_neighbor_delete(struct protocol_interface_info_entry *interface, const uint8_t ll_addr[16]);
153154

154155
/* Configure and return the routing lookup predicate for a specified RPL instance ID */
155156
ipv6_route_predicate_fn_t *rpl_control_get_route_predicate(rpl_domain_t *domain, uint8_t instance_id, const uint8_t src[16], const uint8_t dst[16]);

source/RPL/rpl_downward.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ bool rpl_instance_address_registration_done(protocol_interface_info_entry_t *int
625625
addr->state_timer = (addr->preferred_lifetime * randLIB_get_random_in_range(75, 85) / 10);
626626
} else {
627627
tr_error("Address registration failed");
628+
rpl_delete_neighbour(instance, neighbour);
628629
}
629630

630631
/* If that was last one to reply, send next one. */

source/RPL/rpl_upward.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,15 @@ bool rpl_instance_address_is_parent(rpl_instance_t *instance, const uint8_t *ipv
15771577
}
15781578
return false;
15791579
}
1580+
void rpl_instance_neighbor_delete(rpl_instance_t *instance, const uint8_t *ipv6_addr)
1581+
{
1582+
ns_list_foreach_safe(rpl_neighbour_t, neighbour, &instance->candidate_neighbours) {
1583+
if (addr_ipv6_equal(neighbour->ll_address, ipv6_addr)) {
1584+
rpl_delete_neighbour(instance, neighbour);
1585+
}
1586+
}
1587+
return;
1588+
}
15801589

15811590
void rpl_instance_slow_timer(rpl_instance_t *instance, uint16_t seconds)
15821591
{

source/RPL/rpl_upward.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ void rpl_instance_set_local_repair(rpl_instance_t *instance, bool repair);
8484
bool rpl_instance_local_repair(const rpl_instance_t *instance);
8585
uint16_t rpl_instance_current_rank(const rpl_instance_t *instance);
8686
bool rpl_instance_address_is_parent(rpl_instance_t *instance, const uint8_t *ipv6_addr);
87+
void rpl_instance_neighbor_delete(rpl_instance_t *instance, const uint8_t *ipv6_addr);
8788
void rpl_instance_slow_timer(rpl_instance_t *instance, uint16_t seconds);
8889

8990
rpl_dodag_t *rpl_lookup_dodag(const rpl_instance_t *instance, const uint8_t *dodagid);

test/nanostack/unittest/stub/rpl_upward_stub.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ bool rpl_instance_address_is_parent(rpl_instance_t *instance, const uint8_t *ipv
422422
{
423423
return false;
424424
}
425+
void rpl_instance_neighbor_delete(rpl_instance_t *instance, const uint8_t *ipv6_addr)
426+
{
427+
}
425428

426429
void rpl_instance_slow_timer(rpl_instance_t *instance, uint16_t seconds)
427430
{

0 commit comments

Comments
 (0)