Hi devĀ“s, have found an unexpected error with this patch. Need to investigate it further. PLEASE DO NOT MERGE THIS.
Best,
Erik
Am Mittwoch, den 05.12.2018, 08:14 +0100 schrieb Erik Kapfer:
Fixes #11823
Patches enables CIDR and dotted-decimal notation for "OpenVPN subnet:" entries in "Global settings". network-functions.pl has been introduced.
Signed-off-by: Erik Kapfer erik.kapfer@ipfire.org
html/cgi-bin/ovpnmain.cgi | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 976300fc7..6e57a4991 100644 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -32,6 +32,7 @@ use strict; use Archive::Zip qw(:ERROR_CODES :CONSTANTS); use Sort::Naturally; require '/var/ipfire/general-functions.pl'; +require '/var/ipfire/network-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; require "${General::swroot}/countries.pl"; @@ -245,6 +246,7 @@ sub pkiconfigcheck sub writeserverconf { my %sovpnsettings = (); my @temp = ();
- my @tempovpnsubnet = (); &General::readhash("${General::swroot}/ovpn/settings",
%sovpnsettings); &read_routepushfile;
@@ -267,8 +269,16 @@ sub writeserverconf { print CONF "cert ${General::swroot}/ovpn/certs/servercert.pem\n"; print CONF "key ${General::swroot}/ovpn/certs/serverkey.pem\n"; print CONF "dh ${General::swroot}/ovpn/ca/$cgiparams{'DH_NAME'}\n";
- my @tempovpnsubnet = split("/",$sovpnsettings{'DOVPN_SUBNET'});
- print CONF "server $tempovpnsubnet[0] $tempovpnsubnet[1]\n";
- # ovpn subnet calculate prefix to netmask if needed
- if ($sovpnsettings{'DOVPN_SUBNET'} ne '') {
my ($ip,$subnet) =
split(///,"$vpnsettings{'DOVPN_SUBNET'}");
if (&Network::check_prefix($subnet)) {
$subnet = &Network::convert_prefix2netmask($subnet);
print CONF "server $ip $subnet\n";
} else {
print CONF "server $ip $subnet\n";
}
- } #print CONF "push "route $netsettings{'GREEN_NETADDRESS'}
$netsettings{'GREEN_NETMASK'}"\n";
# Check if we are using mssfix, fragment and set the corretct
mtu of 1500.