]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ipv4: Use per-netns hash table in inet_lookup_ifaddr_rcu().
authorKuniyuki Iwashima <kuniyu@amazon.com>
Tue, 8 Oct 2024 17:29:04 +0000 (10:29 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 10 Oct 2024 03:08:08 +0000 (20:08 -0700)
Now, all IPv4 addresses are put in the per-netns hash table.

Let's use it in inet_lookup_ifaddr_rcu().

Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20241008172906.1326-3-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/devinet.c

index 059807a627a6a40e31b985c1e4eb0e042cc3cce7..cf47b5ac061f91eb846abf1a83b9a94427cde46e 100644 (file)
@@ -188,9 +188,8 @@ struct in_ifaddr *inet_lookup_ifaddr_rcu(struct net *net, __be32 addr)
        u32 hash = inet_addr_hash(net, addr);
        struct in_ifaddr *ifa;
 
-       hlist_for_each_entry_rcu(ifa, &inet_addr_lst[hash], hash)
-               if (ifa->ifa_local == addr &&
-                   net_eq(dev_net(ifa->ifa_dev->dev), net))
+       hlist_for_each_entry_rcu(ifa, &net->ipv4.inet_addr_lst[hash], addr_lst)
+               if (ifa->ifa_local == addr)
                        return ifa;
 
        return NULL;