[UDP]: Make full use of proto.h.udp_hash innovation.
After this we have only udp_lib_get_port to get the port and two stubs for ipv4 and ipv6. No difference in udp and udplite except for initialized h.udp_hash member. I tried to find a graceful way to drop the only difference between udp_v4_get_port and udp_v6_get_port (i.e. the rcv_saddr comparison routine), but adding one more callback on the struct proto didn't appear such :( Maybe later. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
39d8cda76c
commit
6ba5a3c52d
@@ -17,17 +17,6 @@ DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics) __read_mostly;
|
||||
|
||||
struct hlist_head udplite_hash[UDP_HTABLE_SIZE];
|
||||
|
||||
int udplite_get_port(struct sock *sk, unsigned short p,
|
||||
int (*c)(const struct sock *, const struct sock *))
|
||||
{
|
||||
return __udp_lib_get_port(sk, p, udplite_hash, c);
|
||||
}
|
||||
|
||||
static int udplite_v4_get_port(struct sock *sk, unsigned short snum)
|
||||
{
|
||||
return udplite_get_port(sk, snum, ipv4_rcv_saddr_equal);
|
||||
}
|
||||
|
||||
static int udplite_rcv(struct sk_buff *skb)
|
||||
{
|
||||
return __udp4_lib_rcv(skb, udplite_hash, IPPROTO_UDPLITE);
|
||||
@@ -63,8 +52,9 @@ struct proto udplite_prot = {
|
||||
.backlog_rcv = udp_queue_rcv_skb,
|
||||
.hash = udp_lib_hash,
|
||||
.unhash = udp_lib_unhash,
|
||||
.get_port = udplite_v4_get_port,
|
||||
.get_port = udp_v4_get_port,
|
||||
.obj_size = sizeof(struct udp_sock),
|
||||
.h.udp_hash = udplite_hash,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_setsockopt = compat_udp_setsockopt,
|
||||
.compat_getsockopt = compat_udp_getsockopt,
|
||||
@@ -118,4 +108,3 @@ out_register_err:
|
||||
|
||||
EXPORT_SYMBOL(udplite_hash);
|
||||
EXPORT_SYMBOL(udplite_prot);
|
||||
EXPORT_SYMBOL(udplite_get_port);
|
||||
|
Reference in New Issue
Block a user