]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
lower the limits on num_messages
authorAlan T. DeKok <aland@freeradius.org>
Wed, 31 Jan 2018 15:40:26 +0000 (10:40 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 31 Jan 2018 15:50:21 +0000 (10:50 -0500)
which should drastically decrease the memory usage of the detail
file reader

src/modules/proto_detail/proto_detail.c
src/modules/proto_detail/proto_detail_file.c

index 4a603e659246403f2ec19465e9b99b7830f57162..2c49e4f1bdfb26e00476fca367983eae186cc2ed 100644 (file)
@@ -549,9 +549,9 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
         */
        if (!inst->max_packet_size) inst->max_packet_size = inst->app_io->default_message_size;
 
-       if (!inst->num_messages) inst->num_messages = 256;
+       if (!inst->num_messages) inst->num_messages = 2;
 
-       FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32);
+       FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 2);
        FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535);
 
        FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024);
index 148cb0e2e6973654192f03e253a4901e261158a9..e0319d3c2e675754cee8108772be42de74eb5363 100644 (file)
@@ -393,6 +393,14 @@ static int work_exists(proto_detail_file_t *inst, int fd)
                goto error;
        }
 
+       /*
+        *      Limit the number of messages, retransmission, etc.
+        */
+       if (work->max_outstanding < listen->num_messages) {
+               listen->num_messages = work->max_outstanding;
+       }
+       if (work->max_outstanding <= 1) work->max_outstanding = 2;
+
        /*
         *      Open the detail.work file.
         */