Skip to contentSkip to conversation

Dealing with shared/cloned skbs?

DISCUSSION Marcus Sundberg 1 participant 1 message Aug 23, 2005 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

in the 2.4 net/ipv4/netfilter directory various ways are used to check whether an skb needs to be copied before it is modified. At least three ways are used:

if (skb_shared(skb) || skb_cloned(skb))

if (skb_cloned(skb) && !skb->sk)

if (skb_cloned(skb))

And at the places where the skb is actually copied some of them do:

	if ((oldskb)->sk)
		skb_set_owner_w(newskb, oldskb->sk);

while some of them do not.

What is the correct way to know if an skb needs to be copied before modified, and what should be done after a copy takes place?

//Marcus

Signature · 3 lines
---------------------------------------+--------------------------
  Marcus Sundberg <[email protected]>  | Firewalls with SIP & NAT
 Software Developer, Ingate Systems AB |  http://www.ingate.com/