Skip to content
Snippets Groups Projects
Commit 5fb59d2e authored by Todd Freed's avatar Todd Freed
Browse files

coap: dont reorder options having the same option number

parent e8b5a189
No related branches found
No related tags found
No related merge requests found
......@@ -178,7 +178,7 @@ class _CoAPOptsField(StrField):
opt_lst.append((coap_options[1][o[0]], o[1]))
else:
opt_lst.append(o)
opt_lst.sort()
opt_lst.sort(key=lambda o:o[0])
opts = _CoAPOpt(delta=opt_lst[0][0], opt_val=opt_lst[0][1])
high_opt = opt_lst[0][0]
......
......@@ -29,6 +29,12 @@ str(CoAP(options=[("Uri-Query", "query")])) == '\x40\x00\x00\x00\xd5\x02\x71\x75
= Extended option length
str(CoAP(options=[("Location-Path", 'x' * 280)])) == '\x40\x00\x00\x00\x8e\x0b\x00' + '\x78' * 280
= Options should be ordered by option number
str(CoAP(options=[("Uri-Query", "b"),("Uri-Path","a")])) == '\x40\x00\x00\x00\xb1\x61\x41\x62'
= Options of the same type should not be reordered
str(CoAP(options=[("Uri-Path", "b"),("Uri-Path","a")])) == '\x40\x00\x00\x00\xb1\x62\x01\x61'
+ Test layer binding
= Destination port
p = UDP()/CoAP()
......
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