summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-02-28 17:27:45 +0000
committerOlivier Blin <oblin@mandriva.org>2005-02-28 17:27:45 +0000
commit98bd08f67e91821bebbbce286edc364b4d2343d1 (patch)
tree6d2dfa31412cc767e94384a4a903ef7e65d32b05 /perl-install
parent515e40ffa6b4944118e7d60534b2f52f808d91a9 (diff)
downloaddrakx-backup-do-not-use-98bd08f67e91821bebbbce286edc364b4d2343d1.tar
drakx-backup-do-not-use-98bd08f67e91821bebbbce286edc364b4d2343d1.tar.gz
drakx-backup-do-not-use-98bd08f67e91821bebbbce286edc364b4d2343d1.tar.bz2
drakx-backup-do-not-use-98bd08f67e91821bebbbce286edc364b4d2343d1.tar.xz
drakx-backup-do-not-use-98bd08f67e91821bebbbce286edc364b4d2343d1.zip
enhance "wrong network mask format" message (#10712)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/network/netconnect.pm15
-rwxr-xr-xperl-install/standalone/drakconnect19
2 files changed, 20 insertions, 14 deletions
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index b888255d5..77253ef51 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -89,7 +89,7 @@ sub real_main {
my ($isdn, $isdn_name, $isdn_type, %isdn_cards, @isdn_dial_methods);
my $my_isdn = join('', N("Manual choice"), " (", N("Internal ISDN card"), ")");
my ($ndiswrapper_driver, $ndiswrapper_inf_file);
- my ($module, $auto_ip, $protocol, $onboot, $needhostname, $peerdns, $peeryp, $peerntpd, $hotplug, $track_network_id, @fields); # lan config
+ my ($module, $auto_ip, $protocol, $onboot, $needhostname, $peerdns, $peeryp, $peerntpd, $hotplug, $track_network_id); # lan config
my $success = 1;
my $ethntf = {};
my $db_path = "/usr/share/apps/kppp/Provider";
@@ -1000,7 +1000,6 @@ Do you really want to reconfigure this device?"),
delete $ethntf->{NETWORK};
delete $ethntf->{BROADCAST};
delete $ethntf->{TYPE} if $netcnx->{type} ne 'adsl' || !member($adsl_type, qw(manual dhcp));
- @fields = qw(IPADDR NETMASK);
$netc->{dhcp_client} ||= (find { -x "$::prefix/sbin/$_" } qw(dhclient dhcpcd pump dhcpxd)) || "dhcp-client";
$netc->{dhcp_client} = "dhcp-client" if $netc->{dhcp_client} eq "dhclient";
},
@@ -1040,18 +1039,22 @@ notation (for example, 1.2.3.4).")),
$ethntf->{BOOTPROTO} = $auto_ip ? "dhcp" : "static";
$netc->{DHCP} = $auto_ip;
return 0 if $auto_ip;
- if (my @bad = map_index { if_(!is_ip($ethntf->{$_}), $::i) } @fields) {
+ if (!is_ip($ethntf->{IPADDR})) {
$in->ask_warn(N("Error"), N("IP address should be in format 1.2.3.4"));
- return 1, $bad[0];
+ return 1, 0;
+ }
+ if (!is_ip($ethntf->{NETMASK})) {
+ $in->ask_warn(N("Error"), N("Netmask address should be in format 255.255.224.0"));
+ return 1, 1;
}
if (is_ip_forbidden($ethntf->{IPADDR})) {
$in->ask_warn(N("Error"), N("Warning: IP address %s is usually reserved!", $ethntf->{IPADDR}));
- return 1;
+ return 1, 0;
}
#- test if IP address is already used (do not test for sagem DSL devices since it may use many ifcfg files)
if ($ntf_name ne "sagem" && find { $_->{DEVICE} ne $ethntf->{DEVICE} && $_->{IPADDR} eq $ethntf->{IPADDR} } values %$intf) {
$in->ask_warn(N("Error"), N("%s already in use\n", $ethntf->{IPADDR}));
- return 1;
+ return 1, 0;
}
},
focus_out => sub {
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect
index 7c0bb908a..0e02f2e4d 100755
--- a/perl-install/standalone/drakconnect
+++ b/perl-install/standalone/drakconnect
@@ -646,19 +646,22 @@ sub save_notebook {
$intf->{BOOTPROTO} = { reverse %{$proto->{protocols}} }->{$proto->get_text};
}
if ($intf->{BOOTPROTO} eq 'static') {
- check_field($intf, 'IPADDR', 'NETMASK') or $in->ask_warn(N("Error"), N("IP address should be in format 1.2.3.4")) and return 0;
+ if (!is_ip($intf->{IPADDR})) {
+ $in->ask_warn(N("Error"), N("IP address should be in format 1.2.3.4"));
+ return 0;
+ }
+ if (!is_ip($intf->{NETMASK})) {
+ $in->ask_warn(N("Error"), N("Netmask address should be in format 255.255.224.0"));
+ return 0;
+ }
}
- if ($netc->{GATEWAY}) {
- check_field($netc, 'GATEWAY') or $in->ask_warn(N("Error"), N("Gateway address should be in format 1.2.3.4")) and return 0;
+ if ($netc->{GATEWAY} && !is_ip($netc->{GATEWAY})) {
+ $in->ask_warn(N("Error"), N("Gateway address should be in format 1.2.3.4"));
+ return 0;
}
1;
}
-sub check_field {
- my ($field, @ip) = @_;
- (map { if_(!is_ip($field->{$_}), 1) } @ip) ? 0 : 1;
-}
-
sub add_intf() {
$::isWizard = 1;
network::netconnect::main($netcnx, $in, $modules_conf, $netc, undef, $intf);