diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2018-02-05 08:44:14 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2018-02-05 08:44:14 +0000 |
commit | 1add52af22cdb43d3505d022d7d10839f7c15617 (patch) | |
tree | 7a7e08c975771ff9ae7605baf9a7b6918e370dcd /sys/net80211/ieee80211_proto.c | |
parent | 05cd6cb32f94ff6fc4b2e345f167e0d6660cd966 (diff) |
Add a new function hook to struct ieee80211com which wireless drivers
can use to process, and then acknowledge or reject, incoming AUTH
requests in hostap mode.
net80211 accepts an AUTH request from any STA which fits into the node
cache. This behaviour doesn't work for devices which have a lower limit
on concurrent STAs they can serve, so such drivers need an override.
This will be used by our athn(4) USB driver soon.
ok kevlo@
Diffstat (limited to 'sys/net80211/ieee80211_proto.c')
-rw-r--r-- | sys/net80211/ieee80211_proto.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c index 8f6d804ae77..397973e665d 100644 --- a/sys/net80211/ieee80211_proto.c +++ b/sys/net80211/ieee80211_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_proto.c,v 1.81 2017/12/08 21:16:01 stsp Exp $ */ +/* $OpenBSD: ieee80211_proto.c,v 1.82 2018/02/05 08:44:13 stsp Exp $ */ /* $NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $ */ /*- @@ -715,6 +715,24 @@ ieee80211_delba_request(struct ieee80211com *ic, struct ieee80211_node *ni, } } +#ifndef IEEE80211_STA_ONLY +void +ieee80211_auth_open_confirm(struct ieee80211com *ic, + struct ieee80211_node *ni, uint16_t seq) +{ + struct ifnet *ifp = &ic->ic_if; + + IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_AUTH, seq + 1); + if (ifp->if_flags & IFF_DEBUG) + printf("%s: station %s %s authenticated (open)\n", + ifp->if_xname, + ether_sprintf((u_int8_t *)ni->ni_macaddr), + ni->ni_state != IEEE80211_STA_CACHE ? + "newly" : "already"); + ieee80211_node_newstate(ni, IEEE80211_STA_AUTH); +} +#endif + void ieee80211_auth_open(struct ieee80211com *ic, const struct ieee80211_frame *wh, struct ieee80211_node *ni, struct ieee80211_rxinfo *rxi, u_int16_t seq, @@ -765,15 +783,16 @@ ieee80211_auth_open(struct ieee80211com *ic, const struct ieee80211_frame *wh, ni->ni_rstamp = rxi->rxi_tstamp; ni->ni_chan = ic->ic_bss->ni_chan; } - IEEE80211_SEND_MGMT(ic, ni, - IEEE80211_FC0_SUBTYPE_AUTH, seq + 1); - if (ifp->if_flags & IFF_DEBUG) - printf("%s: station %s %s authenticated (open)\n", - ifp->if_xname, - ether_sprintf((u_int8_t *)ni->ni_macaddr), - ni->ni_state != IEEE80211_STA_CACHE ? - "newly" : "already"); - ieee80211_node_newstate(ni, IEEE80211_STA_AUTH); + + /* + * Drivers may want to set up state before confirming. + * In which case this returns EBUSY and the driver will + * later call ieee80211_auth_open_confirm() by itself. + */ + if (ic->ic_newauth && ic->ic_newauth(ic, ni, + ni->ni_state != IEEE80211_STA_CACHE, seq) != 0) + break; + ieee80211_auth_open_confirm(ic, ni, seq); break; #endif /* IEEE80211_STA_ONLY */ |