www.delorie.com/gnu/docs/inetutils/inetutils_14.html   search  
Buy GNU books!

GNU networking utilities

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 Configuration file

Upon execution, inetd reads its configuration information from a configuration pathnames on the command line, by default, `/etc/inetd.conf' and `/etc/initd.d'. If the configuration pathname is a directory, all the files in the directory are read like a configuration file. All of the configuration files are read and merged. There must be an entry for each field in the configuration file, with entries for each field separated by a tab or a space. Comments are denoted by a "#" at the beginning of a line. There must be an entry for each field. The fields of the configuration file are as follows:

           service name
           socket type
           server program
           server program arguments

There are two types of services that inetd can start: standard and TCPMUX. A standard service has a well-known port assigned to it; it may be a service that implements an official Internet standard or is a BSD-specific service. As described in RFC 1078, TCPMUX services are nonstandard services that do not have a well-known port assigned to them. They are invoked from inetd when a program connects to the "tcpmux" well-known port and specifies the service name. This feature is useful for adding locally-developed servers.

The service-name entry is the name of a valid service in the file `/etc/services'. For "internal" services (discussed below), the service name must be the official name of the service (that is, the first entry in `/etc/services'). For TCPMUX services, the value of the service-name field consists of the string "tcpmux" followed by a slash and the locally-chosen service name. The service names listed in /etc/services and the name "help" are reserved. Try to choose unique names for your TCPMUX services by prefixing them with your organization's name and suffixing them with a version number.

The socket-type should be one of "stream", "dgram", "raw", "rdm", or "seqpacket", depending on whether the socket is a stream, datagram, raw, reliably delivered message, or sequenced packet socket. TCPMUX services must use "stream".

The protocol must be a valid protocol as given in /etc/protocols. Examples might be "tcp" or "udp". TCPMUX services must use "tcp".

The wait/nowait entry specifies whether the server that is invoked by inetd will take over the socket associated with the service access point, and thus whether inetd should wait for the server to exit before listening for new service requests. Datagram servers must use "wait", as they are always invoked with the original datagram socket bound to the specified service address. These servers must read at least one datagram from the socket before exiting. If a datagram server connects to its peer, freeing the socket so inetd can received further messages on the socket, it is said to be a "multi-threaded" server; it should read one datagram from the socket and create a new socket connected to the peer. It should fork, and the parent should then exit to allow inetd to check for new service requests to spawn new servers. Datagram servers which process all incoming datagrams on a socket and eventually time out are said to be "single-threaded". Comsat(8), (biff(1)) and talkd(8) are both examples of the latter type of datagram server. Tftpd(8) is an example of a multi-threaded datagram server.

Servers using stream sockets generally are multi-threaded and use the "nowait" entry. Connection requests for these services are accepted by inetd, and the server is given only the newly-accepted socket connected to a client of the service. Most stream-based services operate in this manner. Stream-based servers that use "wait" are started with the listening service socket, and must accept at least one connection request before exiting. Such a server would normally accept and process incoming connection requests until a timeout. TCPMUX services must use "nowait".

The user entry should contain the user name of the user as whom the server should run. This allows for servers to be given less permission than root.

The server-program entry should contain the pathname of the program which is to be executed by inetd when a request is found on its socket. If inetd provides this service internally, this entry should be "internal".

The server program arguments should be just as arguments normally are, starting with argv[0], which is the name of the program. If the service is provided internally, the word "internal" should take the place of this entry.

The inetd program provides several "trivial" services internally by use of routines within itself. These services are "echo", "discard", "chargen" (character generator), "daytime" (human readable time), and "time" (machine readable time, in the form of the number of seconds since midnight, January 1, 1900). All of these services are tcp based. For details of these services, consult the appropriate RFC from the Network Information Center.

The inetd program rereads its configuration file when it receives a hangup signal, SIGHUP. Services may be added, deleted or modified when the configuration file is reread.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003