Skip to content

Commit 8f6b539

Browse files
akodanevdavem330
authored andcommitted
udp: add missing rehash callback to udplite
After commit 4cdeeee ("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 719f835 ("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: 4cdeeee ("net: udp: prefer listeners bound to an address") Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2cddd20 commit 8f6b539

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

net/ipv4/udp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,7 @@ void udp_lib_rehash(struct sock *sk, u16 newhash)
19261926
}
19271927
EXPORT_SYMBOL(udp_lib_rehash);
19281928

1929-
static void udp_v4_rehash(struct sock *sk)
1929+
void udp_v4_rehash(struct sock *sk)
19301930
{
19311931
u16 new_hash = ipv4_portaddr_hash(sock_net(sk),
19321932
inet_sk(sk)->inet_rcv_saddr,

net/ipv4/udp_impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ int __udp4_lib_rcv(struct sk_buff *, struct udp_table *, int);
1010
int __udp4_lib_err(struct sk_buff *, u32, struct udp_table *);
1111

1212
int udp_v4_get_port(struct sock *sk, unsigned short snum);
13+
void udp_v4_rehash(struct sock *sk);
1314

1415
int udp_setsockopt(struct sock *sk, int level, int optname,
1516
char __user *optval, unsigned int optlen);

net/ipv4/udplite.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct proto udplite_prot = {
5353
.sendpage = udp_sendpage,
5454
.hash = udp_lib_hash,
5555
.unhash = udp_lib_unhash,
56+
.rehash = udp_v4_rehash,
5657
.get_port = udp_v4_get_port,
5758
.memory_allocated = &udp_memory_allocated,
5859
.sysctl_mem = sysctl_udp_mem,

0 commit comments

Comments
 (0)