summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Include the newly added header files in next releaseThomas Graf2012-11-231-0/+3
| | | | Signed-off-by: Thomas Graf <tgraf@suug.ch>
* cache: reserve room in cache_ops to avoid breaking module ABI too frequentlyThomas Graf2012-11-231-0/+9
| | | | Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Bug Fix: Add new fill socket to cache managerroopa2012-11-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new socket to cache manager to request fill's on. cache manager today uses cm_sock to request dump from the kernel. It also listens to netlink async events on the same sock. The problem with this is that when libnl is waiting to process the response to get dump request sent to the kernel during fill, it may receive an async event, resulting in libnl complaining about unexpected msg This is usually reproducible when there is heavy netlink async event traffic during nl_cache_mngr_add. This patch adds a new cm_sync_sock to use for fill during cache manager add cache. The other option is to provide an api to set the cm_sync_sock. But since this is a bug fix its probably better to fix the cache manager add api like this patch does. Please suggest otherwise. Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Reviewed-by: Nolan Leake <nolan@cumulusnetworks.com> Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
* cache: provide safe variant of nl_cache_mngt_require() and use itThomas Graf2012-11-162-8/+2
| | | | | | | | 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>
* Use NL_DBG() instead of printing warnings and errors to stderrThomas Graf2012-11-161-6/+6
| | | | Signed-off-by: Thomas Graf <tgraf@suug.ch>
* cache: Provide safe versions of nl_cache_ops_associate() and ↵Thomas Graf2012-11-161-0/+2
| | | | | | nl_cache_ops_lookup() Signed-off-by: Thomas Graf <tgraf@suug.ch>
* cache: Add reference counter to cache operationsThomas Graf2012-11-161-0/+6
| | | | Signed-off-by: Thomas Graf <tgraf@suug.ch>
* lock abstraction layerThomas Graf2012-11-151-0/+50
| | | | | | Hide pthread availability and enablement behind internal API Signed-off-by: Thomas Graf <tgraf@suug.ch>
* cache: Add reference counter to cachesThomas Graf2012-11-152-0/+2
| | | | Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Add master support to rtnl_neigh for AF_BRIDGE objectsroopa2012-11-151-0/+1
| | | | | | | | | | | | | | | | | | | | AF_BRIDGE neigh objects can be uniquely identified by the family, lladdr and bridge ifindex. This patch adds bridge ifindex to AF_BRIDGE neigh objects. Things will be ok even without this patch with just family and lladdr if we assume that we will have unique lladdr's accross bridges in a system. Kernel does not send the bridge ifindex in the AF_BRIDGE fdb/neigh message. This patch tries to get that info by a link cache lookup and adds it to the bridge neigh object 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> Signed-off-by: Thomas Graf <tgraf@suug.ch>
* cache: Move NL_CACHE_AF_ITER to <netlink/cache.h>Thomas Graf2012-11-122-5/+6
| | | | | | <netlink/cache-api.h> alreay requires <netlink/cache.h> anyway. Signed-off-by: Thomas Graf <tgraf@suug.ch>
* New cache manager add cache apiroopa2012-11-121-0/+3
| | | | | | | | | | | | | | | | | | | This patch is an attempt to add a new nl_cache_mngr_add_cache api to allow adding an existing cache to cache manager. Since the new api is similar to nl_cache_mngr_add except for allocating the cache, the patch moves most of the nl_cache_mngr_add code to nl_cache_mngr_add_cache and changes nl_cache_mngr_add to call nl_cache_mngr_add_cache. One use case for this api as pointed out by thomas would be to set cache flags before associating the cache with a cache manager. nl_cache_alloc_name("route/link", &cache); nl_cache_set_flags(cache, NL_CACHE_AF_ITER); nl_cache_mngr_add_cache(mngr, cache, ...); Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Add support for per cache flagsroopa2012-11-123-0/+10
| | | | | | | | 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>
* Hash: Properly prefix hash functionsThomas Graf2012-11-101-4/+4
| | | | | | Do not pollute public namespace with unprefixed functions. Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Add hash support in cache mngrroopa2012-11-103-0/+7
| | | | | | | | | | 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>
* Add nl hashtable structures and access functionsroopa2012-11-103-0/+64
| | | | | | | | | | | This patch adds the required structures and access functions to create and manage hashtables for netlink cache objects 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>
* Add hash functionroopa2012-11-101-0/+69
| | | | | | | | | | | | | | | | | | | | This patch adds a hash function for hashing libnl objects. This hash function is from: http://ccodearchive.net/info/hash.html The original code was modified to remove unwanted dependencies, unwanted code and fixes to header file locations One requirement with this hash function is, hashing over multiple fields of an un-packed struct requires that the struct be zeroed, otherwise random padding bytes will change the hash. 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>
* Add support for updating objects in the cacheroopa2012-11-052-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add new object op oo_id_attrs_getroopa2012-11-051-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current oo_id_attrs nl_object op allows a fixed id attribute list for an cache. But a cache with multiple families may need to specify different id attributes for different families. An example for this is the bridge fdb entries in the neigh cache: neigh entries belonging to the AF_UNSPEC family use (NEIGH_ATTR_IFINDEX | NEIGH_ATTR_DST | NEIGH_ATTR_FAMILY) as id attributes. AF_BRIDGE fdb entries which also support the same msg type, will need to use (NEIGH_ATTR_LLADDR | NEIGH_ATTR_FAMILY) as id attributes. Today you cannot specify different set of attributes to two families belonging to the same cache. This patch adds a new object function oo_id_attrs_get to get the attributes. An example implementation of oo_id_attrs_get for the neigh cache will look like: static uint32_t neigh_id_attrs_get(struct nl_object *obj) { struct rtnl_neigh *neigh = (struct rtnl_neigh *)obj; if (neigh->n_family == AF_BRIDGE) return (NEIGH_ATTR_LLADDR | NEIGH_ATTR_FAMILY); else return (NEIGH_ATTR_IFINDEX | NEIGH_ATTR_DST | NEIGH_ATTR_FAMILY); } 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>
* Merge branch 'master' of https://github.com/rmfought/libnlThomas Graf2012-10-268-194/+556
|\
| * Source cleanup for upstreamRich Fought2012-10-192-39/+38
| |
| * Updated nfnetlink includes; removed ifdefs; added delete exp programRich Fought2012-10-166-213/+352
| |
| * define advanced attributes outRich Fought2012-10-121-5/+27
| |
| * bugfixesRich Fought2012-10-091-0/+1
| |
| * Starting CLI workRich Fought2012-10-081-0/+30
| |
| * Successful compilation of libnl-nf with expectationRich Fought2012-10-081-20/+8
| |
| * Checkpoint before compilation attemptRich Fought2012-10-082-4/+1
| |
| * "checkpoint"Rich Fought2012-10-052-20/+17
| |
| * Checkpoint: compare functionRich Fought2012-10-051-3/+25
| |
| * Exp checkpointRich Fought2012-10-052-0/+167
| |
* | add missing '}' in __cplusplus namespacesThomas Graf2012-10-232-0/+7
| | | | | | | | Signed-off-by: Thomas Graf <tgraf@redhat.com>
* | link: Support link groupingThomas Graf2012-10-092-0/+4
| | | | | | | | | | | | | | | | | | | | New functions: rtnl_link_set_group(link, group) rtnl_link_get_group(link) The group identifier is printed in the brief section as "group N" Signed-off-by: Thomas Graf <tgraf@redhat.com>
* | link: Support IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUESThomas Graf2012-10-092-0/+8
| | | | | | | | | | | | | | | | | | | | New functions: rtnl_link_set_num_tx_queues(link, nqueues) rtnl_link_get_num_tx_queues(link) rtnl_link_set_num_rx_queues(link, nqueues) rtnl_link_get_num_rx_queues(link) Signed-off-by: Thomas Graf <tgraf@redhat.com>
* | link: Support IFLA_PROMISCUITY link attributeThomas Graf2012-10-093-1/+23
| | | | | | | | | | | | | | * read-only attribute * dumped in details sections "promisc-mode (N users)" Signed-off-by: Thomas Graf <tgraf@redhat.com>
* | nl: Provide API to specify the default buffer size when receiving netlink ↵Thomas Graf2012-10-092-0/+3
|/ | | | | | | | | | | | messages New functions: nl_socket_set_msg_buf_size(sk, size) nl_socket_get_msg_buf_size(sk) Default remains getpagesize() Signed-off-by: Thomas Graf <tgraf@redhat.com>
* route: Document ROUTE_CACHE_CONTENT flagThomas Graf2012-08-301-2/+7
| | | | Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Run-time version information is now availableКоренберг Марк (дома)2012-08-301-1/+10
| | | | | | | | | | | | | | | | | | | Run-time version information is available as exported four integers: - const int nl_ver_num = LIBNL_VER_NUM; - const int nl_ver_maj = LIBNL_VER_MAJ; - const int nl_ver_min = LIBNL_VER_MIN; - const int nl_ver_mic = LIBNL_VER_MIC; The purpose of this is to get version of compiled library as run time. Use cases: - To know exact version of the library in Python's ctypes module, Say, to find out if nl_cache_mngr_alloc() allow sk=NULL - To make sure that the version of the loaded library corresponds to the version of headers (for the paranoid). Say, to check: if (LIBNL_VER_NUM != nl_ver_num) exit(1);
* Fix build warning after const char ** convertThomas Graf2012-08-291-2/+2
| | | | | | | | | | Commit 25d640da4a caused the following build warning: ../include/netlink/utils.h:47:15: note: expected 'const char **' but argument is of type 'char **' route/link/inet6.c:300:11: warning: passing argument 2 of 'nl_cancel_down_bytes' from incompatible pointer type [enabled by default] Revert the const char ** change. Signed-off-by: Thomas Graf <tgraf@suug.ch>
* lib/utils.c: One kilobit now is a 1000bits (instead of 1024)Коренберг Марк2012-08-281-2/+2
| | | | | | | http://en.wikipedia.org/wiki/Kilobit Also, convert "char*" to "const char*" in output value, as returned values can not be modified.
* Correct missing fwmark mask proto.Andrew Collins2012-06-111-0/+1
| | | | | In my previous patch for adding fwmark mask support, I neglected to add a prototype for it. This change corrects my oversight.
* genl: Export genl_ops_resolve() and genl_mngt_resolve() in headerThomas Graf2012-06-011-0/+3
| | | | These have been public but have not been declared in a header yet.
* genl: Support registration of families without depending on cachesThomas Graf2012-06-011-7/+26
| | | | | | | | | | | | Introduces the functions genl_register_family() and genl_unregister_family() to register a Generic Netlink family which does not implement a cachable type. API users can direct received messages into genl_handle_msg() which will validate the messages and call the callback functions defined in the commands definition. See test/test-genl.c for an example on how to use it.
* genl: Add genlmsg_user_hdr(), genlmsg_user_data(), and genlmsg_user_datalen()Thomas Graf2012-05-311-0/+4
| | | | | | | These functions deprecate the function genlmsg_data() which did not allow to specify the length of the user header. Use of the new API will make code much clearer. The old function is still kept around for backwards compatibility but marked deprecated in the API reference.
* genl: updates to API reference documentationThomas Graf2012-05-314-30/+93
|
* correct HTB rtable/HZ calculationsAndrew Collins2012-05-291-0/+1
| | | | | | | | | | | | The HTB implementation in libnl uses units of microseconds in a number of places where it seems TC is expecting time in units of ticks, which causes actual rates much higher than requested. Additionally, libnl uses USER_HZ for calculating buffer and cbuffer sizes, which can result in much larger buffers than necessary on systems with high resolution timers. Note that the TBF qdisc uses microseconds incorrectly in two spots as well, I fixed this but did not test.
* add fwmark mask supportA C2012-05-291-0/+1
| | | | | | The fw classifier allows a mask to be set, which is necessary for some complex shaping/firewall scenarios. The attached patch adds support for it to libnl.
* u32: fix various u32 hashing related warningsAdrian Ban2012-05-161-0/+1
| | | | | I've add an missing u32 hash filter missing from u32.h I've fix all warnings in file test-complex-HTB-with-hash-filters.c
* tc: fix included headersThomas Graf2012-05-1612-0/+16
| | | | Reported-by: Adrian Ban <adrian.ban@mantech.ro>
* doc: documentation restructuringThomas Graf2012-05-103-13/+13
| | | | | | | | | | - 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
* u32: add support for hashingAdrian Ban2012-05-081-0/+4
|