Note that there are some explanatory texts on larger screens.

plurals
  1. POICMPv6 - Cannot read any router advertisement messages
    primarykey
    data
    text
    <p>I'm trying to use raw sockets and ICMPv6 to read router advertisement messages on Windows. Through Wireshark, I can see the router (a Cisco 877) sending these messages about every 200 seconds, but my application never receives them.</p> <p>My code takes the following steps:</p> <p>1) Create an IPv6 raw socket using ICMPv6 protocol</p> <p>2) Bind the socket to the IPv6 unspecified address (::)</p> <p>3) Join the link-local all nodes multicast group at FF02::1</p> <p>4) Receive router advertisements (... or not :))</p> <p>The code works fine if I join FF02::16...</p> <p>I've tried setting other socket options like hop limits, multicast hops, to no avail. Any ideas would be welcome, as I am out of them.</p> <pre><code>#include "stdlib.h" #include "winsock2.h" #include "Ws2tcpip.h" #pragma comment(lib, "ws2_32.lib") void main (int argc,char **argv) { WSADATA wsaData; SOCKET nSocket; struct sockaddr_in6 sockinfo; struct ipv6_mreq mreq; char strBuffer[1024]; int nBytes; WSAStartup (MAKEWORD (2,2),&amp;wsaData); // Create a raw socket talking ICMPv6 if ((nSocket = socket (AF_INET6,SOCK_RAW,IPPROTO_ICMPV6)) == SOCKET_ERROR) return; // Bind to :: ::memset (&amp;sockinfo,0,sizeof (sockinfo)); sockinfo.sin6_family = AF_INET6; inet_pton (AF_INET6,"::",&amp;sockinfo.sin6_addr); if (bind (nSocket,(struct sockaddr *) &amp;sockinfo,sizeof (sockinfo)) &lt; 0) return; // Join the link-local all nodes multicast group inet_pton (AF_INET6,"FF02::1",&amp;mreq.ipv6mr_multiaddr); mreq.ipv6mr_interface = 0; if (setsockopt (nSocket,IPPROTO_IPV6,IPV6_ADD_MEMBERSHIP,(char *) &amp;mreq,sizeof (mreq)) &lt; 0) return; // Wait for advertisements for (;;) nBytes = ::recvfrom (nSocket,strBuffer,sizeof (strBuffer),0,NULL,0); closesocket (nSocket); WSACleanup (); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload