From: Yang Hongyang <yanghy@cn•fujitsu.com>
To: Herbert Xu <herbert@gondor•apana.org.au>, davem@davemloft•net
Cc: Shan Wei <shanwei@cn•fujitsu.com>,
Wei Yongjun <yjwei@cn•fujitsu.com>,
netdev@vger•kernel.org
Subject: Re: [PATCHv2]IPv6:remove duplicate check when setsockopt with IPV6_PKTINFO option
Date: Thu, 15 Jan 2009 08:50:11 +0800 [thread overview]
Message-ID: <496E8843.8000906@cn.fujitsu.com> (raw)
In-Reply-To: <496DA1D1.2050005@cn.fujitsu.com>
Actually the condition (optlen == 0) is included in (optlen < sizeof(struct in6_pktinfo)),
so we do not need to check it separately.
We don't need to check (optval==NULL) either,because copy_from_user() will do the job.
Signed-off-by: Yang Hongyang<yanghy@cn•fujitsu.com>
---
net/ipv6/ipv6_sockglue.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 40f3246..1c203b6 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -399,9 +399,7 @@ sticky_done:
{
struct in6_pktinfo pkt;
- if (optlen == 0)
- goto e_inval;
- else if (optlen < sizeof(struct in6_pktinfo) || optval == NULL)
+ if (optlen < sizeof(struct in6_pktinfo))
goto e_inval;
if (copy_from_user(&pkt, optval, sizeof(struct in6_pktinfo))) {
--
1.6.0.3
Shan Wei wrote:
> Yang Hongyang said:
>> Wei Yongjun wrote:
>>> Yang Hongyang wrote:
>>>> Herbert Xu wrote:
>>>>
>>>>> Yang Hongyang <yanghy@cn•fujitsu.com> wrote:
>>>>>
>>>>>> Actually the condition (optlen == 0) is included in (optlen <
>>>>>> sizeof(struct in6_pktinfo)),
>>>>>> so we do not need to check it separately.
>>>>>>
>>>>> You don't need to check optval == NULL either since that's the
>>>>> job of copy_from_user.
>>>>>
>>>> If optval==NULL, what we should return?EINVAL or EFAULT?
>>>> If it is EINVAL,then we should check it .otherwise it's the job of
>>>> copy_from_user
>>>>
>>> I think if optval==NULL, the in6_pktinfo which is set should be remove.
>>> So, you should handle optval==NULL. Not just return error.
>> There's no RFC defines the behavior above,but:
>> RFC3542 said The application can remove any sticky Routing header or sticky
>> Destination options header or sticky Hop-by-Hop options header by calling
>> setsockopt() with a zero option length.
>>
>> So,do we need to allow remove any sticky pktinfo option by calling
>> setsockopt() with a zero option length?
>>
>
> Can remove the option using seting in6_pktinfo struct wiht
> ipi6_ifindex=0,ipi6_ifindex=IN6ADDR_ANY_INIT.
>
> If no RFC definition, not to reset with optlen=0,
> for example IPV6_TCLASS, PV6_2292DSTOPTS.
>
--
Regards
Yang Hongyang
next prev parent reply other threads:[~2009-01-15 0:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-13 7:35 [PATCH]IPv6:remove duplicate check of optlen when setsockopt with IPV6_PKTINFO option Yang Hongyang
2009-01-14 3:47 ` Herbert Xu
2009-01-14 3:54 ` Yang Hongyang
2009-01-14 4:07 ` Wei Yongjun
2009-01-14 5:27 ` Yang Hongyang
2009-01-14 8:26 ` Shan Wei
2009-01-15 0:50 ` Yang Hongyang [this message]
2009-01-14 4:48 ` Herbert Xu
2009-01-15 5:02 ` David Miller
2009-01-15 5:04 ` Herbert Xu
2009-01-15 5:06 ` Herbert Xu
2009-01-15 5:25 ` Yang Hongyang
2009-01-15 5:43 ` David Miller
2009-01-15 5:34 ` Yang Hongyang
2009-01-15 5:37 ` Herbert Xu
2009-01-15 5:45 ` David Miller
2009-01-15 5:48 ` Herbert Xu
2009-01-15 10:07 ` Yang Hongyang
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=496E8843.8000906@cn.fujitsu.com \
--to=yanghy@cn$(echo .)fujitsu.com \
--cc=davem@davemloft$(echo .)net \
--cc=herbert@gondor$(echo .)apana.org.au \
--cc=netdev@vger$(echo .)kernel.org \
--cc=shanwei@cn$(echo .)fujitsu.com \
--cc=yjwei@cn$(echo .)fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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