Skip to content

Commit d05c2fc

Browse files
committed
ICMPv6ND_NA: validate hlim==255 in answers() per RFC 4861
1 parent ce406ff commit d05c2fc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scapy/layers/inet6.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def neighsol(addr, src, iface, timeout=1, chainCC=0):
140140
p /= ICMPv6ND_NS(tgt=addr)
141141
p /= ICMPv6NDOptSrcLLAddr(lladdr=sm)
142142
res = srp1(p, type=ETH_P_IPV6, iface=iface, timeout=timeout, verbose=0,
143-
filter="ip6[7] == 255", chainCC=chainCC)
143+
chainCC=chainCC)
144144

145145
return res
146146

@@ -2258,6 +2258,10 @@ def hashret(self):
22582258
return bytes_encode(self.tgt) + self.payload.hashret()
22592259

22602260
def answers(self, other):
2261+
if not isinstance(self.underlayer, IPv6):
2262+
return False
2263+
if self.underlayer.hlim != 255:
2264+
return False
22612265
return isinstance(other, ICMPv6ND_NS) and self.tgt == other.tgt
22622266

22632267
# associated possible options : target link-layer option, Redirected header

0 commit comments

Comments
 (0)