diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-06-13 07:45:38 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-06-16 07:08:14 -0400 |
commit | 915136065b7ca75af4cae06281e4dc43926edbfe (patch) | |
tree | a7ac3f16f90b58a14900846a80fa3d28ebc01eeb /net | |
parent | 6403d96254c7c44fdfa163248b1198c714c65f6a (diff) |
netfilter: nft_nat: don't dump port information if unset
Don't include port information attributes if they are unset.
Reported-by: Ana Rey <anarey@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nft_nat.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c index a0195d28bcfc..79ff58cd36dc 100644 --- a/net/netfilter/nft_nat.c +++ b/net/netfilter/nft_nat.c | |||
@@ -175,12 +175,14 @@ static int nft_nat_dump(struct sk_buff *skb, const struct nft_expr *expr) | |||
175 | if (nla_put_be32(skb, | 175 | if (nla_put_be32(skb, |
176 | NFTA_NAT_REG_ADDR_MAX, htonl(priv->sreg_addr_max))) | 176 | NFTA_NAT_REG_ADDR_MAX, htonl(priv->sreg_addr_max))) |
177 | goto nla_put_failure; | 177 | goto nla_put_failure; |
178 | if (nla_put_be32(skb, | 178 | if (priv->sreg_proto_min) { |
179 | NFTA_NAT_REG_PROTO_MIN, htonl(priv->sreg_proto_min))) | 179 | if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MIN, |
180 | goto nla_put_failure; | 180 | htonl(priv->sreg_proto_min))) |
181 | if (nla_put_be32(skb, | 181 | goto nla_put_failure; |
182 | NFTA_NAT_REG_PROTO_MAX, htonl(priv->sreg_proto_max))) | 182 | if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MAX, |
183 | goto nla_put_failure; | 183 | htonl(priv->sreg_proto_max))) |
184 | goto nla_put_failure; | ||
185 | } | ||
184 | return 0; | 186 | return 0; |
185 | 187 | ||
186 | nla_put_failure: | 188 | nla_put_failure: |