Skip to content

Commit 34d0339

Browse files
author
Juha Heiskanen
committed
Wi-sun address registartion update
ARO registartion will return new status if bootsrtap is not ready. Only Cache full status remove neighbour. Change-Id: I52fe7c21fd77f5f5ee208f2e976d227ba2f645f6
1 parent 5b30559 commit 34d0339

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed

source/6LoWPAN/ND/nd_router_object.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -928,11 +928,13 @@ bool nd_ns_aro_handler(protocol_interface_info_entry_t *cur_interface, const uin
928928
}
929929

930930
/* TODO - check hard upper limit on registrations? */
931-
if (ws_info(cur_interface) &&
932-
!ws_common_allow_child_registration(cur_interface, aro_out->eui64)) {
933-
aro_out->present = true;
934-
aro_out->status = ARO_FULL;
935-
return true;
931+
if (ws_info(cur_interface)) {
932+
933+
aro_out->status = ws_common_allow_child_registration(cur_interface, aro_out->eui64);
934+
if (aro_out->status != ARO_SUCCESS) {
935+
aro_out->present = true;
936+
return true;
937+
}
936938
}
937939

938940
/* We need to have entry in the Neighbour Cache */

source/6LoWPAN/ws/ws_common.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "randLIB.h"
2323
#include <ns_list.h>
2424
#include <nsdynmemLIB.h>
25+
#include "Common_Protocols/icmpv6.h"
2526
#include "6LoWPAN/ws/ws_config.h"
2627
#include "6LoWPAN/ws/ws_common_defines.h"
2728
#include "6LoWPAN/ws/ws_common.h"
@@ -405,7 +406,7 @@ void ws_common_neighbor_remove(protocol_interface_info_entry_t *cur, const uint8
405406

406407

407408

408-
bool ws_common_allow_child_registration(protocol_interface_info_entry_t *interface, const uint8_t *eui64)
409+
uint8_t ws_common_allow_child_registration(protocol_interface_info_entry_t *interface, const uint8_t *eui64)
409410
{
410411
uint8_t child_count = 0;
411412
uint8_t max_child_count = mac_neighbor_info(interface)->list_total_size - WS_NON_CHILD_NEIGHBOUR_COUNT;
@@ -418,13 +419,13 @@ bool ws_common_allow_child_registration(protocol_interface_info_entry_t *interfa
418419
//Validate Is EUI64 already allocated for any address
419420
if (ipv6_neighbour_has_registered_by_eui64(&interface->ipv6_neighbour_cache, eui64)) {
420421
tr_info("Child registration from old child");
421-
return true;
422+
return ARO_SUCCESS;
422423
}
423424

424425
//Verify that we have Selected Parent
425426
if (interface->bootsrap_mode != ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER && !rpl_control_parent_candidate_list_size(interface, true)) {
426427
tr_info("Do not accept new ARO child: no selected parent");
427-
return false;
428+
return ARO_TOPOLOGICALLY_INCORRECT;
428429
}
429430

430431

@@ -436,10 +437,10 @@ bool ws_common_allow_child_registration(protocol_interface_info_entry_t *interfa
436437
}
437438
if (child_count >= max_child_count) {
438439
tr_warn("Child registration not allowed %d/%d, max:%d", child_count, max_child_count, mac_neighbor_info(interface)->list_total_size);
439-
return false;
440+
return ARO_FULL;
440441
}
441442
tr_info("Child registration allowed %d/%d, max:%d", child_count, max_child_count, mac_neighbor_info(interface)->list_total_size);
442-
return true;
443+
return ARO_SUCCESS;
443444
}
444445

445446
bool ws_common_negative_aro_mark(protocol_interface_info_entry_t *interface, const uint8_t *eui64)
@@ -448,6 +449,7 @@ bool ws_common_negative_aro_mark(protocol_interface_info_entry_t *interface, con
448449
if (!neighbour) {
449450
return false;
450451
}
452+
451453
ws_neighbor_class_entry_t *ws_neighbor = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, neighbour->index);
452454
ws_neighbor->negative_aro_send = true;
453455
neighbour->lifetime = WS_NEIGHBOR_TEMPORARY_LINK_MIN_TIMEOUT_SMALL; //Remove anyway if Packet is freed before MAC push

source/6LoWPAN/ws/ws_common.h

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

142142
void ws_common_neighbor_remove(protocol_interface_info_entry_t *cur, const uint8_t *ll_address);
143143

144-
bool ws_common_allow_child_registration(protocol_interface_info_entry_t *cur, const uint8_t *eui64);
144+
uint8_t ws_common_allow_child_registration(protocol_interface_info_entry_t *cur, const uint8_t *eui64);
145145

146146
bool ws_common_negative_aro_mark(protocol_interface_info_entry_t *interface, const uint8_t *eui64);
147147

@@ -158,7 +158,7 @@ uint32_t ws_common_version_timeout_get(uint8_t config);
158158
#define ws_common_aro_failure(cur, ll_address)
159159
#define ws_common_neighbor_remove(cur, ll_address)
160160
#define ws_common_fast_timer(cur, ticks) ((void) 0)
161-
#define ws_common_allow_child_registration(cur, eui64) (false)
161+
#define ws_common_allow_child_registration(cur, eui64) (2)
162162
#define ws_common_negative_aro_mark(interface, eui64)(false)
163163

164164
#endif //HAVE_WS

source/Common_Protocols/icmpv6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ buffer_t *icmpv6_build_na(protocol_interface_info_entry_t *cur, bool solicited,
16971697
memcpy(ptr, aro->eui64, 8);
16981698
ptr += 8;
16991699
}
1700-
if (ws_info(cur) && aro && aro->status != ARO_SUCCESS) {
1700+
if (ws_info(cur) && aro && (aro->status != ARO_SUCCESS && aro->status != ARO_TOPOLOGICALLY_INCORRECT)) {
17011701
/*If Aro failed we will kill the neigbour after we have succeeded in sending message*/
17021702
if (!ws_common_negative_aro_mark(cur, aro->eui64)) {
17031703
tr_debug("Neighbour removed for negative response send");

source/Common_Protocols/icmpv6.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ typedef enum slaac_src {
117117
#define ARO_SUCCESS 0
118118
#define ARO_DUPLICATE 1
119119
#define ARO_FULL 2
120+
#define ARO_TOPOLOGICALLY_INCORRECT 8
120121

121122
extern void icmpv6_init(void);
122123
extern struct buffer *icmpv6_down(struct buffer *buf);

test/nanostack/unittest/stub/ws_common_stub.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ 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, const uint8_t *eui64)
65+
uint8_t ws_common_allow_child_registration(protocol_interface_info_entry_t *interface, const uint8_t *eui64)
6666
{
6767
(void) interface;
68-
return true;
68+
return 0;
6969
}
7070
void ws_common_aro_failure(protocol_interface_info_entry_t *cur, const uint8_t *ll_address)
7171
{

0 commit comments

Comments
 (0)