netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* attach additional value to skb
@ 2007-10-22 20:03 Yakov Lerner
  2007-10-22 21:18 ` Wenhua Zhao
  2007-10-23  5:42 ` Muli Ben-Yehuda
  0 siblings, 2 replies; 3+ messages in thread
From: Yakov Lerner @ 2007-10-22 20:03 UTC (permalink / raw)
  To: netdev

1. How can I attach my 32-bit value to the skb in the
PRE_ROUTNIG hook such that FORWARD and POST_ROUTING
hooks can later access this value from the skb ?

Can I use sk_buff->cb for that ?

2.
I want to add my custom destructor to the skb, the function
pointer to be called at skb destruction time. Will the following
work:  if I push  address of my_destructor to the
sk-buff->destructor field,  and then when my_destructor
is called, I call the (saved)  old value of  sk-buff->destructor ?
Will this work ?

Yakov

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: attach additional value to skb
  2007-10-22 20:03 attach additional value to skb Yakov Lerner
@ 2007-10-22 21:18 ` Wenhua Zhao
  2007-10-23  5:42 ` Muli Ben-Yehuda
  1 sibling, 0 replies; 3+ messages in thread
From: Wenhua Zhao @ 2007-10-22 21:18 UTC (permalink / raw)
  To: netdev

On 10/22/07, Yakov Lerner <iler.ml@gmail.com> wrote:
> 1. How can I attach my 32-bit value to the skb in the
> PRE_ROUTNIG hook such that FORWARD and POST_ROUTING
> hooks can later access this value from the skb ?
>
> Can I use sk_buff->cb for that ?
In IP layer cb is used by IP as structure inet_skb_param.  It is
written by ip_rcv_options() (in function ip_rcv_finish()) between
PRE_ROUTING and FORWARD/POST_ROUTING.

In my opinion, cb is only used when one exclusively owns the skb.

Regards,
Wenhua

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: attach additional value to skb
  2007-10-22 20:03 attach additional value to skb Yakov Lerner
  2007-10-22 21:18 ` Wenhua Zhao
@ 2007-10-23  5:42 ` Muli Ben-Yehuda
  1 sibling, 0 replies; 3+ messages in thread
From: Muli Ben-Yehuda @ 2007-10-23  5:42 UTC (permalink / raw)
  To: Yakov Lerner; +Cc: netdev

On Mon, Oct 22, 2007 at 10:03:47PM +0200, Yakov Lerner wrote:

> I want to add my custom destructor to the skb, the function pointer
> to be called at skb destruction time. Will the following work: if I
> push address of my_destructor to the
> sk-buff->destructor field,  and then when my_destructor
> is called, I call the (saved)  old value of  sk-buff->destructor ?
> Will this work ?

It might, provided nothing else runs after you that will unilaterally
change the ->destructor field. I.e., it depends at which point in the
skb's life-time you set your hook.

Cheers,
Muli
-- 
SYSTOR 2007 --- 1st Annual Haifa Systems and Storage Conference 2007
http://www.haifa.il.ibm.com/Workshops/systor2007/

Virtualization workshop: Oct 29th, 2007 | Storage workshop: Oct 30th, 2007

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-23  5:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-22 20:03 attach additional value to skb Yakov Lerner
2007-10-22 21:18 ` Wenhua Zhao
2007-10-23  5:42 ` Muli Ben-Yehuda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).