From: Arturo Borrero <arturo.borrero.glez@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: pablo@netfilter.org
Subject: [libnftables PATCH 4/5] expr: xml: don't print target&match info
Date: Mon, 03 Jun 2013 22:44:55 +0200 [thread overview]
Message-ID: <20130603204455.27713.59163.stgit@nfdev.cica.es> (raw)
In-Reply-To: <20130603204451.27713.51887.stgit@nfdev.cica.es>
As is not supported in parsing, don't print at all target&match <info> attribute.
However, I think this could be easily supported, with the drawback of having a XML file full of binary data.
Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
src/expr/match.c | 12 +-----------
src/expr/target.c | 12 +-----------
2 files changed, 2 insertions(+), 22 deletions(-)
diff --git a/src/expr/match.c b/src/expr/match.c
index edb78ea..4f8d8fc 100644
--- a/src/expr/match.c
+++ b/src/expr/match.c
@@ -245,22 +245,12 @@ static int nft_rule_expr_match_snprintf_xml(char *buf, size_t len,
struct nft_expr_match *mt)
{
int ret, size=len;
- int i;
int offset = 0;
- uint8_t *data = (uint8_t *)mt->data;
- ret = snprintf(buf, len, "<name>%s</name><rev>%u</rev><info>0x",
+ ret = snprintf(buf, len, "<name>%s</name><rev>%u</rev>",
mt->name, mt->rev);
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
- for (i=0; i < mt->data_len; i++) {
- ret = snprintf(buf+offset, len, "%x", data[i] & 0xff);
- SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
- }
-
- ret = snprintf(buf+offset, len, "</info>");
- SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
-
return offset;
}
diff --git a/src/expr/target.c b/src/expr/target.c
index 6652c47..bcdf034 100644
--- a/src/expr/target.c
+++ b/src/expr/target.c
@@ -249,22 +249,12 @@ int nft_rule_exp_target_snprintf_xml(char *buf, size_t len,
struct nft_expr_target *tg)
{
int ret, size=len;
- int i;
int offset = 0;
- uint8_t *data = (uint8_t *)tg->data;
- ret = snprintf(buf, len, "<name>%s</name><rev>%u</rev><info>0x",
+ ret = snprintf(buf, len, "<name>%s</name><rev>%u</rev>",
tg->name, tg->rev);
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
- for (i=0; i < tg->data_len; i++) {
- ret = snprintf(buf+offset, len, "%x", data[i] & 0xff);
- SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
- }
-
- ret = snprintf(buf+offset, len, "</info>");
- SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
-
return offset;
}
next prev parent reply other threads:[~2013-06-03 20:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-03 20:44 [libnftables PATCH 1/5] data_reg: xml: fix bytes movements Arturo Borrero
2013-06-03 20:44 ` [libnftables PATCH 2/5] rule: fix snprintf return value Arturo Borrero
2013-06-05 3:09 ` Pablo Neira Ayuso
2013-06-03 20:44 ` [libnftables PATCH 3/5] src: xml: set errno to EINVAL when invalid parsing Arturo Borrero
2013-06-05 3:38 ` Pablo Neira Ayuso
2013-06-03 20:44 ` Arturo Borrero [this message]
2013-06-03 20:44 ` [libnftables PATCH 5/5] examples: get XML ruleset 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=20130603204455.27713.59163.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).