Page MenuHomeFreeBSD

D48172.diff
No OneTemporary

D48172.diff

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -1329,16 +1329,16 @@
struct lkpi_hw *lhw;
chan = NULL;
- if (ni != NULL && ni->ni_chan != IEEE80211_CHAN_ANYC)
+ if (ni != NULL && !NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan))
c = ni->ni_chan;
- else if (ic->ic_bsschan != IEEE80211_CHAN_ANYC)
+ else if (!NET80211_CHANNEL_P_IS_ANYC(ic->ic_bsschan))
c = ic->ic_bsschan;
- else if (ic->ic_curchan != IEEE80211_CHAN_ANYC)
+ else if (!NET80211_CHANNEL_P_IS_ANYC(ic->ic_curchan))
c = ic->ic_curchan;
else
c = NULL;
- if (c != NULL && c != IEEE80211_CHAN_ANYC) {
+ if (NET80211_CHANNEL_P_IS_DEFINED(c) && !NET80211_CHANNEL_P_IS_ANYC(c)) {
lhw = ic->ic_softc;
chan = lkpi_find_lkpi80211_chan(lhw, c);
}
@@ -2577,7 +2577,8 @@
* the fact that the iv_bss can be swapped under the hood in (*iv_update_bss).
*/
ni = ieee80211_ref_node(vap->iv_bss);
- if (ni->ni_chan == NULL || ni->ni_chan == IEEE80211_CHAN_ANYC) {
+ if (!NET80211_CHANNEL_P_IS_DEFINED(ni->ni_chan) ||
+ NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan)) {
ic_printf(vap->iv_ic, "%s: no channel set for iv_bss ni %p "
"on vap %p\n", __func__, ni, vap);
ieee80211_free_node(ni); /* Error handling for the local ni. */
@@ -2617,7 +2618,8 @@
/* Add chanctx (or if exists, change it). */
chanctx_conf = lkpi_get_chanctx_conf(hw, vif);
- KASSERT(ni->ni_chan != NULL && ni->ni_chan != IEEE80211_CHAN_ANYC,
+ KASSERT(NET80211_CHANNEL_P_IS_DEFINED(ni->ni_chan) &&
+ !NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan),
("%s:%d: ni %p ni_chan %p\n", __func__, __LINE__, ni, ni->ni_chan));
#ifdef LKPI_80211_HT
@@ -5203,14 +5205,14 @@
lhw = ic->ic_softc;
c = ic->ic_curchan;
- if (c == NULL || c == IEEE80211_CHAN_ANYC) {
+ if (!NET80211_CHANNEL_P_IS_DEFINED(c) || NET80211_CHANNEL_P_IS_ANYC(c)) {
ic_printf(ic, "%s: Unset channel: c %p, ignoring update\n",
__func__, c);
return;
}
chan = lkpi_find_lkpi80211_chan(lhw, c);
- if (chan == NULL) {
+ if (!NET80211_CHANNEL_P_IS_DEFINED(chan)) {
ic_printf(ic, "%s: No channel found for c %p(%d) chan %p\n",
__func__, c, c->ic_ieee, chan);
return;
@@ -5758,7 +5760,7 @@
rtap->wt_flags |= IEEE80211_RADIOTAP_F_FRAG;
IMPROVE();
rtap->wt_rate = 0;
- if (c != NULL && c != IEEE80211_CHAN_ANYC) {
+ if (NET80211_CHANNEL_P_IS_DEFINED(c) && !NET80211_CHANNEL_P_IS_ANYC(c)) {
rtap->wt_chan_freq = htole16(c->ic_freq);
rtap->wt_chan_flags = htole16(c->ic_flags);
}
@@ -5841,7 +5843,7 @@
info = IEEE80211_SKB_CB(skb);
info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
/* Slight delay; probably only happens on scanning so fine? */
- if (c == NULL || c == IEEE80211_CHAN_ANYC)
+ if (!NET80211_CHANNEL_P_IS_DEFINED(c) || NET80211_CHANNEL_P_IS_ANYC(c))
c = ic->ic_curchan;
info->band = lkpi_net80211_chan_to_nl80211_band(c);
info->hw_queue = vif->hw_queue[ac];
diff --git a/sys/dev/iwm/if_iwm_power.c b/sys/dev/iwm/if_iwm_power.c
--- a/sys/dev/iwm/if_iwm_power.c
+++ b/sys/dev/iwm/if_iwm_power.c
@@ -237,7 +237,7 @@
boolean_t radar_detect = FALSE;
chan = ic->ic_bsschan;
- if (chan == IEEE80211_CHAN_ANYC ||
+ if (NET80211_CHANNEL_P_IS_ANYC(chan) ||
(chan->ic_flags & IEEE80211_CHAN_DFS) != 0) {
radar_detect = TRUE;
}
diff --git a/sys/dev/iwx/if_iwx.c b/sys/dev/iwx/if_iwx.c
--- a/sys/dev/iwx/if_iwx.c
+++ b/sys/dev/iwx/if_iwx.c
@@ -5536,7 +5536,7 @@
min = -1;
- if (c == IEEE80211_CHAN_ANYC) {
+ if (NET80211_CHANNEL_P_IS_ANYC(c)) {
printf("%s: channel is IEEE80211_CHAN_ANYC\n", __func__);
return -1;
}
@@ -6814,7 +6814,7 @@
uint8_t ofdm = 0;
int i;
- if (ni->ni_chan == IEEE80211_CHAN_ANYC ||
+ if (NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan) ||
IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) {
for (i = IWX_FIRST_CCK_RATE; i < IWX_FIRST_OFDM_RATE; i++) {
if ((iwx_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
@@ -7550,7 +7550,7 @@
uint16_t band_flags = (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ);
int err;
- if (chan == IEEE80211_CHAN_ANYC) {
+ if (NET80211_CHANNEL_P_IS_ANYC(chan)) {
printf("%s: GOS-3833: IEEE80211_CHAN_ANYC triggered\n",
DEVNAME(sc));
return EIO;
diff --git a/sys/dev/rtwn/if_rtwn.c b/sys/dev/rtwn/if_rtwn.c
--- a/sys/dev/rtwn/if_rtwn.c
+++ b/sys/dev/rtwn/if_rtwn.c
@@ -1138,7 +1138,7 @@
RTWN_DPRINTF(sc, RTWN_DEBUG_STATE, "%s -> %s\n",
ieee80211_state_name[ostate], ieee80211_state_name[nstate]);
- if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC &&
+ if (NET80211_CHANNEL_P_IS_ANYC(vap->iv_bss->ni_chan) &&
ostate == IEEE80211_S_INIT && nstate == IEEE80211_S_RUN) {
/* need to call iv_newstate() firstly */
error = uvp->newstate(vap, nstate, arg);
@@ -1315,7 +1315,7 @@
basicrates |= (htrates << RTWN_RIDX_HT_MCS_SHIFT);
/* Filter out undesired high rates */
- if (ni->ni_chan != IEEE80211_CHAN_ANYC &&
+ if (!NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan) &&
IEEE80211_IS_CHAN_5GHZ(ni->ni_chan))
basicrates &= R92C_RRSR_RATE_MASK_5GHZ;
else
@@ -1348,8 +1348,8 @@
error = 0;
ni = ieee80211_ref_node(vap->iv_bss);
- if (ic->ic_bsschan == IEEE80211_CHAN_ANYC ||
- ni->ni_chan == IEEE80211_CHAN_ANYC) {
+ if (NET80211_CHANNEL_P_IS_ANYC(ic->ic_bsschan) ||
+ NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan)) {
error = EINVAL;
goto fail;
}
diff --git a/sys/dev/rtwn/if_rtwn_beacon.c b/sys/dev/rtwn/if_rtwn_beacon.c
--- a/sys/dev/rtwn/if_rtwn_beacon.c
+++ b/sys/dev/rtwn/if_rtwn_beacon.c
@@ -110,7 +110,7 @@
RTWN_ASSERT_LOCKED(sc);
- if (ni->ni_chan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan))
return (EINVAL);
m = ieee80211_beacon_alloc(ni);
diff --git a/sys/dev/rtwn/rtl8192c/r92c_chan.c b/sys/dev/rtwn/rtl8192c/r92c_chan.c
--- a/sys/dev/rtwn/rtl8192c/r92c_chan.c
+++ b/sys/dev/rtwn/rtl8192c/r92c_chan.c
@@ -301,7 +301,7 @@
{
if (vap->iv_bss == NULL)
return (EINVAL);
- if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(vap->iv_bss->ni_chan))
return (EINVAL);
/* Set it for the current channel */
diff --git a/sys/dev/rtwn/rtl8192e/r92e_chan.c b/sys/dev/rtwn/rtl8192e/r92e_chan.c
--- a/sys/dev/rtwn/rtl8192e/r92e_chan.c
+++ b/sys/dev/rtwn/rtl8192e/r92e_chan.c
@@ -176,7 +176,7 @@
if (vap->iv_bss == NULL)
return (EINVAL);
- if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(vap->iv_bss->ni_chan))
return (EINVAL);
r92e_set_txpower(sc, vap->iv_bss->ni_chan);
diff --git a/sys/dev/usb/wlan/if_mtw.c b/sys/dev/usb/wlan/if_mtw.c
--- a/sys/dev/usb/wlan/if_mtw.c
+++ b/sys/dev/usb/wlan/if_mtw.c
@@ -1791,7 +1791,7 @@
if (vap->iv_opmode != IEEE80211_M_MONITOR) {
struct ieee80211_node *ni;
- if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) {
+ if (NET80211_CHANNEL_P_IS_ANYC(ic->ic_bsschan)) {
MTW_UNLOCK(sc);
IEEE80211_LOCK(ic);
return (-1);
@@ -3861,9 +3861,9 @@
struct mbuf *m;
uint16_t txwisize;
uint8_t ridx;
- if (ni->ni_chan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan))
return;
- if (ic->ic_bsschan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(ic->ic_bsschan))
return;
/*
diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c
--- a/sys/dev/usb/wlan/if_rum.c
+++ b/sys/dev/usb/wlan/if_rum.c
@@ -1000,8 +1000,8 @@
ni = ieee80211_ref_node(vap->iv_bss);
if (vap->iv_opmode != IEEE80211_M_MONITOR) {
- if (ic->ic_bsschan == IEEE80211_CHAN_ANYC ||
- ni->ni_chan == IEEE80211_CHAN_ANYC) {
+ if (NET80211_CHANNEL_P_IS_ANYC(ic->ic_bsschan) ||
+ NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan)) {
ret = EINVAL;
goto run_fail;
}
@@ -2765,7 +2765,7 @@
if (m == NULL)
return EINVAL;
- if (ic->ic_bsschan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(ic->ic_bsschan))
return EINVAL;
tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)];
@@ -2792,7 +2792,7 @@
struct ieee80211_node *ni = vap->iv_bss;
struct mbuf *m;
- if (ni->ni_chan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan))
return EINVAL;
m = ieee80211_beacon_alloc(ni);
diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c
--- a/sys/dev/usb/wlan/if_run.c
+++ b/sys/dev/usb/wlan/if_run.c
@@ -2250,7 +2250,7 @@
if (vap->iv_opmode != IEEE80211_M_MONITOR) {
struct ieee80211_node *ni;
- if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) {
+ if (NET80211_CHANNEL_P_IS_ANYC(ic->ic_bsschan)) {
RUN_UNLOCK(sc);
IEEE80211_LOCK(ic);
return (-1);
@@ -5061,9 +5061,9 @@
uint16_t txwisize;
uint8_t ridx;
- if (ni->ni_chan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan))
return;
- if (ic->ic_bsschan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(ic->ic_bsschan))
return;
/*
diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c
--- a/sys/dev/usb/wlan/if_ural.c
+++ b/sys/dev/usb/wlan/if_ural.c
@@ -698,7 +698,7 @@
ni = ieee80211_ref_node(vap->iv_bss);
if (vap->iv_opmode != IEEE80211_M_MONITOR) {
- if (ic->ic_bsschan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(ic->ic_bsschan))
goto fail;
ural_update_slot(sc);
@@ -1031,7 +1031,7 @@
ieee80211_free_node(ni);
return (EIO);
}
- if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) {
+ if (NET80211_CHANNEL_P_IS_ANYC(ic->ic_bsschan)) {
m_freem(m0);
ieee80211_free_node(ni);
return (ENXIO);
diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c
--- a/sys/dev/wpi/if_wpi.c
+++ b/sys/dev/wpi/if_wpi.c
@@ -4400,7 +4400,7 @@
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_DOING, __func__);
- if (ni->ni_chan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan))
return EINVAL;
m = ieee80211_beacon_alloc(ni);
@@ -4502,7 +4502,7 @@
}
/* XXX kernel panic workaround */
- if (c == IEEE80211_CHAN_ANYC) {
+ if (NET80211_CHANNEL_P_IS_ANYC(c)) {
device_printf(sc->sc_dev, "%s: incomplete configuration\n",
__func__);
return EINVAL;
diff --git a/sys/net80211/_ieee80211.h b/sys/net80211/_ieee80211.h
--- a/sys/net80211/_ieee80211.h
+++ b/sys/net80211/_ieee80211.h
@@ -163,6 +163,44 @@
#define IEEE80211_CHAN_ANYC \
((struct ieee80211_channel *) IEEE80211_CHAN_ANY)
+/**
+ * @brief Return true if the channel is defined.
+ *
+ * This is true if the channel is defined.
+ * For channel pointers it currently is "is it NULL".
+ *
+ * @param c ieee80211_channel to check
+ * @returns true if defined, false otherwise
+ */
+#define NET80211_CHANNEL_P_IS_DEFINED(c) ((c) != NULL)
+
+/**
+ * @brief Return true if the channel is "any" channel.
+ *
+ * Some uses of channels are as a configuration option to
+ * match against, and there's a way to represent that "any channel" is OK.
+ *
+ * @param c ieee80211_channel to check
+ * @returns true if the channel is marked as "any channel", false otherwise
+ */
+#define NET80211_CHANNEL_P_IS_ANYC(c) ((c) == IEEE80211_CHAN_ANYC)
+
+/**
+ * @brief Return true if the channels are equivalent.
+ *
+ * This returns true if the channel representations are equivalent.
+ * For now this is just a pointer comparison, but the fields that
+ * specifically matter here are:
+ *
+ * + ic_flags, ic_freq, ic_ieee, ic_extieee, ic_vht_ch_freq1, ic_vht_ch_freq2,
+ * ic_freq2.
+ *
+ * @param c1 first ieee80211_channel to check
+ * @param c2 second ieee80211_channel to check
+ * @returns true if the channels are equivalent, false otherwise
+ */
+#define NET80211_CHANNEL_P_IS_EQUIV(c1, c2) ((c1) == (c2))
+
/* channel attributes */
#define IEEE80211_CHAN_PRIV0 0x00000001 /* driver private bit 0 */
#define IEEE80211_CHAN_PRIV1 0x00000002 /* driver private bit 1 */
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -1102,7 +1102,7 @@
ic_printf(ic, "invalid channel (NULL)\n");
return 0; /* XXX */
}
- return (c == IEEE80211_CHAN_ANYC ? IEEE80211_CHAN_ANY : c->ic_ieee);
+ return (NET80211_CHANNEL_P_IS_ANYC(c) ? IEEE80211_CHAN_ANY : c->ic_ieee);
}
/*
diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c
--- a/sys/net80211/ieee80211_adhoc.c
+++ b/sys/net80211/ieee80211_adhoc.c
@@ -165,7 +165,7 @@
sta_leave, NULL);
/* fall thru... */
case IEEE80211_S_INIT:
- if (vap->iv_des_chan != IEEE80211_CHAN_ANYC &&
+ if (!NET80211_CHANNEL_P_IS_ANYC(vap->iv_des_chan) &&
!IEEE80211_IS_CHAN_RADAR(vap->iv_des_chan)) {
/*
* Already have a channel; bypass the
diff --git a/sys/net80211/ieee80211_ddb.c b/sys/net80211/ieee80211_ddb.c
--- a/sys/net80211/ieee80211_ddb.c
+++ b/sys/net80211/ieee80211_ddb.c
@@ -862,7 +862,7 @@
db_printf("%s ", tag);
if (c == NULL)
db_printf("<NULL>");
- else if (c == IEEE80211_CHAN_ANYC)
+ else if (NET80211_CHANNEL_P_IS_ANYC(c))
db_printf("<ANY>");
else
db_printf("[%u (%u) flags=%b maxreg %d maxpow %d minpow %d state 0x%x extieee %u]",
diff --git a/sys/net80211/ieee80211_dfs.c b/sys/net80211/ieee80211_dfs.c
--- a/sys/net80211/ieee80211_dfs.c
+++ b/sys/net80211/ieee80211_dfs.c
@@ -273,7 +273,7 @@
announce_radar(struct ieee80211com *ic, const struct ieee80211_channel *curchan,
const struct ieee80211_channel *newchan)
{
- if (newchan == NULL)
+ if (!NET80211_CHANNEL_P_IS_DEFINED(newchan))
ic_printf(ic, "radar detected on channel %u (%u MHz)\n",
curchan->ic_ieee, curchan->ic_freq);
else
@@ -350,7 +350,7 @@
* channels other than the bss channel; not sure
* that can/will happen but it's simple to support.
*/
- if (chan == ic->ic_bsschan) {
+ if (NET80211_CHANNEL_P_IS_EQUIV(chan, ic->ic_bsschan)) {
/* XXX need a way to defer to user app */
/*
@@ -366,7 +366,7 @@
if (callout_pending(&dfs->cac_timer))
callout_schedule(&dfs->cac_timer, 0);
- else if (dfs->newchan != NULL) {
+ else if (NET80211_CHANNEL_P_IS_DEFINED(dfs->newchan)) {
/* XXX mode 1, switch count 2 */
/* XXX calculate switch count based on max
switch time and beacon interval? */
diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c
--- a/sys/net80211/ieee80211_ht.c
+++ b/sys/net80211/ieee80211_ht.c
@@ -1428,25 +1428,25 @@
if (!IEEE80211_IS_CHAN_HT40(chan)) {
/* NB: arbitrarily pick ht40+ over ht40- */
c = findhtchan(ic, chan, IEEE80211_CHAN_HT40U);
- if (c == NULL)
+ if (!NET80211_CHANNEL_P_IS_DEFINED(c))
c = findhtchan(ic, chan,
IEEE80211_CHAN_HT40D);
- if (c == NULL)
+ if (!NET80211_CHANNEL_P_IS_DEFINED(c))
c = findhtchan(ic, chan,
IEEE80211_CHAN_HT20);
- if (c != NULL)
+ if (NET80211_CHANNEL_P_IS_DEFINED(c))
chan = c;
}
} else if (!IEEE80211_IS_CHAN_HT20(chan)) {
c = findhtchan(ic, chan, IEEE80211_CHAN_HT20);
- if (c != NULL)
+ if (NET80211_CHANNEL_P_IS_DEFINED(c))
chan = c;
}
} else if (IEEE80211_IS_CHAN_HT(chan)) {
/* demote to legacy, HT use is disabled */
c = ieee80211_find_channel(ic, chan->ic_freq,
chan->ic_flags &~ IEEE80211_CHAN_HT);
- if (c != NULL)
+ if (NET80211_CHANNEL_P_IS_DEFINED(c))
chan = c;
}
return chan;
@@ -1557,7 +1557,7 @@
} else if (vap->iv_flags_ht & IEEE80211_FHT_NONHT_PR) {
protmode = IEEE80211_HTINFO_OPMODE_PROTOPT
| IEEE80211_HTINFO_NONHT_PRESENT;
- } else if (ic->ic_bsschan != IEEE80211_CHAN_ANYC &&
+ } else if (!NET80211_CHANNEL_P_IS_ANYC(ic->ic_bsschan) &&
IEEE80211_IS_CHAN_HT40(ic->ic_bsschan) &&
vap->iv_sta_assoc != vap->iv_ht40_sta_assoc) {
protmode = IEEE80211_HTINFO_OPMODE_HT20PR;
@@ -3382,7 +3382,7 @@
* after association the channel is upgraded to HT based
* on the negotiated capabilities.
*/
- if (ni->ni_chan != IEEE80211_CHAN_ANYC &&
+ if (!NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan) &&
findhtchan(ic, ni->ni_chan, IEEE80211_CHAN_HT40U) == NULL &&
findhtchan(ic, ni->ni_chan, IEEE80211_CHAN_HT40D) == NULL)
caps &= ~IEEE80211_HTCAP_CHWIDTH40;
@@ -3807,14 +3807,14 @@
const struct ieee80211vap *vap;
const struct ieee80211_channel *bss_chan;
- if (ni == NULL || ni->ni_chan == IEEE80211_CHAN_ANYC ||
+ if (ni == NULL || NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan) ||
ni->ni_vap == NULL || ni->ni_vap->iv_bss == NULL)
return (false);
vap = ni->ni_vap;
bss_chan = vap->iv_bss->ni_chan;
- if (bss_chan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(bss_chan))
return (false);
if (IEEE80211_IS_CHAN_HT(ni->ni_chan) &&
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -396,7 +396,7 @@
if (vap->iv_opmode == IEEE80211_M_HOSTAP &&
ni->ni_associd == 0) /* only associated stations */
return;
- if (ni->ni_chan == IEEE80211_CHAN_ANYC) /* XXX bogus entry */
+ if (NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan)) /* XXX bogus entry */
return;
len = sta_space(ni, &ielen);
if (len > req->space)
@@ -2087,7 +2087,7 @@
return EINVAL;
}
if ((vap->iv_state == IEEE80211_S_RUN || vap->iv_state == IEEE80211_S_SLEEP) &&
- vap->iv_bss->ni_chan == c)
+ NET80211_CHANNEL_P_IS_EQUIV(vap->iv_bss->ni_chan, c))
return 0; /* NB: nothing to do */
}
vap->iv_des_chan = c;
diff --git a/sys/net80211/ieee80211_regdomain.c b/sys/net80211/ieee80211_regdomain.c
--- a/sys/net80211/ieee80211_regdomain.c
+++ b/sys/net80211/ieee80211_regdomain.c
@@ -435,7 +435,7 @@
* needs to be done for all vaps but for now we only do
* the one where the ioctl is issued.
*/
- if (vap->iv_des_chan != IEEE80211_CHAN_ANYC) {
+ if (!NET80211_CHANNEL_P_IS_ANYC(vap->iv_des_chan)) {
desfreq = vap->iv_des_chan->ic_freq;
desflags = vap->iv_des_chan->ic_flags;
}
@@ -459,7 +459,7 @@
}
ieee80211_scan_flush(vap);
ieee80211_dfs_reset(ic);
- if (vap->iv_des_chan != IEEE80211_CHAN_ANYC) {
+ if (!NET80211_CHANNEL_P_IS_ANYC(vap->iv_des_chan)) {
c = ieee80211_find_channel(ic, desfreq, desflags);
/* NB: may be NULL if not present in new channel list */
vap->iv_des_chan = (c != NULL) ? c : IEEE80211_CHAN_ANYC;
diff --git a/sys/net80211/ieee80211_scan_sta.c b/sys/net80211/ieee80211_scan_sta.c
--- a/sys/net80211/ieee80211_scan_sta.c
+++ b/sys/net80211/ieee80211_scan_sta.c
@@ -318,9 +318,9 @@
*/
c = ieee80211_find_channel_byieee(ic, sp->chan,
curchan->ic_flags);
- if (c != NULL) {
+ if (NET80211_CHANNEL_P_IS_DEFINED(c)) {
ise->se_chan = c;
- } else if (ise->se_chan == NULL) {
+ } else if (!NET80211_CHANNEL_P_IS_DEFINED(ise->se_chan)) {
/* should not happen, pick something */
ise->se_chan = curchan;
}
@@ -427,7 +427,7 @@
isexcluded(struct ieee80211vap *vap, const struct ieee80211_channel *c)
{
return (isclr(vap->iv_ic->ic_chan_active, c->ic_ieee) ||
- (vap->iv_des_chan != IEEE80211_CHAN_ANYC &&
+ (!NET80211_CHANNEL_P_IS_ANYC(vap->iv_des_chan) &&
c->ic_freq != vap->iv_des_chan->ic_freq));
}
@@ -598,7 +598,7 @@
* mechanisms would otherwise elide it (e.g HT, turbo).
*/
c = vap->iv_des_chan;
- if (c != IEEE80211_CHAN_ANYC &&
+ if (!NET80211_CHANNEL_P_IS_ANYC(c) &&
!onscanlist(ss, c) &&
(vap->iv_des_mode == IEEE80211_MODE_AUTO ||
vap->iv_des_mode == ieee80211_chan2mode(c)) &&
@@ -1603,7 +1603,7 @@
if (se->base.se_rssi > maxrssi)
maxrssi = se->base.se_rssi;
}
- if (bestchan == NULL || maxrssi < bestrssi)
+ if (!NET80211_CHANNEL_P_IS_DEFINED(bestchan) || maxrssi < bestrssi)
bestchan = c;
}
IEEE80211_SCAN_TABLE_UNLOCK(st);
@@ -1665,7 +1665,7 @@
* an ssid; start one up. If no channel was
* specified, try to select a channel.
*/
- if (vap->iv_des_chan == IEEE80211_CHAN_ANYC ||
+ if (NET80211_CHANNEL_P_IS_ANYC(vap->iv_des_chan) ||
IEEE80211_IS_CHAN_RADAR(vap->iv_des_chan)) {
chan = adhoc_pick_channel(ss, 0);
} else
@@ -1819,7 +1819,7 @@
/* XXX use other considerations */
return chan;
}
- if (bestchan == NULL ||
+ if (!NET80211_CHANNEL_P_IS_DEFINED(bestchan) ||
st->st_maxrssi[chan->ic_ieee] < st->st_maxrssi[bestchan->ic_ieee])
bestchan = chan;
}
@@ -1838,7 +1838,7 @@
KASSERT(vap->iv_opmode == IEEE80211_M_HOSTAP,
("wrong opmode %u", vap->iv_opmode));
bestchan = ap_pick_channel(ss, 0);
- if (bestchan == NULL) {
+ if (!NET80211_CHANNEL_P_IS_DEFINED(bestchan)) {
/* no suitable channel, should not happen */
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: no suitable channel! (should not happen)\n", __func__);
@@ -1851,7 +1851,7 @@
if (IEEE80211_IS_CHAN_TURBO(bestchan)) {
bestchan = ieee80211_find_channel(ic, bestchan->ic_freq,
bestchan->ic_flags & ~IEEE80211_CHAN_TURBO);
- if (bestchan == NULL) {
+ if (!NET80211_CHANNEL_P_IS_DEFINED(bestchan)) {
/* should never happen ?? */
return 0;
}
@@ -1936,7 +1936,7 @@
* a meshid; start one up. If no channel was
* specified, try to select a channel.
*/
- if (vap->iv_des_chan == IEEE80211_CHAN_ANYC ||
+ if (NET80211_CHANNEL_P_IS_ANYC(vap->iv_des_chan) ||
IEEE80211_IS_CHAN_RADAR(vap->iv_des_chan)) {
struct ieee80211com *ic = vap->iv_ic;
diff --git a/sys/net80211/ieee80211_scan_sw.c b/sys/net80211/ieee80211_scan_sw.c
--- a/sys/net80211/ieee80211_scan_sw.c
+++ b/sys/net80211/ieee80211_scan_sw.c
@@ -828,8 +828,8 @@
if (scandone)
ic->ic_lastscan = ticks;
/* return to the bss channel */
- if (ic->ic_bsschan != IEEE80211_CHAN_ANYC &&
- ic->ic_curchan != ic->ic_bsschan) {
+ if (!NET80211_CHANNEL_P_IS_ANYC(ic->ic_bsschan) &&
+ !NET80211_CHANNEL_P_IS_EQUIV(ic->ic_curchan, ic->ic_bsschan)) {
ieee80211_setupcurchan(ic, ic->ic_bsschan);
IEEE80211_UNLOCK(ic);
ic->ic_set_channel(ic);
diff --git a/sys/net80211/ieee80211_superg.c b/sys/net80211/ieee80211_superg.c
--- a/sys/net80211/ieee80211_superg.c
+++ b/sys/net80211/ieee80211_superg.c
@@ -997,7 +997,7 @@
struct ieee80211_channel *chan;
chan = ieee80211_find_channel(ic, ic->ic_bsschan->ic_freq, newflags);
- if (chan == NULL) { /* XXX should not happen */
+ if (!NET80211_CHANNEL_P_IS_DEFINED(chan)) { /* XXX should not happen */
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG,
"%s: no channel with freq %u flags 0x%x\n",
__func__, ic->ic_bsschan->ic_freq, newflags);
diff --git a/sys/net80211/ieee80211_tdma.c b/sys/net80211/ieee80211_tdma.c
--- a/sys/net80211/ieee80211_tdma.c
+++ b/sys/net80211/ieee80211_tdma.c
@@ -270,7 +270,7 @@
nstate == IEEE80211_S_RUN && ostate != IEEE80211_S_RUN &&
(vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS) &&
ts->tdma_slot != 0 &&
- vap->iv_des_chan == IEEE80211_CHAN_ANYC) {
+ NET80211_CHANNEL_P_IS_ANYC(vap->iv_des_chan)) {
/*
* Start s/w beacon miss timer for slave devices w/o
* hardware support. Note we do this only if we're
diff --git a/sys/net80211/ieee80211_vht.c b/sys/net80211/ieee80211_vht.c
--- a/sys/net80211/ieee80211_vht.c
+++ b/sys/net80211/ieee80211_vht.c
@@ -969,14 +969,14 @@
const struct ieee80211vap *vap;
const struct ieee80211_channel *bss_chan;
- if (ni == NULL || ni->ni_chan == IEEE80211_CHAN_ANYC ||
+ if (ni == NULL || NET80211_CHANNEL_P_IS_ANYC(ni->ni_chan) ||
ni->ni_vap == NULL || ni->ni_vap->iv_bss == NULL)
return (false);
vap = ni->ni_vap;
bss_chan = vap->iv_bss->ni_chan;
- if (bss_chan == IEEE80211_CHAN_ANYC)
+ if (NET80211_CHANNEL_P_IS_ANYC(bss_chan))
return (false);
return (IEEE80211_IS_CHAN_VHT(ni->ni_chan));

File Metadata

Mime Type
text/plain
Expires
Fri, Jun 12, 10:31 AM (10 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33905529
Default Alt Text
D48172.diff (22 KB)

Event Timeline