77 lines
1.2 KiB
Text
77 lines
1.2 KiB
Text
|
#!/bin/rc
|
||
|
|
||
|
fn initfn {
|
||
|
dial/flush
|
||
|
echo +++
|
||
|
echo -n atzh0
|
||
|
dial/expect -q -t 5 OK
|
||
|
}
|
||
|
|
||
|
fn dialfn {
|
||
|
dial/flush
|
||
|
echo -n atdt^$telno^
|
||
|
dial/expect -q -t 60 CONNECT
|
||
|
}
|
||
|
|
||
|
# process options
|
||
|
for(i in $*){
|
||
|
switch($i){
|
||
|
case '-P'
|
||
|
primary=-P
|
||
|
}
|
||
|
}
|
||
|
|
||
|
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
|
||
|
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 )
|
||
|
sleep 30
|
||
|
echo connected to the world >[1=2]
|
||
|
|
||
|
# start ppp
|
||
|
ip/ppp $primary -f
|
||
|
} < $dev > $dev
|
||
|
|
||
|
# supply unknowns with outside addresses
|
||
|
if( ! grep -s 'auth=' /net/ndb){
|
||
|
echo ' auth=204.178.31.3'>>/net/ndb
|
||
|
echo ' authdom=cs.bell-labs.com'>>/net/ndb
|
||
|
}
|
||
|
if( ! grep -s 'ntp=' /net/ndb)
|
||
|
echo ' ntp=204.178.31.2'>>/net/ndb
|
||
|
if( ! grep -s 'dns=' /net/ndb){
|
||
|
echo ' dns=204.178.31.3'>>/net/ndb
|
||
|
echo ' dns=204.178.31.4'>>/net/ndb
|
||
|
}
|
||
|
|
||
|
# start dns if it isn't already going
|
||
|
if(! test -e /srv/dns )
|
||
|
ndb/dns -r
|