Skip to contentSkip to conversation

rt_names: read `rt_addrprotos.d` directory

PATCH Applied David Lamparter 2 participants 2 messages Oct 4, 2024 – Oct 14, 2024

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

PATCH 1/1 rt_names: read `rt_addrprotos.d` directory

rt_addrprotos doesn't currently use the .d directory thing - add it.

My magic 8-ball predicts we might be grabbing a value or two for use in FRRouting at some point in the future. Let's make it so we can ship those in a separate file when it's time.

---
 etc/iproute2/rt_addrprotos.d/README | 2 ++
 lib/rt_names.c                      | 3 +++
 man/man8/ip-address.8.in            | 5 ++++-
 3 files changed, 9 insertions(+), 1 deletion(-)
 create mode 100644 etc/iproute2/rt_addrprotos.d/README
etc/iproute2/rt_addrprotos.d/README new file +2 -0
new file mode 100644
index 000000000000..092115b12423
@@ -0,0 +1,2 @@
+Each file in this directory is an rt_addrprotos configuration file. iproute2
+commands scan this directory processing all files that end in '.conf'.
lib/rt_names.c +3 -0
index e967e0cac5b4..f44b1e4ba34e 100644
@@ -315,6 +315,9 @@ static void rtnl_addrprot_initialize(void)
 		ret = rtnl_tab_initialize(CONF_USR_DIR "/rt_addrprotos",
 					  rtnl_addrprot_tab,
 					  ARRAY_SIZE(rtnl_addrprot_tab));
+
+	rtnl_tab_initialize_dir("rt_addrprotos.d", rtnl_addrprot_tab,
+				ARRAY_SIZE(rtnl_addrprot_tab));
 }
 
 const char *rtnl_addrprot_n2a(__u8 id, char *buf, int len)
man/man8/ip-address.8.in +4 -1
index d37dddb7b1a9..6c3f07f1173a 100644
@@ -303,7 +303,10 @@ receive multicast traffic.
 the protocol identifier of this route.
 .I ADDRPROTO
 may be a number or a string from the file
-.BR "/etc/iproute2/rt_addrprotos" .
+.BR @SYSCONF_USR_DIR@/rt_addrprotos " or " @SYSCONF_ETC_DIR@/rt_addrprotos
+(has precedence if exists).  A directory named
+.BR rt_addrprotos.d
+is also scanned in either location.
 If the protocol ID is not given,
 
 .B ip assumes protocol 0. Several protocol
Signature · 1 line
2.45.2
#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 9 lines · On Fri, 4 Oct 2024 11:16:38 +0200 you wrote:

rt_addrprotos doesn't currently use the .d directory thing - add it.

My magic 8-ball predicts we might be grabbing a value or two for use in FRRouting at some point in the future. Let's make it so we can ship those in a separate file when it's time.

[...]

Here is the summary with links:
- [iproute2-next] rt_names: read rt_addrprotos.d directory

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

You are awesome, thank you!

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