static void nft_ctx_init(struct nft_ctx *ctx,
struct net *net,
-@@ -434,7 +369,7 @@ static struct nft_table *nft_table_looku
+@@ -435,7 +370,7 @@ static struct nft_table *nft_table_looku
list_for_each_entry(table, &net->nft.tables, list) {
if (!nla_strcmp(nla, table->name) &&
nft_active_genmask(table, genmask))
return table;
}
-@@ -575,7 +510,7 @@ static int nf_tables_dump_tables(struct
+@@ -576,7 +511,7 @@ static int nf_tables_dump_tables(struct
cb->seq = net->nft.base_seq;
list_for_each_entry_rcu(table, &net->nft.tables, list) {
continue;
if (idx < s_idx)
-@@ -589,7 +524,7 @@ static int nf_tables_dump_tables(struct
+@@ -590,7 +525,7 @@ static int nf_tables_dump_tables(struct
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq,
NFT_MSG_NEWTABLE, NLM_F_MULTI,
goto done;
nl_dump_check_consistent(cb, nlmsg_hdr(skb));
-@@ -609,7 +544,6 @@ static int nf_tables_gettable(struct net
+@@ -610,7 +545,6 @@ static int nf_tables_gettable(struct net
{
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
u8 genmask = nft_genmask_cur(net);
const struct nft_table *table;
struct sk_buff *skb2;
int family = nfmsg->nfgen_family;
-@@ -622,11 +556,7 @@ static int nf_tables_gettable(struct net
+@@ -623,11 +557,7 @@ static int nf_tables_gettable(struct net
return netlink_dump_start(nlsk, skb, nlh, &c);
}
genmask);
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -746,19 +676,14 @@ static int nf_tables_newtable(struct net
+@@ -747,19 +677,14 @@ static int nf_tables_newtable(struct net
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
u8 genmask = nft_genmask_next(net);
const struct nlattr *name;
if (IS_ERR(table)) {
if (PTR_ERR(table) != -ENOENT)
return PTR_ERR(table);
-@@ -768,7 +693,7 @@ static int nf_tables_newtable(struct net
+@@ -769,7 +694,7 @@ static int nf_tables_newtable(struct net
if (nlh->nlmsg_flags & NLM_F_REPLACE)
return -EOPNOTSUPP;
return nf_tables_updtable(&ctx);
}
-@@ -778,40 +703,34 @@ static int nf_tables_newtable(struct net
+@@ -779,40 +704,34 @@ static int nf_tables_newtable(struct net
return -EINVAL;
}
return err;
}
-@@ -882,10 +801,10 @@ static int nft_flush(struct nft_ctx *ctx
+@@ -883,10 +802,10 @@ static int nft_flush(struct nft_ctx *ctx
int err = 0;
list_for_each_entry_safe(table, nt, &ctx->net->nft.tables, list) {
if (!nft_is_active_next(ctx->net, table))
continue;
-@@ -911,7 +830,6 @@ static int nf_tables_deltable(struct net
+@@ -912,7 +831,6 @@ static int nf_tables_deltable(struct net
{
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
u8 genmask = nft_genmask_next(net);
struct nft_table *table;
int family = nfmsg->nfgen_family;
struct nft_ctx ctx;
-@@ -920,11 +838,7 @@ static int nf_tables_deltable(struct net
+@@ -921,11 +839,7 @@ static int nf_tables_deltable(struct net
if (family == AF_UNSPEC || nla[NFTA_TABLE_NAME] == NULL)
return nft_flush(&ctx, family);
genmask);
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -933,7 +847,7 @@ static int nf_tables_deltable(struct net
+@@ -934,7 +848,7 @@ static int nf_tables_deltable(struct net
table->use > 0)
return -EBUSY;
ctx.table = table;
return nft_flush_table(&ctx);
-@@ -945,7 +859,6 @@ static void nf_tables_table_destroy(stru
+@@ -946,7 +860,6 @@ static void nf_tables_table_destroy(stru
kfree(ctx->table->name);
kfree(ctx->table);
}
int nft_register_chain_type(const struct nf_chain_type *ctype)
-@@ -1174,7 +1087,7 @@ static int nf_tables_dump_chains(struct
+@@ -1175,7 +1088,7 @@ static int nf_tables_dump_chains(struct
cb->seq = net->nft.base_seq;
list_for_each_entry_rcu(table, &net->nft.tables, list) {
continue;
list_for_each_entry_rcu(chain, &table->chains, list) {
-@@ -1190,7 +1103,7 @@ static int nf_tables_dump_chains(struct
+@@ -1191,7 +1104,7 @@ static int nf_tables_dump_chains(struct
cb->nlh->nlmsg_seq,
NFT_MSG_NEWCHAIN,
NLM_F_MULTI,
chain) < 0)
goto done;
-@@ -1212,7 +1125,6 @@ static int nf_tables_getchain(struct net
+@@ -1213,7 +1126,6 @@ static int nf_tables_getchain(struct net
{
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
u8 genmask = nft_genmask_cur(net);
const struct nft_table *table;
const struct nft_chain *chain;
struct sk_buff *skb2;
-@@ -1226,11 +1138,7 @@ static int nf_tables_getchain(struct net
+@@ -1227,11 +1139,7 @@ static int nf_tables_getchain(struct net
return netlink_dump_start(nlsk, skb, nlh, &c);
}
genmask);
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -1612,7 +1520,6 @@ static int nf_tables_newchain(struct net
+@@ -1613,7 +1521,6 @@ static int nf_tables_newchain(struct net
const struct nlattr * uninitialized_var(name);
u8 genmask = nft_genmask_next(net);
int family = nfmsg->nfgen_family;
struct nft_table *table;
struct nft_chain *chain;
u8 policy = NF_ACCEPT;
-@@ -1622,11 +1529,7 @@ static int nf_tables_newchain(struct net
+@@ -1623,11 +1530,7 @@ static int nf_tables_newchain(struct net
create = nlh->nlmsg_flags & NLM_F_CREATE ? true : false;
genmask);
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -1667,7 +1570,7 @@ static int nf_tables_newchain(struct net
+@@ -1668,7 +1571,7 @@ static int nf_tables_newchain(struct net
}
}
if (chain != NULL) {
if (nlh->nlmsg_flags & NLM_F_EXCL)
-@@ -1688,7 +1591,6 @@ static int nf_tables_delchain(struct net
+@@ -1689,7 +1592,6 @@ static int nf_tables_delchain(struct net
{
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
u8 genmask = nft_genmask_next(net);
struct nft_table *table;
struct nft_chain *chain;
struct nft_rule *rule;
-@@ -1697,11 +1599,7 @@ static int nf_tables_delchain(struct net
+@@ -1698,11 +1600,7 @@ static int nf_tables_delchain(struct net
u32 use;
int err;
genmask);
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -1714,7 +1612,7 @@ static int nf_tables_delchain(struct net
+@@ -1715,7 +1613,7 @@ static int nf_tables_delchain(struct net
chain->use > 0)
return -EBUSY;
use = chain->use;
list_for_each_entry(rule, &chain->rules, list) {
-@@ -2149,7 +2047,7 @@ static int nf_tables_dump_rules(struct s
+@@ -2150,7 +2048,7 @@ static int nf_tables_dump_rules(struct s
cb->seq = net->nft.base_seq;
list_for_each_entry_rcu(table, &net->nft.tables, list) {
continue;
if (ctx && ctx->table && strcmp(ctx->table, table->name) != 0)
-@@ -2172,7 +2070,7 @@ static int nf_tables_dump_rules(struct s
+@@ -2173,7 +2071,7 @@ static int nf_tables_dump_rules(struct s
cb->nlh->nlmsg_seq,
NFT_MSG_NEWRULE,
NLM_F_MULTI | NLM_F_APPEND,
table, chain, rule) < 0)
goto done;
-@@ -2208,7 +2106,6 @@ static int nf_tables_getrule(struct net
+@@ -2209,7 +2107,6 @@ static int nf_tables_getrule(struct net
{
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
u8 genmask = nft_genmask_cur(net);
const struct nft_table *table;
const struct nft_chain *chain;
const struct nft_rule *rule;
-@@ -2252,11 +2149,7 @@ static int nf_tables_getrule(struct net
+@@ -2253,11 +2150,7 @@ static int nf_tables_getrule(struct net
return netlink_dump_start(nlsk, skb, nlh, &c);
}
genmask);
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -2322,7 +2215,7 @@ static int nf_tables_newrule(struct net
+@@ -2323,7 +2216,7 @@ static int nf_tables_newrule(struct net
{
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
u8 genmask = nft_genmask_next(net);
struct nft_table *table;
struct nft_chain *chain;
struct nft_rule *rule, *old_rule = NULL;
-@@ -2338,11 +2231,7 @@ static int nf_tables_newrule(struct net
+@@ -2339,11 +2232,7 @@ static int nf_tables_newrule(struct net
create = nlh->nlmsg_flags & NLM_F_CREATE ? true : false;
genmask);
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -2382,7 +2271,7 @@ static int nf_tables_newrule(struct net
+@@ -2383,7 +2272,7 @@ static int nf_tables_newrule(struct net
return PTR_ERR(old_rule);
}
n = 0;
size = 0;
-@@ -2504,18 +2393,13 @@ static int nf_tables_delrule(struct net
+@@ -2505,18 +2394,13 @@ static int nf_tables_delrule(struct net
{
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
u8 genmask = nft_genmask_next(net);
genmask);
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -2527,7 +2411,7 @@ static int nf_tables_delrule(struct net
+@@ -2528,7 +2412,7 @@ static int nf_tables_delrule(struct net
return PTR_ERR(chain);
}
if (chain) {
if (nla[NFTA_RULE_HANDLE]) {
-@@ -2712,26 +2596,17 @@ static int nft_ctx_init_from_setattr(str
+@@ -2713,26 +2597,17 @@ static int nft_ctx_init_from_setattr(str
u8 genmask)
{
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
return 0;
}
-@@ -2964,7 +2839,7 @@ static int nf_tables_dump_sets(struct sk
+@@ -2965,7 +2840,7 @@ static int nf_tables_dump_sets(struct sk
list_for_each_entry_rcu(table, &net->nft.tables, list) {
if (ctx->family != NFPROTO_UNSPEC &&
continue;
if (ctx->table && ctx->table != table)
-@@ -2985,7 +2860,7 @@ static int nf_tables_dump_sets(struct sk
+@@ -2986,7 +2861,7 @@ static int nf_tables_dump_sets(struct sk
ctx_set = *ctx;
ctx_set.table = table;
if (nf_tables_fill_set(skb, &ctx_set, set,
NFT_MSG_NEWSET,
-@@ -3097,8 +2972,8 @@ static int nf_tables_newset(struct net *
+@@ -3098,8 +2973,8 @@ static int nf_tables_newset(struct net *
{
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
u8 genmask = nft_genmask_next(net);
struct nft_table *table;
struct nft_set *set;
struct nft_ctx ctx;
-@@ -3208,16 +3083,12 @@ static int nf_tables_newset(struct net *
+@@ -3209,16 +3084,12 @@ static int nf_tables_newset(struct net *
create = nlh->nlmsg_flags & NLM_F_CREATE ? true : false;
set = nf_tables_set_lookup(table, nla[NFTA_SET_NAME], genmask);
if (IS_ERR(set)) {
-@@ -3479,19 +3350,15 @@ static int nft_ctx_init_from_elemattr(st
+@@ -3480,19 +3351,15 @@ static int nft_ctx_init_from_elemattr(st
u8 genmask)
{
const struct nfgenmsg *nfmsg = nlmsg_data(nlh);
return 0;
}
-@@ -3609,7 +3476,7 @@ static int nf_tables_dump_set(struct sk_
+@@ -3610,7 +3477,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 &&
continue;
if (table != dump_ctx->ctx.table)
-@@ -3639,7 +3506,7 @@ static int nf_tables_dump_set(struct sk_
+@@ -3640,7 +3507,7 @@ static int nf_tables_dump_set(struct sk_
goto nla_put_failure;
nfmsg = nlmsg_data(nlh);
nfmsg->version = NFNETLINK_V0;
nfmsg->res_id = htons(net->nft.base_seq & 0xffff);
-@@ -4527,7 +4394,6 @@ static int nf_tables_newobj(struct net *
+@@ -4528,7 +4395,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;
struct nft_table *table;
struct nft_object *obj;
struct nft_ctx ctx;
-@@ -4539,11 +4405,7 @@ static int nf_tables_newobj(struct net *
+@@ -4540,11 +4406,7 @@ static int nf_tables_newobj(struct net *
!nla[NFTA_OBJ_DATA])
return -EINVAL;
genmask);
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -4562,7 +4424,7 @@ static int nf_tables_newobj(struct net *
+@@ -4563,7 +4425,7 @@ static int nf_tables_newobj(struct net *
return 0;
}
type = nft_obj_type_get(objtype);
if (IS_ERR(type))
-@@ -4654,7 +4516,7 @@ static int nf_tables_dump_obj(struct sk_
+@@ -4655,7 +4517,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) {
continue;
list_for_each_entry_rcu(obj, &table->objects, list) {
-@@ -4677,7 +4539,7 @@ static int nf_tables_dump_obj(struct sk_
+@@ -4678,7 +4540,7 @@ static int nf_tables_dump_obj(struct sk_
cb->nlh->nlmsg_seq,
NFT_MSG_NEWOBJ,
NLM_F_MULTI | NLM_F_APPEND,
obj, reset) < 0)
goto done;
-@@ -4735,7 +4597,6 @@ static int nf_tables_getobj(struct net *
+@@ -4736,7 +4598,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;
const struct nft_table *table;
struct nft_object *obj;
struct sk_buff *skb2;
-@@ -4766,11 +4627,7 @@ static int nf_tables_getobj(struct net *
+@@ -4767,11 +4628,7 @@ static int nf_tables_getobj(struct net *
!nla[NFTA_OBJ_TYPE])
return -EINVAL;
genmask);
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -4817,7 +4674,6 @@ static int nf_tables_delobj(struct net *
+@@ -4818,7 +4675,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;
struct nft_table *table;
struct nft_object *obj;
struct nft_ctx ctx;
-@@ -4827,11 +4683,7 @@ static int nf_tables_delobj(struct net *
+@@ -4828,11 +4684,7 @@ static int nf_tables_delobj(struct net *
!nla[NFTA_OBJ_NAME])
return -EINVAL;
genmask);
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -4843,7 +4695,7 @@ static int nf_tables_delobj(struct net *
+@@ -4844,7 +4696,7 @@ static int nf_tables_delobj(struct net *
if (obj->use > 0)
return -EBUSY;
return nft_delobj(&ctx, obj);
}
-@@ -5028,33 +4880,31 @@ err1:
+@@ -5029,33 +4881,31 @@ err1:
return err;
}
return ERR_PTR(-EAGAIN);
}
#endif
-@@ -5102,7 +4952,6 @@ static int nf_tables_newflowtable(struct
+@@ -5103,7 +4953,6 @@ static int nf_tables_newflowtable(struct
u8 genmask = nft_genmask_next(net);
int family = nfmsg->nfgen_family;
struct nft_flowtable *flowtable;
struct nft_table *table;
struct nft_ctx ctx;
int err, i, k;
-@@ -5112,12 +4961,8 @@ static int nf_tables_newflowtable(struct
+@@ -5113,12 +4962,8 @@ static int nf_tables_newflowtable(struct
!nla[NFTA_FLOWTABLE_HOOK])
return -EINVAL;
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -5134,7 +4979,7 @@ static int nf_tables_newflowtable(struct
+@@ -5135,7 +4980,7 @@ static int nf_tables_newflowtable(struct
return 0;
}
flowtable = kzalloc(sizeof(*flowtable), GFP_KERNEL);
if (!flowtable)
-@@ -5147,7 +4992,7 @@ static int nf_tables_newflowtable(struct
+@@ -5148,7 +4993,7 @@ static int nf_tables_newflowtable(struct
goto err1;
}
if (IS_ERR(type)) {
err = PTR_ERR(type);
goto err2;
-@@ -5207,16 +5052,11 @@ static int nf_tables_delflowtable(struct
+@@ -5208,16 +5053,11 @@ static int nf_tables_delflowtable(struct
u8 genmask = nft_genmask_next(net);
int family = nfmsg->nfgen_family;
struct nft_flowtable *flowtable;
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -5227,7 +5067,7 @@ static int nf_tables_delflowtable(struct
+@@ -5228,7 +5068,7 @@ static int nf_tables_delflowtable(struct
if (flowtable->use > 0)
return -EBUSY;
return nft_delflowtable(&ctx, flowtable);
}
-@@ -5302,7 +5142,7 @@ static int nf_tables_dump_flowtable(stru
+@@ -5303,7 +5143,7 @@ static int nf_tables_dump_flowtable(stru
cb->seq = net->nft.base_seq;
list_for_each_entry_rcu(table, &net->nft.tables, list) {
continue;
list_for_each_entry_rcu(flowtable, &table->flowtables, list) {
-@@ -5321,7 +5161,7 @@ static int nf_tables_dump_flowtable(stru
+@@ -5322,7 +5162,7 @@ static int nf_tables_dump_flowtable(stru
cb->nlh->nlmsg_seq,
NFT_MSG_NEWFLOWTABLE,
NLM_F_MULTI | NLM_F_APPEND,
goto done;
nl_dump_check_consistent(cb, nlmsg_hdr(skb));
-@@ -5381,7 +5221,6 @@ static int nf_tables_getflowtable(struct
+@@ -5382,7 +5222,6 @@ static int nf_tables_getflowtable(struct
u8 genmask = nft_genmask_cur(net);
int family = nfmsg->nfgen_family;
struct nft_flowtable *flowtable;
const struct nft_table *table;
struct sk_buff *skb2;
int err;
-@@ -5407,12 +5246,8 @@ static int nf_tables_getflowtable(struct
+@@ -5408,12 +5247,8 @@ static int nf_tables_getflowtable(struct
if (!nla[NFTA_FLOWTABLE_NAME])
return -EINVAL;
if (IS_ERR(table))
return PTR_ERR(table);
-@@ -6583,7 +6418,7 @@ int __nft_release_basechain(struct nft_c
+@@ -6584,7 +6419,7 @@ int __nft_release_basechain(struct nft_c
}
EXPORT_SYMBOL_GPL(__nft_release_basechain);
{
struct nft_flowtable *flowtable, *nf;
struct nft_table *table, *nt;
-@@ -6596,7 +6431,7 @@ static void __nft_release_afinfo(struct
+@@ -6597,7 +6432,7 @@ static void __nft_release_afinfo(struct
};
list_for_each_entry_safe(table, nt, &net->nft.tables, list) {
list_for_each_entry(chain, &table->chains, list)
nf_tables_unregister_hook(net, table, chain);
-@@ -6648,7 +6483,7 @@ static int __net_init nf_tables_init_net
+@@ -6649,7 +6484,7 @@ static int __net_init nf_tables_init_net
static void __net_exit nf_tables_exit_net(struct net *net)
{