From 937387b853c5154f0234390a6b6cb914c2d34b84 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Fri, 27 Jan 2017 10:03:30 +0100 Subject: [PATCH] Make IP address configurable. --- .gitignore | 2 ++ Makefile | 26 ++++++++++++++++---------- README.md | 12 +++--------- build/build.tcl | 18 +++++++++++++++--- {src/syshst => build}/h3text.2012 | 2 +- build/klh10/config.203 | 4 ++-- build/klh10/{dskdmp.ini => dskdmp.txt} | 2 +- 7 files changed, 40 insertions(+), 26 deletions(-) rename {src/syshst => build}/h3text.2012 (99%) rename build/klh10/{dskdmp.ini => dskdmp.txt} (90%) diff --git a/.gitignore b/.gitignore index 0a5e0cd5..e6a66486 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,7 @@ /out /start /build/*/stamp +/build/klh10/dskdmp.ini /src/system/config.* +/src/syshst/h3text.* /user/*/* diff --git a/Makefile b/Makefile index 682880d5..832fdcc0 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ EMULATOR ?= simh +IP=192.168.1.100 +GW=192.168.0.45 +NETMASK=255,255,255,248 # The directores listed in SRC, DOC, and BIN are put on the sources tape. SRC = system syseng sysen1 sysen2 sysen3 sysnet kshack dragon channa \ @@ -24,16 +27,14 @@ WRITETAPE=${PWD}/tools/tapeutils/tapewrite all: out/rp0.dsk tools/supdup/supdup out/rp0.dsk: build/simh/init out/minsys.tape out/salv.tape out/dskdmp.tape build/build.tcl out/sources.tape build/$(EMULATOR)/stamp - PATH=${PWD}/tools/simh/BIN:$$PATH expect -f build/$(EMULATOR)/build.tcl + PATH=${PWD}/tools/simh/BIN:$$PATH expect -f build/$(EMULATOR)/build.tcl $(IP) $(GW) out/minsys.tape: $(ITSTAR) mkdir -p out cd bin; $(ITSTAR) -cf ../$@ $(MINSYS) -out/sources.tape: $(ITSTAR) +out/sources.tape: $(ITSTAR) build/$(EMULATOR)/stamp src/syshst/h3text.2012 mkdir -p out - rm -f src/system/config.* - cp build/$(EMULATOR)/config.* src/system rm -f src/*/*~ cd src; $(ITSTAR) -cf ../$@ $(SRC) cd doc; $(ITSTAR) -rf ../$@ $(DOC) @@ -48,18 +49,23 @@ out/dskdmp.tape: $(WRITETAPE) $(RAM) $(DSKDMP) mkdir -p out $(WRITETAPE) -n 2560 $@ $(RAM) $(DSKDMP) -build/$(EMULATOR)/stamp: start - touch $@ - start: build/$(EMULATOR)/start ln -s $< $* -build/klh10/stamp: $(KLH10) +build/klh10/stamp: $(KLH10) start build/klh10/dskdmp.ini + x=`echo $(IP) | tr . ,`; sed -e "s/%IP%/$$x/" -e 's/%NETMASK%/$(NETMASK)/' < build/klh10/config.203 > src/system/config.203 touch $@ -build/simh/stamp: $(SIMH) +build/simh/stamp: $(SIMH) start + cp build/simh/config.* src/system touch $@ +build/klh10/dskdmp.ini: build/klh10/dskdmp.txt Makefile + sed -e 's/%IP%/$(IP)/' -e 's/%GW%/$(GW)/' < $< > $@ + +src/syshst/h3text.2012: build/h3text.2012 + sed -e 's/%IP%/$(IP)/' < $< > $@ + $(KLH10): cd tools/klh10; \ ./autogen.sh; \ @@ -83,4 +89,4 @@ tools/supdup/supdup: cd tools/supdup; make clean: - rm -rf out start build/*/stamp + rm -rf out start build/*/stamp src/system/config.* src/syshst/h3text.* diff --git a/README.md b/README.md index fcb5795a..d8b5835d 100644 --- a/README.md +++ b/README.md @@ -269,12 +269,6 @@ matches the address configured in SYSTEM; CONFIG > (as IMPUS3). Finally, the HOST table source (SYSHST; H3TEXT >) and binary (SYSBIN; HOSTS3 >) defined a host called DB-ITS.EXAMPLE.COM at the IP address 192.168.1.100. -In order to change the IP address of the host, you must update multiple -places and rebuild ITS and the host table. You will also have to modify -dskdmp.ini. Here are the places where the IP address is configured (and all -of these must agree): - -dskdmp.ini (in build/klh10 directory on the host) -SYSTEM; CONFIG > (ITS configuration file) -SYSHST; H3TEXT > (host table source file) -SYSBIN; HOSTS3 > (binary file compiled from SYSHST; H3TEXT >) +In order to change the IP address of the host, you can edit the +top-level Makefile variables IP, GW, and NETMASK. After that, a full +rebuild (e.g. `make clean all`) is required. diff --git a/build/build.tcl b/build/build.tcl index aeda128a..65a6e78f 100644 --- a/build/build.tcl +++ b/build/build.tcl @@ -67,9 +67,21 @@ proc shutdown {} { respond "NOW IN DDT" $emulator_escape } +proc ip_address {string} { + set x 0 + set octets [lreverse [split $string .]] + for {set i 0} {$i < 4} {incr i} { + incr x [expr {256 ** $i * [lindex $octets $i]}] + } + format "%o" $x +} + set timeout 100 expect_before timeout abort +set ip [ip_address [lindex $argv 0]] +set gw [ip_address [lindex $argv 1]] + start_nsalv respond "\n" "mark\033g" @@ -644,9 +656,9 @@ expect ":KILL" respond "*" "comsat\033j" respond "*" "\033l.mail.;comsat bin\r" -respond "*" "bughst/<<192.\033_24.>+<168.\033_16.>+<1.\033_8.>+100.>\r" -type "domgat/<<192.\033_24.>+<168.\033_16.>+<0.\033_8.>+45.>\r" -type "tcpgat/<<192.\033_24.>+<168.\033_16.>+<0.\033_8.>+45.>\r" +respond "*" "bughst/$ip\r" +type "domgat/$gw\r" +type "tcpgat/$gw\r" type "debug/0\r" type "xvers/0\r" type "purify\033g" diff --git a/src/syshst/h3text.2012 b/build/h3text.2012 similarity index 99% rename from src/syshst/h3text.2012 rename to build/h3text.2012 index b1266326..03e0c170 100644 --- a/src/syshst/h3text.2012 +++ b/build/h3text.2012 @@ -178,6 +178,6 @@ HOST : 36.21.0.103 : Hamlet.Stanford.EDU,LOTSC : DEC-2060 : TOPS20 : : ;;; KLH: All of the rest of this stuff was flushed... see older versions ;;; of H3TEXT for the cruft. -HOST : 192.168.1.100 : DB-ITS.EXAMPLE.COM : Linux : Linux : : +HOST : %IP% : DB-ITS.EXAMPLE.COM : Linux : Linux : : \ No newline at end of file diff --git a/build/klh10/config.203 b/build/klh10/config.203 index 8f2685c2..fac2ed8f 100644 --- a/build/klh10/config.203 +++ b/build/klh10/config.203 @@ -986,8 +986,8 @@ DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number DEFSYM PMUNSD==146000 ;Unused bits DEFOPT IMPUS==100. ; IMP net host number (old-style) (100 octal) -DEFOPT IMPUS3== ; IP address -DEFOPT NM%IMP== ; Subnet mask +DEFOPT IMPUS3== ; IP address +DEFOPT NM%IMP== ; Subnet mask DEFOPT PKTTRC==-1 ;Packet tracing code enabled DEFINE ITSIRP BODY diff --git a/build/klh10/dskdmp.ini b/build/klh10/dskdmp.txt similarity index 90% rename from build/klh10/dskdmp.ini rename to build/klh10/dskdmp.txt index 7afdfb2f..28ff5fc8 100644 --- a/build/klh10/dskdmp.ini +++ b/build/klh10/dskdmp.txt @@ -15,7 +15,7 @@ devdef mta0 rh1.0 tm02 fmtr=tm03 type=tu45 set clk_ithzfix=60 ; Define IMP for PI on ITS.JOSS.COM -devdef imp ub3 lhdh addr=767600 br=6 vec=250 ipaddr=192.168.1.100 gwaddr=192.168.0.45 +devdef imp ub3 lhdh addr=767600 br=6 vec=250 ipaddr=%IP% gwaddr=%GW% ; Dummy definitions. Only one DZ is still (apparently) needed. devdef dz0 ub3 dz11 addr=760010 br=5 vec=340