treewide: replace /sbin/sh hashbangs with /bin/sh
[unleashed.git] / usr / src / cmd / svc / milestone / net-netmask
blobc4410a3428978900cc9e7c0bb432b497221f65e4
1 #!/bin/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.
28 # Reset netmask and broadcast address whenever new information is
29 # availabe from NIS.
32 . /lib/svc/share/smf_include.sh
35 # In a shared-IP zone we need this service to be up, but all of the
36 # work it tries to do is irrelevant (and will actually lead to the
37 # service failing if we try to do it), so just bail out.
38 # In the global zone and exclusive-IP zones we proceed.
40 smf_configure_ip || exit $SMF_EXIT_OK
43 # wait_nis
44 # Wait up to 5 seconds for ypbind to obtain a binding.
46 wait_nis ()
48 for i in 1 2 3 4 5; do
49 server=`/usr/bin/ypwhich 2>/dev/null`
50 [ $? -eq 0 -a -n "$server" ] && return 0 || sleep 1
51 done
52 return 1
56 # Reset the netmask and broadcast address for our network interfaces.
57 # Since this may result in a name service lookup, we want to now wait
58 # for NIS to come up if we previously started it.
60 domain=`/usr/bin/domainname 2>/dev/null`
62 [ -z "$domain" ] || [ ! -d /var/yp/binding/$domain ] || wait_nis || \
63 echo "WARNING: Timed out waiting for NIS to come up" >& 2
66 # Re-set the netmask and broadcast addr for all IP interfaces. This
67 # ifconfig is run here, after waiting for name services, so that
68 # "netmask +" will find the netmask if it lives in a NIS map. The 'D'
69 # in -auD tells ifconfig NOT to mess with the interface if it is
70 # under DHCP control
72 /usr/sbin/ifconfig -auD4 netmask + broadcast +
74 # Uncomment these lines to print complete network interface configuration
75 # echo "network interface configuration:"
76 # /usr/sbin/ifconfig -a