summaryrefslogtreecommitdiffstats
path: root/lib/addr.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: add const-ness to appropriate parameters in addr, attr, dataRohan Joyce2015-02-161-20/+20
| | | | | | | | | | | | | | | This patch changes the signatures of some functions to allow const pointers in places where a const qualified pointer is enough access for what the function does (e.g. nla_get_u8). It also changes some functions that take a pointer parameter and return a pointer derived from it to use the strchr idiom. This is not exhaustive in terms of places where const can be added, but it's a decent chunk that should not make the external api any more restrictive. http://lists.infradead.org/pipermail/libnl/2015-February/001826.html Signed-off-by: Rohan Joyce <rojoyce.github@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* style: require comma after __ADD() macroThomas Haller2014-07-271-38/+38
| | | | | | | $ sed -i 's/^\([\t ]\+\<__ADD\> \?([^)]\+)\) *$/\1,/' `git grep -w -l __ADD` Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* do not compile some address families when not availableCong Wang2013-11-091-0/+14
| | | | | | | | | | | | | | | | This fixes the following error while compiling libnl3 on CentOS5: addr.c:1027: error: 'AF_RDS' undeclared here (not in a function) addr.c:1033: error: 'AF_CAN' undeclared here (not in a function) addr.c:1034: error: 'AF_TIPC' undeclared here (not in a function) addr.c:1036: error: 'AF_IUCV' undeclared here (not in a function) addr.c:1037: error: 'AF_RXRPC' undeclared here (not in a function) addr.c:1038: error: 'AF_ISDN' undeclared here (not in a function) addr.c:1039: error: 'AF_PHONET' undeclared here (not in a function) make[2]: *** [addr.lo] Error 1 Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
* addr: only translate more recent address family names and ARP types if definedThomas Graf2013-04-051-0/+8
| | | | | | Helps making libnl compilable with older kernel headers Signed-off-by: Thomas Graf <tgraf@suug.ch>
* addr: Update to latest address familiy definition for translationThomas Graf2013-03-141-2/+11
| | | | Signed-off-by: Thomas Graf <tgraf@suug.ch>
* addr: improve API reference documentation for nl_addr_*()Thomas Graf2013-03-141-40/+164
| | | | Signed-off-by: Thomas Graf <tgraf@suug.ch>
* addr: Reset unused portion of binary address in nl_addr_set_binary_addr()Thomas Graf2013-03-141-1/+4
| | | | | | | memset() the binary address before overwriting it with new data to avoid leaving around old portions of the address. Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Fix mask calculation in nl_addr_cmp_prefix()Thomas Graf2013-01-311-2/+2
| | | | | Signed-off-by: Malte Langermann <mlangermann@radiodata.biz> Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Move private header files to <netlink-private/*>Thomas Graf2013-01-241-1/+1
| | | | | | | This clarifies the seperation between public and private header files. Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Address comparison bug fixedКоренберг Марк2012-08-301-1/+2
| | | | Bug introduced in 794ac78c5618ee81a45e4f58694ee27b3403ebd7
* nl_addr_parse handling of 'default', 'any', and 'all'Justin Mayfield2012-08-291-4/+3
| | | | | | | | | | | | I found a small bug in the nl_addr_parse function when being passed the strings "default", "any", or "all". Currently nl_addr_parse will create a zeroed nl_addr with a length corresponding to the family/hint or AF_INET if omitted. This behavior when used in conjunction with the libnl-route library to add default routes to the system has the side effect of creating a route to the host address 0.0.0.0/32. Attached is a patch that matches the iproute2 behavior more closely where we do set the family but the length of the nl_addr is set to 0.
* Fix types-related warnings based on clang diagnosticsКоренберг Марк2012-06-131-3/+3
| | | | | | | | | | | | | | | | | 1. Fix some places where unsigned value compared < 0 2. Fix obsolete %Z specifier to more portable %z 3. Some erroneous types substitution 4. nl_msec2str() - 64-bit msec is now properly used, Only safe changes. I mean int <--> uint32_t and signed/unsigned fixes. Some functinos require size_t argument instead of int, but changes of signatures of that functions is terrible thing. Also, I do not pretend for a full list of fixes. Just to shut up clang -Wall -Wextra One more thing. ifindex. I don't change that because changes will be too big for simple fix.
* doc: documentation restructuringThomas Graf2012-05-101-14/+16
| | | | | | | | | | - changes the modules hierarchy to better represent the set of libaries - list the header file that needs to be included - remove examples/doc from api ref that is included in the guide - add references to the guide - fix doxygen api linking for version 1.8.0 - readd doxygen mainpage to config file - fix a couple of doxygen doc bugs
* nl_addr_cmp(): handle prefix length during address comparisonBrett Ciphery2012-01-121-1/+4
| | | | Signed-off-by: Brett Ciphery <brett.ciphery@windriver.com>
* addr: hide nl_addr_destroy()Thomas Graf2010-11-261-25/+14
| | | | everyone should use nl_addr_put()
* constify struct trans_tblThomas Graf2010-11-171-1/+1
|
* Make nl_str2af return a negative value if parsing failsThomas Graf2010-11-111-1/+1
|
* restructure module documentation orderThomas Graf2008-12-101-1/+1
| | | | split hiearchy into one top level module per library
* Properly handle addr=NULL in nl_addr2strThomas Graf2008-06-131-2/+5
|
* Fix error code of nl_addr_resolve()Thomas Graf2008-05-221-2/+6
|
* Remove obsolete nla_get_addr() and nla_get_data()Thomas Graf2008-05-141-1/+1
| | | | | | | | Replaces obsolete calls to nla_get_addr() and nla_get_data() with nl_addr_alloc_attr() respectively nl_data_alloc_attr(). Also fixes missing error handling while parsing routing multipath configuration.
* Thread-safe error handlingThomas Graf2008-05-141-32/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order for the interface to become more thread safe, the error handling was revised to no longer depend on a static errno and error string buffer. This patch converts all error paths to return a libnl specific error code which can be translated to a error message using nl_geterror(int error). The functions nl_error() and nl_get_errno() are therefore obsolete. This change required various sets of function prototypes to be changed in order to return an error code, the most prominent are: struct nl_cache *foo_alloc_cache(...); changed to: int foo_alloc_cache(..., struct nl_cache **); struct nl_msg *foo_build_request(...); changed to: int foo_build_request(..., struct nl_msg **); struct foo *foo_parse(...); changed to: int foo_parse(..., struct foo **); This pretty much only leaves trivial allocation functions to still return a pointer object which can still return NULL to signal out of memory. This change is a serious API and ABI breaker, sorry!
* Abstract address allocation based on netlink attributeThomas Graf2008-01-301-0/+15
|
* Support link operstate and linkmodeThomas Graf2007-12-191-0/+15
|
* Initial importThomas Graf2007-09-141-0/+883