Skip to content

Commit e7a8d45

Browse files
link-local multicast group registration (ARMmbed#1880)
Added possibility for rx-off-when idle devices to register link-local multicast groups to parent.
1 parent d4c95f2 commit e7a8d45

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

source/6LoWPAN/Thread/thread_common.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,7 @@ bool thread_addresses_needs_to_be_registered(protocol_interface_info_entry_t *cu
17461746
{
17471747
lowpan_context_t *ctx;
17481748
uint8_t thread_realm_local_mcast_addr[16];
1749+
uint8_t thread_ll_unicast_prefix_based_mcast_addr[16];
17491750
if (thread_info(cur)->thread_device_mode != THREAD_DEVICE_MODE_SLEEPY_END_DEVICE &&
17501751
thread_info(cur)->thread_device_mode != THREAD_DEVICE_MODE_END_DEVICE) {
17511752
// No address registration for others than MED or SED
@@ -1768,18 +1769,22 @@ bool thread_addresses_needs_to_be_registered(protocol_interface_info_entry_t *cu
17681769
}
17691770

17701771
// check for multicast groups
1771-
thread_bootstrap_all_nodes_address_generate(thread_realm_local_mcast_addr, cur->thread_info->threadPrivatePrefixInfo.ulaPrefix, 3);
1772+
thread_bootstrap_all_nodes_address_generate(thread_realm_local_mcast_addr, cur->thread_info->threadPrivatePrefixInfo.ulaPrefix, IPV6_SCOPE_REALM_LOCAL);
1773+
thread_bootstrap_all_nodes_address_generate(thread_ll_unicast_prefix_based_mcast_addr, cur->thread_info->threadPrivatePrefixInfo.ulaPrefix, IPV6_SCOPE_LINK_LOCAL);
17721774
ns_list_foreach(if_group_entry_t, entry, &cur->ip_groups)
17731775
{
1774-
if (addr_ipv6_multicast_scope(entry->group) < IPV6_SCOPE_REALM_LOCAL) {
1775-
/* Skip Link Local multicast address */
1776+
if (!memcmp((entry->group), ADDR_MULTICAST_SOLICITED, 13)) {
1777+
/* Skip solicited node multicast address */
17761778
continue;
17771779
}
1778-
17791780
if (addr_ipv6_equal(entry->group, thread_realm_local_mcast_addr)) {
17801781
/* Skip well-known realm-local all Thread nodes multicast address */
17811782
continue;
17821783
}
1784+
if (addr_ipv6_equal(entry->group, thread_ll_unicast_prefix_based_mcast_addr)) {
1785+
/* Skip well-known link-local all Thread nodes multicast address */
1786+
continue;
1787+
}
17831788
if (addr_ipv6_equal(entry->group, ADDR_ALL_MPL_FORWARDERS)) {
17841789
/* Skip All MPL Forwarders address */
17851790
continue;
@@ -1835,6 +1840,7 @@ uint8_t *thread_ml_address_tlv_write(uint8_t *ptr, protocol_interface_info_entry
18351840
uint8_t *thread_address_registration_tlv_write(uint8_t *ptr, protocol_interface_info_entry_t *cur)
18361841
{
18371842
uint8_t thread_realm_local_mcast_addr[16];
1843+
uint8_t thread_ll_unicast_prefix_based_mcast_addr[16];
18381844
lowpan_context_t *ctx;
18391845
uint8_t *address_len_ptr;
18401846

@@ -1850,7 +1856,6 @@ uint8_t *thread_address_registration_tlv_write(uint8_t *ptr, protocol_interface_
18501856

18511857
// Register all global addressess
18521858
ns_list_foreach(if_address_entry_t, e, &cur->ip_addresses) {
1853-
18541859
if (*address_len_ptr > 148 ) {
18551860
// Maximum length of address registrations
18561861
continue;
@@ -1874,23 +1879,27 @@ uint8_t *thread_address_registration_tlv_write(uint8_t *ptr, protocol_interface_
18741879
}
18751880

18761881
/* Registers multicast addresses to the parent */
1877-
thread_bootstrap_all_nodes_address_generate(thread_realm_local_mcast_addr, cur->thread_info->threadPrivatePrefixInfo.ulaPrefix, 3);
1878-
1882+
thread_bootstrap_all_nodes_address_generate(thread_realm_local_mcast_addr, cur->thread_info->threadPrivatePrefixInfo.ulaPrefix, IPV6_SCOPE_REALM_LOCAL);
1883+
thread_bootstrap_all_nodes_address_generate(thread_ll_unicast_prefix_based_mcast_addr, cur->thread_info->threadPrivatePrefixInfo.ulaPrefix, IPV6_SCOPE_LINK_LOCAL);
18791884
ns_list_foreach(if_group_entry_t, entry, &cur->ip_groups)
18801885
{
18811886
if (*address_len_ptr > 148) {
18821887
// Maximum length of address registrations
18831888
continue;
18841889
}
1885-
if (addr_ipv6_multicast_scope(entry->group) < IPV6_SCOPE_REALM_LOCAL) {
1886-
/* Skip Link Local multicast address */
1890+
1891+
if (!memcmp((entry->group), ADDR_MULTICAST_SOLICITED, 13)) {
1892+
/* Skip solicited node multicast address */
18871893
continue;
18881894
}
1889-
18901895
if (addr_ipv6_equal(entry->group, thread_realm_local_mcast_addr)) {
18911896
/* Skip well-known realm-local all Thread nodes multicast address */
18921897
continue;
18931898
}
1899+
if (addr_ipv6_equal(entry->group, thread_ll_unicast_prefix_based_mcast_addr)) {
1900+
/* Skip well-known link-local all Thread nodes multicast address */
1901+
continue;
1902+
}
18941903
if (addr_ipv6_equal(entry->group, ADDR_ALL_MPL_FORWARDERS)) {
18951904
/* Skip All MPL Forwarders address */
18961905
continue;
@@ -2058,7 +2067,7 @@ void thread_mcast_group_change(struct protocol_interface_info_entry *interface,
20582067

20592068
if (thread_bootstrap_should_register_address(interface)) {
20602069
/* Trigger Child Update Request only if MTD child's multicast address change */
2061-
if (addr_ipv6_multicast_scope(group->group) > IPV6_SCOPE_LINK_LOCAL) {
2070+
if (addr_ipv6_multicast_scope(group->group) >= IPV6_SCOPE_LINK_LOCAL) {
20622071
interface->thread_info->childUpdateReqTimer = 1;
20632072
}
20642073
} else {

source/6LoWPAN/Thread/thread_router_bootstrap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,8 +1415,8 @@ static void thread_address_registration_tlv_parse(uint8_t *ptr, uint16_t data_le
14151415
tr_debug("Register %s", trace_ipv6(ptr));
14161416

14171417
if (addr_is_ipv6_multicast(ptr)) {
1418-
// Register multicast address (higher scope than link-local)
1419-
if (addr_ipv6_multicast_scope(ptr) > IPV6_SCOPE_LINK_LOCAL) {
1418+
// Register multicast address (link-local & higher)
1419+
if (addr_ipv6_multicast_scope(ptr) >= IPV6_SCOPE_LINK_LOCAL) {
14201420
addr_add_group(cur, ptr);
14211421
if (thread_child_mcast_entry_get(cur, ptr, mac64)) {
14221422
tr_debug("Added sleepy multicast registration entry.");

0 commit comments

Comments
 (0)