mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-17 21:50:11 +00:00
![]() ip route uses ll_name_to_index and ll_index_to_name to convert between device names and indices. At the moment both use for the ioctl based glibc functions if_nametoindex and if_indextoname and does not cache the result. When using a batch file or dumping large number of routes this means the same device lookups can be done repeatedly adding unnecessary overhead (socket + ioctl + close for each device lookup). Add a new function, ll_link_get, to send a netlink based RTM_GETLINK. If successful, cache the result in idx_head and name_head so future lookups can re-use the entry. Update ll_name_to_index and ll_index_to_name to use ll_link_get and only fallback to the glibc functions if it fails. With this change the time to install 720,022 routes with 2 ecmp nexthops where the nexthop device is given is reduced from 31.4 seconds to 19.2 seconds. A dump of those routes drops from 13.3 to 2.8 seconds. Signed-off-by: David Ahern <dsahern@gmail.com> |
||
---|---|---|
.. | ||
bpf.c | ||
color.c | ||
coverity_model.c | ||
exec.c | ||
fs.c | ||
inet_proto.c | ||
json_print.c | ||
json_writer.c | ||
libgenl.c | ||
libnetlink.c | ||
ll_addr.c | ||
ll_map.c | ||
ll_proto.c | ||
ll_types.c | ||
Makefile | ||
mpls_ntop.c | ||
mpls_pton.c | ||
names.c | ||
namespace.c | ||
rt_names.c | ||
utils.c |