From c735815521924aac8bd13edff047bb3cd1405a26 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Mon, 17 May 2021 21:43:48 +0200 Subject: [PATCH] connections.cgi: Use new system methods Signed-off-by: Stefan Schantl --- html/cgi-bin/connections.cgi | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/html/cgi-bin/connections.cgi b/html/cgi-bin/connections.cgi index 8613b9d9b0..00038f1a05 100644 --- a/html/cgi-bin/connections.cgi +++ b/html/cgi-bin/connections.cgi @@ -146,6 +146,9 @@ if ($netsettings{'RED_DEV'}) { } } +# Call safe system_output function to get all available routes. +my @all_routes = &General::system_output("/sbin/route", "-n"); + # Add Green Firewall Interface push(@network, $netsettings{'GREEN_ADDRESS'}); push(@masklen, "255.255.255.255" ); @@ -157,7 +160,7 @@ push(@masklen, $netsettings{'GREEN_NETMASK'} ); push(@colour, ${Header::colourgreen} ); # Add Green Routes to Array -my @routes = `/sbin/route -n | /bin/grep $netsettings{'GREEN_DEV'}`; +my @routes = grep (/$netsettings{'GREEN_DEV'}/, @all_routes); foreach my $route (@routes) { chomp($route); my @temp = split(/[\t ]+/, $route); @@ -178,7 +181,7 @@ if ($netsettings{'BLUE_DEV'}) { push(@colour, ${Header::colourblue} ); # Add Blue Routes to Array - @routes = `/sbin/route -n | /bin/grep $netsettings{'BLUE_DEV'}`; + @routes = grep(/$netsettings{'BLUE_DEV'}/, @all_routes); foreach my $route (@routes) { chomp($route); my @temp = split(/[\t ]+/, $route); @@ -199,7 +202,7 @@ if ($netsettings{'ORANGE_DEV'}) { push(@masklen, $netsettings{'ORANGE_NETMASK'} ); push(@colour, ${Header::colourorange} ); # Add Orange Routes to Array - @routes = `/sbin/route -n | /bin/grep $netsettings{'ORANGE_DEV'}`; + @routes = grep(/$netsettings{'ORANGE_DEV'}/, @all_routes); foreach my $route (@routes) { chomp($route); my @temp = split(/[\t ]+/, $route); -- 2.39.5