Commit 1e2d56a5 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: nft_nat: dump attributes if they are set

Dump NFTA_NAT_REG_ADDR_MIN if this is non-zero. Same thing with
NFTA_NAT_REG_PROTO_MIN.
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 61cfac6b
...@@ -191,17 +191,19 @@ static int nft_nat_dump(struct sk_buff *skb, const struct nft_expr *expr) ...@@ -191,17 +191,19 @@ static int nft_nat_dump(struct sk_buff *skb, const struct nft_expr *expr)
if (nla_put_be32(skb, NFTA_NAT_FAMILY, htonl(priv->family))) if (nla_put_be32(skb, NFTA_NAT_FAMILY, htonl(priv->family)))
goto nla_put_failure; goto nla_put_failure;
if (nla_put_be32(skb,
NFTA_NAT_REG_ADDR_MIN, htonl(priv->sreg_addr_min))) if (priv->sreg_addr_min) {
goto nla_put_failure; if (nla_put_be32(skb, NFTA_NAT_REG_ADDR_MIN,
if (nla_put_be32(skb, htonl(priv->sreg_addr_min)) ||
NFTA_NAT_REG_ADDR_MAX, htonl(priv->sreg_addr_max))) nla_put_be32(skb, NFTA_NAT_REG_ADDR_MAX,
goto nla_put_failure; htonl(priv->sreg_addr_max)))
goto nla_put_failure;
}
if (priv->sreg_proto_min) { if (priv->sreg_proto_min) {
if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MIN, if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MIN,
htonl(priv->sreg_proto_min))) htonl(priv->sreg_proto_min)) ||
goto nla_put_failure; nla_put_be32(skb, NFTA_NAT_REG_PROTO_MAX,
if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MAX,
htonl(priv->sreg_proto_max))) htonl(priv->sreg_proto_max)))
goto nla_put_failure; goto nla_put_failure;
} }
......
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