From 3e53fe5da39c7430c9f0aaa09bd5a075490afad4 Mon Sep 17 00:00:00 2001
From: Jeffrey Bencteux <jeffbencteux@gmail.com>
Date: Sat, 5 Mar 2016 09:19:44 +0100
Subject: [PATCH] add TCP User Timout Option (RFC 5482)

Allow one to send the TCP User Timeout Option described in RFC 5482 in
a crafted TCP segment.
Also added unit tests in new "TCP options" section of
test/regression.uts
---
 test/regression.uts | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/test/regression.uts b/test/regression.uts
index fd256915..d3ee39f4 100644
--- a/test/regression.uts
+++ b/test/regression.uts
@@ -4396,3 +4396,14 @@ defrags = defragment(frags)
 assert len(defrags) == 1
 * which should be the same as pkt reconstructed
 assert defrags[0] == IP(str(pkt))
+
+############
+############
++ Test TCP options
+
+= TCP options: UTO - basic build
+str(TCP(options=[("UTO", 0xffff)])) == "\x00\x14\x00\x50\x00\x00\x00\x00\x00\x00\x00\x00\x60\x02\x20\x00\x00\x00\x00\x00\x1c\x04\xff\xff"
+
+= TCP options: UTO - basic dissection
+uto = TCP("\x00\x14\x00\x50\x00\x00\x00\x00\x00\x00\x00\x00\x60\x02\x20\x00\x00\x00\x00\x00\x1c\x04\xff\xff")
+uto[TCP].options[0][0] == "UTO" and uto[TCP].options[0][1] == 0xffff
-- 
GitLab