Fix IA_PD length error (#428)

* Fix IA_PD length error

I tested this and noticed wireshark wasn't parsing the message correctly. Turns out the length is wrong.

* Update regression.uts

Fix test for DHCP6OptIA_PD

* Update length of DHCP6OptIA_PD in test.
This commit is contained in:
ngkokkee 2017-01-24 18:34:33 +08:00 committed by Guillaume Valadon
parent 0ec5af2555
commit e63ecd7bc4
2 changed files with 3 additions and 3 deletions

View File

@ -694,13 +694,13 @@ class DHCP6OptIAPrefix(_DHCP6OptGuessPayload): #RFC3633
name = "DHCP6 Option - IA_PD Prefix option"
fields_desc = [ ShortEnumField("optcode", 26, dhcp6opts),
FieldLenField("optlen", None, length_of="iaprefopts",
adjust = lambda pkt,x: x+26),
adjust = lambda pkt,x: x+25),
IntField("preflft", 0),
IntField("validlft", 0),
ByteField("plen", 48), # TODO: Challenge that default value
IP6Field("prefix", "2001:db8::"), # At least, global and won't hurt
StrLenField("iaprefopts", "",
length_from = lambda pkt: pkt.optlen-26) ]
length_from = lambda pkt: pkt.optlen-25) ]
class DHCP6OptIA_PD(_DHCP6OptGuessPayload): #RFC3633
name = "DHCP6 Option - Identity Association for Prefix Delegation"

View File

@ -3548,7 +3548,7 @@ a.optcode == 24 and a.optlen == 36 and len(a.dnsdomains) == 2 and a.dnsdomains[0
+ Test DHCP6 Option - IA_PD Prefix Option
= DHCP6OptIAPrefix - Basic Instantiation
str(DHCP6OptIAPrefix()) == '\x00\x1a\x00\x1a\x00\x00\x00\x00\x00\x00\x00\x000 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
str(DHCP6OptIAPrefix()) == '\x00\x1a\x00\x19\x00\x00\x00\x00\x00\x00\x00\x000 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
#TODO : finish me