All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Yair Itzhaki <Yair@arx.com>
Cc: Netfilter Development Mailinglist
	<netfilter-devel@lists.netfilter.org>,
	linux-kernel@vger.kernel.org
Subject: Re: Re-routing packets via netfilter (ip_rt_bug)
Date: Mon, 25 Apr 2005 11:07:14 +0200	[thread overview]
Message-ID: <426CB342.2010504@trash.net> (raw)
In-Reply-To: <4151C0F9B9C25C47B3328922A6297A3286CF98@post.arx.com>

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

Yair Itzhaki wrote:
> While traversing packets through Netfilter, changing dest address from a foreign to a local address causes the packet to drop (and show up at ip_rt_bug(), along a syslog entry).

Does this patch fix your problem?


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1210 bytes --]

[NETFILTER]: Don't use ip_route_input() for local addresses

Local input routes have ->output set to ip_rt_bug().

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit bef30866b7440f4c8aff99dc025ea99b8d396390
tree a469360c577fdf6919b9a771521eca120103db45
parent a5c2178d8f07f6180a2daf8df4524cf3b45e62ed
author Patrick McHardy <kaber@trash.net> 1114419959 +0200
committer Patrick McHardy <kaber@trash.net> 1114419959 +0200

Index: net/core/netfilter.c
===================================================================
--- 70652aa8f30bea3ea83594cc4a47a11f7a8db89d/net/core/netfilter.c  (mode:100644 sha1:e51cfa46950cf8f1f4dea42be94e71d76d8c3c5b)
+++ a469360c577fdf6919b9a771521eca120103db45/net/core/netfilter.c  (mode:100644 sha1:85936a0b23d9ea42e2cd9d45e8254c2f780eb786)
@@ -611,7 +611,8 @@
 	/* some non-standard hacks like ipt_REJECT.c:send_reset() can cause
 	 * packets with foreign saddr to appear on the NF_IP_LOCAL_OUT hook.
 	 */
-	if (inet_addr_type(iph->saddr) == RTN_LOCAL) {
+	if (inet_addr_type(iph->saddr) == RTN_LOCAL ||
+	    inet_addr_type(iph->daddr) == RTN_LOCAL) {
 		fl.nl_u.ip4_u.daddr = iph->daddr;
 		fl.nl_u.ip4_u.saddr = iph->saddr;
 		fl.nl_u.ip4_u.tos = RT_TOS(iph->tos);

WARNING: multiple messages have this Message-ID (diff)
From: Patrick McHardy <kaber@trash.net>
To: Yair Itzhaki <Yair@arx.com>
Cc: linux-kernel@vger.kernel.org,
	Netfilter Development Mailinglist 
	<netfilter-devel@lists.netfilter.org>
Subject: Re: Re-routing packets via netfilter (ip_rt_bug)
Date: Mon, 25 Apr 2005 11:07:14 +0200	[thread overview]
Message-ID: <426CB342.2010504@trash.net> (raw)
In-Reply-To: <4151C0F9B9C25C47B3328922A6297A3286CF98@post.arx.com>

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

Yair Itzhaki wrote:
> While traversing packets through Netfilter, changing dest address from a foreign to a local address causes the packet to drop (and show up at ip_rt_bug(), along a syslog entry).

Does this patch fix your problem?


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1210 bytes --]

[NETFILTER]: Don't use ip_route_input() for local addresses

Local input routes have ->output set to ip_rt_bug().

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit bef30866b7440f4c8aff99dc025ea99b8d396390
tree a469360c577fdf6919b9a771521eca120103db45
parent a5c2178d8f07f6180a2daf8df4524cf3b45e62ed
author Patrick McHardy <kaber@trash.net> 1114419959 +0200
committer Patrick McHardy <kaber@trash.net> 1114419959 +0200

Index: net/core/netfilter.c
===================================================================
--- 70652aa8f30bea3ea83594cc4a47a11f7a8db89d/net/core/netfilter.c  (mode:100644 sha1:e51cfa46950cf8f1f4dea42be94e71d76d8c3c5b)
+++ a469360c577fdf6919b9a771521eca120103db45/net/core/netfilter.c  (mode:100644 sha1:85936a0b23d9ea42e2cd9d45e8254c2f780eb786)
@@ -611,7 +611,8 @@
 	/* some non-standard hacks like ipt_REJECT.c:send_reset() can cause
 	 * packets with foreign saddr to appear on the NF_IP_LOCAL_OUT hook.
 	 */
-	if (inet_addr_type(iph->saddr) == RTN_LOCAL) {
+	if (inet_addr_type(iph->saddr) == RTN_LOCAL ||
+	    inet_addr_type(iph->daddr) == RTN_LOCAL) {
 		fl.nl_u.ip4_u.daddr = iph->daddr;
 		fl.nl_u.ip4_u.saddr = iph->saddr;
 		fl.nl_u.ip4_u.tos = RT_TOS(iph->tos);

  reply	other threads:[~2005-04-25  9:07 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-25  9:49 Re-routing packets via netfilter (ip_rt_bug) Yair Itzhaki
2005-04-25  9:07 ` Patrick McHardy [this message]
2005-04-25  9:07   ` Patrick McHardy
2005-04-25 10:52   ` Herbert Xu
2005-04-25 10:52     ` Herbert Xu
2005-04-25 15:28     ` Patrick McHardy
2005-04-25 15:28       ` Patrick McHardy
2005-04-25 21:34       ` Herbert Xu
2005-04-25 21:34         ` Herbert Xu
2005-04-26  0:08         ` Patrick McHardy
2005-04-26  0:08           ` Patrick McHardy
2005-04-26  0:39           ` Herbert Xu
2005-04-26  0:39             ` Herbert Xu
2005-04-26 13:17             ` Patrick McHardy
2005-04-26 13:17               ` Patrick McHardy
2005-04-26 23:28               ` Herbert Xu
2005-04-26 23:28                 ` Herbert Xu
2005-04-27  0:56                 ` Patrick McHardy
2005-04-27  0:56                   ` Patrick McHardy
2005-04-27  1:07                   ` Herbert Xu
2005-04-27  1:07                     ` Herbert Xu
2005-04-27 10:26                     ` Patrick McHardy
2005-04-27 10:26                       ` Patrick McHardy
2005-04-27 10:30                       ` Herbert Xu
2005-04-27 10:30                         ` Herbert Xu
2005-04-27 10:41                         ` Jozsef Kadlecsik
2005-04-27 10:41                           ` Jozsef Kadlecsik
2005-04-27 11:35                           ` Herbert Xu
2005-04-27 11:35                             ` Herbert Xu
2005-04-27 11:54                             ` Herbert Xu
2005-04-27 11:54                               ` Herbert Xu
2005-04-27 12:05                               ` Patrick McHardy
2005-04-27 12:05                                 ` Patrick McHardy
2017-07-10  9:20 ` Helbing63
2020-07-23  7:25 ` technical support jollyzula
2020-07-23  7:25 ` Canon.com/ijsetup jollyzula
  -- strict thread matches above, loose matches on Subject: below --
2005-04-25 16:51 Re-routing packets via netfilter (ip_rt_bug) Yair Itzhaki
2005-04-26 15:39 Yair Itzhaki
2005-05-02 17:17 Yair Itzhaki
2005-07-14 12:27 ` Ric Wheeler
2005-07-14 12:27 ` Ric Wheeler

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=426CB342.2010504@trash.net \
    --to=kaber@trash.net \
    --cc=Yair@arx.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netfilter-devel@lists.netfilter.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.