Network Administration

Introduction

The operation of the SAS/C Socket Library depends on its ability to access the configuration information for a site. In some cases, the socket library locates the information automatically. In other cases, you may need to specify the location of the information.

This chapter discusses the location of site configuration files and provides a detailed explanation of how your SAS/C Socket Library finds these files.

Configuration Data Sets

Under UNIX operating systems, these six data sets usually contain site-dependent configuration information for TCP/IP: The socket library uses equivalent data sets under the MVS or CMS operating systems. MVS and CMS file systems differ from the UNIX file structure, and local security or organization considerations can affect how data sets are named. Although the name of the data set may be different, the data set that contains site configuration information is in the same format as the equivalent data set under the UNIX operating system. If data sets in the UNIX format are not available, the library sometimes attempts to determine site information from vendor-specific data sets.

Search Logic

Under the MVS and CMS operating systems, the data set that contains configuration information usually has a name that is derived from the equivalent UNIX filename. For example, the MVS data set name ETC.HOSTS is derived from the UNIX filename /etc/hosts.

The socket library uses the following search logic when searching for the data set containing configuration information:

  1. It determines the name by using an environment variable if one has been set. The name should begin with a SAS/C prefix, such as DSN: for a data set name, or HFS: for a hierarchical file system (HFS) name. If the name does not begin with a prefix, it is interpreted according to the SAS/C Library defaults, which vary from program to program. For example, the default prefix for MVS is DDN:, and for CMS it is CMS:. Use the DSN: prefix if you are supplying the name in DSName form.
  2. Under TSO, it searches for a data set name that is composed of the user's userid (TSO: prefix) and the name derived from the UNIX filename.
  3. It searches for a data set name derived solely from a UNIX filename. Under MVS, the library does not perform this step if the TCPIP_PREFIX environment variable is not TCPIP. See Specifying TCPIP_PREFIX for MVS for a discussion of TCPIP_PREFIX.
  4. Under MVS, it searches for a data set derived from a UNIX filename and prefixed by the TCPIP_PREFIX value.

Finding the Data Set

The socket library uses the following methods to look for each of the configuration data sets:

/etc/protocols

The socket library looks for the following data set names while searching for the MVS or CMS data set that is equivalent to /etc/protocols:
  1. value of ETC_PROTOCOLS environment variable, if defined
  2. tso-prefix.ETC.PROTO under TSO
  3. ETC.PROTO under MVS, or ETC PROTO under CMS
  4. tcpip-prefix.ETC.PROTO under MVS, if TCPIP_PREFIX is not blank.

/etc/services

The socket library looks for the following data set names while searching for the MVS or CMS data set that is equivalent to /etc/services:
  1. value of ETC_SERVICES environment variable, if defined
  2. tso-prefix.ETC.SERVICES under TSO
  3. ETC.SERVICES under MVS, or ETC SERVICES under CMS
  4. tcpip-prefix.ETC.SERVICES under MVS, if TCPIP_PREFIX is not blank.

/etc/hosts

The socket library looks for the following data set names while searching for the MVS or CMS data set that is equivalent to /etc/hosts:
  1. value of ETC_HOSTS environment variable, if defined
  2. tso-prefix.ETC.HOSTS under TSO
  3. ETC.HOSTS under MVS, or ETC HOSTS under CMS
  4. tcpip-prefix.ETC.HOSTS under MVS, if TCPIP_PREFIX is not blank.

/etc/networks

The socket library looks for the following data set names while searching for the MVS or CMS data set that is equivalent to /etc/networks:
  1. value of ETC_NETWORKS environment variable, if defined
  2. tso-prefix.ETC.NETWORKS under TSO
  3. ETC.NETWORKS under MVS, or ETC NETWORKS under CMS
  4. tcpip-prefix.ETC.NETWORKS under MVS, if TCPIP_PREFIX is not blank.

/etc/resolv.conf

The socket library looks for the following data set names while searching for the MVS or CMS data set that is equivalent to /etc/resolv.conf:
  1. value of ETC_RESOLV_CONF environment variable, if defined
  2. tso-prefix.ETC.RESOLV.CONF under TSO
  3. ETC.RESOLV.CONF under MVS, or ETC RESOLV under CMS
  4. tcpip-prefix.ETC.RESOLV.CONF under MVS, if TCPIP_PREFIX is not blank.

/etc/rpc

The socket library looks for the following data set names while searching for the MVS or CMS data set that is equivalent to /etc/rpc:
  1. value of ETC_RPC environment variable, if defined.
  2. tso-prefix.ETC.RPC under TSO. Under MVS but not under TSO, it looks for tcpip-prefix.ETC.RPC if a userid can be determined for the address space.
  3. ETC.RPC under MVS, or ETC RPC under CMS.
  4. tcpip-prefix.ETC.RPC under MVS, if TCPIP_PREFIX is not blank.
When the socket library finds a data set with one of the above names, the name is retained for the duration of the program's execution. You may need to restart the program for the socket library to find a different filename.

Specifying TCPIP_PREFIX for MVS

