Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raw Ethernet Frames Using Winsock

I am porting a communications library from Linux to Windows. I know what my approach is for the most part. The library uses all raw ethernet level frames for all the communications.

The library I am porting from makes use of the PF_PACKET family and the struct sockaddr_ll. After browsing through the MSDN winsock site, I haven't found an equivalent family/struct. What should my approach be here?

I have a few ideas, but I am not sure if they are good ideas I could use PF_UNSPEC, for unspecified. I could just pass the number PF_PACKET represents (it's an unsigned short) I could also just make my own sockadddr_ll struct in Windows.

None of those ideas seem good to me, they just seem like hacks that aren't really likely to work.

If anyone has any suggestions, I would appreciate it.

like image 232
devin Avatar asked Apr 20 '09 04:04

devin


1 Answers

I assume you're referring to Raw Sockets (where you have to write the network layer, transport layer, and application layer information). New Windows versions (XP SP2 and up) have very limited support for raw sockets with many restrictions.

More info (scroll down to "Limitations on Raw Sockets")

The solution, I believe, is to use WinPcap, which allows you to send raw packets on those systems.

like image 176
Aziz Avatar answered Oct 12 '22 02:10

Aziz