netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix UDP filter condition when do checksum
@ 2006-07-31 10:33 Wei Yongjun
  2006-07-31 11:36 ` Herbert Xu
  2006-07-31 12:02 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2006-07-31 10:33 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

In udp_queue_rcv_skb(), checksum condition is error. When UDP filter is
set, checksum is be done, but if UDP filter is not set, checksum will
not be done. So I think this is a BUG. Following is my patch:

--- a/net/ipv4/udp.c	2006-07-31 09:33:45.392479344 -0400
+++ b/net/ipv4/udp.c	2006-07-31 17:10:41.271632200 -0400
@@ -1018,7 +1018,7 @@ static int udp_queue_rcv_skb(struct sock
 		/* FALLTHROUGH -- it's a UDP Packet */
 	}
 
-	if (sk->sk_filter && skb->ip_summed != CHECKSUM_UNNECESSARY) {
+	if (!sk->sk_filter && skb->ip_summed != CHECKSUM_UNNECESSARY) {
 		if (__udp_checksum_complete(skb)) {
 			UDP_INC_STATS_BH(UDP_MIB_INERRORS);
 			kfree_skb(skb);


Signed-off-by: Wei Yongjun <yjwei@nanjing-fnst.com>\x11
`ß'	\x19



'	c link




>



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

* Re: [PATCH] Fix UDP filter condition when do checksum
  2006-07-31 10:33 [PATCH] Fix UDP filter condition when do checksum Wei Yongjun
@ 2006-07-31 11:36 ` Herbert Xu
  2006-07-31 12:02 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2006-07-31 11:36 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: netdev, davem

Wei Yongjun <yjwei@nanjing-fnst.com> wrote:
> In udp_queue_rcv_skb(), checksum condition is error. When UDP filter is
> set, checksum is be done, but if UDP filter is not set, checksum will
> not be done. So I think this is a BUG. Following is my patch:
> 
> --- a/net/ipv4/udp.c    2006-07-31 09:33:45.392479344 -0400
> +++ b/net/ipv4/udp.c    2006-07-31 17:10:41.271632200 -0400
> @@ -1018,7 +1018,7 @@ static int udp_queue_rcv_skb(struct sock
>                /* FALLTHROUGH -- it's a UDP Packet */
>        }
> 
> -       if (sk->sk_filter && skb->ip_summed != CHECKSUM_UNNECESSARY) {
> +       if (!sk->sk_filter && skb->ip_summed != CHECKSUM_UNNECESSARY) {
>                if (__udp_checksum_complete(skb)) {
>                        UDP_INC_STATS_BH(UDP_MIB_INERRORS);
>                        kfree_skb(skb);

For the record, this isn't correct since the only reason we're computing
a checksum here rather than recv(2) time is if we have a filter attached.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [PATCH] Fix UDP filter condition when do checksum
  2006-07-31 10:33 [PATCH] Fix UDP filter condition when do checksum Wei Yongjun
  2006-07-31 11:36 ` Herbert Xu
@ 2006-07-31 12:02 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2006-07-31 12:02 UTC (permalink / raw)
  To: yjwei; +Cc: netdev

From: Wei Yongjun <yjwei@nanjing-fnst.com>
Date: Mon, 31 Jul 2006 06:33:42 -0400

> In udp_queue_rcv_skb(), checksum condition is error. When UDP filter is
> set, checksum is be done, but if UDP filter is not set, checksum will
> not be done. So I think this is a BUG.

It is not a bug, we defer the checksum, when we can, to sys_recvmsg()
where we can combine the copy into userspace and the checksum
calculation into one operation.

We cannot do this deferral when there is a filter attached, and that
is why the check is the way it is.

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

end of thread, other threads:[~2006-07-31 12:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31 10:33 [PATCH] Fix UDP filter condition when do checksum Wei Yongjun
2006-07-31 11:36 ` Herbert Xu
2006-07-31 12:02 ` 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).