The Warp Pharmacy:Software:FAQ: Command line SLIP for Warp IAK

Return to The Warp Pharmacy:Software

For OS/2 Warp with IAK
v1.2 Barry Logan Last Update: 9-24-95

Comments, errors, complaints, or suggestions invited. Mailto: [blogan@crash.cts.com]

Disclaim: everything.

0. Introduction
OS/2 WARP with the IAK (Internet Access Kit) installed contains Program Manager programs which allow the user to connect to either, the IBM Advantis network, or to an alternate provider. IBM did not include all the necessary files nor the instructions for starting SLIP from the command line. This file is an attempt to describe the elements required to start SLIP from the command line.

1. What is command-line SLIP and why would I want it?
Command line SLIP allows one to by-pass the Program Manager programs SLIPPM.EXE or DIALER.EXE and to start a SLIP connection directly from: the command line, an icon, or within a command or REXX script. SLIP.EXE when called directly, starts a REXX script to make the connection. Arguments to slip.exe can be placed on the command line, or put into a configuration file (e.g., slip.cfg). This ability could be useful for automatically starting a process on the host once connected (e.g., the unattended posting mail or news) SLIP connections can be delayed from within a script file using REXX's SysSleep function or by the use of a cron type program.

2. What files do I need?

 * \tcpip\etc\resolv       <-- domain name and nameserver IP
 * \tcpip\etc\slip.cfg     <-- config file to pass parameters to slip.exe
 * \tcpip\bin\runslip.cmd  <-- modified annex.cmd [Appendix B - slip.exe command line options]

3. What is resolv?
The resolv file contains the domain name of the host account and the IP of its nameserver. Up to three nameserver IPs can be included. Resolv should be in \tcpip\etc. It looks like this: domain myhost.com nameserver nnn.nnn.nn.nn

4. What is slip.cfg?
Slip.cfg is a file which specifies the comm parameters and REXX exec that slip.exe uses to make the SLIP connection. The command file (in this example slipup.cmd) should be in the tcpip\etc directory. [See [Appendix A. slip.cfg] for details. Slip.cfg looks like this: interface sl0 {      device=COM2 mtu=1006 compression=on attachcmd = slipup.cmd }

4.1 Can the slip.cfg file be bypassed by passing parameters to slip.exe directly?
Yes. Slip.exe can be called with arguments directly from the command line, eliminating the need to use slip.cfg. [see Appendix B] Here is an example: slip -nocfg -com2 -speed 57600 -vj -connect "runslip.cmd"

5. How can my userid and password be passed from the command line?
Here are three options for passing the userid and password:
 * 1) hard code userid and password into the REXX command file
 * 2) include userid and password as parms to be passed in slip.cfg:      attachparms = userid password [see Appendix A]
 * 3) call slip directly with:         slip -connect "annex.cmd atdt999-9999 loginid password"

See \tcpip\samples\annex.cmd for the code to implement reading the password from the keyboard when password is passed as "*".

6. What is SlipWait.exe?
Slipwait.exe is a program in the \tcpip\bin directory that will wait for a SLIP connection for a specified timeout period.

7. What I really want is to have SLIP start and automatically check mail.
What I really want is something like this: This is where command-line SLIP and slipwait.exe come in handy. The following REXX exec starts slipwait with a timeout value (number of seconds) to wait for a slip connection. Slipwait drops out when the connection is made or it times out. A check is made to see if slipwait timed out. If it did, exit the file, else execute your programs. /* slipwait */
 * 1) start /c ConnectToInternet.cmd
 * 2) call WaitUntilConnected
 * 3) start SomeClientProgram(s)
 * 4) call KillSLIPandShutEverythingDown

start /c ConnectToInternet.cmd 'slipwait 360'     /* seconds until timeout */ if rc = 1 then exit /* exit program when slipwait times out */ else do      'program1'         /* start programs when SLIP established */ 'program2' end exit

8. How do I tell if There is a SLIP connection to the host?
Try pinging the host: ping nnn.nnn.nn.nn

9. Ping worked but I can't FTP or telnet etc.
If you can ping a host, but can't run other programs and compression=on in the \tcpip\etc\slip.cfg file, you may have a mismatch with your provider.

Try setting compression=off.

10. How do I make it stop? (i.e., disconnect)
Use a process killer such as go.exe or killem.exe available for ftp at:
 * ftp://hobbes.nmsu.edu/os2/textuil/go_15.zip
 * ftp://hobbes.nmsu.edu/os2/textuil/kill21.zip
 * ftp://hobbes.nmsu.edu/os2/network/tcpip/sliphang.zip

