I want to check/analyse ICMPv6 router advertisements (RAs) in a Python program using Python, where I get the (not so) raw packet data as follows:
import socket
sock = socket.socket(socket.AF_INET6, socket.SOCK_RAW, socket.IPPROTO_ICMPV6)
p, addr = sock.recvfrom(4096)
When an ICMPv6 packet gets received, the packet p will contain only(!) the ICMPv6 part itself, but not any other outer elements, so there's no IPv6 header, no Ethernet header, ...
How do I create the correct Scapy ICMPv6-derived packet class from my (no so) raw packet data? _ICMPv6
seems to be just a fallback class. Is there some kind of factory to get the correct sub class (such as ICMPv6ND_RA
) from?