netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] ipv4: make do_ip_setsockopt for IP_MULTICAST_IF support ip_mreq struct
@ 2009-09-17  5:20 Xiaotian Feng
  2009-09-17  9:16 ` Shan Wei
  0 siblings, 1 reply; 4+ messages in thread
From: Xiaotian Feng @ 2009-09-17  5:20 UTC (permalink / raw)
  To: davem, kaber, yoshfuji, jmorris, pekkas, kuznet
  Cc: netdev, linux-kernel, Xiaotian Feng, Marc Milgram

ip_mreq and ip_mreqn is almost the same, and do_ip_setsockopt for IP_MULTICAST_IF
part supported ip_mreqn struct. This patch adds support for ip_mreq struct.

Signed-off-by: Marc Milgram <mmilgram@redhat.com>
Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Patrick McHardy <kaber@trash.net>
Cc: David S. Miller <davem@davemloft.net>
---
 net/ipv4/ip_sockglue.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 5a29dce..1e8d026 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -612,11 +612,16 @@ static int do_ip_setsockopt(struct sock *sk, int level,
 		 */
 
 		err = -EFAULT;
+		memset(&mreq, 0, sizeof(mreq));
+
 		if (optlen >= sizeof(struct ip_mreqn)) {
 			if (copy_from_user(&mreq, optval, sizeof(mreq)))
 				break;
+		} else if (optlen >= sizeof(struct ip_mreq)) {
+			if (copy_from_user(&mreq, optval,
+					   sizeof(struct ip_mreq)))
+				break;
 		} else if (optlen >= sizeof(struct in_addr)) {
-			memset(&mreq, 0, sizeof(mreq));
 			if (copy_from_user(&mreq.imr_address, optval,
 					   sizeof(struct in_addr)))
 				break;
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-17 10:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-17  5:20 [PATCH 2/2] ipv4: make do_ip_setsockopt for IP_MULTICAST_IF support ip_mreq struct Xiaotian Feng
2009-09-17  9:16 ` Shan Wei
2009-09-17  9:19   ` Danny Feng
2009-09-17  9:36     ` Alexey Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).