Commit 1ec10212 authored by Patrick McHardy's avatar Patrick McHardy Committed by Pablo Neira Ayuso

netfilter: nf_tables: rename nft_validate_data_load()

The existing name is ambiguous, data is loaded as well when we read from
a register. Rename to nft_validate_register_store() for clarity and
consistency with the upcoming patch to introduce its counterpart,
nft_validate_register_load().
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 45d9bcda
...@@ -114,7 +114,8 @@ static inline enum nft_registers nft_type_to_reg(enum nft_data_types type) ...@@ -114,7 +114,8 @@ static inline enum nft_registers nft_type_to_reg(enum nft_data_types type)
int nft_validate_input_register(enum nft_registers reg); int nft_validate_input_register(enum nft_registers reg);
int nft_validate_output_register(enum nft_registers reg); int nft_validate_output_register(enum nft_registers reg);
int nft_validate_data_load(const struct nft_ctx *ctx, enum nft_registers reg, int nft_validate_register_store(const struct nft_ctx *ctx,
enum nft_registers reg,
const struct nft_data *data, const struct nft_data *data,
enum nft_data_types type, unsigned int len); enum nft_data_types type, unsigned int len);
......
...@@ -71,7 +71,7 @@ static int nft_meta_bridge_get_init(const struct nft_ctx *ctx, ...@@ -71,7 +71,7 @@ static int nft_meta_bridge_get_init(const struct nft_ctx *ctx,
if (err < 0) if (err < 0)
return err; return err;
err = nft_validate_data_load(ctx, priv->dreg, NULL, err = nft_validate_register_store(ctx, priv->dreg, NULL,
NFT_DATA_VALUE, len); NFT_DATA_VALUE, len);
if (err < 0) if (err < 0)
return err; return err;
......
...@@ -2797,7 +2797,7 @@ static int nf_tables_bind_check_setelem(const struct nft_ctx *ctx, ...@@ -2797,7 +2797,7 @@ static int nf_tables_bind_check_setelem(const struct nft_ctx *ctx,
enum nft_registers dreg; enum nft_registers dreg;
dreg = nft_type_to_reg(set->dtype); dreg = nft_type_to_reg(set->dtype);
return nft_validate_data_load(ctx, dreg, nft_set_ext_data(ext), return nft_validate_register_store(ctx, dreg, nft_set_ext_data(ext),
set->dtype == NFT_DATA_VERDICT ? set->dtype == NFT_DATA_VERDICT ?
NFT_DATA_VERDICT : NFT_DATA_VALUE, NFT_DATA_VERDICT : NFT_DATA_VALUE,
set->dlen); set->dlen);
...@@ -3334,8 +3334,9 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, ...@@ -3334,8 +3334,9 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
if (!(binding->flags & NFT_SET_MAP)) if (!(binding->flags & NFT_SET_MAP))
continue; continue;
err = nft_validate_data_load(&bind_ctx, dreg, err = nft_validate_register_store(&bind_ctx, dreg,
&data, d2.type, d2.len); &data,
d2.type, d2.len);
if (err < 0) if (err < 0)
goto err3; goto err3;
} }
...@@ -4157,7 +4158,7 @@ int nft_validate_output_register(enum nft_registers reg) ...@@ -4157,7 +4158,7 @@ int nft_validate_output_register(enum nft_registers reg)
EXPORT_SYMBOL_GPL(nft_validate_output_register); EXPORT_SYMBOL_GPL(nft_validate_output_register);
/** /**
* nft_validate_data_load - validate an expressions' data load * nft_validate_register_store - validate an expressions' register store
* *
* @ctx: context of the expression performing the load * @ctx: context of the expression performing the load
* @reg: the destination register number * @reg: the destination register number
...@@ -4170,7 +4171,8 @@ EXPORT_SYMBOL_GPL(nft_validate_output_register); ...@@ -4170,7 +4171,8 @@ EXPORT_SYMBOL_GPL(nft_validate_output_register);
* A value of NULL for the data means that its runtime gathered * A value of NULL for the data means that its runtime gathered
* data, which is always of type NFT_DATA_VALUE. * data, which is always of type NFT_DATA_VALUE.
*/ */
int nft_validate_data_load(const struct nft_ctx *ctx, enum nft_registers reg, int nft_validate_register_store(const struct nft_ctx *ctx,
enum nft_registers reg,
const struct nft_data *data, const struct nft_data *data,
enum nft_data_types type, unsigned int len) enum nft_data_types type, unsigned int len)
{ {
...@@ -4204,7 +4206,7 @@ int nft_validate_data_load(const struct nft_ctx *ctx, enum nft_registers reg, ...@@ -4204,7 +4206,7 @@ int nft_validate_data_load(const struct nft_ctx *ctx, enum nft_registers reg,
return 0; return 0;
} }
} }
EXPORT_SYMBOL_GPL(nft_validate_data_load); EXPORT_SYMBOL_GPL(nft_validate_register_store);
static const struct nla_policy nft_verdict_policy[NFTA_VERDICT_MAX + 1] = { static const struct nla_policy nft_verdict_policy[NFTA_VERDICT_MAX + 1] = {
[NFTA_VERDICT_CODE] = { .type = NLA_U32 }, [NFTA_VERDICT_CODE] = { .type = NLA_U32 },
......
...@@ -75,7 +75,7 @@ static int nft_bitwise_init(const struct nft_ctx *ctx, ...@@ -75,7 +75,7 @@ static int nft_bitwise_init(const struct nft_ctx *ctx,
if (err < 0) if (err < 0)
return err; return err;
err = nft_validate_data_load(ctx, priv->dreg, NULL, err = nft_validate_register_store(ctx, priv->dreg, NULL,
NFT_DATA_VALUE, priv->len); NFT_DATA_VALUE, priv->len);
if (err < 0) if (err < 0)
return err; return err;
......
...@@ -118,7 +118,7 @@ static int nft_byteorder_init(const struct nft_ctx *ctx, ...@@ -118,7 +118,7 @@ static int nft_byteorder_init(const struct nft_ctx *ctx,
err = nft_validate_output_register(priv->dreg); err = nft_validate_output_register(priv->dreg);
if (err < 0) if (err < 0)
return err; return err;
err = nft_validate_data_load(ctx, priv->dreg, NULL, err = nft_validate_register_store(ctx, priv->dreg, NULL,
NFT_DATA_VALUE, priv->len); NFT_DATA_VALUE, priv->len);
if (err < 0) if (err < 0)
return err; return err;
......
...@@ -311,7 +311,7 @@ static int nft_ct_get_init(const struct nft_ctx *ctx, ...@@ -311,7 +311,7 @@ static int nft_ct_get_init(const struct nft_ctx *ctx,
if (err < 0) if (err < 0)
return err; return err;
err = nft_validate_data_load(ctx, priv->dreg, NULL, err = nft_validate_register_store(ctx, priv->dreg, NULL,
NFT_DATA_VALUE, len); NFT_DATA_VALUE, len);
if (err < 0) if (err < 0)
return err; return err;
......
...@@ -74,7 +74,7 @@ static int nft_exthdr_init(const struct nft_ctx *ctx, ...@@ -74,7 +74,7 @@ static int nft_exthdr_init(const struct nft_ctx *ctx,
err = nft_validate_output_register(priv->dreg); err = nft_validate_output_register(priv->dreg);
if (err < 0) if (err < 0)
return err; return err;
return nft_validate_data_load(ctx, priv->dreg, NULL, return nft_validate_register_store(ctx, priv->dreg, NULL,
NFT_DATA_VALUE, priv->len); NFT_DATA_VALUE, priv->len);
} }
......
...@@ -59,7 +59,7 @@ static int nft_immediate_init(const struct nft_ctx *ctx, ...@@ -59,7 +59,7 @@ static int nft_immediate_init(const struct nft_ctx *ctx,
return err; return err;
priv->dlen = desc.len; priv->dlen = desc.len;
err = nft_validate_data_load(ctx, priv->dreg, &priv->data, err = nft_validate_register_store(ctx, priv->dreg, &priv->data,
desc.type, desc.len); desc.type, desc.len);
if (err < 0) if (err < 0)
goto err1; goto err1;
......
...@@ -262,7 +262,7 @@ int nft_meta_get_init(const struct nft_ctx *ctx, ...@@ -262,7 +262,7 @@ int nft_meta_get_init(const struct nft_ctx *ctx,
if (err < 0) if (err < 0)
return err; return err;
err = nft_validate_data_load(ctx, priv->dreg, NULL, err = nft_validate_register_store(ctx, priv->dreg, NULL,
NFT_DATA_VALUE, len); NFT_DATA_VALUE, len);
if (err < 0) if (err < 0)
return err; return err;
......
...@@ -72,7 +72,7 @@ static int nft_payload_init(const struct nft_ctx *ctx, ...@@ -72,7 +72,7 @@ static int nft_payload_init(const struct nft_ctx *ctx,
err = nft_validate_output_register(priv->dreg); err = nft_validate_output_register(priv->dreg);
if (err < 0) if (err < 0)
return err; return err;
return nft_validate_data_load(ctx, priv->dreg, NULL, return nft_validate_register_store(ctx, priv->dreg, NULL,
NFT_DATA_VALUE, priv->len); NFT_DATA_VALUE, priv->len);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment