mirror of
https://github.com/torvalds/linux.git
synced 2026-07-29 10:41:49 +02:00
tcp: Don't pass hashinfo to inet_diag helpers.
These inet_diag functions required struct inet_hashinfo because they are shared by TCP and DCCP: * inet_diag_dump_icsk() * inet_diag_dump_one_icsk() * inet_diag_find_one_icsk() DCCP has gone, and we don't need to pass hashinfo down to them. Let's fetch net->ipv4.tcp_death_row.hashinfo directly in the first 2 functions. Note that inet_diag_find_one_icsk() don't need hashinfo since the previous patch. We will move TCP-specific functions to tcp_diag.c in the next patch. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20250822190803.540788-6-kuniyu@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
cb16f4b6c7
commit
f1241200cd
|
|
@ -48,15 +48,13 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
|
|||
struct sk_buff *skb, struct netlink_callback *cb,
|
||||
const struct inet_diag_req_v2 *req,
|
||||
u16 nlmsg_flags, bool net_admin);
|
||||
void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
|
||||
void inet_diag_dump_icsk(struct sk_buff *skb,
|
||||
struct netlink_callback *cb,
|
||||
const struct inet_diag_req_v2 *r);
|
||||
int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
|
||||
struct netlink_callback *cb,
|
||||
int inet_diag_dump_one_icsk(struct netlink_callback *cb,
|
||||
const struct inet_diag_req_v2 *req);
|
||||
|
||||
struct sock *inet_diag_find_one_icsk(struct net *net,
|
||||
struct inet_hashinfo *hashinfo,
|
||||
const struct inet_diag_req_v2 *req);
|
||||
|
||||
int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
|
||||
|
|
|
|||
|
|
@ -519,7 +519,6 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
|
|||
}
|
||||
|
||||
struct sock *inet_diag_find_one_icsk(struct net *net,
|
||||
struct inet_hashinfo *hashinfo,
|
||||
const struct inet_diag_req_v2 *req)
|
||||
{
|
||||
struct sock *sk;
|
||||
|
|
@ -562,8 +561,7 @@ struct sock *inet_diag_find_one_icsk(struct net *net,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(inet_diag_find_one_icsk);
|
||||
|
||||
int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
|
||||
struct netlink_callback *cb,
|
||||
int inet_diag_dump_one_icsk(struct netlink_callback *cb,
|
||||
const struct inet_diag_req_v2 *req)
|
||||
{
|
||||
struct sk_buff *in_skb = cb->skb;
|
||||
|
|
@ -573,7 +571,7 @@ int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
|
|||
struct sock *sk;
|
||||
int err;
|
||||
|
||||
sk = inet_diag_find_one_icsk(net, hashinfo, req);
|
||||
sk = inet_diag_find_one_icsk(net, req);
|
||||
if (IS_ERR(sk))
|
||||
return PTR_ERR(sk);
|
||||
|
||||
|
|
@ -1018,7 +1016,7 @@ static void twsk_build_assert(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb,
|
||||
void inet_diag_dump_icsk(struct sk_buff *skb,
|
||||
struct netlink_callback *cb,
|
||||
const struct inet_diag_req_v2 *r)
|
||||
{
|
||||
|
|
@ -1026,10 +1024,12 @@ void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb,
|
|||
struct inet_diag_dump_data *cb_data = cb->data;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
u32 idiag_states = r->idiag_states;
|
||||
struct inet_hashinfo *hashinfo;
|
||||
int i, num, s_i, s_num;
|
||||
struct nlattr *bc;
|
||||
struct sock *sk;
|
||||
|
||||
hashinfo = net->ipv4.tcp_death_row.hashinfo;
|
||||
bc = cb_data->inet_diag_nla_bc;
|
||||
if (idiag_states & TCPF_SYN_RECV)
|
||||
idiag_states |= TCPF_NEW_SYN_RECV;
|
||||
|
|
|
|||
|
|
@ -180,21 +180,13 @@ static size_t tcp_diag_get_aux_size(struct sock *sk, bool net_admin)
|
|||
static void tcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
|
||||
const struct inet_diag_req_v2 *r)
|
||||
{
|
||||
struct inet_hashinfo *hinfo;
|
||||
|
||||
hinfo = sock_net(cb->skb->sk)->ipv4.tcp_death_row.hashinfo;
|
||||
|
||||
inet_diag_dump_icsk(hinfo, skb, cb, r);
|
||||
inet_diag_dump_icsk(skb, cb, r);
|
||||
}
|
||||
|
||||
static int tcp_diag_dump_one(struct netlink_callback *cb,
|
||||
const struct inet_diag_req_v2 *req)
|
||||
{
|
||||
struct inet_hashinfo *hinfo;
|
||||
|
||||
hinfo = sock_net(cb->skb->sk)->ipv4.tcp_death_row.hashinfo;
|
||||
|
||||
return inet_diag_dump_one_icsk(hinfo, cb, req);
|
||||
return inet_diag_dump_one_icsk(cb, req);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_INET_DIAG_DESTROY
|
||||
|
|
@ -202,13 +194,10 @@ static int tcp_diag_destroy(struct sk_buff *in_skb,
|
|||
const struct inet_diag_req_v2 *req)
|
||||
{
|
||||
struct net *net = sock_net(in_skb->sk);
|
||||
struct inet_hashinfo *hinfo;
|
||||
struct sock *sk;
|
||||
int err;
|
||||
|
||||
hinfo = net->ipv4.tcp_death_row.hashinfo;
|
||||
sk = inet_diag_find_one_icsk(net, hinfo, req);
|
||||
|
||||
sk = inet_diag_find_one_icsk(net, req);
|
||||
if (IS_ERR(sk))
|
||||
return PTR_ERR(sk);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user