Creating raw ARP packet

B. James Phillippe (bryan@terran.org)
Fri, 9 Oct 1998 20:54:56 -0700 (PDT)


Hello Gurus,

I could really use some help. I'm working on a program that needs
to create an ARP packet from user-space. Would anyone mind to point me in
the right direction? I have been looking through the kernel code but I'm a
bit lost. I'm trying to do this (pseudo code):

sockfd = socket( AF_INET, SOCK_RAW, IPPROTO_RAW );
setsockopt( sockfd, SOL_SOCKET, SO_DONTROUTE, blah, blah );

/* Builds frame with ARP flag, etc */
build_packet( including ethernet header );

send( sockfd, packet, 42, 0 );

The call the send() returns -EINVAL. I've tried using IPPROTO_IP and
IP_HDRINCL instead for the setsockopt(), but it made no difference.
Clearly I'm doing something (majorly) wrong. Can anyone help me out?

thanks,
-bp

--
B. James Phillippe	. bryan@terran.org
UNIX Software Engineer	. http://www.terran.org/~bryan
Member since 1.1.59	. finger:bryan@earth.terran.org
MOTM: Waiting for the DSL to go in :)

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/