Browse Source

Plan 9 from Bell Labs 2003-08-07

David du Colombier 18 years ago
parent
commit
4fc4c02075

+ 10 - 8
dist/replica/plan9.db

@@ -272,7 +272,7 @@
 386/bin/ip/httpd/save - 775 sys sys 1056364282 131012
 386/bin/ip/httpd/wikipost - 775 sys sys 1056364282 111370
 386/bin/ip/imap4d - 775 sys sys 1056364283 233876
-386/bin/ip/ipconfig - 775 sys sys 1056364284 102995
+386/bin/ip/ipconfig - 775 sys sys 1060189244 128491
 386/bin/ip/ping - 775 sys sys 1057551515 74064
 386/bin/ip/ppp - 775 sys sys 1057795514 216254
 386/bin/ip/pppoe - 775 sys sys 1056364286 75503
@@ -307,7 +307,7 @@
 386/bin/mtime - 775 sys sys 1056364305 57898
 386/bin/mv - 775 sys sys 1056364306 65018
 386/bin/ndb - 20000000775 sys sys 985743147 0
-386/bin/ndb/cs - 775 sys sys 1056364307 143921
+386/bin/ndb/cs - 775 sys sys 1060173545 144252
 386/bin/ndb/csquery - 775 sys sys 1056364307 60158
 386/bin/ndb/dns - 775 sys sys 1056364308 216571
 386/bin/ndb/dnsdebug - 775 sys sys 1056364309 188863
@@ -1328,7 +1328,7 @@ lib/face/48x48x4/x - 20000000775 sys sys 944941894 0
 lib/face/48x48x4/y - 20000000775 sys sys 944941894 0
 lib/face/48x48x4/z - 20000000775 sys sys 944941894 0
 lib/face/48x48x8 - 20000000775 sys sys 944941834 0
-lib/face/48x48x8/.dict - 664 sys sys 1059678094 1849
+lib/face/48x48x8/.dict - 664 sys sys 1060173964 1938
 lib/face/48x48x8/Z - 20000000775 sys sys 944941832 0
 lib/face/48x48x8/a - 20000000775 sys sys 944941832 0
 lib/face/48x48x8/a/axel.1 - 664 sys sys 1056983599 473
@@ -1352,6 +1352,7 @@ lib/face/48x48x8/i - 20000000775 sys sys 944941833 0
 lib/face/48x48x8/j - 20000000775 sys sys 944941833 0
 lib/face/48x48x8/k - 20000000775 sys sys 944941833 0
 lib/face/48x48x8/k/karen.1 - 644 sys sys 1057005135 1608
+lib/face/48x48x8/k/kris.1 - 664 sys sys 1060142993 2364
 lib/face/48x48x8/l - 20000000775 sys sys 944941833 0
 lib/face/48x48x8/l/lucent.1 - 664 sys sys 944941833 801
 lib/face/48x48x8/l/lucio.1 - 664 sys sys 1059678230 1069
@@ -1416,6 +1417,7 @@ lib/face/48x48x8/w - 20000000775 sys sys 944941834 0
 lib/face/48x48x8/x - 20000000775 sys sys 944941834 0
 lib/face/48x48x8/y - 20000000775 sys sys 944941834 0
 lib/face/48x48x8/z - 20000000775 sys sys 944941834 0
+lib/face/48x48x8/z/zed.1 - 664 sys sys 1060174022 2364
 lib/face/512x512x24 - 20000000755 sys sys 944941683 0
 lib/face/512x512x24/.dict - 644 sys sys 944941683 0
 lib/face/512x512x8 - 20000000755 sys sys 944941683 0
@@ -2943,7 +2945,7 @@ rc/bin/doctype - 775 sys sys 945617206 1726
 rc/bin/dosmnt - 775 sys sys 958526437 285
 rc/bin/eject - 775 sys sys 945617207 123
 rc/bin/fax - 775 sys sys 1015701359 2390
