diff options
author | Arturo Borrero <arturo.borrero.glez@gmail.com> | 2014-01-15 11:42:17 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-01-15 14:07:52 +0100 |
commit | 16c04f3be3f9596f065a75fad2cfb8a37ab53b24 (patch) | |
tree | f6ba0e152ab0a8ce97efae97b9da89f189e53c80 /src/expr/byteorder.c | |
parent | 8ef53967043455bca4e53ec9acea8bd5d492f36c (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/byteorder.c')
-rw-r--r-- | src/expr/byteorder.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/expr/byteorder.c b/src/expr/byteorder.c index d6beba3..49ae38f 100644 --- a/src/expr/byteorder.c +++ b/src/expr/byteorder.c @@ -246,17 +246,18 @@ nft_rule_expr_byteorder_xml_parse(struct nft_rule_expr *e, mxml_node_t *tree, #ifdef XML_PARSING struct nft_expr_byteorder *byteorder = nft_expr_data(e); const char *op; - int32_t reg, ntoh; + int32_t ntoh; + uint32_t reg; - reg = nft_mxml_reg_parse(tree, "sreg", MXML_DESCEND_FIRST, err); - if (reg < 0) + if (nft_mxml_reg_parse(tree, "sreg", ®, MXML_DESCEND_FIRST, + NFT_XML_MAND, err) != 0) return -1; byteorder->sreg = reg; e->flags |= (1 << NFT_EXPR_BYTEORDER_SREG); - reg = nft_mxml_reg_parse(tree, "dreg", MXML_DESCEND, err); - if (reg < 0) + if (nft_mxml_reg_parse(tree, "dreg", ®, MXML_DESCEND, NFT_XML_MAND, + err) != 0) return -1; byteorder->dreg = reg; |