Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ipv6: Retire UDP-Lite.

As 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().

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260311052020.1213705-3-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Kuniyuki Iwashima and committed by
Jakub Kicinski
62554a51 86a41d95

+23 -217
-2
include/net/ipv6.h
··· 1179 1179 void tcp6_proc_exit(struct net *net); 1180 1180 int udp6_proc_init(struct net *net); 1181 1181 void udp6_proc_exit(struct net *net); 1182 - int udplite6_proc_init(void); 1183 - void udplite6_proc_exit(void); 1184 1182 int ipv6_misc_proc_init(void); 1185 1183 void ipv6_misc_proc_exit(void); 1186 1184 int snmp6_register_dev(struct inet6_dev *idev);
-3
include/net/transp_v6.h
··· 8 8 /* IPv6 transport protocols */ 9 9 extern struct proto rawv6_prot; 10 10 extern struct proto udpv6_prot; 11 - extern struct proto udplitev6_prot; 12 11 extern struct proto tcpv6_prot; 13 12 extern struct proto pingv6_prot; 14 13 ··· 27 28 void rawv6_exit(void); 28 29 int udpv6_init(void); 29 30 void udpv6_exit(void); 30 - int udplitev6_init(void); 31 - void udplitev6_exit(void); 32 31 int tcpv6_init(void); 33 32 void tcpv6_exit(void); 34 33
+4
include/net/udp.h
··· 282 282 void udp_v6_early_demux(struct sk_buff *skb); 283 283 INDIRECT_CALLABLE_DECLARE(int udpv6_rcv(struct sk_buff *)); 284 284 285 + int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len); 286 + INDIRECT_CALLABLE_DECLARE(int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, 287 + size_t len, int flags)); 288 + 285 289 struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, 286 290 netdev_features_t features, bool is_ipv6); 287 291
+1 -1
net/ipv6/Makefile
··· 7 7 8 8 ipv6-y := af_inet6.o anycast.o ip6_output.o ip6_input.o addrconf.o \ 9 9 addrlabel.o \ 10 - route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o udplite.o \ 10 + route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o \ 11 11 raw.o icmp.o mcast.o reassembly.o tcp_ipv6.o ping.o \ 12 12 exthdrs.o datagram.o ip6_flowlabel.o inet6_connection_sock.o \ 13 13 udp_offload.o seg6.o fib6_notifier.o rpl.o ioam6.o
+1 -22
net/ipv6/af_inet6.c
··· 43 43 #include <net/ip.h> 44 44 #include <net/ipv6.h> 45 45 #include <net/udp.h> 46 - #include <net/udplite.h> 47 46 #include <net/tcp.h> 48 47 #include <net/ping.h> 49 48 #include <net/protocol.h> ··· 635 636 EXPORT_SYMBOL_GPL(inet6_compat_ioctl); 636 637 #endif /* CONFIG_COMPAT */ 637 638 638 - INDIRECT_CALLABLE_DECLARE(int udpv6_sendmsg(struct sock *, struct msghdr *, 639 - size_t)); 640 639 int inet6_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) 641 640 { 642 641 struct sock *sk = sock->sk; ··· 649 652 sk, msg, size); 650 653 } 651 654 652 - INDIRECT_CALLABLE_DECLARE(int udpv6_recvmsg(struct sock *, struct msghdr *, 653 - size_t, int)); 654 655 int inet6_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, 655 656 int flags) 656 657 { ··· 1075 1080 if (err) 1076 1081 goto out_unregister_tcp_proto; 1077 1082 1078 - err = proto_register(&udplitev6_prot, 1); 1079 - if (err) 1080 - goto out_unregister_udp_proto; 1081 - 1082 1083 err = proto_register(&rawv6_prot, 1); 1083 1084 if (err) 1084 - goto out_unregister_udplite_proto; 1085 + goto out_unregister_udp_proto; 1085 1086 1086 1087 err = proto_register(&pingv6_prot, 1); 1087 1088 if (err) ··· 1128 1137 err = -ENOMEM; 1129 1138 if (raw6_proc_init()) 1130 1139 goto proc_raw6_fail; 1131 - if (udplite6_proc_init()) 1132 - goto proc_udplite6_fail; 1133 1140 if (ipv6_misc_proc_init()) 1134 1141 goto proc_misc6_fail; 1135 1142 if (if6_proc_init()) ··· 1162 1173 err = udpv6_init(); 1163 1174 if (err) 1164 1175 goto udpv6_fail; 1165 - 1166 - err = udplitev6_init(); 1167 - if (err) 1168 - goto udplitev6_fail; 1169 1176 1170 1177 err = udpv6_offload_init(); 1171 1178 if (err) ··· 1233 1248 tcpv6_fail: 1234 1249 udpv6_offload_exit(); 1235 1250 udpv6_offload_fail: 1236 - udplitev6_exit(); 1237 - udplitev6_fail: 1238 1251 udpv6_exit(); 1239 1252 udpv6_fail: 1240 1253 ipv6_frag_exit(); ··· 1254 1271 proc_if6_fail: 1255 1272 ipv6_misc_proc_exit(); 1256 1273 proc_misc6_fail: 1257 - udplite6_proc_exit(); 1258 - proc_udplite6_fail: 1259 1274 raw6_proc_exit(); 1260 1275 proc_raw6_fail: 1261 1276 #endif ··· 1277 1296 proto_unregister(&pingv6_prot); 1278 1297 out_unregister_raw_proto: 1279 1298 proto_unregister(&rawv6_prot); 1280 - out_unregister_udplite_proto: 1281 - proto_unregister(&udplitev6_prot); 1282 1299 out_unregister_udp_proto: 1283 1300 proto_unregister(&udpv6_prot); 1284 1301 out_unregister_tcp_proto:
-2
net/ipv6/proc.c
··· 39 39 sock_prot_inuse_get(net, &tcpv6_prot)); 40 40 seq_printf(seq, "UDP6: inuse %d\n", 41 41 sock_prot_inuse_get(net, &udpv6_prot)); 42 - seq_printf(seq, "UDPLITE6: inuse %d\n", 43 - sock_prot_inuse_get(net, &udplitev6_prot)); 44 42 seq_printf(seq, "RAW6: inuse %d\n", 45 43 sock_prot_inuse_get(net, &rawv6_prot)); 46 44 seq_printf(seq, "FRAG6: inuse %u memory %lu\n",
+17 -15
net/ipv6/udp.c
··· 37 37 #include <trace/events/udp.h> 38 38 39 39 #include <net/addrconf.h> 40 + #include <net/aligned_data.h> 40 41 #include <net/ndisc.h> 41 42 #include <net/protocol.h> 42 43 #include <net/transp_v6.h> ··· 58 57 #include <linux/proc_fs.h> 59 58 #include <linux/seq_file.h> 60 59 #include <trace/events/skb.h> 61 - #include "udp_impl.h" 60 + #include <net/udplite.h> 62 61 63 62 static void udpv6_destruct_sock(struct sock *sk) 64 63 { ··· 66 65 inet6_sock_destruct(sk); 67 66 } 68 67 69 - int udpv6_init_sock(struct sock *sk) 68 + static int udpv6_init_sock(struct sock *sk) 70 69 { 71 70 int res = udp_lib_init_sock(sk); 72 71 ··· 96 95 udp6_ehash_secret + net_hash_mix(net)); 97 96 } 98 97 99 - int udp_v6_get_port(struct sock *sk, unsigned short snum) 98 + static int udp_v6_get_port(struct sock *sk, unsigned short snum) 100 99 { 101 100 unsigned int hash2_nulladdr = 102 101 ipv6_portaddr_hash(sock_net(sk), &in6addr_any, snum); ··· 108 107 return udp_lib_get_port(sk, snum, hash2_nulladdr); 109 108 } 110 109 111 - void udp_v6_rehash(struct sock *sk) 110 + static void udp_v6_rehash(struct sock *sk) 112 111 { 113 112 u16 new_hash = ipv6_portaddr_hash(sock_net(sk), 114 113 &sk->sk_v6_rcv_saddr, ··· 465 464 * return it, otherwise we block. 466 465 */ 467 466 467 + INDIRECT_CALLABLE_SCOPE 468 468 int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, 469 469 int flags) 470 470 { ··· 702 700 return sk; 703 701 } 704 702 705 - int __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 706 - u8 type, u8 code, int offset, __be32 info, 707 - struct udp_table *udptable) 703 + static int __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 704 + u8 type, u8 code, int offset, __be32 info, 705 + struct udp_table *udptable) 708 706 { 709 707 struct ipv6_pinfo *np; 710 708 const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data; ··· 1117 1115 return 0; 1118 1116 } 1119 1117 1120 - int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, 1121 - int proto) 1118 + static int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, 1119 + int proto) 1122 1120 { 1123 1121 enum skb_drop_reason reason = SKB_DROP_REASON_NOT_SPECIFIED; 1124 1122 const struct in6_addr *saddr, *daddr; ··· 1856 1854 release_sock(sk); 1857 1855 } 1858 1856 1859 - void udpv6_destroy_sock(struct sock *sk) 1857 + static void udpv6_destroy_sock(struct sock *sk) 1860 1858 { 1861 1859 struct udp_sock *up = udp_sk(sk); 1862 1860 lock_sock(sk); ··· 1884 1882 /* 1885 1883 * Socket option code for UDP 1886 1884 */ 1887 - int udpv6_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval, 1888 - unsigned int optlen) 1885 + static int udpv6_setsockopt(struct sock *sk, int level, int optname, 1886 + sockptr_t optval, unsigned int optlen) 1889 1887 { 1890 1888 if (level == SOL_UDP || level == SOL_UDPLITE || level == SOL_SOCKET) 1891 1889 return udp_lib_setsockopt(sk, level, optname, ··· 1894 1892 return ipv6_setsockopt(sk, level, optname, optval, optlen); 1895 1893 } 1896 1894 1897 - int udpv6_getsockopt(struct sock *sk, int level, int optname, 1898 - char __user *optval, int __user *optlen) 1895 + static int udpv6_getsockopt(struct sock *sk, int level, int optname, 1896 + char __user *optval, int __user *optlen) 1899 1897 { 1900 1898 if (level == SOL_UDP || level == SOL_UDPLITE) 1901 1899 return udp_lib_getsockopt(sk, level, optname, optval, optlen); ··· 1920 1918 return 0; 1921 1919 } 1922 1920 1923 - const struct seq_operations udp6_seq_ops = { 1921 + static const struct seq_operations udp6_seq_ops = { 1924 1922 .start = udp_seq_start, 1925 1923 .next = udp_seq_next, 1926 1924 .stop = udp_seq_stop,
-31
net/ipv6/udp_impl.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _UDP6_IMPL_H 3 - #define _UDP6_IMPL_H 4 - #include <net/aligned_data.h> 5 - #include <net/udp.h> 6 - #include <net/udplite.h> 7 - #include <net/protocol.h> 8 - #include <net/addrconf.h> 9 - #include <net/inet_common.h> 10 - #include <net/transp_v6.h> 11 - 12 - int __udp6_lib_rcv(struct sk_buff *, struct udp_table *, int); 13 - int __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *, u8, u8, int, 14 - __be32, struct udp_table *); 15 - 16 - int udpv6_init_sock(struct sock *sk); 17 - int udp_v6_get_port(struct sock *sk, unsigned short snum); 18 - void udp_v6_rehash(struct sock *sk); 19 - 20 - int udpv6_getsockopt(struct sock *sk, int level, int optname, 21 - char __user *optval, int __user *optlen); 22 - int udpv6_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval, 23 - unsigned int optlen); 24 - int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len); 25 - int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int flags); 26 - void udpv6_destroy_sock(struct sock *sk); 27 - 28 - #ifdef CONFIG_PROC_FS 29 - extern const struct seq_operations udp6_seq_ops; 30 - #endif 31 - #endif /* _UDP6_IMPL_H */
-139
net/ipv6/udplite.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * UDPLITEv6 An implementation of the UDP-Lite protocol over IPv6. 4 - * See also net/ipv4/udplite.c 5 - * 6 - * Authors: Gerrit Renker <gerrit@erg.abdn.ac.uk> 7 - * 8 - * Changes: 9 - * Fixes: 10 - */ 11 - #define pr_fmt(fmt) "UDPLite6: " fmt 12 - 13 - #include <linux/export.h> 14 - #include <linux/proc_fs.h> 15 - #include "udp_impl.h" 16 - 17 - static int udplitev6_sk_init(struct sock *sk) 18 - { 19 - pr_warn_once("UDP-Lite is deprecated and scheduled to be removed in 2025, " 20 - "please contact the netdev mailing list\n"); 21 - return udpv6_init_sock(sk); 22 - } 23 - 24 - static int udplitev6_rcv(struct sk_buff *skb) 25 - { 26 - return __udp6_lib_rcv(skb, &udplite_table, IPPROTO_UDPLITE); 27 - } 28 - 29 - static int udplitev6_err(struct sk_buff *skb, 30 - struct inet6_skb_parm *opt, 31 - u8 type, u8 code, int offset, __be32 info) 32 - { 33 - return __udp6_lib_err(skb, opt, type, code, offset, info, 34 - &udplite_table); 35 - } 36 - 37 - static const struct inet6_protocol udplitev6_protocol = { 38 - .handler = udplitev6_rcv, 39 - .err_handler = udplitev6_err, 40 - .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, 41 - }; 42 - 43 - struct proto udplitev6_prot = { 44 - .name = "UDPLITEv6", 45 - .owner = THIS_MODULE, 46 - .close = udp_lib_close, 47 - .connect = ip6_datagram_connect, 48 - .disconnect = udp_disconnect, 49 - .ioctl = udp_ioctl, 50 - .init = udplitev6_sk_init, 51 - .destroy = udpv6_destroy_sock, 52 - .setsockopt = udpv6_setsockopt, 53 - .getsockopt = udpv6_getsockopt, 54 - .sendmsg = udpv6_sendmsg, 55 - .recvmsg = udpv6_recvmsg, 56 - .hash = udp_lib_hash, 57 - .unhash = udp_lib_unhash, 58 - .rehash = udp_v6_rehash, 59 - .get_port = udp_v6_get_port, 60 - 61 - .memory_allocated = &net_aligned_data.udp_memory_allocated, 62 - .per_cpu_fw_alloc = &udp_memory_per_cpu_fw_alloc, 63 - 64 - .sysctl_mem = sysctl_udp_mem, 65 - .sysctl_wmem_offset = offsetof(struct net, ipv4.sysctl_udp_wmem_min), 66 - .sysctl_rmem_offset = offsetof(struct net, ipv4.sysctl_udp_rmem_min), 67 - .obj_size = sizeof(struct udp6_sock), 68 - .ipv6_pinfo_offset = offsetof(struct udp6_sock, inet6), 69 - .h.udp_table = &udplite_table, 70 - }; 71 - 72 - static struct inet_protosw udplite6_protosw = { 73 - .type = SOCK_DGRAM, 74 - .protocol = IPPROTO_UDPLITE, 75 - .prot = &udplitev6_prot, 76 - .ops = &inet6_dgram_ops, 77 - .flags = INET_PROTOSW_PERMANENT, 78 - }; 79 - 80 - int __init udplitev6_init(void) 81 - { 82 - int ret; 83 - 84 - ret = inet6_add_protocol(&udplitev6_protocol, IPPROTO_UDPLITE); 85 - if (ret) 86 - goto out; 87 - 88 - ret = inet6_register_protosw(&udplite6_protosw); 89 - if (ret) 90 - goto out_udplitev6_protocol; 91 - out: 92 - return ret; 93 - 94 - out_udplitev6_protocol: 95 - inet6_del_protocol(&udplitev6_protocol, IPPROTO_UDPLITE); 96 - goto out; 97 - } 98 - 99 - void udplitev6_exit(void) 100 - { 101 - inet6_unregister_protosw(&udplite6_protosw); 102 - inet6_del_protocol(&udplitev6_protocol, IPPROTO_UDPLITE); 103 - } 104 - 105 - #ifdef CONFIG_PROC_FS 106 - static struct udp_seq_afinfo udplite6_seq_afinfo = { 107 - .family = AF_INET6, 108 - .udp_table = &udplite_table, 109 - }; 110 - 111 - static int __net_init udplite6_proc_init_net(struct net *net) 112 - { 113 - if (!proc_create_net_data("udplite6", 0444, net->proc_net, 114 - &udp6_seq_ops, sizeof(struct udp_iter_state), 115 - &udplite6_seq_afinfo)) 116 - return -ENOMEM; 117 - return 0; 118 - } 119 - 120 - static void __net_exit udplite6_proc_exit_net(struct net *net) 121 - { 122 - remove_proc_entry("udplite6", net->proc_net); 123 - } 124 - 125 - static struct pernet_operations udplite6_net_ops = { 126 - .init = udplite6_proc_init_net, 127 - .exit = udplite6_proc_exit_net, 128 - }; 129 - 130 - int __init udplite6_proc_init(void) 131 - { 132 - return register_pernet_subsys(&udplite6_net_ops); 133 - } 134 - 135 - void udplite6_proc_exit(void) 136 - { 137 - unregister_pernet_subsys(&udplite6_net_ops); 138 - } 139 - #endif
-2
net/rxrpc/output.c
··· 16 16 #include <net/udp.h> 17 17 #include "ar-internal.h" 18 18 19 - extern int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len); 20 - 21 19 ssize_t do_udp_sendmsg(struct socket *socket, struct msghdr *msg, size_t len) 22 20 { 23 21 struct sockaddr *sa = msg->msg_name;