]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Make connections triggers optional
authorNick Porter <nick@portercomputing.co.uk>
Fri, 22 Aug 2025 09:21:38 +0000 (10:21 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 25 Aug 2025 13:56:12 +0000 (14:56 +0100)
src/lib/server/connection.c
src/lib/server/connection.h

index 91d4f9c837aafcfa73a0187d7913ee5eb7ba2140..4e9118cbe404d4e56cece636ea60d58d86530077 100644 (file)
@@ -124,10 +124,11 @@ struct connection_s {
 
        CONF_SECTION            *trigger_cs;            //!< Where to search locally for triggers.
        fr_pair_list_t          *trigger_args;          //!< Arguments to pass to the trigger functions.
+       bool                    triggers;               //!< Do we run triggers.
 };
 
 #define CONN_TRIGGER(_state) do { \
-       trigger(unlang_interpret_get_thread_default(), \
+       if (conn->triggers) trigger(unlang_interpret_get_thread_default(), \
                conn->trigger_cs, fr_table_str_by_value(connection_trigger_names, _state, "<INVALID>"), true, conn->trigger_args); \
 } while (0)
 
@@ -1548,6 +1549,7 @@ connection_t *connection_alloc(TALLOC_CTX *ctx, fr_event_list_t *el,
                .failed = funcs->failed,
                .shutdown = funcs->shutdown,
                .is_closed = true,              /* Starts closed */
+               .triggers = conf->triggers,
                .trigger_args = conf->trigger_args,
                .trigger_cs = conf->trigger_cs,
                .pub.name = talloc_asprintf(conn, "%s - [%" PRIu64 "]", log_prefix, id)
index cd913ddb55a5986b96d7a133d771214740804267..d7d33eca1edf999d396a2990bd21da9a70a5c11e 100644 (file)
@@ -99,6 +99,8 @@ typedef struct {
 
        fr_pair_list_t  *trigger_args;          //!< Additional pairs to pass to the trigger function
                                                ///< Lifetime must be longer than the connection.
+
+       bool            triggers;               //!< Do we run triggers.
 } connection_conf_t;
 
 typedef struct connection_watch_entry_s connection_watch_entry_t;