From 631ebdecb860433c16ece3e084600e596f891b41 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 23 May 2015 08:05:58 -0700 Subject: [PATCH] load= enhancements - Normalize loads to 0.nnnnnnnn - Issue warning if the loads don't sum to 1.000000 Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Providers.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Providers.pm b/Shorewall/Perl/Shorewall/Providers.pm index e9653a840..32f771e6f 100644 --- a/Shorewall/Perl/Shorewall/Providers.pm +++ b/Shorewall/Perl/Shorewall/Providers.pm @@ -568,8 +568,8 @@ sub process_a_provider( $ ) { $track = 0 if $config{TRACK_PROVIDERS}; $default_balance = 0 if $config{USE_DEFAULT_RT}; } elsif ( $option =~ /^load=(0?\.\d{1,8})/ ) { - $load = $1; - require_capability 'STATISTIC_MATCH', "load=$load", 's'; + $load = sprintf "%1.8f", $1; + require_capability 'STATISTIC_MATCH', "load=$1", 's'; } elsif ( $option eq 'autosrc' ) { $noautosrc = 0; } elsif ( $option eq 'noautosrc' ) { @@ -1620,6 +1620,11 @@ sub setup_providers() { our $providers; if ( $providers ) { + if ( $maxload ) { + warning_message "The sum of the provider interface loads exceeds 1.000000" if $maxload > 1; + warning_message "The sum of the provider interface loads is less than 1.000000" if $maxload < 1; + } + emit "\nif [ -z \"\$g_noroutes\" ]; then"; push_indent;