git: 81dbacbb7d71 - main - net/route: Add an eventhandler for rt_numfibs changes
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 30 Mar 2026 16:15:38 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=81dbacbb7d71a53eef99ce73f7e589a165c3e1d6
commit 81dbacbb7d71a53eef99ce73f7e589a165c3e1d6
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-03-30 13:30:19 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-03-30 16:08:20 +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
---
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 49bb7abd9726..34df3297d6d4 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
#define fib4_calc_packet_hash xps_proto_software_hash_v4
diff --git a/sys/net/route/route_tables.c b/sys/net/route/route_tables.c
index 749ef063e125..571f1db9c40d 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>
@@ -268,6 +268,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();