- if (libnet_write_link_layer(llif, Intf, pkt, sizeof(pkt)) < 0)
--- macof.c.orig 2009-09-09 00:01:27.000000000 +0200
+++ macof.c 2009-09-09 00:01:37.000000000 +0200
- *((in_addr_t *)mac) = libnet_get_prand(PRu32);
- *((u_short *)(mac + 4)) = libnet_get_prand(PRu16);
+ *((in_addr_t *)mac) = libnet_get_prand(LIBNET_PRu32);
+ *((u_short *)(mac + 4)) = libnet_get_prand(LIBNET_PRu16);
struct libnet_link_int *llif;
- char ebuf[PCAP_ERRBUF_SIZE];
+ char pcap_ebuf[PCAP_ERRBUF_SIZE];
+ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
u_char sha[ETHER_ADDR_LEN], tha[ETHER_ADDR_LEN];
- u_char pkt[ETH_H + IP_H + TCP_H];
while ((c = getopt(argc, argv, "vs:d:e:x:y:i:n:h?V")) != -1) {
- Src = libnet_name_resolve(optarg, 0);
+ Src = libnet_name2addr4(l, optarg, 0);
- Dst = libnet_name_resolve(optarg, 0);
+ Dst = libnet_name2addr4(l, optarg, 0);
Tha = (u_char *)ether_aton(optarg);
- if (!Intf && (Intf = pcap_lookupdev(ebuf)) == NULL)
+ if (!Intf && (Intf = pcap_lookupdev(pcap_ebuf)) == NULL)
+ errx(1, "%s", pcap_ebuf);
- if ((llif = libnet_open_link_interface(Intf, ebuf)) == 0)
+ if ((l = libnet_init(LIBNET_LINK, Intf, libnet_ebuf)) == NULL)
+ errx(1, "%s", libnet_ebuf);
for (i = 0; i != Repeat; i++) {
else memcpy(tha, Tha, sizeof(tha));