xref: /titanic_50/usr/src/cmd/svc/milestone/net-init (revision 2b24ab6b3865caeede9eeb9db6b83e1d89dcd1ea)
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#
23e11c3f44Smeem# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate# This is the second phase of TCP/IP configuration.  The first part is
27a192e900Samaguire# run by the svc:/network/physical service and includes configuring the
28a192e900Samaguire# interfaces and setting the machine's hostname.  The svc:/network/initial
29a192e900Samaguire# service does all configuration that can be done before name services are
30a192e900Samaguire# started, bar configuring IP routing (this is carried out by the
31a192e900Samaguire# svc:/network/routing-setup service).  The final part, run by the
32a192e900Samaguire# svc:/network/service service,  does all configuration that may require
33a192e900Samaguire# name services.  This includes a final re-configuration of the
34a192e900Samaguire# interfaces.
357c478bd9Sstevel@tonic-gate#
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gate. /lib/svc/share/smf_include.sh
387c478bd9Sstevel@tonic-gate
397c478bd9Sstevel@tonic-gate#
40f4b3ec61Sdh155122# In a shared-IP zone we need this service to be up, but all of the work
417c478bd9Sstevel@tonic-gate# it tries to do is irrelevant (and will actually lead to the service
427c478bd9Sstevel@tonic-gate# failing if we try to do it), so just bail out.
43f4b3ec61Sdh155122# In the global zone and exclusive-IP zones we proceed.
447c478bd9Sstevel@tonic-gate#
45f4b3ec61Sdh155122smf_configure_ip || exit $SMF_EXIT_OK
466927f468Sdp
477c478bd9Sstevel@tonic-gate# Configure IPv6 Default Address Selection.
487c478bd9Sstevel@tonic-gateif [ -f /etc/inet/ipaddrsel.conf ]; then
497c478bd9Sstevel@tonic-gate	/usr/sbin/ipaddrsel -f /etc/inet/ipaddrsel.conf
507c478bd9Sstevel@tonic-gatefi
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gate#
53e11c3f44Smeem# If explicit IPMP groups are being used, in.mpathd will already be started.
54e11c3f44Smeem# However, if TRACK_INTERFACES_ONLY_WITH_GROUPS=no and no explicit IPMP
55e11c3f44Smeem# groups have been configured, then it still needs to be started.  So, fire
56e11c3f44Smeem# it up in "adopt" mode; if there are no interfaces it needs to manage, it
57e11c3f44Smeem# will automatically exit.
587c478bd9Sstevel@tonic-gate#
59f4b3ec61Sdh155122/usr/bin/pgrep -x -u 0 -z `smf_zonename` in.mpathd >/dev/null 2>&1 || \
60f4b3ec61Sdh155122    /usr/lib/inet/in.mpathd -a
617c478bd9Sstevel@tonic-gate
627c478bd9Sstevel@tonic-gate#
637c478bd9Sstevel@tonic-gate# Set the RFC 1948 entropy, regardless of if I'm using it or not.  If present,
647c478bd9Sstevel@tonic-gate# use the encrypted root password as a source of entropy.  Otherwise,
657c478bd9Sstevel@tonic-gate# just use the pre-set (and hopefully difficult to guess) entropy that
667c478bd9Sstevel@tonic-gate# tcp used when it loaded.
677c478bd9Sstevel@tonic-gate#
687c478bd9Sstevel@tonic-gateencr=`/usr/bin/awk -F: '/^root:/ {print $2}' /etc/shadow`
697c478bd9Sstevel@tonic-gate[ -z "$encr" ] || /usr/sbin/ndd -set /dev/tcp tcp_1948_phrase $encr
707c478bd9Sstevel@tonic-gateunset encr
717c478bd9Sstevel@tonic-gate
72db5ca0bdSsangeeta# Set the SDP system Policy.  This needs to happen after basic
73db5ca0bdSsangeeta# networking is up but before any networking services that might
74db5ca0bdSsangeeta# want to use SDP are enabled
75db5ca0bdSsangeetaif [ -f /usr/sbin/sdpadm -a -f /etc/sdp.conf ]; then
76db5ca0bdSsangeeta	. /etc/sdp.conf
77db5ca0bdSsangeeta	if [ "$sysenable" = "1" ]; then
78db5ca0bdSsangeeta		/usr/sbin/sdpadm enable
79db5ca0bdSsangeeta	fi
80db5ca0bdSsangeetafi
81db5ca0bdSsangeeta
827c478bd9Sstevel@tonic-gate#
837c478bd9Sstevel@tonic-gate# Set TCP ISS generation.  By default the ISS generation is
847c478bd9Sstevel@tonic-gate# time + random()-delta.  This might not be strong enough for some users.
857c478bd9Sstevel@tonic-gate# See /etc/default/inetinit for settings and further info on TCP_STRONG_ISS.
867c478bd9Sstevel@tonic-gate# If not set, use TCP's internal default setting.
877c478bd9Sstevel@tonic-gate#
88*2b24ab6bSSebastien Roy[ -f /etc/default/inetinit ] && . /etc/default/inetinit
897c478bd9Sstevel@tonic-gateif [ $TCP_STRONG_ISS ]; then
907c478bd9Sstevel@tonic-gate	/usr/sbin/ndd -set /dev/tcp tcp_strong_iss $TCP_STRONG_ISS
917c478bd9Sstevel@tonic-gatefi
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gate# Clear exit status.
946927f468Sdpexit $SMF_EXIT_OK
95