From 3453812f8e8d511987abd5f6d5bb528fc7663432 Mon Sep 17 00:00:00 2001 From: tievolu <78606440+tievolu@users.noreply.github.com> Date: Mon, 10 Oct 2022 13:33:47 +0100 Subject: [PATCH] Prevent divide by zero Prevent divide by zero when icmp_interval_idle = 0 --- sqm-autorate.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sqm-autorate.pl b/sqm-autorate.pl index 7e2249e..e1be18d 100644 --- a/sqm-autorate.pl +++ b/sqm-autorate.pl @@ -1484,8 +1484,8 @@ sub print_status_summary { "Reflectors - in use: %d, strikeout threshold: %d, strike TTL loaded/idle: %ds/%ds, struckout: %d, pool: %d/%d", $number_of_reflectors, $reflector_strikeout_threshold, - &round(($number_of_reflectors / (1 / ($icmp_interval_loaded))) * ($reflector_strikeout_threshold + 1)), - &round(($number_of_reflectors / (1 / ($icmp_interval_idle))) * ($reflector_strikeout_threshold + 1)), + &round(($number_of_reflectors / (1 / $icmp_interval_loaded)) * ($reflector_strikeout_threshold + 1)), + $icmp_adaptive_idle_suspend ? "inf" : &round(($number_of_reflectors / (1 / $icmp_interval_idle)) * ($reflector_strikeout_threshold + 1)), $struckout_count, scalar(@reflector_pool), $initial_reflector_pool_size @@ -3444,7 +3444,7 @@ sub clear_all_strikes { # If reflector strike TTL is set to "auto", update it based on the current ICMP interval sub update_reflector_strike_ttl { if (&get_config_property("reflector_strike_ttl", "auto") eq "auto") { - $reflector_strike_ttl = &round(($number_of_reflectors / (1 / ($icmp_interval))) * ($reflector_strikeout_threshold + 1)); + $reflector_strike_ttl = &round(($number_of_reflectors / (1 / $icmp_interval)) * ($reflector_strikeout_threshold + 1)); } }