--- tcpkill.c.orig 2009-09-08 23:51:15.000000000 +0200
+++ tcpkill.c 2009-09-09 00:02:18.000000000 +0200
tcp_kill_cb(u_char *user, const struct pcap_pkthdr *pcap, const u_char *pkt)
- struct libnet_ip_hdr *ip;
+ struct libnet_ipv4_hdr *ip;
struct libnet_tcp_hdr *tcp;
- u_char ctext[64], buf[IP_H + TCP_H];
len = pcap->caplen - pcap_off;
- ip = (struct libnet_ip_hdr *)pkt;
+ ip = (struct libnet_ipv4_hdr *)pkt;
if (ip->ip_p != IPPROTO_TCP)
if (tcp->th_flags & (TH_SYN|TH_FIN|TH_RST))
- libnet_build_ip(TCP_H, 0, 0, 0, 64, IPPROTO_TCP,
- ip->ip_dst.s_addr, ip->ip_src.s_addr,
- libnet_build_tcp(ntohs(tcp->th_dport), ntohs(tcp->th_sport),
- 0, 0, TH_RST, 0, 0, NULL, 0, buf + IP_H);
seq = ntohl(tcp->th_ack);
win = ntohs(tcp->th_win);
snprintf(ctext, sizeof(ctext), "%s:%d > %s:%d:",
- libnet_host_lookup(ip->ip_src.s_addr, 0),
+ libnet_addr2name4(ip->ip_src.s_addr, LIBNET_DONT_RESOLVE),
- libnet_host_lookup(ip->ip_dst.s_addr, 0),
+ libnet_addr2name4(ip->ip_dst.s_addr, LIBNET_DONT_RESOLVE),
- ip = (struct libnet_ip_hdr *)buf;
- tcp = (struct libnet_tcp_hdr *)(ip + 1);
for (i = 0; i < Opt_severity; i++) {
- ip->ip_id = libnet_get_prand(PRu16);
- tcp->th_seq = htonl(seq);
- libnet_do_checksum(buf, IPPROTO_TCP, TCP_H);
+ libnet_clear_packet(l);
+ libnet_build_tcp(ntohs(tcp->th_dport), ntohs(tcp->th_sport),
+ seq, 0, TH_RST, 0, 0, 0, LIBNET_TCP_H,