|
64 | 64 |
|
65 | 65 | #define TRACE_GROUP "comm" |
66 | 66 |
|
67 | | -#define SECURITY_POLICY_CCM_ENABLED 0x04 /* Thread Commercial Commissioning Mode is enabled when this bit is set. This is Thread 1.2 feature. */ |
| 67 | +#define SECURITY_POLICY_CCM_DISABLED 0x04 /* Thread Commercial Commissioning Mode is enabled when this bit is set. This is Thread 1.2 feature. */ |
68 | 68 |
|
69 | 69 | typedef struct thread_extension_info { |
70 | 70 | int8_t coap_service_id; |
@@ -271,6 +271,9 @@ int thread_extension_primary_bbr_get(struct protocol_interface_info_entry *cur, |
271 | 271 | } |
272 | 272 | if (mlr_timer_ptr) { |
273 | 273 | *mlr_timer_ptr = common_read_32_bit(&found_tlv[7]); |
| 274 | + if (*mlr_timer_ptr < THREAD_DEFAULT_MIN_MLR_TIMEOUT) { |
| 275 | + *mlr_timer_ptr = THREAD_DEFAULT_MIN_MLR_TIMEOUT; |
| 276 | + } |
274 | 277 | } |
275 | 278 | return 0; |
276 | 279 | } |
@@ -496,14 +499,16 @@ void thread_extension_mcast_subscrition_change(protocol_interface_info_entry_t * |
496 | 499 | if (addr_ipv6_multicast_scope(group->group) < IPV6_SCOPE_ADMIN_LOCAL) { |
497 | 500 | return; |
498 | 501 | } |
499 | | - // Default timer added. |
500 | | - group->mld_timer = added ? THREAD_ADDR_REG_TIMEOUT_BASE + randLIB_get_random_in_range(1, 30) : 0; |
501 | 502 |
|
502 | | - if (0 !=thread_extension_primary_bbr_get(interface, br_ml_addr, NULL, &mlr_timer, NULL )) { |
| 503 | + if (0 != thread_extension_primary_bbr_get(interface, br_ml_addr, NULL, &mlr_timer, NULL )) { |
| 504 | + // No BBR, try again later if adding address. |
| 505 | + group->mld_timer = added ? THREAD_ADDR_REG_RETRY_INTERVAL + randLIB_get_random_in_range(1, 30) : 0; |
503 | 506 | return; |
504 | 507 | } |
505 | | - // follow the Primary BBR set timeout + Small jitter added |
506 | | - group->mld_timer = added ? mlr_timer: 0; |
| 508 | + |
| 509 | + // follow the Primary BBR set timeout. |
| 510 | + group->mld_timer = added ? (mlr_timer - randLIB_get_random_in_range(30, 40)) : 0; |
| 511 | + |
507 | 512 | // MLR is sent only for primary BBR for now, but this might change |
508 | 513 | thread_extension_mlr_req_send(interface, br_ml_addr, group->group); |
509 | 514 |
|
@@ -576,7 +581,7 @@ bool thread_extension_enabled(protocol_interface_info_entry_t *cur) |
576 | 581 | } |
577 | 582 | uint16_t securityPolicy = thread_joiner_application_security_policy_get(cur->id); |
578 | 583 |
|
579 | | - if (securityPolicy & SECURITY_POLICY_CCM_ENABLED) { |
| 584 | + if (!(securityPolicy & SECURITY_POLICY_CCM_DISABLED)) { |
580 | 585 | return true; |
581 | 586 | } |
582 | 587 |
|
@@ -615,11 +620,9 @@ void thread_extension_discover_response_read(discovery_response_list_t *nwk_info |
615 | 620 |
|
616 | 621 | void thread_extension_discover_response_tlv_write(uint16_t *data, uint8_t version, uint16_t securityPolicy) |
617 | 622 | { |
618 | | - |
619 | | - if (version == 3 && !(securityPolicy & SECURITY_POLICY_CCM_ENABLED)) { |
| 623 | + if (version == 3 && !(securityPolicy & SECURITY_POLICY_CCM_DISABLED)) { |
620 | 624 | *data |= (uint16_t) (1 << 10); |
621 | 625 | } |
622 | | - return; |
623 | 626 | } |
624 | 627 |
|
625 | 628 | #ifdef HAVE_THREAD_ROUTER |
|
0 commit comments