-rc/bin/fedex - 775 sys sys 1048862253 1122
+rc/bin/fedex - 775 sys sys 1060187356 1244
 rc/bin/homespool - 775 sys sys 945617207 339
 rc/bin/ipconf - 20000000775 sys sys 1058791152 0
 rc/bin/ipconf/inside - 775 sys sys 1058790955 427
@@ -3036,7 +3038,7 @@ rc/bin/start - 775 sys sys 945617209 120
 rc/bin/stock - 775 sys sys 1055701355 288
 rc/bin/stop - 775 sys sys 945617209 110
 rc/bin/tel - 775 sys sys 1019854296 136
-rc/bin/termrc - 775 sys sys 1038278927 2637
+rc/bin/termrc - 775 sys sys 1060174264 2606
 rc/bin/tlsclienttunnel - 775 sys sys 1024375633 153
 rc/bin/tlssrvtunnel - 775 sys sys 1024375634 175
 rc/bin/troff2gif - 775 sys sys 1045504085 178
@@ -4920,7 +4922,7 @@ sys/man/8/fs - 664 sys sys 1055701170 15029
 sys/man/8/fsconfig - 664 sys sys 1045501600 8142
 sys/man/8/httpd - 664 sys sys 1037690024 4516
 sys/man/8/init - 664 sys sys 944959679 1430
-sys/man/8/ipconfig - 664 sys sys 1055701180 4766
+sys/man/8/ipconfig - 664 sys sys 1060189415 5050
 sys/man/8/ipserv - 664 sys sys 1026847122 4190
 sys/man/8/kfscmd - 664 sys sys 1022010519 4492
 sys/man/8/listen - 664 sys sys 1045501609 3740
@@ -9169,7 +9171,7 @@ sys/src/cmd/ip/imap4d/nodes.c - 664 sys sys 1015013077 3173
 sys/src/cmd/ip/imap4d/search.c - 664 sys sys 1015013077 4520
 sys/src/cmd/ip/imap4d/store.c - 664 sys sys 1015013077 1910
 sys/src/cmd/ip/imap4d/utils.c - 664 sys sys 1015013077 2481
-sys/src/cmd/ip/ipconfig.c - 664 sys sys 1051023520 27439
+sys/src/cmd/ip/ipconfig.c - 664 sys sys 1060189236 29311
 sys/src/cmd/ip/measure.c - 664 sys sys 944961011 3733
 sys/src/cmd/ip/mkfile - 664 sys sys 1038443023 1222
 sys/src/cmd/ip/ping.c - 664 sys sys 1056550715 5076
@@ -9428,7 +9430,7 @@ sys/src/cmd/mv.c - 664 sys sys 1014926695 4276
 sys/src/cmd/ndb - 20000000775 sys sys 988249988 0
 sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1021579991 6525
 sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1050714836 6740
-sys/src/cmd/ndb/cs.c - 664 sys sys 1056171180 32752
+sys/src/cmd/ndb/cs.c - 664 sys sys 1060173544 32903
 sys/src/cmd/ndb/csgetval.c - 664 sys sys 957402051 1051
 sys/src/cmd/ndb/csquery.c - 664 sys sys 1014926159 1062
 sys/src/cmd/ndb/dblookup.c - 664 sys sys 1055701929 17465

+ 11 - 0
dist/replica/plan9.log

@@ -13020,3 +13020,14 @@
 1060041774 0 c sys/src/cmd/upas/ned/mkfile - 664 sys sys 1060041738 233
 1060041774 1 c sys/src/cmd/upas/ned/nedmail.c - 664 sys sys 1060041739 42848
 1060092160 0 c lib/face/48x48x4/.dict - 664 sys sys 1060092065 2010
