mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 00:25:02 +07:00
0df6d32842
The INET_DIAG_REQ_BYTECODE nlattr is currently re-found every time when the "dump()" is re-started. In a latter patch, it will also need to parse the new INET_DIAG_REQ_SK_BPF_STORAGES nlattr to learn the map_fds. Thus, this patch takes this chance to store the parsed nlattr in cb->data during the "start" time of a dump. By doing this, the "bc" argument also becomes unnecessary and is removed. Also, the two copies of the INET_DIAG_REQ_BYTECODE parsing-audit logic between compat/current version can be consolidated to one. Signed-off-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> Link: https://lore.kernel.org/bpf/20200225230415.1975555-1-kafai@fb.com
73 lines
2.1 KiB
C
73 lines
2.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _INET_DIAG_H_
|
|
#define _INET_DIAG_H_ 1
|
|
|
|
#include <uapi/linux/inet_diag.h>
|
|
|
|
struct net;
|
|
struct sock;
|
|
struct inet_hashinfo;
|
|
struct nlattr;
|
|
struct nlmsghdr;
|
|
struct sk_buff;
|
|
struct netlink_callback;
|
|
|
|
struct inet_diag_handler {
|
|
void (*dump)(struct sk_buff *skb,
|
|
struct netlink_callback *cb,
|
|
const struct inet_diag_req_v2 *r);
|
|
|
|
int (*dump_one)(struct netlink_callback *cb,
|
|
const struct inet_diag_req_v2 *req);
|
|
|
|
void (*idiag_get_info)(struct sock *sk,
|
|
struct inet_diag_msg *r,
|
|
void *info);
|
|
|
|
int (*idiag_get_aux)(struct sock *sk,
|
|
bool net_admin,
|
|
struct sk_buff *skb);
|
|
|
|
size_t (*idiag_get_aux_size)(struct sock *sk,
|
|
bool net_admin);
|
|
|
|
int (*destroy)(struct sk_buff *in_skb,
|
|
const struct inet_diag_req_v2 *req);
|
|
|
|
__u16 idiag_type;
|
|
__u16 idiag_info_size;
|
|
};
|
|
|
|
struct inet_diag_dump_data {
|
|
struct nlattr *req_nlas[__INET_DIAG_REQ_MAX];
|
|
#define inet_diag_nla_bc req_nlas[INET_DIAG_REQ_BYTECODE]
|
|
};
|
|
|
|
struct inet_connection_sock;
|
|
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,
|
|
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,
|
|
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);
|
|
|
|
void inet_diag_msg_common_fill(struct inet_diag_msg *r, struct sock *sk);
|
|
|
|
int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
|
|
struct inet_diag_msg *r, int ext,
|
|
struct user_namespace *user_ns, bool net_admin);
|
|
|
|
extern int inet_diag_register(const struct inet_diag_handler *handler);
|
|
extern void inet_diag_unregister(const struct inet_diag_handler *handler);
|
|
#endif /* _INET_DIAG_H_ */
|