summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2007-01-15 01:20:28 +0000
committersam <sam@FreeBSD.org>2007-01-15 01:20:28 +0000
commitc0993d4628582604f3421ff1d855ce4f34135e0f (patch)
tree2751e03f86a7d53188ac8bf8e2cfa94aa9dcd212 /sbin/ifconfig
parent505d2532fe1d955e605664931526492bec80da0b (diff)
downloadFreeBSD-src-c0993d4628582604f3421ff1d855ce4f34135e0f.zip
FreeBSD-src-c0993d4628582604f3421ff1d855ce4f34135e0f.tar.gz
Add initial support for 900MHz channels; still has some rough
edges but ifconfig ath0 list chan works and you can use ieee channel #'s to lock/select a channel. MFC after: 1 month
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r--sbin/ifconfig/ifieee80211.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index 384e897..9da0b3f 100644
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -156,20 +156,43 @@ ieee80211_ieee2mhz(u_int chan)
return 5000 + (chan*5);
}
+static __inline int
+mapgsm(u_int freq, u_int flags)
+{
+ freq *= 10;
+ if (flags & IEEE80211_CHAN_QUARTER)
+ freq += 5;
+ else if (flags & IEEE80211_CHAN_HALF)
+ freq += 10;
+ else
+ freq += 20;
+ /* NB: there is no 907/20 wide but leave room */
+ return (freq - 906*10) / 5;
+}
+
+static __inline int
+mappsb(u_int freq, u_int flags)
+{
+ return 37 + ((freq * 10) + ((freq % 5) == 2 ? 5 : 0) - 49400) / 5;
+}
+
/*
* Convert MHz frequency to IEEE channel number.
*/
static u_int
ieee80211_mhz2ieee(u_int freq, u_int flags)
{
+ if ((flags & IEEE80211_CHAN_GSM) || (907 <= freq && freq <= 922))
+ return mapgsm(freq, flags);
if (freq == 2484)
return 14;
if (freq < 2484)
return (freq - 2407) / 5;
if (freq < 5000) {
- if (freq > 4900) /* XXX hack mapping of PSB */
- return 37 + ((freq * 10) +
- (((freq % 5) == 2) ? 5 : 0) - 49400) / 5;
+ if (flags & (IEEE80211_CHAN_HALF|IEEE80211_CHAN_QUARTER))
+ return mappsb(freq, flags);
+ else if (freq > 4900)
+ return (freq - 4000) / 5;
else
return 15 + ((freq - 2512) / 20);
}
@@ -1039,7 +1062,7 @@ list_stations(int s)
printf("%s %4u %4d %3dM %4d %4d %6d %6d %-4.4s %-4.4s"
, ether_ntoa((const struct ether_addr*) si->isi_macaddr)
, IEEE80211_AID(si->isi_associd)
- , ieee80211_mhz2ieee(si->isi_freq, si->isi_freq)
+ , ieee80211_mhz2ieee(si->isi_freq, si->isi_flags)
, (si->isi_rates[si->isi_txrate] & IEEE80211_RATE_VAL)/2
, si->isi_rssi
, si->isi_inact
@@ -1072,9 +1095,14 @@ print_chaninfo(const struct ieee80211_channel *c)
else
strlcat(buf, " 11a", sizeof(buf));
}
- if (IEEE80211_IS_CHAN_ANYG(c))
- strlcat(buf, " 11g", sizeof(buf));
- else if (IEEE80211_IS_CHAN_B(c))
+ if (IEEE80211_IS_CHAN_ANYG(c)) {
+ if (IEEE80211_IS_CHAN_HALF(c))
+ strlcat(buf, " 11g/10Mhz", sizeof(buf));
+ else if (IEEE80211_IS_CHAN_QUARTER(c))
+ strlcat(buf, " 11g/5Mhz", sizeof(buf));
+ else
+ strlcat(buf, " 11g", sizeof(buf));
+ } else if (IEEE80211_IS_CHAN_B(c))
strlcat(buf, " 11b", sizeof(buf));
if (IEEE80211_IS_CHAN_T(c))
strlcat(buf, " Turbo", sizeof(buf));
OpenPOWER on IntegriCloud