From: Balazs Scheidler <bazsi@balabit.hu>
To: netfilter-devel@lists.samba.org
Subject: NAT, not doing route_me_harder?
Date: Wed, 26 Jun 2002 10:41:36 +0200 [thread overview]
Message-ID: <20020626084136.GA25908@balabit.hu> (raw)
Hi,
I was wondering what the reason is for NAT not rerouting modified packets?
If anything important is modified by a mangle rule that affects routing, the
routing decision is automatically redone as this code fragment shows:
ret = ipt_do_table(pskb, hook, in, out, &packet_mangler, NULL);
/* Reroute for ANY change. */
if (ret != NF_DROP && ret != NF_STOLEN && ret != NF_QUEUE
&& ((*pskb)->nh.iph->saddr != saddr
|| (*pskb)->nh.iph->daddr != daddr
|| (*pskb)->nfmark != nfmark
|| (*pskb)->nh.iph->tos != tos))
return ip_route_me_harder(pskb) == 0 ? ret : NF_DROP;
NAT doesn't do anything like this. So given an SNAT rule changes the source
address in POSTROUTING, the routing tables are not looked up again, so
source address dependant policy routing rules are not applied.
It might not be the best to change this by default, but it could be
implemented by a match, e.g.
iptables -t nat -A POSTROUTING -p tcp -d 0/0 --dport 25 -m reroute -j SNAT --to-source 1.2.3.4
-m reroute would flag the packet as one which needs rerouting (using for
example a flag in nfcache). Packets flagged as such would be rerouted after
do_bindings() is called.
Opinions?
--
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
next reply other threads:[~2002-06-26 8:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-26 8:41 Balazs Scheidler [this message]
2002-06-26 9:13 ` NAT, not doing route_me_harder? Henrik Nordstrom
2002-06-26 9:55 ` Balazs Scheidler
2002-06-26 10:04 ` Henrik Nordstrom
2002-06-26 10:18 ` Balazs Scheidler
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=20020626084136.GA25908@balabit.hu \
--to=bazsi@balabit.hu \
--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.