Skip to contentSkip to conversation

use nftnl_ prefix

PATCH In review Pablo Neira Ayuso 2 participants 6 messages Sep 2, 2015 – Sep 15, 2015 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

cover use nftnl_ prefix

This patchset renames the existing functions and definitions to use the nftnl_ prefix to prepare the introduction of the higher level library, which will use the nft_ prefix.

The patchset does not break backward compatibility: Neither compilation not existing binaries.

The patchset keeps the nft_ symbols around as aliases for the nftnl_ symbols. Moreover, the header files contain the old nft_ definitions so clients of this library don't break all of a sudden.

Please, let me know if you observe any problem with this. I would like that this changes are pushed to master before the next release.

Thanks.

Pablo Neira Ayuso (3):
src: introduce nftnl_* aliases for all existing functions
src: rename existing functions to use the nftnl_ prefix
src: add compat header file definitions

 examples/nft-chain-add.c          |   28 +-
 examples/nft-chain-del.c          |   24 +-
 examples/nft-chain-get.c          |   28 +-
 examples/nft-chain-parse-add.c    |   38 +-
 examples/nft-events.c             |   72 ++--
 examples/nft-rule-add.c           |   68 +--
 examples/nft-rule-del.c           |   22 +-
 examples/nft-rule-get.c           |   18 +-
 examples/nft-rule-parse-add.c     |   40 +-
 examples/nft-ruleset-get.c        |  146 +++----
 examples/nft-ruleset-parse-file.c |  186 ++++----
 examples/nft-set-add.c            |   32 +-
 examples/nft-set-del.c            |   14 +-
 examples/nft-set-elem-add.c       |   28 +-
 examples/nft-set-elem-del.c       |   28 +-
 examples/nft-set-elem-get.c       |   26 +-
 examples/nft-set-get.c            |   24 +-
 examples/nft-set-parse-add.c      |   38 +-
 examples/nft-table-add.c          |   26 +-
 examples/nft-table-del.c          |   26 +-
 examples/nft-table-get.c          |   26 +-
 examples/nft-table-parse-add.c    |   36 +-
 examples/nft-table-upd.c          |   14 +-
 include/buffer.h                  |   34 +-
 include/common.h                  |   18 +-
 include/data_reg.h                |    8 +-
 include/expr.h                    |    6 +-
 include/expr_ops.h                |   26 +-
 include/json.h                    |   86 ++--
 include/libnftnl/batch.h          |   16 +
 include/libnftnl/chain.h          |   77 ++++
 include/libnftnl/common.h         |   53 +++
 include/libnftnl/expr.h           |  168 ++++++++
 include/libnftnl/gen.h            |   36 ++
 include/libnftnl/rule.h           |   83 ++++
 include/libnftnl/ruleset.h        |   61 +++
 include/libnftnl/set.h            |  136 ++++++
 include/libnftnl/table.h          |   65 +++
 include/set.h                     |    8 +-
 include/set_elem.h                |    8 +-
 include/utils.h                   |   54 +--
 include/xml.h                     |   74 ++--
 src/batch.c                       |   69 +--
 src/buffer.c                      |  114 ++---
 src/chain.c                       |  663 ++++++++++++++---------------
 src/common.c                      |  108 +++--
 src/expr.c                        |  108 ++---
 src/expr/bitwise.c                |  202 ++++-----
 src/expr/byteorder.c              |  192 ++++-----
 src/expr/cmp.c                    |  152 +++----
 src/expr/counter.c                |  120 +++---
 src/expr/ct.c                     |  174 ++++----
 src/expr/data_reg.c               |  150 +++----
 src/expr/dynset.c                 |  218 +++++-----
 src/expr/exthdr.c                 |  168 ++++----
 src/expr/immediate.c              |  196 ++++-----
 src/expr/limit.c                  |  120 +++---
 src/expr/log.c                    |  222 +++++-----
 src/expr/lookup.c                 |  148 +++----
 src/expr/masq.c                   |  100 ++---
 src/expr/match.c                  |  114 ++---
 src/expr/meta.c                   |  150 +++----
 src/expr/nat.c                    |  250 +++++------
 src/expr/payload.c                |  168 ++++----
 src/expr/queue.c                  |  150 +++----
 src/expr/redir.c                  |  148 +++----
 src/expr/reject.c                 |  120 +++---
 src/expr/target.c                 |  114 ++---
 src/expr_ops.c                    |    2 +-
 src/gen.c                         |  106 ++---
 src/jansson.c                     |  114 ++---
 src/libnftnl.map                  |  260 ++++++++++++
 src/mxml.c                        |   86 ++--
 src/rule.c                        |  612 +++++++++++++-------------
 src/ruleset.c                     |  848 ++++++++++++++++++-------------------
 src/set.c                         |  712 +++++++++++++++----------------
 src/set_elem.c                    |  462 ++++++++++----------
 src/table.c                       |  376 ++++++++--------
 src/utils.c                       |  125 +++---
 tests/nft-chain-test.c            |   92 ++--
 tests/nft-expr_bitwise-test.c     |   78 ++--
 tests/nft-expr_byteorder-test.c   |   78 ++--
 tests/nft-expr_cmp-test.c         |   66 +--
 tests/nft-expr_counter-test.c     |   60 +--
 tests/nft-expr_ct-test.c          |   66 +--
 tests/nft-expr_exthdr-test.c      |   72 ++--
 tests/nft-expr_immediate-test.c   |   72 ++--
 tests/nft-expr_limit-test.c       |   60 +--
 tests/nft-expr_log-test.c         |   72 ++--
 tests/nft-expr_lookup-test.c      |   66 +--
 tests/nft-expr_masq-test.c        |   54 +--
 tests/nft-expr_match-test.c       |   66 +--
 tests/nft-expr_meta-test.c        |   60 +--
 tests/nft-expr_nat-test.c         |   90 ++--
 tests/nft-expr_payload-test.c     |   72 ++--
 tests/nft-expr_queue-test.c       |   62 +--
 tests/nft-expr_redir-test.c       |   66 +--
 tests/nft-expr_reject-test.c      |   60 +--
 tests/nft-expr_target-test.c      |   66 +--
 tests/nft-parsing-test.c          |   50 +--
 tests/nft-rule-test.c             |   62 +--
 tests/nft-set-test.c              |   62 +--
 tests/nft-table-test.c            |   40 +-
 103 files changed, 6346 insertions(+), 5392 deletions(-)
