Message ID | 20241001024837.96425-3-kuniyu@amazon.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ipv4: Namespacify IPv4 address hash table. | expand |
On Tue, Oct 1, 2024 at 4:50 AM Kuniyuki Iwashima <kuniyu@amazon.com> wrote: > > Now, all IPv4 addresses are put in the per-net hash table. > > Let's use it in inet_lookup_ifaddr_rcu(). > > Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Reviewed-by: Eric Dumazet <edumazet@google.com>
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 059807a627a6..cf47b5ac061f 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -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;
Now, all IPv4 addresses are put in the per-net hash table. Let's use it in inet_lookup_ifaddr_rcu(). Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> --- net/ipv4/devinet.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)