Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#!/bin/rc
2
 
3
# on hook and initialize
4
fn initfn {
5
	dial/drain
6
	dial/at -q -t 5 zh0
7
}
8
 
9
# dial telephone number
10
fn dialfn {
11
	dial/drain
12
	dial/at -q -t 60 dt^$1
13
}
14
 
15
# process options
16
for(i in $*){
17
	switch($i){
18
	case '-P'
19
		primary=-P
20
	}
21
}
22
 
23
# the following can be inherited
24
switch($dev){
25
case ''
26
	dev=/dev/eia1
27
}
28
switch($telno){
29
case ''
30
	telno=18009878722
31
}
32
switch($baud){
33
case ''
34
	baud=115200
35
}
36
 
37
{
38
	# set up uart
39
	if( test -e $dev^ctl ){
40
		echo -n b^$baud	# baud rate
41
		echo -n m1	# cts/rts flow control
42
		echo -n q64000	# big buffer
43
		echo -n n1	# nonblocking writes
44
		echo -n r1	# rts on
45
		echo -n d1	# dtr on
46
		echo -n c1	# handup wen we lose dcd
47
	} > $dev^ctl
48
 
49
	# get the modem's attention
50
	while( ! initfn )
51
		sleep 1
52
 
53
	# dial
54
	while( ! dialfn $telno )
55
		sleep 30
56
 
57
	if( ! dial/expect -it 60 'username:' ){
58
		echo lra: can''t connect >[1=2]
59
		exit connect
60
	}
61
	dial/pass
62
	if( ! dial/expect -it 60 'password:' ){
63
		echo lra: can''t connect >[1=2]
64
		exit connect
65
	}
66
	dial/pass
67
	if( ! dial/expect -t 60 'telnet:' ){
68
		echo lra: can''t connect >[1=2]
69
		exit connect
70
	}
71
	echo ppp
72
	echo connected to lra >[1=2]
73
 
74
	# start ppp
75
	ip/ppp $primary -f
76
} < $dev > $dev
77
 
78
# supply unknowns with inside addresses
79
if( ! grep -s 'auth=' /net/ndb){
80
	echo '	auth=135.104.9.7'>>/net/ndb
81
	echo '	authdom=cs.bell-labs.com'>>/net/ndb
82
}
83
if( ! grep -s 'ntp=' /net/ndb)
84
	echo '	ntp=135.104.9.2'>>/net/ndb
85
if( ! grep -s 'dns=' /net/ndb){
86
	echo '	dns=135.104.8.38'>>/net/ndb
87
	echo '	dns=135.104.70.11'>>/net/ndb
88
}
89
 
90
# start dns if it isn't already going
91
if(! test -e /srv/dns )
92
	ndb/dns -r