From: rahul b jain cs student <rbj2@oak.njit.edu>
To: linux-kernel@vger.kernel.org
Subject: Re: Question about ip_rcv() function
Date: Wed, 23 Jun 2004 16:22:53 -0400 (EDT) [thread overview]
Message-ID: <Pine.GSO.4.58.0406231615220.7099@chrome.njit.edu> (raw)
In-Reply-To: <20040623115027.11ef0902.davem@redhat.com>
Thanks for your response.
I just want to know if my understanding of how the sk_buff structure is
correct.
When data arrives at the TCP layer it is pointed to by the data pointer
and the TCP header goes in the skb->data-skb->head area. When this packet
is passed to the IP layer, skb->tail-skb->data section will now contain
the TCP header + TCP data and now the IP header will be put in the new
skb->data-skb->head area.
Please let me know if this understanding is correct.
I also wanted to know does psk_may_pull() only check for correct header
length or does it (thought some func calls) strip off the IP header ?
Thanks,
Rahul.
On Wed, 23 Jun 2004, David S. Miller wrote:
> On Wed, 23 Jun 2004 14:45:47 -0400 (EDT)
> rahul b jain cs student <rbj2@oak.njit.edu> wrote:
>
> > can anyone explain what is the difference between the following two pieces
> > of code.
> >
> > 1. if (!pskb_may_pull(skb, sizeof(struct iphdr)))
> > goto inhdr_error;
> >
> > iph = skb->nh.iph;
> >
> > 2. if (!pskb_may_pull(skb, iph->ihl*4))
> > goto inhdr_error;
> >
> > iph = skb->nh.iph;
>
> We can't dereference any of the iphdr fields (such as iph->ihl) until
> we know that at least "sizeof(struct iphdr)" bytes are there first.
>
next prev parent reply other threads:[~2004-06-23 20:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-22 20:48 sk_buff structure rahul b jain cs student
2004-06-22 21:24 ` Jonathan Corbet
2004-06-22 23:03 ` rahul b jain cs student
2004-06-23 18:45 ` Question about ip_rcv() function rahul b jain cs student
2004-06-23 18:50 ` David S. Miller
2004-06-23 20:22 ` rahul b jain cs student [this message]
2004-06-23 20:32 ` David S. Miller
2004-06-23 20:43 ` rahul b jain cs student
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=Pine.GSO.4.58.0406231615220.7099@chrome.njit.edu \
--to=rbj2@oak.njit.edu \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®