From: Michael Tremer Date: Thu, 5 Aug 2021 13:28:31 +0000 (+0000) Subject: proxy.cgi: Support running proxy without GREEN X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ee4b5bbb2dc396ad323e3c1053b3c9d334f73a8b;p=people%2Fms%2Fipfire-2.x.git proxy.cgi: Support running proxy without GREEN Signed-off-by: Michael Tremer Signed-off-by: Arne Fitzenreiter --- diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi index 1b949d5b68..b973a8ff75 100644 --- a/html/cgi-bin/proxy.cgi +++ b/html/cgi-bin/proxy.cgi @@ -166,7 +166,11 @@ my $HAVE_NTLM_AUTH = (-e "/usr/bin/ntlm_auth"); &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -my $green_cidr = &General::ipcidr("$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}"); +my $green_cidr = ""; +if (&Header::green_used() && $netsettings{'GREEN_DEV'}) { + $green_cidr = &General::ipcidr("$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}"); +} + my $blue_cidr = ""; if (&Header::blue_used() && $netsettings{'BLUE_DEV'}) { $blue_cidr = &General::ipcidr("$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}"); @@ -1191,9 +1195,11 @@ END if (!$proxysettings{'SRC_SUBNETS'}) { - print "$green_cidr\n"; - if ($netsettings{'BLUE_DEV'}) - { + if (&Header::green_used()) { + print "$green_cidr\n"; + } + + if (&Header::blue_used()) { print "$blue_cidr\n"; } } else { print $proxysettings{'SRC_SUBNETS'}; } @@ -1798,8 +1804,11 @@ print <${General::swroot}/proxy/cachemgr.conf"); flock(FILE, 2); - print FILE "$netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}\n"; + if (&Header::green_used()) { + print FILE "$netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}\n"; + } print FILE "localhost"; close(FILE); return;