summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>2013-08-05 14:01:28 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2013-08-05 14:29:14 +0200
commitb3e73fda10db2b1aa2ef26690bf285839e4ea22a (patch)
tree698e12091152ab0e59047566e50233c63cb0fbf6 /src
parentd7d29351d57864c2d71a5d83f9d7aae092e2b9e4 (diff)
src: xml: table/chain delete properties
This patch deletes the <properties> node in chain and table XML objects. For this to work, the first tree search with MXML_DESCEND_FIRST flag is moved to the next node. Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/chain.c18
-rw-r--r--src/table.c17
2 files changed, 10 insertions, 25 deletions
diff --git a/src/chain.c b/src/chain.c
index c24aeb0..1964353 100644
--- a/src/chain.c
+++ b/src/chain.c
@@ -648,12 +648,9 @@ static int nft_chain_xml_parse(struct nft_chain *c, char *xml)
c->packets = utmp;
c->flags |= (1 << NFT_CHAIN_ATTR_PACKETS);
- /* Ignore <properties> node */
- node = mxmlFindElement(tree, tree, "properties", NULL, NULL,
- MXML_DESCEND_FIRST);
-
/* Get and set <type> */
- node = mxmlFindElement(tree, tree, "type", NULL, NULL, MXML_DESCEND);
+ node = mxmlFindElement(tree, tree, "type", NULL, NULL,
+ MXML_DESCEND_FIRST);
if (node == NULL) {
mxmlDelete(tree);
return -1;
@@ -820,12 +817,8 @@ static int nft_chain_snprintf_xml(char *buf, size_t size, struct nft_chain *c)
ret = snprintf(buf, size,
"<chain name=\"%s\" handle=\"%"PRIu64"\""
" bytes=\"%"PRIu64"\" packets=\"%"PRIu64"\">"
- "<properties>"
- "<type>%s</type>"
- "<table>%s</table>"
- "<prio>%d</prio>"
- "<use>%d</use>"
- "<hooknum>%s</hooknum>",
+ "<type>%s</type><table>%s</table><prio>%d</prio>"
+ "<use>%d</use><hooknum>%s</hooknum>",
c->name, c->handle, c->bytes, c->packets,
c->type, c->table,
c->prio, c->use, hooknum2str_array[c->hooknum]);
@@ -842,8 +835,7 @@ static int nft_chain_snprintf_xml(char *buf, size_t size, struct nft_chain *c)
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
}
- ret = snprintf(buf+offset, size, "<family>%s</family>"
- "</properties></chain>",
+ ret = snprintf(buf+offset, size, "<family>%s</family></chain>",
nft_family2str(c->family));
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
diff --git a/src/table.c b/src/table.c
index 402e8c1..76a1b4b 100644
--- a/src/table.c
+++ b/src/table.c
@@ -244,12 +244,9 @@ static int nft_table_xml_parse(struct nft_table *t, char *xml)
t->name = strdup(mxmlElementGetAttr(tree, "name"));
t->flags |= (1 << NFT_TABLE_ATTR_NAME);
- /* Ignore <properties> node */
- node = mxmlFindElement(tree, tree, "properties", NULL, NULL,
- MXML_DESCEND_FIRST);
-
/* Get the and set <family> node */
- node = mxmlFindElement(tree, tree, "family", NULL, NULL, MXML_DESCEND);
+ node = mxmlFindElement(tree, tree, "family", NULL, NULL,
+ MXML_DESCEND_FIRST);
if (node == NULL) {
mxmlDelete(tree);
return -1;
@@ -363,13 +360,9 @@ static int nft_table_snprintf_json(char *buf, size_t size, struct nft_table *t)
static int nft_table_snprintf_xml(char *buf, size_t size, struct nft_table *t)
{
- return snprintf(buf, size, "<table name=\"%s\">"
- "<properties>"
- "<family>%s</family>"
- "<table_flags>%d</table_flags>"
- "</properties>"
- "</table>",
- t->name, nft_family2str(t->family), t->table_flags);
+ return snprintf(buf, size, "<table name=\"%s\"><family>%s</family>"
+ "<table_flags>%d</table_flags></table>",
+ t->name, nft_family2str(t->family), t->table_flags);
}
static int nft_table_snprintf_default(char *buf, size_t size, struct nft_table *t)