| $! ===========================================================================
$!
$! Copyright (c) Digital Equipment Corporation, 1991 All Rights Reserved.
$! Unpublished rights reserved under the copyright laws of the United States.
$!
$! The software contained on this media is proprietary to and embodies the
$! confidential technology of Digital Equipment Corporation. Possession,
$! use, duplication or dissemination of the software and media is authorized
$! only pursuant to a valid written license from Digital Equipment Corporation.
$!
$!
$! RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the U.S.
$! Government is subject to restrictions as set forth in Subparagraph
$! (c)(1)(ii) of DFARS 252.227-7013, or in FAR 52.227-19, as applicable.
$!
$! Digital Equipment Corporation
$!
$! ===========================================================================
$!
$! DCL procedure for MCC_MAKECONFIG 1.2
$!
$! Script file to drive creation of DECmcc IP Autoconfiguration configuration
$! file.
$!
$! ===========================================================================
$!
$! Modified - 13-Aug-1991 DHM Initial MCC_MAKECONFIG changes:
$! -nms_ prefix changed to mcc_ prefix
$!
$! 05-Nov-1991 UTF Added copyright header.
$!
$! 06-Nov-1991 UTF Made minor change to header (script
$! name in lower case).
$!
$! 8-NOV-1991 AVN First cut at DCL
$!
$! 1.0 11-Nov-1991 UTF Made minor changes to the text of the
$! instructions.
$!
$! 1.1 15-Nov-1991 UTF Modified to not comment out second
$! permit and community public command.
$!
$! 1.2 03-Apr-1992 UTF Replaced all "$ !" with "$!" to match the
$! comments for the copyright. Changed error
$! message for missing parameter P1, to match
$! convention in new VMS command DECmcc
$! Autoconfiguration command procedures.
$!
$! Added SET NOON, SET CONTROL = (T,Y),
$! ON CONTROL_Y THEN GOTO ABORT_EXIT, and
$! ON WARNING THEN GOTO ERROR_EXIT. Also added
$! labels and code for ABORT_EXIT and
$! ERROR_EXIT.
$!
$! Added /error= and /end_of_file= to
$! file open and read statements. Two
$! new chunks of code (see labels
$! 'get_gwy_read_error' and
$! 'get_network_type_error').
$!
$! Removed strip option and reformatted output
$! to improve readability. (Modified to match
$! output on Ultrix.)
$!
$! 1.3 13-MAY-1992 AVN On error produce a cf file anyway. Let
$! the user define gwy and the subnet mask
$!
$! Removed -H/-V option at end.
$! ===========================================================================
$!
$ SET NOON
$ SET CONTROL = (T,Y)
$ ON CONTROL_Y THEN GOTO ABORT_EXIT
$ ON ERROR THEN GOTO ERROR_EXIT
$ ON WARNING THEN goto ERROR_EXIT
$!
$! =: Get the information from UCX :=
$!
$ if p1 .eqs. ""
$ then
$ write sys$output ""
$ write sys$output " Error: Missing required parameter to MCC_MAKCONFIG.COM."
$ write sys$output " Configuration filename required."
$ exit
$ else
$ cf_file_name = p1
$ endif
$ calling_ucx = 1
$ assign sys$scratch:mcc$$_temp_a.a sys$output
$ UCX
show rout
show interface
exit
$ deass sys$output
$ calling_ucx = 0
$ gosub get_gwy
$!
$ gosub get_network_type
$ gosub get_network_mask
$!
$ gosub clean_up
$!
$ gosub create_cf_file
$ exit
$!
$!----------------------------------------------------------------------------
$! Abort exit
$!----------------------------------------------------------------------------
$!
$ ABORT_EXIT:
$!
$ write sys$output ""
$ write sys$output " MCC_MAKECONFIG.COM ABORTED by user."
$ write sys$output ""
$ write sys$output " Warning: ''product_name' data files"
$ write sys$output " may be corrupt."
$ exit 0 ! exit with error status
$!
$!----------------------------------------------------------------------------
$! Error exit
$!----------------------------------------------------------------------------
$!
$ ERROR_EXIT:
$!
$ write sys$output ""
$ invalid_gwy = "TRUE"
$ invalid_permit_mask = "TRUE"
$ gosub create_cf_file
$ gosub clean_up
$ exit
$!
$!============================================================================
$! Sub routines that will get the gwy address from UCX data base.
$!============================================================================
$!
$! =: Get the Gateway address :=
$!
$!============================================================================
$ get_gwy:
$!-----------------
$ sear/out=sys$scratch:mcc$$_temp_a1.a sys$scratch:mcc$$_temp_a.a "0.0.0.0"
$!
$ open/read/error=get_gwy_read_error in_file sys$scratch:mcc$$_temp_a1.a
$ read/end_of_file=get_gwy_read_error in_file host_name
$ close in_file
$!
$ host_name = f$edit(host_name, "COMPRESS ,TRIM")
$ gwy_name :== 'f$extract(f$locate( "0.0.0.0", host_name)+f$length("0.0.0.0 "), 50, host_name)
$ invalid_gwy = "FALSE"
$!
$ return
$!
$ get_gwy_read_error:
$!
$ write sys$output ""
$ write sys$output " Error: Error determining default gateway in MCC_MAKECONFIG.COM"
$ invalid_gwy = "TRUE"
$ return
$!============================================================================
$ get_network_type:
$!-----------------
$ sear/out=sys$scratch:mcc$$_temp_a2.a sys$scratch:mcc$$_temp_a.a "IP_Addr:"
$!
$ open/read/error=get_network_type_error in_file sys$scratch:mcc$$_temp_a2.a
$ read/end_of_file=get_network_type_error in_file ip_address_line
$ close in_file
$!
$ ip_address_line = f$edit(ip_address_line, "COMPRESS ,TRIM")
$ ip_address = f$extract(f$locate( "IP_Addr:", ip_address_line)+f$length("IP_Addr: "), 15, ip_address_line)
$ if f$locate(" ", ip_address) .gt. 0 then -
ip_address = f$extract(0, f$locate(" ", ip_address), ip_address)
$!
$ ip_network_type :== 'f$extract(0, f$locate(".", ip_address), ip_address)
$ invalid_permit_mask = "FALSE"
$!
$ return
$!
$ get_network_type_error:
$!
$ write sys$output ""
$ write sys$output " Error: Error determining network type in MCC_MAKECONFIG.COM"
$ invalid_permit_mask = "TRUE"
$!
$ return
$!============================================================================
$! Now that we know the "network" identifier we can create an appropriate
$! mask.
$!============================================================================
$ get_network_mask:
$!-----------------
$ if ip_network_type .le. 127
$ then
$ mask :== "255.0.0.0"
$ else
$ if ip_network_type .lt. 192
$ then
$ mask :== "255.255.0.0"
$ else
$ if ip_network_type .lt. 224
$ then
$ mask :== "255.255.255.0"
$ endif
$ endif
$ endif
$!
$ return
$!----------------
$ clean_up:
$!----------------
$ deass sys$output
$ if f$search("sys$scratch:mcc$$_temp_a.a;*") .nes. "" then -
delete/noconfirm/nolog sys$scratch:mcc$$_temp_a.a;*
$ if f$search("sys$scratch:mcc$$_temp_a1.a;*") .nes. "" then -
delete/noconfirm/nolog sys$scratch:mcc$$_temp_a1.a;*
$ if f$search("sys$scratch:mcc$$_temp_a2.a;*") .nes. "" then -
delete/noconfirm/nolog sys$scratch:mcc$$_temp_a2.a;*
$ return
$!============================================================================
$!
$!
$!
$!============================================================================
$ create_cf_file:
$!-----------------
$ open/write cf_file 'cf_file_name'
$!
$ write cf_file "# ============================================================================"
$ write cf_file "#"
$ write cf_file "# DECmcc IP Autoconfiguration configuration file."
$ write cf_file "#"
$ write cf_file "# This configuration file is used to specify DECmcc IP Autoconfiguration"
$ write cf_file "# data collection parameters."
$ write cf_file "#"
$ write cf_file "# ============================================================================"
$ write cf_file ""
$ write cf_file "# ----------------------------------------------------------------------------"
$ write cf_file "# The following 'gwy' commands give the starting point(s) for the"
$ write cf_file "# configuration search. You should not need to change them, but you may wish"
$ write cf_file "# to add distant routers if you have isolated ""islands"" of connectivity."
$ write cf_file "#"
$ write cf_file "# Format:"
$ write cf_file "#"
$ write cf_file "# gwy <name-or-address>"
$ write cf_file "#"
$ write cf_file ""
$ if invalid_gwy .eqs. "TRUE"
$ then
$ write cf_file ""
$ write cf_file "# !!!! The utility was unable to get gwy information using UCX software !!!!"
$ write cf_file "# !!!! Please specify either a gwy or your current IP node address here !!!!"
$ write cf_file ""
$ write cf_file "gwy 0.0.0.0"
$ write cf_file ""
$ else
$ write cf_file "gwy ''gwy_name'"
$ endif
$ write cf_file ""
$ write cf_file "#"
$ write cf_file "# ----------------------------------------------------------------------------"
$ write cf_file "# The following 'permit' commands define the limits of the search."
$ write cf_file "# The predefined one(s) limit the search to the IP networks that this"
$ write cf_file "# host is connected to. You may need to add additional 'permit'"
$ write cf_file "# commands if there are other networks that you need to probe."
$ write cf_file "# In addition, you may include 'deny' commands that will explicitly"
$ write cf_file "# exclude groups of hosts. The arguments to both of these commands"
$ write cf_file "# are an IP address, which is compared against addresses encountered"
$ write cf_file "# in the search, and a bitmask, which determines which bits of the"
$ write cf_file "# comparison are significant. The first matching address/mask pair"
$ write cf_file "# encountered determines whether the search is continued from that"
$ write cf_file "# point. If there is no match, the default is 'deny'."
$ write cf_file "#"
$ write cf_file "# Format:"
$ write cf_file "#"
$ write cf_file "# permit <address> <mask>"
$ write cf_file "# deny <address> <mask>"
$ write cf_file ""
$ if invalid_permit_mask .eqs. "TRUE"
$ then
$ write cf_file "# !!!! Please specify an appropriate address and corresponding mask here !!!!"
$ write cf_file "permit 0.0.0.0 255.255.255.255"
$ else
$ write cf_file "permit ''ip_network_type'.0.0.0 ''mask'"
$ endif
$ write cf_file ""
$ write cf_file "# ----------------------------------------------------------------------------"
$ write cf_file "# The following 'permit' command allows the search to investigate IP"
$ write cf_file "# networks built using Digital's ""Portal"" IP-over-DECnet router."
$ write cf_file "# If you have Portals, leave this command in. If not, the command"
$ write cf_file "# will not interfere with anything, so it may be left in."
$ write cf_file ""
$ write cf_file "permit 132.157.0.0 255.255.0.0"
$ write cf_file ""
$ write cf_file "# ----------------------------------------------------------------------------"
$ write cf_file "# If you need to learn about hosts (in addition to routers), uncomment the"
$ write cf_file "# ""options -h"" line, below."
$ write cf_file "#"
$ write cf_file "# You also need to either:"
$ write cf_file "#"
$ write cf_file "# 1) give ""host-permit"" and ""host-deny"" commands, or"
$ write cf_file "# 2) remove the ""host-deny 0.0.0.0 0.0.0.0"" line, below."
$ write cf_file "#"
$ write cf_file "# These work just like the ""permit"" and ""deny"" commands, above. When"
$ write cf_file "# querying a host, the ""host-*"" access list is checked first. If it"
$ write cf_file "# does not have a match, then the router access list is checked. So, by"
$ write cf_file "# default, the -h option will cause all hosts in the network to be queried."
$ write cf_file "# This is a lot of data, and is rarely what you want. Therefore, you will"
$ write cf_file "# probably want to give ""host-permit"" commands for a few subnets, and"
$ write cf_file "# ""host-deny 0.0.0.0 0.0.0.0"" to not find any other hosts."
$ write cf_file "#"
$ write cf_file "# Format:"
$ write cf_file "#"
$ write cf_file "# host-permit <address> <mask>"
$ write cf_file "# host-deny <address> <mask>"
$ write cf_file ""
$ write cf_file "# options -h"
$ write cf_file ""
$ write cf_file "# host-permit <address> <mask>"
$ write cf_file ""
$ write cf_file "host-deny 0.0.0.0 0.0.0.0"
$ write cf_file ""
$ write cf_file "# ----------------------------------------------------------------------------"
$ write cf_file "# If you want to be really aggresive about finding hosts, you can use the -p"
$ write cf_file "# option to force a ""ping"" (ICMP echo) of all of the possible hosts on a"
$ write cf_file "# subnet. This should cause almost all hosts to be found, although"
$ write cf_file "# DECmcc IP Autoconfiguration will take somewhat longer to complete."
$ write cf_file ""
$ write cf_file "# options -p"
$ write cf_file ""
$ write cf_file "# ----------------------------------------------------------------------------"
$ write cf_file "# By default, hosts that are discovered are placed in subdomains associated"
$ write cf_file "# with the network they are connected to if there are 3 or more hosts on a"
$ write cf_file "# network. Up to 40 hosts will be placed in each such domain. These"
$ write cf_file "# parameters can be modified with the host-domainsize command."
$ write cf_file "#"
$ write cf_file "# Format:"
$ write cf_file "#"
$ write cf_file "# host-domainsize <min> <max>"
$ write cf_file ""
$ write cf_file "# ----------------------------------------------------------------------------"
$ write cf_file "# The following 'community' commands define the SNMP ""community name"""
$ write cf_file "# that is used to grant permission to make queries of an SNMP agent."
$ write cf_file "# It is rather like a password. ""public"" is a common default that allows"
$ write cf_file "# read-only access. If routers in your network use different community"
$ write cf_file "# names, you must add them here. This command is similar to the 'permit'"
$ write cf_file "# command above; the community string (first argument) is used if the"
$ write cf_file "# address (second argument) and mask (third argument) match the host's"
$ write cf_file "# address."
$ write cf_file "#"
$ write cf_file "# If more than one address/mask pair in the list matches, each matching"
$ write cf_file "# community name will be tried, from the beginning of the list. You should"
$ write cf_file "# use the following order to minimize the amount of time spent waiting for"
$ write cf_file "# requests with ""bad"" community names to time out:"
$ write cf_file "#"
$ write cf_file "# community names with specific (255.255.255.255) masks"
$ write cf_file "# (e.g. for one router)"
$ write cf_file "#"
$ write cf_file "# common community names with general masks (0.0.0.0)"
$ write cf_file "# (e.g. for ""public"")"
$ write cf_file "#"
$ write cf_file "# uncommon community names with general masks (0.0.0.0)"
$ write cf_file "#"
$ write cf_file "# If no community commands are given then the community name ""public"" will"
$ write cf_file "# be used."
$ write cf_file "#"
$ write cf_file "# Format:"
$ write cf_file "#"
$ write cf_file "# community <name> <address> <mask>"
$ write cf_file ""
$ write cf_file "community public 0.0.0.0 0.0.0.0"
$ write cf_file ""
$ write cf_file "# ----------------------------------------------------------------------------"
$ write cf_file "# If you have point-to-point links that are not appearing properly in the"
$ write cf_file "# map, you can manually configure point-to-point links here. The ""pplink"""
$ write cf_file "# command takes as its arguments the IP addresses (not hostnames) of the"
$ write cf_file "# endpoints of a point-to-point link. It does not hurt to configure these,"
$ write cf_file "# as the information will be ignored if enough information is available from"
$ write cf_file "# SNMP."
$ write cf_file "#"
$ write cf_file "# The exceptions list generated by DECmcc IP Autoconfiguration shows which"
$ write cf_file "# endpoints of point-to-point links could not be resolved. Use it as a"
$ write cf_file "# guide to see which links need to be manually configured."
$ write cf_file "#"
$ write cf_file "# Format:"
$ write cf_file "#"
$ write cf_file "# pplink <address1> <address2>"
$ write cf_file ""
$ write cf_file "# ----------------------------------------------------------------------------"
$ write cf_file "# You can specify additional command-line options here."
$ write cf_file "#"
$ write cf_file "# Useful ones are:"
$ write cf_file "#"
$ write cf_file "# -S num Node spacing; the default is 6.0 nodes across"
$ write cf_file "# the main map"
$ write cf_file "#"
$ write cf_file "# -r count seconds"
$ write cf_file "#"
$ write cf_file "# Specify the number of retransmission attempts and the"
$ write cf_file "# retransmission timeout. If these numbrs are too low,"
$ write cf_file "# some nodes may be missed. If they are too high,"
$ write cf_file "# DECmcc IP Autoconfiguration will take a long time to"
$ write cf_file "# finish. The defaults are 2 retries, with 10 second"
$ write cf_file "# timeouts. It is reasonable to increase the"
$ write cf_file "# timeout to 60 seconds. (e.g. -r 2 60)"
$ write cf_file "#"
$ write cf_file "# Format:"
$ write cf_file "#"
$ write cf_file "# options <option>..."
$ write cf_file ""
$ write cf_file "options -r 2 10"
$!----------------------------------------------------------------------------
$ close cf_file
$!----------------------------------------------------------------------------
$ return
|