diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index 48d56d0ad217..31a96c7840af 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -2051,12 +2051,43 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, #undef ISREASSOC } +/* + * Check the RA of the given frame. + * + * This is just a temporary hack check for control frame handling. + * It's definitely not enough for full processing. + */ +static bool +_check_ra(struct ieee80211_node *ni, const struct mbuf *m) +{ + struct ieee80211vap *vap = ni->ni_vap; + struct ifnet *ifp = vap->iv_ifp; + const struct ieee80211_frame *wh; + + wh = mtod(m, const struct ieee80211_frame *); + return (IEEE80211_ADDR_EQ(wh->i_addr1, IF_LLADDR(ifp))); +} + static void sta_recv_ctl(struct ieee80211_node *ni, struct mbuf *m, int subtype) { + struct ieee80211vap *vap = ni->ni_vap; + const struct ieee80211_frame *wh; + + wh = mtod(m, const struct ieee80211_frame *); + switch (subtype) { case IEEE80211_FC0_SUBTYPE_BAR: - ieee80211_recv_bar(ni, m); + if (_check_ra(ni, m)) + ieee80211_recv_bar(ni, m); + else + ic_printf(vap->iv_ic, + "%s: ignoring BAR not meant for us (%6D->%6D)\n", + __func__, + wh->i_addr2, + ":", + wh->i_addr1, + ":"); break; } }