diff -Nur -x '*.orig' -x '*.rej' e-smith-base-4.18.0/root/usr/lib/perl5/site_perl/esmith/console/configure.pm mezzanine_patched_e-smith-base-4.18.0/root/usr/lib/perl5/site_perl/esmith/console/configure.pm --- e-smith-base-4.18.0/root/usr/lib/perl5/site_perl/esmith/console/configure.pm 2007-04-27 15:09:31.000000000 -0400 +++ mezzanine_patched_e-smith-base-4.18.0/root/usr/lib/perl5/site_perl/esmith/console/configure.pm 2007-04-27 15:08:19.000000000 -0400 @@ -6,7 +6,7 @@ use esmith::util::network qw(:all); use esmith::db; use esmith::ethernet; -use Net::IPv4Addr qw(ipv4_network); +use Net::IPv4Addr qw(:all); our @adapters; our $console; @@ -1096,26 +1096,33 @@ goto STATIC_NETMASK unless ($rc == 0); - if ($choice) + $choice ||= ''; + my $error = undef; + if (!isValidIP($choice)) { - if (isValidIP($choice) ) - { - $db->set_value('GatewayIP', cleanIP($choice)); - goto OTHER_PARAMETERS; - } + $error = "not a valid IP address"; } - else + elsif (cleanIP($choice) eq $db->get_value('ExternalIP')) { - $choice = ''; + $error = "address matches external interface address"; } + elsif (!ipv4_in_network($db->get_value('ExternalIP'), + $db->get_value('ExternalNetmask'), "$choice/32")) + { + $error = "address is not local"; + } + if ($error) + { + ($rc, $choice) = $console->tryagain_page + ( + title => gettext("Invalid") . " - " . gettext($error), + choice => $choice, + ); - ($rc, $choice) = $console->tryagain_page - ( - title => gettext("Invalid gateway IP address"), - choice => $choice, - ); - - goto STATIC_GATEWAY; + goto STATIC_GATEWAY; + } + $db->set_value('GatewayIP', cleanIP($choice)); + goto OTHER_PARAMETERS; } #------------------------------------------------------------ @@ -1702,27 +1709,41 @@ goto SYSTEM_MODE unless ($rc == 0); - if ($choice eq "") + $choice ||= ''; + if (!$choice) { $db->delete('GatewayIP'); $db->set_value('AccessType', 'off'); goto OTHER_PARAMETERS; } - if ( isValidIP($choice) ) + my $error = undef; + if (!isValidIP($choice)) { - $db->set_value('GatewayIP', cleanIP($choice)); - $db->set_value('AccessType', 'dedicated'); - goto OTHER_PARAMETERS; + $error = "not a valid IP address"; } + elsif (cleanIP($choice) eq $db->get_value('LocalIP')) + { + $error = "address matches local interface address"; + } + elsif (!ipv4_in_network($db->get_value('LocalIP'), + $db->get_value('LocalNetmask'), "$choice/32")) + { + $error = "address is not local"; + } + if ($error) + { + ($rc, $choice) = $console->tryagain_page + ( + title => gettext("Invalid") . " - " . gettext($error), + choice => $choice, + ); - ($rc, $choice) = $console->tryagain_page - ( - title => gettext("Invalid gateway IP address"), - choice => $choice, - ); - - goto SERVER_ONLY; + goto SERVER_ONLY; + } + $db->set_value('GatewayIP', cleanIP($choice)); + $db->set_value('AccessType', 'dedicated'); + goto OTHER_PARAMETERS; } #------------------------------------------------------------