Skip to content

Commit fdd6c2d

Browse files
Juha HeiskanenMika Tervonen
authored andcommitted
wi-sun address registration fix:
Added EUI64 to function which validate space for registered child address. If EUI64 is used already at any registered address limit counter check is not necessary anymore. Change-Id: Id602ffee21da26d1c92662dffe54cbd920627186
1 parent 48330ea commit fdd6c2d

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

source/6LoWPAN/ND/nd_router_object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ bool nd_ns_aro_handler(protocol_interface_info_entry_t *cur_interface, const uin
926926

927927
/* TODO - check hard upper limit on registrations? */
928928
if (ws_info(cur_interface) &&
929-
!ws_common_allow_child_registration(cur_interface)) {
929+
!ws_common_allow_child_registration(cur_interface, aro_out->eui64)) {
930930
aro_out->present = true;
931931
aro_out->status = ARO_FULL;
932932
return true;

source/6LoWPAN/ws/ws_common.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,10 @@ void ws_common_neighbor_remove(protocol_interface_info_entry_t *cur, const uint8
363363
tr_debug("neighbor remove %s", trace_ipv6(ll_address));
364364
ws_bootstrap_neighbor_remove(cur, ll_address);
365365
}
366-
bool ws_common_allow_child_registration(protocol_interface_info_entry_t *interface)
366+
367+
368+
369+
bool ws_common_allow_child_registration(protocol_interface_info_entry_t *interface, const uint8_t *eui64)
367370
{
368371
uint8_t child_count = 0;
369372
uint8_t max_child_count = mac_neighbor_info(interface)->list_total_size - WS_NON_CHILD_NEIGHBOUR_COUNT;
@@ -373,6 +376,12 @@ bool ws_common_allow_child_registration(protocol_interface_info_entry_t *interfa
373376
max_child_count = test_max_child_count_override;
374377
}
375378

379+
//Validate Is EUI64 already allocated for any address
380+
if (ipv6_neighbour_has_registered_by_eui64(&interface->ipv6_neighbour_cache, eui64)) {
381+
tr_info("Child registration from old child");
382+
return true;
383+
}
384+
376385
ns_list_foreach_safe(mac_neighbor_table_entry_t, cur, &mac_neighbor_info(interface)->neighbour_list) {
377386

378387
if (ipv6_neighbour_has_registered_by_eui64(&interface->ipv6_neighbour_cache, cur->mac64)) {

source/6LoWPAN/ws/ws_common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void ws_common_aro_failure(protocol_interface_info_entry_t *cur, const uint8_t *
121121

122122
void ws_common_neighbor_remove(protocol_interface_info_entry_t *cur, const uint8_t *ll_address);
123123

124-
bool ws_common_allow_child_registration(protocol_interface_info_entry_t *cur);
124+
bool ws_common_allow_child_registration(protocol_interface_info_entry_t *cur, const uint8_t *eui64);
125125

126126
#define ws_info(cur) ((cur)->ws_info)
127127
#else
@@ -131,7 +131,7 @@ bool ws_common_allow_child_registration(protocol_interface_info_entry_t *cur);
131131
#define ws_common_aro_failure(cur, ll_address)
132132
#define ws_common_neighbor_remove(cur, ll_address)
133133
#define ws_common_fast_timer(cur, ticks) ((void) 0)
134-
#define ws_common_allow_child_registration(cur) (false)
134+
#define ws_common_allow_child_registration(cur, eui64) (false)
135135

136136

137137
#endif //HAVE_WS

test/nanostack/unittest/stub/ws_common_stub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void ws_common_neighbor_update(protocol_interface_info_entry_t *cur, const uint8
6262
(void) cur;
6363
(void) ll_address;
6464
}
65-
bool ws_common_allow_child_registration(protocol_interface_info_entry_t *interface)
65+
bool ws_common_allow_child_registration(protocol_interface_info_entry_t *interface, const uint8_t *eui64)
6666
{
6767
(void) interface;
6868
return true;

0 commit comments

Comments
 (0)