Signature · 1 line
1.7.10.4
author maintainer
#1 lore raw

PATCH 1/3 src: introduce nftnl_* aliases for all existing functions

This patch introduces the nftnl_ symbols as aliases for the existing nft_ symbols through the EXPORT_SYMBOL(...) macro.

We would like to use the nft_* prefix from our upcoming higher level library, meanwhile with this move we avoid that old binaries break because of missing symbol dependencies.

---
 include/utils.h  |    2 +-
 src/batch.c      |   14 +--
 src/chain.c      |   68 +++++++-------
 src/common.c     |   14 +--
 src/expr.c       |   32 +++----
 src/gen.c        |   26 +++---
 src/libnftnl.map |  260 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/rule.c       |   74 ++++++++--------
 src/ruleset.c    |   32 +++----
 src/set.c        |   64 +++++++-------
 src/set_elem.c   |   48 +++++-----
 src/table.c      |   60 ++++++-------
 12 files changed, 477 insertions(+), 217 deletions(-)
include/utils.h +1 -1
index 380b020..fad64e8 100644
@@ -10,7 +10,7 @@
 #include "config.h"
 #ifdef HAVE_VISIBILITY_HIDDEN
 #	define __visible	__attribute__((visibility("default")))
-#	define EXPORT_SYMBOL(x)	typeof(x) (x) __visible
+#	define EXPORT_SYMBOL(y, x)	typeof(x) (x) __visible; __typeof (x) y __attribute ((alias (#x), visibility ("default")))
 #else
 #	define EXPORT_SYMBOL
 #endif
src/batch.c +7 -7
index ec9f728..3f53218 100644
@@ -80,7 +80,7 @@ err1:
 	free(batch);
 	return NULL;
 }
-EXPORT_SYMBOL(nft_batch_alloc);
+EXPORT_SYMBOL(nftnl_batch_alloc, nft_batch_alloc);
 
 void nft_batch_free(struct nft_batch *batch)
 {
@@ -94,7 +94,7 @@ void nft_batch_free(struct nft_batch *batch)
 
 	free(batch);
 }
-EXPORT_SYMBOL(nft_batch_free);
+EXPORT_SYMBOL(nftnl_batch_free, nft_batch_free);
 
 int nft_batch_update(struct nft_batch *batch)
 {
@@ -119,19 +119,19 @@ int nft_batch_update(struct nft_batch *batch)
 err1:
 	return -1;
 }
-EXPORT_SYMBOL(nft_batch_update);
+EXPORT_SYMBOL(nftnl_batch_update, nft_batch_update);
 
 void *nft_batch_buffer(struct nft_batch *batch)
 {
 	return mnl_nlmsg_batch_current(batch->current_page->batch);
 }
-EXPORT_SYMBOL(nft_batch_buffer);
+EXPORT_SYMBOL(nftnl_batch_buffer, nft_batch_buffer);
 
 uint32_t nft_batch_buffer_len(struct nft_batch *batch)
 {
 	return mnl_nlmsg_batch_size(batch->current_page->batch);
 }
