修复ip分片跳转BUG.
This commit is contained in:
16
net_common.c
16
net_common.c
@@ -155,6 +155,12 @@ static int ipv4_jump_to_layer(const char *raw_data, int raw_layer_type, int exp
|
||||
if(raw_layer_type == expect_layer_type){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* IP<49><50>Ƭ<EFBFBD><C6AC><EFBFBD>ټ<EFBFBD><D9BC><EFBFBD><EFBFBD><EFBFBD>ת */
|
||||
unsigned short *iphdr_off = (unsigned short *)&p_ip_hdr->ip_off[0];
|
||||
if((htons(*iphdr_off) & IP_MF) || (htons(*iphdr_off) & IP_OFFMASK)){
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch(p_ip_hdr->ip_p){
|
||||
case IPPROTO_TCP:
|
||||
@@ -262,8 +268,9 @@ static int ipv6_jump_to_layer(const char *raw_data, int raw_layer_type, int exp
|
||||
goto done;
|
||||
break;
|
||||
|
||||
case 44:///NEXTHDR_FRAGMENT:
|
||||
offset_to_ip6 = 8; // 8 == sizeof(struct ipv6_frag_hdr);
|
||||
case 44:///NEXTHDR_FRAGMENT:
|
||||
/* IP<49><50>Ƭ<EFBFBD><C6AC><EFBFBD>ټ<EFBFBD><D9BC><EFBFBD><EFBFBD><EFBFBD>ת */
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case 50://NEXTHDR_ESP:
|
||||
@@ -642,6 +649,11 @@ const void *MESA_net_jump_to_layer_greedy(const void *raw_data, int raw_layer_ty
|
||||
case __ADDR_TYPE_IP_PAIR_V4:
|
||||
{
|
||||
const struct mesa_ip4_hdr *ip4hdr = (const struct mesa_ip4_hdr *)expect_layer;
|
||||
if((ntohs(ip4hdr->ip_off) & IP_MF ) || (ntohs(ip4hdr->ip_off) & IP_OFFMASK)){
|
||||
/* IP<49><50>Ƭ<EFBFBD><C6AC><EFBFBD>ټ<EFBFBD><D9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ת */
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(IPPROTO_UDP == ip4hdr->ip_p){
|
||||
new_next_layer_data = (char *)expect_layer + ip4hdr->ip_hl * 4;
|
||||
new_raw_layer_type = ADDR_TYPE_UDP; /* IP<49><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ƫ<EFBFBD><C6AB>, ֻ֧<D6BB><D6A7>UDP, IPIP, GRE, L2TPv3. */
|
||||
|
||||
Reference in New Issue
Block a user