From: Patrick McHardy <kaber@trash.net>
To: hadi@cyberus.ca
Cc: Maillist netdev <netdev@oss.sgi.com>
Subject: Re: More tc action mess
Date: Thu, 20 Jan 2005 07:32:49 +0100 [thread overview]
Message-ID: <41EF5091.9040402@trash.net> (raw)
In-Reply-To: <1106195414.1048.34.camel@jzny.localdomain>
jamal wrote:
>On Wed, 2005-01-19 at 15:22, Patrick McHardy wrote:
>
>
>>This does not help. Netfilter calls skb_ip_make_writable if it has to
>>touch the packet, if it is shared or cloned the packet will be copied.
>>
>>
>
>for ipt, just restore:
>
>if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
> return -ENOMEM
>
>for the rest, the action code will handle all just fine. There will only
>be one copy per serious of tramplings. This is design intent.
>
>
It seems to be more clever than I initially realized :) But it does need
some fixing for ipt. The ->act function takes a struct sk_buff **, which
implies the skb might get replaced, but tcf_action_exec only takes a struct
sk_buff * and doesn't own the skb. So if the skb is replaced in the action
the owner ends up with a pointer to freed memory. pskb_expand_head is not
enough to stop netfilter from copying, at ingress the the skb might be
nonlinear, in which case it is copied. On egress it seems fine.
>Give me some examples which show something is broken then we can have a
>more coherent discussion. I am willing to kill ipt if it is the problem.
>
Instead of killing ipt we could teach netfilter to be smarter about this.
If the data that needs to be mangled is in the non-linear range we could
just linearize the skb. Additionally we should change act_api to only pass
single skb pointers around, to avoid all confusion and possible trouble.
This seems a lot better than changing almost entire net/sched to pass
double pointers around :)
Regards
Patrick
next prev parent reply other threads:[~2005-01-20 6:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-19 5:09 More tc action mess Patrick McHardy
2005-01-19 13:10 ` jamal
2005-01-19 20:22 ` Patrick McHardy
2005-01-20 4:30 ` jamal
2005-01-20 6:32 ` Patrick McHardy [this message]
2005-01-20 13:44 ` jamal
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=41EF5091.9040402@trash.net \
--to=kaber@trash.net \
--cc=hadi@cyberus.ca \
--cc=netdev@oss.sgi.com \
/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 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).