From 8e802def740929fe55d0dc9a6d320c3e35a90a14 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 14 Feb 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-02-14 --- port/devarp.c | 28 ++++++++++++++-------------- port/devbit.c | 4 ++-- port/ipdat.h | 3 ++- port/stip.c | 6 ++---- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/port/devarp.c b/port/devarp.c index faa34c30269277e46bfce80dd0724c79c672068b..2a915e654ee27be039a02bb5079ff0a5642346cf 100644 --- a/port/devarp.c +++ b/port/devarp.c @@ -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); } diff --git a/port/devbit.c b/port/devbit.c index 6a115c1ad27bc88059b9e9baaf3843860811cab4..9b73b421d57cae6b5826f2a0c181b6347fef7fc7 100644 --- a/port/devbit.c +++ b/port/devbit.c @@ -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); diff --git a/port/ipdat.h b/port/ipdat.h index 4a65644425f64167ddedbd70d4f7cd214d144d5b..3719b681ebd70ae8824be0ba8906431f3b48a540 100644 --- a/port/ipdat.h +++ b/port/ipdat.h @@ -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[]; diff --git a/port/stip.c b/port/stip.c index 5b2d3d8ba4a354dc469fd11a324cb70aa63aa12b..7c77a4f1d2dc00bed3f78f48953bff0fa137ab71 100644 --- a/port/stip.c +++ b/port/stip.c @@ -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 */