xref: /illumos-gate/usr/src/cmd/svc/milestone/net-init (revision f20211217f12ce291fd518e61065cd273f23e4ea)
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 (the "License").
7# You may not use this file except in compliance with the License.
8#
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.
13#
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]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# This is the second phase of TCP/IP configuration.  The first part is
27# run by the svc:/network/physical service and includes configuring the
28# interfaces and setting the machine's hostname.  The svc:/network/initial
29# service does all configuration that can be done before name services are
30# started, bar configuring IP routing (this is carried out by the
31# svc:/network/routing-setup service).  The final part, run by the
32# svc:/network/service service,  does all configuration that may require
33# name services.  This includes a final re-configuration of the
34# interfaces.
35#
36
37. /lib/svc/share/smf_include.sh
38
39#
40# In a shared-IP zone we need this service to be up, but all of the work
41# it tries to do is irrelevant (and will actually lead to the service
42# failing if we try to do it), so just bail out.
43# In the global zone and exclusive-IP zones we proceed.
44#
45smf_configure_ip || exit $SMF_EXIT_OK
46
47# Configure IPv6 Default Address Selection.
48if [ -f /etc/inet/ipaddrsel.conf ]; then
49	/usr/sbin/ipaddrsel -f /etc/inet/ipaddrsel.conf
50fi
51
52#
53# If explicit IPMP groups are being used, in.mpathd will already be started.
54# However, if TRACK_INTERFACES_ONLY_WITH_GROUPS=no and no explicit IPMP
55# groups have been configured, then it still needs to be started.  So, fire
56# it up in "adopt" mode; if there are no interfaces it needs to manage, it
57# will automatically exit.
58#
59/usr/bin/pgrep -x -u 0 -z `smf_zonename` in.mpathd >/dev/null 2>&1 || \
60    /usr/lib/inet/in.mpathd -a
61
62#
63# Set the RFC 1948 entropy, regardless of if I'm using it or not.  If present,
64# use the encrypted root password as a source of entropy.  Otherwise,
65# just use the pre-set (and hopefully difficult to guess) entropy that
66# tcp used when it loaded.
67#
68encr=`/usr/bin/awk -F: '/^root:/ {print $2}' /etc/shadow`
69[ -z "$encr" ] || /usr/sbin/ndd -set /dev/tcp tcp_1948_phrase $encr
70unset encr
71
72# Set the SDP system Policy.  This needs to happen after basic
73# networking is up but before any networking services that might
74# want to use SDP are enabled
75if [ -f /usr/sbin/sdpadm -a -f /etc/sdp.conf ]; then
76	. /etc/sdp.conf
77	if [ "$sysenable" = "1" ]; then
78		/usr/sbin/sdpadm enable
79	fi
80fi
81
82#
83# Set TCP ISS generation.  By default the ISS generation is
84# time + random()-delta.  This might not be strong enough for some users.
85# See /etc/default/inetinit for settings and further info on TCP_STRONG_ISS.
86# If not set, use TCP's internal default setting.
87#
88[ -f /etc/default/inetinit ] && . /etc/default/inetinit
89if [ $TCP_STRONG_ISS ]; then
90	/usr/sbin/ndd -set /dev/tcp tcp_strong_iss $TCP_STRONG_ISS
91fi
92
93# Clear exit status.
94exit $SMF_EXIT_OK
95