net-init revision 6927f468b0af7710df000f6b16f6ee413e1e3007
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# CDDL HEADER START
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# The contents of this file are subject to the terms of the
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# Common Development and Distribution License (the "License").
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# You may not use this file except in compliance with the License.
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# See the License for the specific language governing permissions
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# and limitations under the License.
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# When distributing Covered Code, include this CDDL HEADER in each
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# If applicable, add the following below this CDDL HEADER, with the
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# fields enclosed by brackets "[]" replaced with your own identifying
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# information: Portions Copyright [yyyy] [name of copyright owner]
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# CDDL HEADER END
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# Use is subject to license terms.
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# ident "%Z%%M% %I% %E% SMI"
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# This is the second phase of TCP/IP configuration. The first part is
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# run by the /lib/svc/method/net-physical script (the svc:/network/physical
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# service) and includes configuring the interfaces and setting the machine's
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# hostname. This script (the svc:/network/initial service), does all
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# configuration that can be done before name services are started. This
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# includes configuring IP routing, and setting any tunable parameters.
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# The third part, run by the /lib/svc/method/net-svc script (the
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# svc:/network/service service), does all configuration that may require
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# name services. This includes a final re-configuration of the interfaces.
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang # In a zone we need this service to be up, but all of the work
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang # it tries to do is irrelevant (and will actually lead to the service
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang # failing if we try to do it), so just bail out.
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang ;; # Fall through -- rest of script is the initialization code
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang # If we were routing dynamically, we will note this with
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang # the .dynamic_routing file, so that we can leave the routes
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang # in place without thinking they're static route entries
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang # when we come back into states 2 or 3.
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang if /usr/bin/pgrep -x -u 0 'in.routed|in.rdisc' >/dev/null 2>&1; then
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang /usr/bin/pkill -z global -x -u 0 'in.routed|in.rdisc'
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang /usr/bin/pkill -z global -x -u 0 'in.ndpd|in.ripngd'
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang echo "Usage: $0 { start | stop }"
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang# Configure IPv6 Default Address Selection.
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang/usr/sbin/ifconfig -a6u >/etc/svc/volatile/ifconfig.$$
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fangnumv6ifs=`/usr/bin/grep -c inet6 /etc/svc/volatile/ifconfig.$$`
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang # Add a static route for multicast packets out of a link-local
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang # interface, although would like to specify multicast interface using
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang # an interface name!
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang /inet6 fe80:/ {
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang print substr($2, 1, index($2, "/") - 1)
22a84b8d79248a611e4ba663a268d3c4bed054acQuaker Fang if [ -n "$1" ]; then
# Now that /usr is mounted, see if in.mpathd needs to be started by firing it
# Initialize IPsec only if ipsecinit.conf exists. Otherwise, save the
unset encr
if [ $TCP_STRONG_ISS ]; then
# Configure default IPv4 routers using the local "/etc/defaultrouter"
# The default routes listed in the "/etc/defaultrouter" file will
# empty "/etc/defaultrouter" file will cause the default route
if [ -n "$defrouters" ]; then
# We want the default router(s) listed in /etc/defaultrouter
# Next, add those from /etc/defaultrouter. While doing this,
# "add net default: gateway a.b.c.d: entry exists"
# the /etc/defaultrouter file. routeadm also starts in.ndpd.
if [ -z "$defrouters" ]; then
# Configure tunnels which were deferred by /lib/svc/method/net-physical
# being reachable i.e. routing must be running.
# Also, if names are used in the /etc/hostname.ip.tun* file, those names
if [ -n "$interface_names" ]; then
while [ $# -ge 1 ]; do
while read ifcmds; do
if [ -n "$interface_names" ]; then
while [ $# -ge 1 ]; do
while read ifcmds; do
if [ "$RELAY6TO4ADDR" ]; then
# Read /etc/inet/static_routes and add each route.
exit $SMF_EXIT_OK