netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NAT and requests to unrouted targets
@ 2007-03-15  8:03 Martin Schiller
  2007-03-15  8:51 ` Patrick McHardy
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Schiller @ 2007-03-15  8:03 UTC (permalink / raw)
  To: netdev

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


This patch changes the behaivor of the iptables nat module to the style
before release 2.6.16 so it is possible again to use the "ping -I <iface>
<target>" command to send icmp requests to a target for which no route
exists.

Signed-off-by: Martin Schiller <mschiller@tdt.de>

[-- Attachment #2: iptables_nat_unrouted_ping.patch --]
[-- Type: application/octet-stream, Size: 811 bytes --]

diff -uNpr linux-2.6.19.org/net/ipv4/netfilter/ip_nat_standalone.c linux-2.6.19/net/ipv4/netfilter/ip_nat_standalone.c
--- linux-2.6.19.org/net/ipv4/netfilter/ip_nat_standalone.c	2006-11-29 22:57:37.000000000 +0100
+++ linux-2.6.19/net/ipv4/netfilter/ip_nat_standalone.c	2007-03-15 08:25:11.000000000 +0100
@@ -191,11 +191,13 @@ ip_nat_in(unsigned int hooknum,
           int (*okfn)(struct sk_buff *))
 {
 	unsigned int ret;
+	__be32 saddr = (*pskb)->nh.iph->saddr;
 	__be32 daddr = (*pskb)->nh.iph->daddr;
 
 	ret = ip_nat_fn(hooknum, pskb, in, out, okfn);
 	if (ret != NF_DROP && ret != NF_STOLEN
-	    && daddr != (*pskb)->nh.iph->daddr) {
+	    && ((*pskb)->nh.iph->saddr != saddr
+	        || (*pskb)->nh.iph->daddr != daddr)) {
 		dst_release((*pskb)->dst);
 		(*pskb)->dst = NULL;
 	}

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-03-20 12:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-15  8:03 [PATCH] NAT and requests to unrouted targets Martin Schiller
2007-03-15  8:51 ` Patrick McHardy
2007-03-15 14:54   ` Martin Schiller
2007-03-16  4:13     ` Patrick McHardy
2007-03-19 16:02     ` Patrick McHardy
2007-03-20 11:56       ` Martin Schiller
2007-03-20 12:34         ` Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).