/[smeserver]/rpms/e-smith-base/sme9/e-smith-base-5.4.0-do_not_hardcode_nic_names.patch
ViewVC logotype

Annotation of /rpms/e-smith-base/sme9/e-smith-base-5.4.0-do_not_hardcode_nic_names.patch

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


Revision 1.1 - (hide annotations) (download)
Sat Nov 30 11:03:16 2013 UTC (10 years, 7 months ago) by vip-ire
Branch: MAIN
CVS Tags: e-smith-base-5_4_0-62_el6_sme, e-smith-base-5_4_0-48_el6_sme, e-smith-base-5_4_0-56_el6_sme, e-smith-base-5_4_0-55_el6_sme, e-smith-base-5_4_0-57_el6_sme, e-smith-base-5_4_0-49_el6_sme, e-smith-base-5_4_0-50_el6_sme, e-smith-base-5_4_0-52_el6_sme, e-smith-base-5_4_0-54_el6_sme, e-smith-base-5_4_0-51_el6_sme, e-smith-base-5_4_0-53_el6_sme, e-smith-base-5_4_0-61_el6_sme, e-smith-base-5_4_0-60_el6_sme, e-smith-base-5_4_0-58_el6_sme, e-smith-base-5_4_0-59_el6_sme
* Sat Nov 30 2013 Daniel Berteaud <daniel@firewall-services.com> 5.4.0-48.sme
- Do not hardcode NIC names to eth0 and eth1 [SME: 7990]

