Verify checksum of IP header and TCP header

Guibin(Bill) Tian gbtian at gmail.com
Tue Feb 11 16:22:14 EST 2014


oh, thank you so much!!!


On Tue, Feb 11, 2014 at 4:19 PM, John de la Garza <john at jjdev.com> wrote:

> On Tue, Feb 11, 2014 at 03:03:42PM -0500, Guibin(Bill) Tian wrote:
> > Hi,
> > I am looking for the code in linux kernel that verifies the checksum of
> TCP
> > header and IP header for inbound packet. The packet supposes to be
> dropped
> > if the checksum doesn't match.
>
> Here is some code that checks the TCP checksum.
>
> /*
>  * Calculate(/check) TCP checksum
>  */
> static inline __sum16 tcp_v4_check(int len, __be32 saddr,
>                                    __be32 daddr, __wsum base)
> {
>         return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
> }
>
> from: include/net/tcp.h
>
>
> also, try searching for csum_error in net/ipv4/tcp_ipv4.c
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140211/34d1a482/attachment.html 


More information about the Kernelnewbies mailing list