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

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.