From 8926342d37889e94301b731267492b34ae486547 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 8 Aug 2005 15:19:14 +0000 Subject: initial IPv6 support (6to4 tunnel) --- perl-install/network/netconnect.pm | 15 +++++++++++++-- perl-install/network/network.pm | 8 ++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 025210a23..da095d2c2 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -70,7 +70,7 @@ sub real_main { my (@ndiswrapper_drivers, $ndiswrapper_driver, $ndiswrapper_device); my ($is_wireless, $wireless_enc_mode, $wireless_enc_key, $need_rt2x00_iwpriv, $wireless_roaming, $need_wpa_supplicant); my ($dvb_adapter, $dvb_ad, $dvb_net, $dvb_pid); - my ($module, $auto_ip, $protocol, $onboot, $needhostname, $peerdns, $peeryp, $peerntpd, $ifplugd, $track_network_id); # lan config + my ($module, $auto_ip, $protocol, $onboot, $needhostname, $peerdns, $peeryp, $peerntpd, $ifplugd, $track_network_id, $ipv6_tunnel, $need_network_restart); my $success = 1; my $ethntf = {}; my $db_path = "/usr/share/apps/kppp/Provider"; @@ -160,7 +160,9 @@ sub real_main { if ($net->{type} eq 'adsl' && !member($net->{adsl}{method}, qw(static dhcp)) || member($net->{type}, qw(modem isdn isdn_external))) { return "ask_connect_now"; - } else { + } elsif ($need_network_restart) { + services::restart("network"); + } else { network::tools::stop_net_interface($net, 0); network::tools::start_net_interface($net, 0); } @@ -872,6 +874,7 @@ If you do not know, choose 'use PPPoE'"), $track_network_id = $::isStandalone && $ethntf->{HWADDR} || detect_devices::isLaptop(); delete $ethntf->{TYPE} if $net->{type} ne 'adsl' || !member($net->{adsl}{method}, qw(static dhcp)); $ethntf->{DHCP_CLIENT} ||= (find { -x "$::prefix/sbin/$_" } qw(dhclient dhcpcd pump dhcpxd)); + $ipv6_tunnel = text2bool($ethntf->{IPV6TO4INIT}); }, name => sub { join('', N("Configuring network device %s (driver %s)", $ethntf->{DEVICE}, $module), @@ -896,6 +899,7 @@ notation (for example, 1.2.3.4).")), { text => N("Start at boot"), val => \$onboot, type => "bool" }, ), { label => N("Metric"), val => \$ethntf->{METRIC}, advanced => 1 }, + { text => N("Enable IPv6 to IPv4 tunnel"), val => \$ipv6_tunnel, type => "bool", advanced => 1 }, if_($auto_ip, { label => N("DHCP client"), val => \$ethntf->{DHCP_CLIENT}, list => \@network::ethernet::dhcp_clients, advanced => 1 }, @@ -941,6 +945,13 @@ notation (for example, 1.2.3.4).")), #- FIXME: special case for sagem where $ethntf->{DEVICE} is the result of a command #- we can't always use $ntf_name because of some USB DSL modems $net->{net_interface} = $ntf_name eq "sagem" ? "sagem" : $ethntf->{DEVICE}; + $need_network_restart = $ipv6_tunnel xor text2bool($ethntf->{IPV6TO4INIT}); + if ($ipv6_tunnel) { + $net->{network}{NETWORKING_IPV6} = "yes"; + $net->{network}{IPV6_DEFAULTDEV} = "tun6to4"; + } + $ethntf->{IPV6INIT} = bool2yesno($ipv6_tunnel); + $ethntf->{IPV6TO4INIT} = bool2yesno($ipv6_tunnel); if ($auto_ip) { #- delete gateway settings if gateway device is invalid or if reconfiguring the gateway interface to dhcp $delete_gateway_settings->($ntf_name); diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index 321f61ec9..55b73f895 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -30,11 +30,12 @@ my $tmdns_file = "/etc/tmdns.conf"; #- network (/etc/sysconfig/network) : NETWORKING FORWARD_IPV4 NETWORKING_IPV6 HOSTNAME GATEWAY GATEWAYDEV NISDOMAIN #- NETWORKING : networking flag : string : "yes" by default #- FORWARD_IPV4 : forward IP flag : string : "false" by default -#- NETWORKING_IPV6 : use IPv6, "yes" or "no" #- HOSTNAME : hostname : string : "localhost.localdomain" by default #- GATEWAY : gateway #- GATEWAYDEV : gateway interface #- NISDOMAIN : nis domain +#- NETWORKING_IPV6 : use IPv6, "yes" or "no" +#- IPV6_DEFAULTDEV #- resolv (/etc/resolv.conf): dnsServer, dnsServer2, dnsServer3, DOMAINNAME, DOMAINNAME2, DOMAINNAME3 #- dnsServer : dns server 1 #- dnsServer2 : dns server 2 @@ -53,6 +54,8 @@ my $tmdns_file = "/etc/tmdns.conf"; #- NETMASK : netmask #- DEVICE : device name #- BOOTPROTO : boot prototype : "bootp" or "dhcp" or "pump" or ... +#- IPV6INIT +#- IPV6TO4INIT sub read_conf { my ($file) = @_; @@ -97,7 +100,7 @@ sub write_network_conf { } $net->{network}{NETWORKING} = 'yes'; - setVarsInSh($::prefix . $network_file, $net->{network}, qw(HOSTNAME NETWORKING GATEWAY GATEWAYDEV NISDOMAIN FORWARD_IPV4 NETWORKING_IPV6)); + setVarsInSh($::prefix . $network_file, $net->{network}, qw(HOSTNAME NETWORKING GATEWAY GATEWAYDEV NISDOMAIN FORWARD_IPV4 NETWORKING_IPV6 IPV6_DEFAULTDEV)); $net->{network}{HOSTNAME} && !$::isInstall and sethostname($net); } @@ -195,6 +198,7 @@ sub write_interface_conf { setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR METRIC MII_NOT_SUPPORTED TYPE USERCTL ATM_ADDR ETHTOOL_OPTS VLAN MTU), qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV WIRELESS_WPA_DRIVER), qw(DVB_ADAPTER_ID DVB_NETWORK_DEMUX DVB_NETWORK_PID), + qw(IPV6INIT IPV6TO4INIT), if_($intf->{BOOTPROTO} eq "dhcp", qw(DHCP_CLIENT DHCP_HOSTNAME NEEDHOSTNAME PEERDNS PEERYP PEERNTPD DHCP_TIMEOUT)), if_($intf->{DEVICE} =~ /^ippp\d+$/, qw(DIAL_ON_IFUP)) ); -- cgit v1.2.1