summaryrefslogtreecommitdiffstats
path: root/src/expr/cmp.c
diff options
context:
space:
mode:
authorArturo Borrero <arturo.borrero.glez@gmail.com>2014-01-15 11:42:17 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2014-01-15 14:07:52 +0100
commit16c04f3be3f9596f065a75fad2cfb8a37ab53b24 (patch)
treef6ba0e152ab0a8ce97efae97b9da89f189e53c80 /src/expr/cmp.c
parent8ef53967043455bca4e53ec9acea8bd5d492f36c (diff)
mxml: add optional/mandatory flag to nft_mxml_reg_parse
There are some cases where a reg is not mandatory, for example: * dreg in lookup * dreg/sreg in meta (last version) So, lets change the function nft_mxml_reg_parse() to add an optional/mandatory flag. dreg in lookup is optional as stated at: net/netfilter/nft_lookup.c:nft_lookup_init() Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/expr/cmp.c')
-rw-r--r--src/expr/cmp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/expr/cmp.c b/src/expr/cmp.c
index b5c694a..ebd3e5c 100644
--- a/src/expr/cmp.c
+++ b/src/expr/cmp.c
@@ -217,10 +217,11 @@ static int nft_rule_expr_cmp_xml_parse(struct nft_rule_expr *e, mxml_node_t *tre
#ifdef XML_PARSING
struct nft_expr_cmp *cmp = nft_expr_data(e);
const char *op;
- int32_t reg, op_value;
+ int32_t op_value;
+ uint32_t reg;
- reg = nft_mxml_reg_parse(tree, "sreg", MXML_DESCEND_FIRST, err);
- if (reg < 0)
+ if (nft_mxml_reg_parse(tree, "sreg", &reg, MXML_DESCEND_FIRST,
+ NFT_XML_MAND, err) != 0)
return -1;
cmp->sreg = reg;