~kris/9p

9hist

957732072a3a316fef5653e53e7f04eaeb860eef — David du Colombier 25 years ago 3f3316b
Plan 9 from Bell Labs 2001-01-19
5 files changed, 44 insertions(+), 33 deletions(-)

M boot/boot.h
A boot/glendakey.c
M boot/local.c
M ip/tcp.c
M pc/etherwavelan.c
M boot/boot.h => boot/boot.h +1 -0
@@ 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*);

A boot/glendakey.c => boot/glendakey.c +26 -0
@@ 0,0 1,26 @@
#include <u.h>
#include <libc.h>
#include <auth.h>
#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");
}

M boot/local.c => boot/local.c +7 -2
@@ 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;

M ip/tcp.c => ip/tcp.c +8 -28
@@ 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;


M pc/etherwavelan.c => pc/etherwavelan.c +2 -3
@@ 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;
	}