[libnftnl PATCH 2/4] expr: target: 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/target.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/expr/target.c b/src/expr/target.c
index 8a9f8b0..da25e68 100644
--- a/src/expr/target.c
+++ b/src/expr/target.c
@@ -195,7 +195,6 @@ nft_rule_expr_target_xml_parse(struct nft_rule_expr *e, mxml_node_t *tree,
 			       struct nft_parse_err *err)
 {
 #ifdef XML_PARSING
-	struct nft_expr_target *tg = nft_expr_data(e);
 	const char *name;
 
 	name = nft_mxml_str_parse(tree, "name", MXML_DESCEND_FIRST,
@@ -203,9 +202,7 @@ nft_rule_expr_target_xml_parse(struct nft_rule_expr *e, mxml_node_t *tree,
 	if (name == NULL)
 		return -1;
 
-	strncpy(tg->name, name, XT_EXTENSION_MAXNAMELEN);
-	tg->name[XT_EXTENSION_MAXNAMELEN-1] = '\0';
-	e->flags |= (1 << NFT_EXPR_TG_NAME);
+	nft_rule_expr_set_str(e, NFT_EXPR_TG_NAME, name);
 
 	/* tg->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