On Fri, May 07, 2021 at 10:27:36PM +0000, Mikolaj Kucharski wrote:
> Yes, I see ieee80211_encap: data frame for node... messages in
> dmesg. Two dmesgs, from two PC Engines machines, in two different
> locations, 150+km apart, below.
> 
> Uptime of 12 minutes as hostap from pce-0041:

> athn0: AR9280 rev 2 (2T2R), ROM rev 22, address 04:f0:21:34:e4:23

> ieee80211_encap: data frame for node 04:f0:21:34:e4:23 in state 0

Ooops, sorry I made a mistake. This is the MAC address of the AP itself.
The new check I am adding here should obviously exclude the AP itself.
Otherwise your AP won't work very well because it blocks its own broadcasts.

Fixed patch, with the condition ni != ic->ic_bss added:

diff b412d6f4250f42e50e0333dbcedab9189b4b19e2 /usr/src
blob - 58f654273f7ea0cc3c04e0a60d5e5e6a33296dc0
file + sys/net80211/ieee80211_output.c
--- sys/net80211/ieee80211_output.c
+++ sys/net80211/ieee80211_output.c
@@ -556,6 +556,16 @@ ieee80211_encap(struct ifnet *ifp, struct mbuf *m, str
                goto bad;
        }
 
+#ifndef IEEE80211_STA_ONLY
+       if (ic->ic_opmode == IEEE80211_M_HOSTAP && ni != ic->ic_bss &&
+           ni->ni_state != IEEE80211_STA_ASSOC) {
+               printf("%s: data frame for node %s in state %d\n",
+                   __func__, ether_sprintf(ni->ni_macaddr), ni->ni_state);
+               ic->ic_stats.is_tx_nonode++;
+               goto bad;
+       }
+#endif
+
        if ((ic->ic_flags & IEEE80211_F_RSNON) &&
            !ni->ni_port_valid &&
            eh.ether_type != htons(ETHERTYPE_PAE)) {

Reply via email to