9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Patch to wavelan driver, specify heys in hex.
@ 2003-06-29 19:01 Dan Cross
  2003-06-29 19:05 ` Dan Cross
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Cross @ 2003-06-29 19:01 UTC (permalink / raw)
  To: 9fans; +Cc: 9trouble

So my sysadmins at work set up a wireless lan, but made the WEP key a
random string of hex digits that doesn't easily convert into a UTF
sequence I can put in a file.  So I made a small change to the wavelan
driver to recognize keys that start with ``0x'' as hex strings and
convert them to a binary encoding as appropriate.  It's not perfect, as
I'm not checking for decoding errors, nor are non-hex heys that start
with ``0x'' handled, but I wanted to send it out for others who might
be faced with a similar setup.

	- Dan C.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] Patch to wavelan driver, specify heys in hex.
  2003-06-29 19:01 [9fans] Patch to wavelan driver, specify heys in hex Dan Cross
@ 2003-06-29 19:05 ` Dan Cross
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Cross @ 2003-06-29 19:05 UTC (permalink / raw)
  To: 9fans; +Cc: 9trouble

Naturally, it would help if I included the patch....

	- Dan C.

*** /n/sources/plan9/sys/src/9/port/lib.h	Thu Feb 28 16:19:35 2002
--- lib.h	Sun Jun 29 14:08:46 2003
***************
*** 99,104 ****
--- 99,105 ----
  extern	char	end[];
  extern	int	getfields(char*, char**, int, int, char*);
  extern	int	tokenize(char*, char**, int);
+ extern	int	dec16(uchar*, int, char*, int);
  extern	int	dec64(uchar*, int, char*, int);

  /*
*** /n/sources/plan9/sys/src/9/pc/wavelan.c	Sun Jun 22 12:33:01 2003
--- wavelan.c	Sat Jun 28 19:30:57 2003
***************
*** 1036,1046 ****
  		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]);
- 			if(key->len > WKeyLen)
- 				key->len = WKeyLen;
  			memset(key->dat, 0, sizeof(key->dat));
! 			memmove(key->dat, cb->f[1], key->len);
  		}
  		else
  			r = -1;
--- 1036,1051 ----
  		if((i = atoi(cb->f[0]+3)) >= 1 && i <= WNKeys){
  			ctlr->txkey = i-1;
  			key = &ctlr->keys.keys[ctlr->txkey];
  			memset(key->dat, 0, sizeof(key->dat));
! 			p = cb->f[1];
! 			if(strncmp(p, "0x", 2) == 0)
! 				key->len = dec16(key->dat, WKeyLen, p + 2, strlen(p) - 2);
! 			else {
! 				key->len = strlen(p);
! 				if(key->len > WKeyLen)
! 					key->len = WKeyLen;
! 				memmove(key->dat, p, key->len);
! 			}
  		}
  		else
  			r = -1;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-29 19:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-29 19:01 [9fans] Patch to wavelan driver, specify heys in hex Dan Cross
2003-06-29 19:05 ` Dan Cross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).