diff options
Diffstat (limited to 'sys/dev/usb/if_rsu.c')
-rw-r--r-- | sys/dev/usb/if_rsu.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/dev/usb/if_rsu.c b/sys/dev/usb/if_rsu.c index 1d9e4975133..a2d7b48749a 100644 --- a/sys/dev/usb/if_rsu.c +++ b/sys/dev/usb/if_rsu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rsu.c,v 1.47 2020/07/31 10:49:32 mglocker Exp $ */ +/* $OpenBSD: if_rsu.c,v 1.48 2020/11/30 16:09:33 krw Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -898,17 +898,22 @@ rsu_set_key(struct ieee80211com *ic, struct ieee80211_node *ni, /* Do it in a process context. */ cmd.key = *k; + cmd.ni = ni; rsu_do_async(sc, rsu_set_key_cb, &cmd, sizeof(cmd)); - return (0); + sc->sc_key_tasks++; + return EBUSY; } void rsu_set_key_cb(struct rsu_softc *sc, void *arg) { struct rsu_cmd_key *cmd = arg; + struct ieee80211com *ic = &sc->sc_ic; struct ieee80211_key *k = &cmd->key; struct r92s_fw_cmd_set_key key; + sc->sc_key_tasks--; + memset(&key, 0, sizeof(key)); /* Map net80211 cipher to HW crypto algorithm. */ switch (k->k_cipher) { @@ -925,12 +930,22 @@ rsu_set_key_cb(struct rsu_softc *sc, void *arg) key.algo = R92S_KEY_ALGO_AES; break; default: + IEEE80211_SEND_MGMT(ic, cmd->ni, IEEE80211_FC0_SUBTYPE_DEAUTH, + IEEE80211_REASON_AUTH_LEAVE); + ieee80211_new_state(ic, IEEE80211_S_SCAN, -1); return; } key.id = k->k_id; key.grpkey = (k->k_flags & IEEE80211_KEY_GROUP) != 0; memcpy(key.key, k->k_key, MIN(k->k_len, sizeof(key.key))); (void)rsu_fw_cmd(sc, R92S_CMD_SET_KEY, &key, sizeof(key)); + + if (sc->sc_key_tasks == 0) { + DPRINTF(("marking port %s valid\n", + ether_sprintf(cmd->ni->ni_macaddr))); + cmd->ni->ni_port_valid = 1; + ieee80211_set_link_state(ic, LINK_STATE_UP); + } } /* ARGSUSED */ |