]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
cache CS and use it for error printing
authorAlan T. DeKok <aland@freeradius.org>
Tue, 26 Sep 2017 19:00:28 +0000 (15:00 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 27 Sep 2017 16:25:24 +0000 (12:25 -0400)
src/modules/proto_detail/proto_detail.c
src/modules/proto_detail/proto_detail_file.c

index 1dde50ec12f61a3552409142dcf8cfc1459c9028..ea50d85fcfc33aa082db904cb6569e920a38bd46 100644 (file)
@@ -322,7 +322,7 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
        FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535);
 
        FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024);
-       FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535);
+       FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65536);
 
        return 0;
 }
index e8233f3509152328ec2a367af641046d6c82f73a..c2255903277805df9d7f1026ff1248a7b88b5629 100644 (file)
@@ -41,6 +41,7 @@ typedef struct {
 } fr_detail_entry_t;
 
 typedef struct {
+       CONF_SECTION                    *cs;                    //!< our configuration section
        proto_detail_t  const           *parent;                //!< The module that spawned us!
        char const                      *name;                  //!< debug name for printing
 
@@ -342,7 +343,10 @@ static int mod_open(void *instance)
        proto_detail_file_t *inst = talloc_get_type_abort(instance, proto_detail_file_t);
 
        inst->fd = open(inst->filename_work, O_RDWR);
-       if (inst->fd < 0) return -1;
+       if (inst->fd < 0) {
+               cf_log_err(inst->cs, "Failed opening %s: %s", inst->filename_work, fr_syserror(errno));
+               return -1;
+       }
 
        rad_assert(inst->name == NULL);
        inst->name = talloc_asprintf(inst, "detail working file %s", inst->filename_work);
@@ -391,7 +395,7 @@ static int mod_instantiate(UNUSED void *instance, UNUSED CONF_SECTION *cs)
        return 0;
 }
 
-static int mod_bootstrap(void *instance, UNUSED CONF_SECTION *cs)
+static int mod_bootstrap(void *instance, CONF_SECTION *cs)
 {
        proto_detail_file_t     *inst = talloc_get_type_abort(instance, proto_detail_file_t);
        dl_instance_t const     *dl_inst;
@@ -405,6 +409,7 @@ static int mod_bootstrap(void *instance, UNUSED CONF_SECTION *cs)
        rad_assert(dl_inst);
 
        inst->parent = talloc_get_type_abort(dl_inst->parent->data, proto_detail_t);
+       inst->cs = cs;
 
        return 0;
 }