Subject: [PATCH 1/2] [IPV4] UDP: Always checksum even if without socket filter

From: Wang Chen <[email-masked]>
Date: Fri, 16 Nov 2007 10:46:26 +0800

Dave, 

The current kernel doesn't verify the udp checksum if user doesn't set a
socket filter.It's fine for LAN. But for WAN, it's not a good option.
Shall we fix it? Below is the patch to make udp checksum be always 
available.

[IPV4] UDP: Always checksum even if without socket filter
Make udp checksum be always available even if without socket filter.

Signed-off-by: Wang Chen <[email-masked]>
---
 udp.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

--- linux-2.6.24-rc2.org/net/ipv4/udp.c	2007-11-09 16:37:57.000000000 +0800
+++ linux-2.6.24-rc2/net/ipv4/udp.c	2007-11-16 10:10:35.000000000 +0800
@@ -1011,10 +1011,8 @@ int udp_queue_rcv_skb(struct sock * sk, 
 		}
	}

-	if (sk->sk_filter) {
-		if (udp_lib_checksum_complete(skb))
-			goto drop;
-	}
+	if (udp_lib_checksum_complete(skb))
+		goto drop;

	if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) {
		/* Note that an ENOMEM error is charged twice */