Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- html/cgi-bin/connections.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/cgi-bin/connections.cgi b/html/cgi-bin/connections.cgi index badc1f395..af375effe 100644 --- a/html/cgi-bin/connections.cgi +++ b/html/cgi-bin/connections.cgi @@ -439,7 +439,7 @@ foreach my $line (<CONNTRACK>) { </a> $dport_extra </td> - <td style='text-align:center; background-color:$sip_colour;'> + <td style='text-align:center; background-color:$dip_colour;'> <a href='country.cgi#$dstccode'><img src='$dst_flag_icon' border='0' align='absmiddle' alt='$dstccode' title='$dstccode' /></a> </td> <td class="text-right">
Parsing any custom routes for any custom interfaces was broken so that arbitrary routes were imported when not all interfaces were in use.
Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- html/cgi-bin/connections.cgi | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/html/cgi-bin/connections.cgi b/html/cgi-bin/connections.cgi index af375effe..705118576 100644 --- a/html/cgi-bin/connections.cgi +++ b/html/cgi-bin/connections.cgi @@ -89,6 +89,9 @@ my @routes = &General::system_output("ip", "route", "show");
# Find all routes foreach my $intf (keys %interfaces) { + # Skip empty interfaces + next if ($intf eq ""); + foreach my $route (grep(/dev ${intf}/, @routes)) { if ($route =~ m/^(\d+.\d+.\d+.\d+/\d+)/) { $networks{$1} = $interfaces{$intf};
If %interfaces contains defined interfaces only, this is not necessary.
For blue and orange interfaces this can be done by
my %interfaces = ( $settings{'GREEN_DEV'} => ${Header::colourgreen},
# IPsec "gre[0-9]+" => ${Header::colourvpn}, "vti[0-9]+" => ${Header::colourvpn},
# OpenVPN "tun[0-9]+" => ${Header::colourovpn}, );
# BLUE interface if ($settings{BLUE_DEV} ne "") { $interfaces{$settings{'BLUE_DEV'} } = ${Header::colourblue}; }
#ORANGE interface if ($settings{ORANGE_DEV} ne "") { $interfaces{$settings{'ORANGE_DEV'} }= ${Header::colourorange}; }
For VPN this has to be adapted.
Reviewed-by-: Bernhard Bitsch bbitsch@ipfire.org
Am 06.12.2024 um 17:44 schrieb Michael Tremer:
Parsing any custom routes for any custom interfaces was broken so that arbitrary routes were imported when not all interfaces were in use.
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
html/cgi-bin/connections.cgi | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/html/cgi-bin/connections.cgi b/html/cgi-bin/connections.cgi index af375effe..705118576 100644 --- a/html/cgi-bin/connections.cgi +++ b/html/cgi-bin/connections.cgi @@ -89,6 +89,9 @@ my @routes = &General::system_output("ip", "route", "show");
# Find all routes foreach my $intf (keys %interfaces) {
- # Skip empty interfaces
- next if ($intf eq "");
- foreach my $route (grep(/dev ${intf}/, @routes)) { if ($route =~ m/^(\d+.\d+.\d+.\d+/\d+)/) { $networks{$1} = $interfaces{$intf};
This is also an option.
I found throwing away what is empty in the loop was shorter to write.
-Michael
On 7 Dec 2024, at 23:56, Bernhard Bitsch bbitsch@ipfire.org wrote:
If %interfaces contains defined interfaces only, this is not necessary.
For blue and orange interfaces this can be done by
my %interfaces = ( $settings{'GREEN_DEV'} => ${Header::colourgreen},
# IPsec "gre[0-9]+" => ${Header::colourvpn}, "vti[0-9]+" => ${Header::colourvpn},
# OpenVPN "tun[0-9]+" => ${Header::colourovpn}, );
# BLUE interface if ($settings{BLUE_DEV} ne "") { $interfaces{$settings{'BLUE_DEV'} } = ${Header::colourblue}; }
#ORANGE interface if ($settings{ORANGE_DEV} ne "") { $interfaces{$settings{'ORANGE_DEV'} }= ${Header::colourorange}; }
For VPN this has to be adapted.
Reviewed-by-: Bernhard Bitsch bbitsch@ipfire.org
Am 06.12.2024 um 17:44 schrieb Michael Tremer:
Parsing any custom routes for any custom interfaces was broken so that arbitrary routes were imported when not all interfaces were in use. Signed-off-by: Michael Tremer michael.tremer@ipfire.org
html/cgi-bin/connections.cgi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/html/cgi-bin/connections.cgi b/html/cgi-bin/connections.cgi index af375effe..705118576 100644 --- a/html/cgi-bin/connections.cgi +++ b/html/cgi-bin/connections.cgi @@ -89,6 +89,9 @@ my @routes = &General::system_output("ip", "route", "show"); # Find all routes foreach my $intf (keys %interfaces) {
- # Skip empty interfaces
- next if ($intf eq "");
- foreach my $route (grep(/dev ${intf}/, @routes)) { if ($route =~ m/^(\d+.\d+.\d+.\d+/\d+)/) { $networks{$1} = $interfaces{$intf};
Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- html/cgi-bin/connections.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/html/cgi-bin/connections.cgi b/html/cgi-bin/connections.cgi index 705118576..7286f9b46 100644 --- a/html/cgi-bin/connections.cgi +++ b/html/cgi-bin/connections.cgi @@ -116,13 +116,13 @@ if (-e "/var/ipfire/wireguard/peers") { &General::readhasharray("/var/ipfire/wireguard/peers", %wgpeers);
foreach my $key (keys %wgpeers) { - my $networks = $wgpeers{$key}[6]; + my $networks = $wgpeers{$key}[8];
# Split the string my @networks = split(/|/, $networks);
foreach my $network (@networks) { - $networks[$network] = ${Header::colourwg}; + $networks{$network} = ${Header::colourwg}; } } }
Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- html/cgi-bin/connections.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/cgi-bin/connections.cgi b/html/cgi-bin/connections.cgi index 7286f9b46..80cb4bb69 100644 --- a/html/cgi-bin/connections.cgi +++ b/html/cgi-bin/connections.cgi @@ -476,7 +476,7 @@ sub ipcolour($) {
foreach my $network (@networks) { if (defined $network) { - if (&Network::check_ip_address_and_netmask($network)) { + if (&Network::check_subnet($network)) { if (&Network::ip_address_in_network($address, $network)) { return $networks{$network}; }
Reviewed-by: Bernhard Bitsch bbitsch@ipfire.org
Am 06.12.2024 um 17:44 schrieb Michael Tremer:
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
html/cgi-bin/connections.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/cgi-bin/connections.cgi b/html/cgi-bin/connections.cgi index badc1f395..af375effe 100644 --- a/html/cgi-bin/connections.cgi +++ b/html/cgi-bin/connections.cgi @@ -439,7 +439,7 @@ foreach my $line (<CONNTRACK>) { </a> $dport_extra </td>
<td style='text-align:center; background-color:$sip_colour;'>
<td style='text-align:center; background-color:$dip_colour;'> <a href='country.cgi#$dstccode'><img src='$dst_flag_icon' border='0' align='absmiddle' alt='$dstccode' title='$dstccode' /></a>
</td> <td class="text-right">