###############################################################################
use strict;
+use experimental 'smartmatch';
use Net::IPv4Addr qw( :all );
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";
}
}
+# 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" );
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);
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);
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);
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);
- push(@network, $network);
- push(@masklen, $mask);
- push(@colour, ${Header::colourvpn});
+ if (!&General::validip($mask)) {
+ $mask = ipv4_cidr2msk($mask);
+ }
+
+ push(@network, $network);
+ push(@masklen, $mask);
+ push(@colour, ${Header::colourvpn});
+ }
}
if (-e "${General::swroot}/ovpn/n2nconf") {
<a href="?sort_field=3&sort_order=d"><img style="width:10px" src="/images/up.gif" alt=""></a>
<a href="?sort_field=3&sort_order=a"><img style="width:10px" src="/images/down.gif" alt=""></a>
</th>
+ <th> </th>
<th style='text-align:center' colspan='2'>
<a href="?sort_field=2&sort_order=d"><img style="width:10px" src="/images/up.gif" alt=""></a>
<a href="?sort_field=2&sort_order=a"><img style="width:10px" src="/images/down.gif" alt=""></a>
<a href="?sort_field=4&sort_order=d"><img style="width:10px" src="/images/up.gif" alt=""></a>
<a href="?sort_field=4&sort_order=a"><img style="width:10px" src="/images/down.gif" alt=""></a>
</th>
+ <th> </th>
<th style='text-align:center'>
<a href="?sort_field=8&sort_order=d"><img style="width:10px" src="/images/up.gif" alt=""></a>
<a href="?sort_field=8&sort_order=a"><img style="width:10px" src="/images/down.gif" alt=""></a>
<th style='text-align:center' colspan='2'>
$Lang::tr{'source ip and port'}
</th>
+ <th style='text-align:center'>
+ $Lang::tr{'country'}
+ </th>
<th style='text-align:center' colspan='2'>
$Lang::tr{'dest ip and port'}
</th>
+ <th style='text-align:center'>
+ $Lang::tr{'country'}
+ </th>
<th style='text-align:center'>
$Lang::tr{'download'} /
<br>$Lang::tr{'upload'}
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);
</a>
$sport_extra
</td>
+ <td style='text-align:center; background-color:$sip_colour;'>
+ <a href='country.cgi#$srcccode'><img src='$src_flag_icon' border='0' align='absmiddle' alt='$srcccode' title='$srcccode' /></a>
+ </td>
<td style='text-align:center; background-color:$dip_colour;'>
<a href='/cgi-bin/ipinfo.cgi?ip=$dip'>
<span style='color:#FFFFFF;'>$dip</span>
</a>
$dport_extra
</td>
+ <td style='text-align:center; background-color:$sip_colour;'>
+ <a href='country.cgi#$dstccode'><img src='$dst_flag_icon' border='0' align='absmiddle' alt='$dstccode' title='$dstccode' /></a>
+ </td>
<td style='text-align:center'>
$bytes_in / $bytes_out
</td>