The value of the TCPIP_PREFIX environment variable used in finding configuration data sets is determined in the following way:
  1. If the value is set by the user, either interactively or through a program, before the socket library's initial attempt to use the TCPIP_PREFIX variable to locate a data set, the library uses the value set by the user.
  2. If the TCPIP_PREFIX variable is undefined when the socket library attempts to use it to locate a data set, the TCPIP_PREFIX variable is set with a 27-character string array in L$CNDBA in the transient library. However, the library may search the TCPIP.DATA file for the DATASETPREFIX keyword value before using the array. (See item 2 under gethostbyname and Resolver Configuration for search order.) The default value of this array is TCPIP. A zap that changes this default is provided with the transient library installation instructions. Some SAS/C programs received from software vendors or other sites may not use the transient library and could require their own zaps. For this reason, avoid using the zap, if possible, and instead use the ETC high-level qualifier derived from the UNIX filename or make TCPIP the default high-level qualifier.
For information on setting environment variables, see "Environment Variables" in Chapter 8, "Run-Time Argument Processing," in SAS/C Compiler and Library User's Guide.

Specifying TCPIP_MACH

For IBM TCP/IP, the socket library must locate a TCP/IP virtual machine under CMS or an address space under MVS. The name of the virtual machine or the address space may vary from site to site. The SAS/C Compiler uses the TCPIP_MACH environment variable to determine the value of this name. If the TCPIP_MACH variable does not exist, the socket library searches for the name in the TCPIP.DATA file under MVS or the TCPIP DATA file under CMS. (See item 2 under gethostbyname and Resolver Configuration for search order.) If this file is not available, the socket library uses a default value of TCPIP to locate the TCP/IP virtual machine or address space.

gethostbyname and Resolver Configuration

Under the UNIX environment, the gethostbyname and gethostbyaddr routines may use the /etc/hosts file, or they may call the resolver to contact the name server for the host name information.

The SAS/C Socket Library uses the following logic when looking up host names and addresses:

  1. looks for the /etc/resolv.conf file using the rules listed in /etc/resolv.conf . If the socket library finds the /etc/resolv.conf file, it performs the requested queries through the resolver, and it returns any answer it receives. If attempts to connect to name servers are refused (errno ECONNREFUSED), it goes to step 3.
  2. looks for a data set in the format of the IBM TCP/IP file TCPIP.DATA under MVS, or TCPIP DATA under CMS. The search rules for this data set are those used by IBM TCP/IP. The socket library
    1. looks for the environment variable TCPIP_DATA string. If found, the string is passed to fopen
    2. looks for the data set identified by the DDname SYSTCPD. If found, the filename is passed to fopen
    3. looks for tso-prefix.TCPIP.DATA under TSO
    4. looks for the SYS1.TCPPARMS(TCPDATA) data set
    5. looks for the environment variable TCPIP_PREFIX and then searches for tcpip_prefix.TCPIP.DATA
    6. uses the default value of TCPIP_PREFIX and searches for default-value.TCPIP.DATA
    7. looks for TCPIP.DATA.
  3. if attempts to connect to name servers defined in TCPIP.DATA are refused, the socket library looks for an /etc/hosts file using the rules listed in /etc/hosts . If the socket library finds an /etc/hosts file, it returns the result, including failure.
Determining the domain name in name-server queries follows the same logic as the UNIX operating system in using the domain statement of the /etc/resolv.conf file, the file specified by the HOSTALIASES environment variable and the value of the LOCALDOMAIN environment variable. Name-server addresses are also determined from the /etc/resolv.conf file.

If, because there is no /etc/resolv.conf file, an IBM TCP/IP TCPIP.DATA file is read, resolver configuration is determined by the statements, including IBM defaults, in the TCPIP.DATA file. The SAS/C Library only recognizes the first three name servers specified in this file. Both the UNIX operating system and the SAS/C environment have a limit of three name servers.

Configuring for the CMS Environment

Under the CMS environment, the easiest way to configure your system is to locate files that have names derived from UNIX filenames on a minidisk that is accessible to all TCP/IP users. If you want to use the resolver for name resolution, you should create an ETC RESOLV file. If you are running IBM TCP/IP, you can use the TCPIP DATA file instead.

Configuring for the MVS Environment

Under the MVS environment, the easiest way to configure your system is to give the configuration data sets the ETC high-level qualifier, for example, ETC.HOSTS and ETC.RESOLV.CONF. If you then do not set the TCPIP_PREFIX environment variable, and you do not apply the zap to the TCPIP_PREFIX in the transient library, your programs will always be able to find the configuration data sets. If you want to use the resolver for name resolution, you can create an ETC.RESOLV.CONF file.

An IBM TCP/IP site that prefers to use existing data sets can use the tcpip-prefix.TCPIP.DATA file to control name resolution.

An MVS site that does not use TCPIP as the high-level qualifier and that cannot use the ETC prefix will have to rely on environment variables (possibly DATASET_PREFIX in the TCPIP.DATA file) or the zap provided in the installation instructions. Environment variables work well if there is a way to set them, such as a CLIST that all TCP/IP users can run when they log on or before they run a client program. Also, using environment variables that have a permanent scope enables the user to set the variable once and then use the setting from that point onward. A site that cannot use the environment variables must rely on the zap provided in the installation instructions. Programs received from other sites may also require this zap.


Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.