aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ll_map.c
Commit message (Collapse)AuthorAgeFilesLines
* lib/ll_map: Choose size of new cache items at run-timePhil Sutter2017-08-241-2/+2
| | | | | | | | Instead of having a fixed buffer of 16 bytes for the interface name, tailor size of new ll_cache entry using the interface name's actual length. This also makes sure the following call to strcpy() is safe. Signed-off-by: Phil Sutter <phil@nwl.cc>
* fix netlink message length checksIgor Ryzhov2016-10-091-1/+1
| | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* Use C99 style initializers everywherePhil Sutter2016-07-201-1/+0
| | | | | | | | | | | | | | | | This big patch was compiled by vimgrepping for memset calls and changing to C99 initializer if applicable. One notable exception is the initialization of union bpf_attr in tc/tc_bpf.c: changing it would break for older gcc versions (at least <=3.4.6). Calls to memset for struct rtattr pointer fields for parse_rtattr*() were just dropped since they are not needed. The changes here allowed the compiler to discover some unused variables, so get rid of them, too. Signed-off-by: Phil Sutter <phil@nwl.cc> Acked-by: David Ahern <dsa@cumulusnetworks.com>
* include: add linked list implementation from kernelJiri Pirko2016-03-271-1/+1
| | | | | | Rename hlist.h to list.h while adding it to be aligned with kernel Signed-off-by: Jiri Pirko <jiri@mellanox.com>
* netns: allow to dump and monitor nsidNicolas Dichtel2015-04-201-1/+1
| | | | | | | | | | | | | | | | | | | | Two commands are added: - ip netns list-id - ip monitor nsid A cache is also added to remember the association between the iproute2 netns name (from /var/run/netns/) and the nsid. To avoid interfering with the rth socket, a new rtnl socket (rtnsh) is used to get nsid (we may send rtnl request during listing on rth). Example: $ ip netns list-id nsid 0 (iproute2 netns name: foo) $ ip monitor nsid Deleted nsid 0 (iproute2 netns name: foo) nsid 16 (iproute2 netns name: bar) Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
* cleanup warningsStephen Hemminger2014-08-041-2/+2
| | | | | ll_index can return -1 but was declared unsigned. rt_addr_n2a had unused length parameter
* ll_map: add name and index hashStephen Hemminger2013-03-281-56/+99
| | | | | Make ll_ functions faster by having a name hash, and allow for deletion. Also, allow them to work without calling ll_init_map.
* ll_map: use net/if.h to get prototypeStephen Hemminger2013-03-271-3/+1
| | | | Better to get prototype from system headers
* ll_map: remove unused address fieldsStephen Hemminger2013-03-271-33/+0
| | | | The address was being stored but not used by current code.
* libnetlink: remove unused junk callbackStephen Hemminger2011-12-281-1/+1
| | | | | | | Both rtnl_talk and rtnl_dump had a callback for handling portions of netlink message that do not match the correct pid or seq. But this callback was never used by any part of iproute2 so remove it.
* Cleanup ll_mapStephen Hemminger2010-12-101-25/+34
| | | | | | | In preparation for adding name hash: * add const * use same types in cache as ifinfomsg * rename idxmap to ll_cache
* iproute2: initialize the ll_map only onceOctavian Purdila2010-12-101-0/+8
| | | | | | | Avoid initializing the LL map (which involves a costly RTNL dump) multiple times. This can happen when running in batch mode. Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
* Increase size of ifindex hash headsStephen Hemminger2010-12-101-6/+6
| | | | The default of 16 is too small for users with 10,000 interfaces.
* iproute2: fix addrlabel interface names handlingFlorian Westphal2010-05-131-1/+5
| | | | | | | | | | ip addrlabel outputs if%d names due to missing init call: $ ip addrlabel s prefix a::42/128 dev if4 label 1000 Also, ip did not accept "if%d" interfaces on input. Signed-off-by: Florian Westphal <fw@strlen.de>
* iproute2: Add ll_index_to_addr functionDavid Ward2009-12-011-0/+21
| | | | | | | | | After calling ll_init_map, all of the information stored in the link-layer map can be retrieved by function calls (ll_index_to_*), except for the link-layer address. This patch fills the gap by adding a ll_index_to_addr function. Changes welcome. Signed-off-by: David Ward <david.ward@ll.mit.edu>
* iproute2: Support 20-byte link layer address in idxmapDavid Ward2009-12-011-1/+1
| | | | | | Extend the link-layer address field from 8 to 20 bytes to support InfiniBand. Signed-off-by: David Ward <david.ward@ll.mit.edu>
* iproute2: Support IFF_LOWER_UP and IFF_DORMANTThomas Graf2007-06-191-1/+2
| | | | | | | | | In order to support these new flags add current linux/if.h into the directory with the local copies. This caused troubles with outdated redefinitions from net/if.h so I've removed the dependency on it. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
* Remove trailing whitespaceStephen Hemminger2006-12-051-1/+1
| | | | | | Go through source files and remove all trailing whitespace Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
* Device indices are unsigned and use if_nametoindex as fallbackshemminger2005-06-071-7/+9
|
* Add ip rule flush capabilty and fix all the prototype changesosdl.net!shemminger2004-12-071-1/+2
| | | | | | because of that code rewrites the nlmsghdr. (Logical change 1.106)
* make all filtering handles take const args.osdl.net!shemminger2004-08-311-2/+2
| | | | (Logical change 1.77)
* (Logical change 1.3)osdl.org!shemminger2004-04-151-0/+169
|
* Initial revisionosdl.org!shemminger2004-04-151-0/+0