All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcus Sundberg <marcus@ingate.com>
To: netfilter-devel@lists.netfilter.org
Cc: laforge@netfilter.org, kaber@trash.net
Subject: [PATCH] ip_nat_tftp: Fix expectation NAT.
Date: Thu, 08 Dec 2005 11:49:14 +0100	[thread overview]
Message-ID: <43980FAA.6060608@ingate.com> (raw)

[-- 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)

             reply	other threads:[~2005-12-08 10:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-08 10:49 Marcus Sundberg [this message]
2005-12-09  4:55 ` [PATCH] ip_nat_tftp: Fix expectation NAT Harald Welte
2005-12-09 12:57   ` Marcus Sundberg
2005-12-09 16:23   ` Marcus Sundberg
2005-12-12  7:11 ` Patrick McHardy

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=43980FAA.6060608@ingate.com \
    --to=marcus@ingate.com \
    --cc=kaber@trash.net \
    --cc=laforge@netfilter.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.