Skip to content

Commit eac63d2

Browse files
author
Juha Heiskanen
committed
FHSS and address registration update
Fixed Address registration after parent update by RPL Fixed Unicast random fixed channel bug. Change-Id: Iae7ac55aab0323155cf8a9d8a66326bbd845189c
1 parent c14343a commit eac63d2

File tree

4 files changed

+43
-4
lines changed

4 files changed

+43
-4
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,16 +526,21 @@ uint16_t protocol_6lowpan_neighbor_second_priority_set(int8_t interface_id, addr
526526
mac_neighbor_table_entry_t * entry = mac_neighbor_table_address_discover(mac_neighbor_info(cur), addr_ptr + PAN_ID_LEN, addr_type);
527527

528528
if (entry) {
529+
bool new_secondary = false;
529530
etx_storage_t *etx_entry = etx_storage_entry_get(interface_id, entry->index);
530531
// If secondary parent has changed clears priority from previous parent
531532
if (entry->link_role != SECONDARY_PARENT_NEIGHBOUR) {
533+
new_secondary = true;
532534
protocol_6lowpan_neighbor_priority_clear_all(interface_id, PRIORITY_2ND);
533535
}
534536
entry->link_role = SECONDARY_PARENT_NEIGHBOUR;
535537

536538
if (etx_entry) {
537539
protocol_stats_update(STATS_ETX_2ND_PARENT, etx_entry->etx >> 4);
538540
}
541+
if (new_secondary) {
542+
ws_secondary_parent_update(cur);
543+
}
539544
return 1;
540545
} else {
541546
return 0;

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,9 @@ static int8_t ws_fhss_set_defaults(protocol_interface_info_entry_t *cur, fhss_ws
383383
fhss_configuration->ws_bc_channel_function = cur->ws_info->fhss_bc_channel_function;
384384
fhss_configuration->fhss_bc_dwell_interval = cur->ws_info->fhss_bc_dwell_interval;
385385
fhss_configuration->fhss_broadcast_interval = cur->ws_info->fhss_bc_interval;
386-
fhss_configuration->unicast_fixed_channel = cur->ws_info->fhss_uc_fixed_channel;
386+
if (cur->ws_info->fhss_uc_fixed_channel != 0xffff) {
387+
fhss_configuration->unicast_fixed_channel = cur->ws_info->fhss_uc_fixed_channel;
388+
}
387389
fhss_configuration->broadcast_fixed_channel = cur->ws_info->fhss_bc_fixed_channel;
388390
ws_generate_channel_list(fhss_configuration->channel_mask, cur->ws_info->hopping_schdule.number_of_channels, cur->ws_info->hopping_schdule.regulatory_domain);
389391

@@ -490,7 +492,7 @@ static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry
490492
fhss_configuration.broadcast_fixed_channel = cur->ws_info->fhss_bc_fixed_channel;
491493

492494
}
493-
fhss_configuration.unicast_fixed_channel = cur->ws_info->fhss_uc_fixed_channel;
495+
494496
ns_fhss_ws_configuration_set(cur->ws_info->fhss_api, &fhss_configuration);
495497

496498
// We have broadcast schedule set up set the broadcast parent schedule
@@ -1448,6 +1450,14 @@ static void ws_set_fhss_hop(protocol_interface_info_entry_t *cur)
14481450
ns_fhss_ws_set_hop_count(cur->ws_info->fhss_api, own_hop);
14491451
}
14501452

1453+
static void ws_address_registration_update(protocol_interface_info_entry_t *interface)
1454+
{
1455+
if (!interface->ws_info->address_registration_event_active) {
1456+
interface->ws_info->address_registration_event_active = true;
1457+
tr_info("RPL parent update ... register ARO");
1458+
ws_bootsrap_event_trig(WS_ADDRESS_ADDED, interface->bootStrapId, ARM_LIB_LOW_PRIORITY_EVENT, NULL);
1459+
}
1460+
}
14511461

14521462
static void ws_bootstrap_rpl_callback(rpl_event_t event, void *handle)
14531463
{
@@ -1472,8 +1482,7 @@ static void ws_bootstrap_rpl_callback(rpl_event_t event, void *handle)
14721482
*/
14731483

14741484
} else if (event == RPL_EVENT_DAO_PARENT_SWITCH) {
1475-
tr_info("RPL parent update ... register ARO");
1476-
ws_bootsrap_event_trig(WS_ADDRESS_ADDED, cur->bootStrapId, ARM_LIB_LOW_PRIORITY_EVENT, NULL);
1485+
ws_address_registration_update(cur);
14771486
}
14781487
cur->ws_info->rpl_state = event;
14791488
tr_info("RPL event %d", event);
@@ -1861,6 +1870,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
18611870
ws_bootstrap_state_change(cur, ER_BOOTSRAP_DONE);
18621871
break;
18631872
case WS_ADDRESS_ADDED:
1873+
cur->ws_info->address_registration_event_active = false;
18641874
if (!ws_bootstrap_address_registration_ongoing(cur)) {
18651875
rpl_control_register_address(cur, (if_address_entry_t *) event->data_ptr);
18661876
}
@@ -2052,6 +2062,26 @@ void ws_primary_parent_update(protocol_interface_info_entry_t *interface, mac_ne
20522062
neighbor_info.neighbor = neighbor;
20532063
neighbor_info.ws_neighbor = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, neighbor->index);
20542064
ws_bootstrap_primary_parent_set(interface, &neighbor_info);
2065+
2066+
//Clear both address registration
2067+
ns_list_foreach(if_address_entry_t, address, &interface->ip_addresses) {
2068+
if (!addr_is_ipv6_link_local(address->address)) {
2069+
address->addr_reg_done = 0;
2070+
ws_address_registration_update(interface);
2071+
}
2072+
}
2073+
}
2074+
}
2075+
2076+
void ws_secondary_parent_update(protocol_interface_info_entry_t *interface)
2077+
{
2078+
if (interface->ws_info) {
2079+
ns_list_foreach(if_address_entry_t, address, &interface->ip_addresses) {
2080+
if (!addr_is_ipv6_link_local(address->address)) {
2081+
address->addr_reg_done = 0;
2082+
ws_address_registration_update(interface);
2083+
}
2084+
}
20552085
}
20562086
}
20572087

