From 8c7172e7071f0ec5b2cd9f693474963a4407560a Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Fri, 27 Feb 2026 15:10:25 -0600 Subject: [PATCH] lib: remove the built-in library run-mode This run-mode does not allow for capture ThreadVars to be created at the appropriate place in the application life cycle. Instead, applications should register their own custom run-mode. Ticket: #8259 --- doc/userguide/upgrade.rst | 9 +++++++++ src/runmode-lib.c | 30 ------------------------------ src/runmode-lib.h | 12 ------------ src/runmodes.c | 4 ---- 4 files changed, 9 insertions(+), 46 deletions(-) diff --git a/doc/userguide/upgrade.rst b/doc/userguide/upgrade.rst index 71f4f7428e..723c8837b7 100644 --- a/doc/userguide/upgrade.rst +++ b/doc/userguide/upgrade.rst @@ -84,6 +84,15 @@ Other Changes ``app-layer.protocols.sip.tcp.enabled`` would be read and preferred over ``app-layer.protocols.sip.enabled``. +Changes for Library Users and Plugin Developers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- The built-in library run-mode has been removed. If your application + is relying on this run-mode, it should implement its own application + specific run-mode. See the example, ``examples/lib/custom`` for an + example. For more details, see + https://redmine.openinfosecfoundation.org/issues/8259. + Upgrading to 8.0.1 ------------------ diff --git a/src/runmode-lib.c b/src/runmode-lib.c index c094f6f868..9235c4c29e 100644 --- a/src/runmode-lib.c +++ b/src/runmode-lib.c @@ -26,36 +26,6 @@ #include "runmodes.h" #include "tm-threads.h" -/** \brief register runmodes for suricata as a library */ -void SCRunModeLibIdsRegister(void) -{ - RunModeRegisterNewRunMode(RUNMODE_LIB, "offline", "Library offline mode (pcap replaying)", - SCRunModeLibIdsOffline, NULL); - RunModeRegisterNewRunMode(RUNMODE_LIB, "live", "Library live mode", SCRunModeLibIdsLive, NULL); - return; -} - -/** \brief runmode for offline packet processing (pcap files) */ -int SCRunModeLibIdsOffline(void) -{ - TimeModeSetOffline(); - - return 0; -} - -/** \brief runmode for live packet processing */ -int SCRunModeLibIdsLive(void) -{ - TimeModeSetLive(); - - return 0; -} - -const char *SCRunModeLibGetDefaultMode(void) -{ - return "live"; -} - ThreadVars *SCRunModeLibCreateThreadVars(int worker_id) { char tname[TM_THREAD_NAME_MAX]; diff --git a/src/runmode-lib.h b/src/runmode-lib.h index f6e5ff65fb..7405db54b6 100644 --- a/src/runmode-lib.h +++ b/src/runmode-lib.h @@ -27,18 +27,6 @@ #include "threadvars.h" -/** \brief register runmodes for suricata as a library */ -void SCRunModeLibIdsRegister(void); - -/** \brief runmode for live packet processing */ -int SCRunModeLibIdsLive(void); - -/** \brief runmode for offline packet processing (pcap files) */ -int SCRunModeLibIdsOffline(void); - -/** \brief runmode default mode (live) */ -const char *SCRunModeLibGetDefaultMode(void); - /** * \brief Create ThreadVars for use by a user provided thread. * diff --git a/src/runmodes.c b/src/runmodes.c index 05c5e925ef..da7d88a243 100644 --- a/src/runmodes.c +++ b/src/runmodes.c @@ -245,7 +245,6 @@ void RunModeRegisterRunModes(void) RunModeUnixSocketRegister(); RunModeIpsWinDivertRegister(); RunModeDpdkRegister(); - SCRunModeLibIdsRegister(); #ifdef UNITTESTS UtRunModeRegister(); #endif @@ -358,9 +357,6 @@ static const char *RunModeGetConfOrDefault(int capture_mode, const char *capture custom_mode = RunModeDpdkGetDefaultMode(); break; #endif - case RUNMODE_LIB: - custom_mode = SCRunModeLibGetDefaultMode(); - break; default: return NULL; }