| 113 | } |
| 114 | |
| 115 | static BOOL VerifyPacket(IPHeader *ip) { |
| 116 | if(ip->verlen >> 4 != 4 || ip->len < ((ip->verlen & 0xf) << 2)) { |
| 117 | return TRUE; |
| 118 | } |
| 119 | |
| 120 | if (CalcIpCheckSum(ip) != 0) { |
| 121 | return TRUE; |
| 122 | } |
| 123 | |
| 124 | if ((ip->dst[0] & 0xf0) == 0xe0 || (ip->src[0] & 0xf0) == 0xe0 || |
| 125 | (ip->dst[0] & 0xf8) == 0xf0 || (ip->src[0] & 0xf8) == 0xf0) { |
| 126 | return TRUE; |
| 127 | } |
| 128 | |
| 129 | ASSERT(ip->proto == IP_PROTO_TCP); |
| 130 | if (CalcTcpCheckSum(ip, ip->len) != 0) { |
| 131 | return TRUE; |
| 132 | } |
| 133 | |
| 134 | return FALSE; |
| 135 | } |
| 136 | |
| 137 | static void CalcDigest(u8 *digest, TCPHeader *tcp) { |
| 138 | MD5Context context; |
no test coverage detected