-EXPORT_SYMBOL(nft_batch_buffer_len);
+EXPORT_SYMBOL(nftnl_batch_buffer_len, nft_batch_buffer_len);
 
 int nft_batch_iovec_len(struct nft_batch *batch)
 {
@@ -143,7 +143,7 @@ int nft_batch_iovec_len(struct nft_batch *batch)
 
 	return num_pages;
 }
-EXPORT_SYMBOL(nft_batch_iovec_len);
+EXPORT_SYMBOL(nftnl_batch_iovec_len, nft_batch_iovec_len);
 
 void nft_batch_iovec(struct nft_batch *batch, struct iovec *iov, uint32_t iovlen)
 {
@@ -159,4 +159,4 @@ void nft_batch_iovec(struct nft_batch *batch, struct iovec *iov, uint32_t iovlen
 		i++;
 	}
 }
-EXPORT_SYMBOL(nft_batch_iovec);
+EXPORT_SYMBOL(nftnl_batch_iovec, nft_batch_iovec);
src/chain.c +34 -34

256 lines not on this page · raw message

src/common.c +7 -7
index d69b522..27f9177 100644
@@ -40,7 +40,7 @@ struct nlmsghdr *nft_nlmsg_build_hdr(char *buf, uint16_t cmd, uint16_t family,
 
 	return nlh;
 }
-EXPORT_SYMBOL(nft_nlmsg_build_hdr);
+EXPORT_SYMBOL(nftnl_nlmsg_build_hdr, nft_nlmsg_build_hdr);
 
 struct nft_parse_err *nft_parse_err_alloc(void)
 {
@@ -54,13 +54,13 @@ struct nft_parse_err *nft_parse_err_alloc(void)
 
 	return err;
 }
-EXPORT_SYMBOL(nft_parse_err_alloc);
+EXPORT_SYMBOL(nftnl_parse_err_alloc, nft_parse_err_alloc);
 
 void nft_parse_err_free(struct nft_parse_err *err)
 {
 	xfree(err);
 }
-EXPORT_SYMBOL(nft_parse_err_free);
+EXPORT_SYMBOL(nftnl_parse_err_free, nft_parse_err_free);
 
 int nft_parse_perror(const char *msg, struct nft_parse_err *err)
 {
@@ -80,7 +80,7 @@ int nft_parse_perror(const char *msg, struct nft_parse_err *err)
 		return fprintf(stderr, "%s: Undefined error\n", msg);
 	}
 }
-EXPORT_SYMBOL(nft_parse_perror);
+EXPORT_SYMBOL(nftnl_parse_perror, nft_parse_perror);
 
 int nft_cmd_header_snprintf(char *buf, size_t size, uint32_t cmd, uint32_t type,
 			    uint32_t flags)
@@ -178,13 +178,13 @@ void nft_batch_begin(char *buf, uint32_t seq)
 {
 	nft_batch_build_hdr(buf, NFNL_MSG_BATCH_BEGIN, seq);
 }
-EXPORT_SYMBOL(nft_batch_begin);
+EXPORT_SYMBOL(nftnl_batch_begin, nft_batch_begin);
 
 void nft_batch_end(char *buf, uint32_t seq)
 {
 	nft_batch_build_hdr(buf, NFNL_MSG_BATCH_END, seq);
 }
-EXPORT_SYMBOL(nft_batch_end);
+EXPORT_SYMBOL(nftnl_batch_end, nft_batch_end);
 
 int nft_batch_is_supported(void)
 {
@@ -243,4 +243,4 @@ err:
 	mnl_nlmsg_batch_stop(b);
 	return -1;
 }
-EXPORT_SYMBOL(nft_batch_is_supported);
+EXPORT_SYMBOL(nftnl_batch_is_supported, nft_batch_is_supported);
src/expr.c +16 -16
index 4109495..7731a85 100644
@@ -43,7 +43,7 @@ struct nft_rule_expr *nft_rule_expr_alloc(const char *name)
 
 	return expr;
 }
-EXPORT_SYMBOL(nft_rule_expr_alloc);
+EXPORT_SYMBOL(nftnl_rule_expr_alloc, nft_rule_expr_alloc);
 
 void nft_rule_expr_free(struct nft_rule_expr *expr)
 {
@@ -52,13 +52,13 @@ void nft_rule_expr_free(struct nft_rule_expr *expr)
 
 	xfree(expr);
 }
-EXPORT_SYMBOL(nft_rule_expr_free);
+EXPORT_SYMBOL(nftnl_rule_expr_free, nft_rule_expr_free);
 
 bool nft_rule_expr_is_set(const struct nft_rule_expr *expr, uint16_t type)
 {
 	return expr->flags & (1 << type);
 }
