1 |
stephdl |
1.1 |
diff -Nur e-smith-base-5.2.0-old/root/usr/lib/perl5/site_perl/esmith/console/configure.pm e-smith-base-5.2.0/root/usr/lib/perl5/site_perl/esmith/console/configure.pm |
2 |
|
|
--- e-smith-base-5.2.0-old/root/usr/lib/perl5/site_perl/esmith/console/configure.pm 2014-04-05 17:51:15.298943308 +0200 |
3 |
|
|
+++ e-smith-base-5.2.0/root/usr/lib/perl5/site_perl/esmith/console/configure.pm 2014-04-23 20:03:03.596637563 +0200 |
4 |
|
|
@@ -7,6 +7,7 @@ |
5 |
|
|
use esmith::db; |
6 |
|
|
use esmith::ethernet; |
7 |
|
|
use Net::IPv4Addr qw(:all); |
8 |
|
|
+use Socket qw( inet_aton ); |
9 |
|
|
|
10 |
|
|
our @adapters; |
11 |
|
|
our $console; |
12 |
|
|
@@ -1852,7 +1853,7 @@ |
13 |
|
|
( |
14 |
|
|
title => gettext("Select end of DHCP host number range"), |
15 |
|
|
text => |
16 |
|
|
- 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."), |
17 |
|
|
+ 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."), |
18 |
|
|
value => $serverEnd |
19 |
|
|
); |
20 |
|
|
|
21 |
|
|
@@ -1862,6 +1863,12 @@ |
22 |
|
|
{ |
23 |
|
|
if ( isValidIP($choice) ) |
24 |
|
|
{ |
25 |
|
|
+ # retrieve values to verifiy if ip_count > pptp_sessions |
26 |
|
|
+ my $ip_start = unpack 'N', inet_aton($serverStart); |
27 |
|
|
+ my $ip_end = unpack 'N', inet_aton($choice); |
28 |
|
|
+ my $ip_count = $ip_end - $ip_start; |
29 |
|
|
+ my $pptp_sessions = $db->get_prop('pptpd','sessions'); |
30 |
|
|
+ |
31 |
|
|
my $dhcp_net = ipv4_network($choice, $priv_mask); |
32 |
|
|
if ($dhcp_net eq $priv_net) |
33 |
|
|
{ |
34 |
|
|
@@ -1872,8 +1879,8 @@ |
35 |
|
|
# beginning. |
36 |
|
|
if (cmpIP($serverStart, $choice) < 0) |
37 |
|
|
{ |
38 |
|
|
- if ((cmpIP($priv_ip, $serverStart) < 0) || |
39 |
|
|
- (cmpIP($choice, $priv_ip) < 0)) |
40 |
|
|
+ if (((cmpIP($priv_ip, $serverStart) < 0) || |
41 |
|
|
+ (cmpIP($choice, $priv_ip) < 0)) && ($ip_count > $pptp_sessions)) |
42 |
|
|
{ |
43 |
|
|
# need to check for valid range as well. |
44 |
|
|
unless ($choice eq $serverEnd) |
45 |
|
|
@@ -1882,6 +1889,13 @@ |
46 |
|
|
} |
47 |
|
|
goto DNS_FORWARDER; |
48 |
|
|
} |
49 |
|
|
+ # We want to verify that the number of pptp_IP reserved is not superior |
50 |
|
|
+ # than the number of dhcp_IP set in the range |
51 |
|
|
+ elsif ($ip_count <= $pptp_sessions) |
52 |
|
|
+ { |
53 |
|
|
+ $errmsg = gettext("There is not enough IP in the range to include all your pptp sessions"); |
54 |
|
|
+ $choice = $pptp_sessions . ' allowed pptp clients'; |
55 |
|
|
+ } |
56 |
|
|
else |
57 |
|
|
{ |
58 |
|
|
$errmsg = gettext("The IP range cannot include our private network address."); |