All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcus Sundberg <marcus@ingate.com>
To: Harald Welte <laforge@netfilter.org>
Cc: netfilter-devel@lists.netfilter.org, kaber@trash.net
Subject: Re: [PATCH] ip_nat_tftp: Fix expectation NAT.
Date: Fri, 09 Dec 2005 17:23:37 +0100	[thread overview]
Message-ID: <4399AF89.9030603@ingate.com> (raw)
In-Reply-To: <20051209045520.GB4244@rama.exocore.com>

Harald Welte wrote:
> This is one of the cases where I'd really appreciate having a nfsim
> test for the testsuite to 
> 1) help understanding the problem
> 2) prevent further regressions
> 
> Would you be willing to provide us with a testcase for nfsim-testsuite?
> Unfortunately we cannot offer anything but bonus points ;)

Hi,

How about the following simple test?

//Marcus

--- /dev/null	2004-02-23 22:02:56.000000000 +0100
+++ nfsim-testsuite/03NAT/67tftp.sim	2005-12-09 17:21:25.817527981 +0100
@@ -0,0 +1,46 @@
+# Setup SNAT with port NAT.
+iptables -t nat -A POSTROUTING -p udp -s 192.168.0.0/24 -d 192.168.1.0/24 -j SNAT --to-source 192.168.1.1:30000-40000
+
+# Issue TFTP read request.
+expect gen_ip send:eth1 {IPv4 192.168.1.1 192.168.1.2 21 17 30000 69 DATA \0\x01/nicefile\0netascii\0}
+gen_ip IF=eth0 192.168.0.2 192.168.1.2 21 17 1051 69 DATA \0\x01/nicefile\0netascii\0
+
+# Show expectation.
+proc cat /proc/net/ip_conntrack_expect
+
+# First data packet.
+expect gen_ip send:eth0 {IPv4 192.168.1.2 192.168.0.2 524 17 4711 1051}
+gen_ip IF=eth1 192.168.1.2 192.168.1.1 524 17 4711 30000
+# First ACK.
+expect gen_ip send:eth1 {IPv4 192.168.1.1 192.168.1.2 12 17 30000 4711}
+gen_ip IF=eth0 192.168.0.2 192.168.1.2 12 17 1051 4711
+# Second data packet.
+expect gen_ip send:eth0 {IPv4 192.168.1.2 192.168.0.2 87 17 4711 1051}
+gen_ip IF=eth1 192.168.1.2 192.168.1.1 87 17 4711 30000
+# Second ACK.
+expect gen_ip send:eth1 {IPv4 192.168.1.1 192.168.1.2 12 17 30000 4711}
+gen_ip IF=eth0 192.168.0.2 192.168.1.2 12 17 1051 4711
+
+# Issue TFTP read request again from a new port.
+expect gen_ip send:eth1 {IPv4 192.168.1.1 192.168.1.2 28 17 30001 69 DATA \0\x01/anothernicefile\0netascii\0}
+gen_ip IF=eth0 192.168.0.2 192.168.1.2 28 17 1052 69 DATA \0\x01/anothernicefile\0netascii\0
+
+# Show expectation.
+proc cat /proc/net/ip_conntrack_expect
+
+# First data packet.
+expect gen_ip send:eth0 {IPv4 192.168.1.2 192.168.0.2 524 17 4711 1052}
+gen_ip IF=eth1 192.168.1.2 192.168.1.1 524 17 4711 30001
+# First ACK.
+expect gen_ip send:eth1 {IPv4 192.168.1.1 192.168.1.2 12 17 30001 4711}
+gen_ip IF=eth0 192.168.0.2 192.168.1.2 12 17 1052 4711
+# Second data packet.
+expect gen_ip send:eth0 {IPv4 192.168.1.2 192.168.0.2 233 17 4711 1052}
+gen_ip IF=eth1 192.168.1.2 192.168.1.1 233 17 4711 30001
+# Second ACK.
+expect gen_ip send:eth1 {IPv4 192.168.1.1 192.168.1.2 12 17 30001 4711}
+gen_ip IF=eth0 192.168.0.2 192.168.1.2 12 17 1052 4711
+
+# Show conntracks and expectations.
+proc cat /proc/net/ip_conntrack
+proc cat /proc/net/ip_conntrack_expect


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

  parent reply	other threads:[~2005-12-09 16:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=4399AF89.9030603@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.