aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/pnat/tests/packets.def
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2021-02-23 08:56:27 +0000
committerDamjan Marion <dmarion@me.com>2021-03-15 17:53:05 +0000
commitab3151c52e3686c629c79a6447cf9df4f73d5c6d (patch)
tree9ac5439beef669ad54fda1a6779b99b7e659a48b /src/plugins/nat/pnat/tests/packets.def
parent73d9c9da6a66ca8658f4ff2a0f8421f3d755cb95 (diff)
nat: pnat copy and clear byte instructions
Type: feature Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I8e48bdcc4c311717e067bb0a4e0b409a2eb8e83d Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com> Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/plugins/nat/pnat/tests/packets.def')
-rw-r--r--src/plugins/nat/pnat/tests/packets.def69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/plugins/nat/pnat/tests/packets.def b/src/plugins/nat/pnat/tests/packets.def
new file mode 100644
index 00000000000..b8486642e82
--- /dev/null
+++ b/src/plugins/nat/pnat/tests/packets.def
@@ -0,0 +1,69 @@
+[
+ (
+ "da rewritten",
+ IP(src='1.1.1.1', dst='2.2.2.2')/UDP(sport=80, dport=6871),
+ IP(src='1.1.1.1', dst='1.2.3.4')/UDP(sport=80, dport=6871),
+ 4242
+ ),
+ (
+ "unchanged",
+ IP(src='1.1.1.1', dst='2.2.2.2')/UDP(sport=80, dport=8080),
+ IP(src='1.1.1.1', dst='2.2.2.2')/UDP(sport=80, dport=8080),
+ 4242
+ ),
+ (
+ "tcp da",
+ IP(src='1.1.1.1', dst='2.2.2.2')/TCP(sport=80, dport=6871),
+ IP(src='1.1.1.1', dst='1.2.3.4')/TCP(sport=80, dport=6871),
+ 4242
+ ),
+ (
+ "tcp da ports",
+ IP(src='1.1.1.1', dst='2.2.2.2')/TCP(sport=80, dport=6872),
+ IP(src='1.1.1.1', dst='1.2.3.4')/TCP(sport=53, dport=8000),
+ 4242
+ ),
+ (
+ "tcp da ports -- fragmented packet",
+ IP(src='1.1.1.1', dst='2.2.2.2', flags='MF', frag=100)/Raw('X' * 40),
+ IP(src='1.1.1.1', dst='2.2.2.2', flags='MF', frag=100)/Raw('X' * 40),
+ 4242
+ ),
+ (
+ "short packet",
+ IP(src='1.1.1.1', dst='2.2.2.2'),
+ IP(src='1.1.1.1', dst='2.2.2.2'),
+ 4242
+ ),
+ (
+ "copy byte",
+ IP(src='1.1.1.234', dst='2.2.2.2')/UDP(chksum=0, sport=80, dport=6874),
+ IP(src='1.1.1.234', dst='2.2.2.234')/UDP(chksum=0, sport=80, dport=6874),
+ 4242
+ ),
+ (
+ "copy byte into Geneve reserved field",
+ IP(src='1.1.1.1', dst='2.2.2.2')/UDP(chksum=0, sport=80, dport=6877)/GENEVE(vni=4040),
+ IP(src='1.1.1.1', dst='1.2.3.4')/UDP(chksum=0, sport=80, dport=6877)/Raw(b'\x00\x00\x00\x00\x00\x0F\xC8\x01'),
+ 4242
+ ),
+ (
+ "copy byte overrun",
+ IP(src='1.1.1.234', dst='2.2.2.2')/UDP(chksum=0, sport=80, dport=6875),
+ IP(src='1.1.1.234', dst='2.2.2.2')/UDP(chksum=0, sport=80, dport=6875),
+ 0
+ ),
+ (
+ "clear byte",
+ IP(src='1.1.1.234', dst='2.2.2.2')/UDP(chksum=0, sport=80, dport=6876),
+ IP(src='1.1.1.234', dst='2.2.2.2')/UDP(chksum=0, sport=80, dport=220),
+ 4242
+ ),
+ (
+ "packet with options",
+ IP(src='1.1.1.1', dst='2.2.2.2', options=[IPOption('\x07')])/TCP(sport=80, dport=6872),
+ IP(src='1.1.1.1', dst='1.2.3.4', options=[IPOption('\x07')])/TCP(sport=53, dport=8000),
+ 4242
+ ),
+
+]