of whether the wifi interface happens to be leaving RUN state. The interface
is never usable during state transitions so setting the link DOWN is the only
reasonable option when any transition is triggered.
Fixes a problem where, at boot time, the link state of wifi interfaces was
reported to userland as UNKNOWN (which, curiously, has value 0). dhclient's
link detection logic was recently changed from ifmedia to getifaddrs which
exposed the UNKOWN link state. Since dhclient assumes an UNKNOWN link state
means UP it would start trying to negotiate a lease too early during boot.
Problem reported by tb@
ok krw@
-/* $OpenBSD: ieee80211_proto.c,v 1.74 2017/03/02 09:41:27 stsp Exp $ */
+/* $OpenBSD: ieee80211_proto.c,v 1.75 2017/05/30 10:50:33 stsp Exp $ */
/* $NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $ */
/*-
ieee80211_state_name[nstate]));
ic->ic_state = nstate; /* state transition */
ni = ic->ic_bss; /* NB: no reference held */
- if (ostate == IEEE80211_S_RUN)
- ieee80211_set_link_state(ic, LINK_STATE_DOWN);
+ ieee80211_set_link_state(ic, LINK_STATE_DOWN);
switch (nstate) {
case IEEE80211_S_INIT:
/*