Commit 8f6b5392 authored by Alexey Kodanev's avatar Alexey Kodanev Committed by David S. Miller
Browse files

udp: add missing rehash callback to udplite

After commit 4cdeeee9 ("net: udp: prefer listeners bound to an
address"), UDP-Lite only works when specifying a local address for
the sockets.

This is related to the problem addressed in the commit 719f8358
("udp: add rehash on connect()"). Moreover, __udp4_lib_lookup() now
looks for a socket immediately in the secondary hash table.

The issue was found with LTP/network tests (UDP-Lite test-cases).

Fixes: 4cdeeee9

 ("net: udp: prefer listeners bound to an address")
Signed-off-by: default avatarAlexey Kodanev <alexey.kodanev@oracle.com>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2cddd201
...@@ -1926,7 +1926,7 @@ void udp_lib_rehash(struct sock *sk, u16 newhash) ...@@ -1926,7 +1926,7 @@ void udp_lib_rehash(struct sock *sk, u16 newhash)
} }
EXPORT_SYMBOL(udp_lib_rehash); EXPORT_SYMBOL(udp_lib_rehash);
static void udp_v4_rehash(struct sock *sk) void udp_v4_rehash(struct sock *sk)
{ {
u16 new_hash = ipv4_portaddr_hash(sock_net(sk), u16 new_hash = ipv4_portaddr_hash(sock_net(sk),
inet_sk(sk)->inet_rcv_saddr, inet_sk(sk)->inet_rcv_saddr,
......
...@@ -10,6 +10,7 @@ int __udp4_lib_rcv(struct sk_buff *, struct udp_table *, int); ...@@ -10,6 +10,7 @@ int __udp4_lib_rcv(struct sk_buff *, struct udp_table *, int);
int __udp4_lib_err(struct sk_buff *, u32, struct udp_table *); int __udp4_lib_err(struct sk_buff *, u32, struct udp_table *);
int udp_v4_get_port(struct sock *sk, unsigned short snum); int udp_v4_get_port(struct sock *sk, unsigned short snum);
void udp_v4_rehash(struct sock *sk);
int udp_setsockopt(struct sock *sk, int level, int optname, int udp_setsockopt(struct sock *sk, int level, int optname,
char __user *optval, unsigned int optlen); char __user *optval, unsigned int optlen);
......
...@@ -53,6 +53,7 @@ struct proto udplite_prot = { ...@@ -53,6 +53,7 @@ struct proto udplite_prot = {
.sendpage = udp_sendpage, .sendpage = udp_sendpage,
.hash = udp_lib_hash, .hash = udp_lib_hash,
.unhash = udp_lib_unhash, .unhash = udp_lib_unhash,
.rehash = udp_v4_rehash,
.get_port = udp_v4_get_port, .get_port = udp_v4_get_port,
.memory_allocated = &udp_memory_allocated, .memory_allocated = &udp_memory_allocated,
.sysctl_mem = sysctl_udp_mem, .sysctl_mem = sysctl_udp_mem,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment