From c3b19abc5d32280eacfb7c9f12bfacf4b65d894e Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 2 Feb 2001 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2001-02-02 --- pc/etherwavelan.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/pc/etherwavelan.c b/pc/etherwavelan.c index cc338188e7b9c653fc245fd6eb8b2498aff8fec3..8fd27c24872fd9d8393f6272fa95e5cda7c2094c 100644 --- a/pc/etherwavelan.c +++ b/pc/etherwavelan.c @@ -13,7 +13,6 @@ BUGS: Endian, alignment and mem/io issues? */ - #include "u.h" #include "../port/lib.h" #include "mem.h" @@ -24,7 +23,6 @@ #include "../port/netif.h" #include "etherif.h" - #define DEBUG if(1)print #define SEEKEYS 1 @@ -476,7 +474,6 @@ w_read(Ctlr* ctlr, int type, int off, void* buf, ulong len) return n; } - static int w_write(Ctlr* ctlr, int type, int off, void* buf, ulong len) { @@ -529,7 +526,6 @@ w_alloc(Ctlr* ctlr, int len) return -1; } - static int w_enable(Ether* ether) { @@ -588,10 +584,8 @@ w_enable(Ether* ether) ctlr->txbusy= 0; w_intena(ctlr); return 0; - } - static void w_rxdone(Ether* ether) { @@ -880,13 +874,13 @@ static void attach(Ether* ether) { Ctlr* ctlr; - char name[NAMELEN]; + char name[64]; int rc; if (ether->ctlr == 0) return; - snprint(name, NAMELEN, "#l%dtimer", ether->ctlrno); + snprint(name, sizeof(name), "#l%dtimer", ether->ctlrno); ctlr = (Ctlr*) ether->ctlr; if (ctlr->attached == 0){ ilock(&ctlr->Lock); @@ -1037,15 +1031,19 @@ option(Ctlr* ctlr, char* buf, long n) strncpy(ctlr->nodename, cb->f[1], WNameLen); } else if(cistrcmp(cb->f[0], "channel") == 0){ - i = atoi(cb->f[1]); - if(i >= 1 && i <= 16 ) + if((i = atoi(cb->f[1])) >= 1 && i <= 16) ctlr->chan = i; else r = -1; } else if(cistrcmp(cb->f[0], "mode") == 0){ - i = atoi(cb->f[1]); - if(i >= 1 && i <= 3 ) + if(cistrcmp(cb->f[1], "managed") == 0) + ctlr->ptype = 1; + else if(cistrcmp(cb->f[1], "wds") == 0) + ctlr->ptype = 2; + else if(cistrcmp(cb->f[1], "adhoc") == 0) + ctlr->ptype = 3; + else if((i = atoi(cb->f[1])) >= 1 && i <= 3) ctlr->ptype = i; else r = -1; @@ -1067,8 +1065,7 @@ option(Ctlr* ctlr, char* buf, long n) r = -1; } else if(cistrncmp(cb->f[0], "key", 3) == 0){ - i = atoi(cb->f[0]+3); - if(i >= 1 && i <= WNKeys){ + if((i = atoi(cb->f[0]+3)) >= 1 && i <= WNKeys){ ctlr->txkey = i-1; key = &ctlr->keys.keys[ctlr->txkey]; key->len = strlen(cb->f[1]); @@ -1080,6 +1077,12 @@ option(Ctlr* ctlr, char* buf, long n) else r = -1; } + else if(cistrcmp(cb->f[0], "txkey") == 0){ + if((i = atoi(cb->f[1])) >= 1 && i <= WNKeys) + ctlr->txkey = i-1; + else + r = -1; + } else if(cistrcmp(cb->f[0], "pm") == 0){ if(cistrcmp(cb->f[1], "off") == 0) ctlr->pmena = 0; @@ -1153,8 +1156,6 @@ promiscuous(void* arg, int on) iunlock(&ctlr->Lock); } - - static void interrupt(Ureg* ,void* arg) {