All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ip_nat_tftp: Fix expectation NAT.
@ 2005-12-08 10:49 Marcus Sundberg
  2005-12-09  4:55 ` Harald Welte
  2005-12-12  7:11 ` Patrick McHardy
  0 siblings, 2 replies; 5+ messages in thread
From: Marcus Sundberg @ 2005-12-08 10:49 UTC (permalink / raw)
  To: netfilter-devel; +Cc: laforge, kaber

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

Hi,

this patch fixes the case where the port in an initial TFTP packet
is SNATed. Previously the port was never DNATed back for the expected
connection.

//Marcus
-- 
---------------------------------------+--------------------------
  Marcus Sundberg <marcus@ingate.com>  | Firewalls with SIP & NAT
 Software Developer, Ingate Systems AB |  http://www.ingate.com/

[-- Attachment #2: tftp-nat-fix.diff --]
[-- Type: text/x-patch, Size: 810 bytes --]

[NETFILTER] ip_nat_tftp: Fix expectation NAT.

When a TFTP client is SNATed so that the port is also changed, the
port is never changed back for the expected connection.

Signed-off-by: Marcus Sundberg <marcus@ingate.com>

--- linux.current/net/ipv4/netfilter/ip_nat_tftp.c	2005/12/05 18:58:22	1.1
+++ linux.current/net/ipv4/netfilter/ip_nat_tftp.c	2005/12/05 19:01:05
@@ -42,7 +42,10 @@ static unsigned int help(struct sk_buff 
 			 enum ip_conntrack_info ctinfo,
 			 struct ip_conntrack_expect *exp)
 {
-	exp->saved_proto.udp.port = exp->tuple.dst.u.tcp.port;
+	struct ip_conntrack *ct = exp->master;
+
+	exp->saved_proto.udp.port
+		= ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.udp.port;
 	exp->dir = IP_CT_DIR_REPLY;
 	exp->expectfn = ip_nat_follow_master;
 	if (ip_conntrack_expect_related(exp) != 0)

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

end of thread, other threads:[~2005-12-12  7:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-08 10:49 [PATCH] ip_nat_tftp: Fix expectation NAT Marcus Sundberg
2005-12-09  4:55 ` Harald Welte
2005-12-09 12:57   ` Marcus Sundberg
2005-12-09 16:23   ` Marcus Sundberg
2005-12-12  7:11 ` Patrick McHardy

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.