> Date: Thu, 11 Jun 2020 10:48:09 +0200
> From: Stefan Sperling <[email protected]>
>
> I spotted this while working on iwx(4).
>
> Setting up ic_myaddr when we're about to scan for APs is rather late in
> the game. All these drivers are already setting up ic_myaddr during the
> device initialization phase, long before they get here.
>
> This seems to be a copy-paste error in iwn(4) originally.
> The older wpi(4) driver has similar code which doesn't have this.
>
> ok?
Hmm, won't this affect the ability to changed the lladdr while the
interface is up?
> diff 66ecf2e2f524653126dce17a447a43b26ee90abb /usr/src
> blob - 69c252f4e8a6283d2e7f22c7b815feb769a4c694
> file + sys/dev/pci/if_iwm.c
> --- sys/dev/pci/if_iwm.c
> +++ sys/dev/pci/if_iwm.c
> @@ -5610,7 +5610,6 @@ int
> iwm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq)
> {
> struct ieee80211com *ic = &sc->sc_ic;
> - struct ifnet *ifp = IC2IFP(ic);
> struct ieee80211_frame *wh = (struct ieee80211_frame *)preq->buf;
> struct ieee80211_rateset *rs;
> size_t remain = sizeof(preq->buf);
> @@ -5628,7 +5627,6 @@ iwm_fill_probe_req(struct iwm_softc *sc, struct iwm_sc
> wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_MGT |
> IEEE80211_FC0_SUBTYPE_PROBE_REQ;
> wh->i_fc[1] = IEEE80211_FC1_DIR_NODS;
> - IEEE80211_ADDR_COPY(ic->ic_myaddr, LLADDR(ifp->if_sadl));
> IEEE80211_ADDR_COPY(wh->i_addr1, etherbroadcastaddr);
> IEEE80211_ADDR_COPY(wh->i_addr2, ic->ic_myaddr);
> IEEE80211_ADDR_COPY(wh->i_addr3, etherbroadcastaddr);
> blob - 76bdd28a6d3b3f392fabb05fcd726d86976ec43e
> file + sys/dev/pci/if_iwn.c
> --- sys/dev/pci/if_iwn.c
> +++ sys/dev/pci/if_iwn.c
> @@ -5190,7 +5190,6 @@ iwn_scan(struct iwn_softc *sc, uint16_t flags, int bgs
> struct ieee80211_frame *wh;
> struct ieee80211_rateset *rs;
> struct ieee80211_channel *c;
> - struct ifnet *ifp = &ic->ic_if;
> uint8_t *buf, *frm;
> uint16_t rxchain, dwell_active, dwell_passive;
> uint8_t txant;
> @@ -5294,7 +5293,6 @@ iwn_scan(struct iwn_softc *sc, uint16_t flags, int bgs
> wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_MGT |
> IEEE80211_FC0_SUBTYPE_PROBE_REQ;
> wh->i_fc[1] = IEEE80211_FC1_DIR_NODS;
> - IEEE80211_ADDR_COPY(ic->ic_myaddr, LLADDR(ifp->if_sadl));
> IEEE80211_ADDR_COPY(wh->i_addr1, etherbroadcastaddr);
> IEEE80211_ADDR_COPY(wh->i_addr2, ic->ic_myaddr);
> IEEE80211_ADDR_COPY(wh->i_addr3, etherbroadcastaddr);
> blob - c3ca08c7a726326e37cda8645596a176051b6cf4
> file + sys/dev/pci/if_iwx.c
> --- sys/dev/pci/if_iwx.c
> +++ sys/dev/pci/if_iwx.c
> @@ -4705,7 +4705,6 @@ int
> iwx_fill_probe_req(struct iwx_softc *sc, struct iwx_scan_probe_req *preq)
> {
> struct ieee80211com *ic = &sc->sc_ic;
> - struct ifnet *ifp = IC2IFP(ic);
> struct ieee80211_frame *wh = (struct ieee80211_frame *)preq->buf;
> struct ieee80211_rateset *rs;
> size_t remain = sizeof(preq->buf);
> @@ -4723,7 +4722,6 @@ iwx_fill_probe_req(struct iwx_softc *sc, struct iwx_sc
> wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_MGT |
> IEEE80211_FC0_SUBTYPE_PROBE_REQ;
> wh->i_fc[1] = IEEE80211_FC1_DIR_NODS;
> - IEEE80211_ADDR_COPY(ic->ic_myaddr, LLADDR(ifp->if_sadl));
> IEEE80211_ADDR_COPY(wh->i_addr1, etherbroadcastaddr);
> IEEE80211_ADDR_COPY(wh->i_addr2, ic->ic_myaddr);
> IEEE80211_ADDR_COPY(wh->i_addr3, etherbroadcastaddr);
>
>