17c478bd9Sstevel@tonic-gate#!/sbin/sh 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6*6927f468Sdp# Common Development and Distribution License (the "License"). 7*6927f468Sdp# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 227c478bd9Sstevel@tonic-gate# 23a59fa508Sjl138328# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate# Use is subject to license terms. 257c478bd9Sstevel@tonic-gate# 267c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 277c478bd9Sstevel@tonic-gate# 287c478bd9Sstevel@tonic-gate# This is the second phase of TCP/IP configuration. The first part is 297c478bd9Sstevel@tonic-gate# run by the /lib/svc/method/net-physical script (the svc:/network/physical 307c478bd9Sstevel@tonic-gate# service) and includes configuring the interfaces and setting the machine's 317c478bd9Sstevel@tonic-gate# hostname. This script (the svc:/network/initial service), does all 327c478bd9Sstevel@tonic-gate# configuration that can be done before name services are started. This 337c478bd9Sstevel@tonic-gate# includes configuring IP routing, and setting any tunable parameters. 347c478bd9Sstevel@tonic-gate# The third part, run by the /lib/svc/method/net-svc script (the 357c478bd9Sstevel@tonic-gate# svc:/network/service service), does all configuration that may require 367c478bd9Sstevel@tonic-gate# name services. This includes a final re-configuration of the interfaces. 377c478bd9Sstevel@tonic-gate# 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate. /lib/svc/share/smf_include.sh 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gatecase "$1" in 427c478bd9Sstevel@tonic-gate'start') 437c478bd9Sstevel@tonic-gate # 447c478bd9Sstevel@tonic-gate # In a zone we need this service to be up, but all of the work 457c478bd9Sstevel@tonic-gate # it tries to do is irrelevant (and will actually lead to the service 467c478bd9Sstevel@tonic-gate # failing if we try to do it), so just bail out. 477c478bd9Sstevel@tonic-gate # 48*6927f468Sdp smf_is_globalzone || exit $SMF_EXIT_OK 49*6927f468Sdp 507c478bd9Sstevel@tonic-gate ;; # Fall through -- rest of script is the initialization code 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate'stop') 53*6927f468Sdp smf_is_globalzone || exit $SMF_EXIT_OK 54*6927f468Sdp 557c478bd9Sstevel@tonic-gate # 567c478bd9Sstevel@tonic-gate # If we were routing dynamically, we will note this with 577c478bd9Sstevel@tonic-gate # the .dynamic_routing file, so that we can leave the routes 587c478bd9Sstevel@tonic-gate # in place without thinking they're static route entries 597c478bd9Sstevel@tonic-gate # when we come back into states 2 or 3. 607c478bd9Sstevel@tonic-gate # 617c478bd9Sstevel@tonic-gate if /usr/bin/pgrep -x -u 0 'in.routed|in.rdisc' >/dev/null 2>&1; then 62*6927f468Sdp /usr/bin/pkill -z global -x -u 0 'in.routed|in.rdisc' 637c478bd9Sstevel@tonic-gate > /etc/.dynamic_routing 647c478bd9Sstevel@tonic-gate fi 65*6927f468Sdp /usr/bin/pkill -z global -x -u 0 'in.ndpd|in.ripngd' 66*6927f468Sdp exit $SMF_EXIT_OK 677c478bd9Sstevel@tonic-gate ;; 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate*) 707c478bd9Sstevel@tonic-gate echo "Usage: $0 { start | stop }" 717c478bd9Sstevel@tonic-gate exit 1 727c478bd9Sstevel@tonic-gate ;; 737c478bd9Sstevel@tonic-gateesac 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate# Configure IPv6 Default Address Selection. 767c478bd9Sstevel@tonic-gateif [ -f /etc/inet/ipaddrsel.conf ]; then 777c478bd9Sstevel@tonic-gate /usr/sbin/ipaddrsel -f /etc/inet/ipaddrsel.conf 787c478bd9Sstevel@tonic-gatefi 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate/usr/sbin/ifconfig -a6u >/etc/svc/volatile/ifconfig.$$ 817c478bd9Sstevel@tonic-gatenumv6ifs=`/usr/bin/grep -c inet6 /etc/svc/volatile/ifconfig.$$` 827c478bd9Sstevel@tonic-gateif [ $numv6ifs -gt 1 ]; then 837c478bd9Sstevel@tonic-gate # 847c478bd9Sstevel@tonic-gate # Add a static route for multicast packets out of a link-local 857c478bd9Sstevel@tonic-gate # interface, although would like to specify multicast interface using 867c478bd9Sstevel@tonic-gate # an interface name! 877c478bd9Sstevel@tonic-gate # 887c478bd9Sstevel@tonic-gate set -- `/usr/bin/awk ' 897c478bd9Sstevel@tonic-gate /inet6 fe80:/ { 907c478bd9Sstevel@tonic-gate print substr($2, 1, index($2, "/") - 1) 917c478bd9Sstevel@tonic-gate }' /etc/svc/volatile/ifconfig.$$` 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate if [ -n "$1" ]; then 947c478bd9Sstevel@tonic-gate echo "Setting default IPv6 interface for multicast:" \ 957c478bd9Sstevel@tonic-gate "add net ff00::/8: gateway $1" 967c478bd9Sstevel@tonic-gate /usr/sbin/route -n add -interface -inet6 "ff00::/8" "$1" \ 977c478bd9Sstevel@tonic-gate >/dev/null 987c478bd9Sstevel@tonic-gate fi 997c478bd9Sstevel@tonic-gatefi 1007c478bd9Sstevel@tonic-gate/usr/bin/rm -f /etc/svc/volatile/ifconfig.$$ 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate# 1037c478bd9Sstevel@tonic-gate# Now that /usr is mounted, see if in.mpathd needs to be started by firing it 1047c478bd9Sstevel@tonic-gate# up in "adopt" mode; if there are no interfaces it needs to manage, it will 1057c478bd9Sstevel@tonic-gate# automatically exit. Note that it may already be running if we're not 1067c478bd9Sstevel@tonic-gate# executing as part of system boot. 1077c478bd9Sstevel@tonic-gate# 1087c478bd9Sstevel@tonic-gate/usr/bin/pgrep -x -u 0 in.mpathd >/dev/null 2>&1 || /usr/lib/inet/in.mpathd -a 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate# 1117c478bd9Sstevel@tonic-gate# Pass to the kernel the list of supported IPsec protocols and algorithms. 1127c478bd9Sstevel@tonic-gate# This will not cause IPsec to be loaded. 1137c478bd9Sstevel@tonic-gate# 1147c478bd9Sstevel@tonic-gate/usr/sbin/ipsecalgs -s 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate# 1177c478bd9Sstevel@tonic-gate# Initialize IPsec only if ipsecinit.conf exists. Otherwise, save the 1187c478bd9Sstevel@tonic-gate# kernel memory that'll be consumed if IPsec is loaded. See below for more 1197c478bd9Sstevel@tonic-gate# IPsec-related commands. 1207c478bd9Sstevel@tonic-gate# 1217c478bd9Sstevel@tonic-gateif [ -f /etc/inet/ipsecinit.conf ] ; then 1227c478bd9Sstevel@tonic-gate /usr/sbin/ipsecconf -qa /etc/inet/ipsecinit.conf 1237c478bd9Sstevel@tonic-gatefi 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate# 1267c478bd9Sstevel@tonic-gate# Set the RFC 1948 entropy, regardless of if I'm using it or not. If present, 1277c478bd9Sstevel@tonic-gate# use the encrypted root password as a source of entropy. Otherwise, 1287c478bd9Sstevel@tonic-gate# just use the pre-set (and hopefully difficult to guess) entropy that 1297c478bd9Sstevel@tonic-gate# tcp used when it loaded. 1307c478bd9Sstevel@tonic-gate# 1317c478bd9Sstevel@tonic-gateencr=`/usr/bin/awk -F: '/^root:/ {print $2}' /etc/shadow` 1327c478bd9Sstevel@tonic-gate[ -z "$encr" ] || /usr/sbin/ndd -set /dev/tcp tcp_1948_phrase $encr 1337c478bd9Sstevel@tonic-gateunset encr 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate# 1367c478bd9Sstevel@tonic-gate# Get values for TCP_STRONG_ISS, ACCEPT6TO4RELAY and RELAY6TO4ADDR. 1377c478bd9Sstevel@tonic-gate# 1387c478bd9Sstevel@tonic-gate[ -f /etc/default/inetinit ] && . /etc/default/inetinit 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate# 1417c478bd9Sstevel@tonic-gate# Set TCP ISS generation. By default the ISS generation is 1427c478bd9Sstevel@tonic-gate# time + random()-delta. This might not be strong enough for some users. 1437c478bd9Sstevel@tonic-gate# See /etc/default/inetinit for settings and further info on TCP_STRONG_ISS. 1447c478bd9Sstevel@tonic-gate# If not set, use TCP's internal default setting. 1457c478bd9Sstevel@tonic-gate# 1467c478bd9Sstevel@tonic-gateif [ $TCP_STRONG_ISS ]; then 1477c478bd9Sstevel@tonic-gate /usr/sbin/ndd -set /dev/tcp tcp_strong_iss $TCP_STRONG_ISS 1487c478bd9Sstevel@tonic-gatefi 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate# 1517c478bd9Sstevel@tonic-gate# Configure default IPv4 routers using the local "/etc/defaultrouter" 1527c478bd9Sstevel@tonic-gate# configuration file. The file can contain the hostnames or IP 1537c478bd9Sstevel@tonic-gate# addresses of one or more default routers. If hostnames are used, 1547c478bd9Sstevel@tonic-gate# each hostname must also be listed in the local "/etc/hosts" file 1557c478bd9Sstevel@tonic-gate# because NIS and NIS+ are not running at the time that this script is 1567c478bd9Sstevel@tonic-gate# run. Each router name or address is listed on a single line by 1577c478bd9Sstevel@tonic-gate# itself in the file. Anything else on that line after the router's 1587c478bd9Sstevel@tonic-gate# name or address is ignored. Lines that begin with "#" are 1597c478bd9Sstevel@tonic-gate# considered comments and ignored. 1607c478bd9Sstevel@tonic-gate# 1617c478bd9Sstevel@tonic-gate# The default routes listed in the "/etc/defaultrouter" file will 1627c478bd9Sstevel@tonic-gate# replace those added by the kernel during diskless booting. An 1637c478bd9Sstevel@tonic-gate# empty "/etc/defaultrouter" file will cause the default route 1647c478bd9Sstevel@tonic-gate# added by the kernel to be deleted. 1657c478bd9Sstevel@tonic-gate# 1667c478bd9Sstevel@tonic-gate# Note that the default router file is ignored if we received routes 1677c478bd9Sstevel@tonic-gate# from a DHCP server. Our policy is to always trust DHCP over local 1687c478bd9Sstevel@tonic-gate# administration. 1697c478bd9Sstevel@tonic-gate# 1707c478bd9Sstevel@tonic-gatesmf_netstrategy 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gateif [ "$_INIT_NET_STRATEGY" = "dhcp" ] && [ -n "`/sbin/dhcpinfo Router`" ]; then 1737c478bd9Sstevel@tonic-gate defrouters=`/sbin/dhcpinfo Router` 1747c478bd9Sstevel@tonic-gateelif [ -f /etc/defaultrouter ]; then 1757c478bd9Sstevel@tonic-gate defrouters=`/usr/bin/grep -v \^\# /etc/defaultrouter | \ 1767c478bd9Sstevel@tonic-gate /usr/bin/awk '{print $1}'` 1777c478bd9Sstevel@tonic-gate if [ -n "$defrouters" ]; then 1787c478bd9Sstevel@tonic-gate # 1797c478bd9Sstevel@tonic-gate # We want the default router(s) listed in /etc/defaultrouter 1807c478bd9Sstevel@tonic-gate # to replace the one added from the BOOTPARAMS WHOAMI response 1817c478bd9Sstevel@tonic-gate # but we must avoid flushing the last route between the running 1827c478bd9Sstevel@tonic-gate # system and its /usr file system. 1837c478bd9Sstevel@tonic-gate # 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate # First, remember the original route. 1867c478bd9Sstevel@tonic-gate shift $# 1877c478bd9Sstevel@tonic-gate set -- `/usr/bin/netstat -rn -f inet | /usr/bin/grep '^default'` 1887c478bd9Sstevel@tonic-gate route_IP="$2" 1897c478bd9Sstevel@tonic-gate 1907c478bd9Sstevel@tonic-gate # 1917c478bd9Sstevel@tonic-gate # Next, add those from /etc/defaultrouter. While doing this, 1927c478bd9Sstevel@tonic-gate # if one of the routes we add is for the route previously 1937c478bd9Sstevel@tonic-gate # added as a result of the BOOTPARAMS response, we will see 1947c478bd9Sstevel@tonic-gate # a message of the form: 1957c478bd9Sstevel@tonic-gate # "add net default: gateway a.b.c.d: entry exists" 1967c478bd9Sstevel@tonic-gate # 1977c478bd9Sstevel@tonic-gate do_delete=yes 1987c478bd9Sstevel@tonic-gate for router in $defrouters; do 1997c478bd9Sstevel@tonic-gate set -- `/usr/sbin/route -n add default -gateway $router` 2007c478bd9Sstevel@tonic-gate [ $? -ne 0 -a "x$5" = "x$route_IP:" ] && do_delete=no 2017c478bd9Sstevel@tonic-gate done 2027c478bd9Sstevel@tonic-gate 2037c478bd9Sstevel@tonic-gate # 2047c478bd9Sstevel@tonic-gate # Finally, delete the original default route unless it was 2057c478bd9Sstevel@tonic-gate # also listed in the defaultrouter file. 2067c478bd9Sstevel@tonic-gate # 2077c478bd9Sstevel@tonic-gate if [ -n "$route_IP" -a $do_delete = yes ]; then 2087c478bd9Sstevel@tonic-gate /usr/sbin/route -n delete default -gateway $route_IP \ 2097c478bd9Sstevel@tonic-gate >/dev/null 2107c478bd9Sstevel@tonic-gate fi 2117c478bd9Sstevel@tonic-gate else 2127c478bd9Sstevel@tonic-gate /usr/sbin/route -fn > /dev/null 2137c478bd9Sstevel@tonic-gate fi 2147c478bd9Sstevel@tonic-gateelse 2157c478bd9Sstevel@tonic-gate defrouters= 2167c478bd9Sstevel@tonic-gatefi 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate# 2197c478bd9Sstevel@tonic-gate# Use routeadm(1M) to configure forwarding and launch routing daemons for 2207c478bd9Sstevel@tonic-gate# IPv4 and IPv6 based on preset values. These settings only apply to the 2217c478bd9Sstevel@tonic-gate# global zone. For IPv4 dynamic routing, the system will default to 2227c478bd9Sstevel@tonic-gate# disabled if a default route was previously added via BOOTP, DHCP, or 2237c478bd9Sstevel@tonic-gate# the /etc/defaultrouter file. routeadm also starts in.ndpd. 2247c478bd9Sstevel@tonic-gate# 2257c478bd9Sstevel@tonic-gateif [ ! -f /etc/.dynamic_routing ] && [ -z "$defrouters" ]; then 2267c478bd9Sstevel@tonic-gate # 2277c478bd9Sstevel@tonic-gate # No default routes were setup by "route" command above. 2287c478bd9Sstevel@tonic-gate # Check the kernel routing table for any other default 2297c478bd9Sstevel@tonic-gate # routes. 2307c478bd9Sstevel@tonic-gate # 2317c478bd9Sstevel@tonic-gate /usr/bin/netstat -rn -f inet | \ 2327c478bd9Sstevel@tonic-gate /usr/bin/grep default >/dev/null 2>&1 && defrouters=yes 2337c478bd9Sstevel@tonic-gatefi 2347c478bd9Sstevel@tonic-gate[ -f /etc/.dynamic_routing ] && /usr/bin/rm -f /etc/.dynamic_routing 2357c478bd9Sstevel@tonic-gateif [ -z "$defrouters" ]; then 2367c478bd9Sstevel@tonic-gate routeadmstr="-e ipv4-routing" 2377c478bd9Sstevel@tonic-gateelse 2387c478bd9Sstevel@tonic-gate routeadmstr="-d ipv4-routing" 2397c478bd9Sstevel@tonic-gatefi 2407c478bd9Sstevel@tonic-gate# 2417c478bd9Sstevel@tonic-gate# The -b option used here tells routeadm that the ipv4-routing 2427c478bd9Sstevel@tonic-gate# option in $routeadmstr is the boot-time default. The 2437c478bd9Sstevel@tonic-gate# boot-time default is used if the administrator has not 2447c478bd9Sstevel@tonic-gate# explicitly enabled or disabled ipv4-routing using the -e or 2457c478bd9Sstevel@tonic-gate# -d routeadm option. 2467c478bd9Sstevel@tonic-gate# 2477c478bd9Sstevel@tonic-gate/usr/sbin/routeadm -u -b $routeadmstr 2487c478bd9Sstevel@tonic-gate 2497c478bd9Sstevel@tonic-gate# 2507c478bd9Sstevel@tonic-gate# In spite of global policy, there may be a need for IPsec because of 2517c478bd9Sstevel@tonic-gate# per-socket policy or tunnelled policy. With that in mind, check for manual 2527c478bd9Sstevel@tonic-gate# keys in /etc/inet/secret/ipseckeys, or check for IKE configuration in 2537c478bd9Sstevel@tonic-gate# /etc/inet/ike/config. Either of these will also load and initialize IPsec, 2547c478bd9Sstevel@tonic-gate# thereby consuming kernel memory. 2557c478bd9Sstevel@tonic-gate# 2567c478bd9Sstevel@tonic-gate 2577c478bd9Sstevel@tonic-gateif [ -f /etc/inet/secret/ipseckeys ] ; then 2587c478bd9Sstevel@tonic-gate /usr/sbin/ipseckey -f /etc/inet/secret/ipseckeys 2597c478bd9Sstevel@tonic-gatefi 2607c478bd9Sstevel@tonic-gate 2617c478bd9Sstevel@tonic-gateif [ -f /etc/inet/ike/config ] ; then 2627c478bd9Sstevel@tonic-gate /usr/lib/inet/in.iked 2637c478bd9Sstevel@tonic-gatefi 2647c478bd9Sstevel@tonic-gate 2657c478bd9Sstevel@tonic-gate# 2667c478bd9Sstevel@tonic-gate# Configure tunnels which were deferred by /lib/svc/method/net-physical 2677c478bd9Sstevel@tonic-gate# (the svc:/network/physical service) since it depends on the tunnel endpoints 2687c478bd9Sstevel@tonic-gate# being reachable i.e. routing must be running. 2697c478bd9Sstevel@tonic-gate# 2707c478bd9Sstevel@tonic-gate# WARNING: you may wish to turn OFF forwarding if you haven't already, because 2717c478bd9Sstevel@tonic-gate# of various possible security vulnerabilities when configuring tunnels for 2727c478bd9Sstevel@tonic-gate# Virtual Private Network (VPN) construction. 2737c478bd9Sstevel@tonic-gate# 2747c478bd9Sstevel@tonic-gate# Also, if names are used in the /etc/hostname.ip.tun* file, those names 2757c478bd9Sstevel@tonic-gate# have to be in either DNS (and DNS is used) or in /etc/hosts, because this 2767c478bd9Sstevel@tonic-gate# file is executed before NIS or NIS+ is started. 2777c478bd9Sstevel@tonic-gate# 2787c478bd9Sstevel@tonic-gate 2797c478bd9Sstevel@tonic-gate# 2807c478bd9Sstevel@tonic-gate# IPv4 tunnels 2817c478bd9Sstevel@tonic-gate# The second component of the name must be either "ip" or "ip6". 2827c478bd9Sstevel@tonic-gate# 2837c478bd9Sstevel@tonic-gateinterface_names="`/usr/bin/ls /etc/hostname.ip*.*[0-9] 2>/dev/null | \ 2847c478bd9Sstevel@tonic-gate /usr/bin/grep '/etc/hostname\.ip6\{0,1\}\.'`" 2857c478bd9Sstevel@tonic-gateif [ -n "$interface_names" ]; then 2867c478bd9Sstevel@tonic-gate ( 2877c478bd9Sstevel@tonic-gate echo "configuring IPv4 tunnels:\c" 2887c478bd9Sstevel@tonic-gate # Extract the part after the first '.' 2897c478bd9Sstevel@tonic-gate set -- `for intr in $interface_names; do \ 2907c478bd9Sstevel@tonic-gate /usr/bin/expr //$intr : '[^.]*\.\(.*\)$'; done` 2917c478bd9Sstevel@tonic-gate while [ $# -ge 1 ]; do 2927c478bd9Sstevel@tonic-gate # Skip empty files 2937c478bd9Sstevel@tonic-gate if [ ! -s /etc/hostname\.$1 ]; then 2947c478bd9Sstevel@tonic-gate shift 2957c478bd9Sstevel@tonic-gate continue 2967c478bd9Sstevel@tonic-gate fi 2977c478bd9Sstevel@tonic-gate /usr/sbin/ifconfig $1 plumb 2987c478bd9Sstevel@tonic-gate while read ifcmds; do 2997c478bd9Sstevel@tonic-gate if [ -n "$ifcmds" ]; then 3007c478bd9Sstevel@tonic-gate /usr/sbin/ifconfig $1 inet $ifcmds 3017c478bd9Sstevel@tonic-gate fi 3027c478bd9Sstevel@tonic-gate done </etc/hostname\.$1 >/dev/null 3037c478bd9Sstevel@tonic-gate echo " $1\c" 3047c478bd9Sstevel@tonic-gate shift 3057c478bd9Sstevel@tonic-gate done 3067c478bd9Sstevel@tonic-gate echo "." 3077c478bd9Sstevel@tonic-gate ) 3087c478bd9Sstevel@tonic-gatefi 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate# 3117c478bd9Sstevel@tonic-gate# IPv6 Tunnels 3127c478bd9Sstevel@tonic-gate# The second component of the name must be either "ip" or "ip6". 3137c478bd9Sstevel@tonic-gate# 3147c478bd9Sstevel@tonic-gateinterface_names="`/usr/bin/ls /etc/hostname6.ip*.*[0-9] 2>/dev/null | \ 3157c478bd9Sstevel@tonic-gate /usr/bin/grep '/etc/hostname6\.ip6\{0,1\}\.'`" 3167c478bd9Sstevel@tonic-gateif [ -n "$interface_names" ]; then 3177c478bd9Sstevel@tonic-gate ( 3187c478bd9Sstevel@tonic-gate echo "configuring IPv6 tunnels:\c" 3197c478bd9Sstevel@tonic-gate # Extract the part after the first '.' 3207c478bd9Sstevel@tonic-gate set -- `for intr in $interface_names; do \ 3217c478bd9Sstevel@tonic-gate /usr/bin/expr //$intr : '[^.]*\.\(.*\)$'; done` 3227c478bd9Sstevel@tonic-gate while [ $# -ge 1 ]; do 3237c478bd9Sstevel@tonic-gate # Skip empty files 3247c478bd9Sstevel@tonic-gate if [ ! -s /etc/hostname6\.$1 ]; then 3257c478bd9Sstevel@tonic-gate shift 3267c478bd9Sstevel@tonic-gate continue 3277c478bd9Sstevel@tonic-gate fi 3287c478bd9Sstevel@tonic-gate /usr/sbin/ifconfig $1 inet6 plumb 3297c478bd9Sstevel@tonic-gate while read ifcmds; do 3307c478bd9Sstevel@tonic-gate if [ -n "$ifcmds" ]; then 3317c478bd9Sstevel@tonic-gate /usr/sbin/ifconfig $1 inet6 $ifcmds 3327c478bd9Sstevel@tonic-gate fi 3337c478bd9Sstevel@tonic-gate done </etc/hostname6\.$1 > /dev/null 3347c478bd9Sstevel@tonic-gate echo " $1\c" 3357c478bd9Sstevel@tonic-gate shift 3367c478bd9Sstevel@tonic-gate done 3377c478bd9Sstevel@tonic-gate echo "." 3387c478bd9Sstevel@tonic-gate ) 3397c478bd9Sstevel@tonic-gatefi 3407c478bd9Sstevel@tonic-gate 3417c478bd9Sstevel@tonic-gate# 3427c478bd9Sstevel@tonic-gate# Set 6to4 Relay Router communication support policy and, if applicable, 3437c478bd9Sstevel@tonic-gate# the destination Relay Router IPv4 address. See /etc/default/inetinit for 3447c478bd9Sstevel@tonic-gate# setting and further info on ACCEPT6TO4RELAY and RELAY6TO4ADDR. 3457c478bd9Sstevel@tonic-gate# If ACCEPT6TO4RELAY=NO, the default value in the kernel will 3467c478bd9Sstevel@tonic-gate# be used. 3477c478bd9Sstevel@tonic-gate# 3487c478bd9Sstevel@tonic-gateACCEPT6TO4RELAY=`echo "$ACCEPT6TO4RELAY" | /usr/bin/tr '[A-Z]' '[a-z]'` 3497c478bd9Sstevel@tonic-gateif [ "$ACCEPT6TO4RELAY" = yes ]; then 3507c478bd9Sstevel@tonic-gate if [ "$RELAY6TO4ADDR" ]; then 3517c478bd9Sstevel@tonic-gate /usr/sbin/6to4relay -e -a $RELAY6TO4ADDR 3527c478bd9Sstevel@tonic-gate else 3537c478bd9Sstevel@tonic-gate /usr/sbin/6to4relay -e 3547c478bd9Sstevel@tonic-gate fi 3557c478bd9Sstevel@tonic-gatefi 3567c478bd9Sstevel@tonic-gate 357a59fa508Sjl138328# 358a59fa508Sjl138328# Read /etc/inet/static_routes and add each route. 359a59fa508Sjl138328# 360a59fa508Sjl138328if [ -f /etc/inet/static_routes ]; then 361a59fa508Sjl138328 echo "Adding persistent routes:" 362a59fa508Sjl138328 /usr/bin/egrep -v "^(#|$)" /etc/inet/static_routes | while read line; do 363a59fa508Sjl138328 /usr/sbin/route add $line 364a59fa508Sjl138328 done 365a59fa508Sjl138328fi 366a59fa508Sjl138328 3677c478bd9Sstevel@tonic-gate# Clear exit status. 368*6927f468Sdpexit $SMF_EXIT_OK 369