diff options
| author | Alex Kiernan <alex.kiernan@gmail.com> | 2018-11-10 18:48:00 +0000 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2018-11-12 10:04:31 -0800 |
| commit | cb9b98f69b55fbf1402f855472bd0df5afc5b46b (patch) | |
| tree | f205ef659e215b52d1a89d61192b9004ff1cfa47 | |
| parent | 016b243f10fa89ea610baa2535371efa79ef0405 (diff) | |
| download | meta-openembedded-cb9b98f69b55fbf1402f855472bd0df5afc5b46b.tar.gz | |
libnftnl: Upgrade to 1.1.1
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-networking/recipes-filter/libnftnl/libnftnl/0001-Declare-the-define-visivility-attribute-together.patch | 2949 | ||||
| -rw-r--r-- | meta-networking/recipes-filter/libnftnl/libnftnl/0001-Move-exports-before-symbol-definition.patch | 289 | ||||
| -rw-r--r-- | meta-networking/recipes-filter/libnftnl/libnftnl/0002-avoid-naming-local-function-as-one-of-printf-family.patch (renamed from meta-networking/recipes-filter/libnftnl/libnftnl/0001-avoid-naming-local-function-as-one-of-printf-family.patch) | 263 | ||||
| -rw-r--r-- | meta-networking/recipes-filter/libnftnl/libnftnl_1.1.1.bb (renamed from meta-networking/recipes-filter/libnftnl/libnftnl_1.0.7.bb) | 8 |
4 files changed, 441 insertions, 3068 deletions
diff --git a/meta-networking/recipes-filter/libnftnl/libnftnl/0001-Declare-the-define-visivility-attribute-together.patch b/meta-networking/recipes-filter/libnftnl/libnftnl/0001-Declare-the-define-visivility-attribute-together.patch deleted file mode 100644 index e82b23813f..0000000000 --- a/meta-networking/recipes-filter/libnftnl/libnftnl/0001-Declare-the-define-visivility-attribute-together.patch +++ /dev/null | |||
| @@ -1,2949 +0,0 @@ | |||
| 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 | |||
diff --git a/meta-networking/recipes-filter/libnftnl/libnftnl/0001-Move-exports-before-symbol-definition.patch b/meta-networking/recipes-filter/libnftnl/libnftnl/0001-Move-exports-before-symbol-definition.patch new file mode 100644 index 0000000000..995fd59a53 --- /dev/null +++ b/meta-networking/recipes-filter/libnftnl/libnftnl/0001-Move-exports-before-symbol-definition.patch | |||
| @@ -0,0 +1,289 @@ | |||
| 1 | From 21eb59fbd071ebffb8495232766824944fb521a0 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 3 | Date: Wed, 7 Nov 2018 21:19:53 +0000 | ||
| 4 | Subject: [PATCH] Move exports before symbol definition | ||
| 5 | |||
| 6 | Based on 7966020 ("src: Fix exporting symbols with clang"), when | ||
| 7 | EXPORT_SYMBOL is located after function definition, clang won't properly | ||
| 8 | export the function, resulting in a library with no symbols when built with | ||
| 9 | clang. | ||
| 10 | |||
| 11 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 12 | --- | ||
| 13 | src/flowtable.c | 54 +++++++++++++++++++++++++++--------------------------- | ||
| 14 | 1 file changed, 27 insertions(+), 27 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/src/flowtable.c b/src/flowtable.c | ||
| 17 | index c1ddae4..d7434e3 100644 | ||
| 18 | --- a/src/flowtable.c | ||
| 19 | +++ b/src/flowtable.c | ||
| 20 | @@ -34,12 +34,13 @@ struct nftnl_flowtable { | ||
| 21 | uint32_t flags; | ||
| 22 | }; | ||
| 23 | |||
| 24 | +EXPORT_SYMBOL(nftnl_flowtable_alloc); | ||
| 25 | struct nftnl_flowtable *nftnl_flowtable_alloc(void) | ||
| 26 | { | ||
| 27 | return calloc(1, sizeof(struct nftnl_flowtable)); | ||
| 28 | } | ||
| 29 | -EXPORT_SYMBOL(nftnl_flowtable_alloc); | ||
| 30 | |||
| 31 | +EXPORT_SYMBOL(nftnl_flowtable_free); | ||
| 32 | void nftnl_flowtable_free(const struct nftnl_flowtable *c) | ||
| 33 | { | ||
| 34 | int i; | ||
| 35 | @@ -56,14 +57,14 @@ void nftnl_flowtable_free(const struct nftnl_flowtable *c) | ||
| 36 | } | ||
| 37 | xfree(c); | ||
| 38 | } | ||
| 39 | -EXPORT_SYMBOL(nftnl_flowtable_free); | ||
| 40 | |||
| 41 | +EXPORT_SYMBOL(nftnl_flowtable_is_set); | ||
| 42 | bool nftnl_flowtable_is_set(const struct nftnl_flowtable *c, uint16_t attr) | ||
| 43 | { | ||
| 44 | return c->flags & (1 << attr); | ||
| 45 | } | ||
| 46 | -EXPORT_SYMBOL(nftnl_flowtable_is_set); | ||
| 47 | |||
| 48 | +EXPORT_SYMBOL(nftnl_flowtable_unset); | ||
| 49 | void nftnl_flowtable_unset(struct nftnl_flowtable *c, uint16_t attr) | ||
| 50 | { | ||
| 51 | int i; | ||
| 52 | @@ -96,7 +97,6 @@ void nftnl_flowtable_unset(struct nftnl_flowtable *c, uint16_t attr) | ||
| 53 | |||
| 54 | c->flags &= ~(1 << attr); | ||
| 55 | } | ||
| 56 | -EXPORT_SYMBOL(nftnl_flowtable_unset); | ||
| 57 | |||
| 58 | static uint32_t nftnl_flowtable_validate[NFTNL_FLOWTABLE_MAX + 1] = { | ||
| 59 | [NFTNL_FLOWTABLE_HOOKNUM] = sizeof(uint32_t), | ||
| 60 | @@ -105,6 +105,7 @@ static uint32_t nftnl_flowtable_validate[NFTNL_FLOWTABLE_MAX + 1] = { | ||
| 61 | [NFTNL_FLOWTABLE_FLAGS] = sizeof(uint32_t), | ||
| 62 | }; | ||
| 63 | |||
| 64 | +EXPORT_SYMBOL(nftnl_flowtable_set_data); | ||
| 65 | int nftnl_flowtable_set_data(struct nftnl_flowtable *c, uint16_t attr, | ||
| 66 | const void *data, uint32_t data_len) | ||
| 67 | { | ||
| 68 | @@ -170,32 +171,32 @@ int nftnl_flowtable_set_data(struct nftnl_flowtable *c, uint16_t attr, | ||
| 69 | c->flags |= (1 << attr); | ||
| 70 | return 0; | ||
| 71 | } | ||
| 72 | -EXPORT_SYMBOL(nftnl_flowtable_set_data); | ||
| 73 | |||
| 74 | +EXPORT_SYMBOL(nftnl_flowtable_set); | ||
| 75 | void nftnl_flowtable_set(struct nftnl_flowtable *c, uint16_t attr, const void *data) | ||
| 76 | { | ||
| 77 | nftnl_flowtable_set_data(c, attr, data, nftnl_flowtable_validate[attr]); | ||
| 78 | } | ||
| 79 | -EXPORT_SYMBOL(nftnl_flowtable_set); | ||
| 80 | |||
| 81 | +EXPORT_SYMBOL(nftnl_flowtable_set_u32); | ||
| 82 | void nftnl_flowtable_set_u32(struct nftnl_flowtable *c, uint16_t attr, uint32_t data) | ||
| 83 | { | ||
| 84 | nftnl_flowtable_set_data(c, attr, &data, sizeof(uint32_t)); | ||
| 85 | } | ||
| 86 | -EXPORT_SYMBOL(nftnl_flowtable_set_u32); | ||
| 87 | |||
| 88 | +EXPORT_SYMBOL(nftnl_flowtable_set_s32); | ||
| 89 | void nftnl_flowtable_set_s32(struct nftnl_flowtable *c, uint16_t attr, int32_t data) | ||
| 90 | { | ||
| 91 | nftnl_flowtable_set_data(c, attr, &data, sizeof(int32_t)); | ||
| 92 | } | ||
| 93 | -EXPORT_SYMBOL(nftnl_flowtable_set_s32); | ||
| 94 | |||
| 95 | +EXPORT_SYMBOL(nftnl_flowtable_set_str); | ||
| 96 | int nftnl_flowtable_set_str(struct nftnl_flowtable *c, uint16_t attr, const char *str) | ||
| 97 | { | ||
| 98 | return nftnl_flowtable_set_data(c, attr, str, strlen(str) + 1); | ||
| 99 | } | ||
| 100 | -EXPORT_SYMBOL(nftnl_flowtable_set_str); | ||
| 101 | |||
| 102 | +EXPORT_SYMBOL(nftnl_flowtable_get_data); | ||
| 103 | const void *nftnl_flowtable_get_data(const struct nftnl_flowtable *c, | ||
| 104 | uint16_t attr, uint32_t *data_len) | ||
| 105 | { | ||
| 106 | @@ -229,21 +230,21 @@ const void *nftnl_flowtable_get_data(const struct nftnl_flowtable *c, | ||
| 107 | } | ||
| 108 | return NULL; | ||
| 109 | } | ||
| 110 | -EXPORT_SYMBOL(nftnl_flowtable_get_data); | ||
| 111 | |||
| 112 | +EXPORT_SYMBOL(nftnl_flowtable_get); | ||
| 113 | const void *nftnl_flowtable_get(const struct nftnl_flowtable *c, uint16_t attr) | ||
| 114 | { | ||
| 115 | uint32_t data_len; | ||
| 116 | return nftnl_flowtable_get_data(c, attr, &data_len); | ||
| 117 | } | ||
| 118 | -EXPORT_SYMBOL(nftnl_flowtable_get); | ||
| 119 | |||
| 120 | +EXPORT_SYMBOL(nftnl_flowtable_get_str); | ||
| 121 | const char *nftnl_flowtable_get_str(const struct nftnl_flowtable *c, uint16_t attr) | ||
| 122 | { | ||
| 123 | return nftnl_flowtable_get(c, attr); | ||
| 124 | } | ||
| 125 | -EXPORT_SYMBOL(nftnl_flowtable_get_str); | ||
| 126 | |||
| 127 | +EXPORT_SYMBOL(nftnl_flowtable_get_u32); | ||
| 128 | uint32_t nftnl_flowtable_get_u32(const struct nftnl_flowtable *c, uint16_t attr) | ||
| 129 | { | ||
| 130 | uint32_t data_len; | ||
| 131 | @@ -253,8 +254,8 @@ uint32_t nftnl_flowtable_get_u32(const struct nftnl_flowtable *c, uint16_t attr) | ||
| 132 | |||
| 133 | return val ? *val : 0; | ||
| 134 | } | ||
| 135 | -EXPORT_SYMBOL(nftnl_flowtable_get_u32); | ||
| 136 | |||
| 137 | +EXPORT_SYMBOL(nftnl_flowtable_get_s32); | ||
| 138 | int32_t nftnl_flowtable_get_s32(const struct nftnl_flowtable *c, uint16_t attr) | ||
| 139 | { | ||
| 140 | uint32_t data_len; | ||
| 141 | @@ -264,8 +265,8 @@ int32_t nftnl_flowtable_get_s32(const struct nftnl_flowtable *c, uint16_t attr) | ||
| 142 | |||
| 143 | return val ? *val : 0; | ||
| 144 | } | ||
| 145 | -EXPORT_SYMBOL(nftnl_flowtable_get_s32); | ||
| 146 | |||
| 147 | +EXPORT_SYMBOL(nftnl_flowtable_nlmsg_build_payload); | ||
| 148 | void nftnl_flowtable_nlmsg_build_payload(struct nlmsghdr *nlh, | ||
| 149 | const struct nftnl_flowtable *c) | ||
| 150 | { | ||
| 151 | @@ -301,7 +302,6 @@ void nftnl_flowtable_nlmsg_build_payload(struct nlmsghdr *nlh, | ||
| 152 | if (c->flags & (1 << NFTNL_FLOWTABLE_SIZE)) | ||
| 153 | mnl_attr_put_u32(nlh, NFTA_FLOWTABLE_SIZE, htonl(c->size)); | ||
| 154 | } | ||
| 155 | -EXPORT_SYMBOL(nftnl_flowtable_nlmsg_build_payload); | ||
| 156 | |||
| 157 | static int nftnl_flowtable_parse_attr_cb(const struct nlattr *attr, void *data) | ||
| 158 | { | ||
| 159 | @@ -412,6 +412,7 @@ static int nftnl_flowtable_parse_hook(struct nlattr *attr, struct nftnl_flowtabl | ||
| 160 | return 0; | ||
| 161 | } | ||
| 162 | |||
| 163 | +EXPORT_SYMBOL(nftnl_flowtable_nlmsg_parse); | ||
| 164 | int nftnl_flowtable_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_flowtable *c) | ||
| 165 | { | ||
| 166 | struct nlattr *tb[NFTA_FLOWTABLE_MAX + 1] = {}; | ||
| 167 | @@ -460,7 +461,6 @@ int nftnl_flowtable_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_flowtab | ||
| 168 | |||
| 169 | return ret; | ||
| 170 | } | ||
| 171 | -EXPORT_SYMBOL(nftnl_flowtable_nlmsg_parse); | ||
| 172 | |||
| 173 | static const char *nftnl_hooknum2str(int family, int hooknum) | ||
| 174 | { | ||
| 175 | @@ -612,20 +612,20 @@ static int nftnl_flowtable_do_parse(struct nftnl_flowtable *c, | ||
| 176 | return ret; | ||
| 177 | } | ||
| 178 | |||
| 179 | +EXPORT_SYMBOL(nftnl_flowtable_parse); | ||
| 180 | int nftnl_flowtable_parse(struct nftnl_flowtable *c, enum nftnl_parse_type type, | ||
| 181 | const char *data, struct nftnl_parse_err *err) | ||
| 182 | { | ||
| 183 | return nftnl_flowtable_do_parse(c, type, data, err, NFTNL_PARSE_BUFFER); | ||
| 184 | } | ||
| 185 | -EXPORT_SYMBOL(nftnl_flowtable_parse); | ||
| 186 | |||
| 187 | +EXPORT_SYMBOL(nftnl_flowtable_parse_file); | ||
| 188 | int nftnl_flowtable_parse_file(struct nftnl_flowtable *c, | ||
| 189 | enum nftnl_parse_type type, | ||
| 190 | FILE *fp, struct nftnl_parse_err *err) | ||
| 191 | { | ||
| 192 | return nftnl_flowtable_do_parse(c, type, fp, err, NFTNL_PARSE_FILE); | ||
| 193 | } | ||
| 194 | -EXPORT_SYMBOL(nftnl_flowtable_parse_file); | ||
| 195 | |||
| 196 | static int nftnl_flowtable_export(char *buf, size_t size, | ||
| 197 | const struct nftnl_flowtable *c, int type) | ||
| 198 | @@ -720,6 +720,7 @@ static int nftnl_flowtable_cmd_snprintf(char *buf, size_t size, | ||
| 199 | return offset; | ||
| 200 | } | ||
| 201 | |||
| 202 | +EXPORT_SYMBOL(nftnl_flowtable_snprintf); | ||
| 203 | int nftnl_flowtable_snprintf(char *buf, size_t size, const struct nftnl_flowtable *c, | ||
| 204 | uint32_t type, uint32_t flags) | ||
| 205 | { | ||
| 206 | @@ -729,7 +730,6 @@ int nftnl_flowtable_snprintf(char *buf, size_t size, const struct nftnl_flowtabl | ||
| 207 | return nftnl_flowtable_cmd_snprintf(buf, size, c, nftnl_flag2cmd(flags), | ||
| 208 | type, flags); | ||
| 209 | } | ||
| 210 | -EXPORT_SYMBOL(nftnl_flowtable_snprintf); | ||
| 211 | |||
| 212 | static int nftnl_flowtable_do_snprintf(char *buf, size_t size, const void *c, | ||
| 213 | uint32_t cmd, uint32_t type, uint32_t flags) | ||
| 214 | @@ -737,18 +737,19 @@ static int nftnl_flowtable_do_snprintf(char *buf, size_t size, const void *c, | ||
| 215 | return nftnl_flowtable_snprintf(buf, size, c, type, flags); | ||
| 216 | } | ||
| 217 | |||
| 218 | +EXPORT_SYMBOL(nftnl_flowtable_fprintf); | ||
| 219 | int nftnl_flowtable_fprintf(FILE *fp, const struct nftnl_flowtable *c, | ||
| 220 | uint32_t type, uint32_t flags) | ||
| 221 | { | ||
| 222 | return nftnl_fprintf(fp, c, NFTNL_CMD_UNSPEC, type, flags, | ||
| 223 | nftnl_flowtable_do_snprintf); | ||
| 224 | } | ||
| 225 | -EXPORT_SYMBOL(nftnl_flowtable_fprintf); | ||
| 226 | |||
| 227 | struct nftnl_flowtable_list { | ||
| 228 | struct list_head list; | ||
| 229 | }; | ||
| 230 | |||
| 231 | +EXPORT_SYMBOL(nftnl_flowtable_list_alloc); | ||
| 232 | struct nftnl_flowtable_list *nftnl_flowtable_list_alloc(void) | ||
| 233 | { | ||
| 234 | struct nftnl_flowtable_list *list; | ||
| 235 | @@ -761,8 +762,8 @@ struct nftnl_flowtable_list *nftnl_flowtable_list_alloc(void) | ||
| 236 | |||
| 237 | return list; | ||
| 238 | } | ||
| 239 | -EXPORT_SYMBOL(nftnl_flowtable_list_alloc); | ||
| 240 | |||
| 241 | +EXPORT_SYMBOL(nftnl_flowtable_list_free); | ||
| 242 | void nftnl_flowtable_list_free(struct nftnl_flowtable_list *list) | ||
| 243 | { | ||
| 244 | struct nftnl_flowtable *s, *tmp; | ||
| 245 | @@ -773,34 +774,34 @@ void nftnl_flowtable_list_free(struct nftnl_flowtable_list *list) | ||
| 246 | } | ||
| 247 | xfree(list); | ||
| 248 | } | ||
| 249 | -EXPORT_SYMBOL(nftnl_flowtable_list_free); | ||
| 250 | |||
| 251 | +EXPORT_SYMBOL(nftnl_flowtable_list_is_empty); | ||
| 252 | int nftnl_flowtable_list_is_empty(const struct nftnl_flowtable_list *list) | ||
| 253 | { | ||
| 254 | return list_empty(&list->list); | ||
| 255 | } | ||
| 256 | -EXPORT_SYMBOL(nftnl_flowtable_list_is_empty); | ||
| 257 | |||
| 258 | +EXPORT_SYMBOL(nftnl_flowtable_list_add); | ||
| 259 | void nftnl_flowtable_list_add(struct nftnl_flowtable *s, | ||
| 260 | struct nftnl_flowtable_list *list) | ||
| 261 | { | ||
| 262 | list_add(&s->head, &list->list); | ||
| 263 | } | ||
| 264 | -EXPORT_SYMBOL(nftnl_flowtable_list_add); | ||
| 265 | |||
| 266 | +EXPORT_SYMBOL(nftnl_flowtable_list_add_tail); | ||
| 267 | void nftnl_flowtable_list_add_tail(struct nftnl_flowtable *s, | ||
| 268 | struct nftnl_flowtable_list *list) | ||
| 269 | { | ||
| 270 | list_add_tail(&s->head, &list->list); | ||
| 271 | } | ||
| 272 | -EXPORT_SYMBOL(nftnl_flowtable_list_add_tail); | ||
| 273 | |||
| 274 | +EXPORT_SYMBOL(nftnl_flowtable_list_del); | ||
| 275 | void nftnl_flowtable_list_del(struct nftnl_flowtable *s) | ||
| 276 | { | ||
| 277 | list_del(&s->head); | ||
| 278 | } | ||
| 279 | -EXPORT_SYMBOL(nftnl_flowtable_list_del); | ||
| 280 | |||
| 281 | +EXPORT_SYMBOL(nftnl_flowtable_list_foreach); | ||
| 282 | int nftnl_flowtable_list_foreach(struct nftnl_flowtable_list *flowtable_list, | ||
| 283 | int (*cb)(struct nftnl_flowtable *t, void *data), void *data) | ||
| 284 | { | ||
| 285 | @@ -814,4 +815,3 @@ int nftnl_flowtable_list_foreach(struct nftnl_flowtable_list *flowtable_list, | ||
| 286 | } | ||
| 287 | return 0; | ||
| 288 | } | ||
| 289 | -EXPORT_SYMBOL(nftnl_flowtable_list_foreach); | ||
diff --git a/meta-networking/recipes-filter/libnftnl/libnftnl/0001-avoid-naming-local-function-as-one-of-printf-family.patch b/meta-networking/recipes-filter/libnftnl/libnftnl/0002-avoid-naming-local-function-as-one-of-printf-family.patch index 06e68177ce..e7e8f6fe91 100644 --- a/meta-networking/recipes-filter/libnftnl/libnftnl/0001-avoid-naming-local-function-as-one-of-printf-family.patch +++ b/meta-networking/recipes-filter/libnftnl/libnftnl/0002-avoid-naming-local-function-as-one-of-printf-family.patch | |||
| @@ -1,51 +1,55 @@ | |||
| 1 | From f840cc0da571d98beb17855c177e9986bd096b72 Mon Sep 17 00:00:00 2001 | 1 | From 5ea9fa9d345005f2f53b1b598edb85f5f24ca9da Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Alex Kiernan <alex.kiernan@gmail.com> |
| 3 | Date: Thu, 13 Apr 2017 11:46:09 -0700 | 3 | Date: Wed, 7 Nov 2018 19:41:54 +0000 |
| 4 | Subject: [PATCH] avoid naming local function as one of printf family | 4 | Subject: [PATCH] avoid naming local function as one of printf family |
| 5 | 5 | ||
| 6 | Fixes build issues with clang | 6 | Fixes build issues with clang |
| 7 | error: no member named '__builtin___snprintf_chk' in 'struct expr_ops' | 7 | error: no member named '__builtin___snprintf_chk' in 'struct expr_ops' |
| 8 | 8 | ||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 10 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 10 | --- | 11 | --- |
| 11 | include/expr_ops.h | 2 +- | 12 | include/expr_ops.h | 2 +- |
| 12 | include/obj.h | 2 +- | 13 | include/obj.h | 2 +- |
| 13 | src/buffer.c | 2 +- | 14 | src/expr.c | 4 ++-- |
| 14 | src/expr.c | 4 ++-- | 15 | src/expr/bitwise.c | 2 +- |
| 15 | src/expr/bitwise.c | 2 +- | 16 | src/expr/byteorder.c | 2 +- |
| 16 | src/expr/byteorder.c | 2 +- | 17 | src/expr/cmp.c | 2 +- |
| 17 | src/expr/cmp.c | 2 +- | 18 | src/expr/connlimit.c | 2 +- |
| 18 | src/expr/counter.c | 2 +- | 19 | src/expr/counter.c | 2 +- |
| 19 | src/expr/ct.c | 2 +- | 20 | src/expr/ct.c | 2 +- |
| 20 | src/expr/dup.c | 2 +- | 21 | src/expr/dup.c | 2 +- |
| 21 | src/expr/dynset.c | 2 +- | 22 | src/expr/dynset.c | 2 +- |
| 22 | src/expr/exthdr.c | 2 +- | 23 | src/expr/exthdr.c | 2 +- |
| 23 | src/expr/fib.c | 2 +- | 24 | src/expr/fib.c | 2 +- |
| 24 | src/expr/fwd.c | 2 +- | 25 | src/expr/flow_offload.c | 2 +- |
| 25 | src/expr/hash.c | 2 +- | 26 | src/expr/fwd.c | 2 +- |
| 26 | src/expr/immediate.c | 2 +- | 27 | src/expr/hash.c | 2 +- |
| 27 | src/expr/limit.c | 2 +- | 28 | src/expr/immediate.c | 2 +- |
| 28 | src/expr/log.c | 2 +- | 29 | src/expr/limit.c | 2 +- |
| 29 | src/expr/lookup.c | 2 +- | 30 | src/expr/log.c | 2 +- |
| 30 | src/expr/masq.c | 2 +- | 31 | src/expr/lookup.c | 2 +- |
| 31 | src/expr/match.c | 2 +- | 32 | src/expr/masq.c | 2 +- |
| 32 | src/expr/meta.c | 2 +- | 33 | src/expr/match.c | 2 +- |
| 33 | src/expr/nat.c | 2 +- | 34 | src/expr/meta.c | 2 +- |
| 34 | src/expr/numgen.c | 2 +- | 35 | src/expr/nat.c | 2 +- |
| 35 | src/expr/objref.c | 2 +- | 36 | src/expr/numgen.c | 2 +- |
| 36 | src/expr/payload.c | 2 +- | 37 | src/expr/objref.c | 2 +- |
| 37 | src/expr/queue.c | 2 +- | 38 | src/expr/payload.c | 2 +- |
| 38 | src/expr/quota.c | 2 +- | 39 | src/expr/queue.c | 2 +- |
| 39 | src/expr/range.c | 2 +- | 40 | src/expr/quota.c | 2 +- |
| 40 | src/expr/redir.c | 2 +- | 41 | src/expr/range.c | 2 +- |
| 41 | src/expr/reject.c | 2 +- | 42 | src/expr/redir.c | 2 +- |
| 42 | src/expr/rt.c | 2 +- | 43 | src/expr/reject.c | 2 +- |
| 43 | src/expr/target.c | 2 +- | 44 | src/expr/rt.c | 2 +- |
| 44 | src/obj/counter.c | 2 +- | 45 | src/expr/socket.c | 2 +- |
| 45 | src/obj/ct_helper.c | 2 +- | 46 | src/expr/target.c | 2 +- |
| 46 | src/obj/quota.c | 2 +- | 47 | src/obj/counter.c | 2 +- |
| 47 | src/object.c | 4 ++-- | 48 | src/obj/ct_helper.c | 2 +- |
| 48 | 37 files changed, 39 insertions(+), 39 deletions(-) | 49 | src/obj/limit.c | 2 +- |
| 50 | src/obj/quota.c | 2 +- | ||
| 51 | src/object.c | 4 ++-- | ||
| 52 | 40 files changed, 42 insertions(+), 42 deletions(-) | ||
| 49 | 53 | ||
| 50 | diff --git a/include/expr_ops.h b/include/expr_ops.h | 54 | diff --git a/include/expr_ops.h b/include/expr_ops.h |
| 51 | index e639390..c4fe050 100644 | 55 | index e639390..c4fe050 100644 |
| @@ -61,10 +65,10 @@ index e639390..c4fe050 100644 | |||
| 61 | struct nftnl_parse_err *err); | 65 | struct nftnl_parse_err *err); |
| 62 | }; | 66 | }; |
| 63 | diff --git a/include/obj.h b/include/obj.h | 67 | diff --git a/include/obj.h b/include/obj.h |
| 64 | index d90919f..772caff 100644 | 68 | index 4a728c8..4c20bd1 100644 |
| 65 | --- a/include/obj.h | 69 | --- a/include/obj.h |
| 66 | +++ b/include/obj.h | 70 | +++ b/include/obj.h |
| 67 | @@ -47,7 +47,7 @@ struct obj_ops { | 71 | @@ -55,7 +55,7 @@ struct obj_ops { |
| 68 | const void *(*get)(const struct nftnl_obj *e, uint16_t type, uint32_t *data_len); | 72 | const void *(*get)(const struct nftnl_obj *e, uint16_t type, uint32_t *data_len); |
| 69 | int (*parse)(struct nftnl_obj *e, struct nlattr *attr); | 73 | int (*parse)(struct nftnl_obj *e, struct nlattr *attr); |
| 70 | void (*build)(struct nlmsghdr *nlh, const struct nftnl_obj *e); | 74 | void (*build)(struct nlmsghdr *nlh, const struct nftnl_obj *e); |
| @@ -73,38 +77,25 @@ index d90919f..772caff 100644 | |||
| 73 | int (*json_parse)(struct nftnl_obj *e, json_t *data, | 77 | int (*json_parse)(struct nftnl_obj *e, json_t *data, |
| 74 | struct nftnl_parse_err *err); | 78 | struct nftnl_parse_err *err); |
| 75 | }; | 79 | }; |
| 76 | diff --git a/src/buffer.c b/src/buffer.c | ||
| 77 | index f9d5a83..db656e2 100644 | ||
| 78 | --- a/src/buffer.c | ||
| 79 | +++ b/src/buffer.c | ||
| 80 | @@ -206,7 +206,7 @@ int nftnl_buf_expr(struct nftnl_buf *b, int type, uint32_t flags, | ||
| 81 | case NFTNL_OUTPUT_JSON: | ||
| 82 | nftnl_buf_put(b, "{"); | ||
| 83 | nftnl_buf_str(b, type, expr->ops->name, TYPE); | ||
| 84 | - ret = expr->ops->snprintf(b->buf + b->off, b->len, type, flags, | ||
| 85 | + ret = expr->ops->snprintf_(b->buf + b->off, b->len, type, flags, | ||
| 86 | expr); | ||
| 87 | if (ret > 0) | ||
| 88 | nftnl_buf_update(b, ret); | ||
| 89 | diff --git a/src/expr.c b/src/expr.c | 80 | diff --git a/src/expr.c b/src/expr.c |
| 90 | index c7eb2b4..24f8f8c 100644 | 81 | index 62565e0..2489c30 100644 |
| 91 | --- a/src/expr.c | 82 | --- a/src/expr.c |
| 92 | +++ b/src/expr.c | 83 | +++ b/src/expr.c |
| 93 | @@ -265,10 +265,10 @@ int __EXPORTED nftnl_expr_snprintf(char *buf, size_t size, const struct nftnl_ex | 84 | @@ -285,10 +285,10 @@ int nftnl_expr_snprintf(char *buf, size_t size, const struct nftnl_expr *expr, |
| 94 | int ret; | 85 | if (size) |
| 95 | unsigned int offset = 0, len = size; | 86 | buf[0] = '\0'; |
| 96 | 87 | ||
| 97 | - if (!expr->ops->snprintf) | 88 | - if (!expr->ops->snprintf) |
| 98 | + if (!expr->ops->snprintf_) | 89 | + if (!expr->ops->snprintf_) |
| 99 | return 0; | 90 | return 0; |
| 100 | 91 | ||
| 101 | - ret = expr->ops->snprintf(buf+offset, len, type, flags, expr); | 92 | - ret = expr->ops->snprintf(buf + offset, remain, type, flags, expr); |
| 102 | + ret = expr->ops->snprintf_(buf+offset, len, type, flags, expr); | 93 | + ret = expr->ops->snprintf_(buf + offset, remain, type, flags, expr); |
| 103 | SNPRINTF_BUFFER_SIZE(ret, size, len, offset); | 94 | SNPRINTF_BUFFER_SIZE(ret, remain, offset); |
| 104 | 95 | ||
| 105 | return offset; | 96 | return offset; |
| 106 | diff --git a/src/expr/bitwise.c b/src/expr/bitwise.c | 97 | diff --git a/src/expr/bitwise.c b/src/expr/bitwise.c |
| 107 | index 0febc9d..9b48e79 100644 | 98 | index a89734b..f8360b1 100644 |
| 108 | --- a/src/expr/bitwise.c | 99 | --- a/src/expr/bitwise.c |
| 109 | +++ b/src/expr/bitwise.c | 100 | +++ b/src/expr/bitwise.c |
| 110 | @@ -299,6 +299,6 @@ struct expr_ops expr_ops_bitwise = { | 101 | @@ -299,6 +299,6 @@ struct expr_ops expr_ops_bitwise = { |
| @@ -116,7 +107,7 @@ index 0febc9d..9b48e79 100644 | |||
| 116 | .json_parse = nftnl_expr_bitwise_json_parse, | 107 | .json_parse = nftnl_expr_bitwise_json_parse, |
| 117 | }; | 108 | }; |
| 118 | diff --git a/src/expr/byteorder.c b/src/expr/byteorder.c | 109 | diff --git a/src/expr/byteorder.c b/src/expr/byteorder.c |
| 119 | index 3805307..079582f 100644 | 110 | index 47c04cf..61f733f 100644 |
| 120 | --- a/src/expr/byteorder.c | 111 | --- a/src/expr/byteorder.c |
| 121 | +++ b/src/expr/byteorder.c | 112 | +++ b/src/expr/byteorder.c |
| 122 | @@ -314,6 +314,6 @@ struct expr_ops expr_ops_byteorder = { | 113 | @@ -314,6 +314,6 @@ struct expr_ops expr_ops_byteorder = { |
| @@ -128,7 +119,7 @@ index 3805307..079582f 100644 | |||
| 128 | .json_parse = nftnl_expr_byteorder_json_parse, | 119 | .json_parse = nftnl_expr_byteorder_json_parse, |
| 129 | }; | 120 | }; |
| 130 | diff --git a/src/expr/cmp.c b/src/expr/cmp.c | 121 | diff --git a/src/expr/cmp.c b/src/expr/cmp.c |
| 131 | index 353e907..99b497c 100644 | 122 | index b26d0eb..522c7be 100644 |
| 132 | --- a/src/expr/cmp.c | 123 | --- a/src/expr/cmp.c |
| 133 | +++ b/src/expr/cmp.c | 124 | +++ b/src/expr/cmp.c |
| 134 | @@ -284,6 +284,6 @@ struct expr_ops expr_ops_cmp = { | 125 | @@ -284,6 +284,6 @@ struct expr_ops expr_ops_cmp = { |
| @@ -139,6 +130,18 @@ index 353e907..99b497c 100644 | |||
| 139 | + .snprintf_ = nftnl_expr_cmp_snprintf, | 130 | + .snprintf_ = nftnl_expr_cmp_snprintf, |
| 140 | .json_parse = nftnl_expr_cmp_json_parse, | 131 | .json_parse = nftnl_expr_cmp_json_parse, |
| 141 | }; | 132 | }; |
| 133 | diff --git a/src/expr/connlimit.c b/src/expr/connlimit.c | ||
| 134 | index 60965b5..4e41866 100644 | ||
| 135 | --- a/src/expr/connlimit.c | ||
| 136 | +++ b/src/expr/connlimit.c | ||
| 137 | @@ -202,6 +202,6 @@ struct expr_ops expr_ops_connlimit = { | ||
| 138 | .get = nftnl_expr_connlimit_get, | ||
| 139 | .parse = nftnl_expr_connlimit_parse, | ||
| 140 | .build = nftnl_expr_connlimit_build, | ||
| 141 | - .snprintf = nftnl_expr_connlimit_snprintf, | ||
| 142 | + .snprintf_ = nftnl_expr_connlimit_snprintf, | ||
| 143 | .json_parse = nftnl_expr_connlimit_json_parse, | ||
| 144 | }; | ||
| 142 | diff --git a/src/expr/counter.c b/src/expr/counter.c | 145 | diff --git a/src/expr/counter.c b/src/expr/counter.c |
| 143 | index 21901e8..9fd7655 100644 | 146 | index 21901e8..9fd7655 100644 |
| 144 | --- a/src/expr/counter.c | 147 | --- a/src/expr/counter.c |
| @@ -152,10 +155,10 @@ index 21901e8..9fd7655 100644 | |||
| 152 | .json_parse = nftnl_expr_counter_json_parse, | 155 | .json_parse = nftnl_expr_counter_json_parse, |
| 153 | }; | 156 | }; |
| 154 | diff --git a/src/expr/ct.c b/src/expr/ct.c | 157 | diff --git a/src/expr/ct.c b/src/expr/ct.c |
| 155 | index cdd08e9..6ce5478 100644 | 158 | index 39e9be6..b363f7c 100644 |
| 156 | --- a/src/expr/ct.c | 159 | --- a/src/expr/ct.c |
| 157 | +++ b/src/expr/ct.c | 160 | +++ b/src/expr/ct.c |
| 158 | @@ -356,6 +356,6 @@ struct expr_ops expr_ops_ct = { | 161 | @@ -357,6 +357,6 @@ struct expr_ops expr_ops_ct = { |
| 159 | .get = nftnl_expr_ct_get, | 162 | .get = nftnl_expr_ct_get, |
| 160 | .parse = nftnl_expr_ct_parse, | 163 | .parse = nftnl_expr_ct_parse, |
| 161 | .build = nftnl_expr_ct_build, | 164 | .build = nftnl_expr_ct_build, |
| @@ -164,7 +167,7 @@ index cdd08e9..6ce5478 100644 | |||
| 164 | .json_parse = nftnl_expr_ct_json_parse, | 167 | .json_parse = nftnl_expr_ct_json_parse, |
| 165 | }; | 168 | }; |
| 166 | diff --git a/src/expr/dup.c b/src/expr/dup.c | 169 | diff --git a/src/expr/dup.c b/src/expr/dup.c |
| 167 | index 9aa332b..2f491d8 100644 | 170 | index ed8e620..8d603e3 100644 |
| 168 | --- a/src/expr/dup.c | 171 | --- a/src/expr/dup.c |
| 169 | +++ b/src/expr/dup.c | 172 | +++ b/src/expr/dup.c |
| 170 | @@ -206,6 +206,6 @@ struct expr_ops expr_ops_dup = { | 173 | @@ -206,6 +206,6 @@ struct expr_ops expr_ops_dup = { |
| @@ -176,7 +179,7 @@ index 9aa332b..2f491d8 100644 | |||
| 176 | .json_parse = nftnl_expr_dup_json_parse, | 179 | .json_parse = nftnl_expr_dup_json_parse, |
| 177 | }; | 180 | }; |
| 178 | diff --git a/src/expr/dynset.c b/src/expr/dynset.c | 181 | diff --git a/src/expr/dynset.c b/src/expr/dynset.c |
| 179 | index f7b99ea..758f07c 100644 | 182 | index 160d0e1..a43f4da 100644 |
| 180 | --- a/src/expr/dynset.c | 183 | --- a/src/expr/dynset.c |
| 181 | +++ b/src/expr/dynset.c | 184 | +++ b/src/expr/dynset.c |
| 182 | @@ -368,6 +368,6 @@ struct expr_ops expr_ops_dynset = { | 185 | @@ -368,6 +368,6 @@ struct expr_ops expr_ops_dynset = { |
| @@ -188,10 +191,10 @@ index f7b99ea..758f07c 100644 | |||
| 188 | .json_parse = nftnl_expr_dynset_json_parse, | 191 | .json_parse = nftnl_expr_dynset_json_parse, |
| 189 | }; | 192 | }; |
| 190 | diff --git a/src/expr/exthdr.c b/src/expr/exthdr.c | 193 | diff --git a/src/expr/exthdr.c b/src/expr/exthdr.c |
| 191 | index d4f1665..a834782 100644 | 194 | index 75cafbc..89ea7f5 100644 |
| 192 | --- a/src/expr/exthdr.c | 195 | --- a/src/expr/exthdr.c |
| 193 | +++ b/src/expr/exthdr.c | 196 | +++ b/src/expr/exthdr.c |
| 194 | @@ -356,6 +356,6 @@ struct expr_ops expr_ops_exthdr = { | 197 | @@ -385,6 +385,6 @@ struct expr_ops expr_ops_exthdr = { |
| 195 | .get = nftnl_expr_exthdr_get, | 198 | .get = nftnl_expr_exthdr_get, |
| 196 | .parse = nftnl_expr_exthdr_parse, | 199 | .parse = nftnl_expr_exthdr_parse, |
| 197 | .build = nftnl_expr_exthdr_build, | 200 | .build = nftnl_expr_exthdr_build, |
| @@ -200,10 +203,10 @@ index d4f1665..a834782 100644 | |||
| 200 | .json_parse = nftnl_expr_exthdr_json_parse, | 203 | .json_parse = nftnl_expr_exthdr_json_parse, |
| 201 | }; | 204 | }; |
| 202 | diff --git a/src/expr/fib.c b/src/expr/fib.c | 205 | diff --git a/src/expr/fib.c b/src/expr/fib.c |
| 203 | index f3be081..3c353b2 100644 | 206 | index b922b26..ece4645 100644 |
| 204 | --- a/src/expr/fib.c | 207 | --- a/src/expr/fib.c |
| 205 | +++ b/src/expr/fib.c | 208 | +++ b/src/expr/fib.c |
| 206 | @@ -272,6 +272,6 @@ struct expr_ops expr_ops_fib = { | 209 | @@ -274,6 +274,6 @@ struct expr_ops expr_ops_fib = { |
| 207 | .get = nftnl_expr_fib_get, | 210 | .get = nftnl_expr_fib_get, |
| 208 | .parse = nftnl_expr_fib_parse, | 211 | .parse = nftnl_expr_fib_parse, |
| 209 | .build = nftnl_expr_fib_build, | 212 | .build = nftnl_expr_fib_build, |
| @@ -211,11 +214,23 @@ index f3be081..3c353b2 100644 | |||
| 211 | + .snprintf_ = nftnl_expr_fib_snprintf, | 214 | + .snprintf_ = nftnl_expr_fib_snprintf, |
| 212 | .json_parse = nftnl_expr_fib_json_parse, | 215 | .json_parse = nftnl_expr_fib_json_parse, |
| 213 | }; | 216 | }; |
| 217 | diff --git a/src/expr/flow_offload.c b/src/expr/flow_offload.c | ||
| 218 | index a2001c9..9cdbc21 100644 | ||
| 219 | --- a/src/expr/flow_offload.c | ||
| 220 | +++ b/src/expr/flow_offload.c | ||
| 221 | @@ -179,6 +179,6 @@ struct expr_ops expr_ops_flow = { | ||
| 222 | .get = nftnl_expr_flow_get, | ||
| 223 | .parse = nftnl_expr_flow_parse, | ||
| 224 | .build = nftnl_expr_flow_build, | ||
| 225 | - .snprintf = nftnl_expr_flow_snprintf, | ||
| 226 | + .snprintf_ = nftnl_expr_flow_snprintf, | ||
| 227 | .json_parse = nftnl_expr_flow_json_parse, | ||
| 228 | }; | ||
| 214 | diff --git a/src/expr/fwd.c b/src/expr/fwd.c | 229 | diff --git a/src/expr/fwd.c b/src/expr/fwd.c |
| 215 | index c30d494..f6e41f1 100644 | 230 | index 9021606..7178f43 100644 |
| 216 | --- a/src/expr/fwd.c | 231 | --- a/src/expr/fwd.c |
| 217 | +++ b/src/expr/fwd.c | 232 | +++ b/src/expr/fwd.c |
| 218 | @@ -180,6 +180,6 @@ struct expr_ops expr_ops_fwd = { | 233 | @@ -233,6 +233,6 @@ struct expr_ops expr_ops_fwd = { |
| 219 | .get = nftnl_expr_fwd_get, | 234 | .get = nftnl_expr_fwd_get, |
| 220 | .parse = nftnl_expr_fwd_parse, | 235 | .parse = nftnl_expr_fwd_parse, |
| 221 | .build = nftnl_expr_fwd_build, | 236 | .build = nftnl_expr_fwd_build, |
| @@ -224,10 +239,10 @@ index c30d494..f6e41f1 100644 | |||
| 224 | .json_parse = nftnl_expr_fwd_json_parse, | 239 | .json_parse = nftnl_expr_fwd_json_parse, |
| 225 | }; | 240 | }; |
| 226 | diff --git a/src/expr/hash.c b/src/expr/hash.c | 241 | diff --git a/src/expr/hash.c b/src/expr/hash.c |
| 227 | index d870510..5acb66a 100644 | 242 | index 415537e..186c5b0 100644 |
| 228 | --- a/src/expr/hash.c | 243 | --- a/src/expr/hash.c |
| 229 | +++ b/src/expr/hash.c | 244 | +++ b/src/expr/hash.c |
| 230 | @@ -332,6 +332,6 @@ struct expr_ops expr_ops_hash = { | 245 | @@ -383,6 +383,6 @@ struct expr_ops expr_ops_hash = { |
| 231 | .get = nftnl_expr_hash_get, | 246 | .get = nftnl_expr_hash_get, |
| 232 | .parse = nftnl_expr_hash_parse, | 247 | .parse = nftnl_expr_hash_parse, |
| 233 | .build = nftnl_expr_hash_build, | 248 | .build = nftnl_expr_hash_build, |
| @@ -236,7 +251,7 @@ index d870510..5acb66a 100644 | |||
| 236 | .json_parse = nftnl_expr_hash_json_parse, | 251 | .json_parse = nftnl_expr_hash_json_parse, |
| 237 | }; | 252 | }; |
| 238 | diff --git a/src/expr/immediate.c b/src/expr/immediate.c | 253 | diff --git a/src/expr/immediate.c b/src/expr/immediate.c |
| 239 | index 0b188cc..94bd6da 100644 | 254 | index b0570bd..91ccbdc 100644 |
| 240 | --- a/src/expr/immediate.c | 255 | --- a/src/expr/immediate.c |
| 241 | +++ b/src/expr/immediate.c | 256 | +++ b/src/expr/immediate.c |
| 242 | @@ -316,6 +316,6 @@ struct expr_ops expr_ops_immediate = { | 257 | @@ -316,6 +316,6 @@ struct expr_ops expr_ops_immediate = { |
| @@ -260,10 +275,10 @@ index 856ab18..e71fc2f 100644 | |||
| 260 | .json_parse = nftnl_expr_limit_json_parse, | 275 | .json_parse = nftnl_expr_limit_json_parse, |
| 261 | }; | 276 | }; |
| 262 | diff --git a/src/expr/log.c b/src/expr/log.c | 277 | diff --git a/src/expr/log.c b/src/expr/log.c |
| 263 | index b642255..71dd83a 100644 | 278 | index 86d9651..5769c1c 100644 |
| 264 | --- a/src/expr/log.c | 279 | --- a/src/expr/log.c |
| 265 | +++ b/src/expr/log.c | 280 | +++ b/src/expr/log.c |
| 266 | @@ -352,6 +352,6 @@ struct expr_ops expr_ops_log = { | 281 | @@ -353,6 +353,6 @@ struct expr_ops expr_ops_log = { |
| 267 | .get = nftnl_expr_log_get, | 282 | .get = nftnl_expr_log_get, |
| 268 | .parse = nftnl_expr_log_parse, | 283 | .parse = nftnl_expr_log_parse, |
| 269 | .build = nftnl_expr_log_build, | 284 | .build = nftnl_expr_log_build, |
| @@ -272,10 +287,10 @@ index b642255..71dd83a 100644 | |||
| 272 | .json_parse = nftnl_expr_log_json_parse, | 287 | .json_parse = nftnl_expr_log_json_parse, |
| 273 | }; | 288 | }; |
| 274 | diff --git a/src/expr/lookup.c b/src/expr/lookup.c | 289 | diff --git a/src/expr/lookup.c b/src/expr/lookup.c |
| 275 | index 861815f..6049913 100644 | 290 | index 5fcb81f..b2f0dd6 100644 |
| 276 | --- a/src/expr/lookup.c | 291 | --- a/src/expr/lookup.c |
| 277 | +++ b/src/expr/lookup.c | 292 | +++ b/src/expr/lookup.c |
| 278 | @@ -293,6 +293,6 @@ struct expr_ops expr_ops_lookup = { | 293 | @@ -292,6 +292,6 @@ struct expr_ops expr_ops_lookup = { |
| 279 | .get = nftnl_expr_lookup_get, | 294 | .get = nftnl_expr_lookup_get, |
| 280 | .parse = nftnl_expr_lookup_parse, | 295 | .parse = nftnl_expr_lookup_parse, |
| 281 | .build = nftnl_expr_lookup_build, | 296 | .build = nftnl_expr_lookup_build, |
| @@ -308,10 +323,10 @@ index dd09e1e..f0d8868 100644 | |||
| 308 | .json_parse = nftnl_expr_match_json_parse, | 323 | .json_parse = nftnl_expr_match_json_parse, |
| 309 | }; | 324 | }; |
| 310 | diff --git a/src/expr/meta.c b/src/expr/meta.c | 325 | diff --git a/src/expr/meta.c b/src/expr/meta.c |
| 311 | index 2c75841..907a677 100644 | 326 | index de82105..91f1ebb 100644 |
| 312 | --- a/src/expr/meta.c | 327 | --- a/src/expr/meta.c |
| 313 | +++ b/src/expr/meta.c | 328 | +++ b/src/expr/meta.c |
| 314 | @@ -290,6 +290,6 @@ struct expr_ops expr_ops_meta = { | 329 | @@ -291,6 +291,6 @@ struct expr_ops expr_ops_meta = { |
| 315 | .get = nftnl_expr_meta_get, | 330 | .get = nftnl_expr_meta_get, |
| 316 | .parse = nftnl_expr_meta_parse, | 331 | .parse = nftnl_expr_meta_parse, |
| 317 | .build = nftnl_expr_meta_build, | 332 | .build = nftnl_expr_meta_build, |
| @@ -320,10 +335,10 @@ index 2c75841..907a677 100644 | |||
| 320 | .json_parse = nftnl_expr_meta_json_parse, | 335 | .json_parse = nftnl_expr_meta_json_parse, |
| 321 | }; | 336 | }; |
| 322 | diff --git a/src/expr/nat.c b/src/expr/nat.c | 337 | diff --git a/src/expr/nat.c b/src/expr/nat.c |
| 323 | index 29bc3a2..d476283 100644 | 338 | index 9271303..427c282 100644 |
| 324 | --- a/src/expr/nat.c | 339 | --- a/src/expr/nat.c |
| 325 | +++ b/src/expr/nat.c | 340 | +++ b/src/expr/nat.c |
| 326 | @@ -383,6 +383,6 @@ struct expr_ops expr_ops_nat = { | 341 | @@ -384,6 +384,6 @@ struct expr_ops expr_ops_nat = { |
| 327 | .get = nftnl_expr_nat_get, | 342 | .get = nftnl_expr_nat_get, |
| 328 | .parse = nftnl_expr_nat_parse, | 343 | .parse = nftnl_expr_nat_parse, |
| 329 | .build = nftnl_expr_nat_build, | 344 | .build = nftnl_expr_nat_build, |
| @@ -332,10 +347,10 @@ index 29bc3a2..d476283 100644 | |||
| 332 | .json_parse = nftnl_expr_nat_json_parse, | 347 | .json_parse = nftnl_expr_nat_json_parse, |
| 333 | }; | 348 | }; |
| 334 | diff --git a/src/expr/numgen.c b/src/expr/numgen.c | 349 | diff --git a/src/expr/numgen.c b/src/expr/numgen.c |
| 335 | index a15f03a..28ef741 100644 | 350 | index 5336fde..8e0479a 100644 |
| 336 | --- a/src/expr/numgen.c | 351 | --- a/src/expr/numgen.c |
| 337 | +++ b/src/expr/numgen.c | 352 | +++ b/src/expr/numgen.c |
| 338 | @@ -264,6 +264,6 @@ struct expr_ops expr_ops_ng = { | 353 | @@ -313,6 +313,6 @@ struct expr_ops expr_ops_ng = { |
| 339 | .get = nftnl_expr_ng_get, | 354 | .get = nftnl_expr_ng_get, |
| 340 | .parse = nftnl_expr_ng_parse, | 355 | .parse = nftnl_expr_ng_parse, |
| 341 | .build = nftnl_expr_ng_build, | 356 | .build = nftnl_expr_ng_build, |
| @@ -344,7 +359,7 @@ index a15f03a..28ef741 100644 | |||
| 344 | .json_parse = nftnl_expr_ng_json_parse, | 359 | .json_parse = nftnl_expr_ng_json_parse, |
| 345 | }; | 360 | }; |
| 346 | diff --git a/src/expr/objref.c b/src/expr/objref.c | 361 | diff --git a/src/expr/objref.c b/src/expr/objref.c |
| 347 | index 4cfa3cb..c394290 100644 | 362 | index 64ee863..4504488 100644 |
| 348 | --- a/src/expr/objref.c | 363 | --- a/src/expr/objref.c |
| 349 | +++ b/src/expr/objref.c | 364 | +++ b/src/expr/objref.c |
| 350 | @@ -278,6 +278,6 @@ struct expr_ops expr_ops_objref = { | 365 | @@ -278,6 +278,6 @@ struct expr_ops expr_ops_objref = { |
| @@ -368,10 +383,10 @@ index 91e1587..894ac08 100644 | |||
| 368 | .json_parse = nftnl_expr_payload_json_parse, | 383 | .json_parse = nftnl_expr_payload_json_parse, |
| 369 | }; | 384 | }; |
| 370 | diff --git a/src/expr/queue.c b/src/expr/queue.c | 385 | diff --git a/src/expr/queue.c b/src/expr/queue.c |
| 371 | index 8a9deda..389af83 100644 | 386 | index a392a27..ee26c10 100644 |
| 372 | --- a/src/expr/queue.c | 387 | --- a/src/expr/queue.c |
| 373 | +++ b/src/expr/queue.c | 388 | +++ b/src/expr/queue.c |
| 374 | @@ -276,6 +276,6 @@ struct expr_ops expr_ops_queue = { | 389 | @@ -275,6 +275,6 @@ struct expr_ops expr_ops_queue = { |
| 375 | .get = nftnl_expr_queue_get, | 390 | .get = nftnl_expr_queue_get, |
| 376 | .parse = nftnl_expr_queue_parse, | 391 | .parse = nftnl_expr_queue_parse, |
| 377 | .build = nftnl_expr_queue_build, | 392 | .build = nftnl_expr_queue_build, |
| @@ -392,7 +407,7 @@ index 667e6e1..ff5d182 100644 | |||
| 392 | .json_parse = nftnl_expr_quota_json_parse, | 407 | .json_parse = nftnl_expr_quota_json_parse, |
| 393 | }; | 408 | }; |
| 394 | diff --git a/src/expr/range.c b/src/expr/range.c | 409 | diff --git a/src/expr/range.c b/src/expr/range.c |
| 395 | index 8c8ce12..34d422b 100644 | 410 | index b2789ff..8910f8a 100644 |
| 396 | --- a/src/expr/range.c | 411 | --- a/src/expr/range.c |
| 397 | +++ b/src/expr/range.c | 412 | +++ b/src/expr/range.c |
| 398 | @@ -283,6 +283,6 @@ struct expr_ops expr_ops_range = { | 413 | @@ -283,6 +283,6 @@ struct expr_ops expr_ops_range = { |
| @@ -404,7 +419,7 @@ index 8c8ce12..34d422b 100644 | |||
| 404 | .json_parse = nftnl_expr_range_json_parse, | 419 | .json_parse = nftnl_expr_range_json_parse, |
| 405 | }; | 420 | }; |
| 406 | diff --git a/src/expr/redir.c b/src/expr/redir.c | 421 | diff --git a/src/expr/redir.c b/src/expr/redir.c |
| 407 | index 43538d5..8a21f93 100644 | 422 | index b2aa345..41b77ab 100644 |
| 408 | --- a/src/expr/redir.c | 423 | --- a/src/expr/redir.c |
| 409 | +++ b/src/expr/redir.c | 424 | +++ b/src/expr/redir.c |
| 410 | @@ -242,6 +242,6 @@ struct expr_ops expr_ops_redir = { | 425 | @@ -242,6 +242,6 @@ struct expr_ops expr_ops_redir = { |
| @@ -428,10 +443,10 @@ index 11d8b20..b10e729 100644 | |||
| 428 | .json_parse = nftnl_expr_reject_json_parse, | 443 | .json_parse = nftnl_expr_reject_json_parse, |
| 429 | }; | 444 | }; |
| 430 | diff --git a/src/expr/rt.c b/src/expr/rt.c | 445 | diff --git a/src/expr/rt.c b/src/expr/rt.c |
| 431 | index 5088e66..9f44b29 100644 | 446 | index c3c92c7..688a042 100644 |
| 432 | --- a/src/expr/rt.c | 447 | --- a/src/expr/rt.c |
| 433 | +++ b/src/expr/rt.c | 448 | +++ b/src/expr/rt.c |
| 434 | @@ -238,6 +238,6 @@ struct expr_ops expr_ops_rt = { | 449 | @@ -235,6 +235,6 @@ struct expr_ops expr_ops_rt = { |
| 435 | .get = nftnl_expr_rt_get, | 450 | .get = nftnl_expr_rt_get, |
| 436 | .parse = nftnl_expr_rt_parse, | 451 | .parse = nftnl_expr_rt_parse, |
| 437 | .build = nftnl_expr_rt_build, | 452 | .build = nftnl_expr_rt_build, |
| @@ -439,6 +454,17 @@ index 5088e66..9f44b29 100644 | |||
| 439 | + .snprintf_ = nftnl_expr_rt_snprintf, | 454 | + .snprintf_ = nftnl_expr_rt_snprintf, |
| 440 | .json_parse = nftnl_expr_rt_json_parse, | 455 | .json_parse = nftnl_expr_rt_json_parse, |
| 441 | }; | 456 | }; |
| 457 | diff --git a/src/expr/socket.c b/src/expr/socket.c | ||
| 458 | index db160a1..4c50011 100644 | ||
| 459 | --- a/src/expr/socket.c | ||
| 460 | +++ b/src/expr/socket.c | ||
| 461 | @@ -204,5 +204,5 @@ struct expr_ops expr_ops_socket = { | ||
| 462 | .get = nftnl_expr_socket_get, | ||
| 463 | .parse = nftnl_expr_socket_parse, | ||
| 464 | .build = nftnl_expr_socket_build, | ||
| 465 | - .snprintf = nftnl_expr_socket_snprintf, | ||
| 466 | + .snprintf_ = nftnl_expr_socket_snprintf, | ||
| 467 | }; | ||
| 442 | diff --git a/src/expr/target.c b/src/expr/target.c | 468 | diff --git a/src/expr/target.c b/src/expr/target.c |
| 443 | index ed4bf7d..2ef4078 100644 | 469 | index ed4bf7d..2ef4078 100644 |
| 444 | --- a/src/expr/target.c | 470 | --- a/src/expr/target.c |
| @@ -452,10 +478,10 @@ index ed4bf7d..2ef4078 100644 | |||
| 452 | .json_parse = nftnl_expr_target_json_parse, | 478 | .json_parse = nftnl_expr_target_json_parse, |
| 453 | }; | 479 | }; |
| 454 | diff --git a/src/obj/counter.c b/src/obj/counter.c | 480 | diff --git a/src/obj/counter.c b/src/obj/counter.c |
| 455 | index beadc93..8c4cc25 100644 | 481 | index 332bb2b..edeb7be 100644 |
| 456 | --- a/src/obj/counter.c | 482 | --- a/src/obj/counter.c |
| 457 | +++ b/src/obj/counter.c | 483 | +++ b/src/obj/counter.c |
| 458 | @@ -179,6 +179,6 @@ struct obj_ops obj_ops_counter = { | 484 | @@ -182,6 +182,6 @@ struct obj_ops obj_ops_counter = { |
| 459 | .get = nftnl_obj_counter_get, | 485 | .get = nftnl_obj_counter_get, |
| 460 | .parse = nftnl_obj_counter_parse, | 486 | .parse = nftnl_obj_counter_parse, |
| 461 | .build = nftnl_obj_counter_build, | 487 | .build = nftnl_obj_counter_build, |
| @@ -464,10 +490,10 @@ index beadc93..8c4cc25 100644 | |||
| 464 | .json_parse = nftnl_obj_counter_json_parse, | 490 | .json_parse = nftnl_obj_counter_json_parse, |
| 465 | }; | 491 | }; |
| 466 | diff --git a/src/obj/ct_helper.c b/src/obj/ct_helper.c | 492 | diff --git a/src/obj/ct_helper.c b/src/obj/ct_helper.c |
| 467 | index d6d3111..4c7c88b 100644 | 493 | index 62569fe..69757ff 100644 |
| 468 | --- a/src/obj/ct_helper.c | 494 | --- a/src/obj/ct_helper.c |
| 469 | +++ b/src/obj/ct_helper.c | 495 | +++ b/src/obj/ct_helper.c |
| 470 | @@ -205,6 +205,6 @@ struct obj_ops obj_ops_ct_helper = { | 496 | @@ -208,6 +208,6 @@ struct obj_ops obj_ops_ct_helper = { |
| 471 | .get = nftnl_obj_ct_helper_get, | 497 | .get = nftnl_obj_ct_helper_get, |
| 472 | .parse = nftnl_obj_ct_helper_parse, | 498 | .parse = nftnl_obj_ct_helper_parse, |
| 473 | .build = nftnl_obj_ct_helper_build, | 499 | .build = nftnl_obj_ct_helper_build, |
| @@ -475,11 +501,23 @@ index d6d3111..4c7c88b 100644 | |||
| 475 | + .snprintf_ = nftnl_obj_ct_helper_snprintf, | 501 | + .snprintf_ = nftnl_obj_ct_helper_snprintf, |
| 476 | .json_parse = nftnl_obj_quota_json_parse, | 502 | .json_parse = nftnl_obj_quota_json_parse, |
| 477 | }; | 503 | }; |
| 504 | diff --git a/src/obj/limit.c b/src/obj/limit.c | ||
| 505 | index 7f8bcf7..25018b6 100644 | ||
| 506 | --- a/src/obj/limit.c | ||
| 507 | +++ b/src/obj/limit.c | ||
| 508 | @@ -236,6 +236,6 @@ struct obj_ops obj_ops_limit = { | ||
| 509 | .get = nftnl_obj_limit_get, | ||
| 510 | .parse = nftnl_obj_limit_parse, | ||
| 511 | .build = nftnl_obj_limit_build, | ||
| 512 | - .snprintf = nftnl_obj_limit_snprintf, | ||
| 513 | + .snprintf_ = nftnl_obj_limit_snprintf, | ||
| 514 | .json_parse = nftnl_obj_limit_json_parse, | ||
| 515 | }; | ||
| 478 | diff --git a/src/obj/quota.c b/src/obj/quota.c | 516 | diff --git a/src/obj/quota.c b/src/obj/quota.c |
| 479 | index d5757b2..e959ff8 100644 | 517 | index 6d36784..ecaa8b1 100644 |
| 480 | --- a/src/obj/quota.c | 518 | --- a/src/obj/quota.c |
| 481 | +++ b/src/obj/quota.c | 519 | +++ b/src/obj/quota.c |
| 482 | @@ -200,6 +200,6 @@ struct obj_ops obj_ops_quota = { | 520 | @@ -203,6 +203,6 @@ struct obj_ops obj_ops_quota = { |
| 483 | .get = nftnl_obj_quota_get, | 521 | .get = nftnl_obj_quota_get, |
| 484 | .parse = nftnl_obj_quota_parse, | 522 | .parse = nftnl_obj_quota_parse, |
| 485 | .build = nftnl_obj_quota_build, | 523 | .build = nftnl_obj_quota_build, |
| @@ -488,11 +526,11 @@ index d5757b2..e959ff8 100644 | |||
| 488 | .json_parse = nftnl_obj_quota_json_parse, | 526 | .json_parse = nftnl_obj_quota_json_parse, |
| 489 | }; | 527 | }; |
| 490 | diff --git a/src/object.c b/src/object.c | 528 | diff --git a/src/object.c b/src/object.c |
| 491 | index d409c6d..b938c97 100644 | 529 | index d8278f3..9654b7b 100644 |
| 492 | --- a/src/object.c | 530 | --- a/src/object.c |
| 493 | +++ b/src/object.c | 531 | +++ b/src/object.c |
| 494 | @@ -389,7 +389,7 @@ static int nftnl_obj_export(char *buf, size_t size, | 532 | @@ -429,7 +429,7 @@ static int nftnl_obj_export(char *buf, size_t size, |
| 495 | nftnl_buf_u32(&b, type, obj->use, USE); | 533 | nftnl_buf_u64(&b, type, obj->handle, HANDLE); |
| 496 | 534 | ||
| 497 | if (obj->ops) | 535 | if (obj->ops) |
| 498 | - ret = obj->ops->snprintf(buf + b.len, size - b.len, type, | 536 | - ret = obj->ops->snprintf(buf + b.len, size - b.len, type, |
| @@ -500,15 +538,12 @@ index d409c6d..b938c97 100644 | |||
| 500 | flags, obj); | 538 | flags, obj); |
| 501 | 539 | ||
| 502 | b.len += ret; | 540 | b.len += ret; |
| 503 | @@ -410,7 +410,7 @@ static int nftnl_obj_snprintf_dflt(char *buf, size_t size, | 541 | @@ -450,7 +450,7 @@ static int nftnl_obj_snprintf_dflt(char *buf, size_t size, |
| 504 | SNPRINTF_BUFFER_SIZE(ret, size, len, offset); | 542 | SNPRINTF_BUFFER_SIZE(ret, remain, offset); |
| 505 | 543 | ||
| 506 | if (obj->ops) { | 544 | if (obj->ops) { |
| 507 | - ret = obj->ops->snprintf(buf + offset, offset, type, flags, obj); | 545 | - ret = obj->ops->snprintf(buf + offset, offset, type, flags, |
| 508 | + ret = obj->ops->snprintf_(buf + offset, offset, type, flags, obj); | 546 | + ret = obj->ops->snprintf_(buf + offset, offset, type, flags, |
| 509 | SNPRINTF_BUFFER_SIZE(ret, size, len, offset); | 547 | obj); |
| 548 | SNPRINTF_BUFFER_SIZE(ret, remain, offset); | ||
| 510 | } | 549 | } |
| 511 | ret = snprintf(buf + offset, offset, "]"); | ||
| 512 | -- | ||
| 513 | 2.12.2 | ||
| 514 | |||
diff --git a/meta-networking/recipes-filter/libnftnl/libnftnl_1.0.7.bb b/meta-networking/recipes-filter/libnftnl/libnftnl_1.1.1.bb index ca01c0a611..77959a7309 100644 --- a/meta-networking/recipes-filter/libnftnl/libnftnl_1.0.7.bb +++ b/meta-networking/recipes-filter/libnftnl/libnftnl_1.1.1.bb | |||
| @@ -4,13 +4,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=79808397c3355f163c012616125c9e26" | |||
| 4 | SECTION = "libs" | 4 | SECTION = "libs" |
| 5 | DEPENDS = "libmnl" | 5 | DEPENDS = "libmnl" |
| 6 | PV .= "+git${SRCPV}" | 6 | PV .= "+git${SRCPV}" |
| 7 | SRCREV = "4b89c0cb0883f638ff1abbc2ff47c43cdc26aac5" | 7 | SRCREV = "d379dfcb6c94dcb93a8f16896572d6e162138e0f" |
| 8 | SRC_URI = "git://git.netfilter.org/libnftnl \ | 8 | SRC_URI = "git://git.netfilter.org/libnftnl \ |
| 9 | file://0001-Declare-the-define-visivility-attribute-together.patch \ | 9 | file://0001-Move-exports-before-symbol-definition.patch \ |
| 10 | file://0001-avoid-naming-local-function-as-one-of-printf-family.patch \ | 10 | file://0002-avoid-naming-local-function-as-one-of-printf-family.patch \ |
| 11 | " | 11 | " |
| 12 | SRC_URI[md5sum] = "82183867168eb6644926c48b991b8aac" | ||
| 13 | SRC_URI[sha256sum] = "9bb66ecbc64b8508249402f0093829f44177770ad99f6042b86b3a467d963982" | ||
| 14 | 12 | ||
| 15 | S = "${WORKDIR}/git" | 13 | S = "${WORKDIR}/git" |
| 16 | 14 | ||
