Skip to content

Commit 0b920d8

Browse files
author
Juha Heiskanen
committed
Fixed broken neighbor purge from list
List re ordering was broken and now re-order works like it should. Neighbor link role is defined that now bigger role ID have bigger priority. Change-Id: I901169a4c7b8e965982fe9420db54d86aaf268f6
1 parent a6f3a0d commit 0b920d8

File tree

2 files changed

+11
-26
lines changed

2 files changed

+11
-26
lines changed

source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,31 +1328,16 @@ static uint8_t protocol_6lowpan_mle_order_last_entries(int8_t interface_id, mac_
13281328
continue;
13291329
}
13301330

1331-
1332-
1333-
// Primary parent (parent selected for bootstrap or RPL primary parent)
1334-
if (entry->link_role == PRIORITY_PARENT_NEIGHBOUR && last->link_role != PRIORITY_PARENT_NEIGHBOUR) {
1335-
continue;
1336-
}
1337-
1338-
// Secondary parent (RPL secondary parent)
1339-
if (entry->link_role == SECONDARY_PARENT_NEIGHBOUR && last->link_role != SECONDARY_PARENT_NEIGHBOUR) {
1340-
continue;
1341-
}
1342-
1343-
// Uses this node as parent
1344-
if (entry->link_role == CHILD_NEIGHBOUR && last->link_role != CHILD_NEIGHBOUR) {
1345-
continue;
1346-
}
1347-
1348-
// Better ETX
1349-
etx_cur = etx_storage_entry_get(interface_id, entry->index);
1350-
etx_last = etx_storage_entry_get(interface_id, last->index);
1351-
1352-
if (etx_cur && etx_last && etx_cur->etx <= etx_last->etx) {
1331+
if (entry->link_role > last->link_role) { //Bigger link role is allways better
13531332
continue;
1333+
} else if (entry->link_role == last->link_role) {
1334+
// Compare ETX when Link role is same
1335+
etx_cur = etx_storage_entry_get(interface_id, entry->index);
1336+
etx_last = etx_storage_entry_get(interface_id, last->index);
1337+
if (etx_cur && etx_last && etx_cur->etx <= etx_last->etx) {
1338+
continue;
1339+
}
13541340
}
1355-
13561341
last = entry;
13571342
}
13581343

source/Service_Libs/mac_neighbor_table/mac_neighbor_table.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
#define ACTIVE_NUD_PROCESS_MAX 3 //Limit That how many activate NUD process is active in same time
2727

2828
#define NORMAL_NEIGHBOUR 0
29-
#define PRIORITY_PARENT_NEIGHBOUR 1
30-
#define SECONDARY_PARENT_NEIGHBOUR 2
31-
#define CHILD_NEIGHBOUR 3
29+
#define SECONDARY_PARENT_NEIGHBOUR 1
30+
#define CHILD_NEIGHBOUR 2
31+
#define PRIORITY_PARENT_NEIGHBOUR 3
3232
/**
3333
* Generic Neighbor table entry
3434
*/

0 commit comments

Comments
 (0)