Commit 0434c548 authored by Stig Venaas's avatar Stig Venaas
Browse files

beginnings of IPv6 checksum support, still need to add IPv6 to the actual checksum functions

git-svn-id: file:///home/svn/mapi/trunk@910 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 52a507b2
......@@ -1020,13 +1020,18 @@ void apply_function_to_field(int function,int protocol,int field,unsigned char *
case CHECKSUM_ADJUST:
switch(protocol) {
case IP:
packet->iph->ip_csum=calculate_ip_sum(packet);
if (packet->iph)
packet->iph->ip_csum=calculate_ip_sum(packet);
if(packet->tcph) { //pseudoheader uses some info from IP
packet->tcph->th_sum=calculate_tcp_sum(packet);
}
else if(packet->udph) {
packet->udph->uh_chk=calculate_udp_sum(packet);
}
else if(packet->icmp6h) {
//icmpv6 checksum uses pseudoheader with IP info
packet->icmp6h->icmp6_cksum=calculate_icmp_sum(packet);
}
break;
case TCP:
packet->tcph->th_sum=calculate_tcp_sum(packet);
......@@ -1035,7 +1040,12 @@ void apply_function_to_field(int function,int protocol,int field,unsigned char *
packet->udph->uh_chk=calculate_udp_sum(packet);
break;
case ICMP:
packet->icmph->csum=calculate_icmp_sum(packet);
if (packet->icmph) {
packet->icmph->csum=calculate_icmp_sum(packet);
}
else if(packet->icmp6h) {
packet->icmp6h->icmp6_cksum=calculate_icmp_sum(packet);
}
break;
case HTTP:
case FTP:
......
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