10 * as published by the Free Software Foundation; either version |
10 * as published by the Free Software Foundation; either version |
11 * 2 of the License, or (at your option) any later version. |
11 * 2 of the License, or (at your option) any later version. |
12 */ |
12 */ |
13 #include "udp_impl.h" |
13 #include "udp_impl.h" |
14 |
14 |
15 struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; |
15 struct udp_table udplite_table; |
|
16 EXPORT_SYMBOL(udplite_table); |
16 |
17 |
17 static int udplite_rcv(struct sk_buff *skb) |
18 static int udplite_rcv(struct sk_buff *skb) |
18 { |
19 { |
19 return __udp4_lib_rcv(skb, udplite_hash, IPPROTO_UDPLITE); |
20 return __udp4_lib_rcv(skb, &udplite_table, IPPROTO_UDPLITE); |
20 } |
21 } |
21 |
22 |
22 static void udplite_err(struct sk_buff *skb, u32 info) |
23 static void udplite_err(struct sk_buff *skb, u32 info) |
23 { |
24 { |
24 __udp4_lib_err(skb, info, udplite_hash); |
25 __udp4_lib_err(skb, info, &udplite_table); |
25 } |
26 } |
26 |
27 |
27 static struct net_protocol udplite_protocol = { |
28 static struct net_protocol udplite_protocol = { |
28 .handler = udplite_rcv, |
29 .handler = udplite_rcv, |
29 .err_handler = udplite_err, |
30 .err_handler = udplite_err, |
48 .backlog_rcv = udp_queue_rcv_skb, |
49 .backlog_rcv = udp_queue_rcv_skb, |
49 .hash = udp_lib_hash, |
50 .hash = udp_lib_hash, |
50 .unhash = udp_lib_unhash, |
51 .unhash = udp_lib_unhash, |
51 .get_port = udp_v4_get_port, |
52 .get_port = udp_v4_get_port, |
52 .obj_size = sizeof(struct udp_sock), |
53 .obj_size = sizeof(struct udp_sock), |
53 .h.udp_hash = udplite_hash, |
54 .slab_flags = SLAB_DESTROY_BY_RCU, |
|
55 .h.udp_table = &udplite_table, |
54 #ifdef CONFIG_COMPAT |
56 #ifdef CONFIG_COMPAT |
55 .compat_setsockopt = compat_udp_setsockopt, |
57 .compat_setsockopt = compat_udp_setsockopt, |
56 .compat_getsockopt = compat_udp_getsockopt, |
58 .compat_getsockopt = compat_udp_getsockopt, |
57 #endif |
59 #endif |
58 }; |
60 }; |
106 } |
108 } |
107 #endif |
109 #endif |
108 |
110 |
109 void __init udplite4_register(void) |
111 void __init udplite4_register(void) |
110 { |
112 { |
|
113 udp_table_init(&udplite_table); |
111 if (proto_register(&udplite_prot, 1)) |
114 if (proto_register(&udplite_prot, 1)) |
112 goto out_register_err; |
115 goto out_register_err; |
113 |
116 |
114 if (inet_add_protocol(&udplite_protocol, IPPROTO_UDPLITE) < 0) |
117 if (inet_add_protocol(&udplite_protocol, IPPROTO_UDPLITE) < 0) |
115 goto out_unregister_proto; |
118 goto out_unregister_proto; |