skb_shared || skb_cloned
Hi everybody!
I'm developing a new netfilter target that change some fields of the IP header and I'm having some problems when skb are shared.
This is part of my code that verify the skb. If it is shared or cloned with another application, it creates a new copy (skb_copy()) and frees the old skb (kfree())
if (skb_shared(*pskb) || skb_cloned(*pskb))
{
struct sk_buff *nskb;
printk(KERN_INFO MOD "skb_shared || skb_cloned!!\n");
nskb = skb_copy(*pskb, GFP_ATOMIC);
if (!nskb)
return NF_DROP;
if ((*pskb)->sk)
skb_set_owner_w(nskb, (*pskb)->sk);
kfree_skb(*pskb);
*pskb = nskb;
}My doubt is: the other applications, which skb use? The new one, or the copy?
This is what I did: I ran my new netfilter target with and Ethereal (so that skb was share) but when I saw the output of Ethereal, it showed as if it had not copied it. Is this correct???