ramips: add support for mqmaker witi 512mb version
[openwrt/staging/dedeckeh.git] / target / linux / generic / backport-4.14 / 335-netfilter-nf_tables-add-single-table-list-for-all-fa.patch
index bae2e2879e6f0b96a555c717e653cb7125e071d3..6fedd00eb0d58905e999bb7d83ef173eadd112b2 100644 (file)
@@ -548,24 +548,24 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
 -              if (family != NFPROTO_UNSPEC && family != afi->family)
 +      list_for_each_entry_rcu(table, &net->nft.tables, list) {
 +              if (family != NFPROTO_UNSPEC && family != table->afi->family)
++                      continue;
++
++              if (ctx && ctx->table && strcmp(ctx->table, table->name) != 0)
                        continue;
  
 -              list_for_each_entry_rcu(table, &afi->tables, list) {
 -                      if (ctx && ctx->table &&
 -                          strcmp(ctx->table, table->name) != 0)
--                              continue;
-+              if (ctx && ctx->table && strcmp(ctx->table, table->name) != 0)
-+                      continue;
++              list_for_each_entry_rcu(chain, &table->chains, list) {
++                      if (ctx && ctx->chain &&
++                          strcmp(ctx->chain, chain->name) != 0)
+                               continue;
  
 -                      list_for_each_entry_rcu(chain, &table->chains, list) {
 -                              if (ctx && ctx->chain &&
 -                                  strcmp(ctx->chain, chain->name) != 0)
 -                                      continue;
-+              list_for_each_entry_rcu(chain, &table->chains, list) {
-+                      if (ctx && ctx->chain &&
-+                          strcmp(ctx->chain, chain->name) != 0)
-+                              continue;
+-
 -                              list_for_each_entry_rcu(rule, &chain->rules, list) {
 -                                      if (!nft_is_active(net, rule))
 -                                              goto cont;
@@ -703,19 +703,23 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  
 -              if (cur_family) {
 -                      if (afi->family != cur_family)
+-                              continue;
 +              if (ctx->table && ctx->table != table)
 +                      continue;
-+
+-                      cur_family = 0;
+-              }
+-              list_for_each_entry_rcu(table, &afi->tables, list) {
+-                      if (ctx->table && ctx->table != table)
 +              if (cur_table) {
 +                      if (cur_table != table)
                                continue;
  
--                      cur_family = 0;
+-                      if (cur_table) {
+-                              if (cur_table != table)
+-                                      continue;
 +                      cur_table = NULL;
-               }
--              list_for_each_entry_rcu(table, &afi->tables, list) {
--                      if (ctx->table && ctx->table != table)
--                              continue;
++              }
 +              idx = 0;
 +              list_for_each_entry_rcu(set, &table->sets, list) {
 +                      if (idx < s_idx)
@@ -723,14 +727,11 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
 +                      if (!nft_is_active(net, set))
 +                              goto cont;
  
--                      if (cur_table) {
--                              if (cur_table != table)
--                                      continue;
+-                              cur_table = NULL;
 +                      ctx_set = *ctx;
 +                      ctx_set.table = table;
 +                      ctx_set.family = table->afi->family;
--                              cur_table = NULL;
++
 +                      if (nf_tables_fill_set(skb, &ctx_set, set,
 +                                             NFT_MSG_NEWSET,
 +                                             NLM_F_MULTI) < 0) {
@@ -1106,7 +1107,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                }
        }
  done:
-@@ -5328,7 +5314,8 @@ static int nf_tables_getflowtable(struct
+@@ -5330,7 +5316,8 @@ static int nf_tables_getflowtable(struct
        if (IS_ERR(afi))
                return PTR_ERR(afi);
  
@@ -1116,7 +1117,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -5371,7 +5358,7 @@ static void nf_tables_flowtable_notify(s
+@@ -5373,7 +5360,7 @@ static void nf_tables_flowtable_notify(s
  
        err = nf_tables_fill_flowtable_info(skb, ctx->net, ctx->portid,
                                            ctx->seq, event, 0,
@@ -1125,7 +1126,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (err < 0) {
                kfree_skb(skb);
                goto err;
-@@ -5449,17 +5436,14 @@ static int nf_tables_flowtable_event(str
+@@ -5451,17 +5438,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;
@@ -1146,7 +1147,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                }
        }
        nfnl_unlock(NFNL_SUBSYS_NFTABLES);
-@@ -6478,6 +6462,7 @@ EXPORT_SYMBOL_GPL(nft_data_dump);
+@@ -6480,6 +6464,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);
@@ -1154,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;
-@@ -6514,10 +6499,10 @@ static void __nft_release_afinfo(struct
+@@ -6516,10 +6501,10 @@ static void __nft_release_afinfo(struct
        struct nft_set *set, *ns;
        struct nft_ctx ctx = {
                .net    = net,