[libnftables PATCH 1/5] src: rule: small fix XML output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch aplies two fixes:
	* snprintf XML output offset for rule.
	* add XML <flags> node, missing in previous patches.

The <flags> node will be used for parsing a rule in XML.

Signed-off-by: Arturo Borrero González <arturo.borrero.glez@xxxxxxxxx>
---
 src/rule.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/rule.c b/src/rule.c
index e419b0a..c463c69 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -451,9 +451,10 @@ static int nft_rule_snprintf_xml(char *buf, size_t size, struct nft_rule *r,
 	SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 
 	ret = snprintf(buf+offset, len, "<rule_flags>%u</rule_flags>"
+					"<flags>%u</flags>"
 					"<compat_flags>%u</compat_flags>"
 					"<compat_proto>%u</compat_proto>",
-					r->rule_flags,
+					r->rule_flags, r->flags,
 					r->compat.flags, r->compat.proto);
 	SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 
@@ -469,7 +470,7 @@ static int nft_rule_snprintf_xml(char *buf, size_t size, struct nft_rule *r,
 		SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 
 	}
-	ret = snprintf(buf+offset-1, len, "\n</rule>\n ");
+	ret = snprintf(buf+offset, len, "\n</rule>\n ");
 	SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 
 	return ret;

--
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




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux