summaryrefslogtreecommitdiffstats
path: root/src/expr/cmp.c
diff options
context:
space:
mode:
authorAna Rey <anarey@gmail.com>2014-04-09 11:16:19 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2014-04-14 10:46:06 +0200
commit1a0abb3036452852757d13fe394c6c72dff877bd (patch)
treea9d8902e2725659d274d4830cf8809ed34c4b160 /src/expr/cmp.c
parent5d20b27ac4365ab153afe476895926ede9b74528 (diff)
xml, json: Delete a cmpdata label in xml and json file
It delete the cmpdata label in the structure of json and xml file. Example of xmlfile: The old structure of xml file: [...] <expr type="cmp"> <sreg>1</sreg> <op>eq</op> <cmpdata> <data_reg type="value"> <len>4</len> <data0>0x0100a8c0</data0> </data_reg> </cmpdata> </expr> The new structure of json file: [...] <expr type="cmp"> <sreg>1</sreg> <op>eq</op> <data_reg type="value"> <len>4</len> <data0>0x0100a8c0</data0> </data_reg> </expr> [...] To generate the new testfiles, It use the option -u of nft-parsing-test script. Signed-off-by: Ana Rey <anarey@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/expr/cmp.c')
-rw-r--r--src/expr/cmp.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/expr/cmp.c b/src/expr/cmp.c
index 63250f3..2c334ab 100644
--- a/src/expr/cmp.c
+++ b/src/expr/cmp.c
@@ -258,7 +258,7 @@ nft_rule_expr_cmp_snprintf_json(char *buf, size_t size, struct nft_expr_cmp *cmp
{
int len = size, offset = 0, ret;
- ret = snprintf(buf, len, "\"sreg\":%u,\"op\":\"%s\",\"cmpdata\":{",
+ ret = snprintf(buf, len, "\"sreg\":%u,\"op\":\"%s\",",
cmp->sreg, expr_cmp_str[cmp->op]);
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
@@ -266,9 +266,6 @@ nft_rule_expr_cmp_snprintf_json(char *buf, size_t size, struct nft_expr_cmp *cmp
NFT_OUTPUT_JSON, 0, DATA_VALUE);
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
- ret = snprintf(buf+offset, len, "}");
- SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
-
return offset;
}
@@ -277,7 +274,7 @@ nft_rule_expr_cmp_snprintf_xml(char *buf, size_t size, struct nft_expr_cmp *cmp)
{
int len = size, offset = 0, ret;
- ret = snprintf(buf, len, "<sreg>%u</sreg><op>%s</op><cmpdata>",
+ ret = snprintf(buf, len, "<sreg>%u</sreg><op>%s</op>",
cmp->sreg, expr_cmp_str[cmp->op]);
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
@@ -285,9 +282,6 @@ nft_rule_expr_cmp_snprintf_xml(char *buf, size_t size, struct nft_expr_cmp *cmp)
NFT_OUTPUT_XML, 0, DATA_VALUE);
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
- ret = snprintf(buf+offset, len, "</cmpdata>");
- SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
-
return offset;
}