From owner-p4-projects@FreeBSD.ORG Mon Jul 18 16:38:15 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3781416A420; Mon, 18 Jul 2005 16:38:15 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 104B516A41C for ; Mon, 18 Jul 2005 16:38:15 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id C806D43D45 for ; Mon, 18 Jul 2005 16:38:14 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j6IGcESI056361 for ; Mon, 18 Jul 2005 16:38:14 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j6IGcEqs056354 for perforce@freebsd.org; Mon, 18 Jul 2005 16:38:14 GMT (envelope-from sam@freebsd.org) Date: Mon, 18 Jul 2005 16:38:14 GMT Message-Id: <200507181638.j6IGcEqs056354@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 80452 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2005 16:38:16 -0000 http://perforce.freebsd.org/chv.cgi?CH=80452 Change 80452 by sam@sam_ebb on 2005/07/18 16:37:22 add bgscan+roaming controls Affected files ... .. //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#41 edit Differences ... ==== //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#41 (text+ko) ==== @@ -636,6 +636,66 @@ set80211(s, IEEE80211_IOC_PUREG, d, 0, NULL); } +static void +set80211bgscan(const char *val, int d, int s, const struct afswtch *rafp) +{ + set80211(s, IEEE80211_IOC_BGSCAN, d, 0, NULL); +} + +static +DECL_CMD_FUNC(set80211bgscanidle, val, d) +{ + set80211(s, IEEE80211_IOC_BGSCAN_IDLE, atoi(val), 0, NULL); +} + +static +DECL_CMD_FUNC(set80211bgscanintvl, val, d) +{ + set80211(s, IEEE80211_IOC_BGSCAN_INTERVAL, atoi(val), 0, NULL); +} + +static +DECL_CMD_FUNC(set80211scanvalid, val, d) +{ + set80211(s, IEEE80211_IOC_SCANVALID, atoi(val), 0, NULL); +} + +static +DECL_CMD_FUNC(set80211roamrssi11a, val, d) +{ + set80211(s, IEEE80211_IOC_ROAM_RSSI_11A, atoi(val), 0, NULL); +} + +static +DECL_CMD_FUNC(set80211roamrssi11b, val, d) +{ + set80211(s, IEEE80211_IOC_ROAM_RSSI_11B, atoi(val), 0, NULL); +} + +static +DECL_CMD_FUNC(set80211roamrssi11g, val, d) +{ + set80211(s, IEEE80211_IOC_ROAM_RSSI_11G, atoi(val), 0, NULL); +} + +static +DECL_CMD_FUNC(set80211roamrate11a, val, d) +{ + set80211(s, IEEE80211_IOC_ROAM_RATE_11A, 2*atoi(val), 0, NULL); +} + +static +DECL_CMD_FUNC(set80211roamrate11b, val, d) +{ + set80211(s, IEEE80211_IOC_ROAM_RATE_11B, 2*atoi(val), 0, NULL); +} + +static +DECL_CMD_FUNC(set80211roamrate11g, val, d) +{ + set80211(s, IEEE80211_IOC_ROAM_RATE_11G, 2*atoi(val), 0, NULL); +} + static int getmaxrate(uint8_t rates[15], uint8_t nrates) { @@ -961,12 +1021,11 @@ if (IEEE80211_IS_CHAN_A(c)) strlcat(buf, " 11a", sizeof(buf)); /* XXX 11g schizophrenia */ - if (IEEE80211_IS_CHAN_G(c) || - IEEE80211_IS_CHAN_PUREG(c)) + if (IEEE80211_IS_CHAN_ANYG(c)) strlcat(buf, " 11g", sizeof(buf)); else if (IEEE80211_IS_CHAN_B(c)) strlcat(buf, " 11b", sizeof(buf)); - if (IEEE80211_IS_CHAN_T(c)) + if (IEEE80211_IS_CHAN_TURBO(c)) strlcat(buf, " Turbo", sizeof(buf)); printf("Channel %3u : %u%c Mhz%-14.14s", ieee80211_mhz2ieee(c->ic_freq), c->ic_freq, @@ -1028,7 +1087,7 @@ #define IEEE80211_C_BITS \ "\020\1WEP\2TKIP\3AES\4AES_CCM\6CKIP\11IBSS\12PMGT\13HOSTAP\14AHDEMO" \ "\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE\21MONITOR\22TKIPMIC\30WPA1" \ -"\31WPA2\32BURST\33WME" +"\31WPA2\32BURST\33WME\34WDS\36BGSCAN" static void list_capabilities(int s) @@ -1306,7 +1365,7 @@ { static const uint8_t zerobssid[IEEE80211_ADDR_LEN]; enum ieee80211_opmode opmode = get80211opmode(s); - int i, num, wpa, wme; + int i, num, wpa, wme, bgscan; struct ieee80211req ireq; u_int8_t data[32]; const struct ieee80211_channel *c; @@ -1316,6 +1375,7 @@ ireq.i_data = &data; wpa = 0; /* unknown/not set */ + bgscan = 0; /* unknown/not set */ ireq.i_type = IEEE80211_IOC_SSID; ireq.i_val = -1; @@ -1521,7 +1581,54 @@ LINE_CHECK("%crtsthreshold %d", spacer, ireq.i_val); } - if (IEEE80211_IS_CHAN_G(c) || IEEE80211_IS_CHAN_PUREG(c) || verbose) { + ireq.i_type = IEEE80211_IOC_BGSCAN; + if (ioctl(s, SIOCG80211, &ireq) != -1) { + bgscan = ireq.i_val; + if (ireq.i_val) + LINE_CHECK("%cbgscan", spacer); + else if (verbose) + LINE_CHECK("%c-bgscan", spacer); + } + if (bgscan || verbose) { + ireq.i_type = IEEE80211_IOC_BGSCAN_INTERVAL; + if (ioctl(s, SIOCG80211, &ireq) != -1) + LINE_CHECK("%cbgscanintvl %u", spacer, ireq.i_val); + ireq.i_type = IEEE80211_IOC_BGSCAN_IDLE; + if (ioctl(s, SIOCG80211, &ireq) != -1) + LINE_CHECK("%cbgscanidle %u", spacer, ireq.i_val); + if (IEEE80211_IS_CHAN_A(c) || verbose) { + ireq.i_type = IEEE80211_IOC_ROAM_RSSI_11A; + if (ioctl(s, SIOCG80211, &ireq) != -1) + LINE_CHECK("%croam:rssi11a %d", + spacer, ireq.i_val); + ireq.i_type = IEEE80211_IOC_ROAM_RATE_11A; + if (ioctl(s, SIOCG80211, &ireq) != -1) + LINE_CHECK("%croam:rate11a %u", + spacer, ireq.i_val/2); + } + if (IEEE80211_IS_CHAN_B(c) || verbose) { + ireq.i_type = IEEE80211_IOC_ROAM_RSSI_11B; + if (ioctl(s, SIOCG80211, &ireq) != -1) + LINE_CHECK("%croam:rssi11b %d", + spacer, ireq.i_val); + ireq.i_type = IEEE80211_IOC_ROAM_RATE_11B; + if (ioctl(s, SIOCG80211, &ireq) != -1) + LINE_CHECK("%croam:rate11b %u", + spacer, ireq.i_val/2); + } + if (IEEE80211_IS_CHAN_ANYG(c) || verbose) { + ireq.i_type = IEEE80211_IOC_ROAM_RSSI_11G; + if (ioctl(s, SIOCG80211, &ireq) != -1) + LINE_CHECK("%croam:rssi11g %d", + spacer, ireq.i_val); + ireq.i_type = IEEE80211_IOC_ROAM_RATE_11G; + if (ioctl(s, SIOCG80211, &ireq) != -1) + LINE_CHECK("%croam:rate11g %u", + spacer, ireq.i_val/2); + } + } + + if (IEEE80211_IS_CHAN_ANYG(c) || verbose) { ireq.i_type = IEEE80211_IOC_PUREG; if (ioctl(s, SIOCG80211, &ireq) != -1) { if (ireq.i_val) @@ -1836,6 +1943,17 @@ DEF_CMD("-ff", 0, set80211fastframes), DEF_CMD("dturbo", 1, set80211dturbo), DEF_CMD("-dturbo", 0, set80211dturbo), + DEF_CMD("bgscan", 1, set80211bgscan), + DEF_CMD("-bgscan", 0, set80211bgscan), + DEF_CMD_ARG("bgscanidle", set80211bgscanidle), + DEF_CMD_ARG("bgscanintvl", set80211bgscanintvl), + DEF_CMD_ARG("scanvalid", set80211scanvalid), + DEF_CMD_ARG("roam:rssi11a", set80211roamrssi11a), + DEF_CMD_ARG("roam:rssi11b", set80211roamrssi11b), + DEF_CMD_ARG("roam:rssi11g", set80211roamrssi11g), + DEF_CMD_ARG("roam:rate11a", set80211roamrate11a), + DEF_CMD_ARG("roam:rate11b", set80211roamrate11b), + DEF_CMD_ARG("roam:rate11g", set80211roamrate11g), }; static struct afswtch af_ieee80211 = { .af_name = "af_ieee80211",