fibs: Limit the WARNING message to only once when setting up with multiple fibs

In main [1] this warning message is suppressed but no plans to MFC the
change as the message may be still useful for users that upgrade from
older releases to 14.x or 13.x. Well emitting this warning message every
time increasing the fib number is confusing for users not for the feature
`net.add_addr_allfibs`, let's limit it to be printed only once.

1. a48f7a2eb90b fibs: Suppress the WARNING message for setups with multiple fibs

This is a direct commit to stable/14 and stable/13.

PR:		280097
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D46204
This commit is contained in:
Zhenlei Huang 2024-08-02 02:00:45 +08:00 committed by Franco Fichtner
parent a5e7aacc59
commit c6ac256254

View file

@ -218,6 +218,7 @@ populate_kernel_routes(struct rib_head **new_rt_tables, struct rib_head *rh)
static void
grow_rtables(uint32_t num_tables)
{
static bool printedonce;
struct domain *dom;
struct rib_head **prnh, *rh;
struct rib_head **new_rt_tables, **old_rt_tables;
@ -231,10 +232,12 @@ grow_rtables(uint32_t num_tables)
new_rt_tables = mallocarray(num_tables * (AF_MAX + 1), sizeof(void *),
M_RTABLE, M_WAITOK | M_ZERO);
if ((num_tables > 1) && (V_rt_add_addr_allfibs == 0))
if (num_tables > 1 && V_rt_add_addr_allfibs == 0 && !printedonce) {
printedonce = true;
printf("WARNING: Adding ifaddrs to all fibs has been turned off "
"by default. Consider tuning %s if needed\n",
"net.add_addr_allfibs");
}
#ifdef FIB_ALGO
fib_grow_rtables(num_tables);