1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #!/bin/rc
- # on hook and initialize
- fn initfn {
- dial/drain
- dial/at -q -t 5 zh0
- }
- # dial telephone number
- fn dialfn {
- dial/drain
- dial/at -q -t 60 dt^$1
- }
- # process options
- for(i in $*){
- switch($i){
- case '-P'
- primary=-P
- }
- }
- # the following can be inherited
- switch($dev){
- case ''
- dev=/dev/eia1
- }
- switch($telno){
- case ''
- telno=18009878722
- }
- switch($baud){
- case ''
- baud=115200
- }
- {
- # set up uart
- if( test -e $dev^ctl ){
- echo -n b^$baud # baud rate
- echo -n m1 # cts/rts flow control
- echo -n q64000 # big buffer
- echo -n n1 # nonblocking writes
- echo -n r1 # rts on
- echo -n d1 # dtr on
- echo -n c1 # handup wen we lose dcd
- } > $dev^ctl
- # get the modem's attention
- while( ! initfn )
- sleep 1
- # dial
- while( ! dialfn $telno )
- sleep 30
-
- if( ! dial/expect -it 60 'username:' ){
- echo lra: can''t connect >[1=2]
- exit connect
- }
- dial/pass
- if( ! dial/expect -it 60 'password:' ){
- echo lra: can''t connect >[1=2]
- exit connect
- }
- dial/pass
- if( ! dial/expect -t 60 'telnet:' ){
- echo lra: can''t connect >[1=2]
- exit connect
- }
- echo ppp
- echo connected to lra >[1=2]
- # start ppp
- ip/ppp $primary -f
- } < $dev > $dev
- # supply unknowns with inside addresses
- if( ! grep -s 'auth=' /net/ndb){
- echo ' auth=135.104.9.7'>>/net/ndb
- echo ' authdom=cs.bell-labs.com'>>/net/ndb
- }
- if( ! grep -s 'ntp=' /net/ndb)
- echo ' ntp=135.104.9.2'>>/net/ndb
- if( ! grep -s 'dns=' /net/ndb){
- echo ' dns=135.104.8.38'>>/net/ndb
- echo ' dns=135.104.70.11'>>/net/ndb
- }
- # start dns if it isn't already going
- if(! test -e /srv/dns )
- ndb/dns -r
|