8f195e9
Patch for dsniff >= 2.4b1, which adds support for libnet >= 1.1 having a
8f195e9
completely rewritten API.
8f195e9
8f195e9
--- dsniff-2.4b1/arpspoof.c		2006-06-09 13:35:29.000000000 +0300
8f195e9
+++ dsniff-2.4b1/arpspoof.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -27,7 +27,7 @@
8f195e9
 
8f195e9
 extern char *ether_ntoa(struct ether_addr *);
8f195e9
 
8f195e9
-static struct libnet_link_int *llif;
8f195e9
+static libnet_t *l;
8f195e9
 static struct ether_addr spoof_mac, target_mac;
8f195e9
 static in_addr_t spoof_ip, target_ip;
8f195e9
 static char *intf;
8f195e9
@@ -41,47 +41,49 @@
8f195e9
 }
8f195e9
 
8f195e9
 static int
8f195e9
-arp_send(struct libnet_link_int *llif, char *dev,
8f195e9
-	 int op, u_char *sha, in_addr_t spa, u_char *tha, in_addr_t tpa)
8f195e9
+arp_send(libnet_t *l, int op, u_int8_t *sha,
8f195e9
+	 in_addr_t spa, u_int8_t *tha, in_addr_t tpa)
8f195e9
 {
8f195e9
-	char ebuf[128];
8f195e9
-	u_char pkt[60];
8f195e9
-	
8f195e9
+	int retval;
8f195e9
+
8f195e9
 	if (sha == NULL &&
8f195e9
-	    (sha = (u_char *)libnet_get_hwaddr(llif, dev, ebuf)) == NULL) {
8f195e9
+	    (sha = (u_int8_t *)libnet_get_hwaddr(l)) == NULL) {
8f195e9
 		return (-1);
8f195e9
 	}
8f195e9
 	if (spa == 0) {
8f195e9
-		if ((spa = libnet_get_ipaddr(llif, dev, ebuf)) == 0)
8f195e9
+		if ((spa = libnet_get_ipaddr4(l)) == -1)
8f195e9
 			return (-1);
8f195e9
-		spa = htonl(spa); /* XXX */
8f195e9
 	}
8f195e9
 	if (tha == NULL)
8f195e9
 		tha = "\xff\xff\xff\xff\xff\xff";
8f195e9
 	
8f195e9
-	libnet_build_ethernet(tha, sha, ETHERTYPE_ARP, NULL, 0, pkt);
8f195e9
+	libnet_autobuild_arp(op, sha, (u_int8_t *)&spa,
8f195e9
+			     tha, (u_int8_t *)&tpa, l);
8f195e9
+	libnet_build_ethernet(tha, sha, ETHERTYPE_ARP, NULL, 0, l, 0);
8f195e9
 	
8f195e9
-	libnet_build_arp(ARPHRD_ETHER, ETHERTYPE_IP, ETHER_ADDR_LEN, 4,
8f195e9
-			 op, sha, (u_char *)&spa, tha, (u_char *)&tpa,
8f195e9
-			 NULL, 0, pkt + ETH_H);
8f195e9
-
8f195e9
 	fprintf(stderr, "%s ",
8f195e9
 		ether_ntoa((struct ether_addr *)sha));
8f195e9
 
8f195e9
 	if (op == ARPOP_REQUEST) {
8f195e9
 		fprintf(stderr, "%s 0806 42: arp who-has %s tell %s\n",
8f195e9
 			ether_ntoa((struct ether_addr *)tha),
8f195e9
-			libnet_host_lookup(tpa, 0),
8f195e9
-			libnet_host_lookup(spa, 0));
8f195e9
+			libnet_addr2name4(tpa, LIBNET_DONT_RESOLVE),
8f195e9
+			libnet_addr2name4(spa, LIBNET_DONT_RESOLVE));
8f195e9
 	}
8f195e9
 	else {
8f195e9
 		fprintf(stderr, "%s 0806 42: arp reply %s is-at ",
8f195e9
 			ether_ntoa((struct ether_addr *)tha),
8f195e9
-			libnet_host_lookup(spa, 0));
8f195e9
+			libnet_addr2name4(spa, LIBNET_DONT_RESOLVE));
8f195e9
 		fprintf(stderr, "%s\n",
8f195e9
 			ether_ntoa((struct ether_addr *)sha));
8f195e9
 	}
8f195e9
-	return (libnet_write_link_layer(llif, dev, pkt, sizeof(pkt)) == sizeof(pkt));
8f195e9
+	retval = libnet_write(l);
8f195e9
+	if (retval)
8f195e9
+		fprintf(stderr, "%s", libnet_geterror(l));
8f195e9
+
8f195e9
+	libnet_clear_packet(l);
8f195e9
+
8f195e9
+	return retval;
8f195e9
 }
8f195e9
 
8f195e9
 #ifdef __linux__
8f195e9
@@ -119,7 +121,7 @@
8f195e9
 		/* XXX - force the kernel to arp. feh. */
8f195e9
 		arp_force(ip);
8f195e9
 #else
8f195e9
-		arp_send(llif, intf, ARPOP_REQUEST, NULL, 0, NULL, ip);
8f195e9
+		arp_send(l, ARPOP_REQUEST, NULL, 0, NULL, ip);
8f195e9
 #endif
8f195e9
 		sleep(1);
8f195e9
 	}
