Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Raw socket promiscuous mode

Posted on 2003-02-26
3
Medium Priority
?
2,610 Views
Last Modified: 2007-12-19
hi,

i have developped a piece of code that capture packets with raw sockets (winsock). But i want to switch reception mode between "normal" mode and promiscuous mode (using WSAIoctl with SIO_RCVALL_MCAST or SIO_RCVALL option). Is it possible to do that when the socket is already binded? i've already tried this solution:
...
DWORD   dwCode = RCVALL_OFF,
        dwValue = 0,
        dwBytes = 0;
// put off precedent sock option
status = WSAIoctl(sockRaw_, SIO_RCVALL_MCAST, &dwCode, sizeof(dwCode), NULL, 0, &dwBytes, NULL, NULL);
if (status == SOCKET_ERROR)
  TRACE("0x%x: SetPromiscuous(SIO_RCVALL_MCAST): WSAIoctl() failed: %d", GetCurrentThreadId(), WSAGetLastError());
dwCode = RCVALL_ON;
// set new sock option
status = WSAIoctl(sockRaw_, SIO_RCVALL, &dwCode, sizeof(dwCode), &dwValue, sizeof(dwValue), &dwBytes, NULL, NULL);
if (status == SOCKET_ERROR)
TRACE("0x%x: SetPromiscuous(SIO_RCVALL): WSAIoctl() failed: %d", GetCurrentThreadId(), WSAGetLastError());
...

It makes no error but does not work. i still receive mutlicast packets. Any suggestions??Is there an another way to do that?
0
Comment
Question by:matt31
3 Comments
 
LVL 2

Accepted Solution

by:
bkrahmer earned 153 total points
ID: 8026769
I don't know a lot about multicast packets, but what makes you think it isn't working properly?  MSDN states that SIO_RCVALL_MCAST will let you receive all mcast packets destined for the range of 224.0.0.0 to 239.255.255.255.  Are packets that you are seeing in this range?  Personally, I wouldn't worry about it.  If I wasn't interested in those packets, I would drop them and move on.
brian
0
 

Author Comment

by:matt31
ID: 8026876
ok thanks but it works really fine now, it was not due to my code but to an option on my network adapter card which wasn't set properly.
(FYI: in practical SIO_RCVALL_MCAST also let you receive packets destined to your own IP...)
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9846901
No comment has been added lately, so it's time to clean up this TA. I will
leave a recommendation in the Cleanup topic area that this question is:

Answered: Points to bkrahmer: Grade A

Please leave any comments here within the next seven days.

Experts: Silence means you don't care. Grading recommendations are made in light
of the posted grading guidlines (http://www.experts-exchange.com/help.jsp#hi73).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

-bcl (bcladd)
EE Cleanup Volunteer
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question