Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 1 | From bd01f785da5222d0662be3182fe2650e1c12f43e Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Mon, 10 Apr 2017 14:07:07 -0700 |
| 4 | Subject: [PATCH] Declare the define visivility attribute together |
| 5 | |
| 6 | clang ignores the visibility attribute if its not |
| 7 | defined before the definition. As a result these |
| 8 | symbols become hidden and consumers of this library |
| 9 | fail to link due to these missing symbols |
| 10 | |
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 12 | --- |
| 13 | doxygen.cfg.in | 2 +- |
| 14 | include/utils.h | 5 +-- |
| 15 | src/batch.c | 21 ++++------- |
| 16 | src/chain.c | 102 +++++++++++++++++--------------------------------- |
| 17 | src/common.c | 21 ++++------- |
| 18 | src/expr.c | 51 +++++++++---------------- |
| 19 | src/gen.c | 39 +++++++------------ |
| 20 | src/object.c | 99 ++++++++++++++++-------------------------------- |
| 21 | src/rule.c | 114 +++++++++++++++++++------------------------------------- |
| 22 | src/ruleset.c | 48 ++++++++---------------- |
| 23 | src/set.c | 96 ++++++++++++++++------------------------------- |
| 24 | src/set_elem.c | 72 ++++++++++++----------------------- |
| 25 | src/table.c | 90 +++++++++++++++----------------------------- |
| 26 | src/trace.c | 27 +++++--------- |
| 27 | src/udata.c | 48 ++++++++---------------- |
| 28 | 15 files changed, 279 insertions(+), 556 deletions(-) |
| 29 | |
| 30 | diff --git a/doxygen.cfg.in b/doxygen.cfg.in |
| 31 | index 23fcad4..e49f28d 100644 |
| 32 | --- a/doxygen.cfg.in |
| 33 | +++ b/doxygen.cfg.in |
| 34 | @@ -72,7 +72,7 @@ RECURSIVE = YES |
| 35 | EXCLUDE = |
| 36 | EXCLUDE_SYMLINKS = NO |
| 37 | EXCLUDE_PATTERNS = */.git/* .*.d |
| 38 | -EXCLUDE_SYMBOLS = EXPORT_SYMBOL |
| 39 | +EXCLUDE_SYMBOLS = |
| 40 | EXAMPLE_PATH = |
| 41 | EXAMPLE_PATTERNS = |
| 42 | EXAMPLE_RECURSIVE = NO |
| 43 | diff --git a/include/utils.h b/include/utils.h |
| 44 | index 2f5cf34..ff8207e 100644 |
| 45 | --- a/include/utils.h |
| 46 | +++ b/include/utils.h |
| 47 | @@ -9,10 +9,9 @@ |
| 48 | |
| 49 | #include "config.h" |
| 50 | #ifdef HAVE_VISIBILITY_HIDDEN |
| 51 | -# define __visible __attribute__((visibility("default"))) |
| 52 | -# define EXPORT_SYMBOL(x) typeof(x) (x) __visible; |
| 53 | +# define __EXPORTED __attribute__((visibility("default"))) |
| 54 | #else |
| 55 | -# define EXPORT_SYMBOL |
| 56 | +# define __EXPORT |
| 57 | #endif |
| 58 | |
| 59 | #define __noreturn __attribute__((__noreturn__)) |
| 60 | diff --git a/src/batch.c b/src/batch.c |
| 61 | index 5ee3fd7..3bedd26 100644 |
| 62 | --- a/src/batch.c |
| 63 | +++ b/src/batch.c |
| 64 | @@ -57,7 +57,7 @@ static void nftnl_batch_add_page(struct nftnl_batch_page *page, |
| 65 | list_add_tail(&page->head, &batch->page_list); |
| 66 | } |
| 67 | |
| 68 | -struct nftnl_batch *nftnl_batch_alloc(uint32_t pg_size, uint32_t pg_overrun_size) |
| 69 | +struct nftnl_batch __EXPORTED *nftnl_batch_alloc(uint32_t pg_size, uint32_t pg_overrun_size) |
| 70 | { |
| 71 | struct nftnl_batch *batch; |
| 72 | struct nftnl_batch_page *page; |
| 73 | @@ -80,9 +80,8 @@ err1: |
| 74 | free(batch); |
| 75 | return NULL; |
| 76 | } |
| 77 | -EXPORT_SYMBOL(nftnl_batch_alloc); |
| 78 | |
| 79 | -void nftnl_batch_free(struct nftnl_batch *batch) |
| 80 | +void __EXPORTED nftnl_batch_free(struct nftnl_batch *batch) |
| 81 | { |
| 82 | struct nftnl_batch_page *page, *next; |
| 83 | |
| 84 | @@ -94,9 +93,8 @@ void nftnl_batch_free(struct nftnl_batch *batch) |
| 85 | |
| 86 | free(batch); |
| 87 | } |
| 88 | -EXPORT_SYMBOL(nftnl_batch_free); |
| 89 | |
| 90 | -int nftnl_batch_update(struct nftnl_batch *batch) |
| 91 | +int __EXPORTED nftnl_batch_update(struct nftnl_batch *batch) |
| 92 | { |
| 93 | struct nftnl_batch_page *page; |
| 94 | struct nlmsghdr *last_nlh; |
| 95 | @@ -119,21 +117,18 @@ int nftnl_batch_update(struct nftnl_batch *batch) |
| 96 | err1: |
| 97 | return -1; |
| 98 | } |
| 99 | -EXPORT_SYMBOL(nftnl_batch_update); |
| 100 | |
| 101 | -void *nftnl_batch_buffer(struct nftnl_batch *batch) |
| 102 | +void __EXPORTED *nftnl_batch_buffer(struct nftnl_batch *batch) |
| 103 | { |
| 104 | return mnl_nlmsg_batch_current(batch->current_page->batch); |
| 105 | } |
| 106 | -EXPORT_SYMBOL(nftnl_batch_buffer); |
| 107 | |
| 108 | -uint32_t nftnl_batch_buffer_len(struct nftnl_batch *batch) |
| 109 | +uint32_t __EXPORTED nftnl_batch_buffer_len(struct nftnl_batch *batch) |
| 110 | { |
| 111 | return mnl_nlmsg_batch_size(batch->current_page->batch); |
| 112 | } |
| 113 | -EXPORT_SYMBOL(nftnl_batch_buffer_len); |
| 114 | |
| 115 | -int nftnl_batch_iovec_len(struct nftnl_batch *batch) |
| 116 | +int __EXPORTED nftnl_batch_iovec_len(struct nftnl_batch *batch) |
| 117 | { |
| 118 | int num_pages = batch->num_pages; |
| 119 | |
| 120 | @@ -143,9 +138,8 @@ int nftnl_batch_iovec_len(struct nftnl_batch *batch) |
| 121 | |
| 122 | return num_pages; |
| 123 | } |
| 124 | -EXPORT_SYMBOL(nftnl_batch_iovec_len); |
| 125 | |
| 126 | -void nftnl_batch_iovec(struct nftnl_batch *batch, struct iovec *iov, |
| 127 | +void __EXPORTED nftnl_batch_iovec(struct nftnl_batch *batch, struct iovec *iov, |
| 128 | uint32_t iovlen) |
| 129 | { |
| 130 | struct nftnl_batch_page *page; |
| 131 | @@ -160,4 +154,3 @@ void nftnl_batch_iovec(struct nftnl_batch *batch, struct iovec *iov, |
| 132 | i++; |
| 133 | } |
| 134 | } |
| 135 | -EXPORT_SYMBOL(nftnl_batch_iovec); |
| 136 | diff --git a/src/chain.c b/src/chain.c |
| 137 | index 29860c5..362fa0d 100644 |
| 138 | --- a/src/chain.c |
| 139 | +++ b/src/chain.c |
| 140 | @@ -87,13 +87,12 @@ static const char *nftnl_hooknum2str(int family, int hooknum) |
| 141 | return "unknown"; |
| 142 | } |
| 143 | |
| 144 | -struct nftnl_chain *nftnl_chain_alloc(void) |
| 145 | +struct nftnl_chain __EXPORTED *nftnl_chain_alloc(void) |
| 146 | { |
| 147 | return calloc(1, sizeof(struct nftnl_chain)); |
| 148 | } |
| 149 | -EXPORT_SYMBOL(nftnl_chain_alloc); |
| 150 | |
| 151 | -void nftnl_chain_free(const struct nftnl_chain *c) |
| 152 | +void __EXPORTED nftnl_chain_free(const struct nftnl_chain *c) |
| 153 | { |
| 154 | if (c->flags & (1 << NFTNL_CHAIN_NAME)) |
| 155 | xfree(c->name); |
| 156 | @@ -105,15 +104,13 @@ void nftnl_chain_free(const struct nftnl_chain *c) |
| 157 | xfree(c->dev); |
| 158 | xfree(c); |
| 159 | } |
| 160 | -EXPORT_SYMBOL(nftnl_chain_free); |
| 161 | |
| 162 | -bool nftnl_chain_is_set(const struct nftnl_chain *c, uint16_t attr) |
| 163 | +bool __EXPORTED nftnl_chain_is_set(const struct nftnl_chain *c, uint16_t attr) |
| 164 | { |
| 165 | return c->flags & (1 << attr); |
| 166 | } |
| 167 | -EXPORT_SYMBOL(nftnl_chain_is_set); |
| 168 | |
| 169 | -void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr) |
| 170 | +void __EXPORTED nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr) |
| 171 | { |
| 172 | if (!(c->flags & (1 << attr))) |
| 173 | return; |
| 174 | @@ -147,7 +144,6 @@ void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr) |
| 175 | |
| 176 | c->flags &= ~(1 << attr); |
| 177 | } |
| 178 | -EXPORT_SYMBOL(nftnl_chain_unset); |
| 179 | |
| 180 | static uint32_t nftnl_chain_validate[NFTNL_CHAIN_MAX + 1] = { |
| 181 | [NFTNL_CHAIN_HOOKNUM] = sizeof(uint32_t), |
| 182 | @@ -159,7 +155,7 @@ static uint32_t nftnl_chain_validate[NFTNL_CHAIN_MAX + 1] = { |
| 183 | [NFTNL_CHAIN_FAMILY] = sizeof(uint32_t), |
| 184 | }; |
| 185 | |
| 186 | -int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr, |
| 187 | +int __EXPORTED nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr, |
| 188 | const void *data, uint32_t data_len) |
| 189 | { |
| 190 | nftnl_assert_attr_exists(attr, NFTNL_CHAIN_MAX); |
| 191 | @@ -226,45 +222,38 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr, |
| 192 | c->flags |= (1 << attr); |
| 193 | return 0; |
| 194 | } |
| 195 | -EXPORT_SYMBOL(nftnl_chain_set_data); |
| 196 | |
| 197 | -void nftnl_chain_set(struct nftnl_chain *c, uint16_t attr, const void *data) |
| 198 | +void __EXPORTED nftnl_chain_set(struct nftnl_chain *c, uint16_t attr, const void *data) |
| 199 | { |
| 200 | nftnl_chain_set_data(c, attr, data, nftnl_chain_validate[attr]); |
| 201 | } |
| 202 | -EXPORT_SYMBOL(nftnl_chain_set); |
| 203 | |
| 204 | -void nftnl_chain_set_u32(struct nftnl_chain *c, uint16_t attr, uint32_t data) |
| 205 | +void __EXPORTED nftnl_chain_set_u32(struct nftnl_chain *c, uint16_t attr, uint32_t data) |
| 206 | { |
| 207 | nftnl_chain_set_data(c, attr, &data, sizeof(uint32_t)); |
| 208 | } |
| 209 | -EXPORT_SYMBOL(nftnl_chain_set_u32); |
| 210 | |
| 211 | -void nftnl_chain_set_s32(struct nftnl_chain *c, uint16_t attr, int32_t data) |
| 212 | +void __EXPORTED nftnl_chain_set_s32(struct nftnl_chain *c, uint16_t attr, int32_t data) |
| 213 | { |
| 214 | nftnl_chain_set_data(c, attr, &data, sizeof(int32_t)); |
| 215 | } |
| 216 | -EXPORT_SYMBOL(nftnl_chain_set_s32); |
| 217 | |
| 218 | -void nftnl_chain_set_u64(struct nftnl_chain *c, uint16_t attr, uint64_t data) |
| 219 | +void __EXPORTED nftnl_chain_set_u64(struct nftnl_chain *c, uint16_t attr, uint64_t data) |
| 220 | { |
| 221 | nftnl_chain_set_data(c, attr, &data, sizeof(uint64_t)); |
| 222 | } |
| 223 | -EXPORT_SYMBOL(nftnl_chain_set_u64); |
| 224 | |
| 225 | -void nftnl_chain_set_u8(struct nftnl_chain *c, uint16_t attr, uint8_t data) |
| 226 | +void __EXPORTED nftnl_chain_set_u8(struct nftnl_chain *c, uint16_t attr, uint8_t data) |
| 227 | { |
| 228 | nftnl_chain_set_data(c, attr, &data, sizeof(uint8_t)); |
| 229 | } |
| 230 | -EXPORT_SYMBOL(nftnl_chain_set_u8); |
| 231 | |
| 232 | -int nftnl_chain_set_str(struct nftnl_chain *c, uint16_t attr, const char *str) |
| 233 | +int __EXPORTED nftnl_chain_set_str(struct nftnl_chain *c, uint16_t attr, const char *str) |
| 234 | { |
| 235 | return nftnl_chain_set_data(c, attr, str, strlen(str) + 1); |
| 236 | } |
| 237 | -EXPORT_SYMBOL(nftnl_chain_set_str); |
| 238 | |
| 239 | -const void *nftnl_chain_get_data(const struct nftnl_chain *c, uint16_t attr, |
| 240 | +const void __EXPORTED *nftnl_chain_get_data(const struct nftnl_chain *c, uint16_t attr, |
| 241 | uint32_t *data_len) |
| 242 | { |
| 243 | if (!(c->flags & (1 << attr))) |
| 244 | @@ -310,22 +299,19 @@ const void *nftnl_chain_get_data(const struct nftnl_chain *c, uint16_t attr, |
| 245 | } |
| 246 | return NULL; |
| 247 | } |
| 248 | -EXPORT_SYMBOL(nftnl_chain_get_data); |
| 249 | |
| 250 | -const void *nftnl_chain_get(const struct nftnl_chain *c, uint16_t attr) |
| 251 | +const void __EXPORTED *nftnl_chain_get(const struct nftnl_chain *c, uint16_t attr) |
| 252 | { |
| 253 | uint32_t data_len; |
| 254 | return nftnl_chain_get_data(c, attr, &data_len); |
| 255 | } |
| 256 | -EXPORT_SYMBOL(nftnl_chain_get); |
| 257 | |
| 258 | -const char *nftnl_chain_get_str(const struct nftnl_chain *c, uint16_t attr) |
| 259 | +const char __EXPORTED *nftnl_chain_get_str(const struct nftnl_chain *c, uint16_t attr) |
| 260 | { |
| 261 | return nftnl_chain_get(c, attr); |
| 262 | } |
| 263 | -EXPORT_SYMBOL(nftnl_chain_get_str); |
| 264 | |
| 265 | -uint32_t nftnl_chain_get_u32(const struct nftnl_chain *c, uint16_t attr) |
| 266 | +uint32_t __EXPORTED nftnl_chain_get_u32(const struct nftnl_chain *c, uint16_t attr) |
| 267 | { |
| 268 | uint32_t data_len; |
| 269 | const uint32_t *val = nftnl_chain_get_data(c, attr, &data_len); |
| 270 | @@ -334,9 +320,8 @@ uint32_t nftnl_chain_get_u32(const struct nftnl_chain *c, uint16_t attr) |
| 271 | |
| 272 | return val ? *val : 0; |
| 273 | } |
| 274 | -EXPORT_SYMBOL(nftnl_chain_get_u32); |
| 275 | |
| 276 | -int32_t nftnl_chain_get_s32(const struct nftnl_chain *c, uint16_t attr) |
| 277 | +int32_t __EXPORTED nftnl_chain_get_s32(const struct nftnl_chain *c, uint16_t attr) |
| 278 | { |
| 279 | uint32_t data_len; |
| 280 | const int32_t *val = nftnl_chain_get_data(c, attr, &data_len); |
| 281 | @@ -345,9 +330,8 @@ int32_t nftnl_chain_get_s32(const struct nftnl_chain *c, uint16_t attr) |
| 282 | |
| 283 | return val ? *val : 0; |
| 284 | } |
| 285 | -EXPORT_SYMBOL(nftnl_chain_get_s32); |
| 286 | |
| 287 | -uint64_t nftnl_chain_get_u64(const struct nftnl_chain *c, uint16_t attr) |
| 288 | +uint64_t __EXPORTED nftnl_chain_get_u64(const struct nftnl_chain *c, uint16_t attr) |
| 289 | { |
| 290 | uint32_t data_len; |
| 291 | const uint64_t *val = nftnl_chain_get_data(c, attr, &data_len); |
| 292 | @@ -356,9 +340,8 @@ uint64_t nftnl_chain_get_u64(const struct nftnl_chain *c, uint16_t attr) |
| 293 | |
| 294 | return val ? *val : 0; |
| 295 | } |
| 296 | -EXPORT_SYMBOL(nftnl_chain_get_u64); |
| 297 | |
| 298 | -uint8_t nftnl_chain_get_u8(const struct nftnl_chain *c, uint16_t attr) |
| 299 | +uint8_t __EXPORTED nftnl_chain_get_u8(const struct nftnl_chain *c, uint16_t attr) |
| 300 | { |
| 301 | uint32_t data_len; |
| 302 | const uint8_t *val = nftnl_chain_get_data(c, attr, &data_len); |
| 303 | @@ -367,9 +350,8 @@ uint8_t nftnl_chain_get_u8(const struct nftnl_chain *c, uint16_t attr) |
| 304 | |
| 305 | return val ? *val : 0; |
| 306 | } |
| 307 | -EXPORT_SYMBOL(nftnl_chain_get_u8); |
| 308 | |
| 309 | -void nftnl_chain_nlmsg_build_payload(struct nlmsghdr *nlh, const struct nftnl_chain *c) |
| 310 | +void __EXPORTED nftnl_chain_nlmsg_build_payload(struct nlmsghdr *nlh, const struct nftnl_chain *c) |
| 311 | { |
| 312 | if (c->flags & (1 << NFTNL_CHAIN_TABLE)) |
| 313 | mnl_attr_put_strz(nlh, NFTA_CHAIN_TABLE, c->table); |
| 314 | @@ -404,7 +386,6 @@ void nftnl_chain_nlmsg_build_payload(struct nlmsghdr *nlh, const struct nftnl_ch |
| 315 | if (c->flags & (1 << NFTNL_CHAIN_TYPE)) |
| 316 | mnl_attr_put_strz(nlh, NFTA_CHAIN_TYPE, c->type); |
| 317 | } |
| 318 | -EXPORT_SYMBOL(nftnl_chain_nlmsg_build_payload); |
| 319 | |
| 320 | static int nftnl_chain_parse_attr_cb(const struct nlattr *attr, void *data) |
| 321 | { |
| 322 | @@ -529,7 +510,7 @@ static int nftnl_chain_parse_hook(struct nlattr *attr, struct nftnl_chain *c) |
| 323 | return 0; |
| 324 | } |
| 325 | |
| 326 | -int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c) |
| 327 | +int __EXPORTED nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c) |
| 328 | { |
| 329 | struct nlattr *tb[NFTA_CHAIN_MAX+1] = {}; |
| 330 | struct nfgenmsg *nfg = mnl_nlmsg_get_payload(nlh); |
| 331 | @@ -590,7 +571,6 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c) |
| 332 | |
| 333 | return ret; |
| 334 | } |
| 335 | -EXPORT_SYMBOL(nftnl_chain_nlmsg_parse); |
| 336 | |
| 337 | static inline int nftnl_str2hooknum(int family, const char *hook) |
| 338 | { |
| 339 | @@ -732,19 +712,17 @@ static int nftnl_chain_do_parse(struct nftnl_chain *c, enum nftnl_parse_type typ |
| 340 | return ret; |
| 341 | } |
| 342 | |
| 343 | -int nftnl_chain_parse(struct nftnl_chain *c, enum nftnl_parse_type type, |
| 344 | +int __EXPORTED nftnl_chain_parse(struct nftnl_chain *c, enum nftnl_parse_type type, |
| 345 | const char *data, struct nftnl_parse_err *err) |
| 346 | { |
| 347 | return nftnl_chain_do_parse(c, type, data, err, NFTNL_PARSE_BUFFER); |
| 348 | } |
| 349 | -EXPORT_SYMBOL(nftnl_chain_parse); |
| 350 | |
| 351 | -int nftnl_chain_parse_file(struct nftnl_chain *c, enum nftnl_parse_type type, |
| 352 | +int __EXPORTED nftnl_chain_parse_file(struct nftnl_chain *c, enum nftnl_parse_type type, |
| 353 | FILE *fp, struct nftnl_parse_err *err) |
| 354 | { |
| 355 | return nftnl_chain_do_parse(c, type, fp, err, NFTNL_PARSE_FILE); |
| 356 | } |
| 357 | -EXPORT_SYMBOL(nftnl_chain_parse_file); |
| 358 | |
| 359 | static int nftnl_chain_export(char *buf, size_t size, |
| 360 | const struct nftnl_chain *c, int type) |
| 361 | @@ -841,13 +819,12 @@ static int nftnl_chain_cmd_snprintf(char *buf, size_t size, |
| 362 | return offset; |
| 363 | } |
| 364 | |
| 365 | -int nftnl_chain_snprintf(char *buf, size_t size, const struct nftnl_chain *c, |
| 366 | +int __EXPORTED nftnl_chain_snprintf(char *buf, size_t size, const struct nftnl_chain *c, |
| 367 | uint32_t type, uint32_t flags) |
| 368 | { |
| 369 | return nftnl_chain_cmd_snprintf(buf, size, c, nftnl_flag2cmd(flags), type, |
| 370 | flags); |
| 371 | } |
| 372 | -EXPORT_SYMBOL(nftnl_chain_snprintf); |
| 373 | |
| 374 | static int nftnl_chain_do_snprintf(char *buf, size_t size, const void *c, |
| 375 | uint32_t cmd, uint32_t type, uint32_t flags) |
| 376 | @@ -855,19 +832,18 @@ static int nftnl_chain_do_snprintf(char *buf, size_t size, const void *c, |
| 377 | return nftnl_chain_snprintf(buf, size, c, type, flags); |
| 378 | } |
| 379 | |
| 380 | -int nftnl_chain_fprintf(FILE *fp, const struct nftnl_chain *c, uint32_t type, |
| 381 | +int __EXPORTED nftnl_chain_fprintf(FILE *fp, const struct nftnl_chain *c, uint32_t type, |
| 382 | uint32_t flags) |
| 383 | { |
| 384 | return nftnl_fprintf(fp, c, NFTNL_CMD_UNSPEC, type, flags, |
| 385 | nftnl_chain_do_snprintf); |
| 386 | } |
| 387 | -EXPORT_SYMBOL(nftnl_chain_fprintf); |
| 388 | |
| 389 | struct nftnl_chain_list { |
| 390 | struct list_head list; |
| 391 | }; |
| 392 | |
| 393 | -struct nftnl_chain_list *nftnl_chain_list_alloc(void) |
| 394 | +struct nftnl_chain_list __EXPORTED *nftnl_chain_list_alloc(void) |
| 395 | { |
| 396 | struct nftnl_chain_list *list; |
| 397 | |
| 398 | @@ -879,9 +855,8 @@ struct nftnl_chain_list *nftnl_chain_list_alloc(void) |
| 399 | |
| 400 | return list; |
| 401 | } |
| 402 | -EXPORT_SYMBOL(nftnl_chain_list_alloc); |
| 403 | |
| 404 | -void nftnl_chain_list_free(struct nftnl_chain_list *list) |
| 405 | +void __EXPORTED nftnl_chain_list_free(struct nftnl_chain_list *list) |
| 406 | { |
| 407 | struct nftnl_chain *r, *tmp; |
| 408 | |
| 409 | @@ -891,33 +866,28 @@ void nftnl_chain_list_free(struct nftnl_chain_list *list) |
| 410 | } |
| 411 | xfree(list); |
| 412 | } |
| 413 | -EXPORT_SYMBOL(nftnl_chain_list_free); |
| 414 | |
| 415 | -int nftnl_chain_list_is_empty(const struct nftnl_chain_list *list) |
| 416 | +int __EXPORTED nftnl_chain_list_is_empty(const struct nftnl_chain_list *list) |
| 417 | { |
| 418 | return list_empty(&list->list); |
| 419 | } |
| 420 | -EXPORT_SYMBOL(nftnl_chain_list_is_empty); |
| 421 | |
| 422 | -void nftnl_chain_list_add(struct nftnl_chain *r, struct nftnl_chain_list *list) |
| 423 | +void __EXPORTED nftnl_chain_list_add(struct nftnl_chain *r, struct nftnl_chain_list *list) |
| 424 | { |
| 425 | list_add(&r->head, &list->list); |
| 426 | } |
| 427 | -EXPORT_SYMBOL(nftnl_chain_list_add); |
| 428 | |
| 429 | -void nftnl_chain_list_add_tail(struct nftnl_chain *r, struct nftnl_chain_list *list) |
| 430 | +void __EXPORTED nftnl_chain_list_add_tail(struct nftnl_chain *r, struct nftnl_chain_list *list) |
| 431 | { |
| 432 | list_add_tail(&r->head, &list->list); |
| 433 | } |
| 434 | -EXPORT_SYMBOL(nftnl_chain_list_add_tail); |
| 435 | |
| 436 | -void nftnl_chain_list_del(struct nftnl_chain *r) |
| 437 | +void __EXPORTED nftnl_chain_list_del(struct nftnl_chain *r) |
| 438 | { |
| 439 | list_del(&r->head); |
| 440 | } |
| 441 | -EXPORT_SYMBOL(nftnl_chain_list_del); |
| 442 | |
| 443 | -int nftnl_chain_list_foreach(struct nftnl_chain_list *chain_list, |
| 444 | +int __EXPORTED nftnl_chain_list_foreach(struct nftnl_chain_list *chain_list, |
| 445 | int (*cb)(struct nftnl_chain *r, void *data), |
| 446 | void *data) |
| 447 | { |
| 448 | @@ -931,14 +901,13 @@ int nftnl_chain_list_foreach(struct nftnl_chain_list *chain_list, |
| 449 | } |
| 450 | return 0; |
| 451 | } |
| 452 | -EXPORT_SYMBOL(nftnl_chain_list_foreach); |
| 453 | |
| 454 | struct nftnl_chain_list_iter { |
| 455 | const struct nftnl_chain_list *list; |
| 456 | struct nftnl_chain *cur; |
| 457 | }; |
| 458 | |
| 459 | -struct nftnl_chain_list_iter * |
| 460 | +struct nftnl_chain_list_iter __EXPORTED * |
| 461 | nftnl_chain_list_iter_create(const struct nftnl_chain_list *l) |
| 462 | { |
| 463 | struct nftnl_chain_list_iter *iter; |
| 464 | @@ -955,9 +924,8 @@ nftnl_chain_list_iter_create(const struct nftnl_chain_list *l) |
| 465 | |
| 466 | return iter; |
| 467 | } |
| 468 | -EXPORT_SYMBOL(nftnl_chain_list_iter_create); |
| 469 | |
| 470 | -struct nftnl_chain *nftnl_chain_list_iter_next(struct nftnl_chain_list_iter *iter) |
| 471 | +struct nftnl_chain __EXPORTED *nftnl_chain_list_iter_next(struct nftnl_chain_list_iter *iter) |
| 472 | { |
| 473 | struct nftnl_chain *r = iter->cur; |
| 474 | |
| 475 | @@ -971,10 +939,8 @@ struct nftnl_chain *nftnl_chain_list_iter_next(struct nftnl_chain_list_iter *ite |
| 476 | |
| 477 | return r; |
| 478 | } |
| 479 | -EXPORT_SYMBOL(nftnl_chain_list_iter_next); |
| 480 | |
| 481 | -void nftnl_chain_list_iter_destroy(struct nftnl_chain_list_iter *iter) |
| 482 | +void __EXPORTED nftnl_chain_list_iter_destroy(struct nftnl_chain_list_iter *iter) |
| 483 | { |
| 484 | xfree(iter); |
| 485 | } |
| 486 | -EXPORT_SYMBOL(nftnl_chain_list_iter_destroy); |
| 487 | diff --git a/src/common.c b/src/common.c |
| 488 | index a95883c..68bce2e 100644 |
| 489 | --- a/src/common.c |
| 490 | +++ b/src/common.c |
| 491 | @@ -43,15 +43,14 @@ static struct nlmsghdr *__nftnl_nlmsg_build_hdr(char *buf, uint16_t type, |
| 492 | return nlh; |
| 493 | } |
| 494 | |
| 495 | -struct nlmsghdr *nftnl_nlmsg_build_hdr(char *buf, uint16_t type, uint16_t family, |
| 496 | +struct nlmsghdr __EXPORTED *nftnl_nlmsg_build_hdr(char *buf, uint16_t type, uint16_t family, |
| 497 | uint16_t flags, uint32_t seq) |
| 498 | { |
| 499 | return __nftnl_nlmsg_build_hdr(buf, (NFNL_SUBSYS_NFTABLES << 8) | type, |
| 500 | family, flags, seq, 0); |
| 501 | } |
| 502 | -EXPORT_SYMBOL(nftnl_nlmsg_build_hdr); |
| 503 | |
| 504 | -struct nftnl_parse_err *nftnl_parse_err_alloc(void) |
| 505 | +struct nftnl_parse_err __EXPORTED *nftnl_parse_err_alloc(void) |
| 506 | { |
| 507 | struct nftnl_parse_err *err; |
| 508 | |
| 509 | @@ -63,15 +62,13 @@ struct nftnl_parse_err *nftnl_parse_err_alloc(void) |
| 510 | |
| 511 | return err; |
| 512 | } |
| 513 | -EXPORT_SYMBOL(nftnl_parse_err_alloc); |
| 514 | |
| 515 | -void nftnl_parse_err_free(struct nftnl_parse_err *err) |
| 516 | +void __EXPORTED nftnl_parse_err_free(struct nftnl_parse_err *err) |
| 517 | { |
| 518 | xfree(err); |
| 519 | } |
| 520 | -EXPORT_SYMBOL(nftnl_parse_err_free); |
| 521 | |
| 522 | -int nftnl_parse_perror(const char *msg, struct nftnl_parse_err *err) |
| 523 | +int __EXPORTED nftnl_parse_perror(const char *msg, struct nftnl_parse_err *err) |
| 524 | { |
| 525 | switch (err->error) { |
| 526 | case NFTNL_PARSE_EBADINPUT: |
| 527 | @@ -89,7 +86,6 @@ int nftnl_parse_perror(const char *msg, struct nftnl_parse_err *err) |
| 528 | return fprintf(stderr, "%s: Undefined error\n", msg); |
| 529 | } |
| 530 | } |
| 531 | -EXPORT_SYMBOL(nftnl_parse_perror); |
| 532 | |
| 533 | int nftnl_cmd_header_snprintf(char *buf, size_t size, uint32_t cmd, uint32_t type, |
| 534 | uint32_t flags) |
| 535 | @@ -165,21 +161,19 @@ int nftnl_cmd_footer_fprintf(FILE *fp, uint32_t cmd, uint32_t type, |
| 536 | nftnl_cmd_footer_fprintf_cb); |
| 537 | } |
| 538 | |
| 539 | -struct nlmsghdr *nftnl_batch_begin(char *buf, uint32_t seq) |
| 540 | +struct nlmsghdr __EXPORTED *nftnl_batch_begin(char *buf, uint32_t seq) |
| 541 | { |
| 542 | return __nftnl_nlmsg_build_hdr(buf, NFNL_MSG_BATCH_BEGIN, AF_UNSPEC, |
| 543 | 0, seq, NFNL_SUBSYS_NFTABLES); |
| 544 | } |
| 545 | -EXPORT_SYMBOL(nftnl_batch_begin); |
| 546 | |
| 547 | -struct nlmsghdr *nftnl_batch_end(char *buf, uint32_t seq) |
| 548 | +struct nlmsghdr __EXPORTED *nftnl_batch_end(char *buf, uint32_t seq) |
| 549 | { |
| 550 | return __nftnl_nlmsg_build_hdr(buf, NFNL_MSG_BATCH_END, AF_UNSPEC, |
| 551 | 0, seq, NFNL_SUBSYS_NFTABLES); |
| 552 | } |
| 553 | -EXPORT_SYMBOL(nftnl_batch_end); |
| 554 | |
| 555 | -int nftnl_batch_is_supported(void) |
| 556 | +int __EXPORTED nftnl_batch_is_supported(void) |
| 557 | { |
| 558 | struct mnl_socket *nl; |
| 559 | struct mnl_nlmsg_batch *b; |
| 560 | @@ -236,4 +230,3 @@ err: |
| 561 | mnl_nlmsg_batch_stop(b); |
| 562 | return -1; |
| 563 | } |
| 564 | -EXPORT_SYMBOL(nftnl_batch_is_supported); |
| 565 | diff --git a/src/expr.c b/src/expr.c |
| 566 | index 10ba2c4..c7eb2b4 100644 |
| 567 | --- a/src/expr.c |
| 568 | +++ b/src/expr.c |
| 569 | @@ -24,7 +24,7 @@ |
| 570 | |
| 571 | #include <libnftnl/expr.h> |
| 572 | |
| 573 | -struct nftnl_expr *nftnl_expr_alloc(const char *name) |
| 574 | +struct nftnl_expr __EXPORTED *nftnl_expr_alloc(const char *name) |
| 575 | { |
| 576 | struct nftnl_expr *expr; |
| 577 | struct expr_ops *ops; |
| 578 | @@ -43,24 +43,21 @@ struct nftnl_expr *nftnl_expr_alloc(const char *name) |
| 579 | |
| 580 | return expr; |
| 581 | } |
| 582 | -EXPORT_SYMBOL(nftnl_expr_alloc); |
| 583 | |
| 584 | -void nftnl_expr_free(const struct nftnl_expr *expr) |
| 585 | +void __EXPORTED nftnl_expr_free(const struct nftnl_expr *expr) |
| 586 | { |
| 587 | if (expr->ops->free) |
| 588 | expr->ops->free(expr); |
| 589 | |
| 590 | xfree(expr); |
| 591 | } |
| 592 | -EXPORT_SYMBOL(nftnl_expr_free); |
| 593 | |
| 594 | -bool nftnl_expr_is_set(const struct nftnl_expr *expr, uint16_t type) |
| 595 | +bool __EXPORTED nftnl_expr_is_set(const struct nftnl_expr *expr, uint16_t type) |
| 596 | { |
| 597 | return expr->flags & (1 << type); |
| 598 | } |
| 599 | -EXPORT_SYMBOL(nftnl_expr_is_set); |
| 600 | |
| 601 | -int nftnl_expr_set(struct nftnl_expr *expr, uint16_t type, |
| 602 | +int __EXPORTED nftnl_expr_set(struct nftnl_expr *expr, uint16_t type, |
| 603 | const void *data, uint32_t data_len) |
| 604 | { |
| 605 | switch(type) { |
| 606 | @@ -73,43 +70,37 @@ int nftnl_expr_set(struct nftnl_expr *expr, uint16_t type, |
| 607 | expr->flags |= (1 << type); |
| 608 | return 0; |
| 609 | } |
| 610 | -EXPORT_SYMBOL(nftnl_expr_set); |
| 611 | |
| 612 | -void |
| 613 | +void __EXPORTED |
| 614 | nftnl_expr_set_u8(struct nftnl_expr *expr, uint16_t type, uint8_t data) |
| 615 | { |
| 616 | nftnl_expr_set(expr, type, &data, sizeof(uint8_t)); |
| 617 | } |
| 618 | -EXPORT_SYMBOL(nftnl_expr_set_u8); |
| 619 | |
| 620 | -void |
| 621 | +void __EXPORTED |
| 622 | nftnl_expr_set_u16(struct nftnl_expr *expr, uint16_t type, uint16_t data) |
| 623 | { |
| 624 | nftnl_expr_set(expr, type, &data, sizeof(uint16_t)); |
| 625 | } |
| 626 | -EXPORT_SYMBOL(nftnl_expr_set_u16); |
| 627 | |
| 628 | -void |
| 629 | +void __EXPORTED |
| 630 | nftnl_expr_set_u32(struct nftnl_expr *expr, uint16_t type, uint32_t data) |
| 631 | { |
| 632 | nftnl_expr_set(expr, type, &data, sizeof(uint32_t)); |
| 633 | } |
| 634 | -EXPORT_SYMBOL(nftnl_expr_set_u32); |
| 635 | |
| 636 | -void |
| 637 | +void __EXPORTED |
| 638 | nftnl_expr_set_u64(struct nftnl_expr *expr, uint16_t type, uint64_t data) |
| 639 | { |
| 640 | nftnl_expr_set(expr, type, &data, sizeof(uint64_t)); |
| 641 | } |
| 642 | -EXPORT_SYMBOL(nftnl_expr_set_u64); |
| 643 | |
| 644 | -int nftnl_expr_set_str(struct nftnl_expr *expr, uint16_t type, const char *str) |
| 645 | +int __EXPORTED nftnl_expr_set_str(struct nftnl_expr *expr, uint16_t type, const char *str) |
| 646 | { |
| 647 | return nftnl_expr_set(expr, type, str, strlen(str) + 1); |
| 648 | } |
| 649 | -EXPORT_SYMBOL(nftnl_expr_set_str); |
| 650 | |
| 651 | -const void *nftnl_expr_get(const struct nftnl_expr *expr, |
| 652 | +const void __EXPORTED *nftnl_expr_get(const struct nftnl_expr *expr, |
| 653 | uint16_t type, uint32_t *data_len) |
| 654 | { |
| 655 | const void *ret; |
| 656 | @@ -129,9 +120,8 @@ const void *nftnl_expr_get(const struct nftnl_expr *expr, |
| 657 | |
| 658 | return ret; |
| 659 | } |
| 660 | -EXPORT_SYMBOL(nftnl_expr_get); |
| 661 | |
| 662 | -uint8_t nftnl_expr_get_u8(const struct nftnl_expr *expr, uint16_t type) |
| 663 | +uint8_t __EXPORTED nftnl_expr_get_u8(const struct nftnl_expr *expr, uint16_t type) |
| 664 | { |
| 665 | const void *data; |
| 666 | uint32_t data_len; |
| 667 | @@ -145,9 +135,8 @@ uint8_t nftnl_expr_get_u8(const struct nftnl_expr *expr, uint16_t type) |
| 668 | |
| 669 | return *((uint8_t *)data); |
| 670 | } |
| 671 | -EXPORT_SYMBOL(nftnl_expr_get_u8); |
| 672 | |
| 673 | -uint16_t nftnl_expr_get_u16(const struct nftnl_expr *expr, uint16_t type) |
| 674 | +uint16_t __EXPORTED nftnl_expr_get_u16(const struct nftnl_expr *expr, uint16_t type) |
| 675 | { |
| 676 | const void *data; |
| 677 | uint32_t data_len; |
| 678 | @@ -161,9 +150,8 @@ uint16_t nftnl_expr_get_u16(const struct nftnl_expr *expr, uint16_t type) |
| 679 | |
| 680 | return *((uint16_t *)data); |
| 681 | } |
| 682 | -EXPORT_SYMBOL(nftnl_expr_get_u16); |
| 683 | |
| 684 | -uint32_t nftnl_expr_get_u32(const struct nftnl_expr *expr, uint16_t type) |
| 685 | +uint32_t __EXPORTED nftnl_expr_get_u32(const struct nftnl_expr *expr, uint16_t type) |
| 686 | { |
| 687 | const void *data; |
| 688 | uint32_t data_len; |
| 689 | @@ -177,9 +165,8 @@ uint32_t nftnl_expr_get_u32(const struct nftnl_expr *expr, uint16_t type) |
| 690 | |
| 691 | return *((uint32_t *)data); |
| 692 | } |
| 693 | -EXPORT_SYMBOL(nftnl_expr_get_u32); |
| 694 | |
| 695 | -uint64_t nftnl_expr_get_u64(const struct nftnl_expr *expr, uint16_t type) |
| 696 | +uint64_t __EXPORTED nftnl_expr_get_u64(const struct nftnl_expr *expr, uint16_t type) |
| 697 | { |
| 698 | const void *data; |
| 699 | uint32_t data_len; |
| 700 | @@ -193,17 +180,15 @@ uint64_t nftnl_expr_get_u64(const struct nftnl_expr *expr, uint16_t type) |
| 701 | |
| 702 | return *((uint64_t *)data); |
| 703 | } |
| 704 | -EXPORT_SYMBOL(nftnl_expr_get_u64); |
| 705 | |
| 706 | -const char *nftnl_expr_get_str(const struct nftnl_expr *expr, uint16_t type) |
| 707 | +const char __EXPORTED *nftnl_expr_get_str(const struct nftnl_expr *expr, uint16_t type) |
| 708 | { |
| 709 | uint32_t data_len; |
| 710 | |
| 711 | return (const char *)nftnl_expr_get(expr, type, &data_len); |
| 712 | } |
| 713 | -EXPORT_SYMBOL(nftnl_expr_get_str); |
| 714 | |
| 715 | -bool nftnl_expr_cmp(const struct nftnl_expr *e1, const struct nftnl_expr *e2) |
| 716 | +bool __EXPORTED nftnl_expr_cmp(const struct nftnl_expr *e1, const struct nftnl_expr *e2) |
| 717 | { |
| 718 | if (e1->flags != e2->flags || |
| 719 | strcmp(e1->ops->name, e2->ops->name) != 0) |
| 720 | @@ -211,7 +196,6 @@ bool nftnl_expr_cmp(const struct nftnl_expr *e1, const struct nftnl_expr *e2) |
| 721 | |
| 722 | return e1->ops->cmp(e1, e2); |
| 723 | } |
| 724 | -EXPORT_SYMBOL(nftnl_expr_cmp); |
| 725 | |
| 726 | void nftnl_expr_build_payload(struct nlmsghdr *nlh, struct nftnl_expr *expr) |
| 727 | { |
| 728 | @@ -275,7 +259,7 @@ err1: |
| 729 | return NULL; |
| 730 | } |
| 731 | |
| 732 | -int nftnl_expr_snprintf(char *buf, size_t size, const struct nftnl_expr *expr, |
| 733 | +int __EXPORTED nftnl_expr_snprintf(char *buf, size_t size, const struct nftnl_expr *expr, |
| 734 | uint32_t type, uint32_t flags) |
| 735 | { |
| 736 | int ret; |
| 737 | @@ -289,4 +273,3 @@ int nftnl_expr_snprintf(char *buf, size_t size, const struct nftnl_expr *expr, |
| 738 | |
| 739 | return offset; |
| 740 | } |
| 741 | -EXPORT_SYMBOL(nftnl_expr_snprintf); |
| 742 | diff --git a/src/gen.c b/src/gen.c |
| 743 | index 213562e..8b45caa 100644 |
| 744 | --- a/src/gen.c |
| 745 | +++ b/src/gen.c |
| 746 | @@ -29,25 +29,22 @@ struct nftnl_gen { |
| 747 | uint32_t flags; |
| 748 | }; |
| 749 | |
| 750 | -struct nftnl_gen *nftnl_gen_alloc(void) |
| 751 | +struct nftnl_gen __EXPORTED *nftnl_gen_alloc(void) |
| 752 | { |
| 753 | return calloc(1, sizeof(struct nftnl_gen)); |
| 754 | } |
| 755 | -EXPORT_SYMBOL(nftnl_gen_alloc); |
| 756 | |
| 757 | -void nftnl_gen_free(const struct nftnl_gen *gen) |
| 758 | +void __EXPORTED nftnl_gen_free(const struct nftnl_gen *gen) |
| 759 | { |
| 760 | xfree(gen); |
| 761 | } |
| 762 | -EXPORT_SYMBOL(nftnl_gen_free); |
| 763 | |
| 764 | -bool nftnl_gen_is_set(const struct nftnl_gen *gen, uint16_t attr) |
| 765 | +bool __EXPORTED nftnl_gen_is_set(const struct nftnl_gen *gen, uint16_t attr) |
| 766 | { |
| 767 | return gen->flags & (1 << attr); |
| 768 | } |
| 769 | -EXPORT_SYMBOL(nftnl_gen_is_set); |
| 770 | |
| 771 | -void nftnl_gen_unset(struct nftnl_gen *gen, uint16_t attr) |
| 772 | +void __EXPORTED nftnl_gen_unset(struct nftnl_gen *gen, uint16_t attr) |
| 773 | { |
| 774 | if (!(gen->flags & (1 << attr))) |
| 775 | return; |
| 776 | @@ -58,13 +55,12 @@ void nftnl_gen_unset(struct nftnl_gen *gen, uint16_t attr) |
| 777 | } |
| 778 | gen->flags &= ~(1 << attr); |
| 779 | } |
| 780 | -EXPORT_SYMBOL(nftnl_gen_unset); |
| 781 | |
| 782 | static uint32_t nftnl_gen_validate[NFTNL_GEN_MAX + 1] = { |
| 783 | [NFTNL_GEN_ID] = sizeof(uint32_t), |
| 784 | }; |
| 785 | |
| 786 | -int nftnl_gen_set_data(struct nftnl_gen *gen, uint16_t attr, |
| 787 | +int __EXPORTED nftnl_gen_set_data(struct nftnl_gen *gen, uint16_t attr, |
| 788 | const void *data, uint32_t data_len) |
| 789 | { |
| 790 | nftnl_assert_attr_exists(attr, NFTNL_GEN_MAX); |
| 791 | @@ -78,21 +74,18 @@ int nftnl_gen_set_data(struct nftnl_gen *gen, uint16_t attr, |
| 792 | gen->flags |= (1 << attr); |
| 793 | return 0; |
| 794 | } |
| 795 | -EXPORT_SYMBOL(nftnl_gen_set_data); |
| 796 | |
| 797 | -int nftnl_gen_set(struct nftnl_gen *gen, uint16_t attr, const void *data) |
| 798 | +int __EXPORTED nftnl_gen_set(struct nftnl_gen *gen, uint16_t attr, const void *data) |
| 799 | { |
| 800 | return nftnl_gen_set_data(gen, attr, data, nftnl_gen_validate[attr]); |
| 801 | } |
| 802 | -EXPORT_SYMBOL(nftnl_gen_set); |
| 803 | |
| 804 | -void nftnl_gen_set_u32(struct nftnl_gen *gen, uint16_t attr, uint32_t val) |
| 805 | +void __EXPORTED nftnl_gen_set_u32(struct nftnl_gen *gen, uint16_t attr, uint32_t val) |
| 806 | { |
| 807 | nftnl_gen_set_data(gen, attr, &val, sizeof(uint32_t)); |
| 808 | } |
| 809 | -EXPORT_SYMBOL(nftnl_gen_set_u32); |
| 810 | |
| 811 | -const void *nftnl_gen_get_data(const struct nftnl_gen *gen, uint16_t attr, |
| 812 | +const void __EXPORTED *nftnl_gen_get_data(const struct nftnl_gen *gen, uint16_t attr, |
| 813 | uint32_t *data_len) |
| 814 | { |
| 815 | if (!(gen->flags & (1 << attr))) |
| 816 | @@ -105,21 +98,18 @@ const void *nftnl_gen_get_data(const struct nftnl_gen *gen, uint16_t attr, |
| 817 | } |
| 818 | return NULL; |
| 819 | } |
| 820 | -EXPORT_SYMBOL(nftnl_gen_get_data); |
| 821 | |
| 822 | -const void *nftnl_gen_get(const struct nftnl_gen *gen, uint16_t attr) |
| 823 | +const void __EXPORTED *nftnl_gen_get(const struct nftnl_gen *gen, uint16_t attr) |
| 824 | { |
| 825 | uint32_t data_len; |
| 826 | return nftnl_gen_get_data(gen, attr, &data_len); |
| 827 | } |
| 828 | -EXPORT_SYMBOL(nftnl_gen_get); |
| 829 | |
| 830 | -uint32_t nftnl_gen_get_u32(const struct nftnl_gen *gen, uint16_t attr) |
| 831 | +uint32_t __EXPORTED nftnl_gen_get_u32(const struct nftnl_gen *gen, uint16_t attr) |
| 832 | { |
| 833 | const void *ret = nftnl_gen_get(gen, attr); |
| 834 | return ret == NULL ? 0 : *((uint32_t *)ret); |
| 835 | } |
| 836 | -EXPORT_SYMBOL(nftnl_gen_get_u32); |
| 837 | |
| 838 | static int nftnl_gen_parse_attr_cb(const struct nlattr *attr, void *data) |
| 839 | { |
| 840 | @@ -140,7 +130,7 @@ static int nftnl_gen_parse_attr_cb(const struct nlattr *attr, void *data) |
| 841 | return MNL_CB_OK; |
| 842 | } |
| 843 | |
| 844 | -int nftnl_gen_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_gen *gen) |
| 845 | +int __EXPORTED nftnl_gen_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_gen *gen) |
| 846 | { |
| 847 | struct nlattr *tb[NFTA_GEN_MAX + 1] = {}; |
| 848 | struct nfgenmsg *nfg = mnl_nlmsg_get_payload(nlh); |
| 849 | @@ -154,7 +144,6 @@ int nftnl_gen_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_gen *gen) |
| 850 | } |
| 851 | return 0; |
| 852 | } |
| 853 | -EXPORT_SYMBOL(nftnl_gen_nlmsg_parse); |
| 854 | |
| 855 | static int nftnl_gen_snprintf_default(char *buf, size_t size, |
| 856 | const struct nftnl_gen *gen) |
| 857 | @@ -186,13 +175,12 @@ static int nftnl_gen_cmd_snprintf(char *buf, size_t size, |
| 858 | return offset; |
| 859 | } |
| 860 | |
| 861 | -int nftnl_gen_snprintf(char *buf, size_t size, const struct nftnl_gen *gen, |
| 862 | +int __EXPORTED nftnl_gen_snprintf(char *buf, size_t size, const struct nftnl_gen *gen, |
| 863 | uint32_t type, uint32_t flags) |
| 864 | {; |
| 865 | return nftnl_gen_cmd_snprintf(buf, size, gen, nftnl_flag2cmd(flags), type, |
| 866 | flags); |
| 867 | } |
| 868 | -EXPORT_SYMBOL(nftnl_gen_snprintf); |
| 869 | |
| 870 | static int nftnl_gen_do_snprintf(char *buf, size_t size, const void *gen, |
| 871 | uint32_t cmd, uint32_t type, uint32_t flags) |
| 872 | @@ -200,10 +188,9 @@ static int nftnl_gen_do_snprintf(char *buf, size_t size, const void *gen, |
| 873 | return nftnl_gen_snprintf(buf, size, gen, type, flags); |
| 874 | } |
| 875 | |
| 876 | -int nftnl_gen_fprintf(FILE *fp, const struct nftnl_gen *gen, uint32_t type, |
| 877 | +int __EXPORTED nftnl_gen_fprintf(FILE *fp, const struct nftnl_gen *gen, uint32_t type, |
| 878 | uint32_t flags) |
| 879 | { |
| 880 | return nftnl_fprintf(fp, gen, NFTNL_CMD_UNSPEC, type, flags, |
| 881 | nftnl_gen_do_snprintf); |
| 882 | } |
| 883 | -EXPORT_SYMBOL(nftnl_gen_fprintf); |
| 884 | diff --git a/src/object.c b/src/object.c |
| 885 | index e1a5ac4..d409c6d 100644 |
| 886 | --- a/src/object.c |
| 887 | +++ b/src/object.c |
| 888 | @@ -39,13 +39,12 @@ static struct obj_ops *nftnl_obj_ops_lookup(uint32_t type) |
| 889 | return obj_ops[type]; |
| 890 | } |
| 891 | |
| 892 | -struct nftnl_obj *nftnl_obj_alloc(void) |
| 893 | +struct nftnl_obj __EXPORTED *nftnl_obj_alloc(void) |
| 894 | { |
| 895 | return calloc(1, sizeof(struct nftnl_obj)); |
| 896 | } |
| 897 | -EXPORT_SYMBOL(nftnl_obj_alloc); |
| 898 | |
| 899 | -void nftnl_obj_free(const struct nftnl_obj *obj) |
| 900 | +void __EXPORTED nftnl_obj_free(const struct nftnl_obj *obj) |
| 901 | { |
| 902 | if (obj->flags & (1 << NFTNL_OBJ_TABLE)) |
| 903 | xfree(obj->table); |
| 904 | @@ -54,20 +53,18 @@ void nftnl_obj_free(const struct nftnl_obj *obj) |
| 905 | |
| 906 | xfree(obj); |
| 907 | } |
| 908 | -EXPORT_SYMBOL(nftnl_obj_free); |
| 909 | |
| 910 | -bool nftnl_obj_is_set(const struct nftnl_obj *obj, uint16_t attr) |
| 911 | +bool __EXPORTED nftnl_obj_is_set(const struct nftnl_obj *obj, uint16_t attr) |
| 912 | { |
| 913 | return obj->flags & (1 << attr); |
| 914 | } |
| 915 | -EXPORT_SYMBOL(nftnl_obj_is_set); |
| 916 | |
| 917 | static uint32_t nftnl_obj_validate[NFTNL_OBJ_MAX + 1] = { |
| 918 | [NFTNL_OBJ_FAMILY] = sizeof(uint32_t), |
| 919 | [NFTNL_OBJ_USE] = sizeof(uint32_t), |
| 920 | }; |
| 921 | |
| 922 | -void nftnl_obj_set_data(struct nftnl_obj *obj, uint16_t attr, |
| 923 | +void __EXPORTED nftnl_obj_set_data(struct nftnl_obj *obj, uint16_t attr, |
| 924 | const void *data, uint32_t data_len) |
| 925 | { |
| 926 | if (attr < NFTNL_OBJ_MAX) |
| 927 | @@ -100,45 +97,38 @@ void nftnl_obj_set_data(struct nftnl_obj *obj, uint16_t attr, |
| 928 | } |
| 929 | obj->flags |= (1 << attr); |
| 930 | } |
| 931 | -EXPORT_SYMBOL(nftnl_obj_set_data); |
| 932 | |
| 933 | -void nftnl_obj_set(struct nftnl_obj *obj, uint16_t attr, const void *data) |
| 934 | +void __EXPORTED nftnl_obj_set(struct nftnl_obj *obj, uint16_t attr, const void *data) |
| 935 | { |
| 936 | nftnl_obj_set_data(obj, attr, data, nftnl_obj_validate[attr]); |
| 937 | } |
| 938 | -EXPORT_SYMBOL(nftnl_obj_set); |
| 939 | |
| 940 | -void nftnl_obj_set_u8(struct nftnl_obj *obj, uint16_t attr, uint8_t val) |
| 941 | +void __EXPORTED nftnl_obj_set_u8(struct nftnl_obj *obj, uint16_t attr, uint8_t val) |
| 942 | { |
| 943 | nftnl_obj_set_data(obj, attr, &val, sizeof(uint8_t)); |
| 944 | } |
| 945 | -EXPORT_SYMBOL(nftnl_obj_set_u8); |
| 946 | |
| 947 | -void nftnl_obj_set_u16(struct nftnl_obj *obj, uint16_t attr, uint16_t val) |
| 948 | +void __EXPORTED nftnl_obj_set_u16(struct nftnl_obj *obj, uint16_t attr, uint16_t val) |
| 949 | { |
| 950 | nftnl_obj_set_data(obj, attr, &val, sizeof(uint16_t)); |
| 951 | } |
| 952 | -EXPORT_SYMBOL(nftnl_obj_set_u16); |
| 953 | |
| 954 | -void nftnl_obj_set_u32(struct nftnl_obj *obj, uint16_t attr, uint32_t val) |
| 955 | +void __EXPORTED nftnl_obj_set_u32(struct nftnl_obj *obj, uint16_t attr, uint32_t val) |
| 956 | { |
| 957 | nftnl_obj_set_data(obj, attr, &val, sizeof(uint32_t)); |
| 958 | } |
| 959 | -EXPORT_SYMBOL(nftnl_obj_set_u32); |
| 960 | |
| 961 | -void nftnl_obj_set_u64(struct nftnl_obj *obj, uint16_t attr, uint64_t val) |
| 962 | +void __EXPORTED nftnl_obj_set_u64(struct nftnl_obj *obj, uint16_t attr, uint64_t val) |
| 963 | { |
| 964 | nftnl_obj_set_data(obj, attr, &val, sizeof(uint64_t)); |
| 965 | } |
| 966 | -EXPORT_SYMBOL(nftnl_obj_set_u64); |
| 967 | |
| 968 | -void nftnl_obj_set_str(struct nftnl_obj *obj, uint16_t attr, const char *str) |
| 969 | +void __EXPORTED nftnl_obj_set_str(struct nftnl_obj *obj, uint16_t attr, const char *str) |
| 970 | { |
| 971 | nftnl_obj_set_data(obj, attr, str, 0); |
| 972 | } |
| 973 | -EXPORT_SYMBOL(nftnl_obj_set_str); |
| 974 | |
| 975 | -const void *nftnl_obj_get_data(struct nftnl_obj *obj, uint16_t attr, |
| 976 | +const void __EXPORTED *nftnl_obj_get_data(struct nftnl_obj *obj, uint16_t attr, |
| 977 | uint32_t *data_len) |
| 978 | { |
| 979 | if (!(obj->flags & (1 << attr))) |
| 980 | @@ -168,50 +158,43 @@ const void *nftnl_obj_get_data(struct nftnl_obj *obj, uint16_t attr, |
| 981 | } |
| 982 | return NULL; |
| 983 | } |
| 984 | -EXPORT_SYMBOL(nftnl_obj_get_data); |
| 985 | |
| 986 | -const void *nftnl_obj_get(struct nftnl_obj *obj, uint16_t attr) |
| 987 | +const void __EXPORTED *nftnl_obj_get(struct nftnl_obj *obj, uint16_t attr) |
| 988 | { |
| 989 | uint32_t data_len; |
| 990 | return nftnl_obj_get_data(obj, attr, &data_len); |
| 991 | } |
| 992 | -EXPORT_SYMBOL(nftnl_obj_get); |
| 993 | |
| 994 | -uint8_t nftnl_obj_get_u8(struct nftnl_obj *obj, uint16_t attr) |
| 995 | +uint8_t __EXPORTED nftnl_obj_get_u8(struct nftnl_obj *obj, uint16_t attr) |
| 996 | { |
| 997 | const void *ret = nftnl_obj_get(obj, attr); |
| 998 | return ret == NULL ? 0 : *((uint8_t *)ret); |
| 999 | } |
| 1000 | -EXPORT_SYMBOL(nftnl_obj_get_u8); |
| 1001 | |
| 1002 | -uint16_t nftnl_obj_get_u16(struct nftnl_obj *obj, uint16_t attr) |
| 1003 | +uint16_t __EXPORTED nftnl_obj_get_u16(struct nftnl_obj *obj, uint16_t attr) |
| 1004 | { |
| 1005 | const void *ret = nftnl_obj_get(obj, attr); |
| 1006 | return ret == NULL ? 0 : *((uint16_t *)ret); |
| 1007 | } |
| 1008 | -EXPORT_SYMBOL(nftnl_obj_get_u16); |
| 1009 | |
| 1010 | -uint32_t nftnl_obj_get_u32(struct nftnl_obj *obj, uint16_t attr) |
| 1011 | +uint32_t __EXPORTED nftnl_obj_get_u32(struct nftnl_obj *obj, uint16_t attr) |
| 1012 | { |
| 1013 | const void *ret = nftnl_obj_get(obj, attr); |
| 1014 | return ret == NULL ? 0 : *((uint32_t *)ret); |
| 1015 | } |
| 1016 | -EXPORT_SYMBOL(nftnl_obj_get_u32); |
| 1017 | |
| 1018 | -uint64_t nftnl_obj_get_u64(struct nftnl_obj *obj, uint16_t attr) |
| 1019 | +uint64_t __EXPORTED nftnl_obj_get_u64(struct nftnl_obj *obj, uint16_t attr) |
| 1020 | { |
| 1021 | const void *ret = nftnl_obj_get(obj, attr); |
| 1022 | return ret == NULL ? 0 : *((uint64_t *)ret); |
| 1023 | } |
| 1024 | -EXPORT_SYMBOL(nftnl_obj_get_u64); |
| 1025 | |
| 1026 | -const char *nftnl_obj_get_str(struct nftnl_obj *obj, uint16_t attr) |
| 1027 | +const char __EXPORTED *nftnl_obj_get_str(struct nftnl_obj *obj, uint16_t attr) |
| 1028 | { |
| 1029 | return nftnl_obj_get(obj, attr); |
| 1030 | } |
| 1031 | -EXPORT_SYMBOL(nftnl_obj_get_str); |
| 1032 | |
| 1033 | -void nftnl_obj_nlmsg_build_payload(struct nlmsghdr *nlh, |
| 1034 | +void __EXPORTED nftnl_obj_nlmsg_build_payload(struct nlmsghdr *nlh, |
| 1035 | const struct nftnl_obj *obj) |
| 1036 | { |
| 1037 | if (obj->flags & (1 << NFTNL_OBJ_TABLE)) |
| 1038 | @@ -228,7 +211,6 @@ void nftnl_obj_nlmsg_build_payload(struct nlmsghdr *nlh, |
| 1039 | mnl_attr_nest_end(nlh, nest); |
| 1040 | } |
| 1041 | } |
| 1042 | -EXPORT_SYMBOL(nftnl_obj_nlmsg_build_payload); |
| 1043 | |
| 1044 | static int nftnl_obj_parse_attr_cb(const struct nlattr *attr, void *data) |
| 1045 | { |
| 1046 | @@ -258,7 +240,7 @@ static int nftnl_obj_parse_attr_cb(const struct nlattr *attr, void *data) |
| 1047 | return MNL_CB_OK; |
| 1048 | } |
| 1049 | |
| 1050 | -int nftnl_obj_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_obj *obj) |
| 1051 | +int __EXPORTED nftnl_obj_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_obj *obj) |
| 1052 | { |
| 1053 | struct nfgenmsg *nfg = mnl_nlmsg_get_payload(nlh); |
| 1054 | struct nlattr *tb[NFTA_OBJ_MAX + 1] = {}; |
| 1055 | @@ -299,7 +281,6 @@ int nftnl_obj_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_obj *obj) |
| 1056 | |
| 1057 | return 0; |
| 1058 | } |
| 1059 | -EXPORT_SYMBOL(nftnl_obj_nlmsg_parse); |
| 1060 | |
| 1061 | #ifdef JSON_PARSING |
| 1062 | static int nftnl_jansson_parse_obj(struct nftnl_obj *t, json_t *tree, |
| 1063 | @@ -377,19 +358,17 @@ static int nftnl_obj_do_parse(struct nftnl_obj *obj, enum nftnl_parse_type type, |
| 1064 | return ret; |
| 1065 | } |
| 1066 | |
| 1067 | -int nftnl_obj_parse(struct nftnl_obj *obj, enum nftnl_parse_type type, |
| 1068 | +int __EXPORTED nftnl_obj_parse(struct nftnl_obj *obj, enum nftnl_parse_type type, |
| 1069 | const char *data, struct nftnl_parse_err *err) |
| 1070 | { |
| 1071 | return nftnl_obj_do_parse(obj, type, data, err, NFTNL_PARSE_BUFFER); |
| 1072 | } |
| 1073 | -EXPORT_SYMBOL(nftnl_obj_parse); |
| 1074 | |
| 1075 | -int nftnl_obj_parse_file(struct nftnl_obj *obj, enum nftnl_parse_type type, |
| 1076 | +int __EXPORTED nftnl_obj_parse_file(struct nftnl_obj *obj, enum nftnl_parse_type type, |
| 1077 | FILE *fp, struct nftnl_parse_err *err) |
| 1078 | { |
| 1079 | return nftnl_obj_do_parse(obj, type, fp, err, NFTNL_PARSE_FILE); |
| 1080 | } |
| 1081 | -EXPORT_SYMBOL(nftnl_obj_parse_file); |
| 1082 | |
| 1083 | static int nftnl_obj_export(char *buf, size_t size, |
| 1084 | const struct nftnl_obj *obj, |
| 1085 | @@ -469,13 +448,12 @@ static int nftnl_obj_cmd_snprintf(char *buf, size_t size, |
| 1086 | return offset; |
| 1087 | } |
| 1088 | |
| 1089 | -int nftnl_obj_snprintf(char *buf, size_t size, const struct nftnl_obj *obj, |
| 1090 | +int __EXPORTED nftnl_obj_snprintf(char *buf, size_t size, const struct nftnl_obj *obj, |
| 1091 | uint32_t type, uint32_t flags) |
| 1092 | { |
| 1093 | return nftnl_obj_cmd_snprintf(buf, size, obj, nftnl_flag2cmd(flags), |
| 1094 | type, flags); |
| 1095 | } |
| 1096 | -EXPORT_SYMBOL(nftnl_obj_snprintf); |
| 1097 | |
| 1098 | static int nftnl_obj_do_snprintf(char *buf, size_t size, const void *obj, |
| 1099 | uint32_t cmd, uint32_t type, uint32_t flags) |
| 1100 | @@ -483,19 +461,18 @@ static int nftnl_obj_do_snprintf(char *buf, size_t size, const void *obj, |
| 1101 | return nftnl_obj_snprintf(buf, size, obj, type, flags); |
| 1102 | } |
| 1103 | |
| 1104 | -int nftnl_obj_fprintf(FILE *fp, const struct nftnl_obj *obj, uint32_t type, |
| 1105 | +int __EXPORTED nftnl_obj_fprintf(FILE *fp, const struct nftnl_obj *obj, uint32_t type, |
| 1106 | uint32_t flags) |
| 1107 | { |
| 1108 | return nftnl_fprintf(fp, obj, NFTNL_CMD_UNSPEC, type, flags, |
| 1109 | nftnl_obj_do_snprintf); |
| 1110 | } |
| 1111 | -EXPORT_SYMBOL(nftnl_obj_fprintf); |
| 1112 | |
| 1113 | struct nftnl_obj_list { |
| 1114 | struct list_head list; |
| 1115 | }; |
| 1116 | |
| 1117 | -struct nftnl_obj_list *nftnl_obj_list_alloc(void) |
| 1118 | +struct nftnl_obj_list __EXPORTED *nftnl_obj_list_alloc(void) |
| 1119 | { |
| 1120 | struct nftnl_obj_list *list; |
| 1121 | |
| 1122 | @@ -507,9 +484,8 @@ struct nftnl_obj_list *nftnl_obj_list_alloc(void) |
| 1123 | |
| 1124 | return list; |
| 1125 | } |
| 1126 | -EXPORT_SYMBOL(nftnl_obj_list_alloc); |
| 1127 | |
| 1128 | -void nftnl_obj_list_free(struct nftnl_obj_list *list) |
| 1129 | +void __EXPORTED nftnl_obj_list_free(struct nftnl_obj_list *list) |
| 1130 | { |
| 1131 | struct nftnl_obj *r, *tmp; |
| 1132 | |
| 1133 | @@ -519,34 +495,29 @@ void nftnl_obj_list_free(struct nftnl_obj_list *list) |
| 1134 | } |
| 1135 | xfree(list); |
| 1136 | } |
| 1137 | -EXPORT_SYMBOL(nftnl_obj_list_free); |
| 1138 | |
| 1139 | -int nftnl_obj_list_is_empty(struct nftnl_obj_list *list) |
| 1140 | +int __EXPORTED nftnl_obj_list_is_empty(struct nftnl_obj_list *list) |
| 1141 | { |
| 1142 | return list_empty(&list->list); |
| 1143 | } |
| 1144 | -EXPORT_SYMBOL(nftnl_obj_list_is_empty); |
| 1145 | |
| 1146 | -void nftnl_obj_list_add(struct nftnl_obj *r, struct nftnl_obj_list *list) |
| 1147 | +void __EXPORTED nftnl_obj_list_add(struct nftnl_obj *r, struct nftnl_obj_list *list) |
| 1148 | { |
| 1149 | list_add(&r->head, &list->list); |
| 1150 | } |
| 1151 | -EXPORT_SYMBOL(nftnl_obj_list_add); |
| 1152 | |
| 1153 | -void nftnl_obj_list_add_tail(struct nftnl_obj *r, |
| 1154 | +void __EXPORTED nftnl_obj_list_add_tail(struct nftnl_obj *r, |
| 1155 | struct nftnl_obj_list *list) |
| 1156 | { |
| 1157 | list_add_tail(&r->head, &list->list); |
| 1158 | } |
| 1159 | -EXPORT_SYMBOL(nftnl_obj_list_add_tail); |
| 1160 | |
| 1161 | -void nftnl_obj_list_del(struct nftnl_obj *t) |
| 1162 | +void __EXPORTED nftnl_obj_list_del(struct nftnl_obj *t) |
| 1163 | { |
| 1164 | list_del(&t->head); |
| 1165 | } |
| 1166 | -EXPORT_SYMBOL(nftnl_obj_list_del); |
| 1167 | |
| 1168 | -int nftnl_obj_list_foreach(struct nftnl_obj_list *table_list, |
| 1169 | +int __EXPORTED nftnl_obj_list_foreach(struct nftnl_obj_list *table_list, |
| 1170 | int (*cb)(struct nftnl_obj *t, void *data), |
| 1171 | void *data) |
| 1172 | { |
| 1173 | @@ -560,14 +531,13 @@ int nftnl_obj_list_foreach(struct nftnl_obj_list *table_list, |
| 1174 | } |
| 1175 | return 0; |
| 1176 | } |
| 1177 | -EXPORT_SYMBOL(nftnl_obj_list_foreach); |
| 1178 | |
| 1179 | struct nftnl_obj_list_iter { |
| 1180 | struct nftnl_obj_list *list; |
| 1181 | struct nftnl_obj *cur; |
| 1182 | }; |
| 1183 | |
| 1184 | -struct nftnl_obj_list_iter * |
| 1185 | +struct nftnl_obj_list_iter __EXPORTED * |
| 1186 | nftnl_obj_list_iter_create(struct nftnl_obj_list *l) |
| 1187 | { |
| 1188 | struct nftnl_obj_list_iter *iter; |
| 1189 | @@ -584,9 +554,8 @@ nftnl_obj_list_iter_create(struct nftnl_obj_list *l) |
| 1190 | |
| 1191 | return iter; |
| 1192 | } |
| 1193 | -EXPORT_SYMBOL(nftnl_obj_list_iter_create); |
| 1194 | |
| 1195 | -struct nftnl_obj *nftnl_obj_list_iter_next(struct nftnl_obj_list_iter *iter) |
| 1196 | +struct nftnl_obj __EXPORTED *nftnl_obj_list_iter_next(struct nftnl_obj_list_iter *iter) |
| 1197 | { |
| 1198 | struct nftnl_obj *r = iter->cur; |
| 1199 | |
| 1200 | @@ -600,10 +569,8 @@ struct nftnl_obj *nftnl_obj_list_iter_next(struct nftnl_obj_list_iter *iter) |
| 1201 | |
| 1202 | return r; |
| 1203 | } |
| 1204 | -EXPORT_SYMBOL(nftnl_obj_list_iter_next); |
| 1205 | |
| 1206 | -void nftnl_obj_list_iter_destroy(struct nftnl_obj_list_iter *iter) |
| 1207 | +void __EXPORTED nftnl_obj_list_iter_destroy(struct nftnl_obj_list_iter *iter) |
| 1208 | { |
| 1209 | xfree(iter); |
| 1210 | } |
| 1211 | -EXPORT_SYMBOL(nftnl_obj_list_iter_destroy); |
| 1212 | diff --git a/src/rule.c b/src/rule.c |
| 1213 | index 6c22141..ad8609f 100644 |
| 1214 | --- a/src/rule.c |
| 1215 | +++ b/src/rule.c |
| 1216 | @@ -52,7 +52,7 @@ struct nftnl_rule { |
| 1217 | struct list_head expr_list; |
| 1218 | }; |
| 1219 | |
| 1220 | -struct nftnl_rule *nftnl_rule_alloc(void) |
| 1221 | +struct nftnl_rule __EXPORTED *nftnl_rule_alloc(void) |
| 1222 | { |
| 1223 | struct nftnl_rule *r; |
| 1224 | |
| 1225 | @@ -64,9 +64,8 @@ struct nftnl_rule *nftnl_rule_alloc(void) |
| 1226 | |
| 1227 | return r; |
| 1228 | } |
| 1229 | -EXPORT_SYMBOL(nftnl_rule_alloc); |
| 1230 | |
| 1231 | -void nftnl_rule_free(const struct nftnl_rule *r) |
| 1232 | +void __EXPORTED nftnl_rule_free(const struct nftnl_rule *r) |
| 1233 | { |
| 1234 | struct nftnl_expr *e, *tmp; |
| 1235 | |
| 1236 | @@ -82,15 +81,13 @@ void nftnl_rule_free(const struct nftnl_rule *r) |
| 1237 | |
| 1238 | xfree(r); |
| 1239 | } |
| 1240 | -EXPORT_SYMBOL(nftnl_rule_free); |
| 1241 | |
| 1242 | -bool nftnl_rule_is_set(const struct nftnl_rule *r, uint16_t attr) |
| 1243 | +bool __EXPORTED nftnl_rule_is_set(const struct nftnl_rule *r, uint16_t attr) |
| 1244 | { |
| 1245 | return r->flags & (1 << attr); |
| 1246 | } |
| 1247 | -EXPORT_SYMBOL(nftnl_rule_is_set); |
| 1248 | |
| 1249 | -void nftnl_rule_unset(struct nftnl_rule *r, uint16_t attr) |
| 1250 | +void __EXPORTED nftnl_rule_unset(struct nftnl_rule *r, uint16_t attr) |
| 1251 | { |
| 1252 | if (!(r->flags & (1 << attr))) |
| 1253 | return; |
| 1254 | @@ -116,7 +113,6 @@ void nftnl_rule_unset(struct nftnl_rule *r, uint16_t attr) |
| 1255 | |
| 1256 | r->flags &= ~(1 << attr); |
| 1257 | } |
| 1258 | -EXPORT_SYMBOL(nftnl_rule_unset); |
| 1259 | |
| 1260 | static uint32_t nftnl_rule_validate[NFTNL_RULE_MAX + 1] = { |
| 1261 | [NFTNL_RULE_HANDLE] = sizeof(uint64_t), |
| 1262 | @@ -127,7 +123,7 @@ static uint32_t nftnl_rule_validate[NFTNL_RULE_MAX + 1] = { |
| 1263 | [NFTNL_RULE_ID] = sizeof(uint32_t), |
| 1264 | }; |
| 1265 | |
| 1266 | -int nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr, |
| 1267 | +int __EXPORTED nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr, |
| 1268 | const void *data, uint32_t data_len) |
| 1269 | { |
| 1270 | nftnl_assert_attr_exists(attr, NFTNL_RULE_MAX); |
| 1271 | @@ -183,33 +179,28 @@ int nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr, |
| 1272 | r->flags |= (1 << attr); |
| 1273 | return 0; |
| 1274 | } |
| 1275 | -EXPORT_SYMBOL(nftnl_rule_set_data); |
| 1276 | |
| 1277 | -int nftnl_rule_set(struct nftnl_rule *r, uint16_t attr, const void *data) |
| 1278 | +int __EXPORTED nftnl_rule_set(struct nftnl_rule *r, uint16_t attr, const void *data) |
| 1279 | { |
| 1280 | return nftnl_rule_set_data(r, attr, data, nftnl_rule_validate[attr]); |
| 1281 | } |
| 1282 | -EXPORT_SYMBOL(nftnl_rule_set); |
| 1283 | |
| 1284 | -void nftnl_rule_set_u32(struct nftnl_rule *r, uint16_t attr, uint32_t val) |
| 1285 | +void __EXPORTED nftnl_rule_set_u32(struct nftnl_rule *r, uint16_t attr, uint32_t val) |
| 1286 | { |
| 1287 | nftnl_rule_set_data(r, attr, &val, sizeof(uint32_t)); |
| 1288 | } |
| 1289 | -EXPORT_SYMBOL(nftnl_rule_set_u32); |
| 1290 | |
| 1291 | -void nftnl_rule_set_u64(struct nftnl_rule *r, uint16_t attr, uint64_t val) |
| 1292 | +void __EXPORTED nftnl_rule_set_u64(struct nftnl_rule *r, uint16_t attr, uint64_t val) |
| 1293 | { |
| 1294 | nftnl_rule_set_data(r, attr, &val, sizeof(uint64_t)); |
| 1295 | } |
| 1296 | -EXPORT_SYMBOL(nftnl_rule_set_u64); |
| 1297 | |
| 1298 | -int nftnl_rule_set_str(struct nftnl_rule *r, uint16_t attr, const char *str) |
| 1299 | +int __EXPORTED nftnl_rule_set_str(struct nftnl_rule *r, uint16_t attr, const char *str) |
| 1300 | { |
| 1301 | return nftnl_rule_set_data(r, attr, str, strlen(str) + 1); |
| 1302 | } |
| 1303 | -EXPORT_SYMBOL(nftnl_rule_set_str); |
| 1304 | |
| 1305 | -const void *nftnl_rule_get_data(const struct nftnl_rule *r, uint16_t attr, |
| 1306 | +const void __EXPORTED *nftnl_rule_get_data(const struct nftnl_rule *r, uint16_t attr, |
| 1307 | uint32_t *data_len) |
| 1308 | { |
| 1309 | if (!(r->flags & (1 << attr))) |
| 1310 | @@ -246,22 +237,19 @@ const void *nftnl_rule_get_data(const struct nftnl_rule *r, uint16_t attr, |
| 1311 | } |
| 1312 | return NULL; |
| 1313 | } |
| 1314 | -EXPORT_SYMBOL(nftnl_rule_get_data); |
| 1315 | |
| 1316 | -const void *nftnl_rule_get(const struct nftnl_rule *r, uint16_t attr) |
| 1317 | +const void __EXPORTED *nftnl_rule_get(const struct nftnl_rule *r, uint16_t attr) |
| 1318 | { |
| 1319 | uint32_t data_len; |
| 1320 | return nftnl_rule_get_data(r, attr, &data_len); |
| 1321 | } |
| 1322 | -EXPORT_SYMBOL(nftnl_rule_get); |
| 1323 | |
| 1324 | -const char *nftnl_rule_get_str(const struct nftnl_rule *r, uint16_t attr) |
| 1325 | +const char __EXPORTED *nftnl_rule_get_str(const struct nftnl_rule *r, uint16_t attr) |
| 1326 | { |
| 1327 | return nftnl_rule_get(r, attr); |
| 1328 | } |
| 1329 | -EXPORT_SYMBOL(nftnl_rule_get_str); |
| 1330 | |
| 1331 | -uint32_t nftnl_rule_get_u32(const struct nftnl_rule *r, uint16_t attr) |
| 1332 | +uint32_t __EXPORTED nftnl_rule_get_u32(const struct nftnl_rule *r, uint16_t attr) |
| 1333 | { |
| 1334 | uint32_t data_len; |
| 1335 | const uint32_t *val = nftnl_rule_get_data(r, attr, &data_len); |
| 1336 | @@ -270,9 +258,8 @@ uint32_t nftnl_rule_get_u32(const struct nftnl_rule *r, uint16_t attr) |
| 1337 | |
| 1338 | return val ? *val : 0; |
| 1339 | } |
| 1340 | -EXPORT_SYMBOL(nftnl_rule_get_u32); |
| 1341 | |
| 1342 | -uint64_t nftnl_rule_get_u64(const struct nftnl_rule *r, uint16_t attr) |
| 1343 | +uint64_t __EXPORTED nftnl_rule_get_u64(const struct nftnl_rule *r, uint16_t attr) |
| 1344 | { |
| 1345 | uint32_t data_len; |
| 1346 | const uint64_t *val = nftnl_rule_get_data(r, attr, &data_len); |
| 1347 | @@ -281,9 +268,8 @@ uint64_t nftnl_rule_get_u64(const struct nftnl_rule *r, uint16_t attr) |
| 1348 | |
| 1349 | return val ? *val : 0; |
| 1350 | } |
| 1351 | -EXPORT_SYMBOL(nftnl_rule_get_u64); |
| 1352 | |
| 1353 | -uint8_t nftnl_rule_get_u8(const struct nftnl_rule *r, uint16_t attr) |
| 1354 | +uint8_t __EXPORTED nftnl_rule_get_u8(const struct nftnl_rule *r, uint16_t attr) |
| 1355 | { |
| 1356 | uint32_t data_len; |
| 1357 | const uint8_t *val = nftnl_rule_get_data(r, attr, &data_len); |
| 1358 | @@ -292,9 +278,8 @@ uint8_t nftnl_rule_get_u8(const struct nftnl_rule *r, uint16_t attr) |
| 1359 | |
| 1360 | return val ? *val : 0; |
| 1361 | } |
| 1362 | -EXPORT_SYMBOL(nftnl_rule_get_u8); |
| 1363 | |
| 1364 | -void nftnl_rule_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_rule *r) |
| 1365 | +void __EXPORTED nftnl_rule_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_rule *r) |
| 1366 | { |
| 1367 | struct nftnl_expr *expr; |
| 1368 | struct nlattr *nest, *nest2; |
| 1369 | @@ -335,13 +320,11 @@ void nftnl_rule_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_rule *r) |
| 1370 | if (r->flags & (1 << NFTNL_RULE_ID)) |
| 1371 | mnl_attr_put_u32(nlh, NFTA_RULE_ID, htonl(r->id)); |
| 1372 | } |
| 1373 | -EXPORT_SYMBOL(nftnl_rule_nlmsg_build_payload); |
| 1374 | |
| 1375 | -void nftnl_rule_add_expr(struct nftnl_rule *r, struct nftnl_expr *expr) |
| 1376 | +void __EXPORTED nftnl_rule_add_expr(struct nftnl_rule *r, struct nftnl_expr *expr) |
| 1377 | { |
| 1378 | list_add_tail(&expr->head, &r->expr_list); |
| 1379 | } |
| 1380 | -EXPORT_SYMBOL(nftnl_rule_add_expr); |
| 1381 | |
| 1382 | static int nftnl_rule_parse_attr_cb(const struct nlattr *attr, void *data) |
| 1383 | { |
| 1384 | @@ -441,7 +424,7 @@ static int nftnl_rule_parse_compat(struct nlattr *nest, struct nftnl_rule *r) |
| 1385 | return 0; |
| 1386 | } |
| 1387 | |
| 1388 | -int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r) |
| 1389 | +int __EXPORTED nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r) |
| 1390 | { |
| 1391 | struct nlattr *tb[NFTA_RULE_MAX+1] = {}; |
| 1392 | struct nfgenmsg *nfg = mnl_nlmsg_get_payload(nlh); |
| 1393 | @@ -510,7 +493,6 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r) |
| 1394 | |
| 1395 | return 0; |
| 1396 | } |
| 1397 | -EXPORT_SYMBOL(nftnl_rule_nlmsg_parse); |
| 1398 | |
| 1399 | #ifdef JSON_PARSING |
| 1400 | int nftnl_jansson_parse_rule(struct nftnl_rule *r, json_t *tree, |
| 1401 | @@ -658,19 +640,17 @@ static int nftnl_rule_do_parse(struct nftnl_rule *r, enum nftnl_parse_type type, |
| 1402 | |
| 1403 | return ret; |
| 1404 | } |
| 1405 | -int nftnl_rule_parse(struct nftnl_rule *r, enum nftnl_parse_type type, |
| 1406 | +int __EXPORTED nftnl_rule_parse(struct nftnl_rule *r, enum nftnl_parse_type type, |
| 1407 | const char *data, struct nftnl_parse_err *err) |
| 1408 | { |
| 1409 | return nftnl_rule_do_parse(r, type, data, err, NFTNL_PARSE_BUFFER); |
| 1410 | } |
| 1411 | -EXPORT_SYMBOL(nftnl_rule_parse); |
| 1412 | |
| 1413 | -int nftnl_rule_parse_file(struct nftnl_rule *r, enum nftnl_parse_type type, |
| 1414 | +int __EXPORTED nftnl_rule_parse_file(struct nftnl_rule *r, enum nftnl_parse_type type, |
| 1415 | FILE *fp, struct nftnl_parse_err *err) |
| 1416 | { |
| 1417 | return nftnl_rule_do_parse(r, type, fp, err, NFTNL_PARSE_FILE); |
| 1418 | } |
| 1419 | -EXPORT_SYMBOL(nftnl_rule_parse_file); |
| 1420 | |
| 1421 | static int nftnl_rule_export(char *buf, size_t size, |
| 1422 | const struct nftnl_rule *r, |
| 1423 | @@ -819,13 +799,12 @@ static int nftnl_rule_cmd_snprintf(char *buf, size_t size, |
| 1424 | return offset; |
| 1425 | } |
| 1426 | |
| 1427 | -int nftnl_rule_snprintf(char *buf, size_t size, const struct nftnl_rule *r, |
| 1428 | +int __EXPORTED nftnl_rule_snprintf(char *buf, size_t size, const struct nftnl_rule *r, |
| 1429 | uint32_t type, uint32_t flags) |
| 1430 | { |
| 1431 | return nftnl_rule_cmd_snprintf(buf, size, r, nftnl_flag2cmd(flags), type, |
| 1432 | flags); |
| 1433 | } |
| 1434 | -EXPORT_SYMBOL(nftnl_rule_snprintf); |
| 1435 | |
| 1436 | static int nftnl_rule_do_snprintf(char *buf, size_t size, const void *r, |
| 1437 | uint32_t cmd, uint32_t type, uint32_t flags) |
| 1438 | @@ -833,15 +812,14 @@ static int nftnl_rule_do_snprintf(char *buf, size_t size, const void *r, |
| 1439 | return nftnl_rule_snprintf(buf, size, r, type, flags); |
| 1440 | } |
| 1441 | |
| 1442 | -int nftnl_rule_fprintf(FILE *fp, const struct nftnl_rule *r, uint32_t type, |
| 1443 | +int __EXPORTED nftnl_rule_fprintf(FILE *fp, const struct nftnl_rule *r, uint32_t type, |
| 1444 | uint32_t flags) |
| 1445 | { |
| 1446 | return nftnl_fprintf(fp, r, NFTNL_CMD_UNSPEC, type, flags, |
| 1447 | nftnl_rule_do_snprintf); |
| 1448 | } |
| 1449 | -EXPORT_SYMBOL(nftnl_rule_fprintf); |
| 1450 | |
| 1451 | -int nftnl_expr_foreach(struct nftnl_rule *r, |
| 1452 | +int __EXPORTED nftnl_expr_foreach(struct nftnl_rule *r, |
| 1453 | int (*cb)(struct nftnl_expr *e, void *data), |
| 1454 | void *data) |
| 1455 | { |
| 1456 | @@ -855,7 +833,6 @@ int nftnl_expr_foreach(struct nftnl_rule *r, |
| 1457 | } |
| 1458 | return 0; |
| 1459 | } |
| 1460 | -EXPORT_SYMBOL(nftnl_expr_foreach); |
| 1461 | |
| 1462 | struct nftnl_expr_iter { |
| 1463 | const struct nftnl_rule *r; |
| 1464 | @@ -873,7 +850,7 @@ static void nftnl_expr_iter_init(const struct nftnl_rule *r, |
| 1465 | head); |
| 1466 | } |
| 1467 | |
| 1468 | -struct nftnl_expr_iter *nftnl_expr_iter_create(const struct nftnl_rule *r) |
| 1469 | +struct nftnl_expr_iter __EXPORTED *nftnl_expr_iter_create(const struct nftnl_rule *r) |
| 1470 | { |
| 1471 | struct nftnl_expr_iter *iter; |
| 1472 | |
| 1473 | @@ -885,9 +862,8 @@ struct nftnl_expr_iter *nftnl_expr_iter_create(const struct nftnl_rule *r) |
| 1474 | |
| 1475 | return iter; |
| 1476 | } |
| 1477 | -EXPORT_SYMBOL(nftnl_expr_iter_create); |
| 1478 | |
| 1479 | -struct nftnl_expr *nftnl_expr_iter_next(struct nftnl_expr_iter *iter) |
| 1480 | +struct nftnl_expr __EXPORTED *nftnl_expr_iter_next(struct nftnl_expr_iter *iter) |
| 1481 | { |
| 1482 | struct nftnl_expr *expr = iter->cur; |
| 1483 | |
| 1484 | @@ -901,15 +877,13 @@ struct nftnl_expr *nftnl_expr_iter_next(struct nftnl_expr_iter *iter) |
| 1485 | |
| 1486 | return expr; |
| 1487 | } |
| 1488 | -EXPORT_SYMBOL(nftnl_expr_iter_next); |
| 1489 | |
| 1490 | -void nftnl_expr_iter_destroy(struct nftnl_expr_iter *iter) |
| 1491 | +void __EXPORTED nftnl_expr_iter_destroy(struct nftnl_expr_iter *iter) |
| 1492 | { |
| 1493 | xfree(iter); |
| 1494 | } |
| 1495 | -EXPORT_SYMBOL(nftnl_expr_iter_destroy); |
| 1496 | |
| 1497 | -bool nftnl_rule_cmp(const struct nftnl_rule *r1, const struct nftnl_rule *r2) |
| 1498 | +bool __EXPORTED nftnl_rule_cmp(const struct nftnl_rule *r1, const struct nftnl_rule *r2) |
| 1499 | { |
| 1500 | struct nftnl_expr_iter it1, it2; |
| 1501 | struct nftnl_expr *e1, *e2; |
| 1502 | @@ -938,13 +912,12 @@ bool nftnl_rule_cmp(const struct nftnl_rule *r1, const struct nftnl_rule *r2) |
| 1503 | |
| 1504 | return eq; |
| 1505 | } |
| 1506 | -EXPORT_SYMBOL(nftnl_rule_cmp); |
| 1507 | |
| 1508 | struct nftnl_rule_list { |
| 1509 | struct list_head list; |
| 1510 | }; |
| 1511 | |
| 1512 | -struct nftnl_rule_list *nftnl_rule_list_alloc(void) |
| 1513 | +struct nftnl_rule_list __EXPORTED *nftnl_rule_list_alloc(void) |
| 1514 | { |
| 1515 | struct nftnl_rule_list *list; |
| 1516 | |
| 1517 | @@ -956,9 +929,8 @@ struct nftnl_rule_list *nftnl_rule_list_alloc(void) |
| 1518 | |
| 1519 | return list; |
| 1520 | } |
| 1521 | -EXPORT_SYMBOL(nftnl_rule_list_alloc); |
| 1522 | |
| 1523 | -void nftnl_rule_list_free(struct nftnl_rule_list *list) |
| 1524 | +void __EXPORTED nftnl_rule_list_free(struct nftnl_rule_list *list) |
| 1525 | { |
| 1526 | struct nftnl_rule *r, *tmp; |
| 1527 | |
| 1528 | @@ -968,33 +940,28 @@ void nftnl_rule_list_free(struct nftnl_rule_list *list) |
| 1529 | } |
| 1530 | xfree(list); |
| 1531 | } |
| 1532 | -EXPORT_SYMBOL(nftnl_rule_list_free); |
| 1533 | |
| 1534 | -int nftnl_rule_list_is_empty(const struct nftnl_rule_list *list) |
| 1535 | +int __EXPORTED nftnl_rule_list_is_empty(const struct nftnl_rule_list *list) |
| 1536 | { |
| 1537 | return list_empty(&list->list); |
| 1538 | } |
| 1539 | -EXPORT_SYMBOL(nftnl_rule_list_is_empty); |
| 1540 | |
| 1541 | -void nftnl_rule_list_add(struct nftnl_rule *r, struct nftnl_rule_list *list) |
| 1542 | +void __EXPORTED nftnl_rule_list_add(struct nftnl_rule *r, struct nftnl_rule_list *list) |
| 1543 | { |
| 1544 | list_add(&r->head, &list->list); |
| 1545 | } |
| 1546 | -EXPORT_SYMBOL(nftnl_rule_list_add); |
| 1547 | |
| 1548 | -void nftnl_rule_list_add_tail(struct nftnl_rule *r, struct nftnl_rule_list *list) |
| 1549 | +void __EXPORTED nftnl_rule_list_add_tail(struct nftnl_rule *r, struct nftnl_rule_list *list) |
| 1550 | { |
| 1551 | list_add_tail(&r->head, &list->list); |
| 1552 | } |
| 1553 | -EXPORT_SYMBOL(nftnl_rule_list_add_tail); |
| 1554 | |
| 1555 | -void nftnl_rule_list_del(struct nftnl_rule *r) |
| 1556 | +void __EXPORTED nftnl_rule_list_del(struct nftnl_rule *r) |
| 1557 | { |
| 1558 | list_del(&r->head); |
| 1559 | } |
| 1560 | -EXPORT_SYMBOL(nftnl_rule_list_del); |
| 1561 | |
| 1562 | -int nftnl_rule_list_foreach(struct nftnl_rule_list *rule_list, |
| 1563 | +int __EXPORTED nftnl_rule_list_foreach(struct nftnl_rule_list *rule_list, |
| 1564 | int (*cb)(struct nftnl_rule *r, void *data), |
| 1565 | void *data) |
| 1566 | { |
| 1567 | @@ -1008,14 +975,13 @@ int nftnl_rule_list_foreach(struct nftnl_rule_list *rule_list, |
| 1568 | } |
| 1569 | return 0; |
| 1570 | } |
| 1571 | -EXPORT_SYMBOL(nftnl_rule_list_foreach); |
| 1572 | |
| 1573 | struct nftnl_rule_list_iter { |
| 1574 | const struct nftnl_rule_list *list; |
| 1575 | struct nftnl_rule *cur; |
| 1576 | }; |
| 1577 | |
| 1578 | -struct nftnl_rule_list_iter * |
| 1579 | +struct nftnl_rule_list_iter __EXPORTED * |
| 1580 | nftnl_rule_list_iter_create(const struct nftnl_rule_list *l) |
| 1581 | { |
| 1582 | struct nftnl_rule_list_iter *iter; |
| 1583 | @@ -1032,15 +998,13 @@ nftnl_rule_list_iter_create(const struct nftnl_rule_list *l) |
| 1584 | |
| 1585 | return iter; |
| 1586 | } |
| 1587 | -EXPORT_SYMBOL(nftnl_rule_list_iter_create); |
| 1588 | |
| 1589 | -struct nftnl_rule *nftnl_rule_list_iter_cur(struct nftnl_rule_list_iter *iter) |
| 1590 | +struct nftnl_rule __EXPORTED *nftnl_rule_list_iter_cur(struct nftnl_rule_list_iter *iter) |
| 1591 | { |
| 1592 | return iter->cur; |
| 1593 | } |
| 1594 | -EXPORT_SYMBOL(nftnl_rule_list_iter_cur); |
| 1595 | |
| 1596 | -struct nftnl_rule *nftnl_rule_list_iter_next(struct nftnl_rule_list_iter *iter) |
| 1597 | +struct nftnl_rule __EXPORTED *nftnl_rule_list_iter_next(struct nftnl_rule_list_iter *iter) |
| 1598 | { |
| 1599 | struct nftnl_rule *r = iter->cur; |
| 1600 | |
| 1601 | @@ -1054,10 +1018,8 @@ struct nftnl_rule *nftnl_rule_list_iter_next(struct nftnl_rule_list_iter *iter) |
| 1602 | |
| 1603 | return r; |
| 1604 | } |
| 1605 | -EXPORT_SYMBOL(nftnl_rule_list_iter_next); |
| 1606 | |
| 1607 | -void nftnl_rule_list_iter_destroy(const struct nftnl_rule_list_iter *iter) |
| 1608 | +void __EXPORTED nftnl_rule_list_iter_destroy(const struct nftnl_rule_list_iter *iter) |
| 1609 | { |
| 1610 | xfree(iter); |
| 1611 | } |
| 1612 | -EXPORT_SYMBOL(nftnl_rule_list_iter_destroy); |
| 1613 | diff --git a/src/ruleset.c b/src/ruleset.c |
| 1614 | index 6ef2956..10d48f6 100644 |
| 1615 | --- a/src/ruleset.c |
| 1616 | +++ b/src/ruleset.c |
| 1617 | @@ -55,13 +55,12 @@ struct nftnl_parse_ctx { |
| 1618 | uint16_t flags; |
| 1619 | }; |
| 1620 | |
| 1621 | -struct nftnl_ruleset *nftnl_ruleset_alloc(void) |
| 1622 | +struct nftnl_ruleset __EXPORTED *nftnl_ruleset_alloc(void) |
| 1623 | { |
| 1624 | return calloc(1, sizeof(struct nftnl_ruleset)); |
| 1625 | } |
| 1626 | -EXPORT_SYMBOL(nftnl_ruleset_alloc); |
| 1627 | |
| 1628 | -void nftnl_ruleset_free(const struct nftnl_ruleset *r) |
| 1629 | +void __EXPORTED nftnl_ruleset_free(const struct nftnl_ruleset *r) |
| 1630 | { |
| 1631 | if (r->flags & (1 << NFTNL_RULESET_TABLELIST)) |
| 1632 | nftnl_table_list_free(r->table_list); |
| 1633 | @@ -73,15 +72,13 @@ void nftnl_ruleset_free(const struct nftnl_ruleset *r) |
| 1634 | nftnl_rule_list_free(r->rule_list); |
| 1635 | xfree(r); |
| 1636 | } |
| 1637 | -EXPORT_SYMBOL(nftnl_ruleset_free); |
| 1638 | |
| 1639 | -bool nftnl_ruleset_is_set(const struct nftnl_ruleset *r, uint16_t attr) |
| 1640 | +bool __EXPORTED nftnl_ruleset_is_set(const struct nftnl_ruleset *r, uint16_t attr) |
| 1641 | { |
| 1642 | return r->flags & (1 << attr); |
| 1643 | } |
| 1644 | -EXPORT_SYMBOL(nftnl_ruleset_is_set); |
| 1645 | |
| 1646 | -void nftnl_ruleset_unset(struct nftnl_ruleset *r, uint16_t attr) |
| 1647 | +void __EXPORTED nftnl_ruleset_unset(struct nftnl_ruleset *r, uint16_t attr) |
| 1648 | { |
| 1649 | if (!(r->flags & (1 << attr))) |
| 1650 | return; |
| 1651 | @@ -102,9 +99,8 @@ void nftnl_ruleset_unset(struct nftnl_ruleset *r, uint16_t attr) |
| 1652 | } |
| 1653 | r->flags &= ~(1 << attr); |
| 1654 | } |
| 1655 | -EXPORT_SYMBOL(nftnl_ruleset_unset); |
| 1656 | |
| 1657 | -void nftnl_ruleset_set(struct nftnl_ruleset *r, uint16_t attr, void *data) |
| 1658 | +void __EXPORTED nftnl_ruleset_set(struct nftnl_ruleset *r, uint16_t attr, void *data) |
| 1659 | { |
| 1660 | switch (attr) { |
| 1661 | case NFTNL_RULESET_TABLELIST: |
| 1662 | @@ -128,9 +124,8 @@ void nftnl_ruleset_set(struct nftnl_ruleset *r, uint16_t attr, void *data) |
| 1663 | } |
| 1664 | r->flags |= (1 << attr); |
| 1665 | } |
| 1666 | -EXPORT_SYMBOL(nftnl_ruleset_set); |
| 1667 | |
| 1668 | -void *nftnl_ruleset_get(const struct nftnl_ruleset *r, uint16_t attr) |
| 1669 | +void __EXPORTED *nftnl_ruleset_get(const struct nftnl_ruleset *r, uint16_t attr) |
| 1670 | { |
| 1671 | if (!(r->flags & (1 << attr))) |
| 1672 | return NULL; |
| 1673 | @@ -148,9 +143,8 @@ void *nftnl_ruleset_get(const struct nftnl_ruleset *r, uint16_t attr) |
| 1674 | return NULL; |
| 1675 | } |
| 1676 | } |
| 1677 | -EXPORT_SYMBOL(nftnl_ruleset_get); |
| 1678 | |
| 1679 | -void nftnl_ruleset_ctx_free(const struct nftnl_parse_ctx *ctx) |
| 1680 | +void __EXPORTED nftnl_ruleset_ctx_free(const struct nftnl_parse_ctx *ctx) |
| 1681 | { |
| 1682 | switch (ctx->type) { |
| 1683 | case NFTNL_RULESET_TABLE: |
| 1684 | @@ -171,15 +165,13 @@ void nftnl_ruleset_ctx_free(const struct nftnl_parse_ctx *ctx) |
| 1685 | break; |
| 1686 | } |
| 1687 | } |
| 1688 | -EXPORT_SYMBOL(nftnl_ruleset_ctx_free); |
| 1689 | |
| 1690 | -bool nftnl_ruleset_ctx_is_set(const struct nftnl_parse_ctx *ctx, uint16_t attr) |
| 1691 | +bool __EXPORTED nftnl_ruleset_ctx_is_set(const struct nftnl_parse_ctx *ctx, uint16_t attr) |
| 1692 | { |
| 1693 | return ctx->flags & (1 << attr); |
| 1694 | } |
| 1695 | -EXPORT_SYMBOL(nftnl_ruleset_ctx_is_set); |
| 1696 | |
| 1697 | -void *nftnl_ruleset_ctx_get(const struct nftnl_parse_ctx *ctx, uint16_t attr) |
| 1698 | +void __EXPORTED *nftnl_ruleset_ctx_get(const struct nftnl_parse_ctx *ctx, uint16_t attr) |
| 1699 | { |
| 1700 | if (!(ctx->flags & (1 << attr))) |
| 1701 | return NULL; |
| 1702 | @@ -203,14 +195,12 @@ void *nftnl_ruleset_ctx_get(const struct nftnl_parse_ctx *ctx, uint16_t attr) |
| 1703 | return NULL; |
| 1704 | } |
| 1705 | } |
| 1706 | -EXPORT_SYMBOL(nftnl_ruleset_ctx_get); |
| 1707 | |
| 1708 | -uint32_t nftnl_ruleset_ctx_get_u32(const struct nftnl_parse_ctx *ctx, uint16_t attr) |
| 1709 | +uint32_t __EXPORTED nftnl_ruleset_ctx_get_u32(const struct nftnl_parse_ctx *ctx, uint16_t attr) |
| 1710 | { |
| 1711 | const void *ret = nftnl_ruleset_ctx_get(ctx, attr); |
| 1712 | return ret == NULL ? 0 : *((uint32_t *)ret); |
| 1713 | } |
| 1714 | -EXPORT_SYMBOL(nftnl_ruleset_ctx_get_u32); |
| 1715 | |
| 1716 | #if defined(JSON_PARSING) |
| 1717 | static void nftnl_ruleset_ctx_set(struct nftnl_parse_ctx *ctx, uint16_t attr, |
| 1718 | @@ -593,22 +583,20 @@ nftnl_ruleset_do_parse(enum nftnl_parse_type type, const void *data, |
| 1719 | return ret; |
| 1720 | } |
| 1721 | |
| 1722 | -int nftnl_ruleset_parse_file_cb(enum nftnl_parse_type type, FILE *fp, |
| 1723 | +int __EXPORTED nftnl_ruleset_parse_file_cb(enum nftnl_parse_type type, FILE *fp, |
| 1724 | struct nftnl_parse_err *err, void *data, |
| 1725 | int (*cb)(const struct nftnl_parse_ctx *ctx)) |
| 1726 | { |
| 1727 | return nftnl_ruleset_do_parse(type, fp, err, NFTNL_PARSE_FILE, data, cb); |
| 1728 | } |
| 1729 | -EXPORT_SYMBOL(nftnl_ruleset_parse_file_cb); |
| 1730 | |
| 1731 | -int nftnl_ruleset_parse_buffer_cb(enum nftnl_parse_type type, const char *buffer, |
| 1732 | +int __EXPORTED nftnl_ruleset_parse_buffer_cb(enum nftnl_parse_type type, const char *buffer, |
| 1733 | struct nftnl_parse_err *err, void *data, |
| 1734 | int (*cb)(const struct nftnl_parse_ctx *ctx)) |
| 1735 | { |
| 1736 | return nftnl_ruleset_do_parse(type, buffer, err, NFTNL_PARSE_BUFFER, data, |
| 1737 | cb); |
| 1738 | } |
| 1739 | -EXPORT_SYMBOL(nftnl_ruleset_parse_buffer_cb); |
| 1740 | |
| 1741 | static int nftnl_ruleset_cb(const struct nftnl_parse_ctx *ctx) |
| 1742 | { |
| 1743 | @@ -671,19 +659,17 @@ static int nftnl_ruleset_cb(const struct nftnl_parse_ctx *ctx) |
| 1744 | return 0; |
| 1745 | } |
| 1746 | |
| 1747 | -int nftnl_ruleset_parse(struct nftnl_ruleset *r, enum nftnl_parse_type type, |
| 1748 | +int __EXPORTED nftnl_ruleset_parse(struct nftnl_ruleset *r, enum nftnl_parse_type type, |
| 1749 | const char *data, struct nftnl_parse_err *err) |
| 1750 | { |
| 1751 | return nftnl_ruleset_parse_buffer_cb(type, data, err, r, nftnl_ruleset_cb); |
| 1752 | } |
| 1753 | -EXPORT_SYMBOL(nftnl_ruleset_parse); |
| 1754 | |
| 1755 | -int nftnl_ruleset_parse_file(struct nftnl_ruleset *rs, enum nftnl_parse_type type, |
| 1756 | +int __EXPORTED nftnl_ruleset_parse_file(struct nftnl_ruleset *rs, enum nftnl_parse_type type, |
| 1757 | FILE *fp, struct nftnl_parse_err *err) |
| 1758 | { |
| 1759 | return nftnl_ruleset_parse_file_cb(type, fp, err, rs, nftnl_ruleset_cb); |
| 1760 | } |
| 1761 | -EXPORT_SYMBOL(nftnl_ruleset_parse_file); |
| 1762 | |
| 1763 | static const char *nftnl_ruleset_o_opentag(uint32_t type) |
| 1764 | { |
| 1765 | @@ -928,7 +914,7 @@ static int nftnl_ruleset_cmd_snprintf(char *buf, size_t size, |
| 1766 | } |
| 1767 | } |
| 1768 | |
| 1769 | -int nftnl_ruleset_snprintf(char *buf, size_t size, const struct nftnl_ruleset *r, |
| 1770 | +int __EXPORTED nftnl_ruleset_snprintf(char *buf, size_t size, const struct nftnl_ruleset *r, |
| 1771 | uint32_t type, uint32_t flags) |
| 1772 | { |
| 1773 | switch (type) { |
| 1774 | @@ -943,7 +929,6 @@ int nftnl_ruleset_snprintf(char *buf, size_t size, const struct nftnl_ruleset *r |
| 1775 | return -1; |
| 1776 | } |
| 1777 | } |
| 1778 | -EXPORT_SYMBOL(nftnl_ruleset_snprintf); |
| 1779 | |
| 1780 | static int nftnl_ruleset_fprintf_tables(FILE *fp, const struct nftnl_ruleset *rs, |
| 1781 | uint32_t type, uint32_t flags) |
| 1782 | @@ -1157,10 +1142,9 @@ static int nftnl_ruleset_cmd_fprintf(FILE *fp, const struct nftnl_ruleset *rs, |
| 1783 | return len; |
| 1784 | } |
| 1785 | |
| 1786 | -int nftnl_ruleset_fprintf(FILE *fp, const struct nftnl_ruleset *rs, uint32_t type, |
| 1787 | +int __EXPORTED nftnl_ruleset_fprintf(FILE *fp, const struct nftnl_ruleset *rs, uint32_t type, |
| 1788 | uint32_t flags) |
| 1789 | { |
| 1790 | return nftnl_ruleset_cmd_fprintf(fp, rs, nftnl_flag2cmd(flags), type, |
| 1791 | flags); |
| 1792 | } |
| 1793 | -EXPORT_SYMBOL(nftnl_ruleset_fprintf); |
| 1794 | diff --git a/src/set.c b/src/set.c |
| 1795 | index cce5e63..33a6794 100644 |
| 1796 | --- a/src/set.c |
| 1797 | +++ b/src/set.c |
| 1798 | @@ -27,7 +27,7 @@ |
| 1799 | #include <libnftnl/set.h> |
| 1800 | #include <libnftnl/expr.h> |
| 1801 | |
| 1802 | -struct nftnl_set *nftnl_set_alloc(void) |
| 1803 | +struct nftnl_set __EXPORTED *nftnl_set_alloc(void) |
| 1804 | { |
| 1805 | struct nftnl_set *s; |
| 1806 | |
| 1807 | @@ -38,9 +38,8 @@ struct nftnl_set *nftnl_set_alloc(void) |
| 1808 | INIT_LIST_HEAD(&s->element_list); |
| 1809 | return s; |
| 1810 | } |
| 1811 | -EXPORT_SYMBOL(nftnl_set_alloc); |
| 1812 | |
| 1813 | -void nftnl_set_free(const struct nftnl_set *s) |
| 1814 | +void __EXPORTED nftnl_set_free(const struct nftnl_set *s) |
| 1815 | { |
| 1816 | struct nftnl_set_elem *elem, *tmp; |
| 1817 | |
| 1818 | @@ -55,15 +54,13 @@ void nftnl_set_free(const struct nftnl_set *s) |
| 1819 | } |
| 1820 | xfree(s); |
| 1821 | } |
| 1822 | -EXPORT_SYMBOL(nftnl_set_free); |
| 1823 | |
| 1824 | -bool nftnl_set_is_set(const struct nftnl_set *s, uint16_t attr) |
| 1825 | +bool __EXPORTED nftnl_set_is_set(const struct nftnl_set *s, uint16_t attr) |
| 1826 | { |
| 1827 | return s->flags & (1 << attr); |
| 1828 | } |
| 1829 | -EXPORT_SYMBOL(nftnl_set_is_set); |
| 1830 | |
| 1831 | -void nftnl_set_unset(struct nftnl_set *s, uint16_t attr) |
| 1832 | +void __EXPORTED nftnl_set_unset(struct nftnl_set *s, uint16_t attr) |
| 1833 | { |
| 1834 | if (!(s->flags & (1 << attr))) |
| 1835 | return; |
| 1836 | @@ -97,7 +94,6 @@ void nftnl_set_unset(struct nftnl_set *s, uint16_t attr) |
| 1837 | |
| 1838 | s->flags &= ~(1 << attr); |
| 1839 | } |
| 1840 | -EXPORT_SYMBOL(nftnl_set_unset); |
| 1841 | |
| 1842 | static uint32_t nftnl_set_validate[NFTNL_SET_MAX + 1] = { |
| 1843 | [NFTNL_SET_FLAGS] = sizeof(uint32_t), |
| 1844 | @@ -113,7 +109,7 @@ static uint32_t nftnl_set_validate[NFTNL_SET_MAX + 1] = { |
| 1845 | [NFTNL_SET_GC_INTERVAL] = sizeof(uint32_t), |
| 1846 | }; |
| 1847 | |
| 1848 | -int nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data, |
| 1849 | +int __EXPORTED nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data, |
| 1850 | uint32_t data_len) |
| 1851 | { |
| 1852 | nftnl_assert_attr_exists(attr, NFTNL_SET_MAX); |
| 1853 | @@ -186,33 +182,28 @@ int nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data, |
| 1854 | s->flags |= (1 << attr); |
| 1855 | return 0; |
| 1856 | } |
| 1857 | -EXPORT_SYMBOL(nftnl_set_set_data); |
| 1858 | |
| 1859 | -int nftnl_set_set(struct nftnl_set *s, uint16_t attr, const void *data) |
| 1860 | +int __EXPORTED nftnl_set_set(struct nftnl_set *s, uint16_t attr, const void *data) |
| 1861 | { |
| 1862 | return nftnl_set_set_data(s, attr, data, nftnl_set_validate[attr]); |
| 1863 | } |
| 1864 | -EXPORT_SYMBOL(nftnl_set_set); |
| 1865 | |
| 1866 | -void nftnl_set_set_u32(struct nftnl_set *s, uint16_t attr, uint32_t val) |
| 1867 | +void __EXPORTED nftnl_set_set_u32(struct nftnl_set *s, uint16_t attr, uint32_t val) |
| 1868 | { |
| 1869 | nftnl_set_set(s, attr, &val); |
| 1870 | } |
| 1871 | -EXPORT_SYMBOL(nftnl_set_set_u32); |
| 1872 | |
| 1873 | -void nftnl_set_set_u64(struct nftnl_set *s, uint16_t attr, uint64_t val) |
| 1874 | +void __EXPORTED nftnl_set_set_u64(struct nftnl_set *s, uint16_t attr, uint64_t val) |
| 1875 | { |
| 1876 | nftnl_set_set(s, attr, &val); |
| 1877 | } |
| 1878 | -EXPORT_SYMBOL(nftnl_set_set_u64); |
| 1879 | |
| 1880 | -int nftnl_set_set_str(struct nftnl_set *s, uint16_t attr, const char *str) |
| 1881 | +int __EXPORTED nftnl_set_set_str(struct nftnl_set *s, uint16_t attr, const char *str) |
| 1882 | { |
| 1883 | return nftnl_set_set_data(s, attr, str, strlen(str) + 1); |
| 1884 | } |
| 1885 | -EXPORT_SYMBOL(nftnl_set_set_str); |
| 1886 | |
| 1887 | -const void *nftnl_set_get_data(const struct nftnl_set *s, uint16_t attr, |
| 1888 | +const void __EXPORTED *nftnl_set_get_data(const struct nftnl_set *s, uint16_t attr, |
| 1889 | uint32_t *data_len) |
| 1890 | { |
| 1891 | if (!(s->flags & (1 << attr))) |
| 1892 | @@ -267,22 +258,19 @@ const void *nftnl_set_get_data(const struct nftnl_set *s, uint16_t attr, |
| 1893 | } |
| 1894 | return NULL; |
| 1895 | } |
| 1896 | -EXPORT_SYMBOL(nftnl_set_get_data); |
| 1897 | |
| 1898 | -const void *nftnl_set_get(const struct nftnl_set *s, uint16_t attr) |
| 1899 | +const void __EXPORTED *nftnl_set_get(const struct nftnl_set *s, uint16_t attr) |
| 1900 | { |
| 1901 | uint32_t data_len; |
| 1902 | return nftnl_set_get_data(s, attr, &data_len); |
| 1903 | } |
| 1904 | -EXPORT_SYMBOL(nftnl_set_get); |
| 1905 | |
| 1906 | -const char *nftnl_set_get_str(const struct nftnl_set *s, uint16_t attr) |
| 1907 | +const char __EXPORTED *nftnl_set_get_str(const struct nftnl_set *s, uint16_t attr) |
| 1908 | { |
| 1909 | return nftnl_set_get(s, attr); |
| 1910 | } |
| 1911 | -EXPORT_SYMBOL(nftnl_set_get_str); |
| 1912 | |
| 1913 | -uint32_t nftnl_set_get_u32(const struct nftnl_set *s, uint16_t attr) |
| 1914 | +uint32_t __EXPORTED nftnl_set_get_u32(const struct nftnl_set *s, uint16_t attr) |
| 1915 | { |
| 1916 | uint32_t data_len; |
| 1917 | const uint32_t *val = nftnl_set_get_data(s, attr, &data_len); |
| 1918 | @@ -291,9 +279,8 @@ uint32_t nftnl_set_get_u32(const struct nftnl_set *s, uint16_t attr) |
| 1919 | |
| 1920 | return val ? *val : 0; |
| 1921 | } |
| 1922 | -EXPORT_SYMBOL(nftnl_set_get_u32); |
| 1923 | |
| 1924 | -uint64_t nftnl_set_get_u64(const struct nftnl_set *s, uint16_t attr) |
| 1925 | +uint64_t __EXPORTED nftnl_set_get_u64(const struct nftnl_set *s, uint16_t attr) |
| 1926 | { |
| 1927 | uint32_t data_len; |
| 1928 | const uint64_t *val = nftnl_set_get_data(s, attr, &data_len); |
| 1929 | @@ -302,7 +289,6 @@ uint64_t nftnl_set_get_u64(const struct nftnl_set *s, uint16_t attr) |
| 1930 | |
| 1931 | return val ? *val : 0; |
| 1932 | } |
| 1933 | -EXPORT_SYMBOL(nftnl_set_get_u64); |
| 1934 | |
| 1935 | struct nftnl_set *nftnl_set_clone(const struct nftnl_set *set) |
| 1936 | { |
| 1937 | @@ -351,7 +337,7 @@ nftnl_set_nlmsg_build_desc_payload(struct nlmsghdr *nlh, struct nftnl_set *s) |
| 1938 | mnl_attr_nest_end(nlh, nest); |
| 1939 | } |
| 1940 | |
| 1941 | -void nftnl_set_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_set *s) |
| 1942 | +void __EXPORTED nftnl_set_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_set *s) |
| 1943 | { |
| 1944 | if (s->flags & (1 << NFTNL_SET_TABLE)) |
| 1945 | mnl_attr_put_strz(nlh, NFTA_SET_TABLE, s->table); |
| 1946 | @@ -383,7 +369,6 @@ void nftnl_set_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_set *s) |
| 1947 | if (s->flags & (1 << NFTNL_SET_USERDATA)) |
| 1948 | mnl_attr_put(nlh, NFTA_SET_USERDATA, s->user.len, s->user.data); |
| 1949 | } |
| 1950 | -EXPORT_SYMBOL(nftnl_set_nlmsg_build_payload); |
| 1951 | |
| 1952 | static int nftnl_set_parse_attr_cb(const struct nlattr *attr, void *data) |
| 1953 | { |
| 1954 | @@ -463,7 +448,7 @@ static int nftnl_set_desc_parse(struct nftnl_set *s, |
| 1955 | return 0; |
| 1956 | } |
| 1957 | |
| 1958 | -int nftnl_set_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s) |
| 1959 | +int __EXPORTED nftnl_set_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s) |
| 1960 | { |
| 1961 | struct nlattr *tb[NFTA_SET_MAX+1] = {}; |
| 1962 | struct nfgenmsg *nfg = mnl_nlmsg_get_payload(nlh); |
| 1963 | @@ -546,7 +531,6 @@ int nftnl_set_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s) |
| 1964 | |
| 1965 | return 0; |
| 1966 | } |
| 1967 | -EXPORT_SYMBOL(nftnl_set_nlmsg_parse); |
| 1968 | |
| 1969 | #ifdef JSON_PARSING |
| 1970 | static int nftnl_jansson_parse_set_info(struct nftnl_set *s, json_t *tree, |
| 1971 | @@ -718,19 +702,17 @@ static int nftnl_set_do_parse(struct nftnl_set *s, enum nftnl_parse_type type, |
| 1972 | |
| 1973 | return ret; |
| 1974 | } |
| 1975 | -int nftnl_set_parse(struct nftnl_set *s, enum nftnl_parse_type type, |
| 1976 | +int __EXPORTED nftnl_set_parse(struct nftnl_set *s, enum nftnl_parse_type type, |
| 1977 | const char *data, struct nftnl_parse_err *err) |
| 1978 | { |
| 1979 | return nftnl_set_do_parse(s, type, data, err, NFTNL_PARSE_BUFFER); |
| 1980 | } |
| 1981 | -EXPORT_SYMBOL(nftnl_set_parse); |
| 1982 | |
| 1983 | -int nftnl_set_parse_file(struct nftnl_set *s, enum nftnl_parse_type type, |
| 1984 | +int __EXPORTED nftnl_set_parse_file(struct nftnl_set *s, enum nftnl_parse_type type, |
| 1985 | FILE *fp, struct nftnl_parse_err *err) |
| 1986 | { |
| 1987 | return nftnl_set_do_parse(s, type, fp, err, NFTNL_PARSE_FILE); |
| 1988 | } |
| 1989 | -EXPORT_SYMBOL(nftnl_set_parse_file); |
| 1990 | |
| 1991 | static int nftnl_set_snprintf_json(char *buf, size_t size, |
| 1992 | const struct nftnl_set *s, |
| 1993 | @@ -918,13 +900,12 @@ static int nftnl_set_cmd_snprintf(char *buf, size_t size, |
| 1994 | return offset; |
| 1995 | } |
| 1996 | |
| 1997 | -int nftnl_set_snprintf(char *buf, size_t size, const struct nftnl_set *s, |
| 1998 | +int __EXPORTED nftnl_set_snprintf(char *buf, size_t size, const struct nftnl_set *s, |
| 1999 | uint32_t type, uint32_t flags) |
| 2000 | { |
| 2001 | return nftnl_set_cmd_snprintf(buf, size, s, nftnl_flag2cmd(flags), type, |
| 2002 | flags); |
| 2003 | } |
| 2004 | -EXPORT_SYMBOL(nftnl_set_snprintf); |
| 2005 | |
| 2006 | static int nftnl_set_do_snprintf(char *buf, size_t size, const void *s, |
| 2007 | uint32_t cmd, uint32_t type, uint32_t flags) |
| 2008 | @@ -932,25 +913,23 @@ static int nftnl_set_do_snprintf(char *buf, size_t size, const void *s, |
| 2009 | return nftnl_set_snprintf(buf, size, s, type, flags); |
| 2010 | } |
| 2011 | |
| 2012 | -int nftnl_set_fprintf(FILE *fp, const struct nftnl_set *s, uint32_t type, |
| 2013 | +int __EXPORTED nftnl_set_fprintf(FILE *fp, const struct nftnl_set *s, uint32_t type, |
| 2014 | uint32_t flags) |
| 2015 | { |
| 2016 | return nftnl_fprintf(fp, s, NFTNL_CMD_UNSPEC, type, flags, |
| 2017 | nftnl_set_do_snprintf); |
| 2018 | } |
| 2019 | -EXPORT_SYMBOL(nftnl_set_fprintf); |
| 2020 | |
| 2021 | -void nftnl_set_elem_add(struct nftnl_set *s, struct nftnl_set_elem *elem) |
| 2022 | +void __EXPORTED nftnl_set_elem_add(struct nftnl_set *s, struct nftnl_set_elem *elem) |
| 2023 | { |
| 2024 | list_add_tail(&elem->head, &s->element_list); |
| 2025 | } |
| 2026 | -EXPORT_SYMBOL(nftnl_set_elem_add); |
| 2027 | |
| 2028 | struct nftnl_set_list { |
| 2029 | struct list_head list; |
| 2030 | }; |
| 2031 | |
| 2032 | -struct nftnl_set_list *nftnl_set_list_alloc(void) |
| 2033 | +struct nftnl_set_list __EXPORTED *nftnl_set_list_alloc(void) |
| 2034 | { |
| 2035 | struct nftnl_set_list *list; |
| 2036 | |
| 2037 | @@ -962,9 +941,8 @@ struct nftnl_set_list *nftnl_set_list_alloc(void) |
| 2038 | |
| 2039 | return list; |
| 2040 | } |
| 2041 | -EXPORT_SYMBOL(nftnl_set_list_alloc); |
| 2042 | |
| 2043 | -void nftnl_set_list_free(struct nftnl_set_list *list) |
| 2044 | +void __EXPORTED nftnl_set_list_free(struct nftnl_set_list *list) |
| 2045 | { |
| 2046 | struct nftnl_set *s, *tmp; |
| 2047 | |
| 2048 | @@ -974,33 +952,28 @@ void nftnl_set_list_free(struct nftnl_set_list *list) |
| 2049 | } |
| 2050 | xfree(list); |
| 2051 | } |
| 2052 | -EXPORT_SYMBOL(nftnl_set_list_free); |
| 2053 | |
| 2054 | -int nftnl_set_list_is_empty(const struct nftnl_set_list *list) |
| 2055 | +int __EXPORTED nftnl_set_list_is_empty(const struct nftnl_set_list *list) |
| 2056 | { |
| 2057 | return list_empty(&list->list); |
| 2058 | } |
| 2059 | -EXPORT_SYMBOL(nftnl_set_list_is_empty); |
| 2060 | |
| 2061 | -void nftnl_set_list_add(struct nftnl_set *s, struct nftnl_set_list *list) |
| 2062 | +void __EXPORTED nftnl_set_list_add(struct nftnl_set *s, struct nftnl_set_list *list) |
| 2063 | { |
| 2064 | list_add(&s->head, &list->list); |
| 2065 | } |
| 2066 | -EXPORT_SYMBOL(nftnl_set_list_add); |
| 2067 | |
| 2068 | -void nftnl_set_list_add_tail(struct nftnl_set *s, struct nftnl_set_list *list) |
| 2069 | +void __EXPORTED nftnl_set_list_add_tail(struct nftnl_set *s, struct nftnl_set_list *list) |
| 2070 | { |
| 2071 | list_add_tail(&s->head, &list->list); |
| 2072 | } |
| 2073 | -EXPORT_SYMBOL(nftnl_set_list_add_tail); |
| 2074 | |
| 2075 | -void nftnl_set_list_del(struct nftnl_set *s) |
| 2076 | +void __EXPORTED nftnl_set_list_del(struct nftnl_set *s) |
| 2077 | { |
| 2078 | list_del(&s->head); |
| 2079 | } |
| 2080 | -EXPORT_SYMBOL(nftnl_set_list_del); |
| 2081 | |
| 2082 | -int nftnl_set_list_foreach(struct nftnl_set_list *set_list, |
| 2083 | +int __EXPORTED nftnl_set_list_foreach(struct nftnl_set_list *set_list, |
| 2084 | int (*cb)(struct nftnl_set *t, void *data), void *data) |
| 2085 | { |
| 2086 | struct nftnl_set *cur, *tmp; |
| 2087 | @@ -1013,14 +986,13 @@ int nftnl_set_list_foreach(struct nftnl_set_list *set_list, |
| 2088 | } |
| 2089 | return 0; |
| 2090 | } |
| 2091 | -EXPORT_SYMBOL(nftnl_set_list_foreach); |
| 2092 | |
| 2093 | struct nftnl_set_list_iter { |
| 2094 | const struct nftnl_set_list *list; |
| 2095 | struct nftnl_set *cur; |
| 2096 | }; |
| 2097 | |
| 2098 | -struct nftnl_set_list_iter * |
| 2099 | +struct nftnl_set_list_iter __EXPORTED * |
| 2100 | nftnl_set_list_iter_create(const struct nftnl_set_list *l) |
| 2101 | { |
| 2102 | struct nftnl_set_list_iter *iter; |
| 2103 | @@ -1037,16 +1009,14 @@ nftnl_set_list_iter_create(const struct nftnl_set_list *l) |
| 2104 | |
| 2105 | return iter; |
| 2106 | } |
| 2107 | -EXPORT_SYMBOL(nftnl_set_list_iter_create); |
| 2108 | |
| 2109 | -struct nftnl_set * |
| 2110 | +struct nftnl_set __EXPORTED * |
| 2111 | nftnl_set_list_iter_cur(const struct nftnl_set_list_iter *iter) |
| 2112 | { |
| 2113 | return iter->cur; |
| 2114 | } |
| 2115 | -EXPORT_SYMBOL(nftnl_set_list_iter_cur); |
| 2116 | |
| 2117 | -struct nftnl_set *nftnl_set_list_iter_next(struct nftnl_set_list_iter *iter) |
| 2118 | +struct nftnl_set __EXPORTED *nftnl_set_list_iter_next(struct nftnl_set_list_iter *iter) |
| 2119 | { |
| 2120 | struct nftnl_set *s = iter->cur; |
| 2121 | |
| 2122 | @@ -1060,13 +1030,11 @@ struct nftnl_set *nftnl_set_list_iter_next(struct nftnl_set_list_iter *iter) |
| 2123 | |
| 2124 | return s; |
| 2125 | } |
| 2126 | -EXPORT_SYMBOL(nftnl_set_list_iter_next); |
| 2127 | |
| 2128 | -void nftnl_set_list_iter_destroy(const struct nftnl_set_list_iter *iter) |
| 2129 | +void __EXPORTED nftnl_set_list_iter_destroy(const struct nftnl_set_list_iter *iter) |
| 2130 | { |
| 2131 | xfree(iter); |
| 2132 | } |
| 2133 | -EXPORT_SYMBOL(nftnl_set_list_iter_destroy); |
| 2134 | |
| 2135 | static struct nftnl_set *nftnl_set_lookup(const char *this_set_name, |
| 2136 | struct nftnl_set_list *set_list) |
| 2137 | diff --git a/src/set_elem.c b/src/set_elem.c |
| 2138 | index 433b896..bd1e895 100644 |
| 2139 | --- a/src/set_elem.c |
| 2140 | +++ b/src/set_elem.c |
| 2141 | @@ -27,7 +27,7 @@ |
| 2142 | #include <libnftnl/rule.h> |
| 2143 | #include <libnftnl/expr.h> |
| 2144 | |
| 2145 | -struct nftnl_set_elem *nftnl_set_elem_alloc(void) |
| 2146 | +struct nftnl_set_elem __EXPORTED *nftnl_set_elem_alloc(void) |
| 2147 | { |
| 2148 | struct nftnl_set_elem *s; |
| 2149 | |
| 2150 | @@ -37,9 +37,8 @@ struct nftnl_set_elem *nftnl_set_elem_alloc(void) |
| 2151 | |
| 2152 | return s; |
| 2153 | } |
| 2154 | -EXPORT_SYMBOL(nftnl_set_elem_alloc); |
| 2155 | |
| 2156 | -void nftnl_set_elem_free(struct nftnl_set_elem *s) |
| 2157 | +void __EXPORTED nftnl_set_elem_free(struct nftnl_set_elem *s) |
| 2158 | { |
| 2159 | if (s->flags & (1 << NFTNL_SET_ELEM_CHAIN)) |
| 2160 | xfree(s->data.chain); |
| 2161 | @@ -55,15 +54,13 @@ void nftnl_set_elem_free(struct nftnl_set_elem *s) |
| 2162 | |
| 2163 | xfree(s); |
| 2164 | } |
| 2165 | -EXPORT_SYMBOL(nftnl_set_elem_free); |
| 2166 | |
| 2167 | -bool nftnl_set_elem_is_set(const struct nftnl_set_elem *s, uint16_t attr) |
| 2168 | +bool __EXPORTED nftnl_set_elem_is_set(const struct nftnl_set_elem *s, uint16_t attr) |
| 2169 | { |
| 2170 | return s->flags & (1 << attr); |
| 2171 | } |
| 2172 | -EXPORT_SYMBOL(nftnl_set_elem_is_set); |
| 2173 | |
| 2174 | -void nftnl_set_elem_unset(struct nftnl_set_elem *s, uint16_t attr) |
| 2175 | +void __EXPORTED nftnl_set_elem_unset(struct nftnl_set_elem *s, uint16_t attr) |
| 2176 | { |
| 2177 | if (!(s->flags & (1 << attr))) |
| 2178 | return; |
| 2179 | @@ -94,9 +91,8 @@ void nftnl_set_elem_unset(struct nftnl_set_elem *s, uint16_t attr) |
| 2180 | |
| 2181 | s->flags &= ~(1 << attr); |
| 2182 | } |
| 2183 | -EXPORT_SYMBOL(nftnl_set_elem_unset); |
| 2184 | |
| 2185 | -int nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr, |
| 2186 | +int __EXPORTED nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr, |
| 2187 | const void *data, uint32_t data_len) |
| 2188 | { |
| 2189 | switch(attr) { |
| 2190 | @@ -147,27 +143,23 @@ int nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr, |
| 2191 | s->flags |= (1 << attr); |
| 2192 | return -1; |
| 2193 | } |
| 2194 | -EXPORT_SYMBOL(nftnl_set_elem_set); |
| 2195 | |
| 2196 | -void nftnl_set_elem_set_u32(struct nftnl_set_elem *s, uint16_t attr, uint32_t val) |
| 2197 | +void __EXPORTED nftnl_set_elem_set_u32(struct nftnl_set_elem *s, uint16_t attr, uint32_t val) |
| 2198 | { |
| 2199 | nftnl_set_elem_set(s, attr, &val, sizeof(uint32_t)); |
| 2200 | } |
| 2201 | -EXPORT_SYMBOL(nftnl_set_elem_set_u32); |
| 2202 | |
| 2203 | -void nftnl_set_elem_set_u64(struct nftnl_set_elem *s, uint16_t attr, uint64_t val) |
| 2204 | +void __EXPORTED nftnl_set_elem_set_u64(struct nftnl_set_elem *s, uint16_t attr, uint64_t val) |
| 2205 | { |
| 2206 | nftnl_set_elem_set(s, attr, &val, sizeof(uint64_t)); |
| 2207 | } |
| 2208 | -EXPORT_SYMBOL(nftnl_set_elem_set_u64); |
| 2209 | |
| 2210 | -int nftnl_set_elem_set_str(struct nftnl_set_elem *s, uint16_t attr, const char *str) |
| 2211 | +int __EXPORTED nftnl_set_elem_set_str(struct nftnl_set_elem *s, uint16_t attr, const char *str) |
| 2212 | { |
| 2213 | return nftnl_set_elem_set(s, attr, str, strlen(str) + 1); |
| 2214 | } |
| 2215 | -EXPORT_SYMBOL(nftnl_set_elem_set_str); |
| 2216 | |
| 2217 | -const void *nftnl_set_elem_get(struct nftnl_set_elem *s, uint16_t attr, uint32_t *data_len) |
| 2218 | +const void __EXPORTED *nftnl_set_elem_get(struct nftnl_set_elem *s, uint16_t attr, uint32_t *data_len) |
| 2219 | { |
| 2220 | if (!(s->flags & (1 << attr))) |
| 2221 | return NULL; |
| 2222 | @@ -205,31 +197,27 @@ const void *nftnl_set_elem_get(struct nftnl_set_elem *s, uint16_t attr, uint32_t |
| 2223 | } |
| 2224 | return NULL; |
| 2225 | } |
| 2226 | -EXPORT_SYMBOL(nftnl_set_elem_get); |
| 2227 | |
| 2228 | -const char *nftnl_set_elem_get_str(struct nftnl_set_elem *s, uint16_t attr) |
| 2229 | +const char __EXPORTED *nftnl_set_elem_get_str(struct nftnl_set_elem *s, uint16_t attr) |
| 2230 | { |
| 2231 | uint32_t size; |
| 2232 | |
| 2233 | return nftnl_set_elem_get(s, attr, &size); |
| 2234 | } |
| 2235 | -EXPORT_SYMBOL(nftnl_set_elem_get_str); |
| 2236 | |
| 2237 | -uint32_t nftnl_set_elem_get_u32(struct nftnl_set_elem *s, uint16_t attr) |
| 2238 | +uint32_t __EXPORTED nftnl_set_elem_get_u32(struct nftnl_set_elem *s, uint16_t attr) |
| 2239 | { |
| 2240 | uint32_t size; |
| 2241 | uint32_t val = *((uint32_t *)nftnl_set_elem_get(s, attr, &size)); |
| 2242 | return val; |
| 2243 | } |
| 2244 | -EXPORT_SYMBOL(nftnl_set_elem_get_u32); |
| 2245 | |
| 2246 | -uint64_t nftnl_set_elem_get_u64(struct nftnl_set_elem *s, uint16_t attr) |
| 2247 | +uint64_t __EXPORTED nftnl_set_elem_get_u64(struct nftnl_set_elem *s, uint16_t attr) |
| 2248 | { |
| 2249 | uint32_t size; |
| 2250 | uint64_t val = *((uint64_t *)nftnl_set_elem_get(s, attr, &size)); |
| 2251 | return val; |
| 2252 | } |
| 2253 | -EXPORT_SYMBOL(nftnl_set_elem_get_u64); |
| 2254 | |
| 2255 | struct nftnl_set_elem *nftnl_set_elem_clone(struct nftnl_set_elem *elem) |
| 2256 | { |
| 2257 | @@ -315,7 +303,7 @@ static struct nlattr *nftnl_set_elem_build(struct nlmsghdr *nlh, |
| 2258 | return nest2; |
| 2259 | } |
| 2260 | |
| 2261 | -void nftnl_set_elems_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_set *s) |
| 2262 | +void __EXPORTED nftnl_set_elems_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_set *s) |
| 2263 | { |
| 2264 | struct nftnl_set_elem *elem; |
| 2265 | struct nlattr *nest1; |
| 2266 | @@ -332,7 +320,6 @@ void nftnl_set_elems_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_set |
| 2267 | |
| 2268 | mnl_attr_nest_end(nlh, nest1); |
| 2269 | } |
| 2270 | -EXPORT_SYMBOL(nftnl_set_elems_nlmsg_build_payload); |
| 2271 | |
| 2272 | static int nftnl_set_elem_parse_attr_cb(const struct nlattr *attr, void *data) |
| 2273 | { |
| 2274 | @@ -503,7 +490,7 @@ static int nftnl_set_elems_parse(struct nftnl_set *s, const struct nlattr *nest) |
| 2275 | return ret; |
| 2276 | } |
| 2277 | |
| 2278 | -int nftnl_set_elems_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s) |
| 2279 | +int __EXPORTED nftnl_set_elems_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s) |
| 2280 | { |
| 2281 | struct nlattr *tb[NFTA_SET_ELEM_LIST_MAX+1] = {}; |
| 2282 | struct nfgenmsg *nfg = mnl_nlmsg_get_payload(nlh); |
| 2283 | @@ -546,7 +533,6 @@ int nftnl_set_elems_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s) |
| 2284 | |
| 2285 | return 0; |
| 2286 | } |
| 2287 | -EXPORT_SYMBOL(nftnl_set_elems_nlmsg_parse); |
| 2288 | |
| 2289 | static int nftnl_set_elem_json_parse(struct nftnl_set_elem *e, const void *json, |
| 2290 | struct nftnl_parse_err *err, |
| 2291 | @@ -587,19 +573,17 @@ nftnl_set_elem_do_parse(struct nftnl_set_elem *e, enum nftnl_parse_type type, |
| 2292 | |
| 2293 | return ret; |
| 2294 | } |
| 2295 | -int nftnl_set_elem_parse(struct nftnl_set_elem *e, enum nftnl_parse_type type, |
| 2296 | +int __EXPORTED nftnl_set_elem_parse(struct nftnl_set_elem *e, enum nftnl_parse_type type, |
| 2297 | const char *data, struct nftnl_parse_err *err) |
| 2298 | { |
| 2299 | return nftnl_set_elem_do_parse(e, type, data, err, NFTNL_PARSE_BUFFER); |
| 2300 | } |
| 2301 | -EXPORT_SYMBOL(nftnl_set_elem_parse); |
| 2302 | |
| 2303 | -int nftnl_set_elem_parse_file(struct nftnl_set_elem *e, enum nftnl_parse_type type, |
| 2304 | +int __EXPORTED nftnl_set_elem_parse_file(struct nftnl_set_elem *e, enum nftnl_parse_type type, |
| 2305 | FILE *fp, struct nftnl_parse_err *err) |
| 2306 | { |
| 2307 | return nftnl_set_elem_do_parse(e, type, fp, err, NFTNL_PARSE_FILE); |
| 2308 | } |
| 2309 | -EXPORT_SYMBOL(nftnl_set_elem_parse_file); |
| 2310 | |
| 2311 | static int nftnl_set_elem_snprintf_json(char *buf, size_t size, |
| 2312 | const struct nftnl_set_elem *e, |
| 2313 | @@ -719,14 +703,13 @@ static int nftnl_set_elem_cmd_snprintf(char *buf, size_t size, |
| 2314 | return offset; |
| 2315 | } |
| 2316 | |
| 2317 | -int nftnl_set_elem_snprintf(char *buf, size_t size, |
| 2318 | +int __EXPORTED nftnl_set_elem_snprintf(char *buf, size_t size, |
| 2319 | const struct nftnl_set_elem *e, |
| 2320 | uint32_t type, uint32_t flags) |
| 2321 | { |
| 2322 | return nftnl_set_elem_cmd_snprintf(buf, size, e, nftnl_flag2cmd(flags), |
| 2323 | type, flags); |
| 2324 | } |
| 2325 | -EXPORT_SYMBOL(nftnl_set_elem_snprintf); |
| 2326 | |
| 2327 | static int nftnl_set_elem_do_snprintf(char *buf, size_t size, const void *e, |
| 2328 | uint32_t cmd, uint32_t type, |
| 2329 | @@ -735,15 +718,14 @@ static int nftnl_set_elem_do_snprintf(char *buf, size_t size, const void *e, |
| 2330 | return nftnl_set_elem_snprintf(buf, size, e, type, flags); |
| 2331 | } |
| 2332 | |
| 2333 | -int nftnl_set_elem_fprintf(FILE *fp, struct nftnl_set_elem *se, uint32_t type, |
| 2334 | +int __EXPORTED nftnl_set_elem_fprintf(FILE *fp, struct nftnl_set_elem *se, uint32_t type, |
| 2335 | uint32_t flags) |
| 2336 | { |
| 2337 | return nftnl_fprintf(fp, se, NFTNL_CMD_UNSPEC, type, flags, |
| 2338 | nftnl_set_elem_do_snprintf); |
| 2339 | } |
| 2340 | -EXPORT_SYMBOL(nftnl_set_elem_fprintf); |
| 2341 | |
| 2342 | -int nftnl_set_elem_foreach(struct nftnl_set *s, |
| 2343 | +int __EXPORTED nftnl_set_elem_foreach(struct nftnl_set *s, |
| 2344 | int (*cb)(struct nftnl_set_elem *e, void *data), |
| 2345 | void *data) |
| 2346 | { |
| 2347 | @@ -757,7 +739,6 @@ int nftnl_set_elem_foreach(struct nftnl_set *s, |
| 2348 | } |
| 2349 | return 0; |
| 2350 | } |
| 2351 | -EXPORT_SYMBOL(nftnl_set_elem_foreach); |
| 2352 | |
| 2353 | struct nftnl_set_elems_iter { |
| 2354 | const struct nftnl_set *set; |
| 2355 | @@ -765,7 +746,7 @@ struct nftnl_set_elems_iter { |
| 2356 | struct nftnl_set_elem *cur; |
| 2357 | }; |
| 2358 | |
| 2359 | -struct nftnl_set_elems_iter * |
| 2360 | +struct nftnl_set_elems_iter __EXPORTED * |
| 2361 | nftnl_set_elems_iter_create(const struct nftnl_set *s) |
| 2362 | { |
| 2363 | struct nftnl_set_elems_iter *iter; |
| 2364 | @@ -784,16 +765,14 @@ nftnl_set_elems_iter_create(const struct nftnl_set *s) |
| 2365 | |
| 2366 | return iter; |
| 2367 | } |
| 2368 | -EXPORT_SYMBOL(nftnl_set_elems_iter_create); |
| 2369 | |
| 2370 | -struct nftnl_set_elem * |
| 2371 | +struct nftnl_set_elem __EXPORTED * |
| 2372 | nftnl_set_elems_iter_cur(const struct nftnl_set_elems_iter *iter) |
| 2373 | { |
| 2374 | return iter->cur; |
| 2375 | } |
| 2376 | -EXPORT_SYMBOL(nftnl_set_elems_iter_cur); |
| 2377 | |
| 2378 | -struct nftnl_set_elem *nftnl_set_elems_iter_next(struct nftnl_set_elems_iter *iter) |
| 2379 | +struct nftnl_set_elem __EXPORTED *nftnl_set_elems_iter_next(struct nftnl_set_elems_iter *iter) |
| 2380 | { |
| 2381 | struct nftnl_set_elem *s = iter->cur; |
| 2382 | |
| 2383 | @@ -806,13 +785,11 @@ struct nftnl_set_elem *nftnl_set_elems_iter_next(struct nftnl_set_elems_iter *it |
| 2384 | |
| 2385 | return s; |
| 2386 | } |
| 2387 | -EXPORT_SYMBOL(nftnl_set_elems_iter_next); |
| 2388 | |
| 2389 | -void nftnl_set_elems_iter_destroy(struct nftnl_set_elems_iter *iter) |
| 2390 | +void __EXPORTED nftnl_set_elems_iter_destroy(struct nftnl_set_elems_iter *iter) |
| 2391 | { |
| 2392 | xfree(iter); |
| 2393 | } |
| 2394 | -EXPORT_SYMBOL(nftnl_set_elems_iter_destroy); |
| 2395 | |
| 2396 | static bool nftnl_attr_nest_overflow(struct nlmsghdr *nlh, |
| 2397 | const struct nlattr *from, |
| 2398 | @@ -831,7 +808,7 @@ static bool nftnl_attr_nest_overflow(struct nlmsghdr *nlh, |
| 2399 | return false; |
| 2400 | } |
| 2401 | |
| 2402 | -int nftnl_set_elems_nlmsg_build_payload_iter(struct nlmsghdr *nlh, |
| 2403 | +int __EXPORTED nftnl_set_elems_nlmsg_build_payload_iter(struct nlmsghdr *nlh, |
| 2404 | struct nftnl_set_elems_iter *iter) |
| 2405 | { |
| 2406 | struct nftnl_set_elem *elem; |
| 2407 | @@ -861,4 +838,3 @@ int nftnl_set_elems_nlmsg_build_payload_iter(struct nlmsghdr *nlh, |
| 2408 | |
| 2409 | return ret; |
| 2410 | } |
| 2411 | -EXPORT_SYMBOL(nftnl_set_elems_nlmsg_build_payload_iter); |
| 2412 | diff --git a/src/table.c b/src/table.c |
| 2413 | index a7d5a8f..0e99f3c 100644 |
| 2414 | --- a/src/table.c |
| 2415 | +++ b/src/table.c |
| 2416 | @@ -36,28 +36,25 @@ struct nftnl_table { |
| 2417 | uint32_t flags; |
| 2418 | }; |
| 2419 | |
| 2420 | -struct nftnl_table *nftnl_table_alloc(void) |
| 2421 | +struct nftnl_table __EXPORTED *nftnl_table_alloc(void) |
| 2422 | { |
| 2423 | return calloc(1, sizeof(struct nftnl_table)); |
| 2424 | } |
| 2425 | -EXPORT_SYMBOL(nftnl_table_alloc); |
| 2426 | |
| 2427 | -void nftnl_table_free(const struct nftnl_table *t) |
| 2428 | +void __EXPORTED nftnl_table_free(const struct nftnl_table *t) |
| 2429 | { |
| 2430 | if (t->flags & (1 << NFTNL_TABLE_NAME)) |
| 2431 | xfree(t->name); |
| 2432 | |
| 2433 | xfree(t); |
| 2434 | } |
| 2435 | -EXPORT_SYMBOL(nftnl_table_free); |
| 2436 | |
| 2437 | -bool nftnl_table_is_set(const struct nftnl_table *t, uint16_t attr) |
| 2438 | +bool __EXPORTED nftnl_table_is_set(const struct nftnl_table *t, uint16_t attr) |
| 2439 | { |
| 2440 | return t->flags & (1 << attr); |
| 2441 | } |
| 2442 | -EXPORT_SYMBOL(nftnl_table_is_set); |
| 2443 | |
| 2444 | -void nftnl_table_unset(struct nftnl_table *t, uint16_t attr) |
| 2445 | +void __EXPORTED nftnl_table_unset(struct nftnl_table *t, uint16_t attr) |
| 2446 | { |
| 2447 | if (!(t->flags & (1 << attr))) |
| 2448 | return; |
| 2449 | @@ -74,14 +71,13 @@ void nftnl_table_unset(struct nftnl_table *t, uint16_t attr) |
| 2450 | } |
| 2451 | t->flags &= ~(1 << attr); |
| 2452 | } |
| 2453 | -EXPORT_SYMBOL(nftnl_table_unset); |
| 2454 | |
| 2455 | static uint32_t nftnl_table_validate[NFTNL_TABLE_MAX + 1] = { |
| 2456 | [NFTNL_TABLE_FLAGS] = sizeof(uint32_t), |
| 2457 | [NFTNL_TABLE_FAMILY] = sizeof(uint32_t), |
| 2458 | }; |
| 2459 | |
| 2460 | -int nftnl_table_set_data(struct nftnl_table *t, uint16_t attr, |
| 2461 | +int __EXPORTED nftnl_table_set_data(struct nftnl_table *t, uint16_t attr, |
| 2462 | const void *data, uint32_t data_len) |
| 2463 | { |
| 2464 | nftnl_assert_attr_exists(attr, NFTNL_TABLE_MAX); |
| 2465 | @@ -109,33 +105,28 @@ int nftnl_table_set_data(struct nftnl_table *t, uint16_t attr, |
| 2466 | t->flags |= (1 << attr); |
| 2467 | return 0; |
| 2468 | } |
| 2469 | -EXPORT_SYMBOL(nftnl_table_set_data); |
| 2470 | |
| 2471 | -void nftnl_table_set(struct nftnl_table *t, uint16_t attr, const void *data) |
| 2472 | +void __EXPORTED nftnl_table_set(struct nftnl_table *t, uint16_t attr, const void *data) |
| 2473 | { |
| 2474 | nftnl_table_set_data(t, attr, data, nftnl_table_validate[attr]); |
| 2475 | } |
| 2476 | -EXPORT_SYMBOL(nftnl_table_set); |
| 2477 | |
| 2478 | -void nftnl_table_set_u32(struct nftnl_table *t, uint16_t attr, uint32_t val) |
| 2479 | +void __EXPORTED nftnl_table_set_u32(struct nftnl_table *t, uint16_t attr, uint32_t val) |
| 2480 | { |
| 2481 | nftnl_table_set_data(t, attr, &val, sizeof(uint32_t)); |
| 2482 | } |
| 2483 | -EXPORT_SYMBOL(nftnl_table_set_u32); |
| 2484 | |
| 2485 | -void nftnl_table_set_u8(struct nftnl_table *t, uint16_t attr, uint8_t val) |
| 2486 | +void __EXPORTED nftnl_table_set_u8(struct nftnl_table *t, uint16_t attr, uint8_t val) |
| 2487 | { |
| 2488 | nftnl_table_set_data(t, attr, &val, sizeof(uint8_t)); |
| 2489 | } |
| 2490 | -EXPORT_SYMBOL(nftnl_table_set_u8); |
| 2491 | |
| 2492 | -int nftnl_table_set_str(struct nftnl_table *t, uint16_t attr, const char *str) |
| 2493 | +int __EXPORTED nftnl_table_set_str(struct nftnl_table *t, uint16_t attr, const char *str) |
| 2494 | { |
| 2495 | return nftnl_table_set_data(t, attr, str, strlen(str) + 1); |
| 2496 | } |
| 2497 | -EXPORT_SYMBOL(nftnl_table_set_str); |
| 2498 | |
| 2499 | -const void *nftnl_table_get_data(const struct nftnl_table *t, uint16_t attr, |
| 2500 | +const void __EXPORTED *nftnl_table_get_data(const struct nftnl_table *t, uint16_t attr, |
| 2501 | uint32_t *data_len) |
| 2502 | { |
| 2503 | if (!(t->flags & (1 << attr))) |
| 2504 | @@ -157,43 +148,37 @@ const void *nftnl_table_get_data(const struct nftnl_table *t, uint16_t attr, |
| 2505 | } |
| 2506 | return NULL; |
| 2507 | } |
| 2508 | -EXPORT_SYMBOL(nftnl_table_get_data); |
| 2509 | |
| 2510 | -const void *nftnl_table_get(const struct nftnl_table *t, uint16_t attr) |
| 2511 | +const void __EXPORTED *nftnl_table_get(const struct nftnl_table *t, uint16_t attr) |
| 2512 | { |
| 2513 | uint32_t data_len; |
| 2514 | return nftnl_table_get_data(t, attr, &data_len); |
| 2515 | } |
| 2516 | -EXPORT_SYMBOL(nftnl_table_get); |
| 2517 | |
| 2518 | -uint32_t nftnl_table_get_u32(const struct nftnl_table *t, uint16_t attr) |
| 2519 | +uint32_t __EXPORTED nftnl_table_get_u32(const struct nftnl_table *t, uint16_t attr) |
| 2520 | { |
| 2521 | const void *ret = nftnl_table_get(t, attr); |
| 2522 | return ret == NULL ? 0 : *((uint32_t *)ret); |
| 2523 | } |
| 2524 | -EXPORT_SYMBOL(nftnl_table_get_u32); |
| 2525 | |
| 2526 | -uint8_t nftnl_table_get_u8(const struct nftnl_table *t, uint16_t attr) |
| 2527 | +uint8_t __EXPORTED nftnl_table_get_u8(const struct nftnl_table *t, uint16_t attr) |
| 2528 | { |
| 2529 | const void *ret = nftnl_table_get(t, attr); |
| 2530 | return ret == NULL ? 0 : *((uint8_t *)ret); |
| 2531 | } |
| 2532 | -EXPORT_SYMBOL(nftnl_table_get_u8); |
| 2533 | |
| 2534 | -const char *nftnl_table_get_str(const struct nftnl_table *t, uint16_t attr) |
| 2535 | +const char __EXPORTED *nftnl_table_get_str(const struct nftnl_table *t, uint16_t attr) |
| 2536 | { |
| 2537 | return nftnl_table_get(t, attr); |
| 2538 | } |
| 2539 | -EXPORT_SYMBOL(nftnl_table_get_str); |
| 2540 | |
| 2541 | -void nftnl_table_nlmsg_build_payload(struct nlmsghdr *nlh, const struct nftnl_table *t) |
| 2542 | +void __EXPORTED nftnl_table_nlmsg_build_payload(struct nlmsghdr *nlh, const struct nftnl_table *t) |
| 2543 | { |
| 2544 | if (t->flags & (1 << NFTNL_TABLE_NAME)) |
| 2545 | mnl_attr_put_strz(nlh, NFTA_TABLE_NAME, t->name); |
| 2546 | if (t->flags & (1 << NFTNL_TABLE_FLAGS)) |
| 2547 | mnl_attr_put_u32(nlh, NFTA_TABLE_FLAGS, htonl(t->table_flags)); |
| 2548 | } |
| 2549 | -EXPORT_SYMBOL(nftnl_table_nlmsg_build_payload); |
| 2550 | |
| 2551 | static int nftnl_table_parse_attr_cb(const struct nlattr *attr, void *data) |
| 2552 | { |
| 2553 | @@ -219,7 +204,7 @@ static int nftnl_table_parse_attr_cb(const struct nlattr *attr, void *data) |
| 2554 | return MNL_CB_OK; |
| 2555 | } |
| 2556 | |
| 2557 | -int nftnl_table_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_table *t) |
| 2558 | +int __EXPORTED nftnl_table_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_table *t) |
| 2559 | { |
| 2560 | struct nlattr *tb[NFTA_TABLE_MAX+1] = {}; |
| 2561 | struct nfgenmsg *nfg = mnl_nlmsg_get_payload(nlh); |
| 2562 | @@ -249,7 +234,6 @@ int nftnl_table_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_table *t) |
| 2563 | |
| 2564 | return 0; |
| 2565 | } |
| 2566 | -EXPORT_SYMBOL(nftnl_table_nlmsg_parse); |
| 2567 | |
| 2568 | #ifdef JSON_PARSING |
| 2569 | int nftnl_jansson_parse_table(struct nftnl_table *t, json_t *tree, |
| 2570 | @@ -330,19 +314,17 @@ static int nftnl_table_do_parse(struct nftnl_table *t, enum nftnl_parse_type typ |
| 2571 | return ret; |
| 2572 | } |
| 2573 | |
| 2574 | -int nftnl_table_parse(struct nftnl_table *t, enum nftnl_parse_type type, |
| 2575 | +int __EXPORTED nftnl_table_parse(struct nftnl_table *t, enum nftnl_parse_type type, |
| 2576 | const char *data, struct nftnl_parse_err *err) |
| 2577 | { |
| 2578 | return nftnl_table_do_parse(t, type, data, err, NFTNL_PARSE_BUFFER); |
| 2579 | } |
| 2580 | -EXPORT_SYMBOL(nftnl_table_parse); |
| 2581 | |
| 2582 | -int nftnl_table_parse_file(struct nftnl_table *t, enum nftnl_parse_type type, |
| 2583 | +int __EXPORTED nftnl_table_parse_file(struct nftnl_table *t, enum nftnl_parse_type type, |
| 2584 | FILE *fp, struct nftnl_parse_err *err) |
| 2585 | { |
| 2586 | return nftnl_table_do_parse(t, type, fp, err, NFTNL_PARSE_FILE); |
| 2587 | } |
| 2588 | -EXPORT_SYMBOL(nftnl_table_parse_file); |
| 2589 | |
| 2590 | static int nftnl_table_export(char *buf, size_t size, |
| 2591 | const struct nftnl_table *t, int type) |
| 2592 | @@ -400,13 +382,12 @@ static int nftnl_table_cmd_snprintf(char *buf, size_t size, |
| 2593 | return offset; |
| 2594 | } |
| 2595 | |
| 2596 | -int nftnl_table_snprintf(char *buf, size_t size, const struct nftnl_table *t, |
| 2597 | +int __EXPORTED nftnl_table_snprintf(char *buf, size_t size, const struct nftnl_table *t, |
| 2598 | uint32_t type, uint32_t flags) |
| 2599 | { |
| 2600 | return nftnl_table_cmd_snprintf(buf, size, t, nftnl_flag2cmd(flags), type, |
| 2601 | flags); |
| 2602 | } |
| 2603 | -EXPORT_SYMBOL(nftnl_table_snprintf); |
| 2604 | |
| 2605 | static int nftnl_table_do_snprintf(char *buf, size_t size, const void *t, |
| 2606 | uint32_t cmd, uint32_t type, uint32_t flags) |
| 2607 | @@ -414,19 +395,18 @@ static int nftnl_table_do_snprintf(char *buf, size_t size, const void *t, |
| 2608 | return nftnl_table_snprintf(buf, size, t, type, flags); |
| 2609 | } |
| 2610 | |
| 2611 | -int nftnl_table_fprintf(FILE *fp, const struct nftnl_table *t, uint32_t type, |
| 2612 | +int __EXPORTED nftnl_table_fprintf(FILE *fp, const struct nftnl_table *t, uint32_t type, |
| 2613 | uint32_t flags) |
| 2614 | { |
| 2615 | return nftnl_fprintf(fp, t, NFTNL_CMD_UNSPEC, type, flags, |
| 2616 | nftnl_table_do_snprintf); |
| 2617 | } |
| 2618 | -EXPORT_SYMBOL(nftnl_table_fprintf); |
| 2619 | |
| 2620 | struct nftnl_table_list { |
| 2621 | struct list_head list; |
| 2622 | }; |
| 2623 | |
| 2624 | -struct nftnl_table_list *nftnl_table_list_alloc(void) |
| 2625 | +struct nftnl_table_list __EXPORTED *nftnl_table_list_alloc(void) |
| 2626 | { |
| 2627 | struct nftnl_table_list *list; |
| 2628 | |
| 2629 | @@ -438,9 +418,8 @@ struct nftnl_table_list *nftnl_table_list_alloc(void) |
| 2630 | |
| 2631 | return list; |
| 2632 | } |
| 2633 | -EXPORT_SYMBOL(nftnl_table_list_alloc); |
| 2634 | |
| 2635 | -void nftnl_table_list_free(struct nftnl_table_list *list) |
| 2636 | +void __EXPORTED nftnl_table_list_free(struct nftnl_table_list *list) |
| 2637 | { |
| 2638 | struct nftnl_table *r, *tmp; |
| 2639 | |
| 2640 | @@ -450,33 +429,28 @@ void nftnl_table_list_free(struct nftnl_table_list *list) |
| 2641 | } |
| 2642 | xfree(list); |
| 2643 | } |
| 2644 | -EXPORT_SYMBOL(nftnl_table_list_free); |
| 2645 | |
| 2646 | -int nftnl_table_list_is_empty(const struct nftnl_table_list *list) |
| 2647 | +int __EXPORTED nftnl_table_list_is_empty(const struct nftnl_table_list *list) |
| 2648 | { |
| 2649 | return list_empty(&list->list); |
| 2650 | } |
| 2651 | -EXPORT_SYMBOL(nftnl_table_list_is_empty); |
| 2652 | |
| 2653 | -void nftnl_table_list_add(struct nftnl_table *r, struct nftnl_table_list *list) |
| 2654 | +void __EXPORTED nftnl_table_list_add(struct nftnl_table *r, struct nftnl_table_list *list) |
| 2655 | { |
| 2656 | list_add(&r->head, &list->list); |
| 2657 | } |
| 2658 | -EXPORT_SYMBOL(nftnl_table_list_add); |
| 2659 | |
| 2660 | -void nftnl_table_list_add_tail(struct nftnl_table *r, struct nftnl_table_list *list) |
| 2661 | +void __EXPORTED nftnl_table_list_add_tail(struct nftnl_table *r, struct nftnl_table_list *list) |
| 2662 | { |
| 2663 | list_add_tail(&r->head, &list->list); |
| 2664 | } |
| 2665 | -EXPORT_SYMBOL(nftnl_table_list_add_tail); |
| 2666 | |
| 2667 | -void nftnl_table_list_del(struct nftnl_table *t) |
| 2668 | +void __EXPORTED nftnl_table_list_del(struct nftnl_table *t) |
| 2669 | { |
| 2670 | list_del(&t->head); |
| 2671 | } |
| 2672 | -EXPORT_SYMBOL(nftnl_table_list_del); |
| 2673 | |
| 2674 | -int nftnl_table_list_foreach(struct nftnl_table_list *table_list, |
| 2675 | +int __EXPORTED nftnl_table_list_foreach(struct nftnl_table_list *table_list, |
| 2676 | int (*cb)(struct nftnl_table *t, void *data), |
| 2677 | void *data) |
| 2678 | { |
| 2679 | @@ -490,14 +464,13 @@ int nftnl_table_list_foreach(struct nftnl_table_list *table_list, |
| 2680 | } |
| 2681 | return 0; |
| 2682 | } |
| 2683 | -EXPORT_SYMBOL(nftnl_table_list_foreach); |
| 2684 | |
| 2685 | struct nftnl_table_list_iter { |
| 2686 | const struct nftnl_table_list *list; |
| 2687 | struct nftnl_table *cur; |
| 2688 | }; |
| 2689 | |
| 2690 | -struct nftnl_table_list_iter * |
| 2691 | +struct nftnl_table_list_iter __EXPORTED * |
| 2692 | nftnl_table_list_iter_create(const struct nftnl_table_list *l) |
| 2693 | { |
| 2694 | struct nftnl_table_list_iter *iter; |
| 2695 | @@ -514,9 +487,8 @@ nftnl_table_list_iter_create(const struct nftnl_table_list *l) |
| 2696 | |
| 2697 | return iter; |
| 2698 | } |
| 2699 | -EXPORT_SYMBOL(nftnl_table_list_iter_create); |
| 2700 | |
| 2701 | -struct nftnl_table *nftnl_table_list_iter_next(struct nftnl_table_list_iter *iter) |
| 2702 | +struct nftnl_table __EXPORTED *nftnl_table_list_iter_next(struct nftnl_table_list_iter *iter) |
| 2703 | { |
| 2704 | struct nftnl_table *r = iter->cur; |
| 2705 | |
| 2706 | @@ -530,10 +502,8 @@ struct nftnl_table *nftnl_table_list_iter_next(struct nftnl_table_list_iter *ite |
| 2707 | |
| 2708 | return r; |
| 2709 | } |
| 2710 | -EXPORT_SYMBOL(nftnl_table_list_iter_next); |
| 2711 | |
| 2712 | -void nftnl_table_list_iter_destroy(const struct nftnl_table_list_iter *iter) |
| 2713 | +void __EXPORTED nftnl_table_list_iter_destroy(const struct nftnl_table_list_iter *iter) |
| 2714 | { |
| 2715 | xfree(iter); |
| 2716 | } |
| 2717 | -EXPORT_SYMBOL(nftnl_table_list_iter_destroy); |
| 2718 | diff --git a/src/trace.c b/src/trace.c |
| 2719 | index bd05d3c..4739ef9 100644 |
| 2720 | --- a/src/trace.c |
| 2721 | +++ b/src/trace.c |
| 2722 | @@ -52,14 +52,12 @@ struct nftnl_trace { |
| 2723 | uint32_t flags; |
| 2724 | }; |
| 2725 | |
| 2726 | -EXPORT_SYMBOL(nftnl_trace_alloc); |
| 2727 | -struct nftnl_trace *nftnl_trace_alloc(void) |
| 2728 | +struct nftnl_trace __EXPORTED *nftnl_trace_alloc(void) |
| 2729 | { |
| 2730 | return calloc(1, sizeof(struct nftnl_trace)); |
| 2731 | } |
| 2732 | |
| 2733 | -EXPORT_SYMBOL(nftnl_trace_free); |
| 2734 | -void nftnl_trace_free(const struct nftnl_trace *t) |
| 2735 | +void __EXPORTED nftnl_trace_free(const struct nftnl_trace *t) |
| 2736 | { |
| 2737 | xfree(t->chain); |
| 2738 | xfree(t->table); |
| 2739 | @@ -70,8 +68,7 @@ void nftnl_trace_free(const struct nftnl_trace *t) |
| 2740 | xfree(t); |
| 2741 | } |
| 2742 | |
| 2743 | -EXPORT_SYMBOL(nftnl_trace_is_set); |
| 2744 | -bool nftnl_trace_is_set(const struct nftnl_trace *t, uint16_t attr) |
| 2745 | +bool __EXPORTED nftnl_trace_is_set(const struct nftnl_trace *t, uint16_t attr) |
| 2746 | { |
| 2747 | return t->flags & (1 << attr); |
| 2748 | } |
| 2749 | @@ -130,8 +127,7 @@ static int nftnl_trace_parse_attr_cb(const struct nlattr *attr, void *data) |
| 2750 | return MNL_CB_OK; |
| 2751 | } |
| 2752 | |
| 2753 | -EXPORT_SYMBOL(nftnl_trace_get_data); |
| 2754 | -const void *nftnl_trace_get_data(const struct nftnl_trace *trace, |
| 2755 | +const void __EXPORTED *nftnl_trace_get_data(const struct nftnl_trace *trace, |
| 2756 | uint16_t type, uint32_t *data_len) |
| 2757 | { |
| 2758 | enum nftnl_trace_attr attr = type; |
| 2759 | @@ -201,8 +197,7 @@ const void *nftnl_trace_get_data(const struct nftnl_trace *trace, |
| 2760 | return NULL; |
| 2761 | } |
| 2762 | |
| 2763 | -EXPORT_SYMBOL(nftnl_trace_get_str); |
| 2764 | -const char *nftnl_trace_get_str(const struct nftnl_trace *trace, uint16_t type) |
| 2765 | +const char __EXPORTED *nftnl_trace_get_str(const struct nftnl_trace *trace, uint16_t type) |
| 2766 | { |
| 2767 | if (!nftnl_trace_is_set(trace, type)) |
| 2768 | return NULL; |
| 2769 | @@ -216,8 +211,7 @@ const char *nftnl_trace_get_str(const struct nftnl_trace *trace, uint16_t type) |
| 2770 | return NULL; |
| 2771 | } |
| 2772 | |
| 2773 | -EXPORT_SYMBOL(nftnl_trace_get_u16); |
| 2774 | -uint16_t nftnl_trace_get_u16(const struct nftnl_trace *trace, uint16_t type) |
| 2775 | +uint16_t __EXPORTED nftnl_trace_get_u16(const struct nftnl_trace *trace, uint16_t type) |
| 2776 | { |
| 2777 | const uint16_t *d; |
| 2778 | uint32_t dlen; |
| 2779 | @@ -229,8 +223,7 @@ uint16_t nftnl_trace_get_u16(const struct nftnl_trace *trace, uint16_t type) |
| 2780 | return 0; |
| 2781 | } |
| 2782 | |
| 2783 | -EXPORT_SYMBOL(nftnl_trace_get_u32); |
| 2784 | -uint32_t nftnl_trace_get_u32(const struct nftnl_trace *trace, uint16_t type) |
| 2785 | +uint32_t __EXPORTED nftnl_trace_get_u32(const struct nftnl_trace *trace, uint16_t type) |
| 2786 | { |
| 2787 | const uint32_t *d; |
| 2788 | uint32_t dlen; |
| 2789 | @@ -242,8 +235,7 @@ uint32_t nftnl_trace_get_u32(const struct nftnl_trace *trace, uint16_t type) |
| 2790 | return 0; |
| 2791 | } |
| 2792 | |
| 2793 | -EXPORT_SYMBOL(nftnl_trace_get_u64); |
| 2794 | -uint64_t nftnl_trace_get_u64(const struct nftnl_trace *trace, uint16_t type) |
| 2795 | +uint64_t __EXPORTED nftnl_trace_get_u64(const struct nftnl_trace *trace, uint16_t type) |
| 2796 | { |
| 2797 | const uint64_t *d; |
| 2798 | uint32_t dlen; |
| 2799 | @@ -323,9 +315,8 @@ static int nftnl_trace_parse_verdict(const struct nlattr *attr, |
| 2800 | } |
| 2801 | return 0; |
| 2802 | } |
| 2803 | -EXPORT_SYMBOL(nftnl_trace_nlmsg_parse); |
| 2804 | |
| 2805 | -int nftnl_trace_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_trace *t) |
| 2806 | +int __EXPORTED nftnl_trace_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_trace *t) |
| 2807 | { |
| 2808 | struct nfgenmsg *nfg = mnl_nlmsg_get_payload(nlh); |
| 2809 | struct nlattr *tb[NFTA_TRACE_MAX+1] = {}; |
| 2810 | diff --git a/src/udata.c b/src/udata.c |
| 2811 | index d679dd0..7e2de0f 100644 |
| 2812 | --- a/src/udata.c |
| 2813 | +++ b/src/udata.c |
| 2814 | @@ -16,7 +16,7 @@ |
| 2815 | #include <stdint.h> |
| 2816 | #include <string.h> |
| 2817 | |
| 2818 | -struct nftnl_udata_buf *nftnl_udata_buf_alloc(uint32_t data_size) |
| 2819 | +struct nftnl_udata_buf __EXPORTED *nftnl_udata_buf_alloc(uint32_t data_size) |
| 2820 | { |
| 2821 | struct nftnl_udata_buf *buf; |
| 2822 | |
| 2823 | @@ -28,47 +28,40 @@ struct nftnl_udata_buf *nftnl_udata_buf_alloc(uint32_t data_size) |
| 2824 | |
| 2825 | return buf; |
| 2826 | } |
| 2827 | -EXPORT_SYMBOL(nftnl_udata_buf_alloc); |
| 2828 | |
| 2829 | -void nftnl_udata_buf_free(const struct nftnl_udata_buf *buf) |
| 2830 | +void __EXPORTED nftnl_udata_buf_free(const struct nftnl_udata_buf *buf) |
| 2831 | { |
| 2832 | xfree(buf); |
| 2833 | } |
| 2834 | -EXPORT_SYMBOL(nftnl_udata_buf_free); |
| 2835 | |
| 2836 | -uint32_t nftnl_udata_buf_len(const struct nftnl_udata_buf *buf) |
| 2837 | +uint32_t __EXPORTED nftnl_udata_buf_len(const struct nftnl_udata_buf *buf) |
| 2838 | { |
| 2839 | return (uint32_t)(buf->end - buf->data); |
| 2840 | } |
| 2841 | -EXPORT_SYMBOL(nftnl_udata_buf_len); |
| 2842 | |
| 2843 | -void *nftnl_udata_buf_data(const struct nftnl_udata_buf *buf) |
| 2844 | +void __EXPORTED *nftnl_udata_buf_data(const struct nftnl_udata_buf *buf) |
| 2845 | { |
| 2846 | return (void *)buf->data; |
| 2847 | } |
| 2848 | -EXPORT_SYMBOL(nftnl_udata_buf_data); |
| 2849 | |
| 2850 | -void nftnl_udata_buf_put(struct nftnl_udata_buf *buf, const void *data, |
| 2851 | +void __EXPORTED nftnl_udata_buf_put(struct nftnl_udata_buf *buf, const void *data, |
| 2852 | uint32_t len) |
| 2853 | { |
| 2854 | memcpy(buf->data, data, len <= buf->size ? len : buf->size); |
| 2855 | buf->end = buf->data + len; |
| 2856 | } |
| 2857 | -EXPORT_SYMBOL(nftnl_udata_buf_put); |
| 2858 | |
| 2859 | -struct nftnl_udata *nftnl_udata_start(const struct nftnl_udata_buf *buf) |
| 2860 | +struct nftnl_udata __EXPORTED *nftnl_udata_start(const struct nftnl_udata_buf *buf) |
| 2861 | { |
| 2862 | return (struct nftnl_udata *)buf->data; |
| 2863 | } |
| 2864 | -EXPORT_SYMBOL(nftnl_udata_start); |
| 2865 | |
| 2866 | -struct nftnl_udata *nftnl_udata_end(const struct nftnl_udata_buf *buf) |
| 2867 | +struct nftnl_udata __EXPORTED *nftnl_udata_end(const struct nftnl_udata_buf *buf) |
| 2868 | { |
| 2869 | return (struct nftnl_udata *)buf->end; |
| 2870 | } |
| 2871 | -EXPORT_SYMBOL(nftnl_udata_end); |
| 2872 | |
| 2873 | -bool nftnl_udata_put(struct nftnl_udata_buf *buf, uint8_t type, uint32_t len, |
| 2874 | +bool __EXPORTED nftnl_udata_put(struct nftnl_udata_buf *buf, uint8_t type, uint32_t len, |
| 2875 | const void *value) |
| 2876 | { |
| 2877 | struct nftnl_udata *attr; |
| 2878 | @@ -85,55 +78,47 @@ bool nftnl_udata_put(struct nftnl_udata_buf *buf, uint8_t type, uint32_t len, |
| 2879 | |
| 2880 | return true; |
| 2881 | } |
| 2882 | -EXPORT_SYMBOL(nftnl_udata_put); |
| 2883 | |
| 2884 | -bool nftnl_udata_put_strz(struct nftnl_udata_buf *buf, uint8_t type, |
| 2885 | +bool __EXPORTED nftnl_udata_put_strz(struct nftnl_udata_buf *buf, uint8_t type, |
| 2886 | const char *strz) |
| 2887 | { |
| 2888 | return nftnl_udata_put(buf, type, strlen(strz) + 1, strz); |
| 2889 | } |
| 2890 | -EXPORT_SYMBOL(nftnl_udata_put_strz); |
| 2891 | |
| 2892 | -bool nftnl_udata_put_u32(struct nftnl_udata_buf *buf, uint8_t type, |
| 2893 | +bool __EXPORTED nftnl_udata_put_u32(struct nftnl_udata_buf *buf, uint8_t type, |
| 2894 | uint32_t data) |
| 2895 | { |
| 2896 | return nftnl_udata_put(buf, type, sizeof(data), &data); |
| 2897 | } |
| 2898 | -EXPORT_SYMBOL(nftnl_udata_put_u32); |
| 2899 | |
| 2900 | -uint8_t nftnl_udata_type(const struct nftnl_udata *attr) |
| 2901 | +uint8_t __EXPORTED nftnl_udata_type(const struct nftnl_udata *attr) |
| 2902 | { |
| 2903 | return attr->type; |
| 2904 | } |
| 2905 | -EXPORT_SYMBOL(nftnl_udata_type); |
| 2906 | |
| 2907 | -uint8_t nftnl_udata_len(const struct nftnl_udata *attr) |
| 2908 | +uint8_t __EXPORTED nftnl_udata_len(const struct nftnl_udata *attr) |
| 2909 | { |
| 2910 | return attr->len; |
| 2911 | } |
| 2912 | -EXPORT_SYMBOL(nftnl_udata_len); |
| 2913 | |
| 2914 | -void *nftnl_udata_get(const struct nftnl_udata *attr) |
| 2915 | +void __EXPORTED *nftnl_udata_get(const struct nftnl_udata *attr) |
| 2916 | { |
| 2917 | return (void *)attr->value; |
| 2918 | } |
| 2919 | -EXPORT_SYMBOL(nftnl_udata_get); |
| 2920 | |
| 2921 | -uint32_t nftnl_udata_get_u32(const struct nftnl_udata *attr) |
| 2922 | +uint32_t __EXPORTED nftnl_udata_get_u32(const struct nftnl_udata *attr) |
| 2923 | { |
| 2924 | uint32_t *data = (uint32_t *)attr->value; |
| 2925 | |
| 2926 | return *data; |
| 2927 | } |
| 2928 | -EXPORT_SYMBOL(nftnl_udata_get_u32); |
| 2929 | |
| 2930 | -struct nftnl_udata *nftnl_udata_next(const struct nftnl_udata *attr) |
| 2931 | +struct nftnl_udata __EXPORTED *nftnl_udata_next(const struct nftnl_udata *attr) |
| 2932 | { |
| 2933 | return (struct nftnl_udata *)&attr->value[attr->len]; |
| 2934 | } |
| 2935 | -EXPORT_SYMBOL(nftnl_udata_next); |
| 2936 | |
| 2937 | -int nftnl_udata_parse(const void *data, uint32_t data_len, nftnl_udata_cb_t cb, |
| 2938 | +int __EXPORTED nftnl_udata_parse(const void *data, uint32_t data_len, nftnl_udata_cb_t cb, |
| 2939 | void *cb_data) |
| 2940 | { |
| 2941 | int ret = 0; |
| 2942 | @@ -147,4 +132,3 @@ int nftnl_udata_parse(const void *data, uint32_t data_len, nftnl_udata_cb_t cb, |
| 2943 | |
| 2944 | return ret; |
| 2945 | } |
| 2946 | -EXPORT_SYMBOL(nftnl_udata_parse); |
| 2947 | -- |
| 2948 | 2.11.0 (Apple Git-81) |
| 2949 | |