diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2020-12-02 17:06:36 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2020-12-02 17:06:36 +0000 |
commit | 2c60c82670b060b4761e71d89e858876d8daf216 (patch) | |
tree | 77e1793d769b05f052061b62a12e0b39e7947125 /sys/dev/ic | |
parent | dbe3671951f111d2d03ca2e47e1ffb5cfe30e01f (diff) |
Extract another couple of chunks from main() into helper functions,
get_routefd() and set_user().
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/bwfm.c | 16 | ||||
-rw-r--r-- | sys/dev/ic/bwfmvar.h | 3 |
2 files changed, 16 insertions, 3 deletions
diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index fc5899130ff..af901a4330a 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfm.c,v 1.77 2020/11/16 17:12:55 patrick Exp $ */ +/* $OpenBSD: bwfm.c,v 1.78 2020/12/02 17:06:35 krw Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se> @@ -2607,7 +2607,8 @@ bwfm_set_key(struct ieee80211com *ic, struct ieee80211_node *ni, cmd.ni = ni; cmd.k = k; bwfm_do_async(sc, bwfm_set_key_cb, &cmd, sizeof(cmd)); - return 0; + sc->sc_key_tasks++; + return EBUSY; } void @@ -2616,10 +2617,13 @@ bwfm_set_key_cb(struct bwfm_softc *sc, void *arg) struct bwfm_cmd_key *cmd = arg; struct ieee80211_key *k = cmd->k; struct ieee80211_node *ni = cmd->ni; + struct ieee80211com *ic = &sc->sc_ic; struct bwfm_wsec_key key; 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) @@ -2654,6 +2658,7 @@ bwfm_set_key_cb(struct bwfm_softc *sc, void *arg) default: printf("%s: cipher %x not supported\n", DEVNAME(sc), k->k_cipher); + ieee80211_new_state(ic, IEEE80211_S_SCAN, -1); return; } @@ -2661,6 +2666,13 @@ bwfm_set_key_cb(struct bwfm_softc *sc, void *arg) bwfm_fwvar_var_get_int(sc, "wsec", &wsec); wsec |= wsec_enable; bwfm_fwvar_var_set_int(sc, "wsec", wsec); + + 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; + ieee80211_set_link_state(ic, LINK_STATE_UP); + } } void diff --git a/sys/dev/ic/bwfmvar.h b/sys/dev/ic/bwfmvar.h index 7c0ccfcdc11..c91cca79ce5 100644 --- a/sys/dev/ic/bwfmvar.h +++ b/sys/dev/ic/bwfmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfmvar.h,v 1.20 2020/05/15 14:09:14 patrick Exp $ */ +/* $OpenBSD: bwfmvar.h,v 1.21 2020/12/02 17:06:35 krw Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se> @@ -172,6 +172,7 @@ struct bwfm_softc { u_char *sc_clm; size_t sc_clmsize; + int sc_key_tasks; }; void bwfm_attach(struct bwfm_softc *); |