diff -Nur e-smith-base-5.6.0.old/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm e-smith-base-5.6.0/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm --- e-smith-base-5.6.0.old/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm 2014-04-23 19:37:18.174222615 +0200 +++ e-smith-base-5.6.0/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm 2014-04-23 19:37:32.655052739 +0200 @@ -7,6 +7,8 @@ use esmith::db; use esmith::ethernet; use Net::IPv4Addr qw(:all); +use Socket qw( inet_aton ); + our @adapters; our $console; @@ -1851,7 +1853,7 @@ ( title => gettext("Select end of DHCP host number range"), text => - gettext("Please enter the last host address in this range. If you are using the standard server defaults and have no particular preference, you should keep the default value."), + gettext("Please enter the last host address in this range. If you are using the standard server defaults and have no particular preference, you should keep the default value. Think to add enough ip for pptp sessions."), value => $serverEnd ); @@ -1861,6 +1863,12 @@ { if ( isValidIP($choice) ) { + # retrieve values to verifiy if ip_count > pptp_sessions + my $ip_start = unpack 'N', inet_aton($serverStart); + my $ip_end = unpack 'N', inet_aton($choice); + my $ip_count = $ip_end - $ip_start; + my $pptp_sessions = $db->get_prop('pptpd','sessions'); + my $dhcp_net = ipv4_network($choice, $priv_mask); if ($dhcp_net eq $priv_net) { @@ -1871,8 +1879,8 @@ # beginning. if (cmpIP($serverStart, $choice) < 0) { - if ((cmpIP($priv_ip, $serverStart) < 0) || - (cmpIP($choice, $priv_ip) < 0)) + if (((cmpIP($priv_ip, $serverStart) < 0) || + (cmpIP($choice, $priv_ip) < 0)) && ($ip_count > $pptp_sessions)) { # need to check for valid range as well. unless ($choice eq $serverEnd) @@ -1881,6 +1889,13 @@ } goto DNS_FORWARDER; } + # We want to verify that the number of pptp_IP reserved is not superior + # than the number of dhcp_IP set in the range + elsif ($ip_count <= $pptp_sessions) + { + $errmsg = gettext("There is not enough IP in the range to include all your pptp sessions"); + $choice = $pptp_sessions . ' allowed pptp clients'; + } else { $errmsg = gettext("The IP range cannot include our private network address.");