Skip to contentSkip to conversation

src: expr: log: fixed error in nft_rule_expr_log_build

PATCH Applied Ana Rey 2 participants 2 messages Nov 19, 2013 netfilter

lore
Share & tools
lore

Ana Rey

author
#0 lore raw

PATCH 1/1 src: expr: log: fixed error in nft_rule_expr_log_build

If I run my automatic unit test of libnftable, It shows:
"ERROR: Expr NFT_EXPR_LOG_PREFIX mismatches"
a: test
b: test

The problem was in nft_rule_expr_log_build function.

With the attached patch, we use "mnl_attr_put_strz" in instead of "mnl_attr_put_str".

---
 src/expr/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/expr/log.c +1 -1
index 495c1bd..76657a9 100644
@@ -119,7 +119,7 @@ nft_rule_expr_log_build(struct nlmsghdr *nlh, struct nft_rule_expr *e)
 	struct nft_expr_log *log = nft_expr_data(e);
 
 	if (e->flags & (1 << NFT_EXPR_LOG_PREFIX))
-		mnl_attr_put_str(nlh, NFTA_LOG_PREFIX, log->prefix);
+		mnl_attr_put_strz(nlh, NFTA_LOG_PREFIX, log->prefix);
 	if (e->flags & (1 << NFT_EXPR_LOG_GROUP))
 		mnl_attr_put_u16(nlh, NFTA_LOG_GROUP, htons(log->group));
 	if (e->flags & (1 << NFT_EXPR_LOG_SNAPLEN))
Signature · 1 line
1.8.4.rc3
maintainer Applied
#1 lore raw
Quoted 9 lines · Ana Rey

If I run my automatic unit test of libnftable, It shows:
"ERROR: Expr NFT_EXPR_LOG_PREFIX mismatches"
a: test
b: test

The problem was in nft_rule_expr_log_build function.

With the attached patch, we use "mnl_attr_put_strz" in instead of "mnl_attr_put_str".

Applied, thanks.