Commit d21eb85b authored by Wez's avatar Wez Committed by Commit Bot

Migrate UDPSocket::LeaveGroup IPv4 case to include interface Id.

LeaveGroup() previously used ip_mreq, which does not allow the interface
to which the operation applies to be specified by Id. Since no interface
IP address is specified in the call, it fails if the network stack
expects the interface to be explicitly specified (i.e. under Fuchsia).

Bug: 864450
Change-Id: Idff67518387d80c6c91f96bfd774db4a11a310f8
Reviewed-on: https://chromium-review.googlesource.com/1152903Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579212}
parent a2b7053e
......@@ -1023,8 +1023,9 @@ int UDPSocketPosix::LeaveGroup(const IPAddress& group_address) const {
case IPAddress::kIPv4AddressSize: {
if (addr_family_ != AF_INET)
return ERR_ADDRESS_INVALID;
ip_mreq mreq = {};
mreq.imr_interface.s_addr = INADDR_ANY;
ip_mreqn mreq = {};
mreq.imr_ifindex = multicast_interface_;
mreq.imr_address.s_addr = INADDR_ANY;
memcpy(&mreq.imr_multiaddr, group_address.bytes().data(),
IPAddress::kIPv4AddressSize);
int rv = setsockopt(socket_, IPPROTO_IP, IP_DROP_MEMBERSHIP,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment