Skip to content
Snippets Groups Projects
Commit 199d839b authored by Pierre Lalet's avatar Pierre Lalet
Browse files

Merge pull request #76 from H1ghl4nd3r/UTO

add TCP User Timeout Option (RFC 5482)
parents 77a59970 3e53fe5d
No related branches found
No related tags found
No related merge requests found
...@@ -213,7 +213,8 @@ TCPOptions = ( ...@@ -213,7 +213,8 @@ TCPOptions = (
8 : ("Timestamp","!II"), 8 : ("Timestamp","!II"),
14 : ("AltChkSum","!BH"), 14 : ("AltChkSum","!BH"),
15 : ("AltChkSumOpt",None), 15 : ("AltChkSumOpt",None),
25 : ("Mood","!p") 25 : ("Mood","!p"),
28 : ("UTO", "!H")
}, },
{ "EOL":0, { "EOL":0,
"NOP":1, "NOP":1,
...@@ -224,7 +225,8 @@ TCPOptions = ( ...@@ -224,7 +225,8 @@ TCPOptions = (
"Timestamp":8, "Timestamp":8,
"AltChkSum":14, "AltChkSum":14,
"AltChkSumOpt":15, "AltChkSumOpt":15,
"Mood":25 "Mood":25,
"UTO":28
} ) } )
class TCPOptionsField(StrField): class TCPOptionsField(StrField):
......
...@@ -4396,3 +4396,14 @@ defrags = defragment(frags) ...@@ -4396,3 +4396,14 @@ defrags = defragment(frags)
assert len(defrags) == 1 assert len(defrags) == 1
* which should be the same as pkt reconstructed * which should be the same as pkt reconstructed
assert defrags[0] == IP(str(pkt)) 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment