aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-filter/libnetfilter/files/0001-libnetfilter-acct-Declare-the-define-visivility-attribute-together.patch
blob: 92e178efb755f6de226fd3809831366b8e631e99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
From f3e3e8fa703e88b76b22c5486277dfca3c85a24b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 10 Apr 2017 14:56:18 -0700
Subject: [PATCH] Declare the define visivility attribute together

clang ignores the visibility attribute if its not
defined before the definition. As a result these
symbols become hidden and consumers of this library
fail to link due to these missing symbols

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending

 doxygen.cfg.in          |  2 +-
 src/internal.h          |  5 ++---
 src/libnetfilter_acct.c | 41 ++++++++++++++---------------------------
 3 files changed, 17 insertions(+), 31 deletions(-)

diff --git a/doxygen.cfg.in b/doxygen.cfg.in
index 7f4bd04..fe64d48 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 nfacct
+EXCLUDE_SYMBOLS        = nfacct
 EXAMPLE_PATH           = 
 EXAMPLE_PATTERNS       = 
 EXAMPLE_RECURSIVE      = NO
diff --git a/src/internal.h b/src/internal.h
index f0cc2e1..e5c5ffd 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 __EXPORT	__attribute__((visibility("default")))
 #else
-#	define EXPORT_SYMBOL
+#	define __EXPORT
 #endif
 
 #include <endian.h>
diff --git a/src/libnetfilter_acct.c b/src/libnetfilter_acct.c
index b0bcf67..0220d14 100644
--- a/src/libnetfilter_acct.c
+++ b/src/libnetfilter_acct.c
@@ -76,21 +76,19 @@ struct nfacct {
  * In case of success, this function returns a valid pointer, otherwise NULL
  * s returned and errno is appropriately set.
  */
-struct nfacct *nfacct_alloc(void)
+struct nfacct __EXPORT *nfacct_alloc(void)
 {
 	return calloc(1, sizeof(struct nfacct));
 }
-EXPORT_SYMBOL(nfacct_alloc);
 
 /**
  * nfacct_free - release one accounting object
  * \param nfacct pointer to the accounting object
  */
-void nfacct_free(struct nfacct *nfacct)
+void __EXPORT nfacct_free(struct nfacct *nfacct)
 {
 	free(nfacct);
 }
-EXPORT_SYMBOL(nfacct_free);
 
 /**
  * nfacct_attr_set - set one attribute of the accounting object
@@ -98,7 +96,7 @@ EXPORT_SYMBOL(nfacct_free);
  * \param type attribute type you want to set
  * \param data pointer to data that will be used to set this attribute
  */
-void
+void __EXPORT
 nfacct_attr_set(struct nfacct *nfacct, enum nfacct_attr_type type,
 		const void *data)
 {
@@ -126,7 +124,6 @@ nfacct_attr_set(struct nfacct *nfacct, enum nfacct_attr_type type,
 		break;
 	}
 }
-EXPORT_SYMBOL(nfacct_attr_set);
 
 /**
  * nfacct_attr_set_str - set one attribute the accounting object
@@ -134,13 +131,12 @@ EXPORT_SYMBOL(nfacct_attr_set);
  * \param type attribute type you want to set
  * \param name string that will be used to set this attribute
  */
-void
+void __EXPORT
 nfacct_attr_set_str(struct nfacct *nfacct, enum nfacct_attr_type type,
 		    const char *name)
 {
 	nfacct_attr_set(nfacct, type, name);
 }
-EXPORT_SYMBOL(nfacct_attr_set_str);
 
 /**
  * nfacct_attr_set_u64 - set one attribute the accounting object
@@ -148,20 +144,19 @@ EXPORT_SYMBOL(nfacct_attr_set_str);
  * \param type attribute type you want to set
  * \param value unsigned 64-bits integer
  */
-void
+void __EXPORT
 nfacct_attr_set_u64(struct nfacct *nfacct, enum nfacct_attr_type type,
 		    uint64_t value)
 {
 	nfacct_attr_set(nfacct, type, &value);
 }
-EXPORT_SYMBOL(nfacct_attr_set_u64);
 
 /**
  * nfacct_attr_unset - unset one attribute the accounting object
  * \param nfacct pointer to the accounting object
  * \param type attribute type you want to set
  */
-void
+void __EXPORT
 nfacct_attr_unset(struct nfacct *nfacct, enum nfacct_attr_type type)
 {
 	switch(type) {
@@ -182,7 +177,6 @@ nfacct_attr_unset(struct nfacct *nfacct, enum nfacct_attr_type type)
 		break;
 	}
 }
-EXPORT_SYMBOL(nfacct_attr_unset);
 
 /**
  * nfacct_attr_get - get one attribute the accounting object
@@ -192,7 +186,7 @@ EXPORT_SYMBOL(nfacct_attr_unset);
  * This function returns a valid pointer to the attribute data. If a
  * unsupported attribute is used, this returns NULL.
  */
-const void *nfacct_attr_get(struct nfacct *nfacct, enum nfacct_attr_type type)
+const void __EXPORT *nfacct_attr_get(struct nfacct *nfacct, enum nfacct_attr_type type)
 {
 	const void *ret = NULL;
 
@@ -220,7 +214,6 @@ const void *nfacct_attr_get(struct nfacct *nfacct, enum nfacct_attr_type type)
 	}
 	return ret;
 }
-EXPORT_SYMBOL(nfacct_attr_get);
 
 /**
  * nfacct_attr_get_str - get one attribute the accounting object
@@ -230,12 +223,11 @@ EXPORT_SYMBOL(nfacct_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 __EXPORT *
 nfacct_attr_get_str(struct nfacct *nfacct, enum nfacct_attr_type type)
 {
 	return nfacct_attr_get(nfacct, type);
 }
-EXPORT_SYMBOL(nfacct_attr_get_str);
 
 /**
  * nfacct_attr_get_u64 - get one attribute the accounting object
@@ -245,12 +237,11 @@ EXPORT_SYMBOL(nfacct_attr_get_str);
  * This function returns a unsigned 64-bits integer. If the attribute is
  * unsupported, this returns NULL.
  */
-uint64_t nfacct_attr_get_u64(struct nfacct *nfacct, enum nfacct_attr_type type)
+uint64_t __EXPORT nfacct_attr_get_u64(struct nfacct *nfacct, enum nfacct_attr_type type)
 {
 	const void *ret = nfacct_attr_get(nfacct, type);
 	return ret ? *((uint64_t *)ret) : 0;
 }
-EXPORT_SYMBOL(nfacct_attr_get_u64);
 
 static int
 nfacct_snprintf_plain(char *buf, size_t rem, struct nfacct *nfacct,
@@ -424,8 +415,8 @@ err:
  * This function returns -1 in case that some mandatory attributes are
  * missing. On sucess, it returns 0.
  */
-int nfacct_snprintf(char *buf, size_t size, struct nfacct *nfacct,
-		    uint16_t type, uint16_t flags)
+int __EXPORT nfacct_snprintf(char *buf, size_t size, struct nfacct *nfacct,
+		             uint16_t type, uint16_t flags)
 {
 	int ret = 0;
 
@@ -445,7 +436,6 @@ int nfacct_snprintf(char *buf, size_t size, struct nfacct *nfacct,
 	}
 	return ret;
 }
-EXPORT_SYMBOL(nfacct_snprintf);
 
 /**
  * @}
@@ -484,7 +474,7 @@ EXPORT_SYMBOL(nfacct_snprintf);
  * - Command NFNL_MSG_ACCT_DEL, to delete one specific nfacct object (if
  *   unused, otherwise you hit EBUSY).
  */
-struct nlmsghdr *
+struct nlmsghdr __EXPORT *
 nfacct_nlmsg_build_hdr(char *buf, uint8_t cmd, uint16_t flags, uint32_t seq)
 {
 	struct nlmsghdr *nlh;
@@ -502,14 +492,13 @@ nfacct_nlmsg_build_hdr(char *buf, uint8_t cmd, uint16_t flags, uint32_t seq)
 
 	return nlh;
 }
-EXPORT_SYMBOL(nfacct_nlmsg_build_hdr);
 
 /**
  * nfacct_nlmsg_build_payload - build payload from accounting object
  * \param nlh: netlink message that you want to use to add the payload.
  * \param nfacct: pointer to a accounting object
  */
-void nfacct_nlmsg_build_payload(struct nlmsghdr *nlh, struct nfacct *nfacct)
+void __EXPORT nfacct_nlmsg_build_payload(struct nlmsghdr *nlh, struct nfacct *nfacct)
 {
 	if (nfacct->bitset & (1 << NFACCT_ATTR_NAME))
 		mnl_attr_put_strz(nlh, NFACCT_NAME, nfacct->name);
@@ -526,7 +515,6 @@ void nfacct_nlmsg_build_payload(struct nlmsghdr *nlh, struct nfacct *nfacct)
 	if (nfacct->bitset & (1 << NFACCT_ATTR_QUOTA))
 		mnl_attr_put_u64(nlh, NFACCT_QUOTA, htobe64(nfacct->quota));
 }
-EXPORT_SYMBOL(nfacct_nlmsg_build_payload);
 
 static int nfacct_nlmsg_parse_attr_cb(const struct nlattr *attr, void *data)
 {
@@ -563,7 +551,7 @@ static int nfacct_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 __EXPORT
 nfacct_nlmsg_parse_payload(const struct nlmsghdr *nlh, struct nfacct *nfacct)
 {
 	struct nlattr *tb[NFACCT_MAX+1] = {};
@@ -589,7 +577,6 @@ nfacct_nlmsg_parse_payload(const struct nlmsghdr *nlh, struct nfacct *nfacct)
 
 	return 0;
 }
-EXPORT_SYMBOL(nfacct_nlmsg_parse_payload);
 
 /**
  * @}
-- 
2.12.2