From: Balazs Scheidler <bazsi@balabit.hu>
To: Henrik Nordstrom <hno@marasystems.com>
Cc: netfilter-devel@lists.samba.org
Subject: Re: NAT, not doing route_me_harder?
Date: Wed, 26 Jun 2002 12:18:38 +0200 [thread overview]
Message-ID: <20020626101838.GA9824@balabit.hu> (raw)
In-Reply-To: <200206261204.23831.hno@marasystems.com>
On Wed, Jun 26, 2002 at 12:04:23PM +0200, Henrik Nordstrom wrote:
> Balazs Scheidler wrote:
> > I think I now understand, have my packets marked in local OUTPUT, route
> > based on that mark, and SNAT based on the marks. Is this the way you
> > suggested? Hmm.. this sounds reasonable on the programmer's perspective,
> > but is difficult to maintain from the user's: it needs two rules.
>
> Yes, it requires three custom rules rather than two (there is also the routing
> policy rule)
>
> Having NAT reroute all packets due to source nat transformations would be a
> significant performance impact only to support the corner cases where it is
> handy..
Why? The rerouting would be triggered only if the user requests it, so
normal path would not be affected. And as routing decisions are heavily
cached, it is said (I think it was Harald who said that) that routing
decisions are not expensive. It would add a simple bit-test in normal path,
and a second routing decision if explicitly requested:
something like this in ip_nat_fn(), after do_bindings is called:
saddr = (*pskb)->nh.iph->saddr;
daddr = (*pskb)->nh.iph->daddr;
ret = do_bindings(ct, ctinfo, info, hooknum, pskb);
if (ret != NF_DROP && ret != NF_STOLEN && (ct->flags & IP_NAT_REROUTE)) {
if (((*pskb)->nh.iph->saddr != saddr || (*pskb)->nh.iph->daddr != daddr))
ret = (ip_route_me_harder(pskb) == 0) ? ret : NF_DROP;
}
return ret;
This could also be extended with the local output case, so ip_nat_fn() and
ip_nat_local_fn() could be merged. (the if condition would become:
if (ret != NF_DROP && ret != NF_STOLEN && (hooknum == NF_IP_LOCAL_OUT || ct->flags & IP_NAT_REROUTE)) {
...
}
--
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
prev parent reply other threads:[~2002-06-26 10:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-26 8:41 NAT, not doing route_me_harder? Balazs Scheidler
2002-06-26 9:13 ` Henrik Nordstrom
2002-06-26 9:55 ` Balazs Scheidler
2002-06-26 10:04 ` Henrik Nordstrom
2002-06-26 10:18 ` Balazs Scheidler [this message]
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=20020626101838.GA9824@balabit.hu \
--to=bazsi@balabit.hu \
--cc=hno@marasystems.com \
--cc=netfilter-devel@lists.samba.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.