net-nwam revision 69b43529e65fb6eb0c88e6b7b42025e9bf025b8a
2400N/A# The contents of this file are subject to the terms of the 2400N/A# Common Development and Distribution License (the "License"). 2400N/A# You may not use this file except in compliance with the License. 2400N/A# See the License for the specific language governing permissions 2400N/A# and limitations under the License. 2400N/A# When distributing Covered Code, include this CDDL HEADER in each 2400N/A# If applicable, add the following below this CDDL HEADER, with the 2400N/A# fields enclosed by brackets "[]" replaced with your own identifying 2400N/A# information: Portions Copyright [yyyy] [name of copyright owner] 3817N/A# Copyright 2010 Sun Microsystems, Inc. All rights reserved. 2400N/A# Use is subject to license terms. 3817N/A# Set appropriate config SMF property to these files when NWAM is stopped 3817N/A# and corresponding config properties in the Legacy location are emtpy # We don't have a writable file system so we write to /etc/svc/volatile and # then later copy anything interesting to /etc/nwam. # copy_to_legacy_loc <file> # Copies the file to the Legacy location directory # copy_from_legacy_loc <destination file> # Copies file with the same name from Legacy location to the given # Make destination directory if needed # write_loc_prop <property> <value> <file> # Appends to <file> a nwamcfg command to set <property> to <value> if non-empty # set_smf_prop <fmri> <property name> <property value> # get_smf_prop <fmri> <property name> # Creates Legacy location from the current configuration # Write nwamcfg commands to create Legacy location to # $CREATE_LOC_LEGACY_FILE as values for properties are determined # Note that some of the *_CONFIG_FILE variables point at copies of # files we've made and others indicate where those copies should be # if we are enabling the location. # Gather NIS info from appropriate file if present. $NAWK '{ printf "%s,", $1 }'` # Gather LDAP info via ldapclient(1M). $NAWK '$1 == "preferredServerList:" { print $2 }'` # Now, write nwamcfg commands for nameservices # If the firewall policy is "custom", simply copy the # custom_policy_file. If the firewall policy is "none", "allow" or # "deny", save the value as "/<value>". When reverting back to the # Legacy location, these values will have to be treated as special. # For all configuration files, copy them to the Legacy directory. # Use the respective properties to remember the original locations # of the files so that they can be copied back there when NWAM is # save value as /none, /allow, or /deny # Undoes the effects of the Legacy location creation 'FS="," { for (i = 1; i <= NF; i++) print $i }' \ # IPFilter, IPsec, and IKE # change /none, /allow, and /deny to firewall policy # no need to clear custom_policy_file as it isn't "custom" # Remove the Legacy directory and location # Arguments to net-nwam are # method ( start | refresh | stop | -u | -c ) # The real daemon is not started in a shared stack zone. But we need to # create a dummy background process to preserve contract lifetime. # Update PVID on interfaces configured with VLAN 1 # Upgrade handling. The upgrade file consists of a series # of dladm(1M) commands. Note that after we are done, we # cannot rename the upgrade script file as the file system # is still read-only at this point. Defer this to the # manifest-import service. if [ -f
"${upgrade_script}" ];
then # Bring up simnet instances # Initialize security objects. # Initialize VNICs, VLANs and flows. Though they are brought # up here, NWAM will not automatically manage VNICs and VLANs. # We also need to create the Legacy location, which is used # to restore non-NWAM settings that are overwritten when # start nwamd in foreground; it will daemonize itself # We need to make the dummy process we created above stop. # Restore the non-NWAM settings. echo "No Legacy location to revert to!" # remove the location property group # After we run this part of the script upon the next reboot # There are various other parts of the system (nscd, nfs) that # depend on continuing to have a working network. For this # reason we don't change the network configuration immediately. # If nwam is online then make sure that it's temporarily enabled. # Set nwam so that it won't be enabled upon reboot. # Nothing to do for sysidtool echo "Usage: $0 { start | stop | refresh }"