summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2019-08-16all: Avoid pointer arithmetic on `void *`Michael Forney
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
2019-08-12Add SPDX identifiersYegor Yefremov
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
2018-06-25nl-neigh-list: free allocated itemsTobias Jungel
2018-04-06build: sort entries in Makefile.am and .gitignore by nameThomas Haller
2018-04-06nf-ct-add typoLukáš Karas
2018-04-06add demo program for listen conntrack eventsLukáš Karas
2017-08-18Add support for label stack in nl-route commandsDavid Ahern
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>
2017-06-15all: avoid compiler warnings -Wimplicit-fallthroughThomas Haller
2017-05-12build: allow building cli without dynamic librarires supportThomas Haller
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
2017-05-12route: Add support for MPLS to netconfDavid Ahern
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>
2017-05-12nl-monitor: Add support for netconf cachesDavid Ahern
Allow user to monitor netconf changes. Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-12nl-monitor: All user to specify line formatDavid Ahern
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>
2017-03-12lib: escape usage of strerror_l() if it doesn't exist in libcAlexey Brodkin
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>
2017-03-02include: don't include kernel headers in public libnl3 headersThomas Haller
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).
2017-02-27build: merge src/Makefile.am into top-level makefileThomas Haller
2017-02-27build: merge src/lib/Makefile.am into top-level makefileThomas Haller
2017-01-17fopen: add O_CLOEXECNick Kralevich
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
2016-11-29nl-link-stats: prefer RTNL_LINK_STATS_MAX over __RTNL_LINK_STATS_MAXThomas Haller
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>
2016-11-29src: nl-link-stats: use correct rtnl link stats maximumTobias Klauser
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>
2016-08-25src: switch to using strerror_l() instead of strerror_r()André Draszik
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>
2016-08-12trivial: whitespace-only fixes for src and libPeter Wu
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>
2016-03-31build: move -rdynamic from CPPFLAGS to LDFLAGSTobias Klauser
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
2015-11-19link/neigh: add flags option to link and neighbor cachesDavid Ahern
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>
2015-06-19build: fix path to cli linker version script for out-of-tree buildjfarrell
https://github.com/thom311/libnl/pull/78
2015-03-18build: extend configure option --enable-cli and install all cli programsThomas Haller
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>
2015-03-18build/trivial: sort PROGRAMS list in src/Makefile.amThomas Haller
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-03-17route: remove unnecessary include of private linux/if.hDavid Chappelle
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>
2015-02-25correct --protocol option for nl-cls-* utilitiesCong Wang
Just in the help message. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-02-02build: add linker scripts for libnl-cli-3.so libraryThomas Haller
libnl-cli-3.so was unversioned previously. This is an ABI change (but backward compatible). Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-24idiag: deprecate IDIAG_SS_* socket statesThomas Haller
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>
2014-09-24build: move copy of linux headers to private directoryThomas Haller
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>
2014-09-24build/trivial: prettify makefiles by wrapping long linesThomas Haller
Signed-off-by: Thomas Haller <thaller@redhat.com> Acked-by: Thomas Graf <tgraf@suug.ch>
2014-08-26src: Silence all warningsThomas Graf
Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-26nf: nfnl_*_str2copy_mode() should return intThomas Graf
... 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>
2014-06-17cli: Fix typo in error messageTobias Klauser
s/neighbout/neighbour/ Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-10cli: add error checking to nl-route-get about out-of-memoryThomas Haller
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>
2014-04-30gitignore: ignore 'nf-ct-add' (netfilter/ct)Thomas Haller
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-14netfilter/ct: expand CT parameters that can be used in add/delete operationsRich Fought
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>
2014-01-31remove the obsolete src/cls directoryCong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-27build: separate compiler and linker flagsJan Engelhardt
-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>
2013-10-22nl-link-set: Add --state optionJulien BERNARD
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>
2013-08-26Priority of the '<' operator is higher than that of the '=' operatormaksqwe
Signed-off-by: maksqwe <maksqwe1@ukr.net> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-07-25Add idiag-socket-detailsJoe Damato
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.
2013-07-19Add support for inet diag Netlink protocol.Joe Damato
- 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.
2013-03-24nl-route-add: Add NLM_F_EXCL flag to route addroopa
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-28Use thread-safe strerror_r() instead of strerror()Thomas Graf
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>
2013-01-24Merge pull request #29 from rmfought/natdir32Thomas Graf
netfilter: expectation NAT direction is 32 bit attribute
2013-01-24Fix build warnings of nl-(qdisc|class|cls)-addThomas Graf
Reported-by: Jeroen Roovers <jer@gentoo.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-24Move private header files to <netlink-private/*>Thomas Graf
This clarifies the seperation between public and private header files. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-23netfilter: expectation NAT direction is 32 bit attributeRich Fought