summaryrefslogtreecommitdiffstats
path: root/lib/route/neigh.c
Commit message (Collapse)AuthorAgeFilesLines
* neigh: add function to look up neighbour (fdb) by ifindex, mac and vlanJonas Johansson2016-05-291-0/+26
| | | | | | | | | | | | | | | | | The rtnl_neigh_get() function can not be used to look up a fdb entry in the neigh cache. This is due to that the function searches among destination addresses (NDA_DST) and not among link layer addresses (NDA_LLADDR), which is used by fdb entries. A fdb entry can also exist in several vlans, so a vlan id parameter is also needed to find a unique entry. This commit adds a function, rtnl_neigh_get_by_vlan() which searches the neigh cache for a specific neighbour (fdb) entry by interface index, link layer address and vlan id. Signed-off-by: Jonas Johansson <jonas.johansson@westermo.se> Signed-off-by: Thomas Haller <thaller@redhat.com> http://lists.infradead.org/pipermail/libnl/2016-May/002124.html https://github.com/thom311/libnl/pull/98
* neigh: support neighbour flag NTF_SELFJonas Johansson2016-04-291-0/+2
| | | | | | | Signed-off-by: Jonas Johansson <jonas.johansson@westermo.se> Signed-off-by: Thomas Haller <thaller@redhat.com> https://github.com/thom311/libnl/pull/96
* lib: update ce-mask to uint64_tDavid Ahern2016-02-121-3/+3
| | | | | | | | | | | | | | | | | | | | lib/route/link.c already defines 32 attributes which fills the current uint32_t used for ce_mask. To accommodate more attributes the mask needs to be expanded. This patch updates the definition to uint64_t. The nl_object_diff API is maintained for ABI with existing users. A new nl_object_diff64 API is added for the expanded attribute list. The MSB of the 32-bit API is used to indicate if higher order attributes had a mismatch. (Suggested by Thomas). Note that LINK_ATTR_LINK_NETNSID changes. But since the attribute flags are not public API it shouldn't be a problem. http://lists.infradead.org/pipermail/libnl/2015-December/002078.html http://lists.infradead.org/pipermail/libnl/2015-December/002083.html Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* bridge: add support for VLANsDavid Ahern2015-12-071-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | Add operation for requesting VLAN data for AF_BRIDGE and parsing of IFLA_AF_SPEC for AF_BRIDGE. VLANs are saved in a bitmap. Also add dumping of vlan info to link list and neigh list. For example: $ nl-link-list --details --family=bridge br1 ether 8e:6e:0e:86:e5:86 master br1 <broadcast,multicast,up,running,lowerup> mtu 1500 txqlen 0 weight 0 index 18 mode default carrier down bridge: pvid 1 all vlans: 1 301-400 601-610 untagged vlans: 1 bond1 ether 46:ef:e1:c9:46:fe <broadcast,multicast,master> mtu 1500 txqlen 0 weight 0 index 20 state down mode default carrier down bridge: Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com> Signed-off-by: David Ahern <dsa@cumulusnetworks.com> [thaller@redhat.com: modified original patch to use ao_parse_af_full(). Also renaming new API and drop some #defines] Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/neigh: add flags option to link and neighbor cachesDavid Ahern2015-11-191-0/+32
| | | | | | | | | | | | | Both link and neighbor cache support specify multiple groups (nl_af_group), but the alloc_cache functions for both do not set the NL_CACHE_AF_ITER flag before populating the cache so only the first group is used by default. This patch adds an API to pass in flags to make that happen and updates the nl-neigh-list command to make use of it. http://lists.infradead.org/pipermail/libnl/2015-October/001996.html Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* neigh: add support for NTF_SELFDavid Ahern2015-11-011-6/+13
| | | | | | | | http://lists.infradead.org/pipermail/libnl/2015-October/001995.html Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* neigh: accept "norarp" in rtnl_neigh_state2str()Thomas Haller2015-06-261-1/+6
| | | | | | | | Commit 6a9335f101e22cd5eaba4dfcf0a44e2c3097b4ab fixed a typo in the string-to-flags conversion. At least for rtnl_neigh_str2state() we want to continue to parse "norarp" for backward compatiblity. Signed-off-by: Thomas Haller <thaller@redhat.com>
* neigh: fix type for NUD_NOARP flag in trans_tblTobias Jungel2015-06-261-1/+1
| | | | | | | | | | Translate NUD_NOARP to "noarp", instead of "norarp". https://github.com/thom311/libnl/pull/79 Fixes: 44d362409d5469aed47d19e7908d19bd194493a4 Signed-off-by: Thomas Haller <thaller@redhat.com>
* neigh: add support for NDA_VLAN nl attributeJonas Johansson2015-03-231-0/+26
| | | | | | | | | [thaller@redhat.com: modified patch to parse NDA_VLAN and diff vlan] http://lists.infradead.org/pipermail/libnl/2015-March/001861.html Signed-off-by: Jonas Johansson <jonasj76@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* style: require comma after __ADD() macroThomas Haller2014-07-271-20/+20
| | | | | | | $ sed -i 's/^\([\t ]\+\<__ADD\> \?([^)]\+)\) *$/\1,/' `git grep -w -l __ADD` Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* nl: Print file:line:func in debugging messages and provide --disable-debug ↵Thomas Graf2013-04-021-0/+2
| | | | | | | | | 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>
* neigh: Remove check for AF_UNSPEC in rtnl_neigh_get()Thomas Graf2013-02-011-2/+2
| | | | | | | | | | | | | This check was introduces to not accidently return AF_BRIDGE objects to unaware API users as they do differ in structure. However, such objects are only available if explicitely requests using the NL_CACHE_AF_ITER flag or by using arg1 == AF_BRIDGE for the cache. Therefore remove this check and allow rtnl_neigh_get() to be used to fetch any neighbor object of a cache. Reported-by: Maxime Bizon <mbizon@freebox.fr> Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Move private header files to <netlink-private/*>Thomas Graf2013-01-241-1/+1
| | | | | | | This clarifies the seperation between public and private header files. Signed-off-by: Thomas Graf <tgraf@suug.ch>
* cache: provide safe variant of nl_cache_mngt_require() and use itThomas Graf2012-11-161-2/+7
| | | | | | | | 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>
* Add master support to rtnl_neigh for AF_BRIDGE objectsroopa2012-11-151-2/+22
| | | | | | | | | | | | | | | | | | | | 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>
* Add AF_BRIDGE support to neigh cacheroopa2012-11-151-10/+36
| | | | | | | | | | | | | This patch adds AF_BRIDGE to the list of families supported by the cache. Implements oo_id_attrs_get to declare separate id attributes for AF_UNSPEC and AF_BRIDGE neigh objects 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>
* Add hash support to neigh cacheroopa2012-11-091-0/+46
| | | | | | | | | | This patch adds keygen function to the neigh object 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 new function to provide neighbour event parsingBrett Ciphery2012-01-301-1/+18
| | | | | | | | | | 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>
* neigh: include ndm flags while building messageThomas Graf2011-06-151-0/+3
| | | | Reported by jeff courington <jeff_courington@hotmail.com>
* Documentation updatesThomas Graf2011-03-211-1/+1
| | | | Mostly killing doxygen warnings, some doc updates to caching
* constify struct trans_tblThomas Graf2010-11-171-3/+3
|
* Rename nl_get_hz() to nl_get_user_hz() to indicate it's not the in-kernel HZ ↵Thomas Graf2010-11-171-1/+1
| | | | value
* Support neighbour flag NTF_USEThomas Graf2010-10-291-0/+2
|
* Remove NL_DUMP_ENV codeThomas Graf2010-10-201-46/+0
| | | | | | | Dumping objects as environment variables has never been implemented completely and only increases the size of the library for no real purpose. Integration into scripts is better achieved by implementing a python module anyway.
* neigh: fix id_attrs to include ifindexPatrick McHardy2010-04-191-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 <kaber@trash.net>
* Add internal wait_for_ack() which only waits for ACK if !NL_NO_AUTO_ACKThomas Graf2008-10-201-2/+2
| | | | | This changeset ensures that internal code properly synchronizes to ACKs if ACKs are enabled and otherwise return immediately.
* Remove XML dumpingThomas Graf2008-06-171-55/+0
| | | | Bloats the library, not frequently used
* Remove old line counting while dumpingThomas Graf2008-05-231-54/+43
|
* Remove change routine, works flawlessly via add() with NLM_F_REPLACEThomas Graf2008-05-221-65/+8
| | | | This breaks the API but is the right thing to do.
* Add rtnl_neigh_get_family()Thomas Graf2008-05-201-0/+5
|
* Allow parser callbacks to return NL_OK, NL_SKIP, NL_EXITThomas Graf2008-05-151-5/+0
| | | | Obsoletes internal P_ACCEPT/P_IGNORE
* Fix memory leaks when sending of message failedThomas Graf2008-05-151-6/+9
| | | | | Various callers of nl_send_auto_complete() failed to free the allocated message when an error was reported.
* Rename struct nl_handle to struct nl_sockThomas Graf2008-05-151-20/+19
| | | | | | | | 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.
* Replace RTNL_LINK_NOT_FOUND with just 0Thomas Graf2008-05-141-4/+1
| | | | | The interface index 0 is reserved and can be safely used to signal that the device does not exist.
* Remove obsolete nla_get_addr() and nla_get_data()Thomas Graf2008-05-141-4/+8
| | | | | | | | Replaces obsolete calls to nla_get_addr() and nla_get_data() with nl_addr_alloc_attr() respectively nl_data_alloc_attr(). Also fixes missing error handling while parsing routing multipath configuration.
* Thread-safe error handlingThomas Graf2008-05-141-59/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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!
* Big routing code rework (API/ABI BREAK!)Thomas Graf2008-04-291-1/+1
| | | | | | | | | | Adds all missing routing attributes and brings the routing related code to a working state. In the process the API was broken several times with the justification that nobody is using this code yet. The changes include new example code which is also a prototype for how plain CLI tools could look like to control routes.
* Fix memory leak when parsing netlink messages into cachesThomas Graf2007-12-171-1/+1
| | | | The reference created by the parsers was never given back.
* Export interface to define cachesThomas Graf2007-09-171-2/+1
| | | | | | | | | | This interface was internal so far which required all code defining caches to be compiled with the sources available. In order to simplify the interface, the co_msg_parser prototype was changed to take the struct nl_parser_param directly instead of a void *. It used to be void * because the co_msg_parser was directly passed as the NL_CB_VALID callback function.
* Initial importThomas Graf2007-09-141-0/+1023