1 vip-ire 1.1 diff -Nur e-smith-base-5.4.0/createlinks e-smith-base-5.4.0_bz7990/createlinks
2     --- e-smith-base-5.4.0/createlinks 2013-11-23 13:33:18.879901866 +0100
3     +++ e-smith-base-5.4.0_bz7990/createlinks 2013-11-11 12:27:25.689384794 +0100
4     @@ -15,8 +15,6 @@
5     }
6    
7     foreach (qw(
8     - /var/lib/dhclient/dhclient-eth0.conf
9     - /var/lib/dhclient/dhclient-eth1.conf
10     /var/service/wan/pppoe.pppd.conf
11     /var/service/wan/run.pppoe.conf
12     /etc/ppp/ip-down.local
13     @@ -55,9 +53,6 @@
14    
15     foreach (qw(
16     /etc/sysconfig/network-scripts/ifcfg-bond0
17     - /etc/sysconfig/network-scripts/ifcfg-eth0
18     - /etc/sysconfig/network-scripts/ifcfg-eth0.4094
19     - /etc/sysconfig/network-scripts/ifcfg-eth1
20     /etc/sysconfig/network
21     /etc/nsswitch.conf
22     /etc/HOSTNAME
23     @@ -69,6 +64,8 @@
24     {
25     templates2events($_, qw(console-save bootstrap-console-save));
26     }
27     +event_link("update-ifcfg", "console-save", "05");
28     +event_link("update-ifcfg", "bootstrap-console-save", "05");
29    
30     # conf-other
31    
32     @@ -109,16 +106,8 @@
33     ));
34    
35     # conf-routes
36     -templates2events("/etc/sysconfig/network-scripts/route-eth0", qw(
37     - bootstrap-console-save
38     - network-create
39     - network-delete
40     - ));
41     -templates2events("/etc/sysconfig/network-scripts/route-eth1", qw(
42     - bootstrap-console-save
43     - network-create
44     - network-delete
45     - ));
46     +event_link("update-ifcfg", "network-create", "05");
47     +event_link("update-ifcfg", "network-delete", "05");
48    
49     # conf-security
50    
51     diff -Nur e-smith-base-5.4.0/root/etc/e-smith/db/configuration/migrate/10interfaces e-smith-base-5.4.0_bz7990/root/etc/e-smith/db/configuration/migrate/10interfaces
52     --- e-smith-base-5.4.0/root/etc/e-smith/db/configuration/migrate/10interfaces 2007-01-27 02:56:31.000000000 +0100
53     +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/db/configuration/migrate/10interfaces 2013-11-11 12:27:25.689384794 +0100
54     @@ -54,20 +54,12 @@
55     my %int_props =
56     (
57     type => "interface",
58     - Name => ($mode eq "serveronly") ?
59     - ($bonding eq "enabled") ? "bond0" : "eth0" :
60     - ($ethernet_assign eq 'swapped') ? "eth1" : "eth0",
61     Configuration => 'static',
62     Driver => $DB->get_value("EthernetDriver1"),
63     IPAddress => $DB->get_value("LocalIP"),
64     Netmask => $DB->get_value("LocalNetmask")
65     );
66    
67     - my $vlan = $sysconfig{VlanWAN} || 4094;
68     - my $second_interface = $ethernet_assign eq 'swapped' ? 'eth0'
69     - : $DB->get_value("EthernetDriver2") eq "unknown" ?
70     - "eth0.$vlan" : "eth1";
71     -
72     ($int_props{Network}, $int_props{Broadcast}) =
73     esmith::util::computeNetworkAndBroadcast($int_props{IPAddress},
74     $int_props{Netmask} );
75     @@ -91,6 +83,8 @@
76     # Get the existing props
77     my %ext_props = $external->props;
78    
79     + my $second_interface = $ext_props{'Name'};
80     +
81     # Delete ones which may no longer apply
82     delete $ext_props{Driver};
83     delete $ext_props{Configuration};
84     @@ -133,6 +127,11 @@
85     }
86    
87     $pppoe->set_prop("PhysicalInterface", $second_interface);
88     + # Only update PhysicalInterface
89     + # if we just switched to pppoe
90     + # ($second_interface is the name of the real external interface)
91     + $pppoe->set_prop("PhysicalInterface", $second_interface)
92     + if ($second_interface ne 'ppp0');
93     }
94     else
95     {
96     diff -Nur e-smith-base-5.4.0/root/etc/e-smith/events/actions/update-ifcfg e-smith-base-5.4.0_bz7990/root/etc/e-smith/events/actions/update-ifcfg
97     --- e-smith-base-5.4.0/root/etc/e-smith/events/actions/update-ifcfg 1970-01-01 01:00:00.000000000 +0100
98     +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/events/actions/update-ifcfg 2013-11-23 14:28:44.314991101 +0100
99     @@ -0,0 +1,62 @@
100     +#!/usr/bin/perl -w
101     +
102     +use esmith::ConfigDB;
103     +use esmith::templates;
104     +use esmith::ethernet;
105     +use strict;
106     +
107     +my @adapters = split(/\n/, esmith::ethernet::probeAdapters());
108     +my @nics = ();
109     +
110     +# Expand templates for every adapters found
111     +foreach my $adapter (@adapters){
112     + my (undef, undef, undef, undef, $nic) = split(/\t/, $adapter, 5);
113     + push @nics, $nic;
114     + esmith::templates::processTemplate({
115     + MORE_DATA => { THIS_DEVICE => $nic },
116     + TEMPLATE_PATH => '/etc/sysconfig/network-scripts/ifcfg-ethX',
117     + OUTPUT_FILENAME => "/etc/sysconfig/network-scripts/ifcfg-$nic"
118     + });
119     + esmith::templates::processTemplate({
120     + MORE_DATA => { THIS_DEVICE => $nic },
121     + TEMPLATE_PATH => '/etc/sysconfig/network-scripts/route-ethX',
122     + OUTPUT_FILENAME => "/etc/sysconfig/network-scripts/route-$nic"
123     + });
124     + esmith::templates::processTemplate({
125     + MORE_DATA => { THIS_DEVICE => $nic },
126     + TEMPLATE_PATH => '/var/lib/dhclient/dhclient.conf',
127     + OUTPUT_FILENAME => "/var/lib/dhclient/dhclient-$nic.conf"
128     + });
129     +}
130     +
131     +# Build a list of interfaces for which we want to keep the config
132     +my $c = esmith::ConfigDB->open_ro() ||
133     + die "Couldn't open ConfigDB";
134     +foreach ($c->get_all_by_prop( type => 'interface')){
135     + push @nics, $_->prop('Name');
136     +}
137     +push @nics, $_ foreach (qw/ppp0 bond0 lo/);
138     +my %dedup;
139     +@dedup{@nics} = ();
140     +@nics = keys %dedup;
141     +
142     +# Now remove any ifcfg-X, route-X or dhclient-X.conf
143     +# for NIC which have been removed
144     +foreach my $removed (glob "/etc/sysconfig/network-scripts/ifcfg-*"){
145     + $removed =~ m/ifcfg\-(.*)$/;
146     + my $interface = $1;
147     + next if (grep { $_ eq $interface } @nics);
148     + unlink $removed;
149     +}
150     +foreach my $removed (glob "/etc/sysconfig/network-scripts/route-*"){
151     + $removed =~ m/route\-(.*)$/;
152     + my $interface = $1;
153     + next if (grep { $_ eq $interface } @nics);
154     + unlink $removed;
155     +}
156     +foreach my $removed (glob "/var/lib/dhclient/dhclient-*.conf"){
157     + $removed =~ m/dhclient\-(.*)\.conf$/;
158     + my $interface = $1;
159     + next if (grep { $_ eq $interface } @nics);
160     + unlink $removed;
161     +}
162     diff -Nur e-smith-base-5.4.0/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/50VLAN e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/50VLAN
163     --- e-smith-base-5.4.0/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/50VLAN 2005-11-21 05:28:08.000000000 +0100
164     +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/50VLAN 1970-01-01 01:00:00.000000000 +0100
165     @@ -1,9 +0,0 @@
166     -{
167     - $OUT = "";
168     - $THIS_DEVICE =~ /(eth\d)\.(\d+)/;
169     - return unless defined $2;
170     -
171     - my ($physdev, $vlan) = ($1, $2);
172     - $OUT .= "VLAN=yes\n" .
173     - "PHYSDEV=$physdev";
174     -}
175     diff -Nur e-smith-base-5.4.0/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/70bonding e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/70bonding
176     --- e-smith-base-5.4.0/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/70bonding 2005-11-21 05:28:08.000000000 +0100
177     +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/70bonding 2013-11-11 12:27:25.689384794 +0100
178     @@ -1,7 +1,9 @@
179     {
180     $OUT = "";
181     return unless ($InternalInterface{Name} eq "bond0");
182     - if ($THIS_DEVICE =~ /eth[01]/)
183     + # FIXME: this should be restricted to the real slaves
184     + # and not every interface except bond0
185     + if ($THIS_DEVICE ne 'bond0')
186     {
187     $OUT .= "MASTER=bond0\n";
188     $OUT .= "SLAVE=yes";
189     diff -Nur e-smith-base-5.4.0/root/etc/e-smith/templates/var/service/wan/dhclient.config/device e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates/var/service/wan/dhclient.config/device
190     --- e-smith-base-5.4.0/root/etc/e-smith/templates/var/service/wan/dhclient.config/device 2007-01-27 02:56:31.000000000 +0100
191     +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates/var/service/wan/dhclient.config/device 2013-11-23 13:38:06.746800554 +0100
192     @@ -1,13 +1,5 @@
193     {
194     my $device = $ExternalInterface{Name} || "eth1";
195     - $OUT .= "/sbin/modprobe eth0\n";
196     - $OUT .= "/sbin/modprobe eth1\n" if $device eq "eth1";
197     - if ($device eq "eth0.4094")
198     - {
199     - $OUT .=
200     - "/sbin/modprobe 8021q\n" .
201     - "/sbin/vconfig add eth0 4094\n";
202     - }
203     $OUT .= "/sbin/ifconfig $device up mtu 1500\n\n";
204     $OUT .= "interface=$device\n";
205     }
206     diff -Nur e-smith-base-5.4.0/root/etc/e-smith/templates/var/service/wan/run.pppoe.conf/device e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates/var/service/wan/run.pppoe.conf/device
207     --- e-smith-base-5.4.0/root/etc/e-smith/templates/var/service/wan/run.pppoe.conf/device 2007-01-27 02:56:31.000000000 +0100
208     +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates/var/service/wan/run.pppoe.conf/device 2013-11-11 12:27:25.690384795 +0100
209     @@ -1,13 +1,5 @@
210     {
211     my $device = $pppoe{PhysicalInterface} || "eth1";
212     - $OUT .= "/sbin/modprobe eth0\n";
213     - $OUT .= "/sbin/modprobe eth1\n" if $device eq "eth1";
214     - if ($device eq "eth0.4094")
215     - {
216     - $OUT .=
217     - "/sbin/modprobe 8021q\n" .
218     - "test -f /proc/net/vlan/eth0.4094 || /sbin/vconfig add eth0 4094\n";
219     - }
220     $OUT .= "/sbin/ifconfig $device up mtu 1500\n";
221     $OUT .= "/sbin/modprobe ppp_generic\n";
222     $OUT .= "/sbin/modprobe ppp_async\n";
223     diff -Nur e-smith-base-5.4.0/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-bond0 e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-bond0
224     --- e-smith-base-5.4.0/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-bond0 2005-11-21 05:28:10.000000000 +0100
225     +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-bond0 1970-01-01 01:00:00.000000000 +0100
226     @@ -1,3 +0,0 @@
227     -TEMPLATE_PATH="/etc/sysconfig/network-scripts/ifcfg-ethX"
228     -OUTPUT_FILENAME="/etc/sysconfig/network-scripts/ifcfg-bond0"
229     -MORE_DATA={ THIS_DEVICE => "bond0" }
230     diff -Nur e-smith-base-5.4.0/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-eth0 e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-eth0
231     --- e-smith-base-5.4.0/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-eth0 2005-11-21 05:28:10.000000000 +0100
232     +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-eth0 1970-01-01 01:00:00.000000000 +0100
233     @@ -1,3 +0,0 @@
234     -TEMPLATE_PATH="/etc/sysconfig/network-scripts/ifcfg-ethX"
235     -OUTPUT_FILENAME="/etc/sysconfig/network-scripts/ifcfg-eth0"
236     -MORE_DATA={ THIS_DEVICE => "eth0" }
237     diff -Nur e-smith-base-5.4.0/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-eth0.4094 e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-eth0.4094
238     --- e-smith-base-5.4.0/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-eth0.4094 2005-11-21 05:28:10.000000000 +0100
239     +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-eth0.4094 1970-01-01 01:00:00.000000000 +0100
240     @@ -1,3 +0,0 @@
241     -TEMPLATE_PATH="/etc/sysconfig/network-scripts/ifcfg-ethX"
242     -OUTPUT_FILENAME="/etc/sysconfig/network-scripts/ifcfg-eth0.4094"
243     -MORE_DATA={ THIS_DEVICE => "eth0.4094" }
244     diff -Nur e-smith-base-5.4.0/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-eth1 e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-eth1
245     --- e-smith-base-5.4.0/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-eth1 2005-11-21 05:28:10.000000000 +0100
246     +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/ifcfg-eth1 1970-01-01 01:00:00.000000000 +0100
247     @@ -1,3 +0,0 @@
248     -TEMPLATE_PATH="/etc/sysconfig/network-scripts/ifcfg-ethX"
249     -OUTPUT_FILENAME="/etc/sysconfig/network-scripts/ifcfg-eth1"
250     -MORE_DATA={ THIS_DEVICE => "eth1" }
251     diff -Nur e-smith-base-5.4.0/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/route-eth0 e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/route-eth0
252     --- e-smith-base-5.4.0/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/route-eth0 2005-11-21 05:28:10.000000000 +0100
253     +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/route-eth0 1970-01-01 01:00:00.000000000 +0100
254     @@ -1,4 +0,0 @@
255     -TEMPLATE_PATH="/etc/sysconfig/network-scripts/route-ethX"
256     -OUTPUT_FILENAME="/etc/sysconfig/network-scripts/route-eth0"
257     -MORE_DATA={ THIS_DEVICE => "eth0" }
258     -FILTER=sub { $_[0] =~ /^#/ ? '' : $_[0] } # Remove comments
259     diff -Nur e-smith-base-5.4.0/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/route-eth1 e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/route-eth1
260     --- e-smith-base-5.4.0/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/route-eth1 2005-11-21 05:28:10.000000000 +0100
261     +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/templates.metadata/etc/sysconfig/network-scripts/route-eth1 1970-01-01 01:00:00.000000000 +0100
262     @@ -1,4 +0,0 @@
263     -TEMPLATE_PATH="/etc/sysconfig/network-scripts/route-ethX"
264     -OUTPUT_FILENAME="/etc/sysconfig/network-scripts/route-eth1"
265     -MORE_DATA={ THIS_DEVICE => "eth1" }
266     -FILTER=sub { $_[0] =~ /^#/ ? '' : $_[0] } # Remove comments
267     diff -Nur e-smith-base-5.4.0/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm e-smith-base-5.4.0_bz7990/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm
268     --- e-smith-base-5.4.0/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm 2013-11-23 13:33:19.000901828 +0100
269     +++ e-smith-base-5.4.0_bz7990/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm 2013-11-11 12:30:54.204449017 +0100
270     @@ -530,8 +530,7 @@
271     ETHERNET_EXTERNAL:
272     #------------------------------------------------------------
273     {
274     - my $vlan = $db->get_prop('sysconfig', 'VlanWAN');
275     - if (scalar @adapters == 1 && !$vlan)
276     + if (scalar @adapters == 1)
277     {
278     ($rc, $choice) = $console->message_page
279     (
280     @@ -1598,6 +1597,8 @@
281    
282     $db->set_prop('InternalInterface', 'NICBonding',
283     ($choice eq gettext('enabled')) ? 'enabled' : 'disabled');
284     + $db->set_prop('InternalInterface', 'Name', 'bond0')
285     + if ($choice eq gettext('enabled'));
286    
287     $db->set_value("EthernetDriver2",
288     ($db->get_prop('InternalInterface', 'NICBonding',

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