-EXPORT_SYMBOL(nft_rule_expr_is_set);
+EXPORT_SYMBOL(nftnl_rule_expr_is_set, nft_rule_expr_is_set);
 
 void
 nft_rule_expr_set(struct nft_rule_expr *expr, uint16_t type,
@@ -73,42 +73,42 @@ nft_rule_expr_set(struct nft_rule_expr *expr, uint16_t type,
 	}
 	expr->flags |= (1 << type);
 }
-EXPORT_SYMBOL(nft_rule_expr_set);
+EXPORT_SYMBOL(nftnl_rule_expr_set, nft_rule_expr_set);
 
 void
 nft_rule_expr_set_u8(struct nft_rule_expr *expr, uint16_t type, uint8_t data)
 {
 	nft_rule_expr_set(expr, type, &data, sizeof(uint8_t));
 }
-EXPORT_SYMBOL(nft_rule_expr_set_u8);
+EXPORT_SYMBOL(nftnl_rule_expr_set_u8, nft_rule_expr_set_u8);
 
 void
 nft_rule_expr_set_u16(struct nft_rule_expr *expr, uint16_t type, uint16_t data)
 {
 	nft_rule_expr_set(expr, type, &data, sizeof(uint16_t));
 }
-EXPORT_SYMBOL(nft_rule_expr_set_u16);
+EXPORT_SYMBOL(nftnl_rule_expr_set_u16, nft_rule_expr_set_u16);
 
 void
 nft_rule_expr_set_u32(struct nft_rule_expr *expr, uint16_t type, uint32_t data)
 {
 	nft_rule_expr_set(expr, type, &data, sizeof(uint32_t));
 }
-EXPORT_SYMBOL(nft_rule_expr_set_u32);
+EXPORT_SYMBOL(nftnl_rule_expr_set_u32, nft_rule_expr_set_u32);
 
 void
 nft_rule_expr_set_u64(struct nft_rule_expr *expr, uint16_t type, uint64_t data)
 {
 	nft_rule_expr_set(expr, type, &data, sizeof(uint64_t));
 }
-EXPORT_SYMBOL(nft_rule_expr_set_u64);
+EXPORT_SYMBOL(nftnl_rule_expr_set_u64, nft_rule_expr_set_u64);
 
 void
 nft_rule_expr_set_str(struct nft_rule_expr *expr, uint16_t type, const char *str)
 {
 	nft_rule_expr_set(expr, type, str, strlen(str)+1);
 }
-EXPORT_SYMBOL(nft_rule_expr_set_str);
+EXPORT_SYMBOL(nftnl_rule_expr_set_str, nft_rule_expr_set_str);
 
 const void *nft_rule_expr_get(const struct nft_rule_expr *expr,
 			      uint16_t type, uint32_t *data_len)
@@ -129,7 +129,7 @@ const void *nft_rule_expr_get(const struct nft_rule_expr *expr,
 
 	return ret;
 }
-EXPORT_SYMBOL(nft_rule_expr_get);
+EXPORT_SYMBOL(nftnl_rule_expr_get, nft_rule_expr_get);
 
 uint8_t nft_rule_expr_get_u8(const struct nft_rule_expr *expr, uint16_t type)
 {
@@ -145,7 +145,7 @@ uint8_t nft_rule_expr_get_u8(const struct nft_rule_expr *expr, uint16_t type)
 
 	return *((uint8_t *)data);
 }
-EXPORT_SYMBOL(nft_rule_expr_get_u8);
+EXPORT_SYMBOL(nftnl_rule_expr_get_u8, nft_rule_expr_get_u8);
 
 uint16_t nft_rule_expr_get_u16(const struct nft_rule_expr *expr, uint16_t type)
 {
@@ -161,7 +161,7 @@ uint16_t nft_rule_expr_get_u16(const struct nft_rule_expr *expr, uint16_t type)
 
 	return *((uint16_t *)data);
 }
-EXPORT_SYMBOL(nft_rule_expr_get_u16);
+EXPORT_SYMBOL(nftnl_rule_expr_get_u16, nft_rule_expr_get_u16);
 
 uint32_t nft_rule_expr_get_u32(const struct nft_rule_expr *expr, uint16_t type)
 {
@@ -177,7 +177,7 @@ uint32_t nft_rule_expr_get_u32(const struct nft_rule_expr *expr, uint16_t type)
 
 	return *((uint32_t *)data);
 }
-EXPORT_SYMBOL(nft_rule_expr_get_u32);
+EXPORT_SYMBOL(nftnl_rule_expr_get_u32, nft_rule_expr_get_u32);
 
 uint64_t nft_rule_expr_get_u64(const struct nft_rule_expr *expr, uint16_t type)
 {
@@ -193,7 +193,7 @@ uint64_t nft_rule_expr_get_u64(const struct nft_rule_expr *expr, uint16_t type)
 
 	return *((uint64_t *)data);
 }
