8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / svc / milestone / net-loopback
blobbd52bbc7190f10785f30a5ebe94e46361c009975
1 #!/sbin/sh
3 # CDDL HEADER START
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.
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.
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]
20 # CDDL HEADER END
23 # Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
27 . /lib/svc/share/smf_include.sh
30 # In a shared-IP zone we need this service to be up, but all of the work
31 # it tries to do is irrelevant (and will actually lead to the service
32 # failing if we try to do it), so just bail out.
33 # In the global zone and exclusive-IP zones we proceed.
35 smf_configure_ip || exit $SMF_EXIT_OK
37 if [ -f /etc/hostname.lo0 ] || [ -f /etc/hostname6.lo0 ]; then
38 echo "found /etc/hostname.lo0 or /etc/hostname6.lo0; "\
39 "using ifconfig to create lo0" > /dev/msglog
40 # IPv4 loopback
41 /sbin/ifconfig lo0 plumb 127.0.0.1 up
43 # IPv6 loopback
44 /sbin/ifconfig lo0 inet6 plumb ::1 up
46 # Trusted Extensions shares the loopback interface with all zones
47 if (smf_is_system_labeled); then
48 if smf_is_globalzone; then
49 /sbin/ifconfig lo0 all-zones
50 /sbin/ifconfig lo0 inet6 all-zones
53 else
54 state=`/sbin/ipadm show-if -p -o state lo0 2>/dev/null`
55 if [ $? -eq 0 -a "$state" = "disabled" ]; then
56 /sbin/ipadm enable-if -t lo0
57 else
58 # IPv4 loopback
59 /sbin/ipadm create-addr -t -T static -a 127.0.0.1/8 lo0/v4
61 # IPv6 loopback
62 /sbin/ipadm create-addr -t -T static -a ::1/128 lo0/v6
65 # Trusted Extensions shares the loopback interface with all zones
66 if (smf_is_system_labeled); then
67 if smf_is_globalzone; then
68 /sbin/ipadm set-addrprop -t -p zone=all-zones lo0/v4
69 /sbin/ipadm set-addrprop -t -p zone=all-zones lo0/v6