Skip to contentSkip to conversation

ll_map: add RTEXT_FILTER_NAME_ONLY to ll_link_get() and ll_init_map()

PATCH Applied Eric Dumazet 2 participants 2 messages May 20 – May 22

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ll_map: add RTEXT_FILTER_NAME_ONLY to ll_link_get() and ll_init_map()

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.

---
 lib/ll_map.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
lib/ll_map.c +4 -2
index 07937e27d4f6fb5506a3da6e9318270635224364..21dd124960a604b0cd8912a11e1808c0eec5dc3e 100644
@@ -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);
 	}
Signature · 1 line
2.54.0.631.ge1b05301d1-goog
#1 lore raw
This patch was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Hello:

This patch was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Quoted 8 lines · On Wed, 20 May 2026 10:30:43 +0000 you wrote:

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:

[...]

Here is the summary with links:
- [iproute2-next] ll_map: add RTEXT_FILTER_NAME_ONLY to ll_link_get() and ll_init_map()

    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=de91e928ff57

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html