/[smeserver]/rpms/e-smith-base/sme8/e-smith-base-5.2.0-hwaddress.patch
ViewVC logotype

Contents of /rpms/e-smith-base/sme8/e-smith-base-5.2.0-hwaddress.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Fri Feb 5 08:25:18 2010 UTC (14 years, 9 months ago) by dungog
Branch: MAIN
CVS Tags: e-smith-base-5_2_0-34_el5_sme, e-smith-base-5_2_0-32_el5_sme, e-smith-base-5_2_0-30_el5_sme, e-smith-base-5_2_0-67_el5_sme, e-smith-base-5_2_0-14_el5_sme, e-smith-base-5_2_0-71_el5_sme, e-smith-base-5_2_0-52_el5_sme, e-smith-base-5_2_0-51_el5_sme, e-smith-base-5_2_0-53_el5_sme, e-smith-base-5_2_0-68_el5_sme, e-smith-base-5_2_0-77_el5_sme, e-smith-base-5_2_0-21_el5_sme, e-smith-base-5_2_0-26_el5_sme, e-smith-base-5_2_0-59_el5_sme, e-smith-base-5_2_0-36_el5_sme, e-smith-base-5_2_0-56_el5_sme, e-smith-base-5_2_0-55_el5_sme, e-smith-base-5_2_0-78_el5_sme, e-smith-base-5_2_0-86_el5_sme, e-smith-base-5_2_0-76_el5_sme, e-smith-base-5_2_0-84_el5_sme, e-smith-base-5_2_0-38_el5_sme, e-smith-base-5_2_0-65_el5_sme, e-smith-base-5_2_0-88_el5_sme, e-smith-base-5_2_0-64_el5_sme, e-smith-base-5_2_0-47_el5_sme, e-smith-base-5_2_0-81_el5_sme, e-smith-base-5_2_0-82_el5_sme, e-smith-base-5_2_0-50_el5_sme, e-smith-base-5_2_0-57_el5_sme, e-smith-base-5_2_0-15_el5_sme, e-smith-base-5_2_0-89_el5_sme, e-smith-base-5_2_0-49_el5_sme, e-smith-base-5_2_0-90_el5_sme, e-smith-base-5_2_0-48_el5_sme, e-smith-base-5_2_0-33_el5_sme, e-smith-base-5_2_0-87_el5_sme, e-smith-base-5_2_0-80_el5_sme, e-smith-base-5_2_0-16_el5_sme, e-smith-base-5_2_0-28_el5_sme, e-smith-base-5_2_0-24_el5_sme, e-smith-base-5_2_0-70_el5_sme, e-smith-base-5_2_0-66_el5_sme, e-smith-base-5_2_0-63_el5_sme, e-smith-base-5_2_0-17_el5_sme, e-smith-base-5_2_0-41_el5_sme, e-smith-base-5_2_0-42_el5_sme, e-smith-base-5_2_0-61_el5_sme, e-smith-base-5_2_0-19_el5_sme, e-smith-base-5_2_0-60_el5_sme, e-smith-base-5_2_0-58_el5_sme, e-smith-base-5_2_0-20_el5_sme, e-smith-base-5_2_0-31_el5_sme, e-smith-base-5_2_0-45_el5_sme, e-smith-base-5_2_0-46_el5_sme, e-smith-base-5_2_0-29_el5_sme, e-smith-base-5_2_0-85_el5_sme, e-smith-base-5_2_0-69_el5_sme, e-smith-base-5_2_0-79_el5_sme, e-smith-base-5_2_0-27_el5_sme, e-smith-base-5_2_0-72_el5_sme, e-smith-base-5_2_0-75_el5_sme, e-smith-base-5_2_0-22_el5_sme, e-smith-base-5_2_0-73_el5_sme, e-smith-base-5_2_0-54_el5_sme, e-smith-base-5_2_0-37_el5_sme, e-smith-base-5_2_0-43_el5_sme, e-smith-base-5_2_0-44_el5_sme, e-smith-base-5_2_0-62_el5_sme, e-smith-base-5_2_0-25_el5_sme, e-smith-base-5_2_0-74_el5_sme, e-smith-base-5_2_0-35_el5_sme, e-smith-base-5_2_0-83_el5_sme, e-smith-base-5_2_0-23_el5_sme, e-smith-base-5_2_0-18_el5_sme
and the patch

