netdev
[Top] [All Lists]

Re: what pointers does pskb_may_pull() nuke?

To: Michael Richardson <mcr@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: what pointers does pskb_may_pull() nuke?
From: Andi Kleen <ak@xxxxxxx>
Date: Tue, 27 Nov 2001 21:45:51 +0100
Cc: netdev@xxxxxxxxxxx, design@xxxxxxxxxxxxxxxxxx
In-reply-to: <200111271944.fARJiGv01467@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>; from mcr@xxxxxxxxxxxxxxxxxxxxxx on Tue, Nov 27, 2001 at 02:44:16PM -0500
References: <Pine.LNX.4.33.0111251934180.6389-100000@xxxxxxxxxxxx> <200111271944.fARJiGv01467@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
User-agent: Mutt/1.3.16i
On Tue, Nov 27, 2001 at 02:44:16PM -0500, Michael Richardson wrote:
>     Julian>   // not needed in LOCAL_IN:
>     Julian>         if (skb->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) {
>     Julian>                 skb = ip_defrag(skb);
>     Julian>                 if (!skb)
>     Julian>                         return NF_STOLEN;
>     Julian>                 *skb_p = skb;
>     Julian>         }
> 
>   Do I really need to this? I'm a transport protocol (i.e. above IP, like
> TCP) in this context, not a net filter module.

As protocol you don't.

> 
>     Julian>         if (skb_is_nonlinear(skb)) {
>     Julian>                 if (skb_linearize(skb, GFP_ATOMIC) != 0)
>     Julian>                         return NF_DROP;
>     Julian>                 ip_send_check(skb->nh.iph); // Not needed for 
> local delivery
>     Julian>         }
> 
>   Can I just call skb_linearize()?

Yes.

> 
>     Julian>   Then after *_may_pull (or any other functions that move the
>     Julian> data) you have to base everything on skb->nh.iph and to create 
> your
>     Julian> own h.raw and other pointers.
> 
>   If skb->nh.iph is correct, then I don't care about the other stuff.

It should be correct at protocol level.

> 
>     >> It appears that we never enabled it, not is it clear when we should :-)
> 
>     Julian>   Hm, are you sure it is not enabled? I don't know how you are
>     Julian> using skb->data in the protocol handlers as pointer to iphdr 
> after 2.4.4
> 
>   Is IPH_is_SKB_PULLED set by some other part of the system?

It is not a linux symbol.

>     Julian>   While we played with sk_buffs during the Linux Virtual Server
>     Julian> port we didn't found any docs. If you can't find any docs or don't
>     Julian> have other options feel free to contact me directly.
> 
>   thanks.

There is only Alan Cox's outdated document on (pre zerocopy linear) skbs. 
It gives the basics which are still mostly correct modulo the changes for
non linear skbs.
You'll likely find it somewhere on http://www.linux.org.uk
A new one should be probably written or included as inline docs that covers
skb_linearize(), pskb_* et.al. too. 

-Andi

<Prev in Thread] Current Thread [Next in Thread>