#!/usr/sbin/sh # # Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. # # # Reset netmask and broadcast address whenever new information is # availabe from NIS. # . /lib/svc/share/smf_include.sh # # In a shared-IP zone we need this service to be up, but all of the # work it tries to do is irrelevant (and will actually lead to the # service failing if we try to do it), so just bail out. # In the global zone and exclusive-IP zones we proceed. # smf_configure_ip || exit $SMF_EXIT_OK # # wait_nis # Wait up to 5 seconds for ypbind to obtain a binding. # wait_nis () { for i in 1 2 3 4 5; do server=`/usr/bin/ypwhich 2>/dev/null` [ $? -eq 0 -a -n "$server" ] && return 0 || sleep 1 done return 1 } # # Reset the netmask and broadcast address for our network interfaces. # Since this may result in a name service lookup, we want to now wait # for NIS to come up if we previously started it. # domain=`/usr/bin/domainname 2>/dev/null` [ -z "$domain" ] || [ ! -d $SMF_SYSVOL_FS/daemon/ypbind ] || wait_nis || \ echo "WARNING: Timed out waiting for NIS to come up" >& 2 # # Re-set the netmask and broadcast addr for all IP interfaces. This # ifconfig is run here, after waiting for name services, so that # "netmask +" will find the netmask if it lives in a NIS map. The 'D' # in -auLD tells ifconfig NOT to mess with the interface if it is # under DHCP control # /usr/sbin/ifconfig -auLD4 netmask + broadcast + # Uncomment these lines to print complete network interface configuration # echo "network interface configuration:" # /usr/sbin/ifconfig -a