Skip to content

Commit 199d839

Browse files
committed
Merge pull request phaethon#76 from H1ghl4nd3r/UTO
add TCP User Timeout Option (RFC 5482)
2 parents 77a5997 + 3e53fe5 commit 199d839

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

scapy/layers/inet.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ class IPOption_SDBM(IPOption):
213213
8 : ("Timestamp","!II"),
214214
14 : ("AltChkSum","!BH"),
215215
15 : ("AltChkSumOpt",None),
216-
25 : ("Mood","!p")
216+
25 : ("Mood","!p"),
217+
28 : ("UTO", "!H")
217218
},
218219
{ "EOL":0,
219220
"NOP":1,
@@ -224,7 +225,8 @@ class IPOption_SDBM(IPOption):
224225
"Timestamp":8,
225226
"AltChkSum":14,
226227
"AltChkSumOpt":15,
227-
"Mood":25
228+
"Mood":25,
229+
"UTO":28
228230
} )
229231

230232
class TCPOptionsField(StrField):

test/regression.uts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4396,3 +4396,14 @@ defrags = defragment(frags)
43964396
assert len(defrags) == 1
43974397
* which should be the same as pkt reconstructed
43984398
assert defrags[0] == IP(str(pkt))
4399+
4400+
############
4401+
############
4402+
+ Test TCP options
4403+
4404+
= TCP options: UTO - basic build
4405+
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"
4406+
4407+
= TCP options: UTO - basic dissection
4408+
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")
4409+
uto[TCP].options[0][0] == "UTO" and uto[TCP].options[0][1] == 0xffff

0 commit comments

Comments
 (0)