summaryrefslogtreecommitdiffstats
path: root/dhcp_wizard
diff options
context:
space:
mode:
Diffstat (limited to 'dhcp_wizard')
-rwxr-xr-xdhcp_wizard/Dhcp.pm22
1 files changed, 12 insertions, 10 deletions
diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm
index 6aa67a38..7bf306c6 100755
--- a/dhcp_wizard/Dhcp.pm
+++ b/dhcp_wizard/Dhcp.pm
@@ -74,23 +74,23 @@ $o->{pages} = {
next => 'summary'
},
dhcp_warning => {
- name => N('Warning'),
- data => [ { label => N('You are in dhcp, server may not work with your configuration.') } ],
+ name => N('Warning') . "\n\n" . N('You are in dhcp, server may not work with your configuration.'),
+ ignore => 1,
next => 'ip_range'
},
ip_range_error => {
- name => N('Error'),
- data => [ { label => N('The IP range specified is not correct.') } ],
+ name => N('Error') . "\n\n" . N('The IP range specified is not correct.'),
+ ignore => 1,
next => 'ip_range'
},
ip_range_warning => {
- name => N('Warning'),
- data => [ { label => N('The IP range specified is not in server address range.') } ],
+ name => N('Warning') . "\n\n" . N('The IP range specified is not in server address range.'),
+ ignore => 1,
next => 'summary'
},
server_in_range => {
- name => N('Error'),
- data => [ { label => N('The IP of the server must not be in range.') } ],
+ name => N('Error') . "\n\n" . N('The IP of the server must not be in range.'),
+ ignore => 1,
next => 'ip_range'
},
summary => {
@@ -104,8 +104,7 @@ $o->{pages} = {
next => 'end'
},
end => {
- name => N('Congratulations'),
- data => [ { label => N('The wizard successfully configured the DHCP services of your server.') } ],
+ name => N('Congratulations') . "\n\n" . N('The wizard successfully configured the DHCP services of your server.'),
end => 1,
next => 0
},
@@ -128,8 +127,11 @@ sub compute_range2 {
}
sub check {
+ my $check_ip = sub { return 0 if ($_[0] < 0 || $_[0] > 255); 1 };
my $r1_trunc = "$1.$2.$3" if $o->{var}{ip1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
+ foreach ($1, $2, $3, $4) { $check_ip->($_) or return 'ip_range_error' }
my $r2_trunc = "$1.$2.$3" if $o->{var}{ip2} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
+ foreach ($1, $2, $3, $4) { $check_ip->($_) or return 'ip_range_error' }
my $d1 = "$4" if $o->{var}{ip1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $d2 = "$4" if $o->{var}{ip2} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $s_trunc = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;