+1060144275 0 c lib/face/48x48x8/.dict - 664 sys sys 1060142916 1908
+1060144275 1 a lib/face/48x48x8/k/kris.1 - 664 sys sys 1060142993 2364
+1060174868 0 c 386/bin/ndb/cs - 775 sys sys 1060173545 144252
+1060174868 1 c lib/face/48x48x8/.dict - 664 sys sys 1060173964 1938
+1060174868 2 a lib/face/48x48x8/z/zed.1 - 664 sys sys 1060174022 2364
+1060174868 3 c rc/bin/termrc - 775 sys sys 1060174264 2606
+1060174868 4 c sys/src/cmd/ndb/cs.c - 664 sys sys 1060173544 32903
+1060187479 0 c rc/bin/fedex - 775 sys sys 1060187356 1244
+1060189283 0 c 386/bin/ip/ipconfig - 775 sys sys 1060189244 128491
+1060189283 1 c sys/src/cmd/ip/ipconfig.c - 664 sys sys 1060189236 29311
+1060191081 0 c sys/man/8/ipconfig - 664 sys sys 1060189415 5050

+ 3 - 0
lib/face/48x48x8/.dict

@@ -1,6 +1,7 @@
 astro/collyer g/geoff.2
 astro/geoff g/geoff.2
 9fs.org/nigel n/nigel.1
+alchar.org/aedil k/kris.1
 ar/unknown u/unknown.68
 at/unknown u/unknown.157
 au/unknown u/unknown.214
@@ -43,6 +44,7 @@ my/unknown u/unknown.155
 nl/unknown u/unknown.156
 no/unknown u/unknown.193
 nz/unknown u/unknown.148
+pandora.be/z.mccarthy z/zed.1
 plan9.escet.urjc.es/nemo n/nemo.1
 proxima.alt.za/lucio l/lucio.1
 pt/unknown u/unknown.166
@@ -51,6 +53,7 @@ sdgm.net/boyd b/boyd.1
 sdgm.net/cross d/dancross.1
 se/unknown u/unknown.180
 sg/unknown u/unknown.147
+sinenomine.net/kvanhees k/kris.1
 sk/unknown s/sk.1
 snellwilcox.com/steve.simon s/stevesimon.1
 su/unknown u/unknown.67

File diff suppressed because it is too large
+ 0 - 0
lib/face/48x48x8/k/kris.1


BIN
lib/face/48x48x8/z/zed.1


+ 4 - 3
rc/bin/fedex