Here is a REXX program to kill SLIP: /* KillSLIP.cmd */

'c:\tcpip\bin\go kill slip' exit

Appendix A. slip.cfg
interface sl0 { }
 * 1) 		 OS/2 2.0 SLIP Driver for IBM TCP/IP v1.2.1
 * 2) 				 Version 1.0
 * 3) 			 David Bolen - db3l@ans.net
 * 4) 				  SLIP.CFG
 * 5) 			  SLIP Configuration File
 * 6) 			     Copyright (c) 1993
 * 7) 	     David Bolen and Advanced Network & Services, Inc.
 * 8) 			    All Rights Reserved
 * 9) This file controls the interfaces that the SLIP driver creates and manages.
 * 10) It is used to set up interface values (such as MTU, RTT estimates, and
 * 11) device information), as well as specifying other per-interface data, such
 * 12) as what scripts should be run to make a SLIP attachment over an interface.
 * 13) The general format of the file is a series of interface "clauses", of the
 * 14) form:
 * 15) 		interface ??? {		# Comments
 * 16) 		    parameter = value  [,] [ parameter = value [,] ... ]
 * }
 * 1) Spaces, commas and newlines are ignored (except within quoted strings).
 * 2) In general, the layout of the file is free-form, within the general bounds
 * 3) of the interface blocks.
 * 4) Comments may begin at any point on the line, and are signified by a hash
 * 5) (#) character - everything past the comment character is ignored.
 * 6) Parameter names and values are delimited by whitespace.  Special characters
 * 7) (whitespace, ',', '{', '}', '#', '=') may be included in a value by
 * 8) surrounding that value in double quotes ("), or by prefixing the special
 * 9) character with a backslash (\).  Use \\ to get a backslash itself, and use
 * 10) \" within a quoted string to get a double quote within the value.
 * 11) In the above, ??? specifies an interface to be defined.  Currently only
 * 12) two values are allowed:
 * 13) 	default		Default settings. Specifies parameters that will
 * 14) 			be assumed for any interfaces later in the file
 * 15) 			where their interface clauses do not contain new
 * 16) 			values for the parameters.
 * 17) 	sl0		Serial Interface 0.
 * 18) The "interface default" clause may be specified multiple times, and is
 * 19) additive.  Where a parameter appears in more than one such clause, its
 * 20) most recent value will be used for any later interface clauses.
 * 21) The following parameters and values are allowed for each interface:
 * 22)   Basic Parameters
 * 23) 	device		Interface serial device (ie: "com1")
 * 24) 	mtu		Maximum transmission unit (bytes)
 * 25) 	compression	Adjusts VJ compression. Can be "ON" (always compress),
 * 26) 			 "OFF" (never), or "AUTO" (accept compression and
 * 27) 			 start compressing if compressed packets are received)
 * 28) 	attachcmd	Name of rexx command script to run to attach interface
 * 29) 	attachparms	 Parameters to pass to command script
 * 30)   Queuing Parameters
 * 31) 	fastqueue	Enables priority queueing for interactive traffic.
 * 32) 	nofastqueue	 Disables priority queueing
 * 33) 	queuesize	Normal and priority queue sizes (IP kernel<->SLIP) in
 * 34) 	fastqueuesize    packets.  These should be multiples of 4.
 * 35)   Protocol Parameters
 * 36) 	rtt		Initial TCP RTT estimates. Like BSD-Reno's per-route
 * 37) 	rttvar		 defaults, but per-interface.  The values assigned
 * 38) 	rttmin		 to these parameters are in milliseconds
 * 39) 	sendpipe	Size of TCP send and receive windows (bytes)
 * 40) 	recvpipe
 * 41) 	ssthresh	"Slow start" congestion window threshold (bytes)
 * 42) When this file is initially processed, the system default interface clause
 * 43) is as follows:
 * 44) 	interface default {
 * 45) 	  mtu=1006, compression=off,
 * 46) 	  fastqueue, queuesize=12, fastqueuesize=24,
 * 47) 	  recvpipe=4096
 * }
 * 1) And the default device for the "sl0" interface is "com1"
 * 2) If an interface definition enables compression (compression=on), and does
 * 3) not otherwise specify an MTU, the default MTU will be lowered to 296.
 * 4) Note that this does not happen with compression=auto.
 * 5) It is not recommended that anything other than "Basic Parameter" values
 * 6) be adjusted unless truly necessary.  In particular, adjusting queue sizes
 * 7) and rtt* values without a complete understanding of the affect such
 * 8) adjustments will have on protocol (such as TCP) behavior can seriously
 * 9) affect both interactive response and throughput.
 * 10) $Id: slip.cfg,v 1.4 1993/07/05 22:49:40 db3l Exp $
 * 11) Set up a simple default sl0
 * 1)   Protocol Parameters
 * 2) 	rtt		Initial TCP RTT estimates. Like BSD-Reno's per-route
 * 3) 	rttvar		 defaults, but per-interface.  The values assigned
 * 4) 	rttmin		 to these parameters are in milliseconds
 * 5) 	sendpipe	Size of TCP send and receive windows (bytes)
 * 6) 	recvpipe
 * 7) 	ssthresh	"Slow start" congestion window threshold (bytes)
 * 8) When this file is initially processed, the system default interface clause
 * 9) is as follows:
 * 10) 	interface default {
 * 11) 	  mtu=1006, compression=off,
 * 12) 	  fastqueue, queuesize=12, fastqueuesize=24,
 * 13) 	  recvpipe=4096
 * }
 * 1) And the default device for the "sl0" interface is "com1"
 * 2) If an interface definition enables compression (compression=on), and does
 * 3) not otherwise specify an MTU, the default MTU will be lowered to 296.
 * 4) Note that this does not happen with compression=auto.
 * 5) It is not recommended that anything other than "Basic Parameter" values
 * 6) be adjusted unless truly necessary.  In particular, adjusting queue sizes
 * 7) and rtt* values without a complete understanding of the affect such
 * 8) adjustments will have on protocol (such as TCP) behavior can seriously
 * 9) affect both interactive response and throughput.
 * 10) $Id: slip.cfg,v 1.4 1993/07/05 22:49:40 db3l Exp $
 * 11) Set up a simple default sl0
 * 1) It is not recommended that anything other than "Basic Parameter" values
 * 2) be adjusted unless truly necessary.  In particular, adjusting queue sizes
 * 3) and rtt* values without a complete understanding of the affect such
 * 4) adjustments will have on protocol (such as TCP) behavior can seriously
 * 5) affect both interactive response and throughput.
 * 6) $Id: slip.cfg,v 1.4 1993/07/05 22:49:40 db3l Exp $
 * 7) Set up a simple default sl0
 * 1) $Id: slip.cfg,v 1.4 1993/07/05 22:49:40 db3l Exp $
 * 2) Set up a simple default sl0
 * 1) Set up a simple default sl0
 * 1) Set up a simple default sl0
 * 1) Set up a simple default sl0
 * 1) Set up a simple default sl0

