DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

slink(ADMN)


slink -- STREAMS linker

Syntax

/etc/slink [ -c file ] [ -f ] [ -G ] [ -n file ] [ -u ] [ -v ] [ function [ arg ... ]]

Description

slink is a STREAMS configuration utility which is used to define the various modules and drivers required for STREAMS TCP/IP.

When the kernel is relinked, the /etc/kslgen script calls slink to parse the configuration files in the directory /etc/strcf.d (see strcf(SFF)). These files define the TCP/IP network interfaces known to the kernel. (The output is written to /etc/conf/pack.d/ksl/space.c.) The kernel must be relinked and rebooted for a new STREAMS configuration to take effect.

The following options may be specified on the slink command line:


-c file
Use file instead of /etc/strcf.

-f
Do not fork. slink must remain in the foreground, holding open its file descriptors. This assumes that persistent links are not being used. In this case, slink will only be able to build streams that are defined to use regular links (I_LINK; see streamio(M)).

-G
Generate C source code to be used by the ksl (kernel STREAMS linker) driver.

-n file
Write information about device nodes and external variables to file.

-u
Unlink persistent links (shut down the protocol stack). This option can only be run by the user root, and not by others with root authority.

-v
Verbose mode (each operation is logged to stderr).
If a function is specified as an argument, it will be used instead of the boot function.

The configuration file contains a list of functions, each of which is composed of a list of commands. Each command is a call to one of the functions defined in the configuration file or to one of a set of built-in functions. Among the built-in functions are the basic STREAMS operations open, link, plink, and push, along with several TCP/IP-specific functions.

A function definition has the following form:

   function-name {
   	command1
   	command2
   	...
   }
The syntax for commands is:
   function arg1 arg2 arg3 ...
or
   var = function arg1 arg2 arg3 ...
The placement of newlines is important: a newline must follow the left and right braces and every command. Extra newlines are allowed; that is, where one newline is required, more than one may be used. A backslash (\) followed immediately by a newline is considered equivalent to a space; that is, it may be used to continue a command on a new line. The use of other white space characters (spaces and tabs) is at the discretion of the user, except that there must be white space separating the function name and the arguments of a command.

Comments are delimited by ``#'' and newline, and are considered equivalent to a newline.

Function and variable names may be any string of characters taken from A-Z, a-z, 0-9, and ``_'', except that the first character cannot be a digit. Function names and variable names occupy separate name spaces. All functions are global and may be forward referenced. All variables are local to the functions in which they occur.

Variables are defined when they appear to the left of an equals (=) on a command line. For example:

   tcp = open /dev/inet/tcp
The variable acquires the value returned by the command. In the above example, the value of the variable tcp will be the file descriptor returned by the open call.

Arguments to a command may be either variables, parameters, or strings.

A variable that appears as an argument must have been assigned a value on a previous command line in that function.

Parameters take the form of a dollar sign ($) followed by one or two decimal digits, and are replaced with the corresponding argument from the function call. If a given parameter was not specified in the function call, an error results (for example, if a command references $3 and only two arguments were passed to the function, an execution error will occur).

