From 063da5bcaaf58e3ab6b86eacd6a4c958541a97bd Mon Sep 17 00:00:00 2001 From: Arturo Borrero Date: Mon, 12 Aug 2013 09:35:39 +0200 Subject: nat: xml: fix wrong node name in snprintf This patch renames all nodes to in nat expr. A bug is fixed, since the default option in snprintf was already . 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 Signed-off-by: Pablo Neira Ayuso --- src/expr/nat.c | 6 +++--- tests/xmlfiles/32-rule-nat6.xml | 2 +- tests/xmlfiles/33-rule-nat4.xml | 2 +- 3 files changed, 5 insertions(+), 5 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, "snat"); + ret = snprintf(buf, len, "snat"); else if (nat->type == NFT_NAT_DNAT) - ret = snprintf(buf, len, "dnat"); + ret = snprintf(buf, len, "dnat"); else ret = snprintf(buf, len, "unknown"); 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 @@ -ip6nat
OUTPUT1000ip6snat1234
+ip6nat
OUTPUT1000snatip61234
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 @@ -ipfilter
INPUT10001234ipdnat
+ipfilter
INPUT1000dnatip1234
-- cgit v1.2.3