struct tcp_header *tcp_hd; struct IPHeader *ip_hd; unsigned short int tcp_win; unsigned long int tcp_ack; int packet_len = ETH_HDRSIZE + IP_HDRSIZE + TCP_HDRSIZE; unsigned char *packet = (unsigned char *)malloc(packet_len); tcp_hd = (struct tcp_header *)(packet + ETH_HDRSIZE + IP_HDRSIZE); ip_hd = (struct ip_hd *)(packet + ETH_HDRSIZE + IP_HDRSIZE); ip_hd->iph_verlen = 4; ip_hd->iph_tos = 0; ip_hd->iph_id = htons(55555); ip_hd->iph_offset = htons(0x4000); ip_hd->iph_ttl = 128; ip_hd->iph_protocol = 6; ip_hd->iph_xsum = 0; ip_hd->iph_dest = inet_addr("192.168.0.1"); /* Set tcp header */ tcp_hd->tcp_src = htons(80); tcp_hd->tcp_dst = htons(80); tcp_hd->tcp_seq = htonl(tcp_ack + tcp_win); tcp_hd->tcp_ack = 0; tcp_hd->tcp_res = 0; tcp_hd->tcp_off = 5; tcp_hd->tcp_flags = TCP_RST; tcp_hd->tcp_win = 0; tcp_hd->tcp_sum = 0; tcp_hd->tcp_urp = 0;