Re: [PATCH 3/3 v2] nftables: rule: Change the field "rule->comment" for an nftnl_attrbuf.

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

 



On 02/03/16 19:37, Pablo Neira Ayuso wrote:
On Mon, Feb 29, 2016 at 05:25:40PM +0100, Carlos Falgueras García wrote:
diff --git a/src/rule.c b/src/rule.c
index 18ff592..499fa7b 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -23,6 +23,7 @@

  #include <libnftnl/common.h>
  #include <libnftnl/ruleset.h>
+#include <libnftnl/attr.h>
  #include <netinet/ip.h>
  #include <linux/netfilter.h>
  #include <linux/netfilter_arp.h>
@@ -366,6 +367,7 @@ struct rule *rule_alloc(const struct location *loc, const struct handle *h)
  	rule->location = *loc;
  	init_list_head(&rule->list);
  	init_list_head(&rule->stmts);
+	rule->udata = NULL;
  	if (h != NULL)
  		rule->handle = *h;
  	return rule;
@@ -375,21 +377,53 @@ void rule_free(struct rule *rule)
  {
  	stmt_list_free(&rule->stmts);
  	handle_free(&rule->handle);
-	xfree(rule->comment);
+	nftnl_attrbuf_free(rule->udata);

I would rename this function to:

         nftnl_udata_free();

So all functions that now refer to nftnl_attrbuf_* look like:

         nftnl_udata_*()

then, to push/retrieve attributes, I would use the prefix:

         nftnl_udata_attr_*()

I renamed all functions following these rule except "nftnl_udata_attr_put" which I changed to "nftnl_udata_put" because functions like "nftnl_udata_attr_put_strz" would have very long name. It is ok?
--
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