From 0f4a03663b6c81caebededd6d0ffc9fda8de3209 Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Tue, 30 Sep 2014 18:17:28 +0000 Subject: [PATCH] If the checksum coverage field in the UDPLITE header is the length of the complete UDPLITE packet, the packet has full checksum coverage. SO fix the condition. Reviewed by: kevlo MFC after: 3 days --- sys/netinet/udp_usrreq.c | 5 +++-- sys/netinet6/udp6_usrreq.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index b50783f0683..a3804b9e909 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -444,9 +444,10 @@ udp_input(struct mbuf **mp, int *offp, int proto) */ len = ntohs((u_short)uh->uh_ulen); ip_len = ntohs(ip->ip_len) - iphlen; - if (proto == IPPROTO_UDPLITE && len == 0) { + if (proto == IPPROTO_UDPLITE && (len == 0 || len == ip_len)) { /* Zero means checksum over the complete packet. */ - len = ip_len; + if (len == 0) + len = ip_len; cscov_partial = 0; } if (ip_len != len) { diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index d90d1971c7a..22981876ef4 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -227,9 +227,10 @@ udp6_input(struct mbuf **mp, int *offp, int proto) nxt = ip6->ip6_nxt; cscov_partial = (nxt == IPPROTO_UDPLITE) ? 1 : 0; - if (nxt == IPPROTO_UDPLITE && ulen == 0) { + if (nxt == IPPROTO_UDPLITE && (ulen == 0 || ulen == plen)) { /* Zero means checksum over the complete packet. */ - ulen = plen; + if (ulen == 0) + ulen = plen; cscov_partial = 0; } if (nxt == IPPROTO_UDP && plen != ulen) {