netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libnetfilter_cttimeout] Use __EXPORTED rather than EXPORT_SYMBOL
@ 2017-01-04 22:30 Kevin Cernekee
  2017-01-04 22:30 ` [PATCH libnetfilter_cthelper] " Kevin Cernekee
  2017-01-16 13:30 ` [PATCH libnetfilter_cttimeout] " Pablo Neira Ayuso
  0 siblings, 2 replies; 4+ messages in thread
From: Kevin Cernekee @ 2017-01-04 22:30 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

clang is sensitive to the ordering of
__attribute__((visibility("default"))) relative to the function
body.  gcc is not.  So if we try to re-declare an existing function
with default visibility, clang prints a warning and generates
a broken .so file in which nfct_timeout_* are not exported to library
callers.

Move the attribute up into the function definition to make clang happy.

Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
---
 doxygen.cfg.in               |  2 +-
 src/internal.h               |  5 ++---
 src/libnetfilter_cttimeout.c | 44 +++++++++++++++++---------------------------
 3 files changed, 20 insertions(+), 31 deletions(-)

diff --git a/doxygen.cfg.in b/doxygen.cfg.in
index 8e5d4495eb41..09c3ce00e422 100644
--- a/doxygen.cfg.in
+++ b/doxygen.cfg.in
@@ -72,7 +72,7 @@ RECURSIVE              = YES
 EXCLUDE                = 
 EXCLUDE_SYMLINKS       = NO
 EXCLUDE_PATTERNS       = */.git/* .*.d
-EXCLUDE_SYMBOLS        = EXPORT_SYMBOL nfct_timeout _container_policy_cb
+EXCLUDE_SYMBOLS        = nfct_timeout _container_policy_cb
 EXAMPLE_PATH           = 
 EXAMPLE_PATTERNS       = 
 EXAMPLE_RECURSIVE      = NO
diff --git a/src/internal.h b/src/internal.h
index 3a88d1a1f7d8..5d781718ddad 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -3,10 +3,9 @@
 
 #include "config.h"
 #ifdef HAVE_VISIBILITY_HIDDEN
-#	define __visible	__attribute__((visibility("default")))
-#	define EXPORT_SYMBOL(x)	typeof(x) (x) __visible
+#	define __EXPORTED	__attribute__((visibility("default")))
 #else
-#	define EXPORT_SYMBOL
+#	define __EXPORTED
 #endif
 
 #endif
diff --git a/src/libnetfilter_cttimeout.c b/src/libnetfilter_cttimeout.c
index 7844a1f9c19a..a0a71851b0eb 100644
--- a/src/libnetfilter_cttimeout.c
+++ b/src/libnetfilter_cttimeout.c
@@ -187,7 +187,7 @@ struct nfct_timeout {
  * In case of success, this function returns a valid pointer, otherwise NULL
  * s returned and errno is appropriately set.
  */
-struct nfct_timeout *nfct_timeout_alloc(void)
+struct nfct_timeout __EXPORTED *nfct_timeout_alloc(void)
 {
 	struct nfct_timeout *t;
 
@@ -197,19 +197,17 @@ struct nfct_timeout *nfct_timeout_alloc(void)
 
 	return t;
 }
-EXPORT_SYMBOL(nfct_timeout_alloc);
 
 /**
  * nfct_timeout_free - release one conntrack timeout object
  * \param t pointer to the conntrack timeout object
  */
-void nfct_timeout_free(struct nfct_timeout *t)
+void __EXPORTED nfct_timeout_free(struct nfct_timeout *t)
 {
 	if (t->timeout)
 		free(t->timeout);
 	free(t);
 }
-EXPORT_SYMBOL(nfct_timeout_free);
 
 /**
  * nfct_timeout_attr_set - set one attribute of the conntrack timeout object
@@ -217,7 +215,7 @@ EXPORT_SYMBOL(nfct_timeout_free);
  * \param type attribute type you want to set
  * \param data pointer to data that will be used to set this attribute
  */
-int
+int __EXPORTED
 nfct_timeout_attr_set(struct nfct_timeout *t, uint32_t type, const void *data)
 {
 	switch(type) {
@@ -236,7 +234,6 @@ nfct_timeout_attr_set(struct nfct_timeout *t, uint32_t type, const void *data)
 	t->attrset |= (1 << type);
 	return 0;
 }
-EXPORT_SYMBOL(nfct_timeout_attr_set);
 
 /**
  * nfct_timeout_attr_set_u8 - set one attribute of the conntrack timeout object
@@ -244,12 +241,11 @@ EXPORT_SYMBOL(nfct_timeout_attr_set);
  * \param type attribute type you want to set
  * \param data pointer to data that will be used to set this attribute
  */
-int
+int __EXPORTED
 nfct_timeout_attr_set_u8(struct nfct_timeout *t, uint32_t type, uint8_t data)
 {
 	return nfct_timeout_attr_set(t, type, &data);
 }
-EXPORT_SYMBOL(nfct_timeout_attr_set_u8);
 
 /**
  * nfct_timeout_attr_set_u16 - set one attribute of the conntrack timeout object
@@ -257,23 +253,21 @@ EXPORT_SYMBOL(nfct_timeout_attr_set_u8);
  * \param type attribute type you want to set
  * \param data pointer to data that will be used to set this attribute
  */
-int
+int __EXPORTED
 nfct_timeout_attr_set_u16(struct nfct_timeout *t, uint32_t type, uint16_t data)
 {
 	return nfct_timeout_attr_set(t, type, &data);
 }
-EXPORT_SYMBOL(nfct_timeout_attr_set_u16);
 
 /**
  * nfct_timeout_attr_unset - unset one attribute of the conntrack timeout object
  * \param t pointer to the conntrack timeout object
  * \param type attribute type you want to set
  */
-void nfct_timeout_attr_unset(struct nfct_timeout *t, uint32_t type)
+void __EXPORTED nfct_timeout_attr_unset(struct nfct_timeout *t, uint32_t type)
 {
 	t->attrset &= ~(1 << type);
 }
-EXPORT_SYMBOL(nfct_timeout_attr_unset);
 
 /**
  * nfct_timeout_policy_attr_set_u32 - set one attribute of the policy
@@ -281,7 +275,7 @@ EXPORT_SYMBOL(nfct_timeout_attr_unset);
  * \param type attribute type you want to set
  * \param data data that will be used to set this attribute
  */
-int
+int __EXPORTED
 nfct_timeout_policy_attr_set_u32(struct nfct_timeout *t,
 				 uint32_t type, uint32_t data)
 {
@@ -319,18 +313,17 @@ nfct_timeout_policy_attr_set_u32(struct nfct_timeout *t,
 
 	return 0;
 }
-EXPORT_SYMBOL(nfct_timeout_policy_attr_set_u32);
 
 /**
  * nfct_timeout_policy_attr_unset - unset one attribute of the policy
  * \param t pointer to the conntrack timeout object
  * \param type attribute type you want to set
  */
-void nfct_timeout_policy_attr_unset(struct nfct_timeout *t, uint32_t type)
+void __EXPORTED
+nfct_timeout_policy_attr_unset(struct nfct_timeout *t, uint32_t type)
 {
 	t->attrset &= ~(1 << type);
 }
-EXPORT_SYMBOL(nfct_timeout_policy_attr_unset);
 
 /**
  * nfct_timeout_policy_attr_to_name - get state name from protocol state number
@@ -340,7 +333,8 @@ EXPORT_SYMBOL(nfct_timeout_policy_attr_unset);
  * This function returns NULL if unsupported protocol or state number is passed.
  * Otherwise, a pointer to valid string is returned.
  */
-const char *nfct_timeout_policy_attr_to_name(uint8_t l4proto, uint32_t state)
+const char __EXPORTED *
+nfct_timeout_policy_attr_to_name(uint8_t l4proto, uint32_t state)
 {
 	if (timeout_protocol[l4proto].state_to_name == NULL) {
 		printf("no array state name\n");
@@ -354,7 +348,6 @@ const char *nfct_timeout_policy_attr_to_name(uint8_t l4proto, uint32_t state)
 
 	return timeout_protocol[l4proto].state_to_name[state];
 }
-EXPORT_SYMBOL(nfct_timeout_policy_attr_to_name);
 
 /**
  * @}
@@ -438,8 +431,9 @@ nfct_timeout_snprintf_default(char *buf, size_t size,
  * This function returns -1 in case that some mandatory attributes are
  * missing. On sucess, it returns 0.
  */
-int nfct_timeout_snprintf(char *buf, size_t size, const struct nfct_timeout *t,
-			  unsigned int type, unsigned int flags)
+int __EXPORTED
+nfct_timeout_snprintf(char *buf, size_t size, const struct nfct_timeout *t,
+		      unsigned int type, unsigned int flags)
 {
 	int ret = 0;
 
@@ -454,7 +448,6 @@ int nfct_timeout_snprintf(char *buf, size_t size, const struct nfct_timeout *t,
 
 	return ret;
 }
-EXPORT_SYMBOL(nfct_timeout_snprintf);
 
 /**
  * @}
@@ -477,7 +470,7 @@ EXPORT_SYMBOL(nfct_timeout_snprintf);
  * - CTNL_MSG_TIMEOUT_GET: get conntrack timeout object.
  * - CTNL_MSG_TIMEOUT_DEL: delete conntrack timeout object.
  */
-struct nlmsghdr *
+struct nlmsghdr __EXPORTED *
 nfct_timeout_nlmsg_build_hdr(char *buf, uint8_t cmd,
 			     uint16_t flags, uint32_t seq)
 {
@@ -496,14 +489,13 @@ nfct_timeout_nlmsg_build_hdr(char *buf, uint8_t cmd,
 
 	return nlh;
 }
-EXPORT_SYMBOL(nfct_timeout_nlmsg_build_hdr);
 
 /**
  * nfct_timeout_nlmsg_build_payload - build payload from ct timeout object
  * \param nlh: netlink message that you want to use to add the payload.
  * \param t: pointer to a conntrack timeout object
  */
-void
+void __EXPORTED
 nfct_timeout_nlmsg_build_payload(struct nlmsghdr *nlh,
 				 const struct nfct_timeout *t)
 {
@@ -532,7 +524,6 @@ nfct_timeout_nlmsg_build_payload(struct nlmsghdr *nlh,
 	}
 
 }
-EXPORT_SYMBOL(nfct_timeout_nlmsg_build_payload);
 
 static int
 timeout_nlmsg_parse_attr_cb(const struct nlattr *attr, void *data)
@@ -629,7 +620,7 @@ timeout_parse_attr_data(struct nfct_timeout *t, const struct nlattr *nest)
  * This function returns -1 in case that some mandatory attributes are
  * missing. On sucess, it returns 0.
  */
-int
+int __EXPORTED
 nfct_timeout_nlmsg_parse_payload(const struct nlmsghdr *nlh,
 				 struct nfct_timeout *t)
 {
@@ -654,7 +645,6 @@ nfct_timeout_nlmsg_parse_payload(const struct nlmsghdr *nlh,
 	}
 	return 0;
 }
-EXPORT_SYMBOL(nfct_timeout_nlmsg_parse_payload);
 
 /**
  * @}
-- 
2.11.0.390.gc69c2f50cf-goog


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

* [PATCH libnetfilter_cthelper] Use __EXPORTED rather than EXPORT_SYMBOL
  2017-01-04 22:30 [PATCH libnetfilter_cttimeout] Use __EXPORTED rather than EXPORT_SYMBOL Kevin Cernekee
@ 2017-01-04 22:30 ` Kevin Cernekee
  2017-01-16 13:30   ` Pablo Neira Ayuso
  2017-01-16 13:30 ` [PATCH libnetfilter_cttimeout] " Pablo Neira Ayuso
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Cernekee @ 2017-01-04 22:30 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

clang is sensitive to the ordering of
__attribute__((visibility("default"))) relative to the function
body.  gcc is not.  So if we try to re-declare an existing function
with default visibility, clang prints a warning and generates
a broken .so file in which nfct_helper_* are not exported to library
callers.

Move the attribute up into the function definition to make clang happy.

Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
---
 doxygen.cfg.in              |  2 +-
 src/internal.h              |  5 ++-
 src/libnetfilter_cthelper.c | 83 ++++++++++++++++++---------------------------
 3 files changed, 36 insertions(+), 54 deletions(-)

diff --git a/doxygen.cfg.in b/doxygen.cfg.in
index cac9b0510b4d..190b7cd6e716 100644
--- a/doxygen.cfg.in
+++ b/doxygen.cfg.in
@@ -72,7 +72,7 @@ RECURSIVE              = YES
 EXCLUDE                = 
 EXCLUDE_SYMLINKS       = NO
 EXCLUDE_PATTERNS       = */.git/* .*.d
-EXCLUDE_SYMBOLS        = EXPORT_SYMBOL
+EXCLUDE_SYMBOLS        = 
 EXAMPLE_PATH           = 
 EXAMPLE_PATTERNS       = 
 EXAMPLE_RECURSIVE      = NO
diff --git a/src/internal.h b/src/internal.h
index 3a88d1a1f7d8..5d781718ddad 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -3,10 +3,9 @@
 
 #include "config.h"
 #ifdef HAVE_VISIBILITY_HIDDEN
-#	define __visible	__attribute__((visibility("default")))
-#	define EXPORT_SYMBOL(x)	typeof(x) (x) __visible
+#	define __EXPORTED	__attribute__((visibility("default")))
 #else
-#	define EXPORT_SYMBOL
+#	define __EXPORTED
 #endif
 
 #endif
diff --git a/src/libnetfilter_cthelper.c b/src/libnetfilter_cthelper.c
index f8f58e6c9c5e..af543a17fafa 100644
--- a/src/libnetfilter_cthelper.c
+++ b/src/libnetfilter_cthelper.c
@@ -99,17 +99,16 @@ struct nfct_helper {
  * In case of success, this function returns a valid pointer, otherwise NULL
  * s returned and errno is appropriately set.
  */
-struct nfct_helper *nfct_helper_alloc(void)
+struct nfct_helper __EXPORTED *nfct_helper_alloc(void)
 {
 	return calloc(1, sizeof(struct nfct_helper));
 }
-EXPORT_SYMBOL(nfct_helper_alloc);
 
 /**
  * nfct_helper_free - release one helper object
  * \param nfct_helper pointer to the helper object
  */
-void nfct_helper_free(struct nfct_helper *h)
+void __EXPORTED nfct_helper_free(struct nfct_helper *h)
 {
 	int i;
 
@@ -119,7 +118,6 @@ void nfct_helper_free(struct nfct_helper *h)
 	}
 	free(h);
 }
-EXPORT_SYMBOL(nfct_helper_free);
 
 /**
  * nfct_helper_policy_alloc - allocate a new helper policy object
@@ -127,21 +125,19 @@ EXPORT_SYMBOL(nfct_helper_free);
  * In case of success, this function returns a valid pointer, otherwise NULL
  * s returned and errno is appropriately set.
  */
-struct nfct_helper_policy *nfct_helper_policy_alloc(void)
+struct nfct_helper_policy __EXPORTED *nfct_helper_policy_alloc(void)
 {
 	return calloc(1, sizeof(struct nfct_helper_policy));
 }
-EXPORT_SYMBOL(nfct_helper_policy_alloc);
 
 /**
  * nfct_helper_free - release one helper policy object
  * \param nfct_helper pointer to the helper object
  */
-void nfct_helper_policy_free(struct nfct_helper_policy *p)
+void __EXPORTED nfct_helper_policy_free(struct nfct_helper_policy *p)
 {
 	free(p);
 }
-EXPORT_SYMBOL(nfct_helper_policy_free);
 
 /**
  * nfct_helper_policy_attr_set - set one attribute of the helper object
@@ -149,7 +145,7 @@ EXPORT_SYMBOL(nfct_helper_policy_free);
  * \param type attribute type you want to set
  * \param data pointer to data that will be used to set this attribute
  */
-void
+void __EXPORTED
 nfct_helper_policy_attr_set(struct nfct_helper_policy *p,
 			    enum nfct_helper_policy_attr_type type,
 			    const void *data)
@@ -170,7 +166,6 @@ nfct_helper_policy_attr_set(struct nfct_helper_policy *p,
 		break;
 	}
 }
-EXPORT_SYMBOL(nfct_helper_policy_attr_set);
 
 /**
  * nfct_helper_attr_set_str - set one attribute the helper object
@@ -178,23 +173,21 @@ EXPORT_SYMBOL(nfct_helper_policy_attr_set);
  * \param type attribute type you want to set
  * \param name string that will be used to set this attribute
  */
-void
+void __EXPORTED
 nfct_helper_policy_attr_set_str(struct nfct_helper_policy *p,
 				enum nfct_helper_policy_attr_type type,
 				const char *name)
 {
 	nfct_helper_policy_attr_set(p, type, name);
 }
-EXPORT_SYMBOL(nfct_helper_policy_attr_set_str);
 
-void
+void __EXPORTED
 nfct_helper_policy_attr_set_u32(struct nfct_helper_policy *p,
 				enum nfct_helper_policy_attr_type type,
 				uint32_t value)
 {
 	nfct_helper_policy_attr_set(p, type, &value);
 }
-EXPORT_SYMBOL(nfct_helper_policy_attr_set_u32);
 
 /**
  * nfct_helper_attr_set - set one attribute of the helper object
@@ -202,7 +195,7 @@ EXPORT_SYMBOL(nfct_helper_policy_attr_set_u32);
  * \param type attribute type you want to set
  * \param data pointer to data that will be used to set this attribute
  */
-void
+void __EXPORTED
 nfct_helper_attr_set(struct nfct_helper *h,
 		     enum nfct_helper_attr_type type, const void *data)
 {
@@ -250,7 +243,6 @@ nfct_helper_attr_set(struct nfct_helper *h,
 		break;
 	}
 }
-EXPORT_SYMBOL(nfct_helper_attr_set);
 
 /**
  * nfct_helper_attr_set_str - set one attribute the helper object
@@ -258,44 +250,40 @@ EXPORT_SYMBOL(nfct_helper_attr_set);
  * \param type attribute type you want to set
  * \param name string that will be used to set this attribute
  */
-void
+void __EXPORTED
 nfct_helper_attr_set_str(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type,
 		    const char *name)
 {
 	nfct_helper_attr_set(nfct_helper, type, name);
 }
-EXPORT_SYMBOL(nfct_helper_attr_set_str);
 
-void
+void __EXPORTED
 nfct_helper_attr_set_u8(struct nfct_helper *nfct_helper,
 			 enum nfct_helper_attr_type type, uint8_t value)
 {
 	nfct_helper_attr_set(nfct_helper, type, &value);
 }
-EXPORT_SYMBOL(nfct_helper_attr_set_u8);
 
-void
+void __EXPORTED
 nfct_helper_attr_set_u16(struct nfct_helper *nfct_helper,
 			 enum nfct_helper_attr_type type, uint16_t value)
 {
 	nfct_helper_attr_set(nfct_helper, type, &value);
 }
-EXPORT_SYMBOL(nfct_helper_attr_set_u16);
 
-void
+void __EXPORTED
 nfct_helper_attr_set_u32(struct nfct_helper *nfct_helper,
 			 enum nfct_helper_attr_type type, uint32_t value)
 {
 	nfct_helper_attr_set(nfct_helper, type, &value);
 }
-EXPORT_SYMBOL(nfct_helper_attr_set_u32);
 
 /**
  * nfct_helper_attr_unset - unset one attribute the helper object
  * \param nfct_helper pointer to the helper object
  * \param type attribute type you want to set
  */
-void
+void __EXPORTED
 nfct_helper_attr_unset(struct nfct_helper *nfct_helper, enum nfct_helper_attr_type type)
 {
 	switch(type) {
@@ -307,7 +295,6 @@ nfct_helper_attr_unset(struct nfct_helper *nfct_helper, enum nfct_helper_attr_ty
 		break;
 	}
 }
-EXPORT_SYMBOL(nfct_helper_attr_unset);
 
 /**
  * nfct_helper_attr_get - get one attribute the helper object
@@ -317,8 +304,9 @@ EXPORT_SYMBOL(nfct_helper_attr_unset);
  * This function returns a valid pointer to the attribute data. If a
  * unsupported attribute is used, this returns NULL.
  */
-const void *nfct_helper_attr_get(struct nfct_helper *helper,
-				 enum nfct_helper_attr_type type)
+const void __EXPORTED *
+nfct_helper_attr_get(struct nfct_helper *helper,
+		     enum nfct_helper_attr_type type)
 {
 	const void *ret = NULL;
 
@@ -358,7 +346,6 @@ const void *nfct_helper_attr_get(struct nfct_helper *helper,
 	}
 	return ret;
 }
-EXPORT_SYMBOL(nfct_helper_attr_get);
 
 /**
  * nfct_helper_attr_get_str - get one attribute the helper object
@@ -368,13 +355,12 @@ EXPORT_SYMBOL(nfct_helper_attr_get);
  * This function returns a valid pointer to the beginning of the string.
  * If the attribute is unsupported, this returns NULL.
  */
-const char *
+const char __EXPORTED *
 nfct_helper_attr_get_str(struct nfct_helper *nfct_helper,
 			 enum nfct_helper_attr_type type)
 {
 	return (const char *)nfct_helper_attr_get(nfct_helper, type);
 }
-EXPORT_SYMBOL(nfct_helper_attr_get_str);
 
 /**
  * nfct_helper_attr_get_u8 - get one attribute the helper object
@@ -384,12 +370,12 @@ EXPORT_SYMBOL(nfct_helper_attr_get_str);
  * This function returns a unsigned 8-bits integer. If the attribute is
  * unsupported, this returns NULL.
  */
-uint8_t nfct_helper_attr_get_u8(struct nfct_helper *nfct_helper,
-				  enum nfct_helper_attr_type type)
+uint8_t __EXPORTED
+nfct_helper_attr_get_u8(struct nfct_helper *nfct_helper,
+			enum nfct_helper_attr_type type)
 {
 	return *((uint8_t *)nfct_helper_attr_get(nfct_helper, type));
 }
-EXPORT_SYMBOL(nfct_helper_attr_get_u8);
 
 /**
  * nfct_helper_attr_get_u16 - get one attribute the helper object
@@ -399,12 +385,12 @@ EXPORT_SYMBOL(nfct_helper_attr_get_u8);
  * This function returns a unsigned 16-bits integer. If the attribute is
  * unsupported, this returns NULL.
  */
-uint16_t nfct_helper_attr_get_u16(struct nfct_helper *nfct_helper,
-				  enum nfct_helper_attr_type type)
+uint16_t __EXPORTED
+nfct_helper_attr_get_u16(struct nfct_helper *nfct_helper,
+			 enum nfct_helper_attr_type type)
 {
 	return *((uint16_t *)nfct_helper_attr_get(nfct_helper, type));
 }
-EXPORT_SYMBOL(nfct_helper_attr_get_u16);
 
 /**
  * nfct_helper_attr_get_u32 - get one attribute the helper object
@@ -414,12 +400,12 @@ EXPORT_SYMBOL(nfct_helper_attr_get_u16);
  * This function returns a unsigned 32-bits integer. If the attribute is
  * unsupported, this returns NULL.
  */
-uint32_t nfct_helper_attr_get_u32(struct nfct_helper *nfct_helper,
-				  enum nfct_helper_attr_type type)
+uint32_t __EXPORTED
+nfct_helper_attr_get_u32(struct nfct_helper *nfct_helper,
+			 enum nfct_helper_attr_type type)
 {
 	return *((uint32_t *)nfct_helper_attr_get(nfct_helper, type));
 }
-EXPORT_SYMBOL(nfct_helper_attr_get_u32);
 
 /**
  * nfct_helper_snprintf - print helper object into one buffer
@@ -431,9 +417,10 @@ EXPORT_SYMBOL(nfct_helper_attr_get_u32);
  * This function returns -1 in case that some mandatory attributes are
  * missing. On sucess, it returns 0.
  */
-int nfct_helper_snprintf(char *buf, size_t size,
-			 struct nfct_helper *helper,
-			 unsigned int type, unsigned int flags)
+int __EXPORTED
+nfct_helper_snprintf(char *buf, size_t size,
+		     struct nfct_helper *helper,
+		     unsigned int type, unsigned int flags)
 {
 	int ret;
 
@@ -454,7 +441,6 @@ int nfct_helper_snprintf(char *buf, size_t size,
 
 	return ret;
 }
-EXPORT_SYMBOL(nfct_helper_snprintf);
 
 /**
  * @}
@@ -490,7 +476,7 @@ EXPORT_SYMBOL(nfct_helper_snprintf);
  * - Command NFNL_MSG_ACCT_DEL, to delete one specific nfct_helper object (if
  *   unused, otherwise you hit EBUSY).
  */
-struct nlmsghdr *
+struct nlmsghdr __EXPORTED *
 nfct_helper_nlmsg_build_hdr(char *buf, uint8_t cmd,
 			    uint16_t flags, uint32_t seq)
 {
@@ -509,7 +495,6 @@ nfct_helper_nlmsg_build_hdr(char *buf, uint8_t cmd,
 
 	return nlh;
 }
-EXPORT_SYMBOL(nfct_helper_nlmsg_build_hdr);
 
 static void
 nfct_helper_nlmsg_build_policy(struct nlmsghdr *nlh,
@@ -530,7 +515,7 @@ nfct_helper_nlmsg_build_policy(struct nlmsghdr *nlh,
  * \param nlh: netlink message that you want to use to add the payload.
  * \param nfct_helper: pointer to a helper object
  */
-void
+void __EXPORTED
 nfct_helper_nlmsg_build_payload(struct nlmsghdr *nlh, struct nfct_helper *h)
 {
 	struct nlattr *nest;
@@ -593,7 +578,6 @@ nfct_helper_nlmsg_build_payload(struct nlmsghdr *nlh, struct nfct_helper *h)
 	if (h->bitset & (1 << NFCTH_ATTR_STATUS))
 		mnl_attr_put_u32(nlh, NFCTH_STATUS, ntohl(h->status));
 }
-EXPORT_SYMBOL(nfct_helper_nlmsg_build_payload);
 
 static int
 nfct_helper_nlmsg_parse_tuple_cb(const struct nlattr *attr, void *data)
@@ -795,7 +779,7 @@ nfct_helper_nlmsg_parse_attr_cb(const struct nlattr *attr, void *data)
  * This function returns -1 in case that some mandatory attributes are
  * missing. On sucess, it returns 0.
  */
-int
+int __EXPORTED
 nfct_helper_nlmsg_parse_payload(const struct nlmsghdr *nlh,
 				struct nfct_helper *h)
 {
@@ -832,7 +816,6 @@ nfct_helper_nlmsg_parse_payload(const struct nlmsghdr *nlh,
 	}
 	return 0;
 }
-EXPORT_SYMBOL(nfct_helper_nlmsg_parse_payload);
 
 /**
  * @}
-- 
2.11.0.390.gc69c2f50cf-goog


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

* Re: [PATCH libnetfilter_cttimeout] Use __EXPORTED rather than EXPORT_SYMBOL
  2017-01-04 22:30 [PATCH libnetfilter_cttimeout] Use __EXPORTED rather than EXPORT_SYMBOL Kevin Cernekee
  2017-01-04 22:30 ` [PATCH libnetfilter_cthelper] " Kevin Cernekee
@ 2017-01-16 13:30 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2017-01-16 13:30 UTC (permalink / raw)
  To: Kevin Cernekee; +Cc: netfilter-devel

On Wed, Jan 04, 2017 at 02:30:25PM -0800, Kevin Cernekee wrote:
> clang is sensitive to the ordering of
> __attribute__((visibility("default"))) relative to the function
> body.  gcc is not.  So if we try to re-declare an existing function
> with default visibility, clang prints a warning and generates
> a broken .so file in which nfct_timeout_* are not exported to library
> callers.
> 
> Move the attribute up into the function definition to make clang happy.

Applied, thanks.

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

* Re: [PATCH libnetfilter_cthelper] Use __EXPORTED rather than EXPORT_SYMBOL
  2017-01-04 22:30 ` [PATCH libnetfilter_cthelper] " Kevin Cernekee
@ 2017-01-16 13:30   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2017-01-16 13:30 UTC (permalink / raw)
  To: Kevin Cernekee; +Cc: netfilter-devel

On Wed, Jan 04, 2017 at 02:30:26PM -0800, Kevin Cernekee wrote:
> clang is sensitive to the ordering of
> __attribute__((visibility("default"))) relative to the function
> body.  gcc is not.  So if we try to re-declare an existing function
> with default visibility, clang prints a warning and generates
> a broken .so file in which nfct_helper_* are not exported to library
> callers.
> 
> Move the attribute up into the function definition to make clang happy.

Also applied, thanks.

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

end of thread, other threads:[~2017-01-16 13:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-04 22:30 [PATCH libnetfilter_cttimeout] Use __EXPORTED rather than EXPORT_SYMBOL Kevin Cernekee
2017-01-04 22:30 ` [PATCH libnetfilter_cthelper] " Kevin Cernekee
2017-01-16 13:30   ` Pablo Neira Ayuso
2017-01-16 13:30 ` [PATCH libnetfilter_cttimeout] " 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).