> X-Envelope-From: [email protected]
> X-Envelope-To: <[email protected]>
> Date: Fri, 16 Jun 2017 15:50:24 +0200
> From: Stefan Sperling <[email protected]>
> Mail-Followup-To: [email protected]
> Content-Disposition: inline
> List-Owner: <mailto:[email protected]>
> X-Loop: [email protected]
> Sender: [email protected]
> X-CNFS-Analysis: v=2.2 cv=X8AQEybe c=1 sm=0 tr=0
>       a=A3duGc4wJ8K8BtNzzvyz4A==:117 a=A3duGc4wJ8K8BtNzzvyz4A==:17
>       a=kj9zAlcOel0A:10 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10
>       a=LWSFodeU3zMA:10 a=9vQTC7IF3B0A:10 a=ZZnuYtJkoWoA:10
>       a=FejnlcmcWjXD4WlFsZAA:9 a=CjuIK1q_8ugA:10
> X-Virus-Scanned: by XS4ALL Virus Scanner
> X-XS4ALL-Spam-Score: -0.5 () RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS,
>       T_HEADER_FROM_DIFFERENT_DOMAINS, UNPARSEABLE_RELAY
> X-XS4ALL-Spam: NO
> Envelope-To: [email protected]
> 
> Set the link state of wifi interfaces to DOWN at attach time
> instead of leaving it as UNKNOWN which userland cannot really
> make use of (e.g. dhclient interprets UNKNOWN as UP).
> 
> Link state is also reset by the ieee80211_newstate() function.
> However, that function is usually called by the driver-specific newstate
> function stored in ic->ic_newstate. During the very first time ic_newstate()
> runs, without the diff below the link state is UNKNOWN. And if a driver
> decides not to call ieee80211_newstate() for some reason (such as iwm(4)
> does during INIT->SCAN) the link state will still be UNKNOWN.
> 
> In my opinion the link state of wifi interfaces should at any time
> be either DOWN or UP, and never UNKNOWN.
> 
> ok?

Makes sense to me.  Even if the firmware would initialize the hardware
I don't think we'd ever want to take over that state.

> Index: sys/net80211/ieee80211.c
> ===================================================================
> RCS file: /cvs/src/sys/net80211/ieee80211.c,v
> retrieving revision 1.61
> diff -u -p -r1.61 ieee80211.c
> --- sys/net80211/ieee80211.c  31 May 2017 09:17:39 -0000      1.61
> +++ sys/net80211/ieee80211.c  7 Jun 2017 15:08:55 -0000
> @@ -156,6 +156,8 @@ ieee80211_ifattach(struct ifnet *ifp)
>  
>       if_addgroup(ifp, "wlan");
>       ifp->if_priority = IF_WIRELESS_DEFAULT_PRIORITY;
> +
> +     ieee80211_set_link_state(ic, LINK_STATE_DOWN);
>  }
>  
>  void
> 
> 

Reply via email to