Appendix B - Slip.exe command line options
Type slip -? at the command for the following informaition.

[SLIP] - SL/IP (Serial Line/Internet Protocol) driver

Usage: SLIP [options], where options are: -?                         Usage help. -com                    Use com port  for interface sl0. -connect "command"         Invoke command to setup modem connection. -d                         Increase debug level. -exit             Exit SL/IP  minutes after line disconnect. -f            Use  instead of default: slip.cfg. -hangup           Send  to sl0 com port on exit. -idle             Exit SL/IP after  minutes of idle time. -ifconfig  Configure sl0 with the specified IP addresses, +defaultroute    optionally add a default route through , +proxyarp        make a proxy ARP entry for  using. -modem            Send modem  to interface sl0 com port. -mtu                 Set interface sl0 MTU to. -nocfg                     Ignore configuration file. -notify                    Notify on termination of Data Carrier Detect. -p                      Run SL/IP at priority, where  =1-4. If                            is ommitted run in time critical server mode, =3. -rtscts                    Use RTS/CTS hardware flow control. -speed               Set sl0 com port speed to. -t[i|o]                    Trace input and output packets. -vj                        Use VJ header compression for interface sl0.

Appendix C - A modified annex.cmd that is redial and multiple phone number capable
/* SLIP REXX: */ /* Author: Kai Uwe Rommel * Created: Sun Mar 12 1995 * * modified apr 7 1995 * by Barry Logan blogan@cts.com * This script is called by slip.exe * Login and password should be hardcoded or add readpass module from * annex.cmd and pass them as parms with -attchparms switch in slip.cfg * * SysSleep RexxUtil function is called - be sure to have it loaded * * change number.o = (number of tel numbers in dial queue )

parse arg interface, dialcmd login password

call RxFuncAdd 'SysSleep', 'RexxUtil', 'SysSleep'

/* comment out login, password and dialcmd if passing them from the * command line or through slip.cfg login =    "merlin"                 /* Insert your account name */ password = "********"               /* Insert your password */ dialcmd = "ATDT"                    /* Modem dial string */ number.0 = 3                        /* tel numbers in dial queue */ number.1 = '595-0001'               /* central */ number.2 = '395-0002'               /* east county */ number.3 = '295-0666'               /* south bay */ redial = 0                          /* retry counter */ zzz   = 3                           /* seconds to sleep between redials */

