linux/net/ipv4/inet_diag.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * inet_diag.c	Module for monitoring INET transport protocols sockets.
 *
 * Authors:	Alexey Kuznetsov, <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/random.h>
#include <linux/slab.h>
#include <linux/cache.h>
#include <linux/init.h>
#include <linux/time.h>

#include <net/icmp.h>
#include <net/tcp.h>
#include <net/ipv6.h>
#include <net/inet_common.h>
#include <net/inet_connection_sock.h>
#include <net/inet_hashtables.h>
#include <net/inet_timewait_sock.h>
#include <net/inet6_hashtables.h>
#include <net/bpf_sk_storage.h>
#include <net/netlink.h>

#include <linux/inet.h>
#include <linux/stddef.h>

#include <linux/inet_diag.h>
#include <linux/sock_diag.h>

static const struct inet_diag_handler __rcu **inet_diag_table;

struct inet_diag_entry {};

static const struct inet_diag_handler *inet_diag_lock_handler(int proto)
{}

static void inet_diag_unlock_handler(const struct inet_diag_handler *handler)
{}

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

static size_t inet_sk_attr_size(struct sock *sk,
				const struct inet_diag_req_v2 *req,
				bool net_admin)
{}

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)
{}
EXPORT_SYMBOL_GPL();

static int inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen,
				 struct nlattr **req_nlas)
{}

static int inet_diag_get_protocol(const struct inet_diag_req_v2 *req,
				  const struct inet_diag_dump_data *data)
{}

#define MAX_DUMP_ALLOC_SIZE

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)
{}
EXPORT_SYMBOL_GPL();

static int inet_twsk_diag_fill(struct sock *sk,
			       struct sk_buff *skb,
			       struct netlink_callback *cb,
			       u16 nlmsg_flags, bool net_admin)
{}

static int inet_req_diag_fill(struct sock *sk, struct sk_buff *skb,
			      struct netlink_callback *cb,
			      u16 nlmsg_flags, bool net_admin)
{}

static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
			struct netlink_callback *cb,
			const struct inet_diag_req_v2 *r,
			u16 nlmsg_flags, bool net_admin)
{}

struct sock *inet_diag_find_one_icsk(struct net *net,
				     struct inet_hashinfo *hashinfo,
				     const struct inet_diag_req_v2 *req)
{}
EXPORT_SYMBOL_GPL();

int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
			    struct netlink_callback *cb,
			    const struct inet_diag_req_v2 *req)
{}
EXPORT_SYMBOL_GPL();

static int inet_diag_cmd_exact(int cmd, struct sk_buff *in_skb,
			       const struct nlmsghdr *nlh,
			       int hdrlen,
			       const struct inet_diag_req_v2 *req)
{}

static int bitstring_match(const __be32 *a1, const __be32 *a2, int bits)
{}

static int inet_diag_bc_run(const struct nlattr *_bc,
			    const struct inet_diag_entry *entry)
{}

/* This helper is available for all sockets (ESTABLISH, TIMEWAIT, SYN_RECV)
 */
static void entry_fill_addrs(struct inet_diag_entry *entry,
			     const struct sock *sk)
{}

int inet_diag_bc_sk(const struct nlattr *bc, struct sock *sk)
{}
EXPORT_SYMBOL_GPL();

static int valid_cc(const void *bc, int len, int cc)
{}

/* data is u32 ifindex */
static bool valid_devcond(const struct inet_diag_bc_op *op, int len,
			  int *min_len)
{}
/* Validate an inet_diag_hostcond. */
static bool valid_hostcond(const struct inet_diag_bc_op *op, int len,
			   int *min_len)
{}

/* Validate a port comparison operator. */
static bool valid_port_comparison(const struct inet_diag_bc_op *op,
				  int len, int *min_len)
{}

static bool valid_markcond(const struct inet_diag_bc_op *op, int len,
			   int *min_len)
{}

#ifdef CONFIG_SOCK_CGROUP_DATA
static bool valid_cgroupcond(const struct inet_diag_bc_op *op, int len,
			     int *min_len)
{}
#endif

static int inet_diag_bc_audit(const struct nlattr *attr,
			      const struct sk_buff *skb)
{}

static void twsk_build_assert(void)
{}

void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb,
			 struct netlink_callback *cb,
			 const struct inet_diag_req_v2 *r)
{}
EXPORT_SYMBOL_GPL();

static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
			    const struct inet_diag_req_v2 *r)
{}

static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
{}

static int __inet_diag_dump_start(struct netlink_callback *cb, int hdrlen)
{}

static int inet_diag_dump_start(struct netlink_callback *cb)
{}

static int inet_diag_dump_start_compat(struct netlink_callback *cb)
{}

static int inet_diag_dump_done(struct netlink_callback *cb)
{}

static int inet_diag_type2proto(int type)
{}

static int inet_diag_dump_compat(struct sk_buff *skb,
				 struct netlink_callback *cb)
{}

static int inet_diag_get_exact_compat(struct sk_buff *in_skb,
				      const struct nlmsghdr *nlh)
{}

static int inet_diag_rcv_msg_compat(struct sk_buff *skb, struct nlmsghdr *nlh)
{}

static int inet_diag_handler_cmd(struct sk_buff *skb, struct nlmsghdr *h)
{}

static
int inet_diag_handler_get_info(struct sk_buff *skb, struct sock *sk)
{}

static const struct sock_diag_handler inet_diag_handler =;

static const struct sock_diag_handler inet6_diag_handler =;

int inet_diag_register(const struct inet_diag_handler *h)
{}
EXPORT_SYMBOL_GPL();

void inet_diag_unregister(const struct inet_diag_handler *h)
{}
EXPORT_SYMBOL_GPL();

static const struct sock_diag_inet_compat inet_diag_compat =;

static int __init inet_diag_init(void)
{}

static void __exit inet_diag_exit(void)
{}

module_init();
module_exit(inet_diag_exit);
MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_ALIAS_NET_PF_PROTO_TYPE();
MODULE_ALIAS_NET_PF_PROTO_TYPE();