From 9cecaef7d629134e73a4be21d0ca6e89f3fd0ebe Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Sun, 29 Mar 2015 06:05:00 +0000 Subject: [PATCH] Fix a long-standing bug with the early MAC address initialisation path, which showed up after I started changing addresses this early. It turns out that there's some other malarky going on behind the scenes in the HAL and merely setting the net80211/ifp mac address this early isn't enough. If the MAC is set from kenv at attach time, the HAL also needs to be programmed early. Without this, the VAP wouldn't work enough for finishing association - probe requests would be fine as they're broadcast, but association request would fail. --- sys/dev/ath/if_ath.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index c35651e2ead..ecf9da5a3c4 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -1204,8 +1204,12 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) sc->sc_hasveol = ath_hal_hasveol(ah); /* get mac address from kenv first, then hardware */ - if (ath_fetch_mac_kenv(sc, macaddr) < 0) + if (ath_fetch_mac_kenv(sc, macaddr) == 0) { + /* Tell the HAL now about the new MAC */ + ath_hal_setmac(ah, macaddr); + } else { ath_hal_getmac(ah, macaddr); + } if (sc->sc_hasbmask) ath_hal_getbssidmask(ah, sc->sc_hwbssidmask);