From: Xiaotian Feng <dfeng@redhat.com>
To: davem@davemloft.net, kaber@trash.net, yoshfuji@linux-ipv6.org,
jmorris@namei.org, pekkas@netcore.fi, kuznet@ms2.inr.ac.ru
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Xiaotian Feng <dfeng@redhat.com>,
Marc Milgram <mmilgram@redhat.com>
Subject: [PATCH 2/2] ipv4: make do_ip_setsockopt for IP_MULTICAST_IF support ip_mreq struct
Date: Thu, 17 Sep 2009 13:20:11 +0800 [thread overview]
Message-ID: <1253164811-15820-1-git-send-email-dfeng@redhat.com> (raw)
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
next reply other threads:[~2009-09-17 5:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-17 5:20 Xiaotian Feng [this message]
2009-09-17 9:16 ` [PATCH 2/2] ipv4: make do_ip_setsockopt for IP_MULTICAST_IF support ip_mreq struct Shan Wei
2009-09-17 9:19 ` Danny Feng
2009-09-17 9:36 ` Alexey Kuznetsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1253164811-15820-1-git-send-email-dfeng@redhat.com \
--to=dfeng@redhat.com \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=mmilgram@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pekkas@netcore.fi \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).