* Check channel compatibility. */
| 2100 | * Check channel compatibility. |
| 2101 | */ |
| 2102 | static int |
| 2103 | checkchan(const struct ieee80211req_chaninfo *avail, int freq, int flags) |
| 2104 | { |
| 2105 | flags &= ~REQ_FLAGS; |
| 2106 | /* |
| 2107 | * Check if exact channel is in the calibration table; |
| 2108 | * everything below is to deal with channels that we |
| 2109 | * want to include but that are not explicitly listed. |
| 2110 | */ |
| 2111 | if (chanlookup(avail->ic_chans, avail->ic_nchans, freq, flags) != NULL) |
| 2112 | return 1; |
| 2113 | if (flags & IEEE80211_CHAN_GSM) { |
| 2114 | /* |
| 2115 | * XXX GSM frequency mapping is handled in the kernel |
| 2116 | * so we cannot find them in the calibration table; |
| 2117 | * just accept the channel and the kernel will reject |
| 2118 | * the channel list if it's wrong. |
| 2119 | */ |
| 2120 | return 1; |
| 2121 | } |
| 2122 | /* |
| 2123 | * If this is a 1/2 or 1/4 width channel allow it if a full |
| 2124 | * width channel is present for this frequency, and the device |
| 2125 | * supports fractional channels on this band. This is a hack |
| 2126 | * that avoids bloating the calibration table; it may be better |
| 2127 | * by per-band attributes though (we are effectively calculating |
| 2128 | * this attribute by scanning the channel list ourself). |
| 2129 | */ |
| 2130 | if ((flags & (IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)) == 0) |
| 2131 | return 0; |
| 2132 | if (chanlookup(avail->ic_chans, avail->ic_nchans, freq, |
| 2133 | flags &~ (IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)) == NULL) |
| 2134 | return 0; |
| 2135 | if (flags & IEEE80211_CHAN_HALF) { |
| 2136 | return chanfind(avail->ic_chans, avail->ic_nchans, |
| 2137 | IEEE80211_CHAN_HALF | |
| 2138 | (flags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ))); |
| 2139 | } else { |
| 2140 | return chanfind(avail->ic_chans, avail->ic_nchans, |
| 2141 | IEEE80211_CHAN_QUARTER | |
| 2142 | (flags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ))); |
| 2143 | } |
| 2144 | } |
| 2145 | |
| 2146 | static void |
| 2147 | regdomain_addchans(struct ieee80211req_chaninfo *ci, |
no test coverage detected