It changes the parse functions to omit unset values. Now, It possible to use a xml file like this: [...] <expr type="nat"> <type>snat</type> <family>ip</family> <sreg_addr_min>1</sreg_addr_min> <sreg_addr_max>1</sreg_addr_max> </expr></rule> Signed-off-by: Ana Rey <anarey@xxxxxxxxx> --- src/expr/nat.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/expr/nat.c b/src/expr/nat.c index 46d5ed7..c10f0ff 100644 --- a/src/expr/nat.c +++ b/src/expr/nat.c @@ -283,24 +283,20 @@ static int nft_rule_expr_nat_xml_parse(struct nft_rule_expr *e, mxml_node_t *tre nft_rule_expr_set_u32(e, NFT_EXPR_NAT_FAMILY, family); if (nft_mxml_reg_parse(tree, "sreg_addr_min", ®_addr_min, - MXML_DESCEND, NFT_XML_MAND, err) < 0) - return -1; - nft_rule_expr_set_u32(e, NFT_EXPR_NAT_REG_ADDR_MIN, reg_addr_min); + MXML_DESCEND, NFT_XML_MAND, err) == 0) + nft_rule_expr_set_u32(e, NFT_EXPR_NAT_REG_ADDR_MIN, reg_addr_min); if (nft_mxml_reg_parse(tree, "sreg_addr_max", ®_addr_max, - MXML_DESCEND, NFT_XML_MAND, err) < 0) - return -1; - nft_rule_expr_set_u32(e, NFT_EXPR_NAT_REG_ADDR_MAX, reg_addr_max); + MXML_DESCEND, NFT_XML_MAND, err) == 0) + nft_rule_expr_set_u32(e, NFT_EXPR_NAT_REG_ADDR_MAX, reg_addr_max); if (nft_mxml_reg_parse(tree, "sreg_proto_min", ®_proto_min, - MXML_DESCEND, NFT_XML_MAND, err) < 0) - return -1; - nft_rule_expr_set_u32(e, NFT_EXPR_NAT_REG_PROTO_MIN, reg_proto_min); + MXML_DESCEND, NFT_XML_MAND, err) == 0) + nft_rule_expr_set_u32(e, NFT_EXPR_NAT_REG_PROTO_MIN, reg_proto_min); if (nft_mxml_reg_parse(tree, "sreg_proto_max", ®_proto_max, - MXML_DESCEND, NFT_XML_MAND, err) < 0) - return -1; - nft_rule_expr_set_u32(e, NFT_EXPR_NAT_REG_PROTO_MAX, reg_proto_max); + MXML_DESCEND, NFT_XML_MAND, err) == 0) + nft_rule_expr_set_u32(e, NFT_EXPR_NAT_REG_PROTO_MAX, reg_proto_max); return 0; #else -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html