From: Kuniyuki Iwashima <kuniyu@google.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
David Ahern <dsahern@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuniyu@google.com>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
netdev@vger.kernel.org
Subject: [PATCH v1 net-next 09/15] udp: Remove UDPLITE_SEND_CSCOV and UDPLITE_RECV_CSCOV.
Date: Wed, 4 Mar 2026 19:28:40 +0000 [thread overview]
Message-ID: <20260304193034.1870586-10-kuniyu@google.com> (raw)
In-Reply-To: <20260304193034.1870586-1-kuniyu@google.com>
UDP-Lite supports variable-length checksum and has two socket
options, UDPLITE_SEND_CSCOV and UDPLITE_RECV_CSCOV, to control
the checksum coverage.
Let's remove the support.
setsockopt(UDPLITE_SEND_CSCOV / UDPLITE_RECV_CSCOV) was only
available for UDP-Lite and returned -ENOPROTOOPT for UDP.
Now, the options are handled in ip_setsockopt() and
ipv6_setsockopt(), which still return the same error.
getsockopt(UDPLITE_SEND_CSCOV / UDPLITE_RECV_CSCOV) was available
for UDP and always returned 0, meaning full checksum, but now
-ENOPROTOOPT is returned.
Given that getsockopt() is meaningless for UDP and even the options
are not defined under include/uapi/, this should not be a problem.
$ man 7 udplite
...
BUGS
Where glibc support is missing, the following definitions
are needed:
#define IPPROTO_UDPLITE 136
#define UDPLITE_SEND_CSCOV 10
#define UDPLITE_RECV_CSCOV 11
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
---
include/linux/udp.h | 10 +--------
include/net/udplite.h | 15 -------------
include/uapi/linux/udp.h | 1 +
net/ipv4/udp.c | 46 ++--------------------------------------
net/ipv6/ip6_checksum.c | 2 +-
net/ipv6/udp.c | 5 ++---
6 files changed, 7 insertions(+), 72 deletions(-)
delete mode 100644 include/net/udplite.h
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 1cbf6b4d3aab..ce56ebcee5cb 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -40,8 +40,6 @@ enum {
UDP_FLAGS_ACCEPT_FRAGLIST,
UDP_FLAGS_ACCEPT_L4,
UDP_FLAGS_ENCAP_ENABLED, /* This socket enabled encap */
- UDP_FLAGS_UDPLITE_SEND_CC, /* set via udplite setsockopt */
- UDP_FLAGS_UDPLITE_RECV_CC, /* set via udplite setsockopt */
};
/* per NUMA structure for lockless producer usage. */
@@ -74,11 +72,7 @@ struct udp_sock {
*/
__u16 len; /* total length of pending frames */
__u16 gso_size;
- /*
- * Fields specific to UDP-Lite.
- */
- __u16 pcslen;
- __u16 pcrlen;
+
/*
* For encapsulation sockets.
*/
@@ -236,8 +230,6 @@ static inline void udp_allow_gso(struct sock *sk)
hlist_nulls_for_each_entry_rcu(__up, node, list, udp_lrpa_node)
#endif
-#define IS_UDPLITE(__sk) (unlikely(__sk->sk_protocol == IPPROTO_UDPLITE))
-
static inline struct sock *udp_tunnel_sk(const struct net *net, bool is_ipv6)
{
#if IS_ENABLED(CONFIG_NET_UDP_TUNNEL)
diff --git a/include/net/udplite.h b/include/net/udplite.h
deleted file mode 100644
index 6bfa1d6833d1..000000000000
--- a/include/net/udplite.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Definitions for the UDP-Lite (RFC 3828) code.
- */
-#ifndef _UDPLITE_H
-#define _UDPLITE_H
-
-#include <net/ip6_checksum.h>
-#include <net/udp.h>
-
-/* UDP-Lite socket options */
-#define UDPLITE_SEND_CSCOV 10 /* sender partial coverage (as sent) */
-#define UDPLITE_RECV_CSCOV 11 /* receiver partial coverage (threshold ) */
-
-#endif /* _UDPLITE_H */
diff --git a/include/uapi/linux/udp.h b/include/uapi/linux/udp.h
index edca3e430305..195041ffb7d8 100644
--- a/include/uapi/linux/udp.h
+++ b/include/uapi/linux/udp.h
@@ -29,6 +29,7 @@ struct udphdr {
/* UDP socket options */
#define UDP_CORK 1 /* Never send partially complete segments */
+/* Don't use 10 and 11 */
#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
#define UDP_NO_CHECK6_TX 101 /* Disable sending checksum for UDP6X */
#define UDP_NO_CHECK6_RX 102 /* Disable accepting checksum for UDP6 */
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index efdab50a58a0..4174a302eeea 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -117,7 +117,6 @@
#include <net/sock_reuseport.h>
#include <net/addrconf.h>
#include <net/udp_tunnel.h>
-#include <net/udplite.h>
#include <net/gro.h>
#if IS_ENABLED(CONFIG_IPV6)
#include <net/ipv6_stubs.h>
@@ -2917,7 +2916,6 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
struct udp_sock *up = udp_sk(sk);
int val, valbool;
int err = 0;
- int is_udplite = IS_UDPLITE(sk);
if (level == SOL_SOCKET) {
err = sk_setsockopt(sk, level, optname, optval, optlen);
@@ -3004,36 +3002,6 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
sockopt_release_sock(sk);
break;
- /*
- * UDP-Lite's partial checksum coverage (RFC 3828).
- */
- /* The sender sets actual checksum coverage length via this option.
- * The case coverage > packet length is handled by send module. */
- case UDPLITE_SEND_CSCOV:
- if (!is_udplite) /* Disable the option on UDP sockets */
- return -ENOPROTOOPT;
- if (val != 0 && val < 8) /* Illegal coverage: use default (8) */
- val = 8;
- else if (val > USHRT_MAX)
- val = USHRT_MAX;
- WRITE_ONCE(up->pcslen, val);
- udp_set_bit(UDPLITE_SEND_CC, sk);
- break;
-
- /* The receiver specifies a minimum checksum coverage value. To make
- * sense, this should be set to at least 8 (as done below). If zero is
- * used, this again means full checksum coverage. */
- case UDPLITE_RECV_CSCOV:
- if (!is_udplite) /* Disable the option on UDP sockets */
- return -ENOPROTOOPT;
- if (val != 0 && val < 8) /* Avoid silly minimal values. */
- val = 8;
- else if (val > USHRT_MAX)
- val = USHRT_MAX;
- WRITE_ONCE(up->pcrlen, val);
- udp_set_bit(UDPLITE_RECV_CC, sk);
- break;
-
default:
err = -ENOPROTOOPT;
break;
@@ -3046,7 +3014,7 @@ EXPORT_IPV6_MOD(udp_lib_setsockopt);
static int udp_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval,
unsigned int optlen)
{
- if (level == SOL_UDP || level == SOL_UDPLITE || level == SOL_SOCKET)
+ if (level == SOL_UDP || level == SOL_SOCKET)
return udp_lib_setsockopt(sk, level, optname,
optval, optlen,
udp_push_pending_frames);
@@ -3092,16 +3060,6 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname,
val = udp_test_bit(GRO_ENABLED, sk);
break;
- /* The following two cannot be changed on UDP sockets, the return is
- * always 0 (which corresponds to the full checksum coverage of UDP). */
- case UDPLITE_SEND_CSCOV:
- val = READ_ONCE(up->pcslen);
- break;
-
- case UDPLITE_RECV_CSCOV:
- val = READ_ONCE(up->pcrlen);
- break;
-
default:
return -ENOPROTOOPT;
}
@@ -3117,7 +3075,7 @@ EXPORT_IPV6_MOD(udp_lib_getsockopt);
static int udp_getsockopt(struct sock *sk, int level, int optname,
char __user *optval, int __user *optlen)
{
- if (level == SOL_UDP || level == SOL_UDPLITE)
+ if (level == SOL_UDP)
return udp_lib_getsockopt(sk, level, optname, optval, optlen);
return ip_getsockopt(sk, level, optname, optval, optlen);
}
diff --git a/net/ipv6/ip6_checksum.c b/net/ipv6/ip6_checksum.c
index 8bb68a0cdfd6..e1a594873675 100644
--- a/net/ipv6/ip6_checksum.c
+++ b/net/ipv6/ip6_checksum.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <net/ip.h>
+#include <net/ip6_checksum.h>
#include <net/udp.h>
-#include <net/udplite.h>
#include <asm/checksum.h>
#ifndef _HAVE_ARCH_IPV6_CSUM
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 402b3b821480..49c315d0154d 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -58,7 +58,6 @@
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <trace/events/skb.h>
-#include <net/udplite.h>
static void udpv6_destruct_sock(struct sock *sk)
{
@@ -1832,7 +1831,7 @@ static void udpv6_destroy_sock(struct sock *sk)
static int udpv6_setsockopt(struct sock *sk, int level, int optname,
sockptr_t optval, unsigned int optlen)
{
- if (level == SOL_UDP || level == SOL_UDPLITE || level == SOL_SOCKET)
+ if (level == SOL_UDP || level == SOL_SOCKET)
return udp_lib_setsockopt(sk, level, optname,
optval, optlen,
udp_v6_push_pending_frames);
@@ -1842,7 +1841,7 @@ static int udpv6_setsockopt(struct sock *sk, int level, int optname,
static int udpv6_getsockopt(struct sock *sk, int level, int optname,
char __user *optval, int __user *optlen)
{
- if (level == SOL_UDP || level == SOL_UDPLITE)
+ if (level == SOL_UDP)
return udp_lib_getsockopt(sk, level, optname, optval, optlen);
return ipv6_getsockopt(sk, level, optname, optval, optlen);
}
--
2.53.0.473.g4a7958ca14-goog
next prev parent reply other threads:[~2026-03-04 19:30 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 19:28 [PATCH v1 net-next 00/15] udp: Retire UDP-Lite Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 01/15] udp: Make udp[46]_seq_show() static Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 02/15] ipv6: Retire UDP-Lite Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 03/15] ipv6: Remove UDP-Lite support for IPV6_ADDRFORM Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 04/15] ipv4: Retire UDP-Lite Kuniyuki Iwashima
2026-03-05 15:03 ` kernel test robot
2026-03-05 19:42 ` Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 05/15] udp: Remove UDP-Lite SNMP stats Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 06/15] smack: Remove IPPROTO_UDPLITE support in security_sock_rcv_skb() Kuniyuki Iwashima
2026-03-05 17:08 ` Casey Schaufler
2026-03-04 19:28 ` [PATCH v1 net-next 07/15] udp: Remove partial csum code in RX Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 08/15] udp: Remove partial csum code in TX Kuniyuki Iwashima
2026-03-04 19:28 ` Kuniyuki Iwashima [this message]
2026-03-04 22:47 ` [PATCH v1 net-next 09/15] udp: Remove UDPLITE_SEND_CSCOV and UDPLITE_RECV_CSCOV Willem de Bruijn
2026-03-05 0:09 ` Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 10/15] udp: Remove struct proto.h.udp_table Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 11/15] udp: Remove udp_table in struct udp_seq_afinfo Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 12/15] udp: Remove dead check in __udp[46]_lib_lookup() for BPF Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 13/15] udp: Don't pass udptable to IPv6 socket lookup functions Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 14/15] udp: Don't pass udptable to IPv4 " Kuniyuki Iwashima
2026-03-04 19:28 ` [PATCH v1 net-next 15/15] udp: Don't pass proto to __udp4_lib_rcv() and __udp6_lib_rcv() Kuniyuki Iwashima
2026-03-04 19:53 ` [PATCH v1 net-next 00/15] udp: Retire UDP-Lite Florian Westphal
2026-03-04 20:10 ` Kuniyuki Iwashima
2026-03-04 23:20 ` Willem de Bruijn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260304193034.1870586-10-kuniyu@google.com \
--to=kuniyu@google.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox