[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <480878CE.5040904@cn.fujitsu.com>
Date: Fri, 18 Apr 2008 18:32:46 +0800
From: Wang Chen <wangchen@...fujitsu.com>
To: YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>,
"David S. Miller" <davem@...emloft.net>,
NETDEV <netdev@...r.kernel.org>
Subject: [PATCH] RAW6: Do not allow set IPV6_CHECKSUM for ICMPv6 socket
As RFC3542 mentions: An attempt to set IPV6_CHECKSUM for an
ICMPv6 socket will fail.
Add a check for that in do_rawv6_setsockopt().
Signed-off-by: Wang Chen <wangchen@...fujitsu.com>
---
net/ipv6/raw.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 0a6fbc1..c4cc1f9 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -994,6 +994,11 @@ static int do_rawv6_setsockopt(struct sock *sk, int level, int optname,
switch (optname) {
case IPV6_CHECKSUM:
+ /* RFC3542: An attempt to set IPV6_CHECKSUM for an
+ * ICMPv6 socket will fail.
+ */
+ if (inet_sk(sk)->num == IPPROTO_ICMPV6)
+ return(-EINVAL);
/* You may get strange result with a positive odd offset;
RFC2292bis agrees with me. */
if (val > 0 && (val&1))
--
1.5.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists