Re: questions on ip_input.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 






hi,

  sizeof(struct iphdr) can be different from iph->ihl*4, one difference is
this

HTH
Amit




"bunty " <bunty123_4@rediffmail.com>@nl.linux.org on 06/03/2004 08:38:04 PM

Please respond to "bunty " <bunty123_4@rediffmail.com>

Sent by:    kernelnewbies-bounce@nl.linux.org


To:    kernelnewbies@nl.linux.org
cc:

Subject:    questions on ip_input.c



hello ,

what is the difference between following two fragments of code?
---------------------------------------------------------------
 if (!pskb_may_pull(skb, sizeof(struct iphdr)))
  goto inhdr_error;

 iph = skb->nh.iph;
-----------------------------------------------------------------
 if (!pskb_may_pull(skb, iph->ihl*4))
  goto inhdr_error;

 iph = skb->nh.iph;
-----------------------------------------------------------------

Also

 /* Our transport medium may have padded the buffer out. Now we know it
                 * is IP we can trim to the true length of the frame.
                 * Note this now means skb->len holds ntohs(iph->tot_len).
                 */
                if (skb->len > len) {
                        __pskb_trim(skb, len);
                        if (skb->ip_summed == CHECKSUM_HW)
                                skb->ip_summed = CHECKSUM_NONE;

can anybody explain me in which condition trim is required ot transport
layer
to pad zeros?

regards,
parag.



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux