netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shan Wei <shanwei@cn.fujitsu.com>
To: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH] IPv6: Fail with appropriate error code when sending RH0
Date: Fri, 27 Jun 2008 12:28:52 +0800	[thread overview]
Message-ID: <48646C84.1000207@cn.fujitsu.com> (raw)

When sending IPv6 packet with RH0(Type 0 Routing Header),
return EINVAL instead of EPERM.

Signed-off-by: Shan Wei<shanwei@cn.fujitsu.com>
---
 net/ipv6/ipv6_sockglue.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 86e28a7..0101d4f 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -377,12 +377,15 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
 				break;
 #endif
 			default:
+				retv = -EINVAL;
 				goto sticky_done;
 			}
 
 			if ((rthdr->hdrlen & 1) ||
-			    (rthdr->hdrlen >> 1) != rthdr->segments_left)
+			    (rthdr->hdrlen >> 1) != rthdr->segments_left) {
+				retv = -EINVAL;
 				goto sticky_done;
+			}
 		}
 
 		retv = 0;
-- 
1.5.4.4 


             reply	other threads:[~2008-06-27  5:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-27  4:28 Shan Wei [this message]
2008-07-19  1:28 ` [PATCH] IPv6: Fail with appropriate error code when sending RH0 Shan Wei

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=48646C84.1000207@cn.fujitsu.com \
    --to=shanwei@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --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).