diff options
author | Jiri Pirko <jpirko@redhat.com> | 2012-05-04 00:37:45 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-08 05:03:22 +0200 |
commit | 3a084ddb4bf299a6e898a9a07c89f3917f0713f7 (patch) | |
tree | f938915de277b2b9b52ce6dc1308f18d0d083bcd /net/ipv4/ip_sockglue.c | |
parent | netdev/of/phy: Add MDIO bus multiplexer driven by GPIO lines. (diff) | |
download | linux-3a084ddb4bf299a6e898a9a07c89f3917f0713f7.tar.xz linux-3a084ddb4bf299a6e898a9a07c89f3917f0713f7.zip |
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: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_sockglue.c')
-rw-r--r-- | net/ipv4/ip_sockglue.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 51c6c672c8aa..0d11f234d615 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -673,10 +673,15 @@ 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, - sizeof(struct in_addr))) - break; + 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) { |