net-svc revision d71dbb732372504daff1f1783bc0d8864ce9bd50
474N/A# The contents of this file are subject to the terms of the 474N/A# Common Development and Distribution License (the "License"). 474N/A# You may not use this file except in compliance with the License. 474N/A# See the License for the specific language governing permissions 474N/A# and limitations under the License. 474N/A# When distributing Covered Code, include this CDDL HEADER in each 474N/A# If applicable, add the following below this CDDL HEADER, with the 474N/A# fields enclosed by brackets "[]" replaced with your own identifying 474N/A# information: Portions Copyright [yyyy] [name of copyright owner] 1914N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 474N/A# Use is subject to license terms. 474N/A#ident "%Z%%M% %I% %E% SMI" 474N/A# runs after the NIS/NIS+ startup script. We run things here that may 474N/A # In a shared-IP zone we need this service to be up, but all of the 474N/A # work it tries to do is irrelevant (and will actually lead to the 474N/A # service failing if we try to do it), so just bail out. 474N/A # In the global zone and exclusive-IP zones we proceed. 844N/A ;;
# Fall through -- rest of script is the initialization code 474N/A echo "Usage: $0 { start | stop }" 474N/A# If boot variables are not set, set variables we use 474N/A# Wait up to 5 seconds for ypbind to obtain a binding. 474N/A# This function takes two file names and the file mode as input. The two 474N/A# files are compared for differences (using cmp(1)) and if different, the 474N/A# second file is over written with the first. A chmod is done with the file 474N/A# mode passed in. If the files are equal, the first file passed 474N/A# in (the /tmp file) is deleted. 474N/A # The umask during boot is configurable, which requires 474N/A # explicit setting of file permission modes when we 474N/A# This routine takes as a parameter, the name of the respective policy 474N/A # Add dns to the nsswitch file, if it isn't already there. 474N/A printf("#%s # Commented out by DHCP\n", $0); for (i = 2; i <= n; i++) { if (updated == 0 && index(a[i], "[") == 1) { newl = newl" # Added by DHCP"; # We now need to 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. 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 -auD tells ifconfig NOT to # mess with the interface if it is under DHCP control # Uncomment these lines to print complete network interface configuration # echo "network interface configuration:" # domain or nameserver entries with new ones derived # from DHCP. Note that it is important to preserve # order of domain entries vs. search entries; the search # entries are reserved for administrator customization # and if placed after the domain entry will override it. # Use only first domain, not a search list split(ENVIRON["dnsdomain"], d) printf("domain %s\n", d[1]) $1 == "domain" { writedomain(); next } $1 != "nameserver" { print $0 } n = split(ENVIRON["dnsservers"], s) printf("nameserver %s\n", s[i]) # Add dns to the nsswitch file, if it isn't already there. # If we added DNS to the hosts and ipnodes policy in the nsswitch, -e
'/# Added by DHCP$/d' \
-e
's/^\(#hosts:\)\(.*[^#]\)\(#.*\)$/hosts: \2/' \
-e
's/^\(#ipnodes:\)\(.*[^#]\)\(#.*\)$/ipnodes: \2/' \
# Clean up any old DHCP-added entries (except loopback) in the hosts file. if (index($0, "# Added by DHCP") == 0 || $1 == "127.0.0.1" || $1 == "::1") { # Load the IPQoS configuration. # This is backgrounded so that any remote hostname lookups it performs # don't unduely delay startup. Any messages go via syslog. # Add a static route for multicast packets out our default interface. # The default interface is the interface that corresponds to the node name. # Run in background subshell to avoid waiting for name service. echo "Setting default IPv4 interface for multicast:" \