netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RAW6: Do not allow set IPV6_CHECKSUM for ICMPv6 socket
@ 2008-04-18 10:32 Wang Chen
  2008-04-18 11:09 ` David Miller
  0 siblings, 1 reply; 13+ messages in thread
From: Wang Chen @ 2008-04-18 10:32 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki, David S. Miller, NETDEV

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@cn.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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-04-25  4:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-18 10:32 [PATCH] RAW6: Do not allow set IPV6_CHECKSUM for ICMPv6 socket Wang Chen
2008-04-18 11:09 ` David Miller
2008-04-20  7:18   ` Wang Chen
2008-04-20  7:33     ` David Miller
2008-04-20  9:18       ` Wang Chen
2008-04-20  9:38         ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-20  9:37           ` David Miller
     [not found]           ` <dd9c5f130804200342r4bdc938fq4af15c9747ba6e06@mail.gmail.com>
2008-04-24 10:48             ` David Miller
2008-04-24 12:19               ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-24 15:26                 ` Rémi Denis-Courmont
2008-04-25  1:03                   ` Wang Chen
2008-04-25  4:46                     ` David Miller
2008-04-25  4:31                 ` David Miller

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).