Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa2c1de0 authored by Patrick McHardy's avatar Patrick McHardy Committed by Pablo Neira Ayuso
Browse files

netfilter: nf_tables: minor nf_chain_type cleanups



Minor nf_chain_type cleanups:

- reorder struct to plug a hoe
- rename struct module member to "owner" for consistency
- rename nf_hookfn array to "hooks" for consistency
- reorder initializers for better readability

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 2a37d755
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -498,13 +498,23 @@ struct nft_af_info {
int nft_register_afinfo(struct net *, struct nft_af_info *);
void nft_unregister_afinfo(struct nft_af_info *);

/**
 * 	struct nf_chain_type - nf_tables chain type info
 *
 * 	@name: name of the type
 * 	@type: numeric identifier
 * 	@family: address family
 * 	@owner: module owner
 * 	@hook_mask: mask of valid hooks
 * 	@hooks: hookfn overrides
 */
struct nf_chain_type {
	unsigned int		hook_mask;
	const char			*name;
	enum nft_chain_type		type;
	nf_hookfn		*fn[NF_MAX_HOOKS];
	struct module		*me;
	int				family;
	struct module			*owner;
	unsigned int			hook_mask;
	nf_hookfn			*hooks[NF_MAX_HOOKS];
};

int nft_register_chain_type(const struct nf_chain_type *);
+2 −2
Original line number Diff line number Diff line
@@ -69,10 +69,10 @@ static struct pernet_operations nf_tables_bridge_net_ops = {
};

static const struct nf_chain_type filter_bridge = {
	.family		= NFPROTO_BRIDGE,
	.name		= "filter",
	.type		= NFT_CHAIN_T_DEFAULT,
	.me		= THIS_MODULE,
	.family		= NFPROTO_BRIDGE,
	.owner		= THIS_MODULE,
	.hook_mask	= (1 << NF_BR_LOCAL_IN) |
			  (1 << NF_BR_FORWARD) |
			  (1 << NF_BR_LOCAL_OUT),
+2 −2
Original line number Diff line number Diff line
@@ -69,10 +69,10 @@ static struct pernet_operations nf_tables_arp_net_ops = {
};

static const struct nf_chain_type filter_arp = {
	.family		= NFPROTO_ARP,
	.name		= "filter",
	.type		= NFT_CHAIN_T_DEFAULT,
	.me		= THIS_MODULE,
	.family		= NFPROTO_ARP,
	.owner		= THIS_MODULE,
	.hook_mask	= (1 << NF_ARP_IN) |
			  (1 << NF_ARP_OUT) |
			  (1 << NF_ARP_FORWARD),
+2 −2
Original line number Diff line number Diff line
@@ -92,10 +92,10 @@ static struct pernet_operations nf_tables_ipv4_net_ops = {
};

static const struct nf_chain_type filter_ipv4 = {
	.family		= NFPROTO_IPV4,
	.name		= "filter",
	.type		= NFT_CHAIN_T_DEFAULT,
	.me		= THIS_MODULE,
	.family		= NFPROTO_IPV4,
	.owner		= THIS_MODULE,
	.hook_mask	= (1 << NF_INET_LOCAL_IN) |
			  (1 << NF_INET_LOCAL_OUT) |
			  (1 << NF_INET_FORWARD) |
+3 −3
Original line number Diff line number Diff line
@@ -165,20 +165,20 @@ static unsigned int nf_nat_output(const struct nf_hook_ops *ops,
}

static const struct nf_chain_type nft_chain_nat_ipv4 = {
	.family		= NFPROTO_IPV4,
	.name		= "nat",
	.type		= NFT_CHAIN_T_NAT,
	.family		= NFPROTO_IPV4,
	.owner		= THIS_MODULE,
	.hook_mask	= (1 << NF_INET_PRE_ROUTING) |
			  (1 << NF_INET_POST_ROUTING) |
			  (1 << NF_INET_LOCAL_OUT) |
			  (1 << NF_INET_LOCAL_IN),
	.fn		= {
	.hooks		= {
		[NF_INET_PRE_ROUTING]	= nf_nat_prerouting,
		[NF_INET_POST_ROUTING]	= nf_nat_postrouting,
		[NF_INET_LOCAL_OUT]	= nf_nat_output,
		[NF_INET_LOCAL_IN]	= nf_nat_fn,
	},
	.me		= THIS_MODULE,
};

static int __init nft_chain_nat_init(void)
Loading