netfilter: restore NF_INET_NUMHOOKS
This definition is used by the iptables legacy UAPI, restore it.
Fixes: d3519cb89f ("netfilter: nf_tables: add inet ingress support")
Reported-by: Jason A. Donenfeld <Jason@zx2c4.com>
Tested-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
50172733d0
commit
d25e2e9388
@@ -14,6 +14,8 @@
|
|||||||
#include <net/netlink.h>
|
#include <net/netlink.h>
|
||||||
#include <net/flow_offload.h>
|
#include <net/flow_offload.h>
|
||||||
|
|
||||||
|
#define NFT_MAX_HOOKS (NF_INET_INGRESS + 1)
|
||||||
|
|
||||||
struct module;
|
struct module;
|
||||||
|
|
||||||
#define NFT_JUMP_STACK_SIZE 16
|
#define NFT_JUMP_STACK_SIZE 16
|
||||||
@@ -979,7 +981,7 @@ struct nft_chain_type {
|
|||||||
int family;
|
int family;
|
||||||
struct module *owner;
|
struct module *owner;
|
||||||
unsigned int hook_mask;
|
unsigned int hook_mask;
|
||||||
nf_hookfn *hooks[NF_MAX_HOOKS];
|
nf_hookfn *hooks[NFT_MAX_HOOKS];
|
||||||
int (*ops_register)(struct net *net, const struct nf_hook_ops *ops);
|
int (*ops_register)(struct net *net, const struct nf_hook_ops *ops);
|
||||||
void (*ops_unregister)(struct net *net, const struct nf_hook_ops *ops);
|
void (*ops_unregister)(struct net *net, const struct nf_hook_ops *ops);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ enum nf_inet_hooks {
|
|||||||
NF_INET_FORWARD,
|
NF_INET_FORWARD,
|
||||||
NF_INET_LOCAL_OUT,
|
NF_INET_LOCAL_OUT,
|
||||||
NF_INET_POST_ROUTING,
|
NF_INET_POST_ROUTING,
|
||||||
NF_INET_INGRESS,
|
NF_INET_NUMHOOKS,
|
||||||
NF_INET_NUMHOOKS
|
NF_INET_INGRESS = NF_INET_NUMHOOKS,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum nf_dev_hooks {
|
enum nf_dev_hooks {
|
||||||
|
|||||||
@@ -1864,7 +1864,7 @@ static int nft_chain_parse_hook(struct net *net,
|
|||||||
if (IS_ERR(type))
|
if (IS_ERR(type))
|
||||||
return PTR_ERR(type);
|
return PTR_ERR(type);
|
||||||
}
|
}
|
||||||
if (hook->num > NF_MAX_HOOKS || !(type->hook_mask & (1 << hook->num)))
|
if (hook->num >= NFT_MAX_HOOKS || !(type->hook_mask & (1 << hook->num)))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
if (type->type == NFT_CHAIN_T_NAT &&
|
if (type->type == NFT_CHAIN_T_NAT &&
|
||||||
|
|||||||
Reference in New Issue
Block a user