]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
rt_names: read `rt_addrprotos.d` directory
authorDavid Lamparter <equinox@diac24.net>
Fri, 4 Oct 2024 09:16:38 +0000 (11:16 +0200)
committerDavid Ahern <dsahern@kernel.org>
Mon, 14 Oct 2024 21:36:08 +0000 (21:36 +0000)
`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.

Signed-off-by: David Lamparter <equinox@diac24.net>
Signed-off-by: David Ahern <dsahern@kernel.org>
etc/iproute2/rt_addrprotos.d/README [new file with mode: 0644]
lib/rt_names.c
man/man8/ip-address.8.in

diff --git a/etc/iproute2/rt_addrprotos.d/README b/etc/iproute2/rt_addrprotos.d/README
new file mode 100644 (file)
index 0000000..092115b
--- /dev/null
@@ -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'.
index 723f0917b0ae22a59b7c73b7525337ce1f85bc69..7dc194b1530cfdad3bc3b20c3b9e3bb0d4d09cb0 100644 (file)
@@ -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)
index d37dddb7b1a981cd065699c2670b8ce4bd2aa7e9..6c3f07f1173a0c105107208a5b16d0253df1d251 100644 (file)
@@ -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