All of lore.kernel.org
 help / color / mirror / Atom feed
From: john@jjdev.com (John de la Garza)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Verify checksum of IP header and TCP header
Date: Tue, 11 Feb 2014 13:19:19 -0800	[thread overview]
Message-ID: <20140211211918.GA4872@vega.jjdev.com> (raw)
In-Reply-To: <CALdM3teorONFAMKYseQK4iRkS+-Y=+EGzrLubKTgoxm-Jas5fw@mail.gmail.com>

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

  reply	other threads:[~2014-02-11 21:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2014-02-11 21:22   ` Guibin(Bill) Tian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140211211918.GA4872@vega.jjdev.com \
    --to=john@jjdev.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.