summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* all: Avoid pointer arithmetic on `void *`Michael Forney2019-08-161-3/+3
| | | | | | | ISO C requires that the pointer operand to the binary + operator be to a complete object type[0]. [0] http://port70.net/~nsz/c/c11/n1570.html#6.5.6p2
* Add SPDX identifiersYegor Yefremov2019-08-1259-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Software Package Data Exchange identifiers help to detect source file licenses and hence simplify the FOSS compliance process. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> https://github.com/thom311/libnl/pull/219 --- FILES=( lib/addr.c lib/attr.c lib/cache.c lib/cache_mngr.c lib/cache_mngt.c lib/data.c lib/error.c lib/fib_lookup/lookup.c lib/fib_lookup/request.c lib/genl/ctrl.c lib/genl/family.c lib/genl/genl.c lib/genl/mngt.c lib/handlers.c lib/hash.c lib/hashtable.c lib/idiag/idiag.c lib/idiag/idiag_meminfo_obj.c lib/idiag/idiag_msg_obj.c lib/idiag/idiag_req_obj.c lib/idiag/idiag_vegasinfo_obj.c lib/mpls.c lib/msg.c lib/netfilter/ct.c lib/netfilter/ct_obj.c lib/netfilter/exp.c lib/netfilter/exp_obj.c lib/netfilter/log.c lib/netfilter/log_msg.c lib/netfilter/log_msg_obj.c lib/netfilter/log_obj.c lib/netfilter/netfilter.c lib/netfilter/nfnl.c lib/netfilter/queue.c lib/netfilter/queue_msg.c lib/netfilter/queue_msg_obj.c lib/netfilter/queue_obj.c lib/nl.c lib/object.c lib/route/act.c lib/route/addr.c lib/route/class.c lib/route/classid.c lib/route/cls.c lib/route/link.c lib/route/neigh.c lib/route/neightbl.c lib/route/netconf.c lib/route/nexthop.c lib/route/nexthop_encap.c lib/route/nh_encap_mpls.c lib/route/pktloc.c lib/route/qdisc.c lib/route/route.c lib/route/route_obj.c lib/route/route_utils.c lib/route/rtnl.c lib/route/rule.c lib/route/tc.c lib/socket.c lib/utils.c lib/version.c lib/xfrm/ae.c lib/xfrm/lifetime.c lib/xfrm/sa.c lib/xfrm/selector.c lib/xfrm/sp.c lib/xfrm/template.c src/genl-ctrl-list.c src/idiag-socket-details.c src/lib/addr.c src/lib/class.c src/lib/cls.c src/lib/ct.c src/lib/exp.c src/lib/link.c src/lib/neigh.c src/lib/qdisc.c src/lib/route.c src/lib/rule.c src/lib/tc.c src/lib/utils.c src/nf-ct-add.c src/nf-ct-events.c src/nf-ct-list.c src/nf-exp-add.c src/nf-exp-delete.c src/nf-exp-list.c src/nf-log.c src/nf-monitor.c src/nf-queue.c src/nl-addr-add.c src/nl-addr-delete.c src/nl-addr-list.c src/nl-class-add.c src/nl-class-delete.c src/nl-class-list.c src/nl-classid-lookup.c src/nl-cls-add.c src/nl-cls-delete.c src/nl-cls-list.c src/nl-fib-lookup.c src/nl-link-enslave.c src/nl-link-ifindex2name.c src/nl-link-list.c src/nl-link-name2ifindex.c src/nl-link-release.c src/nl-link-set.c src/nl-link-stats.c src/nl-list-caches.c src/nl-list-sockets.c src/nl-monitor.c src/nl-neigh-add.c src/nl-neigh-delete.c src/nl-neigh-list.c src/nl-neightbl-list.c src/nl-pktloc-lookup.c src/nl-qdisc-add.c src/nl-qdisc-delete.c src/nl-qdisc-list.c src/nl-route-add.c src/nl-route-delete.c src/nl-route-get.c src/nl-route-list.c src/nl-rule-list.c src/nl-tctree-list.c src/nl-util-addr.c ) sed '1s#^#/* SPDX-License-Identifier: LGPL-2.1-only */\n#' "${FILES[@]}" -i
* nl-neigh-list: free allocated itemsTobias Jungel2018-06-251-0/+5
|
* build: sort entries in Makefile.am and .gitignore by nameThomas Haller2018-04-061-16/+16
|
* nf-ct-add typoLukáš Karas2018-04-062-2/+2
|
* add demo program for listen conntrack eventsLukáš Karas2018-04-062-0/+116
|
* Add support for label stack in nl-route commandsDavid Ahern2017-08-181-2/+16
| | | | | | | | | Add support for MPLS labels in nexthop specification. Specifically, the 'as' keyword specifies the MPLS label stack and if the route address family is MPLS then the nexthop via is added as a route via instead of a gateway (subtle differences introduced for MPLS). Signed-off-by: David Ahern <dsahern@gmail.com>
* all: avoid compiler warnings -Wimplicit-fallthroughThomas Haller2017-06-151-0/+1
|
* build: allow building cli without dynamic librarires supportThomas Haller2017-05-121-4/+19
| | | | | | | | | | | | | | Commit 3cb28534d34392ceec4adead0cfa97039796ccb7 enables building of cli always as part of `make check`. As cli previously always included <dlfcn.h>, this broke tests for building with toolchains that don't support dynamic library loading. Add a configure check and disable dlopen() based on whether <dlfcn.h> is available. Signed-off-by: Thomas Haller <thaller@redhat.com> https://github.com/thom311/libnl/pull/141
* route: Add support for MPLS to netconfDavid Ahern2017-05-121-0/+1
| | | | | | | | | | | | Add support to netconf for MPLS address family. v2 - change get method to return 0/error and take 'int *val' which is set to the value requested - added rtnl_netconf_get_input to libnl-route-3.sym Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* nl-monitor: Add support for netconf cachesDavid Ahern2017-05-121-0/+2
| | | | | | | Allow user to monitor netconf changes. Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* nl-monitor: All user to specify line formatDavid Ahern2017-05-121-40/+70
| | | | | | | | | | nl-monitor defaults to stats. Allow user to select brief and details. The known_groups is moved up to a global to allow a proper print_usage function. Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib: escape usage of strerror_l() if it doesn't exist in libcAlexey Brodkin2017-03-121-0/+6
| | | | | | | | | | | | | | | | uClibc doesn't implement strerror_l() and thus libnl starting from 3.2.29 couldn't be compiled with it any longer. To work-around that problem we'll just do a check on strerror_l() availability during configuration and if it's not there just fall back to locale-less strerror(). See-also: 6c2d111177e91184073c44f83d4a6182aaba06d7 http://lists.infradead.org/pipermail/libnl/2017-March/002301.html Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* include: don't include kernel headers in public libnl3 headersThomas Haller2017-03-0242-2/+86
| | | | | | | | | | | | | | | | | It would be desirable not to include kernel headers in our public libnl3 headers. As a test, remove all those includes, and fix compilation by explicitly including the kernel headers where needed. In some cases, that requires forward declaration for kernel structures, as we use them as part of our own headers. Realistically, we cannot drop those includes as it probalby breaks compilation for users that expect to get a certain kernel header when including a libnl3 header. So, this will not be done and the includes will be restored in the next commit. Do this step to show how it would be and to verify that we could build with such a change. The reason not to do this is backward compatibility (at compile-time).
* build: merge src/Makefile.am into top-level makefileThomas Haller2017-02-271-140/+0
|
* build: merge src/lib/Makefile.am into top-level makefileThomas Haller2017-02-272-61/+0
|
* fopen: add O_CLOEXECNick Kralevich2017-01-171-1/+1
| | | | | | | | | | Add O_CLOEXEC to various fopen() calls. This avoids file descriptors leaking across an exec() boundary in a multi-threaded program. Please see "man 2 open" for additional information about O_CLOEXEC. Signed-off-by: Nick Kralevich <nnk@google.com> https://github.com/thom311/libnl/pull/128
* nl-link-stats: prefer RTNL_LINK_STATS_MAX over __RTNL_LINK_STATS_MAXThomas Haller2016-11-291-2/+2
| | | | | | | | The result is basically the same, but I feel that __RTNL_LINK_STATS_MAX is an internal variable that shouldn't be used. Thus, let's iterate instead until <= MAX. Signed-off-by: Thomas Haller <thaller@redhat.com>
* src: nl-link-stats: use correct rtnl link stats maximumTobias Klauser2016-11-291-2/+2
| | | | | | | | | Use __RTNL_LINK_STATS_MAX instead of RTNL_LINK_STATS_MAX when iterating over all rtnl link stat counters. Otherwise, the last stat counter will always be missing, as RTNL_LINK_STATS_MAX is the value of the last valid index. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
* src: switch to using strerror_l() instead of strerror_r()André Draszik2016-08-251-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | glibc provides two versions of strerror_r(), which can be chosen between using feature test macros _GNU_SOURCE and _POSIX_C_SOURCE. libnl is built using the former, hence we get the glibc special version, and all code so far has been written for this. Other C libraries like musl on the other hand only try to be posix compliant, and only ever provide the posix version of strerror_r(), which has a different signature. Uses in libnl hence generally cause printf() of an *int* with a *string format* specifier for that reason. Additionally, strerror_r() has been deprecated: http://austingroupbugs.net/view.php?id=655 Switch to using strerror_l(). Signed-off-by: André Draszik <adraszik@tycoint.com> Reviewed-by: Stephane Ayotte <sayotte@tycoint.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* trivial: whitespace-only fixes for src and libPeter Wu2016-08-1222-135/+135
| | | | | | | | | | | Fixes alignment, lines with just whitespace and mixed tab/space indentation. Searched, reviewed and optionally fixed in vim using regex ^\t* [\t ]*\([^*us ]\|$\)\|\t\+$ http://lists.infradead.org/pipermail/libnl/2016-August/002183.html Signed-off-by: Peter Wu <peter@lekensteyn.nl> Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: move -rdynamic from CPPFLAGS to LDFLAGSTobias Klauser2016-03-311-2/+2
| | | | | | | | | | The -rdynamic flag is a linker flag, not a compiler/preprocessor flag, so move it to LDFLAGS. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Thomas Haller <thaller@redhat.com> http://lists.infradead.org/pipermail/libnl/2016-March/002100.html
* link/neigh: add flags option to link and neighbor cachesDavid Ahern2015-11-193-3/+33
| | | | | | | | | | | | | Both link and neighbor cache support specify multiple groups (nl_af_group), but the alloc_cache functions for both do not set the NL_CACHE_AF_ITER flag before populating the cache so only the first group is used by default. This patch adds an API to pass in flags to make that happen and updates the nl-neigh-list command to make use of it. http://lists.infradead.org/pipermail/libnl/2015-October/001996.html Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: fix path to cli linker version script for out-of-tree buildjfarrell2015-06-191-2/+2
| | | | https://github.com/thom311/libnl/pull/78
* build: extend configure option --enable-cli and install all cli programsThomas Haller2015-03-181-15/+23
| | | | | | | | | | | | Previously, some cli programs were installed to sbin/ and most were not installed at all. Now, by default install all of them to bin/ directory. But extend the configure option to allow specifying 'no-inst', 'bin', or 'sbin'. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* build/trivial: sort PROGRAMS list in src/Makefile.amThomas Haller2015-03-181-18/+40
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* route: remove unnecessary include of private linux/if.hDavid Chappelle2015-03-171-0/+1
| | | | | | | | | | | | | | | | | | | Including linux/if.h in netlink/route/link.h causes issues in cases where libnl is used in conjuntion with other third party libraries that include net/if.h. Seems to be a long checkered history of symbol collisions between these two files. As it turns out, including linux/if.h from within netlink/route/link.h is actually unecessary. I resurrected a forgotten path from this thread: http://lists.infradead.org/pipermail/libnl/2012-April/000525.html By removing the include as the patch suggests we can get around the nuissance of the symbol collisions. https://github.com/thom311/libnl/pull/73 Signed-off-by: Thomas Haller <thaller@redhat.com>
* correct --protocol option for nl-cls-* utilitiesCong Wang2015-02-253-3/+3
| | | | | | | Just in the help message. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: add linker scripts for libnl-cli-3.so libraryThomas Haller2015-02-021-0/+6
| | | | | | | libnl-cli-3.so was unversioned previously. This is an ABI change (but backward compatible). Signed-off-by: Thomas Haller <thaller@redhat.com>
* idiag: deprecate IDIAG_SS_* socket statesThomas Haller2014-11-241-1/+1
| | | | | | | | | | These values mirror TCP_* socket states from 'netinit/tcp.h'. There is no good reason to expose a copy of those values. User space should use the original values (if they care). The only value that is actually useful is IDIAGNL_SS_ALL. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: move copy of linux headers to private directoryThomas Haller2014-09-242-0/+2
| | | | | | | | | | | | | | | | | | | libnl3 contains a private copy of some kernel header files. Normally, users are expected to install libnl and specify -I$PREFIX/include/libnl3 as include path. As the private kernel header files are not installed, this works fine. However, it can be convenient to build against the libnl source directory, without installing libnl. In this case, the private kernel header files shaddow the system provided ones. This is undesired. Move these files to a different directory to avoid this clash. http://lists.infradead.org/pipermail/libnl/2014-September/001645.html Signed-off-by: Thomas Haller <thaller@redhat.com> Acked-by: Thomas Graf <tgraf@suug.ch>
* build/trivial: prettify makefiles by wrapping long linesThomas Haller2014-09-242-2/+14
| | | | | Signed-off-by: Thomas Haller <thaller@redhat.com> Acked-by: Thomas Graf <tgraf@suug.ch>
* src: Silence all warningsThomas Graf2014-08-266-15/+9
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* nf: nfnl_*_str2copy_mode() should return intThomas Graf2014-08-262-2/+2
| | | | | | | | | | | | | ... to be able to return a negative error code for unknown modes. [thaller@redhat.com: This is potentially an ABI break, but since the size of the enum is implementation defined, it seems anyway unstable to have them as function arguments/return values.] http://lists.infradead.org/pipermail/libnl/2014-August/001616.html Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: Fix typo in error messageTobias Klauser2014-06-171-1/+1
| | | | | | | s/neighbout/neighbour/ Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: add error checking to nl-route-get about out-of-memoryThomas Haller2014-06-101-2/+6
| | | | | | | This is mainly to appease coverity which warned about this. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* gitignore: ignore 'nf-ct-add' (netfilter/ct)Thomas Haller2014-04-301-0/+1
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* netfilter/ct: expand CT parameters that can be used in add/delete operationsRich Fought2014-04-143-1/+150
| | | | | | | | | | | | This expands functionality for manipulating conntracks over netlink by adding other attributes to nfnl_ct_build_message(). Added a command link program to add conntracks. https://github.com/thom311/libnl/pull/55 [thaller@redhat.com: cleaned up whitespace from original patch] Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* remove the obsolete src/cls directoryCong Wang2014-01-314-324/+0
| | | | | Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: separate compiler and linker flagsJan Engelhardt2013-11-272-5/+8
| | | | | | | | | -Wall is a compiler flag, and thus should be in CFLAGS, not CPPFLAGS. Similarly, -l belongs into LDADD/LIBADD because of ordering constraints. Signed-off-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Thomas Graf <tgraf@suug.ch>
* nl-link-set: Add --state optionJulien BERNARD2013-10-221-0/+9
| | | | | | | | | | | | | I modified the nl-link-set.c file to be able to set the interface up or down. I joined the patch. With the new nl-link-set binary I can set the tap interface down. I am working with Ubuntu 12.04 LTS 64bits and the libnl and libnl-route packages built from libnl3-3.2.3 from ubuntu reprositories. -- Julien BERNARD Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Priority of the '<' operator is higher than that of the '=' operatormaksqwe2013-08-261-1/+1
| | | | | Signed-off-by: maksqwe <maksqwe1@ukr.net> Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Add idiag-socket-detailsJoe Damato2013-07-253-1/+95
| | | | | | This small program lists all sockets on the system seen by netlink and serves as a simple example showing how to alloc an idiag msg cache and dump the objects in it.
* Add support for inet diag Netlink protocol.Joe Damato2013-07-191-1/+2
| | | | | | | | | | | | | - Inet diag allows users to gather low-level socket information. - This library provides a higher-level API for creating inetdiag requests (via idiagnl_connect and idiagnl_send_simple) and parsing the replies (via idiagnl_msg_parse). A cache is also provided (via idiagnl_msg_alloc_cache). - Request and message objects provide APIs for accessing and setting the various properties of each. - This library also allows the user to parse the inetdiag response attributes which contain information about traffic class, TOS, congestion, socket memory info, and more depending on the kernel version used. - Includes doxygen documentation.
* nl-route-add: Add NLM_F_EXCL flag to route addroopa2013-03-241-1/+1
| | | | | Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Use thread-safe strerror_r() instead of strerror()Thomas Graf2013-02-281-1/+2
| | | | | | | We have only ever fed well known error codes into strerror() so it should never have been a problem though. Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Merge pull request #29 from rmfought/natdir32Thomas Graf2013-01-241-0/+18
|\ | | | | netfilter: expectation NAT direction is 32 bit attribute
| * netfilter: expectation NAT direction is 32 bit attributeRich Fought2013-01-231-0/+18
| |
* | Fix build warnings of nl-(qdisc|class|cls)-addThomas Graf2013-01-243-0/+6
| | | | | | | | | | Reported-by: Jeroen Roovers <jer@gentoo.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>
* | Move private header files to <netlink-private/*>Thomas Graf2013-01-242-2/+2
|/ | | | | | | This clarifies the seperation between public and private header files. Signed-off-by: Thomas Graf <tgraf@suug.ch>