Skip to content

Commit 5b791a4

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 5b791a4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

features/lwipstack/LWIPStack.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,14 @@ nsapi_error_t LWIP::setsockopt(nsapi_socket_t handle, int level, int optname, co
560560
return NSAPI_ERROR_PARAMETER;
561561
}
562562

563-
/* Convert the interface address, or make sure it's the correct sort of "any" */
564563
if (imr->imr_interface.version != NSAPI_UNSPEC) {
564+
/* Convert the interface address */
565565
if (!convert_mbed_addr_to_lwip(&if_addr, &imr->imr_interface)) {
566566
return NSAPI_ERROR_PARAMETER;
567567
}
568568
} else {
569-
ip_addr_set_any(IP_IS_V6(&if_addr), &if_addr);
569+
/* Set interface address to "any", matching the group address type */
570+
ip_addr_set_any(IP_IS_V6(&multi_addr), &if_addr);
570571
}
571572

572573
igmp_err = ERR_USE; // Maps to NSAPI_ERROR_UNSUPPORTED

0 commit comments

Comments
 (0)