cfgnet.san revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#ident "%Z%%M% %I% %E% SMI"
#
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
#
# Source the utilities.
#
. ${DIRNAME}/utilities.san
#
# Process the input arguments.
#
process_args $@
#
# In case the tester wants to see script output, allow them
# to run in debug mode.
#
if [ ! -z "${DEBUG}" ]
then
echo "Output from test: ${TESTNAME}" >${OUTFILE}
echo >>${OUTFILE}
echo "debug output can be found at ${OUTFILE}"
else
fi
#
# Set NISSERV and NISDMAIN if NIS or NIS+ in YP compat mode.
# Returns 0 if these variables are set, nonzero otherwise.
#
{
unset NISSERV
unset NISDMAIN
do
"nis")
if [ ${?} -eq 0 ]
then
NISSERV=""
do
if [ -z "${NISSERV}" ]
then
else
NISSERV="${NISSERV} ${NSERV}"
fi
done
unset NSERV
fi
;;
esac
unset TMP
done
}
#
# Set variables.
#
#
# Determine subnet, netmask, and broadcast address.
#
SUBNET=`get_netmask ${SRVADDR}`
if [ -z "${SUBNET}" ]
then
if [ "${DEFNET}" != "${SRVADDR}" ]
then
# likely subnetted/supernetted.
print - "\n\n###\tWarning\t###\n"
print - "Network ${SRVADDR} is netmasked, but no entry was found in the 'netmasks'\ntable; please update the 'netmasks' table in the appropriate\nnameservice before continuing (see /etc/nsswitch.conf).\n" >&2
return 1
else
# use the default.
SUBNET="${DEFMASK}"
fi
fi
BCAST=`get_bcast_addr ${SRVADDR} ${SUBNET}`
SUBNETADDR=`get_subnet_addr ${SRVADDR} ${SUBNET}`
#
# Make sure to clean up before we configure.
#
#
# Configure.
#
RET=$?
if [ "${RET}" != "0" ]
then
echo "Error configuring ${SUBNETADDR} table = ${RET}"
echo "${TESTNAME} - Test failed!"
exit 1
fi
#
# Verify that the network table was created.
#
NETTAB=`echo ${NETTABS} | fgrep ${SUBNETADDR}`
if [ -z ${NETTAB} ]
then
echo "Network table for ${SUBNETADDR} not created."
echo "${TESTNAME} - Test failed!"
exit 1
fi
#
# Verify that the network macro was created.
#
RET=$?
if [ "${RET}" != "0" ]
then
echo "Error displaying dhcptab = ${RET}"
echo "${TESTNAME} - Test failed!"
exit 1
fi
if [ -z "${NETWORK_MACRO}" ]
then
echo "Server macro does not exist in dhcptab"
echo "${TESTNAME} - Test failed!"
exit 1
fi
#
# Grab the server macro definition
#
#
# Verify that the Subnet symbol is defined as part of the macro definition
#
SRCH=":Subnet=${SUBNET}:"
#
# Verify that the RDiscvyF symbol is defined as part of the macro definition
#
SRCH=":RDiscvyF=1:"
#
# Verify that the Broadcst symbol is defined as part of the macro definition
#
SRCH=":Broadcst=${BCAST}:"
#
# Get the NIS info
#
#
# Verify that the DNSdmain symbol is defined as part of the macro definition
#
if [ ! -z "${NISDMAIN}" ]
then
SRCH=":NISdmain=\"${NISDMAIN}\":"
fi
if [ ! -z "${NISSERV}" ]
then
SRCH=":NISservs=${NISSERV}:"
fi
#
# Verify that all symbols have been accounted for
#
if [ "${MACRO_DEFINITION}" != ":" ]
then
echo "Network macro definition has invalid extra symbols: ${MACRO_DEFINITION}"
echo "${TESTNAME} - Test failed!"
exit 1
fi
echo "${TESTNAME} - Test passed."
exit 0