Skip to content

Commit cb54705

Browse files
Address generation changed to slaac based generation (ARMmbed#1708)
1 parent ee0306b commit cb54705

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

source/6LoWPAN/Thread/thread_extension.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include "6LoWPAN/Thread/thread_extension_bootstrap.h"
5454
#include "6LoWPAN/Thread/thread_extension_constants.h"
5555
#include "6LoWPAN/MAC/mac_helper.h"
56+
#include "Common_Protocols/icmpv6.h"
5657
#include "NWK_INTERFACE/Include/protocol.h"
5758
#include "Common_Protocols/ipv6.h"
5859

@@ -436,16 +437,15 @@ void thread_extension_address_generate(protocol_interface_info_entry_t *cur)
436437
if (thread_extension_network_prefix_get(cur->id, &options, domain_address, &domain_prefix_len)) {
437438
return;
438439
}
439-
if(domain_prefix_len != 64 || !(options & 0x80)) {
440+
if (!(options & 0x80)) {
440441
tr_debug("domain prefix does not allow SLAAC address, prefix %s options:%u",trace_ipv6_prefix(domain_address,domain_prefix_len),options);
441442
return;
442443
}
443444

444-
//GENERATE ML-EID64
445-
memcpy(&domain_address[8], cur->iid_slaac , 8);
446-
def_address = addr_add(cur, domain_address, 64, ADDR_SOURCE_THREAD_DOMAIN, 0xffffffff, 0xffffffff, true);
445+
def_address = icmpv6_slaac_address_add(cur, domain_address, domain_prefix_len, 0xffffffff, 0xffffffff, true, SLAAC_IID_DEFAULT);
447446
if (def_address) {
448-
tr_info("Generated domain address 64: %s", trace_ipv6(domain_address));
447+
tr_info("Generated domain address 64: %s", trace_ipv6(def_address->address));
448+
def_address->source = ADDR_SOURCE_THREAD_DOMAIN;
449449
} else {
450450
tr_error("Domain address creation failed");
451451
}

0 commit comments

Comments
 (0)