udp: Retire UDP-Lite.
Subsystems (11)
Kuniyuki Iwashima
maintainerv2 cover udp: Retire UDP-Lite.
In 2023, syzbot found a null-ptr-deref bug triggered when UDP-Lite attempted to charge an skb after the total memory usage for UDP-Lite _and_ UDP exceeded a system-wide threshold, net.ipv4.udp_mem[1].
Since this threshold is shared with UDP, the bug would have been easy to trigger if any real-world applications were using UDP-Lite; however, only syzbot ever stumbled upon it.
The bug had persisted since 2016, suggesting that UDP-Lite had remained unused for 7 years at that point.
The bug was fixed in commit ad42a35bdfc6 ("udplite: Fix NULL pointer dereference in __sk_mem_raise_allocated()."), and we added another commit be28c14ac8bb ("udplite: Print deprecation notice.") to announce the deprecation plan.
Since then, no one has complained, so it is time to officially retire UDP-Lite.
This series first removes IPv6 and IPv4 UDP-Lite sockets, then gradually cleans up the remaining dead/unnecessary code within the UDP stack.
By removing a bunch of conditionals for UDP-Lite from the fast path, udp_rr with 20,000 flows sees a 10% increase in pps (13.3 Mpps -> 14.7 Mpps) on an AMD EPYC 7B12 (Zen 2) 64-Core Processor platform.
[ With FDO, the baseline is much higher and the delta was ~3%,
20.1 Mpps -> 20.7 Mpps ]
Before:
$ nstat > /dev/null; sleep 1; nstat | grep Udp Udp6InDatagrams 14013408 0.0 Udp6OutDatagrams 14013128 0.0
After:
$ nstat > /dev/null; sleep 1; nstat | grep Udp Udp6InDatagrams 15491971 0.0 Udp6OutDatagrams 15491671 0.0
$ ./scripts/bloat-o-meter vmlinux.before vmlinux.after add/remove: 13/75 grow/shrink: 11/75 up/down: 13777/-18401 (-4624) Function old new delta udp4_gro_receive 872 866 -6 udp6_gro_receive 910 903 -7 udp_rcv 32 1727 +1695 udpv6_rcv 32 1450 +1418 __udp4_lib_rcv 2045 - -2045 __udp6_lib_rcv 2084 - -2084 udp_unicast_rcv_skb 160 149 -11 udp6_unicast_rcv_skb 196 181 -15 __udp4_lib_mcast_deliver 925 846 -79 __udp6_lib_mcast_deliver 922 810 -112 __udp4_lib_lookup 973 969 -4 __udp6_lib_lookup 940 929 -11 __udp4_lib_lookup_skb 106 100 -6 __udp6_lib_lookup_skb 71 66 -5 udp4_lib_lookup_skb 132 127 -5 udp6_lib_lookup_skb 87 81 -6 udp_queue_rcv_skb 326 356 +30 udpv6_queue_rcv_skb 331 361 +30 udp_queue_rcv_one_skb 1233 914 -319 udpv6_queue_rcv_one_skb 1250 930 -320 __udp_enqueue_schedule_skb 1067 995 -72 udp_rcv_segment 520 480 -40 udp_post_segment_fix_csum 120 - -120 udp_lib_checksum_complete 200 84 -116 udp_err 27 1103 +1076 udpv6_err 36 1417 +1381 __udp4_lib_err 1112 - -1112 __udp6_lib_err 1448 - -1448 udp_recvmsg 1149 994 -155 udpv6_recvmsg 1349 1294 -55 udp_sendmsg 2730 2648 -82 udp_send_skb 909 681 -228 udpv6_sendmsg 3022 2861 -161 udp_v6_send_skb 1214 952 -262 ... Total: Before=18446744073748075501, After=18446744073748070877, chg -0.00%
Changes:
v2:
Patch 4 : Make udp_seq_ops static
Patch 9 : Add a detailed reason in include/uapi/linux/udp.h
v1: https://lore.kernel.org/netdev/[email protected]/
Kuniyuki Iwashima (15):
udp: Make udp[46]_seq_show() static.
ipv6: Retire UDP-Lite.
ipv6: Remove UDP-Lite support for IPV6_ADDRFORM.
ipv4: Retire UDP-Lite.
udp: Remove UDP-Lite SNMP stats.
smack: Remove IPPROTO_UDPLITE support in security_sock_rcv_skb().
udp: Remove partial csum code in RX.
udp: Remove partial csum code in TX.
udp: Remove UDPLITE_SEND_CSCOV and UDPLITE_RECV_CSCOV.
udp: Remove struct proto.h.udp_table.
udp: Remove udp_table in struct udp_seq_afinfo.
udp: Remove dead check in __udp[46]_lib_lookup() for BPF.
udp: Don't pass udptable to IPv6 socket lookup functions.
udp: Don't pass udptable to IPv4 socket lookup functions.
udp: Don't pass proto to __udp4_lib_rcv() and __udp6_lib_rcv().
include/linux/udp.h | 10 +- include/net/ipv6.h | 2 - include/net/ipv6_stubs.h | 7 +- include/net/netns/mib.h | 5 - include/net/sock.h | 5 +- include/net/transp_v6.h | 3 - include/net/udp.h | 86 +++----- include/net/udplite.h | 88 -------- include/uapi/linux/udp.h | 2 + net/core/filter.c | 5 +- net/ipv4/Makefile | 2 +- net/ipv4/af_inet.c | 12 -- net/ipv4/proc.c | 16 -- net/ipv4/udp.c | 428 ++++++++++++------------------------- net/ipv4/udp_bpf.c | 2 - net/ipv4/udp_diag.c | 128 +++-------- net/ipv4/udp_impl.h | 27 --- net/ipv4/udp_offload.c | 3 +- net/ipv4/udplite.c | 135 ------------ net/ipv6/Makefile | 2 +- net/ipv6/af_inet6.c | 32 +-- net/ipv6/ip6_checksum.c | 2 +- net/ipv6/ipv6_sockglue.c | 17 +- net/ipv6/proc.c | 16 -- net/ipv6/udp.c | 305 ++++++++++---------------- net/ipv6/udp_impl.h | 31 --- net/ipv6/udp_offload.c | 3 +- net/ipv6/udplite.c | 139 ------------ net/rxrpc/output.c | 2 - security/smack/smack_lsm.c | 4 +- 30 files changed, 341 insertions(+), 1178 deletions(-) delete mode 100644 include/net/udplite.h delete mode 100644 net/ipv4/udp_impl.h delete mode 100644 net/ipv4/udplite.c delete mode 100644 net/ipv6/udp_impl.h delete mode 100644 net/ipv6/udplite.c
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 1/15 udp: Make udp[46]_seq_show() static.
Since commit a3d2599b2446 ("ipv{4,6}/udp{,lite}: simplify proc registration"), udp4_seq_show() and udp6_seq_show() are not used in net/ipv4/udplite.c and net/ipv6/udplite.c.
Instead, udp_seq_ops and udp6_seq_ops are exposed to UDP-Lite.
Let's make udp4_seq_show() and udp6_seq_show() static.
udp_seq_ops and udp6_seq_ops are moved to udp_impl.h so that we can make them static when the header is removed.
--- include/net/udp.h | 3 --- net/ipv4/udp.c | 3 +-- net/ipv4/udp_impl.h | 2 +- net/ipv6/udp.c | 3 +-- net/ipv6/udp_impl.h | 2 +- 5 files changed, 4 insertions(+), 9 deletions(-)
include/net/udp.h +0 -3
@@ -576,9 +576,6 @@ void *udp_seq_start(struct seq_file *seq, loff_t *pos);void *udp_seq_next (struct seq_file *seq,void *v,loff_t *pos);void udp_seq_stop (struct seq_file *seq,void *v); -extern const struct seq_operations udp_seq_ops; -extern const struct seq_operations udp6_seq_ops; -int udp4_proc_init (void );void udp4_proc_exit (void );#endif /* CONFIG_PROC_FS */
net/ipv4/udp.c +1 -2
@@ -3438,7 +3438,7 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f, sk_drops_read(sp)); } -int udp4_seq_show (struct seq_file *seq,void *v) +static int udp4_seq_show (struct seq_file *seq,void *v) {seq_setwidth (seq,127 );if (v ==SEQ_START_TOKEN )
@@ -3748,7 +3748,6 @@ const struct seq_operations udp_seq_ops = { .stop = udp_seq_stop, .show = udp4_seq_show, }; -EXPORT_IPV6_MOD (udp_seq_ops);static struct udp_seq_afinfo udp4_seq_afinfo = { .family =AF_INET ,
net/ipv4/udp_impl.h +1 -1
@@ -22,6 +22,6 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int flags);void udp_destroy_sock (struct sock *sk);#ifdef CONFIG_PROC_FS -int udp4_seq_show (struct seq_file *seq,void *v); +extern const struct seq_operations udp_seq_ops;#endif #endif /* _UDP4_IMPL_H */
net/ipv6/udp.c +1 -2
@@ -1903,7 +1903,7 @@ int udpv6_getsockopt(struct sock *sk, int level, int optname,/* ------------------------------------------------------------------------ */ #ifdef CONFIG_PROC_FS -int udp6_seq_show (struct seq_file *seq,void *v) +static int udp6_seq_show (struct seq_file *seq,void *v) {if (v ==SEQ_START_TOKEN ) {seq_puts (seq,IPV6_SEQ_DGRAM_HEADER );
@@ -1924,7 +1924,6 @@ const struct seq_operations udp6_seq_ops = { .stop = udp_seq_stop, .show = udp6_seq_show, }; -EXPORT_SYMBOL (udp6_seq_ops);static struct udp_seq_afinfo udp6_seq_afinfo = { .family =AF_INET6 ,
net/ipv6/udp_impl.h +1 -1
@@ -26,6 +26,6 @@ int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int flags);void udpv6_destroy_sock (struct sock *sk);#ifdef CONFIG_PROC_FS -int udp6_seq_show (struct seq_file *seq,void *v); +extern const struct seq_operations udp6_seq_ops;#endif #endif /* _UDP6_IMPL_H */
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 2/15 ipv6: Retire UDP-Lite.
In reply to Kuniyuki IwashimaAs announced in commit be28c14ac8bb ("udplite: Print deprecation notice."), it's time to deprecate UDP-Lite.
As a first step, let's drop support for IPv6 UDP-Lite sockets.
We will remove the remaining dead code gradually.
Along with the removal of udplite.c, most of the functions exposed via udp_impl.h are made static.
The prototypes of udpv6_sendmsg() and udpv6_recvmsg() are moved to udp.h, but only udpv6_recvmsg() has INDIRECT_CALLABLE_DECLARE() because udpv6_sendmsg() is exported for rxrpc since commit ed472b0c8783 ("rxrpc: Call udp_sendmsg() directly").
Also, udpv6_recvmsg() needs INDIRECT_CALLABLE_SCOPE for CONFIG_MITIGATION_RETPOLINE=n.
Note that udplite.h is included temporarily for udplite_csum().
--- include/net/ipv6.h | 2 - include/net/transp_v6.h | 3 - include/net/udp.h | 4 ++ net/ipv6/Makefile | 2 +- net/ipv6/af_inet6.c | 23 +------ net/ipv6/proc.c | 2 - net/ipv6/udp.c | 32 ++++----- net/ipv6/udp_impl.h | 31 --------- net/ipv6/udplite.c | 139 ---------------------------------------- net/rxrpc/output.c | 2 - 10 files changed, 23 insertions(+), 217 deletions(-) delete mode 100644 net/ipv6/udp_impl.h delete mode 100644 net/ipv6/udplite.c
include/net/ipv6.h +0 -2
@@ -1179,8 +1179,6 @@ int tcp6_proc_init(struct net *net);void tcp6_proc_exit (struct net *net);int udp6_proc_init (struct net *net);void udp6_proc_exit (struct net *net); -int udplite6_proc_init (void ); -void udplite6_proc_exit (void );int ipv6_misc_proc_init (void );void ipv6_misc_proc_exit (void );int snmp6_register_dev (struct inet6_dev *idev);
include/net/transp_v6.h +0 -3
@@ -8,7 +8,6 @@/* IPv6 transport protocols */ extern struct proto rawv6_prot;extern struct proto udpv6_prot; -extern struct proto udplitev6_prot;extern struct proto tcpv6_prot;extern struct proto pingv6_prot;
@@ -28,8 +27,6 @@ int rawv6_init(void);void rawv6_exit (void );int udpv6_init (void );void udpv6_exit (void ); -int udplitev6_init (void ); -void udplitev6_exit (void );int tcpv6_init (void );void tcpv6_exit (void );
include/net/udp.h +4 -0
@@ -282,6 +282,10 @@ typedef struct sock *(*udp_lookup_t)(const struct sk_buff *skb, __be16 sport,void udp_v6_early_demux (struct sk_buff *skb); INDIRECT_CALLABLE_DECLARE(int udpv6_rcv(struct sk_buff *)); +int udpv6_sendmsg (struct sock *sk,struct msghdr *msg,size_t len); +INDIRECT_CALLABLE_DECLARE(int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, +size_t len,int flags)); +struct sk_buff *__udp_gso_segment (struct sk_buff *gso_skb,netdev_features_t features,bool is_ipv6);
net/ipv6/Makefile +1 -1
@@ -7,7 +7,7 @@ obj-$(CONFIG_IPV6) += ipv6.o ipv6-y := af_inet6.o anycast.o ip6_output.o ip6_input.o addrconf.o \ addrlabel.o \ - route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o udplite.o \ + route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o \ raw.o icmp.o mcast.o reassembly.o tcp_ipv6.o ping.o \ exthdrs.o datagram.o ip6_flowlabel.o inet6_connection_sock.o \ udp_offload.o seg6.o fib6_notifier.o rpl.o ioam6.o
net/ipv6/af_inet6.c +1 -22
@@ -43,7 +43,6 @@#include <net/ip.h> #include <net/ipv6.h> #include <net/udp.h> -#include <net/udplite.h> #include <net/tcp.h> #include <net/ping.h> #include <net/protocol.h>
@@ -644,8 +643,6 @@ int inet6_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)EXPORT_SYMBOL_GPL (inet6_compat_ioctl);#endif /* CONFIG_COMPAT */ -INDIRECT_CALLABLE_DECLARE(int udpv6_sendmsg(struct sock *, struct msghdr *, -size_t ));int inet6_sendmsg (struct socket *sock,struct msghdr *msg,size_t size) {struct sock *sk = sock->sk;
@@ -660,8 +657,6 @@ int inet6_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) sk, msg, size); } -INDIRECT_CALLABLE_DECLARE(int udpv6_recvmsg(struct sock *, struct msghdr *, -size_t ,int ));int inet6_recvmsg (struct socket *sock,struct msghdr *msg,size_t size,int flags) {
@@ -1088,13 +1083,9 @@ static int __init inet6_init(void)if (err) goto out_unregister_tcp_proto; - err =proto_register (&udplitev6_prot,1 ); -if (err) - goto out_unregister_udp_proto; - err =proto_register (&rawv6_prot,1 );if (err) - goto out_unregister_udplite_proto; + goto out_unregister_udp_proto; err =proto_register (&pingv6_prot,1 );if (err)
@@ -1145,8 +1136,6 @@ static int __init inet6_init(void) err = -ENOMEM ;if (raw6_proc_init ()) goto proc_raw6_fail; -if (udplite6_proc_init ()) - goto proc_udplite6_fail;if (ipv6_misc_proc_init ()) goto proc_misc6_fail;if (if6_proc_init ())
@@ -1182,10 +1171,6 @@ static int __init inet6_init(void)if (err) goto udpv6_fail; - err =udplitev6_init (); -if (err) - goto udplitev6_fail; - err =udpv6_offload_init ();if (err) goto udpv6_offload_fail;
@@ -1256,8 +1241,6 @@ static int __init inet6_init(void) tcpv6_fail:udpv6_offload_exit (); udpv6_offload_fail: -udplitev6_exit (); -udplitev6_fail:udpv6_exit (); udpv6_fail:ipv6_frag_exit ();
@@ -1279,8 +1262,6 @@ static int __init inet6_init(void) proc_if6_fail:ipv6_misc_proc_exit (); proc_misc6_fail: -udplite6_proc_exit (); -proc_udplite6_fail:raw6_proc_exit (); proc_raw6_fail:#endif
@@ -1304,8 +1285,6 @@ static int __init inet6_init(void)proto_unregister (&pingv6_prot); out_unregister_raw_proto:proto_unregister (&rawv6_prot); -out_unregister_udplite_proto: -proto_unregister (&udplitev6_prot); out_unregister_udp_proto:proto_unregister (&udpv6_prot); out_unregister_tcp_proto:
net/ipv6/proc.c +0 -2
@@ -39,8 +39,6 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v) sock_prot_inuse_get(net, &tcpv6_prot));seq_printf (seq,"UDP6: inuse %d\n" ,sock_prot_inuse_get (net, &udpv6_prot)); -seq_printf (seq,"UDPLITE6: inuse %d\n" , -sock_prot_inuse_get (net, &udplitev6_prot));seq_printf (seq,"RAW6: inuse %d\n" ,sock_prot_inuse_get (net, &rawv6_prot)); seq_printf(seq, "FRAG6: inuse %u memory %lu\n",
net/ipv6/udp.c +17 -15
@@ -37,6 +37,7 @@#include <trace/events/udp.h> #include <net/addrconf.h> +#include <net/aligned_data.h> #include <net/ndisc.h> #include <net/protocol.h> #include <net/transp_v6.h>
@@ -57,7 +58,7 @@#include <linux/proc_fs.h> #include <linux/seq_file.h> #include <trace/events/skb.h> -#include "udp_impl.h" +#include <net/udplite.h> static void udpv6_destruct_sock (struct sock *sk) {
@@ -65,7 +66,7 @@ static void udpv6_destruct_sock(struct sock *sk)inet6_sock_destruct (sk); } -int udpv6_init_sock (struct sock *sk) +static int udpv6_init_sock (struct sock *sk) {int res =udp_lib_init_sock (sk);
@@ -95,7 +96,7 @@ u32 udp6_ehashfn(const struct net *net, udp6_ehash_secret + net_hash_mix(net)); } -int udp_v6_get_port (struct sock *sk,unsigned short snum) +static int udp_v6_get_port (struct sock *sk,unsigned short snum) {unsigned int hash2_nulladdr =ipv6_portaddr_hash (sock_net (sk), &in6addr_any, snum);
@@ -107,7 +108,7 @@ int udp_v6_get_port(struct sock *sk, unsigned short snum)return udp_lib_get_port (sk, snum, hash2_nulladdr); } -void udp_v6_rehash (struct sock *sk) +static void udp_v6_rehash (struct sock *sk) { u16 new_hash = ipv6_portaddr_hash(sock_net(sk), &sk->sk_v6_rcv_saddr,
@@ -464,6 +465,7 @@ static int udp6_skb_len(struct sk_buff *skb)* return it, otherwise we block. */ +INDIRECT_CALLABLE_SCOPE int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,int flags) {
@@ -700,9 +702,9 @@ static struct sock *__udp6_lib_err_encap(struct net *net,return sk; } -int __udp6_lib_err (struct sk_buff *skb,struct inet6_skb_parm *opt, -u8 type,u8 code,int offset,__be32 info, -struct udp_table *udptable) +static int __udp6_lib_err (struct sk_buff *skb,struct inet6_skb_parm *opt, +u8 type,u8 code,int offset,__be32 info, +struct udp_table *udptable) {struct ipv6_pinfo *np;const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data;
@@ -1115,8 +1117,8 @@ static int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto)return 0 ; } -int __udp6_lib_rcv (struct sk_buff *skb,struct udp_table *udptable, -int proto) +static int __udp6_lib_rcv (struct sk_buff *skb,struct udp_table *udptable, +int proto) {enum skb_drop_reason reason =SKB_DROP_REASON_NOT_SPECIFIED ;const struct in6_addr *saddr, *daddr;
@@ -1854,7 +1856,7 @@ static void udpv6_splice_eof(struct socket *sock)release_sock (sk); } -void udpv6_destroy_sock (struct sock *sk) +static void udpv6_destroy_sock (struct sock *sk) {struct udp_sock *up =udp_sk (sk);lock_sock (sk);
@@ -1882,8 +1884,8 @@ void udpv6_destroy_sock(struct sock *sk)/* * Socket option code for UDP */ -int udpv6_setsockopt (struct sock *sk,int level,int optname,sockptr_t optval, -unsigned int optlen) +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 ) return udp_lib_setsockopt(sk, level, optname,
@@ -1892,8 +1894,8 @@ int udpv6_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval,return ipv6_setsockopt (sk, level, optname, optval, optlen); } -int udpv6_getsockopt (struct sock *sk,int level,int optname, -char __user *optval,int __user *optlen) +static int udpv6_getsockopt (struct sock *sk,int level,int optname, +char __user *optval,int __user *optlen) {if (level ==SOL_UDP || level ==SOL_UDPLITE )return udp_lib_getsockopt (sk, level, optname, optval, optlen);
@@ -1918,7 +1920,7 @@ static int udp6_seq_show(struct seq_file *seq, void *v)return 0 ; } -const struct seq_operations udp6_seq_ops = { +static const struct seq_operations udp6_seq_ops = { .start = udp_seq_start, .next = udp_seq_next, .stop = udp_seq_stop,
net/ipv6/udp_impl.h deleted +0 -31
@@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _UDP6_IMPL_H -#define _UDP6_IMPL_H -#include <net/aligned_data.h> -#include <net/udp.h> -#include <net/udplite.h> -#include <net/protocol.h> -#include <net/addrconf.h> -#include <net/inet_common.h> -#include <net/transp_v6.h> - -int __udp6_lib_rcv (struct sk_buff *,struct udp_table *,int ); -int __udp6_lib_err (struct sk_buff *,struct inet6_skb_parm *,u8 ,u8 ,int , -__be32 ,struct udp_table *); - -int udpv6_init_sock (struct sock *sk); -int udp_v6_get_port (struct sock *sk,unsigned short snum); -void udp_v6_rehash (struct sock *sk); - -int udpv6_getsockopt (struct sock *sk,int level,int optname, -char __user *optval,int __user *optlen); -int udpv6_setsockopt (struct sock *sk,int level,int optname,sockptr_t optval, -unsigned int optlen); -int udpv6_sendmsg (struct sock *sk,struct msghdr *msg,size_t len); -int udpv6_recvmsg (struct sock *sk,struct msghdr *msg,size_t len,int flags); -void udpv6_destroy_sock (struct sock *sk); - -#ifdef CONFIG_PROC_FS -extern const struct seq_operations udp6_seq_ops; -#endif -#endif /* _UDP6_IMPL_H */
net/ipv6/udplite.c deleted +0 -139
139 lines not on this page · raw message
net/rxrpc/output.c +0 -2
@@ -16,8 +16,6 @@#include <net/udp.h> #include "ar-internal.h" -extern int udpv6_sendmsg (struct sock *sk,struct msghdr *msg,size_t len); -ssize_t do_udp_sendmsg (struct socket *socket,struct msghdr *msg,size_t len) {struct sockaddr *sa = msg->msg_name;
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 3/15 ipv6: Remove UDP-Lite support for IPV6_ADDRFORM.
In reply to Kuniyuki IwashimaWe cannot create IPv6 UDP-Lite sockets anymore.
Let's remove dead code in IPV6_ADDRFORM.
--- net/ipv6/ipv6_sockglue.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
net/ipv6/ipv6_sockglue.c +4 -13
@@ -45,7 +45,6 @@#include <net/inet_common.h> #include <net/tcp.h> #include <net/udp.h> -#include <net/udplite.h> #include <net/xfrm.h> #include <net/compat.h> #include <net/seg6.h>
@@ -563,10 +562,8 @@ int do_ipv6_setsockopt(struct sock *sk, int level, int optname,if (sk->sk_type ==SOCK_RAW )break ; -if (sk->sk_protocol ==IPPROTO_UDP || - sk->sk_protocol ==IPPROTO_UDPLITE ) { -struct udp_sock *up =udp_sk (sk); -if (up->pending ==AF_INET6 ) { +if (sk->sk_protocol ==IPPROTO_UDP ) { +if (udp_sk (sk)->pending ==AF_INET6 ) { retv = -EBUSY ;break ; }
@@ -607,16 +604,11 @@ int do_ipv6_setsockopt(struct sock *sk, int level, int optname,WRITE_ONCE (sk->sk_family,PF_INET );tcp_sync_mss (sk, icsk->icsk_pmtu_cookie); }else { -struct proto *prot = &udp_prot; - -if (sk->sk_protocol ==IPPROTO_UDPLITE ) - prot = &udplite_prot; -sock_prot_inuse_add (net, sk->sk_prot,-1 ); -sock_prot_inuse_add (net, prot,1 ); +sock_prot_inuse_add (net, &udp_prot,1 );/* Paired with READ_ONCE(sk->sk_prot) in inet6_dgram_ops */ -WRITE_ONCE (sk->sk_prot, prot); +WRITE_ONCE (sk->sk_prot, &udp_prot);WRITE_ONCE (sk->sk_socket->ops, &inet_dgram_ops);WRITE_ONCE (sk->sk_family,PF_INET ); }
@@ -1098,7 +1090,6 @@ int do_ipv6_getsockopt(struct sock *sk, int level, int optname,switch (optname) {case IPV6_ADDRFORM :if (sk->sk_protocol !=IPPROTO_UDP && - sk->sk_protocol !=IPPROTO_UDPLITE && sk->sk_protocol !=IPPROTO_TCP )return -ENOPROTOOPT ;if (sk->sk_state !=TCP_ESTABLISHED )
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 4/15 ipv4: Retire UDP-Lite.
In reply to Kuniyuki IwashimaWe have deprecated IPv6 UDP-Lite sockets.
Let's drop support for IPv4 UDP-Lite sockets as well.
Most of the changes are similar to the IPv6 patch: removing udplite.c and udp_impl.h, marking most functions in udp_impl.h as static, moving the prototype for udp_recvmsg() to udp.h, and adding INDIRECT_CALLABLE_SCOPE for it.
In addition, the INET_DIAG support for UDP-Lite is dropped.
We will remove the remaining dead code in the following patches.
---
v2: Make udp_seq_ops static
--- include/net/sock.h | 4 +- include/net/udp.h | 7 ++- include/net/udplite.h | 4 -- net/ipv4/Makefile | 2 +- net/ipv4/af_inet.c | 6 -- net/ipv4/proc.c | 3 - net/ipv4/udp.c | 33 ++++++----- net/ipv4/udp_bpf.c | 2 - net/ipv4/udp_diag.c | 47 +-------------- net/ipv4/udp_impl.h | 27 --------- net/ipv4/udplite.c | 135 ------------------------------------------ 11 files changed, 26 insertions(+), 244 deletions(-) delete mode 100644 net/ipv4/udp_impl.h delete mode 100644 net/ipv4/udplite.c
include/net/sock.h +2 -2
@@ -126,14 +126,14 @@ typedef __u64 __bitwise __addrpair;* @skc_bypass_prot_mem: bypass the per-protocol memory accounting for skb * @skc_bound_dev_if: bound device index if != 0 * @skc_bind_node: bind hash linkage for various protocol lookup tables -* @skc_portaddr_node: second hash linkage for UDP/UDP-Lite protocol +* @skc_portaddr_node: second hash linkage for UDP * @skc_prot: protocol handlers inside a network family * @skc_net: reference to the network namespace of this socket * @skc_v6_daddr: IPV6 destination address * @skc_v6_rcv_saddr: IPV6 source address * @skc_cookie: socket's cookie value * @skc_node: main hash linkage for various protocol lookup tables -* @skc_nulls_node: main hash linkage for TCP/UDP/UDP-Lite protocol +* @skc_nulls_node: main hash linkage for TCP * @skc_tx_queue_mapping: tx queue number for this connection * @skc_rx_queue_mapping: rx queue number for this connection * @skc_flags: place holder for sk_flags
include/net/udp.h +4 -3
@@ -105,7 +105,7 @@ struct udp_table {unsigned int log; };extern struct udp_table udp_table; -void udp_table_init (struct udp_table *,const char *); +static inline struct udp_hslot *udp_hashslot (struct udp_table *table,const struct net *net,unsigned int num)
@@ -312,7 +312,7 @@ static inline void udp_drops_inc(struct sock *sk)numa_drop_add (&udp_sk (sk)->drop_counters,1 ); } -/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ +/* hash routines shared between UDPv4/6 */ static inline int udp_lib_hash (struct sock *sk) {BUG ();
@@ -420,6 +420,8 @@ bool udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst);int udp_err (struct sk_buff *,u32 );int udp_abort (struct sock *sk,int err);int udp_sendmsg (struct sock *sk,struct msghdr *msg,size_t len); +INDIRECT_CALLABLE_DECLARE(int udp_recvmsg(struct sock *sk, struct msghdr *msg, +size_t len,int flags));void udp_splice_eof (struct socket *sock);int udp_push_pending_frames (struct sock *sk);void udp_flush_pending_frames (struct sock *sk);
@@ -427,7 +429,6 @@ int udp_cmsg_send(struct sock *sk, struct msghdr *msg, u16 *gso_size);void udp4_hwcsum (struct sk_buff *skb,__be32 src,__be32 dst);int udp_rcv (struct sk_buff *skb);int udp_ioctl (struct sock *sk,int cmd,int *karg); -int udp_init_sock (struct sock *sk);int udp_pre_connect (struct sock *sk,struct sockaddr_unsized *uaddr,int addr_len);int __udp_disconnect (struct sock *sk,int flags);int udp_disconnect (struct sock *sk,int flags);
include/net/udplite.h +0 -4
@@ -12,9 +12,6 @@#define UDPLITE_SEND_CSCOV 10/* sender partial coverage (as sent) */ #define UDPLITE_RECV_CSCOV 11/* receiver partial coverage (threshold ) */ -extern struct proto udplite_prot; -extern struct udp_table udplite_table; -/* * Checksum computation is all in software, hence simpler getfrag. */
@@ -84,5 +81,4 @@ static inline __wsum udplite_csum(struct sk_buff *skb) return skb_checksum(skb, off, len, 0); } -void udplite4_register (void );#endif /* _UDPLITE_H */
net/ipv4/Makefile +1 -1
@@ -10,7 +10,7 @@ obj-y := route.o inetpeer.o protocol.o \ tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o \ tcp_minisocks.o tcp_cong.o tcp_metrics.o tcp_fastopen.o \ tcp_recovery.o tcp_ulp.o \ - tcp_offload.o tcp_plb.o datagram.o raw.o udp.o udplite.o \ + tcp_offload.o tcp_plb.o datagram.o raw.o udp.o \ udp_offload.o arp.o icmp.o devinet.o af_inet.o igmp.o \ fib_frontend.o fib_semantics.o fib_trie.o fib_notifier.o \ inet_fragment.o ping.o ip_tunnel_core.o gre_offload.o \
net/ipv4/af_inet.c +0 -6
@@ -104,7 +104,6 @@#include <net/tcp.h> #include <net/psp.h> #include <net/udp.h> -#include <net/udplite.h> #include <net/ping.h> #include <linux/skbuff.h> #include <net/sock.h>
@@ -876,8 +875,6 @@ void inet_splice_eof(struct socket *sock) }EXPORT_SYMBOL_GPL (inet_splice_eof); -INDIRECT_CALLABLE_DECLARE(int udp_recvmsg(struct sock *, struct msghdr *, -size_t ,int ));int inet_recvmsg (struct socket *sock,struct msghdr *msg,size_t size,int flags) {
@@ -1975,9 +1972,6 @@ static int __init inet_init(void)/* Setup UDP memory threshold */ udp_init (); -/* Add UDP-Lite (RFC 3828) */ -udplite4_register (); -raw_init ();ping_init ();
net/ipv4/proc.c +0 -3
@@ -35,7 +35,6 @@#include <net/mptcp.h> #include <net/proto_memory.h> #include <net/udp.h> -#include <net/udplite.h> #include <linux/bottom_half.h> #include <linux/inetdevice.h> #include <linux/proc_fs.h>
@@ -65,8 +64,6 @@ static int sockstat_seq_show(struct seq_file *seq, void *v)seq_printf (seq,"UDP: inuse %d mem %ld\n" ,sock_prot_inuse_get (net, &udp_prot),proto_memory_allocated (&udp_prot)); -seq_printf (seq,"UDPLITE: inuse %d\n" , -sock_prot_inuse_get (net, &udplite_prot));seq_printf (seq,"RAW: inuse %d\n" ,sock_prot_inuse_get (net, &raw_prot)); seq_printf(seq, "FRAG: inuse %u memory %lu\n",
net/ipv4/udp.c +18 -15
@@ -98,8 +98,10 @@#include <linux/skbuff.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> +#include <net/aligned_data.h> #include <net/net_namespace.h> #include <net/icmp.h> +#include <net/inet_common.h> #include <net/inet_hashtables.h> #include <net/ip.h> #include <net/ip_tunnels.h>
@@ -112,10 +114,10 @@#include <linux/btf_ids.h> #include <trace/events/skb.h> #include <net/busy_poll.h> -#include "udp_impl.h" #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>
@@ -229,7 +231,7 @@ static int udp_reuseport_add_sock(struct sock *sk, struct udp_hslot *hslot) }/** -* udp_lib_get_port - UDP/-Lite port lookup for IPv4 and IPv6 +* udp_lib_get_port - UDP port lookup for IPv4 and IPv6 * * @sk: socket struct in question * @snum: port number to look up
@@ -353,7 +355,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum, }EXPORT_IPV6_MOD (udp_lib_get_port); -int udp_v4_get_port (struct sock *sk,unsigned short snum) +static int udp_v4_get_port (struct sock *sk,unsigned short snum) {unsigned int hash2_nulladdr =ipv4_portaddr_hash (sock_net (sk),htonl (INADDR_ANY ), snum);
@@ -928,7 +930,7 @@ static struct sock *__udp4_lib_err_encap(struct net *net,* to find the appropriate port. */ -int __udp4_lib_err (struct sk_buff *skb,u32 info,struct udp_table *udptable) +static int __udp4_lib_err (struct sk_buff *skb,u32 info,struct udp_table *udptable) {struct inet_sock *inet;const struct iphdr *iph = (const struct iphdr *)skb->data;
@@ -1855,7 +1857,7 @@ static void udp_destruct_sock(struct sock *sk)inet_sock_destruct (sk); } -int udp_init_sock (struct sock *sk) +static int udp_init_sock (struct sock *sk) {int res =udp_lib_init_sock (sk);
@@ -2070,6 +2072,7 @@ EXPORT_IPV6_MOD(udp_read_skb);* return it, otherwise we block. */ +INDIRECT_CALLABLE_SCOPE int udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int flags) {struct inet_sock *inet =inet_sk (sk);
@@ -2337,7 +2340,7 @@ void udp_lib_rehash(struct sock *sk, u16 newhash, u16 newhash4) }EXPORT_IPV6_MOD (udp_lib_rehash); -void udp_v4_rehash (struct sock *sk) +static void udp_v4_rehash (struct sock *sk) { u16 new_hash = ipv4_portaddr_hash(sock_net(sk), inet_sk(sk)->inet_rcv_saddr,
@@ -2683,8 +2686,8 @@ static int udp_unicast_rcv_skb(struct sock *sk, struct sk_buff *skb,* All we need to do is get the socket, and then do a checksum. */ -int __udp4_lib_rcv (struct sk_buff *skb,struct udp_table *udptable, -int proto) +static int __udp4_lib_rcv (struct sk_buff *skb,struct udp_table *udptable, +int proto) {struct sock *sk =NULL ;struct udphdr *uh;
@@ -2930,7 +2933,7 @@ int udp_rcv(struct sk_buff *skb)return __udp4_lib_rcv (skb,dev_net (skb->dev)->ipv4.udp_table,IPPROTO_UDP ); } -void udp_destroy_sock (struct sock *sk) +static void udp_destroy_sock (struct sock *sk) {struct udp_sock *up =udp_sk (sk);bool slow =lock_sock_fast (sk);
@@ -3120,8 +3123,8 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, }EXPORT_IPV6_MOD (udp_lib_setsockopt); -int udp_setsockopt (struct sock *sk,int level,int optname,sockptr_t optval, -unsigned int optlen) +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 ) return udp_lib_setsockopt(sk, level, optname,
@@ -3191,8 +3194,8 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, }EXPORT_IPV6_MOD (udp_lib_getsockopt); -int udp_getsockopt (struct sock *sk,int level,int optname, -char __user *optval,int __user *optlen) +static int udp_getsockopt (struct sock *sk,int level,int optname, +char __user *optval,int __user *optlen) {if (level ==SOL_UDP || level ==SOL_UDPLITE )return udp_lib_getsockopt (sk, level, optname, optval, optlen);
@@ -3742,7 +3745,7 @@ static unsigned short seq_file_family(const struct seq_file *seq)return afinfo->family; } -const struct seq_operations udp_seq_ops = { +static const struct seq_operations udp_seq_ops = { .start = udp_seq_start, .next = udp_seq_next, .stop = udp_seq_stop,
@@ -3801,7 +3804,7 @@ static int __init set_uhash_entries(char *str) }__setup ("uhash_entries=" , set_uhash_entries); -void __init udp_table_init (struct udp_table *table,const char *name) +static void __init udp_table_init (struct udp_table *table,const char *name) {unsigned int i, slot_size;
net/ipv4/udp_bpf.c +0 -2
@@ -7,8 +7,6 @@#include <net/inet_common.h> #include <asm/ioctls.h> -#include "udp_impl.h" -static struct proto *udpv6_prot_saved__read_mostly ; static int sk_udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
net/ipv4/udp_diag.c +1 -46
74 lines not on this page · raw message
net/ipv4/udp_impl.h deleted +0 -27
@@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _UDP4_IMPL_H -#define _UDP4_IMPL_H -#include <net/aligned_data.h> -#include <net/udp.h> -#include <net/udplite.h> -#include <net/protocol.h> -#include <net/inet_common.h> - -int __udp4_lib_rcv (struct sk_buff *,struct udp_table *,int ); -int __udp4_lib_err (struct sk_buff *,u32 ,struct udp_table *); - -int udp_v4_get_port (struct sock *sk,unsigned short snum); -void udp_v4_rehash (struct sock *sk); - -int udp_setsockopt (struct sock *sk,int level,int optname,sockptr_t optval, -unsigned int optlen); -int udp_getsockopt (struct sock *sk,int level,int optname, -char __user *optval,int __user *optlen); - -int udp_recvmsg (struct sock *sk,struct msghdr *msg,size_t len,int flags); -void udp_destroy_sock (struct sock *sk); - -#ifdef CONFIG_PROC_FS -extern const struct seq_operations udp_seq_ops; -#endif -#endif /* _UDP4_IMPL_H */
net/ipv4/udplite.c deleted +0 -135
135 lines not on this page · raw message
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 5/15 udp: Remove UDP-Lite SNMP stats.
In reply to Kuniyuki IwashimaSince UDP and UDP-Lite shared most of the code, we have had to check the protocol every time we increment SNMP stats.
Now that the UDP-Lite paths are dead, let's remove UDP-Lite SNMP stats.
--- include/net/netns/mib.h | 5 --- include/net/udp.h | 46 ++++++++++--------------- net/ipv4/af_inet.c | 6 ---- net/ipv4/proc.c | 13 ------- net/ipv4/udp.c | 75 ++++++++++++++++++----------------------- net/ipv6/af_inet6.c | 9 ++--- net/ipv6/proc.c | 14 -------- net/ipv6/udp.c | 48 +++++++++++--------------- 8 files changed, 71 insertions(+), 145 deletions(-)
include/net/netns/mib.h +0 -5
@@ -28,11 +28,6 @@ struct netns_mib { DEFINE_SNMP_STAT(struct mptcp_mib, mptcp_statistics);#endif - DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics); -#if IS_ENABLED (CONFIG_IPV6 ) - DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6); -#endif - DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics); DEFINE_SNMP_STAT_ATOMIC(struct icmpmsg_mib, icmpmsg_statistics);#if IS_ENABLED (CONFIG_IPV6 )
include/net/udp.h +18 -28
56 lines not on this page · raw message
net/ipv4/af_inet.c +0 -6
@@ -1723,9 +1723,6 @@ static __net_init int ipv4_mib_init_net(struct net *net) net->mib.udp_statistics = alloc_percpu(struct udp_mib);if (!net->mib.udp_statistics) goto err_udp_mib; - net->mib.udplite_statistics = alloc_percpu(struct udp_mib); -if (!net->mib.udplite_statistics) - goto err_udplite_mib; net->mib.icmp_statistics = alloc_percpu(struct icmp_mib);if (!net->mib.icmp_statistics) goto err_icmp_mib;
@@ -1739,8 +1736,6 @@ static __net_init int ipv4_mib_init_net(struct net *net) err_icmpmsg_mib:free_percpu (net->mib.icmp_statistics); err_icmp_mib: -free_percpu (net->mib.udplite_statistics); -err_udplite_mib:free_percpu (net->mib.udp_statistics); err_udp_mib:free_percpu (net->mib.net_statistics);
@@ -1756,7 +1751,6 @@ static __net_exit void ipv4_mib_exit_net(struct net *net) {kfree (net->mib.icmpmsg_statistics);free_percpu (net->mib.icmp_statistics); -free_percpu (net->mib.udplite_statistics);free_percpu (net->mib.udp_statistics);free_percpu (net->mib.net_statistics);free_percpu (net->mib.ip_statistics);
net/ipv4/proc.c +0 -13
@@ -444,19 +444,6 @@ static int snmp_seq_show_tcp_udp(struct seq_file *seq, void *v)for (i =0 ; i < udp_cnt; i++)seq_printf (seq," %lu" , buff[i]); -memset (buff,0 , udp_cnt *sizeof (unsigned long )); - -/* the UDP and UDP-Lite MIBs are the same */ -seq_puts (seq,"\nUdpLite:" ); -snmp_get_cpu_field_batch_cnt (buff, snmp4_udp_list, - udp_cnt, - net->mib.udplite_statistics); -for (i =0 ; i < udp_cnt; i++) -seq_printf (seq," %s" , snmp4_udp_list[i].name); -seq_puts (seq,"\nUdpLite:" ); -for (i =0 ; i < udp_cnt; i++) -seq_printf (seq," %lu" , buff[i]); -seq_putc (seq,'\n' );return 0 ; }
net/ipv4/udp.c +32 -43
185 lines not on this page · raw message
net/ipv6/af_inet6.c +2 -7
@@ -894,9 +894,7 @@ static int __net_init ipv6_init_mibs(struct net *net) net->mib.udp_stats_in6 = alloc_percpu(struct udp_mib);if (!net->mib.udp_stats_in6)return -ENOMEM ; - net->mib.udplite_stats_in6 = alloc_percpu(struct udp_mib); -if (!net->mib.udplite_stats_in6) - goto err_udplite_mib; + net->mib.ipv6_statistics = alloc_percpu(struct ipstats_mib);if (!net->mib.ipv6_statistics) goto err_ip_mib;
@@ -907,10 +905,10 @@ static int __net_init ipv6_init_mibs(struct net *net)u64_stats_init (&af_inet6_stats->syncp); } - net->mib.icmpv6_statistics = alloc_percpu(struct icmpv6_mib);if (!net->mib.icmpv6_statistics) goto err_icmp_mib; + net->mib.icmpv6msg_statistics = kzalloc_obj(struct icmpv6msg_mib);if (!net->mib.icmpv6msg_statistics) goto err_icmpmsg_mib;
@@ -921,8 +919,6 @@ static int __net_init ipv6_init_mibs(struct net *net) err_icmp_mib:free_percpu (net->mib.ipv6_statistics); err_ip_mib: -free_percpu (net->mib.udplite_stats_in6); -err_udplite_mib:free_percpu (net->mib.udp_stats_in6);return -ENOMEM ; }
@@ -930,7 +926,6 @@ static int __net_init ipv6_init_mibs(struct net *net)static void ipv6_cleanup_mibs (struct net *net) {free_percpu (net->mib.udp_stats_in6); -free_percpu (net->mib.udplite_stats_in6);free_percpu (net->mib.ipv6_statistics);free_percpu (net->mib.icmpv6_statistics);kfree (net->mib.icmpv6msg_statistics);
net/ipv6/proc.c +0 -14
@@ -108,17 +108,6 @@ static const struct snmp_mib snmp6_udp6_list[] = { SNMP_MIB_ITEM("Udp6MemErrors", UDP_MIB_MEMERRORS), }; -static const struct snmp_mib snmp6_udplite6_list[] = { -SNMP_MIB_ITEM ("UdpLite6InDatagrams" ,UDP_MIB_INDATAGRAMS ), -SNMP_MIB_ITEM ("UdpLite6NoPorts" ,UDP_MIB_NOPORTS ), -SNMP_MIB_ITEM ("UdpLite6InErrors" ,UDP_MIB_INERRORS ), -SNMP_MIB_ITEM ("UdpLite6OutDatagrams" ,UDP_MIB_OUTDATAGRAMS ), -SNMP_MIB_ITEM ("UdpLite6RcvbufErrors" ,UDP_MIB_RCVBUFERRORS ), -SNMP_MIB_ITEM ("UdpLite6SndbufErrors" ,UDP_MIB_SNDBUFERRORS ), -SNMP_MIB_ITEM ("UdpLite6InCsumErrors" ,UDP_MIB_CSUMERRORS ), -SNMP_MIB_ITEM ("UdpLite6MemErrors" ,UDP_MIB_MEMERRORS ), -}; -static void snmp6_seq_show_icmpv6msg (struct seq_file *seq,atomic_long_t *smib) {char name[32 ];
@@ -226,9 +215,6 @@ static int snmp6_seq_show(struct seq_file *seq, void *v)snmp6_seq_show_item (seq, net->mib.udp_stats_in6,NULL , snmp6_udp6_list,ARRAY_SIZE (snmp6_udp6_list)); -snmp6_seq_show_item (seq, net->mib.udplite_stats_in6, -NULL , snmp6_udplite6_list, -ARRAY_SIZE (snmp6_udplite6_list));return 0 ; }
net/ipv6/udp.c +19 -29
121 lines not on this page · raw message
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 6/15 smack: Remove IPPROTO_UDPLITE support in security_sock_rcv_skb().
In reply to Kuniyuki Iwashimasmack_socket_sock_rcv_skb() is registered as socket_sock_rcv_skb, which is called as security_sock_rcv_skb() in sk_filter_trim_cap().
Now that UDP-Lite is gone, let's remove the IPPROTO_UDPLITE support in smack_socket_sock_rcv_skb().
---
Cc: Paul Moore <[email protected]>
Cc: James Morris <[email protected]>
Cc: "Serge E. Hallyn" <[email protected]>
Cc: [email protected]
--- security/smack/smack_lsm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
security/smack/smack_lsm.c +1 -3
@@ -4176,7 +4176,6 @@ static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr_in6 *sip) sip->sin6_port = th->source;break ;case IPPROTO_UDP : -case IPPROTO_UDPLITE : uh =skb_header_pointer (skb, offset,sizeof (_udph), &_udph);if (uh !=NULL ) sip->sin6_port = uh->source;
@@ -4301,8 +4300,7 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)#if IS_ENABLED (CONFIG_IPV6 )case PF_INET6 : proto =smk_skb_to_addr_ipv6 (skb, &sadd); -if (proto !=IPPROTO_UDP && proto !=IPPROTO_UDPLITE && - proto !=IPPROTO_TCP ) +if (proto !=IPPROTO_UDP && proto !=IPPROTO_TCP )break ;#ifdef SMACK_IPV6_SECMARK_LABELING skp =smack_from_skb (skb);
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 7/15 udp: Remove partial csum code in RX.
In reply to Kuniyuki IwashimaUDP-Lite supports the partial checksum and the coverage is stored in the position of the length field of struct udphdr.
In RX paths, udp4_csum_init() / udp6_csum_init() save the value in UDP_SKB_CB(skb)->cscov and set UDP_SKB_CB(skb)->partial_cov to 1 if the coverage is not full.
The subsequent processing diverges depending on the value, but such paths are now dead.
Also, these functions have some code guarded for UDP:
* udp_unicast_rcv_skb / udp6_unicast_rcv_skb
* __udp4_lib_rcv() and __udp6_lib_rcv().
Let's remove the partial csum code and the unnecessary guard for UDP-Lite in RX.
--- include/net/udp.h | 17 ++------- include/net/udplite.h | 34 ------------------ net/ipv4/udp.c | 83 ++++++++----------------------------------- net/ipv6/udp.c | 83 +++++++++++-------------------------------- 4 files changed, 38 insertions(+), 179 deletions(-)
include/net/udp.h +3 -14
@@ -32,11 +32,9 @@#include <linux/math.h> /** -* struct udp_skb_cb - UDP(-Lite) private variables +* struct udp_skb_cb - UDP private variables * * @header: private variables used by IPv4/IPv6 -* @cscov: checksum coverage length (UDP-Lite only) -* @partial_cov: if set indicates partial csum coverage */ struct udp_skb_cb { union {
@@ -45,8 +43,6 @@ struct udp_skb_cb {struct inet6_skb_parm h6;#endif } header; -__u16 cscov; -__u8 partial_cov; };#define UDP_SKB_CB (__skb) ((struct udp_skb_cb *)((__skb)->cb))
@@ -216,13 +212,11 @@ extern int sysctl_udp_wmem_min;struct sk_buff ;/* -* Generic checksumming routines for UDP(-Lite) v4 and v6 +* Generic checksumming routines for UDP v4 and v6 */ static inline __sum16 __udp_lib_checksum_complete (struct sk_buff *skb) { -return (UDP_SKB_CB (skb)->cscov == skb->len ? -__skb_checksum_complete (skb) : -__skb_checksum_complete_head (skb,UDP_SKB_CB (skb)->cscov)); +return __skb_checksum_complete (skb); }static inline int udp_lib_checksum_complete (struct sk_buff *skb)
@@ -273,7 +267,6 @@ static inline void udp_csum_pull_header(struct sk_buff *skb) skb->csum =csum_partial (skb->data,sizeof (struct udphdr ), skb->csum);skb_pull_rcsum (skb,sizeof (struct udphdr )); -UDP_SKB_CB (skb)->cscov -=sizeof (struct udphdr ); } typedef struct sock *(*udp_lookup_t)(const struct sk_buff *skb, __be16 sport,
@@ -641,9 +634,6 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,static inline void udp_post_segment_fix_csum (struct sk_buff *skb) { -/* UDP-lite can't land here - no GRO */ -WARN_ON_ONCE (UDP_SKB_CB (skb)->partial_cov); -/* UDP packets generated with UDP_SEGMENT and traversing: * * UDP tunnel(xmit) -> veth (segmentation) -> veth (gro) -> UDP tunnel (rx)
@@ -657,7 +647,6 @@ static inline void udp_post_segment_fix_csum(struct sk_buff *skb)* a valid csum after the segmentation. * Additionally fixup the UDP CB. */ -UDP_SKB_CB (skb)->cscov = skb->len;if (skb->ip_summed ==CHECKSUM_NONE && !skb->csum_valid) skb->csum_valid =1 ; }
include/net/udplite.h +0 -34
@@ -25,40 +25,6 @@ static __inline__ int udplite_getfrag(void *from, char *to, int offset,/* * Checksumming routines */ -static inline int udplite_checksum_init (struct sk_buff *skb,struct udphdr *uh) -{ -u16 cscov; - -/* In UDPv4 a zero checksum means that the transmitter generated no -* checksum. UDP-Lite (like IPv6) mandates checksums, hence packets -* with a zero checksum field are illegal. */ -if (uh->check ==0 ) { -net_dbg_ratelimited ("UDPLite: zeroed checksum field\n" ); -return 1 ; - } - - cscov =ntohs (uh->len); - -if (cscov ==0 )/* Indicates that full coverage is required. */ - ; -else if (cscov <8 || cscov > skb->len) { -/* -* Coverage length violates RFC 3828: log and discard silently. -*/ -net_dbg_ratelimited ("UDPLite: bad csum coverage %d/%d\n" , - cscov, skb->len); -return 1 ; - - }else if (cscov < skb->len) { -UDP_SKB_CB (skb)->partial_cov =1 ; -UDP_SKB_CB (skb)->cscov = cscov; -if (skb->ip_summed ==CHECKSUM_COMPLETE ) - skb->ip_summed =CHECKSUM_NONE ; - skb->csum_valid =0 ; - } - -return 0 ; -}/* Fast-path computation of checksum. Socket may not be locked. */ static inline __wsum udplite_csum (struct sk_buff *skb)
net/ipv4/udp.c +14 -69
134 lines not on this page · raw message
net/ipv6/udp.c +21 -62
139 lines not on this page · raw message
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Paolo Abeni
maintainerRe: [v2,net-next,07/15] udp: Remove partial csum code in RX.
This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible.
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
udp: Remove partial csum code in RX.
This commit removes UDP-Lite specific partial checksum handling from UDP receive paths, including removal of UDP_SKB_CB fields, simplification of checksum initialization functions, and elimination of UDP-Lite guards.
Quoted 3 lines
include/net/udp.h +0
-0
[ ... ]
Quoted 3 lines
net/ipv4/udp.c +0
-0
[ ... ]
Quoted 9 lines
net/ipv4/udp.c +2
-3@@ -2703,14 +2647,15 @@ static int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,if (ulen > skb->len) goto short_packet; -if (proto ==IPPROTO_UDP ) { -/* UDP validates ulen. */ -if (ulen <sizeof (*uh) ||pskb_trim_rcsum (skb, ulen)) +/* UDP validates ulen. */ +if (ulen <sizeof (*uh)) {
net/ipv4/udp.c static int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, · line 2660
Quoted 10 lines
net/ipv4/udp.c +3
-1+if (pskb_trim_rcsum (skb, ulen)) goto short_packet; + uh =udp_hdr (skb); } -if (udp4_csum_init (skb, uh, proto)) +if (udp4_csum_init (skb, uh)) goto csum_error;
Does this refactoring introduce two bugs?
The old code checked both conditions with short-circuit OR:
if (ulen < sizeof(*uh) || pskb_trim_rcsum(skb, ulen))
goto short_packet;
This correctly (1) rejected packets where ulen < 8, and (2) trimmed the SKB to the declared UDP length when ulen < skb->len.
The new code changes the logic structure:
if (ulen < sizeof(*uh)) {
if (pskb_trim_rcsum(skb, ulen))
goto short_packet;
uh = udp_hdr(skb);}
First potential bug: When sizeof(*uh) <= ulen < skb->len, the entire block is skipped. This means pskb_trim_rcsum() is never called, so the SKB retains trailing data beyond the declared UDP length. Won't this cause checksum calculations to include extraneous bytes, leading to valid packets being incorrectly rejected?
This scenario occurs when UDP length < IP payload length, which can happen with malformed or crafted packets.
Second potential bug: When ulen < sizeof(*uh), the old code would immediately goto short_packet via the || short-circuit. The new code enters the block and tries to trim the SKB to a sub-header-size length. If pskb_trim_rcsum() succeeds, processing continues with skb->len < sizeof(struct udphdr). Is this safe?
Looking at the IPv6 counterpart __udp6_lib_rcv(), it handles this differently:
if (ulen < sizeof(*uh))
goto short_packet;
if (ulen < skb->len) {
if (pskb_trim_rcsum(skb, ulen))
goto short_packet;
saddr = &ipv6_hdr(skb)->saddr;
daddr = &ipv6_hdr(skb)->daddr;
uh = udp_hdr(skb);
}Should the IPv4 code follow the same pattern, or should it preserve the original short-circuit logic:
if (ulen < sizeof(*uh) || pskb_trim_rcsum(skb, ulen))
goto short_packet;
uh = udp_hdr(skb);Kuniyuki Iwashima
maintainerRe: [v2,net-next,07/15] udp: Remove partial csum code in RX.
Quoted 91 lines · Paolo Abeni
This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible.
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
udp: Remove partial csum code in RX.This commit removes UDP-Lite specific partial checksum handling from UDP receive paths, including removal of
UDP_SKB_CBfields, simplification of checksum initialization functions, and elimination of UDP-Lite guards.Quoted 3 lines
include/net/udp.h +0
-0[ ... ]
Quoted 3 lines
net/ipv4/udp.c +0
-0[ ... ]
Quoted 9 lines
net/ipv4/udp.c +2
-3@@ -2703,14 +2647,15 @@ static int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,if (ulen > skb->len) goto short_packet; -if (proto ==IPPROTO_UDP ) { -/* UDP validates ulen. */ -if (ulen <sizeof (*uh) ||pskb_trim_rcsum (skb, ulen)) +/* UDP validates ulen. */ +if (ulen <sizeof (*uh)) {net/ipv4/udp.c static int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, · line 2660
Quoted 10 lines
net/ipv4/udp.c +3
-1+if (pskb_trim_rcsum (skb, ulen)) goto short_packet; + uh =udp_hdr (skb); } -if (udp4_csum_init (skb, uh, proto)) +if (udp4_csum_init (skb, uh)) goto csum_error;Does this refactoring introduce two bugs?
The old code checked both conditions with short-circuit OR:
if (ulen <sizeof(*uh)||pskb_trim_rcsum(skb, ulen))goto short_packet;This correctly (1) rejected packets where ulen < 8, and (2) trimmed the SKB to the declared UDP length when ulen <
skb->len.The new code changes the logic structure:
if (ulen < sizeof(*uh)) { if (pskb_trim_rcsum(skb, ulen)) goto short_packet; uh = udp_hdr(skb);}
First potential bug: When
sizeof(*uh)<= ulen <skb->len, the entire block is skipped. This meanspskb_trim_rcsum()is never called, so the SKB retains trailing data beyond the declared UDP length. Won't this cause checksum calculations to include extraneous bytes, leading to valid packets being incorrectly rejected?This scenario occurs when UDP length < IP payload length, which can happen with malformed or crafted packets.
Second potential bug: When ulen <
sizeof(*uh), the old code would immediately gotoshort_packetvia the || short-circuit. The new code enters the block and tries to trim the SKB to a sub-header-size length. Ifpskb_trim_rcsum()succeeds, processing continues withskb->len< sizeof(struct udphdr). Is this safe?Looking at the IPv6 counterpart
__udp6_lib_rcv(), it handles this differently:if (ulen <
sizeof(*uh))goto short_packet;if (ulen < skb->len) { if (pskb_trim_rcsum(skb, ulen)) goto short_packet; saddr = &ipv6_hdr(skb)->saddr; daddr = &ipv6_hdr(skb)->daddr; uh = udp_hdr(skb); }
Quoted 2 lines
Should the IPv4 code follow the same pattern, or should it preserve the original short-circuit logic:
Indeed, I'll follow the IPv6 pattern there.
Thanks !
Re: [PATCH v2 net-next 07/15] udp: Remove partial csum code in RX.
In reply to Kuniyuki IwashimaQuoted 7 lines · On Thu, 5 Mar 2026 21:49:53 +0000 Kuniyuki Iwashima <[email protected]> wrote:
UDP-Lite supports the partial checksum and the coverage is stored in the position of the length field of struct udphdr.
In RX paths,
udp4_csum_init()/udp6_csum_init()save the value in UDP_SKB_CB(skb)->cscov and set UDP_SKB_CB(skb)->partial_cov to 1 if the coverage is not full.
Is it worth completely removing the code that defers the udp RX checksum until the copy_to_user() and the corresponding TX side code that checksums the data being sent.
I'm not sure what the 'killer application' was for the RX side. I'd guess the userspace NFS daemon - long since dead.
With most modern 'performance' NICs doing checksum offload you don't want to 'waste' cycles doing a checksum during transmit that won't be needed - and you don't know the interface until much later.
I also recall that pretty much only x86 actually tries to do the checksum and copy together - most architectures checksum the buffer fragments (of the iov[]) as they are copied - even though the kernel buffer is linear; so has to handle more fragments.
ISTR there is a bug where 0 and ~0 get swapped.
Even for x86-64 the fastest IP checksum does 12-16 bytes/clock (I think you can get 12 on Intel and 16 on AMD), and the copy will do 64 bytes per clock (on recent enough cpu and once it is started and with an aligned destination).
So even there separate copy and checksum may be faster.
The only time copy+checksum really helps is for buffers that spill the L1-cache - which is why I think NFS's 8k UDP datagrams are why the code was added at all.
(Last time I asked about this Linus couldn't remember.)
David
Kuniyuki Iwashima
maintainerPATCH v2 8/15 udp: Remove partial csum code in TX.
In reply to Kuniyuki IwashimaUDP TX paths also have some code for UDP-Lite partial checksum:
* udplite_csum() in udp_send_skb() and udp_v6_send_skb()
* udplite_getfrag() in udp_sendmsg() and udpv6_sendmsg()
Let's remove such code.
Now, we can use IPPROTO_UDP directly instead of sk->sk_protocol or fl6->flowi6_proto for csum_tcpudp_magic() and csum_ipv6_magic().
--- include/net/udplite.h | 35 -------------------------- net/ipv4/udp.c | 58 ++++++++++++++++--------------------------- net/ipv6/udp.c | 54 +++++++++++++++++++--------------------- 3 files changed, 47 insertions(+), 100 deletions(-)
include/net/udplite.h +0 -35
@@ -12,39 +12,4 @@#define UDPLITE_SEND_CSCOV 10/* sender partial coverage (as sent) */ #define UDPLITE_RECV_CSCOV 11/* receiver partial coverage (threshold ) */ -/* -* Checksum computation is all in software, hence simpler getfrag. -*/ -static __inline__int udplite_getfrag (void *from,char *to,int offset, -int len,int odd,struct sk_buff *skb) -{ -struct msghdr *msg = from; -return copy_from_iter_full (to, len, &msg->msg_iter) ?0 : -EFAULT ; -} - -/* -* Checksumming routines -*/ - -/* Fast-path computation of checksum. Socket may not be locked. */ -static inline __wsum udplite_csum (struct sk_buff *skb) -{ -const int off =skb_transport_offset (skb); -const struct sock *sk = skb->sk; -int len = skb->len - off; - -if (udp_test_bit (UDPLITE_SEND_CC , sk)) { -u16 pcslen =READ_ONCE (udp_sk (sk)->pcslen); - -if (pcslen < len) { -if (pcslen >0 ) - len = pcslen; -udp_hdr (skb)->len =htons (pcslen); - } - } - skb->ip_summed =CHECKSUM_NONE ;/* no HW support for checksumming */ - -return skb_checksum (skb, off, len,0 ); -} -#endif /* _UDPLITE_H */
net/ipv4/udp.c +22 -36
130 lines not on this page · raw message
net/ipv6/udp.c +25 -29
122 lines not on this page · raw message
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 9/15 udp: Remove UDPLITE_SEND_CSCOV and UDPLITE_RECV_CSCOV.
In reply to Kuniyuki IwashimaUDP-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---
v2: Add a detailed reason in include/uapi/linux/udp.h
--- include/linux/udp.h | 10 +-------- include/net/udplite.h | 15 ------------- include/uapi/linux/udp.h | 2 ++ net/ipv4/udp.c | 46 ++-------------------------------------- net/ipv6/ip6_checksum.c | 2 +- net/ipv6/udp.c | 5 ++--- 6 files changed, 8 insertions(+), 72 deletions(-) delete mode 100644 include/net/udplite.h
include/linux/udp.h +1 -9
@@ -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 )
include/net/udplite.h deleted +0 -15
@@ -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 */
include/uapi/linux/udp.h +2 -0
@@ -29,6 +29,8 @@ struct udphdr {/* UDP socket options */ #define UDP_CORK 1/* Never send partially complete segments */ +/* Deprecated, reserved for UDPLITE_SEND_CSCOV 10 */ +/* Deprecated, reserved for UDPLITE_RECV_CSCOV 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 */
net/ipv4/udp.c +2 -44
82 lines not on this page · raw message
net/ipv6/ip6_checksum.c +1 -1
@@ -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
net/ipv6/udp.c +2 -3
@@ -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); }
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 10/15 udp: Remove struct proto.h.udp_table.
In reply to Kuniyuki IwashimaSince UDP and UDP-Lite had dedicated socket hash tables for each, we have had to fetch them from different pointers.
UDP always has its global or per-netns table in net->ipv4.udp_table and struct proto.h.udp_table is NULL.
OTOH, UDP-Lite had only one global table in the pointer.
We no longer use the field.
Let's remove it and udp_get_table_prot().
--- include/net/sock.h | 1 - net/ipv4/udp.c | 26 ++++++++++++-------------- net/ipv6/udp.c | 1 - 3 files changed, 12 insertions(+), 16 deletions(-)
include/net/sock.h +0 -1
@@ -1392,7 +1392,6 @@ struct proto {union {struct inet_hashinfo *hashinfo; -struct udp_table *udp_table;struct raw_hashinfo *raw_hash;struct smc_hashinfo *smc_hash; } h;
net/ipv4/udp.c +12 -14
@@ -134,11 +134,6 @@ EXPORT_PER_CPU_SYMBOL_GPL(udp_memory_per_cpu_fw_alloc);#define MAX_UDP_PORTS 65536#define PORTS_PER_CHAIN (MAX_UDP_PORTS / UDP_HTABLE_SIZE_MIN_PERNET) -static struct udp_table *udp_get_table_prot (struct sock *sk) -{ -return sk->sk_prot->h.udp_table ? :sock_net (sk)->ipv4.udp_table; -} - static int udp_lib_lport_inuse(struct net *net, __u16 num, const struct udp_hslot *hslot, unsigned long *bitmap,
@@ -240,11 +235,13 @@ static int udp_reuseport_add_sock(struct sock *sk, struct udp_hslot *hslot)int udp_lib_get_port (struct sock *sk,unsigned short snum,unsigned int hash2_nulladdr) { -struct udp_table *udptable =udp_get_table_prot (sk);struct udp_hslot *hslot, *hslot2;struct net *net =sock_net (sk); +struct udp_table *udptable;int error = -EADDRINUSE ; + udptable = net->ipv4.udp_table; +if (!snum) {DECLARE_BITMAP (bitmap,PORTS_PER_CHAIN );unsigned short first, last;
@@ -2224,12 +2221,13 @@ EXPORT_IPV6_MOD(udp_disconnect);void udp_lib_unhash (struct sock *sk) {if (sk_hashed (sk)) { -struct udp_table *udptable =udp_get_table_prot (sk);struct udp_hslot *hslot, *hslot2; +struct net *net =sock_net (sk); +struct udp_table *udptable;sock_rps_delete_flow (sk); - hslot =udp_hashslot (udptable,sock_net (sk), -udp_sk (sk)->udp_port_hash); + udptable = net->ipv4.udp_table; + hslot =udp_hashslot (udptable, net,udp_sk (sk)->udp_port_hash); hslot2 =udp_hashslot2 (udptable,udp_sk (sk)->udp_portaddr_hash);spin_lock_bh (&hslot->lock);
@@ -2238,7 +2236,7 @@ void udp_lib_unhash(struct sock *sk)if (sk_del_node_init_rcu (sk)) { hslot->count--;inet_sk (sk)->inet_num =0 ; -sock_prot_inuse_add (sock_net (sk), sk->sk_prot,-1 ); +sock_prot_inuse_add (net, sk->sk_prot,-1 );spin_lock (&hslot2->lock);hlist_del_init_rcu (&udp_sk (sk)->udp_portaddr_node);
@@ -2258,11 +2256,12 @@ EXPORT_IPV6_MOD(udp_lib_unhash);void udp_lib_rehash (struct sock *sk,u16 newhash,u16 newhash4) {if (sk_hashed (sk)) { -struct udp_table *udptable =udp_get_table_prot (sk);struct udp_hslot *hslot, *hslot2, *nhslot2; +struct net *net =sock_net (sk); +struct udp_table *udptable; - hslot =udp_hashslot (udptable,sock_net (sk), -udp_sk (sk)->udp_port_hash); + udptable = net->ipv4.udp_table; + hslot =udp_hashslot (udptable, net,udp_sk (sk)->udp_port_hash); hslot2 =udp_hashslot2 (udptable,udp_sk (sk)->udp_portaddr_hash); nhslot2 =udp_hashslot2 (udptable, newhash);udp_sk (sk)->udp_portaddr_hash = newhash;
@@ -3168,7 +3167,6 @@ struct proto udp_prot = { .sysctl_wmem_offset = offsetof(struct net, ipv4.sysctl_udp_wmem_min), .sysctl_rmem_offset = offsetof(struct net, ipv4.sysctl_udp_rmem_min), .obj_size = sizeof(struct udp_sock), - .h.udp_table = NULL, .diag_destroy = udp_abort, };EXPORT_SYMBOL (udp_prot);
net/ipv6/udp.c +0 -1
@@ -1925,7 +1925,6 @@ struct proto udpv6_prot = { .sysctl_rmem_offset = offsetof(struct net, ipv4.sysctl_udp_rmem_min), .obj_size = sizeof(struct udp6_sock), .ipv6_pinfo_offset = offsetof(struct udp6_sock, inet6), - .h.udp_table = NULL, .diag_destroy = udp_abort, };
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 11/15 udp: Remove udp_table in struct udp_seq_afinfo.
In reply to Kuniyuki IwashimaSince UDP and UDP-Lite had dedicated socket hash tables for each, we have had to fetch them from different pointers for procfs or bpf iterator.
UDP always has its global or per-netns table in net->ipv4.udp_table and struct udp_seq_afinfo.udp_table is NULL.
OTOH, UDP-Lite had only one global table in the pointer.
We no longer use the field.
Let's remove it and udp_get_table_seq().
--- include/net/udp.h | 1 - net/ipv4/udp.c | 22 ++++------------------ net/ipv6/udp.c | 1 - 3 files changed, 4 insertions(+), 20 deletions(-)
include/net/udp.h +0 -1
@@ -552,7 +552,6 @@ static inline int copy_linear_skb(struct sk_buff *skb, int len, int off,#ifdef CONFIG_PROC_FS struct udp_seq_afinfo {sa_family_t family; -struct udp_table *udp_table; }; struct udp_iter_state {
net/ipv4/udp.c +4 -18
@@ -3186,21 +3186,8 @@ static bool seq_sk_match(struct seq_file *seq, const struct sock *sk)#ifdef CONFIG_BPF_SYSCALL static const struct seq_operations bpf_iter_udp_seq_ops; -#endif -static struct udp_table *udp_get_table_seq (struct seq_file *seq, -struct net *net) -{ -const struct udp_seq_afinfo *afinfo; - -#ifdef CONFIG_BPF_SYSCALL -if (seq->op == &bpf_iter_udp_seq_ops) -return net->ipv4.udp_table;#endif - afinfo =pde_data (file_inode (seq->file)); -return afinfo->udp_table ? : net->ipv4.udp_table; -} -static struct sock *udp_get_first (struct seq_file *seq,int start) {struct udp_iter_state *state = seq->private;
@@ -3208,7 +3195,7 @@ static struct sock *udp_get_first(struct seq_file *seq, int start)struct udp_table *udptable;struct sock *sk; - udptable =udp_get_table_seq (seq, net); + udptable = net->ipv4.udp_table;for (state->bucket = start; state->bucket <= udptable->mask; ++state->bucket) {
@@ -3240,7 +3227,7 @@ static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk) }while (sk && !seq_sk_match (seq, sk));if (!sk) { - udptable =udp_get_table_seq (seq, net); + udptable = net->ipv4.udp_table;if (state->bucket <= udptable->mask)spin_unlock_bh (&udptable->hash[state->bucket].lock);
@@ -3288,7 +3275,7 @@ void udp_seq_stop(struct seq_file *seq, void *v)struct udp_iter_state *state = seq->private;struct udp_table *udptable; - udptable =udp_get_table_seq (seq,seq_file_net (seq)); + udptable =seq_file_net (seq)->ipv4.udp_table;if (state->bucket <= udptable->mask)spin_unlock_bh (&udptable->hash[state->bucket].lock);
@@ -3392,7 +3379,7 @@ static struct sock *bpf_iter_udp_batch(struct seq_file *seq)if (iter->cur_sk == iter->end_sk) state->bucket++; - udptable =udp_get_table_seq (seq, net); + udptable = net->ipv4.udp_table; again:/* New batch for the next bucket.
@@ -3630,7 +3617,6 @@ static const struct seq_operations udp_seq_ops = {static struct udp_seq_afinfo udp4_seq_afinfo = { .family =AF_INET , - .udp_table =NULL , };static int __net_init udp4_proc_init_net (struct net *net)
net/ipv6/udp.c +0 -1
@@ -1873,7 +1873,6 @@ static const struct seq_operations udp6_seq_ops = {static struct udp_seq_afinfo udp6_seq_afinfo = { .family =AF_INET6 , - .udp_table =NULL , };int __net_init udp6_proc_init (struct net *net)
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 12/15 udp: Remove dead check in __udp[46]_lib_lookup() for BPF.
In reply to Kuniyuki IwashimaBPF socket lookup for SO_REUSEPORT does not support UDP-Lite.
In __udp4_lib_lookup() and __udp6_lib_lookup(), it checks if the passed udptable pointer is the same as net->ipv4.udp_table, which is only true for UDP.
Now, the condition is always true.
Let's remove the check.
--- net/ipv4/udp.c | 3 +-- net/ipv6/udp.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
net/ipv4/udp.c +1 -2
@@ -699,8 +699,7 @@ struct sock *__udp4_lib_lookup(const struct net *net, __be32 saddr, goto done;/* Lookup redirect from BPF */ -if (static_branch_unlikely (&bpf_sk_lookup_enabled) && - udptable == net->ipv4.udp_table) { +if (static_branch_unlikely (&bpf_sk_lookup_enabled)) { sk =inet_lookup_run_sk_lookup (net,IPPROTO_UDP , skb,sizeof (struct udphdr ), saddr, sport, daddr, hnum, dif, udp_ehashfn);
net/ipv6/udp.c +1 -2
@@ -370,8 +370,7 @@ struct sock *__udp6_lib_lookup(const struct net *net, goto done;/* Lookup redirect from BPF */ -if (static_branch_unlikely (&bpf_sk_lookup_enabled) && - udptable == net->ipv4.udp_table) { +if (static_branch_unlikely (&bpf_sk_lookup_enabled)) { sk =inet6_lookup_run_sk_lookup (net,IPPROTO_UDP , skb,sizeof (struct udphdr ), saddr, sport, daddr, hnum, dif, udp6_ehashfn);
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 13/15 udp: Don't pass udptable to IPv6 socket lookup functions.
In reply to Kuniyuki IwashimaSince UDP and UDP-Lite had dedicated socket hash tables for each, we have had to pass the pointer down to many socket lookup functions.
UDP-Lite gone, and we do not need to do that.
Let's fetch net->ipv4.udp_table only where needed in IPv6
stack: __udp6_lib_lookup() and __udp6_lib_mcast_deliver().
__udp6_lib_err() is renamed to udpv6_err() as its wrapper is no longer needed.
--- include/net/ipv6_stubs.h | 7 ++-- include/net/udp.h | 3 +- net/core/filter.c | 3 +- net/ipv4/udp_diag.c | 20 +++++----- net/ipv6/udp.c | 82 ++++++++++++++++++---------------------- net/ipv6/udp_offload.c | 3 +- 6 files changed, 53 insertions(+), 65 deletions(-)
include/net/ipv6_stubs.h +3 -4
@@ -83,10 +83,9 @@ struct ipv6_bpf_stub {int (*inet6_bind)(struct sock *sk,struct sockaddr_unsized *uaddr,int addr_len,u32 flags);struct sock *(*udp6_lib_lookup)(const struct net *net, -const struct in6_addr *saddr,__be16 sport, -const struct in6_addr *daddr,__be16 dport, -int dif,int sdif,struct udp_table *tbl, -struct sk_buff *skb); +const struct in6_addr *saddr,__be16 sport, +const struct in6_addr *daddr,__be16 dport, +int dif,int sdif,struct sk_buff *skb);int (*ipv6_setsockopt)(struct sock *sk,int level,int optname,sockptr_t optval,unsigned int optlen); int (*ipv6_getsockopt)(struct sock *sk, int level, int optname,
include/net/udp.h +1 -2
@@ -449,8 +449,7 @@ struct sock *udp6_lib_lookup(const struct net *net,struct sock *__udp6_lib_lookup (const struct net *net,const struct in6_addr *saddr,__be16 sport,const struct in6_addr *daddr,__be16 dport, -int dif,int sdif,struct udp_table *tbl, -struct sk_buff *skb); +int dif,int sdif,struct sk_buff *skb);struct sock *udp6_lib_lookup_skb (const struct sk_buff *skb,__be16 sport,__be16 dport);int udp_read_skb (struct sock *sk,skb_read_actor_t recv_actor);
net/core/filter.c +1 -2
@@ -6895,8 +6895,7 @@ static struct sock *sk_lookup(struct net *net, struct bpf_sock_tuple *tuple, sk = ipv6_bpf_stub->udp6_lib_lookup (net, src6, tuple->ipv6.sport, dst6, tuple->ipv6.dport, - dif, sdif, - net->ipv4.udp_table,NULL ); + dif, sdif,NULL );#endif }
net/ipv4/udp_diag.c +10 -10
@@ -44,11 +44,11 @@ static int udp_dump_one(struct udp_table *tbl,#if IS_ENABLED (CONFIG_IPV6 ) else if (req->sdiag_family == AF_INET6) sk =__udp6_lib_lookup (net, - (struct in6_addr *)req->id.idiag_src, - req->id.idiag_sport, - (struct in6_addr *)req->id.idiag_dst, - req->id.idiag_dport, - req->id.idiag_if,0 , tbl,NULL ); + (struct in6_addr *)req->id.idiag_src, + req->id.idiag_sport, + (struct in6_addr *)req->id.idiag_dst, + req->id.idiag_dport, + req->id.idiag_if,0 ,NULL );#endif if (sk && !refcount_inc_not_zero (&sk->sk_refcnt)) sk =NULL ;
@@ -185,11 +185,11 @@ static int __udp_diag_destroy(struct sk_buff *in_skb, else sk =__udp6_lib_lookup (net, - (struct in6_addr *)req->id.idiag_dst, - req->id.idiag_dport, - (struct in6_addr *)req->id.idiag_src, - req->id.idiag_sport, - req->id.idiag_if,0 , tbl,NULL ); + (struct in6_addr *)req->id.idiag_dst, + req->id.idiag_dport, + (struct in6_addr *)req->id.idiag_src, + req->id.idiag_sport, + req->id.idiag_if,0 ,NULL ); }#endif else {
net/ipv6/udp.c +37 -45
184 lines not on this page · raw message
net/ipv6/udp_offload.c +1 -2
@@ -128,8 +128,7 @@ static struct sock *udp6_gro_lookup_skb(struct sk_buff *skb, __be16 sport,inet6_get_iif_sdif (skb, &iif, &sdif);return __udp6_lib_lookup (net, &iph->saddr, sport, - &iph->daddr, dport, iif, - sdif, net->ipv4.udp_table,NULL ); + &iph->daddr, dport, iif, sdif,NULL ); }struct sk_buff *udp6_gro_receive (struct list_head *head,struct sk_buff *skb)
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 14/15 udp: Don't pass udptable to IPv4 socket lookup functions.
In reply to Kuniyuki IwashimaSince UDP and UDP-Lite had dedicated socket hash tables for each, we have had to pass the pointer down to many socket lookup functions.
UDP-Lite gone, and we do not need to do that.
Let's fetch net->ipv4.udp_table only where needed in IPv4
stack: __udp4_lib_lookup(), __udp4_lib_mcast_deliver(), and udp_diag_dump().
Some functions are renamed as the wrapper functions are no longer needed.
__udp4_lib_err() -> udp_err()
__udp_diag_destroy() -> udp_diag_destroy()
udp_dump_one() -> udp_diag_dump_one()
udp_dump() -> udp_diag_dump()
--- include/net/udp.h | 5 ++- net/core/filter.c | 2 +- net/ipv4/udp.c | 75 +++++++++++++++++++----------------------- net/ipv4/udp_diag.c | 61 ++++++++++++---------------------- net/ipv4/udp_offload.c | 3 +- 5 files changed, 59 insertions(+), 87 deletions(-)
include/net/udp.h +2 -3
@@ -437,9 +437,8 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,struct sock *udp4_lib_lookup (const struct net *net,__be32 saddr,__be16 sport,__be32 daddr,__be16 dport,int dif);struct sock *__udp4_lib_lookup (const struct net *net,__be32 saddr, -__be16 sport, -__be32 daddr,__be16 dport,int dif,int sdif, -struct udp_table *tbl,struct sk_buff *skb); +__be16 sport,__be32 daddr,__be16 dport, +int dif,int sdif,struct sk_buff *skb);struct sock *udp4_lib_lookup_skb (const struct sk_buff *skb,__be16 sport,__be16 dport); struct sock *udp6_lib_lookup(const struct net *net,
net/core/filter.c +1 -1
@@ -6880,7 +6880,7 @@ static struct sock *sk_lookup(struct net *net, struct bpf_sock_tuple *tuple,else sk =__udp4_lib_lookup (net, src4, tuple->ipv4.sport, dst4, tuple->ipv4.dport, - dif, sdif, net->ipv4.udp_table,NULL ); + dif, sdif,NULL );#if IS_ENABLED (CONFIG_IPV6 ) } else {struct in6_addr *src6 = (struct in6_addr *)&tuple->ipv6.saddr;
net/ipv4/udp.c +34 -41
184 lines not on this page · raw message
net/ipv4/udp_diag.c +21 -40
116 lines not on this page · raw message
net/ipv4/udp_offload.c +1 -2
@@ -869,8 +869,7 @@ static struct sock *udp4_gro_lookup_skb(struct sk_buff *skb, __be16 sport,inet_get_iif_sdif (skb, &iif, &sdif);return __udp4_lib_lookup (net, iph->saddr, sport, - iph->daddr, dport, iif, - sdif, net->ipv4.udp_table,NULL ); + iph->daddr, dport, iif, sdif,NULL ); }INDIRECT_CALLABLE_SCOPE
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Kuniyuki Iwashima
maintainerPATCH v2 15/15 udp: Don't pass proto to __udp4_lib_rcv() and __udp6_lib_rcv().
In reply to Kuniyuki IwashimaUDP and UDP-Lite shared __udp4_lib_rcv() and __udp6_lib_rcv() by passing IPPROTO_UDP or IPPROTO_UDPLITE.
Now, @proto is always IPPROTO_UDP.
Let's not pass it and rename the functions accordingly.
With this series removing a bunch of conditionals for UDP-Lite from the fast path, udp_rr with 20,000 flows sees a 10% increase in pps (13.3 Mpps -> 14.7 Mpps) on an AMD EPYC 7B12 (Zen 2) 64-Core Processor platform.
[ With FDO, the baseline is much higher and the delta was ~3%,
20.1 Mpps -> 20.7 Mpps ]
Before:
$ nstat > /dev/null; sleep 1; nstat | grep Udp Udp6InDatagrams 14013408 0.0 Udp6OutDatagrams 14013128 0.0
After:
$ nstat > /dev/null; sleep 1; nstat | grep Udp Udp6InDatagrams 15491971 0.0 Udp6OutDatagrams 15491671 0.0
$ ./scripts/bloat-o-meter vmlinux.before vmlinux.after add/remove: 13/75 grow/shrink: 11/75 up/down: 13777/-18401 (-4624) Function old new delta udp4_gro_receive 872 866 -6 udp6_gro_receive 910 903 -7 udp_rcv 32 1727 +1695 udpv6_rcv 32 1450 +1418 __udp4_lib_rcv 2045 - -2045 __udp6_lib_rcv 2084 - -2084 udp_unicast_rcv_skb 160 149 -11 udp6_unicast_rcv_skb 196 181 -15 __udp4_lib_mcast_deliver 925 846 -79 __udp6_lib_mcast_deliver 922 810 -112 __udp4_lib_lookup 973 969 -4 __udp6_lib_lookup 940 929 -11 __udp4_lib_lookup_skb 106 100 -6 __udp6_lib_lookup_skb 71 66 -5 udp4_lib_lookup_skb 132 127 -5 udp6_lib_lookup_skb 87 81 -6 udp_queue_rcv_skb 326 356 +30 udpv6_queue_rcv_skb 331 361 +30 udp_queue_rcv_one_skb 1233 914 -319 udpv6_queue_rcv_one_skb 1250 930 -320 __udp_enqueue_schedule_skb 1067 995 -72 udp_rcv_segment 520 480 -40 udp_post_segment_fix_csum 120 - -120 udp_lib_checksum_complete 200 84 -116 udp_err 27 1103 +1076 udpv6_err 36 1417 +1381 __udp4_lib_err 1112 - -1112 __udp6_lib_err 1448 - -1448 udp_recvmsg 1149 994 -155 udpv6_recvmsg 1349 1294 -55 udp_sendmsg 2730 2648 -82 udp_send_skb 909 681 -228 udpv6_sendmsg 3022 2861 -161 udp_v6_send_skb 1214 952 -262 ... Total: Before=18446744073748075501, After=18446744073748070877, chg -0.00%
--- net/ipv4/udp.c | 18 +++++------------- net/ipv6/udp.c | 15 ++++----------- 2 files changed, 9 insertions(+), 24 deletions(-)
net/ipv4/udp.c +5 -13
@@ -2474,8 +2474,7 @@ EXPORT_IPV6_MOD(udp_sk_rx_dst_set);*/ static int __udp4_lib_mcast_deliver (struct net *net,struct sk_buff *skb,struct udphdr *uh, -__be32 saddr,__be32 daddr, -int proto) +__be32 saddr,__be32 daddr) {struct udp_table *udptable = net->ipv4.udp_table;unsigned int hash2, hash2_any, offset;
@@ -2597,7 +2596,7 @@ static int udp_unicast_rcv_skb(struct sock *sk, struct sk_buff *skb,* All we need to do is get the socket, and then do a checksum. */ -static int __udp4_lib_rcv (struct sk_buff *skb,int proto) +int udp_rcv (struct sk_buff *skb) {struct rtable *rt =skb_rtable (skb);struct net *net =dev_net (skb->dev);
@@ -2654,7 +2653,7 @@ static int __udp4_lib_rcv(struct sk_buff *skb, int proto) }if (rt->rt_flags & (RTCF_BROADCAST |RTCF_MULTICAST )) -return __udp4_lib_mcast_deliver (net, skb, uh, saddr, daddr, proto); +return __udp4_lib_mcast_deliver (net, skb, uh, saddr, daddr); sk =__udp4_lib_lookup_skb (skb, uh->source, uh->dest);if (sk)
@@ -2681,8 +2680,7 @@ static int __udp4_lib_rcv(struct sk_buff *skb, int proto) short_packet: drop_reason =SKB_DROP_REASON_PKT_TOO_SMALL ; -net_dbg_ratelimited ("UDP%s: short packet: From %pI4:%u %d/%d to %pI4:%u\n" , - proto ==IPPROTO_UDPLITE ?"Lite" :"" , +net_dbg_ratelimited ("UDP: short packet: From %pI4:%u %d/%d to %pI4:%u\n" , &saddr,ntohs (uh->source), ulen, skb->len, &daddr,ntohs (uh->dest));
@@ -2694,8 +2692,7 @@ static int __udp4_lib_rcv(struct sk_buff *skb, int proto)* the network is concerned, anyway) as per 4.1.3.4 (MUST). */ drop_reason =SKB_DROP_REASON_UDP_CSUM ; -net_dbg_ratelimited ("UDP%s: bad checksum. From %pI4:%u to %pI4:%u ulen %d\n" , - proto ==IPPROTO_UDPLITE ?"Lite" :"" , +net_dbg_ratelimited ("UDP: bad checksum. From %pI4:%u to %pI4:%u ulen %d\n" , &saddr,ntohs (uh->source), &daddr,ntohs (uh->dest), ulen);__UDP_INC_STATS (net,UDP_MIB_CSUMERRORS );
@@ -2838,11 +2835,6 @@ enum skb_drop_reason udp_v4_early_demux(struct sk_buff *skb)return SKB_NOT_DROPPED_YET ; } -int udp_rcv (struct sk_buff *skb) -{ -return __udp4_lib_rcv (skb,IPPROTO_UDP ); -} -static void udp_destroy_sock (struct sock *sk) {struct udp_sock *up =udp_sk (sk);
net/ipv6/udp.c +4 -11
@@ -934,8 +934,7 @@ static void udp6_csum_zero_error(struct sk_buff *skb)*/ static int __udp6_lib_mcast_deliver (struct net *net,struct sk_buff *skb,const struct in6_addr *saddr, -const struct in6_addr *daddr, -int proto) +const struct in6_addr *daddr) {struct udp_table *udptable = net->ipv4.udp_table;const struct udphdr *uh =udp_hdr (skb);
@@ -1063,7 +1062,7 @@ static int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh)return 0 ; } -static int __udp6_lib_rcv (struct sk_buff *skb,int proto) +INDIRECT_CALLABLE_SCOPE int udpv6_rcv(struct sk_buff *skb) {enum skb_drop_reason reason =SKB_DROP_REASON_NOT_SPECIFIED ;const struct in6_addr *saddr, *daddr;
@@ -1133,7 +1132,7 @@ static int __udp6_lib_rcv(struct sk_buff *skb, int proto)* Multicast receive code */ if (ipv6_addr_is_multicast (daddr)) -return __udp6_lib_mcast_deliver (net, skb, saddr, daddr, proto); +return __udp6_lib_mcast_deliver (net, skb, saddr, daddr);/* Unicast */ sk =__udp6_lib_lookup_skb (skb, uh->source, uh->dest);
@@ -1164,8 +1163,7 @@ static int __udp6_lib_rcv(struct sk_buff *skb, int proto) short_packet:if (reason ==SKB_DROP_REASON_NOT_SPECIFIED ) reason =SKB_DROP_REASON_PKT_TOO_SMALL ; -net_dbg_ratelimited ("UDP%sv6: short packet: From [%pI6c]:%u %d/%d to [%pI6c]:%u\n" , - proto ==IPPROTO_UDPLITE ?"-Lite" :"" , +net_dbg_ratelimited ("UDPv6: short packet: From [%pI6c]:%u %d/%d to [%pI6c]:%u\n" , saddr,ntohs (uh->source), ulen, skb->len, daddr,ntohs (uh->dest));
@@ -1252,11 +1250,6 @@ void udp_v6_early_demux(struct sk_buff *skb) } } -INDIRECT_CALLABLE_SCOPE int udpv6_rcv(struct sk_buff *skb) -{ -return __udp6_lib_rcv (skb,IPPROTO_UDP ); -} -/* * Throw away all pending data and cancel the corking. Socket is locked. */
Signature · 1 line
2.53.0.473.g4a7958ca14-goog