linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sk_buff allocation
@ 2001-06-12 10:42 Emmanuel Varagnat
  2001-06-12 10:53 ` Alexey Vyskubov
  0 siblings, 1 reply; 3+ messages in thread
From: Emmanuel Varagnat @ 2001-06-12 10:42 UTC (permalink / raw)
  To: linux-kernel


I'm writing a module that is able to modify outgoing packets.
This is done by registering a new entry in ptype_all.
But my problem is that in dev_queue_xmit_nit the sk_buff is
cloned and that my function get this clone. So my modification
on skb->data isn't take into account by the ethernet driver.

My idea was to do my modifications and then copy all my datas
starting at skb->data so that nothing in the sk_buff is modified.

But what am I doing if the buffer doesn't have enough room to
support the new/modified data ?
skb_cow or skb_copy_expand, for example, will return me a new
sk_buff with a new buffer but how could I tell the system that
it must "replace" the old sk_buff by this one ?

Thanks

-Emmanuel Varagnat

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

* Re: sk_buff allocation
  2001-06-12 10:42 sk_buff allocation Emmanuel Varagnat
@ 2001-06-12 10:53 ` Alexey Vyskubov
  2001-06-12 11:49   ` Emmanuel Varagnat
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Vyskubov @ 2001-06-12 10:53 UTC (permalink / raw)
  To: ext Emmanuel Varagnat; +Cc: linux-kernel

> I'm writing a module that is able to modify outgoing packets.
> This is done by registering a new entry in ptype_all.
> But my problem is that in dev_queue_xmit_nit the sk_buff is
> cloned and that my function get this clone. So my modification
> on skb->data isn't take into account by the ethernet driver.

Why don't you use netfilter hooks? Write your hook for NF_IP_POST_ROUTING; it
will receive sk_buff **pskb, so you can completely replace old skbuff with new.

-- 
Alexey

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

* Re: sk_buff allocation
  2001-06-12 10:53 ` Alexey Vyskubov
@ 2001-06-12 11:49   ` Emmanuel Varagnat
  0 siblings, 0 replies; 3+ messages in thread
From: Emmanuel Varagnat @ 2001-06-12 11:49 UTC (permalink / raw)
  To: Alexey Vyskubov; +Cc: linux-kernel

Alexey Vyskubov wrote:
> 
> Why don't you use netfilter hooks? Write your hook for NF_IP_POST_ROUTING; it
> will receive sk_buff **pskb, so you can completely replace old skbuff with new.

Because, it doesn't seems to fit my needs.
The hardware header must present.

But I could have missed something looking at the kernel code.

Thanks a lot

-Manu

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

end of thread, other threads:[~2001-06-12 11:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-12 10:42 sk_buff allocation Emmanuel Varagnat
2001-06-12 10:53 ` Alexey Vyskubov
2001-06-12 11:49   ` Emmanuel Varagnat

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).