1*7c478bd9Sstevel@tonic-gate#!/sbin/sh 2*7c478bd9Sstevel@tonic-gate# 3*7c478bd9Sstevel@tonic-gate# CDDL HEADER START 4*7c478bd9Sstevel@tonic-gate# 5*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only 7*7c478bd9Sstevel@tonic-gate# (the "License"). You may not use this file except in compliance 8*7c478bd9Sstevel@tonic-gate# with the License. 9*7c478bd9Sstevel@tonic-gate# 10*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 12*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 13*7c478bd9Sstevel@tonic-gate# and limitations under the License. 14*7c478bd9Sstevel@tonic-gate# 15*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 16*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 18*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 19*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 20*7c478bd9Sstevel@tonic-gate# 21*7c478bd9Sstevel@tonic-gate# CDDL HEADER END 22*7c478bd9Sstevel@tonic-gate# 23*7c478bd9Sstevel@tonic-gate# 24*7c478bd9Sstevel@tonic-gate# Copyright 2004 Sun Microsystems, Inc. All rights reserved. 25*7c478bd9Sstevel@tonic-gate# Use is subject to license terms. 26*7c478bd9Sstevel@tonic-gate# 27*7c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate# 30*7c478bd9Sstevel@tonic-gate# This is the second phase of TCP/IP configuration. The first part is 31*7c478bd9Sstevel@tonic-gate# run by the /lib/svc/method/net-physical script (the svc:/network/physical 32*7c478bd9Sstevel@tonic-gate# service) and includes configuring the interfaces and setting the machine's 33*7c478bd9Sstevel@tonic-gate# hostname. This script (the svc:/network/initial service), does all 34*7c478bd9Sstevel@tonic-gate# configuration that can be done before name services are started. This 35*7c478bd9Sstevel@tonic-gate# includes configuring IP routing, and setting any tunable parameters. 36*7c478bd9Sstevel@tonic-gate# The third part, run by the /lib/svc/method/net-svc script (the 37*7c478bd9Sstevel@tonic-gate# svc:/network/service service), does all configuration that may require 38*7c478bd9Sstevel@tonic-gate# name services. This includes a final re-configuration of the interfaces. 39*7c478bd9Sstevel@tonic-gate# 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate. /lib/svc/share/smf_include.sh 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gatecase "$1" in 44*7c478bd9Sstevel@tonic-gate'start') 45*7c478bd9Sstevel@tonic-gate # 46*7c478bd9Sstevel@tonic-gate # In a zone we need this service to be up, but all of the work 47*7c478bd9Sstevel@tonic-gate # it tries to do is irrelevant (and will actually lead to the service 48*7c478bd9Sstevel@tonic-gate # failing if we try to do it), so just bail out. 49*7c478bd9Sstevel@tonic-gate # 50*7c478bd9Sstevel@tonic-gate if [ `/sbin/zonename` != "global" ]; then 51*7c478bd9Sstevel@tonic-gate exit 0 52*7c478bd9Sstevel@tonic-gate fi 53*7c478bd9Sstevel@tonic-gate ;; # Fall through -- rest of script is the initialization code 54*7c478bd9Sstevel@tonic-gate 55*7c478bd9Sstevel@tonic-gate'stop') 56*7c478bd9Sstevel@tonic-gate if [ `/sbin/zonename` != "global" ]; then 57*7c478bd9Sstevel@tonic-gate exit 0 58*7c478bd9Sstevel@tonic-gate fi 59*7c478bd9Sstevel@tonic-gate # 60*7c478bd9Sstevel@tonic-gate # If we were routing dynamically, we will note this with 61*7c478bd9Sstevel@tonic-gate # the .dynamic_routing file, so that we can leave the routes 62*7c478bd9Sstevel@tonic-gate # in place without thinking they're static route entries 63*7c478bd9Sstevel@tonic-gate # when we come back into states 2 or 3. 64*7c478bd9Sstevel@tonic-gate # 65*7c478bd9Sstevel@tonic-gate if /usr/bin/pgrep -x -u 0 'in.routed|in.rdisc' >/dev/null 2>&1; then 66*7c478bd9Sstevel@tonic-gate /usr/bin/pkill -z `/sbin/zonename` -x -u 0 'in.routed|in.rdisc' 67*7c478bd9Sstevel@tonic-gate > /etc/.dynamic_routing 68*7c478bd9Sstevel@tonic-gate fi 69*7c478bd9Sstevel@tonic-gate /usr/bin/pkill -z `/sbin/zonename` -x -u 0 'in.ndpd|in.ripngd' 70*7c478bd9Sstevel@tonic-gate exit 0 71*7c478bd9Sstevel@tonic-gate ;; 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate*) 74*7c478bd9Sstevel@tonic-gate echo "Usage: $0 { start | stop }" 75*7c478bd9Sstevel@tonic-gate exit 1 76*7c478bd9Sstevel@tonic-gate ;; 77*7c478bd9Sstevel@tonic-gateesac 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate# Configure IPv6 Default Address Selection. 80*7c478bd9Sstevel@tonic-gateif [ -f /etc/inet/ipaddrsel.conf ]; then 81*7c478bd9Sstevel@tonic-gate /usr/sbin/ipaddrsel -f /etc/inet/ipaddrsel.conf 82*7c478bd9Sstevel@tonic-gatefi 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate/usr/sbin/ifconfig -a6u >/etc/svc/volatile/ifconfig.$$ 85*7c478bd9Sstevel@tonic-gatenumv6ifs=`/usr/bin/grep -c inet6 /etc/svc/volatile/ifconfig.$$` 86*7c478bd9Sstevel@tonic-gateif [ $numv6ifs -gt 1 ]; then 87*7c478bd9Sstevel@tonic-gate # 88*7c478bd9Sstevel@tonic-gate # Add a static route for multicast packets out of a link-local 89*7c478bd9Sstevel@tonic-gate # interface, although would like to specify multicast interface using 90*7c478bd9Sstevel@tonic-gate # an interface name! 91*7c478bd9Sstevel@tonic-gate # 92*7c478bd9Sstevel@tonic-gate set -- `/usr/bin/awk ' 93*7c478bd9Sstevel@tonic-gate /inet6 fe80:/ { 94*7c478bd9Sstevel@tonic-gate print substr($2, 1, index($2, "/") - 1) 95*7c478bd9Sstevel@tonic-gate }' /etc/svc/volatile/ifconfig.$$` 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate if [ -n "$1" ]; then 98*7c478bd9Sstevel@tonic-gate echo "Setting default IPv6 interface for multicast:" \ 99*7c478bd9Sstevel@tonic-gate "add net ff00::/8: gateway $1" 100*7c478bd9Sstevel@tonic-gate /usr/sbin/route -n add -interface -inet6 "ff00::/8" "$1" \ 101*7c478bd9Sstevel@tonic-gate >/dev/null 102*7c478bd9Sstevel@tonic-gate fi 103*7c478bd9Sstevel@tonic-gatefi 104*7c478bd9Sstevel@tonic-gate/usr/bin/rm -f /etc/svc/volatile/ifconfig.$$ 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gate# 107*7c478bd9Sstevel@tonic-gate# Now that /usr is mounted, see if in.mpathd needs to be started by firing it 108*7c478bd9Sstevel@tonic-gate# up in "adopt" mode; if there are no interfaces it needs to manage, it will 109*7c478bd9Sstevel@tonic-gate# automatically exit. Note that it may already be running if we're not 110*7c478bd9Sstevel@tonic-gate# executing as part of system boot. 111*7c478bd9Sstevel@tonic-gate# 112*7c478bd9Sstevel@tonic-gate/usr/bin/pgrep -x -u 0 in.mpathd >/dev/null 2>&1 || /usr/lib/inet/in.mpathd -a 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate# 115*7c478bd9Sstevel@tonic-gate# Pass to the kernel the list of supported IPsec protocols and algorithms. 116*7c478bd9Sstevel@tonic-gate# This will not cause IPsec to be loaded. 117*7c478bd9Sstevel@tonic-gate# 118*7c478bd9Sstevel@tonic-gate/usr/sbin/ipsecalgs -s 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate# 121*7c478bd9Sstevel@tonic-gate# Initialize IPsec only if ipsecinit.conf exists. Otherwise, save the 122*7c478bd9Sstevel@tonic-gate# kernel memory that'll be consumed if IPsec is loaded. See below for more 123*7c478bd9Sstevel@tonic-gate# IPsec-related commands. 124*7c478bd9Sstevel@tonic-gate# 125*7c478bd9Sstevel@tonic-gateif [ -f /etc/inet/ipsecinit.conf ] ; then 126*7c478bd9Sstevel@tonic-gate /usr/sbin/ipsecconf -qa /etc/inet/ipsecinit.conf 127*7c478bd9Sstevel@tonic-gatefi 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate# 130*7c478bd9Sstevel@tonic-gate# Set the RFC 1948 entropy, regardless of if I'm using it or not. If present, 131*7c478bd9Sstevel@tonic-gate# use the encrypted root password as a source of entropy. Otherwise, 132*7c478bd9Sstevel@tonic-gate# just use the pre-set (and hopefully difficult to guess) entropy that 133*7c478bd9Sstevel@tonic-gate# tcp used when it loaded. 134*7c478bd9Sstevel@tonic-gate# 135*7c478bd9Sstevel@tonic-gateencr=`/usr/bin/awk -F: '/^root:/ {print $2}' /etc/shadow` 136*7c478bd9Sstevel@tonic-gate[ -z "$encr" ] || /usr/sbin/ndd -set /dev/tcp tcp_1948_phrase $encr 137*7c478bd9Sstevel@tonic-gateunset encr 138*7c478bd9Sstevel@tonic-gate 139*7c478bd9Sstevel@tonic-gate# 140*7c478bd9Sstevel@tonic-gate# Get values for TCP_STRONG_ISS, ACCEPT6TO4RELAY and RELAY6TO4ADDR. 141*7c478bd9Sstevel@tonic-gate# 142*7c478bd9Sstevel@tonic-gate[ -f /etc/default/inetinit ] && . /etc/default/inetinit 143*7c478bd9Sstevel@tonic-gate 144*7c478bd9Sstevel@tonic-gate# 145*7c478bd9Sstevel@tonic-gate# Set TCP ISS generation. By default the ISS generation is 146*7c478bd9Sstevel@tonic-gate# time + random()-delta. This might not be strong enough for some users. 147*7c478bd9Sstevel@tonic-gate# See /etc/default/inetinit for settings and further info on TCP_STRONG_ISS. 148*7c478bd9Sstevel@tonic-gate# If not set, use TCP's internal default setting. 149*7c478bd9Sstevel@tonic-gate# 150*7c478bd9Sstevel@tonic-gateif [ $TCP_STRONG_ISS ]; then 151*7c478bd9Sstevel@tonic-gate /usr/sbin/ndd -set /dev/tcp tcp_strong_iss $TCP_STRONG_ISS 152*7c478bd9Sstevel@tonic-gatefi 153*7c478bd9Sstevel@tonic-gate 154*7c478bd9Sstevel@tonic-gate# 155*7c478bd9Sstevel@tonic-gate# Configure default IPv4 routers using the local "/etc/defaultrouter" 156*7c478bd9Sstevel@tonic-gate# configuration file. The file can contain the hostnames or IP 157*7c478bd9Sstevel@tonic-gate# addresses of one or more default routers. If hostnames are used, 158*7c478bd9Sstevel@tonic-gate# each hostname must also be listed in the local "/etc/hosts" file 159*7c478bd9Sstevel@tonic-gate# because NIS and NIS+ are not running at the time that this script is 160*7c478bd9Sstevel@tonic-gate# run. Each router name or address is listed on a single line by 161*7c478bd9Sstevel@tonic-gate# itself in the file. Anything else on that line after the router's 162*7c478bd9Sstevel@tonic-gate# name or address is ignored. Lines that begin with "#" are 163*7c478bd9Sstevel@tonic-gate# considered comments and ignored. 164*7c478bd9Sstevel@tonic-gate# 165*7c478bd9Sstevel@tonic-gate# The default routes listed in the "/etc/defaultrouter" file will 166*7c478bd9Sstevel@tonic-gate# replace those added by the kernel during diskless booting. An 167*7c478bd9Sstevel@tonic-gate# empty "/etc/defaultrouter" file will cause the default route 168*7c478bd9Sstevel@tonic-gate# added by the kernel to be deleted. 169*7c478bd9Sstevel@tonic-gate# 170*7c478bd9Sstevel@tonic-gate# Note that the default router file is ignored if we received routes 171*7c478bd9Sstevel@tonic-gate# from a DHCP server. Our policy is to always trust DHCP over local 172*7c478bd9Sstevel@tonic-gate# administration. 173*7c478bd9Sstevel@tonic-gate# 174*7c478bd9Sstevel@tonic-gatesmf_netstrategy 175*7c478bd9Sstevel@tonic-gate 176*7c478bd9Sstevel@tonic-gateif [ "$_INIT_NET_STRATEGY" = "dhcp" ] && [ -n "`/sbin/dhcpinfo Router`" ]; then 177*7c478bd9Sstevel@tonic-gate defrouters=`/sbin/dhcpinfo Router` 178*7c478bd9Sstevel@tonic-gateelif [ -f /etc/defaultrouter ]; then 179*7c478bd9Sstevel@tonic-gate defrouters=`/usr/bin/grep -v \^\# /etc/defaultrouter | \ 180*7c478bd9Sstevel@tonic-gate /usr/bin/awk '{print $1}'` 181*7c478bd9Sstevel@tonic-gate if [ -n "$defrouters" ]; then 182*7c478bd9Sstevel@tonic-gate # 183*7c478bd9Sstevel@tonic-gate # We want the default router(s) listed in /etc/defaultrouter 184*7c478bd9Sstevel@tonic-gate # to replace the one added from the BOOTPARAMS WHOAMI response 185*7c478bd9Sstevel@tonic-gate # but we must avoid flushing the last route between the running 186*7c478bd9Sstevel@tonic-gate # system and its /usr file system. 187*7c478bd9Sstevel@tonic-gate # 188*7c478bd9Sstevel@tonic-gate 189*7c478bd9Sstevel@tonic-gate # First, remember the original route. 190*7c478bd9Sstevel@tonic-gate shift $# 191*7c478bd9Sstevel@tonic-gate set -- `/usr/bin/netstat -rn -f inet | /usr/bin/grep '^default'` 192*7c478bd9Sstevel@tonic-gate route_IP="$2" 193*7c478bd9Sstevel@tonic-gate 194*7c478bd9Sstevel@tonic-gate # 195*7c478bd9Sstevel@tonic-gate # Next, add those from /etc/defaultrouter. While doing this, 196*7c478bd9Sstevel@tonic-gate # if one of the routes we add is for the route previously 197*7c478bd9Sstevel@tonic-gate # added as a result of the BOOTPARAMS response, we will see 198*7c478bd9Sstevel@tonic-gate # a message of the form: 199*7c478bd9Sstevel@tonic-gate # "add net default: gateway a.b.c.d: entry exists" 200*7c478bd9Sstevel@tonic-gate # 201*7c478bd9Sstevel@tonic-gate do_delete=yes 202*7c478bd9Sstevel@tonic-gate for router in $defrouters; do 203*7c478bd9Sstevel@tonic-gate set -- `/usr/sbin/route -n add default -gateway $router` 204*7c478bd9Sstevel@tonic-gate [ $? -ne 0 -a "x$5" = "x$route_IP:" ] && do_delete=no 205*7c478bd9Sstevel@tonic-gate done 206*7c478bd9Sstevel@tonic-gate 207*7c478bd9Sstevel@tonic-gate # 208*7c478bd9Sstevel@tonic-gate # Finally, delete the original default route unless it was 209*7c478bd9Sstevel@tonic-gate # also listed in the defaultrouter file. 210*7c478bd9Sstevel@tonic-gate # 211*7c478bd9Sstevel@tonic-gate if [ -n "$route_IP" -a $do_delete = yes ]; then 212*7c478bd9Sstevel@tonic-gate /usr/sbin/route -n delete default -gateway $route_IP \ 213*7c478bd9Sstevel@tonic-gate >/dev/null 214*7c478bd9Sstevel@tonic-gate fi 215*7c478bd9Sstevel@tonic-gate else 216*7c478bd9Sstevel@tonic-gate /usr/sbin/route -fn > /dev/null 217*7c478bd9Sstevel@tonic-gate fi 218*7c478bd9Sstevel@tonic-gateelse 219*7c478bd9Sstevel@tonic-gate defrouters= 220*7c478bd9Sstevel@tonic-gatefi 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate# 223*7c478bd9Sstevel@tonic-gate# Use routeadm(1M) to configure forwarding and launch routing daemons for 224*7c478bd9Sstevel@tonic-gate# IPv4 and IPv6 based on preset values. These settings only apply to the 225*7c478bd9Sstevel@tonic-gate# global zone. For IPv4 dynamic routing, the system will default to 226*7c478bd9Sstevel@tonic-gate# disabled if a default route was previously added via BOOTP, DHCP, or 227*7c478bd9Sstevel@tonic-gate# the /etc/defaultrouter file. routeadm also starts in.ndpd. 228*7c478bd9Sstevel@tonic-gate# 229*7c478bd9Sstevel@tonic-gateif [ ! -f /etc/.dynamic_routing ] && [ -z "$defrouters" ]; then 230*7c478bd9Sstevel@tonic-gate # 231*7c478bd9Sstevel@tonic-gate # No default routes were setup by "route" command above. 232*7c478bd9Sstevel@tonic-gate # Check the kernel routing table for any other default 233*7c478bd9Sstevel@tonic-gate # routes. 234*7c478bd9Sstevel@tonic-gate # 235*7c478bd9Sstevel@tonic-gate /usr/bin/netstat -rn -f inet | \ 236*7c478bd9Sstevel@tonic-gate /usr/bin/grep default >/dev/null 2>&1 && defrouters=yes 237*7c478bd9Sstevel@tonic-gatefi 238*7c478bd9Sstevel@tonic-gate[ -f /etc/.dynamic_routing ] && /usr/bin/rm -f /etc/.dynamic_routing 239*7c478bd9Sstevel@tonic-gateif [ -z "$defrouters" ]; then 240*7c478bd9Sstevel@tonic-gate routeadmstr="-e ipv4-routing" 241*7c478bd9Sstevel@tonic-gateelse 242*7c478bd9Sstevel@tonic-gate routeadmstr="-d ipv4-routing" 243*7c478bd9Sstevel@tonic-gatefi 244*7c478bd9Sstevel@tonic-gate# 245*7c478bd9Sstevel@tonic-gate# The -b option used here tells routeadm that the ipv4-routing 246*7c478bd9Sstevel@tonic-gate# option in $routeadmstr is the boot-time default. The 247*7c478bd9Sstevel@tonic-gate# boot-time default is used if the administrator has not 248*7c478bd9Sstevel@tonic-gate# explicitly enabled or disabled ipv4-routing using the -e or 249*7c478bd9Sstevel@tonic-gate# -d routeadm option. 250*7c478bd9Sstevel@tonic-gate# 251*7c478bd9Sstevel@tonic-gate/usr/sbin/routeadm -u -b $routeadmstr 252*7c478bd9Sstevel@tonic-gate 253*7c478bd9Sstevel@tonic-gate# 254*7c478bd9Sstevel@tonic-gate# In spite of global policy, there may be a need for IPsec because of 255*7c478bd9Sstevel@tonic-gate# per-socket policy or tunnelled policy. With that in mind, check for manual 256*7c478bd9Sstevel@tonic-gate# keys in /etc/inet/secret/ipseckeys, or check for IKE configuration in 257*7c478bd9Sstevel@tonic-gate# /etc/inet/ike/config. Either of these will also load and initialize IPsec, 258*7c478bd9Sstevel@tonic-gate# thereby consuming kernel memory. 259*7c478bd9Sstevel@tonic-gate# 260*7c478bd9Sstevel@tonic-gate 261*7c478bd9Sstevel@tonic-gateif [ -f /etc/inet/secret/ipseckeys ] ; then 262*7c478bd9Sstevel@tonic-gate /usr/sbin/ipseckey -f /etc/inet/secret/ipseckeys 263*7c478bd9Sstevel@tonic-gatefi 264*7c478bd9Sstevel@tonic-gate 265*7c478bd9Sstevel@tonic-gateif [ -f /etc/inet/ike/config ] ; then 266*7c478bd9Sstevel@tonic-gate /usr/lib/inet/in.iked 267*7c478bd9Sstevel@tonic-gatefi 268*7c478bd9Sstevel@tonic-gate 269*7c478bd9Sstevel@tonic-gate# 270*7c478bd9Sstevel@tonic-gate# Configure tunnels which were deferred by /lib/svc/method/net-physical 271*7c478bd9Sstevel@tonic-gate# (the svc:/network/physical service) since it depends on the tunnel endpoints 272*7c478bd9Sstevel@tonic-gate# being reachable i.e. routing must be running. 273*7c478bd9Sstevel@tonic-gate# 274*7c478bd9Sstevel@tonic-gate# WARNING: you may wish to turn OFF forwarding if you haven't already, because 275*7c478bd9Sstevel@tonic-gate# of various possible security vulnerabilities when configuring tunnels for 276*7c478bd9Sstevel@tonic-gate# Virtual Private Network (VPN) construction. 277*7c478bd9Sstevel@tonic-gate# 278*7c478bd9Sstevel@tonic-gate# Also, if names are used in the /etc/hostname.ip.tun* file, those names 279*7c478bd9Sstevel@tonic-gate# have to be in either DNS (and DNS is used) or in /etc/hosts, because this 280*7c478bd9Sstevel@tonic-gate# file is executed before NIS or NIS+ is started. 281*7c478bd9Sstevel@tonic-gate# 282*7c478bd9Sstevel@tonic-gate 283*7c478bd9Sstevel@tonic-gate# 284*7c478bd9Sstevel@tonic-gate# IPv4 tunnels 285*7c478bd9Sstevel@tonic-gate# The second component of the name must be either "ip" or "ip6". 286*7c478bd9Sstevel@tonic-gate# 287*7c478bd9Sstevel@tonic-gateinterface_names="`/usr/bin/ls /etc/hostname.ip*.*[0-9] 2>/dev/null | \ 288*7c478bd9Sstevel@tonic-gate /usr/bin/grep '/etc/hostname\.ip6\{0,1\}\.'`" 289*7c478bd9Sstevel@tonic-gateif [ -n "$interface_names" ]; then 290*7c478bd9Sstevel@tonic-gate ( 291*7c478bd9Sstevel@tonic-gate echo "configuring IPv4 tunnels:\c" 292*7c478bd9Sstevel@tonic-gate # Extract the part after the first '.' 293*7c478bd9Sstevel@tonic-gate set -- `for intr in $interface_names; do \ 294*7c478bd9Sstevel@tonic-gate /usr/bin/expr //$intr : '[^.]*\.\(.*\)$'; done` 295*7c478bd9Sstevel@tonic-gate while [ $# -ge 1 ]; do 296*7c478bd9Sstevel@tonic-gate # Skip empty files 297*7c478bd9Sstevel@tonic-gate if [ ! -s /etc/hostname\.$1 ]; then 298*7c478bd9Sstevel@tonic-gate shift 299*7c478bd9Sstevel@tonic-gate continue 300*7c478bd9Sstevel@tonic-gate fi 301*7c478bd9Sstevel@tonic-gate /usr/sbin/ifconfig $1 plumb 302*7c478bd9Sstevel@tonic-gate while read ifcmds; do 303*7c478bd9Sstevel@tonic-gate if [ -n "$ifcmds" ]; then 304*7c478bd9Sstevel@tonic-gate /usr/sbin/ifconfig $1 inet $ifcmds 305*7c478bd9Sstevel@tonic-gate fi 306*7c478bd9Sstevel@tonic-gate done </etc/hostname\.$1 >/dev/null 307*7c478bd9Sstevel@tonic-gate echo " $1\c" 308*7c478bd9Sstevel@tonic-gate shift 309*7c478bd9Sstevel@tonic-gate done 310*7c478bd9Sstevel@tonic-gate echo "." 311*7c478bd9Sstevel@tonic-gate ) 312*7c478bd9Sstevel@tonic-gatefi 313*7c478bd9Sstevel@tonic-gate 314*7c478bd9Sstevel@tonic-gate# 315*7c478bd9Sstevel@tonic-gate# IPv6 Tunnels 316*7c478bd9Sstevel@tonic-gate# The second component of the name must be either "ip" or "ip6". 317*7c478bd9Sstevel@tonic-gate# 318*7c478bd9Sstevel@tonic-gateinterface_names="`/usr/bin/ls /etc/hostname6.ip*.*[0-9] 2>/dev/null | \ 319*7c478bd9Sstevel@tonic-gate /usr/bin/grep '/etc/hostname6\.ip6\{0,1\}\.'`" 320*7c478bd9Sstevel@tonic-gateif [ -n "$interface_names" ]; then 321*7c478bd9Sstevel@tonic-gate ( 322*7c478bd9Sstevel@tonic-gate echo "configuring IPv6 tunnels:\c" 323*7c478bd9Sstevel@tonic-gate # Extract the part after the first '.' 324*7c478bd9Sstevel@tonic-gate set -- `for intr in $interface_names; do \ 325*7c478bd9Sstevel@tonic-gate /usr/bin/expr //$intr : '[^.]*\.\(.*\)$'; done` 326*7c478bd9Sstevel@tonic-gate while [ $# -ge 1 ]; do 327*7c478bd9Sstevel@tonic-gate # Skip empty files 328*7c478bd9Sstevel@tonic-gate if [ ! -s /etc/hostname6\.$1 ]; then 329*7c478bd9Sstevel@tonic-gate shift 330*7c478bd9Sstevel@tonic-gate continue 331*7c478bd9Sstevel@tonic-gate fi 332*7c478bd9Sstevel@tonic-gate /usr/sbin/ifconfig $1 inet6 plumb 333*7c478bd9Sstevel@tonic-gate while read ifcmds; do 334*7c478bd9Sstevel@tonic-gate if [ -n "$ifcmds" ]; then 335*7c478bd9Sstevel@tonic-gate /usr/sbin/ifconfig $1 inet6 $ifcmds 336*7c478bd9Sstevel@tonic-gate fi 337*7c478bd9Sstevel@tonic-gate done </etc/hostname6\.$1 > /dev/null 338*7c478bd9Sstevel@tonic-gate echo " $1\c" 339*7c478bd9Sstevel@tonic-gate shift 340*7c478bd9Sstevel@tonic-gate done 341*7c478bd9Sstevel@tonic-gate echo "." 342*7c478bd9Sstevel@tonic-gate ) 343*7c478bd9Sstevel@tonic-gatefi 344*7c478bd9Sstevel@tonic-gate 345*7c478bd9Sstevel@tonic-gate# 346*7c478bd9Sstevel@tonic-gate# Set 6to4 Relay Router communication support policy and, if applicable, 347*7c478bd9Sstevel@tonic-gate# the destination Relay Router IPv4 address. See /etc/default/inetinit for 348*7c478bd9Sstevel@tonic-gate# setting and further info on ACCEPT6TO4RELAY and RELAY6TO4ADDR. 349*7c478bd9Sstevel@tonic-gate# If ACCEPT6TO4RELAY=NO, the default value in the kernel will 350*7c478bd9Sstevel@tonic-gate# be used. 351*7c478bd9Sstevel@tonic-gate# 352*7c478bd9Sstevel@tonic-gateACCEPT6TO4RELAY=`echo "$ACCEPT6TO4RELAY" | /usr/bin/tr '[A-Z]' '[a-z]'` 353*7c478bd9Sstevel@tonic-gateif [ "$ACCEPT6TO4RELAY" = yes ]; then 354*7c478bd9Sstevel@tonic-gate if [ "$RELAY6TO4ADDR" ]; then 355*7c478bd9Sstevel@tonic-gate /usr/sbin/6to4relay -e -a $RELAY6TO4ADDR 356*7c478bd9Sstevel@tonic-gate else 357*7c478bd9Sstevel@tonic-gate /usr/sbin/6to4relay -e 358*7c478bd9Sstevel@tonic-gate fi 359*7c478bd9Sstevel@tonic-gatefi 360*7c478bd9Sstevel@tonic-gate 361*7c478bd9Sstevel@tonic-gate# Clear exit status. 362*7c478bd9Sstevel@tonic-gateexit 0 363