title: get ICMPv6 header from IPv6 packet
body: <p>Hi i'm stuck on getting ICMPv6 header from IPv6 packet.</p>
  
  <pre><code>        size = sizeof(sockaddr_in6);
          if ((lenght = recvfrom(socd, buffer, BUFSIZE, 0, (sockaddr *)&amp;receiveSockAddr, &amp;size)) &lt; 0) {
            cerr &lt;&lt; "recvfrom error" &lt;&lt; endl;
          }
  
          ip = (ip6_hdr *) buffer;
  
          cout &lt;&lt; "Payload length: " &lt;&lt; ip-&gt;ip6_ctlun.ip6_un1.ip6_un1_plen &lt;&lt; endl;
          cout &lt;&lt; "Payload length ntohs: " &lt;&lt; ntohs(ip-&gt;ip6_ctlun.ip6_un1.ip6_un1_plen) &lt;&lt; endl;
  
          //icmpRec = (icmp6_hdr *) (buffer + ???offset???);
  </code></pre>
  
  <p>I need find out how to set the offset. Only way I know is to get payload length and then the: <strong>packet length - payload length = my offset</strong>. But in <strong>ip->ip6_ctlun.ip6_un1.ip6_un1_plen</strong> are some weird numbers.</p>
  
  <p>From the code above im receiving:</p>
  
  <pre><code>Payload length: 25332
  Payload length ntohs: 62562 
  </code></pre>
  
  <p>after sending ICMP6_ECHO_REQUEST to ipv6.google.com</p>
  
  <p>But if I look in wireshark the Payload length is 8 bytes. How to correctly decode the payload number from <strong>uint16_t</strong> to correct decimal number <strong>8</strong>? And how get the whole size of IPv6 packet to calculate the offset? Why IPv6 haven't IHL as IPv4? This very complicate the work aroud IPv6 I think.</p>