Commit 7073b16f authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: nf_tables: Use nla_put_be32() to dump immediate parameters

nft_dump_register() should only be used with registers, not with
immediates.

Fixes: cb1b69b0 ("netfilter: nf_tables: add hash expression")
Fixes: 91dbc6be("netfilter: nf_tables: add number generator expression")
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent c016c7e4
...@@ -88,11 +88,11 @@ static int nft_hash_dump(struct sk_buff *skb, ...@@ -88,11 +88,11 @@ static int nft_hash_dump(struct sk_buff *skb,
goto nla_put_failure; goto nla_put_failure;
if (nft_dump_register(skb, NFTA_HASH_DREG, priv->dreg)) if (nft_dump_register(skb, NFTA_HASH_DREG, priv->dreg))
goto nla_put_failure; goto nla_put_failure;
if (nft_dump_register(skb, NFTA_HASH_LEN, priv->len)) if (nla_put_be32(skb, NFTA_HASH_LEN, htonl(priv->len)))
goto nla_put_failure; goto nla_put_failure;
if (nft_dump_register(skb, NFTA_HASH_MODULUS, priv->modulus)) if (nla_put_be32(skb, NFTA_HASH_MODULUS, htonl(priv->modulus)))
goto nla_put_failure; goto nla_put_failure;
if (nft_dump_register(skb, NFTA_HASH_SEED, priv->seed)) if (nla_put_be32(skb, NFTA_HASH_SEED, htonl(priv->seed)))
goto nla_put_failure; goto nla_put_failure;
return 0; return 0;
......
...@@ -68,9 +68,9 @@ static int nft_ng_dump(struct sk_buff *skb, enum nft_registers dreg, ...@@ -68,9 +68,9 @@ static int nft_ng_dump(struct sk_buff *skb, enum nft_registers dreg,
{ {
if (nft_dump_register(skb, NFTA_NG_DREG, dreg)) if (nft_dump_register(skb, NFTA_NG_DREG, dreg))
goto nla_put_failure; goto nla_put_failure;
if (nft_dump_register(skb, NFTA_NG_UNTIL, until)) if (nla_put_be32(skb, NFTA_NG_UNTIL, htonl(until)))
goto nla_put_failure; goto nla_put_failure;
if (nft_dump_register(skb, NFTA_NG_TYPE, type)) if (nla_put_be32(skb, NFTA_NG_TYPE, htonl(type)))
goto nla_put_failure; goto nla_put_failure;
return 0; return 0;
......
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