summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_input.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-02-06 11:14:22 +0000
committerbrian <brian@FreeBSD.org>1997-02-06 11:14:22 +0000
commitf1bef29dedc927da77bb08c940ceac1e8cbedab3 (patch)
treecd98973396db827283690d3f8317850a12b5e83d /sys/netinet/ip_input.c
parenta45c2f2f55c84431da91cf4cf50b316c777da6d7 (diff)
downloadFreeBSD-src-f1bef29dedc927da77bb08c940ceac1e8cbedab3.zip
FreeBSD-src-f1bef29dedc927da77bb08c940ceac1e8cbedab3.tar.gz
Don't zero ip->ip_sum during sum validation. This should only
affect programs that sit on top of divert(4) sockets. The multicast routing code already unconditionally zeros the sum before recalculating. Any code that unconditionaly sums a packet without first zeroing the sum (assuming that it's already zero'd) will break. No such code seems to exist.
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r--sys/netinet/ip_input.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index a627f6d..b1c8165 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -216,6 +216,7 @@ ip_input(struct mbuf *m)
struct ipq *fp;
struct in_ifaddr *ia;
int hlen;
+ u_short sum;
#ifdef DIAGNOSTIC
if ((m->m_flags & M_PKTHDR) == 0)
@@ -264,11 +265,11 @@ ip_input(struct mbuf *m)
ip = mtod(m, struct ip *);
}
if (hlen == sizeof(struct ip)) {
- ip->ip_sum = in_cksum_hdr(ip);
+ sum = in_cksum_hdr(ip);
} else {
- ip->ip_sum = in_cksum(m, hlen);
+ sum = in_cksum(m, hlen);
}
- if (ip->ip_sum) {
+ if (sum) {
ipstat.ips_badsum++;
goto bad;
}
OpenPOWER on IntegriCloud