vergoh / vnstat

vnStat - a network traffic monitor for Linux and BSD
GNU General Public License v2.0
1.41k stars 120 forks source link

vnstati: fivegraph limit with unlimited retention #232

Closed leeps closed 2 years ago

leeps commented 2 years ago

When using unlimited retention of 5 minute intervals, you could not modify the limit and heigth of the fivegraph output because range checking for the fivegraph limit does not account for -1 as configured retention hours. This commit changes the range check by requiring that retention hours are positive before limiting them to the configured retention. I'm assuming that any negative values other than -1 either have the same "unlimited" effect or are caught in vnstatd.

vergoh commented 2 years ago

Thanks. The unlimited 5 minute interval retentation was tested but not in combination with the graphical output which was implemented much later than the text output version. You are correct that it should still be allowed to output the graph even with -1 being selected. The configuration file parser takes care in https://github.com/vergoh/vnstat/blob/master/src/cfg.c#L236 to block any values less than -1 but that graph also needed additional sanity checks in order to ensure that all combination of the configuration values can result in a reasonable looking graph. That's why that section you correctly located exists.