how to port linux raw socket to FreeBSD

I wrote a linux raw socket code that can send and recieve file by network interface directly without ip.how can I port it into Freebsd
there is no "ETH_P_ALL" macro and "struct sockaddr_ll" defined in Freebsd.what can intead of them in Freebsd.I also attached all of the source code that can make directly in linux.
 

Attachments

  • src_linux.zip
    4.6 KB · Views: 33
Of course you can program in raw sockets with FreeBSD, your only issue is with all the linux-isms you've possibly included in your code.
A quick glance sees quite a bit, so get busy with judicious use of #ifdef et al.
Hint: sys/sockio.h is very useful.
I have no idea about ETH_P_ALL, btw. I don't know what it does and what Linux exposes for it.
 

SirDice

Administrator
Staff member
Administrator
Moderator
While you are certainly porting code, this isn't about creating a new port for the FreeBSD ports system. Thread moved from "Porting new software" to "Userland Programming and scripting". Your question seems to fit that category better, you might get some extra views from coders.
 
Top