From: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: [libnftables PATCH] nat: xml: fix wrong node name in snprintf
Date: Mon, 12 Aug 2013 09:35:39 +0200 [thread overview]
Message-ID: <20130812073539.20663.65637.stgit@nfdev.cica.es> (raw)
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>
next reply other threads:[~2013-08-12 7:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-12 7:35 Arturo Borrero Gonzalez [this message]
2013-08-12 9:36 ` [libnftables PATCH] nat: xml: fix wrong node name in snprintf Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130812073539.20663.65637.stgit@nfdev.cica.es \
--to=arturo.borrero.glez@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).