From 957732072a3a316fef5653e53e7f04eaeb860eef Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 19 Jan 2001 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2001-01-19 --- boot/boot.h | 1 + boot/glendakey.c | 26 ++++++++++++++++++++++++++ boot/local.c | 9 +++++++-- ip/tcp.c | 36 ++++++++---------------------------- pc/etherwavelan.c | 5 ++--- 5 files changed, 44 insertions(+), 33 deletions(-) create mode 100644 boot/glendakey.c diff --git a/boot/boot.h b/boot/boot.h index 6944415d831f30d15b0f5590e9fc487e65f65e3d..8cbded5ab0e3892056e2862de1f41159204d7abb 100644 --- a/boot/boot.h +++ b/boot/boot.h @@ -33,6 +33,7 @@ extern char* checkkey(Method*, char*, char*); extern void fatal(char*); extern void getpasswd(char*, int); extern void key(int, Method*); +extern void glendakey(int, Method*); extern int nop(int); extern int outin(char*, char*, int); extern int plumb(char*, char*, int*, char*); diff --git a/boot/glendakey.c b/boot/glendakey.c new file mode 100644 index 0000000000000000000000000000000000000000..0974847941006ad2cc824f73074c7710e08d8427 --- /dev/null +++ b/boot/glendakey.c @@ -0,0 +1,26 @@ +#include +#include +#include +#include <../boot/boot.h> + +/* + * pretend to get info out of nvram. + */ +void +glendakey(int, Method*) +{ + char key[DESKEYLEN]; + + passtokey(key, "boyd"); + + /* set host's key */ + if(writefile("#c/key", key, DESKEYLEN) < 0) + warning("#c/key"); + + /* set host's owner (and uid of current process) */ + if(writefile("#c/hostowner", "glenda", 6) < 0) + warning("#c/hostowner"); + + if(writefile("#c/hostdomain", "plan9", 5) < 0) + warning("#c/hostdomain"); +} diff --git a/boot/local.c b/boot/local.c index d6dc1ab394de7a69a7ff233c555255218717237f..4aa391306c06991db1402c47aba035d096ce426d 100644 --- a/boot/local.c +++ b/boot/local.c @@ -64,15 +64,20 @@ connectlocal(void) char *dev; char **arg, **argp; - if(stat("/kfs", d) < 0) + if(stat("/kfs", d) < 0){ + print("stat /kfs fails: %r\n"); return -1; + } dev = disk ? disk : bootdisk; sprint(partition, "%sfs", dev); if(dirstat(partition, &dir) < 0){ strcpy(partition, dev); - if(dirstat(partition, &dir) < 0) + if(dirstat(partition, &dir) < 0){ + print("stat %s fails: %r\n", partition); + print("(stat %sfs also failed)\n", dev); return -1; + } } if(dir.mode & CHDIR) return -1; diff --git a/ip/tcp.c b/ip/tcp.c index 4885d55e808a69f15c26dee04b8cc4fa07f7a9df..f756464ec267ba9fdc7ed79cb75ab27c02998b0d 100644 --- a/ip/tcp.c +++ b/ip/tcp.c @@ -150,7 +150,6 @@ struct Tcpctl ulong ptr; /* Data pointer */ ushort wnd; /* Tcp send window */ ulong urg; /* Urgent data pointer */ - ulong wl1; ulong wl2; /* to implement tahoe and reno TCP */ @@ -189,7 +188,7 @@ struct Tcpctl int kacounter; /* count down for keep alive */ uint sndsyntime; /* time syn sent */ ulong time; /* time Finwait2 or Syn_received was sent */ - int nochecksum; /* non-zero means don't send checksums */ + int nochecksum; /* non-zero means don't send checksums */ Tcphdr protohdr; /* prototype header */ }; @@ -646,7 +645,7 @@ tcpmtu(Conv *s) } void -inittcpctl(Conv *s) +inittcpctl(Conv *s, int mode) { Tcpctl *tcb; Tcphdr *h; @@ -669,6 +668,7 @@ inittcpctl(Conv *s) tcb->katimer.arg = s; /* create a prototype(pseudo) header */ + if(mode != TCP_LISTEN) if(ipcmp(s->laddr, IPnoaddr) == 0) findlocalip(s->p->f, s->laddr, s->raddr); h = &tcb->protohdr; @@ -707,7 +707,7 @@ tcpstart(Conv *s, int mode, ushort window) tcb = (Tcpctl*)s->ptcl; /* Send SYN, go into SYN_SENT state */ - inittcpctl(s); + inittcpctl(s, mode); tcb->window = window; tcb->rcv.wnd = window; @@ -1111,21 +1111,15 @@ update(Conv *s, Tcp *seg) } /* - * update our send window if this is a new ack (ignore old packets - * even if the ack is new) + * update window */ - if(seq_ge(seg->ack,tcb->snd.wl2)) - if(seq_ge(seg->seq,tcb->snd.wl1)) { - - /* a closed window opened, start retransmitting. why? - presotto */ - if(seg->wnd != 0 && tcb->snd.wnd == 0) - tcb->snd.ptr = tcb->snd.una; - + if( seq_gt(seg->ack, tcb->snd.wl2) + || (tcb->snd.wl2 == seg->ack && seg->wnd > tcb->snd.wnd)){ tcb->snd.wnd = seg->wnd; - tcb->snd.wl1 = seg->seq; tcb->snd.wl2 = seg->ack; } + if(!seq_gt(seg->ack, tcb->snd.una)) return; @@ -1738,19 +1732,6 @@ tcpoutput(Conv *s) if((tcb->flags&FORCE) == 0) break; - /* avoid sending short packets unless... */ - if(dsize != 0) { - /* ...we have a full segment */ - if(dsize != tcb->mss) - /* ...the data was just queued */ - if((dsize + sent) != sndcnt) - /* ...we're being forced */ - if(!(tcb->flags&FORCE)) - /* ...we have at least half a window's worth to send */ - if(dsize < tcb->snd.wnd/2 || tcb->snd.wnd == 0) - return; - } - tcphalt(tpriv, &tcb->acktimer); tcb->flags &= ~FORCE; @@ -2075,7 +2056,6 @@ procsyn(Conv *s, Tcp *seg) tcb->rcv.nxt = seg->seq + 1; tcb->rcv.urg = tcb->rcv.nxt; - tcb->snd.wl1 = seg->seq; tcb->irs = seg->seq; tcb->snd.wnd = seg->wnd; diff --git a/pc/etherwavelan.c b/pc/etherwavelan.c index a795c5861fec208624401692571b7c3fd6ae22d9..10aec6492615b25cc3c084a671fb38b60c4e3e63 100644 --- a/pc/etherwavelan.c +++ b/pc/etherwavelan.c @@ -1019,7 +1019,6 @@ static long ctl(Ether* ether, void* buf, long n) { int i; - char *p; Ctlr *ctlr; Cmdbuf *cb; @@ -1047,13 +1046,13 @@ ctl(Ether* ether, void* buf, long n) strncpy(ctlr->nodename, cb->f[1], WNameLen); else if(strcmp(cb->f[0], "chan") == 0){ i = atoi(cb->f[1]); - if (i < 1 || i > 16 ) + if(i < 1 || i > 16 ) error("invalid wavelan channel"); ctlr->chan = i; } else if(strcmp(cb->f[0], "ptype") == 0){ i = atoi(cb->f[1]); - if (i < 1 || i > 3 ) + if(i < 1 || i > 3 ) error("invalid wavelan port type"); ctlr->ptype = i; }