xref: /illumos-gate/usr/src/cmd/svc/milestone/net-loopback (revision f4b3ec61df05330d25f55a36b975b4d7519fdeb1)
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
66927f468Sdp# Common Development and Distribution License (the "License").
76927f468Sdp# 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#
23*f4b3ec61Sdh155122# Copyright 2007 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. /lib/svc/share/smf_include.sh
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate#
31*f4b3ec61Sdh155122# In a shared-IP zone we need this service to be up, but all of the work
327c478bd9Sstevel@tonic-gate# it tries to do is irrelevant (and will actually lead to the service
337c478bd9Sstevel@tonic-gate# failing if we try to do it), so just bail out.
34*f4b3ec61Sdh155122# In the global zone and exclusive-IP zones we proceed.
357c478bd9Sstevel@tonic-gate#
36*f4b3ec61Sdh155122smf_configure_ip || exit $SMF_EXIT_OK
377c478bd9Sstevel@tonic-gate
387c478bd9Sstevel@tonic-gate#
397c478bd9Sstevel@tonic-gate# Cause ifconfig to not automatically start in.mpathd when IPMP groups are
407c478bd9Sstevel@tonic-gate# configured.  This is not strictly necessary but makes it so that in.mpathd
417c478bd9Sstevel@tonic-gate# will always be started explicitly from /lib/svc/method/net-init (the
427c478bd9Sstevel@tonic-gate# svc:/network/initial service), when we're sure that /usr is mounted.
437c478bd9Sstevel@tonic-gate#
447c478bd9Sstevel@tonic-gateSUNW_NO_MPATHD=; export SUNW_NO_MPATHD
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gate#
477c478bd9Sstevel@tonic-gate# Before any interfaces are configured, we need to set the system
487c478bd9Sstevel@tonic-gate# default IP forwarding behavior.  This will be the setting for
497c478bd9Sstevel@tonic-gate# interfaces that don't modify the per-interface setting with the
507c478bd9Sstevel@tonic-gate# router or -router ifconfig command in their /etc/hostname.<intf>
51a192e900Samaguire# files.  Due to their dependency on this service, the IP forwarding services
52a192e900Samaguire# will run at this point (though routing daemons will not run until later
53a192e900Samaguire# in the boot process) and set forwarding flags.
547c478bd9Sstevel@tonic-gate#
557c478bd9Sstevel@tonic-gate
56a192e900Samaguire# ipV4 loopback
577c478bd9Sstevel@tonic-gate/sbin/ifconfig lo0 plumb 127.0.0.1 up
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gate# Configure the v6 loopback if any IPv6 interfaces are configured.
607c478bd9Sstevel@tonic-gateinterface_names="`echo /etc/hostname6.*[0-9] 2>/dev/null`"
617c478bd9Sstevel@tonic-gateif [ "$interface_names" != "/etc/hostname6.*[0-9]" ]; then
627c478bd9Sstevel@tonic-gate        ORIGIFS="$IFS"
637c478bd9Sstevel@tonic-gate        IFS="$IFS."
647c478bd9Sstevel@tonic-gate        set -- $interface_names
657c478bd9Sstevel@tonic-gate        IFS="$ORIGIFS"
667c478bd9Sstevel@tonic-gate        while [ $# -ge 2 ]; do
677c478bd9Sstevel@tonic-gate                shift
687c478bd9Sstevel@tonic-gate                if [ $# -gt 1 -a "$2" != "/etc/hostname6" ]; then
697c478bd9Sstevel@tonic-gate                        while [ $# -gt 1 -a "$1" != "/etc/hostname6" ]; do
707c478bd9Sstevel@tonic-gate                                shift
717c478bd9Sstevel@tonic-gate                        done
727c478bd9Sstevel@tonic-gate                else
737c478bd9Sstevel@tonic-gate                        inet6_list="$inet6_list $1"
747c478bd9Sstevel@tonic-gate                        shift
757c478bd9Sstevel@tonic-gate                fi
767c478bd9Sstevel@tonic-gate        done
777c478bd9Sstevel@tonic-gatefi
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gateif [ -n "$inet6_list" ]; then
807c478bd9Sstevel@tonic-gate	/sbin/ifconfig lo0 inet6 plumb ::1 up
817c478bd9Sstevel@tonic-gateelse
826927f468Sdp	exit $SMF_EXIT_OK
837c478bd9Sstevel@tonic-gatefi
84