Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a084ddb authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller
Browse files

net: IP_MULTICAST_IF setsockopt now recognizes struct mreq



Until now, struct mreq has not been recognized and it was worked with
as with struct in_addr. That means imr_multiaddr was copied to
imr_address. So do recognize struct mreq here and copy that correctly.

Signed-off-by: default avatarJiri Pirko <jpirko@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 416912a1
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -673,11 +673,16 @@ static int do_ip_setsockopt(struct sock *sk, int level,
				break;
		} else {
			memset(&mreq, 0, sizeof(mreq));
			if (optlen >= sizeof(struct in_addr) &&
			    copy_from_user(&mreq.imr_address, optval,
			if (optlen >= sizeof(struct ip_mreq)) {
				if (copy_from_user(&mreq, optval,
						   sizeof(struct ip_mreq)))
					break;
			} else if (optlen >= sizeof(struct in_addr)) {
				if (copy_from_user(&mreq.imr_address, optval,
						   sizeof(struct in_addr)))
					break;
			}
		}

		if (!mreq.imr_ifindex) {
			if (mreq.imr_address.s_addr == htonl(INADDR_ANY)) {