| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * UDPLITE An implementation of the UDP-Lite protocol (RFC 3828). |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Changes: |
|---|
| 7 | 8 | * 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. |
|---|
| 12 | 9 | */ |
|---|
| 13 | 10 | |
|---|
| 14 | 11 | #define pr_fmt(fmt) "UDPLite: " fmt |
|---|
| .. | .. |
|---|
| 20 | 17 | struct udp_table udplite_table __read_mostly; |
|---|
| 21 | 18 | EXPORT_SYMBOL(udplite_table); |
|---|
| 22 | 19 | |
|---|
| 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 | + |
|---|
| 23 | 28 | static int udplite_rcv(struct sk_buff *skb) |
|---|
| 24 | 29 | { |
|---|
| 25 | 30 | return __udp4_lib_rcv(skb, &udplite_table, IPPROTO_UDPLITE); |
|---|
| 26 | 31 | } |
|---|
| 27 | 32 | |
|---|
| 28 | | -static void udplite_err(struct sk_buff *skb, u32 info) |
|---|
| 33 | +static int udplite_err(struct sk_buff *skb, u32 info) |
|---|
| 29 | 34 | { |
|---|
| 30 | | - __udp4_lib_err(skb, info, &udplite_table); |
|---|
| 35 | + return __udp4_lib_err(skb, info, &udplite_table); |
|---|
| 31 | 36 | } |
|---|
| 32 | 37 | |
|---|
| 33 | 38 | static const struct net_protocol udplite_protocol = { |
|---|
| .. | .. |
|---|
| 53 | 58 | .sendpage = udp_sendpage, |
|---|
| 54 | 59 | .hash = udp_lib_hash, |
|---|
| 55 | 60 | .unhash = udp_lib_unhash, |
|---|
| 61 | + .rehash = udp_v4_rehash, |
|---|
| 56 | 62 | .get_port = udp_v4_get_port, |
|---|
| 57 | 63 | .memory_allocated = &udp_memory_allocated, |
|---|
| 58 | 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), |
|---|
| 59 | 67 | .obj_size = sizeof(struct udp_sock), |
|---|
| 60 | 68 | .h.udp_table = &udplite_table, |
|---|
| 61 | | -#ifdef CONFIG_COMPAT |
|---|
| 62 | | - .compat_setsockopt = compat_udp_setsockopt, |
|---|
| 63 | | - .compat_getsockopt = compat_udp_getsockopt, |
|---|
| 64 | | -#endif |
|---|
| 65 | 69 | }; |
|---|
| 66 | 70 | EXPORT_SYMBOL(udplite_prot); |
|---|
| 67 | 71 | |
|---|