Skip to content

Commit e07cfb4

Browse files
re-factored thread_mcast_should_register_address. (ARMmbed#1887)
1 parent 426acd1 commit e07cfb4

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

source/6LoWPAN/Thread/thread_common.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,24 +2060,25 @@ static bool thread_mcast_should_register_address(struct protocol_interface_info_
20602060
{
20612061
uint8_t thread_realm_local_mcast_addr[16];
20622062
uint8_t thread_ll_unicast_prefix_based_mcast_addr[16];
2063+
if (addr_ipv6_multicast_scope(addr) < IPV6_SCOPE_LINK_LOCAL) {
2064+
return false;
2065+
}
2066+
if (memcmp(addr, ADDR_MULTICAST_SOLICITED, 13) == 0) {
2067+
return false;
2068+
}
2069+
if (memcmp(addr, ADDR_LINK_LOCAL_ALL_NODES, 16) == 0) {
2070+
return false;
2071+
}
2072+
if (memcmp(addr, ADDR_LINK_LOCAL_ALL_ROUTERS, 16) == 0) {
2073+
return false;
2074+
}
20632075
thread_bootstrap_all_nodes_address_generate(thread_realm_local_mcast_addr, cur->thread_info->threadPrivatePrefixInfo.ulaPrefix, IPV6_SCOPE_REALM_LOCAL);
2076+
if (memcmp(addr, thread_realm_local_mcast_addr, 16) == 0) {
2077+
return false;
2078+
}
20642079
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-
}
2080+
if (memcmp(addr, thread_ll_unicast_prefix_based_mcast_addr, 16) == 0) {
2081+
return false;
20812082
}
20822083
return true;
20832084
}

0 commit comments

Comments
 (0)