sample dnet code int send_ack(u_char *data) { struct ip_hdr *ip; struct tcp_hdr *tcp; u_char buf[40]; ip_t *ipdev; ip = (struct ip_hdr *)data; tcp = (struct tcp_hdr *)(data + ip->ip_off + IP_HDR_LEN); tcp_pack_hdr (buf + IP_HDR_LEN, tcp->th_dport, tcp->th_sport, rand(), tcp->th_seq + 1, 1024, TH_SYN + TH_ACK, NULL); ip_pack_hdr (buf, 0x10, IP_HDR_LEN, arc4random() ^ 0xFFFFFFFF, 0, 64, IP_PROTO_TCP, ip->ip_dst, ip->ip_src); ipdev = ip_open(); (void)ip_send (ipdev, buf, sizeof(buf)); ip_close (ipdev); return (1); } int main(int argc, char **argv) { ... send_ack("foobar"); }