summaryrefslogtreecommitdiff
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-06-23 18:54:45 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-06-23 18:54:45 +0000
commitced2c454722870f31392314819901f8b783c25f5 (patch)
tree6dfb35ff54491f50a1b72b840812940eb8e3eb96 /sys/netinet/udp_usrreq.c
parent288fc71e386ca4ad0219628adfececd7c9db39d0 (diff)
Clear the checksum flags after verification. Also, don't count
checksum errors as hardware checksum packets as well.
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 663f559fbd4..094f2c22230 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.69 2001/06/23 16:15:56 fgsch Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.70 2001/06/23 18:54:44 angelos Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -298,10 +298,6 @@ udp_input(m, va_alist)
#endif /* INET6 */
if (uh->uh_sum) {
if ((m->m_pkthdr.csum & M_UDP_CSUM_IN_OK) == 0) {
- bzero(((struct ipovly *)ip)->ih_x1,
- sizeof ((struct ipovly *)ip)->ih_x1);
- ((struct ipovly *)ip)->ih_len = uh->uh_ulen;
-
if (m->m_pkthdr.csum & M_UDP_CSUM_IN_BAD) {
udpstat.udps_badsum++;
udpstat.udps_inhwcsum++;
@@ -309,15 +305,20 @@ udp_input(m, va_alist)
return;
}
+ bzero(((struct ipovly *)ip)->ih_x1,
+ sizeof ((struct ipovly *)ip)->ih_x1);
+ ((struct ipovly *)ip)->ih_len = uh->uh_ulen;
+
if ((uh->uh_sum = in_cksum(m, len +
sizeof (struct ip))) != 0) {
udpstat.udps_badsum++;
m_freem(m);
return;
}
- } else
+ } else {
+ m->m_pkthdr.csum &= ~M_UDP_CSUM_IN_OK;
udpstat.udps_inhwcsum++;
-
+ }
} else
udpstat.udps_nosum++;