Contributors: 20
Author Tokens Token Proportion Commits Commit Proportion
Pavel Emelyanov 81 21.32% 7 18.92%
Arnaldo Carvalho de Melo 77 20.26% 3 8.11%
Xin Long 47 12.37% 1 2.70%
Martin KaFai Lau 36 9.47% 3 8.11%
Eric Dumazet 32 8.42% 5 13.51%
Dmitry Yakunin 29 7.63% 2 5.41%
Lorenzo Colitti 15 3.95% 2 5.41%
Ivan Delalande 13 3.42% 1 2.70%
Linus Torvalds 8 2.11% 1 2.70%
Herbert Xu 6 1.58% 2 5.41%
Eric W. Biedermann 6 1.58% 1 2.70%
Linus Torvalds (pre-git) 6 1.58% 1 2.70%
Cyrill V. Gorcunov 5 1.32% 1 2.70%
Wei Wang 4 1.05% 1 2.70%
Jaswinder Singh Rajput 4 1.05% 1 2.70%
Ben Dooks 4 1.05% 1 2.70%
Craig Gallek 3 0.79% 1 2.70%
Konstantin Khlebnikov 2 0.53% 1 2.70%
Greg Kroah-Hartman 1 0.26% 1 2.70%
David Howells 1 0.26% 1 2.70%
Total 380 37


/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _INET_DIAG_H_
#define _INET_DIAG_H_ 1

#include <net/netlink.h>
#include <uapi/linux/inet_diag.h>

struct inet_hashinfo;

struct inet_diag_handler {
	struct module	*owner;
	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);

	int		(*destroy)(struct sk_buff *in_skb,
				   const struct inet_diag_req_v2 *req);

	__u16		idiag_type;
	__u16		idiag_info_size;
};

struct bpf_sk_storage_diag;
struct inet_diag_dump_data {
	struct nlattr *req_nlas[__INET_DIAG_REQ_MAX];
#define inet_diag_nla_bc req_nlas[INET_DIAG_REQ_BYTECODE]
#define inet_diag_nla_bpf_stgs req_nlas[INET_DIAG_REQ_SK_BPF_STORAGES]

	struct bpf_sk_storage_diag *bpf_stg_diag;
	bool mark_needed;	/* INET_DIAG_BC_MARK_COND present. */
#ifdef CONFIG_SOCK_CGROUP_DATA
	bool cgroup_needed;	/* INET_DIAG_BC_CGROUP_COND present. */
#endif
	bool userlocks_needed;	/* INET_DIAG_BC_AUTO present. */
};

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);

int inet_diag_bc_sk(const struct inet_diag_dump_data *cb_data, struct sock *sk);

void inet_diag_msg_common_fill(struct inet_diag_msg *r, struct sock *sk);

static inline size_t inet_diag_msg_attrs_size(void)
{
	return	  nla_total_size(1)  /* INET_DIAG_SHUTDOWN */
		+ nla_total_size(1)  /* INET_DIAG_TOS */
#if IS_ENABLED(CONFIG_IPV6)
		+ nla_total_size(1)  /* INET_DIAG_TCLASS */
		+ nla_total_size(1)  /* INET_DIAG_SKV6ONLY */
#endif
		+ nla_total_size(4)  /* INET_DIAG_MARK */
		+ nla_total_size(4)  /* INET_DIAG_CLASS_ID */
#ifdef CONFIG_SOCK_CGROUP_DATA
		+ nla_total_size_64bit(sizeof(u64))  /* INET_DIAG_CGROUP_ID */
#endif
		+ nla_total_size(sizeof(struct inet_diag_sockopt))
						     /* INET_DIAG_SOCKOPT */
		;
}
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_ */