From c6ac2562543a46f99a135a84bc3b8c4cb360b570 Mon Sep 17 00:00:00 2001 From: Zhenlei Huang Date: Fri, 2 Aug 2024 02:00:45 +0800 Subject: [PATCH] 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 --- sys/net/route/route_tables.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/net/route/route_tables.c b/sys/net/route/route_tables.c index fd211bcd5dd..f1c96f813d9 100644 --- a/sys/net/route/route_tables.c +++ b/sys/net/route/route_tables.c @@ -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);