[NETFILTER]: Apply PRE_ROUTING manips in LOCAL_OUT for locally generated icmp errors

Linux Kernel Mailing List <[email protected]>
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1534, 2004/12/21 17:23:20+01:00, [email protected]

	[NETFILTER]: Apply PRE_ROUTING manips in LOCAL_OUT for locally generated icmp errors
	
	Locally generated ICMP errors never hit PRE_ROUTING. Fixes invalid
	addressed ICMP errors for SNATed packets.
	
	Signed-off-by: Patrick McHardy <[email protected]>



 ip_nat_core.c |    8 ++++++++
 1 files changed, 8 insertions(+)


diff -Nru a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c
--- a/net/ipv4/netfilter/ip_nat_core.c	2005-01-15 07:04:04 -08:00
+++ b/net/ipv4/netfilter/ip_nat_core.c	2005-01-15 07:04:04 -08:00
@@ -918,6 +918,14 @@
 		/* Mapping the inner packet is just like a normal packet, except
 		 * it was never src/dst reversed, so where we would normally
 		 * apply a dst manip, we apply a src, and vice versa. */
+
+		/* Only true for forwarded packets, locally generated packets
+		 * never hit PRE_ROUTING, we need to apply their PRE_ROUTING
+		 * manips in LOCAL_OUT. */
+		if (hooknum == NF_IP_LOCAL_OUT &&
+		    info->manips[i].hooknum == NF_IP_PRE_ROUTING)
+			hooknum = info->manips[i].hooknum;
+
 		if (info->manips[i].hooknum != hooknum)
 			continue;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.