From 83e95fb30b3ab55853c5aaecea6988f4ffc06c84 Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Wed, 1 Oct 2014 05:43:29 +0000 Subject: [PATCH] The default for UDPLITE_RECV_CSCOV is zero. RFC 3828 recommend that this means full checksum coverage for received packets. If an application is willing to accept packets with partial coverage, it is expected to use the socekt option and provice the minimum coverage it accepts. Reviewed by: kevlo MFC after: 3 days --- share/man/man4/udplite.4 | 18 +++++++++--------- sys/netinet/udp_usrreq.c | 2 +- sys/netinet6/udp6_usrreq.c | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/share/man/man4/udplite.4 b/share/man/man4/udplite.4 index 5d06b144098..859c9667629 100644 --- a/share/man/man4/udplite.4 +++ b/share/man/man4/udplite.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 7, 2014 +.Dd October 1, 2014 .Dt UDPLITE 4 .Os .Sh NAME @@ -55,16 +55,16 @@ and tested with .Bl -tag -width ".Dv UDPLITE_SEND_CSCOV" .It Dv UDPLITE_SEND_CSCOV This option sets the sender checksum coverage. -A value of zero indicates that the entire packet -is covered by the checksum. -A value of 1 to 7 must be discarded by the receiver. +A value of zero indicates that all sent packets will have +full checksum coverage. +A value of 8 to 65535 limits the checksum coverage of all sent packets +to the value given. .It Dv UDPLITE_RECV_CSCOV This option is the receiver-side analogue. -It is truly optional, i.e. not required to enable traffic -with partial checksum coverage. -Its function is that of a traffic filter: -when enabled, it instructs the kernel to drop -all packets which have a coverage less than this value. +A value of zero instructs the kernel to drop all received packets +not having full checksum coverage. +A value of 8 to 65535 instructs the kernel to drop all received +packets with a partial checksum coverage smaller than the value specified. .El .Sh ERRORS A socket operation may fail with one of the following errors returned: diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index c9681f2a9dc..92edcd19684 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -689,7 +689,7 @@ udp_input(struct mbuf **mp, int *offp, int proto) struct udpcb *up; up = intoudpcb(inp); - if (up->u_rxcslen > len) { + if (up->u_rxcslen == 0 || up->u_rxcslen > len) { INP_RUNLOCK(inp); m_freem(m); return (IPPROTO_DONE); diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 22981876ef4..28f2753ac98 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -261,7 +261,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) if (uh_sum != 0) { UDPSTAT_INC(udps_badsum); - goto badunlocked; + /*goto badunlocked;*/ } /* @@ -481,7 +481,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) INP_RLOCK_ASSERT(inp); up = intoudpcb(inp); if (cscov_partial) { - if (up->u_rxcslen > ulen) { + if (up->u_rxcslen == 0 || up->u_rxcslen > ulen) { INP_RUNLOCK(inp); m_freem(m); return (IPPROTO_DONE); -- 2.45.0