Skip to content

Commit

Permalink
ML-EID is now added to address registration tlv. (ARMmbed#1565)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakvenugopal authored Feb 13, 2018
1 parent ed76459 commit 09414e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 31 deletions.
4 changes: 2 additions & 2 deletions source/6LoWPAN/Thread/thread_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,7 +1712,8 @@ uint8_t *thread_address_registration_tlv_write(uint8_t *ptr, protocol_interface_
// Maximum length of address registrations
continue;
}
if (addr_ipv6_scope(e->address, cur) == IPV6_SCOPE_GLOBAL) {
if (addr_ipv6_scope(e->address, cur) == IPV6_SCOPE_GLOBAL || (addr_ipv6_scope(e->address, cur) == IPV6_SCOPE_REALM_LOCAL
&& !thread_addr_is_mesh_local_16(e->address, cur))) {
ctx = lowpan_context_get_by_address(&cur->lowpan_contexts, e->address);
if (ctx) {
//Write TLV to list
Expand All @@ -1725,7 +1726,6 @@ uint8_t *thread_address_registration_tlv_write(uint8_t *ptr, protocol_interface_
memcpy(ptr, e->address, 16);
ptr += 16;
*address_len_ptr += 17;

}
}
}
Expand Down
31 changes: 2 additions & 29 deletions source/6LoWPAN/Thread/thread_host_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ static int thread_parent_request_build(protocol_interface_info_entry_t *cur);
static int thread_attach_child_id_request_build(protocol_interface_info_entry_t *cur);
static int thread_end_device_synch_response_validate(protocol_interface_info_entry_t *cur, uint8_t *ptr, uint16_t data_length, uint8_t linkMargin, uint8_t *src_address, mle_security_header_t *securityHeader);

static uint8_t *thread_single_address_registration_tlv_write(uint8_t *ptr, lowpan_context_t *ctx, uint8_t *addressPtr);
static int8_t thread_end_device_synch_start(protocol_interface_info_entry_t *cur);


Expand Down Expand Up @@ -1028,25 +1027,6 @@ static bool thread_child_id_req_timeout(int8_t interface_id, uint16_t msgId, boo
return false;
}

static uint8_t *thread_single_address_registration_tlv_write(uint8_t *ptr, lowpan_context_t *ctx, uint8_t *addressPtr)
{
*ptr++ = MLE_TYPE_ADDRESS_REGISTRATION;
if (ctx) {
*ptr++ = 9;
//Write TLV to list
*ptr++ = (ctx->cid | 0x80);
memcpy(ptr, addressPtr + 8, 8);
ptr += 8;
} else {
*ptr++ = 17;
//Write TLV to list
*ptr++ = 0;
memcpy(ptr, addressPtr, 16);
ptr += 16;
}
return ptr;
}

static int thread_attach_child_id_request_build(protocol_interface_info_entry_t *cur)
{
uint8_t *ptr, *address_ptr;
Expand All @@ -1069,8 +1049,6 @@ static int thread_attach_child_id_request_build(protocol_interface_info_entry_t
thread_management_get_current_keysequence(cur->id, &keySequence);
mle_service_msg_update_security_params(buf_id, 5, 2, keySequence);

lowpan_context_t *ctx;
uint8_t ml64[16];
uint8_t request_tlv_list[3];
uint8_t macShort[2];
uint8_t reqTlvCnt;
Expand All @@ -1088,15 +1066,10 @@ static int thread_attach_child_id_request_build(protocol_interface_info_entry_t
ptr = mle_tlv_write_response(ptr, scan_parent->challengeData, scan_parent->chal_len);

//Add ML-EID
memcpy(ml64, thread_info(cur)->threadPrivatePrefixInfo.ulaPrefix, 8);
memcpy(&ml64[8], cur->iid_slaac, 8);
if ((mode & MLE_FFD_DEV) == 0) {
ctx = lowpan_context_get_by_address(&cur->lowpan_contexts, ml64);
if (ctx) {
//Write TLV to list
ptr = thread_single_address_registration_tlv_write(ptr, ctx, ml64);
}
ptr = thread_address_registration_tlv_write(ptr, cur);
}

reqTlvCnt = 2;
request_tlv_list[0] = MLE_TYPE_NETWORK_DATA;

Expand Down

0 comments on commit 09414e1

Please sign in to comment.