Skip to content

Commit 37a2fab

Browse files
author
Sathish Kumar Mani
committed
Fixes IPv6 multicast join issue
Problem Statement: During multicast join sequence, InternetSocket::join_multicast_group() calls InternetSocket::modify_multicast_group(). modify_multicast_group() sets up the multicast group address (i.e., mreq.imr_multiaddr) to be joined and the interface address (i.e., mreq.imr_interface) to be used for the multicast join request. The interface address is initialized with the default value, which sets the version of interface address to NSAPI_UNSPEC. This results in LWIP::setsockopt() API to attempt IPv6 multicast join on the IPv4 interface address, hence IPv6 multicast join always fails with the protocol error. Fix: Initialize interface address version based on the multicast address version in LWIP::setsockopt(), before attempting multicast join operation.
1 parent 1798c24 commit 37a2fab

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

features/lwipstack/LWIPStack.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,14 @@ nsapi_error_t LWIP::setsockopt(nsapi_socket_t handle, int level, int optname, co
566566
return NSAPI_ERROR_PARAMETER;
567567
}
568568
} else {
569+
/* Initialize the interface address type based on the multicast address version */
570+
if (imr->imr_multiaddr.version == NSAPI_IPv4) {
571+
ip_addr_set_zero_ip4(&if_addr);
572+
} else if (imr->imr_multiaddr.version == NSAPI_IPv6) {
573+
ip_addr_set_zero_ip6(&if_addr);
574+
} else {
575+
return NSAPI_ERROR_PARAMETER;
576+
}
569577
ip_addr_set_any(IP_IS_V6(&if_addr), &if_addr);
570578
}
571579

0 commit comments

Comments
 (0)