All of lore.kernel.org
 help / color / mirror / Atom feed
* Verify checksum of IP header and TCP header
@ 2014-02-11 20:03 Guibin(Bill) Tian
  2014-02-11 21:19 ` John de la Garza
  0 siblings, 1 reply; 3+ messages in thread
From: Guibin(Bill) Tian @ 2014-02-11 20:03 UTC (permalink / raw)
  To: kernelnewbies

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.

I tried tcp_input.c and ip_input.c, also with global search. But I couldn't
find any code that does this job. Can anyone tell me where is the code?
 Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140211/206ea6f2/attachment.html 

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

* Verify checksum of IP header and TCP header
  2014-02-11 20:03 Verify checksum of IP header and TCP header Guibin(Bill) Tian
@ 2014-02-11 21:19 ` John de la Garza
  2014-02-11 21:22   ` Guibin(Bill) Tian
  0 siblings, 1 reply; 3+ messages in thread
From: John de la Garza @ 2014-02-11 21:19 UTC (permalink / raw)
  To: kernelnewbies

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

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

* Verify checksum of IP header and TCP header
  2014-02-11 21:19 ` John de la Garza
@ 2014-02-11 21:22   ` Guibin(Bill) Tian
  0 siblings, 0 replies; 3+ messages in thread
From: Guibin(Bill) Tian @ 2014-02-11 21:22 UTC (permalink / raw)
  To: kernelnewbies

oh, thank you so much!!!


On Tue, Feb 11, 2014 at 4:19 PM, John de la Garza <john@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 

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

end of thread, other threads:[~2014-02-11 21:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-11 20:03 Verify checksum of IP header and TCP header Guibin(Bill) Tian
2014-02-11 21:19 ` John de la Garza
2014-02-11 21:22   ` Guibin(Bill) Tian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.