diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-06-03 07:14:48 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-06-03 07:14:48 +0000 |
commit | 8fc41a1333f01496878ca0561f3ca1ad186b6d64 (patch) | |
tree | 2dd030c580d5b8e954bce95508ac7ecacc6127b9 /perl-install/network/tools.pm | |
parent | 671adafbfbb78f044970bc4af895ed43dff99757 (diff) | |
download | drakx-8fc41a1333f01496878ca0561f3ca1ad186b6d64.tar drakx-8fc41a1333f01496878ca0561f3ca1ad186b6d64.tar.gz drakx-8fc41a1333f01496878ca0561f3ca1ad186b6d64.tar.bz2 drakx-8fc41a1333f01496878ca0561f3ca1ad186b6d64.tar.xz drakx-8fc41a1333f01496878ca0561f3ca1ad186b6d64.zip |
- merge network settings in a $net hash (it modifies $o fields too):
o $netc becomes $net->{network} and $net->{resolv}
o $intf becomes $net->{ifcfg}
- move zeroconf config stuff in write_zeroconf
- read_tmdns_conf -> read_zeroconf
- read_all_conf -> read_net_conf
- configureNetwork2 -> configure_network
- configure_network: write ifcfg files for ppp interfaces too
- don't install wireless-tools in configure_network, this package is in basesystem
- most functions don't need the file path as an argument in network::network
- drop network::tools::remove_initscript
- don't export too much from network::network
- don't export from network::tools
- remove adsl_unsupported_eci step in drakconnect
- drop passwd2 field in network::adsl
- drop $net->{isdn_internal}
- network::netconnect : main -> safe_main
- use network::netconnect::real_main during install
- don't read network config in network::netconnect::real_main
- install_steps::upNetwork : resolv.conf is already symlinked by network::network::configure_network when appropriate
- try to fix install_any::generate_automatic_stage1_params to use a real interface configuration
- put authentication stuff in $net->{auth}
- drop network::ethernet::write_ether_conf
- drop network::adsl::get_wizard
- use 'static' instead of 'manual' as ADSL method
- drop first_modem and its workarounds in network::modem
- drop deprecated "multiple_internet_cnx" step in drakconnect
- don't save /etc/sysconfig/drakconnect anymore
- drop MDK::Common::Globals stuff
- drop getIP in net_applet (Pixel)
- drop $netc->{DHCP}
- configure_network(): write resolv.conf even if a dhcp interface is configured
Diffstat (limited to 'perl-install/network/tools.pm')
-rw-r--r-- | perl-install/network/tools.pm | 54 |
1 files changed, 20 insertions, 34 deletions
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index ba51572a7..478dca21d 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -4,11 +4,6 @@ use strict; use common; use run_program; use c; -use vars qw(@ISA @EXPORT @EXPORT_OK); -use MDK::Common::System qw(getVarsFromSh); - -@ISA = qw(Exporter); -@EXPORT = qw(connect_backend connected connected_bg disconnect_backend is_dynamic_ip passwd_by_login read_secret_backend test_connected remove_initscript write_secret_backend start_interface stop_interface); sub write_secret_backend { my ($a, $b) = @_; @@ -159,48 +154,39 @@ sub check_link_beat() { }); } -sub remove_initscript() { - $::testing and return; - if (-e "$::prefix/etc/rc.d/init.d/internet") { - run_program::rooted($::prefix, "/sbin/chkconfig", "--del", "internet"); - rm_rf("$::prefix/etc/rc.d/init.d/internet"); - log::explanations("Removed internet service"); - } -} - sub is_dynamic_ip { - my ($intf) = @_; - any { $_->{BOOTPROTO} !~ /^(none|static|)$/ } values %$intf; + my ($net) = @_; + any { $_->{BOOTPROTO} !~ /^(none|static|)$/ } values %{$net->{ifcfg}}; } sub is_dynamic_host { - my ($intf) = @_; - any { defined $_->{DHCP_HOSTNAME} } values %$intf; + my ($net) = @_; + any { defined $_->{DHCP_HOSTNAME} } values %{$net->{ifcfg}}; } #- returns interface whose IP address matchs given IP address, according to its network mask sub find_matching_interface { - my ($intf, $address) = @_; + my ($net, $address) = @_; my @ip = split '\.', $address; find { - my @intf_ip = split '\.', $intf->{$_}{IPADDR} or return; - my @mask = split '\.', $intf->{$_}{NETMASK} or return; + my @intf_ip = split '\.', $net->{ifcfg}{$_}{IPADDR} or return; + my @mask = split '\.', $net->{ifcfg}{$_}{NETMASK} or return; every { $_ } mapn { ($_[0] & $_[2]) == ($_[1] & $_[2]) } \@intf_ip, \@ip, \@mask; - } sort keys %$intf; + } sort keys %{$net->{ifcfg}}; } #- returns gateway interface if found sub get_default_gateway_interface { - my ($netc, $intf) = @_; - my @intfs = sort keys %$intf; + my ($net) = @_; + my @intfs = sort keys %{$net->{ifcfg}}; `$::prefix/sbin/ip route show` =~ /^default.*\s+dev\s+(\S+)/m && $1 || - $netc->{GATEWAYDEV} || - $netc->{GATEWAY} && find_matching_interface($intf, $netc->{GATEWAY}) || - (find { get_interface_type($intf->{$_}) eq 'adsl' } @intfs) || - (find { get_interface_type($intf->{$_}) eq 'isdn' && text2bool($intf->{$_}{DIAL_ON_IFUP}) } @intfs) || - (find { get_interface_type($intf->{$_}) eq 'modem' } @intfs) || - (find { get_interface_type($intf->{$_}) eq 'wifi' && $intf->{$_}{BOOTPROTO} eq 'dhcp' } @intfs) || - (find { get_interface_type($intf->{$_}) eq 'ethernet' && $intf->{$_}{BOOTPROTO} eq 'dhcp' } @intfs); + $net->{network}{GATEWAYDEV} || + $net->{network}{GATEWAY} && find_matching_interface($net, $net->{network}{GATEWAY}) || + (find { get_interface_type($net->{ifcfg}{$_}) eq 'adsl' } @intfs) || + (find { get_interface_type($net->{ifcfg}{$_}) eq 'isdn' && text2bool($net->{ifcfg}{$_}{DIAL_ON_IFUP}) } @intfs) || + (find { get_interface_type($net->{ifcfg}{$_}) eq 'modem' } @intfs) || + (find { get_interface_type($net->{ifcfg}{$_}) eq 'wifi' && $net->{ifcfg}{$_}{BOOTPROTO} eq 'dhcp' } @intfs) || + (find { get_interface_type($net->{ifcfg}{$_}) eq 'ethernet' && $net->{ifcfg}{$_}{BOOTPROTO} eq 'dhcp' } @intfs); } sub get_interface_status { @@ -213,9 +199,9 @@ sub get_interface_status { #- returns (gateway_interface, interface is up, gateway address, dns server address) sub get_internet_connection { - my ($netc, $intf, $o_gw_intf) = @_; - my $gw_intf = $o_gw_intf || get_default_gateway_interface($netc, $intf) or return; - return $gw_intf, get_interface_status($gw_intf), $netc->{dnsServer}; + my ($net, $o_gw_intf) = @_; + my $gw_intf = $o_gw_intf || get_default_gateway_interface($net) or return; + return $gw_intf, get_interface_status($gw_intf), $net->{resolv}{dnsServer}; } sub get_interface_type { |