Commit 98141f69 authored by Stig Venaas's avatar Stig Venaas
Browse files

fixed IPv6 total_len and packet_end for strip, replace and regexp

git-svn-id: file:///home/svn/mapi/trunk@879 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 0f55ad7e
......@@ -882,8 +882,13 @@ void apply_function_to_field(int function,int protocol,int field,unsigned char *
break;
case STRIP:
//printf("++I will call STRIP and I will keep %d bytes\n",params->seed);
total_len=ntohs(packet->iph->ip_len);
packet_end=((unsigned char *)(packet->iph))+total_len;
if (packet->iph) {
total_len = ntohs(packet->iph->ip_len);
packet_end = (unsigned char *)packet->iph + total_len;
} else { /* assume IPv6 when not IPv4 */
total_len = ntohs(packet->ip6h->ip6_plen) + IP6_HEADER_LEN;
packet_end = (unsigned char *)packet->ip6h + total_len;
}
strip(packet,header_pointer,header_len,params->seed,total_len,packet_end);
break;
case HASHED:
......@@ -949,8 +954,13 @@ void apply_function_to_field(int function,int protocol,int field,unsigned char *
break;
case REPLACE:
//printf("++I will call REPLACE with pattern: %s\n",params->pattern);
total_len=ntohs(packet->iph->ip_len);
packet_end=((unsigned char *)(packet->iph))+total_len;
if (packet->iph) {
total_len = ntohs(packet->iph->ip_len);
packet_end = (unsigned char *)packet->iph + total_len;
} else { /* assume IPv6 when not IPv4 */
total_len = ntohs(packet->ip6h->ip6_plen) + IP6_HEADER_LEN;
packet_end = (unsigned char *)packet->ip6h + total_len;
}
replace_field(field_pointer,len,(unsigned char *)params->pattern,strlen(params->pattern),packet,total_len,packet_end);
break;
case CHECKSUM_ADJUST:
......@@ -982,8 +992,13 @@ void apply_function_to_field(int function,int protocol,int field,unsigned char *
}
break;
case REGEXP:
total_len=ntohs(packet->iph->ip_len);
packet_end=((unsigned char *)(packet->iph))+total_len;
if (packet->iph) {
total_len = ntohs(packet->iph->ip_len);
packet_end = (unsigned char *)packet->iph + total_len;
} else { /* assume IPv6 when not IPv4 */
total_len = ntohs(packet->ip6h->ip6_plen) + IP6_HEADER_LEN;
packet_end = (unsigned char *)packet->ip6h + total_len;
}
reg_exp_substitute(field_pointer,len,params->regexp,params->replaceVector,params->num_of_matches,packet,total_len,packet_end);
break;
default:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment