1#!/bin/sh
2#-
3# Copyright (c) 2011 Nathan Whitehorn
4# All rights reserved.
5# Copyright (c) 2011 The FreeBSD Foundation
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 225429 2011-09-07 00:45:15Z bz $
33
34#
35# TODO:
36# - Add DHCPv6 support once FreeBSD ships with it.
37#
38
39: ${DIALOG_OK=0}
40: ${DIALOG_CANCEL=1}
41: ${DIALOG_HELP=2}
42: ${DIALOG_EXTRA=3}
43: ${DIALOG_ITEM_HELP=4}
44: ${DIALOG_ESC=255}
45
46INTERFACE=$1
47case "${INTERFACE}" in
48"") dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
49 --msgbox 'No interface specified for IPv6 configuration.' 0 0
50 exit 1
51 ;;
52esac
53
54AGAIN=""
55while : ; do
56 MSG="Would you like to try stateless address autoconfiguration (SLAAC)${AGAIN}?"
57 dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
58 --yesno "${MSG}" 0 0
59 if [ $? -eq $DIALOG_OK ]; then
60 if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
61 dialog --backtitle 'FreeBSD Installer' \
62 --infobox "Sending Router Solicitation ..." 0 0
63 ifconfig ${INTERFACE} inet6 -ifdisabled accept_rtadv up
64 rtsol -F $INTERFACE 2>> $BSDINSTALL_LOG
65 if [ $? -ne 0 ]; then
66 dialog --backtitle 'FreeBSD Installer' --msgbox "SLAAC failed." 0 0
67 AGAIN=" again"
68 continue
69 fi
70 fi
71 echo ifconfig_${INTERFACE}_ipv6=\"inet6 accept_rtadv\" >> $BSDINSTALL_TMPETC/._rc.conf.net
72 exit 0
73 else
--- 69 unchanged lines hidden (view full) ---
143 . $BSDINSTALL_TMPETC/._rc.conf.net
144 ifconfig ${INTERFACE} `eval echo \\\$ifconfig_${INTERFACE}_ipv6`
145 if [ -n "${ipv6_defaultrouter}" ]; then
146 route delete -inet6 default
147 route add -inet6 default ${ipv6_defaultrouter}
148 fi
149fi
150
2#-
3# Copyright (c) 2011 Nathan Whitehorn
4# All rights reserved.
5# Copyright (c) 2011 The FreeBSD Foundation
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 225429 2011-09-07 00:45:15Z bz $
33
34#
35# TODO:
36# - Add DHCPv6 support once FreeBSD ships with it.
37#
38
39: ${DIALOG_OK=0}
40: ${DIALOG_CANCEL=1}
41: ${DIALOG_HELP=2}
42: ${DIALOG_EXTRA=3}
43: ${DIALOG_ITEM_HELP=4}
44: ${DIALOG_ESC=255}
45
46INTERFACE=$1
47case "${INTERFACE}" in
48"") dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
49 --msgbox 'No interface specified for IPv6 configuration.' 0 0
50 exit 1
51 ;;
52esac
53
54AGAIN=""
55while : ; do
56 MSG="Would you like to try stateless address autoconfiguration (SLAAC)${AGAIN}?"
57 dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
58 --yesno "${MSG}" 0 0
59 if [ $? -eq $DIALOG_OK ]; then
60 if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
61 dialog --backtitle 'FreeBSD Installer' \
62 --infobox "Sending Router Solicitation ..." 0 0
63 ifconfig ${INTERFACE} inet6 -ifdisabled accept_rtadv up
64 rtsol -F $INTERFACE 2>> $BSDINSTALL_LOG
65 if [ $? -ne 0 ]; then
66 dialog --backtitle 'FreeBSD Installer' --msgbox "SLAAC failed." 0 0
67 AGAIN=" again"
68 continue
69 fi
70 fi
71 echo ifconfig_${INTERFACE}_ipv6=\"inet6 accept_rtadv\" >> $BSDINSTALL_TMPETC/._rc.conf.net
72 exit 0
73 else
--- 69 unchanged lines hidden (view full) ---
143 . $BSDINSTALL_TMPETC/._rc.conf.net
144 ifconfig ${INTERFACE} `eval echo \\\$ifconfig_${INTERFACE}_ipv6`
145 if [ -n "${ipv6_defaultrouter}" ]; then
146 route delete -inet6 default
147 route add -inet6 default ${ipv6_defaultrouter}
148 fi
149fi
150