diff -Nur e-smith-base-5.4.0/createlinks e-smith-base-5.4.0_bz7990/createlinks --- e-smith-base-5.4.0/createlinks 2013-11-23 13:33:18.879901866 +0100 +++ e-smith-base-5.4.0_bz7990/createlinks 2013-11-11 12:27:25.689384794 +0100 @@ -15,8 +15,6 @@ } foreach (qw( - /var/lib/dhclient/dhclient-eth0.conf - /var/lib/dhclient/dhclient-eth1.conf /var/service/wan/pppoe.pppd.conf /var/service/wan/run.pppoe.conf /etc/ppp/ip-down.local @@ -55,9 +53,6 @@ foreach (qw( /etc/sysconfig/network-scripts/ifcfg-bond0 - /etc/sysconfig/network-scripts/ifcfg-eth0 - /etc/sysconfig/network-scripts/ifcfg-eth0.4094 - /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network /etc/nsswitch.conf /etc/HOSTNAME @@ -69,6 +64,8 @@ { templates2events($_, qw(console-save bootstrap-console-save)); } +event_link("update-ifcfg", "console-save", "05"); +event_link("update-ifcfg", "bootstrap-console-save", "05"); # conf-other @@ -109,16 +106,8 @@ )); # conf-routes -templates2events("/etc/sysconfig/network-scripts/route-eth0", qw( - bootstrap-console-save - network-create - network-delete - )); -templates2events("/etc/sysconfig/network-scripts/route-eth1", qw( - bootstrap-console-save - network-create - network-delete - )); +event_link("update-ifcfg", "network-create", "05"); +event_link("update-ifcfg", "network-delete", "05"); # conf-security 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 --- e-smith-base-5.4.0/root/etc/e-smith/db/configuration/migrate/10interfaces 2007-01-27 02:56:31.000000000 +0100 +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/db/configuration/migrate/10interfaces 2013-11-11 12:27:25.689384794 +0100 @@ -54,20 +54,12 @@ my %int_props = ( type => "interface", - Name => ($mode eq "serveronly") ? - ($bonding eq "enabled") ? "bond0" : "eth0" : - ($ethernet_assign eq 'swapped') ? "eth1" : "eth0", Configuration => 'static', Driver => $DB->get_value("EthernetDriver1"), IPAddress => $DB->get_value("LocalIP"), Netmask => $DB->get_value("LocalNetmask") ); - my $vlan = $sysconfig{VlanWAN} || 4094; - my $second_interface = $ethernet_assign eq 'swapped' ? 'eth0' - : $DB->get_value("EthernetDriver2") eq "unknown" ? - "eth0.$vlan" : "eth1"; - ($int_props{Network}, $int_props{Broadcast}) = esmith::util::computeNetworkAndBroadcast($int_props{IPAddress}, $int_props{Netmask} ); @@ -91,6 +83,8 @@ # Get the existing props my %ext_props = $external->props; + my $second_interface = $ext_props{'Name'}; + # Delete ones which may no longer apply delete $ext_props{Driver}; delete $ext_props{Configuration}; @@ -133,6 +127,11 @@ } $pppoe->set_prop("PhysicalInterface", $second_interface); + # Only update PhysicalInterface + # if we just switched to pppoe + # ($second_interface is the name of the real external interface) + $pppoe->set_prop("PhysicalInterface", $second_interface) + if ($second_interface ne 'ppp0'); } else { 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 --- e-smith-base-5.4.0/root/etc/e-smith/events/actions/update-ifcfg 1970-01-01 01:00:00.000000000 +0100 +++ e-smith-base-5.4.0_bz7990/root/etc/e-smith/events/actions/update-ifcfg 2013-11-23 14:28:44.314991101 +0100 @@ -0,0 +1,62 @@ +#!/usr/bin/perl -w + +use esmith::ConfigDB; +use esmith::templates; +use esmith::ethernet; +use strict; + +my @adapters = split(/\n/, esmith::ethernet::probeAdapters()); +my @nics = (); + +# Expand templates for every adapters found +foreach my $adapter (@adapters){ + my (undef, undef, undef, undef, $nic) = split(/\t/, $adapter, 5); + push @nics, $nic; + esmith::templates::processTemplate({ + MORE_DATA => { THIS_DEVICE => $nic }, + TEMPLATE_PATH => '/etc/sysconfig/network-scripts/ifcfg-ethX', + OUTPUT_FILENAME => "/etc/sysconfig/network-scripts/ifcfg-$nic" + }); + esmith::templates::processTemplate({ + MORE_DATA => { THIS_DEVICE => $nic }, + TEMPLATE_PATH => '/etc/sysconfig/network-scripts/route-ethX', + OUTPUT_FILENAME => "/etc/sysconfig/network-scripts/route-$nic" + }); + esmith::templates::processTemplate({ + MORE_DATA => { THIS_DEVICE => $nic }, + TEMPLATE_PATH => '/var/lib/dhclient/dhclient.conf', + OUTPUT_FILENAME => "/var/lib/dhclient/dhclient-$nic.conf" + }); +} + +# Build a list of interfaces for which we want to keep the config +my $c = esmith::ConfigDB->open_ro() || + die "Couldn't open ConfigDB"; +foreach ($c->get_all_by_prop( type => 'interface')){ + push @nics, $_->prop('Name'); +} +push @nics, $_ foreach (qw/ppp0 bond0 lo/); +my %dedup; +@dedup{@nics} = (); +@nics = keys %dedup; + +# Now remove any ifcfg-X, route-X or dhclient-X.conf +# for NIC which have been removed +foreach my $removed (glob "/etc/sysconfig/network-scripts/ifcfg-*"){ + $removed =~ m/ifcfg\-(.*)$/; + my $interface = $1; + next if (grep { $_ eq $interface } @nics); + unlink $removed; +} +foreach my $removed (glob "/etc/sysconfig/network-scripts/route-*"){ + $removed =~ m/route\-(.*)$/; + my $interface = $1; + next if (grep { $_ eq $interface } @nics); + unlink $removed; +} +foreach my $removed (glob "/var/lib/dhclient/dhclient-*.conf"){ + $removed =~ m/dhclient\-(.*)\.conf$/; + my $interface = $1; + next if (grep { $_ eq $interface } @nics); + unlink $removed; +} 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 --- 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 +++ 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 @@ -1,9 +0,0 @@ -{ - $OUT = ""; - $THIS_DEVICE =~ /(eth\d)\.(\d+)/; - return unless defined $2; - - my ($physdev, $vlan) = ($1, $2); - $OUT .= "VLAN=yes\n" . - "PHYSDEV=$physdev"; -} 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 --- 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 +++ 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 @@ -1,7 +1,9 @@ { $OUT = ""; return unless ($InternalInterface{Name} eq "bond0"); - if ($THIS_DEVICE =~ /eth[01]/) + # FIXME: this should be restricted to the real slaves + # and not every interface except bond0 + if ($THIS_DEVICE ne 'bond0') { $OUT .= "MASTER=bond0\n"; $OUT .= "SLAVE=yes"; 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 --- 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 +++ 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 @@ -1,13 +1,5 @@ { my $device = $ExternalInterface{Name} || "eth1"; - $OUT .= "/sbin/modprobe eth0\n"; - $OUT .= "/sbin/modprobe eth1\n" if $device eq "eth1"; - if ($device eq "eth0.4094") - { - $OUT .= - "/sbin/modprobe 8021q\n" . - "/sbin/vconfig add eth0 4094\n"; - } $OUT .= "/sbin/ifconfig $device up mtu 1500\n\n"; $OUT .= "interface=$device\n"; } 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 --- 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 +++ 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 @@ -1,13 +1,5 @@ { my $device = $pppoe{PhysicalInterface} || "eth1"; - $OUT .= "/sbin/modprobe eth0\n"; - $OUT .= "/sbin/modprobe eth1\n" if $device eq "eth1"; - if ($device eq "eth0.4094") - { - $OUT .= - "/sbin/modprobe 8021q\n" . - "test -f /proc/net/vlan/eth0.4094 || /sbin/vconfig add eth0 4094\n"; - } $OUT .= "/sbin/ifconfig $device up mtu 1500\n"; $OUT .= "/sbin/modprobe ppp_generic\n"; $OUT .= "/sbin/modprobe ppp_async\n"; 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 --- 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 +++ 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 @@ -1,3 +0,0 @@ -TEMPLATE_PATH="/etc/sysconfig/network-scripts/ifcfg-ethX" -OUTPUT_FILENAME="/etc/sysconfig/network-scripts/ifcfg-bond0" -MORE_DATA={ THIS_DEVICE => "bond0" } 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 --- 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 +++ 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 @@ -1,3 +0,0 @@ -TEMPLATE_PATH="/etc/sysconfig/network-scripts/ifcfg-ethX" -OUTPUT_FILENAME="/etc/sysconfig/network-scripts/ifcfg-eth0" -MORE_DATA={ THIS_DEVICE => "eth0" } 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 --- 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 +++ 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 @@ -1,3 +0,0 @@ -TEMPLATE_PATH="/etc/sysconfig/network-scripts/ifcfg-ethX" -OUTPUT_FILENAME="/etc/sysconfig/network-scripts/ifcfg-eth0.4094" -MORE_DATA={ THIS_DEVICE => "eth0.4094" } 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 --- 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 +++ 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 @@ -1,3 +0,0 @@ -TEMPLATE_PATH="/etc/sysconfig/network-scripts/ifcfg-ethX" -OUTPUT_FILENAME="/etc/sysconfig/network-scripts/ifcfg-eth1" -MORE_DATA={ THIS_DEVICE => "eth1" } 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 --- 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 +++ 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 @@ -1,4 +0,0 @@ -TEMPLATE_PATH="/etc/sysconfig/network-scripts/route-ethX" -OUTPUT_FILENAME="/etc/sysconfig/network-scripts/route-eth0" -MORE_DATA={ THIS_DEVICE => "eth0" } -FILTER=sub { $_[0] =~ /^#/ ? '' : $_[0] } # Remove comments 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 --- 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 +++ 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 @@ -1,4 +0,0 @@ -TEMPLATE_PATH="/etc/sysconfig/network-scripts/route-ethX" -OUTPUT_FILENAME="/etc/sysconfig/network-scripts/route-eth1" -MORE_DATA={ THIS_DEVICE => "eth1" } -FILTER=sub { $_[0] =~ /^#/ ? '' : $_[0] } # Remove comments 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 --- e-smith-base-5.4.0/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm 2013-11-23 13:33:19.000901828 +0100 +++ 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 @@ -530,8 +530,7 @@ ETHERNET_EXTERNAL: #------------------------------------------------------------ { - my $vlan = $db->get_prop('sysconfig', 'VlanWAN'); - if (scalar @adapters == 1 && !$vlan) + if (scalar @adapters == 1) { ($rc, $choice) = $console->message_page ( @@ -1598,6 +1597,8 @@ $db->set_prop('InternalInterface', 'NICBonding', ($choice eq gettext('enabled')) ? 'enabled' : 'disabled'); + $db->set_prop('InternalInterface', 'Name', 'bond0') + if ($choice eq gettext('enabled')); $db->set_value("EthernetDriver2", ($db->get_prop('InternalInterface', 'NICBonding',