[libnftnl PATCH 2/4] expr: match: Use nft_rule_expr_set_* in the xml parsing code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Code refactoring to use nft_rule_expr_set_* in parse functions.

Signed-off-by: Ana Rey <anarey@xxxxxxxxx>
---
 src/expr/match.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/expr/match.c b/src/expr/match.c
index 05f9aff..572d0f9 100644
--- a/src/expr/match.c
+++ b/src/expr/match.c
@@ -194,17 +194,13 @@ static int nft_rule_expr_match_xml_parse(struct nft_rule_expr *e, mxml_node_t *t
 					 struct nft_parse_err *err)
 {
 #ifdef XML_PARSING
-	struct nft_expr_match *mt = nft_expr_data(e);
 	const char *name;
 
 	name = nft_mxml_str_parse(tree, "name", MXML_DESCEND_FIRST,
 				  NFT_XML_MAND, err);
 	if (name == NULL)
 		return -1;
-
-	strncpy(mt->name, name, XT_EXTENSION_MAXNAMELEN);
-	mt->name[XT_EXTENSION_MAXNAMELEN-1] = '\0';
-	e->flags |= (1 << NFT_EXPR_MT_NAME);
+	nft_rule_expr_set_str(e, NFT_EXPR_MT_NAME, name);
 
 	/* mt->info is ignored until other solution is reached */
 
-- 
2.0.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux