]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add "synchronous" flag for synchronous proxying
authorAlan T. DeKok <aland@freeradius.org>
Thu, 24 Aug 2017 19:41:20 +0000 (15:41 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 24 Aug 2017 20:25:25 +0000 (16:25 -0400)
src/modules/rlm_radius/rlm_radius.c
src/modules/rlm_radius/rlm_radius.h

index a6b8df09db93dcb03aa9bf6294acb2fe1472667e..566206452eb47dca794ab70462a50b20bf91a2d9 100644 (file)
@@ -102,6 +102,8 @@ static CONF_PARSER const module_config[] = {
 
        { FR_CONF_OFFSET("replicate", FR_TYPE_BOOL, rlm_radius_t, replicate) },
 
+       { FR_CONF_OFFSET("synchronous", FR_TYPE_BOOL, rlm_radius_t, synchronous) },
+
        { FR_CONF_OFFSET("type", FR_TYPE_UINT32 | FR_TYPE_MULTI | FR_TYPE_NOT_EMPTY | FR_TYPE_REQUIRED, rlm_radius_t, types),
          .func = type_parse },
 
@@ -188,6 +190,10 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED C
            (code >= FR_MAX_PACKET_CODE) ||
            (!type_interval_config[code].name)) goto invalid_code;
 
+       /*
+        *      If we're doing async proxying, push the timers for the
+        *      various packet types.
+        */
        cf_section_rule_push(cs, &type_interval_config[code]);
 
        memcpy(out, &code, sizeof(code));
@@ -336,6 +342,13 @@ static void mod_radius_signal(REQUEST *request, void *instance, void *thread, vo
                return;
        }
 
+       /*
+        *      We received a duplicate packet, but we're not doing
+        *      synchronous proxying.  Ignore the dup, and rely on the
+        *      IO submodule to time it's own retransmissions.
+        */
+       if ((action == FR_ACTION_DUP) && !inst->synchronous) return;
+
        if (!inst->io->signal) return;
 
        inst->io->signal(request, inst->io_instance, t->thread_io_ctx, link, action);
@@ -557,6 +570,12 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf)
                inst->status_check = 0;
        }
 
+       /*
+        *      Don't sanity check the async timers if we're doing
+        *      synchronous proxying.
+        */
+       if (inst->synchronous) goto setup_io_submodule;
+
        /*
         *      Set limits on retransmission timers
         */
@@ -638,6 +657,7 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf)
                FR_INTEGER_BOUND_CHECK("Disconnect-Request.mrd", inst->retry[FR_CODE_DISCONNECT_REQUEST].mrd, <=, 30);
        }
 
+setup_io_submodule:
        inst->io = (fr_radius_client_io_t const *) inst->io_submodule->module->common;
        inst->io_instance = inst->io_submodule->data;
        inst->io_conf = inst->io_submodule->conf;
index bba41e70844a19e9c80ba5ddbc0622cb243c9b93..becd97cd7ea08c32f911039facafebaf3ce57ea8 100644 (file)
@@ -80,6 +80,7 @@ struct rlm_radius_t {
        struct timeval          zombie_period;
 
        bool                    replicate;      //!< are we ignoring responses?
+       bool                    synchronous;    //!< are we doing synchronous proxying?
 
        dl_instance_t           *io_submodule;  //!< As provided by the transport_parse
        fr_radius_client_io_t const *io;        //!< Easy access to the IO handle