udp6: add missing rehash callback to udplite
authorAlexey Kodanev <alexey.kodanev@oracle.com>
Wed, 16 Jan 2019 16:17:45 +0000 (19:17 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Jan 2019 23:01:08 +0000 (15:01 -0800)
After commit 23b0269e58ae ("net: udp6: 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 719f835853a9
("udp: add rehash on connect()"). Moreover, __udp6_lib_lookup() now
looks for a socket immediately in the secondary hash table.

And this issue was found with LTP/network tests as well.

Fixes: 23b0269e58ae ("net: udp6: 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>
net/ipv6/udp.c
net/ipv6/udp_impl.h
net/ipv6/udplite.c

index e1f2b96606662b495f7f00a1c70a05cd77c1a106..2596ffdeebeaaa60f096d774f3da32bd5486a2f4 100644 (file)
@@ -102,7 +102,7 @@ int udp_v6_get_port(struct sock *sk, unsigned short snum)
        return udp_lib_get_port(sk, snum, hash2_nulladdr);
 }
 
-static void udp_v6_rehash(struct sock *sk)
+void udp_v6_rehash(struct sock *sk)
 {
        u16 new_hash = ipv6_portaddr_hash(sock_net(sk),
                                          &sk->sk_v6_rcv_saddr,
index 5730e6503cb496c6adfcada286ac24b4bab65ab8..20e324b6f3584e8f52473eb703943025c81288f8 100644 (file)
@@ -13,6 +13,7 @@ int __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *, u8, u8, int,
                   __be32, struct udp_table *);
 
 int udp_v6_get_port(struct sock *sk, unsigned short snum);
+void udp_v6_rehash(struct sock *sk);
 
 int udpv6_getsockopt(struct sock *sk, int level, int optname,
                     char __user *optval, int __user *optlen);
index a125aebc29e5e9d2874b3c7bd5f1f1e9970fda67..f359078364448fc9e1d9a45d98bb8f9ca9b1e63a 100644 (file)
@@ -49,6 +49,7 @@ struct proto udplitev6_prot = {
        .recvmsg           = udpv6_recvmsg,
        .hash              = udp_lib_hash,
        .unhash            = udp_lib_unhash,
+       .rehash            = udp_v6_rehash,
        .get_port          = udp_v6_get_port,
        .memory_allocated  = &udp_memory_allocated,
        .sysctl_mem        = sysctl_udp_mem,