myip =   "198.68.170.46"            /* my ip address */ hostip = "198.147.219.17"           /* gateway - provider host address */ netmask = "255.255.255.240"         /* provider netmask */

cr = '0D'X crlf = '0D0A'X

say '' say 'SLIP ..... Standby' '(interface' interface')' say '' call send 'atz' || cr call waitfor('OK') call flush_receive /* clean it out */

do forever do num = 1 to number.0  /* cycle through the dialing queue */ call charout, 'Dialing 'number.num' ('redial' redials)'crlf call send dialcmd || number.num || cr       if waitfor('CONNECT', 60, 1) = 0 then leave loop call send 'ATH' || cr      /* hangup if not connect */ redial = redial + 1 call SysSleep zzz end end

if waitfor('ogin:', 60) \= 0 then exit 1 call flush_receive 'echo' call send login || cr if waitfor('assword:', 60) \= 0 then exit 1 call flush_receive 'echo' call send password || cr

if waitfor('Packet mode enabled', 60) \= 0 then exit 1 call flush_receive 'echo'

'ifconfig sl0 'myip' 'hostip' netmask 255.255.255.0' 'route -f add default 'hostip' 1'

say "We're in! - Connection Established" call beep 1000,150            /* announce login done */

exit 0

send:

parse arg sendstring call slip_com_output interface, sendstring return

waitfor:

parse arg waitstring, timeout, fail, noecho if timeout = '' then timeout = 5000 /* LONG delay if not specified */ if fail = '' then fail = 0 if noecho = '' then noecho = 0 if remain_buffer = 'REMAIN_BUFFER' then remain_buffer = ''

waitfor_buffer = '' done = -1 curpos = 1 start_time = time('E') do while done = -1 if (remain_buffer \= '') then do

line = remain_buffer remain_buffer = '' end

else do        line = slip_com_input(interface,, 10) end

waitfor_buffer = waitfor_buffer || line index = pos(waitstring, waitfor_buffer) if index > 0 then do        remain_buffer = substr(waitfor_buffer, index + length(waitstring)) waitfor_buffer = delstr(waitfor_buffer, index + length(waitstring)) done = 0 end

if fail > 0 then do        if pos('BUSY', waitfor_buffer) > 0 then done = 2 if pos('ERROR', waitfor_buffer) > 0 then done = 2 if pos('NO CARRIER', waitfor_buffer) > 0 then done = 2 if pos('NO DIALTONE', waitfor_buffer) > 0 then done = 2 end

if noecho = 0 then call charout, substr(waitfor_buffer, curpos) curpos = length(waitfor_buffer) + 1 if done \= 0 & time('E') > timeout then do       call lineout, 'Timed out.' done = 1 end

if done = -1 then call SysSleep 1 end

timeout = 0

return done

flush_receive:

parse arg echo

if echo \= '' & length(remain_buffer) > 0 then do     call charout, remain_buffer remain_buffer = '' end

do until line = '' line = slip_com_input(interface,, 100) if echo \= '' then call charout, line end

return

/* end */

Appendix D - Feedback about bootp.
From: Charles Hedrick

2) You might want to tell people about bootp. Your script assumes that your host has a fixed address.  For a lot of people, the service they connect to assigns a new address each time.  Rather than complex things to parse the printout, it's easier just to call "bootp sl0", which gets the address using bootp, and then does the ifconfig and route commands.

/* REXX */ call RxFuncAdd 'SysSleep', 'RexxUtil', 'SysSleep' start "/min slip -notify -p3 -rtscts -speed 57600 -vj" call SysSleep 5 bootp sl0

by Barry Logan, blogan@crash.cts.com

Return to The Warp Pharmacy:Software