xref: /titanic_44/usr/src/cmd/svc/milestone/net-loopback (revision ea8dc4b6d2251b437950c0056bc626b311c73c27)
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, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
24# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27#ident	"%Z%%M%	%I%	%E% SMI"
28
29. /lib/svc/share/smf_include.sh
30
31#
32# In a zone we need this service to be up, but all of the work
33# it tries to do is irrelevant (and will actually lead to the service
34# failing if we try to do it), so just bail out.
35#
36if [ `/sbin/zonename` != "global" ]; then
37	exit 0
38fi
39
40#
41# Cause ifconfig to not automatically start in.mpathd when IPMP groups are
42# configured.  This is not strictly necessary but makes it so that in.mpathd
43# will always be started explicitly from /lib/svc/method/net-init (the
44# svc:/network/initial service), when we're sure that /usr is mounted.
45#
46SUNW_NO_MPATHD=; export SUNW_NO_MPATHD
47
48#
49# Before any interfaces are configured, we need to set the system
50# default IP forwarding behavior.  This will be the setting for
51# interfaces that don't modify the per-interface setting with the
52# router or -router ifconfig command in their /etc/hostname.<intf>
53# files.  The -F option tells routeadm to only update the forwarding
54# configuration for the system, and not dynamic routing.  We don't
55# want routing daemons started until later in the boot process (see
56# the net-init method for that).
57#
58/sbin/routeadm -u -F
59
60# IPv4 loopback
61/sbin/ifconfig lo0 plumb 127.0.0.1 up
62
63# Configure the v6 loopback if any IPv6 interfaces are configured.
64interface_names="`echo /etc/hostname6.*[0-9] 2>/dev/null`"
65if [ "$interface_names" != "/etc/hostname6.*[0-9]" ]; then
66        ORIGIFS="$IFS"
67        IFS="$IFS."
68        set -- $interface_names
69        IFS="$ORIGIFS"
70        while [ $# -ge 2 ]; do
71                shift
72                if [ $# -gt 1 -a "$2" != "/etc/hostname6" ]; then
73                        while [ $# -gt 1 -a "$1" != "/etc/hostname6" ]; do
74                                shift
75                        done
76                else
77                        inet6_list="$inet6_list $1"
78                        shift
79                fi
80        done
81fi
82
83if [ -n "$inet6_list" ]; then
84	/sbin/ifconfig lo0 inet6 plumb ::1 up
85else
86	exit 0
87fi
88