summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2000-08-07 09:51:04 +0000
committerru <ru@FreeBSD.org>2000-08-07 09:51:04 +0000
commit12eac35afe3b9e8daf6f71cc825340a73d5bebf7 (patch)
treef51563733735ba84f100788168184378f4a23dab /lib
parentf4389ea9b369d8c961334d5f03832ea46e63147b (diff)
downloadFreeBSD-src-12eac35afe3b9e8daf6f71cc825340a73d5bebf7.zip
FreeBSD-src-12eac35afe3b9e8daf6f71cc825340a73d5bebf7.tar.gz
Adjust TCP checksum rather than compute it afresh.
Submitted by: Erik Salander <erik@whistle.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalias/alias_pptp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/libalias/alias_pptp.c b/lib/libalias/alias_pptp.c
index 822cfa6..88e177b 100644
--- a/lib/libalias/alias_pptp.c
+++ b/lib/libalias/alias_pptp.c
@@ -190,13 +190,15 @@ AliasHandlePptpOut(struct ip *pip, /* IP packet to examine/patch */
cptr->cid1);
if (gre_link != NULL) {
+ int accumulate = cptr->cid1;
+
/* alias the Call Id */
cptr->cid1 = GetAliasPort(gre_link);
/* Compute TCP checksum for revised packet */
tc = (struct tcphdr *) ((char *) pip + (pip->ip_hl << 2));
- tc->th_sum = 0;
- tc->th_sum = TcpChecksum(pip);
+ accumulate -= cptr->cid1;
+ ADJUST_CHECKSUM(accumulate, tc->th_sum);
}
}
}
@@ -237,13 +239,15 @@ AliasHandlePptpIn(struct ip *pip, /* IP packet to examine/patch */
*pcall_id);
if (gre_link != NULL) {
+ int accumulate = *pcall_id;
+
/* alias the Call Id */
*pcall_id = GetOriginalPort(gre_link);
/* Compute TCP checksum for modified packet */
tc = (struct tcphdr *) ((char *) pip + (pip->ip_hl << 2));
- tc->th_sum = 0;
- tc->th_sum = TcpChecksum(pip);
+ accumulate -= *pcall_id;
+ ADJUST_CHECKSUM(accumulate, tc->th_sum);
}
}
OpenPOWER on IntegriCloud