All of lore.kernel.org
 help / color / mirror / Atom feed
* skb_shared || skb_cloned
@ 2005-10-04  8:53 Gervasio Bernal
  0 siblings, 0 replies; only message in thread
From: Gervasio Bernal @ 2005-10-04  8:53 UTC (permalink / raw)
  To: netfilter-devel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-10-04  8:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-04  8:53 skb_shared || skb_cloned Gervasio Bernal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.