net: IP_MULTICAST_IF setsockopt now recognizes struct mreq
Subsystems (3)
PATCH 1/1 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 <[email protected]>
--- net/ipv4/ip_sockglue.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
net/ipv4/ip_sockglue.c +9 -4
@@ -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) {
Signature · 1 line
1.7.9.1
David Miller
maintainerFrom: Jiri Pirko <[email protected]>
Date: Fri, 4 May 2012 10:37:45 +0200
Quoted 5 lines
Until now, struct mreq has not been recognized and it was worked with as with struct
in_addr. That meansimr_multiaddrwas copied toimr_address. So do recognize struct mreq here and copy that correctly.Signed-off-by Jiri Pirko <[email protected]>
Fair enough, applied.