From: Stefan Schantl Date: Mon, 17 May 2021 19:43:48 +0000 (+0200) Subject: connections.cgi: Use new system methods X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c735815521924aac8bd13edff047bb3cd1405a26;p=people%2Fstevee%2Fipfire-2.x.git connections.cgi: Use new system methods Signed-off-by: Stefan Schantl --- 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);