]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
time_delta can be counter, too
authorAlan T. DeKok <aland@freeradius.org>
Mon, 26 Sep 2022 16:24:42 +0000 (12:24 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 29 Sep 2022 22:09:33 +0000 (18:09 -0400)
src/lib/util/dict_validate.c

index 5bce1214ccc6fa2d5308fe4f04797943d07091d6..23f5e999f12d6b880e6b5f855dc7a1a361a63368 100644 (file)
@@ -489,10 +489,12 @@ bool dict_attr_flags_valid(fr_dict_t *dict, fr_dict_attr_t const *parent,
        }
 
        /*
-        *      Only numerical types can be counter
+        *      Counters can be time deltas, or unsigned integers.
+        *      For other data types, we don't know how to
+        *      automatically add two counters.
         */
        if (flags->is_counter) {
-               if (fr_type_is_numeric(type) && !fr_type_is_signed(type)) {
+               if ((type == FR_TYPE_TIME_DELTA) || (fr_type_is_integer(type) && !fr_type_is_signed(type))) {
                        ALLOW_FLAG(is_counter);
                } else {
                        fr_strerror_printf("The 'counter' flag cannot be used with '%s'", fr_type_to_str(type));