diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2006-08-26 23:06:05 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 18:18:21 -0400 |
commit | 25030a7f9eeab2dcefff036469e0e2b4f956198f (patch) | |
tree | 923030c42f1c2bf4aa9cd851df13b95bd0fe542b /include | |
parent | 6a28ec8cd0c6993a4ac0d52f4347f7ed077b5cac (diff) |
[UDP]: Unify UDPv4 and UDPv6 ->get_port()
This patch creates one common function which is called by
udp_v4_get_port() and udp_v6_get_port(). As a result,
* duplicated code is removed
* udp_port_rover and local port lookup can now be removed from udp.h
* further savings follow since the same function will be used by UDP-Litev4
and UDP-Litev6
In contrast to the patch sent in response to Yoshifujis comments
(fixed by this variant), the code below also removes the
EXPORT_SYMBOL(udp_port_rover), since udp_port_rover can now remain
local to net/ipv4/udp.c.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/udp.h | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/include/net/udp.h b/include/net/udp.h index 766fba1369ce..c490a0f662ac 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -30,25 +30,9 @@ | |||
30 | 30 | ||
31 | #define UDP_HTABLE_SIZE 128 | 31 | #define UDP_HTABLE_SIZE 128 |
32 | 32 | ||
33 | /* udp.c: This needs to be shared by v4 and v6 because the lookup | ||
34 | * and hashing code needs to work with different AF's yet | ||
35 | * the port space is shared. | ||
36 | */ | ||
37 | extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; | 33 | extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; |
38 | extern rwlock_t udp_hash_lock; | 34 | extern rwlock_t udp_hash_lock; |
39 | 35 | ||
40 | extern int udp_port_rover; | ||
41 | |||
42 | static inline int udp_lport_inuse(u16 num) | ||
43 | { | ||
44 | struct sock *sk; | ||
45 | struct hlist_node *node; | ||
46 | |||
47 | sk_for_each(sk, node, &udp_hash[num & (UDP_HTABLE_SIZE - 1)]) | ||
48 | if (inet_sk(sk)->num == num) | ||
49 | return 1; | ||
50 | return 0; | ||
51 | } | ||
52 | 36 | ||
53 | /* Note: this must match 'valbool' in sock_setsockopt */ | 37 | /* Note: this must match 'valbool' in sock_setsockopt */ |
54 | #define UDP_CSUM_NOXMIT 1 | 38 | #define UDP_CSUM_NOXMIT 1 |
@@ -63,6 +47,8 @@ extern struct proto udp_prot; | |||
63 | 47 | ||
64 | struct sk_buff; | 48 | struct sk_buff; |
65 | 49 | ||
50 | extern int udp_get_port(struct sock *sk, unsigned short snum, | ||
51 | int (*saddr_cmp)(struct sock *, struct sock *)); | ||
66 | extern void udp_err(struct sk_buff *, u32); | 52 | extern void udp_err(struct sk_buff *, u32); |
67 | 53 | ||
68 | extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, | 54 | extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, |