path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2010-10-13Don't include pktloc_syntax.h in BUILT_SOURCESThomas Graf1-1/+0
2010-10-13route_obj: don't add empty destination to nlmsgDavid Lamparter1-1/+2
don't try to give the kernel an empty RTA_DST attribute. this would previously happening on trying to delete the default route as returned from the kernel. the kernel doesn't add a RTA_DST atttribute, so libnl does nl_addr_alloc(0) and inserts a zero-length RTA_DST attribute into the deletion request, which the kernel then refuses with ERANGE. Signed-off-by: David Lamparter <>
2010-10-13automake: add ${top_builddir}/include to AM_CFLAGSAndreas Bießmann1-1/+1
This patch enables out-of-source builds like this $ cd builddir && src_dir/configure && make Before this patch there was an error about missing netlink/version.h which is built by automake in top_builddir rather than top_srcdir which is already in include search path. Signed-off-by: Andreas Bießmann <>
2010-10-13Put preprocessor definitions in AM_CPPFLAGSMatthew L. Creech1-1/+1
When an alternate kernel header include directory is added in CPPFLAGS, the libnl build fails. This is because the local copy of kernel headers is added in AM_CFLAGS, which gets included after CPPFLAGS in the automake-generated makefile. Switching to AM_CPPFLAGS fixes the problems.
2010-10-13add user data to change_func_t for cachesAndreas Fett2-11/+13
the patch below adds the possibility to pass user data to callbacks of type change_func_t when using the nl_cache_mngr_* family of functions. If there is any better way to do this, without duplicating the code in cache_mngr.c please let me know.
2010-10-13Trivial fix for TBF memleakDenys Fedorysychenko1-0/+6
Without this patch, running alloc / free cache loop will lead to huge memory leaks on machine with 3000 interfaces with tbf qdiscs. Here was valgrind output: ==5580== 18,070,728 bytes in 347,514 blocks are definitely lost in loss record 32 of 32 ==5580== at 0x4025485: calloc (in /lib/valgrind/vgpreload_memcheck-x86- ==5580== by 0x405F410: tbf_msg_parser (tbf.c:46) ==5580== by 0x405302B: qdisc_msg_parser (qdisc.c:119) ==5580== by 0x4033DC9: nl_cache_parse (cache.c:643) ==5580== by 0x4033E7C: update_msg_parser (cache.c:460) ==5580== by 0x4038A11: nl_recvmsgs (netlink-local.h:112) ==5580== by 0x4034175: __cache_pickup (cache.c:483) ==5580== by 0x40343FF: nl_cache_pickup (cache.c:516) ==5580== by 0x403447D: nl_cache_refill (cache.c:698) ==5580== by 0x4034AB7: nl_cache_alloc_and_fill (cache.c:198) ==5580== by 0x4053216: rtnl_qdisc_alloc_cache (qdisc.c:388) ==5580== by 0x80489DB: main (in /home/root/nltest) Patch complied and tested for same test case, no more leaks anymore.
2010-07-03Let git ignore generated pktloc source filesThomas Graf1-0/+4
2010-07-03Fix compile warning in utils.cThomas Graf1-1/+1
2010-07-03Fix compile warning in nl.cThomas Graf1-1/+1
2010-07-02Packet Location InterfaceThomas Graf5-2/+336
2010-04-19Fix rule attribute comparisonPatrick McHardy1-0/+2
Rules don't have unique identifiers, so all attributes are compared by initializing the ID mask to ~0. This doesn't work however since nl_object_identical verifies whether the ID attributes are actually present before comparing the objects, which is never the case. Work around by using the intersection of present attributes when comparing two rule objects. Signed-off-by: Patrick McHardy <>
2010-04-19addr: add NL_DUMP_ENV functionPatrick McHardy1-0/+76
Signed-off-by: Patrick McHardy <>
2010-04-19addr: restore anycast functionsPatrick McHardy1-0/+32
Seems it got lost during some cleanups. Signed-off-by: Patrick McHardy <>
2010-04-19neigh: fix id_attrs to include ifindexPatrick McHardy1-1/+1
Neighbour entries for the same destination may exist on multiple interfaces. Include the interface in the ID attributes. Signed-off-by: Patrick McHardy <>
2010-04-19cache: properly invoke change_cb for deleted objects in nl_cache_resync()Patrick McHardy1-2/+8
When resyncing a cache, there are no delete messages, so they need to be synthesized for deleted objects. Signed-off-by: Patrick McHardy <>
2010-03-10Fix a bug when calculating ticks_per_usecJose Ignacio Naranjo Hernández1-19/+16
I've noticed a wrong behavior when setting up some delays in a netem qdisc. I will try to make the things easier for the reader describing the calls path. To set up a delay (or jitter...) I use 'rtnl_netem_set_delay' which requires an int parameter that tells the delay in micro seconds. Inside this func, the delay is set up with the help of 'nl_us2ticks', which is just an arithmetic operation (us * ticks_per_usec), where us is the input parameter and ticks_per_usec is a global variable initialized in 'get_psched_settings'. And here is the problem: If this variable is going to be calculated using '/proc/net/psched', I think the file scan is not done properly. I don't understand what the meaning of the asterisk is here: int r = fscanf(fd, "%08x%08x%08x%*08x", &tick, &us, &nom); if (4 == r && nom == 1000000 && !got_tick) ticks_per_usec = (double)tick/(double)us; The execution path never gets in the if statement, because r is always 3, and if the fourth parameter is read (avoiding the asterisk), there is no variable to store it in, so it comes a segv. In my opinion we can get rid of the if statement, because I think the proc psched file has always a fixed format of 4 parameters, and 'nom' is always 1000000 ( Find attached a patch I did, if I am correct.
2010-03-10new function nfnl_queue_msg_send_verdict_payload()Karl Hiramoto2-0/+62
nfnl_queue_msg_send_verdict_payload() will to send the verdict, mark, and possibly changed payload through the netlink socket. Add a few docbook comments in other funcs. Signed-off-by: Karl Hiramoto <>
2010-03-10new feature nl_send_iovec(), nl_auto_complete() and code refactoring.Karl Hiramoto1-24/+45
Create new function nl_send_iovec() to be used to send multiple 'struct iovec' through the netlink socket. This will be used for NF_QUEUE, to send packet payload of a modified packet. Refactor nl_send() to use nl_send_iovec() sending a single struct iovec. Create new function nl_auto_complete() by refactoring nl_send_auto_complete(), so other functions that call nl_send may also use nl_auto_complete() Signed-off-by: Karl Hiramoto <>
2009-12-07one more fix, u32.cDenys Fedoryschenko1-2/+1
One more segfault, also nl-tctree-list , fix Probably need reformat for better look Patch attached
2009-12-07invalid comma cause segfault for nl-tctree-list, tbf.cDenys Fedoryschenko1-1/+1
I notice segfault while running nl-tctree-list for tbf qdisc. Patch that fix this typo is attached.
2009-11-10libnl: add ERANGE to errno translationPatrick McHardy1-0/+1
Signed-off-by: Patrick McHardy <>
2009-11-10libnl: fix automake breakagePatrick McHardy1-1/+1
libnl-route must be handled before libnl-nf in lib_LTLIBRARIES since the later depends on the former. Additionally nf-monitor, nl-list-caches, nl-list-sockets and nl-util-addr have been dropped from the Makefile. Signed-off-by: Patrick McHardy <>
2009-09-03- Compile with _GNU_SOURCEThomas Graf1-2/+2
- Fixed classifier.c -> cls.c
2009-09-02Merge branch 'master' of git:// Graf3-129/+43
Conflicts: lib/Makefile src/Makefile
2009-09-02Add support for getting and deleting queueing classes.olc1-0/+78
2009-09-02Fix rtnl_addr cachingDan Winship1-2/+1
addr_obj.ops.oo_id_attrs included ADDR_ATTR_PEER, so any address that didn't have a peer address set would compare as unequal to itself, meaning it could never be removed from a cache after it was added, etc.
2009-09-02Patch for unexpectedly aligned messagesMarc de Kruijf1-1/+1
I found the following bug, where nlmsg_ok() in lib/msg.c would incorrectly return 'true' when the input argument 'remaining' was a negative number. This happens when the message is not aligned the way that libnl expects (although it is still legal). In the comparison of the signed and unsigned numbers on line 284, the signed number gets converted to an unsigned number, which is unexpected and naturally produces a bug. My patch is below. The cast is ugly, but it fixes the problem.
2009-09-02- Reworked the classifier interface.Thomas Graf10-187/+1046
- Added initial ematch support - Added support for the basic classifier - Added support for the cgroup classifier
2009-07-20nl_object_clone: properly clone ce_mask fieldAlexander Sack1-0/+1
based on my finding, ce_mask needs to be identical on clones; otherwise some functions (like "dump") will treat clones differently.
2009-07-05build: make use of library dependenciesJan Engelhardt1-0/+3
2009-06-23Move to automake-based buildJan Engelhardt3-128/+40
Issues solved: * PACKAGE_VERSION was abused for SOVERSION * unneeded DEP stage * did not support out-of-tree builds * no way to turn off silent mode * overriding CFLAGS at make time was not supported * no static libs were provided Signed-off-by: Jan Engelhardt <>
2009-05-04release_local_port: properly compute the bitmap positionInaky Perez-Gonzalez1-1/+1
Current calculation is always off, not reflecting the right position in the bitmap, which results in failures due to conflicts (detected at the kernel level) when trying to open a new handle. Signed-off-by: Inaky Perez-Gonzalez <>
2009-04-16nl_object_priv() is inline, so define it in the headerPavel Roskin1-5/+0
2009-04-16Remove all versioned libraries on "make clean"Pavel Roskin1-1/+1
2009-04-16Fix parallel buildPavel Roskin1-3/+3
When linking against libnl, require to exist. When linking against libnl-route, require to exist.
2008-12-10Fix up naming changesThomas Graf2-2/+2
2008-12-10restructure module documentation orderThomas Graf13-73/+50
split hiearchy into one top level module per library
2008-12-10Consistent naming of socket functionsThomas Graf1-3/+14
2008-12-03Documentation updateThomas Graf4-209/+381
2008-12-03Allow to pass multiple group values to membership functionsHolger Eitzenberger1-16/+42
Instead of calling the membership functions several times it is helpfull to extend the API and make the single group functions a special case. The value 0 (NFNLGRP_NONE) terminates this list. Example use: nl_socket_add_memberships(sock, group_1, group_2, 0); nl_socket_drop_memberships(sock, group_1, group_2, 0); Signed-off-by: Holger Eitzenberger <>
2008-10-30libnl: add some errno codes to nl_syserr2nlerrPatrick McHardy1-0/+2
Signed-off-by: Patrick McHardy <>
2008-10-23libnl: nfqueue: add nfqueue specific socket allocation functionPatrick McHardy1-0/+10
commit e92539843a0c7e5116254382626cce226bf2135e Author: Patrick McHardy <> Date: Thu Oct 23 13:46:16 2008 +0200 libnl: nfqueue: add nfqueue specific socket allocation function nfqueue users usually send verdict messages from the receive callback. When waiting for ACKs, the receive callback might be called again recursively until the stack blows up. Add a nfqueue specific socket allocation function that automatically disables ACKing for the socket. Signed-off-by: Patrick McHardy <>
2008-10-20Add internal wait_for_ack() which only waits for ACK if !NL_NO_AUTO_ACKThomas Graf12-20/+20
This changeset ensures that internal code properly synchronizes to ACKs if ACKs are enabled and otherwise return immediately.
2008-10-20Add socket flag NL_NO_AUTO_ACK to allow disabling auto ACKSThomas Graf2-2/+32
2008-10-15Error handling for rtnl_cls_set_kind() & addition of rtnl_cls_get_ops()Thomas Graf1-1/+11
2008-10-15Use 16bit ints for classifier prio/protocolThomas Graf1-4/+4
2008-10-14Replace NL_KEEP code with proper message reference countingThomas Graf2-32/+33
Adds reference counting to netlink messages so callbacks can hold on to a message without using the broken keep message flag.
2008-10-10Only include local addr as peer addr if providedWolfgang Steudel1-1/+1
we're using libnl-1.1 for a project. When trying to delete all addresses of an interface by only setting interface index and address family of an rtnl_addr and executing rtnl_addr_delete() we received some error (I don't remember what it was). The bug(?) is in build_addr_msg() in lib/route/addr.c: IFA_ADDRESS is set to a_local when a_peer is not set, without checking if a_local was set. We just added if (tmpl->ce_mask & ADDR_ATTR_LOCAL) after the "else" (line 496 in the current git).
2008-10-10fix lib symlinksPatrick McHardy1-0/+4
2008-06-17Remove XML dumpingThomas Graf5-247/+0
Bloats the library, not frequently used