|
|
|
@ -639,7 +639,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
genmask);
|
|
|
|
|
if (IS_ERR(table))
|
|
|
|
|
return PTR_ERR(table);
|
|
|
|
|
@@ -2295,7 +2188,7 @@ static int nf_tables_newrule(struct net
|
|
|
|
|
@@ -2296,7 +2189,7 @@ static int nf_tables_newrule(struct net
|
|
|
|
|
{
|
|
|
|
|
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
|
|
|
|
|
u8 genmask = nft_genmask_next(net);
|
|
|
|
@ -648,7 +648,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
struct nft_table *table;
|
|
|
|
|
struct nft_chain *chain;
|
|
|
|
|
struct nft_rule *rule, *old_rule = NULL;
|
|
|
|
|
@@ -2311,11 +2204,7 @@ static int nf_tables_newrule(struct net
|
|
|
|
|
@@ -2312,11 +2205,7 @@ static int nf_tables_newrule(struct net
|
|
|
|
|
|
|
|
|
|
create = nlh->nlmsg_flags & NLM_F_CREATE ? true : false;
|
|
|
|
|
|
|
|
|
@ -661,7 +661,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
genmask);
|
|
|
|
|
if (IS_ERR(table))
|
|
|
|
|
return PTR_ERR(table);
|
|
|
|
|
@@ -2355,7 +2244,7 @@ static int nf_tables_newrule(struct net
|
|
|
|
|
@@ -2356,7 +2245,7 @@ static int nf_tables_newrule(struct net
|
|
|
|
|
return PTR_ERR(old_rule);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -670,7 +670,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
|
|
|
|
|
n = 0;
|
|
|
|
|
size = 0;
|
|
|
|
|
@@ -2484,18 +2373,13 @@ static int nf_tables_delrule(struct net
|
|
|
|
|
@@ -2478,18 +2367,13 @@ static int nf_tables_delrule(struct net
|
|
|
|
|
{
|
|
|
|
|
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
|
|
|
|
|
u8 genmask = nft_genmask_next(net);
|
|
|
|
@ -690,7 +690,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
genmask);
|
|
|
|
|
if (IS_ERR(table))
|
|
|
|
|
return PTR_ERR(table);
|
|
|
|
|
@@ -2507,7 +2391,7 @@ static int nf_tables_delrule(struct net
|
|
|
|
|
@@ -2501,7 +2385,7 @@ static int nf_tables_delrule(struct net
|
|
|
|
|
return PTR_ERR(chain);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -699,7 +699,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
|
|
|
|
|
if (chain) {
|
|
|
|
|
if (nla[NFTA_RULE_HANDLE]) {
|
|
|
|
|
@@ -2692,26 +2576,17 @@ static int nft_ctx_init_from_setattr(str
|
|
|
|
|
@@ -2686,26 +2570,17 @@ static int nft_ctx_init_from_setattr(str
|
|
|
|
|
u8 genmask)
|
|
|
|
|
{
|
|
|
|
|
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
|
|
|
|
@ -729,7 +729,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2943,7 +2818,7 @@ static int nf_tables_dump_sets(struct sk
|
|
|
|
|
@@ -2937,7 +2812,7 @@ static int nf_tables_dump_sets(struct sk
|
|
|
|
|
|
|
|
|
|
list_for_each_entry_rcu(table, &net->nft.tables, list) {
|
|
|
|
|
if (ctx->family != NFPROTO_UNSPEC &&
|
|
|
|
@ -738,7 +738,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (ctx->table && ctx->table != table)
|
|
|
|
|
@@ -2964,7 +2839,7 @@ static int nf_tables_dump_sets(struct sk
|
|
|
|
|
@@ -2958,7 +2833,7 @@ static int nf_tables_dump_sets(struct sk
|
|
|
|
|
|
|
|
|
|
ctx_set = *ctx;
|
|
|
|
|
ctx_set.table = table;
|
|
|
|
@ -747,7 +747,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
|
|
|
|
|
if (nf_tables_fill_set(skb, &ctx_set, set,
|
|
|
|
|
NFT_MSG_NEWSET,
|
|
|
|
|
@@ -3076,8 +2951,8 @@ static int nf_tables_newset(struct net *
|
|
|
|
|
@@ -3070,8 +2945,8 @@ static int nf_tables_newset(struct net *
|
|
|
|
|
{
|
|
|
|
|
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
|
|
|
|
|
u8 genmask = nft_genmask_next(net);
|
|
|
|
@ -757,7 +757,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
struct nft_table *table;
|
|
|
|
|
struct nft_set *set;
|
|
|
|
|
struct nft_ctx ctx;
|
|
|
|
|
@@ -3184,16 +3059,12 @@ static int nf_tables_newset(struct net *
|
|
|
|
|
@@ -3178,16 +3053,12 @@ static int nf_tables_newset(struct net *
|
|
|
|
|
|
|
|
|
|
create = nlh->nlmsg_flags & NLM_F_CREATE ? true : false;
|
|
|
|
|
|
|
|
|
@ -776,7 +776,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
|
|
|
|
|
set = nf_tables_set_lookup(table, nla[NFTA_SET_NAME], genmask);
|
|
|
|
|
if (IS_ERR(set)) {
|
|
|
|
|
@@ -3455,19 +3326,15 @@ static int nft_ctx_init_from_elemattr(st
|
|
|
|
|
@@ -3449,19 +3320,15 @@ static int nft_ctx_init_from_elemattr(st
|
|
|
|
|
u8 genmask)
|
|
|
|
|
{
|
|
|
|
|
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
|
|
|
|
@ -799,7 +799,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -3585,7 +3452,7 @@ static int nf_tables_dump_set(struct sk_
|
|
|
|
|
@@ -3579,7 +3446,7 @@ static int nf_tables_dump_set(struct sk_
|
|
|
|
|
rcu_read_lock();
|
|
|
|
|
list_for_each_entry_rcu(table, &net->nft.tables, list) {
|
|
|
|
|
if (dump_ctx->ctx.family != NFPROTO_UNSPEC &&
|
|
|
|
@ -808,7 +808,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (table != dump_ctx->ctx.table)
|
|
|
|
|
@@ -3615,7 +3482,7 @@ static int nf_tables_dump_set(struct sk_
|
|
|
|
|
@@ -3609,7 +3476,7 @@ static int nf_tables_dump_set(struct sk_
|
|
|
|
|
goto nla_put_failure;
|
|
|
|
|
|
|
|
|
|
nfmsg = nlmsg_data(nlh);
|
|
|
|
@ -817,7 +817,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
nfmsg->version = NFNETLINK_V0;
|
|
|
|
|
nfmsg->res_id = htons(net->nft.base_seq & 0xffff);
|
|
|
|
|
|
|
|
|
|
@@ -4495,7 +4362,6 @@ static int nf_tables_newobj(struct net *
|
|
|
|
|
@@ -4489,7 +4356,6 @@ static int nf_tables_newobj(struct net *
|
|
|
|
|
const struct nft_object_type *type;
|
|
|
|
|
u8 genmask = nft_genmask_next(net);
|
|
|
|
|
int family = nfmsg->nfgen_family;
|
|
|
|
@ -825,7 +825,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
struct nft_table *table;
|
|
|
|
|
struct nft_object *obj;
|
|
|
|
|
struct nft_ctx ctx;
|
|
|
|
|
@@ -4507,11 +4373,7 @@ static int nf_tables_newobj(struct net *
|
|
|
|
|
@@ -4501,11 +4367,7 @@ static int nf_tables_newobj(struct net *
|
|
|
|
|
!nla[NFTA_OBJ_DATA])
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
|
@ -838,7 +838,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
genmask);
|
|
|
|
|
if (IS_ERR(table))
|
|
|
|
|
return PTR_ERR(table);
|
|
|
|
|
@@ -4530,7 +4392,7 @@ static int nf_tables_newobj(struct net *
|
|
|
|
|
@@ -4524,7 +4386,7 @@ static int nf_tables_newobj(struct net *
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -847,7 +847,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
|
|
|
|
|
type = nft_obj_type_get(objtype);
|
|
|
|
|
if (IS_ERR(type))
|
|
|
|
|
@@ -4622,7 +4484,7 @@ static int nf_tables_dump_obj(struct sk_
|
|
|
|
|
@@ -4616,7 +4478,7 @@ static int nf_tables_dump_obj(struct sk_
|
|
|
|
|
cb->seq = net->nft.base_seq;
|
|
|
|
|
|
|
|
|
|
list_for_each_entry_rcu(table, &net->nft.tables, list) {
|
|
|
|
@ -856,7 +856,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
list_for_each_entry_rcu(obj, &table->objects, list) {
|
|
|
|
|
@@ -4645,7 +4507,7 @@ static int nf_tables_dump_obj(struct sk_
|
|
|
|
|
@@ -4639,7 +4501,7 @@ static int nf_tables_dump_obj(struct sk_
|
|
|
|
|
cb->nlh->nlmsg_seq,
|
|
|
|
|
NFT_MSG_NEWOBJ,
|
|
|
|
|
NLM_F_MULTI | NLM_F_APPEND,
|
|
|
|
@ -865,7 +865,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
obj, reset) < 0)
|
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
|
|
@@ -4703,7 +4565,6 @@ static int nf_tables_getobj(struct net *
|
|
|
|
|
@@ -4697,7 +4559,6 @@ static int nf_tables_getobj(struct net *
|
|
|
|
|
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
|
|
|
|
|
u8 genmask = nft_genmask_cur(net);
|
|
|
|
|
int family = nfmsg->nfgen_family;
|
|
|
|
@ -873,7 +873,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
const struct nft_table *table;
|
|
|
|
|
struct nft_object *obj;
|
|
|
|
|
struct sk_buff *skb2;
|
|
|
|
|
@@ -4734,11 +4595,7 @@ static int nf_tables_getobj(struct net *
|
|
|
|
|
@@ -4728,11 +4589,7 @@ static int nf_tables_getobj(struct net *
|
|
|
|
|
!nla[NFTA_OBJ_TYPE])
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
|
@ -886,7 +886,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
genmask);
|
|
|
|
|
if (IS_ERR(table))
|
|
|
|
|
return PTR_ERR(table);
|
|
|
|
|
@@ -4785,7 +4642,6 @@ static int nf_tables_delobj(struct net *
|
|
|
|
|
@@ -4779,7 +4636,6 @@ static int nf_tables_delobj(struct net *
|
|
|
|
|
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
|
|
|
|
|
u8 genmask = nft_genmask_next(net);
|
|
|
|
|
int family = nfmsg->nfgen_family;
|
|
|
|
@ -894,7 +894,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
struct nft_table *table;
|
|
|
|
|
struct nft_object *obj;
|
|
|
|
|
struct nft_ctx ctx;
|
|
|
|
|
@@ -4795,11 +4651,7 @@ static int nf_tables_delobj(struct net *
|
|
|
|
|
@@ -4789,11 +4645,7 @@ static int nf_tables_delobj(struct net *
|
|
|
|
|
!nla[NFTA_OBJ_NAME])
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
|
@ -907,7 +907,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
genmask);
|
|
|
|
|
if (IS_ERR(table))
|
|
|
|
|
return PTR_ERR(table);
|
|
|
|
|
@@ -4811,7 +4663,7 @@ static int nf_tables_delobj(struct net *
|
|
|
|
|
@@ -4805,7 +4657,7 @@ static int nf_tables_delobj(struct net *
|
|
|
|
|
if (obj->use > 0)
|
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
|
@ -916,7 +916,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
|
|
|
|
|
return nft_delobj(&ctx, obj);
|
|
|
|
|
}
|
|
|
|
|
@@ -4996,33 +4848,31 @@ err1:
|
|
|
|
|
@@ -4990,33 +4842,31 @@ err1:
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -956,7 +956,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
return ERR_PTR(-EAGAIN);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
@@ -5070,7 +4920,6 @@ static int nf_tables_newflowtable(struct
|
|
|
|
|
@@ -5064,7 +4914,6 @@ static int nf_tables_newflowtable(struct
|
|
|
|
|
u8 genmask = nft_genmask_next(net);
|
|
|
|
|
int family = nfmsg->nfgen_family;
|
|
|
|
|
struct nft_flowtable *flowtable;
|
|
|
|
@ -964,7 +964,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
struct nft_table *table;
|
|
|
|
|
struct nft_ctx ctx;
|
|
|
|
|
int err, i, k;
|
|
|
|
|
@@ -5080,12 +4929,8 @@ static int nf_tables_newflowtable(struct
|
|
|
|
|
@@ -5074,12 +4923,8 @@ static int nf_tables_newflowtable(struct
|
|
|
|
|
!nla[NFTA_FLOWTABLE_HOOK])
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
|
@ -978,7 +978,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
if (IS_ERR(table))
|
|
|
|
|
return PTR_ERR(table);
|
|
|
|
|
|
|
|
|
|
@@ -5102,7 +4947,7 @@ static int nf_tables_newflowtable(struct
|
|
|
|
|
@@ -5096,7 +4941,7 @@ static int nf_tables_newflowtable(struct
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -987,7 +987,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
|
|
|
|
|
flowtable = kzalloc(sizeof(*flowtable), GFP_KERNEL);
|
|
|
|
|
if (!flowtable)
|
|
|
|
|
@@ -5115,7 +4960,7 @@ static int nf_tables_newflowtable(struct
|
|
|
|
|
@@ -5109,7 +4954,7 @@ static int nf_tables_newflowtable(struct
|
|
|
|
|
goto err1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -996,7 +996,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
if (IS_ERR(type)) {
|
|
|
|
|
err = PTR_ERR(type);
|
|
|
|
|
goto err2;
|
|
|
|
|
@@ -5175,16 +5020,11 @@ static int nf_tables_delflowtable(struct
|
|
|
|
|
@@ -5169,16 +5014,11 @@ static int nf_tables_delflowtable(struct
|
|
|
|
|
u8 genmask = nft_genmask_next(net);
|
|
|
|
|
int family = nfmsg->nfgen_family;
|
|
|
|
|
struct nft_flowtable *flowtable;
|
|
|
|
@ -1014,7 +1014,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
if (IS_ERR(table))
|
|
|
|
|
return PTR_ERR(table);
|
|
|
|
|
|
|
|
|
|
@@ -5195,7 +5035,7 @@ static int nf_tables_delflowtable(struct
|
|
|
|
|
@@ -5189,7 +5029,7 @@ static int nf_tables_delflowtable(struct
|
|
|
|
|
if (flowtable->use > 0)
|
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
|
@ -1023,7 +1023,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
|
|
|
|
|
return nft_delflowtable(&ctx, flowtable);
|
|
|
|
|
}
|
|
|
|
|
@@ -5270,7 +5110,7 @@ static int nf_tables_dump_flowtable(stru
|
|
|
|
|
@@ -5264,7 +5104,7 @@ static int nf_tables_dump_flowtable(stru
|
|
|
|
|
cb->seq = net->nft.base_seq;
|
|
|
|
|
|
|
|
|
|
list_for_each_entry_rcu(table, &net->nft.tables, list) {
|
|
|
|
@ -1032,7 +1032,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
list_for_each_entry_rcu(flowtable, &table->flowtables, list) {
|
|
|
|
|
@@ -5289,7 +5129,7 @@ static int nf_tables_dump_flowtable(stru
|
|
|
|
|
@@ -5283,7 +5123,7 @@ static int nf_tables_dump_flowtable(stru
|
|
|
|
|
cb->nlh->nlmsg_seq,
|
|
|
|
|
NFT_MSG_NEWFLOWTABLE,
|
|
|
|
|
NLM_F_MULTI | NLM_F_APPEND,
|
|
|
|
@ -1041,7 +1041,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
|
|
nl_dump_check_consistent(cb, nlmsg_hdr(skb));
|
|
|
|
|
@@ -5349,7 +5189,6 @@ static int nf_tables_getflowtable(struct
|
|
|
|
|
@@ -5343,7 +5183,6 @@ static int nf_tables_getflowtable(struct
|
|
|
|
|
u8 genmask = nft_genmask_cur(net);
|
|
|
|
|
int family = nfmsg->nfgen_family;
|
|
|
|
|
struct nft_flowtable *flowtable;
|
|
|
|
@ -1049,7 +1049,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
const struct nft_table *table;
|
|
|
|
|
struct sk_buff *skb2;
|
|
|
|
|
int err;
|
|
|
|
|
@@ -5375,12 +5214,8 @@ static int nf_tables_getflowtable(struct
|
|
|
|
|
@@ -5369,12 +5208,8 @@ static int nf_tables_getflowtable(struct
|
|
|
|
|
if (!nla[NFTA_FLOWTABLE_NAME])
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
|
@ -1063,7 +1063,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
if (IS_ERR(table))
|
|
|
|
|
return PTR_ERR(table);
|
|
|
|
|
|
|
|
|
|
@@ -6551,7 +6386,7 @@ int __nft_release_basechain(struct nft_c
|
|
|
|
|
@@ -6545,7 +6380,7 @@ int __nft_release_basechain(struct nft_c
|
|
|
|
|
}
|
|
|
|
|
EXPORT_SYMBOL_GPL(__nft_release_basechain);
|
|
|
|
|
|
|
|
|
@ -1072,7 +1072,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
{
|
|
|
|
|
struct nft_flowtable *flowtable, *nf;
|
|
|
|
|
struct nft_table *table, *nt;
|
|
|
|
|
@@ -6564,7 +6399,7 @@ static void __nft_release_afinfo(struct
|
|
|
|
|
@@ -6558,7 +6393,7 @@ static void __nft_release_afinfo(struct
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
list_for_each_entry_safe(table, nt, &net->nft.tables, list) {
|
|
|
|
@ -1081,7 +1081,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> |
|
|
|
|
|
|
|
|
|
list_for_each_entry(chain, &table->chains, list)
|
|
|
|
|
nf_tables_unregister_hook(net, table, chain);
|
|
|
|
|
@@ -6616,7 +6451,7 @@ static int __net_init nf_tables_init_net
|
|
|
|
|
@@ -6610,7 +6445,7 @@ static int __net_init nf_tables_init_net
|
|
|
|
|
|
|
|
|
|
static void __net_exit nf_tables_exit_net(struct net *net)
|
|
|
|
|
{
|
|
|
|
|