summaryrefslogtreecommitdiffstats
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authoritojun <itojun@openbsd.org>2004-04-14 05:34:15 +0000
committeritojun <itojun@openbsd.org>2004-04-14 05:34:15 +0000
commit7f78c31bd34ca41742ebfd09b8df9a949cdd7d6e (patch)
treec1ebf98ede44704af45d630e392ad6ed5521cf76 /sys/netinet/udp_usrreq.c
parentnew vr; loki@animata.net (diff)
downloadwireguard-openbsd-7f78c31bd34ca41742ebfd09b8df9a949cdd7d6e.tar.xz
wireguard-openbsd-7f78c31bd34ca41742ebfd09b8df9a949cdd7d6e.zip
with IPv6, udp checksum is mandatory. henning ok
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 92db5bf4ac2..fe5538c0b92 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.99 2004/03/21 20:58:10 markus Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.100 2004/04/14 05:34:15 itojun Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -278,6 +278,10 @@ udp_input(struct mbuf *m, ...)
/*
* In IPv6, the UDP checksum is ALWAYS used.
*/
+ if (uh->uh_sum == 0) {
+ udpstat.udps_nosum++;
+ goto bad;
+ }
if ((uh->uh_sum = in6_cksum(m, IPPROTO_UDP, iphlen, len))) {
udpstat.udps_badsum++;
goto bad;
@@ -540,6 +544,7 @@ udp_input(struct mbuf *m, ...)
}
#ifdef INET6
if (ip6) {
+ uh->uh_sum = savesum;
icmp6_error(m, ICMP6_DST_UNREACH,
ICMP6_DST_UNREACH_NOPORT,0);
} else