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