netdev
[Top] [All Lists]

Re: what pointers does pskb_may_pull() nuke?

To: netdev@xxxxxxxxxxx, design@xxxxxxxxxxxxxxxxxx
Subject: Re: what pointers does pskb_may_pull() nuke?
From: Michael Richardson <mcr@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 27 Nov 2001 14:44:16 -0500
In-reply-to: Your message of "Sun, 25 Nov 2001 20:29:43 GMT." <Pine.LNX.4.33.0111251934180.6389-100000@u.domain.uli>
Sender: owner-netdev@xxxxxxxxxxx
-----BEGIN PGP SIGNED MESSAGE-----


>>>>> "Julian" == Julian Anastasov <ja@xxxxxx> writes:
    Julian>     pskb_may_pull does not assemble all fragments, even after
    Julian> ip_defrag you have to call skb_linearize if the skb is still
    Julian> non-linear, i.e. something like:

    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.

    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()?

    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 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?

    Julian>     If in doubt, don't use skb->h.raw in your calcs, base
    Julian> everything on nh.raw (more portable for local delivery)
  
  okay.

    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.

]       ON HUMILITY: to err is human. To moo, bovine.           |  firewalls  [
]   Michael Richardson, Sandelman Software Works, Ottawa, ON    |net architect[
] mcr@xxxxxxxxxxxxxxxxxxxxxx http://www.sandelman.ottawa.on.ca/ |device driver[
] panic("Just another NetBSD/notebook using, kernel hacking, security guy");  [

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: latin1
Comment: Finger me for keys

iQCVAwUBPAPtCoqHRg3pndX9AQHy6AP/XJqgp7tFUIXGz+SPCtRBKA6dTjBVMTQz
XAwEdh9DYnkqwUfr/Ff06vwxielILC0JD+o1Q5iQ22GqHG8dtPEw2Gm86Ft3RHA8
cm5yLktGwrMqMvPVwF2fTgmPuf00aXqGxOg7txvYj74R1dWjjaekoJmtCKOMXg5f
ULvuQuadhLU=
=seQv
-----END PGP SIGNATURE-----

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