|
53 | 53 | #include "6LoWPAN/Thread/thread_extension_bootstrap.h"
|
54 | 54 | #include "6LoWPAN/Thread/thread_extension_constants.h"
|
55 | 55 | #include "6LoWPAN/MAC/mac_helper.h"
|
| 56 | +#include "Common_Protocols/icmpv6.h" |
56 | 57 | #include "NWK_INTERFACE/Include/protocol.h"
|
57 | 58 | #include "Common_Protocols/ipv6.h"
|
58 | 59 |
|
@@ -436,16 +437,15 @@ void thread_extension_address_generate(protocol_interface_info_entry_t *cur)
|
436 | 437 | if (thread_extension_network_prefix_get(cur->id, &options, domain_address, &domain_prefix_len)) {
|
437 | 438 | return;
|
438 | 439 | }
|
439 |
| - if(domain_prefix_len != 64 || !(options & 0x80)) { |
| 440 | + if (!(options & 0x80)) { |
440 | 441 | tr_debug("domain prefix does not allow SLAAC address, prefix %s options:%u",trace_ipv6_prefix(domain_address,domain_prefix_len),options);
|
441 | 442 | return;
|
442 | 443 | }
|
443 | 444 |
|
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); |
447 | 446 | 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; |
449 | 449 | } else {
|
450 | 450 | tr_error("Domain address creation failed");
|
451 | 451 | }
|
|
0 commit comments