Click here to Skip to main content
15,886,801 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I only need incoming packets. How do I switch this from promiscuous?

// Set socket to promiscuous mode
   
   if ( WSAIoctl( sniff_socket,
                  SIO_RCVALL,
                  &optval,
                  sizeof(optval),
                  NULL,
                  0,
                  &dwLen,
                  NULL,
                  NULL ) == SOCKET_ERROR )

	{
      exit(-3);
	}
Posted

You probably want to use RCVALL_IPLEVEL IOCTL option.

See here: http://msdn.microsoft.com/en-us/library/ee309610%28v=vs.85%29.aspx[^]
 
Share this answer
 
Comments
Member 7766180 26-Apr-11 15:03pm    
OK I tried it and it's coming up undefined.
if ( WSAIoctl( sniff_socket,
SIO_RCVALL_IPLEVEL,
&optval,
sizeof(optval),
NULL,
0,
&dwLen,
NULL,
NULL ) == SOCKET_ERROR )

{
Albert Holguin 26-Apr-11 17:53pm    
see my solution, he's been asking a lot of questions around winpcap...
Member 7766180 28-Apr-11 8:26am    
I added this header #include <mstcpip.h> and I'm still getting undefined for SIO_RCVALL_IPLEVEL
DS
Albert Holguin 28-Apr-11 15:10pm    
is this a reply to me or a comment for hans?
Member 7766180 28-Apr-11 17:53pm    
To Hans. Suggestions welcome though!
DS
since you're using winpcap, this is another filter option... like i've suggested before, get familiar with your filtering options. you really have to download and learn to use wireshark, this would allow you to see the capabilities of winpcap.

See dst host host:
http://www.mirrorservice.org/sites/ftp.wiretapped.net/pub/security/packet-capture/winpcap/docs/docs31/html/group__language.html[^]

...And here's the wireshark site:
http://www.wireshark.org/[^]

P.S. Not sure what you're trying to build, but it seems like you're trying to build wireshark. Maybe you need to stop and take the time to see what that tool has and if its something you can use.
 
Share this answer
 
v3
Comments
Hans Dietrich 26-Apr-11 22:45pm    
Good answer, my 5.
Albert Holguin 26-Apr-11 23:24pm    
thanks :)
Member 7766180 28-Apr-11 8:14am    
I'm trying to build a small application that will run under window services that will capture the Source IP and Packet ID of incoming packets only.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900