@@ -54,8 +54,9 @@ fn awk3 {
 # hget 'http://www.fedex.com/cgi-bin/track_it?airbill_list='$1'&kurrent_airbill='$1'&language=english&cntry_code=us&state=0' |
 hget 'http://www.fedex.com/cgi-bin/tracking?action=track&language=english&cntry_code=us&initial=x&mps=y&tracknumbers='$1 |
 	htmlfmt >/tmp/fedex.$pid
-bgrep 'Tracking Number' /tmp/fedex.$pid | awk2
+sed -n '/Tracking number/,/^$/p' /tmp/fedex.$pid | awk2
 echo
-bgrep 'Scan Activity' /tmp/fedex.$pid | awk3
+sed -n '/Reference number/,/^$/p' /tmp/fedex.$pid | awk2
+echo
+sed -n '/Date.time/,/^$/p' /tmp/fedex.$pid | sed 1,4d | fmt -l 4000 | sed 's/ [A-Z][A-Z] /&\n/g'
 rm /tmp/fedex.$pid
-

+ 2 - 2
rc/bin/termrc

@@ -7,7 +7,7 @@ fileserver=kfs
 cpu=CPU
 # replace FACEDOM with the local domain to be used in the faces database
 facedom=FACEDOM
-TIMESYNCACCURACY=1000000	# accuracy in nanosec
+TIMESYNCARGS=-rLa1000000
 NDBFILE=/lib/ndb/local
 
 if(test -e /rc/bin/termrc.local)
@@ -33,7 +33,7 @@ sysname=`{cat /dev/sysname}
 if(test -e /net/ipifc/0/ctl)
 	ndb/dns -rf $NDBFILE
 
-aux/timesync -rLa $TIMESYNCACCURACY
+aux/timesync $TIMESYNCARGS
 
 switch($terminal){
 case carrera*

+ 12 - 2
sys/man/8/ipconfig

@@ -3,7 +3,7 @@
 ipconfig, rip \- Internet configuration and routing
 .SH SYNOPSIS
 .B ip/ipconfig
-.RB [ -DGPdnr ]
+.RB [ -NDGPdnpr ]
 .RB [ -b
 .IR baud ]
 .RB [ -c
@@ -85,6 +85,11 @@ The options are:
 .B D
 turn on debugging.
 .TP
+.B N
+look in /lib/ndb for the IP parameters.  This only works if the
+interface is an ethernet.  It uses the ethernet address to find
+a matching entry.
+.TP
 .B G
 use only generic DHCP options.  Without this option,
 .I ipconfig
@@ -95,11 +100,16 @@ interpret as the Plan 9 file server and auth server.
 Replies to these options contain a list of IP addresses for possible
 file servers and auth servers.
 .TP
-.B P
+.B p
 write configuration information to
 .BR /net/ndb ,
 even if other network interfaces are already configured
 .TP
+.B P
+do not write configuration information to
+.BR /net/ndb ,
+even if this is the first network interface to be configured
+.TP
 .B b
 the baud rate to use on a serial line
 when configuring

+ 89 - 9
sys/src/cmd/ip/ipconfig.c

@@ -1,6 +1,8 @@
 #include <u.h>
 #include <libc.h>
 #include <ip.h>
+#include <bio.h>
+#include <ndb.h>
 #include "dhcp.h"
 
 int	noconfig;
@@ -9,9 +11,10 @@ int	dodhcp;
 int	nip;
 int	myifc = -1;
 int	plan9 = 1;
-int	beprimary;
+int	beprimary = -1;
 int	nodhcpwatch;
 int	sendhostname;
+int	dondbconfig = 0;
 
 Ipifc	*ifc;
 
@@ -105,6 +108,7 @@ int	parseverb(char*);
 void	doadd(int);
 void	doremove(void);
 void	dounbind(void);
+void	ndbconfig(void);
 
 char optmagic[4] = { 0x63, 0x82, 0x53, 0x63 };
 
@@ -153,9 +157,14 @@ main(int argc, char **argv)
 	case 'G':
 		plan9 = 0;
 		break;
-	case 'P':
+	case 'N':
+		dondbconfig = 1;
+		break;
+	case 'p':
 		beprimary = 1;
 		break;
+	case 'P':
+		beprimary = 0;
 	case 'b':
 		p = ARGF();
 		if(p == nil)
@@ -284,6 +293,23 @@ main(int argc, char **argv)
 	exits(0);
 }
 
+int
+havendb(char *net)
+{
+	Dir *d;
+	char buf[128];
+
+	snprint(buf, sizeof buf, "%s/ndb", net);
+	if((d = dirstat("/net/ndb")) == nil)
+		return 0;
+	if(d->length == 0){
+		free(d);
+		return 0;
+	}
+	free(d);
+	return 1;
+}
+
 void
 doadd(int retry)
 {
@@ -291,7 +317,7 @@ doadd(int retry)
 
 	// get number of preexisting interfaces
 	nip = nipifcs(conf.mpoint);
-	if(nip == 0)
+	if(beprimary == -1 && (nip == 0 || !havendb(conf.mpoint)))
 		beprimary = 1;
 
 	// get ipifc into name space and condition device for ip
@@ -301,8 +327,12 @@ doadd(int retry)
 		binddevice();
 	}
 
-	if(!validip(conf.laddr))
-		dodhcp = 1;
+	if(!validip(conf.laddr)){
+		if(dondbconfig)
+			ndbconfig();
+		else
+			dodhcp = 1;
+	}
 
 	// run dhcp if we need something
 	if(dodhcp){
@@ -334,7 +364,7 @@ doadd(int retry)
 	}
 
 	// leave everything we've learned somewhere other procs can find it
-	if(beprimary){
+	if(beprimary == 1){
 		putndb();
 		tweakservers();
 	}
@@ -527,7 +557,7 @@ ipconfig(void)
 		return -1;
 	}
 
-	if(beprimary && validip(conf.gaddr))
+	if(beprimary==1 && validip(conf.gaddr))
 		adddefroute(conf.mpoint, conf.gaddr);
 
 	return 0;
@@ -557,7 +587,7 @@ ipunconfig(void)
 	ipmove(conf.mask, IPnoaddr);
 
 	// forget configuration info
-	if(beprimary)
+	if(beprimary==1)
 		writendb("", 0, 0);
 }
 
@@ -672,7 +702,7 @@ dhcpwatch(int needconfig)
 			needconfig = 0;
 
 			// leave everything we've learned somewhere other procs can find it
-			if(beprimary){
+			if(beprimary==1){
 				putndb();
 				tweakservers();
 			}
@@ -1433,3 +1463,53 @@ parseverb(char *name)
 	return -1;
 }
 
+// get everything out of ndb
+void
+ndbconfig(void)
+{
+	Ndb *db;
+	Ndbtuple *t, *nt;
+	char etheraddr[32];
+	char *attrs[10];
+	int nattr;
+	int ndns = 0;
+	int nfs = 0;
+	int nauth = 0;
+
+	db = ndbopen(0);
+	if(db == nil)
+		sysfatal("can't open ndb: %r");
+	if(strcmp(conf.type, "ether") != 0 || myetheraddr(conf.hwa, conf.dev) != 0)
+		sysfatal("can't read hardware address");
+	sprint(etheraddr, "%E", conf.hwa);
+	nattr = 0;
+	attrs[nattr++] = "ip";
+	attrs[nattr++] = "ipmask";
+	attrs[nattr++] = "ipgw";
+	attrs[nattr++] = "@dns";
+	attrs[nattr++] = "@ntp";
+	attrs[nattr++] = "@fs";
+	attrs[nattr++] = "@auth";
+	attrs[nattr] = nil;
+	t = ndbipinfo(db, "ether", etheraddr, attrs, nattr);
+	for(nt = t; nt != nil; nt = nt->entry){
+		if(strcmp(nt->attr, "ip") == 0){
+			parseip(conf.laddr, nt->val);
+		} else if(strcmp(nt->attr, "ipmask") == 0){
+			parseipmask(conf.mask, nt->val);
+		} else if(strcmp(nt->attr, "ipgw") == 0){
+			parseip(conf.gaddr, nt->val);
+		} else if(ndns < 2 && strcmp(nt->attr, "dns") == 0){
+			parseip(conf.dns+IPaddrlen*ndns, nt->val);
+		} else if(strcmp(nt->attr, "ntp") == 0){
+			parseip(conf.ntp, nt->val);
+		} else if(nfs < 2 && strcmp(nt->attr, "fs") == 0){
+			parseip(conf.fs+IPaddrlen*nfs, nt->val);
+		} else if(nauth < 2 && strcmp(nt->attr, "auth") == 0){
+			parseip(conf.auth+IPaddrlen*nauth, nt->val);
+		}
+	}
+	ndbfree(t);
+	if(!validip(conf.laddr))
+		sysfatal("address not found in ndb");
+}

+ 7 - 2
sys/src/cmd/ndb/cs.c

@@ -1274,8 +1274,13 @@ ipserv(Network *np, char *name, char *buf)
 		if(t == 0)
 			return 0;
 	} else {
-		t = ndbgetval(db, &s, "port", name, "port", port);
-		if(t == 0){
+		/* look up only for tcp ports < 1024 to get the restricted
+		 * attribute
+		 */
+		t = nil;
+		if(atoi(name) < 1024 && strcmp(np->net, "tcp") == 0)
+			t = ndbgetval(db, &s, "port", name, "port", port);
+		if(t == nil){
 			strncpy(port, name, sizeof(port));
 			port[sizeof(port)-1] = 0;
 		}

Some files were not shown because too many files changed in this diff