Raw IPv6 sockets totally different from raw IPv4 sockets The IPv6 header and extension headers are not passed as data on raw IPv6 sockets. no HDRINCL option for raw IPv6 sockets. use ancillary data and/or socket options to change header contents. all data passed via raw sockets MUST be in network byte order. This is ambiguos for Raw IPv4 sockets. struct ip *ip4; struct icmp *icmp4; struct icmp6_hdr *icmp6; s4 = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); recvfrom(s4, buf, sizeof(buf), 0); ip4 = (struct ip *)buf; /* the IPv4 header is included in data */ icmp4 = (struct icmp *)(buf + (ip4->ip_hl << 2)); ... s6 = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); recvfrom(s6, buf, sizeof(buf), 0); icmp6 = (struct icmp6_hdr *)buf; /* the IPv6 header is NOT included */ ...