netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [libnftables PATCH] nat: xml: fix wrong node name in snprintf
@ 2013-08-12  7:35 Arturo Borrero Gonzalez
  2013-08-12  9:36 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Arturo Borrero Gonzalez @ 2013-08-12  7:35 UTC (permalink / raw)
  To: netfilter-devel

This patch renames all <nat_type> nodes to <type> in nat expr.
A bug is fixed, since the default option in snprintf was already
<type>.

This follows the pattern of avoid prefixing XML nodes.

Note that this is mostly reverting what was done at:
31e34c3 (nat: xml: rename node type to nat_type).

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
 tests/xmlfiles/32-rule-nat6.xml |    2 +-
 tests/xmlfiles/33-rule-nat4.xml |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/expr/nat.c b/src/expr/nat.c
index c81dc7f..e6866ec 100644
--- a/src/expr/nat.c
+++ b/src/expr/nat.c
@@ -204,7 +204,7 @@ static int nft_rule_expr_nat_xml_parse(struct nft_rule_expr *e, mxml_node_t *tre
 	int32_t reg;
 	int family, nat_type_value;
 
-	nat_type = nft_mxml_str_parse(tree, "nat_type", MXML_DESCEND_FIRST);
+	nat_type = nft_mxml_str_parse(tree, "type", MXML_DESCEND_FIRST);
 	if (nat_type == NULL)
 		return -1;
 
@@ -306,9 +306,9 @@ nft_rule_expr_nat_snprintf_xml(char *buf, size_t size,
 
 	/* Is a mandatory element. Provide a default, even empty */
 	if (nat->type == NFT_NAT_SNAT)
-		ret = snprintf(buf, len, "<nat_type>snat</nat_type>");
+		ret = snprintf(buf, len, "<type>snat</type>");
 	else if (nat->type == NFT_NAT_DNAT)
-		ret = snprintf(buf, len, "<nat_type>dnat</nat_type>");
+		ret = snprintf(buf, len, "<type>dnat</type>");
 	else
 		ret = snprintf(buf, len, "<type>unknown</type>");
 
diff --git a/tests/xmlfiles/32-rule-nat6.xml b/tests/xmlfiles/32-rule-nat6.xml
index 1834bff..16dcfb0 100644
--- a/tests/xmlfiles/32-rule-nat6.xml
+++ b/tests/xmlfiles/32-rule-nat6.xml
@@ -1 +1 @@
-<rule><family>ip6</family><table>nat</table><chain>OUTPUT</chain><handle>100</handle><flags>0</flags><expr type="nat"><family>ip6</family><nat_type>snat</nat_type><sreg_addr_min>1</sreg_addr_min><sreg_addr_max>2</sreg_addr_max><sreg_proto_min>3</sreg_proto_min><sreg_proto_max>4</sreg_proto_max></expr></rule>
+<rule><family>ip6</family><table>nat</table><chain>OUTPUT</chain><handle>100</handle><flags>0</flags><expr type="nat"><type>snat</type><family>ip6</family><sreg_addr_min>1</sreg_addr_min><sreg_addr_max>2</sreg_addr_max><sreg_proto_min>3</sreg_proto_min><sreg_proto_max>4</sreg_proto_max></expr></rule>
diff --git a/tests/xmlfiles/33-rule-nat4.xml b/tests/xmlfiles/33-rule-nat4.xml
index ac4d7d2..8ac5238 100644
--- a/tests/xmlfiles/33-rule-nat4.xml
+++ b/tests/xmlfiles/33-rule-nat4.xml
@@ -1 +1 @@
-<rule><family>ip</family><table>filter</table><chain>INPUT</chain><handle>100</handle><flags>0</flags><expr type="nat"><sreg_addr_min>1</sreg_addr_min><sreg_addr_max>2</sreg_addr_max><sreg_proto_min>3</sreg_proto_min><sreg_proto_max>4</sreg_proto_max><family>ip</family><nat_type>dnat</nat_type></expr></rule>
+<rule><family>ip</family><table>filter</table><chain>INPUT</chain><handle>100</handle><flags>0</flags><expr type="nat"><type>dnat</type><family>ip</family><sreg_addr_min>1</sreg_addr_min><sreg_addr_max>2</sreg_addr_max><sreg_proto_min>3</sreg_proto_min><sreg_proto_max>4</sreg_proto_max></expr></rule>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [libnftables PATCH] nat: xml: fix wrong node name in snprintf
  2013-08-12  7:35 [libnftables PATCH] nat: xml: fix wrong node name in snprintf Arturo Borrero Gonzalez
@ 2013-08-12  9:36 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2013-08-12  9:36 UTC (permalink / raw)
  To: Arturo Borrero Gonzalez; +Cc: netfilter-devel

On Mon, Aug 12, 2013 at 09:35:39AM +0200, Arturo Borrero Gonzalez wrote:
> This patch renames all <nat_type> nodes to <type> in nat expr.
> A bug is fixed, since the default option in snprintf was already
> <type>.
> 
> This follows the pattern of avoid prefixing XML nodes.
> 
> Note that this is mostly reverting what was done at:
> 31e34c3 (nat: xml: rename node type to nat_type).

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-12  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-12  7:35 [libnftables PATCH] nat: xml: fix wrong node name in snprintf Arturo Borrero Gonzalez
2013-08-12  9:36 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).