1 |
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 |
2 |
--- e-smith-base-4.18.0/root/usr/lib/perl5/site_perl/esmith/console/configure.pm 2007-04-27 15:09:31.000000000 -0400 |
3 |
+++ 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 |
4 |
@@ -6,7 +6,7 @@ |
5 |
use esmith::util::network qw(:all); |
6 |
use esmith::db; |
7 |
use esmith::ethernet; |
8 |
-use Net::IPv4Addr qw(ipv4_network); |
9 |
+use Net::IPv4Addr qw(:all); |
10 |
|
11 |
our @adapters; |
12 |
our $console; |
13 |
@@ -1096,26 +1096,33 @@ |
14 |
|
15 |
goto STATIC_NETMASK unless ($rc == 0); |
16 |
|
17 |
- if ($choice) |
18 |
+ $choice ||= ''; |
19 |
+ my $error = undef; |
20 |
+ if (!isValidIP($choice)) |
21 |
{ |
22 |
- if (isValidIP($choice) ) |
23 |
- { |
24 |
- $db->set_value('GatewayIP', cleanIP($choice)); |
25 |
- goto OTHER_PARAMETERS; |
26 |
- } |
27 |
+ $error = "not a valid IP address"; |
28 |
} |
29 |
- else |
30 |
+ elsif (cleanIP($choice) eq $db->get_value('ExternalIP')) |
31 |
{ |
32 |
- $choice = ''; |
33 |
+ $error = "address matches external interface address"; |
34 |
} |
35 |
+ elsif (!ipv4_in_network($db->get_value('ExternalIP'), |
36 |
+ $db->get_value('ExternalNetmask'), "$choice/32")) |
37 |
+ { |
38 |
+ $error = "address is not local"; |
39 |
+ } |
40 |
+ if ($error) |
41 |
+ { |
42 |
+ ($rc, $choice) = $console->tryagain_page |
43 |
+ ( |
44 |
+ title => gettext("Invalid") . " - " . gettext($error), |
45 |
+ choice => $choice, |
46 |
+ ); |
47 |
|
48 |
- ($rc, $choice) = $console->tryagain_page |
49 |
- ( |
50 |
- title => gettext("Invalid gateway IP address"), |
51 |
- choice => $choice, |
52 |
- ); |
53 |
- |
54 |
- goto STATIC_GATEWAY; |
55 |
+ goto STATIC_GATEWAY; |
56 |
+ } |
57 |
+ $db->set_value('GatewayIP', cleanIP($choice)); |
58 |
+ goto OTHER_PARAMETERS; |
59 |
} |
60 |
|
61 |
#------------------------------------------------------------ |
62 |
@@ -1702,27 +1709,41 @@ |
63 |
|
64 |
goto SYSTEM_MODE unless ($rc == 0); |
65 |
|
66 |
- if ($choice eq "") |
67 |
+ $choice ||= ''; |
68 |
+ if (!$choice) |
69 |
{ |
70 |
$db->delete('GatewayIP'); |
71 |
$db->set_value('AccessType', 'off'); |
72 |
goto OTHER_PARAMETERS; |
73 |
} |
74 |
|
75 |
- if ( isValidIP($choice) ) |
76 |
+ my $error = undef; |
77 |
+ if (!isValidIP($choice)) |
78 |
{ |
79 |
- $db->set_value('GatewayIP', cleanIP($choice)); |
80 |
- $db->set_value('AccessType', 'dedicated'); |
81 |
- goto OTHER_PARAMETERS; |
82 |
+ $error = "not a valid IP address"; |
83 |
} |
84 |
+ elsif (cleanIP($choice) eq $db->get_value('LocalIP')) |
85 |
+ { |
86 |
+ $error = "address matches local interface address"; |
87 |
+ } |
88 |
+ elsif (!ipv4_in_network($db->get_value('LocalIP'), |
89 |
+ $db->get_value('LocalNetmask'), "$choice/32")) |
90 |
+ { |
91 |
+ $error = "address is not local"; |
92 |
+ } |
93 |
+ if ($error) |
94 |
+ { |
95 |
+ ($rc, $choice) = $console->tryagain_page |
96 |
+ ( |
97 |
+ title => gettext("Invalid") . " - " . gettext($error), |
98 |
+ choice => $choice, |
99 |
+ ); |
100 |
|
101 |
- ($rc, $choice) = $console->tryagain_page |
102 |
- ( |
103 |
- title => gettext("Invalid gateway IP address"), |
104 |
- choice => $choice, |
105 |
- ); |
106 |
- |
107 |
- goto SERVER_ONLY; |
108 |
+ goto SERVER_ONLY; |
109 |
+ } |
110 |
+ $db->set_value('GatewayIP', cleanIP($choice)); |
111 |
+ $db->set_value('AccessType', 'dedicated'); |
112 |
+ goto OTHER_PARAMETERS; |
113 |
} |
114 |
|
115 |
#------------------------------------------------------------ |