Skip to content

Commit

Permalink
Fixes IPv6 multicast join issue
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Sathish Kumar Mani committed Oct 14, 2019
1 parent 1798c24 commit 5b791a4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions features/lwipstack/LWIPStack.cpp
Expand Up @@ -560,13 +560,14 @@ nsapi_error_t LWIP::setsockopt(nsapi_socket_t handle, int level, int optname, co
return NSAPI_ERROR_PARAMETER;
}

/* Convert the interface address, or make sure it's the correct sort of "any" */
if (imr->imr_interface.version != NSAPI_UNSPEC) {
/* Convert the interface address */
if (!convert_mbed_addr_to_lwip(&if_addr, &imr->imr_interface)) {
return NSAPI_ERROR_PARAMETER;
}
} else {
ip_addr_set_any(IP_IS_V6(&if_addr), &if_addr);
/* Set interface address to "any", matching the group address type */
ip_addr_set_any(IP_IS_V6(&multi_addr), &if_addr);
}

igmp_err = ERR_USE; // Maps to NSAPI_ERROR_UNSUPPORTED
Expand Down

0 comments on commit 5b791a4

Please sign in to comment.