summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2015-09-27 16:53:39 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2015-09-27 16:53:39 +0000
commitb88f8f6a671ecdb25858eafb432edf13574523dc (patch)
tree90a1cf4ea034f3e0f8d68a584aba65da4c91b89e /sys
parentc392cdfbcc8c4566f558dfb757278d8de06746fb (diff)
Fix bsd.rd upgrades over iwm(4), and fix `ifconfig iwm0 lladdr random`.
The bsd.rd problems happened because of the net80211 detach/attach hack which ran when the firmware is loaded for the first time. Do the minimum of what needs to be done instead. To fix lladdr random pick up a changing MAC address in the ioctl handler and don't overwrite a custom MAC address while loading the firmware. ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_iwm.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index af0429b8a06..3d9eee6fbbd 100644
--- a/sys/dev/pci/if_iwm.c
+++ b/sys/dev/pci/if_iwm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwm.c,v 1.50 2015/09/27 16:52:35 stsp Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.51 2015/09/27 16:53:38 stsp Exp $ */
/*
* Copyright (c) 2014 genua mbh <info@genua.de>
@@ -2803,8 +2803,10 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justnvm)
printf("%s: failed to read nvm\n", DEVNAME(sc));
return error;
}
- memcpy(&sc->sc_ic.ic_myaddr,
- &sc->sc_nvm.hw_addr, ETHER_ADDR_LEN);
+
+ if (IEEE80211_ADDR_EQ(etheranyaddr, sc->sc_ic.ic_myaddr))
+ IEEE80211_ADDR_COPY(sc->sc_ic.ic_myaddr,
+ sc->sc_nvm.hw_addr);
sc->sc_scan_cmd_len = sizeof(struct iwm_scan_cmd)
+ sc->sc_capa_max_probe_len
@@ -5757,6 +5759,11 @@ iwm_ioctl(struct ifnet *ifp, u_long cmd, iwm_caddr_t data)
error = 0;
break;
+ case SIOCSIFLLADDR:
+ IEEE80211_ADDR_COPY(sc->sc_ic.ic_myaddr,
+ ((struct arpcom *)ifp)->ac_enaddr);
+ break;
+
default:
error = ieee80211_ioctl(ifp, cmd, data);
}
@@ -6373,9 +6380,14 @@ iwm_preinit(struct iwm_softc *sc)
memset(&ic->ic_sup_rates[IEEE80211_MODE_11A], 0,
sizeof(ic->ic_sup_rates[IEEE80211_MODE_11A]));
- /* Reattach net80211 so MAC address and channel map are picked up. */
- ieee80211_ifdetach(ifp);
- ieee80211_ifattach(ifp);
+ /* Configure channel information obtained from firmware. */
+ ieee80211_channel_init(ifp);
+
+ /* Configure MAC address. */
+ error = if_setlladdr(ifp, ic->ic_myaddr);
+ if (error)
+ printf("%s: could not set MAC address (error %d)\n",
+ DEVNAME(sc), error);
ic->ic_node_alloc = iwm_node_alloc;