-EXPORT_SYMBOL(nft_rule_expr_get_u64);
+EXPORT_SYMBOL(nftnl_rule_expr_get_u64, nft_rule_expr_get_u64);
 
 const char *nft_rule_expr_get_str(const struct nft_rule_expr *expr, uint16_t type)
 {
@@ -201,7 +201,7 @@ const char *nft_rule_expr_get_str(const struct nft_rule_expr *expr, uint16_t typ
 
 	return (const char *)nft_rule_expr_get(expr, type, &data_len);
 }
-EXPORT_SYMBOL(nft_rule_expr_get_str);
+EXPORT_SYMBOL(nftnl_rule_expr_get_str, nft_rule_expr_get_str);
 
 void
 nft_rule_expr_build_payload(struct nlmsghdr *nlh, struct nft_rule_expr *expr)
@@ -273,4 +273,4 @@ int nft_rule_expr_snprintf(char *buf, size_t size, struct nft_rule_expr *expr,
 
 	return offset;
 }
-EXPORT_SYMBOL(nft_rule_expr_snprintf);
+EXPORT_SYMBOL(nftnl_rule_expr_snprintf, nft_rule_expr_snprintf);
src/gen.c +13 -13
index 10a647a..2c9e561 100644
@@ -33,19 +33,19 @@ struct nft_gen *nft_gen_alloc(void)
 {
 	return calloc(1, sizeof(struct nft_gen));
 }
-EXPORT_SYMBOL(nft_gen_alloc);
+EXPORT_SYMBOL(nftnl_gen_alloc, nft_gen_alloc);
 
 void nft_gen_free(struct nft_gen *gen)
 {
 	xfree(gen);
 }
-EXPORT_SYMBOL(nft_gen_free);
+EXPORT_SYMBOL(nftnl_gen_free, nft_gen_free);
 
 bool nft_gen_attr_is_set(const struct nft_gen *gen, uint16_t attr)
 {
 	return gen->flags & (1 << attr);
 }
-EXPORT_SYMBOL(nft_gen_attr_is_set);
+EXPORT_SYMBOL(nftnl_gen_attr_is_set, nft_gen_attr_is_set);
 
 void nft_gen_attr_unset(struct nft_gen *gen, uint16_t attr)
 {
@@ -58,7 +58,7 @@ void nft_gen_attr_unset(struct nft_gen *gen, uint16_t attr)
 	}
 	gen->flags &= ~(1 << attr);
 }
-EXPORT_SYMBOL(nft_gen_attr_unset);
+EXPORT_SYMBOL(nftnl_gen_attr_unset, nft_gen_attr_unset);
 
 static uint32_t nft_gen_attr_validate[NFT_GEN_MAX + 1] = {
 	[NFT_GEN_ID]	= sizeof(uint32_t),
@@ -79,19 +79,19 @@ void nft_gen_attr_set_data(struct nft_gen *gen, uint16_t attr,
 	}
 	gen->flags |= (1 << attr);
 }
-EXPORT_SYMBOL(nft_gen_attr_set_data);
+EXPORT_SYMBOL(nftnl_gen_attr_set_data, nft_gen_attr_set_data);
 
 void nft_gen_attr_set(struct nft_gen *gen, uint16_t attr, const void *data)
 {
 	nft_gen_attr_set_data(gen, attr, data, nft_gen_attr_validate[attr]);
 }
-EXPORT_SYMBOL(nft_gen_attr_set);
+EXPORT_SYMBOL(nftnl_gen_attr_set, nft_gen_attr_set);
 
 void nft_gen_attr_set_u32(struct nft_gen *gen, uint16_t attr, uint32_t val)
 {
 	nft_gen_attr_set_data(gen, attr, &val, sizeof(uint32_t));
 }
-EXPORT_SYMBOL(nft_gen_attr_set_u32);
+EXPORT_SYMBOL(nftnl_gen_attr_set_u32, nft_gen_attr_set_u32);
 
 const void *nft_gen_attr_get_data(struct nft_gen *gen, uint16_t attr,
 				  uint32_t *data_len)
@@ -105,21 +105,21 @@ const void *nft_gen_attr_get_data(struct nft_gen *gen, uint16_t attr,
 	}
 	return NULL;
 }
-EXPORT_SYMBOL(nft_gen_attr_get_data);
+EXPORT_SYMBOL(nftnl_gen_attr_get_data, nft_gen_attr_get_data);
 
 const void *nft_gen_attr_get(struct nft_gen *gen, uint16_t attr)
 {
 	uint32_t data_len;
 	return nft_gen_attr_get_data(gen, attr, &data_len);
 }
-EXPORT_SYMBOL(nft_gen_attr_get);
+EXPORT_SYMBOL(nftnl_gen_attr_get, nft_gen_attr_get);
 
 uint32_t nft_gen_attr_get_u32(struct nft_gen *gen, uint16_t attr)
 {
 	const void *ret = nft_gen_attr_get(gen, attr);
 	return ret == NULL ? 0 : *((uint32_t *)ret);
 }
