Revision: 6010 http://ipcop.svn.sourceforge.net/ipcop/?rev=6010&view=rev Author: owes Date: 2011-10-31 07:46:48 +0000 (Mon, 31 Oct 2011) Log Message: ----------- Add OpenVPN network into proxy.pac
Modified Paths: -------------- ipcop/trunk/html/cgi-bin/proxy.cgi Modified: ipcop/trunk/html/cgi-bin/proxy.cgi =================================================================== --- ipcop/trunk/html/cgi-bin/proxy.cgi 2011-10-30 21:01:02 UTC (rev 6009) +++ ipcop/trunk/html/cgi-bin/proxy.cgi 2011-10-31 07:46:48 UTC (rev 6010) @@ -44,6 +44,7 @@ my %proxysettings=(); my %netsettings=(); my %ovpnsettings=(); +my $ovpnactive = 0; my %filtersettings=(); my %updaccelsettings=(); my %stdproxysettings=(); @@ -238,6 +239,11 @@ &General::readhash("/var/ipcop/main/settings", \%mainsettings); if (-e "/var/ipcop/openvpn/settings") { &General::readhash("/var/ipcop/openvpn/settings", \%ovpnsettings); + + if ((defined($ovpnsettings{'ENABLED_RED_1'}) && $ovpnsettings{'ENABLED_RED_1'} eq 'on') + || (defined($ovpnsettings{'ENABLED_BLUE_1'}) && $ovpnsettings{'ENABLED_BLUE_1'} eq 'on')) { + $ovpnactive = 1; + } } $https_port = $mainsettings{'GUIPORT'} if (defined($mainsettings{'GUIPORT'})); @@ -1006,8 +1012,7 @@ print "<td class='base'>$Lang::tr{'transparent on'} <span class='ipcop_iface_blue' style='font-weight: bold;'>$Lang::tr{'blue'}</span>:</td>"; print "<td><input type='checkbox' name='TRANSPARENT_BLUE_1' $checked{'TRANSPARENT_BLUE_1'}{'on'} /></td></tr>"; } -if ((defined($ovpnsettings{'ENABLED_RED_1'}) && $ovpnsettings{'ENABLED_RED_1'} eq 'on') - || (defined($ovpnsettings{'ENABLED_BLUE_1'}) && $ovpnsettings{'ENABLED_BLUE_1'} eq 'on')) { +if ($ovpnactive) { print "<tr><td class='base'>$Lang::tr{'enabled on'} <span class='ipcop_iface_ovpn' style='font-weight: bold;'>OpenVPN</span>:</td>"; print "<td><input type='checkbox' name='ENABLED_OVPN' $checked{'ENABLED_OVPN'}{'on'} /></td>"; print "<td class='base'>$Lang::tr{'transparent on'} <span class='ipcop_iface_ovpn' style='font-weight: bold;'>OpenVPN</span>:</td>"; @@ -2832,9 +2837,7 @@ print FILE $proxysettings{'SRC_SUBNETS'}; } - if (($proxysettings{'ENABLED_OVPN'} eq 'on') && - ((defined($ovpnsettings{'ENABLED_RED_1'}) && $ovpnsettings{'ENABLED_RED_1'} eq 'on') - || (defined($ovpnsettings{'ENABLED_BLUE_1'}) && $ovpnsettings{'ENABLED_BLUE_1'} eq 'on'))) { + if (($proxysettings{'ENABLED_OVPN'} eq 'on') && $ovpnactive) { print FILE NetAddr::IP->new("$ovpnsettings{'DOVPN_SUBNET'}")."\n"; } close(FILE); @@ -3107,7 +3110,7 @@ flock(FILE, 2); print FILE "function FindProxyForURL(url, host)\n{\n"; - if (($proxysettings{'ENABLED_GREEN_1'} eq 'on') || ($proxysettings{'ENABLED_BLUE_1'} eq 'on')) { + if (($proxysettings{'ENABLED_GREEN_1'} eq 'on') || ($proxysettings{'ENABLED_BLUE_1'} eq 'on') || ($proxysettings{'ENABLED_OVPN'} eq 'on')) { print FILE <<END // URL without dots if (isPlainHostName(host)) @@ -3129,6 +3132,18 @@ return "DIRECT"; END ; + if ($ovpnactive && ($proxysettings{'ENABLED_OVPN'} eq 'on')) { + my $ovpnnet = NetAddr::IP->new($ovpnsettings{'DOVPN_SUBNET'})->network()->addr(); + my $ovpnmask = NetAddr::IP->new($ovpnsettings{'DOVPN_SUBNET'})->mask(); + my $serverip = NetAddr::IP->new($ovpnsettings{'DOVPN_SUBNET'})->first()->addr(); + print FILE <<END + + // OpenVPN Network + else if (isInNet(myIpAddress(), "$ovpnnet", "$ovpnmask)) + return "PROXY $serverip:$proxysettings{'PROXY_PORT'}"; +END + ; + } if (($netsettings{'BLUE_COUNT'} >= 1) && ($proxysettings{'ENABLED_BLUE_1'} eq 'on')) { print FILE <<END This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Get your Android app more play: Bring it to the BlackBerry PlayBook in minutes. BlackBerry App World™ now supports Android™ Apps for the BlackBerry® PlayBook™. Discover just how easy and simple it is! http://p.sf.net/sfu/android-dev2dev _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn