summaryrefslogtreecommitdiffstats
path: root/lib/route/link.c
Commit message (Collapse)AuthorAgeFilesLines
...
* link: Support IFLA_PROMISCUITY link attributeThomas Graf2012-10-091-40/+79
| | | | | | | * read-only attribute * dumped in details sections "promisc-mode (N users)" Signed-off-by: Thomas Graf <tgraf@redhat.com>
* "%llu" replaced with "%" PRIu64Коренберг Марк (дома)2012-08-291-2/+2
| | | | | | | | | | | | | | | | | | | | | On some architectures, uint64_t is defined as: typedef unsigned long long int __u64; on another architectures as: typedef unsigned long int __u64; So, according to man 3 printf, uint64_t should be printed as "%llu" on some architectures, and as "%lu" on another. The same for scanf. To eliminate that challenge, there is inttypes.h, in which appropriate constants are defined for current architecture. 32-bit types (and even 16 and 8 bit types) should be printed using such constants if printed variable defined as uint_XXXt or intXXXt type. But in reality 32-bit and less types does not gain run-time error (except in scanf), because they pushed to stack as 32-bit values at least. So, I decide not to fix that.
* link: rtnl_link_get_kernel() should only wait for ACK if AUTO-ACK is onThomas Graf2012-06-131-1/+1
| | | | Signed-off-by: Thomas Graf <tgraf@suug.ch>
* doc: documentation restructuringThomas Graf2012-05-101-2/+1
| | | | | | | | | | - 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
* link: fix regression in link message parserTorsten Hilbrich2012-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a simple test program that queries the source IP for a given destination address I get a crash in the call to rtnl_link_alloc_cache. Here is the stack trace (created with version 3.2.4): Program received signal SIGSEGV, Segmentation fault. 0xb7eb7553 in strlen () from /lib/libc.so.6 (gdb) bt #0 0xb7eb7553 in strlen () from /lib/libc.so.6 #1 0xb7eb7285 in strdup () from /lib/libc.so.6 #2 0xb7fcc305 in nla_strdup (nla=0x0) at attr.c:1033 #3 0xb7f9c173 in link_msg_parser (ops=0xb7fc2940, who=0x804b330, n=0x804c3e8, pp=0xbffffbf8) at route/link.c:486 #4 0xb7fcd485 in nl_cache_parse (ops=0xb7fc2940, who=0x804b330, nlh=0x804c3e8, params=0xbffffbf8) at cache.c:724 #5 0xb7fcd547 in update_msg_parser (msg=0x804b328, arg=0xbffffbb8) at cache.c:531 #6 0xb7fd1f25 in nl_cb_call (cb=<optimized out>, msg=<optimized out>, type=<optimized out>) at ../include/netlink-local.h:126 #7 recvmsgs (cb=<optimized out>, sk=<optimized out>) at nl.c:729 #8 nl_recvmsgs (sk=0x804b2d0, cb=0x804b368) at nl.c:780 #9 0xb7fcd5fd in __cache_pickup (sk=0x804b2d0, cache=<optimized out>, param=0xbffffbf8) at cache.c:560 #10 0xb7fcd83f in nl_cache_pickup (sk=0x804b2d0, cache=0x804b308) at cache.c:593 #11 0xb7fcd8c8 in nl_cache_refill (sk=0x804b2d0, cache=0x804b308) at cache.c:780 #12 0xb7f9d1fc in rtnl_link_alloc_cache (sk=0x804b2d0, family=4, result=0xbffffcd4) at route/link.c:868 #13 0x08048fd0 in libnl_init (data=<optimized out>) at helper_route.c:60 #14 iproute_get_source (destination=0xbffffeff "127.0.0.1", source=0xbffffd0f "\b\004c\370\267\364_\370\267\260\224\004\b8\375\377\277e\024\347\267\320\016\377\267\273\224\004\b\364_\370\267\260\224\004\b", source_size=17) at helper_route.c:105 #15 0x08048e6a in main (argc=2, argv=0xbffffde4) at ip_route_get.c:25 The attached patch (against 3.2.4) solves the problem, fixing something that looks like a typo. The bug is still present in current Git master.
* link: allow to add/get linkinfo of unknown typeJiri Pirko2011-11-111-22/+54
| | | | | | | | 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>
* add missing IFLA_MASTER fillupJiri Pirko2011-11-071-0/+3
| | | | | | this makes all set_master functions work. Signed-off-by: Jiri Pirko <jpirko@redhat.com>
* link: generic link enslaving APIThomas Graf2011-11-071-0/+123
| | | | | | 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.
* link: Ignore bridging notifications in link cache managerThomas Graf2011-10-211-0/+14
| | | | | RTM_DELLINK and RTM_NEWLINK bridging notifications should not delete/add entries to a link cache.
* link: Eat ACK followed by RTM_NEWLINK when requesting single linkThomas Graf2011-09-141-0/+4
| | | | | | When requesting a single link with RTM_GETLINK (no dump) the RTM_NEWLINK carrying the answer will be followed by an ACK we have to wait for.
* link: fix unaligned access to 64bit link statsBryan Phillippe2011-08-121-27/+37
|
* Updated link documentationThomas Graf2011-07-281-577/+682
| | | | | | | - API documentation - developer guide - enabled doxygen navbar - fixed css
* Use 'link type' instead of 'link info type'Thomas Graf2011-07-211-12/+21
| | | | | | The term 'link type' is much more easier to understand than 'link info type' rtnl_link_set/get_info_type() left around for backwards compatibility
* Include IFLA_LINK in link messagesThomas Graf2011-07-211-0/+3
|
* Fix clone() of AF specific link dataThomas Graf2011-04-211-1/+1
| | | | Passed the original link to ao_clone() instead of the new one.
* Support link info types with no payloadThomas Graf2011-04-191-4/+5
|
* Support for rtnl_link_add()Thomas Graf2011-04-151-6/+73
| | | | API for adding virtual links
* Improve rtnl_link_change() behaviourThomas Graf2011-04-131-73/+128
| | | | | | | | | | | | - avoid unncessary name change requests The kernel does not check if the specified IFNAME is different from the current name. It assumes that if IFNAME and ifindex are both specified, a name change is requested. Therefore avoid specyfing IFNAME if ifindex is provided and original and new name are identical. - move link building to own function (to allow link add later on) - error if immutable changes have been made - better documentation
* fix line removed by mistakeThomas Graf2011-04-111-0/+1
| | | | This line was removed by mistake in the last commit
* API to issue direct GET requests to the kernelThomas Graf2011-04-111-1/+92
| | | | | | | | | Provide nl_pickup() to pick up an answer from a netlink request and parse it using the supplied parser. Add rtnl_link_get_kernel() which sends an RTM_GETLINK to the kernel to fetch a single link directly from the kernel. This can be faster than dumping the whole table, especially if lots of links are configured.
* link: Provide rtnl_link_delete() to delete virtual linksThomas Graf2011-04-101-0/+81
| | | | | Takes a link object and extracts ifindex and name to build a deletion request message to delete virtual network links.
* link: Make return and argument type matchThomas Graf2011-04-101-2/+2
|
* Documentation updatesThomas Graf2011-03-211-1/+2
| | | | Mostly killing doxygen warnings, some doc updates to caching
* Add missing argument in rtnl_link_change exampleMiguel Di Ciurcio Filho2011-03-161-1/+1
| | | | Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
* prefix ipv6 link statistics identifiers with IP6Thomas Graf2011-03-161-30/+30
|
* constify struct trans_tblThomas Graf2010-11-171-5/+5
|
* link: define RTM_SETLINK to allow pretty printingThomas Graf2010-11-161-0/+1
|
* link: Add missing IFLA_AF_SPEC container attributeThomas Graf2010-11-161-0/+6
|
* link: Fix typo, use rtnl_link_af_alloc() to make sure data buffer is allocatedThomas Graf2010-11-161-1/+1
|
* link: AF_INET link moduleThomas Graf2010-11-161-7/+27
| | | | | | | | Note: The code for this is not upstream yet. Extends the link api to allow address family modules to fill a link message and implements a AF_INET address family link module which uses the new interface.
* link: Support for IFLA_AF_SPECThomas Graf2010-11-131-9/+42
| | | | | | | | This feature isn't upstream yet. It's required to test a patch in my local tree. Makes the link parser understand IFLA_AF_SPEC and call the address family specific parser.
* Add support for per interface ICMPv6 statisticsThomas Graf2010-11-111-0/+4
|
* Extend rtnl_link_alloc_cache() to support address familiesThomas Graf2010-11-111-7/+82
| | | | | | | Adds a family argument which allows to request link dumps for a certain address family. This allows to f.e. dump ipv6 specific statistics and data. nl-link-list --family inet6
* link/api: Convert link info ops to use nl_list_headThomas Graf2010-11-111-2/+1
| | | | | rtnl_link_info_ops_lookup() now returns a pointer with refcnt increment, you must return it using rtnl_link_info_ops_put()
* link: API for address family specific link dataThomas Graf2010-11-111-10/+120
| | | | | | Introduces a new API to handle address familiy specific link data such as IFLA_PROTINFO. It provides entry hooks for parsing IFLA_PROTINFO attributes and allows to include the parsed data when a link object is dumped.
* link: Support IFLA_NUM_VF attributeThomas Graf2010-11-111-0/+28
| | | | | | - parses attribute if available - provides API to access value rtnl_link_get_num_vf(link, num_vf)
* link: Support IFLA_IFALIAS attributeThomas Graf2010-11-111-1/+58
| | | | | | | | - parse IFLA_IFALIAS if available - provides API to access/change ifalias rtnl_link_get_ifalias(link) rtnl_link_set_ifalias(link, alias) - extends nl-link-set to test functionality
* Support for 64bit link counters IFLA_STATS64Thomas Graf2010-10-281-7/+45
|
* Remove NL_DUMP_ENV codeThomas Graf2010-10-201-68/+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.
* Add internal wait_for_ack() which only waits for ACK if !NL_NO_AUTO_ACKThomas Graf2008-10-201-1/+1
| | | | | This changeset ensures that internal code properly synchronizes to ACKs if ACKs are enabled and otherwise return immediately.
* Remove XML dumpingThomas Graf2008-06-171-71/+0
| | | | Bloats the library, not frequently used
* Remove old line counting while dumpingThomas Graf2008-05-231-103/+84
|
* 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-2/+3
| | | | | 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-12/+12
| | | | | | | | 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-14/+5
| | | | | 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/+9
| | | | | | | | 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-36/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 64bit alignment issue on x86_64.Thomas Graf2008-03-311-7/+2
|