| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * UDPLITEv6 An implementation of the UDP-Lite protocol over IPv6. |
|---|
| 3 | 4 | * See also net/ipv4/udplite.c |
|---|
| .. | .. |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Changes: |
|---|
| 8 | 9 | * Fixes: |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or |
|---|
| 10 | | - * modify it under the terms of the GNU General Public License |
|---|
| 11 | | - * as published by the Free Software Foundation; either version |
|---|
| 12 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 13 | 10 | */ |
|---|
| 14 | 11 | #include <linux/export.h> |
|---|
| 15 | 12 | #include <linux/proc_fs.h> |
|---|
| 16 | 13 | #include "udp_impl.h" |
|---|
| 14 | + |
|---|
| 15 | +static int udplitev6_sk_init(struct sock *sk) |
|---|
| 16 | +{ |
|---|
| 17 | + udpv6_init_sock(sk); |
|---|
| 18 | + udp_sk(sk)->pcflag = UDPLITE_BIT; |
|---|
| 19 | + return 0; |
|---|
| 20 | +} |
|---|
| 17 | 21 | |
|---|
| 18 | 22 | static int udplitev6_rcv(struct sk_buff *skb) |
|---|
| 19 | 23 | { |
|---|
| 20 | 24 | return __udp6_lib_rcv(skb, &udplite_table, IPPROTO_UDPLITE); |
|---|
| 21 | 25 | } |
|---|
| 22 | 26 | |
|---|
| 23 | | -static void udplitev6_err(struct sk_buff *skb, |
|---|
| 27 | +static int udplitev6_err(struct sk_buff *skb, |
|---|
| 24 | 28 | struct inet6_skb_parm *opt, |
|---|
| 25 | 29 | u8 type, u8 code, int offset, __be32 info) |
|---|
| 26 | 30 | { |
|---|
| 27 | | - __udp6_lib_err(skb, opt, type, code, offset, info, &udplite_table); |
|---|
| 31 | + return __udp6_lib_err(skb, opt, type, code, offset, info, |
|---|
| 32 | + &udplite_table); |
|---|
| 28 | 33 | } |
|---|
| 29 | 34 | |
|---|
| 30 | 35 | static const struct inet6_protocol udplitev6_protocol = { |
|---|
| .. | .. |
|---|
| 40 | 45 | .connect = ip6_datagram_connect, |
|---|
| 41 | 46 | .disconnect = udp_disconnect, |
|---|
| 42 | 47 | .ioctl = udp_ioctl, |
|---|
| 43 | | - .init = udplite_sk_init, |
|---|
| 48 | + .init = udplitev6_sk_init, |
|---|
| 44 | 49 | .destroy = udpv6_destroy_sock, |
|---|
| 45 | 50 | .setsockopt = udpv6_setsockopt, |
|---|
| 46 | 51 | .getsockopt = udpv6_getsockopt, |
|---|
| .. | .. |
|---|
| 48 | 53 | .recvmsg = udpv6_recvmsg, |
|---|
| 49 | 54 | .hash = udp_lib_hash, |
|---|
| 50 | 55 | .unhash = udp_lib_unhash, |
|---|
| 56 | + .rehash = udp_v6_rehash, |
|---|
| 51 | 57 | .get_port = udp_v6_get_port, |
|---|
| 52 | 58 | .memory_allocated = &udp_memory_allocated, |
|---|
| 53 | 59 | .sysctl_mem = sysctl_udp_mem, |
|---|
| 60 | + .sysctl_wmem_offset = offsetof(struct net, ipv4.sysctl_udp_wmem_min), |
|---|
| 61 | + .sysctl_rmem_offset = offsetof(struct net, ipv4.sysctl_udp_rmem_min), |
|---|
| 54 | 62 | .obj_size = sizeof(struct udp6_sock), |
|---|
| 55 | 63 | .h.udp_table = &udplite_table, |
|---|
| 56 | | -#ifdef CONFIG_COMPAT |
|---|
| 57 | | - .compat_setsockopt = compat_udpv6_setsockopt, |
|---|
| 58 | | - .compat_getsockopt = compat_udpv6_getsockopt, |
|---|
| 59 | | -#endif |
|---|
| 60 | 64 | }; |
|---|
| 61 | 65 | |
|---|
| 62 | 66 | static struct inet_protosw udplite6_protosw = { |
|---|