]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/connections.cgi
remote.cgi: Fix splitting output from ssh-keygen.
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / connections.cgi
index c27ff2ef761a70bebb550fd49e029ced97355cb9..00038f1a05bc4c758a5486d0979fa4ccd8d3f915 100644 (file)
@@ -32,7 +32,7 @@ use Switch;
 require '/var/ipfire/general-functions.pl';
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
-require "${General::swroot}/geoip-functions.pl";
+require "${General::swroot}/location-functions.pl";
 
 my $colour_multicast = "#A0A0A0";
 
@@ -86,9 +86,6 @@ if ( $debug ){
 my @dummy = ( ${Header::table1colour} );
 undef (@dummy);
 
-# Init libloc database connection.
-my $libloc_db_handle = &GeoIP::init();
-
 # check sorting arguments
 if ( $cgiin{'sort_field'} ~~ [ '1','2','3','4','5','6','7','8','9' ] ) {
        $SORT_FIELD = $cgiin{'sort_field'};
@@ -149,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" );
@@ -160,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);
@@ -181,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);
@@ -202,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);
@@ -553,11 +553,11 @@ foreach my $line (@conntrack) {
        my $bytes_in = format_bytes($bytes[0]);
        my $bytes_out = format_bytes($bytes[1]);
 
-       # enumerate GeoIP information
-       my $srcccode = &GeoIP::lookup_country_code($libloc_db_handle, $sip_ret);
-       my $src_flag_icon = &GeoIP::get_flag_icon($srcccode);
-       my $dstccode = &GeoIP::lookup_country_code($libloc_db_handle, $dip_ret);
-       my $dst_flag_icon = &GeoIP::get_flag_icon($dstccode);
+       # enumerate location information
+       my $srcccode = &Location::Functions::lookup_country_code($sip_ret);
+       my $src_flag_icon = &Location::Functions::get_flag_icon($srcccode);
+       my $dstccode = &Location::Functions::lookup_country_code($dip_ret);
+       my $dst_flag_icon = &Location::Functions::get_flag_icon($dstccode);
 
        # Format TTL
        $ttl = format_time($ttl);