summaryrefslogtreecommitdiffstats
path: root/src/expr/bitwise.c
diff options
context:
space:
mode:
authorArturo Borrero <arturo.borrero.glez@gmail.com>2013-07-25 18:46:35 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2013-07-25 20:03:21 +0200
commite13819c5f5b6138c4c7e01156d0fd9f58b11702d (patch)
treec4bbc0256f537099a8233915597419843359793b /src/expr/bitwise.c
parent3ebc57b84c227fcfc55545af85e246ab4cad2041 (diff)
src: xml: consolidate common XML code via nft_mxml_num_parse
This patch moves common XML parsing code to nft_mxml_num_parse(). To handle this, the nft_strtoi() helper fuction is included. I've changed some MXML_DESCEND[_FIRST] flags to avoid match a nested node under some circumstances, ie, matching two nodes with the same name that are descendant. 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/bitwise.c')
-rw-r--r--src/expr/bitwise.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/expr/bitwise.c b/src/expr/bitwise.c
index 84de249..f0a2eff 100644
--- a/src/expr/bitwise.c
+++ b/src/expr/bitwise.c
@@ -201,6 +201,12 @@ nft_rule_expr_bitwise_xml_parse(struct nft_rule_expr *e, mxml_node_t *tree)
bitwise->dreg = reg;
e->flags |= (1 << NFT_EXPR_BITWISE_DREG);
+ if (nft_mxml_num_parse(tree, "len", MXML_DESCEND_FIRST,
+ BASE_DEC, &bitwise->len, NFT_TYPE_U8) != 0)
+ return -1;
+
+ e->flags |= (1 << NFT_EXPR_BITWISE_LEN);
+
if (nft_mxml_data_reg_parse(tree, "mask",
&bitwise->mask) != DATA_VALUE)
return -1;