Skip to content

Commit

Permalink
Wi-SUN NS probe update:
Browse files Browse the repository at this point in the history
ARO is added to new parent candidate probe message if address is available.
  • Loading branch information
Juha Heiuskanen committed Nov 10, 2020
1 parent 579f756 commit 51cd564
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
31 changes: 29 additions & 2 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,18 +426,45 @@ static void ws_nud_entry_remove(protocol_interface_info_entry_t *cur, mac_neighb
ws_nud_state_clean(cur, nud_entry);
}
}
if_address_entry_t *ws_probe_aro_address(protocol_interface_info_entry_t *interface)
{
if (interface->global_address_available) {
ns_list_foreach(if_address_entry_t, address, &interface->ip_addresses) {
if (addr_ipv6_scope(address->address, interface) > IPV6_SCOPE_LINK_LOCAL) {
return address;
}
}
}
return NULL;
}


static bool ws_nud_message_build(protocol_interface_info_entry_t *cur, mac_neighbor_table_entry_t *neighbor, bool nud_process)
{
//Send NS
uint8_t ll_target[16];
aro_t aro_temp;
//SET ARO and src address pointer to NULL by default
aro_t *aro_ptr = NULL;
uint8_t *src_address_ptr = NULL;

ws_bootsrap_create_ll_address(ll_target, neighbor->mac64);
if (nud_process) {
tr_info("NUD generate NS %u", neighbor->index);
} else {
tr_info("Probe generate NS %u", neighbor->index);
}
buffer_t *buffer = icmpv6_build_ns(cur, ll_target, NULL, true, false, NULL);
if_address_entry_t *gp_address = ws_probe_aro_address(cur);
if (gp_address) {
src_address_ptr = gp_address->address;
aro_temp.status = ARO_SUCCESS;
aro_temp.present = true;
memcpy(aro_temp.eui64, cur->mac, 8);
//Just Short Test
aro_temp.lifetime = 1;
aro_ptr = &aro_temp;
}
}
buffer_t *buffer = icmpv6_build_ns(cur, ll_target, src_address_ptr, true, false, aro_ptr);
if (buffer) {
protocol_push(buffer);
return true;
Expand Down
6 changes: 5 additions & 1 deletion source/Common_Protocols/icmpv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,11 @@ buffer_t *icmpv6_build_ns(protocol_interface_info_entry_t *cur, const uint8_t ta
/* If ARO Success sending is omitted, MAC ACK is used instead */
/* Setting callback for receiving ACK from adaptation layer */
if (aro && cur->ipv6_neighbour_cache.omit_na_aro_success) {
buf->ack_receive_cb = icmpv6_aro_cb;
if (aro->lifetime > 1) {
buf->ack_receive_cb = icmpv6_aro_cb;
} else {
buf->ack_receive_cb = ack_receive_cb;
}
}
}
if (unicast && (!aro && cur->ipv6_neighbour_cache.omit_na)) {
Expand Down

0 comments on commit 51cd564

Please sign in to comment.