1#!/sbin/sh 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22# 23# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26# ident "%Z%%M% %I% %E% SMI" 27# 28# This is the second phase of TCP/IP configuration. The first part is 29# run by the svc:/network/physical service and includes configuring the 30# interfaces and setting the machine's hostname. The svc:/network/initial 31# service does all configuration that can be done before name services are 32# started, bar configuring IP routing (this is carried out by the 33# svc:/network/routing-setup service). The final part, run by the 34# svc:/network/service service, does all configuration that may require 35# name services. This includes a final re-configuration of the 36# interfaces. 37# 38 39. /lib/svc/share/smf_include.sh 40 41# 42# In a shared-IP zone we need this service to be up, but all of the work 43# it tries to do is irrelevant (and will actually lead to the service 44# failing if we try to do it), so just bail out. 45# In the global zone and exclusive-IP zones we proceed. 46# 47smf_configure_ip || exit $SMF_EXIT_OK 48 49# Configure IPv6 Default Address Selection. 50if [ -f /etc/inet/ipaddrsel.conf ]; then 51 /usr/sbin/ipaddrsel -f /etc/inet/ipaddrsel.conf 52fi 53 54# 55# Now that /usr is mounted, see if in.mpathd needs to be started by firing it 56# up in "adopt" mode; if there are no interfaces it needs to manage, it will 57# automatically exit. Note that it may already be running if we're not 58# executing as part of system boot. 59# 60/usr/bin/pgrep -x -u 0 -z `smf_zonename` in.mpathd >/dev/null 2>&1 || \ 61 /usr/lib/inet/in.mpathd -a 62 63# 64# Set the RFC 1948 entropy, regardless of if I'm using it or not. If present, 65# use the encrypted root password as a source of entropy. Otherwise, 66# just use the pre-set (and hopefully difficult to guess) entropy that 67# tcp used when it loaded. 68# 69encr=`/usr/bin/awk -F: '/^root:/ {print $2}' /etc/shadow` 70[ -z "$encr" ] || /usr/sbin/ndd -set /dev/tcp tcp_1948_phrase $encr 71unset encr 72 73# 74# Get values for TCP_STRONG_ISS, ACCEPT6TO4RELAY and RELAY6TO4ADDR. 75# 76[ -f /etc/default/inetinit ] && . /etc/default/inetinit 77 78# Set the SDP system Policy. This needs to happen after basic 79# networking is up but before any networking services that might 80# want to use SDP are enabled 81if [ -f /usr/sbin/sdpadm -a -f /etc/sdp.conf ]; then 82 . /etc/sdp.conf 83 if [ "$sysenable" = "1" ]; then 84 /usr/sbin/sdpadm enable 85 fi 86fi 87 88# 89# Set TCP ISS generation. By default the ISS generation is 90# time + random()-delta. This might not be strong enough for some users. 91# See /etc/default/inetinit for settings and further info on TCP_STRONG_ISS. 92# If not set, use TCP's internal default setting. 93# 94if [ $TCP_STRONG_ISS ]; then 95 /usr/sbin/ndd -set /dev/tcp tcp_strong_iss $TCP_STRONG_ISS 96fi 97 98# 99# Configure tunnels which were deferred by /lib/svc/method/net-physical 100# (the svc:/network/physical service) since it depends on the tunnel endpoints 101# being reachable i.e. routing must be running. 102# 103# WARNING: you may wish to turn OFF forwarding if you haven't already, because 104# of various possible security vulnerabilities when configuring tunnels for 105# Virtual Private Network (VPN) construction. 106# 107# Also, if names are used in the /etc/hostname.ip.tun* file, those names 108# have to be in either DNS (and DNS is used) or in /etc/hosts, because this 109# file is executed before NIS or NIS+ is started. 110# 111 112# 113# IPv4 tunnels 114# The second component of the name must be either "ip" or "ip6". 115# 116interface_names="`/usr/bin/ls /etc/hostname.ip*.*[0-9] 2>/dev/null | \ 117 /usr/bin/grep '/etc/hostname\.ip6\{0,1\}\.'`" 118if [ -n "$interface_names" ]; then 119 ( 120 echo "configuring IPv4 tunnels:\c" 121 # Extract the part after the first '.' 122 set -- `for intr in $interface_names; do \ 123 /usr/bin/expr //$intr : '[^.]*\.\(.*\)$'; done` 124 while [ $# -ge 1 ]; do 125 # Skip empty files 126 if [ ! -s /etc/hostname\.$1 ]; then 127 shift 128 continue 129 fi 130 /usr/sbin/ifconfig $1 plumb 131 while read ifcmds; do 132 if [ -n "$ifcmds" ]; then 133 /usr/sbin/ifconfig $1 inet $ifcmds 134 fi 135 done </etc/hostname\.$1 >/dev/null 136 echo " $1\c" 137 shift 138 done 139 echo "." 140 ) 141fi 142 143# 144# IPv6 Tunnels 145# The second component of the name must be either "ip" or "ip6". 146# 147interface_names="`/usr/bin/ls /etc/hostname6.ip*.*[0-9] 2>/dev/null | \ 148 /usr/bin/grep '/etc/hostname6\.ip6\{0,1\}\.'`" 149if [ -n "$interface_names" ]; then 150 ( 151 echo "configuring IPv6 tunnels:\c" 152 # Extract the part after the first '.' 153 set -- `for intr in $interface_names; do \ 154 /usr/bin/expr //$intr : '[^.]*\.\(.*\)$'; done` 155 while [ $# -ge 1 ]; do 156 # Skip empty files 157 if [ ! -s /etc/hostname6\.$1 ]; then 158 shift 159 continue 160 fi 161 /usr/sbin/ifconfig $1 inet6 plumb 162 while read ifcmds; do 163 if [ -n "$ifcmds" ]; then 164 /usr/sbin/ifconfig $1 inet6 $ifcmds 165 fi 166 done </etc/hostname6\.$1 > /dev/null 167 echo " $1\c" 168 shift 169 done 170 echo "." 171 ) 172fi 173 174# Clear exit status. 175exit $SMF_EXIT_OK 176