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.

Signed-off-by: David Lamparter <equinox@diac24.net>
Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
David Lamparter
2024-10-04 11:16:38 +02:00
committed by David Ahern
parent 75e760026c
commit b43f84a0a9
3 changed files with 9 additions and 1 deletions

View File

@@ -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'.

View 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)

View 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