* [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
* Re: [PATCH 2/2] ipv4: make do_ip_setsockopt for IP_MULTICAST_IF support ip_mreq struct
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
0 siblings, 1 reply; 4+ messages in thread
From: Shan Wei @ 2009-09-17 9:16 UTC (permalink / raw)
To: Xiaotian Feng
Cc: davem, kaber, yoshfuji, jmorris, pekkas, kuznet, netdev,
linux-kernel, Marc Milgram
Xiaotian Feng wrote, at 09/17/2009 01:20 PM:
> 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.
>
It's not meaning to support the ip_mreq struct, the imr_multiaddr member
never be used by the IP_MULTICAST_IF.
In addition, using the option normally like this:
struct in_addr interface_addr;
setsockopt (socket, IPPROTO_IP, IP_MULTICAST_IF, &interface_addr, sizeof(interface_addr));
Do your patch suggest using the option like this?
struct ip_mreq mreq;
setsockopt (socket, IPPROTO_IP, IP_MULTICAST_IF, &mreq, sizeof(mreq));
Best Regards
-----
Shan Wei
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ipv4: make do_ip_setsockopt for IP_MULTICAST_IF support ip_mreq struct
2009-09-17 9:16 ` Shan Wei
@ 2009-09-17 9:19 ` Danny Feng
2009-09-17 9:36 ` Alexey Kuznetsov
0 siblings, 1 reply; 4+ messages in thread
From: Danny Feng @ 2009-09-17 9:19 UTC (permalink / raw)
To: Shan Wei
Cc: davem, kaber, yoshfuji, jmorris, pekkas, kuznet, netdev,
linux-kernel, Marc Milgram
On 09/17/2009 05:16 PM, Shan Wei wrote:
> Xiaotian Feng wrote, at 09/17/2009 01:20 PM:
>> 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.
>>
>
> It's not meaning to support the ip_mreq struct, the imr_multiaddr member
> never be used by the IP_MULTICAST_IF.
>
> In addition, using the option normally like this:
> struct in_addr interface_addr;
> setsockopt (socket, IPPROTO_IP, IP_MULTICAST_IF,&interface_addr, sizeof(interface_addr));
>
> Do your patch suggest using the option like this?
> struct ip_mreq mreq;
> setsockopt (socket, IPPROTO_IP, IP_MULTICAST_IF,&mreq, sizeof(mreq));
>
In fact, current implemetation supports:
struct ip_mreqn mreqn;
setsockopt(socket, IPPROTO_IP, IP_MULTICAST_IF, &mreqn, sizeof(mreqn));
Then why not support mreq?
>
> Best Regards
> -----
> Shan Wei
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ipv4: make do_ip_setsockopt for IP_MULTICAST_IF support ip_mreq struct
2009-09-17 9:19 ` Danny Feng
@ 2009-09-17 9:36 ` Alexey Kuznetsov
0 siblings, 0 replies; 4+ messages in thread
From: Alexey Kuznetsov @ 2009-09-17 9:36 UTC (permalink / raw)
To: Danny Feng
Cc: Shan Wei, davem, kaber, yoshfuji, jmorris, pekkas, netdev,
linux-kernel, Marc Milgram
Hello!
On Thu, Sep 17, 2009 at 05:19:16PM +0800, Danny Feng wrote:
> In fact, current implemetation supports:
>
> struct ip_mreqn mreqn;
> setsockopt(socket, IPPROTO_IP, IP_MULTICAST_IF, &mreqn, sizeof(mreqn));
>
> Then why not support mreq?
Because support of ip_mreqn makes sense (it user interface index)
and support of ip_mreq, which does not contain interface index,
does not. "Polymorphic" IP_MULTICAST_IF was a stupid mistake (mine),
which should not grow like a tumor.
Ack to patch #1, nack to #2.
Alexey
^ permalink raw reply [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).