diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 2001-04-16 00:39:40 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 2001-04-16 00:39:40 +0000 |
commit | 41081a5e36043e797aac2eb8786cc12171991eb2 (patch) | |
tree | e99eb6346d9b18dcb6eb93ba2d1b34e6b4ed4ea7 | |
parent | b07f8d2eb9d126efe5d3c7e9316b0e5b15f8ce06 (diff) |
Actually permit setting the transmit key in WEP mode; from Kurt Miller.
Correctly display number and order of WEP keys; from Kurt Miller.
Fixes part of PR 1754; ok deraadt@
-rw-r--r-- | sbin/ancontrol/ancontrol.8 | 4 | ||||
-rw-r--r-- | sbin/ancontrol/ancontrol.c | 35 |
2 files changed, 23 insertions, 16 deletions
diff --git a/sbin/ancontrol/ancontrol.8 b/sbin/ancontrol/ancontrol.8 index 224086de06b..2e4c141e665 100644 --- a/sbin/ancontrol/ancontrol.8 +++ b/sbin/ancontrol/ancontrol.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ancontrol.8,v 1.8 2001/04/13 16:53:50 jakob Exp $ +.\" $OpenBSD: ancontrol.8,v 1.9 2001/04/16 00:39:38 tholo Exp $ .\" .\" Copyright (c) 1997, 1998, 1999 .\" Bill Paul <wpaul@ee.columbia.edu> All rights reserved. @@ -219,7 +219,7 @@ option: selection sets the receive diversity and .Ar 1 sets the transmit diversity. -.It Fl d Ar "0|1|2|3" +.It Fl e Ar "0|1|2|3" Set the transmit WEP key to use. Note that until this command is issued, the device will use the last key programmed. The transmit key is stored in NVRAM. diff --git a/sbin/ancontrol/ancontrol.c b/sbin/ancontrol/ancontrol.c index f9c2c858b1b..ecef80391d1 100644 --- a/sbin/ancontrol/ancontrol.c +++ b/sbin/ancontrol/ancontrol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ancontrol.c,v 1.11 2001/04/15 23:19:13 ericj Exp $ */ +/* $OpenBSD: ancontrol.c,v 1.12 2001/04/16 00:39:39 tholo Exp $ */ /* * Copyright 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -1253,21 +1253,24 @@ an_readkeyinfo(iface) for (i = 0; i < 4; i++) { areq.an_len = sizeof(struct an_ltv_key); an_getval(iface, &areq); - switch (k->klen) { - case 0: + for (; i < k->kindex && i < 4; i++) printf("\tKey %d is unset\n", i); - break; - case 5: - printf("\tKey %d is set 40 bits\n", i); - break; - case 13: - printf("\tKey %d is set 128 bits\n", i); - break; - default: - printf("\tKey %d has an unknown size %d\n", i, k->klen); - break; + if (i < 4) { + switch (k->klen) { + case 0: + printf("\tKey %d is unset\n", i); + break; + case 5: + printf("\tKey %d is set 40 bits\n", i); + break; + case 13: + printf("\tKey %d is set 128 bits\n", i); + break; + default: + printf("\tKey %d has an unknown size %d\n", i, k->klen); + break; + } } - areq.an_type = AN_RID_WEP_PERMANENT; /* read next key */ } k->kindex = 0xffff; @@ -1405,6 +1408,10 @@ main(argc, argv) } arg = optarg; break; + case 'e': + act = ACT_SET_KEYS; + arg = optarg; + break; case 'f': act = ACT_SET_FRAG_THRESH; arg = optarg; |