summaryrefslogtreecommitdiff
path: root/rc/bin/ipconf
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 17:14:36 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 17:14:36 +0300
commit2959e1ede0ebc6fdffd7b8660f43c2ce14c9696f (patch)
treef6343b1ce11a8c87251dd27cf3d3e26b50693fa7 /rc/bin/ipconf
parente463eb40363ff4c68b1d903f4e0cdd0ac1c5977f (diff)
Import sources from 2011-03-30 iso image - rc
Diffstat (limited to 'rc/bin/ipconf')
-rwxr-xr-xrc/bin/ipconf/inside19
-rwxr-xr-xrc/bin/ipconf/lra92
-rwxr-xr-xrc/bin/ipconf/outside24
-rwxr-xr-xrc/bin/ipconf/theworld76
4 files changed, 211 insertions, 0 deletions
diff --git a/rc/bin/ipconf/inside b/rc/bin/ipconf/inside
new file mode 100755
index 000000000..51a929dd1
--- /dev/null
+++ b/rc/bin/ipconf/inside
@@ -0,0 +1,19 @@
+#!/bin/rc
+
+ip/ipconfig
+
+# 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
diff --git a/rc/bin/ipconf/lra b/rc/bin/ipconf/lra
new file mode 100755
index 000000000..47f575740
--- /dev/null
+++ b/rc/bin/ipconf/lra
@@ -0,0 +1,92 @@
+#!/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
diff --git a/rc/bin/ipconf/outside b/rc/bin/ipconf/outside
new file mode 100755
index 000000000..3f060f691
--- /dev/null
+++ b/rc/bin/ipconf/outside
@@ -0,0 +1,24 @@
+#!/bin/rc
+ip/ipconfig -dDG
+
+# 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
+}
+
+# set ndbfile for termrc touse
+NDBFILE=/lib/ndb/external
+
+# start dns if it isn't already going
+if(! test -e /srv/dns )
+ ndb/dns -r
+
+# just in case we can't find achille
+cpu=tcp!204.178.31.2
diff --git a/rc/bin/ipconf/theworld b/rc/bin/ipconf/theworld
new file mode 100755
index 000000000..b68df1979
--- /dev/null
+++ b/rc/bin/ipconf/theworld
@@ -0,0 +1,76 @@
+#!/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