source/6LoWPAN/ws/ws_bootstrap.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ void ws_bootstrap_trickle_timer(protocol_interface_info_entry_t *cur, uint16_t t
5656

5757
void ws_primary_parent_update(protocol_interface_info_entry_t *interface, mac_neighbor_table_entry_t *neighbor);
5858

59+
void ws_secondary_parent_update(protocol_interface_info_entry_t *interface);
60+
5961
void ws_nud_entry_remove_active(protocol_interface_info_entry_t *cur, void *neighbor);
6062

6163
void ws_nud_active_timer(protocol_interface_info_entry_t *cur, uint16_t ticks);
@@ -66,6 +68,7 @@ void ws_nud_active_timer(protocol_interface_info_entry_t *cur, uint16_t ticks);
6668
#define ws_bootstrap_state_machine(cur)
6769
#define ws_bootstrap_restart(cur)
6870
#define ws_primary_parent_update(interface, neighbor)
71+
#define ws_secondary_parent_update(interface)
6972

7073
#endif //HAVE_WS
7174

source/6LoWPAN/ws/ws_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ typedef struct ws_info_s {
6767
uint32_t pan_version_timer; /**< border router version udate timeout */
6868
uint32_t pan_version_timeout_timer; /**< routers will fallback to previous state after this */
6969
uint8_t gtkhash[32];
70+
bool address_registration_event_active : 1;
7071
bool configuration_learned:1;
7172
bool trickle_pas_running:1;
7273
bool trickle_pa_running:1;

0 commit comments

Comments
 (0)