summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* nl: Fix return value of nl_recvmsgs()Thomas Graf2012-05-081-0/+1
| | | | | | | | | | | | Apparently the change to have nl_recvmsgs() return the number of parsed messages broke nl_wait_for_ack() among other applications. This patch reverts to the old behaviour and provides a new function nl_recvmsgs_report() which provides the additional information for use by the cache manager and possibly other applications. Reported-by: Scott Bonar <sbonar@cradlepoint.com> Signed-off-by: Thomas Graf <tgraf@redhat.com>
* object: Add functions to access the object type, cache and object opsThomas Graf2012-04-241-1/+6
|
* cache: Add co_include_event allowing caches to provide their own ↵Thomas Graf2012-04-222-3/+19
| | | | nl_cache_include() implementation
* cache: improve documentation of co_event_filterThomas Graf2012-04-221-3/+20
|
* cache_mngr: Provide nl_cache_mngr_info() to pring cache manager detailsThomas Graf2012-04-211-0/+2
| | | | Useful for debugging and testing
* cache_mngr: Automatically allocate socket if neededThomas Graf2012-04-212-3/+4
| | | | | | | | | | | The requirement to have the caller provide the socket does not make much sense. Automatically allocate the socket if none was provided. This may also avoid some future abuse of reusing request sockets for handling notifications. Also rename cm_handle to cm_sock for clarity (no API change)
* Add new nl_cache_clone() function.Thierry Reding2012-02-161-0/+1
| | | | | | | | | 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>
* Support plug qdisc - queue traffic until explicit releaseShriram Rajagopalan2012-02-144-0/+58
| | | | | | | | | | | | | | | | | | | | | | | The plug qdisc supports two operations - plug and unplug. When the qdisc receives a plug ("buffer") command via netlink request, packets arriving henceforth are buffered until a corresponding unplug command is received. Depending on the type of unplug ("release_one" or "release_indefinite"), the queue can be unplugged indefinitely or selectively. The plug qdisc allows a user to implement network output buffering (aka output commit), used commonly in checkpoint based fault tolerance systems. It also supports a general purpose queue plug/unplug functionality. The associated kernel module is available in David Miller's net-next tree, commit: c3059be16c9ef29c05f0876a9df5fea21f29724f This patch introduces userspace tools and API, to control the qdisc via netlink messages. Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca> Signed-off-by: Thomas Graf <tgraf@redhat.com>
* add new function to provide neighbour event parsingBrett Ciphery2012-01-301-0/+2
| | | | | | | | | | the neighbour parsing function was previously not accessible, so custom callback functions had to handle the decoding itself. rtnl_neigh_parse is introduced and implemented in much the same way as rtnl_route_parse. Signed-off-by: Brett Ciphery <brett.ciphery@windriver.com> Signed-off-by: Thomas Graf <tgraf@redhat.com>
* dsmark: Add missing declarations for rtnl_class_dsmark_(get|set)_bitmask()Thomas Graf2011-11-251-3/+3
| | | | | | | The existing declarations refered to non-existing functions so removing them is safe. Signed-off-by: Thomas Graf <tgraf@redhat.com>
* link: allow to add/get linkinfo of unknown typeJiri Pirko2011-11-111-0/+1
| | | | | | | | store type kind in rtnl_link independently. That would allow to use this value even if type_ops are not present. This allows for example to create devices of type unknown to libnl. Signed-off-by: Jiri Pirko <jpirko@redhat.com>
* link: generic link enslaving APIThomas Graf2011-11-071-0/+6
| | | | | | Adds rtnl_link_enslave() / rtnl_link_release() providing a genreic link enslaving/release API for use with all link types which use the IFLA_MASTER property.