* [PATCH 1/4] connections.cgi: Fix colour of destination country
@ 2024-12-06 16:44 Michael Tremer
2024-12-06 16:44 ` [PATCH 2/4] connections.cgi: Ignore empty interfaces Michael Tremer
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Michael Tremer @ 2024-12-06 16:44 UTC (permalink / raw)
To: development
[-- Attachment #1: Type: text/plain, Size: 745 bytes --]
Signed-off-by: Michael Tremer <michael.tremer(a)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">
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/4] connections.cgi: Ignore empty interfaces
2024-12-06 16:44 [PATCH 1/4] connections.cgi: Fix colour of destination country Michael Tremer
@ 2024-12-06 16:44 ` Michael Tremer
2024-12-07 23:56 ` Bernhard Bitsch
2024-12-06 16:44 ` [PATCH 3/4] connections.cgi: Fix importing Wireguard peers Michael Tremer
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Michael Tremer @ 2024-12-06 16:44 UTC (permalink / raw)
To: development
[-- Attachment #1: Type: text/plain, Size: 800 bytes --]
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(a)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};
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/4] connections.cgi: Fix importing Wireguard peers
2024-12-06 16:44 [PATCH 1/4] connections.cgi: Fix colour of destination country Michael Tremer
2024-12-06 16:44 ` [PATCH 2/4] connections.cgi: Ignore empty interfaces Michael Tremer
@ 2024-12-06 16:44 ` Michael Tremer
2024-12-06 16:44 ` [PATCH 4/4] connections.cgi: Support CIDR notation Michael Tremer
2024-12-06 22:09 ` [PATCH 1/4] connections.cgi: Fix colour of destination country Bernhard Bitsch
3 siblings, 0 replies; 7+ messages in thread
From: Michael Tremer @ 2024-12-06 16:44 UTC (permalink / raw)
To: development
[-- Attachment #1: Type: text/plain, Size: 796 bytes --]
Signed-off-by: Michael Tremer <michael.tremer(a)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};
}
}
}
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/4] connections.cgi: Support CIDR notation
2024-12-06 16:44 [PATCH 1/4] connections.cgi: Fix colour of destination country Michael Tremer
2024-12-06 16:44 ` [PATCH 2/4] connections.cgi: Ignore empty interfaces Michael Tremer
2024-12-06 16:44 ` [PATCH 3/4] connections.cgi: Fix importing Wireguard peers Michael Tremer
@ 2024-12-06 16:44 ` Michael Tremer
2024-12-06 22:09 ` [PATCH 1/4] connections.cgi: Fix colour of destination country Bernhard Bitsch
3 siblings, 0 replies; 7+ messages in thread
From: Michael Tremer @ 2024-12-06 16:44 UTC (permalink / raw)
To: development
[-- Attachment #1: Type: text/plain, Size: 650 bytes --]
Signed-off-by: Michael Tremer <michael.tremer(a)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};
}
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] connections.cgi: Fix colour of destination country
2024-12-06 16:44 [PATCH 1/4] connections.cgi: Fix colour of destination country Michael Tremer
` (2 preceding siblings ...)
2024-12-06 16:44 ` [PATCH 4/4] connections.cgi: Support CIDR notation Michael Tremer
@ 2024-12-06 22:09 ` Bernhard Bitsch
3 siblings, 0 replies; 7+ messages in thread
From: Bernhard Bitsch @ 2024-12-06 22:09 UTC (permalink / raw)
To: development
[-- Attachment #1: Type: text/plain, Size: 879 bytes --]
Reviewed-by: Bernhard Bitsch <bbitsch(a)ipfire.org>
Am 06.12.2024 um 17:44 schrieb Michael Tremer:
> Signed-off-by: Michael Tremer <michael.tremer(a)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">
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/4] connections.cgi: Ignore empty interfaces
2024-12-06 16:44 ` [PATCH 2/4] connections.cgi: Ignore empty interfaces Michael Tremer
@ 2024-12-07 23:56 ` Bernhard Bitsch
2024-12-09 11:30 ` Michael Tremer
0 siblings, 1 reply; 7+ messages in thread
From: Bernhard Bitsch @ 2024-12-07 23:56 UTC (permalink / raw)
To: development
[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]
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(a)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(a)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};
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/4] connections.cgi: Ignore empty interfaces
2024-12-07 23:56 ` Bernhard Bitsch
@ 2024-12-09 11:30 ` Michael Tremer
0 siblings, 0 replies; 7+ messages in thread
From: Michael Tremer @ 2024-12-09 11:30 UTC (permalink / raw)
To: development
[-- Attachment #1: Type: text/plain, Size: 1880 bytes --]
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(a)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(a)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(a)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};
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-12-09 11:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-06 16:44 [PATCH 1/4] connections.cgi: Fix colour of destination country Michael Tremer
2024-12-06 16:44 ` [PATCH 2/4] connections.cgi: Ignore empty interfaces Michael Tremer
2024-12-07 23:56 ` Bernhard Bitsch
2024-12-09 11:30 ` Michael Tremer
2024-12-06 16:44 ` [PATCH 3/4] connections.cgi: Fix importing Wireguard peers Michael Tremer
2024-12-06 16:44 ` [PATCH 4/4] connections.cgi: Support CIDR notation Michael Tremer
2024-12-06 22:09 ` [PATCH 1/4] connections.cgi: Fix colour of destination country Bernhard Bitsch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox