1#!/bin/sh
2#-
3# Copyright (c) 2011 Nathan Whitehorn
4# Copyright (c) 2011 The FreeBSD Foundation
5# Copyright (c) 2013 Devin Teske
6# All rights reserved.
7#
8# Portions of this software were developed by Bjoern Zeeb
9# under sponsorship from the FreeBSD Foundation.
10#
11# Redistribution and use in source and binary forms, with or without
12# modification, are permitted provided that the following conditions
13# are met:
--- 10 unchanged lines hidden (view full) ---
24# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30# SUCH DAMAGE.
31#
32# $FreeBSD: stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv6 258421 2013-11-21 03:40:52Z dteske $
33#
34############################################################ INCLUDES
35
36BSDCFG_SHARE="/usr/share/bsdconfig"
37. $BSDCFG_SHARE/common.subr || exit 1
38f_dprintf "%s: loading includes..." "$0"
39f_include $BSDCFG_SHARE/dialog.subr
40
41############################################################ MAIN
42
43#
44# TODO:
45# - Add DHCPv6 support once FreeBSD ships with it.
46#
47
48INTERFACE=$1
49case "${INTERFACE}" in
50"") dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
51 --msgbox 'No interface specified for IPv6 configuration.' 0 0
52 exit 1
53 ;;
54esac
55
56AGAIN=""
57while : ; do
58 MSG="Would you like to try stateless address autoconfiguration (SLAAC)${AGAIN}?"
59 dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
60 --yesno "${MSG}" 0 0
61 if [ $? -eq $DIALOG_OK ]; then
62 if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
63 dialog --backtitle 'FreeBSD Installer' \
64 --infobox "Sending Router Solicitation ..." 0 0
65 ifconfig ${INTERFACE} inet6 -ifdisabled accept_rtadv up
66 err=$( rtsol -F $INTERFACE 2>&1 )
67 if [ $? -ne 0 ]; then
68 f_dprintf "%s" "$err"
69 dialog --backtitle 'FreeBSD Installer' --msgbox "SLAAC failed." 0 0
70 AGAIN=" again"
71 continue
72 fi
73 fi
74 echo ifconfig_${INTERFACE}_ipv6=\"inet6 accept_rtadv\" >> $BSDINSTALL_TMPETC/._rc.conf.net
75 exit 0
76 else
--- 69 unchanged lines hidden (view full) ---
146 . $BSDINSTALL_TMPETC/._rc.conf.net
147 ifconfig ${INTERFACE} `eval echo \\\$ifconfig_${INTERFACE}_ipv6`
148 if [ -n "${ipv6_defaultrouter}" ]; then
149 route delete -inet6 default
150 route add -inet6 default ${ipv6_defaultrouter}
151 fi
152fi
153
154################################################################################
155# END
156################################################################################
2#-
3# Copyright (c) 2011 Nathan Whitehorn
4# Copyright (c) 2011 The FreeBSD Foundation
5# Copyright (c) 2013 Devin Teske
6# All rights reserved.
7#
8# Portions of this software were developed by Bjoern Zeeb
9# under sponsorship from the FreeBSD Foundation.
10#
11# Redistribution and use in source and binary forms, with or without
12# modification, are permitted provided that the following conditions
13# are met:
--- 10 unchanged lines hidden (view full) ---
24# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30# SUCH DAMAGE.
31#
32# $FreeBSD: stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv6 258421 2013-11-21 03:40:52Z dteske $
33#
34############################################################ INCLUDES
35
36BSDCFG_SHARE="/usr/share/bsdconfig"
37. $BSDCFG_SHARE/common.subr || exit 1
38f_dprintf "%s: loading includes..." "$0"
39f_include $BSDCFG_SHARE/dialog.subr
40
41############################################################ MAIN
42
43#
44# TODO:
45# - Add DHCPv6 support once FreeBSD ships with it.
46#
47
48INTERFACE=$1
49case "${INTERFACE}" in
50"") dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
51 --msgbox 'No interface specified for IPv6 configuration.' 0 0
52 exit 1
53 ;;
54esac
55
56AGAIN=""
57while : ; do
58 MSG="Would you like to try stateless address autoconfiguration (SLAAC)${AGAIN}?"
59 dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
60 --yesno "${MSG}" 0 0
61 if [ $? -eq $DIALOG_OK ]; then
62 if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
63 dialog --backtitle 'FreeBSD Installer' \
64 --infobox "Sending Router Solicitation ..." 0 0
65 ifconfig ${INTERFACE} inet6 -ifdisabled accept_rtadv up
66 err=$( rtsol -F $INTERFACE 2>&1 )
67 if [ $? -ne 0 ]; then
68 f_dprintf "%s" "$err"
69 dialog --backtitle 'FreeBSD Installer' --msgbox "SLAAC failed." 0 0
70 AGAIN=" again"
71 continue
72 fi
73 fi
74 echo ifconfig_${INTERFACE}_ipv6=\"inet6 accept_rtadv\" >> $BSDINSTALL_TMPETC/._rc.conf.net
75 exit 0
76 else
--- 69 unchanged lines hidden (view full) ---
146 . $BSDINSTALL_TMPETC/._rc.conf.net
147 ifconfig ${INTERFACE} `eval echo \\\$ifconfig_${INTERFACE}_ipv6`
148 if [ -n "${ipv6_defaultrouter}" ]; then
149 route delete -inet6 default
150 route add -inet6 default ${ipv6_defaultrouter}
151 fi
152fi
153
154################################################################################
155# END
156################################################################################