From d27835dbdf4ec277591ffa68e4233f869f3f6a9f Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 7 Jan 2004 16:47:07 +0000 Subject: fixes merged from head into updates --- perl-install/c/stuff.xs.pl | 31 +++++++++++++++++++++++ perl-install/drakxtools.spec | 42 +++++++++++++++++-------------- perl-install/modules.pm | 16 +++++++----- perl-install/network/ethernet.pm | 25 ++++++++++-------- perl-install/standalone/service_harddrake | 6 +++++ 5 files changed, 84 insertions(+), 36 deletions(-) diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index fb9f86074..ab5bf35c7 100644 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -10,6 +10,7 @@ print ' #include #include +#include #include #include #include @@ -32,6 +33,16 @@ print ' #include #include #include +#include +#include + +// for ethtool structs: +typedef unsigned long long u64; +typedef __uint32_t u32; +typedef __uint16_t u16; +typedef __uint8_t u8; + +#include /* for is_ext3 */ #include @@ -404,6 +415,26 @@ hasNetDevice(device) OUTPUT: RETVAL +char* +getNetDriver(char* device) + CODE: + struct ifreq ifr; + struct ethtool_drvinfo drvinfo; + int s = socket(AF_INET, SOCK_DGRAM, 0); + + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)-1); + + drvinfo.cmd = ETHTOOL_GDRVINFO; + ifr.ifr_data = (caddr_t) &drvinfo; + + if (ioctl(s, SIOCETHTOOL, &ifr) != -1) + RETVAL = strdup(drvinfo.driver); + else { perror("SIOCETHTOOL"); RETVAL = strdup(""); } + OUTPUT: + RETVAL + + int addDefaultRoute(gateway) char *gateway diff --git a/perl-install/drakxtools.spec b/perl-install/drakxtools.spec index 79c0fabab..6acbee12d 100644 --- a/perl-install/drakxtools.spec +++ b/perl-install/drakxtools.spec @@ -1,7 +1,7 @@ Summary: The drakxtools (XFdrake, diskdrake, keyboarddrake, mousedrake...) Name: drakxtools Version: 9.2 -Release: 19mdk +Release: 19.1.92mdk Url: http://www.mandrakelinux.com/en/drakx.php3 Source0: %name-%version.tar.bz2 License: GPL @@ -315,18 +315,24 @@ file /etc/sysconfig/harddrake2/previous_hw | fgrep -q perl && %_datadir/harddrak %config(noreplace) %_sysconfdir/logrotate.d/drakxtools-http %changelog -* Tue Nov 4 2003 Thierry Vignaud 9.2-19mdk +* Thu Nov 13 2003 Thierry Vignaud 9.2-19.1.92mdk - drakboot: disable lun detections for ide burners - drakconnect: - o fix empty fields in expert mode + o mcc view: + * fix network interfaces list update (really remove from the Gtk+ + list lost interfaces) + o wizard: + * fix wireless cards detection (#3690, #4181, #5143, #5814, ...) + * always list sagem_dhcp in adsl list, showing it only in expert + mode is confusing + * handle more than 4 ethernet cards + * speedtouch adsl: fix broken connection scripts + * support ISDN usb adapters + * fix empty fields in expert mode + o prevent droping wireless parameters for modules not listed in + wireless modules list o fix anthill bug #50: ensure /etc/ppp/pap-secrets is not world readable since it contains password/user mapping for dialup -- net_monitor: handle multiple network interfaces - -* Mon Oct 27 2003 Thierry Vignaud 9.2-18mdk -- drakconnect: - o do not blacklist anymore bcm4400 for network hotplugging - o support ISDN usb adapters - drakperm: o force user|group|other rights order in edit dialog o one was able to alter system rules in memory wheareas this is not @@ -334,30 +340,28 @@ file /etc/sysconfig/harddrake2/previous_hw | fgrep -q perl && %_datadir/harddrak disable "ok" button for system rules to prevent confusion. - harddrake service: workaround anthill bug #18 (do not overwrite sound aliases when no hardware change occured) -- misc amd64 fixes (gwenole) - net_monitor: o fix connection status detection o fix profile managment switch + o handle multiple network interfaces -* Thu Oct 16 2003 Thierry Vignaud 9.2-17mdk -- drakbackup: all users overrides individual selection in wizard - (#5916) (stew) +* Tue Oct 14 2003 Thierry Vignaud 9.2-16.3.92mdk +- drakbackup: all users overrides individual selection in wizard (#5916) - drakconnect: o fix #425, #1881: wireless adapters settings were lost when altering network configuration when not from wizard mode o when steping back in wizard, do not overwrite first card - parameters with last one's (#3276) + parameters with last one's (#3276) o fix expert mode (lost checkboxes states when "expert mode" option is checked) - o blacklist bcm4400 for network hotplugging - drakfont: o fix ttf conversion (#5088) o log more explanations +- drakgw: enable to choose the interface - draksec: fix unsaved security administrator setting (#6103) -- misc chinese fixes (arnaud, pablo) -- printerdrake: fix lpd call (pablo) -- translations updates (pablo) -- misc amd64 fixes (gwenole) +- misc chinese fixes +- printerdrake: fix lpd call +- translations updates * Fri Sep 19 2003 Thierry Vignaud 9.2-16mdk - drakconnect: fix #5825 (hostname set as ARRAY(0x...)) diff --git a/perl-install/modules.pm b/perl-install/modules.pm index 552774cf7..db77932e5 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -171,13 +171,15 @@ sub add_probeall { } sub remove_alias($) { + my ($name) = @_; + remove_alias_regexp("^$name\$"); +} + +sub remove_alias_regexp($) { my ($name) = @_; foreach (keys %conf) { - $conf{$_}{alias} && $conf{$_}{alias} eq $name or next; - delete $conf{$_}{alias}; - return 1; + delete $conf{$_}{alias} if /$name/; } - 0; } sub remove_module($) { @@ -232,7 +234,7 @@ sub mergein_conf { my ($file) = @_; my $modconfref = read_conf($file); while (my ($key, $value) = each %$modconfref) { - $conf{$key}{alias} = $value->{alias} if !exists $conf{$key}{alias}; + $conf{$key}{alias} ||= $value->{alias}; $conf{$key}{options} = $value->{options} if $value->{options}; push @{$conf{$key}{probeall} ||= []}, deref($value->{probeall}); } @@ -261,7 +263,9 @@ sub write_conf { } elsif ($conf{$alias}{$type} && $conf{$alias}{$type} ne $module) { my $v = join(' ', uniq(deref($conf{$alias}{$type}))); $_ = "$type $alias $v\n"; - } + } elsif ($type eq 'alias' && !defined $conf{$alias}{alias}) { + $_ = ''; + } } $file; my $written = read_conf($file); diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index 8c3bb5b56..bcda4a64b 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -115,16 +115,11 @@ sub conf_network_card_backend { my $saved_driver; return map { my $interface = $_; - my $interface_state = `LC_ALL=C LANG=C LANGUAGE=C LC_MESSAGES=C $::prefix/sbin/ifconfig "$interface"`; - my $a = modules::get_alias($interface); - my $b; - foreach (@devs) { - $_->{device} eq $interface and $b = $_->{driver}; - } - $a ||= $b; - $a and $saved_driver = $a; - if_($::isInstall || $interface_state =~ /inet addr|Bcast|Mask|Interrupt|Base address/ && $a, - [$interface, $saved_driver]); + my $a = c::getNetDriver($interface) || modules::get_alias($interface); + my $b = find { $_->{device} eq $interface } @devs; + $a ||= $b->{driver}; + $a and $saved_driver = $a; # handle multiple cards managed by the same driver + [ $interface, $saved_driver ] } @all_cards; } $o_interface =~ /eth[0-9]+/ or die("the interface is not an ethx"); @@ -153,7 +148,7 @@ sub configureNetwork { my @l = map { $_->[0] } @all_cards; foreach (@all_cards) { - modules::remove_alias($_->[0]); + modules::remove_alias($_->[1]); modules::add_alias($_->[0], $_->[1]); } @@ -196,4 +191,12 @@ want to use the default host name."), 1; } +# automatic net aliases configuration +sub configure_eth_aliases() { + foreach (detect_devices::getNet()) { + my $driver = c::getNetDriver($_) or next; + modules::add_alias($_, $driver); + } +} + 1; diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake index f8028b762..137e2ccdc 100755 --- a/perl-install/standalone/service_harddrake +++ b/perl-install/standalone/service_harddrake @@ -69,6 +69,12 @@ foreach (@harddrake::data::tree) { # automatic sound slots configuration if ($Ident eq "AUDIO") { harddrake::sound::configure_sound_slots(); + } elsif ($Ident eq "ETHERNET") { + modules::remove_alias_regexp('^(wlan|eth)[0-9]*$'); + modules::load_category('network/main|gigabit|usb'); + require network::ethernet; + network::ethernet::configure_eth_aliases(); + modules::write_conf(); } next unless -x first(split /\s+/, $configurator_pool[0]); -- cgit v1.2.1