-
- if address != link_local:
- raise RuntimeError(
- 'Source address ({0}) not matching link local address({1})'.format(
- address, link_local))
-
- if ether['IPv6'].hlim != 255:
- raise RuntimeError('Hop limit not correct: {0}!=255'.format(
- ether['IPv6'].hlim))
-
- ra_code = ether['ICMPv6 Neighbor Discovery - Router Advertisement'].code
+ all_nodes_multicast = ipaddress.IPv6Address(u'ff02::1')
+
+ if src_address != link_local:
+ raise RuntimeError('Source address ({0}) not matching link local '
+ 'address ({1})'.format(src_address, link_local))
+ if dst_address != all_nodes_multicast:
+ raise RuntimeError('Packet destination address ({0}) is not the all'
+ ' nodes multicast address ({1}).'.
+ format(dst_address, all_nodes_multicast))
+ if ether[IPv6].hlim != 255:
+ raise RuntimeError('Hop limit not correct: {0}!=255'.
+ format(ether[IPv6].hlim))
+
+ ra_code = ether[ICMPv6ND_RA].code