From: Patrick McHardy <kaber@trash.net>
To: Yasuyuki KOZAKAI <yasuyuki.kozakai@toshiba.co.jp>
Cc: jr-list-2007@quo.to, netfilter-devel@lists.netfilter.org,
netfilter@lists.netfilter.org
Subject: Re: ICMP packets associated with NAT connections sent out wrong interface?
Date: Fri, 13 Jul 2007 16:50:02 +0200 [thread overview]
Message-ID: <4697911A.60909@trash.net> (raw)
In-Reply-To: <200707131425.l6DEPBYv013659@toshiba.co.jp>
[-- Attachment #1: Type: text/plain, Size: 270 bytes --]
Yasuyuki KOZAKAI wrote:
> [NETFILTER]: nf_conntrack: Don't track locally generated special ICMP error
Thanks. I had to manually apply it because it clashed with the
pr_debug changes, please verify that I made no mistake. I'll
also push your original patch to -stable.
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 2508 bytes --]
[NETFILTER]: nf_conntrack: Don't track locally generated special ICMP error
The conntrack assigned to locally generated ICMP error is usually the one
assigned to the original packet which has caused the error. But if
the original packet is handled as invalid by nf_conntrack, no conntrack
is assigned to the original packet. Then nf_ct_attach() cannot assign
any conntrack to the ICMP error packet. In that case the current
nf_conntrack_icmp assigns appropriate conntrack to it. But the current
code mistakes the direction of the packet. As a result, NAT code mistakes
the address to be mangled.
To fix the bug, this changes nf_conntrack_icmp not to assign conntrack
to such ICMP error. Actually no address is necessary to be mangled
in this case.
Spotted by Jordan Russell.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit b94585f7a2d237fa09af67063b0dc499e5461da6
tree ff17e171f22901060080b61f0e2383603a0407e9
parent 0c066bfa040c11160cbcfbad27e0a513801f6768
author Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Fri, 13 Jul 2007 16:48:17 +0200
committer Patrick McHardy <kaber@trash.net> Fri, 13 Jul 2007 16:48:17 +0200
net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 22 +++++-----------------
1 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
index b8b7999..f965733 100644
--- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
@@ -165,25 +165,13 @@ icmp_error_message(struct sk_buff *skb,
h = nf_conntrack_find_get(&innertuple);
if (!h) {
- /* Locally generated ICMPs will match inverted if they
- haven't been SNAT'ed yet */
- /* FIXME: NAT code has to handle half-done double NAT --RR */
- if (hooknum == NF_IP_LOCAL_OUT)
- h = nf_conntrack_find_get(&origtuple);
-
- if (!h) {
- pr_debug("icmp_error_message: no match\n");
- return -NF_ACCEPT;
- }
-
- /* Reverse direction from that found */
- if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY)
- *ctinfo += IP_CT_IS_REPLY;
- } else {
- if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY)
- *ctinfo += IP_CT_IS_REPLY;
+ pr_debug("icmp_error_message: no match\n");
+ return -NF_ACCEPT;
}
+ if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY)
+ *ctinfo += IP_CT_IS_REPLY;
+
/* Update skb to refer to this connection */
skb->nfct = &nf_ct_tuplehash_to_ctrack(h)->ct_general;
skb->nfctinfo = *ctinfo;
next prev parent reply other threads:[~2007-07-13 14:50 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-16 16:43 ICMP packets associated with NAT connections sent out wrong interface? Jordan Russell
2007-06-26 22:22 ` Martijn Lievaart
2007-06-27 11:44 ` Ray Leach
2007-06-27 18:16 ` Jordan Russell
2007-06-28 6:56 ` Martijn Lievaart
2007-06-28 16:26 ` Jordan Russell
2007-06-28 19:10 ` Martijn Lievaart
2007-06-29 1:00 ` Yasuyuki KOZAKAI
[not found] ` <200706290100.l5T1028w016087@toshiba.co.jp>
2007-07-04 23:25 ` Jordan Russell
[not found] ` <468C15EE.9060806@quo.to>
2007-07-05 1:11 ` Yasuyuki KOZAKAI
2007-07-05 1:16 ` Yasuyuki KOZAKAI
2007-07-05 5:51 ` Jordan Russell
2007-07-05 5:51 ` Jordan Russell
2007-07-05 11:17 ` Yasuyuki KOZAKAI
2007-07-05 12:21 ` Patrick McHardy
2007-07-05 12:33 ` Krzysztof Oledzki
2007-07-05 17:05 ` Jordan Russell
[not found] ` <200707050111.l651Bu2w016010@toshiba.co.jp>
2007-07-06 0:14 ` Yasuyuki KOZAKAI
2007-07-06 0:50 ` Jordan Russell
2007-07-06 17:42 ` Jordan Russell
2007-07-06 17:42 ` Jordan Russell
2007-07-07 6:27 ` Yasuyuki KOZAKAI
2007-07-07 12:24 ` Yasuyuki KOZAKAI
2007-07-07 12:24 ` Yasuyuki KOZAKAI
2007-07-07 15:34 ` Patrick McHardy
2007-07-07 17:28 ` Yasuyuki KOZAKAI
2007-07-07 17:48 ` Yasuyuki KOZAKAI
2007-07-08 6:31 ` Yasuyuki KOZAKAI
[not found] ` <200707071748.l67HmfE2005051@toshiba.co.jp>
2007-07-09 13:34 ` Patrick McHardy
2007-07-13 14:25 ` Yasuyuki KOZAKAI
[not found] ` <200707131425.l6DEPBYv013659@toshiba.co.jp>
2007-07-13 14:50 ` Patrick McHardy [this message]
2007-07-13 15:49 ` Yasuyuki KOZAKAI
2007-07-07 21:04 ` Jordan Russell
2007-07-09 7:03 ` Yasuyuki KOZAKAI
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=4697911A.60909@trash.net \
--to=kaber@trash.net \
--cc=jr-list-2007@quo.to \
--cc=netfilter-devel@lists.netfilter.org \
--cc=netfilter@lists.netfilter.org \
--cc=yasuyuki.kozakai@toshiba.co.jp \
/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.