diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/udp.c | 22 | ||||
-rw-r--r-- | net/ipv4/udp_impl.h | 6 | ||||
-rw-r--r-- | net/ipv4/udplite.c | 15 |
3 files changed, 11 insertions, 32 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index fa946829d1e8..8c1f5eaafcd2 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -143,18 +143,17 @@ static inline int __udp_lib_lport_inuse(struct net *net, __u16 num, | |||
143 | } | 143 | } |
144 | 144 | ||
145 | /** | 145 | /** |
146 | * __udp_lib_get_port - UDP/-Lite port lookup for IPv4 and IPv6 | 146 | * udp_lib_get_port - UDP/-Lite port lookup for IPv4 and IPv6 |
147 | * | 147 | * |
148 | * @sk: socket struct in question | 148 | * @sk: socket struct in question |
149 | * @snum: port number to look up | 149 | * @snum: port number to look up |
150 | * @udptable: hash list table, must be of UDP_HTABLE_SIZE | ||
151 | * @saddr_comp: AF-dependent comparison of bound local IP addresses | 150 | * @saddr_comp: AF-dependent comparison of bound local IP addresses |
152 | */ | 151 | */ |
153 | int __udp_lib_get_port(struct sock *sk, unsigned short snum, | 152 | int udp_lib_get_port(struct sock *sk, unsigned short snum, |
154 | struct hlist_head udptable[], | ||
155 | int (*saddr_comp)(const struct sock *sk1, | 153 | int (*saddr_comp)(const struct sock *sk1, |
156 | const struct sock *sk2 ) ) | 154 | const struct sock *sk2 ) ) |
157 | { | 155 | { |
156 | struct hlist_head *udptable = sk->sk_prot->h.udp_hash; | ||
158 | struct hlist_node *node; | 157 | struct hlist_node *node; |
159 | struct hlist_head *head; | 158 | struct hlist_head *head; |
160 | struct sock *sk2; | 159 | struct sock *sk2; |
@@ -240,13 +239,7 @@ fail: | |||
240 | return error; | 239 | return error; |
241 | } | 240 | } |
242 | 241 | ||
243 | int udp_get_port(struct sock *sk, unsigned short snum, | 242 | static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2) |
244 | int (*scmp)(const struct sock *, const struct sock *)) | ||
245 | { | ||
246 | return __udp_lib_get_port(sk, snum, udp_hash, scmp); | ||
247 | } | ||
248 | |||
249 | int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2) | ||
250 | { | 243 | { |
251 | struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2); | 244 | struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2); |
252 | 245 | ||
@@ -255,9 +248,9 @@ int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2) | |||
255 | inet1->rcv_saddr == inet2->rcv_saddr )); | 248 | inet1->rcv_saddr == inet2->rcv_saddr )); |
256 | } | 249 | } |
257 | 250 | ||
258 | static inline int udp_v4_get_port(struct sock *sk, unsigned short snum) | 251 | int udp_v4_get_port(struct sock *sk, unsigned short snum) |
259 | { | 252 | { |
260 | return udp_get_port(sk, snum, ipv4_rcv_saddr_equal); | 253 | return udp_lib_get_port(sk, snum, ipv4_rcv_saddr_equal); |
261 | } | 254 | } |
262 | 255 | ||
263 | /* UDP is nearly always wildcards out the wazoo, it makes no sense to try | 256 | /* UDP is nearly always wildcards out the wazoo, it makes no sense to try |
@@ -1498,6 +1491,7 @@ struct proto udp_prot = { | |||
1498 | .sysctl_wmem = &sysctl_udp_wmem_min, | 1491 | .sysctl_wmem = &sysctl_udp_wmem_min, |
1499 | .sysctl_rmem = &sysctl_udp_rmem_min, | 1492 | .sysctl_rmem = &sysctl_udp_rmem_min, |
1500 | .obj_size = sizeof(struct udp_sock), | 1493 | .obj_size = sizeof(struct udp_sock), |
1494 | .h.udp_hash = udp_hash, | ||
1501 | #ifdef CONFIG_COMPAT | 1495 | #ifdef CONFIG_COMPAT |
1502 | .compat_setsockopt = compat_udp_setsockopt, | 1496 | .compat_setsockopt = compat_udp_setsockopt, |
1503 | .compat_getsockopt = compat_udp_getsockopt, | 1497 | .compat_getsockopt = compat_udp_getsockopt, |
@@ -1741,12 +1735,12 @@ EXPORT_SYMBOL(udp_disconnect); | |||
1741 | EXPORT_SYMBOL(udp_hash); | 1735 | EXPORT_SYMBOL(udp_hash); |
1742 | EXPORT_SYMBOL(udp_hash_lock); | 1736 | EXPORT_SYMBOL(udp_hash_lock); |
1743 | EXPORT_SYMBOL(udp_ioctl); | 1737 | EXPORT_SYMBOL(udp_ioctl); |
1744 | EXPORT_SYMBOL(udp_get_port); | ||
1745 | EXPORT_SYMBOL(udp_prot); | 1738 | EXPORT_SYMBOL(udp_prot); |
1746 | EXPORT_SYMBOL(udp_sendmsg); | 1739 | EXPORT_SYMBOL(udp_sendmsg); |
1747 | EXPORT_SYMBOL(udp_lib_getsockopt); | 1740 | EXPORT_SYMBOL(udp_lib_getsockopt); |
1748 | EXPORT_SYMBOL(udp_lib_setsockopt); | 1741 | EXPORT_SYMBOL(udp_lib_setsockopt); |
1749 | EXPORT_SYMBOL(udp_poll); | 1742 | EXPORT_SYMBOL(udp_poll); |
1743 | EXPORT_SYMBOL(udp_lib_get_port); | ||
1750 | 1744 | ||
1751 | #ifdef CONFIG_PROC_FS | 1745 | #ifdef CONFIG_PROC_FS |
1752 | EXPORT_SYMBOL(udp_proc_register); | 1746 | EXPORT_SYMBOL(udp_proc_register); |
diff --git a/net/ipv4/udp_impl.h b/net/ipv4/udp_impl.h index 6c55828e41ba..7288bf7977fb 100644 --- a/net/ipv4/udp_impl.h +++ b/net/ipv4/udp_impl.h | |||
@@ -8,11 +8,7 @@ | |||
8 | extern int __udp4_lib_rcv(struct sk_buff *, struct hlist_head [], int ); | 8 | extern int __udp4_lib_rcv(struct sk_buff *, struct hlist_head [], int ); |
9 | extern void __udp4_lib_err(struct sk_buff *, u32, struct hlist_head []); | 9 | extern void __udp4_lib_err(struct sk_buff *, u32, struct hlist_head []); |
10 | 10 | ||
11 | extern int __udp_lib_get_port(struct sock *sk, unsigned short snum, | 11 | extern int udp_v4_get_port(struct sock *sk, unsigned short snum); |
12 | struct hlist_head udptable[], | ||
13 | int (*)(const struct sock*,const struct sock*)); | ||
14 | extern int ipv4_rcv_saddr_equal(const struct sock *, const struct sock *); | ||
15 | |||
16 | 12 | ||
17 | extern int udp_setsockopt(struct sock *sk, int level, int optname, | 13 | extern int udp_setsockopt(struct sock *sk, int level, int optname, |
18 | char __user *optval, int optlen); | 14 | char __user *optval, int optlen); |
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c index 2469b5104587..8d42e344b043 100644 --- a/net/ipv4/udplite.c +++ b/net/ipv4/udplite.c | |||
@@ -17,17 +17,6 @@ DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics) __read_mostly; | |||
17 | 17 | ||
18 | struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; | 18 | struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; |
19 | 19 | ||
20 | int udplite_get_port(struct sock *sk, unsigned short p, | ||
21 | int (*c)(const struct sock *, const struct sock *)) | ||
22 | { | ||
23 | return __udp_lib_get_port(sk, p, udplite_hash, c); | ||
24 | } | ||
25 | |||
26 | static int udplite_v4_get_port(struct sock *sk, unsigned short snum) | ||
27 | { | ||
28 | return udplite_get_port(sk, snum, ipv4_rcv_saddr_equal); | ||
29 | } | ||
30 | |||
31 | static int udplite_rcv(struct sk_buff *skb) | 20 | static int udplite_rcv(struct sk_buff *skb) |
32 | { | 21 | { |
33 | return __udp4_lib_rcv(skb, udplite_hash, IPPROTO_UDPLITE); | 22 | return __udp4_lib_rcv(skb, udplite_hash, IPPROTO_UDPLITE); |
@@ -63,8 +52,9 @@ struct proto udplite_prot = { | |||
63 | .backlog_rcv = udp_queue_rcv_skb, | 52 | .backlog_rcv = udp_queue_rcv_skb, |
64 | .hash = udp_lib_hash, | 53 | .hash = udp_lib_hash, |
65 | .unhash = udp_lib_unhash, | 54 | .unhash = udp_lib_unhash, |
66 | .get_port = udplite_v4_get_port, | 55 | .get_port = udp_v4_get_port, |
67 | .obj_size = sizeof(struct udp_sock), | 56 | .obj_size = sizeof(struct udp_sock), |
57 | .h.udp_hash = udplite_hash, | ||
68 | #ifdef CONFIG_COMPAT | 58 | #ifdef CONFIG_COMPAT |
69 | .compat_setsockopt = compat_udp_setsockopt, | 59 | .compat_setsockopt = compat_udp_setsockopt, |
70 | .compat_getsockopt = compat_udp_getsockopt, | 60 | .compat_getsockopt = compat_udp_getsockopt, |
@@ -118,4 +108,3 @@ out_register_err: | |||
118 | 108 | ||
119 | EXPORT_SYMBOL(udplite_hash); | 109 | EXPORT_SYMBOL(udplite_hash); |
120 | EXPORT_SYMBOL(udplite_prot); | 110 | EXPORT_SYMBOL(udplite_prot); |
121 | EXPORT_SYMBOL(udplite_get_port); | ||