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

From: Wang Chen <[email-masked]>
Date: Fri, 16 Nov 2007 11:18:16 +0800

David Miller said the following on 2007-11-16 10:54:
> From: Wang Chen <[email-masked]>
> Date: Fri, 16 Nov 2007 10:46:26 +0800
> 
>> 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]>
> 
> It checks the checksum in udp_recvmsg() and udp_poll().
> 

Actually, I tested and found this issue.
I sent 50 udp packets, which have wrong checksum, to my
machine.
Before the patch being applied, /proc/net/snmp's udp
InDatagrams increased, and InErrors didn't increase.
After the patch being applied, InErrors increased correctly
and InDatagrams stayed unchanging.

So, I think the checksum in udp_queue_rcv_skb() actually does
the work, not that in udp_recvmsg() and udp_poll().

If I am wrong, please point out.

> Please do not fix bugs via code inspection without writing
> test programs to validate whether there is really a "bug"
> here or not.
> 

This is a bug from test, not from code inspection.