Skip to content
Snippets Groups Projects
Commit 6695b89a authored by Guillaume Valadon's avatar Guillaume Valadon
Browse files

Issues #884 & #915: IPv6 NA is not a NS & Error in class...

Issues #884 & #915: IPv6 NA is not a NS & Error in class ICMPv6ND_NS(_ICMPv6NDGuessPayload, _ICMPv6, Packet):
parent 9d4a1202
No related branches found
No related tags found
No related merge requests found
...@@ -1687,10 +1687,7 @@ class ICMPv6ND_NS(_ICMPv6NDGuessPayload, _ICMPv6, Packet): ...@@ -1687,10 +1687,7 @@ class ICMPv6ND_NS(_ICMPv6NDGuessPayload, _ICMPv6, Packet):
fields_desc = [ ByteEnumField("type",135, icmp6types), fields_desc = [ ByteEnumField("type",135, icmp6types),
ByteField("code",0), ByteField("code",0),
XShortField("cksum", None), XShortField("cksum", None),
BitField("R",0,1), IntField("res", 0),
BitField("S",0,1),
BitField("O",0,1),
XBitField("res",0,29),
IP6Field("tgt","::") ] IP6Field("tgt","::") ]
overload_fields = {IPv6: { "nh": 58, "dst": "ff02::1", "hlim": 255 }} overload_fields = {IPv6: { "nh": 58, "dst": "ff02::1", "hlim": 255 }}
...@@ -1700,11 +1697,23 @@ class ICMPv6ND_NS(_ICMPv6NDGuessPayload, _ICMPv6, Packet): ...@@ -1700,11 +1697,23 @@ class ICMPv6ND_NS(_ICMPv6NDGuessPayload, _ICMPv6, Packet):
def hashret(self): def hashret(self):
return self.tgt+self.payload.hashret() return self.tgt+self.payload.hashret()
class ICMPv6ND_NA(ICMPv6ND_NS): class ICMPv6ND_NA(_ICMPv6NDGuessPayload, _ICMPv6, Packet):
name = "ICMPv6 Neighbor Discovery - Neighbor Advertisement" name = "ICMPv6 Neighbor Discovery - Neighbor Advertisement"
type = 136 fields_desc = [ ByteEnumField("type",136, icmp6types),
R = 1 ByteField("code",0),
O = 1 XShortField("cksum", None),
BitField("R",1,1),
BitField("S",0,1),
BitField("O",1,1),
XBitField("res",0,29),
IP6Field("tgt","::") ]
overload_fields = {IPv6: { "nh": 58, "dst": "ff02::1", "hlim": 255 }}
def mysummary(self):
return self.sprintf("%name% (tgt: %tgt%)")
def hashret(self):
return self.tgt+self.payload.hashret()
def answers(self, other): def answers(self, other):
return isinstance(other, ICMPv6ND_NS) and self.tgt == other.tgt return isinstance(other, ICMPv6ND_NS) and self.tgt == other.tgt
......
...@@ -1741,15 +1741,15 @@ isinstance(a, IPv6) and a.nh == 58 and a.hlim == 255 and isinstance(a.payload, I ...@@ -1741,15 +1741,15 @@ isinstance(a, IPv6) and a.nh == 58 and a.hlim == 255 and isinstance(a.payload, I
str(ICMPv6ND_NS()) == '\x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' str(ICMPv6ND_NS()) == '\x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
= ICMPv6ND_NS - Instantiation with specific values = ICMPv6ND_NS - Instantiation with specific values
str(ICMPv6ND_NS(code=0x11, R=1, S=1, O=1, res=1, tgt="ffff::1111")) == '\x87\x11\x00\x00\xe0\x00\x00\x01\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' str(ICMPv6ND_NS(code=0x11, res=3758096385, tgt="ffff::1111")) == '\x87\x11\x00\x00\xe0\x00\x00\x01\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11'
= ICMPv6ND_NS - Basic Dissection = ICMPv6ND_NS - Basic Dissection
a=ICMPv6ND_NS('\x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a=ICMPv6ND_NS('\x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
a.code==0 and a.R==0 and a.S==0 and a.O==0 and a.res==0 and a.tgt=="::" a.code==0 and a.res==0 and a.tgt=="::"
= ICMPv6ND_NS - Dissection with specific values = ICMPv6ND_NS - Dissection with specific values
a=ICMPv6ND_NS('\x87\x11\x00\x00\xe0\x00\x00\x01\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') a=ICMPv6ND_NS('\x87\x11\x00\x00\xe0\x00\x00\x01\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11')
a.code==0x11 and a.R==1 and a.S==1 and a.O==1 and a.res==1 and a.tgt=="ffff::1111" a.code==0x11 and a.res==3758096385 and a.tgt=="ffff::1111"
= ICMPv6ND_NS - IPv6 layer fields overloading = ICMPv6ND_NS - IPv6 layer fields overloading
a=IPv6(str(IPv6()/ICMPv6ND_NS())) a=IPv6(str(IPv6()/ICMPv6ND_NS()))
......
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