Date: Tue, 3 Feb 2009 22:32:26 +0000 (UTC) From: Sam Leffler <sam@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r188106 - head/sys/net80211 Message-ID: <200902032232.n13MWQpm044102@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sam Date: Tue Feb 3 22:32:26 2009 New Revision: 188106 URL: http://svn.freebsd.org/changeset/base/188106 Log: When crafting a media setting w/ an auto (non-fixed) rate mask out the turbo option in addition to the mode bits; otherwise if the current channel is a turbo mode channel we'll form an invalid media setting and the ifmedia_set operation in vap_attach will panic. While here use C99-style initialization for an array indexed by mode; this makes it consistent w/ other usage and avoids breakage if we should ever change the set of modes. Modified: head/sys/net80211/ieee80211.c Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Tue Feb 3 22:22:07 2009 (r188105) +++ head/sys/net80211/ieee80211.c Tue Feb 3 22:32:26 2009 (r188106) @@ -472,7 +472,8 @@ ieee80211_vap_attach(struct ieee80211vap vap->iv_opmode == IEEE80211_M_STA, media_change, media_stat); ieee80211_media_status(ifp, &imr); /* NB: strip explicit mode; we're actually in autoselect */ - ifmedia_set(&vap->iv_media, imr.ifm_active &~ IFM_MMASK); + ifmedia_set(&vap->iv_media, + imr.ifm_active &~ (IFM_MMASK | IFM_IEEE80211_TURBO)); if (maxrate) ifp->if_baudrate = IF_Mbps(maxrate); @@ -857,16 +858,16 @@ addmedia(struct ifmedia *media, int caps ifmedia_add(media, \ IFM_MAKEWORD(IFM_IEEE80211, (_s), (_o), 0), 0, NULL) static const u_int mopts[IEEE80211_MODE_MAX] = { - IFM_AUTO, - IFM_IEEE80211_11A, - IFM_IEEE80211_11B, - IFM_IEEE80211_11G, - IFM_IEEE80211_FH, - IFM_IEEE80211_11A | IFM_IEEE80211_TURBO, - IFM_IEEE80211_11G | IFM_IEEE80211_TURBO, - IFM_IEEE80211_11A | IFM_IEEE80211_TURBO, - IFM_IEEE80211_11NA, - IFM_IEEE80211_11NG, + [IEEE80211_MODE_AUTO] = IFM_AUTO, + [IEEE80211_MODE_11A] = IFM_IEEE80211_11A, + [IEEE80211_MODE_11B] = IFM_IEEE80211_11B, + [IEEE80211_MODE_11G] = IFM_IEEE80211_11G, + [IEEE80211_MODE_FH] = IFM_IEEE80211_FH, + [IEEE80211_MODE_TURBO_A] = IFM_IEEE80211_11A|IFM_IEEE80211_TURBO, + [IEEE80211_MODE_TURBO_G] = IFM_IEEE80211_11G|IFM_IEEE80211_TURBO, + [IEEE80211_MODE_STURBO_A] = IFM_IEEE80211_11A|IFM_IEEE80211_TURBO, + [IEEE80211_MODE_11NA] = IFM_IEEE80211_11NA, + [IEEE80211_MODE_11NG] = IFM_IEEE80211_11NG, }; u_int mopt; @@ -996,7 +997,8 @@ ieee80211_media_init(struct ieee80211com ieee80211com_media_change, ieee80211com_media_status); /* NB: strip explicit mode; we're actually in autoselect */ ifmedia_set(&ic->ic_media, - media_status(ic->ic_opmode, ic->ic_curchan) &~ IFM_MMASK); + media_status(ic->ic_opmode, ic->ic_curchan) &~ + (IFM_MMASK | IFM_IEEE80211_TURBO)); if (maxrate) ifp->if_baudrate = IF_Mbps(maxrate);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902032232.n13MWQpm044102>