linux/net/netfilter/ipset/ip_set_hash_netport.c

// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (C) 2003-2013 Jozsef Kadlecsik <[email protected]> */

/* Kernel module implementing an IP set type: the hash:net,port type */

#include <linux/jhash.h>
#include <linux/module.h>
#include <linux/ip.h>
#include <linux/skbuff.h>
#include <linux/errno.h>
#include <linux/random.h>
#include <net/ip.h>
#include <net/ipv6.h>
#include <net/netlink.h>

#include <linux/netfilter.h>
#include <linux/netfilter/ipset/pfxlen.h>
#include <linux/netfilter/ipset/ip_set.h>
#include <linux/netfilter/ipset/ip_set_getport.h>
#include <linux/netfilter/ipset/ip_set_hash.h>

#define IPSET_TYPE_REV_MIN
/*				1    SCTP and UDPLITE support added */
/*				2    Range as input support for IPv4 added */
/*				3    nomatch flag support added */
/*				4    Counters support added */
/*				5    Comments support added */
/*				6    Forceadd support added */
/*				7    skbinfo support added */
#define IPSET_TYPE_REV_MAX

MODULE_LICENSE();
MODULE_AUTHOR();
IP_SET_MODULE_DESC();
MODULE_ALIAS();

/* Type specific function prefix */
#define HTYPE
#define IP_SET_HASH_WITH_PROTO
#define IP_SET_HASH_WITH_NETS

/* We squeeze the "nomatch" flag into cidr: we don't support cidr == 0
 * However this way we have to store internally cidr - 1,
 * dancing back and forth.
 */
#define IP_SET_HASH_WITH_NETS_PACKED

/* IPv4 variant */

/* Member elements */
struct hash_netport4_elem {};

/* Common functions */

static bool
hash_netport4_data_equal(const struct hash_netport4_elem *ip1,
			 const struct hash_netport4_elem *ip2,
			 u32 *multi)
{}

static int
hash_netport4_do_data_match(const struct hash_netport4_elem *elem)
{}

static void
hash_netport4_data_set_flags(struct hash_netport4_elem *elem, u32 flags)
{}

static void
hash_netport4_data_reset_flags(struct hash_netport4_elem *elem, u8 *flags)
{}

static void
hash_netport4_data_netmask(struct hash_netport4_elem *elem, u8 cidr)
{}

static bool
hash_netport4_data_list(struct sk_buff *skb,
			const struct hash_netport4_elem *data)
{}

static void
hash_netport4_data_next(struct hash_netport4_elem *next,
			const struct hash_netport4_elem *d)
{}

#define MTYPE
#define HOST_MASK
#include "ip_set_hash_gen.h"

static int
hash_netport4_kadt(struct ip_set *set, const struct sk_buff *skb,
		   const struct xt_action_param *par,
		   enum ipset_adt adt, struct ip_set_adt_opt *opt)
{}

static int
hash_netport4_uadt(struct ip_set *set, struct nlattr *tb[],
		   enum ipset_adt adt, u32 *lineno, u32 flags, bool retried)
{}

/* IPv6 variant */

struct hash_netport6_elem {};

/* Common functions */

static bool
hash_netport6_data_equal(const struct hash_netport6_elem *ip1,
			 const struct hash_netport6_elem *ip2,
			 u32 *multi)
{}

static int
hash_netport6_do_data_match(const struct hash_netport6_elem *elem)
{}

static void
hash_netport6_data_set_flags(struct hash_netport6_elem *elem, u32 flags)
{}

static void
hash_netport6_data_reset_flags(struct hash_netport6_elem *elem, u8 *flags)
{}

static void
hash_netport6_data_netmask(struct hash_netport6_elem *elem, u8 cidr)
{}

static bool
hash_netport6_data_list(struct sk_buff *skb,
			const struct hash_netport6_elem *data)
{}

static void
hash_netport6_data_next(struct hash_netport6_elem *next,
			const struct hash_netport6_elem *d)
{}

#undef MTYPE
#undef HOST_MASK

#define MTYPE
#define HOST_MASK
#define IP_SET_EMIT_CREATE
#include "ip_set_hash_gen.h"

static int
hash_netport6_kadt(struct ip_set *set, const struct sk_buff *skb,
		   const struct xt_action_param *par,
		   enum ipset_adt adt, struct ip_set_adt_opt *opt)
{}

static int
hash_netport6_uadt(struct ip_set *set, struct nlattr *tb[],
		   enum ipset_adt adt, u32 *lineno, u32 flags, bool retried)
{}

static struct ip_set_type hash_netport_type __read_mostly =;

static int __init
hash_netport_init(void)
{}

static void __exit
hash_netport_fini(void)
{}

module_init();
module_exit(hash_netport_fini);