/*
* send a raw ethernet frame
*/
#include //memcpy()
#include //strxxx()
#include //close()
#include //socket()
#include //htons()
#include //struct ifreq
#include //ETH_ALEN(6),ETH_HLEN(14),ETH_FRAME_LEN(1514),struct ethhdr
#include //struct sockaddr_ll
#include //ioctl()
union ethframe {
struct {
struct ethhdr header;
char data[ETH_DATA_LEN];
} field;
char buffer[ETH_FRAME_LEN];
};
int main(void)
{
char *iface = "ext1";
char dest[ETH_ALEN] = {0x00, 0x12, 0x34, 0x56, 0x78, 0x90};
short proto = 0x1234;
char *data = "hello world";
unsigned short data_len = strlen(data);
int s;
if ((s = socket(AF_PACKET, SOCK_RAW, htons(proto))) < 0) {