On Tue, Mar 14, 2023 at 01:37:28PM +0100, Stefan Sperling wrote:
> On Tue, Mar 14, 2023 at 12:19:10PM +0000, Klemens Nanni wrote:
> > Here is an yet untested WEP removal diff based on 'grep WEP' in case we go
> > this way rather than fixing WEP.
> 
> Did you test wether adding the WEP capability flag to the driver is
> sufficient? If you have a hostap-capable interface like athn(4) and
> a bwfm(4) client it is trvial to create a test setup for this. Just
> use static IPs on AP and client and try get to a ping through.
> 
> I would encourage you to at least try to fix WEP instead of axing
> things that would need to be reinstated once it's been fixed.
> Maybe one day you will be traveling and depend on bwfm(4) to connect
> to some WEP-only hotspot and then you will be happy to have fixed it ;)

It isn't enough.

panic'd without 'if (cmd->ni != NULL)'

I started on this, but didn't get to a point where it could
pass traffic to another machine running hostap.

Perhaps it would be easier to do software WEP.

incomplete diff:

Index: bwfm.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/bwfm.c,v
retrieving revision 1.106
diff -u -p -r1.106 bwfm.c
--- bwfm.c      30 Dec 2022 16:49:34 -0000      1.106
+++ bwfm.c      8 Mar 2023 14:42:57 -0000
@@ -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
@@ -2041,10 +2042,14 @@ 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);
        }
+
        bwfm_fwvar_var_set_int(sc, "auth", BWFM_AUTH_OPEN);
        bwfm_fwvar_var_set_int(sc, "mfp", BWFM_MFP_NONE);
 
@@ -2839,13 +2844,13 @@ bwfm_set_key_cb(struct bwfm_softc *sc, v
        uint32_t wsec, wsec_enable;
        int ext_key = 0;
 
+
        sc->sc_key_tasks--;
 
        if ((k->k_flags & IEEE80211_KEY_GROUP) == 0 &&
            k->k_cipher != IEEE80211_CIPHER_WEP40 &&
            k->k_cipher != IEEE80211_CIPHER_WEP104)
                ext_key = 1;
-
        memset(&key, 0, sizeof(key));
        if (ext_key && !IEEE80211_IS_MULTICAST(ni->ni_macaddr))
                memcpy(key.ea, ni->ni_macaddr, sizeof(key.ea));
@@ -2889,7 +2894,8 @@ bwfm_set_key_cb(struct bwfm_softc *sc, v
        if (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;
+               if (cmd->ni != NULL)
+                       cmd->ni->ni_port_valid = 1;
                ieee80211_set_link_state(ic, LINK_STATE_UP);
        }
 }

Reply via email to