netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BK-PATCH 2.4] IPV6: ensure to evaluate checksum
@ 2004-05-20 10:33 YOSHIFUJI Hideaki / 吉藤英明
  2004-05-20 15:14 ` David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-05-20 10:33 UTC (permalink / raw)
  To: davem; +Cc: netdev, yoshfuji

Hello.

Following changesets fixes checksum for rawv6 sockets.
 - don't receive packets with incorrect checksum

Please pull following csets from <bk://bk.skbuff.net:20426>.

Thanks in advance.

CHANGESET
---------
ChangeSet@1.1414, 2004-05-20 19:07:49+09:00, yoshfuji@linux-ipv6.org
  [IPV6] ensure to evaluate the checksum for sockets with the IPV6_CHECKSUM option.

diff -Nru a/net/ipv6/raw.c b/net/ipv6/raw.c
--- a/net/ipv6/raw.c	Thu May 20 19:08:48 2004
+++ b/net/ipv6/raw.c	Thu May 20 19:08:48 2004
@@ -279,8 +279,11 @@
 
 static inline int rawv6_rcv_skb(struct sock * sk, struct sk_buff * skb)
 {
+	if ((sk->tp_pinfo.tp_raw.checksum
 #if defined(CONFIG_FILTER)
-	if (sk->filter && skb->ip_summed != CHECKSUM_UNNECESSARY) {
+	    || sk->filter 
+#endif
+	    ) && skb->ip_summed != CHECKSUM_UNNECESSARY) {
 		if ((unsigned short)csum_fold(skb_checksum(skb, 0, skb->len, skb->csum))) {
 			IP6_INC_STATS_BH(Ip6InDiscards);
 			kfree_skb(skb);
@@ -288,7 +291,6 @@
 		}
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
 	}
-#endif
 	/* Charge it to the socket. */
 	if (sock_queue_rcv_skb(sk,skb)<0) {
 		IP6_INC_STATS_BH(Ip6InDiscards);

-- 
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

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

* Re: [BK-PATCH 2.4] IPV6: ensure to evaluate checksum
  2004-05-20 10:33 [BK-PATCH 2.4] IPV6: ensure to evaluate checksum YOSHIFUJI Hideaki / 吉藤英明
@ 2004-05-20 15:14 ` David S. Miller
  2004-05-20 15:55   ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 4+ messages in thread
From: David S. Miller @ 2004-05-20 15:14 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev, yoshfuji

On Thu, 20 May 2004 19:33:12 +0900 (JST)
YOSHIFUJI Hideaki / ^[$B5HF#1QL@^[(B <yoshfuji@linux-ipv6.org> wrote:

> Following changesets fixes checksum for rawv6 sockets.
>  - don't receive packets with incorrect checksum

I notice now how ipv6 RAW behaves differently here
than ipv4 RAW.  In ipv4, packet is accepted regardless
of checksum correctness.

I can see both advantages and disadvantages of this
behavior.  But what I want to ask is if ipv6 RAW is
being different on purpose, for example does the ipv6
advanced API specify this perhaps?

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

* Re: [BK-PATCH 2.4] IPV6: ensure to evaluate checksum
  2004-05-20 15:14 ` David S. Miller
@ 2004-05-20 15:55   ` YOSHIFUJI Hideaki / 吉藤英明
  2004-05-20 16:32     ` David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-05-20 15:55 UTC (permalink / raw)
  To: davem; +Cc: netdev, yoshfuji

In article <20040520081421.594c5447.davem@redhat.com> (at Thu, 20 May 2004 08:14:21 -0700), "David S. Miller" <davem@redhat.com> says:

> I can see both advantages and disadvantages of this
> behavior.  But what I want to ask is if ipv6 RAW is
> being different on purpose, for example does the ipv6
> advanced API specify this perhaps?

Yes. RFC3542 (Advanced Sockets Application Program Interface (API) for 
IPv6) says:
|   For other raw IPv6 sockets (that is, for raw IPv6 sockets created
|   with a third argument other than IPPROTO_ICMPV6), the application
|   must set the new IPV6_CHECKSUM socket option to have the kernel (1)
|   compute and store a checksum for output, and (2) verify the received
|   checksum on input, discarding the packet if the checksum is in error.

--yoshfuji

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

* Re: [BK-PATCH 2.4] IPV6: ensure to evaluate checksum
  2004-05-20 15:55   ` YOSHIFUJI Hideaki / 吉藤英明
@ 2004-05-20 16:32     ` David S. Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2004-05-20 16:32 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev

On Fri, 21 May 2004 00:55:50 +0900 (JST)
YOSHIFUJI Hideaki / ^[$B5HF#1QL@^[(B <yoshfuji@linux-ipv6.org> wrote:

> In article <20040520081421.594c5447.davem@redhat.com> (at Thu, 20 May 2004 08:14:21 -0700), "David S. Miller" <davem@redhat.com> says:
> 
> > I can see both advantages and disadvantages of this
> > behavior.  But what I want to ask is if ipv6 RAW is
> > being different on purpose, for example does the ipv6
> > advanced API specify this perhaps?
> 
> Yes.

Great, I've pulled your 2.4.x raw ipv6 changes into my tree.

Thanks a lot.

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

end of thread, other threads:[~2004-05-20 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-20 10:33 [BK-PATCH 2.4] IPV6: ensure to evaluate checksum YOSHIFUJI Hideaki / 吉藤英明
2004-05-20 15:14 ` David S. Miller
2004-05-20 15:55   ` YOSHIFUJI Hideaki / 吉藤英明
2004-05-20 16:32     ` David S. 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).