From 98bd08f67e91821bebbbce286edc364b4d2343d1 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 28 Feb 2005 17:27:45 +0000 Subject: enhance "wrong network mask format" message (#10712) --- perl-install/standalone/drakconnect | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'perl-install/standalone/drakconnect') 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); -- cgit v1.2.1