* [RFC][PATCH 3/3] IPv4:Check IP_MULTICAST_LOOP option value
@ 2008-06-10 7:51 Shan Wei
2008-06-10 8:15 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 1 reply; 6+ messages in thread
From: Shan Wei @ 2008-06-10 7:51 UTC (permalink / raw)
To: davem; +Cc: netdev
The IP_MULTICAST_LOOP option can only be set with o or 1. When
other valuse are set, the kernel should return an error of EINVAL.
In addition, the option should not be uesd by SOCK_STREAM type,
same as IP_MULTICAST_IF, IP_MULTICAST_TTL.
But the kernel doesn't check them.
Signed-off-by: Shan Wei<shanwei@cn.fujitsu.com>
---
net/ipv4/ip_sockglue.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index e0514e8..82196a5 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -558,8 +558,12 @@ static int do_ip_setsockopt(struct sock *sk, int level,
inet->mc_ttl = val;
break;
case IP_MULTICAST_LOOP:
+ if (sk->sk_type == SOCK_STREAM)
+ goto e_inval;
if (optlen<1)
goto e_inval;
+ if (val < 0 || val > 1)
+ goto e_inval;
inet->mc_loop = !!val;
break;
case IP_MULTICAST_IF:
--
1.5.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [RFC][PATCH 3/3] IPv4:Check IP_MULTICAST_LOOP option value
2008-06-10 7:51 [RFC][PATCH 3/3] IPv4:Check IP_MULTICAST_LOOP option value Shan Wei
@ 2008-06-10 8:15 ` YOSHIFUJI Hideaki / 吉藤英明
2008-06-10 8:32 ` YOSHIFUJI Hideaki / 吉藤英明
2008-06-10 8:32 ` Shan Wei
0 siblings, 2 replies; 6+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2008-06-10 8:15 UTC (permalink / raw)
To: shanwei; +Cc: davem, netdev, yoshfuji
In article <484E3293.8000507@cn.fujitsu.com> (at Tue, 10 Jun 2008 15:51:47 +0800), Shan Wei <shanwei@cn.fujitsu.com> says:
> The IP_MULTICAST_LOOP option can only be set with o or 1. When
> other valuse are set, the kernel should return an error of EINVAL.
>
> In addition, the option should not be uesd by SOCK_STREAM type,
> same as IP_MULTICAST_IF, IP_MULTICAST_TTL.
>
> But the kernel doesn't check them.
Is there any standard reference about this?
--yoshfuji
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC][PATCH 3/3] IPv4:Check IP_MULTICAST_LOOP option value
2008-06-10 8:15 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2008-06-10 8:32 ` YOSHIFUJI Hideaki / 吉藤英明
2008-06-10 8:32 ` Shan Wei
1 sibling, 0 replies; 6+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2008-06-10 8:32 UTC (permalink / raw)
To: shanwei; +Cc: davem, netdev, yoshfuji
In article <20080610.171527.86317043.yoshfuji@linux-ipv6.org> (at Tue, 10 Jun 2008 17:15:27 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> says:
> In article <484E3293.8000507@cn.fujitsu.com> (at Tue, 10 Jun 2008 15:51:47 +0800), Shan Wei <shanwei@cn.fujitsu.com> says:
>
> > The IP_MULTICAST_LOOP option can only be set with o or 1. When
> > other valuse are set, the kernel should return an error of EINVAL.
> >
> > In addition, the option should not be uesd by SOCK_STREAM type,
> > same as IP_MULTICAST_IF, IP_MULTICAST_TTL.
> >
> > But the kernel doesn't check them.
>
> Is there any standard reference about this?
And actually I diagree to check "val."
(For example, FreeBSD does not check this.)
--yoshfuji
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC][PATCH 3/3] IPv4:Check IP_MULTICAST_LOOP option value
2008-06-10 8:15 ` YOSHIFUJI Hideaki / 吉藤英明
2008-06-10 8:32 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2008-06-10 8:32 ` Shan Wei
2008-06-10 8:42 ` YOSHIFUJI Hideaki / 吉藤英明
1 sibling, 1 reply; 6+ messages in thread
From: Shan Wei @ 2008-06-10 8:32 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / 吉藤英明; +Cc: davem, netdev
YOSHIFUJI Hideaki / 吉藤英明 写道:
> In article <484E3293.8000507@cn.fujitsu.com> (at Tue, 10 Jun 2008 15:51:47 +0800), Shan Wei <shanwei@cn.fujitsu.com> says:
>
>> The IP_MULTICAST_LOOP option can only be set with o or 1. When
>> other valuse are set, the kernel should return an error of EINVAL.
>>
>> In addition, the option should not be uesd by SOCK_STREAM type,
>> same as IP_MULTICAST_IF, IP_MULTICAST_TTL.
>>
>> But the kernel doesn't check them.
>
> Is there any standard reference about this?
>
I have not found it.
But, the IP_MULTICAST_LOOP option is same as IPV6_MULTICAST_LOOP.
> --yoshfuji
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC][PATCH 3/3] IPv4:Check IP_MULTICAST_LOOP option value
2008-06-10 8:32 ` Shan Wei
@ 2008-06-10 8:42 ` YOSHIFUJI Hideaki / 吉藤英明
2008-06-10 9:07 ` Shan Wei
0 siblings, 1 reply; 6+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2008-06-10 8:42 UTC (permalink / raw)
To: shanwei; +Cc: davem, netdev, yoshfuji
In article <484E3C0A.1000808@cn.fujitsu.com> (at Tue, 10 Jun 2008 16:32:10 +0800), Shan Wei <shanwei@cn.fujitsu.com> says:
> YOSHIFUJI Hideaki / 吉藤英明 写道:
> > In article <484E3293.8000507@cn.fujitsu.com> (at Tue, 10 Jun 2008 15:51:47 +0800), Shan Wei <shanwei@cn.fujitsu.com> says:
> >
> >> The IP_MULTICAST_LOOP option can only be set with o or 1. When
> >> other valuse are set, the kernel should return an error of EINVAL.
> >>
> >> In addition, the option should not be uesd by SOCK_STREAM type,
> >> same as IP_MULTICAST_IF, IP_MULTICAST_TTL.
> >>
> >> But the kernel doesn't check them.
> >
> > Is there any standard reference about this?
> >
> I have not found it.
> But, the IP_MULTICAST_LOOP option is same as IPV6_MULTICAST_LOOP.
I disagree.
We follow what traditional BSDs do, and they do not check if the
value is 0 or 1 for IP_MULTICAST_LOOP.
On the other hand, they do for IPV6_MULTICAST_LOOP.
--yoshfuji
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC][PATCH 3/3] IPv4:Check IP_MULTICAST_LOOP option value
2008-06-10 8:42 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2008-06-10 9:07 ` Shan Wei
0 siblings, 0 replies; 6+ messages in thread
From: Shan Wei @ 2008-06-10 9:07 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / 吉藤英明; +Cc: davem, netdev
YOSHIFUJI Hideaki / 吉藤英明 写道:
> In article <484E3C0A.1000808@cn.fujitsu.com> (at Tue, 10 Jun 2008 16:32:10 +0800), Shan Wei <shanwei@cn.fujitsu.com> says:
>
>> YOSHIFUJI Hideaki / 吉藤英明 写道:
>>> In article <484E3293.8000507@cn.fujitsu.com> (at Tue, 10 Jun 2008 15:51:47 +0800), Shan Wei <shanwei@cn.fujitsu.com> says:
>>>
>>>> The IP_MULTICAST_LOOP option can only be set with o or 1. When
>>>> other valuse are set, the kernel should return an error of EINVAL.
>>>>
>>>> In addition, the option should not be uesd by SOCK_STREAM type,
>>>> same as IP_MULTICAST_IF, IP_MULTICAST_TTL.
>>>>
>>>> But the kernel doesn't check them.
>>> Is there any standard reference about this?
>>>
>> I have not found it.
>> But, the IP_MULTICAST_LOOP option is same as IPV6_MULTICAST_LOOP.
>
> I disagree.
> We follow what traditional BSDs do, and they do not check if the
> value is 0 or 1 for IP_MULTICAST_LOOP.
> On the other hand, they do for IPV6_MULTICAST_LOOP.
>
Ok.
no need to check "val".
The option should not be uesd by SOCK_STREAM type.
how do you think of ?
> --yoshfuji
>
>
>
--
Regards
単 衛
--------------------------------------------------
Shan Wei
Development Dept.I
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
8/F., Civil Defense Building, No.189 Guangzhou Road,
Nanjing, 210029, China
TEL:+86+25-86630566-836
FUJITSU INTERNAL:79955-836
FAX:+86+25-83317685
Mail:shanwei@cn.fujitsu.com
--------------------------------------------------
This communication is for use by the intended recipient(s) only and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not an intended recipient of this communication, you are hereby notified that any dissemination, distribution or copying hereof is strictly prohibited. If you have received this communication in error, please notify me by reply e-mail, permanently delete this communication from your system, and destroy any hard copies you may have printed.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-06-10 9:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-10 7:51 [RFC][PATCH 3/3] IPv4:Check IP_MULTICAST_LOOP option value Shan Wei
2008-06-10 8:15 ` YOSHIFUJI Hideaki / 吉藤英明
2008-06-10 8:32 ` YOSHIFUJI Hideaki / 吉藤英明
2008-06-10 8:32 ` Shan Wei
2008-06-10 8:42 ` YOSHIFUJI Hideaki / 吉藤英明
2008-06-10 9:07 ` Shan Wei
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).