From 1ef5062f02132f9b867cff6f2e55334a8f532647 Mon Sep 17 00:00:00 2001 From: Deepak Venugopal Date: Mon, 29 Oct 2018 15:15:06 +0100 Subject: [PATCH] Address registration fix (#1882) skipped triggering of child update request for known multicast addresses, removed multicast entries before processing new address registration tlv. --- source/6LoWPAN/Thread/thread_common.c | 29 +++++++++++++++++-- .../6LoWPAN/Thread/thread_router_bootstrap.c | 2 +- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/source/6LoWPAN/Thread/thread_common.c b/source/6LoWPAN/Thread/thread_common.c index 39c184e99cf..567851ecb4b 100644 --- a/source/6LoWPAN/Thread/thread_common.c +++ b/source/6LoWPAN/Thread/thread_common.c @@ -2056,9 +2056,34 @@ static void thread_address_notification_cb(struct protocol_interface_info_entry } } -void thread_mcast_group_change(struct protocol_interface_info_entry *interface, if_group_entry_t *group, bool addr_added) +static bool thread_mcast_should_register_address(struct protocol_interface_info_entry *cur, uint8_t *addr) { + uint8_t thread_realm_local_mcast_addr[16]; + uint8_t thread_ll_unicast_prefix_based_mcast_addr[16]; + thread_bootstrap_all_nodes_address_generate(thread_realm_local_mcast_addr, cur->thread_info->threadPrivatePrefixInfo.ulaPrefix, IPV6_SCOPE_REALM_LOCAL); + thread_bootstrap_all_nodes_address_generate(thread_ll_unicast_prefix_based_mcast_addr, cur->thread_info->threadPrivatePrefixInfo.ulaPrefix, IPV6_SCOPE_LINK_LOCAL); + if (addr_ipv6_multicast_scope(addr) >= IPV6_SCOPE_LINK_LOCAL) { + if (memcmp(addr, ADDR_MULTICAST_SOLICITED, 13) == 0) { + return false; + } + if (memcmp(addr, thread_realm_local_mcast_addr, 16) == 0) { + return false; + } + if (memcmp(addr, thread_ll_unicast_prefix_based_mcast_addr, 16) == 0) { + return false; + } + if (memcmp(addr, ADDR_LINK_LOCAL_ALL_NODES, 16) == 0) { + return false; + } + if (memcmp(addr, ADDR_LINK_LOCAL_ALL_ROUTERS, 16) == 0) { + return false; + } + } + return true; +} +void thread_mcast_group_change(struct protocol_interface_info_entry *interface, if_group_entry_t *group, bool addr_added) +{ if (thread_attach_ready(interface) != 0) { return; } @@ -2067,7 +2092,7 @@ void thread_mcast_group_change(struct protocol_interface_info_entry *interface, if (thread_bootstrap_should_register_address(interface)) { /* Trigger Child Update Request only if MTD child's multicast address change */ - if (addr_ipv6_multicast_scope(group->group) >= IPV6_SCOPE_LINK_LOCAL) { + if (thread_mcast_should_register_address(interface, group->group)) { interface->thread_info->childUpdateReqTimer = 1; } } else { diff --git a/source/6LoWPAN/Thread/thread_router_bootstrap.c b/source/6LoWPAN/Thread/thread_router_bootstrap.c index cd1198da13f..127ea439d17 100644 --- a/source/6LoWPAN/Thread/thread_router_bootstrap.c +++ b/source/6LoWPAN/Thread/thread_router_bootstrap.c @@ -1392,7 +1392,7 @@ static void thread_address_registration_tlv_parse(uint8_t *ptr, uint16_t data_le uint8_t tempIPv6Address[16]; uint8_t ctxId; bool new_neighbour_created; - + thread_child_mcast_entries_remove(cur,mac64); while (data_length) { //Read ctxId = *ptr++;