8f195e9
@@ -136,9 +138,9 @@
8f195e9
 	if (arp_find(spoof_ip, &spoof_mac)) {
8f195e9
 		for (i = 0; i < 3; i++) {
8f195e9
 			/* XXX - on BSD, requires ETHERSPOOF kernel. */
8f195e9
-			arp_send(llif, intf, ARPOP_REPLY,
8f195e9
-				 (u_char *)&spoof_mac, spoof_ip,
8f195e9
-				 (target_ip ? (u_char *)&target_mac : NULL),
8f195e9
+			arp_send(l, ARPOP_REPLY,
8f195e9
+				 (u_int8_t *)&spoof_mac, spoof_ip,
8f195e9
+				 (target_ip ? (u_int8_t *)&target_mac : NULL),
8f195e9
 				 target_ip);
8f195e9
 			sleep(1);
8f195e9
 		}
8f195e9
@@ -151,7 +153,8 @@
8f195e9
 {
8f195e9
 	extern char *optarg;
8f195e9
 	extern int optind;
8f195e9
-	char ebuf[PCAP_ERRBUF_SIZE];
8f195e9
+	char pcap_ebuf[PCAP_ERRBUF_SIZE];
8f195e9
+	char libnet_ebuf[LIBNET_ERRBUF_SIZE];
8f195e9
 	int c;
8f195e9
 	
8f195e9
 	intf = NULL;
8f195e9
@@ -163,7 +166,7 @@
8f195e9
 			intf = optarg;
8f195e9
 			break;
8f195e9
 		case 't':
8f195e9
-			if ((target_ip = libnet_name_resolve(optarg, 1)) == -1)
8f195e9
+			if ((target_ip = libnet_name2addr4(l, optarg, LIBNET_RESOLVE)) == -1)
8f195e9
 				usage();
8f195e9
 			break;
8f195e9
 		default:
8f195e9
@@ -176,26 +179,26 @@
8f195e9
 	if (argc != 1)
8f195e9
 		usage();
8f195e9
 	
8f195e9
-	if ((spoof_ip = libnet_name_resolve(argv[0], 1)) == -1)
8f195e9
+	if ((spoof_ip = libnet_name2addr4(l, argv[0], LIBNET_RESOLVE)) == -1)
8f195e9
 		usage();
8f195e9
 	
8f195e9
-	if (intf == NULL && (intf = pcap_lookupdev(ebuf)) == NULL)
8f195e9
-		errx(1, "%s", ebuf);
8f195e9
+	if (intf == NULL && (intf = pcap_lookupdev(pcap_ebuf)) == NULL)
8f195e9
+		errx(1, "%s", pcap_ebuf);
8f195e9
 	
8f195e9
-	if ((llif = libnet_open_link_interface(intf, ebuf)) == 0)
8f195e9
-		errx(1, "%s", ebuf);
8f195e9
+	if ((l = libnet_init(LIBNET_LINK, intf, libnet_ebuf)) == NULL)
8f195e9
+		errx(1, "%s", libnet_ebuf);
8f195e9
 	
8f195e9
 	if (target_ip != 0 && !arp_find(target_ip, &target_mac))
8f195e9
 		errx(1, "couldn't arp for host %s",
8f195e9
-		     libnet_host_lookup(target_ip, 0));
8f195e9
+		     libnet_addr2name4(target_ip, LIBNET_DONT_RESOLVE));
8f195e9
 	
8f195e9
 	signal(SIGHUP, cleanup);
8f195e9
 	signal(SIGINT, cleanup);
8f195e9
 	signal(SIGTERM, cleanup);
8f195e9
 	
8f195e9
 	for (;;) {
8f195e9
-		arp_send(llif, intf, ARPOP_REPLY, NULL, spoof_ip,
8f195e9
-			 (target_ip ? (u_char *)&target_mac : NULL),
8f195e9
+		arp_send(l, ARPOP_REPLY, NULL, spoof_ip,
8f195e9
+			 (target_ip ? (u_int8_t *)&target_mac : NULL),
8f195e9
 			 target_ip);
8f195e9
 		sleep(2);
8f195e9
 	}
8f195e9
--- dsniff-2.4b1/dnsspoof.c		2001-03-15 10:33:03.000000000 +0200
8f195e9
+++ dsniff-2.4b1/dnsspoof.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -38,7 +38,7 @@
8f195e9
 
8f195e9
 pcap_t		*pcap_pd = NULL;
8f195e9
 int		 pcap_off = -1;
8f195e9
-int		 lnet_sock = -1;
8f195e9
+libnet_t	*l;
8f195e9
 u_long		 lnet_ip = -1;
8f195e9
 
8f195e9
 static void
8f195e9
@@ -90,19 +90,18 @@
8f195e9
 dns_init(char *dev, char *filename)
8f195e9
 {
8f195e9
 	FILE *f;
8f195e9
-	struct libnet_link_int *llif;
8f195e9
+	libnet_t *l;
8f195e9
+	char libnet_ebuf[LIBNET_ERRBUF_SIZE];
8f195e9
 	struct dnsent *de;
8f195e9
 	char *ip, *name, buf[1024];
8f195e9
 
8f195e9
-	if ((llif = libnet_open_link_interface(dev, buf)) == NULL)
8f195e9
-		errx(1, "%s", buf);
8f195e9
+	if ((l = libnet_init(LIBNET_LINK, dev, libnet_ebuf)) == NULL)
8f195e9
+		errx(1, "%s", libnet_ebuf);
8f195e9
 	
8f195e9
-	if ((lnet_ip = libnet_get_ipaddr(llif, dev, buf)) == -1)
8f195e9
-		errx(1, "%s", buf);
8f195e9
+	if ((lnet_ip = libnet_get_ipaddr4(l)) == -1)
8f195e9
+		errx(1, "%s", libnet_geterror(l));
8f195e9
 
8f195e9
-	lnet_ip = htonl(lnet_ip);
8f195e9
-	
8f195e9
-	libnet_close_link_interface(llif);
8f195e9
+	libnet_destroy(l);
8f195e9
 
8f195e9
 	SLIST_INIT(&dns_entries);
8f195e9
 	
8f195e9
@@ -180,7 +179,7 @@
8f195e9
 static void
8f195e9
 dns_spoof(u_char *u, const struct pcap_pkthdr *pkthdr, const u_char *pkt)
8f195e9
 {
8f195e9
-	struct libnet_ip_hdr *ip;
8f195e9
+	struct libnet_ipv4_hdr *ip;
8f195e9
 	struct libnet_udp_hdr *udp;
8f195e9
 	HEADER *dns;
8f195e9
 	char name[MAXHOSTNAMELEN];
8f195e9
@@ -189,7 +188,7 @@
8f195e9
 	in_addr_t dst;
8f195e9
 	u_short type, class;
8f195e9
 
8f195e9
-	ip = (struct libnet_ip_hdr *)(pkt + pcap_off);
8f195e9
+	ip = (struct libnet_ipv4_hdr *)(pkt + pcap_off);
8f195e9
 	udp = (struct libnet_udp_hdr *)(pkt + pcap_off + (ip->ip_hl * 4));
8f195e9
 	dns = (HEADER *)(udp + 1);
8f195e9
 	p = (u_char *)(dns + 1);
8f195e9
@@ -212,7 +211,7 @@
8f195e9
 	if (class != C_IN)
8f195e9
 		return;
8f195e9
 
8f195e9
-	p = buf + IP_H + UDP_H + dnslen;
8f195e9
+	p = buf + dnslen;
8f195e9
 	
8f195e9
 	if (type == T_A) {
8f195e9
 		if ((dst = dns_lookup_a(name)) == -1)
8f195e9
@@ -234,38 +233,38 @@
8f195e9
 		anslen += 12;
8f195e9
 	}
8f195e9
 	else return;
8f195e9
-	
8f195e9
-	libnet_build_ip(UDP_H + dnslen + anslen, 0, libnet_get_prand(PRu16),
8f195e9
-			0, 64, IPPROTO_UDP, ip->ip_dst.s_addr,
8f195e9
-			ip->ip_src.s_addr, NULL, 0, buf);
8f195e9
-	
8f195e9
-	libnet_build_udp(ntohs(udp->uh_dport), ntohs(udp->uh_sport),
8f195e9
-			 NULL, dnslen + anslen, buf + IP_H);
8f195e9
 
8f195e9
-	memcpy(buf + IP_H + UDP_H, (u_char *)dns, dnslen);
8f195e9
+	memcpy(buf, (u_char *)dns, dnslen);
8f195e9
 
8f195e9
-	dns = (HEADER *)(buf + IP_H + UDP_H);
8f195e9
+	dns = (HEADER *)buf;
8f195e9
 	dns->qr = dns->ra = 1;
8f195e9
 	if (type == T_PTR) dns->aa = 1;
8f195e9
 	dns->ancount = htons(1);
8f195e9
 
8f195e9
 	dnslen += anslen;
8f195e9
+
8f195e9
+	libnet_clear_packet(l);
8f195e9
+	libnet_build_udp(ntohs(udp->uh_dport), ntohs(udp->uh_sport),
8f195e9
+			 LIBNET_UDP_H + dnslen, 0,
8f195e9
+			 (u_int8_t *)buf, dnslen, l, 0);
8f195e9
+
8f195e9
+	libnet_build_ipv4(LIBNET_IPV4_H + LIBNET_UDP_H + dnslen, 0,
8f195e9
+			  libnet_get_prand(LIBNET_PRu16), 0, 64, IPPROTO_UDP, 0,
8f195e9
+			  ip->ip_dst.s_addr, ip->ip_src.s_addr, NULL, 0, l, 0);
8f195e9
 	
8f195e9
-	libnet_do_checksum(buf, IPPROTO_UDP, UDP_H + dnslen);
8f195e9
-	
8f195e9
-	if (libnet_write_ip(lnet_sock, buf, IP_H + UDP_H + dnslen) < 0)
8f195e9
+	if (libnet_write(l) < 0)
8f195e9
 		warn("write");
8f195e9
 
8f195e9
 	fprintf(stderr, "%s.%d > %s.%d:  %d+ %s? %s\n",
8f195e9
-	      libnet_host_lookup(ip->ip_src.s_addr, 0), ntohs(udp->uh_sport),
8f195e9
-	      libnet_host_lookup(ip->ip_dst.s_addr, 0), ntohs(udp->uh_dport),
8f195e9
+	      libnet_addr2name4(ip->ip_src.s_addr, 0), ntohs(udp->uh_sport),
8f195e9
+	      libnet_addr2name4(ip->ip_dst.s_addr, 0), ntohs(udp->uh_dport),
8f195e9
 	      ntohs(dns->id), type == T_A ? "A" : "PTR", name);
8f195e9
 }
8f195e9
 
8f195e9
 static void
8f195e9
 cleanup(int sig)
8f195e9
 {
8f195e9
-	libnet_close_raw_sock(lnet_sock);
8f195e9
+	libnet_destroy(l);
8f195e9
 	pcap_close(pcap_pd);
8f195e9
 	exit(0);
8f195e9
 }
8f195e9
@@ -276,6 +275,7 @@
8f195e9
 	extern char *optarg;
8f195e9
 	extern int optind;
8f195e9
 	char *p, *dev, *hosts, buf[1024];
8f195e9
+	char ebuf[LIBNET_ERRBUF_SIZE];
8f195e9
 	int i;
8f195e9
 
8f195e9
 	dev = hosts = NULL;
8f195e9
@@ -306,7 +306,7 @@
8f195e9
 		strlcpy(buf, p, sizeof(buf));
8f195e9
 	}
8f195e9
 	else snprintf(buf, sizeof(buf), "udp dst port 53 and not src %s",
8f195e9
-		      libnet_host_lookup(lnet_ip, 0));
8f195e9
+		      libnet_addr2name4(lnet_ip, LIBNET_DONT_RESOLVE));
8f195e9
 	
8f195e9
 	if ((pcap_pd = pcap_init(dev, buf, 128)) == NULL)
8f195e9
 		errx(1, "couldn't initialize sniffing");
8f195e9
@@ -314,10 +314,10 @@
8f195e9
 	if ((pcap_off = pcap_dloff(pcap_pd)) < 0)
8f195e9
 		errx(1, "couldn't determine link layer offset");
8f195e9
 	
8f195e9
-	if ((lnet_sock = libnet_open_raw_sock(IPPROTO_RAW)) == -1)
8f195e9
+	if ((l = libnet_init(LIBNET_RAW4, dev, ebuf)) == NULL)
8f195e9
 		errx(1, "couldn't initialize sending");
8f195e9
 	
8f195e9
-	libnet_seed_prand();
8f195e9
+	libnet_seed_prand(l);
8f195e9
 	
8f195e9
 	signal(SIGHUP, cleanup);
8f195e9
 	signal(SIGINT, cleanup);
8f195e9
--- dsniff-2.4b1/filesnarf.c		2006-06-09 13:35:29.000000000 +0300
8f195e9
+++ dsniff-2.4b1/filesnarf.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -134,8 +134,8 @@
8f195e9
 	int fd;
8f195e9
 
8f195e9
 	warnx("%s.%d > %s.%d: %s (%d@%d)",
8f195e9
-	      libnet_host_lookup(addr->daddr, 0), addr->dest,
8f195e9
-	      libnet_host_lookup(addr->saddr, 0), addr->source,
8f195e9
+	      libnet_addr2name4(addr->daddr, LIBNET_DONT_RESOLVE), addr->dest,
8f195e9
+	      libnet_addr2name4(addr->saddr, LIBNET_DONT_RESOLVE), addr->source,
8f195e9
 	      ma->filename, len, ma->offset);
8f195e9
 	
8f195e9
 	if ((fd = open(ma->filename, O_WRONLY|O_CREAT, 0644)) >= 0) {
8f195e9
@@ -353,7 +353,7 @@
8f195e9
 }
8f195e9
 
8f195e9
 static void
8f195e9
-decode_udp_nfs(struct libnet_ip_hdr *ip)
8f195e9
+decode_udp_nfs(struct libnet_ipv4_hdr *ip)
8f195e9
 {
8f195e9
 	static struct tuple4 addr;
8f195e9
 	struct libnet_udp_hdr *udp;
8f195e9
--- dsniff-2.4b1/macof.c		2001-03-15 10:33:04.000000000 +0200
8f195e9
+++ dsniff-2.4b1/macof.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -48,8 +48,8 @@
8f195e9
 static void
8f195e9
 gen_mac(u_char *mac)
8f195e9
 {
8f195e9
-	*((in_addr_t *)mac) = libnet_get_prand(PRu32);
8f195e9
-	*((u_short *)(mac + 4)) = libnet_get_prand(PRu16);
8f195e9
+	*((in_addr_t *)mac) = libnet_get_prand(LIBNET_PRu32);
8f195e9
+	*((u_short *)(mac + 4)) = libnet_get_prand(LIBNET_PRu16);
8f195e9
 }
8f195e9
 
8f195e9
 int
8f195e9
@@ -59,22 +59,23 @@
8f195e9
 	extern int optind;
8f195e9
 	int c, i;
8f195e9
 	struct libnet_link_int *llif;
8f195e9
-	char ebuf[PCAP_ERRBUF_SIZE];
8f195e9
+	char pcap_ebuf[PCAP_ERRBUF_SIZE];
8f195e9
+	char libnet_ebuf[LIBNET_ERRBUF_SIZE];
8f195e9
 	u_char sha[ETHER_ADDR_LEN], tha[ETHER_ADDR_LEN];
8f195e9
 	in_addr_t src, dst;
8f195e9
 	u_short sport, dport;
8f195e9
 	u_int32_t seq;
8f195e9
-	u_char pkt[ETH_H + IP_H + TCP_H];
8f195e9
+	libnet_t *l;
8f195e9
 	
8f195e9
 	while ((c = getopt(argc, argv, "vs:d:e:x:y:i:n:h?V")) != -1) {
8f195e9
 		switch (c) {
8f195e9
 		case 'v':
8f195e9
 			break;
8f195e9
 		case 's':
8f195e9
-			Src = libnet_name_resolve(optarg, 0);
8f195e9
+			Src = libnet_name2addr4(l, optarg, 0);
8f195e9
 			break;
8f195e9
 		case 'd':
8f195e9
-			Dst = libnet_name_resolve(optarg, 0);
8f195e9
+			Dst = libnet_name2addr4(l, optarg, 0);
8f195e9
 			break;
8f195e9
 		case 'e':
8f195e9
 			Tha = (u_char *)ether_aton(optarg);
8f195e9
@@ -101,13 +102,13 @@
8f195e9
 	if (argc != 0)
8f195e9
 		usage();
8f195e9
 	
8f195e9
-	if (!Intf && (Intf = pcap_lookupdev(ebuf)) == NULL)
8f195e9
-		errx(1, "%s", ebuf);
8f195e9
+	if (!Intf && (Intf = pcap_lookupdev(pcap_ebuf)) == NULL)
8f195e9
+		errx(1, "%s", pcap_ebuf);
8f195e9
 	
8f195e9
-	if ((llif = libnet_open_link_interface(Intf, ebuf)) == 0)
8f195e9
-		errx(1, "%s", ebuf);
8f195e9
+	if ((l = libnet_init(LIBNET_LINK, Intf, libnet_ebuf)) == NULL)
8f195e9
+		errx(1, "%s", libnet_ebuf);
8f195e9
 	
8f195e9
-	libnet_seed_prand();
8f195e9
+	libnet_seed_prand(l);
8f195e9
 	
8f195e9
 	for (i = 0; i != Repeat; i++) {
8f195e9
 		
8f195e9
@@ -117,39 +118,39 @@
8f195e9
 		else memcpy(tha, Tha, sizeof(tha));
8f195e9
 		
8f195e9
 		if (Src != 0) src = Src;
8f195e9
-		else src = libnet_get_prand(PRu32);
8f195e9
+		else src = libnet_get_prand(LIBNET_PRu32);
8f195e9
 		
8f195e9
 		if (Dst != 0) dst = Dst;
8f195e9
-		else dst = libnet_get_prand(PRu32);
8f195e9
+		else dst = libnet_get_prand(LIBNET_PRu32);
8f195e9
 		
8f195e9
 		if (Sport != 0) sport = Sport;
8f195e9
-		else sport = libnet_get_prand(PRu16);
8f195e9
+		else sport = libnet_get_prand(LIBNET_PRu16);
8f195e9
 		
8f195e9
 		if (Dport != 0) dport = Dport;
8f195e9
-		else dport = libnet_get_prand(PRu16);
8f195e9
+		else dport = libnet_get_prand(LIBNET_PRu16);
8f195e9
 
8f195e9
-		seq = libnet_get_prand(PRu32);
8f195e9
-		
8f195e9
-		libnet_build_ethernet(tha, sha, ETHERTYPE_IP, NULL, 0, pkt);
8f195e9
-		
8f195e9
-		libnet_build_ip(TCP_H, 0, libnet_get_prand(PRu16), 0, 64,
8f195e9
-				IPPROTO_TCP, src, dst, NULL, 0, pkt + ETH_H);
8f195e9
+		seq = libnet_get_prand(LIBNET_PRu32);
8f195e9
 		
8f195e9
 		libnet_build_tcp(sport, dport, seq, 0, TH_SYN, 512,
8f195e9
-				 0, NULL, 0, pkt + ETH_H + IP_H);
8f195e9
+				 0, 0, LIBNET_TCP_H, NULL, 0, l, 0);
8f195e9
 		
8f195e9
-		libnet_do_checksum(pkt + ETH_H, IPPROTO_IP, IP_H);
8f195e9
-		libnet_do_checksum(pkt + ETH_H, IPPROTO_TCP, TCP_H);
8f195e9
+		libnet_build_ipv4(LIBNET_TCP_H, 0,
8f195e9
+				  libnet_get_prand(LIBNET_PRu16), 0, 64,
8f195e9
+				  IPPROTO_TCP, 0, src, dst, NULL, 0, l, 0);
8f195e9
 		
8f195e9
-		if (libnet_write_link_layer(llif, Intf, pkt, sizeof(pkt)) < 0)
8f195e9
+		libnet_build_ethernet(tha, sha, ETHERTYPE_IP, NULL, 0, l, 0);
8f195e9
+		
8f195e9
+		if (libnet_write(l) < 0)
8f195e9
 			errx(1, "write");
8f195e9
 
8f195e9
+		libnet_clear_packet(l);
8f195e9
+
8f195e9
 		fprintf(stderr, "%s ",
8f195e9
 			ether_ntoa((struct ether_addr *)sha));
8f195e9
 		fprintf(stderr, "%s %s.%d > %s.%d: S %u:%u(0) win 512\n",
8f195e9
 			ether_ntoa((struct ether_addr *)tha),
8f195e9
-			libnet_host_lookup(Src, 0), sport,
8f195e9
-			libnet_host_lookup(Dst, 0), dport, seq, seq);
8f195e9
+			libnet_addr2name4(Src, 0), sport,
8f195e9
+			libnet_addr2name4(Dst, 0), dport, seq, seq);
8f195e9
 	}
8f195e9
 	exit(0);
8f195e9
 }
8f195e9
--- dsniff-2.4b1/record.c		2001-03-15 10:33:04.000000000 +0200
8f195e9
+++ dsniff-2.4b1/record.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -65,8 +65,8 @@
8f195e9
 	tm = localtime(&rec->time);
8f195e9
 	strftime(tstr, sizeof(tstr), "%x %X", tm);
8f195e9
 	
8f195e9
-	srcp = libnet_host_lookup(rec->src, Opt_dns);
8f195e9
-	dstp = libnet_host_lookup(rec->dst, Opt_dns);
8f195e9
+	srcp = libnet_addr2name4(rec->src, Opt_dns);
8f195e9
+	dstp = libnet_addr2name4(rec->dst, Opt_dns);
8f195e9
 
8f195e9
 	if ((pr = getprotobynumber(rec->proto)) == NULL)
8f195e9
 		protop = "unknown";
8f195e9
--- dsniff-2.4b1/sshmitm.c		2001-03-15 10:33:04.000000000 +0200
8f195e9
+++ dsniff-2.4b1/sshmitm.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -389,7 +389,7 @@
8f195e9
 	if (argc < 1)
8f195e9
 		usage();
8f195e9
 	
8f195e9
-	if ((ip = libnet_name_resolve(argv[0], 1)) == -1)
8f195e9
+	if ((ip = libnet_name2addr4(NULL, argv[0], LIBNET_RESOLVE)) == -1)
8f195e9
 		usage();
8f195e9
 
8f195e9
 	if (argc == 2 && (rport = atoi(argv[1])) == 0)
8f195e9
--- dsniff-2.4b1/tcpkill.c		2001-03-17 10:10:43.000000000 +0200
8f195e9
+++ dsniff-2.4b1/tcpkill.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -39,17 +39,18 @@
8f195e9
 static void
8f195e9
 tcp_kill_cb(u_char *user, const struct pcap_pkthdr *pcap, const u_char *pkt)
8f195e9
 {
8f195e9
-	struct libnet_ip_hdr *ip;
8f195e9
+	struct libnet_ipv4_hdr *ip;
8f195e9
 	struct libnet_tcp_hdr *tcp;
8f195e9
-	u_char ctext[64], buf[IP_H + TCP_H];
8f195e9
+	u_char ctext[64];
8f195e9
 	u_int32_t seq, win;
8f195e9
-	int i, *sock, len;
8f195e9
+	int i, len;
8f195e9
+	libnet_t *l;
8f195e9
 
8f195e9
-	sock = (int *)user;
8f195e9
+	l = (libnet_t *)user;
8f195e9
 	pkt += pcap_off;
8f195e9
 	len = pcap->caplen - pcap_off;
8f195e9
 
8f195e9
-	ip = (struct libnet_ip_hdr *)pkt;
8f195e9
+	ip = (struct libnet_ipv4_hdr *)pkt;
8f195e9
 	if (ip->ip_p != IPPROTO_TCP)
8f195e9
 		return;
8f195e9
 	
8f195e9
@@ -57,34 +58,31 @@
8f195e9
 	if (tcp->th_flags & (TH_SYN|TH_FIN|TH_RST))
8f195e9
 		return;
8f195e9
 
8f195e9
-	libnet_build_ip(TCP_H, 0, 0, 0, 64, IPPROTO_TCP,
8f195e9
-			ip->ip_dst.s_addr, ip->ip_src.s_addr,
8f195e9
-			NULL, 0, buf);
8f195e9
-
8f195e9
-	libnet_build_tcp(ntohs(tcp->th_dport), ntohs(tcp->th_sport),
8f195e9
-			 0, 0, TH_RST, 0, 0, NULL, 0, buf + IP_H);
8f195e9
-	
8f195e9
 	seq = ntohl(tcp->th_ack);
8f195e9
 	win = ntohs(tcp->th_win);
8f195e9
 	
8f195e9
 	snprintf(ctext, sizeof(ctext), "%s:%d > %s:%d:",
8f195e9
-		 libnet_host_lookup(ip->ip_src.s_addr, 0),
8f195e9
+		 libnet_addr2name4(ip->ip_src.s_addr, LIBNET_DONT_RESOLVE),
8f195e9
 		 ntohs(tcp->th_sport),
8f195e9
-		 libnet_host_lookup(ip->ip_dst.s_addr, 0),
8f195e9
+		 libnet_addr2name4(ip->ip_dst.s_addr, LIBNET_DONT_RESOLVE),
8f195e9
 		 ntohs(tcp->th_dport));
8f195e9
 	
8f195e9
-	ip = (struct libnet_ip_hdr *)buf;
8f195e9
-	tcp = (struct libnet_tcp_hdr *)(ip + 1);
8f195e9
-	
8f195e9
 	for (i = 0; i < Opt_severity; i++) {
8f195e9
-		ip->ip_id = libnet_get_prand(PRu16);
8f195e9
 		seq += (i * win);
8f195e9
-		tcp->th_seq = htonl(seq);
8f195e9
 		
8f195e9
-		libnet_do_checksum(buf, IPPROTO_TCP, TCP_H);
8f195e9
+		libnet_clear_packet(l);
8f195e9
 		
8f195e9
-		if (libnet_write_ip(*sock, buf, sizeof(buf)) < 0)
8f195e9
-			warn("write_ip");
8f195e9
+		libnet_build_tcp(ntohs(tcp->th_dport), ntohs(tcp->th_sport),
8f195e9
+				 seq, 0, TH_RST, 0, 0, 0, LIBNET_TCP_H, 
8f195e9
+				 NULL, 0, l, 0);
8f195e9
+		
8f195e9
+		libnet_build_ipv4(LIBNET_IPV4_H + LIBNET_TCP_H, 0,
8f195e9
+				  libnet_get_prand(LIBNET_PRu16), 0, 64,
8f195e9
+				  IPPROTO_TCP, 0, ip->ip_dst.s_addr,
8f195e9
+				  ip->ip_src.s_addr, NULL, 0, l, 0);
8f195e9
+		
8f195e9
+		if (libnet_write(l) < 0)
8f195e9
+			warn("write");
8f195e9
 		
8f195e9
 		fprintf(stderr, "%s R %lu:%lu(0) win 0\n", ctext, seq, seq);
8f195e9
 	}
8f195e9
@@ -95,8 +93,10 @@
8f195e9
 {
8f195e9
 	extern char *optarg;
8f195e9
 	extern int optind;
8f195e9
-	int c, sock;
8f195e9
+	int c;
8f195e9
 	char *p, *intf, *filter, ebuf[PCAP_ERRBUF_SIZE];
8f195e9
+	char libnet_ebuf[LIBNET_ERRBUF_SIZE];
8f195e9
+	libnet_t *l;
8f195e9
 	pcap_t *pd;
8f195e9
 	
8f195e9
 	intf = NULL;
8f195e9
@@ -136,14 +136,14 @@
8f195e9
 	if ((pcap_off = pcap_dloff(pd)) < 0)
8f195e9
 		errx(1, "couldn't determine link layer offset");
8f195e9
 	
8f195e9
-	if ((sock = libnet_open_raw_sock(IPPROTO_RAW)) == -1)
8f195e9
+	if ((l = libnet_init(LIBNET_RAW4, intf, libnet_ebuf)) == NULL)
8f195e9
 		errx(1, "couldn't initialize sending");
8f195e9
 	
8f195e9
-	libnet_seed_prand();
8f195e9
+	libnet_seed_prand(l);
8f195e9
 	
8f195e9
 	warnx("listening on %s [%s]", intf, filter);
8f195e9
 	
8f195e9
-	pcap_loop(pd, -1, tcp_kill_cb, (u_char *)&sock);
8f195e9
+	pcap_loop(pd, -1, tcp_kill_cb, (u_char *)l);
8f195e9
   
8f195e9
 	/* NOTREACHED */
8f195e9
 	
8f195e9
--- dsniff-2.4b1/tcpnice.c		2001-03-17 09:41:51.000000000 +0200
8f195e9
+++ dsniff-2.4b1/tcpnice.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -41,107 +41,106 @@
8f195e9
 }
8f195e9
 
8f195e9
 static void
8f195e9
-send_tcp_window_advertisement(int sock, struct libnet_ip_hdr *ip,
8f195e9
+send_tcp_window_advertisement(libnet_t *l, struct libnet_ipv4_hdr *ip,
8f195e9
 			     struct libnet_tcp_hdr *tcp)
8f195e9
 {
8f195e9
 	int len;
8f195e9
 	
8f195e9
 	ip->ip_hl = 5;
8f195e9
-	ip->ip_len = htons(IP_H + TCP_H);
8f195e9
-	ip->ip_id = libnet_get_prand(PRu16);
8f195e9
-	memcpy(buf, (u_char *)ip, IP_H);
8f195e9
+	ip->ip_len = htons(LIBNET_IPV4_H + LIBNET_TCP_H);
8f195e9
+	ip->ip_id = libnet_get_prand(LIBNET_PRu16);
8f195e9
+	memcpy(buf, (u_char *)ip, LIBNET_IPV4_H);
8f195e9
 	
8f195e9
 	tcp->th_off = 5;
8f195e9
 	tcp->th_win = htons(MIN_WIN);
8f195e9
-	memcpy(buf + IP_H, (u_char *)tcp, TCP_H);
8f195e9
+	memcpy(buf + LIBNET_IPV4_H, (u_char *)tcp, LIBNET_TCP_H);
8f195e9
 	
8f195e9
-	libnet_do_checksum(buf, IPPROTO_TCP, TCP_H);
8f195e9
+	libnet_do_checksum(l, buf, IPPROTO_TCP, LIBNET_TCP_H);
8f195e9
 	
8f195e9
-	len = IP_H + TCP_H;
8f195e9
+	len = LIBNET_IPV4_H + LIBNET_TCP_H;
8f195e9
 	
8f195e9
-	if (libnet_write_ip(sock, buf, len) != len)
8f195e9
+	if (libnet_write_raw_ipv4(l, buf, len) != len)
8f195e9
 		warn("write");
8f195e9
 	
8f195e9
 	fprintf(stderr, "%s:%d > %s:%d: . ack %lu win %d\n",
8f195e9
-		libnet_host_lookup(ip->ip_src.s_addr, 0), ntohs(tcp->th_sport),
8f195e9
-		libnet_host_lookup(ip->ip_dst.s_addr, 0), ntohs(tcp->th_dport),
8f195e9
+		libnet_addr2name4(ip->ip_src.s_addr, 0), ntohs(tcp->th_sport),
8f195e9
+		libnet_addr2name4(ip->ip_dst.s_addr, 0), ntohs(tcp->th_dport),
8f195e9
 		ntohl(tcp->th_ack), 1);
8f195e9
 }
8f195e9
 
8f195e9
 static void
8f195e9
-send_icmp_source_quench(int sock, struct libnet_ip_hdr *ip)
8f195e9
+send_icmp_source_quench(libnet_t *l, struct libnet_ipv4_hdr *ip)
8f195e9
 {
8f195e9
-	struct libnet_icmp_hdr *icmp;
8f195e9
+	struct libnet_icmpv4_hdr *icmp;
8f195e9
 	int len;
8f195e9
 	
8f195e9
 	len = (ip->ip_hl * 4) + 8;
8f195e9
 
8f195e9
-	libnet_build_ip(ICMP_ECHO_H + len, 0, libnet_get_prand(PRu16),
8f195e9
-			0, 64, IPPROTO_ICMP, ip->ip_dst.s_addr,
8f195e9
-			ip->ip_src.s_addr, NULL, 0, buf);
8f195e9
-	
8f195e9
-	icmp = (struct libnet_icmp_hdr *)(buf + IP_H);
8f195e9
+	icmp = (struct libnet_icmpv4_hdr *)(buf + LIBNET_IPV4_H);
8f195e9
 	icmp->icmp_type = ICMP_SOURCEQUENCH;
8f195e9
 	icmp->icmp_code = 0;
8f195e9
-	memcpy((u_char *)icmp + ICMP_ECHO_H, (u_char *)ip, len);
8f195e9
+	memcpy((u_char *)icmp + LIBNET_ICMPV4_ECHO_H, (u_char *)ip, len);
8f195e9
 	
8f195e9
-	libnet_do_checksum(buf, IPPROTO_ICMP, ICMP_ECHO_H + len);
8f195e9
+	len += LIBNET_ICMPV4_ECHO_H;
8f195e9
 	
8f195e9
-	len += (IP_H + ICMP_ECHO_H);
8f195e9
+	libnet_build_ipv4(LIBNET_IPV4_H + len, 0,
8f195e9
+			  libnet_get_prand(LIBNET_PRu16), 0, 64, IPPROTO_ICMP,
8f195e9
+			  0, ip->ip_dst.s_addr, ip->ip_src.s_addr,
8f195e9
+			  (u_int8_t *) icmp, len, l, 0);
8f195e9
 	
8f195e9
-	if (libnet_write_ip(sock, buf, len) != len)
8f195e9
+	if (libnet_write(l) != len)
8f195e9
 		warn("write");
8f195e9
 	
8f195e9
 	fprintf(stderr, "%s > %s: icmp: source quench\n",
8f195e9
-		libnet_host_lookup(ip->ip_dst.s_addr, 0),
8f195e9
-		libnet_host_lookup(ip->ip_src.s_addr, 0));
8f195e9
+		libnet_addr2name4(ip->ip_dst.s_addr, 0),
8f195e9
+		libnet_addr2name4(ip->ip_src.s_addr, 0));
8f195e9
 }
8f195e9
 
8f195e9
 static void
8f195e9
-send_icmp_frag_needed(int sock, struct libnet_ip_hdr *ip)
8f195e9
+send_icmp_frag_needed(libnet_t *l, struct libnet_ipv4_hdr *ip)
8f195e9
 {
8f195e9
-	struct libnet_icmp_hdr *icmp;
8f195e9
+	struct libnet_icmpv4_hdr *icmp;
8f195e9
 	int len;
8f195e9
 
8f195e9
 	len = (ip->ip_hl * 4) + 8;
8f195e9
 	
8f195e9
-	libnet_build_ip(ICMP_MASK_H + len, 4, libnet_get_prand(PRu16),
8f195e9
-			0, 64, IPPROTO_ICMP, ip->ip_dst.s_addr,
8f195e9
-			ip->ip_src.s_addr, NULL, 0, buf);
8f195e9
-
8f195e9
-	icmp = (struct libnet_icmp_hdr *)(buf + IP_H);
8f195e9
+	icmp = (struct libnet_icmpv4_hdr *)(buf + LIBNET_IPV4_H);
8f195e9
 	icmp->icmp_type = ICMP_UNREACH;
8f195e9
 	icmp->icmp_code = ICMP_UNREACH_NEEDFRAG;
8f195e9
 	icmp->hun.frag.pad = 0;
8f195e9
 	icmp->hun.frag.mtu = htons(MIN_MTU);
8f195e9
-	memcpy((u_char *)icmp + ICMP_MASK_H, (u_char *)ip, len);
8f195e9
+	memcpy((u_char *)icmp + LIBNET_ICMPV4_MASK_H, (u_char *)ip, len);
8f195e9
 
8f195e9
-	libnet_do_checksum(buf, IPPROTO_ICMP, ICMP_MASK_H + len);
8f195e9
-	
8f195e9
-	len += (IP_H + ICMP_MASK_H);
8f195e9
+	len += LIBNET_ICMPV4_MASK_H;
8f195e9
+
8f195e9
+	libnet_build_ipv4(LIBNET_IPV4_H + len, 4,
8f195e9
+			  libnet_get_prand(LIBNET_PRu16), 0, 64, IPPROTO_ICMP,
8f195e9
+			  0, ip->ip_dst.s_addr, ip->ip_src.s_addr,
8f195e9
+			  (u_int8_t *) icmp, len, l, 0);
8f195e9
 	
8f195e9
-	if (libnet_write_ip(sock, buf, len) != len)
8f195e9
+	if (libnet_write(l) != len)
8f195e9
 		warn("write");
8f195e9
 	
8f195e9
 	fprintf(stderr, "%s > %s: icmp: ",
8f195e9
-		libnet_host_lookup(ip->ip_dst.s_addr, 0),
8f195e9
-		libnet_host_lookup(ip->ip_src.s_addr, 0));
8f195e9
+		libnet_addr2name4(ip->ip_dst.s_addr, 0),
8f195e9
+		libnet_addr2name4(ip->ip_src.s_addr, 0));
8f195e9
 	fprintf(stderr, "%s unreachable - need to frag (mtu %d)\n",
8f195e9
-		libnet_host_lookup(ip->ip_src.s_addr, 0), MIN_MTU);
8f195e9
+		libnet_addr2name4(ip->ip_src.s_addr, 0), MIN_MTU);
8f195e9
 }
8f195e9
 
8f195e9
 static void
8f195e9
 tcp_nice_cb(u_char *user, const struct pcap_pkthdr *pcap, const u_char *pkt)
8f195e9
 {
8f195e9
-	struct libnet_ip_hdr *ip;
8f195e9
+	struct libnet_ipv4_hdr *ip;
8f195e9
 	struct libnet_tcp_hdr *tcp;
8f195e9
-	int *sock, len;
8f195e9
+	int len;
8f195e9
+	libnet_t *l;
8f195e9
 
8f195e9
-	sock = (int *)user;
8f195e9
+	l = (libnet_t *)user;
8f195e9
 	pkt += pcap_off;
8f195e9
 	len = pcap->caplen - pcap_off;
8f195e9
 
8f195e9
-	ip = (struct libnet_ip_hdr *)pkt;
8f195e9
+	ip = (struct libnet_ipv4_hdr *)pkt;
8f195e9
 	if (ip->ip_p != IPPROTO_TCP)
8f195e9
 		return;
8f195e9
 	
8f195e9
@@ -151,11 +150,11 @@
8f195e9
 	
8f195e9
 	if (ntohs(ip->ip_len) > (ip->ip_hl << 2) + (tcp->th_off << 2)) {
8f195e9
 		if (Opt_icmp)
8f195e9
-			send_icmp_source_quench(*sock, ip);
8f195e9
+			send_icmp_source_quench(l, ip);
8f195e9
 		if (Opt_win)
8f195e9
-			send_tcp_window_advertisement(*sock, ip, tcp);
8f195e9
+			send_tcp_window_advertisement(l, ip, tcp);
8f195e9
 		if (Opt_pmtu)
8f195e9
-			send_icmp_frag_needed(*sock, ip);
8f195e9
+			send_icmp_frag_needed(l, ip);
8f195e9
 	}
8f195e9
 }
8f195e9
 
8f195e9
@@ -164,8 +163,10 @@
8f195e9
 {
8f195e9
 	extern char *optarg;
8f195e9
 	extern int optind;
8f195e9
-	int c, sock;
8f195e9
+	int c;
8f195e9
 	char *intf, *filter, ebuf[PCAP_ERRBUF_SIZE];
8f195e9
+	char libnet_ebuf[LIBNET_ERRBUF_SIZE];
8f195e9
+	libnet_t *l;
8f195e9
 	pcap_t *pd;
8f195e9
 	
8f195e9
 	intf = NULL;
8f195e9
@@ -209,14 +210,14 @@
8f195e9
 	if ((pcap_off = pcap_dloff(pd)) < 0)
8f195e9
 		errx(1, "couldn't determine link layer offset");
8f195e9
 	
8f195e9
-	if ((sock = libnet_open_raw_sock(IPPROTO_RAW)) == -1)
8f195e9
+	if ((l = libnet_init(LIBNET_RAW4, intf, libnet_ebuf)) == NULL)
8f195e9
 		errx(1, "couldn't initialize sending");
8f195e9
 	
8f195e9
-	libnet_seed_prand();
8f195e9
+	libnet_seed_prand(l);
8f195e9
 	
8f195e9
 	warnx("listening on %s [%s]", intf, filter);
8f195e9
 	
8f195e9
-	pcap_loop(pd, -1, tcp_nice_cb, (u_char *)&sock);
8f195e9
+	pcap_loop(pd, -1, tcp_nice_cb, (u_char *)l);
8f195e9
 	
8f195e9
 	/* NOTREACHED */
8f195e9
 	
8f195e9
--- dsniff-2.4b1/tcp_raw.c		2001-03-15 10:33:04.000000000 +0200
8f195e9
+++ dsniff-2.4b1/tcp_raw.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -119,7 +119,7 @@
8f195e9
 }
8f195e9
 
8f195e9
 struct iovec *
8f195e9
-tcp_raw_input(struct libnet_ip_hdr *ip, struct libnet_tcp_hdr *tcp, int len)
8f195e9
+tcp_raw_input(struct libnet_ipv4_hdr *ip, struct libnet_tcp_hdr *tcp, int len)
8f195e9
 {
8f195e9
 	struct tha tha;
8f195e9
 	struct tcp_conn *conn;
8f195e9
@@ -131,7 +131,7 @@
8f195e9
 
8f195e9
 	/* Verify TCP checksum. */
8f195e9
 	cksum = tcp->th_sum;
8f195e9
-	libnet_do_checksum((u_char *) ip, IPPROTO_TCP, len);
8f195e9
+	libnet_do_checksum(NULL, (u_char *) ip, IPPROTO_TCP, len);
8f195e9
 
8f195e9
 	if (cksum != tcp->th_sum)
8f195e9
 		return (NULL);
8f195e9
--- dsniff-2.4b1/tcp_raw.h		2001-03-15 10:33:06.000000000 +0200
8f195e9
+++ dsniff-2.4b1/tcp_raw.h.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -15,7 +15,7 @@
8f195e9
 				   u_short sport, u_short dport,
8f195e9
 				   u_char *buf, int len);
8f195e9
 
8f195e9
-struct iovec   *tcp_raw_input(struct libnet_ip_hdr *ip,
8f195e9
+struct iovec   *tcp_raw_input(struct libnet_ipv4_hdr *ip,
8f195e9
 			      struct libnet_tcp_hdr *tcp, int len);
8f195e9
 
8f195e9
 void		tcp_raw_timeout(int timeout, tcp_raw_callback_t callback);
8f195e9
--- dsniff-2.4b1/trigger.c		2001-03-15 10:33:05.000000000 +0200
8f195e9
+++ dsniff-2.4b1/trigger.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -276,7 +276,7 @@
8f195e9
 }
8f195e9
 	
8f195e9
 void
8f195e9
-trigger_ip(struct libnet_ip_hdr *ip)
8f195e9
+trigger_ip(struct libnet_ipv4_hdr *ip)
8f195e9
 {
8f195e9
 	struct trigger *t, tr;
8f195e9
 	u_char *buf;
8f195e9
@@ -305,7 +305,7 @@
8f195e9
 
8f195e9
 /* libnids needs a nids_register_udp()... */
8f195e9
 void
8f195e9
-trigger_udp(struct libnet_ip_hdr *ip)
8f195e9
+trigger_udp(struct libnet_ipv4_hdr *ip)
8f195e9
 {
8f195e9
 	struct trigger *t, tr;
8f195e9
 	struct libnet_udp_hdr *udp;
8f195e9
@@ -437,7 +437,7 @@
8f195e9
 }
8f195e9
 
8f195e9
 void
8f195e9
-trigger_tcp_raw(struct libnet_ip_hdr *ip)
8f195e9
+trigger_tcp_raw(struct libnet_ipv4_hdr *ip)
8f195e9
 {
8f195e9
 	struct trigger *t, tr;
8f195e9
 	struct libnet_tcp_hdr *tcp;
8f195e9
--- dsniff-2.4b1/trigger.h		2001-03-15 10:33:06.000000000 +0200
8f195e9
+++ dsniff-2.4b1/trigger.h.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -24,10 +24,10 @@
8f195e9
 int	trigger_set_tcp(int port, char *name);
8f195e9
 int	trigger_set_rpc(int program, char *name);
8f195e9
 
8f195e9
-void	trigger_ip(struct libnet_ip_hdr *ip);
8f195e9
-void	trigger_udp(struct libnet_ip_hdr *ip);
8f195e9
+void	trigger_ip(struct libnet_ipv4_hdr *ip);
8f195e9
+void	trigger_udp(struct libnet_ipv4_hdr *ip);
8f195e9
 void	trigger_tcp(struct tcp_stream *ts, void **conn_save);
8f195e9
-void	trigger_tcp_raw(struct libnet_ip_hdr *ip);
8f195e9
+void	trigger_tcp_raw(struct libnet_ipv4_hdr *ip);
8f195e9
 void	trigger_tcp_raw_timeout(int signal);
8f195e9
 void	trigger_rpc(int program, int proto, int port);
8f195e9
 
8f195e9
--- dsniff-2.4b1/urlsnarf.c		2006-06-09 13:35:29.000000000 +0300
8f195e9
+++ dsniff-2.4b1/urlsnarf.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -145,14 +145,14 @@
8f195e9
 		if (user == NULL)
8f195e9
 			user = "-";
8f195e9
 		if (vhost == NULL)
8f195e9
-			vhost = libnet_host_lookup(addr->daddr, Opt_dns);
8f195e9
+			vhost = libnet_addr2name4(addr->daddr, Opt_dns);
8f195e9
 		if (referer == NULL)
8f195e9
 			referer = "-";
8f195e9
 		if (agent == NULL)
8f195e9
 			agent = "-";
8f195e9
 		
8f195e9
 		printf("%s - %s [%s] \"%s http://%s%s\" - - \"%s\" \"%s\"\n",
8f195e9
-		       libnet_host_lookup(addr->saddr, Opt_dns),
8f195e9
+		       libnet_addr2name4(addr->saddr, Opt_dns),
8f195e9
 		       user, timestamp(), req, vhost, uri, referer, agent);
8f195e9
 	}
8f195e9
 	fflush(stdout);
8f195e9
--- dsniff-2.4b1/webmitm.c		2001-03-17 10:35:05.000000000 +0200
8f195e9
+++ dsniff-2.4b1/webmitm.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -242,7 +242,7 @@
8f195e9
 			word = buf_tok(&msg, "/", 1);
8f195e9
 			vhost = buf_strdup(word);
8f195e9
 		}
8f195e9
-		ssin.sin_addr.s_addr = libnet_name_resolve(vhost, 1);
8f195e9
+		ssin.sin_addr.s_addr = libnet_name2addr4(NULL, vhost, 1);
8f195e9
 		free(vhost);
8f195e9
 		
8f195e9
 		if (ssin.sin_addr.s_addr == ntohl(INADDR_LOOPBACK) ||
8f195e9
@@ -510,7 +510,7 @@
8f195e9
 	argv += optind;
8f195e9
 
8f195e9
 	if (argc == 1) {
8f195e9
-		if ((static_host = libnet_name_resolve(argv[0], 1)) == -1)
8f195e9
+		if ((static_host = libnet_name2addr4(NULL, argv[0], 1)) == -1)
8f195e9
 			usage();
8f195e9
 	}
8f195e9
 	else if (argc != 0) usage();
8f195e9
--- dsniff-2.4b1/webspy.c		2006-06-09 13:35:29.000000000 +0300
8f195e9
+++ dsniff-2.4b1/webspy.c.libnet_11	2006-06-09 13:35:29.000000000 +0300
8f195e9
@@ -126,7 +126,7 @@
8f195e9
 		if (auth == NULL)
8f195e9
 			auth = "";
8f195e9
 		if (vhost == NULL)
8f195e9
-			vhost = libnet_host_lookup(addr->daddr, 0);
8f195e9
+			vhost = libnet_addr2name4(addr->daddr, 0);
8f195e9
 		
8f195e9
 		snprintf(cmd, sizeof(cmd), "openURL(http://%s%s%s%s)",
8f195e9
 			 auth, *auth ? "@" : "", vhost, uri);
8f195e9
@@ -205,7 +205,7 @@
8f195e9
 	cmdtab[0] = cmd;
8f195e9
 	cmdtab[1] = NULL;
8f195e9
 	
8f195e9
-	if ((host = libnet_name_resolve(argv[0], 1)) == -1)
8f195e9
+	if ((host = libnet_name2addr4(NULL, argv[0], 1)) == -1)
8f195e9
 		errx(1, "unknown host");
8f195e9
 	
8f195e9
 	if ((dpy = XOpenDisplay(NULL)) == NULL)