From: Arturo Borrero <arturo.borrero.glez@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: pablo@netfilter.org
Subject: [libnftables PATCH 1/5] src: rule: small fix XML output
Date: Wed, 10 Apr 2013 18:39:57 +0200 [thread overview]
Message-ID: <20130410163957.6303.44318.stgit@nfdev.cica.es> (raw)
In-Reply-To: <20130410163912.6303.8705.stgit@nfdev.cica.es>
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@gmail.com>
---
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-04-10 16:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 16:39 [libnftables PATCH 0/5] XML works Arturo Borrero
2013-04-10 16:39 ` Arturo Borrero [this message]
2013-04-18 23:32 ` [libnftables PATCH 1/5] src: rule: small fix XML output Pablo Neira Ayuso
2013-04-10 16:40 ` [libnftables PATCH 2/5] src: expr: XML printing for binary data in targer and match Arturo Borrero
2013-04-10 16:40 ` [libnftables PATCH 3/5] src: xml printing: delete text format Arturo Borrero
2013-04-19 0:00 ` Pablo Neira Ayuso
2013-04-10 16:40 ` [libnftables PATCH 4/5] src: expr: print flags in XML Arturo Borrero
2013-04-10 16:40 ` [libnftables PATCH 5/5] src: support for XML parsing Arturo Borrero
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=20130410163957.6303.44318.stgit@nfdev.cica.es \
--to=arturo.borrero.glez@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).