o add support for setting 128-bit WEP keys

o use IEEE80211_KEYBUF_SIZE instead of magic numbers
o distinguish between 40-, 104-, and 128-bit WEP keys when printing status
This commit is contained in:
Sam Leffler 2003-09-17 19:27:43 +00:00
parent fd9469f628
commit 60ef637e8d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=120178

View File

@ -76,6 +76,7 @@
#include <net/if_types.h>
#include <net/route.h>
#include <net80211/ieee80211.h>
#include <net80211/ieee80211_crypto.h>
#include <net80211/ieee80211_ioctl.h>
#include <ctype.h>
@ -229,7 +230,7 @@ set80211wepkey(const char *val, int d, int s, const struct afswtch *rafp)
{
int key = 0;
int len;
u_int8_t data[14];
u_int8_t data[IEEE80211_KEYBUF_SIZE];
if (isdigit(val[0]) && val[1] == ':') {
key = atoi(val)-1;
@ -253,7 +254,7 @@ set80211nwkey(const char *val, int d, int s, const struct afswtch *rafp)
{
int txkey;
int i, len;
u_int8_t data[14];
u_int8_t data[IEEE80211_KEYBUF_SIZE];
set80211(s, IEEE80211_IOC_WEP, IEEE80211_WEP_ON, 0, NULL);
@ -427,10 +428,12 @@ ieee80211_status (int s, struct rt_addrinfo *info __unused)
warn("WEP support, but can get keys!");
goto end;
}
if (ireq.i_len == 0 || ireq.i_len > 13)
if (ireq.i_len == 0 ||
ireq.i_len > IEEE80211_KEYBUF_SIZE)
continue;
printf("%cwepkey %d:%s", spacer, i+1,
ireq.i_len <= 5 ? "64-bit" : "128-bit");
ireq.i_len <= 5 ? "40-bit" :
ireq.i_len <= 13 ? "104-bit" : "128-bit");
if (spacer == '\t')
spacer = ' ';
}