Skip to content

Commit 588c385

Browse files
author
Juha Heiskanen
committed
Drop only non trusted devices when life is over 60 seconds old.
Change-Id: Id8e2f1ceb6262cdcaa8d52debe4d8461fd0ea9f9
1 parent 99e8ce7 commit 588c385

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,19 +1292,32 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
12921292
continue;
12931293
}
12941294

1295-
if (ipv6_neighbour_has_registered_by_eui64(&interface->ipv6_neighbour_cache, cur->mac64)) {
1296-
// We have registered entry so we have been selected as parent
1297-
continue;
1295+
if (cur->trusted_device) {
1296+
1297+
if (ipv6_neighbour_has_registered_by_eui64(&interface->ipv6_neighbour_cache, cur->mac64)) {
1298+
// We have registered entry so we have been selected as parent
1299+
continue;
1300+
}
1301+
1302+
memcpy(ll_target + 8, cur->mac64, 8);
1303+
ll_target[8] ^= 2;
1304+
1305+
if (rpl_control_is_dodag_parent(interface, ll_target)) {
1306+
// Possible parent is limited to 3 by default?
1307+
continue;
1308+
}
12981309
}
12991310

1300-
memcpy(ll_target + 8, cur->mac64, 8);
1301-
ll_target[8] ^= 2;
13021311

1303-
if (rpl_control_is_dodag_parent(interface, ll_target)) {
1304-
// Possible parent is limited to 3 by default?
1305-
continue;
1312+
1313+
if (cur->trusted_device) {
1314+
neighbor_entry_ptr = cur;
1315+
} else {
1316+
if (cur->link_lifetime - cur->lifetime > WS_NEIGHBOR_NOT_TRUSTED_LINK_TIMEOUT) {
1317+
//Accept only Enough Old not trusted Device
1318+
neighbor_entry_ptr = cur;
1319+
}
13061320
}
1307-
neighbor_entry_ptr = cur;
13081321
}
13091322
if (neighbor_entry_ptr) {
13101323
tr_info("dropped oldest neighbour %s", trace_array(neighbor_entry_ptr->mac64, 8));

source/6LoWPAN/ws/ws_common_defines.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ typedef struct ws_bs_ie {
186186
#define WS_FAN_VERSION_1_0 1
187187

188188
#define WS_NEIGHBOR_LINK_TIMEOUT 2200
189+
#define WS_NEIGHBOR_NOT_TRUSTED_LINK_TIMEOUT 60
189190
#define WS_NEIGHBOR_NUD_TIMEOUT WS_NEIGHBOR_LINK_TIMEOUT / 2
190191

191192
#define WS_NEIGBOR_ETX_SAMPLE_MAX 3

0 commit comments

Comments
 (0)