Create socket to send and receive arp packets - Freebsd

Kristof Provost kristof at sigsegv.be
Sun Apr 10 17:56:47 UTC 2016


> On 10 Apr 2016, at 10:00, Wafa Hamzah <wafah at mellanox.com> wrote:
> 
> Hi,
> 
> We are trying to send arp requests from user space using a RAW socket.
> Our Linux reference suggest the following flags when creating the socket: s  = socket (PF_PACKET, SOCK_PACKET, htons(ETH_P_ARP))).
> For FreeBSD support, we replaced PF_PACKET with PF_ARP , SOCK_PACKET with SOCK_RAW and htons(ETH_P_ARP) with  ETHERTYPE_ARP Which resulted in a failure to create the socket (the return code was -1).
> 
> Please advise,
I’d start by looking at ‘errno’, because that’ll tell you a little more.
It should give you a better indication of why the call fails.

It might also be useful to reduce the code to the bare minimum required
to reproduce your problem. Not only will that often help you to find the problem
it also makes it easier to post the code, which is the next step in helping you.

Regards,
Kristof


More information about the freebsd-net mailing list