diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-07-04 16:10:24 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-07-04 16:47:58 +0200 |
commit | 556fb7ee694a0f18cbd3d73ac96b27c74081bd6d (patch) | |
tree | a5148ca080d15ea122473186baacc3fd5bd2138c /src/expr/exthdr.c | |
parent | d844fa06e43bc80487acfe5647cef4d4994c95fd (diff) |
src: consolidate XML parsing of expressions via nft_mxml_reg_parse
This patch reduces the XML code in 100 LOC.
Diffstat (limited to 'src/expr/exthdr.c')
-rw-r--r-- | src/expr/exthdr.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/expr/exthdr.c b/src/expr/exthdr.c index e7f4fab..6055067 100644 --- a/src/expr/exthdr.c +++ b/src/expr/exthdr.c @@ -219,24 +219,14 @@ nft_rule_expr_exthdr_xml_parse(struct nft_rule_expr *e, mxml_node_t *tree) mxml_node_t *node = NULL; uint64_t tmp; char *endptr; + int32_t reg; int type; - /* All nodes are mandatory */ - - /* Get and set <dreg> */ - node = mxmlFindElement(tree, tree, "dreg", NULL, NULL, - MXML_DESCEND_FIRST); - if (node == NULL) - return -1; - - tmp = strtoull(node->child->value.opaque, &endptr, 10); - if (tmp > UINT32_MAX || tmp < 0 || *endptr) - return -1; - - if (tmp > NFT_REG_MAX) + reg = nft_mxml_reg_parse(tree, "dreg", MXML_DESCEND_FIRST); + if (reg < 0) return -1; - exthdr->dreg = tmp; + exthdr->dreg = reg; e->flags |= (1 << NFT_EXPR_EXTHDR_DREG); /* Get and set <exthdr_type> */ |