hc
2024-02-20 e636c8d336489bf3eed5878299e6cc045bbad077
kernel/net/ipv4/udplite.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * UDPLITE An implementation of the UDP-Lite protocol (RFC 3828).
34 *
....@@ -5,10 +6,6 @@
56 *
67 * Changes:
78 * Fixes:
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License
10
- * as published by the Free Software Foundation; either version
11
- * 2 of the License, or (at your option) any later version.
129 */
1310
1411 #define pr_fmt(fmt) "UDPLite: " fmt
....@@ -20,14 +17,22 @@
2017 struct udp_table udplite_table __read_mostly;
2118 EXPORT_SYMBOL(udplite_table);
2219
20
+/* Designate sk as UDP-Lite socket */
21
+static int udplite_sk_init(struct sock *sk)
22
+{
23
+ udp_init_sock(sk);
24
+ udp_sk(sk)->pcflag = UDPLITE_BIT;
25
+ return 0;
26
+}
27
+
2328 static int udplite_rcv(struct sk_buff *skb)
2429 {
2530 return __udp4_lib_rcv(skb, &udplite_table, IPPROTO_UDPLITE);
2631 }
2732
28
-static void udplite_err(struct sk_buff *skb, u32 info)
33
+static int udplite_err(struct sk_buff *skb, u32 info)
2934 {
30
- __udp4_lib_err(skb, info, &udplite_table);
35
+ return __udp4_lib_err(skb, info, &udplite_table);
3136 }
3237
3338 static const struct net_protocol udplite_protocol = {
....@@ -53,15 +58,14 @@
5358 .sendpage = udp_sendpage,
5459 .hash = udp_lib_hash,
5560 .unhash = udp_lib_unhash,
61
+ .rehash = udp_v4_rehash,
5662 .get_port = udp_v4_get_port,
5763 .memory_allocated = &udp_memory_allocated,
5864 .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),
5967 .obj_size = sizeof(struct udp_sock),
6068 .h.udp_table = &udplite_table,
61
-#ifdef CONFIG_COMPAT
62
- .compat_setsockopt = compat_udp_setsockopt,
63
- .compat_getsockopt = compat_udp_getsockopt,
64
-#endif
6569 };
6670 EXPORT_SYMBOL(udplite_prot);
6771