xref: /aosp_15_r20/external/ot-br-posix/script/standalone_ipv6 (revision 4a64e381480ef79f0532b2421e44e6ee336b8e0d)
1*4a64e381SAndroid Build Coastguard Worker#!/bin/bash
2*4a64e381SAndroid Build Coastguard Worker#
3*4a64e381SAndroid Build Coastguard Worker#  Copyright (c) 2017, The OpenThread Authors.
4*4a64e381SAndroid Build Coastguard Worker#  All rights reserved.
5*4a64e381SAndroid Build Coastguard Worker#
6*4a64e381SAndroid Build Coastguard Worker#  Redistribution and use in source and binary forms, with or without
7*4a64e381SAndroid Build Coastguard Worker#  modification, are permitted provided that the following conditions are met:
8*4a64e381SAndroid Build Coastguard Worker#  1. Redistributions of source code must retain the above copyright
9*4a64e381SAndroid Build Coastguard Worker#     notice, this list of conditions and the following disclaimer.
10*4a64e381SAndroid Build Coastguard Worker#  2. Redistributions in binary form must reproduce the above copyright
11*4a64e381SAndroid Build Coastguard Worker#     notice, this list of conditions and the following disclaimer in the
12*4a64e381SAndroid Build Coastguard Worker#     documentation and/or other materials provided with the distribution.
13*4a64e381SAndroid Build Coastguard Worker#  3. Neither the name of the copyright holder nor the
14*4a64e381SAndroid Build Coastguard Worker#     names of its contributors may be used to endorse or promote products
15*4a64e381SAndroid Build Coastguard Worker#     derived from this software without specific prior written permission.
16*4a64e381SAndroid Build Coastguard Worker#
17*4a64e381SAndroid Build Coastguard Worker#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18*4a64e381SAndroid Build Coastguard Worker#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*4a64e381SAndroid Build Coastguard Worker#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*4a64e381SAndroid Build Coastguard Worker#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21*4a64e381SAndroid Build Coastguard Worker#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22*4a64e381SAndroid Build Coastguard Worker#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23*4a64e381SAndroid Build Coastguard Worker#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24*4a64e381SAndroid Build Coastguard Worker#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25*4a64e381SAndroid Build Coastguard Worker#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26*4a64e381SAndroid Build Coastguard Worker#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27*4a64e381SAndroid Build Coastguard Worker#  POSSIBILITY OF SUCH DAMAGE.
28*4a64e381SAndroid Build Coastguard Worker#
29*4a64e381SAndroid Build Coastguard Worker#----------------------------------------
30*4a64e381SAndroid Build Coastguard Worker# Purpose:
31*4a64e381SAndroid Build Coastguard Worker#  To understand the purpose of this script see: print_big_ugly_warning() below.
32*4a64e381SAndroid Build Coastguard Worker#----------------------------------------
33*4a64e381SAndroid Build Coastguard Worker#
34*4a64e381SAndroid Build Coastguard Worker
35*4a64e381SAndroid Build Coastguard Worker# remember the name of this script
36*4a64e381SAndroid Build Coastguard WorkerSCRIPT_NAME=$0
37*4a64e381SAndroid Build Coastguard Worker
38*4a64e381SAndroid Build Coastguard WorkerCWD=$(pwd)
39*4a64e381SAndroid Build Coastguard WorkerDATE=$(date)
40*4a64e381SAndroid Build Coastguard Worker
41*4a64e381SAndroid Build Coastguard Worker# shellcheck source=script/_initrc
42*4a64e381SAndroid Build Coastguard Worker. "$(dirname "$0")"/_initrc
43*4a64e381SAndroid Build Coastguard Worker
44*4a64e381SAndroid Build Coastguard WorkerETH0_IPV6_BASE_PREFIX=fd11:33
45*4a64e381SAndroid Build Coastguard Worker
46*4a64e381SAndroid Build Coastguard Workerdebug_echo()
47*4a64e381SAndroid Build Coastguard Worker{
48*4a64e381SAndroid Build Coastguard Worker    if [ "${_DEBUG_IPV6}" == "true" ]; then
49*4a64e381SAndroid Build Coastguard Worker        echo "${@}"
50*4a64e381SAndroid Build Coastguard Worker    fi
51*4a64e381SAndroid Build Coastguard Worker}
52*4a64e381SAndroid Build Coastguard Worker
53*4a64e381SAndroid Build Coastguard Workerdetermine_eth0_name()
54*4a64e381SAndroid Build Coastguard Worker{
55*4a64e381SAndroid Build Coastguard Worker    ETH0_NAME=''
56*4a64e381SAndroid Build Coastguard Worker
57*4a64e381SAndroid Build Coastguard Worker    #
58*4a64e381SAndroid Build Coastguard Worker    # this gives us a sorted list of network interface names
59*4a64e381SAndroid Build Coastguard Worker    for devname in $(
60*4a64e381SAndroid Build Coastguard Worker        cd /sys/class/net || exit
61*4a64e381SAndroid Build Coastguard Worker        ls
62*4a64e381SAndroid Build Coastguard Worker    ); do
63*4a64e381SAndroid Build Coastguard Worker        # We want the physical device
64*4a64e381SAndroid Build Coastguard Worker        # Not things like "usb0" or "wpan0"
65*4a64e381SAndroid Build Coastguard Worker        # And we assume the first one is what we want
66*4a64e381SAndroid Build Coastguard Worker        debug_echo "Consider: ${devname}"
67*4a64e381SAndroid Build Coastguard Worker        ignore=false
68*4a64e381SAndroid Build Coastguard Worker        case ${devname} in
69*4a64e381SAndroid Build Coastguard Worker            usb* | can* | wpan* | br* | wlan* | lo)
70*4a64e381SAndroid Build Coastguard Worker                # by name we can ignore USB-gadget, CANbus, Thread, wireless and loopback
71*4a64e381SAndroid Build Coastguard Worker                ignore=true
72*4a64e381SAndroid Build Coastguard Worker                ;;
73*4a64e381SAndroid Build Coastguard Worker            *)
74*4a64e381SAndroid Build Coastguard Worker                ignore=false
75*4a64e381SAndroid Build Coastguard Worker                ;;
76*4a64e381SAndroid Build Coastguard Worker        esac
77*4a64e381SAndroid Build Coastguard Worker
78*4a64e381SAndroid Build Coastguard Worker        if $ignore; then
79*4a64e381SAndroid Build Coastguard Worker            debug_echo "Ignore ${devname} by name"
80*4a64e381SAndroid Build Coastguard Worker            continue
81*4a64e381SAndroid Build Coastguard Worker        fi
82*4a64e381SAndroid Build Coastguard Worker
83*4a64e381SAndroid Build Coastguard Worker        debug_echo "Consider: ${devname}"
84*4a64e381SAndroid Build Coastguard Worker        if [ ! -L /sys/class/net/"${devname}"/device ]; then
85*4a64e381SAndroid Build Coastguard Worker            debug_echo "Not a DEVICE ${devname}"
86*4a64e381SAndroid Build Coastguard Worker            continue
87*4a64e381SAndroid Build Coastguard Worker        fi
88*4a64e381SAndroid Build Coastguard Worker
89*4a64e381SAndroid Build Coastguard Worker        type=$(cat /sys/class/net/"${devname}"/type)
90*4a64e381SAndroid Build Coastguard Worker        # Type1 = ARPHRD_ETHER
91*4a64e381SAndroid Build Coastguard Worker        if [ "$type" -ne 1 ]; then
92*4a64e381SAndroid Build Coastguard Worker            debug_echo "Not ARPHRD_ETHER"
93*4a64e381SAndroid Build Coastguard Worker            continue
94*4a64e381SAndroid Build Coastguard Worker        fi
95*4a64e381SAndroid Build Coastguard Worker        # We assume the first thing we find is our device
96*4a64e381SAndroid Build Coastguard Worker        ETH0_NAME=${devname}
97*4a64e381SAndroid Build Coastguard Worker        break
98*4a64e381SAndroid Build Coastguard Worker    done
99*4a64e381SAndroid Build Coastguard Worker
100*4a64e381SAndroid Build Coastguard Worker    if [ -z "${ETH0_NAME}" ]; then
101*4a64e381SAndroid Build Coastguard Worker        echo "Cannot determine ETH0 name...."
102*4a64e381SAndroid Build Coastguard Worker        exit 1
103*4a64e381SAndroid Build Coastguard Worker    fi
104*4a64e381SAndroid Build Coastguard Worker    echo "Assuming: Primary ETHERNET name is $ETH0_NAME"
105*4a64e381SAndroid Build Coastguard Worker}
106*4a64e381SAndroid Build Coastguard Worker
107*4a64e381SAndroid Build Coastguard Workerinstall_radvd()
108*4a64e381SAndroid Build Coastguard Worker{
109*4a64e381SAndroid Build Coastguard Worker    echo "Fetching RADVD..."
110*4a64e381SAndroid Build Coastguard Worker    echo "apt-get install --no-install-recommends radvd"
111*4a64e381SAndroid Build Coastguard Worker    sudo apt-get install --no-install-recommends radvd
112*4a64e381SAndroid Build Coastguard Worker}
113*4a64e381SAndroid Build Coastguard Worker
114*4a64e381SAndroid Build Coastguard Workerchoose_random_eth0_address()
115*4a64e381SAndroid Build Coastguard Worker{
116*4a64e381SAndroid Build Coastguard Worker    # steps below are
117*4a64e381SAndroid Build Coastguard Worker    #   Using "od" see http://man7.org/linux/man-pages/man1/od.1.html
118*4a64e381SAndroid Build Coastguard Worker    #      read from /dev/urandom
119*4a64e381SAndroid Build Coastguard Worker    #
120*4a64e381SAndroid Build Coastguard Worker    # We use /dev/urandom not /dev/random for these reasons:
121*4a64e381SAndroid Build Coastguard Worker    # 1) This is for private (not public) test purposes
122*4a64e381SAndroid Build Coastguard Worker    # 2) urandom might stall ... and not give us bytes
123*4a64e381SAndroid Build Coastguard Worker    #
124*4a64e381SAndroid Build Coastguard Worker    # We want data in 16bit hex, hence: --format=x2
125*4a64e381SAndroid Build Coastguard Worker    # We want only 4 bytes, hence --read-bytes=4
126*4a64e381SAndroid Build Coastguard Worker    #
127*4a64e381SAndroid Build Coastguard Worker    # The output looks like:
128*4a64e381SAndroid Build Coastguard Worker    #      0000000 1234 5678
129*4a64e381SAndroid Build Coastguard Worker    #      0000008
130*4a64e381SAndroid Build Coastguard Worker    #
131*4a64e381SAndroid Build Coastguard Worker    # head gives us the first line
132*4a64e381SAndroid Build Coastguard Worker    # cut gives us the items 2 and 3 on the line
133*4a64e381SAndroid Build Coastguard Worker    # tr  converts the space into a ':'
134*4a64e381SAndroid Build Coastguard Worker    #
135*4a64e381SAndroid Build Coastguard Worker    RANDOM_32BIT_VALUE=$(od --read-bytes=4 --format=x2 /dev/urandom \
136*4a64e381SAndroid Build Coastguard Worker        | head -1 \
137*4a64e381SAndroid Build Coastguard Worker        | cut -d' ' -f2,3 \
138*4a64e381SAndroid Build Coastguard Worker        | tr ' ' ':')
139*4a64e381SAndroid Build Coastguard Worker
140*4a64e381SAndroid Build Coastguard Worker    # thus, "RANDOM_32BIT_VALUE=1234:5678"
141*4a64e381SAndroid Build Coastguard Worker
142*4a64e381SAndroid Build Coastguard Worker    # We'll use this for the radvd config
143*4a64e381SAndroid Build Coastguard Worker    ETH0_IPV6_PREFIX=${ETH0_IPV6_BASE_PREFIX}:${RANDOM_32BIT_VALUE}
144*4a64e381SAndroid Build Coastguard Worker
145*4a64e381SAndroid Build Coastguard Worker    # and this for the static network address
146*4a64e381SAndroid Build Coastguard Worker    ETH0_IPV6_STATIC_ADDRESS=${ETH0_IPV6_PREFIX}::1
147*4a64e381SAndroid Build Coastguard Worker}
148*4a64e381SAndroid Build Coastguard Worker
149*4a64e381SAndroid Build Coastguard Workerconfigure_radvd()
150*4a64e381SAndroid Build Coastguard Worker{
151*4a64e381SAndroid Build Coastguard Worker    # this creates a configuration file for radvd
152*4a64e381SAndroid Build Coastguard Worker    CFG_FILE=/etc/radvd.conf
153*4a64e381SAndroid Build Coastguard Worker    if [ -f $CFG_FILE ]; then
154*4a64e381SAndroid Build Coastguard Worker        echo "radvd config file exists: $CFG_FILE"
155*4a64e381SAndroid Build Coastguard Worker        echo "SKIPPING radvd configuration"
156*4a64e381SAndroid Build Coastguard Worker    else
157*4a64e381SAndroid Build Coastguard Worker        sudo tee -a /etc/radvd.conf <<__EOF__
158*4a64e381SAndroid Build Coastguard Worker#
159*4a64e381SAndroid Build Coastguard Worker# This RADVD configuration file was created
160*4a64e381SAndroid Build Coastguard Worker# by the OpenThread configuration script $SCRIPT_NAME
161*4a64e381SAndroid Build Coastguard Worker# Executed in the directory ${CWD} on ${DATE}
162*4a64e381SAndroid Build Coastguard Worker#
163*4a64e381SAndroid Build Coastguard Worker# The purpose is to configure IPV6 in an issolated and
164*4a64e381SAndroid Build Coastguard Worker# standalone network configuration for the purpose of test only
165*4a64e381SAndroid Build Coastguard Worker#
166*4a64e381SAndroid Build Coastguard Worker# This is by no means a complete IPv6 configuration
167*4a64e381SAndroid Build Coastguard Worker# it is sufficent to allow coap transactions
168*4a64e381SAndroid Build Coastguard Worker# with thread devices on the thread mesh network
169*4a64e381SAndroid Build Coastguard Worker# attched to this boarder router
170*4a64e381SAndroid Build Coastguard Worker#
171*4a64e381SAndroid Build Coastguard Workerinterface ${ETH0_NAME} {
172*4a64e381SAndroid Build Coastguard Worker    # We want to send router adverts
173*4a64e381SAndroid Build Coastguard Worker    AdvSendAdvert on;
174*4a64e381SAndroid Build Coastguard Worker
175*4a64e381SAndroid Build Coastguard Worker    # This is not a proper IPv6 router
176*4a64e381SAndroid Build Coastguard Worker    # it is only for openthread
177*4a64e381SAndroid Build Coastguard Worker    AdvDefaultPreference low;
178*4a64e381SAndroid Build Coastguard Worker
179*4a64e381SAndroid Build Coastguard Worker    # We should advertize this prefix
180*4a64e381SAndroid Build Coastguard Worker    prefix ${ETH0_IPV6_PREFIX}::/64 {
181*4a64e381SAndroid Build Coastguard Worker         # we want this "on link"
182*4a64e381SAndroid Build Coastguard Worker         AdvOnLink on;
183*4a64e381SAndroid Build Coastguard Worker         # devices should self-assign addresses with this prefix
184*4a64e381SAndroid Build Coastguard Worker         AdvAutonomous on;
185*4a64e381SAndroid Build Coastguard Worker         AdvRouterAddr on;
186*4a64e381SAndroid Build Coastguard Worker    };
187*4a64e381SAndroid Build Coastguard Worker};
188*4a64e381SAndroid Build Coastguard Worker__EOF__
189*4a64e381SAndroid Build Coastguard Worker    fi
190*4a64e381SAndroid Build Coastguard Worker}
191*4a64e381SAndroid Build Coastguard Worker
192*4a64e381SAndroid Build Coastguard Workerassign_eth0_static_ipv6()
193*4a64e381SAndroid Build Coastguard Worker{
194*4a64e381SAndroid Build Coastguard Worker
195*4a64e381SAndroid Build Coastguard Worker    # this creates a static IPv6 address for Eth0
196*4a64e381SAndroid Build Coastguard Worker    sudo tee -a /etc/network/interfaces <<__EOF__
197*4a64e381SAndroid Build Coastguard Worker
198*4a64e381SAndroid Build Coastguard Worker# This configuration was created by
199*4a64e381SAndroid Build Coastguard Worker# the openthread ${SCRIPT_NAME}
200*4a64e381SAndroid Build Coastguard Worker# executing in the directory ${CWD}
201*4a64e381SAndroid Build Coastguard Worker# and executed on ${DATE}
202*4a64e381SAndroid Build Coastguard Worker#
203*4a64e381SAndroid Build Coastguard Worker# for the purposes of testing ipv6 addresses
204*4a64e381SAndroid Build Coastguard Worker# in an issolated network configuration
205*4a64e381SAndroid Build Coastguard Worker
206*4a64e381SAndroid Build Coastguard Worker# ensure ETH0 is configured at boot
207*4a64e381SAndroid Build Coastguard Workerauto ${ETH0_NAME}
208*4a64e381SAndroid Build Coastguard Worker
209*4a64e381SAndroid Build Coastguard Worker# Configure the IPv6 address static
210*4a64e381SAndroid Build Coastguard Worker# Note: IPv4 is not effected by this
211*4a64e381SAndroid Build Coastguard Workeriface ${ETH0_NAME} inet6 static
212*4a64e381SAndroid Build Coastguard Worker    address ${ETH0_IPV6_STATIC_ADDRESS}
213*4a64e381SAndroid Build Coastguard Worker    netmask 64
214*4a64e381SAndroid Build Coastguard Worker__EOF__
215*4a64e381SAndroid Build Coastguard Worker
216*4a64e381SAndroid Build Coastguard Worker}
217*4a64e381SAndroid Build Coastguard Worker
218*4a64e381SAndroid Build Coastguard Worker# on BBB we do this.
219*4a64e381SAndroid Build Coastguard Worker# other platforms might do something simular
220*4a64e381SAndroid Build Coastguard Workerbbb_main()
221*4a64e381SAndroid Build Coastguard Worker{
222*4a64e381SAndroid Build Coastguard Worker    install_radvd
223*4a64e381SAndroid Build Coastguard Worker    determine_eth0_name
224*4a64e381SAndroid Build Coastguard Worker    choose_random_eth0_address
225*4a64e381SAndroid Build Coastguard Worker    configure_radvd
226*4a64e381SAndroid Build Coastguard Worker    assign_eth0_static_ipv6
227*4a64e381SAndroid Build Coastguard Worker
228*4a64e381SAndroid Build Coastguard Worker    echo "You should now reboot your Device"
229*4a64e381SAndroid Build Coastguard Worker}
230*4a64e381SAndroid Build Coastguard Worker
231*4a64e381SAndroid Build Coastguard Workerprint_big_ugly_warning()
232*4a64e381SAndroid Build Coastguard Worker{
233*4a64e381SAndroid Build Coastguard Worker    # Scare our victim.
234*4a64e381SAndroid Build Coastguard Worker
235*4a64e381SAndroid Build Coastguard Worker    cat <<_EOF_
236*4a64e381SAndroid Build Coastguard Worker
237*4a64e381SAndroid Build Coastguard WorkerPlease understand the purpose of this script.
238*4a64e381SAndroid Build Coastguard Worker
239*4a64e381SAndroid Build Coastguard WorkerThis script is not intended to be an complete and proper IPv6
240*4a64e381SAndroid Build Coastguard Workerconfiguration script.
241*4a64e381SAndroid Build Coastguard Worker
242*4a64e381SAndroid Build Coastguard WorkerThis is only hack that turns on just enough IPv6 to perform simple
243*4a64e381SAndroid Build Coastguard WorkerCoAP requests on or across an issolated test network to the Thread
244*4a64e381SAndroid Build Coastguard Workernetwork.
245*4a64e381SAndroid Build Coastguard Worker
246*4a64e381SAndroid Build Coastguard WorkerThe example issolated test network consists of these parts:
247*4a64e381SAndroid Build Coastguard Worker
248*4a64e381SAndroid Build Coastguard Worker1) A thread RF radio network.
249*4a64e381SAndroid Build Coastguard Worker
250*4a64e381SAndroid Build Coastguard Worker2) The OpenThread Border router attached to the Thread network
251*4a64e381SAndroid Build Coastguard Worker
252*4a64e381SAndroid Build Coastguard Worker3) The Openthread Border router would typically be connected
253*4a64e381SAndroid Build Coastguard Worker   to a residential home network in some way (wifi, or wired)
254*4a64e381SAndroid Build Coastguard Worker
255*4a64e381SAndroid Build Coastguard Worker   In this case, it is connected to a router that is not
256*4a64e381SAndroid Build Coastguard Worker   connected to an upstream provider - it is issolated.
257*4a64e381SAndroid Build Coastguard Worker
258*4a64e381SAndroid Build Coastguard Worker4) In order to test & develop applications other things on the
259*4a64e381SAndroid Build Coastguard Worker   "home/test network" need to talk to the various Thread end nodes
260*4a64e381SAndroid Build Coastguard Worker   via IPv6
261*4a64e381SAndroid Build Coastguard Worker
262*4a64e381SAndroid Build Coastguard Worker   Examples include:
263*4a64e381SAndroid Build Coastguard Worker
264*4a64e381SAndroid Build Coastguard Worker   * Laptop, or desktop machine
265*4a64e381SAndroid Build Coastguard Worker   * Android/Apple Phone or Tablet
266*4a64e381SAndroid Build Coastguard Worker   * other network devices
267*4a64e381SAndroid Build Coastguard Worker
268*4a64e381SAndroid Build Coastguard WorkerTo test/develop your applications a means for these other devices on
269*4a64e381SAndroid Build Coastguard Workeryour test network to talk to devices on the Thread Network must exist.
270*4a64e381SAndroid Build Coastguard Worker
271*4a64e381SAndroid Build Coastguard WorkerThe problem:
272*4a64e381SAndroid Build Coastguard Worker
273*4a64e381SAndroid Build Coastguard Worker
274*4a64e381SAndroid Build Coastguard Worker   Most home network routers provide only IPv4 services. They most
275*4a64e381SAndroid Build Coastguard Worker   typically assume the upstream ISP network provider will provide
276*4a64e381SAndroid Build Coastguard Worker   IPv6 addresses and configuration. A test network is often issolated
277*4a64e381SAndroid Build Coastguard Worker   and not connected to the large world wide web, it is completely an
278*4a64e381SAndroid Build Coastguard Worker   island. The upstream ISP provider does not exist.
279*4a64e381SAndroid Build Coastguard Worker
280*4a64e381SAndroid Build Coastguard Worker   In the end something needs to provide a minimal IPv6 configuration.
281*4a64e381SAndroid Build Coastguard Worker
282*4a64e381SAndroid Build Coastguard Worker=========================================================
283*4a64e381SAndroid Build Coastguard WorkerThe above is the purpose of this ipv6 standalone hack script
284*4a64e381SAndroid Build Coastguard Worker
285*4a64e381SAndroid Build Coastguard WorkerNever consider this script a proper IPv6 configuration.
286*4a64e381SAndroid Build Coastguard Worker=========================================================
287*4a64e381SAndroid Build Coastguard Worker
288*4a64e381SAndroid Build Coastguard WorkerIt is only a quick hack that enables enough IPv6 to work such that:
289*4a64e381SAndroid Build Coastguard Worker
290*4a64e381SAndroid Build Coastguard Worker1) Your local test laptop/cellphone has an IPv6 address and
291*4a64e381SAndroid Build Coastguard Worker2) can perform CoAP transfers between a node on thread network
292*4a64e381SAndroid Build Coastguard Worker
293*4a64e381SAndroid Build Coastguard WorkerNow that you have read and understood the above, execute this script
294*4a64e381SAndroid Build Coastguard Workeragain like this:
295*4a64e381SAndroid Build Coastguard Worker
296*4a64e381SAndroid Build Coastguard Worker      ${SCRIPT_NAME}   enable_ipv6_hack
297*4a64e381SAndroid Build Coastguard Worker
298*4a64e381SAndroid Build Coastguard Worker_EOF_
299*4a64e381SAndroid Build Coastguard Worker
300*4a64e381SAndroid Build Coastguard Worker}
301*4a64e381SAndroid Build Coastguard Worker
302*4a64e381SAndroid Build Coastguard Worker# ensure user/victim has read the ugly warning.
303*4a64e381SAndroid Build Coastguard Workerif [ "${1}" != "enable_ipv6_hack" ]; then
304*4a64e381SAndroid Build Coastguard Worker    print_big_ugly_warning
305*4a64e381SAndroid Build Coastguard Worker    exit 1
306*4a64e381SAndroid Build Coastguard Workerfi
307*4a64e381SAndroid Build Coastguard Worker
308*4a64e381SAndroid Build Coastguard Worker# platforms specifc
309*4a64e381SAndroid Build Coastguard Workercase ${PLATFORM} in
310*4a64e381SAndroid Build Coastguard Worker    "beagleboneblack")
311*4a64e381SAndroid Build Coastguard Worker        bbb_main
312*4a64e381SAndroid Build Coastguard Worker        ;;
313*4a64e381SAndroid Build Coastguard Worker    *)
314*4a64e381SAndroid Build Coastguard Worker        die "Unsupported/unknown platform ${PLATFORM}"
315*4a64e381SAndroid Build Coastguard Worker        ;;
316*4a64e381SAndroid Build Coastguard Workeresac
317