Skip to content

Commit 1ef5062

Browse files
Address registration fix (#1882)
skipped triggering of child update request for known multicast addresses, removed multicast entries before processing new address registration tlv.
1 parent e7a8d45 commit 1ef5062

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

source/6LoWPAN/Thread/thread_common.c

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,9 +2056,34 @@ static void thread_address_notification_cb(struct protocol_interface_info_entry
20562056
}
20572057
}
20582058

2059-
void thread_mcast_group_change(struct protocol_interface_info_entry *interface, if_group_entry_t *group, bool addr_added)
2059+
static bool thread_mcast_should_register_address(struct protocol_interface_info_entry *cur, uint8_t *addr)
20602060
{
2061+
uint8_t thread_realm_local_mcast_addr[16];
2062+
uint8_t thread_ll_unicast_prefix_based_mcast_addr[16];
2063+
thread_bootstrap_all_nodes_address_generate(thread_realm_local_mcast_addr, cur->thread_info->threadPrivatePrefixInfo.ulaPrefix, IPV6_SCOPE_REALM_LOCAL);
2064+
thread_bootstrap_all_nodes_address_generate(thread_ll_unicast_prefix_based_mcast_addr, cur->thread_info->threadPrivatePrefixInfo.ulaPrefix, IPV6_SCOPE_LINK_LOCAL);
2065+
if (addr_ipv6_multicast_scope(addr) >= IPV6_SCOPE_LINK_LOCAL) {
2066+
if (memcmp(addr, ADDR_MULTICAST_SOLICITED, 13) == 0) {
2067+
return false;
2068+
}
2069+
if (memcmp(addr, thread_realm_local_mcast_addr, 16) == 0) {
2070+
return false;
2071+
}
2072+
if (memcmp(addr, thread_ll_unicast_prefix_based_mcast_addr, 16) == 0) {
2073+
return false;
2074+
}
2075+
if (memcmp(addr, ADDR_LINK_LOCAL_ALL_NODES, 16) == 0) {
2076+
return false;
2077+
}
2078+
if (memcmp(addr, ADDR_LINK_LOCAL_ALL_ROUTERS, 16) == 0) {
2079+
return false;
2080+
}
2081+
}
2082+
return true;
2083+
}
20612084

2085+
void thread_mcast_group_change(struct protocol_interface_info_entry *interface, if_group_entry_t *group, bool addr_added)
2086+
{
20622087
if (thread_attach_ready(interface) != 0) {
20632088
return;
20642089
}
@@ -2067,7 +2092,7 @@ void thread_mcast_group_change(struct protocol_interface_info_entry *interface,
20672092

20682093
if (thread_bootstrap_should_register_address(interface)) {
20692094
/* Trigger Child Update Request only if MTD child's multicast address change */
2070-
if (addr_ipv6_multicast_scope(group->group) >= IPV6_SCOPE_LINK_LOCAL) {
2095+
if (thread_mcast_should_register_address(interface, group->group)) {
20712096
interface->thread_info->childUpdateReqTimer = 1;
20722097
}
20732098
} else {

source/6LoWPAN/Thread/thread_router_bootstrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ static void thread_address_registration_tlv_parse(uint8_t *ptr, uint16_t data_le
13921392
uint8_t tempIPv6Address[16];
13931393
uint8_t ctxId;
13941394
bool new_neighbour_created;
1395-
1395+
thread_child_mcast_entries_remove(cur,mac64);
13961396
while (data_length) {
13971397
//Read
13981398
ctxId = *ptr++;

0 commit comments

Comments
 (0)