-EXPORT_SYMBOL(nft_gen_attr_get_u32);
+EXPORT_SYMBOL(nftnl_gen_attr_get_u32, nft_gen_attr_get_u32);
 
 static int nft_gen_parse_attr_cb(const struct nlattr *attr, void *data)
 {
@@ -154,7 +154,7 @@ int nft_gen_nlmsg_parse(const struct nlmsghdr *nlh, struct nft_gen *gen)
 	}
 	return 0;
 }
-EXPORT_SYMBOL(nft_gen_nlmsg_parse);
+EXPORT_SYMBOL(nftnl_gen_nlmsg_parse, nft_gen_nlmsg_parse);
 
 static int nft_gen_snprintf_default(char *buf, size_t size, struct nft_gen *gen)
 {
@@ -190,7 +190,7 @@ int nft_gen_snprintf(char *buf, size_t size, struct nft_gen *gen, uint32_t type,
 	return nft_gen_cmd_snprintf(buf, size, gen, nft_flag2cmd(flags), type,
 				    flags);
 }
-EXPORT_SYMBOL(nft_gen_snprintf);
+EXPORT_SYMBOL(nftnl_gen_snprintf, nft_gen_snprintf);
 
 static inline int nft_gen_do_snprintf(char *buf, size_t size, void *gen,
 				      uint32_t cmd, uint32_t type,
@@ -205,4 +205,4 @@ int nft_gen_fprintf(FILE *fp, struct nft_gen *gen, uint32_t type,
 	return nft_fprintf(fp, gen, NFT_CMD_UNSPEC, type, flags,
 			   nft_gen_do_snprintf);
 }
-EXPORT_SYMBOL(nft_gen_fprintf);
+EXPORT_SYMBOL(nftnl_gen_fprintf, nft_gen_fprintf);
src/libnftnl.map +260 -0

282 lines not on this page · raw message

src/rule.c +37 -37

279 lines not on this page · raw message

src/ruleset.c +16 -16
index e7f9204..42fe9e6 100644
@@ -62,7 +62,7 @@ struct nft_ruleset *nft_ruleset_alloc(void)
 {
 	return calloc(1, sizeof(struct nft_ruleset));
 }
-EXPORT_SYMBOL(nft_ruleset_alloc);
+EXPORT_SYMBOL(nftnl_ruleset_alloc, nft_ruleset_alloc);
 
 void nft_ruleset_free(struct nft_ruleset *r)
 {
@@ -76,13 +76,13 @@ void nft_ruleset_free(struct nft_ruleset *r)
 		nft_rule_list_free(r->rule_list);
 	xfree(r);
 }
-EXPORT_SYMBOL(nft_ruleset_free);
+EXPORT_SYMBOL(nftnl_ruleset_free, nft_ruleset_free);
 
 bool nft_ruleset_attr_is_set(const struct nft_ruleset *r, uint16_t attr)
 {
 	return r->flags & (1 << attr);
 }
-EXPORT_SYMBOL(nft_ruleset_attr_is_set);
+EXPORT_SYMBOL(nftnl_ruleset_attr_is_set, nft_ruleset_attr_is_set);
 
 void nft_ruleset_attr_unset(struct nft_ruleset *r, uint16_t attr)
 {
@@ -109,7 +109,7 @@ void nft_ruleset_attr_unset(struct nft_ruleset *r, uint16_t attr)
 	}
 	r->flags &= ~(1 << attr);
 }
-EXPORT_SYMBOL(nft_ruleset_attr_unset);
+EXPORT_SYMBOL(nftnl_ruleset_attr_unset, nft_ruleset_attr_unset);
 
 void nft_ruleset_attr_set(struct nft_ruleset *r, uint16_t attr, void *data)
 {
@@ -135,7 +135,7 @@ void nft_ruleset_attr_set(struct nft_ruleset *r, uint16_t attr, void *data)
 	}
 	r->flags |= (1 << attr);
 }
-EXPORT_SYMBOL(nft_ruleset_attr_set);
+EXPORT_SYMBOL(nftnl_ruleset_attr_set, nft_ruleset_attr_set);
 
 void *nft_ruleset_attr_get(const struct nft_ruleset *r, uint16_t attr)
 {
@@ -155,7 +155,7 @@ void *nft_ruleset_attr_get(const struct nft_ruleset *r, uint16_t attr)
 		return NULL;
 	}
 }
-EXPORT_SYMBOL(nft_ruleset_attr_get);
+EXPORT_SYMBOL(nftnl_ruleset_attr_get, nft_ruleset_attr_get);
 
 void nft_ruleset_ctx_free(const struct nft_parse_ctx *ctx)
 {
@@ -178,13 +178,13 @@ void nft_ruleset_ctx_free(const struct nft_parse_ctx *ctx)
 		break;
 	}
 }
