proxy: Skip VPNs that route everything for proxy.pac

Message ID 20230324154922.276520-1-michael.tremer@ipfire.org
State Accepted
Commit 80c04308dee1beb95f3df4ceb817b4006d016dd4
Headers
Series proxy: Skip VPNs that route everything for proxy.pac |

Commit Message

Michael Tremer March 24, 2023, 3:49 p.m. UTC
  The function tries to figure out which networks are connected locally,
but VPN tunnels that use 0.0.0.0 and GRE/VTI interfaces will be
considered local and the proxy is being disabled for everyone.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 html/cgi-bin/proxy.cgi | 3 +++
 1 file changed, 3 insertions(+)
  

Patch

diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi
index a718d5771..71be315f6 100644
--- a/html/cgi-bin/proxy.cgi
+++ b/html/cgi-bin/proxy.cgi
@@ -2986,6 +2986,7 @@  END
 			foreach my $network (@networks) {
 				my ($vpnip, $vpnsub) = split("/", $network);
 				$vpnsub = &Network::convert_prefix2netmask($vpnsub) || $vpnsub;
+				next if ($vpnip eq "0.0.0.0" || $vpnsub eq "0.0.0.0");
 				print FILE "     (isInNet(host, \"$vpnip\", \"$vpnsub\")) ||\n";
 			}
 		}
@@ -2996,6 +2997,8 @@  END
 			my @networks = split(/\|/, $ovpnconfig{$key}[11]);
 			foreach my $network (@networks) {
 				my ($vpnip, $vpnsub) = split("/", $network);
+				$vpnsub = &Network::convert_prefix2netmask($vpnsub) || $vpnsub;
+				next if ($vpnip eq "0.0.0.0" || $vpnsub eq "0.0.0.0");
 				print FILE "     (isInNet(host, \"$vpnip\", \"$vpnsub\")) ||\n";
 			}
 		}