The HyperNews Linux KHG Discussion Pages

## See Ethernet-HOWTO section 3.7.16

  Forum: Device Driver Basics
  Re: How to bypass the TCP/IP stack and access raw ethernet (Ritvik Pandey)
  Keywords: raw ethernet
  Date: Thu, 07 Aug 1997 15:00:34 GMT
  From: Lee, Seung-dong <sdlee@hexa.snu.ac.kr>

Ethernet-HOWTO ... 3.7.16. Access to the raw Ethernet Device
      How do I get access to the raw ethernet device in linux, without going
      through TCP/IP and friends?
      ______________________________________________________________________
              int s=socket(AF_INET,SOCK_PACKET,htons(ETH_P_ALL));
      ______________________________________________________________________
      This gives you a socket receiving every protocol type.  Do recvfrom()
      calls to it and it will fill the sockaddr with device type in
      sa_family and the device name in the sa_data array. I don't know who
      originally invented SOCK_PACKET for Linux (its been in for ages) but
      its superb stuff.  You can use it to send stuff raw too via sendto()
      calls.  You have to have root access to do either of course.
...