nat: xml: fix wrong node name in snprintf
PATCH 1/1 nat: xml: fix wrong node name in snprintf
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 <[email protected]>
--- tests/xmlfiles/32-rule-nat6.xml | 2 +- tests/xmlfiles/33-rule-nat4.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
src/expr/nat.c +3 -3
@@ -204,7 +204,7 @@ static int nft_rule_expr_nat_xml_parse(struct nft_rule_expr *e, mxml_node_t *treint32_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>" );
tests/xmlfiles/32-rule-nat6.xml +1 -1
@@ -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>
tests/xmlfiles/33-rule-nat4.xml +1 -1
@@ -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>
Quoted 8 lines · Arturo Borrero Gonzalez
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 tonat_type).
Applied, thanks.