linux/net/netfilter/nf_conntrack_helper.c

// SPDX-License-Identifier: GPL-2.0-only
/* Helper handling for netfilter. */

/* (C) 1999-2001 Paul `Rusty' Russell
 * (C) 2002-2006 Netfilter Core Team <[email protected]>
 * (C) 2003,2004 USAGI/WIDE Project <http://www.linux-ipv6.org>
 * (C) 2006-2012 Patrick McHardy <[email protected]>
 */

#include <linux/types.h>
#include <linux/netfilter.h>
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/vmalloc.h>
#include <linux/stddef.h>
#include <linux/random.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/rculist.h>
#include <linux/rtnetlink.h>

#include <net/netfilter/nf_conntrack.h>
#include <net/netfilter/nf_conntrack_core.h>
#include <net/netfilter/nf_conntrack_ecache.h>
#include <net/netfilter/nf_conntrack_extend.h>
#include <net/netfilter/nf_conntrack_helper.h>
#include <net/netfilter/nf_conntrack_l4proto.h>
#include <net/netfilter/nf_conntrack_seqadj.h>
#include <net/netfilter/nf_log.h>
#include <net/ip.h>

static DEFINE_MUTEX(nf_ct_helper_mutex);
struct hlist_head *nf_ct_helper_hash __read_mostly;
EXPORT_SYMBOL_GPL();
unsigned int nf_ct_helper_hsize __read_mostly;
EXPORT_SYMBOL_GPL();
static unsigned int nf_ct_helper_count __read_mostly;

static DEFINE_MUTEX(nf_ct_nat_helpers_mutex);
static struct list_head nf_ct_nat_helpers __read_mostly;

/* Stupid hash, but collision free for the default registrations of the
 * helpers currently in the kernel. */
static unsigned int helper_hash(const struct nf_conntrack_tuple *tuple)
{}

struct nf_conntrack_helper *
__nf_conntrack_helper_find(const char *name, u16 l3num, u8 protonum)
{}
EXPORT_SYMBOL_GPL();

struct nf_conntrack_helper *
nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum)
{}
EXPORT_SYMBOL_GPL();

void nf_conntrack_helper_put(struct nf_conntrack_helper *helper)
{}
EXPORT_SYMBOL_GPL();

static struct nf_conntrack_nat_helper *
nf_conntrack_nat_helper_find(const char *mod_name)
{}

int
nf_nat_helper_try_module_get(const char *name, u16 l3num, u8 protonum)
{}
EXPORT_SYMBOL_GPL();

void nf_nat_helper_put(struct nf_conntrack_helper *helper)
{}
EXPORT_SYMBOL_GPL();

struct nf_conn_help *
nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp)
{}
EXPORT_SYMBOL_GPL();

int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
			      gfp_t flags)
{}
EXPORT_SYMBOL_GPL();

/* appropriate ct lock protecting must be taken by caller */
static int unhelp(struct nf_conn *ct, void *me)
{}

void nf_ct_helper_destroy(struct nf_conn *ct)
{}

static LIST_HEAD(nf_ct_helper_expectfn_list);

void nf_ct_helper_expectfn_register(struct nf_ct_helper_expectfn *n)
{}
EXPORT_SYMBOL_GPL();

void nf_ct_helper_expectfn_unregister(struct nf_ct_helper_expectfn *n)
{}
EXPORT_SYMBOL_GPL();

/* Caller should hold the rcu lock */
struct nf_ct_helper_expectfn *
nf_ct_helper_expectfn_find_by_name(const char *name)
{}
EXPORT_SYMBOL_GPL();

/* Caller should hold the rcu lock */
struct nf_ct_helper_expectfn *
nf_ct_helper_expectfn_find_by_symbol(const void *symbol)
{}
EXPORT_SYMBOL_GPL();

__printf(3, 4)
void nf_ct_helper_log(struct sk_buff *skb, const struct nf_conn *ct,
		      const char *fmt, ...)
{}
EXPORT_SYMBOL_GPL();

int nf_conntrack_helper_register(struct nf_conntrack_helper *me)
{}
EXPORT_SYMBOL_GPL();

static bool expect_iter_me(struct nf_conntrack_expect *exp, void *data)
{}

void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
{}
EXPORT_SYMBOL_GPL();

void nf_ct_helper_init(struct nf_conntrack_helper *helper,
		       u16 l3num, u16 protonum, const char *name,
		       u16 default_port, u16 spec_port, u32 id,
		       const struct nf_conntrack_expect_policy *exp_pol,
		       u32 expect_class_max,
		       int (*help)(struct sk_buff *skb, unsigned int protoff,
				   struct nf_conn *ct,
				   enum ip_conntrack_info ctinfo),
		       int (*from_nlattr)(struct nlattr *attr,
					  struct nf_conn *ct),
		       struct module *module)
{}
EXPORT_SYMBOL_GPL();

int nf_conntrack_helpers_register(struct nf_conntrack_helper *helper,
				  unsigned int n)
{}
EXPORT_SYMBOL_GPL();

void nf_conntrack_helpers_unregister(struct nf_conntrack_helper *helper,
				unsigned int n)
{}
EXPORT_SYMBOL_GPL();

void nf_nat_helper_register(struct nf_conntrack_nat_helper *nat)
{}
EXPORT_SYMBOL_GPL();

void nf_nat_helper_unregister(struct nf_conntrack_nat_helper *nat)
{}
EXPORT_SYMBOL_GPL();

int nf_conntrack_helper_init(void)
{}

void nf_conntrack_helper_fini(void)
{}