Blame view
net/ipv4/udplite.c
3.4 KB
ba4e58eca [NET]: Supporting... |
1 2 3 |
/* * UDPLITE An implementation of the UDP-Lite protocol (RFC 3828). * |
ba4e58eca [NET]: Supporting... |
4 5 6 7 8 9 10 11 12 |
* Authors: Gerrit Renker <gerrit@erg.abdn.ac.uk> * * Changes: * Fixes: * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ |
afd465030 net: ipv4: Standa... |
13 14 |
#define pr_fmt(fmt) "UDPLite: " fmt |
bc3b2d7fb net: Add export.h... |
15 |
#include <linux/export.h> |
ba4e58eca [NET]: Supporting... |
16 |
#include "udp_impl.h" |
ba4e58eca [NET]: Supporting... |
17 |
|
f86dcc5aa udp: dynamically ... |
18 |
struct udp_table udplite_table __read_mostly; |
645ca708f udp: introduce st... |
19 |
EXPORT_SYMBOL(udplite_table); |
ba4e58eca [NET]: Supporting... |
20 |
|
f5b99bcdd [NET]: Possible c... |
21 |
static int udplite_rcv(struct sk_buff *skb) |
ba4e58eca [NET]: Supporting... |
22 |
{ |
645ca708f udp: introduce st... |
23 |
return __udp4_lib_rcv(skb, &udplite_table, IPPROTO_UDPLITE); |
ba4e58eca [NET]: Supporting... |
24 |
} |
f5b99bcdd [NET]: Possible c... |
25 |
static void udplite_err(struct sk_buff *skb, u32 info) |
ba4e58eca [NET]: Supporting... |
26 |
{ |
645ca708f udp: introduce st... |
27 |
__udp4_lib_err(skb, info, &udplite_table); |
ba4e58eca [NET]: Supporting... |
28 |
} |
32613090a net: constify str... |
29 |
static const struct net_protocol udplite_protocol = { |
ba4e58eca [NET]: Supporting... |
30 31 32 |
.handler = udplite_rcv, .err_handler = udplite_err, .no_policy = 1, |
92f1fecb4 [NETNS]: Enable T... |
33 |
.netns_ok = 1, |
ba4e58eca [NET]: Supporting... |
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
}; struct proto udplite_prot = { .name = "UDP-Lite", .owner = THIS_MODULE, .close = udp_lib_close, .connect = ip4_datagram_connect, .disconnect = udp_disconnect, .ioctl = udp_ioctl, .init = udplite_sk_init, .destroy = udp_destroy_sock, .setsockopt = udp_setsockopt, .getsockopt = udp_getsockopt, .sendmsg = udp_sendmsg, .recvmsg = udp_recvmsg, .sendpage = udp_sendpage, .backlog_rcv = udp_queue_rcv_skb, .hash = udp_lib_hash, .unhash = udp_lib_unhash, |
6ba5a3c52 [UDP]: Make full ... |
53 |
.get_port = udp_v4_get_port, |
ba4e58eca [NET]: Supporting... |
54 |
.obj_size = sizeof(struct udp_sock), |
271b72c7f udp: RCU handling... |
55 |
.slab_flags = SLAB_DESTROY_BY_RCU, |
645ca708f udp: introduce st... |
56 |
.h.udp_table = &udplite_table, |
ba4e58eca [NET]: Supporting... |
57 58 59 60 |
#ifdef CONFIG_COMPAT .compat_setsockopt = compat_udp_setsockopt, .compat_getsockopt = compat_udp_getsockopt, #endif |
fcbdf09d9 net: fix nulls li... |
61 |
.clear_sk = sk_prot_clear_portaddr_nulls, |
ba4e58eca [NET]: Supporting... |
62 |
}; |
4bc2f18ba net/ipv4: EXPORT_... |
63 |
EXPORT_SYMBOL(udplite_prot); |
ba4e58eca [NET]: Supporting... |
64 65 66 67 68 69 |
static struct inet_protosw udplite4_protosw = { .type = SOCK_DGRAM, .protocol = IPPROTO_UDPLITE, .prot = &udplite_prot, .ops = &inet_dgram_ops, |
ba4e58eca [NET]: Supporting... |
70 71 72 73 |
.flags = INET_PROTOSW_PERMANENT, }; #ifdef CONFIG_PROC_FS |
73cb88ecb net: make the tcp... |
74 75 76 77 78 79 80 81 |
static const struct file_operations udplite_afinfo_seq_fops = { .owner = THIS_MODULE, .open = udp_seq_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release_net }; |
ba4e58eca [NET]: Supporting... |
82 |
static struct udp_seq_afinfo udplite4_seq_afinfo = { |
ba4e58eca [NET]: Supporting... |
83 84 |
.name = "udplite", .family = AF_INET, |
645ca708f udp: introduce st... |
85 |
.udp_table = &udplite_table, |
73cb88ecb net: make the tcp... |
86 |
.seq_fops = &udplite_afinfo_seq_fops, |
dda61925f [UDP]: Move seq_o... |
87 88 89 |
.seq_ops = { .show = udp4_seq_show, }, |
ba4e58eca [NET]: Supporting... |
90 |
}; |
ff2bac6a6 [UDP-Lite]: Clean... |
91 |
|
2c8c1e729 net: spread __net... |
92 |
static int __net_init udplite4_proc_init_net(struct net *net) |
84c375af0 [NETNS][UDP-Lite]... |
93 94 95 |
{ return udp_proc_register(net, &udplite4_seq_afinfo); } |
2c8c1e729 net: spread __net... |
96 |
static void __net_exit udplite4_proc_exit_net(struct net *net) |
84c375af0 [NETNS][UDP-Lite]... |
97 98 99 100 101 102 103 104 |
{ udp_proc_unregister(net, &udplite4_seq_afinfo); } static struct pernet_operations udplite4_net_ops = { .init = udplite4_proc_init_net, .exit = udplite4_proc_exit_net, }; |
ff2bac6a6 [UDP-Lite]: Clean... |
105 106 |
static __init int udplite4_proc_init(void) { |
84c375af0 [NETNS][UDP-Lite]... |
107 |
return register_pernet_subsys(&udplite4_net_ops); |
ff2bac6a6 [UDP-Lite]: Clean... |
108 109 110 111 112 113 |
} #else static inline int udplite4_proc_init(void) { return 0; } |
ba4e58eca [NET]: Supporting... |
114 115 116 117 |
#endif void __init udplite4_register(void) { |
f86dcc5aa udp: dynamically ... |
118 |
udp_table_init(&udplite_table, "UDP-Lite"); |
ba4e58eca [NET]: Supporting... |
119 120 121 122 123 124 125 |
if (proto_register(&udplite_prot, 1)) goto out_register_err; if (inet_add_protocol(&udplite_protocol, IPPROTO_UDPLITE) < 0) goto out_unregister_proto; inet_register_protosw(&udplite4_protosw); |
ff2bac6a6 [UDP-Lite]: Clean... |
126 |
if (udplite4_proc_init()) |
058bd4d2a net: Convert prin... |
127 128 |
pr_err("%s: Cannot register /proc! ", __func__); |
ba4e58eca [NET]: Supporting... |
129 130 131 132 133 |
return; out_unregister_proto: proto_unregister(&udplite_prot); out_register_err: |
058bd4d2a net: Convert prin... |
134 135 |
pr_crit("%s: Cannot add UDP-Lite protocol ", __func__); |
ba4e58eca [NET]: Supporting... |
136 |
} |