diff -uNr orginal/icmp.c patched/icmp.c --- orginal/icmp.c Thu Aug 28 21:38:10 2003 +++ patched/icmp.c Thu Sep 4 02:52:24 2003 @@ -91,6 +91,7 @@ #include #include +#define GENIE_IP_PATCH /* * Build xmit assembly blocks */ @@ -319,39 +320,37 @@ * the other fragments first, so that we get the checksum * for the whole packet here. */ - - /* +#ifndef GENIE_IP_PATCH + csum = csum_partial_copy_nocheck((void *)&icmp_param->data, + to, icmp_param->head_len, + icmp_param->csum); csum=skb_copy_and_csum_bits(icmp_param->skb, icmp_param->offset, to+icmp_param->head_len, fraglen-icmp_param->head_len, csum); - csum = csum_partial_copy_nocheck((void *)&icmp_param->data, - to, icmp_param->head_len, - icmp_param->csum); - - - */ - { - csum = skb_copy_and_csum_bits(icmp_param->skb, +#else + csum=skb_copy_and_csum_bits(icmp_param->skb, + icmp_param->offset, + to+icmp_param->head_len, + fraglen-icmp_param->head_len, + 0); + csum = 0; + icmp_param->csum = 0; + icmp_param->csum = skb_checksum(icmp_param->skb, icmp_param->offset, - to+icmp_param->head_len, fraglen-icmp_param->head_len, - 0); - csum = 0 ; - icmp_param->csum = 0; + csum); - csum = csum_partial(icmp_param->skb, - icmp_param->data_len, 0); +// icmp_param->csum = skb_copy_bits(icmp_param->skb, +// icmp_param->offset, to+icmp_param->head_len, csum); csum = csum_partial_copy_nocheck((void *)&icmp_param->data, to, icmp_param->head_len, icmp_param->csum); - +#endif icmph=(struct icmphdr *)to; icmph->checksum = csum_fold(csum); - } - return 0; } @@ -415,7 +414,9 @@ struct icmp_bxm icmp_param; struct rtable *rt = (struct rtable*)skb_in->dst; struct ipcm_cookie ipc; +#ifdef GENIE_IP_PATCH unsigned int offset; +#endif u32 saddr; u8 tos; @@ -541,13 +542,19 @@ room -= sizeof(struct iphdr) + icmp_param.replyopts.optlen; room -= sizeof(struct icmphdr); +#ifndef GENIE_IP_PATCH + icmp_param.data_len=skb_in->len-icmp_param.offset; +#else + if( skb_in->data > skb_in->nh.raw) offset = (skb_in->data - skb_in->nh.raw); else offset = 0; - icmp_param.data_len=skb_in->len-icmp_param.offset+offset; + icmp_param.data_len=skb_in->len+offset; +// icmp_param.data_len=skb_in->len+icmp_param.offset; +#endif if (icmp_param.data_len > room) icmp_param.data_len = room; icmp_param.head_len = sizeof(struct icmphdr); diff -uNr orginal/ip_output.c patched/ip_output.c --- orginal/ip_output.c Thu Aug 28 21:38:10 2003 +++ patched/ip_output.c Thu Sep 4 01:27:47 2003 @@ -78,7 +78,9 @@ #include #include + #define GENIE_IP_PATCH + /* * Shall we try to damage output packets if routing dev changes? */ @@ -472,9 +474,7 @@ ip_local_error(sk, EMSGSIZE, rt->rt_dst, sk->dport, mtu); return -EMSGSIZE; } - #ifndef GENIE_IP_PATCH - /* * Start at the end of the frame by handling the remainder. */ @@ -492,45 +492,42 @@ offset -= maxfraglen-fragheaderlen; } #else - /* Patch for skt. - */ offset = 0; - if(length < (maxfraglen - fragheaderlen)) + if ( length < ( maxfraglen - fragheaderlen) ) { fraglen = length + fragheaderlen; - else + } else { fraglen = maxfraglen; + } + //printk( KERN_INFO "\n\nbeyond while first : length : %d", length); + //printk( KERN_INFO "\tfraglen : %d", fraglen); + //printk( KERN_INFO "\toffset : %d", offset); + //printk( KERN_INFO "\tfragheaderlen: %d", fragheaderlen); #endif -#ifndef GENIE_IP_PATH + /* * The last fragment will not have MF (more fragments) set. */ - +#ifndef GENIE_IP_PATCH mf = 0; #else - /* the first fragment will have MFset - */ - if( length < (maxfraglen - fragheaderlen)) + if( length < (maxfraglen - fragheaderlen) ) mf = 0; - else + else mf = htons(IP_MF); + printk(KERN_INFO "\n\nmf value is %d\n", mf); #endif - -#ifndef GENIE_IP_PATCH /* * Don't fragment packets for path mtu discovery. */ - +#ifndef GENIE_IP_PATCH if (offset > 0 && sk->protinfo.af_inet.pmtudisc==IP_PMTUDISC_DO) { - ip_local_error(sk, EMSGSIZE, rt->rt_dst, sk->dport, mtu); - return -EMSGSIZE; - } #else - if( length > (maxfraglen - fragheaderlen) && - sk->protinfo.af_inet.pmtudisc==IP_PMTUDISC_DO) { + if( length > (maxfraglen - fragheaderlen ) && sk->protinfo.af_inet.pmtudisc==IP_PMTUDISC_DO ) { + +#endif ip_local_error(sk, EMSGSIZE, rt->rt_dst, sk->dport, mtu); return -EMSGSIZE; } -#endif if (flags&MSG_PROBE) goto out; @@ -542,8 +539,9 @@ #ifndef GENIE_IP_PATCH do { #else - while( offset < length ) { + while(offset < length ) { #endif + char *data; struct sk_buff * skb; @@ -629,13 +627,17 @@ offset -= (maxfraglen-fragheaderlen); fraglen = maxfraglen; #else - offset = offset + ( maxfraglen - fragheaderlen); - if( length < offset + ( maxfraglen - fragheaderlen)) { + offset += (maxfraglen - fragheaderlen); + if( length <= offset + (maxfraglen - fragheaderlen )) { fraglen = length - offset + fragheaderlen; mf = 0; } else { fraglen = maxfraglen; } + + //printk(KERN_INFO "\nupper offset size : %d", offset ); + //printk(KERN_INFO "\tupper fragheaderlen size : %d", fragheaderlen); + //printk(KERN_INFO "\tupper length size : %d", length); #endif nfrags++; @@ -651,9 +653,11 @@ #ifndef GENIE_IP_PATCH } while (offset >= 0); #else + //printk(KERN_INFO "\noffset size : %d", offset ); + //printk(KERN_INFO "\tfraglen size : %d", fraglen); + //printk(KERN_INFO "\tmaxfraglen size : %d", maxfraglen); } #endif - if (nfrags>1) ip_statistics[smp_processor_id()*2 + !in_softirq()].IpFragCreates += nfrags; out: diff -uNr orginal/udp.c patched/udp.c --- orginal/udp.c Thu Aug 28 21:38:10 2003 +++ patched/udp.c Thu Sep 4 02:35:04 2003 @@ -94,6 +94,8 @@ #include #include +#define GENIE_IP_PATCH + /* * Snmp MIB for the UDP layer */ @@ -380,18 +382,23 @@ if (csum_partial_copy_fromiovecend(to+sizeof(struct udphdr), ufh->iov, offset, fraglen-sizeof(struct udphdr), &ufh->wcheck)) return -EFAULT; +#ifndef GENIE_IP_PATCH + ufh->wcheck = csum_partial((char *)ufh, sizeof(struct udphdr), + ufh->wcheck); + ufh->uh.check = csum_tcpudp_magic(ufh->saddr, ufh->daddr, + ntohs(ufh->uh.len), + IPPROTO_UDP, ufh->wcheck); +#else + ufh->wcheck =0; + ufh->wcheck = csum_partial((char*) ufh->iov->iov_base, ufh->iov->iov_len,0); + ufh->wcheck = csum_partial((char *)ufh, sizeof(struct udphdr), 0); + ufh->uh.check = csum_tcpudp_magic(ufh->saddr, ufh->daddr, + ntohs(ufh->uh.len), + IPPROTO_UDP, ufh->wcheck); + +#endif + - ufh->wcheck = 0; - ufh->wcheck = csum_partial((char *)ufh->iov->iov_base, ufh->iov->iov_len, 0); - ufh->wcheck = csum_partial((char *)ufh, sizeof(struct udphdr), ufh->wcheck); - ufh->uh.check = csum_tcpudp_magic(ufh->saddr, ufh->daddr, ntohs(ufh->uh.len), - IPPROTO_UDP, ufh->wcheck); - - //ufh->wcheck = csum_partial((char *)ufh, sizeof(struct udphdr), - // ufh->wcheck); - //ufh->uh.check = csum_tcpudp_magic(ufh->saddr, ufh->daddr, - // ntohs(ufh->uh.len), - // IPPROTO_UDP, ufh->wcheck); if (ufh->uh.check == 0) ufh->uh.check = -1; memcpy(to, ufh, sizeof(struct udphdr));