netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [libnftnl PATCH] examples: nft-rule-parse-add: fix wrong buffer usage when building rule header
@ 2014-11-17  9:26 Arturo Borrero Gonzalez
  2014-11-17 10:52 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Arturo Borrero Gonzalez @ 2014-11-17  9:26 UTC (permalink / raw)
  To: netfilter-devel; +Cc: pablo

The libmnl helper returns a pointer where to start putting the rule data.

CC: Ian Bishop <ian@pace7.com>
Closes: http://bugzilla.netfilter.org/show_bug.cgi?id=983
Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
 examples/nft-rule-parse-add.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/nft-rule-parse-add.c b/examples/nft-rule-parse-add.c
index 4160435..75f5268 100644
--- a/examples/nft-rule-parse-add.c
+++ b/examples/nft-rule-parse-add.c
@@ -122,7 +122,8 @@ int main(int argc, char *argv[])
 
 	rule_seq = seq;
 	family = nft_rule_attr_get_u32(r, NFT_RULE_ATTR_FAMILY);
-	nlh = nft_rule_nlmsg_build_hdr(buf, NFT_MSG_NEWRULE, family,
+	nlh = nft_rule_nlmsg_build_hdr(mnl_nlmsg_batch_current(batch),
+				       NFT_MSG_NEWRULE, family,
 				       NLM_F_CREATE|NLM_F_APPEND|NLM_F_ACK,
 				       seq++);
 	nft_rule_nlmsg_build_payload(nlh, r);


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [libnftnl PATCH] examples: nft-rule-parse-add: fix wrong buffer usage when building rule header
  2014-11-17  9:26 [libnftnl PATCH] examples: nft-rule-parse-add: fix wrong buffer usage when building rule header Arturo Borrero Gonzalez
@ 2014-11-17 10:52 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2014-11-17 10:52 UTC (permalink / raw)
  To: Arturo Borrero Gonzalez; +Cc: netfilter-devel

On Mon, Nov 17, 2014 at 10:26:41AM +0100, Arturo Borrero Gonzalez wrote:
> The libmnl helper returns a pointer where to start putting the rule data.

Thanks Arturo.

I think it would be good to get rid of the -parse-* examples and
replace them by one using the ruleset API.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-17 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17  9:26 [libnftnl PATCH] examples: nft-rule-parse-add: fix wrong buffer usage when building rule header Arturo Borrero Gonzalez
2014-11-17 10:52 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).