熟悉tcp的都知道,在connect时候,有三次握手过程。也就是所谓的[SYN] [SYN+ACK] [ACK],在目的主机收到syn后,会回复一个确认包,但是若是我源主机ip并不存在,那么并不能返回三次握手中的[ACK]包,导致目标主机不断为到来的连接分配资源,这样,只要源主机不断发送SYN报文,伪造大量的ip地址,目的主机最终将会由于资源耗尽而崩溃。
/************************************************************************/
/* synFlood.h */
/* 2013-3-18 */
/************************************************************************/
typedef unsigned short ushort;
typedef unsigned long ulong;
typedef unsigned int uint;
typedef unsigned char uchar;
//ip首部
typedef struct ip_hdr
{
uchar h_verlen; //4位首部长度,4位IP版本号
uchar tos; //8位服务类型TOS
ushort total_len; //16位总长度(字节)
ushort ident; //16位标识
ushort frag_and_flags; //3位标志位(另外13位为片偏移)
uchar ttl; //8位生存时间 TTL
uchar protocols; //8位协议 (如ICMP,TCP等)
ushort chksum;