aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTom Jones <thj@FreeBSD.org>2018-10-05 12:51:30 +0000
committerTom Jones <thj@FreeBSD.org>2018-10-05 12:51:30 +0000
commitb6e870116f9c9ddc8cb80e35de670011921d0ca5 (patch)
treeaaf11e1bb193bd9608b92bea4489bb7351b4b6d2 /sys
parent19fa5a506624e14b05f5dad50a41a3056f1e9002 (diff)
downloadsrc-b6e870116f9c9ddc8cb80e35de670011921d0ca5.tar.gz
src-b6e870116f9c9ddc8cb80e35de670011921d0ca5.zip
Convert UDP length to host byte order
When getting the number of bytes to checksum make sure to convert the UDP length to host byte order when the entire header is not in the first mbuf. Reviewed by: jtl, tuexen, ae Approved by: re (gjb), jtl (mentor) Differential Revision: https://reviews.freebsd.org/D17357
Notes
Notes: svn path=/head/; revision=339195
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_output.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 9d7b9cbe8661..a08806a686bd 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -932,10 +932,11 @@ in_delayed_cksum(struct mbuf *m)
if (m->m_pkthdr.csum_flags & CSUM_UDP) {
/* if udp header is not in the first mbuf copy udplen */
- if (offset + sizeof(struct udphdr) > m->m_len)
+ if (offset + sizeof(struct udphdr) > m->m_len) {
m_copydata(m, offset + offsetof(struct udphdr,
uh_ulen), sizeof(cklen), (caddr_t)&cklen);
- else {
+ cklen = ntohs(cklen);
+ } else {
uh = (struct udphdr *)mtodo(m, offset);
cklen = ntohs(uh->uh_ulen);
}