| * (C)opyright 1992-1998 Darren Reed. (from tcplog) |
| * See the IPFILTER.LICENCE file for details on licencing. |
| #include <linux/netdevice.h> |
| #include <netinet/in_systm.h> |
| static const char sccsid[] = "@(#)slinux.c 1.2 8/25/95"; |
| static const char rcsid[] = "@(#)$Id$"; |
| #define BUFSPACE (4*CHUNKSIZE) |
| * Be careful to only include those defined in the flags option for the |
| * interface are included in the header size. |
| static char *eth_dev = NULL; |
| int initdevice(dev, spare) |
| if ((fd = socket(AF_INET, SOCK_PACKET, htons(ETHERTYPE_IP))) == -1) |
| perror("socket(SOCK_PACKET)"); |
| * output an IP packet onto a fd opened for /dev/nit |
| strncpy(ifr.ifr_name, eth_dev, sizeof(ifr.ifr_name)); |
| if (ioctl(fd, SIOCGIFHWADDR, &ifr) == -1) |
| bcopy(ifr.ifr_hwaddr.sa_data, pkt + 6, 6); |
| s.sa_family = ETHERTYPE_IP; |
| strncpy(s.sa_data, eth_dev, sizeof(s.sa_data)); |
| if (sendto(fd, pkt, len, 0, &s, sizeof(s)) == -1) |