Strings are sequences of characters optionally enclosed in double quotes ("). Quotes may be used to prevent a string from being interpreted as a variable name or a parameter, and to allow the inclusion of spaces, tabs, and the special characters {, }, =, and #. The backslash (\) may also be used to quote the characters {, }, =, ", #, and \ individually.

The following built-in functions are provided by slink:


addmcaddr MAC_address
Send a message to the network driver to implement a multicast Media Access Control (MAC) address (MAC_address). The 48-bit address must be formatted as six hexadecimal numbers separated by colons, for example: 01:00:5e:7f:7f:7f.

call function
Call a function in the kernel. No arguments may be supplied and no return value is expected. For example, ip_set_if_address is called in /etc/strcf to set the IP addresses for the network and local loopback interfaces at boot time.

close fd
Close file descriptor fd.

dlattach fd unit
Send a DL_ATTACH_REQ message down the stream referenced by fd specifying unit unit.

dlbind fd sap
Send a DL_BIND_REQ message down the stream referenced by fd specifying the Service Access Point sap. The media-level address of the device at the bottom of the stream is returned if the operation succeeds. It can be used later as the argument to the sifaddr command.

dlsubsbind fd ssap
Send a DL_SUBS_BIND_REQ message down the stream referenced by fd specifying the Secondary Service Access Point ssap.

exit
Cause a kernel panic due to the failure of a built-in command in the streams-linking process.

initqp path qname lowat hiwat ...
Send an INITQPARMS (initialize queue parameters) ioctl to the driver corresponding to pathname path. qname specifies the queue for which the low and high water marks will be set, and must be one of:


hd
stream head

rq
read queue

wq
write queue

muxrq
multiplexor read queue

muxwq
multiplexor write queue

lowat and hiwat specify the new low and high water marks for the queue. Both lowat and hiwat must be present. To change only one of these parameters, the other may be replaced with a dash ``-''. Up to five qname lowat hiwat triplets may be present.


label label_name
Define a label named label_name.

link fd1 fd2
Link the stream referenced by fd2 beneath the stream referenced by fd1. Returns the link identifier associated with the link. Note that fd2 cannot be used after this operation.

noexit
Allow operations to continue rather than causing a kernel panic due to the failure of a built-in command in the streams-linking process. The currently executing function is terminated and execution resumes at the next statement.

onerror label_name
On error, jump to the label named label_name.

open path
Open the device specified by pathname path. Returns a file descriptor referencing the open stream.

plink fd1 fd2
Link the stream referenced by fd2 beneath the stream referenced by fd1 using a persistent link. Returns the link identifier associated with the link. Note that fd2 cannot be used after this operation.

push fd module
Push module onto the stream referenced by fd.

return val
Set the return value for the current function to val. Note that executing a return command does not terminate execution of the current function.

sifaddr fd name addr
Sends a SIOCSIFNAME ioctl down the stream referenced by fd. The arguments are an interface name and the media-level address associated with the specified name. This is used by the ARP driver to reply to ARP queries.

sifhrd fd type
Send a SIOCSHRDTYPE (set interface hardware type) ioctl down the stream referenced by fd. The hardware type is used by the ARP driver when sending messages. Legal values for type are ``ether'' and ``ieee''.

sifname fd link name flags
Send a SIOCSIFNAME (set interface name) ioctl down the stream referenced by fd for the link associated with link identifier link specifying the name name. flags are specified in hexadecimal by OR'ing the bit values defined in /usr/include/sys/net/if.h:


0x1
interface is up (IFF_UP)

0x2
broadcast address is valid (IFF_BROADCAST)

0x4
turn on debugging (IFF_DEBUG)

0x8
loopback through the network (IFF_LOOPBACK)

0x10
interface is a point-to-point link (IFF_POINTOPOINT)

0x20
interface wants to hear IP ioctl requests (IFF_WANTIOCTLS)

0x40
resources allocated (IFF_RUNNING)

0x80
no address resolution protocol (IFF_NOARP)

0x100
link-specific flag (IFF_LINK0)

0x200
receive all multicast packets (IFF_ALLMULTI; not implemented, reserved for future use)

0x400
link-specific flag (IFF_LINK1)

0x800
select one-packet mode (IFF_ONEPACKET)

0x1000
link-specific flag (IFF_LINK2)

0x2000
interface cannot hear own transmissions (IFF_SIMPLEX)

0x4000
interface supports IP multicasting (IFF_MULTICAST)


strcat str1 str2
Concatenate strings str1 and str2 and return the resulting string.

unitsel fd unit
Send a IF_UNITSEL (unit select) ioctl down the stream referenced by fd specifying unit unit.

Warning

Invoking slink without any options builds the kernel TCP/IP streams stacks with persistent links (I_PLINK; see streamio(M)). It is not normally necessary to call slink this way because the kernel sets up the streams stacks at boot time. When TCP/IP starts (see tcp(ADMN)), it only calls slink if the ksl.disable bootstring was used to prevent the streams stacks from being built at boot time.

Files


/etc/strcf
example STREAMS configuration file

/etc/strcf.d
directory containing STREAMS configuration files

See also

Intro(ADMP), strcf(SFF), streamio(M), tcp(ADMN)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003