kernel: bump 4.14 to 4.14.75
[openwrt/openwrt.git] / target / linux / generic / backport-4.14 / 335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch
index 59bffa2ada09249f8b013c4672ee08df4dea3f9e..59ec44a482362d1fe05c82880610fa29a0ef6723 100644 (file)
@@ -467,7 +467,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                if (err < 0)
                        return err;
  
-@@ -1509,7 +1504,7 @@ static int nf_tables_updchain(struct nft
+@@ -1508,7 +1503,7 @@ static int nf_tables_updchain(struct nft
                if (!nft_is_base_chain(chain))
                        return -EBUSY;
  
@@ -476,7 +476,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                                           create);
                if (err < 0)
                        return err;
-@@ -1602,7 +1597,8 @@ static int nf_tables_newchain(struct net
+@@ -1618,7 +1613,8 @@ static int nf_tables_newchain(struct net
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -486,7 +486,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -1642,7 +1638,7 @@ static int nf_tables_newchain(struct net
+@@ -1658,7 +1654,7 @@ static int nf_tables_newchain(struct net
                }
        }
  
@@ -495,7 +495,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  
        if (chain != NULL) {
                if (nlh->nlmsg_flags & NLM_F_EXCL)
-@@ -1676,7 +1672,8 @@ static int nf_tables_delchain(struct net
+@@ -1692,7 +1688,8 @@ static int nf_tables_delchain(struct net
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -505,7 +505,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -1688,7 +1685,7 @@ static int nf_tables_delchain(struct net
+@@ -1704,7 +1701,7 @@ static int nf_tables_delchain(struct net
            chain->use > 0)
                return -EBUSY;
  
@@ -514,7 +514,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  
        use = chain->use;
        list_for_each_entry(rule, &chain->rules, list) {
-@@ -1853,7 +1850,7 @@ static int nf_tables_expr_parse(const st
+@@ -1869,7 +1866,7 @@ static int nf_tables_expr_parse(const st
        if (err < 0)
                return err;
  
@@ -523,7 +523,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(type))
                return PTR_ERR(type);
  
-@@ -2077,7 +2074,7 @@ static void nf_tables_rule_notify(const
+@@ -2093,7 +2090,7 @@ static void nf_tables_rule_notify(const
                goto err;
  
        err = nf_tables_fill_rule_info(skb, ctx->net, ctx->portid, ctx->seq,
@@ -532,7 +532,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                                       ctx->chain, rule);
        if (err < 0) {
                kfree_skb(skb);
-@@ -2101,7 +2098,6 @@ static int nf_tables_dump_rules(struct s
+@@ -2117,7 +2114,6 @@ static int nf_tables_dump_rules(struct s
  {
        const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh);
        const struct nft_rule_dump_ctx *ctx = cb->data;
@@ -540,7 +540,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        const struct nft_table *table;
        const struct nft_chain *chain;
        const struct nft_rule *rule;
-@@ -2112,39 +2108,37 @@ static int nf_tables_dump_rules(struct s
+@@ -2128,39 +2124,37 @@ static int nf_tables_dump_rules(struct s
        rcu_read_lock();
        cb->seq = net->nft.base_seq;
  
@@ -605,7 +605,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                        }
                }
        }
-@@ -2222,7 +2216,8 @@ static int nf_tables_getrule(struct net
+@@ -2238,7 +2232,8 @@ static int nf_tables_getrule(struct net
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -615,7 +615,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -2306,7 +2301,8 @@ static int nf_tables_newrule(struct net
+@@ -2322,7 +2317,8 @@ static int nf_tables_newrule(struct net
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -625,7 +625,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -2345,7 +2341,7 @@ static int nf_tables_newrule(struct net
+@@ -2361,7 +2357,7 @@ static int nf_tables_newrule(struct net
                        return PTR_ERR(old_rule);
        }
  
@@ -634,7 +634,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  
        n = 0;
        size = 0;
-@@ -2485,7 +2481,8 @@ static int nf_tables_delrule(struct net
+@@ -2501,7 +2497,8 @@ static int nf_tables_delrule(struct net
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -644,7 +644,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -2496,7 +2493,7 @@ static int nf_tables_delrule(struct net
+@@ -2512,7 +2509,7 @@ static int nf_tables_delrule(struct net
                        return PTR_ERR(chain);
        }
  
@@ -653,7 +653,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  
        if (chain) {
                if (nla[NFTA_RULE_HANDLE]) {
-@@ -2694,13 +2691,13 @@ static int nft_ctx_init_from_setattr(str
+@@ -2710,13 +2707,13 @@ static int nft_ctx_init_from_setattr(str
                if (afi == NULL)
                        return -EAFNOSUPPORT;
  
@@ -670,7 +670,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        return 0;
  }
  
-@@ -2827,7 +2824,7 @@ static int nf_tables_fill_set(struct sk_
+@@ -2844,7 +2841,7 @@ static int nf_tables_fill_set(struct sk_
                goto nla_put_failure;
  
        nfmsg = nlmsg_data(nlh);
@@ -679,7 +679,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        nfmsg->version          = NFNETLINK_V0;
        nfmsg->res_id           = htons(ctx->net->nft.base_seq & 0xffff);
  
-@@ -2919,10 +2916,8 @@ static int nf_tables_dump_sets(struct sk
+@@ -2936,10 +2933,8 @@ static int nf_tables_dump_sets(struct sk
  {
        const struct nft_set *set;
        unsigned int idx, s_idx = cb->args[0];
@@ -690,7 +690,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        struct nft_ctx *ctx = cb->data, ctx_set;
  
        if (cb->args[1])
-@@ -2931,51 +2926,44 @@ static int nf_tables_dump_sets(struct sk
+@@ -2948,51 +2943,44 @@ static int nf_tables_dump_sets(struct sk
        rcu_read_lock();
        cb->seq = net->nft.base_seq;
  
@@ -771,7 +771,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        }
        cb->args[1] = 1;
  done:
-@@ -3185,11 +3173,12 @@ static int nf_tables_newset(struct net *
+@@ -3202,11 +3190,12 @@ static int nf_tables_newset(struct net *
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -786,7 +786,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)) {
-@@ -3458,12 +3447,12 @@ static int nft_ctx_init_from_elemattr(st
+@@ -3475,12 +3464,12 @@ static int nft_ctx_init_from_elemattr(st
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -802,7 +802,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        return 0;
  }
  
-@@ -3568,7 +3557,6 @@ static int nf_tables_dump_set(struct sk_
+@@ -3585,7 +3574,6 @@ static int nf_tables_dump_set(struct sk_
  {
        struct nft_set_dump_ctx *dump_ctx = cb->data;
        struct net *net = sock_net(skb->sk);
@@ -810,7 +810,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        struct nft_table *table;
        struct nft_set *set;
        struct nft_set_dump_args args;
-@@ -3580,21 +3568,19 @@ static int nf_tables_dump_set(struct sk_
+@@ -3597,21 +3585,19 @@ static int nf_tables_dump_set(struct sk_
        int event;
  
        rcu_read_lock();
@@ -841,7 +841,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                }
                break;
        }
-@@ -3614,7 +3600,7 @@ static int nf_tables_dump_set(struct sk_
+@@ -3631,7 +3617,7 @@ static int nf_tables_dump_set(struct sk_
                goto nla_put_failure;
  
        nfmsg = nlmsg_data(nlh);
@@ -850,7 +850,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        nfmsg->version      = NFNETLINK_V0;
        nfmsg->res_id       = htons(net->nft.base_seq & 0xffff);
  
-@@ -3716,7 +3702,7 @@ static int nf_tables_fill_setelem_info(s
+@@ -3733,7 +3719,7 @@ static int nf_tables_fill_setelem_info(s
                goto nla_put_failure;
  
        nfmsg = nlmsg_data(nlh);
@@ -859,7 +859,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        nfmsg->version          = NFNETLINK_V0;
        nfmsg->res_id           = htons(ctx->net->nft.base_seq & 0xffff);
  
-@@ -3960,7 +3946,7 @@ static int nft_add_set_elem(struct nft_c
+@@ -3977,7 +3963,7 @@ static int nft_add_set_elem(struct nft_c
                list_for_each_entry(binding, &set->bindings, list) {
                        struct nft_ctx bind_ctx = {
                                .net    = ctx->net,
@@ -868,7 +868,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                                .table  = ctx->table,
                                .chain  = (struct nft_chain *)binding->chain,
                        };
-@@ -4509,7 +4495,8 @@ static int nf_tables_newobj(struct net *
+@@ -4527,7 +4513,8 @@ static int nf_tables_newobj(struct net *
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -878,7 +878,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -4527,7 +4514,7 @@ static int nf_tables_newobj(struct net *
+@@ -4545,7 +4532,7 @@ static int nf_tables_newobj(struct net *
                return 0;
        }
  
@@ -887,7 +887,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  
        type = nft_obj_type_get(objtype);
        if (IS_ERR(type))
-@@ -4604,7 +4591,6 @@ struct nft_obj_filter {
+@@ -4622,7 +4609,6 @@ struct nft_obj_filter {
  static int nf_tables_dump_obj(struct sk_buff *skb, struct netlink_callback *cb)
  {
        const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh);
@@ -895,7 +895,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        const struct nft_table *table;
        unsigned int idx = 0, s_idx = cb->args[0];
        struct nft_obj_filter *filter = cb->data;
-@@ -4619,38 +4605,37 @@ static int nf_tables_dump_obj(struct sk_
+@@ -4637,38 +4623,37 @@ static int nf_tables_dump_obj(struct sk_
        rcu_read_lock();
        cb->seq = net->nft.base_seq;
  
@@ -960,7 +960,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                }
        }
  done:
-@@ -4737,7 +4722,8 @@ static int nf_tables_getobj(struct net *
+@@ -4755,7 +4740,8 @@ static int nf_tables_getobj(struct net *
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -970,7 +970,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -4797,7 +4783,8 @@ static int nf_tables_delobj(struct net *
+@@ -4815,7 +4801,8 @@ static int nf_tables_delobj(struct net *
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -980,7 +980,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -4808,7 +4795,7 @@ static int nf_tables_delobj(struct net *
+@@ -4826,7 +4813,7 @@ static int nf_tables_delobj(struct net *
        if (obj->use > 0)
                return -EBUSY;
  
@@ -989,7 +989,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  
        return nft_delobj(&ctx, obj);
  }
-@@ -4846,7 +4833,7 @@ static void nf_tables_obj_notify(const s
+@@ -4864,7 +4851,7 @@ static void nf_tables_obj_notify(const s
                                 struct nft_object *obj, int event)
  {
        nft_obj_notify(ctx->net, ctx->table, obj, ctx->portid, ctx->seq, event,
@@ -998,7 +998,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  }
  
  /*
-@@ -5036,7 +5023,7 @@ void nft_flow_table_iterate(struct net *
+@@ -5054,7 +5041,7 @@ void nft_flow_table_iterate(struct net *
  
        rcu_read_lock();
        list_for_each_entry_rcu(afi, &net->nft.af_info, list) {
@@ -1007,7 +1007,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                        list_for_each_entry_rcu(flowtable, &table->flowtables, list) {
                                iter(&flowtable->data, data);
                        }
-@@ -5084,7 +5071,8 @@ static int nf_tables_newflowtable(struct
+@@ -5102,7 +5089,8 @@ static int nf_tables_newflowtable(struct
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -1017,7 +1017,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -5101,7 +5089,7 @@ static int nf_tables_newflowtable(struct
+@@ -5119,7 +5107,7 @@ static int nf_tables_newflowtable(struct
                return 0;
        }
  
@@ -1026,7 +1026,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  
        flowtable = kzalloc(sizeof(*flowtable), GFP_KERNEL);
        if (!flowtable)
-@@ -5182,7 +5170,8 @@ static int nf_tables_delflowtable(struct
+@@ -5200,7 +5188,8 @@ static int nf_tables_delflowtable(struct
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -1036,7 +1036,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -5193,7 +5182,7 @@ static int nf_tables_delflowtable(struct
+@@ -5211,7 +5200,7 @@ static int nf_tables_delflowtable(struct
        if (flowtable->use > 0)
                return -EBUSY;
  
@@ -1045,7 +1045,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  
        return nft_delflowtable(&ctx, flowtable);
  }
-@@ -5262,40 +5251,37 @@ static int nf_tables_dump_flowtable(stru
+@@ -5280,40 +5269,37 @@ static int nf_tables_dump_flowtable(stru
        struct net *net = sock_net(skb->sk);
        int family = nfmsg->nfgen_family;
        struct nft_flowtable *flowtable;
@@ -1107,7 +1107,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                }
        }
  done:
-@@ -5380,7 +5366,8 @@ static int nf_tables_getflowtable(struct
+@@ -5398,7 +5384,8 @@ static int nf_tables_getflowtable(struct
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -1117,7 +1117,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -5423,7 +5410,7 @@ static void nf_tables_flowtable_notify(s
+@@ -5441,7 +5428,7 @@ static void nf_tables_flowtable_notify(s
  
        err = nf_tables_fill_flowtable_info(skb, ctx->net, ctx->portid,
                                            ctx->seq, event, 0,
@@ -1126,7 +1126,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (err < 0) {
                kfree_skb(skb);
                goto err;
-@@ -5501,17 +5488,14 @@ static int nf_tables_flowtable_event(str
+@@ -5519,17 +5506,14 @@ static int nf_tables_flowtable_event(str
        struct net_device *dev = netdev_notifier_info_to_dev(ptr);
        struct nft_flowtable *flowtable;
        struct nft_table *table;
@@ -1147,7 +1147,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                }
        }
        nfnl_unlock(NFNL_SUBSYS_NFTABLES);
-@@ -6532,6 +6516,7 @@ EXPORT_SYMBOL_GPL(nft_data_dump);
+@@ -6555,6 +6539,7 @@ EXPORT_SYMBOL_GPL(nft_data_dump);
  static int __net_init nf_tables_init_net(struct net *net)
  {
        INIT_LIST_HEAD(&net->nft.af_info);
@@ -1155,7 +1155,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        INIT_LIST_HEAD(&net->nft.commit_list);
        net->nft.base_seq = 1;
        return 0;
-@@ -6568,10 +6553,10 @@ static void __nft_release_afinfo(struct
+@@ -6591,10 +6576,10 @@ static void __nft_release_afinfo(struct
        struct nft_set *set, *ns;
        struct nft_ctx ctx = {
                .net    = net,
@@ -1280,8 +1280,8 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
 -      family = ctx->afi->family;
 +      family = ctx->family;
  
-       /* Re-use the existing target if it's already loaded. */
-       list_for_each_entry(nft_target, &nft_target_list, head) {
+       if (strcmp(tg_name, XT_ERROR_TARGET) == 0 ||
+           strcmp(tg_name, XT_STANDARD_TARGET) == 0 ||
 --- a/net/netfilter/nft_ct.c
 +++ b/net/netfilter/nft_ct.c
 @@ -405,7 +405,7 @@ static int nft_ct_get_init(const struct