iproute2 can spend considerable amount of time in ll_init_map()
or ll_link_get() to dump verbose netdev attributes, contributing
to RTNL pressure.
Add RTEXT_FILTER_NAME_ONLY new flag so that rtnl_fill_ifinfo()
limits its output to:
- struct nlmsghdr
- IFLA_IFNAME
- IFLA_PROP_LIST (alternate names)
This is supported in linux 7.2+ (and ignored in old kernels).
RTNL avoidance should be automatically provided in upcoming
kernel patches.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
.n.nlmsg_type = RTM_GETLINK,
.ifm.ifi_index = index,
};
- __u32 filt_mask = RTEXT_FILTER_VF | RTEXT_FILTER_SKIP_STATS;
+ __u32 filt_mask = RTEXT_FILTER_VF | RTEXT_FILTER_SKIP_STATS |
+ RTEXT_FILTER_NAME_ONLY;
struct rtnl_handle rth = {};
struct nlmsghdr *answer;
int rc = 0;
if (rtnl_linkdump_req_filter(rth, AF_UNSPEC,
RTEXT_FILTER_VF |
- RTEXT_FILTER_SKIP_STATS) < 0) {
+ RTEXT_FILTER_SKIP_STATS |
+ RTEXT_FILTER_NAME_ONLY) < 0) {
perror("Cannot send dump request");
exit(1);
}