Skip to content

Commit 09414e1

Browse files
ML-EID is now added to address registration tlv. (#1565)
1 parent ed76459 commit 09414e1

File tree

2 files changed

+4
-31
lines changed

2 files changed

+4
-31
lines changed

source/6LoWPAN/Thread/thread_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,8 @@ uint8_t *thread_address_registration_tlv_write(uint8_t *ptr, protocol_interface_
17121712
// Maximum length of address registrations
17131713
continue;
17141714
}
1715-
if (addr_ipv6_scope(e->address, cur) == IPV6_SCOPE_GLOBAL) {
1715+
if (addr_ipv6_scope(e->address, cur) == IPV6_SCOPE_GLOBAL || (addr_ipv6_scope(e->address, cur) == IPV6_SCOPE_REALM_LOCAL
1716+
&& !thread_addr_is_mesh_local_16(e->address, cur))) {
17161717
ctx = lowpan_context_get_by_address(&cur->lowpan_contexts, e->address);
17171718
if (ctx) {
17181719
//Write TLV to list
@@ -1725,7 +1726,6 @@ uint8_t *thread_address_registration_tlv_write(uint8_t *ptr, protocol_interface_
17251726
memcpy(ptr, e->address, 16);
17261727
ptr += 16;
17271728
*address_len_ptr += 17;
1728-
17291729
}
17301730
}
17311731
}

source/6LoWPAN/Thread/thread_host_bootstrap.c

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ static int thread_parent_request_build(protocol_interface_info_entry_t *cur);
8888
static int thread_attach_child_id_request_build(protocol_interface_info_entry_t *cur);
8989
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);
9090

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

9493

@@ -1028,25 +1027,6 @@ static bool thread_child_id_req_timeout(int8_t interface_id, uint16_t msgId, boo
10281027
return false;
10291028
}
10301029

1031-
static uint8_t *thread_single_address_registration_tlv_write(uint8_t *ptr, lowpan_context_t *ctx, uint8_t *addressPtr)
1032-
{
1033-
*ptr++ = MLE_TYPE_ADDRESS_REGISTRATION;
1034-
if (ctx) {
1035-
*ptr++ = 9;
1036-
//Write TLV to list
1037-
*ptr++ = (ctx->cid | 0x80);
1038-
memcpy(ptr, addressPtr + 8, 8);
1039-
ptr += 8;
1040-
} else {
1041-
*ptr++ = 17;
1042-
//Write TLV to list
1043-
*ptr++ = 0;
1044-
memcpy(ptr, addressPtr, 16);
1045-
ptr += 16;
1046-
}
1047-
return ptr;
1048-
}
1049-
10501030
static int thread_attach_child_id_request_build(protocol_interface_info_entry_t *cur)
10511031
{
10521032
uint8_t *ptr, *address_ptr;
@@ -1069,8 +1049,6 @@ static int thread_attach_child_id_request_build(protocol_interface_info_entry_t
10691049
thread_management_get_current_keysequence(cur->id, &keySequence);
10701050
mle_service_msg_update_security_params(buf_id, 5, 2, keySequence);
10711051

1072-
lowpan_context_t *ctx;
1073-
uint8_t ml64[16];
10741052
uint8_t request_tlv_list[3];
10751053
uint8_t macShort[2];
10761054
uint8_t reqTlvCnt;
@@ -1088,15 +1066,10 @@ static int thread_attach_child_id_request_build(protocol_interface_info_entry_t
10881066
ptr = mle_tlv_write_response(ptr, scan_parent->challengeData, scan_parent->chal_len);
10891067

10901068
//Add ML-EID
1091-
memcpy(ml64, thread_info(cur)->threadPrivatePrefixInfo.ulaPrefix, 8);
1092-
memcpy(&ml64[8], cur->iid_slaac, 8);
10931069
if ((mode & MLE_FFD_DEV) == 0) {
1094-
ctx = lowpan_context_get_by_address(&cur->lowpan_contexts, ml64);
1095-
if (ctx) {
1096-
//Write TLV to list
1097-
ptr = thread_single_address_registration_tlv_write(ptr, ctx, ml64);
1098-
}
1070+
ptr = thread_address_registration_tlv_write(ptr, cur);
10991071
}
1072+
11001073
reqTlvCnt = 2;
11011074
request_tlv_list[0] = MLE_TYPE_NETWORK_DATA;
11021075

0 commit comments

Comments
 (0)