path: root/include/utils.h
Commit message (Collapse)AuthorAgeFilesLines
* utils: Don't return directly from SNPRINTF_BUFFER_SIZEPhil Sutter2016-08-121-1/+1
| | | | | | | | | | | | | Apart from being a bad idea in general, the return statement contained in that macro in some cases leads to returning from functions without properly cleaning up, thereby causing memory leaks. Instead, just sanitize the value in 'ret' to not harm further calls of snprintf() (as 'len' will eventually just become zero). Cc: Arturo Borrero <> Signed-off-by: Phil Sutter <> Signed-off-by: Pablo Neira Ayuso <>
* src: assert when setting unknown attributesPablo Neira Ayuso2016-06-151-0/+9
| | | | | | | | | | | | If this attribute is not supported by the library, we should rise an assertion so the client knows something is wrong, instead of silently going through. The only case I can think may hit this problem is version mismatch between library and tools. This should not ever really happen, so better bail out from the library itself in this case. Signed-off-by: Pablo Neira Ayuso <>
* libnftnl: constify object arguments to various functionsPatrick McHardy2016-05-091-3/+5
| | | | | | | | | flow table support needs constant object arguments to printing functions to avoid ugly casts. While at it, also constify object arguments to message construction, destructor and a few helper functions. Signed-off-by: Patrick McHardy <> Signed-off-by: Pablo Neira Ayuso <>
* src: rename EXPORT_SYMBOL to EXPORT_SYMBOL_ALIASFlorian Westphal2015-11-241-1/+3
| | | | | | | Future symbols don't need backwards-compat aliases. Signed-off-by: Florian Westphal <> Signed-off-by: Pablo Neira Ayuso <>
* src: add compat header file definitionsPablo Neira Ayuso2015-09-071-1/+1
| | | | | | | | | | | This patch restores the original nft_* definitions from the header files to avoid sudden compilation breakage of the existing clients of this library. Then, moving forward the idea is to deprecate the old nft_* symbols anytime soon using __attribute__((deprecated)) from the header files to warn our users that they need to update their code. Signed-off-by: Pablo Neira Ayuso <>
* src: rename existing functions to use the nftnl_ prefixPablo Neira Ayuso2015-09-071-27/+27
| | | | | | | | | So we can use the nft_* prefix anytime soon for our upcoming higher level library. After this patch, the nft_* symbols become an alias of the nftnl_* symbols. Signed-off-by: Pablo Neira Ayuso <>
* src: introduce nftnl_* aliases for all existing functionsPablo Neira Ayuso2015-09-021-1/+1
| | | | | | | | | | | This patch introduces the nftnl_ symbols as aliases for the existing nft_ symbols through the EXPORT_SYMBOL(...) macro. We would like to use the nft_* prefix from our upcoming higher level library, meanwhile with this move we avoid that old binaries break because of missing symbol dependencies. Signed-off-by: Pablo Neira Ayuso <>
* src: restore static array with expression operationsPablo Neira Ayuso2015-03-231-1/+0
| | | | | | | | | | | | | We cannot use __attribute__((constructor)) to register the supported expressions in runtime when the library is statically linked. This lead us to some explicit libnftnl_init() function that needs to be called from the main() function of the client program. This patch reverts 4dd0772 ("expr: use __attribute__((constructor)) to register expression"). Reported-by: Laurent Bercot <> Signed-off-by: Pablo Neira Ayuso <>
* src: split internal.h is smaller filesPablo Neira Ayuso2015-02-171-0/+83
The internal.h file started being a small file with private definitions. Its size has been increasing over time more and more, so let's split this in small header files that map to the corresponding class where the functions belong to. Signed-off-by: Pablo Neira Ayuso <>