From a6226bb44c7180df1e67b3f8231a734ff27d5a0a Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Sat, 25 Nov 2006 07:37:38 +0000 Subject: [PATCH] Ensure outbound data packets in hostap mode are delivered only to stations that are associated by making ieee80211_find_txnode return NULL when a unicast frame is to be delivered to an unassociated station. Obtained-from: FreeBSD (sam@freebsd.org) --- sys/netproto/802_11/wlan/ieee80211_node.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/sys/netproto/802_11/wlan/ieee80211_node.c b/sys/netproto/802_11/wlan/ieee80211_node.c index 44cf2fc4f0..992375d1e6 100644 --- a/sys/netproto/802_11/wlan/ieee80211_node.c +++ b/sys/netproto/802_11/wlan/ieee80211_node.c @@ -30,7 +30,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.48.2.10 2006/03/13 03:05:47 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_node.c,v 1.6 2006/09/05 03:48:12 dillon Exp $ + * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_node.c,v 1.7 2006/11/25 07:37:38 sephe Exp $ */ #include @@ -1453,10 +1453,22 @@ ieee80211_find_txnode(struct ieee80211com *ic, const uint8_t *macaddr) * also optimize station mode operation, all frames go * to the bss node. */ - if (ic->ic_opmode == IEEE80211_M_STA || IEEE80211_IS_MULTICAST(macaddr)) + if (ic->ic_opmode == IEEE80211_M_STA || + IEEE80211_IS_MULTICAST(macaddr)) { ni = ieee80211_ref_node(ic->ic_bss); - else + } else { ni = _ieee80211_find_node(nt, macaddr); + if (ic->ic_opmode == IEEE80211_M_HOSTAP && + (ni != NULL && ni->ni_associd == 0)) { + /* + * Station is not associated; don't permit the + * data frame to be sent by returning NULL. This + * is kinda a kludge but the least intrusive way + * to add this check into all drivers. + */ + ieee80211_unref_node(&ni); /* NB: null's ni */ + } + } if (ni == NULL) { if (ic->ic_opmode == IEEE80211_M_IBSS || -- 2.41.0