[nftables] netlink: use libnl OBJ_CAST macro

Patrick McHardy netfilter-cvslog-bounces at lists.netfilter.org
Wed Apr 1 07:44:33 CEST 2009


Gitweb:		http://git.netfilter.org/cgi-bin/gitweb.cgi?p=nftables.git;a=commit;h=9fe2e9d494a229a3f833add44d7242abe46aa156
commit 9fe2e9d494a229a3f833add44d7242abe46aa156
Author:     Patrick McHardy <kaber at trash.net>
AuthorDate: Tue Mar 31 04:14:21 2009 +0200
Commit:     Patrick McHardy <kaber at trash.net>
CommitDate: Tue Mar 31 04:14:21 2009 +0200

    netlink: use libnl OBJ_CAST macro
    
    Signed-off-by: Patrick McHardy <kaber at trash.net>
       via  9fe2e9d494a229a3f833add44d7242abe46aa156 (commit)
      from  6ed76e7024c2ec021ac0a4e08b1f0b26e98a01c5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9fe2e9d494a229a3f833add44d7242abe46aa156
Author: Patrick McHardy <kaber at trash.net>
Date:   Tue Mar 31 04:14:21 2009 +0200

    netlink: use libnl OBJ_CAST macro
    
    Signed-off-by: Patrick McHardy <kaber at trash.net>

-----------------------------------------------------------------------

 src/netlink.c           |   12 ++++--------
 src/netlink_linearize.c |    2 +-
 2 files changed, 5 insertions(+), 9 deletions(-)
Signed-off-by: Patrick McHardy <kaber at trash.net>

diff --git a/src/netlink.c b/src/netlink.c
index 7ba9011..548f4fb 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -199,8 +199,7 @@ static int netlink_list_rules(struct netlink_ctx *ctx, const struct handle *h)
 					nl_geterror(err));
 
 	nlr = alloc_nft_rule(h);
-	nl_cache_foreach_filter(rule_cache, (struct nl_object *)nlr,
-				list_rule_cb, ctx);
+	nl_cache_foreach_filter(rule_cache, OBJ_CAST(nlr), list_rule_cb, ctx);
 	nfnl_nft_rule_put(nlr);
 	nl_cache_free(rule_cache);
 	return 0;
@@ -254,8 +253,7 @@ static int netlink_flush_rules(struct netlink_ctx *ctx, const struct handle *h)
 					nl_geterror(err));
 
 	nlr = alloc_nft_rule(h);
-	nl_cache_foreach_filter(rule_cache, (struct nl_object *)nlr,
-				flush_rule_cb, ctx);
+	nl_cache_foreach_filter(rule_cache, OBJ_CAST(nlr), flush_rule_cb, ctx);
 	nfnl_nft_rule_put(nlr);
 	nl_cache_free(rule_cache);
 	return 0;
@@ -332,8 +330,7 @@ int netlink_list_chains(struct netlink_ctx *ctx, const struct handle *h)
 					nl_geterror(err));
 
 	nlc = alloc_nft_chain(h);
-	nl_cache_foreach_filter(chain_cache, (struct nl_object *)nlc,
-				list_chain_cb, ctx);
+	nl_cache_foreach_filter(chain_cache, OBJ_CAST(nlc), list_chain_cb, ctx);
 	nfnl_nft_chain_put(nlc);
 	nl_cache_free(chain_cache);
 	return 0;
@@ -436,8 +433,7 @@ int netlink_list_tables(struct netlink_ctx *ctx, const struct handle *h)
 					nl_geterror(err));
 
 	nlt = alloc_nft_table(h);
-	nl_cache_foreach_filter(table_cache, (struct nl_object *)nlt,
-				list_table_cb, ctx);
+	nl_cache_foreach_filter(table_cache, OBJ_CAST(nlt), list_table_cb, ctx);
 	nfnl_nft_table_put(nlt);
 	nl_cache_free(table_cache);
 	return 0;
diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
index 0a28b29..0b3f819 100644
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
@@ -714,7 +714,7 @@ int netlink_linearize_rule(struct netlink_ctx *ctx, struct nfnl_nft_rule *nlr,
 		netlink_gen_stmt(&lctx, stmt);
 
 #ifdef DEBUG
-	netlink_dump_object((struct nl_object *)nlr);
+	netlink_dump_object(OBJ_CAST(nlr));
 #endif
 	return 0;
 }



More information about the netfilter-cvslog mailing list