]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ll_map: add RTEXT_FILTER_NAME_ONLY to ll_link_get() and ll_init_map()
authorEric Dumazet <edumazet@google.com>
Wed, 20 May 2026 10:30:43 +0000 (10:30 +0000)
committerDavid Ahern <dsahern@kernel.org>
Fri, 22 May 2026 22:15:35 +0000 (16:15 -0600)
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>
lib/ll_map.c

index 07937e27d4f6fb5506a3da6e9318270635224364..21dd124960a604b0cd8912a11e1808c0eec5dc3e 100644 (file)
@@ -273,7 +273,8 @@ static int ll_link_get(const char *name, int index)
                .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;
@@ -393,7 +394,8 @@ void ll_init_map(struct rtnl_handle *rth)
 
        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);
        }