kernel: bump 4.14 to 4.14.104
[openwrt/openwrt.git] / target / linux / generic / backport-4.14 / 344-v4.16-netfilter-nf_tables-allocate-handle-and-delete-objec.patch
index 84729ad1f570097b0b096578bca0663272e9773d..29c87823b355db4044757d0f9edc14974aaea970 100644 (file)
@@ -151,7 +151,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  
  static void nft_ctx_init(struct nft_ctx *ctx,
                         struct net *net,
-@@ -361,6 +362,20 @@ static struct nft_table *nft_table_looku
+@@ -364,6 +365,20 @@ static struct nft_table *nft_table_looku
        return NULL;
  }
  
@@ -172,7 +172,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  static struct nft_table *nf_tables_table_lookup(const struct net *net,
                                                const struct nlattr *nla,
                                                u8 family, u8 genmask)
-@@ -377,6 +392,22 @@ static struct nft_table *nf_tables_table
+@@ -380,6 +395,22 @@ static struct nft_table *nf_tables_table
        return ERR_PTR(-ENOENT);
  }
  
@@ -195,7 +195,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  static inline u64 nf_tables_alloc_handle(struct nft_table *table)
  {
        return ++table->hgenerator;
-@@ -423,6 +454,7 @@ static const struct nla_policy nft_table
+@@ -426,6 +457,7 @@ static const struct nla_policy nft_table
        [NFTA_TABLE_NAME]       = { .type = NLA_STRING,
                                    .len = NFT_TABLE_MAXNAMELEN - 1 },
        [NFTA_TABLE_FLAGS]      = { .type = NLA_U32 },
@@ -203,7 +203,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  };
  
  static int nf_tables_fill_table_info(struct sk_buff *skb, struct net *net,
-@@ -444,7 +476,9 @@ static int nf_tables_fill_table_info(str
+@@ -447,7 +479,9 @@ static int nf_tables_fill_table_info(str
  
        if (nla_put_string(skb, NFTA_TABLE_NAME, table->name) ||
            nla_put_be32(skb, NFTA_TABLE_FLAGS, htonl(table->flags)) ||
@@ -214,7 +214,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                goto nla_put_failure;
  
        nlmsg_end(skb, nlh);
-@@ -703,6 +737,7 @@ static int nf_tables_newtable(struct net
+@@ -706,6 +740,7 @@ static int nf_tables_newtable(struct net
        INIT_LIST_HEAD(&table->flowtables);
        table->family = family;
        table->flags = flags;
@@ -222,7 +222,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  
        nft_ctx_init(&ctx, net, skb, nlh, family, table, NULL, nla);
        err = nft_trans_table_add(&ctx, NFT_MSG_NEWTABLE);
-@@ -820,11 +855,18 @@ static int nf_tables_deltable(struct net
+@@ -823,11 +858,18 @@ static int nf_tables_deltable(struct net
        struct nft_ctx ctx;
  
        nft_ctx_init(&ctx, net, skb, nlh, 0, NULL, NULL, nla);
@@ -244,7 +244,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(table))
                return PTR_ERR(table);
  
-@@ -1581,6 +1623,7 @@ static int nf_tables_delchain(struct net
+@@ -1584,6 +1626,7 @@ static int nf_tables_delchain(struct net
        struct nft_rule *rule;
        int family = nfmsg->nfgen_family;
        struct nft_ctx ctx;
@@ -252,7 +252,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        u32 use;
        int err;
  
-@@ -1589,7 +1632,12 @@ static int nf_tables_delchain(struct net
+@@ -1592,7 +1635,12 @@ static int nf_tables_delchain(struct net
        if (IS_ERR(table))
                return PTR_ERR(table);
  
@@ -266,7 +266,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(chain))
                return PTR_ERR(chain);
  
-@@ -2557,6 +2605,7 @@ static const struct nla_policy nft_set_p
+@@ -2560,6 +2608,7 @@ static const struct nla_policy nft_set_p
        [NFTA_SET_USERDATA]             = { .type = NLA_BINARY,
                                            .len  = NFT_USERDATA_MAXLEN },
        [NFTA_SET_OBJ_TYPE]             = { .type = NLA_U32 },
@@ -274,7 +274,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  };
  
  static const struct nla_policy nft_set_desc_policy[NFTA_SET_DESC_MAX + 1] = {
-@@ -2600,6 +2649,22 @@ static struct nft_set *nf_tables_set_loo
+@@ -2603,6 +2652,22 @@ static struct nft_set *nf_tables_set_loo
        return ERR_PTR(-ENOENT);
  }
  
@@ -297,7 +297,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  static struct nft_set *nf_tables_set_lookup_byid(const struct net *net,
                                                 const struct nlattr *nla,
                                                 u8 genmask)
-@@ -2716,6 +2781,9 @@ static int nf_tables_fill_set(struct sk_
+@@ -2719,6 +2784,9 @@ static int nf_tables_fill_set(struct sk_
                goto nla_put_failure;
        if (nla_put_string(skb, NFTA_SET_NAME, set->name))
                goto nla_put_failure;
@@ -307,7 +307,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (set->flags != 0)
                if (nla_put_be32(skb, NFTA_SET_FLAGS, htonl(set->flags)))
                        goto nla_put_failure;
-@@ -3124,6 +3192,7 @@ static int nf_tables_newset(struct net *
+@@ -3127,6 +3195,7 @@ static int nf_tables_newset(struct net *
        set->udata  = udata;
        set->timeout = timeout;
        set->gc_int = gc_int;
@@ -315,7 +315,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  
        err = ops->init(set, &desc, nla);
        if (err < 0)
-@@ -3183,7 +3252,10 @@ static int nf_tables_delset(struct net *
+@@ -3186,7 +3255,10 @@ static int nf_tables_delset(struct net *
        if (err < 0)
                return err;
  
@@ -327,7 +327,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(set))
                return PTR_ERR(set);
  
-@@ -4244,6 +4316,21 @@ struct nft_object *nf_tables_obj_lookup(
+@@ -4249,6 +4321,21 @@ struct nft_object *nf_tables_obj_lookup(
  }
  EXPORT_SYMBOL_GPL(nf_tables_obj_lookup);
  
@@ -349,7 +349,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  static const struct nla_policy nft_obj_policy[NFTA_OBJ_MAX + 1] = {
        [NFTA_OBJ_TABLE]        = { .type = NLA_STRING,
                                    .len = NFT_TABLE_MAXNAMELEN - 1 },
-@@ -4251,6 +4338,7 @@ static const struct nla_policy nft_obj_p
+@@ -4256,6 +4343,7 @@ static const struct nla_policy nft_obj_p
                                    .len = NFT_OBJ_MAXNAMELEN - 1 },
        [NFTA_OBJ_TYPE]         = { .type = NLA_U32 },
        [NFTA_OBJ_DATA]         = { .type = NLA_NESTED },
@@ -357,7 +357,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  };
  
  static struct nft_object *nft_obj_init(const struct nft_ctx *ctx,
-@@ -4398,6 +4486,8 @@ static int nf_tables_newobj(struct net *
+@@ -4403,6 +4491,8 @@ static int nf_tables_newobj(struct net *
                goto err1;
        }
        obj->table = table;
@@ -366,7 +366,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        obj->name = nla_strdup(nla[NFTA_OBJ_NAME], GFP_KERNEL);
        if (!obj->name) {
                err = -ENOMEM;
-@@ -4444,7 +4534,9 @@ static int nf_tables_fill_obj_info(struc
+@@ -4449,7 +4539,9 @@ static int nf_tables_fill_obj_info(struc
            nla_put_string(skb, NFTA_OBJ_NAME, obj->name) ||
            nla_put_be32(skb, NFTA_OBJ_TYPE, htonl(obj->ops->type->type)) ||
            nla_put_be32(skb, NFTA_OBJ_USE, htonl(obj->use)) ||
@@ -377,7 +377,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                goto nla_put_failure;
  
        nlmsg_end(skb, nlh);
-@@ -4642,7 +4734,7 @@ static int nf_tables_delobj(struct net *
+@@ -4647,7 +4739,7 @@ static int nf_tables_delobj(struct net *
        u32 objtype;
  
        if (!nla[NFTA_OBJ_TYPE] ||
@@ -386,7 +386,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
                return -EINVAL;
  
        table = nf_tables_table_lookup(net, nla[NFTA_OBJ_TABLE], family,
-@@ -4651,7 +4743,12 @@ static int nf_tables_delobj(struct net *
+@@ -4656,7 +4748,12 @@ static int nf_tables_delobj(struct net *
                return PTR_ERR(table);
  
        objtype = ntohl(nla_get_be32(nla[NFTA_OBJ_TYPE]));
@@ -400,7 +400,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(obj))
                return PTR_ERR(obj);
        if (obj->use > 0)
-@@ -4723,6 +4820,7 @@ static const struct nla_policy nft_flowt
+@@ -4728,6 +4825,7 @@ static const struct nla_policy nft_flowt
        [NFTA_FLOWTABLE_NAME]           = { .type = NLA_STRING,
                                            .len = NFT_NAME_MAXLEN - 1 },
        [NFTA_FLOWTABLE_HOOK]           = { .type = NLA_NESTED },
@@ -408,7 +408,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  };
  
  struct nft_flowtable *nf_tables_flowtable_lookup(const struct nft_table *table,
-@@ -4740,6 +4838,20 @@ struct nft_flowtable *nf_tables_flowtabl
+@@ -4745,6 +4843,20 @@ struct nft_flowtable *nf_tables_flowtabl
  }
  EXPORT_SYMBOL_GPL(nf_tables_flowtable_lookup);
  
@@ -429,7 +429,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  #define NFT_FLOWTABLE_DEVICE_MAX      8
  
  static int nf_tables_parse_devices(const struct nft_ctx *ctx,
-@@ -4948,6 +5060,8 @@ static int nf_tables_newflowtable(struct
+@@ -4953,6 +5065,8 @@ static int nf_tables_newflowtable(struct
                return -ENOMEM;
  
        flowtable->table = table;
@@ -438,7 +438,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        flowtable->name = nla_strdup(nla[NFTA_FLOWTABLE_NAME], GFP_KERNEL);
        if (!flowtable->name) {
                err = -ENOMEM;
-@@ -5022,8 +5136,14 @@ static int nf_tables_delflowtable(struct
+@@ -5027,8 +5141,14 @@ static int nf_tables_delflowtable(struct
        if (IS_ERR(table))
                return PTR_ERR(table);
  
@@ -455,7 +455,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
        if (IS_ERR(flowtable))
                  return PTR_ERR(flowtable);
        if (flowtable->use > 0)
-@@ -5056,7 +5176,9 @@ static int nf_tables_fill_flowtable_info
+@@ -5061,7 +5181,9 @@ static int nf_tables_fill_flowtable_info
  
        if (nla_put_string(skb, NFTA_FLOWTABLE_TABLE, flowtable->table->name) ||
            nla_put_string(skb, NFTA_FLOWTABLE_NAME, flowtable->name) ||