All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gervasio Bernal <gervasiobernal@speedy.com.ar>
To: netfilter-devel@lists.netfilter.org
Subject: skb_shared || skb_cloned
Date: Tue, 04 Oct 2005 08:53:00 +0000	[thread overview]
Message-ID: <434242EC.2070107@speedy.com.ar> (raw)

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

                 reply	other threads:[~2005-10-04  8:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=434242EC.2070107@speedy.com.ar \
    --to=gervasiobernal@speedy.com.ar \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.