-EXPORT_SYMBOL(nft_ruleset_ctx_free);
+EXPORT_SYMBOL(nftnl_ruleset_ctx_free, nft_ruleset_ctx_free);
 
 bool nft_ruleset_ctx_is_set(const struct nft_parse_ctx *ctx, uint16_t attr)
 {
 	return ctx->flags & (1 << attr);
 }
-EXPORT_SYMBOL(nft_ruleset_ctx_is_set);
+EXPORT_SYMBOL(nftnl_ruleset_ctx_is_set, nft_ruleset_ctx_is_set);
 
 void *nft_ruleset_ctx_get(const struct nft_parse_ctx *ctx, uint16_t attr)
 {
@@ -210,14 +210,14 @@ void *nft_ruleset_ctx_get(const struct nft_parse_ctx *ctx, uint16_t attr)
 		return NULL;
 	}
 }
-EXPORT_SYMBOL(nft_ruleset_ctx_get);
+EXPORT_SYMBOL(nftnl_ruleset_ctx_get, nft_ruleset_ctx_get);
 
 uint32_t nft_ruleset_ctx_get_u32(const struct nft_parse_ctx *ctx, uint16_t attr)
 {
 	const void *ret = nft_ruleset_ctx_get(ctx, attr);
 	return ret == NULL ? 0 : *((uint32_t *)ret);
 }