1 diff -uNr e-smith-base-5.2.0/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/10HWADDR e-smith-base-5.2.0-hwaddress/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/10HWADDR
2 --- e-smith-base-5.2.0/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/10HWADDR 1970-01-01 01:00:00.000000000 +0100
3 +++ e-smith-base-5.2.0-hwaddress/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/10HWADDR 2010-01-25 16:07:25.127139939 +0100
4 @@ -0,0 +1,11 @@
5 +{
6 + $OUT = "";
7 + return if ($InternalInterface{Name} eq "bond0");
8 + if ($THIS_DEVICE =~ /^eth[01]$/)
9 + {
10 + $OUT .= "HWADDR=" . (
11 + ($is_internal) ?
12 + $InternalInterface{HWAddress} : $ExternalInterface{HWAddress}
13 + );
14 + }
15 +}
16 diff -uNr e-smith-base-5.2.0/root/usr/lib/perl5/site_perl/esmith/console/configure.pm e-smith-base-5.2.0-hwaddress/root/usr/lib/perl5/site_perl/esmith/console/configure.pm
17 --- e-smith-base-5.2.0/root/usr/lib/perl5/site_perl/esmith/console/configure.pm 2010-01-25 16:45:28.248772290 +0100
18 +++ e-smith-base-5.2.0-hwaddress/root/usr/lib/perl5/site_perl/esmith/console/configure.pm 2010-01-25 17:20:01.498833247 +0100
19 @@ -51,50 +51,52 @@
20 {
21 # We'll use a VLAN on eth0 for the "dedicated" WAN link
22 $db->set_value("EthernetDriver2", "unknown");
23 + $db->set_prop("ExternalInterface", "HWAddress", "");
24 return 'CHANGE';
25 }
26 # Internal, and there's only one
27 - my (undef, $driver, undef) = split (/\s+/, $adapters[0], 3);
28 + my (undef, $driver, $hwaddr, undef) = split (/\s+/, $adapters[0], 4);
29 $db->set_value("EthernetDriver1", $driver);
30 + $db->set_prop("InternalInterface", "HWAddress", $hwaddr);
31 return 'CHANGE';
32 }
33
34 - if (scalar @adapters == 2)
35 - {
36 - my (undef, $driver1, undef) = split (/\s+/, $adapters[0], 3);
37 - my (undef, $driver2, undef) = split (/\s+/, $adapters[1], 3);
38 - if ($driver1 eq $driver2)
39 - {
40 - # Choice is obvious!
41 - $db->set_value($confEntry, $driver1);
42 - return 'CHANGE';
43 - }
44 - }
45 -
46 my %tag2driver;
47 + my %tag2hwaddr;
48 my @args;
49 my $default;
50 + my $existing_hwaddr;
51 + my $skip;
52
53 - my $existing_driver = $db->get_value($confEntry);
54 - my $skip = ($confEntry eq "EthernetDriver2") ? $db->get_value("EthernetDriver1") : '';
55 + if ($ifName eq "external")
56 + {
57 + $skip = $db->get_prop("InternalInterface", "HWAddress");
58 + $existing_hwaddr = $db->get_prop("ExternalInterface", "HWAddress");
59 + }
60 + else
61 + {
62 + $skip = "";
63 + $existing_hwaddr = $db->get_prop("InternalInterface", "HWAddress");
64 + }
65
66 foreach my $adapter ( @adapters )
67 {
68 - my ($parameter, $driver, $chipset) = split (/\s+/, $adapter, 3);
69 + my ($parameter, $driver, $hwaddr, $chipset) = split (/\s+/, $adapter, 4);
70 chomp($chipset);
71
72 my $tag = ++$item . ".";
73
74 $tag2driver{$tag} = $driver;
75 + $tag2hwaddr{$tag} = $hwaddr;
76
77 my $display_name = gettext("Use") . " " . ${driver} . " " .
78 gettext("for chipset") . " " . ${chipset};
79
80 push(@args, $tag, substr($display_name, 0, 65));
81
82 - if ($driver ne $skip)
83 + if ($hwaddr ne $skip)
84 {
85 - $default = $tag if $driver eq $existing_driver;
86 + $default = $tag if $hwaddr eq $existing_hwaddr;
87 $default ||= $tag;
88 }
89 }
90 @@ -106,13 +108,6 @@
91 gettext("external");
92 #--------------------------------------------------------
93
94 - push( @args,
95 - ++$item . ".",
96 - sprintf(gettext("Manually select driver for %s ethernet adapter"),
97 - gettext($ifName)),
98 - );
99 -
100 -
101 my ($rc, $choice) = $console->menu_page
102 (
103 title => sprintf(gettext("Select %s network ethernet driver"),
104 @@ -129,109 +124,17 @@
105
106 return 'CANCEL' unless ($rc == 0);
107
108 - my $newDriver;
109 -
110 - if ( $choice =~ /^${item}/ )
111 - {
112 - $newDriver = ethernetManual($ifName);
113 - return 'CANCEL_MANUAL' if ($newDriver eq 'CANCEL_MANUAL');
114 - }
115 - elsif (defined($tag2driver{$choice}) )
116 - {
117 - $newDriver = $tag2driver{$choice};
118 - }
119 -
120 - if ( $newDriver eq $existing_driver )
121 - {
122 - return 'KEEP';
123 - }
124 + return 'KEEP' if ($tag2hwaddr{$choice} eq $existing_hwaddr);
125
126 - # Try to load the driver before accepting it.
127 - system('/sbin/modprobe', $newDriver) == 0
128 - or return ('NOLOAD', $newDriver);
129 + $db->set_value($confEntry, $tag2driver{$choice});
130 + $db->set_prop(
131 + ($ifName eq "external") ? "ExternalInterface" : "InternalInterface",
132 + "HWAddress", $tag2hwaddr{$choice}
133 + );
134
135 - $db->set_value($confEntry, $newDriver);
136 return 'CHANGE';
137 }
138
139 -#------------------------------------------------------------
140 -# Manually choose Ethernet driver for given adapter
141 -#------------------------------------------------------------
142 -sub ethernetManual($)
143 -{
144 - my ($ifName) = @_;
145 -
146 - my $driver = gettext("unknown");
147 -
148 - my @args =
149 - (
150 - "1.", gettext("Choose driver by specifying ethernet adapter model"),
151 - "2.", gettext("Choose driver directly"),
152 - );
153 -
154 - my ($rc, $choice) = $console->menu_page
155 - (
156 - title => sprintf(gettext("Select %s adapter manually"), gettext($ifName)),
157 - text => gettext("Please select one of the following:"),
158 - argsref => \@args
159 - );
160 -
161 - return 'CANCEL_MANUAL' unless ($rc == 0);
162 -
163 - if ($choice eq "1.")
164 - {
165 - # Choose driver by specifying ethernet adapter model
166 - my @args;
167 -
168 - my $adapters = esmith::ethernet::listAdapters();
169 -
170 - while ( $adapters =~ s/^\s*"([^"]*)"// ) # )"...Keep Emacs happy
171 - {
172 - push @args, substr $1, 0, 60;
173 - }
174 -
175 - my ($rc, $choice) = $console->menu_page
176 - (
177 - title => sprintf(gettext("Specify %s adapter and driver"),
178 - gettext($ifName)),
179 - text => sprintf(gettext("Please specify your %s ethernet adapter and corresponding driver"), gettext($ifName)),
180 - argsref => \@args
181 - );
182 -
183 - return 'CANCEL_MANUAL' unless ($rc == 0);
184 -
185 - $choice =~ /(\w+)/;
186 - $driver = $1;
187 - }
188 - else
189 - {
190 - # Choose driver directly
191 -
192 - my @args;
193 -
194 - my $drivers = esmith::ethernet::listDrivers;
195 -
196 - while ($drivers =~ s/^\s*"([^"]*)"//)
197 - {
198 - push @args, substr $1, 0, 60;
199 - }
200 -
201 - my ($rc, $choice) = $console->menu_page
202 - (
203 - title => sprintf(gettext("Specify %s ethernet driver"), gettext($ifName)),
204 - text => sprintf(gettext("Please specify the driver to use for the %s ethernet adapter"), gettext($ifName)),
205 - argsref => \@args
206 - );
207 -
208 - return 'CANCEL_MANUAL' unless ($rc == 0);
209 -
210 - $choice =~ /(\w+)/;
211 - $driver = $1;
212 - }
213 -
214 - return $driver;
215 -}
216 -
217 sub doit
218 {
219 my $self = shift;
220 @@ -615,44 +518,7 @@
221 goto ETHERNET_EXTERNAL;
222 }
223
224 - if ($db->get_value('EthernetDriver1') eq $db->get_value('EthernetDriver2'))
225 - {
226 - goto ETHERNET_SWAP
227 - }
228 - else
229 - {
230 - $db->set_value('EthernetAssign', "normal");
231 - }
232 -
233 - goto SERVER_GATEWAY_DEDICATED;
234 -}
235 -
236 -#------------------------------------------------------------
237 -ETHERNET_SWAP:
238 -#------------------------------------------------------------
239 -
240 -{
241 - my $EthernetAssign = $db->get_value('EthernetAssign');
242 -
243 - my @args = (
244 - gettext("normal"), gettext("eth0 is local, eth1 is external"),
245 - gettext("swapped"), gettext("eth1 is local, eth0 is external")
246 - );
247 -
248 - ($rc, $choice) = $console->menu_page
249 - (
250 - title => gettext("Select ethernet card assignment"),
251 - default => gettext($EthernetAssign),
252 - text =>
253 - gettext("You have two Ethernet cards which use the same driver. The server will automatically designate one for your local network (called eth0) and one for your external Internet connection (called eth1). If this default assignment is not appropriate for your situation, you can select the opposite assignment using swapped mode. Most installations can accept the default setting of normal.") .
254 - "\n\n" .
255 - gettext("Please select whether you want to operate in normal or swapped mode.") ,
256 - argsref => \@args
257 - );
258 -
259 - goto SERVER_GATEWAY unless ($rc == 0);
260 -
261 - $db->set_value('EthernetAssign', ($choice eq gettext("swapped")) ? "swapped" : "normal");
262 + $db->set_value('EthernetAssign', "normal");
263
264 goto SERVER_GATEWAY_DEDICATED;
265 }
266 @@ -1671,8 +1537,8 @@
267 {
268 if (scalar @adapters == 2)
269 {
270 - my (undef, $driver1, undef) = split (/\s+/, $adapters[0], 3);
271 - my (undef, $driver2, undef) = split (/\s+/, $adapters[1], 3);
272 + my (undef, $driver1, undef, undef) = split (/\s+/, $adapters[0], 4);
273 + my (undef, $driver2, undef, undef) = split (/\s+/, $adapters[1], 4);
274 if($driver1 eq $driver2)
275 {
276 my $val = $db->get_prop('InternalInterface', 'NICBonding') || 'disabled';

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed