summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2013-06-28Merge /home/kaber/src/repos/libnl.gitHEADmasterPatrick McHardy32-125/+983
2013-06-27msg: Avoid returning a negative value for nlmsg_attrlen()Thomas Graf1-1/+1
If a hdrlen was provided that was greather than the actual message length, a negative attributes length would result. This was typically happening for RTM_GETLINK requests where we can get a away with a 4 bytes header on the request side but the response would use a 16 bytes header. This resulted in strange -8 bytes leftover debug messages. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-06-27netfilter/queue: introduce nfnl_queue_msg_send_verdict_batch()Holger Eitzenberger2-0/+31
The batched verdict implicitely ACKs all queue packet IDs up to the one send back, which reduces the number of verdict messages send to the kernel. Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-06-27netfilter/queue: generalize nfnl_queue_msg_build_verdict()Holger Eitzenberger1-2/+10
Generalize netfilter/queue to allow sending batched verdicts later. Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-06-27Handle -NLE_AGAIN in nl_cache_mngr_data_readyAndrew Collins1-1/+1
Since commit "nl: Return -NLE_AGAIN if non-blocking socket would block", nl_cache_mngr_data_ready returns -NLE_AGAIN to callers on non-blocking sockets. Change it to consider -NLE_AGAIN as a non-error case as it is expected behavior with the nl_recv changes. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-06-27Default to comparing all attributes if no oo_id_attrs definedAndrew Collins1-1/+3
Since commit: "cache pickup: Avoid duplicates during cache pickup", nfnl_ct_alloc_cache no longer properly fills the cache, as it doesn't define oo_id_attrs so all items are considered duplicates. Instead of adding a ~0 oo_id_attrs to ct_obj, this changes nl_object_identical to default to comparing all attributes if neither oo_id_attrs_get or oo_id_attrs are provided. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-05-24Merge branch 'master' of https://github.com/michael-dev/libnlThomas Graf7-1/+536
2013-05-16Add macvlan supportMichael Braun7-1/+536
This patch add support for kernel macvlan interfaces. Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
2013-05-143.2.22 releaseThomas Graf2-2/+2
2013-05-08nl: Increase receive buffer size to 4 pagesThomas Graf1-1/+1
Assuming that the kernel does not send more than a page is no longer valid, and enabling MSG_PEEK'ing by default to figure out the exact message buffer requirements can have a negative influence on the performance of existing applications. Bumping the default receive buffer space to 4 pages seems a sane default. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-05-08rtnl_link_af_unregister: fix lockingNathan Lynch1-2/+2
rtnl_link_af_unregister() attempts to write-lock info_lock twice instead of releasing it before returning. It also will return with info_lock write-locked if passed a NULL ops. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-28Prepare for 3.2.22-rc1 releaseThomas Graf2-6/+6
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-28tests: Include util.h in distThomas Graf1-0/+3
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-28tests: Add basic attribute unit testsThomas Graf4-1/+97
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-28configure: Convert ENABLE_UNIT_TESTS to a mere AM conditionalThomas Graf1-3/+3
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-28Wrong calcultation in nla_reserveEmmanuel Thierry1-1/+1
There seams to be an error in the calculation of needed space for the message in nla_reserve. The current size of the message is counted twice: Once in NLMSG_ALIGN, once in the condition below. This causes nla_put_* calls to be rejected if the allocation size of the message has been strictly calculated by the caller. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-28attr: Fix typo in nla_is_nested()Thomas Graf1-1/+1
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-28Merge branch 'fixes' of https://github.com/socketpair/libnlThomas Graf2-6/+15
2013-04-28attr: nla_is_nested() must access nla_type directlyThomas Graf1-1/+1
Can't used nla_type() as it applies NLA_TYPE_MASK first Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-28Fix leak of cb if nl_socket_alloc_cb() failed to allocate socketКоренберг Марк (дома)1-4/+13
- each *_get() should have corresponding *_put(). That rule was broken in nl_socket_alloc() - Also, check if cb is NULL in nl_socket_set_cb (calls BUG())
2013-04-27tests: Make unit test building optionalThomas Graf2-1/+9
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-26dump_attrs: "NLA_F_NESTED" => nla_is_nested(nla)Коренберг Марк (дома)1-2/+2
2013-04-05autoconf: Use PKG_CHECK_MODULES() instead of AM_PATH_CHECK()Thomas Graf1-1/+1
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-05addr: only translate more recent address family names and ARP types if definedThomas Graf2-0/+10
Helps making libnl compilable with older kernel headers Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-03Perform no operation on nl_object_free(NULL).Emmanuel Roullit1-1/+6
Passing a NULL pointer would cause a NULL pointer dereference within nl_object_free(). Returning early on NULL pointer is the behavior free(3) and other nl*_free() functions. Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
2013-04-02msg: Pretty print generic netlink header in nl_msg_dump()Thomas Graf1-41/+97
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-02nl: Return -NLE_AGAIN if non-blocking socket would blockThomas Graf1-5/+0
Previously 0 was returned which gave the caller no chance of detecting when a non-blocking socket would block. If a caller intends to never see an error message it should utilize poll()/select() to only read when the socket has pending data or information. Reported-by: Holger Eitzenberger <holger@eitzenberger.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-02genl: Fix cb reference leak in genl_ctrl_probe_by_name()Thomas Graf1-2/+7
nl_socket_get_cb() bumps the cb reference counter Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-02ct: add ICMPv6 type,code and IDHolger Eitzenberger1-18/+45
Add ICMPv6 type, code and ID (if set) by using the already available conntrack atttributes. Currently the ICMPv6 conntrack objects in libnl are without type, code and ID. This e. g. is the output of nl_object_dump() without the patch: ipv6-icmp ::1 <-> ::1 id 0xdd0871f0 family inet6 timeout 30s <NOREPLY,SNAT_INIT,DNAT_INIT> The attached patch tries to solve that. It then looks like ipv6-icmp ::1 <-> ::1 icmp type 128 code 0 id 28253 id 0xdf3a11f0 family inet6 timeout 30s <SNAT_INIT,DNAT_INIT> It is the 'small' approach, because it reuses the existing ICMP attributes of the conntrack object (currently only used for IPv4). This way I can avoid to add new _icmp6_get_, _icmp6_set_ and _icmp6_test_ functions. Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-02nl: Print file:line:func in debugging messages and provide --disable-debug ↵Thomas Graf5-10/+32
to disable debugging Compiling libnl with --disable-debug will result in the ignorance of the 'NLDBG' environment variable. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-01cache: Improve debugging messages of cache operationsThomas Graf1-24/+38
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-01Merge git://git.infradead.org/users/tgr/libnlPatrick McHardy361-7427/+30264
Signed-off-by: Patrick McHardy <kaber@trash.net> Conflicts: include/linux/netlink.h lib/Makefile.am lib/error.c libnl-3.0.pc.in src/Makefile.am
2013-04-01genl: Update mt_id of cache ops when resolving genl idThomas Graf1-0/+4
The cache layer uses the message type array stored in the cache ops to lookup which cache a message belongs to. Update to the the message array with the resolved generic netlink id to make it compatible with the caching API. Allows to use nl_cache_refill() and others for generic netlink based caches with dynamic generic netlink ids. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-01genl: Provide internal function to resolve name to idThomas Graf2-0/+28
Like genl_ops_resolve() but uses its own socket. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-24nl-route-add: Add NLM_F_EXCL flag to route addroopa1-1/+1
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-17Remove rtnl_link_free() declaration from the header file.Tony Cheneau1-1/+0
Reason: there is no rtnl_link_free() definition anywhere in the code. Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-17Remove superfluous declaration of rtnl_route_put()Tony Cheneau1-1/+0
rtnl_route_put() is declared twice in the same header file Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14rtnl-addr: Fix invalid call to nl_addr_set_prefixlen() if neither local or ↵Thomas Graf1-4/+7
peer address are present Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14rtnl-addr: Inherit prefix length to nl_addr objs in rtnl_addr_set_prefixlen()Thomas Graf1-3/+32
Previously if using rtnl_addr_set_prefixlen() the new prefix length was not forwarded to the corresponding 'struct nl_addr' objects associated with address already and thus the comparison function would fail. This patch also clears the internal ADDR_ATTR_PREFIXLEN flag if the prefix length has been reset. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14tests: Add check based unit test systemThomas Graf5-6/+273
Introduces new unit tests based on `check`. Each subsystem/module can have its own unit tests in tests/check-<name>.c that will be linked together in tests/check-all.c. Running 'make check' will compile and run the unit tests automatically. A reference unit test implementation has been done for the abstract address module. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14addr: Update to latest address familiy definition for translationThomas Graf1-2/+11
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14addr: improve API reference documentation for nl_addr_*()Thomas Graf2-42/+166
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14addr: Reset unused portion of binary address in nl_addr_set_binary_addr()Thomas Graf1-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>
2013-03-14msg: Pretty print error message header even if incompleteThomas Graf1-15/+24
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14msg: Pretty print padding attributes in nl_msg_dump()Thomas Graf1-3/+7
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14attr: Warn application if nla_parse() observes same attribute multiple timesThomas Graf1-8/+13
Use a debugging message to warn applications if an attribute is found multiple times in the same message. It is perfectly valid to rely on this behaviour but it is likely to indicate a bug. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14attr: No longer warn about attribute of type 0Thomas Graf1-3/+2
The kernel will start using type 0 attributes for padding purposes. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14attr: Do not enforce maximum length for NLA_FLAG attributesThomas Graf1-3/+1
Although wasteful, NLA_FLAG with non zero payload cause no harm and should thus not be rejected. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14attr: Add nla_nest_cancel() to remove partially added nested attributesThomas Graf3-2/+25
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-28Use thread-safe strerror_r() instead of strerror()Thomas Graf5-7/+10
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>