1*6ba597c5SAnurag S. Maskey#!/sbin/sh 2*6ba597c5SAnurag S. Maskey# 3*6ba597c5SAnurag S. Maskey# CDDL HEADER START 4*6ba597c5SAnurag S. Maskey# 5*6ba597c5SAnurag S. Maskey# The contents of this file are subject to the terms of the 6*6ba597c5SAnurag S. Maskey# Common Development and Distribution License (the "License"). 7*6ba597c5SAnurag S. Maskey# You may not use this file except in compliance with the License. 8*6ba597c5SAnurag S. Maskey# 9*6ba597c5SAnurag S. Maskey# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*6ba597c5SAnurag S. Maskey# or http://www.opensolaris.org/os/licensing. 11*6ba597c5SAnurag S. Maskey# See the License for the specific language governing permissions 12*6ba597c5SAnurag S. Maskey# and limitations under the License. 13*6ba597c5SAnurag S. Maskey# 14*6ba597c5SAnurag S. Maskey# When distributing Covered Code, include this CDDL HEADER in each 15*6ba597c5SAnurag S. Maskey# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*6ba597c5SAnurag S. Maskey# If applicable, add the following below this CDDL HEADER, with the 17*6ba597c5SAnurag S. Maskey# fields enclosed by brackets "[]" replaced with your own identifying 18*6ba597c5SAnurag S. Maskey# information: Portions Copyright [yyyy] [name of copyright owner] 19*6ba597c5SAnurag S. Maskey# 20*6ba597c5SAnurag S. Maskey# CDDL HEADER END 21*6ba597c5SAnurag S. Maskey# 22*6ba597c5SAnurag S. Maskey# 23*6ba597c5SAnurag S. Maskey# Copyright 2010 Sun Microsystems, Inc. All rights reserved. 24*6ba597c5SAnurag S. Maskey# Use is subject to license terms. 25*6ba597c5SAnurag S. Maskey# 26*6ba597c5SAnurag S. Maskey 27*6ba597c5SAnurag S. Maskey# 28*6ba597c5SAnurag S. Maskey# Reset netmask and broadcast address whenever new information is 29*6ba597c5SAnurag S. Maskey# availabe from NIS. 30*6ba597c5SAnurag S. Maskey# 31*6ba597c5SAnurag S. Maskey 32*6ba597c5SAnurag S. Maskey. /lib/svc/share/smf_include.sh 33*6ba597c5SAnurag S. Maskey 34*6ba597c5SAnurag S. Maskey# 35*6ba597c5SAnurag S. Maskey# In a shared-IP zone we need this service to be up, but all of the 36*6ba597c5SAnurag S. Maskey# work it tries to do is irrelevant (and will actually lead to the 37*6ba597c5SAnurag S. Maskey# service failing if we try to do it), so just bail out. 38*6ba597c5SAnurag S. Maskey# In the global zone and exclusive-IP zones we proceed. 39*6ba597c5SAnurag S. Maskey# 40*6ba597c5SAnurag S. Maskeysmf_configure_ip || exit $SMF_EXIT_OK 41*6ba597c5SAnurag S. Maskey 42*6ba597c5SAnurag S. Maskey# 43*6ba597c5SAnurag S. Maskey# wait_nis 44*6ba597c5SAnurag S. Maskey# Wait up to 5 seconds for ypbind to obtain a binding. 45*6ba597c5SAnurag S. Maskey# 46*6ba597c5SAnurag S. Maskeywait_nis () 47*6ba597c5SAnurag S. Maskey{ 48*6ba597c5SAnurag S. Maskey for i in 1 2 3 4 5; do 49*6ba597c5SAnurag S. Maskey server=`/usr/bin/ypwhich 2>/dev/null` 50*6ba597c5SAnurag S. Maskey [ $? -eq 0 -a -n "$server" ] && return 0 || sleep 1 51*6ba597c5SAnurag S. Maskey done 52*6ba597c5SAnurag S. Maskey return 1 53*6ba597c5SAnurag S. Maskey} 54*6ba597c5SAnurag S. Maskey 55*6ba597c5SAnurag S. Maskey# 56*6ba597c5SAnurag S. Maskey# Reset the netmask and broadcast address for our network interfaces. 57*6ba597c5SAnurag S. Maskey# Since this may result in a name service lookup, we want to now wait 58*6ba597c5SAnurag S. Maskey# for NIS to come up if we previously started it. 59*6ba597c5SAnurag S. Maskey# 60*6ba597c5SAnurag S. Maskeydomain=`/usr/bin/domainname 2>/dev/null` 61*6ba597c5SAnurag S. Maskey 62*6ba597c5SAnurag S. Maskey[ -z "$domain" ] || [ ! -d /var/yp/binding/$domain ] || wait_nis || \ 63*6ba597c5SAnurag S. Maskey echo "WARNING: Timed out waiting for NIS to come up" >& 2 64*6ba597c5SAnurag S. Maskey 65*6ba597c5SAnurag S. Maskey# 66*6ba597c5SAnurag S. Maskey# Re-set the netmask and broadcast addr for all IP interfaces. This 67*6ba597c5SAnurag S. Maskey# ifconfig is run here, after waiting for name services, so that 68*6ba597c5SAnurag S. Maskey# "netmask +" will find the netmask if it lives in a NIS map. The 'D' 69*6ba597c5SAnurag S. Maskey# in -auD tells ifconfig NOT to mess with the interface if it is 70*6ba597c5SAnurag S. Maskey# under DHCP control 71*6ba597c5SAnurag S. Maskey# 72*6ba597c5SAnurag S. Maskey/usr/sbin/ifconfig -auD4 netmask + broadcast + 73*6ba597c5SAnurag S. Maskey 74*6ba597c5SAnurag S. Maskey# Uncomment these lines to print complete network interface configuration 75*6ba597c5SAnurag S. Maskey# echo "network interface configuration:" 76*6ba597c5SAnurag S. Maskey# /usr/sbin/ifconfig -a 77