summaryrefslogtreecommitdiff
path: root/sys/dev/ic/bwfm.c
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2023-03-15 22:47:36 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2023-03-15 22:47:36 +0000
commit1081683e40168dc8c0b893760058adc0fcdb9930 (patch)
treeaed196fc3c8d995cd66084c7942be9b03e19bc30 /sys/dev/ic/bwfm.c
parent072110a540f82c7471377303799c320d3e6bb769 (diff)
make WEP encryption work on bwfm(4)
based on an initial diff by jsg@ brokenness pointed out by kn@ ok jsg@
Diffstat (limited to 'sys/dev/ic/bwfm.c')
-rw-r--r--sys/dev/ic/bwfm.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c
index 56c8e2365b5..a5e6d0788da 100644
--- a/sys/dev/ic/bwfm.c
+++ b/sys/dev/ic/bwfm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bwfm.c,v 1.106 2022/12/30 16:49:34 kettenis Exp $ */
+/* $OpenBSD: bwfm.c,v 1.107 2023/03/15 22:47:35 stsp Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
* Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se>
@@ -199,6 +199,7 @@ bwfm_attach(struct bwfm_softc *sc)
ic->ic_state = IEEE80211_S_INIT;
ic->ic_caps =
+ IEEE80211_C_WEP |
#ifndef IEEE80211_STA_ONLY
IEEE80211_C_HOSTAP | /* Access Point */
#endif
@@ -2001,8 +2002,7 @@ bwfm_connect(struct bwfm_softc *sc)
uint8_t *frm;
/*
- * OPEN: Open or WPA/WPA2 on newer Chips/Firmware.
- * SHARED KEY: WEP.
+ * OPEN: Open or WEP or WPA/WPA2 on newer Chips/Firmware.
* AUTO: Automatic, probably for older Chips/Firmware.
*/
if (ic->ic_flags & IEEE80211_F_RSNON) {
@@ -2041,6 +2041,9 @@ bwfm_connect(struct bwfm_softc *sc)
bwfm_fwvar_var_set_int(sc, "wpa_auth", wpa);
bwfm_fwvar_var_set_int(sc, "wsec", wsec);
+ } else if (ic->ic_flags & IEEE80211_F_WEPON) {
+ bwfm_fwvar_var_set_int(sc, "wpa_auth", BWFM_WPA_AUTH_DISABLED);
+ bwfm_fwvar_var_set_int(sc, "wsec", BWFM_WSEC_WEP);
} else {
bwfm_fwvar_var_set_int(sc, "wpa_auth", BWFM_WPA_AUTH_DISABLED);
bwfm_fwvar_var_set_int(sc, "wsec", BWFM_WSEC_NONE);
@@ -2083,8 +2086,7 @@ bwfm_hostap(struct bwfm_softc *sc)
struct bwfm_join_params join;
/*
- * OPEN: Open or WPA/WPA2 on newer Chips/Firmware.
- * SHARED KEY: WEP.
+ * OPEN: Open or WEP or WPA/WPA2 on newer Chips/Firmware.
* AUTO: Automatic, probably for older Chips/Firmware.
*/
if (ic->ic_flags & IEEE80211_F_RSNON) {
@@ -2883,10 +2885,12 @@ bwfm_set_key_cb(struct bwfm_softc *sc, void *arg)
bwfm_fwvar_var_set_data(sc, "wsec_key", &key, sizeof(key));
bwfm_fwvar_var_get_int(sc, "wsec", &wsec);
+ wsec &= ~(BWFM_WSEC_WEP | BWFM_WSEC_TKIP | BWFM_WSEC_AES);
wsec |= wsec_enable;
bwfm_fwvar_var_set_int(sc, "wsec", wsec);
- if (sc->sc_key_tasks == 0) {
+ if (wsec_enable != BWFM_WSEC_WEP && cmd->ni != NULL &&
+ sc->sc_key_tasks == 0) {
DPRINTF(("%s: marking port %s valid\n", DEVNAME(sc),
ether_sprintf(cmd->ni->ni_macaddr)));
cmd->ni->ni_port_valid = 1;