dect
/
libnl
Archived
13
0
Fork 0
Commit Graph

37 Commits

Author SHA1 Message Date
Thomas Graf f9241d57fe cache: Improve debugging messages of cache operations
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-01 11:46:30 +02:00
Thomas Graf 9680f910f4 Move private header files to <netlink-private/*>
This clarifies the seperation between public and private
header files.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-24 13:51:24 +01:00
roopa b1ebda9241 cache: Add new nl_cache_find api
This patch adds new cache find api

nl_cache_find api was suggested by Thomas.

Unlike nl_cache_search, this patch uses
nl_object_match_filter() to look for an
object match.

Am not sure this matches what was decided
on the list few weeks back. I will be happy
to make any changes.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-11 13:52:50 +01:00
mihai.dontu@gmail.com ba38f39198 cache: make sure the user has specified a callback
In cache_include(), the user callback is used even though one might not
have been specified, leading to a crash. This happens, for example, when
NetworkManager calls nl_cache_include() with the change_cb argument set
to NULL. Fix it by making sure the callback points to a valid address.

Signed-off-by: Mihai Dontu <mihai.dontu@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-06 14:22:15 +01:00
roopa 96bb7c9a4c cache pickup: Avoid duplicates during cache pickup
This patch adds search and replace/update functionality
to cache pickup_cb. This change is required to avoid
duplicates getting into the cache during pickup. Also
helps updating existing objects during cache pickup.
We have seen this in cases of ipv6 equal cost multipath
routes

changes v1 to v2:
	- Updated documentation

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2012-12-21 13:30:21 +01:00
roopa 20a051237c Bug Fix: cache_include: Fix object ref release after successful object update
The current code does a rtnl_link_put on new object instead of
old object. This patch fixes it. None of the caches have support
for object update, so this should not have affected anyone yet.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2012-12-17 16:46:58 +01:00
Thomas Graf 4149154c22 cache: only continue iterating over co_groups if it is available
A co_groups == NULL must enter the loop to trigger the initial
fill of the cache but may never bump the grp pointer as doing
so prevents the loop from being escaped correctly.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-26 11:50:56 +01:00
Thomas Graf 00132b4696 cache: provide safe variant of nl_cache_mngt_require() and use it
This makes runtime removal of cache operations possible if non-safe
API is not in use by application. The non-safe API will be removed
in the next major version.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-16 01:11:55 +01:00
Thomas Graf 23c4ef67c7 Use NL_DBG() instead of printing warnings and errors to stderr
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-16 00:42:34 +01:00
Thomas Graf cb82c2a545 use safe cache lookup variants internally
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-16 00:29:58 +01:00
Thomas Graf c658a6eef8 cache: Add reference counter to caches
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-15 20:45:44 +01:00
Thomas Graf 8ffa257bfa cache: Move nl_cache_ops_set_flags() to cache_mngt.c
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-12 22:07:39 +01:00
Thomas Graf 5734011228 cache: Fix typo in API doc of nl_cache_set_flags()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-12 22:03:22 +01:00
roopa 0bd14aa2d6 Add NL_CACHE_AF_ITER support during refill and resync
This patch adds support to iter over all supported families
during cache fill and resync.

The motivation for this was previously introduced at
http://lists.infradead.org/pipermail/libnl/2012-November/000734.html
In short, this patch allows caches to request dump on all supported
families instead of only AF_UNSPEC as done today.

With feedback from thomas this patch makes the iter over all families
conditional on per cache flag NL_CACHE_AF_ITER

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-12 21:51:07 +01:00
roopa dd8a87da96 Add support for per cache flags
This patch adds support for per cache flags
and adds a flag NL_CACHE_AF_ITER to iter over all
supported families when filling the cache.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-12 21:51:02 +01:00
roopa 55c0e036b0 Add hash support in cache mngr
This patch adds support to create, delete modify hash table for a cache

Signed-off-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Signed-off-by: Nolan Leake <nolan@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-10 00:12:44 +01:00
roopa bc7c822f54 Add support for updating objects in the cache
This patch adds support to update a cache object during cache_include instead
of the current approach of deleting the original object and adding a new one.
This operation is conditional on the object implementing the operation. If
the update is not successful, cache_include falls back to the existing cache
inclusion process of deleting and adding the object.

It adds a new object operation called oo_update. oo_update takes two objects
as arguments, first being the existing cache object that needs update, the
second argument being the new object. Currently it is left to the implementor
to use the msg type to decide wether to delete or add the new object attributes
to the old one. But the operation type or msg type can be easily made part of the
object arguments.

The motivation for this change is explained below in the context of including
support for AF_BRIDGE objects into the link cache.

libnl today deletes an object before it includes an identical object.
But for some objects like the AF_BRIDGE objects this does not work well.
link cache uses the ifindex as its key in object searches.
If link cache were to support AF_BRIDGE family objects, todays implementation,
	- will replace the original link object with the bridge port link object
	  for add notifications
	- And a bridge port delete notification from kernel would delete the
	link object from the cache leaving the cache without the link object
	until the kernel sends another notification for that link

The bridge port link notification contains some base link object attributes
plus bridge specific protocol info attributes. In such cases we think an
operation to update the existing object in place in cache might be useful.

This can be made to work for AF_INET6 link objects too.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Nolan Leake <nolan@cumulusnetworks.com>
Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Reviewed-by: Wilson Kok <wkok@cumulusnetworks.com>
2012-11-05 13:58:50 +01:00
Bushman, Jeff ca883b61bc Fix for dumping objects to a buffer instead of file descriptor
Attached is a patch to fix two problems with dumping objects to a buffer in=
stead of a file descriptor.
One was a problem in detecting the end of the buffer in the newline code.
The other was a problem with clearing the whole buffer before printing each=
 object.
2012-05-18 15:03:46 +02:00
Thomas Graf fec10a2823 doc: documentation restructuring
- 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
2012-05-10 12:03:59 +02:00
Thierry Reding 0b40364150 Add new nl_cache_clone() function.
The function can be used to make a copy of an existing cache. It is very
similar to nl_cache_subset() except that it allows no filtering but
copies every object.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-02-16 13:42:49 +01:00
Pavel Roskin 7701c8572f Make some functions and global variables static 2011-08-11 14:49:51 +02:00
Pavel Roskin f9993836ed Remove write-only variables in lib/cache.c 2011-08-11 14:49:51 +02:00
Thomas Graf 21d52eabba Support for NLM_F_INTR
Check if a dump was interrupted and needs to be redone
2011-07-14 10:51:49 +02:00
Thomas Graf 23c27b4738 Provide nl_cache_set_arg{1,2}() to specify cache args
Added based on a RFE. This is required if allocation and
(re)filling is to be splitted.
2011-04-10 10:22:27 +02:00
Thomas Graf c1073d6172 Documentation updates
Mostly killing doxygen warnings, some doc updates to caching
2011-03-22 00:40:26 +01:00
Thomas Graf 552c85cab7 Hold reference to obj while calling callback of cache iterator 2011-03-17 17:30:32 +01:00
Thomas Graf 33e94038c4 Print debugging info while iterating a cache based on a filter 2011-03-17 16:40:39 +01:00
Andreas Fett 4ab22ccd47 add user data to change_func_t for caches
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-13 13:41:57 +02:00
Patrick McHardy ba1bd9050d cache: properly invoke change_cb for deleted objects in nl_cache_resync()
When resyncing a cache, there are no delete messages, so they need to
be synthesized for deleted objects.

Signed-off-by: Patrick McHardy <kaber@trash.net>
2010-04-19 12:42:27 +02:00
Thomas Graf d844307024 Remove old line counting while dumping 2008-05-23 23:45:14 +02:00
Thomas Graf 1155370f52 Rename struct nl_handle to struct nl_sock
The idea of a common handle is long revised and only misleading,
nl_handle really represents a socket with some additional
action handlers assigned to it.

Alias for nl_handle is kept for backwards compatibility.
2008-05-15 13:26:32 +02:00
Thomas Graf 8a3efffa5b Thread-safe error handling
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!
2008-05-14 17:49:44 +02:00
Thomas Graf f4f7704b0d Ignore NULL pointers passed to nl_cache_free() 2008-04-29 22:58:07 +02:00
Patrick McHardy c6609efc0f [PATCH] libnl cache management leak 2008-01-10 12:44:22 +01:00
Thomas Graf c8a0a5cdfb Added additional parsing and validation functions for generic netlink
Also adds better example documentation for generic netlink
2008-01-10 12:35:38 +01:00
Thomas Graf 3d8efba917 Check for availability of request_update()
The implementation of this function is optional if a cache wishes to
be updated by notifications only.
2007-09-17 12:35:19 +02:00
Thomas Graf 44d362409d Initial import 2007-09-15 01:28:01 +02:00