-EXPORT_SYMBOL(nft_ruleset_ctx_get_u32);
+EXPORT_SYMBOL(nftnl_ruleset_ctx_get_u32, nft_ruleset_ctx_get_u32);
 
 #if defined(JSON_PARSING) || defined(XML_PARSING)
 static void nft_ruleset_ctx_set(struct nft_parse_ctx *ctx, uint16_t attr,
@@ -751,7 +751,7 @@ int nft_ruleset_parse_file_cb(enum nft_parse_type type, FILE *fp,
 {
 	return nft_ruleset_do_parse(type, fp, err, NFT_PARSE_FILE, data, cb);
 }
-EXPORT_SYMBOL(nft_ruleset_parse_file_cb);
+EXPORT_SYMBOL(nftnl_ruleset_parse_file_cb, nft_ruleset_parse_file_cb);
 
 int nft_ruleset_parse_buffer_cb(enum nft_parse_type type, const char *buffer,
 				struct nft_parse_err *err, void *data,
@@ -760,7 +760,7 @@ int nft_ruleset_parse_buffer_cb(enum nft_parse_type type, const char *buffer,
 	return nft_ruleset_do_parse(type, buffer, err, NFT_PARSE_BUFFER, data,
 				    cb);
 }
-EXPORT_SYMBOL(nft_ruleset_parse_buffer_cb);
+EXPORT_SYMBOL(nftnl_ruleset_parse_buffer_cb, nft_ruleset_parse_buffer_cb);
 
 static int nft_ruleset_cb(const struct nft_parse_ctx *ctx)
 {
@@ -828,14 +828,14 @@ int nft_ruleset_parse(struct nft_ruleset *r, enum nft_parse_type type,
 {
 	return nft_ruleset_parse_buffer_cb(type, data, err, r, nft_ruleset_cb);
 }
-EXPORT_SYMBOL(nft_ruleset_parse);
+EXPORT_SYMBOL(nftnl_ruleset_parse, nft_ruleset_parse);
 
 int nft_ruleset_parse_file(struct nft_ruleset *rs, enum nft_parse_type type,
 			   FILE *fp, struct nft_parse_err *err)
 {
 	return nft_ruleset_parse_file_cb(type, fp, err, rs, nft_ruleset_cb);
 }
-EXPORT_SYMBOL(nft_ruleset_parse_file);
+EXPORT_SYMBOL(nftnl_ruleset_parse_file, nft_ruleset_parse_file);
 
 static const char *nft_ruleset_o_opentag(uint32_t type)
 {
@@ -1097,7 +1097,7 @@ int nft_ruleset_snprintf(char *buf, size_t size, const struct nft_ruleset *r,
 		return -1;
 	}
 }
-EXPORT_SYMBOL(nft_ruleset_snprintf);
+EXPORT_SYMBOL(nftnl_ruleset_snprintf, nft_ruleset_snprintf);
 
 static int nft_ruleset_fprintf_tables(FILE *fp, const struct nft_ruleset *rs,
 				      uint32_t type, uint32_t flags)
@@ -1317,4 +1317,4 @@ int nft_ruleset_fprintf(FILE *fp, const struct nft_ruleset *rs, uint32_t type,
 	return nft_ruleset_cmd_fprintf(fp, rs, nft_flag2cmd(flags), type,
 				       flags);
 }
-EXPORT_SYMBOL(nft_ruleset_fprintf);
+EXPORT_SYMBOL(nftnl_ruleset_fprintf, nft_ruleset_fprintf);
src/set.c +32 -32

243 lines not on this page · raw message

src/set_elem.c +24 -24

183 lines not on this page · raw message

src/table.c +30 -30

226 lines not on this page · raw message

Signature · 1 line
1.7.10.4
author maintainer
#2 lore raw
In reply to Pablo Neira Ayuso
Quoted 7 lines · Pablo Neira Ayuso

This patchset renames the existing functions and definitions to use the nftnl_ prefix to prepare the introduction of the higher level library, which will use the nft_ prefix.

The patchset does not break backward compatibility: Neither compilation not existing binaries.

Quoted 6 lines

The patchset keeps the nft_ symbols around as aliases for the nftnl_ symbols. Moreover, the header files contain the old nft_ definitions so clients of this library don't break all of a sudden.

Please, let me know if you observe any problem with this. I would like that this changes are pushed to master before the next release.

Just pushed out this branch:

http://git.netfilter.org/libnftnl/log/?h=nftnl

Just in case the largest Patch 2/3 does not reach the list.

author maintainer
#3 lore raw

Hi,

Quoted 12 lines · Pablo Neira Ayuso
Quoted 11 lines · Pablo Neira Ayuso

This patchset renames the existing functions and definitions to use the nftnl_ prefix to prepare the introduction of the higher level library, which will use the nft_ prefix.

The patchset does not break backward compatibility: Neither compilation not existing binaries.

The patchset keeps the nft_ symbols around as aliases for the nftnl_ symbols. Moreover, the header files contain the old nft_ definitions so clients of this library don't break all of a sudden.

Quoted 6 lines
Quoted 2 lines

Please, let me know if you observe any problem with this. I would like that this changes are pushed to master before the next release.

Just pushed out this branch:

http://git.netfilter.org/libnftnl/log/?h=nftnl

I'm pushing four more patches into this branch before we make the next release on top of the brand new patches to use the nftnl_ prefix instead as Patrick suggested.

Not sending them to the mailing list, they are large as the previous and they are renaming things:

1) src: rename nftnl_rule_expr to nftnl_expr

The nftnl_rule_expr is not restricted anymore to the scope of rules since it can be used from sets, so let's get rid of the _rule_ infix to get it shorter.

2) src: rename NFTNL_RULE_EXPR_ATTR to NFTNL_EXPR_

Same as 1, but for constants.

3) src: get rid of _ATTR_ infix in new nfntl_ definitions

Remove the infix _ATTR_, the constant definitions have a large name, so let's reduce it a bit.

4) src: get rid of _attr_ infix in new nftnl_ definitions

Similar to 3. Note that after this we've got things like:

        nft_set_set_u32(...)

Please, let me know if you have more renaming suggestions since libnftnl will be out soon and it would be great if we can avoid this stuff in the future.

Thanks.

#4 lore raw
Quoted 5 lines · Pablo Neira Ayuso

Please, let me know if you have more renaming suggestions since libnftnl will be out soon and it would be great if we can avoid this stuff in the future.

Perhaps:

nftnl_rule_u64_set(...)
nftnl_rule_u64_get(...)
nftnl_set_u32_set(...)
nftnl_set_u32_get(...)
...

Signature · 5 lines
Arturo Borrero González
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#5 lore raw
In reply to Pablo Neira Ayuso
Quoted 18 lines · Pablo Neira Ayuso

Hi,

Quoted 15 lines · Pablo Neira Ayuso
Quoted 13 lines · Pablo Neira Ayuso

This patchset renames the existing functions and definitions to use the nftnl_ prefix to prepare the introduction of the higher level library, which will use the nft_ prefix.

The patchset does not break backward compatibility: Neither compilation not existing binaries.

The patchset keeps the nft_ symbols around as aliases for the nftnl_ symbols. Moreover, the header files contain the old nft_ definitions so clients of this library don't break all of a sudden.

Please, let me know if you observe any problem with this. I would like that this changes are pushed to master before the next release.

Quoted 7 lines
Quoted 3 lines

Just pushed out this branch:

http://git.netfilter.org/libnftnl/log/?h=nftnl

I'm pushing four more patches into this branch before we make the next release on top of the brand new patches to use the nftnl_ prefix instead as Patrick suggested.

I have pushed these two patches to the 'nftnl' branch in both cases:

http://git.netfilter.org/nftables/commit/?h=nftnl&id=830693fe7b02aae554178dfd7220b6e779434eef
http://git.netfilter.org/iptables/commit/?h=nftnl&id=7babe09c9cfaa288c8502613340c9b35b29617bc

They are adapting the code to use the new symbols in libnftnl. They are slightly large, so I preferred to send it in this way.