X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Fconnections.cgi;h=8613b9d9b0c3126e81606baf4a5e18179432ae0b;hb=c4391a0181b5bff0ac2db8efcdcefc9e20c3e098;hp=f1ed2125a2cb9e253ca332f7de01c1b09985e601;hpb=f0728c790ffce0acc5373bc340596a5e9974c8c1;p=people%2Fpmueller%2Fipfire-2.x.git diff --git a/html/cgi-bin/connections.cgi b/html/cgi-bin/connections.cgi index f1ed2125a2..8613b9d9b0 100644 --- a/html/cgi-bin/connections.cgi +++ b/html/cgi-bin/connections.cgi @@ -20,6 +20,7 @@ ############################################################################### use strict; +use experimental 'smartmatch'; use Net::IPv4Addr qw( :all ); use Switch; @@ -31,6 +32,7 @@ use Switch; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; +require "${General::swroot}/location-functions.pl"; my $colour_multicast = "#A0A0A0"; @@ -261,15 +263,19 @@ close(IPSEC); foreach my $line (@ipsec) { my @vpn = split(',', $line); - my ($network, $mask) = split("/", $vpn[12]); - if (!&General::validip($mask)) { - $mask = ipv4_cidr2msk($mask); - } + my @subnets = split(/\|/, $vpn[12]); + for my $subnet (@subnets) { + my ($network, $mask) = split("/", $subnet); + + if (!&General::validip($mask)) { + $mask = ipv4_cidr2msk($mask); + } - push(@network, $network); - push(@masklen, $mask); - push(@colour, ${Header::colourvpn}); + push(@network, $network); + push(@masklen, $mask); + push(@colour, ${Header::colourvpn}); + } } if (-e "${General::swroot}/ovpn/n2nconf") { @@ -375,6 +381,7 @@ print < +   @@ -382,6 +389,7 @@ print < +   @@ -405,9 +413,15 @@ print < $Lang::tr{'source ip and port'} + + $Lang::tr{'country'} + $Lang::tr{'dest ip and port'} + + $Lang::tr{'country'} + $Lang::tr{'download'} /
$Lang::tr{'upload'} @@ -520,7 +534,8 @@ foreach my $line (@conntrack) { } my $sip_colour = ipcolour($sip); - my $dip_colour = ipcolour($dip); + # use colour of destination network for DNAT + my $dip_colour = $dip ne $dip_ret ? ipcolour($dip_ret) : ipcolour($dip); my $sserv = ''; if ($sport < 1024) { @@ -535,11 +550,17 @@ foreach my $line (@conntrack) { my $bytes_in = format_bytes($bytes[0]); my $bytes_out = format_bytes($bytes[1]); + # 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); my $sip_extra; - if ($sip ne $sip_ret) { + if ($sip_ret && $sip ne $sip_ret) { $sip_extra = "> "; $sip_extra .= ""; $sip_extra .= " $sip_ret"; @@ -547,7 +568,7 @@ foreach my $line (@conntrack) { } my $dip_extra; - if ($dip ne $dip_ret) { + if ($dip_ret && $dip ne $dip_ret) { $dip_extra = "> "; $dip_extra .= ""; $dip_extra .= " $dip_ret"; @@ -596,6 +617,9 @@ foreach my $line (@conntrack) { $sport_extra + + $srcccode + $dip @@ -608,6 +632,9 @@ foreach my $line (@conntrack) { $dport_extra + + $dstccode + $bytes_in / $bytes_out @@ -660,15 +687,17 @@ sub ipcolour($) { my ($ip) = $_[0]; my $found = 0; - foreach my $line (@network) { - if ($network[$id] eq '') { - $id++; - } else { - if (!$found && ipv4_in_network($network[$id], $masklen[$id], $ip) ) { - $found = 1; - $colour = $colour[$id]; + if ($ip) { + foreach my $line (@network) { + if ($network[$id] eq '') { + $id++; + } else { + if (!$found && ipv4_in_network($network[$id], $masklen[$id], $ip) ) { + $found = 1; + $colour = $colour[$id]; + } + $id++; } - $id++; } }