version 1.1.1.1, 2012/02/21 22:14:23
|
version 1.1.1.2, 2013/07/22 11:54:41
|
Line 43 int
|
Line 43 int
|
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
{ |
{ |
int c; |
int c; |
u_int32_t i; | uint32_t i; |
libnet_t *l; |
libnet_t *l; |
libnet_ptag_t t; |
libnet_ptag_t t; |
char *device = NULL; |
char *device = NULL; |
u_int8_t *packet; | uint8_t *packet; |
u_int32_t packet_s; | uint32_t packet_s; |
char errbuf[LIBNET_ERRBUF_SIZE]; |
char errbuf[LIBNET_ERRBUF_SIZE]; |
|
|
printf("libnet 1.1 packet shaping: ARP[link -- autobuilding ethernet]\n"); |
printf("libnet 1.1 packet shaping: ARP[link -- autobuilding ethernet]\n"); |
Line 70 main(int argc, char *argv[])
|
Line 70 main(int argc, char *argv[])
|
} |
} |
else |
else |
|
|
/* |
|
* Build the packet, remmebering that order IS important. We must |
|
* build the packet from lowest protocol type on up as it would |
|
* appear on the wire. So for our ARP packet: |
|
* |
|
* ------------------------------------------- |
|
* | Ethernet | ARP | |
|
* ------------------------------------------- |
|
* ^ ^ |
|
* |------------------ | |
|
* libnet_build_ethernet()--| | |
|
* | |
|
* libnet_build_arp()-----------| |
|
*/ |
|
|
|
i = libnet_get_ipaddr4(l); |
i = libnet_get_ipaddr4(l); |
|
|
t = libnet_build_arp( |
t = libnet_build_arp( |
Line 94 main(int argc, char *argv[])
|
Line 79 main(int argc, char *argv[])
|
4, /* protocol addr size */ |
4, /* protocol addr size */ |
ARPOP_REPLY, /* operation type */ |
ARPOP_REPLY, /* operation type */ |
enet_src, /* sender hardware addr */ |
enet_src, /* sender hardware addr */ |
(u_int8_t *)&i, /* sender protocol addr */ | (uint8_t *)&i, /* sender protocol addr */ |
enet_dst, /* target hardware addr */ |
enet_dst, /* target hardware addr */ |
(u_int8_t *)&i, /* target protocol addr */ | (uint8_t *)&i, /* target protocol addr */ |
NULL, /* payload */ |
NULL, /* payload */ |
0, /* payload size */ |
0, /* payload size */ |
l, /* libnet context */ |
l, /* libnet context */ |