git: 9cb93a545559 - stable/15 - net/route: Add an eventhandler for rt_numfibs changes
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 03 May 2026 23:51:53 UTC
The branch stable/15 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=9cb93a5455595792e7bf4dbe877b942e38ffa91a
commit 9cb93a5455595792e7bf4dbe877b942e38ffa91a
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-03-30 13:30:19 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-05-03 23:10:42 +0000
net/route: Add an eventhandler for rt_numfibs changes
The multicast routing code will start implementing per-FIB routing
tables. As a part of this, it needs to be notified when the number of
FIBs changes, so that it can expand its tables.
Add an eventhandler for this purpose.
MFC after: 2 weeks
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D55239
(cherry picked from commit 81dbacbb7d71a53eef99ce73f7e589a165c3e1d6)
---
sys/net/route.h | 6 ++++++
sys/net/route/route_tables.c | 4 +++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/sys/net/route.h b/sys/net/route.h
index 8c713d65ec95..d1b13cdd4d67 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -32,6 +32,9 @@
#ifndef _NET_ROUTE_H_
#define _NET_ROUTE_H_
+#ifdef _KERNEL
+#include <sys/_eventhandler.h>
+#endif
#include <net/vnet.h>
/*
@@ -124,6 +127,9 @@ VNET_DECLARE(u_int, rt_add_addr_allfibs); /* Announce interfaces to all fibs */
#define V_fib_hash_outbound VNET(fib_hash_outbound)
VNET_DECLARE(u_int, fib_hash_outbound);
+typedef void (*rtnumfibs_change_t)(void *, uint32_t);
+EVENTHANDLER_DECLARE(rtnumfibs_change, rtnumfibs_change_t);
+
/* Outbound flowid generation rules */
#ifdef RSS
diff --git a/sys/net/route/route_tables.c b/sys/net/route/route_tables.c
index d7fbcbefc501..fdcb775ac4ce 100644
--- a/sys/net/route/route_tables.c
+++ b/sys/net/route/route_tables.c
@@ -33,10 +33,10 @@
* Which is the new name for an in kernel routing (next hop) table. *
***********************************************************************/
-#include <sys/cdefs.h>
#include "opt_route.h"
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/socket.h>
#include <sys/systm.h>
#include <sys/malloc.h>
@@ -272,6 +272,8 @@ grow_rtables(uint32_t num_tables)
old_rt_tables = V_rt_tables;
V_rt_tables = new_rt_tables;
+ EVENTHANDLER_INVOKE(rtnumfibs_change, num_tables);
+
/* Wait till all cpus see new pointers */
atomic_thread_fence_rel();
NET_EPOCH_WAIT();