From owner-freebsd-net Mon Nov 13 0:40: 9 2000 Delivered-To: freebsd-net@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id CF8E837B479 for ; Mon, 13 Nov 2000 00:39:40 -0800 (PST) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.0/8.11.0) id eAD8crq37949; Mon, 13 Nov 2000 10:38:53 +0200 (EET) (envelope-from ru) Date: Mon, 13 Nov 2000 10:38:53 +0200 From: Ruslan Ermilov To: Charles Mott Cc: Archie Cobbs , net@FreeBSD.ORG, Ari Suutari Subject: Re: libalias: Incremental Update of Internet Checksum Message-ID: <20001113103852.E34671@sunbay.com> Mail-Followup-To: Charles Mott , Archie Cobbs , net@FreeBSD.ORG, Ari Suutari References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="IS0zKkzwUGydFO0o" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from cmott@scientech.com on Mon, Nov 13, 2000 at 12:29:32AM -0700 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --IS0zKkzwUGydFO0o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Nov 13, 2000 at 12:29:32AM -0700, Charles Mott wrote: > Ok, ok -- Ruslan is mathematically correct, but > the problem is really neglible, because of how checksums > are commonly verified. Even if DifferentialChecksum() > incorrectly produces a 0xffff instead of 0x0000, this error > does not affect the verification sum computed by a recipient > machine. > > To quote from RF 1624: > > If an end system verifies the checksum by including the checksum > field itself in the one's complement sum and then comparing the > result against -0, as recommended by RFC 1071, it does not matter if > an intermediate system generated a -0 instead of +0 due to the RFC > 1141 property described here. > That's true but it does not mean that there is no problem. The checksum value of 0xffff is incorrect, because one's complement sum is guaranteed to be a non-zero if at least one item is non-zero (which is the case for IP header -- protocol field is non-zero). Actually I do not understand at all how DifferentialChecksum() works currently. What mathematica it is based on? > It would be interesting to do some network surveillance > to see how often 0xffff shows up in checksum fields. > I don't think too often, but it doesn't matter. The bug is there, and should be fixed. I am actually going to commit another patch to libalias(3). It uses the formula 3 from the above mentioned RFC, and is more straightforward to understand. It also has the plus in that you can freely change the signedness of accumulator without affecting the end result. I am attaching the patch here for those interested. Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --IS0zKkzwUGydFO0o Content-Type: message/rfc822 Content-Disposition: inline Date: Thu, 9 Nov 2000 17:36:29 +0200 From: Ruslan Ermilov To: Brian Somers , Ari Suutari Cc: Charles Mott , Erik Salander Subject: Re: libalias: Incremental Update of Internet Checksum Message-ID: <20001109173629.A72896@sunbay.com> References: <20001108200359.A38693@sunbay.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="BXVAT5kNtrzKuDFl" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20001108200359.A38693@sunbay.com>; from ru@FreeBSD.org on Wed, Nov 08, 2000 at 08:03:59PM +0200 --BXVAT5kNtrzKuDFl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Nov 08, 2000 at 08:03:59PM +0200, Ruslan Ermilov wrote: > Hi! > > The DifferentialChecksum() function in libalias(3) is used > to efficiently recompute the checksum for altered packets. > Unfortunately, the implementation suffers from the problem > described in RFC 1624. I have implemented the replacement > for it, using the final formula [4] from the RFC. > I am going to commit the following patch to libalias(3) on Monday until I get any objections or "wait" requests from you till that time. It uses the fomula 3 (rather than 4) from the above mentioned RFC. Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --BXVAT5kNtrzKuDFl Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Index: alias_util.c =================================================================== RCS file: /home/ncvs/src/lib/libalias/alias_util.c,v retrieving revision 1.5 diff -u -p -r1.5 alias_util.c --- alias_util.c 2000/04/05 07:45:39 1.5 +++ alias_util.c 2000/11/09 15:18:59 @@ -34,7 +34,7 @@ purposes); u_short PacketAliasInternetChecksum(u_short *ptr, int nbytes) { - int sum, oddbyte; + u_int sum, oddbyte; sum = 0; while (nbytes > 1) @@ -68,7 +68,7 @@ TcpChecksum(struct ip *pip) u_short *ptr; struct tcphdr *tc; int nhdr, ntcp, nbytes; - int sum, oddbyte; + u_int sum, oddbyte; nhdr = pip->ip_hl << 2; ntcp = ntohs(pip->ip_len) - nhdr; @@ -111,31 +111,23 @@ TcpChecksum(struct ip *pip) } +/* + * Incremental Update of Internet Checksum using [Eqn. 3] from RFC 1624. + */ void DifferentialChecksum(u_short *cksum, u_short *new, u_short *old, int n) { int i; - int accumulate; + u_int accumulate; - accumulate = *cksum; + accumulate = (u_short)~*cksum; for (i=0; i> 16) + (accumulate & 0xffff); - accumulate += accumulate >> 16; - *cksum = (u_short) ~accumulate; - } - else - { - accumulate = (accumulate >> 16) + (accumulate & 0xffff); - accumulate += accumulate >> 16; - *cksum = (u_short) accumulate; - } + accumulate = (accumulate >> 16) + (accumulate & 0xffff); + accumulate += accumulate >> 16; + *cksum = (u_short)~accumulate; } - Index: alias_local.h =================================================================== RCS file: /home/ncvs/src/lib/libalias/alias_local.h,v retrieving revision 1.18 diff -u -p -r1.18 alias_local.h --- alias_local.h 2000/10/30 17:24:12 1.18 +++ alias_local.h 2000/11/09 15:18:59 @@ -28,29 +28,19 @@ */ /* - The following macro is used to update an - internet checksum. "delta" is a 32-bit - accumulation of all the changes to the - checksum (adding in new 16-bit words and - subtracting out old words), and "cksum" - is the checksum value to be updated. -*/ + * The following macro is used to update an internet checksum. + * "acc" is a 32-bit accumulation of all the changes to the checksum + * (adding in all new 16-bit words and 16-bit one's complements of + * old 16-bit words), and "cksum" is the checksum value to be updated. + */ #define ADJUST_CHECKSUM(acc, cksum) { \ - acc += cksum; \ - if (acc < 0) \ - { \ - acc = -acc; \ - acc = (acc >> 16) + (acc & 0xffff); \ - acc += acc >> 16; \ - cksum = (u_short) ~acc; \ - } \ - else \ - { \ - acc = (acc >> 16) + (acc & 0xffff); \ - acc += acc >> 16; \ - cksum = (u_short) acc; \ - } \ + (acc) += (u_short)~(cksum); \ + (acc) = ((acc) >> 16) + ((acc) & 0xffff); \ + (acc) += (acc) >> 16; \ + (cksum) = (u_short)~(acc); \ } +#define NEW(new) ((u_short) (new)) +#define OLD(old) ((u_short)~(old)) /* Index: alias.c =================================================================== RCS file: /home/ncvs/src/lib/libalias/alias.c,v retrieving revision 1.27 diff -u -p -r1.27 alias.c --- alias.c 2000/10/30 17:24:12 1.27 +++ alias.c 2000/11/09 15:18:59 @@ -259,8 +259,8 @@ IcmpAliasIn1(struct ip *pip) original_id = GetOriginalPort(link); /* Adjust ICMP checksum */ - accumulate = ic->icmp_id; - accumulate -= original_id; + accumulate = OLD(ic->icmp_id); + accumulate += NEW(original_id); ADJUST_CHECKSUM(accumulate, ic->icmp_cksum) /* Put original sequence number back in */ @@ -333,13 +333,13 @@ IcmpAliasIn2(struct ip *pip) /* Adjust ICMP checksum */ sptr = (u_short *) &(ip->ip_src); - accumulate = *sptr++; - accumulate += *sptr; + accumulate = OLD(*sptr++); + accumulate += OLD(*sptr); sptr = (u_short *) &original_address; - accumulate -= *sptr++; - accumulate -= *sptr; - accumulate += ud->uh_sport; - accumulate -= original_port; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); + accumulate += OLD(ud->uh_sport); + accumulate += NEW(original_port); ADJUST_CHECKSUM(accumulate, ic->icmp_cksum) /* Un-alias address in IP header */ @@ -366,13 +366,13 @@ fragment contained in ICMP data section /* Adjust ICMP checksum */ sptr = (u_short *) &(ip->ip_src); - accumulate = *sptr++; - accumulate += *sptr; + accumulate = OLD(*sptr++); + accumulate += OLD(*sptr); sptr = (u_short *) &original_address; - accumulate -= *sptr++; - accumulate -= *sptr; - accumulate += ic2->icmp_id; - accumulate -= original_id; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); + accumulate += OLD(ic2->icmp_id); + accumulate += NEW(original_id); ADJUST_CHECKSUM(accumulate, ic->icmp_cksum) /* Un-alias address in IP header */ @@ -452,8 +452,8 @@ IcmpAliasOut1(struct ip *pip) alias_id = GetAliasPort(link); /* Since data field is being modified, adjust ICMP checksum */ - accumulate = ic->icmp_id; - accumulate -= alias_id; + accumulate = OLD(ic->icmp_id); + accumulate += NEW(alias_id); ADJUST_CHECKSUM(accumulate, ic->icmp_cksum) /* Alias sequence number */ @@ -527,13 +527,13 @@ IcmpAliasOut2(struct ip *pip) /* Adjust ICMP checksum */ sptr = (u_short *) &(ip->ip_dst); - accumulate = *sptr++; - accumulate += *sptr; + accumulate = OLD(*sptr++); + accumulate += OLD(*sptr); sptr = (u_short *) &alias_address; - accumulate -= *sptr++; - accumulate -= *sptr; - accumulate += ud->uh_dport; - accumulate -= alias_port; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); + accumulate += OLD(ud->uh_dport); + accumulate += NEW(alias_port); ADJUST_CHECKSUM(accumulate, ic->icmp_cksum) /* @@ -565,13 +565,13 @@ fragment contained in ICMP data section /* Adjust ICMP checksum */ sptr = (u_short *) &(ip->ip_dst); - accumulate = *sptr++; - accumulate += *sptr; + accumulate = OLD(*sptr++); + accumulate += OLD(*sptr); sptr = (u_short *) &alias_address; - accumulate -= *sptr++; - accumulate -= *sptr; - accumulate += ic2->icmp_id; - accumulate -= alias_id; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); + accumulate += OLD(ic2->icmp_id); + accumulate += NEW(alias_id); ADJUST_CHECKSUM(accumulate, ic->icmp_cksum) /* @@ -748,14 +748,14 @@ UdpAliasIn(struct ip *pip) /* is being unaliased and destination address is being altered. */ if (ud->uh_sum != 0) { - accumulate = alias_port; - accumulate -= ud->uh_dport; + accumulate = OLD(alias_port); + accumulate += NEW(ud->uh_dport); sptr = (u_short *) &alias_address; - accumulate += *sptr++; - accumulate += *sptr; + accumulate += OLD(*sptr++); + accumulate += OLD(*sptr); sptr = (u_short *) &original_address; - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); ADJUST_CHECKSUM(accumulate, ud->uh_sum) } @@ -819,14 +819,14 @@ UdpAliasOut(struct ip *pip) int accumulate; u_short *sptr; - accumulate = ud->uh_sport; - accumulate -= alias_port; + accumulate = OLD(ud->uh_sport); + accumulate += NEW(alias_port); sptr = (u_short *) &(pip->ip_src); - accumulate += *sptr++; - accumulate += *sptr; + accumulate += OLD(*sptr++); + accumulate += OLD(*sptr); sptr = (u_short *) &alias_address; - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); ADJUST_CHECKSUM(accumulate, ud->uh_sum) } @@ -883,29 +883,29 @@ TcpAliasIn(struct ip *pip) /* Adjust TCP checksum since destination port is being unaliased */ /* and destination port is being altered. */ - accumulate = alias_port; - accumulate -= tc->th_dport; + accumulate = OLD(alias_port); + accumulate += NEW(tc->th_dport); sptr = (u_short *) &alias_address; - accumulate += *sptr++; - accumulate += *sptr; + accumulate += OLD(*sptr++); + accumulate += OLD(*sptr); sptr = (u_short *) &original_address; - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); /* If this is a proxy, then modify the TCP source port and checksum accumulation */ if (proxy_port != 0) { - accumulate += tc->th_sport; + accumulate += OLD(tc->th_sport); tc->th_sport = proxy_port; - accumulate -= tc->th_sport; + accumulate += NEW(tc->th_sport); sptr = (u_short *) &pip->ip_src; - accumulate += *sptr++; - accumulate += *sptr; + accumulate += OLD(*sptr++); + accumulate += OLD(*sptr); sptr = (u_short *) &proxy_address; - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); } /* See if ACK number needs to be modified */ @@ -917,12 +917,12 @@ TcpAliasIn(struct ip *pip) if (delta != 0) { sptr = (u_short *) &tc->th_ack; - accumulate += *sptr++; - accumulate += *sptr; + accumulate += OLD(*sptr++); + accumulate += OLD(*sptr); tc->th_ack = htonl(ntohl(tc->th_ack) - delta); sptr = (u_short *) &tc->th_ack; - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); } } @@ -930,24 +930,24 @@ TcpAliasIn(struct ip *pip) /* Restore original IP address */ sptr = (u_short *) &pip->ip_dst; - accumulate = *sptr++; - accumulate += *sptr; + accumulate = OLD(*sptr++); + accumulate += OLD(*sptr); pip->ip_dst = original_address; sptr = (u_short *) &pip->ip_dst; - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); /* If this is a transparent proxy packet, then modify the source address */ if (proxy_address.s_addr != 0) { sptr = (u_short *) &pip->ip_src; - accumulate += *sptr++; - accumulate += *sptr; + accumulate += OLD(*sptr++); + accumulate += OLD(*sptr); pip->ip_src = proxy_address; sptr = (u_short *) &pip->ip_src; - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); } ADJUST_CHECKSUM(accumulate, pip->ip_sum); @@ -987,26 +987,26 @@ TcpAliasOut(struct ip *pip, int maxpacke int accumulate; u_short *sptr; - accumulate = tc->th_dport; + accumulate = OLD(tc->th_dport); tc->th_dport = proxy_server_port; - accumulate -= tc->th_dport; + accumulate += NEW(tc->th_dport); sptr = (u_short *) &(pip->ip_dst); - accumulate += *sptr++; - accumulate += *sptr; + accumulate += OLD(*sptr++); + accumulate += OLD(*sptr); sptr = (u_short *) &proxy_server_address; - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); ADJUST_CHECKSUM(accumulate, tc->th_sum); sptr = (u_short *) &(pip->ip_dst); - accumulate = *sptr++; - accumulate += *sptr; + accumulate = OLD(*sptr++); + accumulate += OLD(*sptr); pip->ip_dst = proxy_server_address; sptr = (u_short *) &(pip->ip_dst); - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); ADJUST_CHECKSUM(accumulate, pip->ip_sum); } @@ -1055,16 +1055,16 @@ TcpAliasOut(struct ip *pip, int maxpacke /* Adjust TCP checksum since source port is being aliased */ /* and source address is being altered */ - accumulate = tc->th_sport; + accumulate = OLD(tc->th_sport); tc->th_sport = alias_port; - accumulate -= tc->th_sport; + accumulate += NEW(tc->th_sport); sptr = (u_short *) &(pip->ip_src); - accumulate += *sptr++; - accumulate += *sptr; + accumulate += OLD(*sptr++); + accumulate += OLD(*sptr); sptr = (u_short *) &alias_address; - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); /* Modify sequence number if necessary */ if (GetAckModified(link) == 1) @@ -1075,12 +1075,12 @@ TcpAliasOut(struct ip *pip, int maxpacke if (delta != 0) { sptr = (u_short *) &tc->th_seq; - accumulate += *sptr++; - accumulate += *sptr; + accumulate += OLD(*sptr++); + accumulate += OLD(*sptr); tc->th_seq = htonl(ntohl(tc->th_seq) + delta); sptr = (u_short *) &tc->th_seq; - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); } } @@ -1088,12 +1088,12 @@ TcpAliasOut(struct ip *pip, int maxpacke /* Change source address */ sptr = (u_short *) &(pip->ip_src); - accumulate = *sptr++; - accumulate += *sptr; + accumulate = OLD(*sptr++); + accumulate += OLD(*sptr); pip->ip_src = alias_address; sptr = (u_short *) &(pip->ip_src); - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); ADJUST_CHECKSUM(accumulate, pip->ip_sum) @@ -1466,19 +1466,19 @@ PacketUnaliasOut(char *ptr, /* /* Adjust TCP/UDP checksum */ sptr = (u_short *) &(pip->ip_src); - accumulate = *sptr++; - accumulate += *sptr; + accumulate = OLD(*sptr++); + accumulate += OLD(*sptr); sptr = (u_short *) &original_address; - accumulate -= *sptr++; - accumulate -= *sptr; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); if (pip->ip_p == IPPROTO_UDP) { - accumulate += ud->uh_sport; - accumulate -= original_port; + accumulate += OLD(ud->uh_sport); + accumulate += NEW(original_port); ADJUST_CHECKSUM(accumulate, ud->uh_sum) } else { - accumulate += tc->th_sport; - accumulate -= original_port; + accumulate += OLD(tc->th_sport); + accumulate += NEW(original_port); ADJUST_CHECKSUM(accumulate, tc->th_sum) } @@ -1509,13 +1509,13 @@ PacketUnaliasOut(char *ptr, /* /* Adjust ICMP checksum */ sptr = (u_short *) &(pip->ip_src); - accumulate = *sptr++; - accumulate += *sptr; + accumulate = OLD(*sptr++); + accumulate += OLD(*sptr); sptr = (u_short *) &original_address; - accumulate -= *sptr++; - accumulate -= *sptr; - accumulate += ic->icmp_id; - accumulate -= original_id; + accumulate += NEW(*sptr++); + accumulate += NEW(*sptr); + accumulate += OLD(ic->icmp_id); + accumulate += NEW(original_id); ADJUST_CHECKSUM(accumulate, ic->icmp_cksum) /* Adjust IP checksum */ Index: alias_nbt.c =================================================================== RCS file: /home/ncvs/src/lib/libalias/alias_nbt.c,v retrieving revision 1.5 diff -u -p -r1.5 alias_nbt.c --- alias_nbt.c 2000/08/31 12:54:55 1.5 +++ alias_nbt.c 2000/11/09 15:18:59 @@ -233,14 +233,14 @@ int AliasHandleUdpNbt( if ( uh->uh_sum != 0 ) { int acc; u_short *sptr; - acc = ndh->source_port; - acc -= alias_port; + acc = OLD(ndh->source_port); + acc += NEW(alias_port); sptr = (u_short *) &(ndh->source_ip); - acc += *sptr++; - acc += *sptr; + acc += OLD(*sptr++); + acc += OLD(*sptr); sptr = (u_short *) alias_address; - acc -= *sptr++; - acc -= *sptr; + acc += NEW(*sptr++); + acc += NEW(*sptr); ADJUST_CHECKSUM(acc, uh->uh_sum) } ndh->source_ip = *alias_address; @@ -353,11 +353,11 @@ AliasHandleResourceNB( u_short *sptr; sptr = (u_short *) &(nb->addr); - acc = *sptr++; - acc += *sptr; + acc = OLD(*sptr++); + acc += OLD(*sptr); sptr = (u_short *) &(nbtarg->newaddr); - acc -= *sptr++; - acc -= *sptr; + acc += NEW(*sptr++); + acc += NEW(*sptr); ADJUST_CHECKSUM(acc, *nbtarg->uh_sum) } @@ -421,11 +421,11 @@ AliasHandleResourceA( u_short *sptr; sptr = (u_short *) &(a->addr); /* Old */ - acc = *sptr++; - acc += *sptr; + acc = OLD(*sptr++); + acc += OLD(*sptr); sptr = (u_short *) &nbtarg->newaddr; /* New */ - acc -= *sptr++; - acc -= *sptr; + acc += NEW(*sptr++); + acc += NEW(*sptr); ADJUST_CHECKSUM(acc, *nbtarg->uh_sum) } Index: alias_pptp.c =================================================================== RCS file: /home/ncvs/src/lib/libalias/alias_pptp.c,v retrieving revision 1.4 diff -u -p -r1.4 alias_pptp.c --- alias_pptp.c 2000/10/30 12:39:41 1.4 +++ alias_pptp.c 2000/11/09 15:19:00 @@ -177,14 +177,14 @@ AliasHandlePptpOut(struct ip *pip, / } if (pptp_link != NULL) { - int accumulate = cptr->cid1; + int accumulate = OLD(cptr->cid1); /* alias the Call Id */ cptr->cid1 = GetAliasPort(pptp_link); /* Compute TCP checksum for revised packet */ tc = (struct tcphdr *) ((char *) pip + (pip->ip_hl << 2)); - accumulate -= cptr->cid1; + accumulate += NEW(cptr->cid1); ADJUST_CHECKSUM(accumulate, tc->th_sum); switch (ctl_type) { @@ -247,14 +247,14 @@ AliasHandlePptpIn(struct ip *pip, /* *pcall_id); if (pptp_link != NULL) { - int accumulate = *pcall_id; + int accumulate = OLD(*pcall_id); /* De-alias the Peer's Call Id. */ *pcall_id = GetOriginalPort(pptp_link); /* Compute TCP checksum for modified packet */ tc = (struct tcphdr *) ((char *) pip + (pip->ip_hl << 2)); - accumulate -= *pcall_id; + accumulate += NEW(*pcall_id); ADJUST_CHECKSUM(accumulate, tc->th_sum); if (ctl_type == PPTP_OutCallReply || ctl_type == PPTP_InCallReply) { Index: alias_proxy.c =================================================================== RCS file: /home/ncvs/src/lib/libalias/alias_proxy.c,v retrieving revision 1.5 diff -u -p -r1.5 alias_proxy.c --- alias_proxy.c 2000/08/29 21:34:55 1.5 +++ alias_proxy.c 2000/11/09 15:19:00 @@ -326,9 +326,9 @@ ProxyEncodeTcpStream(struct alias_link * { int accumulate; - accumulate = pip->ip_len; + accumulate = OLD(pip->ip_len); pip->ip_len = htons(ntohs(pip->ip_len) + slen); - accumulate -= pip->ip_len; + accumulate += NEW(pip->ip_len); ADJUST_CHECKSUM(accumulate, pip->ip_sum); } @@ -385,18 +385,18 @@ ProxyEncodeIpHeader(struct ip *pip, u_short *sptr; sptr = (u_short *) option; - accumulate = 0; + accumulate = OLD(0); for (i=0; iip_hl += OPTION_LEN_INT32; - accumulate -= *sptr; + accumulate += NEW(*sptr); - accumulate += pip->ip_len; + accumulate += OLD(pip->ip_len); pip->ip_len = htons(ntohs(pip->ip_len) + OPTION_LEN_BYTES); - accumulate -= pip->ip_len; + accumulate += NEW(pip->ip_len); ADJUST_CHECKSUM(accumulate, pip->ip_sum); } --BXVAT5kNtrzKuDFl-- --IS0zKkzwUGydFO0o-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message