diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-09-08 03:10:20 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-09-20 19:21:49 +0200 |
commit | 4461568aa4e565de2c336f4875ddf912f26da8a5 (patch) | |
tree | f16df651fb474e16ed08b17be120e8305df8198d /net/core | |
parent | tcp: Set NULL to sk->sk_prot->h.hashinfo. (diff) | |
download | linux-4461568aa4e565de2c336f4875ddf912f26da8a5.tar.xz linux-4461568aa4e565de2c336f4875ddf912f26da8a5.zip |
tcp: Access &tcp_hashinfo via net.
We will soon introduce an optional per-netns ehash.
This means we cannot use tcp_hashinfo directly in most places.
Instead, access it via net->ipv4.tcp_death_row.hashinfo.
The access will be valid only while initialising tcp_hashinfo
itself and creating/destroying each netns.
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/filter.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/core/filter.c b/net/core/filter.c index e872f45399b0..31608801078e 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -6373,6 +6373,7 @@ static const struct bpf_func_proto bpf_lwt_seg6_adjust_srh_proto = { static struct sock *sk_lookup(struct net *net, struct bpf_sock_tuple *tuple, int dif, int sdif, u8 family, u8 proto) { + struct inet_hashinfo *hinfo = net->ipv4.tcp_death_row.hashinfo; bool refcounted = false; struct sock *sk = NULL; @@ -6381,7 +6382,7 @@ static struct sock *sk_lookup(struct net *net, struct bpf_sock_tuple *tuple, __be32 dst4 = tuple->ipv4.daddr; if (proto == IPPROTO_TCP) - sk = __inet_lookup(net, &tcp_hashinfo, NULL, 0, + sk = __inet_lookup(net, hinfo, NULL, 0, src4, tuple->ipv4.sport, dst4, tuple->ipv4.dport, dif, sdif, &refcounted); @@ -6395,7 +6396,7 @@ static struct sock *sk_lookup(struct net *net, struct bpf_sock_tuple *tuple, struct in6_addr *dst6 = (struct in6_addr *)&tuple->ipv6.daddr; if (proto == IPPROTO_TCP) - sk = __inet6_lookup(net, &tcp_hashinfo, NULL, 0, + sk = __inet6_lookup(net, hinfo, NULL, 0, src6, tuple->ipv6.sport, dst6, ntohs(tuple->ipv6.dport), dif, sdif, &refcounted); |