~kris/9p

9hist

8e802def740929fe55d0dc9a6d320c3e35a90a14 — David du Colombier 34 years ago 5d15e97
Plan 9 from Bell Labs 1992-02-14
4 files changed, 20 insertions(+), 21 deletions(-)

M port/devarp.c
M port/devbit.c
M port/ipdat.h
M port/stip.c
M port/devarp.c => port/devarp.c +14 -14
@@ 320,19 320,20 @@ arpoput(Queue *q, Block *bp)
		return;
	}

	if(!Servq) {
		if((dropped++ % 1000) == 0)
			print("arp: No server, packet dropped\n");
		freeb(bp);
		return;
	}

	eh = (Etherhdr *)bp->rptr;
	if(nhgets(eh->type) != ET_IP) {
		PUTNEXT(q, bp);	
		return;
	}

	/* if ip broadcast, use ether bcast address */
	addr = nhgetl(eh->dst);
	if(addr == Myip[Mybcast] || addr == Myip[Mynet] || addr == Myip[Mysubnet]){
		memset(eh->d, 0xff, sizeof(eh->d));
		PUTNEXT(q, bp);
		return;
	}

	iproute(eh->dst, ip);

	/* if a known ip addr, send downstream to the ethernet */


@@ 341,15 342,14 @@ arpoput(Queue *q, Block *bp)
		return;
	}

	/* if ip broadcast, use ether bcast address */
	addr = nhgetl(eh->dst);
	if(addr == Myip[Mybcast] || addr == Myip[Mynet] || addr == Myip[Mysubnet]){
		memset(eh->d, 0xff, sizeof(eh->d));
		PUTNEXT(q, bp);
	/* Push the packet up to the arp server for address resolution */
	if(!Servq) {
		if((dropped++ % 1000) == 0)
			print("arp: No server, packet dropped %d.%d.%d.%d\n",
				eh->dst[0], eh->dst[1], eh->dst[2], eh->dst[3]);
		freeb(bp);
		return;
	}

	/* Push the packet up to the arp server for address resolution */
	memmove(eh->d, ip, sizeof(ip));
	PUTNEXT(Servq, bp);
}

M port/devbit.c => port/devbit.c +2 -2
@@ 1336,8 1336,8 @@ bitloadchar(GFont *f, int ci, GSubfont *subf, int si)
	rect.min.y = 0;
	rect.max.y = f->height;
	rect.min.x = c->x;
	rect.max.x = c->xright;
	gbitblt(f->b, Pt(c->x, 0), subf->bits, rect, 0);
	rect.max.x = c->x+f->width;
	gbitblt(f->b, rect.min, f->b, rect, 0);
	rect.min.x = fi->x;
	rect.max.x = (fi+1)->x;
	gbitblt(f->b, Pt(c->x, f->ascent-subf->ascent), subf->bits, rect, S);

M port/ipdat.h => port/ipdat.h +2 -1
@@ 493,6 493,7 @@ void	iplocalfill(Chan*, char*, int);
void	ipremotefill(Chan*, char*, int);
void	ipstatusfill(Chan*, char*, int);
int	ipforme(uchar*);
void	ipsetaddrs(void);

#define	fmtaddr(xx)	(xx>>24)&0xff,(xx>>16)&0xff,(xx>>8)&0xff,xx&0xff
#define	MIN(a, b)	((a) < (b) ? (a) : (b))


@@ 503,7 504,7 @@ int	ipforme(uchar*);

#define WORKBUF		64

extern Ipaddr Myip[4];
extern Ipaddr Myip[7];
extern Ipaddr Mymask;
extern Ipaddr classmask[4];
extern Ipconv *ipconv[];

M port/stip.c => port/stip.c +2 -4
@@ 26,19 26,17 @@ QLock		fraglock;

Queue 		*Etherq;

Ipaddr		Myip[4];
Ipaddr		Myip[7];
Ipaddr		Mymask;
Ipaddr		Mynetmask;
uchar		Netmyip[4];	/* In Network byte order */
uchar		bcast[4] = { 0xff, 0xff, 0xff, 0xff };
Ipaddr		Me[7];		/* possible addresses for me */

/* Predeclaration */
static void	ipetherclose(Queue*);
static void	ipetheriput(Queue*, Block*);
static void	ipetheropen(Queue*, Stream*);
static void	ipetheroput(Queue*, Block*);
static void	ipsetaddrs(void);

/*
 *  the ethernet multiplexor stream module definition


@@ 361,7 359,7 @@ drop:
void
ipsetaddrs(void)
{
	Myip[1] = ~0;					/* local broadcast */
	Myip[Mybcast] = ~0;				/* local broadcast */
	Myip[2] = 0;					/* local broadcast - old */
	Myip[Mysubnet] = Myip[Myself] | ~Mynetmask;	/* subnet broadcast */
	Myip[Mysubnet+1] = Myip[Myself] & Mynetmask;	/* subnet broadcast - old */