--- dnsspoof.c.orig 2009-09-08 23:45:30.000000000 +0200
+++ dnsspoof.c 2009-09-09 00:00:26.000000000 +0200
dns_init(char *dev, char *filename)
- struct libnet_link_int *llif;
+ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
char *ip, *name, buf[1024];
- if ((llif = libnet_open_link_interface(dev, buf)) == NULL)
+ if ((l = libnet_init(LIBNET_LINK, dev, libnet_ebuf)) == NULL)
+ errx(1, "%s", libnet_ebuf);
- if ((lnet_ip = libnet_get_ipaddr(llif, dev, buf)) == -1)
+ if ((lnet_ip = libnet_get_ipaddr4(l)) == -1)
+ errx(1, "%s", libnet_geterror(l));
- lnet_ip = htonl(lnet_ip);
- libnet_close_link_interface(llif);
SLIST_INIT(&dns_entries);
dns_spoof(u_char *u, const struct pcap_pkthdr *pkthdr, const u_char *pkt)
- struct libnet_ip_hdr *ip;
+ struct libnet_ipv4_hdr *ip;
struct libnet_udp_hdr *udp;
char name[MAXHOSTNAMELEN];
- ip = (struct libnet_ip_hdr *)(pkt + pcap_off);
+ ip = (struct libnet_ipv4_hdr *)(pkt + pcap_off);
udp = (struct libnet_udp_hdr *)(pkt + pcap_off + (ip->ip_hl * 4));
dns = (HEADER *)(udp + 1);
- p = buf + IP_H + UDP_H + dnslen;