Skip to content

Commit

Permalink
netfilter: nf_tables: rename struct nf_chain_type
Browse files Browse the repository at this point in the history
Use nft_ prefix. By when I added chain types, I forgot to use the
nftables prefix. Rename enum nft_chain_type to enum nft_chain_types too,
otherwise there is an overlap.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Pablo Neira Ayuso committed Mar 30, 2018
1 parent 9124a20 commit 32537e9
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 27 deletions.
16 changes: 8 additions & 8 deletions include/net/netfilter/nf_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -868,15 +868,15 @@ struct nft_chain {
char *name;
};

enum nft_chain_type {
enum nft_chain_types {
NFT_CHAIN_T_DEFAULT = 0,
NFT_CHAIN_T_ROUTE,
NFT_CHAIN_T_NAT,
NFT_CHAIN_T_MAX
};

/**
* struct nf_chain_type - nf_tables chain type info
* struct nft_chain_type - nf_tables chain type info
*
* @name: name of the type
* @type: numeric identifier
Expand All @@ -885,17 +885,17 @@ enum nft_chain_type {
* @hook_mask: mask of valid hooks
* @hooks: array of hook functions
*/
struct nf_chain_type {
struct nft_chain_type {
const char *name;
enum nft_chain_type type;
enum nft_chain_types type;
int family;
struct module *owner;
unsigned int hook_mask;
nf_hookfn *hooks[NF_MAX_HOOKS];
};

int nft_chain_validate_dependency(const struct nft_chain *chain,
enum nft_chain_type type);
enum nft_chain_types type);
int nft_chain_validate_hooks(const struct nft_chain *chain,
unsigned int hook_flags);

Expand All @@ -917,7 +917,7 @@ struct nft_stats {
*/
struct nft_base_chain {
struct nf_hook_ops ops;
const struct nf_chain_type *type;
const struct nft_chain_type *type;
u8 policy;
u8 flags;
struct nft_stats __percpu *stats;
Expand Down Expand Up @@ -970,8 +970,8 @@ struct nft_table {
char *name;
};

int nft_register_chain_type(const struct nf_chain_type *);
void nft_unregister_chain_type(const struct nf_chain_type *);
int nft_register_chain_type(const struct nft_chain_type *);
void nft_unregister_chain_type(const struct nft_chain_type *);

int nft_register_expr(struct nft_expr_type *);
void nft_unregister_expr(struct nft_expr_type *);
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/nf_tables_bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ nft_do_chain_bridge(void *priv,
return nft_do_chain(&pkt, priv);
}

static const struct nf_chain_type filter_bridge = {
static const struct nft_chain_type filter_bridge = {
.name = "filter",
.type = NFT_CHAIN_T_DEFAULT,
.family = NFPROTO_BRIDGE,
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/nf_tables_arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ nft_do_chain_arp(void *priv,
return nft_do_chain(&pkt, priv);
}

static const struct nf_chain_type filter_arp = {
static const struct nft_chain_type filter_arp = {
.name = "filter",
.type = NFT_CHAIN_T_DEFAULT,
.family = NFPROTO_ARP,
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/nf_tables_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static unsigned int nft_do_chain_ipv4(void *priv,
return nft_do_chain(&pkt, priv);
}

static const struct nf_chain_type filter_ipv4 = {
static const struct nft_chain_type filter_ipv4 = {
.name = "filter",
.type = NFT_CHAIN_T_DEFAULT,
.family = NFPROTO_IPV4,
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/nft_chain_nat_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static unsigned int nft_nat_ipv4_local_fn(void *priv,
return nf_nat_ipv4_local_fn(priv, skb, state, nft_nat_do_chain);
}

static const struct nf_chain_type nft_chain_nat_ipv4 = {
static const struct nft_chain_type nft_chain_nat_ipv4 = {
.name = "nat",
.type = NFT_CHAIN_T_NAT,
.family = NFPROTO_IPV4,
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/nft_chain_route_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static unsigned int nf_route_table_hook(void *priv,
return ret;
}

static const struct nf_chain_type nft_chain_route_ipv4 = {
static const struct nft_chain_type nft_chain_route_ipv4 = {
.name = "route",
.type = NFT_CHAIN_T_ROUTE,
.family = NFPROTO_IPV4,
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/netfilter/nf_tables_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static unsigned int nft_do_chain_ipv6(void *priv,
return nft_do_chain(&pkt, priv);
}

static const struct nf_chain_type filter_ipv6 = {
static const struct nft_chain_type filter_ipv6 = {
.name = "filter",
.type = NFT_CHAIN_T_DEFAULT,
.family = NFPROTO_IPV6,
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/netfilter/nft_chain_nat_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static unsigned int nft_nat_ipv6_local_fn(void *priv,
return nf_nat_ipv6_local_fn(priv, skb, state, nft_nat_do_chain);
}

static const struct nf_chain_type nft_chain_nat_ipv6 = {
static const struct nft_chain_type nft_chain_nat_ipv6 = {
.name = "nat",
.type = NFT_CHAIN_T_NAT,
.family = NFPROTO_IPV6,
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/netfilter/nft_chain_route_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static unsigned int nf_route_table_hook(void *priv,
return ret;
}

static const struct nf_chain_type nft_chain_route_ipv6 = {
static const struct nft_chain_type nft_chain_route_ipv6 = {
.name = "route",
.type = NFT_CHAIN_T_ROUTE,
.family = NFPROTO_IPV6,
Expand Down
18 changes: 9 additions & 9 deletions net/netfilter/nf_tables_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ static inline u64 nf_tables_alloc_handle(struct nft_table *table)
return ++table->hgenerator;
}

static const struct nf_chain_type *chain_type[NFPROTO_NUMPROTO][NFT_CHAIN_T_MAX];
static const struct nft_chain_type *chain_type[NFPROTO_NUMPROTO][NFT_CHAIN_T_MAX];

static const struct nf_chain_type *
static const struct nft_chain_type *
__nf_tables_chain_type_lookup(const struct nlattr *nla, u8 family)
{
int i;
Expand All @@ -399,10 +399,10 @@ __nf_tables_chain_type_lookup(const struct nlattr *nla, u8 family)
return NULL;
}

static const struct nf_chain_type *
static const struct nft_chain_type *
nf_tables_chain_type_lookup(const struct nlattr *nla, u8 family, bool autoload)
{
const struct nf_chain_type *type;
const struct nft_chain_type *type;

type = __nf_tables_chain_type_lookup(nla, family);
if (type != NULL)
Expand Down Expand Up @@ -859,7 +859,7 @@ static void nf_tables_table_destroy(struct nft_ctx *ctx)
kfree(ctx->table);
}

int nft_register_chain_type(const struct nf_chain_type *ctype)
int nft_register_chain_type(const struct nft_chain_type *ctype)
{
int err = 0;

Expand All @@ -878,7 +878,7 @@ int nft_register_chain_type(const struct nf_chain_type *ctype)
}
EXPORT_SYMBOL_GPL(nft_register_chain_type);

void nft_unregister_chain_type(const struct nf_chain_type *ctype)
void nft_unregister_chain_type(const struct nft_chain_type *ctype)
{
nfnl_lock(NFNL_SUBSYS_NFTABLES);
chain_type[ctype->family][ctype->type] = NULL;
Expand Down Expand Up @@ -1239,7 +1239,7 @@ static void nf_tables_chain_destroy(struct nft_chain *chain)
struct nft_chain_hook {
u32 num;
s32 priority;
const struct nf_chain_type *type;
const struct nft_chain_type *type;
struct net_device *dev;
};

Expand All @@ -1249,7 +1249,7 @@ static int nft_chain_parse_hook(struct net *net,
bool create)
{
struct nlattr *ha[NFTA_HOOK_MAX + 1];
const struct nf_chain_type *type;
const struct nft_chain_type *type;
struct net_device *dev;
int err;

Expand Down Expand Up @@ -6000,7 +6000,7 @@ static const struct nfnetlink_subsystem nf_tables_subsys = {
};

int nft_chain_validate_dependency(const struct nft_chain *chain,
enum nft_chain_type type)
enum nft_chain_types type)
{
const struct nft_base_chain *basechain;

Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/nf_tables_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static unsigned int nft_do_chain_inet(void *priv, struct sk_buff *skb,
return nft_do_chain(&pkt, priv);
}

static const struct nf_chain_type filter_inet = {
static const struct nft_chain_type filter_inet = {
.name = "filter",
.type = NFT_CHAIN_T_DEFAULT,
.family = NFPROTO_INET,
Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/nf_tables_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ nft_do_chain_netdev(void *priv, struct sk_buff *skb,
return nft_do_chain(&pkt, priv);
}

static const struct nf_chain_type nft_filter_chain_netdev = {
static const struct nft_chain_type nft_filter_chain_netdev = {
.name = "filter",
.type = NFT_CHAIN_T_DEFAULT,
.family = NFPROTO_NETDEV,
Expand Down

0 comments on commit 32537e9

Please sign in to comment.