summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsnmpd
diff options
context:
space:
mode:
authorsyrinx <syrinx@FreeBSD.org>2010-07-26 16:16:39 +0000
committersyrinx <syrinx@FreeBSD.org>2010-07-26 16:16:39 +0000
commit566d7d1a533f02074a80ad7af239b2bbb142c27a (patch)
tree21ecca9f039f77a582356b36026b2d7c94477cbb /usr.sbin/bsnmpd
parent88ec2982d0e2a65efb1031eedde721c2fd14dd4c (diff)
downloadFreeBSD-src-566d7d1a533f02074a80ad7af239b2bbb142c27a.zip
FreeBSD-src-566d7d1a533f02074a80ad7af239b2bbb142c27a.tar.gz
Bring in a SNMP module to support monitoring cloned wireless interfaces
via bsnmpd(1). The module implements a private BEGEMOT-WIRELESS-MIB. Sponsored by: The FreeBSD Foundation Reviewed by: philip@ Approved by: philip@
Diffstat (limited to 'usr.sbin/bsnmpd')
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt3898
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_wlan/Makefile17
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3160
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.c4513
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h286
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c3145
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def675
7 files changed, 12694 insertions, 0 deletions
diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt b/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt
new file mode 100644
index 0000000..194ecd1
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt
@@ -0,0 +1,3898 @@
+--
+-- Copyright (C) 2010 The FreeBSD Foundation
+-- All rights reserved.
+--
+-- This documentation was written by Shteryana Sotirova Shopova under
+-- sponsorship from the FreeBSD Foundation.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions
+-- are met:
+-- 1. Redistributions of source code must retain the above copyright
+-- notice, this list of conditions and the following disclaimer.
+-- 2. Redistributions in binary form must reproduce the above copyright
+-- notice, this list of conditions and the following disclaimer in the
+-- documentation and/or other materials provided with the distribution.
+--
+-- THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+-- ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+-- SUCH DAMAGE.
+--
+-- $FreeBSD$
+--
+
+BEGEMOT-WIRELESS-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
+ Counter32, Integer32, TimeTicks, Unsigned32, mib-2
+ FROM SNMPv2-SMI
+ TEXTUAL-CONVENTION, MacAddress, TruthValue, RowStatus,
+ DisplayString
+ FROM SNMPv2-TC
+ InterfaceIndex, ifIndex FROM IF-MIB
+ begemot
+ FROM BEGEMOT-MIB;
+
+begemotWlan MODULE-IDENTITY
+ LAST-UPDATED "201005170000Z"
+ ORGANIZATION "The FreeBSD Foundation"
+ CONTACT-INFO
+ " Shteryana Shopova
+
+ Postal: 12 Andrey Lyapchev Blvd.
+ block 2, ap.19
+ 1797 Sofia
+ Bulgaria
+
+ Fax: N/A
+
+ E-Mail: syrinx@FreeBSD.org"
+ DESCRIPTION
+ "The Begemot MIB for managing IEEE802.11 interfaces."
+ REVISION "201005170000Z"
+ DESCRIPTION
+ "Initial revision."
+ ::= { begemot 210 }
+
+-- ---------------------------------------------------------- --
+-- Textual conventions
+-- ---------------------------------------------------------- --
+WlanMgmtReasonCode ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "Enumeration of reason and codes used in IEEE802.11
+ management frames to indicate why an action took place."
+ SYNTAX INTEGER {
+ unspecified(1),
+ authenticationExpire(2),
+ authenticationLeave(3),
+ associationExpire(4),
+ associationTooMany(5),
+ notAuthenticated(6),
+ notAssociated(7),
+ associationLeave(8),
+ associationNotAuthenticated(9),
+-- XXX: TODO - FIXME
+ dissasocPwrcapBad(10),
+ dissasocSuperchanBad(11),
+ ieInvalid(13),
+ micFailure(14),
+ fourWayHandshakeTimeout(15),
+ groupKeyUpdateTimeout(16),
+ ieIn4FourWayDiffers(17),
+ groupCipherInvalid(18),
+ pairwiseCiherInvalid(19),
+ akmpInvalid(20),
+ unsupportedRsnIeVersion(21),
+ invalidRsnIeCap(22),
+ dot1xAuthFailed(23),
+ cipherSuiteRejected(24),
+ unspeciffiedQos(32),
+ insufficientBw(33),
+ tooManyFrames(34),
+ outsideTxOp(35),
+ leavingQbss(36),
+ badMechanism(37),
+ setupNeeded(38),
+ timeout(39)
+ }
+
+WlanMgmtMeshReasonCode ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "Enumeration of reason and codes used in IEEE802.11
+ mesh routing management frames to indicate why an
+ action took place."
+ SYNTAX INTEGER {
+-- XXX: TODO - FIXME
+ peerLinkCancelled(2),
+ maxPeers(3),
+ cpViolation(4),
+ closeRcvd(5),
+ maxRetries(6),
+ confirmTimeout(7),
+ invalidGtk(8),
+ inconsistentParams(9),
+ invalidSecurity(10),
+ perrUnspecified(11),
+ perrNoFI(12),
+ perrDestUnreach(13)
+ }
+
+WlanMgmtStatusCode ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "Enumeration of reason and codes used in IEEE802.11
+ management frames to indicate what the result of an
+ operation is."
+ SYNTAX INTEGER {
+-- XXX: TODO - FIXME
+ success(0),
+ unspecified(1),
+ capabilitiesInfo(10),
+ notAssociated(11),
+ other(12),
+ algorithm(13),
+ sequence(14),
+ challenge(15),
+ timeout(16),
+ tooMany(17),
+ basicRate(18),
+ spRequired(19),
+ pbccRequired(20),
+ caRequired(21),
+ specMgmtRequired(22),
+ pwrcapRequire(23),
+ superchanRequired(24),
+ shortSlotRequired(25),
+ dssofdmRequired(26),
+ missingHTCaps(27),
+ invalidIE(40),
+ groupCipherInvalid(41),
+ pairwiseCipherInvalid(42),
+ akmpInvalid(43),
+ unsupportedRsnIEVersion(44),
+ invalidRsnIECap(45),
+ cipherSuiteRejected(46)
+ }
+
+WlanRegDomainCode ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "Enumeration of regdomain codes."
+ SYNTAX INTEGER {
+ fcc(1),
+ ca(2),
+ etsi(3),
+ etsi2(4),
+ etsi3(5),
+ fcc3(6),
+ japan(7),
+ korea(8),
+ apac(9),
+ apac2(10),
+ apac3(11),
+ row(12),
+ none(13),
+ debug(14),
+ sr9(15),
+ xr9(16),
+ gz901(17)
+ }
+
+WlanIfaceDot11nPduType ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "Enumeration of values for PDU transmit/receive enabled."
+ SYNTAX INTEGER {
+ disabled(0),
+ rxOnly(1),
+ txOnly(2),
+ txAndRx(3)
+ }
+
+WlanPeerCapabilityFlags ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "A list of capability bits that may be advertised by a peer."
+ SYNTAX BITS {
+ ess(1),
+ ibss(2),
+ cfPollable(3),
+ cfPollRequest(4),
+ privacy(5),
+ shortPreamble(6),
+ pbcc(7),
+ channelAgility(8),
+ shortSlotTime(9),
+ rsn(10),
+ dsssofdm(11)
+ }
+
+WlanIfPhyMode ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "A list of wireless PHY operating modes."
+ SYNTAX INTEGER {
+ auto(1),
+ dot11a(2),
+ dot11b(3),
+ dot11g(4),
+ fh(5),
+ turboA(6),
+ turboG(7),
+ sturboA(8),
+ dot11na(9),
+ dot11ng(10),
+ ofdmHalf(11),
+ ofdmQuarter(12)
+ }
+
+-- ---------------------------------------------------------- --
+-- Subtrees in the Begemot Wireless MIB
+-- ---------------------------------------------------------- --
+begemotWlanNotifications OBJECT IDENTIFIER ::= { begemotWlan 0 }
+
+begemotWlanInterface OBJECT IDENTIFIER ::= { begemotWlan 1 }
+
+begemotWlanScanning OBJECT IDENTIFIER ::= { begemotWlan 2 }
+
+begemotWlanStatistics OBJECT IDENTIFIER ::= { begemotWlan 3 }
+
+begemotWlanWep OBJECT IDENTIFIER ::= { begemotWlan 4 }
+
+begemotWlanMACAccessControl OBJECT IDENTIFIER ::= { begemotWlan 5 }
+
+begemotWlanMeshRouting OBJECT IDENTIFIER ::= { begemotWlan 6 }
+
+-- ---------------------------------------------------------- --
+-- begemotWlanMultimedia OBJECT IDENTIFIER ::= { begemotWlan 7 }
+-- ---------------------------------------------------------- --
+
+-- ---------------------------------------------------------- --
+-- Cloned wireless interfaces' database
+-- ---------------------------------------------------------- --
+wlanInterfaceTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanInterfaceEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains the list of cloned wireless
+ interfaces created on the system."
+ ::= { begemotWlanInterface 1 }
+
+wlanInterfaceEntry OBJECT-TYPE
+ SYNTAX WlanInterfaceEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Information for a cloned wireless interface."
+ INDEX { wlanIfaceName }
+ ::= { wlanInterfaceTable 1 }
+
+WlanInterfaceEntry ::= SEQUENCE {
+ wlanIfaceIndex InterfaceIndex,
+ wlanIfaceName DisplayString,
+ wlanParentIfName DisplayString,
+ wlanIfaceOperatingMode INTEGER,
+ wlanIfaceFlags BITS,
+ wlanIfaceBssid MacAddress,
+ wlanIfaceLocalAddress MacAddress,
+ wlanIfaceStatus RowStatus,
+ wlanIfaceState INTEGER
+}
+
+wlanIfaceIndex OBJECT-TYPE
+ SYNTAX InterfaceIndex
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The ifIndex of this cloned wireless interface."
+ ::= { wlanInterfaceEntry 1 }
+
+wlanIfaceName OBJECT-TYPE
+ SYNTAX DisplayString (SIZE(1..32))
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "The name of this cloned wireless interface."
+ ::= { wlanInterfaceEntry 2 }
+
+wlanParentIfName OBJECT-TYPE
+ SYNTAX DisplayString (SIZE(1..32))
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "The name of this cloned wireless interface's parent hardware
+ interface."
+ ::= { wlanInterfaceEntry 3 }
+
+wlanIfaceOperatingMode OBJECT-TYPE
+ SYNTAX INTEGER {
+ ibss(0),
+ station(1),
+ wds(2),
+ adhocDemo(3),
+ hostAp(4),
+ monitor(5),
+ meshPoint(6),
+ tdma(7)
+ }
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "The desired operating mode of the cloned wireless interface."
+ DEFVAL { station }
+ ::= { wlanInterfaceEntry 4 }
+
+wlanIfaceFlags OBJECT-TYPE
+ SYNTAX BITS {
+ uniqueBssid(1),
+ noBeacons(2),
+ wdsLegacy(3)
+ }
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "Flags per cloned wireless interface used during creation."
+ ::= { wlanInterfaceEntry 5 }
+
+wlanIfaceBssid OBJECT-TYPE
+ SYNTAX MacAddress
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "The BSSID assigned to a cloned wireless interface operating in
+ WDS mode."
+ ::= { wlanInterfaceEntry 6 }
+
+wlanIfaceLocalAddress OBJECT-TYPE
+ SYNTAX MacAddress
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "The unique local MAC address assigned to the cloned wireless
+ interface during creation."
+ ::= { wlanInterfaceEntry 7 }
+
+wlanIfaceStatus OBJECT-TYPE
+ SYNTAX RowStatus
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "This column allows creation or deletion of cloned wireless
+ interfaces."
+ ::= { wlanInterfaceEntry 8 }
+
+wlanIfaceState OBJECT-TYPE
+ SYNTAX INTEGER {
+ up(1),
+ down(2)
+ }
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "The operating state of the interface."
+ ::= { wlanInterfaceEntry 9 }
+
+wlanIfParentTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanIfParentEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains information about the parent hardware
+ interface of every cloned wireless interface in the system."
+ ::= { begemotWlanInterface 2 }
+
+wlanIfParentEntry OBJECT-TYPE
+ SYNTAX WlanIfParentEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Information for the parent hardware interface of a cloned
+ wireless interface."
+ AUGMENTS { wlanInterfaceEntry }
+ ::= { wlanIfParentTable 1 }
+
+WlanIfParentEntry ::= SEQUENCE {
+ wlanIfParentDriverCapabilities BITS,
+ wlanIfParentCryptoCapabilities BITS,
+ wlanIfParentHTCapabilities BITS
+}
+
+wlanIfParentDriverCapabilities OBJECT-TYPE
+ SYNTAX BITS {
+ station(1),
+ ieee8023encap(2),
+ athFastFrames(3),
+ athTurbo(4),
+ ibss(5),
+ pmgt(6),
+ hostAp(7),
+ ahDemo(8),
+ swRetry(9),
+ txPmgt(10),
+ shortSlot(11),
+ shortPreamble(12),
+ monitor(13),
+ dfs(14),
+ mbss(15),
+ wpa1(16),
+ wpa2(17),
+ burst(18),
+ wme(19),
+ wds(20),
+ bgScan(21),
+ txFrag(22),
+ tdma(23)
+ }
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The driver capabilities of this cloned interface's parent."
+ ::= { wlanIfParentEntry 1 }
+
+wlanIfParentCryptoCapabilities OBJECT-TYPE
+ SYNTAX BITS {
+ wep(1),
+ tkip(2),
+ aes(3),
+ aesCcm(4),
+ tkipMic(5),
+ ckip(6)
+ }
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The hardware cryptographic capabilities of this cloned
+ interface's parent."
+ ::= { wlanIfParentEntry 2 }
+
+wlanIfParentHTCapabilities OBJECT-TYPE
+ SYNTAX BITS {
+ ldpc(1),
+ chwidth40(2),
+ greenField(3),
+ shortGi20(4),
+ shortGi40(5),
+ txStbc(6),
+ delba(7),
+ amsdu7935(8),
+ dssscck40(9),
+ psmp(10),
+ fortyMHzIntolerant(11),
+ lsigTxOpProt(12),
+ htcAmpdu(13),
+ htcAmsdu(14),
+ htcHt(15),
+ htcSmps(16),
+ htcRifs(17)
+ }
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The hardware High Throughput capabilities of this cloned
+ interface's parent."
+ ::= { wlanIfParentEntry 3 }
+
+wlanIfaceConfigTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanIfaceConfigEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains a list of configuration parameters per
+ cloned wireless interface. Some of the parameters may not be
+ applicable depending on the underlying device's hardware
+ capabilities and operating mode of the virtual interface."
+ ::= { begemotWlanInterface 3 }
+
+wlanIfaceConfigEntry OBJECT-TYPE
+ SYNTAX WlanIfaceConfigEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A list of configuration parameters for a cloned wireless interface."
+ AUGMENTS { wlanInterfaceEntry }
+ ::= { wlanIfaceConfigTable 1 }
+
+WlanIfaceConfigEntry ::= SEQUENCE {
+ wlanIfacePacketBurst TruthValue,
+ wlanIfaceCountryCode OCTET STRING,
+ wlanIfaceRegDomain INTEGER,
+ wlanIfaceDesiredSsid OCTET STRING,
+ wlanIfaceDesiredChannel INTEGER,
+ wlanIfaceDynamicFreqSelection TruthValue,
+ wlanIfaceFastFrames TruthValue,
+ wlanIfaceDturbo TruthValue,
+ wlanIfaceTxPower INTEGER,
+ wlanIfaceFragmentThreshold INTEGER,
+ wlanIfaceRTSThreshold INTEGER,
+ wlanIfaceWlanPrivacySubscribe TruthValue,
+-- Parameters for station mode
+ wlanIfaceBgScan TruthValue,
+ wlanIfaceBgScanIdle INTEGER,
+ wlanIfaceBgScanInterval INTEGER,
+ wlanIfaceBeaconMissedThreshold INTEGER,
+ wlanIfaceDesiredBssid MacAddress,
+ wlanIfaceRoamingMode INTEGER,
+-- Additional parameters when operating in host-ap/ad-hoc mode
+ wlanIfaceDot11d TruthValue,
+ wlanIfaceDot11h TruthValue,
+ wlanIfaceDynamicWds TruthValue,
+ wlanIfacePowerSave TruthValue,
+ wlanIfaceApBridge TruthValue,
+ wlanIfaceBeaconInterval INTEGER,
+ wlanIfaceDtimPeriod INTEGER,
+ wlanIfaceHideSsid TruthValue,
+ wlanIfaceInactivityProccess TruthValue,
+ wlanIfaceDot11gProtMode INTEGER,
+ wlanIfaceDot11gPureMode TruthValue,
+ wlanIfaceDot11nPureMode TruthValue,
+ wlanIfaceDot11nAmpdu INTEGER,
+ wlanIfaceDot11nAmpduDensity INTEGER,
+ wlanIfaceDot11nAmpduLimit INTEGER,
+ wlanIfaceDot11nAmsdu INTEGER,
+ wlanIfaceDot11nAmsduLimit INTEGER,
+ wlanIfaceDot11nHighThroughput TruthValue,
+ wlanIfaceDot11nHTCompatible TruthValue,
+ wlanIfaceDot11nHTProtMode INTEGER,
+ wlanIfaceDot11nRIFS TruthValue,
+ wlanIfaceDot11nShortGI TruthValue,
+ wlanIfaceDot11nSMPSMode INTEGER,
+-- Parameters when operating in tdma mode
+ wlanIfaceTdmaSlot INTEGER,
+ wlanIfaceTdmaSlotCount INTEGER,
+ wlanIfaceTdmaSlotLength INTEGER,
+ wlanIfaceTdmaBeaconInterval INTEGER
+}
+
+wlanIfacePacketBurst OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object controls whether packet bursting is
+ enabled on the interface."
+ ::= { wlanIfaceConfigEntry 1 }
+
+wlanIfaceCountryCode OBJECT-TYPE
+ SYNTAX OCTET STRING (SIZE(3))
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object controls the country regulatory
+ constraints for operation of this wireless interface. The first
+ two octets of this string is the two character country code as
+ described in ISO/IEC 3166-1. The third octet shall contain one
+ of the following:
+
+ 1. an ASCII space character, if the regulations under which the
+ interface is operating include all environments in the specified
+ country.
+
+ 2. an ASCII 'O' character, if the country's regulastions are for
+ Outdoor environment only.
+
+ 3. an ASCII 'I' character, if the country's regulastions are for
+ Indoor environment only."
+ ::= { wlanIfaceConfigEntry 2 }
+
+wlanIfaceRegDomain OBJECT-TYPE
+ SYNTAX WlanRegDomainCode
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "This object specifies the regulatory domain to use when calculating
+ the regulatory constraints for operation of the interface."
+ ::= { wlanIfaceConfigEntry 3 }
+
+wlanIfaceDesiredSsid OBJECT-TYPE
+ SYNTAX OCTET STRING (SIZE(0..32))
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The desired SSID for the interface as an ASCII string.
+ Specifying an empty string shall remove the current configured
+ SSID."
+ ::= { wlanIfaceConfigEntry 4 }
+
+wlanIfaceDesiredChannel OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The desired operating channel for this interface. The value of this
+ column is the channel index (wlanIfaceChannelId) of the corresponding
+ entry from the wlanIfaceChannelTable. The interface status must be
+ down so that the current operating channel may be set properly."
+ ::= { wlanIfaceConfigEntry 5 }
+
+wlanIfaceDynamicFreqSelection OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether Dynamic Frequency
+ Selection (DFS) as specified in 802.11h is enabled on an
+ interface that supports 802.11h and DFS."
+ DEFVAL { false }
+ ::= { wlanIfaceConfigEntry 6 }
+
+wlanIfaceFastFrames OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object controls whether use of Atheros Fast
+ Frames is enabled when when communicating with another Fast
+ Frames-capable station. The value is only meaningfull for
+ interfaces that support Atheros Fast Frames."
+ ::= { wlanIfaceConfigEntry 7 }
+
+wlanIfaceDturbo OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object controls whether use of Atheros Dynamic
+ Turbo mode is enabled when when communicating with another Dynamic
+ Turbo-capable station. The value is only meaningfull for interfaces
+ that support Atheros Dynamic Turbo mode."
+ ::= { wlanIfaceConfigEntry 8 }
+
+wlanIfaceTxPower OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object controls the power used to transmit
+ frames. Accepted values are in units of one tenths of a dBm in
+ steps of .5 dBm, e.g setting the value of this object to 155
+ results in 15.5 dBm transmit power configured on the interface."
+ ::= { wlanIfaceConfigEntry 9 }
+
+wlanIfaceFragmentThreshold OBJECT-TYPE
+ SYNTAX INTEGER (256..2346)
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object controls the threshold for which
+ transmitted frames are broken into fragments. Setting the value
+ of this object to 2346 will disable transmit fragmentation."
+ DEFVAL { 2346 }
+ ::= { wlanIfaceConfigEntry 10 }
+
+wlanIfaceRTSThreshold OBJECT-TYPE
+ SYNTAX INTEGER (1..2346)
+ UNITS "bytes"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object controls the threshold for which
+ transmitted frames are preceded by transmission of an RTS
+ control frame. Setting the value of this object to 2346 will
+ disable transmission of RTS frames."
+ DEFVAL { 2346 }
+ ::= { wlanIfaceConfigEntry 11 }
+
+wlanIfaceWlanPrivacySubscribe OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether Wireless Privacy
+ Subscriber support is enabled on the interface."
+ ::= { wlanIfaceConfigEntry 12 }
+
+wlanIfaceBgScan OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether background scanning
+ is enabled for an interface operating in station mode."
+ ::= { wlanIfaceConfigEntry 13 }
+
+wlanIfaceBgScanIdle OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "milliseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the minimum time a station must
+ be idle before a background scan is initiated on an interface
+ operating in station mode."
+ DEFVAL { 250 }
+ ::= { wlanIfaceConfigEntry 14 }
+
+wlanIfaceBgScanInterval OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "seconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the interval at which background
+ scanning is attempted when operating in station mode."
+ DEFVAL { 300 }
+ ::= { wlanIfaceConfigEntry 15 }
+
+wlanIfaceBeaconMissedThreshold OBJECT-TYPE
+ SYNTAX INTEGER (1..255)
+ UNITS "frames"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the number of consequtive missed
+ beacons before an interface operating in station mode will attempt
+ to search for a new access point."
+ DEFVAL { 7 }
+ ::= { wlanIfaceConfigEntry 16 }
+
+wlanIfaceDesiredBssid OBJECT-TYPE
+ SYNTAX MacAddress
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the MAC address of the desired
+ access point to use when an interface is operating as a station."
+ ::= { wlanIfaceConfigEntry 17 }
+
+wlanIfaceRoamingMode OBJECT-TYPE
+ SYNTAX INTEGER {
+ device(1),
+ auto(2),
+ manual(3)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the desired system behavior
+ when the interface is operating as a station and the communication
+ with the current access point is broken."
+ DEFVAL { auto }
+ ::= { wlanIfaceConfigEntry 18 }
+
+wlanIfaceDot11d OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether 802.11d specification
+ support is enabled."
+ DEFVAL { false }
+ ::= { wlanIfaceConfigEntry 19 }
+
+wlanIfaceDot11h OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether 802.11h support
+ including spectrum management is enabled. The value is only
+ meaningfull for interfaces that support 802.11h specification."
+ DEFVAL { false }
+ ::= { wlanIfaceConfigEntry 20 }
+
+wlanIfaceDynamicWds OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether Dynamic WDS (DWDS)
+ support is enabled. The value is only meaningfull for interfaces
+ that support Dynamic WDS."
+ ::= { wlanIfaceConfigEntry 21 }
+
+wlanIfacePowerSave OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether powersave operation
+ is enabled. The value is only meaningfull for interfaces that
+ support powersave operation."
+ ::= { wlanIfaceConfigEntry 22 }
+
+wlanIfaceApBridge OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether packets between
+ wireless clients will be passed directly by an interface
+ operating in host ap mode. Disabling it may be usefull in
+ situations when traffic between wireless clients needs to be
+ processed with packet filtering."
+ DEFVAL { true }
+ ::= { wlanIfaceConfigEntry 23 }
+
+wlanIfaceBeaconInterval OBJECT-TYPE
+ SYNTAX INTEGER (25..1000)
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the interval at with beacon
+ frames are sent when an interface is operating in ad-hoc or ap
+ mode. The beacon interval is specified in TU's (1024 usecs)."
+ DEFVAL { 100 }
+ ::= { wlanIfaceConfigEntry 24 }
+
+wlanIfaceDtimPeriod OBJECT-TYPE
+ SYNTAX INTEGER (1..15)
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the DTIM period at which
+ buffered multicast data frames are transmitted by an interface
+ operating in host ap mode. Its value indicates the number of
+ beacon intervals between DTIM."
+ DEFVAL { 1 }
+ ::= { wlanIfaceConfigEntry 25 }
+
+wlanIfaceHideSsid OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether broadcasting of the
+ SSID in beacon frames and responding to undirected probe request
+ frames is enabled for an interface operating in ap mode."
+ DEFVAL { false }
+ ::= { wlanIfaceConfigEntry 26 }
+
+wlanIfaceInactivityProccess OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether inactivity processing
+ for associated station on an interface operating in ap mode is
+ enabled."
+ DEFVAL { true }
+ ::= { wlanIfaceConfigEntry 27 }
+
+wlanIfaceDot11gProtMode OBJECT-TYPE
+ SYNTAX INTEGER {
+ off(1),
+ cts(2),
+ rtscts(3)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the technique used for
+ protecting OFDM frames in a mixed 11b/11g network."
+ ::= { wlanIfaceConfigEntry 28 }
+
+wlanIfaceDot11gPureMode OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether only 802.11g-capable
+ stations will be allowed to associate to an interface operating
+ as access point in 802.11g mode."
+ ::= { wlanIfaceConfigEntry 29 }
+
+wlanIfaceDot11nPureMode OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether only HT-capable
+ stations will be allowed to associate to an interface operating
+ as access point in 802.11n mode."
+ ::= { wlanIfaceConfigEntry 30 }
+
+wlanIfaceDot11nAmpdu OBJECT-TYPE
+ SYNTAX WlanIfaceDot11nPduType
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether sending and
+ receiving of AMPDU frames is enabled on an interface
+ operating in 802.11n mode."
+ DEFVAL { txAndRx }
+ ::= { wlanIfaceConfigEntry 31 }
+
+wlanIfaceDot11nAmpduDensity OBJECT-TYPE
+ SYNTAX INTEGER (0|25|50|100|200|400|800|1600)
+ UNITS "1/100ths-of-microsecond"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the AMPDU density parameter
+ for an interface operating in 802.11n mode."
+ ::= { wlanIfaceConfigEntry 32 }
+
+wlanIfaceDot11nAmpduLimit OBJECT-TYPE
+ SYNTAX INTEGER (8192|16384|32768|65536)
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies a limit on the AMPDU packet
+ size for receiving AMPDU frames for an interface operating in
+ 802.11n mode."
+ ::= { wlanIfaceConfigEntry 33 }
+
+wlanIfaceDot11nAmsdu OBJECT-TYPE
+ SYNTAX WlanIfaceDot11nPduType
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether sending and receiving
+ of AMSDU frames is enabled on an interface operating in 802.11n
+ mode."
+ DEFVAL { rxOnly }
+ ::= { wlanIfaceConfigEntry 34 }
+
+wlanIfaceDot11nAmsduLimit OBJECT-TYPE
+ SYNTAX INTEGER (3839|7935)
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies a limit on the AMSDU packet
+ size when sending and receiving AMSDU frames for an interface
+ operating in 802.11n mode."
+ ::= { wlanIfaceConfigEntry 35 }
+
+wlanIfaceDot11nHighThroughput OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether use of High Throughput
+ (HT) is enabled for an interface operating in 802.11n mode."
+ DEFVAL { true }
+ ::= { wlanIfaceConfigEntry 36 }
+
+wlanIfaceDot11nHTCompatible OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether use of compatibility
+ support for pre-802.11n devices is enabled for an interface
+ operating in 802.11n mode."
+ DEFVAL { true }
+ ::= { wlanIfaceConfigEntry 37 }
+
+wlanIfaceDot11nHTProtMode OBJECT-TYPE
+ SYNTAX INTEGER {
+ off(1),
+ rts(2)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the technique used for
+ protecting HT frames in a mixed legacy/HT network for interfaces
+ operating in 802.11n mode."
+ DEFVAL { rts }
+ ::= { wlanIfaceConfigEntry 38 }
+
+wlanIfaceDot11nRIFS OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether Reduced InterFrame
+ Spacing (RIFS) is enabled for an interface operating in 802.11n
+ mode on an HT channel."
+ ::= { wlanIfaceConfigEntry 39 }
+
+wlanIfaceDot11nShortGI OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether use of Short Guard
+ Interval is enabled on an interface operating in 802.11n mode
+ on an HT channel."
+ ::= { wlanIfaceConfigEntry 40 }
+
+wlanIfaceDot11nSMPSMode OBJECT-TYPE
+ SYNTAX INTEGER {
+ disabled(1),
+ static(2),
+ dynamic(3)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies whether use of Spatial Multiplexing
+ Power Save (SMPS) is enabled on an interface operating in 802.11n mode
+ and whether SMPS mode is set to Static or Dynamic. The value is only
+ meaningfull for interfaces that support SMPS."
+ ::= { wlanIfaceConfigEntry 41 }
+
+wlanIfaceTdmaSlot OBJECT-TYPE
+ SYNTAX INTEGER (0..2)
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the slot configuration to use
+ when operating in TDMA mode."
+ ::= { wlanIfaceConfigEntry 42 }
+
+wlanIfaceTdmaSlotCount OBJECT-TYPE
+ SYNTAX INTEGER (0..2)
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the number of slots to use to
+ setup a BSS for an interface operating in TDMA mode."
+ ::= { wlanIfaceConfigEntry 43 }
+
+wlanIfaceTdmaSlotLength OBJECT-TYPE
+ SYNTAX INTEGER (150..65000)
+ UNITS "microseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies a slot length that each station
+ has when a BSS is setup by an interface operating in TDMA mode."
+ DEFVAL { 10000 }
+ ::= { wlanIfaceConfigEntry 44 }
+
+wlanIfaceTdmaBeaconInterval OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the number of superframes at
+ which a beacon frame is sent to synchronize the TDMA slot timing
+ for interfaces operating in TDMA mode."
+ DEFVAL { 5 }
+ ::= { wlanIfaceConfigEntry 45 }
+
+wlanIfacePeerTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanIfacePeerEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains information about the associated stations
+ for an interface operating as an access point, or the stations
+ identified as neighbors in the IBSS for an interface operating in
+ adhoc mode."
+ ::= { begemotWlanInterface 4 }
+
+wlanIfacePeerEntry OBJECT-TYPE
+ SYNTAX WlanIfacePeerEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "An entry that contains information for the associated stations
+ for an interface operating as an access point, or the neighboring
+ stations of an interface in adhoc mode."
+ INDEX { wlanIfaceName, wlanIfacePeerAddress }
+ ::= { wlanIfacePeerTable 1 }
+
+WlanIfacePeerEntry ::= SEQUENCE {
+ wlanIfacePeerAddress MacAddress,
+ wlanIfacePeerAssociationId INTEGER,
+ wlanIfacePeerVlanTag INTEGER,
+ wlanIfacePeerFrequency INTEGER,
+ wlanIfacePeerCurrentTXRate INTEGER,
+ wlanIfacePeerRxSignalStrength INTEGER,
+ wlanIfacePeerIdleTimer INTEGER,
+ wlanIfacePeerTxSequenceNo INTEGER,
+ wlanIfacePeerRxSequenceNo INTEGER,
+ wlanIfacePeerTxPower INTEGER,
+ wlanIfacePeerCapabilities BITS,
+ wlanIfacePeerFlags BITS
+}
+
+wlanIfacePeerAddress OBJECT-TYPE
+ SYNTAX MacAddress
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The MAC address of this peer."
+ ::= { wlanIfacePeerEntry 1 }
+
+wlanIfacePeerAssociationId OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The ID of the associacition with this peer."
+ ::= { wlanIfacePeerEntry 2 }
+
+wlanIfacePeerVlanTag OBJECT-TYPE
+ SYNTAX INTEGER (0..4096)
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The Vlan Tag for traffic to/from this peer."
+ ::= { wlanIfacePeerEntry 3 }
+
+wlanIfacePeerFrequency OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The operating frequency for the link with this peer."
+ ::= { wlanIfacePeerEntry 4 }
+
+wlanIfacePeerCurrentTXRate OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The current transmit rate for this peer."
+ ::= { wlanIfacePeerEntry 5 }
+
+wlanIfacePeerRxSignalStrength OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The average receive signal strength for this peer."
+ ::= { wlanIfacePeerEntry 6 }
+
+wlanIfacePeerIdleTimer OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "seconds"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The value of this peer's inactivity timer."
+ ::= { wlanIfacePeerEntry 7 }
+
+wlanIfacePeerTxSequenceNo OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The last sequence number transmitted to this peer."
+ ::= { wlanIfacePeerEntry 8 }
+
+wlanIfacePeerRxSequenceNo OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The last sequence number received from this peer."
+ ::= { wlanIfacePeerEntry 9 }
+
+wlanIfacePeerTxPower OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The transmit power limit for this peer."
+ ::= { wlanIfacePeerEntry 10 }
+
+wlanIfacePeerCapabilities OBJECT-TYPE
+ SYNTAX WlanPeerCapabilityFlags
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The capabilities advertised by this peer."
+ ::= { wlanIfacePeerEntry 11 }
+
+wlanIfacePeerFlags OBJECT-TYPE
+ SYNTAX BITS {
+ authorizedForData(1),
+ qosEnabled(2),
+ erpEnabled(3),
+ powerSaveMode(4),
+ authRefHeld(5),
+ htEnabled(6),
+ htCompat(7),
+ wpsAssoc(8),
+ tsnAssoc(9),
+ ampduRx(10),
+ ampduTx(11),
+ mimoPowerSave(12),
+ sendRts(13),
+ rifs(14),
+ shortGiHT20(15),
+ shortGiHT40(16),
+ amsduRx(17),
+ amsduTx(18)
+ }
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The peer state flags."
+ ::= { wlanIfacePeerEntry 12 }
+
+wlanIfaceChannelTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanIfaceChannelEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains information about the active channels for
+ the cloned wireless interfaces in the system."
+ ::= { begemotWlanInterface 5 }
+
+wlanIfaceChannelEntry OBJECT-TYPE
+ SYNTAX WlanIfaceChannelEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "An entry that contains active channel information for the wireless
+ interface."
+ INDEX { wlanIfaceName, wlanIfaceChannelId }
+ ::= { wlanIfaceChannelTable 1 }
+
+WlanIfaceChannelEntry ::= SEQUENCE {
+ wlanIfaceChannelId INTEGER,
+ wlanIfaceChannelIeeeId INTEGER,
+ wlanIfaceChannelType INTEGER,
+ wlanIfaceChannelFlags BITS,
+ wlanIfaceChannelFrequency INTEGER,
+ wlanIfaceChannelMaxRegPower INTEGER,
+ wlanIfaceChannelMaxTxPower INTEGER,
+ wlanIfaceChannelMinTxPower INTEGER,
+ wlanIfaceChannelState BITS,
+ wlanIfaceChannelHTExtension INTEGER,
+ wlanIfaceChannelMaxAntennaGain INTEGER
+}
+
+wlanIfaceChannelId OBJECT-TYPE
+ SYNTAX INTEGER (1..1536)
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "The index of this channel entry."
+ ::= { wlanIfaceChannelEntry 1 }
+
+wlanIfaceChannelIeeeId OBJECT-TYPE
+ SYNTAX INTEGER (1..256)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The channel IEEE ID."
+ ::= { wlanIfaceChannelEntry 2 }
+
+wlanIfaceChannelType OBJECT-TYPE
+ SYNTAX INTEGER {
+ fhss(1),
+ dot11a(2),
+ dot11b(3),
+ dot11g(4),
+ tenMHz(5),
+ fiveMHz(6),
+ turbo(7),
+ ht(8)
+ }
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The operating channel type for this entry."
+ ::= { wlanIfaceChannelEntry 3 }
+
+wlanIfaceChannelFlags OBJECT-TYPE
+ SYNTAX BITS {
+ turbo(1),
+ cck(2),
+ ofdm(3),
+ spectrum2Ghz(4),
+ spectrum5Ghz(5),
+ passiveScan(6),
+ dynamicCckOfdm(7),
+ gfsk(8),
+ spectrum900Mhz(9),
+ dot11aStaticTurbo(10),
+ halfRate(11),
+ quarterRate(12),
+ ht20(13),
+ ht40u(14),
+ ht40d(15),
+ dfs(16),
+ xmit4ms(17),
+ noAdhoc(18),
+ noHostAp(19),
+ dot11d(20)
+ }
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The channel flags."
+ ::= { wlanIfaceChannelEntry 4 }
+
+wlanIfaceChannelFrequency OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The channel frequency setting in Mhz."
+ ::= { wlanIfaceChannelEntry 5 }
+
+wlanIfaceChannelMaxRegPower OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The maximum regulatory tx power in dBm for this channel."
+ ::= { wlanIfaceChannelEntry 6 }
+
+wlanIfaceChannelMaxTxPower OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The maximum tx power in units of .5 dBm for this channel."
+ ::= { wlanIfaceChannelEntry 7 }
+
+wlanIfaceChannelMinTxPower OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The minimum tx power in units of .5 dBm for this channel."
+ ::= { wlanIfaceChannelEntry 8 }
+
+wlanIfaceChannelState OBJECT-TYPE
+ SYNTAX BITS {
+ radar(1),
+ cacDone(2),
+ interferenceDetected(3),
+ radarClear(4)
+ }
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The channel dynamic state."
+ ::= { wlanIfaceChannelEntry 9 }
+
+wlanIfaceChannelHTExtension OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The HT40 extension channel number."
+ ::= { wlanIfaceChannelEntry 10 }
+
+wlanIfaceChannelMaxAntennaGain OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The maximum antenna gain in units of .5 dBm."
+ ::= { wlanIfaceChannelEntry 11 }
+
+-- ---------------------------------------------------------- --
+-- The Scan requests/results for cloned wireless interfaces
+-- ---------------------------------------------------------- --
+
+wlanScanConfigTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanScanConfigEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains a configuration for channel scanning
+ initiated via SNMP."
+ ::= { begemotWlanScanning 1 }
+
+wlanScanConfigEntry OBJECT-TYPE
+ SYNTAX WlanScanConfigEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Per cloned wireless interface channel scan configuration data.
+ The entry will be empty if no scans were initiated via SNMP."
+ INDEX { wlanIfaceName }
+ ::= { wlanScanConfigTable 1 }
+
+WlanScanConfigEntry ::= SEQUENCE {
+ wlanScanFlags BITS,
+ wlanScanDuration INTEGER,
+ wlanScanMinChannelDwellTime INTEGER,
+ wlanScanMaxChannelDwellTime INTEGER,
+ wlanScanConfigStatus INTEGER
+}
+
+wlanScanFlags OBJECT-TYPE
+ SYNTAX BITS {
+ noSelection(1),
+ activeScan(2),
+ pickFirst(3),
+ backgroundScan(4),
+ once(5),
+ noBroadcast(6),
+ noAutoSequencing(7),
+ flushCashe(8),
+ chechCashe(9)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Desired flags for the channel scan."
+ ::= { wlanScanConfigEntry 1 }
+
+wlanScanDuration OBJECT-TYPE
+ SYNTAX INTEGER (1..2147483647)
+ UNITS "milliseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The desired duration of the scan. Setting the value of this object
+ to the highest allowed value will initiate an infinite scan."
+ ::= { wlanScanConfigEntry 2 }
+
+wlanScanMinChannelDwellTime OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "milliseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The minimum channel dwelltime for this scan."
+ ::= { wlanScanConfigEntry 3 }
+
+wlanScanMaxChannelDwellTime OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "milliseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The maximum channel dwelltime for this scan."
+ ::= { wlanScanConfigEntry 4 }
+
+wlanScanConfigStatus OBJECT-TYPE
+ SYNTAX INTEGER {
+ unknown(0),
+ notStarted(1),
+ running(2),
+ finished(3),
+ cancel(4)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "This object is used to initiate or cancel channel scanning on the cloned
+ interface via SNMP. Setting its value to running(2) will initiate channel
+ scanning on the cloned interface, while setting the value to cancel will
+ cancel the current ongoing scan. All other values should be returned in
+ GET operations only."
+ ::= { wlanScanConfigEntry 5 }
+
+wlanScanResultsTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanScanResultsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains scan results for a virtual wireless interface."
+ ::= { begemotWlanScanning 2 }
+
+wlanScanResultsEntry OBJECT-TYPE
+ SYNTAX WlanScanResultsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Per virtual wireless interface channel scan results data."
+ INDEX { wlanIfaceName, wlanScanResultID, wlanScanResultBssid }
+ ::= { wlanScanResultsTable 1 }
+
+WlanScanResultsEntry ::= SEQUENCE {
+ wlanScanResultID OCTET STRING,
+ wlanScanResultBssid MacAddress,
+ wlanScanResultChannel INTEGER,
+ wlanScanResultRate INTEGER,
+ wlanScanResultNoise INTEGER,
+ wlanScanResultBeaconInterval INTEGER,
+ wlanScanResultCapabilities BITS
+}
+
+wlanScanResultID OBJECT-TYPE
+ SYNTAX OCTET STRING (SIZE(0..32))
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The SSID/MESH ID for this scan result entry."
+ ::= { wlanScanResultsEntry 1 }
+
+wlanScanResultBssid OBJECT-TYPE
+ SYNTAX MacAddress
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The BSSID for this scan result entry."
+ ::= { wlanScanResultsEntry 2 }
+
+wlanScanResultChannel OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The operating channel for this scan result entry."
+ ::= { wlanScanResultsEntry 3 }
+
+wlanScanResultRate OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The operating rate of this scan result entry."
+ ::= { wlanScanResultsEntry 4 }
+
+wlanScanResultNoise OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The channel noise for this scan result entry."
+ ::= { wlanScanResultsEntry 5 }
+
+wlanScanResultBeaconInterval OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The beacon interval reported for this scan result entry."
+ ::= { wlanScanResultsEntry 6 }
+
+wlanScanResultCapabilities OBJECT-TYPE
+ SYNTAX WlanPeerCapabilityFlags
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The capabilities advertised for this scan result entry."
+ ::= { wlanScanResultsEntry 7 }
+
+wlanIfRoamParamsTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanIfRoamParamsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains the parameters that govern the roaming
+ operation on a wireless interface."
+ ::= { begemotWlanInterface 6 }
+
+wlanIfRoamParamsEntry OBJECT-TYPE
+ SYNTAX WlanIfRoamParamsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "An entry that contains the roaming parameters of a wireless
+ interface."
+ INDEX { wlanIfaceName, wlanIfRoamPhyMode }
+ ::= { wlanIfRoamParamsTable 1 }
+
+WlanIfRoamParamsEntry ::= SEQUENCE {
+ wlanIfRoamPhyMode INTEGER,
+ wlanIfRoamRxSignalStrength INTEGER,
+ wlanIfRoamTxRateThreshold INTEGER
+}
+
+wlanIfRoamPhyMode OBJECT-TYPE
+ SYNTAX WlanIfPhyMode
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "The PHY mode for this roaming parameters entry."
+ ::= { wlanIfRoamParamsEntry 1 }
+
+wlanIfRoamRxSignalStrength OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The Receive Signal Strength for this roaming parameters entry."
+ ::= { wlanIfRoamParamsEntry 2 }
+
+wlanIfRoamTxRateThreshold OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The transmit rate threshold value for this roaming parameters
+ entry in Mb/s or MCS."
+ ::= { wlanIfRoamParamsEntry 3 }
+
+wlanIfTxParamsTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanIfTxParamsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains the parameters that govern the transmit
+ operation on a wireless interface."
+ ::= { begemotWlanInterface 7 }
+
+wlanIfTxParamsEntry OBJECT-TYPE
+ SYNTAX WlanIfTxParamsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "An entry that contains the transmit parameters of a wireless
+ interface."
+ INDEX { wlanIfaceName, wlanIfTxPhyMode }
+ ::= { wlanIfTxParamsTable 1 }
+
+WlanIfTxParamsEntry ::= SEQUENCE {
+ wlanIfTxPhyMode INTEGER,
+ wlanIfTxUnicastRate INTEGER,
+ wlanIfTxMcastRate INTEGER,
+ wlanIfTxMgmtRate INTEGER,
+ wlanIfTxMaxRetryCount INTEGER
+}
+
+wlanIfTxPhyMode OBJECT-TYPE
+ SYNTAX WlanIfPhyMode
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "The PHY mode for this entry."
+ ::= { wlanIfTxParamsEntry 1 }
+
+wlanIfTxUnicastRate OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies a fixed rate for transmitting
+ unicast frames in this phy mode."
+ ::= { wlanIfTxParamsEntry 2 }
+
+wlanIfTxMcastRate OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies a fixed rate for transmitting
+ broadcast and multicast frames in this phy mode."
+ ::= { wlanIfTxParamsEntry 3 }
+
+wlanIfTxMgmtRate OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies a fixed rate for transmitting
+ management and/or control frames in this phy mode."
+ ::= { wlanIfTxParamsEntry 4 }
+
+wlanIfTxMaxRetryCount OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The maximum number of tries to use when sending unicast frames
+ in this phy mode."
+ ::= { wlanIfTxParamsEntry 5 }
+
+-- ---------------------------------------------------------- --
+-- The Statistics Database for Wireless interfaces
+-- ---------------------------------------------------------- --
+
+wlanIfaceStatisticsTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanIfaceStatisticsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains summary statistics for each virtual wireless
+ interface on the managed device."
+ ::= { begemotWlanStatistics 1 }
+
+wlanIfaceStatisticsEntry OBJECT-TYPE
+ SYNTAX WlanIfaceStatisticsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A list of statistics for each virtual wireless interface."
+ AUGMENTS { wlanInterfaceEntry }
+ ::= { wlanIfaceStatisticsTable 1 }
+
+WlanIfaceStatisticsEntry ::= SEQUENCE {
+ wlanStatsRxBadVersion Counter32,
+ wlanStatsRxTooShort Counter32,
+ wlanStatsRxWrongBssid Counter32,
+ wlanStatsRxDiscardedDups Counter32,
+ wlanStatsRxWrongDir Counter32,
+ wlanStatsRxDiscardMcastEcho Counter32,
+ wlanStatsRxDiscardNoAssoc Counter32,
+ wlanStatsRxWepNoPrivacy Counter32,
+ wlanStatsRxWepUnencrypted Counter32,
+ wlanStatsRxWepFailed Counter32,
+ wlanStatsRxDecapsulationFailed Counter32,
+ wlanStatsRxDiscardMgmt Counter32,
+ wlanStatsRxControl Counter32,
+ wlanStatsRxBeacon Counter32,
+ wlanStatsRxRateSetTooBig Counter32,
+ wlanStatsRxElemMissing Counter32,
+ wlanStatsRxElemTooBig Counter32,
+ wlanStatsRxElemTooSmall Counter32,
+ wlanStatsRxElemUnknown Counter32,
+ wlanStatsRxChannelMismatch Counter32,
+ wlanStatsRxDropped Counter32,
+ wlanStatsRxSsidMismatch Counter32,
+ wlanStatsRxAuthNotSupported Counter32,
+ wlanStatsRxAuthFailed Counter32,
+ wlanStatsRxAuthCM Counter32,
+ wlanStatsRxAssocWrongBssid Counter32,
+ wlanStatsRxAssocNoAuth Counter32,
+ wlanStatsRxAssocCapMismatch Counter32,
+ wlanStatsRxAssocNoRateMatch Counter32,
+ wlanStatsRxBadWpaIE Counter32,
+ wlanStatsRxDeauthenticate Counter32,
+ wlanStatsRxDisassociate Counter32,
+ wlanStatsRxUnknownSubtype Counter32,
+ wlanStatsRxFailedNoBuf Counter32,
+ wlanStatsRxBadAuthRequest Counter32,
+ wlanStatsRxUnAuthorized Counter32,
+ wlanStatsRxBadKeyId Counter32,
+ wlanStatsRxCCMPSeqViolation Counter32,
+ wlanStatsRxCCMPBadFormat Counter32,
+ wlanStatsRxCCMPFailedMIC Counter32,
+ wlanStatsRxTKIPSeqViolation Counter32,
+ wlanStatsRxTKIPBadFormat Counter32,
+ wlanStatsRxTKIPFailedMIC Counter32,
+ wlanStatsRxTKIPFailedICV Counter32,
+ wlanStatsRxDiscardACL Counter32,
+ wlanStatsTxFailedNoBuf Counter32,
+ wlanStatsTxFailedNoNode Counter32,
+ wlanStatsTxUnknownMgmt Counter32,
+ wlanStatsTxBadCipher Counter32,
+ wlanStatsTxNoDefKey Counter32,
+ wlanStatsTxFragmented Counter32,
+ wlanStatsTxFragmentsCreated Counter32,
+ wlanStatsActiveScans Counter32,
+ wlanStatsPassiveScans Counter32,
+ wlanStatsTimeoutInactivity Counter32,
+ wlanStatsCryptoNoMem Counter32,
+ wlanStatsSwCryptoTKIP Counter32,
+ wlanStatsSwCryptoTKIPEnMIC Counter32,
+ wlanStatsSwCryptoTKIPDeMIC Counter32,
+ wlanStatsCryptoTKIPCM Counter32,
+ wlanStatsSwCryptoCCMP Counter32,
+ wlanStatsSwCryptoWEP Counter32,
+ wlanStatsCryptoCipherKeyRejected Counter32,
+ wlanStatsCryptoNoKey Counter32,
+ wlanStatsCryptoDeleteKeyFailed Counter32,
+ wlanStatsCryptoUnknownCipher Counter32,
+ wlanStatsCryptoAttachFailed Counter32,
+ wlanStatsCryptoKeyFailed Counter32,
+ wlanStatsCryptoEnMICFailed Counter32,
+ wlanStatsIBSSCapMismatch Counter32,
+ wlanStatsUnassocStaPSPoll Counter32,
+ wlanStatsBadAidPSPoll Counter32,
+ wlanStatsEmptyPSPoll Counter32,
+ wlanStatsRxFFBadHdr Counter32,
+ wlanStatsRxFFTooShort Counter32,
+ wlanStatsRxFFSplitError Counter32,
+ wlanStatsRxFFDecap Counter32,
+ wlanStatsTxFFEncap Counter32,
+ wlanStatsRxBadBintval Counter32,
+ wlanStatsRxDemicFailed Counter32,
+ wlanStatsRxDefragFailed Counter32,
+ wlanStatsRxMgmt Counter32,
+ wlanStatsRxActionMgmt Counter32,
+ wlanStatsRxAMSDUTooShort Counter32,
+ wlanStatsRxAMSDUSplitError Counter32,
+ wlanStatsRxAMSDUDecap Counter32,
+ wlanStatsTxAMSDUEncap Counter32,
+ wlanStatsAMPDUBadBAR Counter32,
+ wlanStatsAMPDUOowBar Counter32,
+ wlanStatsAMPDUMovedBAR Counter32,
+ wlanStatsAMPDURxBAR Counter32,
+ wlanStatsAMPDURxOor Counter32,
+ wlanStatsAMPDURxCopied Counter32,
+ wlanStatsAMPDURxDropped Counter32,
+ wlanStatsTxDiscardBadState Counter32,
+ wlanStatsTxFailedNoAssoc Counter32,
+ wlanStatsTxClassifyFailed Counter32,
+ wlanStatsDwdsMcastDiscard Counter32,
+ wlanStatsHTAssocRejectNoHT Counter32,
+ wlanStatsHTAssocDowngrade Counter32,
+ wlanStatsHTAssocRateMismatch Counter32,
+ wlanStatsAMPDURxAge Counter32,
+ wlanStatsAMPDUMoved Counter32,
+ wlanStatsADDBADisabledReject Counter32,
+ wlanStatsADDBANoRequest Counter32,
+ wlanStatsADDBABadToken Counter32,
+ wlanStatsADDBABadPolicy Counter32,
+ wlanStatsAMPDUStopped Counter32,
+ wlanStatsAMPDUStopFailed Counter32,
+ wlanStatsAMPDURxReorder Counter32,
+ wlanStatsScansBackground Counter32,
+ wlanLastDeauthReason INTEGER,
+ wlanLastDissasocReason INTEGER,
+ wlanLastAuthFailReason INTEGER,
+ wlanStatsBeaconMissedEvents Counter32,
+ wlanStatsRxDiscardBadStates Counter32,
+ wlanStatsFFFlushed Counter32,
+ wlanStatsTxControlFrames Counter32,
+ wlanStatsAMPDURexmt Counter32,
+ wlanStatsAMPDURexmtFailed Counter32,
+ wlanStatsReset INTEGER
+}
+
+wlanStatsRxBadVersion OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that had bad version."
+ ::= { wlanIfaceStatisticsEntry 1 }
+
+wlanStatsRxTooShort OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that were too short."
+ ::= { wlanIfaceStatisticsEntry 2 }
+
+wlanStatsRxWrongBssid OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface with wrong BSSID."
+ ::= { wlanIfaceStatisticsEntry 3 }
+
+wlanStatsRxDiscardedDups OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of received discarded duplicate frames by this interface."
+ ::= { wlanIfaceStatisticsEntry 4 }
+
+wlanStatsRxWrongDir OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of received frames by this interface that were dropped
+ due to wrong direction."
+ ::= { wlanIfaceStatisticsEntry 5 }
+
+wlanStatsRxDiscardMcastEcho OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of received multicast echo frames discarded by this
+ interface."
+ ::= { wlanIfaceStatisticsEntry 6 }
+
+wlanStatsRxDiscardNoAssoc OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that were dropped
+ since no association existed with the sending station."
+ ::= { wlanIfaceStatisticsEntry 7 }
+
+wlanStatsRxWepNoPrivacy OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that were dropped
+ since they contained WEP information and WEP privacy was off."
+ ::= { wlanIfaceStatisticsEntry 8 }
+
+wlanStatsRxWepUnencrypted OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that were dropped
+ since they contained no WEP information and WEP privacy was on."
+ ::= { wlanIfaceStatisticsEntry 9 }
+
+wlanStatsRxWepFailed OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that were dropped
+ since processing of the WEP information contained in them failed."
+ ::= { wlanIfaceStatisticsEntry 10 }
+
+wlanStatsRxDecapsulationFailed OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of received frames that were discarded by this interface
+ due to decapsulation failure."
+ ::= { wlanIfaceStatisticsEntry 11 }
+
+wlanStatsRxDiscardMgmt OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of received management frames discarded by this interface."
+ ::= { wlanIfaceStatisticsEntry 12 }
+
+wlanStatsRxControl OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of control frames received by this interface."
+ ::= { wlanIfaceStatisticsEntry 13 }
+
+wlanStatsRxBeacon OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of beacon frames received by this interface."
+ ::= { wlanIfaceStatisticsEntry 14 }
+
+wlanStatsRxRateSetTooBig OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface with extended
+ supported rate element."
+ ::= { wlanIfaceStatisticsEntry 15 }
+
+wlanStatsRxElemMissing OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that were missing
+ a required element."
+ ::= { wlanIfaceStatisticsEntry 16 }
+
+wlanStatsRxElemTooBig OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that contained an
+ information element whose size was too big."
+ ::= { wlanIfaceStatisticsEntry 17 }
+
+wlanStatsRxElemTooSmall OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that contained an
+ information element whose size was too small."
+ ::= { wlanIfaceStatisticsEntry 18 }
+
+wlanStatsRxElemUnknown OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that contained an
+ unknown information element."
+ ::= { wlanIfaceStatisticsEntry 19 }
+
+wlanStatsRxChannelMismatch OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface, that were discarded
+ since they were received on a channel different from the one indicated
+ in the DS params element id."
+ ::= { wlanIfaceStatisticsEntry 20 }
+
+wlanStatsRxDropped OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that were dropped due
+ to unknown reason."
+ ::= { wlanIfaceStatisticsEntry 21 }
+
+wlanStatsRxSsidMismatch OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that had a bad SSID."
+ ::= { wlanIfaceStatisticsEntry 22 }
+
+wlanStatsRxAuthNotSupported OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that contained an
+ unknown authentication algorithm."
+ ::= { wlanIfaceStatisticsEntry 23 }
+
+wlanStatsRxAuthFailed OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface for which the
+ authentication failed."
+ ::= { wlanIfaceStatisticsEntry 24 }
+
+wlanStatsRxAuthCM OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface for which the
+ authentication failed due to TKIP countermeasures enabled."
+ ::= { wlanIfaceStatisticsEntry 25 }
+
+wlanStatsRxAssocWrongBssid OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface with association
+ request that had a bad BSSID."
+ ::= { wlanIfaceStatisticsEntry 26 }
+
+wlanStatsRxAssocNoAuth OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface with association
+ request that came from unauthentication node."
+ ::= { wlanIfaceStatisticsEntry 27 }
+
+wlanStatsRxAssocCapMismatch OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface with association
+ request that had bad capabilities set."
+ ::= { wlanIfaceStatisticsEntry 28 }
+
+wlanStatsRxAssocNoRateMatch OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface with association
+ request that had unsupported rate set."
+ ::= { wlanIfaceStatisticsEntry 29 }
+
+wlanStatsRxBadWpaIE OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface with association
+ request that had no or invalid WPA information element."
+ ::= { wlanIfaceStatisticsEntry 30 }
+
+wlanStatsRxDeauthenticate OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of deauthentication requests received by this interface."
+ ::= { wlanIfaceStatisticsEntry 31 }
+
+wlanStatsRxDisassociate OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of deassociation requests received by this interface."
+ ::= { wlanIfaceStatisticsEntry 32 }
+
+wlanStatsRxUnknownSubtype OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that had unknown
+ subtype."
+ ::= { wlanIfaceStatisticsEntry 33 }
+
+wlanStatsRxFailedNoBuf OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that were dropped
+ due to lack of free buffers."
+ ::= { wlanIfaceStatisticsEntry 34 }
+
+wlanStatsRxBadAuthRequest OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface for which
+ authentication failed."
+ ::= { wlanIfaceStatisticsEntry 35 }
+
+wlanStatsRxUnAuthorized OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of non-PAE frames received by this interface prior to
+ authorization."
+ ::= { wlanIfaceStatisticsEntry 36 }
+
+wlanStatsRxBadKeyId OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface with bad key."
+ ::= { wlanIfaceStatisticsEntry 37 }
+
+wlanStatsRxCCMPSeqViolation OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that caused CCMP
+ sequence violation."
+ ::= { wlanIfaceStatisticsEntry 38 }
+
+wlanStatsRxCCMPBadFormat OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that had bad CCMP
+ format."
+ ::= { wlanIfaceStatisticsEntry 39 }
+
+wlanStatsRxCCMPFailedMIC OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames receivbed by this interface for which CCMP
+ decryption failed due to MIC mismatch."
+ ::= { wlanIfaceStatisticsEntry 40 }
+
+wlanStatsRxTKIPSeqViolation OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that caused TKIP
+ sequence violation.."
+ ::= { wlanIfaceStatisticsEntry 41 }
+
+wlanStatsRxTKIPBadFormat OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that were missing
+ TKIP ExtIV."
+ ::= { wlanIfaceStatisticsEntry 42 }
+
+wlanStatsRxTKIPFailedMIC OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface for which TKIP
+ decryption failed due to MIC mismatch."
+ ::= { wlanIfaceStatisticsEntry 43 }
+
+wlanStatsRxTKIPFailedICV OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface for which TKIP
+ decryption failed due to ICV mismatch."
+ ::= { wlanIfaceStatisticsEntry 44 }
+
+wlanStatsRxDiscardACL OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface that were
+ disallowed by ACL."
+ ::= { wlanIfaceStatisticsEntry 45 }
+
+wlanStatsTxFailedNoBuf OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were not transmitted by this interface
+ due to lack of free buffers."
+ ::= { wlanIfaceStatisticsEntry 46 }
+
+wlanStatsTxFailedNoNode OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were queued for transmit on this interface
+ but were not sent since appropriate node for sending was not found."
+ ::= { wlanIfaceStatisticsEntry 47 }
+
+wlanStatsTxUnknownMgmt OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of unknown management frames transmitted by this interface."
+ ::= { wlanIfaceStatisticsEntry 48 }
+
+wlanStatsTxBadCipher OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were queued for transmit on this interface
+ but were not send since the specified key was not setup."
+ ::= { wlanIfaceStatisticsEntry 49 }
+
+wlanStatsTxNoDefKey OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were queued for transmit on this interface
+ but were not send since an appropriate key was not found."
+ ::= { wlanIfaceStatisticsEntry 50 }
+
+wlanStatsTxFragmented OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of fragmented frames transmitted by this interface."
+ ::= { wlanIfaceStatisticsEntry 51 }
+
+wlanStatsTxFragmentsCreated OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of created fragments transmitted by this interface."
+ ::= { wlanIfaceStatisticsEntry 52 }
+
+wlanStatsActiveScans OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of active scans performed by this interface."
+ ::= { wlanIfaceStatisticsEntry 53 }
+
+wlanStatsPassiveScans OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of passive scans performed by this interface."
+ ::= { wlanIfaceStatisticsEntry 54 }
+
+wlanStatsTimeoutInactivity OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times a station/node was dropped by this interface
+ due to inactivity timeout."
+ ::= { wlanIfaceStatisticsEntry 55 }
+
+wlanStatsCryptoNoMem OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number times attaching a crypto protocol to this interface
+ failed due to lack of memory."
+ ::= { wlanIfaceStatisticsEntry 56 }
+
+wlanStatsSwCryptoTKIP OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times TKIP encryption/decryption was handled in
+ software for frames received/transmitted by this interface."
+ ::= { wlanIfaceStatisticsEntry 57 }
+
+wlanStatsSwCryptoTKIPEnMIC OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times TKIP MIC was added in software to frames
+ transmitted by this interface."
+ ::= { wlanIfaceStatisticsEntry 58 }
+
+wlanStatsSwCryptoTKIPDeMIC OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times TKIP MIC was stripped in software from frames
+ received by this interface."
+ ::= { wlanIfaceStatisticsEntry 59 }
+
+wlanStatsCryptoTKIPCM OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames discarded by this interface due to TKIP
+ counter measures."
+ ::= { wlanIfaceStatisticsEntry 60 }
+
+wlanStatsSwCryptoCCMP OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times CCMP encryption/decryption was handled in
+ software for frames received/transmitted by this interface."
+ ::= { wlanIfaceStatisticsEntry 61 }
+
+wlanStatsSwCryptoWEP OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times WEP encryption/decryption was handled in
+ software for frames received/transmitted by this interface."
+ ::= { wlanIfaceStatisticsEntry 62 }
+
+wlanStatsCryptoCipherKeyRejected OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times a key was rejected for this interface."
+ ::= { wlanIfaceStatisticsEntry 63 }
+
+wlanStatsCryptoNoKey OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times key setup for this interface failed."
+ ::= { wlanIfaceStatisticsEntry 64 }
+
+wlanStatsCryptoDeleteKeyFailed OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times key deletion from driver for this interface
+ failed."
+ ::= { wlanIfaceStatisticsEntry 65 }
+
+wlanStatsCryptoUnknownCipher OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times key setup for this interface failed due to
+ invalid cipher."
+ ::= { wlanIfaceStatisticsEntry 66 }
+
+wlanStatsCryptoAttachFailed OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times attaching a cipher for this interface failed."
+ ::= { wlanIfaceStatisticsEntry 67 }
+
+wlanStatsCryptoKeyFailed OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times setting a cipher in the driver for this
+ interface failed."
+ ::= { wlanIfaceStatisticsEntry 68 }
+
+wlanStatsCryptoEnMICFailed OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were discarded by by this interface
+ due to failed enmic."
+ ::= { wlanIfaceStatisticsEntry 69 }
+
+wlanStatsIBSSCapMismatch OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times a BSSID change failed for an interface operating
+ in ad hoc mode due to capabilities mismatch."
+ ::= { wlanIfaceStatisticsEntry 70 }
+
+wlanStatsUnassocStaPSPoll OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of ps-poll frames from unassociated station received
+ by this interface."
+ ::= { wlanIfaceStatisticsEntry 71 }
+
+wlanStatsBadAidPSPoll OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of ps-poll frames with incorrect aid received by this
+ interface."
+ ::= { wlanIfaceStatisticsEntry 72 }
+
+wlanStatsEmptyPSPoll OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of empty ps-poll frames received by this interface."
+ ::= { wlanIfaceStatisticsEntry 73 }
+
+wlanStatsRxFFBadHdr OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of fast frames with bad header received by this interface."
+ ::= { wlanIfaceStatisticsEntry 74 }
+
+wlanStatsRxFFTooShort OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of fast frames received by this interface, for which
+ decapsulation failed."
+ ::= { wlanIfaceStatisticsEntry 75 }
+
+wlanStatsRxFFSplitError OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of fast frames received by this interface, for which
+ decapsulation failed during split."
+ ::= { wlanIfaceStatisticsEntry 76 }
+
+wlanStatsRxFFDecap OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of fast frames received by this interface, that were
+ successfully decapsulated."
+ ::= { wlanIfaceStatisticsEntry 77 }
+
+wlanStatsTxFFEncap OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of encapsulated fast frames transmitted by this interface."
+ ::= { wlanIfaceStatisticsEntry 78 }
+
+wlanStatsRxBadBintval OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames with bogus beacon interval received by this
+ interface."
+ ::= { wlanIfaceStatisticsEntry 79 }
+
+wlanStatsRxDemicFailed OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface for which
+ stripping of the MIC failed."
+ ::= { wlanIfaceStatisticsEntry 80 }
+
+wlanStatsRxDefragFailed OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received by this interface for which
+ defragmentation failed."
+ ::= { wlanIfaceStatisticsEntry 81 }
+
+wlanStatsRxMgmt OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of management frames received by this interface."
+ ::= { wlanIfaceStatisticsEntry 82 }
+
+wlanStatsRxActionMgmt OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of action management frames received by this interface."
+ ::= { wlanIfaceStatisticsEntry 83 }
+
+wlanStatsRxAMSDUTooShort OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of A-MSDU frames received by this interface for which
+ decapsulaiton failed."
+ ::= { wlanIfaceStatisticsEntry 84 }
+
+wlanStatsRxAMSDUSplitError OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of A-MSDU frames received by this interface for which
+ split failed."
+ ::= { wlanIfaceStatisticsEntry 85 }
+
+wlanStatsRxAMSDUDecap OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of A-MSDU frames received by this interface which
+ were successfully decapsulaited."
+ ::= { wlanIfaceStatisticsEntry 86 }
+
+wlanStatsTxAMSDUEncap OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of encapsulated A-MSDU frames transmitted by this
+ interface."
+ ::= { wlanIfaceStatisticsEntry 87 }
+
+wlanStatsAMPDUBadBAR OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of A-MPDU frames that were dropped by this interface
+ source BAR frame processing was disabled."
+ ::= { wlanIfaceStatisticsEntry 88 }
+
+wlanStatsAMPDUOowBar OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of A-MPDU BAR before ADDBA frames received by this
+ interface."
+ ::= { wlanIfaceStatisticsEntry 89 }
+
+wlanStatsAMPDUMovedBAR OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times a BAR moved window occurred."
+ ::= { wlanIfaceStatisticsEntry 90 }
+
+wlanStatsAMPDURxBAR OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of A-MPDU BAR frames received by this interface."
+ ::= { wlanIfaceStatisticsEntry 91 }
+
+wlanStatsAMPDURxOor OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of out-of-order A-MPDU frames by received this interface."
+ ::= { wlanIfaceStatisticsEntry 92 }
+
+wlanStatsAMPDURxCopied OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of A-MPDU frames by copied down this interface."
+ ::= { wlanIfaceStatisticsEntry 93 }
+
+wlanStatsAMPDURxDropped OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of A-MPDU frames by dropped this interface."
+ ::= { wlanIfaceStatisticsEntry 94 }
+
+wlanStatsTxDiscardBadState OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames queued for transmit on this interface that
+ were discarded due to interface state not ready for transmit."
+ ::= { wlanIfaceStatisticsEntry 95 }
+
+wlanStatsTxFailedNoAssoc OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames queued for transmit on this interface that
+ were discarded since the receiving station was not associated."
+ ::= { wlanIfaceStatisticsEntry 96 }
+
+wlanStatsTxClassifyFailed OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames queued for transmit on this interface that
+ were discarded since their priority was not determined."
+ ::= { wlanIfaceStatisticsEntry 97 }
+
+wlanStatsDwdsMcastDiscard OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of multicast over DWDS frames discared by this interface."
+ ::= { wlanIfaceStatisticsEntry 98 }
+
+wlanStatsHTAssocRejectNoHT OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of management frames received from a non-HT stations
+ that were rejected by this interface."
+ ::= { wlanIfaceStatisticsEntry 99 }
+
+wlanStatsHTAssocDowngrade OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times HT was dissallowed for an association on
+ this interface due to WEP or TKIP requested."
+ ::= { wlanIfaceStatisticsEntry 100 }
+
+wlanStatsHTAssocRateMismatch OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times rate mismatch occured furing HT rate set
+ handling on this interface."
+ ::= { wlanIfaceStatisticsEntry 101 }
+
+wlanStatsAMPDURxAge OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of A-MPDU frames sent by this interface due to aging out."
+ ::= { wlanIfaceStatisticsEntry 102 }
+
+wlanStatsAMPDUMoved OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of time A-MPDU MSDU moved window occured for this
+ interface."
+ ::= { wlanIfaceStatisticsEntry 103 }
+
+wlanStatsADDBADisabledReject OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of received ADDBA frames that were discarded by this
+ interface since ADDBA was disabled."
+ ::= { wlanIfaceStatisticsEntry 104 }
+
+wlanStatsADDBANoRequest OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of received ADDBA responces frames that were discarded
+ by this interface due to no pending ADDBA."
+ ::= { wlanIfaceStatisticsEntry 105 }
+
+wlanStatsADDBABadToken OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of received ADDBA responce frames that were discarded
+ by this interface since ADDBA response caused dialogtoken mismatch."
+ ::= { wlanIfaceStatisticsEntry 106 }
+
+wlanStatsADDBABadPolicy OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of received ADDBA responce frames that were discarded
+ by this interface since ADDBA response caused policy mismatch."
+ ::= { wlanIfaceStatisticsEntry 107 }
+
+wlanStatsAMPDUStopped OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times a A-MPDU stream stopped on this interface."
+ ::= { wlanIfaceStatisticsEntry 108 }
+
+wlanStatsAMPDUStopFailed OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times a A-MPDU stream stop failed on this interface."
+ ::= { wlanIfaceStatisticsEntry 109 }
+
+wlanStatsAMPDURxReorder OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of received reordered A-MPDU frames on this interface."
+ ::= { wlanIfaceStatisticsEntry 110 }
+
+wlanStatsScansBackground OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of background scans started on this interface."
+ ::= { wlanIfaceStatisticsEntry 111 }
+
+wlanLastDeauthReason OBJECT-TYPE
+ SYNTAX WlanMgmtReasonCode
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The last received deauthenticate reason on this interface."
+ ::= { wlanIfaceStatisticsEntry 112 }
+
+wlanLastDissasocReason OBJECT-TYPE
+ SYNTAX WlanMgmtReasonCode
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The last received dissasociate reason on this interface."
+ ::= { wlanIfaceStatisticsEntry 113 }
+
+wlanLastAuthFailReason OBJECT-TYPE
+ SYNTAX WlanMgmtReasonCode
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The last received authentication failed reason on this interface."
+ ::= { wlanIfaceStatisticsEntry 114 }
+
+wlanStatsBeaconMissedEvents OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of beacon miss notification events on this interface."
+ ::= { wlanIfaceStatisticsEntry 115 }
+
+wlanStatsRxDiscardBadStates OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames received on this interface that were discarded
+ due to interface state not ready for receive."
+ ::= { wlanIfaceStatisticsEntry 116 }
+
+wlanStatsFFFlushed OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of fast frames flushed from the stage queue on this
+ interface."
+ ::= { wlanIfaceStatisticsEntry 117 }
+
+wlanStatsTxControlFrames OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of control frames transmitted by this interface."
+ ::= { wlanIfaceStatisticsEntry 118 }
+
+wlanStatsAMPDURexmt OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of A-MPDU frames successfully retransmitted by this
+ interface."
+ ::= { wlanIfaceStatisticsEntry 119 }
+
+wlanStatsAMPDURexmtFailed OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of A-MPDU frames for which retransmition failed on
+ this interface."
+ ::= { wlanIfaceStatisticsEntry 120 }
+
+wlanStatsReset OBJECT-TYPE
+ SYNTAX INTEGER {
+ no-op(1),
+ clear(2)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object is used to reset the statistics on this
+ interface."
+ ::= { wlanIfaceStatisticsEntry 121 }
+
+-- ---------------------------------------------------------- --
+-- The WEP Configuration Database for Wireless interfaces
+-- ---------------------------------------------------------- --
+
+wlanWepInterfaceTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanWepInterfaceEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains WEP configuration for the wireless interfaces
+ on the managed system."
+ ::= { begemotWlanWep 1 }
+
+wlanWepInterfaceEntry OBJECT-TYPE
+ SYNTAX WlanWepInterfaceEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "WEP Configuration for wireless interface."
+ INDEX { wlanIfaceName}
+ ::= { wlanWepInterfaceTable 1 }
+
+WlanWepInterfaceEntry ::= SEQUENCE {
+ wlanWepMode INTEGER,
+ wlanWepDefTxKey INTEGER
+}
+
+wlanWepMode OBJECT-TYPE
+ SYNTAX INTEGER {
+ off(0),
+ on(1),
+ mixed(2)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The WEP mode set on the interface."
+ DEFVAL { off }
+ ::= { wlanWepInterfaceEntry 1 }
+
+wlanWepDefTxKey OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The index of the default WEP key for the interface."
+ ::= { wlanWepInterfaceEntry 2 }
+
+wlanWepKeyTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanWepKeyEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains the configured WEP keys for a virtual
+ wireless interface."
+ ::= { begemotWlanWep 2 }
+
+wlanWepKeyEntry OBJECT-TYPE
+ SYNTAX WlanWepKeyEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A configured WEP Key entry."
+ INDEX { wlanIfaceName, wlanWepKeyID }
+ ::= { wlanWepKeyTable 1 }
+
+WlanWepKeyEntry ::= SEQUENCE {
+ wlanWepKeyID INTEGER,
+ wlanWepKeyLength INTEGER,
+ wlanWepKeySet OCTET STRING,
+ wlanWepKeyHash OCTET STRING,
+ wlanWepKeyStatus RowStatus
+}
+
+wlanWepKeyID OBJECT-TYPE
+ SYNTAX INTEGER (1..4)
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The WEP Key ID."
+ ::= { wlanWepKeyEntry 1 }
+
+wlanWepKeyLength OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The WEP Key length."
+ ::= { wlanWepKeyEntry 2 }
+
+wlanWepKeySet OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The WEP Key String to configure for this key. When GET is attempted
+ for this column, an empty Octet String is returned."
+ ::= { wlanWepKeyEntry 3 }
+
+wlanWepKeyHash OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The SHA256 hash produced of the WEP Key String."
+ ::= { wlanWepKeyEntry 4 }
+
+wlanWepKeyStatus OBJECT-TYPE
+ SYNTAX RowStatus
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "This object is used for creating/deleting WEP keys."
+ ::= { wlanWepKeyEntry 5 }
+
+-- ---------------------------------------------------------- --
+-- The MAC Access Control Database for Wireless interfaces
+-- ---------------------------------------------------------- --
+
+wlanMACAccessControlTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanMACAccessControlEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains Access Control configuration for wireless
+ interfaces operating as an access point."
+ ::= { begemotWlanMACAccessControl 1 }
+
+wlanMACAccessControlEntry OBJECT-TYPE
+ SYNTAX WlanMACAccessControlEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "The MAC Access Control configuration for a wireless interface
+ operating as an access point."
+ INDEX { wlanIfaceName}
+ ::= { wlanMACAccessControlTable 1 }
+
+WlanMACAccessControlEntry ::= SEQUENCE {
+ wlanMACAccessControlPolicy INTEGER,
+ wlanMACAccessControlNacl Counter32,
+ wlanMACAccessControlFlush INTEGER
+}
+
+wlanMACAccessControlPolicy OBJECT-TYPE
+ SYNTAX INTEGER {
+ open(0),
+ allow(1),
+ deny(2),
+ radius(7)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the MAC Access Control policy
+ for this Host AP interface."
+ DEFVAL { open }
+ ::= { wlanMACAccessControlEntry 1 }
+
+wlanMACAccessControlNacl OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of active MAC Access Control Entries in the Database
+ for this Host AP interface."
+ ::= { wlanMACAccessControlEntry 2 }
+
+wlanMACAccessControlFlush OBJECT-TYPE
+ SYNTAX INTEGER {
+ no-op(0),
+ flush(1)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "This object is used to flush all entries from the MAC Access
+ Control Database for the specified virtual wireless interface."
+ ::= { wlanMACAccessControlEntry 3 }
+
+wlanMACAccessControlMACTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanMACAccessControlMACEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains Access Control MAC for virtual wireless
+ interfaces operating in Host AP mode."
+ ::= { begemotWlanMACAccessControl 2 }
+
+wlanMACAccessControlMACEntry OBJECT-TYPE
+ SYNTAX WlanMACAccessControlMACEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "The MAC Access Control configuration database with MAC addresses
+ for a virtual wireless interface."
+ INDEX { wlanIfaceName, wlanMACAccessControlMAC }
+ ::= { wlanMACAccessControlMACTable 1 }
+
+WlanMACAccessControlMACEntry ::= SEQUENCE {
+ wlanMACAccessControlMAC MacAddress,
+ wlanMACAccessControlMACStatus RowStatus
+}
+
+wlanMACAccessControlMAC OBJECT-TYPE
+ SYNTAX MacAddress
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The value of this object specifies the station's MAC to which
+ the Access Control policy will be applied."
+ ::= { wlanMACAccessControlMACEntry 1 }
+
+wlanMACAccessControlMACStatus OBJECT-TYPE
+ SYNTAX RowStatus
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The object is used to add or delete MAC entries from the Access
+ Control Database for this interface operating in Host AP mode.
+ To add an entry the value of this object should be set to createAndGo,
+ a value of destroy will remove an existing entry. A GET on this object
+ will always return value active."
+ ::= { wlanMACAccessControlMACEntry 2 }
+
+-- ---------------------------------------------------------- --
+-- The Mesh Routing Database for interfaces operating in mesh mode
+-- ---------------------------------------------------------- --
+
+wlanMeshRoutingConfig OBJECT IDENTIFIER ::= { begemotWlanMeshRouting 1 }
+
+wlanMeshInterface OBJECT IDENTIFIER ::= { begemotWlanMeshRouting 2 }
+
+wlanMeshRoute OBJECT IDENTIFIER ::= { begemotWlanMeshRouting 3 }
+
+wlanMeshStatistics OBJECT IDENTIFIER ::= { begemotWlanMeshRouting 4 }
+
+wlanMeshRouteProtocols OBJECT IDENTIFIER ::= { begemotWlanMeshRouting 5 }
+
+wlanMeshMaxRetries OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Maximum retries during peer link establishment for wireless mesh
+ routing operation."
+ DEFVAL { 2 }
+ ::= { wlanMeshRoutingConfig 1 }
+
+wlanMeshConfirmTimeout OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "milliseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Confirm state timeout for wireless mesh routing operation."
+ DEFVAL { 40 }
+ ::= { wlanMeshRoutingConfig 2 }
+
+wlanMeshHoldingTimeout OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "milliseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Holding state timeout for wireless mesh routing operation."
+ DEFVAL { 40 }
+ ::= { wlanMeshRoutingConfig 3 }
+
+wlanMeshRetryTimeout OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "milliseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Retry timeout for wireless mesh routing operation."
+ DEFVAL { 40 }
+ ::= { wlanMeshRoutingConfig 4 }
+
+wlanMeshInterfaceTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanMeshInterfaceEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains information for wireless interfaces operating
+ as wireless mesh points."
+ ::= { wlanMeshInterface 1 }
+
+wlanMeshInterfaceEntry OBJECT-TYPE
+ SYNTAX WlanMeshInterfaceEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Wireless Mesh Routing information for an interface operating as
+ mesh point."
+ INDEX { wlanIfaceName }
+ ::= { wlanMeshInterfaceTable 1 }
+
+WlanMeshInterfaceEntry ::= SEQUENCE {
+ wlanMeshId OCTET STRING,
+ wlanMeshTTL INTEGER,
+ wlanMeshPeeringEnabled TruthValue,
+ wlanMeshForwardingEnabled TruthValue,
+ wlanMeshMetric INTEGER,
+ wlanMeshPath INTEGER,
+ wlanMeshRoutesFlush INTEGER
+}
+
+wlanMeshId OBJECT-TYPE
+ SYNTAX OCTET STRING (SIZE(1..32))
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The desired Mesh Identifier for the interface."
+ ::= { wlanMeshInterfaceEntry 1 }
+
+wlanMeshTTL OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "hops"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The number of hops a packet may be forwarded before it is discarded."
+ DEFVAL { 31 }
+ ::= { wlanMeshInterfaceEntry 2 }
+
+wlanMeshPeeringEnabled OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Enable or disable peering with neighbor mesh stations for this
+ interface."
+ DEFVAL { true }
+ ::= { wlanMeshInterfaceEntry 3 }
+
+wlanMeshForwardingEnabled OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Enable or disable forwarding packets by this interface."
+ DEFVAL { true }
+ ::= { wlanMeshInterfaceEntry 4 }
+
+wlanMeshMetric OBJECT-TYPE
+ SYNTAX INTEGER {
+ unknown(0),
+ airtime(1)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The link metric protocol used by the interface."
+ DEFVAL { airtime }
+ ::= { wlanMeshInterfaceEntry 5 }
+
+wlanMeshPath OBJECT-TYPE
+ SYNTAX INTEGER {
+ unknown(0),
+ hwmp(1)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The path selection protocol used by the interface."
+ DEFVAL { hwmp }
+ ::= { wlanMeshInterfaceEntry 6 }
+
+wlanMeshRoutesFlush OBJECT-TYPE
+ SYNTAX INTEGER {
+ no-op(0),
+ flush(1)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "This object is used to flush all mesh route entries from the mesh
+ routing table for the specified interface."
+ ::= { wlanMeshInterfaceEntry 7 }
+
+wlanMeshNeighborTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanMeshNeighborEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains information for the neighbors of wireless
+ interfaces operating in mesh mode."
+ ::= { wlanMeshInterface 2 }
+
+wlanMeshNeighborEntry OBJECT-TYPE
+ SYNTAX WlanMeshNeighborEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Information for all neighbors of a wireless interface operating as
+ a mesh point."
+ INDEX { wlanIfaceName, wlanMeshNeighborAddress }
+ ::= { wlanMeshNeighborTable 1 }
+
+WlanMeshNeighborEntry ::= SEQUENCE {
+ wlanMeshNeighborAddress MacAddress,
+ wlanMeshNeighborFrequency INTEGER,
+ wlanMeshNeighborLocalId INTEGER,
+ wlanMeshNeighborPeerId INTEGER,
+ wlanMeshNeighborPeerState INTEGER,
+ wlanMeshNeighborCurrentTXRate INTEGER,
+ wlanMeshNeighborRxSignalStrength INTEGER,
+ wlanMeshNeighborIdleTimer INTEGER,
+ wlanMeshNeighborTxSequenceNo INTEGER,
+ wlanMeshNeighborRxSequenceNo INTEGER
+}
+
+wlanMeshNeighborAddress OBJECT-TYPE
+ SYNTAX MacAddress
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The Ethernet address of this neighbor."
+ ::= { wlanMeshNeighborEntry 1 }
+
+wlanMeshNeighborFrequency OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The operating frequency for the link with this neighbor."
+ ::= { wlanMeshNeighborEntry 2 }
+
+wlanMeshNeighborLocalId OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The local mesh id for this neighbor."
+ ::= { wlanMeshNeighborEntry 3 }
+
+wlanMeshNeighborPeerId OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The mesh peer id of this neighbor."
+ ::= { wlanMeshNeighborEntry 4 }
+
+wlanMeshNeighborPeerState OBJECT-TYPE
+ SYNTAX INTEGER {
+ idle(0),
+ openTx(1),
+ openRx(2),
+ confirmRx(3),
+ established(4),
+ closing(5)
+ }
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The current link state for this neighbor."
+ ::= { wlanMeshNeighborEntry 5 }
+
+wlanMeshNeighborCurrentTXRate OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The current transmit rate for this neighbor."
+ ::= { wlanMeshNeighborEntry 6 }
+
+wlanMeshNeighborRxSignalStrength OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The average receive signal strength for this neighbor."
+ ::= { wlanMeshNeighborEntry 7 }
+
+wlanMeshNeighborIdleTimer OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "seconds"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The value of this neighbor's inactivity timer."
+ ::= { wlanMeshNeighborEntry 8 }
+
+wlanMeshNeighborTxSequenceNo OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The last sequence number transmitted to this neighbor."
+ ::= { wlanMeshNeighborEntry 9 }
+
+wlanMeshNeighborRxSequenceNo OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The last sequence number received from this neighbor."
+ ::= { wlanMeshNeighborEntry 10 }
+
+wlanMeshRouteTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanMeshRouteEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains the mesh routing table for interfaces operating
+ as mesh points, used for forwarding packets on a mesh network."
+ ::= { wlanMeshRoute 1 }
+
+wlanMeshRouteEntry OBJECT-TYPE
+ SYNTAX WlanMeshRouteEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Wireless Mesh Routing Table entries for virtual wireless interfaces."
+ INDEX { wlanIfaceName, wlanMeshRouteDestination }
+ ::= { wlanMeshRouteTable 1 }
+
+WlanMeshRouteEntry ::= SEQUENCE {
+ wlanMeshRouteDestination MacAddress,
+ wlanMeshRouteNextHop MacAddress,
+ wlanMeshRouteHops INTEGER,
+ wlanMeshRouteMetric Unsigned32,
+ wlanMeshRouteLifeTime Unsigned32,
+ wlanMeshRouteLastMseq Unsigned32,
+ wlanMeshRouteFlags BITS,
+ wlanMeshRouteStatus RowStatus
+}
+
+wlanMeshRouteDestination OBJECT-TYPE
+ SYNTAX MacAddress
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "The mesh route entry's destination address."
+ ::= { wlanMeshRouteEntry 1 }
+
+wlanMeshRouteNextHop OBJECT-TYPE
+ SYNTAX MacAddress
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The mesh route entry's next hop address."
+ ::= { wlanMeshRouteEntry 2 }
+
+wlanMeshRouteHops OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of hops for this mesh route entry."
+ ::= { wlanMeshRouteEntry 3 }
+
+wlanMeshRouteMetric OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The metric of this mesh route entry."
+ ::= { wlanMeshRouteEntry 4 }
+
+wlanMeshRouteLifeTime OBJECT-TYPE
+ SYNTAX Unsigned32
+ UNITS "seconds"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The life time of this mesh route entry."
+ ::= { wlanMeshRouteEntry 5 }
+
+wlanMeshRouteLastMseq OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The last sequence number seen from this destination."
+ ::= { wlanMeshRouteEntry 6 }
+
+wlanMeshRouteFlags OBJECT-TYPE
+ SYNTAX BITS {
+ valid(1),
+ proxy(2)
+ }
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The Mesh Route entry's flags."
+ ::= { wlanMeshRouteEntry 7 }
+
+wlanMeshRouteStatus OBJECT-TYPE
+ SYNTAX RowStatus
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The object is used to add or delete entries from the mesh routing
+ table for the virtual wireless interface."
+ ::= { wlanMeshRouteEntry 8 }
+
+wlanMeshStatsTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanMeshStatsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains summary statistics for each virtual wireless
+ interface operating as mesh point."
+ ::= { wlanMeshStatistics 1 }
+
+wlanMeshStatsEntry OBJECT-TYPE
+ SYNTAX WlanMeshStatsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A list of statistics for each virtual wireless interface operating
+ as mesh point."
+ INDEX { wlanIfaceName }
+ ::= { wlanMeshStatsTable 1 }
+
+WlanMeshStatsEntry ::= SEQUENCE {
+ wlanMeshDroppedBadSta Counter32,
+ wlanMeshDroppedNoLink Counter32,
+ wlanMeshNoFwdTtl Counter32,
+ wlanMeshNoFwdBuf Counter32,
+ wlanMeshNoFwdTooShort Counter32,
+ wlanMeshNoFwdDisabled Counter32,
+ wlanMeshNoFwdPathUnknown Counter32,
+ wlanMeshDroppedBadAE Counter32,
+ wlanMeshRouteAddFailed Counter32,
+ wlanMeshDroppedNoProxy Counter32,
+ wlanMeshDroppedMisaligned Counter32
+}
+
+wlanMeshDroppedBadSta OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames dropped by this interface since they were
+ received from a non-mesh station."
+ ::= { wlanMeshStatsEntry 1 }
+
+wlanMeshDroppedNoLink OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames dropped by this interface since no link had
+ been established."
+ ::= { wlanMeshStatsEntry 2 }
+
+wlanMeshNoFwdTtl OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were not forwarded by this interface
+ because of a zero TTL."
+ ::= { wlanMeshStatsEntry 3 }
+
+wlanMeshNoFwdBuf OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were not forwarded by this interface
+ due to lack of free buffers."
+ ::= { wlanMeshStatsEntry 4 }
+
+wlanMeshNoFwdTooShort OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were not forwarded by this interface
+ due to missing headers."
+ ::= { wlanMeshStatsEntry 5 }
+
+wlanMeshNoFwdDisabled OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were not forwarded by this interface
+ since forwarding was disabled."
+ ::= { wlanMeshStatsEntry 6 }
+
+wlanMeshNoFwdPathUnknown OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were not forwarded by this interface
+ since the path was unknown."
+ ::= { wlanMeshStatsEntry 7 }
+
+wlanMeshDroppedBadAE OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were dropped by this interface since
+ the AE was invalid."
+ ::= { wlanMeshStatsEntry 8 }
+
+wlanMeshRouteAddFailed OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times an addition of a route to the mesh routing
+ table for this interface failed."
+ ::= { wlanMeshStatsEntry 9 }
+
+wlanMeshDroppedNoProxy OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were dropped by this interface since
+ proxying was not enabled on the interface."
+ ::= { wlanMeshStatsEntry 10 }
+
+wlanMeshDroppedMisaligned OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of frames that were dropped by this interface due to
+ bad alighment."
+ ::= { wlanMeshStatsEntry 11 }
+
+-- ---------------------------------------------------------- --
+-- Subtrees containing data for each supported mesh routing protocol.
+-- ---------------------------------------------------------- --
+
+wlanMeshProtoHWMP OBJECT IDENTIFIER ::= { wlanMeshRouteProtocols 1 }
+
+-- ---------------------------------------------------------- --
+-- Hybrid Wireless Mesh Protocol database.
+-- ---------------------------------------------------------- --
+wlanMeshHWMPConfig OBJECT IDENTIFIER ::= { wlanMeshProtoHWMP 1 }
+
+wlanMeshHWMPInterface OBJECT IDENTIFIER ::= { wlanMeshProtoHWMP 2 }
+
+wlanMeshHWMPStatistics OBJECT IDENTIFIER ::= { wlanMeshProtoHWMP 3 }
+
+wlanHWMPRouteInactiveTimeout OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "milliseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The HWMP Route inactivity timeout."
+ DEFVAL { 5000 }
+ ::= { wlanMeshHWMPConfig 1 }
+
+wlanHWMPRootAnnounceInterval OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "milliseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The HWMP Root Announcement interval."
+ DEFVAL { 1000 }
+ ::= { wlanMeshHWMPConfig 2 }
+
+wlanHWMPRootInterval OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "milliseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The HWMP Root interval."
+ DEFVAL { 2000 }
+ ::= { wlanMeshHWMPConfig 3 }
+
+wlanHWMPRootTimeout OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "milliseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The root PREQ timeout."
+ DEFVAL { 5000 }
+ ::= { wlanMeshHWMPConfig 4 }
+
+wlanHWMPPathLifetime OBJECT-TYPE
+ SYNTAX INTEGER
+ UNITS "milliseconds"
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The HWMP path entry lifetime."
+ DEFVAL { 500 }
+ ::= { wlanMeshHWMPConfig 5 }
+
+wlanHWMPReplyForwardBit OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "A non-zero value for this object specifies that RF bit shall be
+ set on generated PREQs."
+ DEFVAL { 1 }
+ ::= { wlanMeshHWMPConfig 6 }
+
+wlanHWMPTargetOnlyBit OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "A non-zero value for this object specifies that TO bit shall be
+ set on generated PREQs."
+ DEFVAL { 0 }
+ ::= { wlanMeshHWMPConfig 7 }
+
+wlanHWMPInterfaceTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanHWMPInterfaceEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains information for wireless interfaces
+ operating in mesh mode."
+ ::= { wlanMeshHWMPInterface 1 }
+
+wlanHWMPInterfaceEntry OBJECT-TYPE
+ SYNTAX WlanHWMPInterfaceEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Wireless Mesh Routing HWMP information for a wireless interface."
+ INDEX { wlanIfaceName }
+ ::= { wlanHWMPInterfaceTable 1 }
+
+WlanHWMPInterfaceEntry ::= SEQUENCE {
+ wlanHWMPRootMode INTEGER,
+ wlanHWMPMaxHops INTEGER
+}
+
+wlanHWMPRootMode OBJECT-TYPE
+ SYNTAX INTEGER {
+ disabled(1),
+ normal(2),
+ proactive(3),
+ rann(4)
+ }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "This object is used to configure whether the interface will operate
+ as root node and specify root node mode."
+ DEFVAL { disabled }
+ ::= { wlanHWMPInterfaceEntry 1 }
+
+wlanHWMPMaxHops OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The maximum number of hops allowed on an HMWP path for this interface."
+ DEFVAL { 31 }
+ ::= { wlanHWMPInterfaceEntry 2 }
+
+wlanMeshHWMPStatsTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF WlanMeshHWMPStatsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table that contains summary statistics for HWMP operation on an
+ interface operating as mesh point."
+ ::= { wlanMeshHWMPStatistics 1 }
+
+wlanMeshHWMPStatsEntry OBJECT-TYPE
+ SYNTAX WlanMeshHWMPStatsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A list of HWMP statistics for each wlan interface operating as HWMP
+ mesh point."
+ INDEX { wlanIfaceName }
+ ::= { wlanMeshHWMPStatsTable 1 }
+
+WlanMeshHWMPStatsEntry ::= SEQUENCE {
+ wlanMeshHWMPWrongSeqNo Counter32,
+ wlanMeshHWMPTxRootPREQ Counter32,
+ wlanMeshHWMPTxRootRANN Counter32,
+ wlanMeshHWMPProxy Counter32
+}
+
+wlanMeshHWMPWrongSeqNo OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of HWMP frames with wrong sequence number received by
+ this interface."
+ ::= { wlanMeshHWMPStatsEntry 1 }
+
+wlanMeshHWMPTxRootPREQ OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of HWMP Root PREQ frames sent by this interface."
+ ::= { wlanMeshHWMPStatsEntry 2 }
+
+wlanMeshHWMPTxRootRANN OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of HWMP Root RANN frames sent by this interface."
+ ::= { wlanMeshHWMPStatsEntry 3 }
+
+wlanMeshHWMPProxy OBJECT-TYPE
+ SYNTAX Counter32
+ UNITS "frames"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of HWMP PREP frames discarded by this interface due to
+ the HWMP route being marked as proxy."
+ ::= { wlanMeshHWMPStatsEntry 4 }
+
+END
diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/Makefile b/usr.sbin/bsnmpd/modules/snmp_wlan/Makefile
new file mode 100644
index 0000000..9b8628b
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_wlan/Makefile
@@ -0,0 +1,17 @@
+#
+# $FreeBSD$
+#
+
+MOD= wlan
+SRCS= wlan_snmp.c wlan_sys.c
+CFLAGS+= -DSNMPTREE_TYPES
+
+WARNS= 6
+
+XSYM= begemotWlan
+
+BMIBS= BEGEMOT-WIRELESS-MIB.txt
+MAN= snmp_${MOD}.3
+DEFS= ${MOD}_tree.def
+
+.include <bsd.snmpmod.mk>
diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3 b/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3
new file mode 100644
index 0000000..6b9e503
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3
@@ -0,0 +1,160 @@
+.\"-
+.\" Copyright (C) 2010 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written by Shteryana Sotirova Shopova under
+.\" sponsorship from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 28, 2010
+.Dt snmp_wlan 3
+.Os
+.Sh NAME
+.Nm snmp_wlan
+.Nd "wireless networking module for
+.Xr bsnmpd 1
+.Sh LIBRARY
+.Pq begemotSnmpdModulePath."wlan" = "/usr/lib/snmp_wlan.so"
+.Sh DESCRIPTION
+The
+.Nm snmp_wlan
+module implements a private BEGEMOT-WIRELESS-MIB, which allows
+management of virtual wireless interfaces. The MIB defines objects similar to the
+state data and configuration capabilities of
+.Xr ifconfig 8
+for configuring virtual wireless interfaces.
+Therefore one should consider adding write comminities or loading the
+.Nm
+module on systems where security is crucial.
+.Sh IMPLEMENTATION NOTES
+A short description of the Tables and interesting objects in the MIB follows.
+.Bl -tag -width "XXXXXXXXX"
+.It Va wlanInterfaceTable
+The table is used for creation and deletion of virtual wireless interfaces. To
+add a new interface, a SET should be executed on the
+.Va wlanIfaceName
+column with
+value the desired name of the interface. Next the parent interface must be set
+via
+.Va wlanParentIfName
+column. Any optional parameters may be set
+via the
+.Va wlanIfaceOperatingMode,
+.Va wlanIfaceFlags,
+.Va wlanIfaceBssid
+and
+.Va wlanIfaceLocalAddress
+columns.
+To finally create the interface in the system, a SET with value of active(1) to
+.Va wlanIfaceStatus
+column should be executed.
+To destroy a wireless interface a SET with value of destroy(6) to the relevant
+.Va wlanIfaceStatus
+column should be executed.
+.It Va wlanIfParentTable
+The table contains information about the hardware capabilities of the parent of
+a wireless interface.
+.It Va wlanIfaceConfigTable
+The table is used to get or set various configuration paremeters for a virtual
+wireless interface. Depending on the operating mode of the interface and the
+hardware capabilities of the underlying hardware interface, not all parameters
+and values may be supported.
+.It Va wlanIfacePeerTable
+The table contains information about the associated stations for interfaces
+operating as access points, or the stations identified as neighbors in the IBSS
+for interfaces operating in adhoc mode.
+.It Va wlanIfaceChannelTable
+Information about the active channels for the wireless interfaces in the system.
+.It Va wlanIfRoamParamsTable
+The parameters that govern the roaming operation on the wireless interfaces.
+.It Va wlanIfTxParamsTable
+The parameters that govern the transmit operation on the wireless interfaces.
+.It Va wlanScanConfigTable
+The table that contains a configuration for channel scanning initiated via SNMP.
+.It Va wlanScanResultsTable
+The table contains the scan results from the last scan for each wireless
+interface on the system.
+.It Va wlanIfaceStatisticsTable
+Summary statistics for each wireless interface on the system.
+.It Va wlanWepInterfaceTable
+WEP configuration for the wireless interfaces on the system.
+.It Va wlanMACAccessControlTable
+Access Control configuration for wireless interfaces operating as access points.
+.It Va wlanMACAccessControlMACTable
+The table with Access Control MAC entries for which the configured Access
+Control POlicy on wireless interfaces operating in Host AP mode is applied.
+.Va wlanMACAccessControlMACStatus
+column is used to add or delete MAC ACL entries. A set with value createAndGo(4)
+will add new entry, while with value destroy(6) will delete an existing one.
+.It Va wlanMeshRoutingConfig
+The subtree contains system configuration related to Wireless Mesh Routing.
+.It Va wlanMeshInterfaceTable
+The table contains information for wireless interfaces operating as wireless
+mesh points.
+.It Va wlanMeshNeighborTable
+The table contains information for the neighbors of wireless interfaces
+operating in mesh mode.
+.It Va wlanMeshRouteTable
+The mesh routing table for interfaces operating as mesh points, used for
+forwarding packets on a mesh network.
+.Va wlanMeshRouteStatus
+column is used to add or delete entries in the mesh routing table for an
+interface. A set with value createAndGo(4) will add new entry, while with value
+destroy(6) will delete an existing one.
+.It Va wlanMeshStatsTable
+Summary statistics for each virtual wireless interface operating as mesh point.
+.It Va wlanMeshHWMPConfig
+The subtree contains system configuration related to Hybrid Wireless Mesh
+Protocol.
+.It Va wlanHWMPInterfaceTable
+The table contains HWMP information for wireless interfaces operating in mesh
+mode.
+.It Va wlanMeshHWMPStatsTable
+Summary statistics for HWMP operation on interfaces operating as mesh points.
+.El
+.Sh RESTRICTIONS
+Not all information or configuration in the MIBs is currently available in FreeBSD.
+The values of the following variables carry no information:
+.Bl -tag -width "XXXXXXXXX"
+.It Va wlanStatsReset
+.El
+.Sh FILES
+.Bl -tag -width "XXXXXXXXX"
+.It Pa /usr/share/snmp/defs/wlan_tree.def
+The description of the MIB tree implemented by
+.Nm .
+.It Pa /usr/share/snmp/mibs/BEGEMOT-WIRELESS-MIB.txt
+The private BEGEMOT-WIRELESS-MIB that is implemented by this module.
+.El
+.Sh SEE ALSO
+.Xr bsnmpd 1 ,
+.Xr gensnmptree 1 ,
+.Xr wlan 4 ,
+.Xr wlan_acl 4 ,
+.Xr wlan_wep 4 ,
+.Xr ifconfig 8 ,
+.Xr snmpmod 3
+.Sh AUTHORS
+.An Shteryana Shopova Aq syrinx@FreeBSD.org
diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.c b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.c
new file mode 100644
index 0000000..ec94ac6
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.c
@@ -0,0 +1,4513 @@
+/*-
+ * Copyright (c) 2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Shteryana Sotirova Shopova under
+ * sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+
+#include <net/if.h>
+#include <net/if_media.h>
+#include <net/if_mib.h>
+#include <net/if_types.h>
+#include <net80211/ieee80211.h>
+#include <net80211/ieee80211_ioctl.h>
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <syslog.h>
+
+#include <bsnmp/snmpmod.h>
+#include <bsnmp/snmp_mibII.h>
+
+#include "wlan_tree.h"
+#include "wlan_snmp.h"
+#include "wlan_oid.h"
+
+static struct lmodule *wlan_module;
+
+/* For the registration. */
+static const struct asn_oid oid_wlan = OIDX_begemotWlan;
+/* The registration. */
+static uint reg_wlan;
+
+/* Periodic timer for polling the module's data. */
+static void *wlan_data_timer;
+
+/*
+ * Poll data from kernel every 15 minutes unless explicitly requested by an
+ * SNMP client.
+ * XXX: make that configurable.
+ */
+static int wlan_poll_ticks = (15 * 60) * 100;
+
+/* The age of each table. */
+#define WLAN_LIST_MAXAGE 5
+
+static time_t wlan_iflist_age;
+static time_t wlan_peerlist_age;
+static time_t wlan_chanlist_age;
+static time_t wlan_roamlist_age;
+static time_t wlan_tx_paramlist_age;
+static time_t wlan_scanlist_age;
+static time_t wlan_maclist_age;
+static time_t wlan_mrlist_age;
+
+/*
+ * The list of all virtual wireless interfaces - sorted by name.
+ */
+SLIST_HEAD(wlan_ifaces, wlan_iface);
+static struct wlan_ifaces wlan_ifaces = SLIST_HEAD_INITIALIZER(wlan_ifaces);
+
+static struct wlan_config wlan_config;
+
+/* Forward declarations */
+static int bits_get(struct snmp_value *, const u_char *, ssize_t);
+
+static int wlan_add_wif(struct wlan_iface *);
+static void wlan_delete_wif(struct wlan_iface *);
+static int wlan_attach_newif(struct mibif *);
+static int wlan_iface_create(struct wlan_iface *);
+static int wlan_iface_destroy(struct wlan_iface *);
+static struct wlan_iface * wlan_new_wif(char *);
+
+static void wlan_free_interface(struct wlan_iface *);
+static void wlan_free_iflist(void);
+static void wlan_free_peerlist(struct wlan_iface *);
+static void wlan_scan_free_results(struct wlan_iface *);
+static void wlan_mac_free_maclist(struct wlan_iface *);
+static void wlan_mesh_free_routes(struct wlan_iface *);
+
+static int wlan_update_interface(struct wlan_iface *);
+static void wlan_update_interface_list(void);
+static void wlan_update_peers(void);
+static void wlan_update_channels(void);
+static void wlan_update_roam_params(void);
+static void wlan_update_tx_params(void);
+static void wlan_scan_update_results(void);
+static void wlan_mac_update_aclmacs(void);
+static void wlan_mesh_update_routes(void);
+
+static struct wlan_iface * wlan_find_interface(const char *);
+static struct wlan_peer * wlan_find_peer(struct wlan_iface *, uint8_t *);
+static struct ieee80211_channel* wlan_find_channel(struct wlan_iface *,
+ uint32_t);
+static struct wlan_scan_result * wlan_scan_find_result(struct wlan_iface *,
+ uint8_t *, uint8_t *);
+static struct wlan_mac_mac * wlan_mac_find_mac(struct wlan_iface *,
+ uint8_t *);
+static struct wlan_mesh_route * wlan_mesh_find_route(struct wlan_iface *,
+ uint8_t *);
+
+static struct wlan_iface * wlan_first_interface(void);
+static struct wlan_iface * wlan_next_interface(struct wlan_iface *);
+static struct wlan_iface * wlan_mesh_first_interface(void);
+static struct wlan_iface * wlan_mesh_next_interface(struct wlan_iface *);
+
+static struct wlan_iface * wlan_get_interface(const struct asn_oid *, uint);
+static struct wlan_iface * wlan_get_snmp_interface(const struct asn_oid *,
+ uint);
+static struct wlan_peer * wlan_get_peer(const struct asn_oid *, uint,
+ struct wlan_iface **);
+static struct ieee80211_channel *wlan_get_channel(const struct asn_oid *, uint,
+ struct wlan_iface **);
+static struct ieee80211_roamparam *wlan_get_roam_param(const struct asn_oid *,
+ uint, struct wlan_iface **);
+static struct ieee80211_txparam *wlan_get_tx_param(const struct asn_oid *,
+ uint, struct wlan_iface **, uint32_t *);
+static struct wlan_scan_result *wlan_get_scanr(const struct asn_oid *, uint,
+ struct wlan_iface **);
+static struct wlan_mac_mac * wlan_get_acl_mac(const struct asn_oid *,
+ uint, struct wlan_iface **);
+static struct wlan_iface * wlan_mesh_get_iface(const struct asn_oid *, uint);
+static struct wlan_peer * wlan_mesh_get_peer(const struct asn_oid *, uint,
+ struct wlan_iface **);
+static struct wlan_mesh_route * wlan_mesh_get_route(const struct asn_oid *,
+ uint, struct wlan_iface **);
+
+static struct wlan_iface * wlan_get_next_interface(const struct asn_oid *,
+ uint);
+static struct wlan_iface * wlan_get_next_snmp_interface(const struct
+ asn_oid *, uint);
+static struct wlan_peer * wlan_get_next_peer(const struct asn_oid *, uint,
+ struct wlan_iface **);
+static struct ieee80211_channel *wlan_get_next_channel(const struct asn_oid *,
+ uint, struct wlan_iface **);
+static struct ieee80211_roamparam *wlan_get_next_roam_param(const struct
+ asn_oid *, uint sub, struct wlan_iface **, uint32_t *);
+static struct ieee80211_txparam *wlan_get_next_tx_param(const struct asn_oid *,
+ uint, struct wlan_iface **, uint32_t *);
+static struct wlan_scan_result *wlan_get_next_scanr(const struct asn_oid *,
+ uint , struct wlan_iface **);
+static struct wlan_mac_mac * wlan_get_next_acl_mac(const struct asn_oid *,
+ uint, struct wlan_iface **);
+static struct wlan_iface * wlan_mesh_get_next_iface(const struct asn_oid *,
+ uint);
+static struct wlan_peer * wlan_mesh_get_next_peer(const struct asn_oid *,
+ uint, struct wlan_iface **);
+static struct wlan_mesh_route * wlan_mesh_get_next_route(const struct asn_oid *,
+ uint sub, struct wlan_iface **);
+
+static uint8_t *wlan_get_ifname(const struct asn_oid *, uint, uint8_t *);
+static int wlan_mac_index_decode(const struct asn_oid *, uint, char *,
+ uint8_t *);
+static int wlan_channel_index_decode(const struct asn_oid *, uint,
+ char *, uint32_t *);
+static int wlan_phy_index_decode(const struct asn_oid *, uint, char *,
+ uint32_t *);
+static int wlan_scanr_index_decode(const struct asn_oid *oid, uint sub,
+ char *wname, uint8_t *ssid, uint8_t *bssid);
+
+static void wlan_append_ifindex(struct asn_oid *, uint,
+ const struct wlan_iface *);
+static void wlan_append_mac_index(struct asn_oid *, uint, char *, uint8_t *);
+static void wlan_append_channel_index(struct asn_oid *, uint,
+ const struct wlan_iface *, const struct ieee80211_channel *);
+static void wlan_append_phy_index(struct asn_oid *, uint, char *, uint32_t);
+static void wlan_append_scanr_index(struct asn_oid *, uint, char *,
+ uint8_t *, uint8_t *);
+
+static int wlan_acl_mac_set_status(struct snmp_context *,
+ struct snmp_value *, uint);
+static int wlan_mesh_route_set_status(struct snmp_context *,
+ struct snmp_value *, uint);
+
+static int32_t wlan_get_channel_type(struct ieee80211_channel *);
+static int wlan_scan_compare_result(struct wlan_scan_result *,
+ struct wlan_scan_result *);
+static int wlan_mac_delete_mac(struct wlan_iface *, struct wlan_mac_mac *);
+static int wlan_mesh_delete_route(struct wlan_iface *,
+ struct wlan_mesh_route *);
+
+/*
+ * The module's GET/SET data hooks per each table or group of objects as
+ * required by bsnmpd(1).
+ */
+int
+op_wlan_iface(struct snmp_context *ctx, struct snmp_value *val, uint32_t sub,
+ uint32_t iidx __unused, enum snmp_op op)
+{
+ int rc;
+ char wname[IFNAMSIZ];
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wif = wlan_get_snmp_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+
+ case SNMP_OP_GETNEXT:
+ if ((wif = wlan_get_next_snmp_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_ifindex(&val->var, sub, wif);
+ break;
+
+ case SNMP_OP_SET:
+ if ((wif = wlan_get_snmp_interface(&val->var, sub)) == NULL) {
+ if (val->var.subs[sub - 1] != LEAF_wlanIfaceName)
+ return (SNMP_ERR_NOSUCHNAME);
+ if (wlan_get_ifname(&val->var, sub, wname) == NULL)
+ return (SNMP_ERR_INCONS_VALUE);
+ if ((wif = wlan_new_wif(wname)) == NULL)
+ return (SNMP_ERR_GENERR);
+ wif->internal = 1;
+ }
+ if (wif->status == RowStatus_active &&
+ val->var.subs[sub - 1] != LEAF_wlanIfaceStatus &&
+ val->var.subs[sub - 1] != LEAF_wlanIfaceState)
+ return (SNMP_ERR_INCONS_VALUE);
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfaceIndex:
+ return (SNMP_ERR_NOT_WRITEABLE);
+
+ case LEAF_wlanIfaceName:
+ if (val->v.octetstring.len >= IFNAMSIZ)
+ return (SNMP_ERR_INCONS_VALUE);
+ if ((ctx->scratch->ptr1 = malloc(IFNAMSIZ)) == NULL)
+ return (SNMP_ERR_GENERR);
+ strlcpy(ctx->scratch->ptr1, wif->wname, IFNAMSIZ);
+ memcpy(wif->wname, val->v.octetstring.octets,
+ val->v.octetstring.len);
+ wif->wname[val->v.octetstring.len] = '\0';
+ return (SNMP_ERR_NOERROR);
+
+ case LEAF_wlanParentIfName:
+ if (val->v.octetstring.len >= IFNAMSIZ)
+ return (SNMP_ERR_INCONS_VALUE);
+ if ((ctx->scratch->ptr1 = malloc(IFNAMSIZ)) == NULL)
+ return (SNMP_ERR_GENERR);
+ strlcpy(ctx->scratch->ptr1, wif->pname, IFNAMSIZ);
+ memcpy(wif->pname, val->v.octetstring.octets,
+ val->v.octetstring.len);
+ wif->pname[val->v.octetstring.len] = '\0';
+ return (SNMP_ERR_NOERROR);
+
+ case LEAF_wlanIfaceOperatingMode:
+ ctx->scratch->int1 = wif->mode;
+ wif->mode = val->v.integer;
+ return (SNMP_ERR_NOERROR);
+
+ case LEAF_wlanIfaceFlags:
+ if (val->v.octetstring.len > sizeof(wif->flags))
+ return (SNMP_ERR_INCONS_VALUE);
+ ctx->scratch->ptr1 = malloc(sizeof(wif->flags));
+ if (ctx->scratch->ptr1 == NULL)
+ return (SNMP_ERR_GENERR);
+ memcpy(ctx->scratch->ptr1, (uint8_t *)&wif->flags,
+ sizeof(wif->flags));
+ memcpy((uint8_t *)&wif->flags, val->v.octetstring.octets,
+ sizeof(wif->flags));
+ return (SNMP_ERR_NOERROR);
+
+ case LEAF_wlanIfaceBssid:
+ if (val->v.octetstring.len != IEEE80211_ADDR_LEN)
+ return (SNMP_ERR_INCONS_VALUE);
+ ctx->scratch->ptr1 = malloc(IEEE80211_ADDR_LEN);
+ if (ctx->scratch->ptr1 == NULL)
+ return (SNMP_ERR_GENERR);
+ memcpy(ctx->scratch->ptr1, wif->dbssid,
+ IEEE80211_ADDR_LEN);
+ memcpy(wif->dbssid, val->v.octetstring.octets,
+ IEEE80211_ADDR_LEN);
+ return (SNMP_ERR_NOERROR);
+
+ case LEAF_wlanIfaceLocalAddress:
+ if (val->v.octetstring.len != IEEE80211_ADDR_LEN)
+ return (SNMP_ERR_INCONS_VALUE);
+ ctx->scratch->ptr1 = malloc(IEEE80211_ADDR_LEN);
+ if (ctx->scratch->ptr1 == NULL)
+ return (SNMP_ERR_GENERR);
+ memcpy(ctx->scratch->ptr1, wif->dlmac,
+ IEEE80211_ADDR_LEN);
+ memcpy(wif->dlmac, val->v.octetstring.octets,
+ IEEE80211_ADDR_LEN);
+ return (SNMP_ERR_NOERROR);
+
+ case LEAF_wlanIfaceStatus:
+ ctx->scratch->int1 = wif->status;
+ wif->status = val->v.integer;
+ if (wif->status == RowStatus_active) {
+ rc = wlan_iface_create(wif); /* XXX */
+ if (rc != SNMP_ERR_NOERROR) {
+ wif->status = ctx->scratch->int1;
+ return (rc);
+ }
+ } else if (wif->status == RowStatus_destroy)
+ return (wlan_iface_destroy(wif));
+ else
+ wif->status = RowStatus_notReady;
+ return (SNMP_ERR_NOERROR);
+
+ case LEAF_wlanIfaceState:
+ ctx->scratch->int1 = wif->state;
+ wif->state = val->v.integer;
+ if (wif->status == RowStatus_active)
+ if (wlan_config_state(wif, 1) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+ }
+ abort();
+
+ case SNMP_OP_ROLLBACK:
+ if ((wif = wlan_get_snmp_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfaceName:
+ strlcpy(wif->wname, ctx->scratch->ptr1, IFNAMSIZ);
+ free(ctx->scratch->ptr1);
+ break;
+
+ case LEAF_wlanParentIfName:
+ strlcpy(wif->pname, ctx->scratch->ptr1, IFNAMSIZ);
+ free(ctx->scratch->ptr1);
+ break;
+
+ case LEAF_wlanIfaceOperatingMode:
+ wif->mode = ctx->scratch->int1;
+ break;
+
+ case LEAF_wlanIfaceFlags:
+ memcpy((uint8_t *)&wif->flags, ctx->scratch->ptr1,
+ sizeof(wif->flags));
+ free(ctx->scratch->ptr1);
+ break;
+
+ case LEAF_wlanIfaceBssid:
+ memcpy(wif->dbssid, ctx->scratch->ptr1,
+ IEEE80211_ADDR_LEN);
+ free(ctx->scratch->ptr1);
+ break;
+
+ case LEAF_wlanIfaceLocalAddress:
+ memcpy(wif->dlmac, ctx->scratch->ptr1,
+ IEEE80211_ADDR_LEN);
+ free(ctx->scratch->ptr1);
+ break;
+
+ case LEAF_wlanIfaceStatus:
+ wif->status = ctx->scratch->int1;
+ if (ctx->scratch->int1 == RowStatus_active)
+ return (SNMP_ERR_GENERR); /* XXX: FIXME */
+ else if (wif->internal != 0)
+ return (wlan_iface_destroy(wif));
+ break;
+
+ case LEAF_wlanIfaceState:
+ wif->state = ctx->scratch->int1;
+ if (wif->status == RowStatus_active)
+ if (wlan_config_state(wif, 1) < 0)
+ return (SNMP_ERR_GENERR);
+ break;
+ }
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_COMMIT:
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfaceName:
+ case LEAF_wlanParentIfName:
+ case LEAF_wlanIfaceFlags:
+ case LEAF_wlanIfaceBssid:
+ case LEAF_wlanIfaceLocalAddress:
+ free(ctx->scratch->ptr1);
+ /* FALLTHROUGH */
+ default:
+ return (SNMP_ERR_NOERROR);
+ }
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfaceIndex:
+ val->v.integer = wif->index;
+ return (SNMP_ERR_NOERROR);
+ case LEAF_wlanIfaceName:
+ return (string_get(val, wif->wname, -1));
+ case LEAF_wlanParentIfName:
+ return (string_get(val, wif->pname, -1));
+ case LEAF_wlanIfaceOperatingMode:
+ val->v.integer = wif->mode;
+ return (SNMP_ERR_NOERROR);
+ case LEAF_wlanIfaceFlags:
+ return (bits_get(val, (uint8_t *)&wif->flags,
+ sizeof(wif->flags)));
+ case LEAF_wlanIfaceBssid:
+ return (string_get(val, wif->dbssid, IEEE80211_ADDR_LEN));
+ case LEAF_wlanIfaceLocalAddress:
+ return (string_get(val, wif->dlmac, IEEE80211_ADDR_LEN));
+ case LEAF_wlanIfaceStatus:
+ val->v.integer = wif->status;
+ return (SNMP_ERR_NOERROR);
+ case LEAF_wlanIfaceState:
+ val->v.integer = wif->state;
+ return (SNMP_ERR_NOERROR);
+ }
+
+ abort();
+}
+
+int
+op_wlan_if_parent(struct snmp_context *ctx __unused, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+ case SNMP_OP_GETNEXT:
+ if ((wif = wlan_get_next_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_ifindex(&val->var, sub, wif);
+ break;
+ case SNMP_OP_SET:
+ return (SNMP_ERR_NOT_WRITEABLE);
+ case SNMP_OP_COMMIT:
+ /* FALLTHROUGH */
+ case SNMP_OP_ROLLBACK:
+ /* FALLTHROUGH */
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfParentDriverCapabilities:
+ return (bits_get(val, (uint8_t *)&wif->drivercaps,
+ sizeof(wif->drivercaps)));
+ case LEAF_wlanIfParentCryptoCapabilities:
+ return (bits_get(val, (uint8_t *)&wif->cryptocaps,
+ sizeof(wif->cryptocaps)));
+ case LEAF_wlanIfParentHTCapabilities:
+ return (bits_get(val, (uint8_t *)&wif->htcaps,
+ sizeof(wif->htcaps)));
+ }
+
+ abort();
+}
+
+int
+op_wlan_iface_config(struct snmp_context *ctx, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ int intval, vlen, rc;
+ char *strval;
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ goto get_config;
+
+ case SNMP_OP_GETNEXT:
+ if ((wif = wlan_get_next_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_ifindex(&val->var, sub, wif);
+ goto get_config;
+
+ case SNMP_OP_SET:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+
+ intval = val->v.integer;
+ strval = NULL;
+ vlen = 0;
+
+ /* Simple sanity checks & save old data. */
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfaceCountryCode:
+ if (val->v.octetstring.len != WLAN_COUNTRY_CODE_SIZE)
+ return (SNMP_ERR_INCONS_VALUE);
+ break;
+ case LEAF_wlanIfaceDesiredSsid:
+ if (val->v.octetstring.len > IEEE80211_NWID_LEN)
+ return (SNMP_ERR_INCONS_VALUE);
+ break;
+ case LEAF_wlanIfaceDesiredBssid:
+ if (val->v.octetstring.len != IEEE80211_ADDR_LEN)
+ return (SNMP_ERR_INCONS_VALUE);
+ break;
+ case LEAF_wlanIfacePacketBurst:
+ ctx->scratch->int1 = wif->packet_burst;
+ break;
+ case LEAF_wlanIfaceRegDomain:
+ ctx->scratch->int1 = wif->reg_domain;
+ break;
+ case LEAF_wlanIfaceDesiredChannel:
+ ctx->scratch->int1 = wif->desired_channel;
+ break;
+ case LEAF_wlanIfaceDynamicFreqSelection:
+ ctx->scratch->int1 = wif->dyn_frequency;
+ break;
+ case LEAF_wlanIfaceFastFrames:
+ ctx->scratch->int1 = wif->fast_frames;
+ break;
+ case LEAF_wlanIfaceDturbo:
+ ctx->scratch->int1 = wif->dturbo;
+ break;
+ case LEAF_wlanIfaceTxPower:
+ ctx->scratch->int1 = wif->tx_power;
+ break;
+ case LEAF_wlanIfaceFragmentThreshold:
+ ctx->scratch->int1 = wif->frag_threshold;
+ break;
+ case LEAF_wlanIfaceRTSThreshold:
+ ctx->scratch->int1 = wif->rts_threshold;
+ break;
+ case LEAF_wlanIfaceWlanPrivacySubscribe:
+ ctx->scratch->int1 = wif->priv_subscribe;
+ break;
+ case LEAF_wlanIfaceBgScan:
+ ctx->scratch->int1 = wif->bg_scan;
+ break;
+ case LEAF_wlanIfaceBgScanIdle:
+ ctx->scratch->int1 = wif->bg_scan_idle;
+ break;
+ case LEAF_wlanIfaceBgScanInterval:
+ ctx->scratch->int1 = wif->bg_scan_interval;
+ break;
+ case LEAF_wlanIfaceBeaconMissedThreshold:
+ ctx->scratch->int1 = wif->beacons_missed;
+ break;
+ case LEAF_wlanIfaceRoamingMode:
+ ctx->scratch->int1 = wif->roam_mode;
+ break;
+ case LEAF_wlanIfaceDot11d:
+ ctx->scratch->int1 = wif->dot11d;
+ break;
+ case LEAF_wlanIfaceDot11h:
+ ctx->scratch->int1 = wif->dot11h;
+ break;
+ case LEAF_wlanIfaceDynamicWds:
+ ctx->scratch->int1 = wif->dynamic_wds;
+ break;
+ case LEAF_wlanIfacePowerSave:
+ ctx->scratch->int1 = wif->power_save;
+ break;
+ case LEAF_wlanIfaceApBridge:
+ ctx->scratch->int1 = wif->ap_bridge;
+ break;
+ case LEAF_wlanIfaceBeaconInterval:
+ ctx->scratch->int1 = wif->beacon_interval;
+ break;
+ case LEAF_wlanIfaceDtimPeriod:
+ ctx->scratch->int1 = wif->dtim_period;
+ break;
+ case LEAF_wlanIfaceHideSsid:
+ ctx->scratch->int1 = wif->hide_ssid;
+ break;
+ case LEAF_wlanIfaceInactivityProccess:
+ ctx->scratch->int1 = wif->inact_process;
+ break;
+ case LEAF_wlanIfaceDot11gProtMode:
+ ctx->scratch->int1 = wif->do11g_protect;
+ break;
+ case LEAF_wlanIfaceDot11gPureMode:
+ ctx->scratch->int1 = wif->dot11g_pure;
+ break;
+ case LEAF_wlanIfaceDot11nPureMode:
+ ctx->scratch->int1 = wif->dot11n_pure;
+ break;
+ case LEAF_wlanIfaceDot11nAmpdu:
+ ctx->scratch->int1 = wif->ampdu;
+ break;
+ case LEAF_wlanIfaceDot11nAmpduDensity:
+ ctx->scratch->int1 = wif->ampdu_density;
+ break;
+ case LEAF_wlanIfaceDot11nAmpduLimit:
+ ctx->scratch->int1 = wif->ampdu_limit;
+ break;
+ case LEAF_wlanIfaceDot11nAmsdu:
+ ctx->scratch->int1 = wif->amsdu;
+ break;
+ case LEAF_wlanIfaceDot11nAmsduLimit:
+ ctx->scratch->int1 = wif->amsdu_limit;
+ break;
+ case LEAF_wlanIfaceDot11nHighThroughput:
+ ctx->scratch->int1 = wif->ht_enabled;
+ break;
+ case LEAF_wlanIfaceDot11nHTCompatible:
+ ctx->scratch->int1 = wif->ht_compatible;
+ break;
+ case LEAF_wlanIfaceDot11nHTProtMode:
+ ctx->scratch->int1 = wif->ht_prot_mode;
+ break;
+ case LEAF_wlanIfaceDot11nRIFS:
+ ctx->scratch->int1 = wif->rifs;
+ break;
+ case LEAF_wlanIfaceDot11nShortGI:
+ ctx->scratch->int1 = wif->short_gi;
+ break;
+ case LEAF_wlanIfaceDot11nSMPSMode:
+ ctx->scratch->int1 = wif->smps_mode;
+ break;
+ case LEAF_wlanIfaceTdmaSlot:
+ ctx->scratch->int1 = wif->tdma_slot;
+ break;
+ case LEAF_wlanIfaceTdmaSlotCount:
+ ctx->scratch->int1 = wif->tdma_slot_count;
+ break;
+ case LEAF_wlanIfaceTdmaSlotLength:
+ ctx->scratch->int1 = wif->tdma_slot_length;
+ break;
+ case LEAF_wlanIfaceTdmaBeaconInterval:
+ ctx->scratch->int1 = wif->tdma_binterval;
+ break;
+ default:
+ abort();
+ }
+
+ if (val->syntax != SNMP_SYNTAX_OCTETSTRING)
+ goto set_config;
+
+ ctx->scratch->int1 = val->v.octetstring.len;
+ ctx->scratch->ptr1 = malloc(val->v.octetstring.len + 1);
+ if (ctx->scratch->ptr1 == NULL)
+ return (SNMP_ERR_GENERR); /* XXX */
+ if (val->var.subs[sub - 1] == LEAF_wlanIfaceDesiredSsid)
+ strlcpy(ctx->scratch->ptr1, val->v.octetstring.octets,
+ val->v.octetstring.len + 1);
+ else
+ memcpy(ctx->scratch->ptr1, val->v.octetstring.octets,
+ val->v.octetstring.len);
+ strval = val->v.octetstring.octets;
+ vlen = val->v.octetstring.len;
+ goto set_config;
+
+ case SNMP_OP_ROLLBACK:
+ intval = ctx->scratch->int1;
+ strval = NULL;
+ vlen = 0;
+
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfaceCountryCode:
+ case LEAF_wlanIfaceDesiredSsid:
+ case LEAF_wlanIfaceDesiredBssid:
+ strval = ctx->scratch->ptr1;
+ vlen = ctx->scratch->int1;
+ break;
+ default:
+ break;
+ }
+ goto set_config;
+
+ case SNMP_OP_COMMIT:
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfaceCountryCode:
+ case LEAF_wlanIfaceDesiredSsid:
+ case LEAF_wlanIfaceDesiredBssid:
+ free(ctx->scratch->ptr1);
+ /* FALLTHROUGH */
+ default:
+ return (SNMP_ERR_NOERROR);
+ }
+ }
+ abort();
+
+get_config:
+
+ if (wlan_config_get_ioctl(wif, val->var.subs[sub - 1]) < 0)
+ return (SNMP_ERR_GENERR);
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfacePacketBurst:
+ val->v.integer = wif->packet_burst;
+ break;
+ case LEAF_wlanIfaceCountryCode:
+ return (string_get(val, wif->country_code,
+ WLAN_COUNTRY_CODE_SIZE));
+ case LEAF_wlanIfaceRegDomain:
+ val->v.integer = wif->reg_domain;
+ break;
+ case LEAF_wlanIfaceDesiredSsid:
+ return (string_get(val, wif->desired_ssid, -1));
+ case LEAF_wlanIfaceDesiredChannel:
+ val->v.integer = wif->desired_channel;
+ break;
+ case LEAF_wlanIfaceDynamicFreqSelection:
+ val->v.integer = wif->dyn_frequency;
+ break;
+ case LEAF_wlanIfaceFastFrames:
+ val->v.integer = wif->fast_frames;
+ break;
+ case LEAF_wlanIfaceDturbo:
+ val->v.integer = wif->dturbo;
+ break;
+ case LEAF_wlanIfaceTxPower:
+ val->v.integer = wif->tx_power;
+ break;
+ case LEAF_wlanIfaceFragmentThreshold:
+ val->v.integer = wif->frag_threshold;
+ break;
+ case LEAF_wlanIfaceRTSThreshold:
+ val->v.integer = wif->rts_threshold;
+ break;
+ case LEAF_wlanIfaceWlanPrivacySubscribe:
+ val->v.integer = wif->priv_subscribe;
+ break;
+ case LEAF_wlanIfaceBgScan:
+ val->v.integer = wif->bg_scan;
+ break;
+ case LEAF_wlanIfaceBgScanIdle:
+ val->v.integer = wif->bg_scan_idle;
+ break;
+ case LEAF_wlanIfaceBgScanInterval:
+ val->v.integer = wif->bg_scan_interval;
+ break;
+ case LEAF_wlanIfaceBeaconMissedThreshold:
+ val->v.integer = wif->beacons_missed;
+ break;
+ case LEAF_wlanIfaceDesiredBssid:
+ return (string_get(val, wif->desired_bssid,
+ IEEE80211_ADDR_LEN));
+ case LEAF_wlanIfaceRoamingMode:
+ val->v.integer = wif->roam_mode;
+ break;
+ case LEAF_wlanIfaceDot11d:
+ val->v.integer = wif->dot11d;
+ break;
+ case LEAF_wlanIfaceDot11h:
+ val->v.integer = wif->dot11h;
+ break;
+ case LEAF_wlanIfaceDynamicWds:
+ val->v.integer = wif->dynamic_wds;
+ break;
+ case LEAF_wlanIfacePowerSave:
+ val->v.integer = wif->power_save;
+ break;
+ case LEAF_wlanIfaceApBridge:
+ val->v.integer = wif->ap_bridge;
+ break;
+ case LEAF_wlanIfaceBeaconInterval:
+ val->v.integer = wif->beacon_interval;
+ break;
+ case LEAF_wlanIfaceDtimPeriod:
+ val->v.integer = wif->dtim_period;
+ break;
+ case LEAF_wlanIfaceHideSsid:
+ val->v.integer = wif->hide_ssid;
+ break;
+ case LEAF_wlanIfaceInactivityProccess:
+ val->v.integer = wif->inact_process;
+ break;
+ case LEAF_wlanIfaceDot11gProtMode:
+ val->v.integer = wif->do11g_protect;
+ break;
+ case LEAF_wlanIfaceDot11gPureMode:
+ val->v.integer = wif->dot11g_pure;
+ break;
+ case LEAF_wlanIfaceDot11nPureMode:
+ val->v.integer = wif->dot11n_pure;
+ break;
+ case LEAF_wlanIfaceDot11nAmpdu:
+ val->v.integer = wif->ampdu;
+ break;
+ case LEAF_wlanIfaceDot11nAmpduDensity:
+ val->v.integer = wif->ampdu_density;
+ break;
+ case LEAF_wlanIfaceDot11nAmpduLimit:
+ val->v.integer = wif->ampdu_limit;
+ break;
+ case LEAF_wlanIfaceDot11nAmsdu:
+ val->v.integer = wif->amsdu;
+ break;
+ case LEAF_wlanIfaceDot11nAmsduLimit:
+ val->v.integer = wif->amsdu_limit;
+ break;
+ case LEAF_wlanIfaceDot11nHighThroughput:
+ val->v.integer = wif->ht_enabled;
+ break;
+ case LEAF_wlanIfaceDot11nHTCompatible:
+ val->v.integer = wif->ht_compatible;
+ break;
+ case LEAF_wlanIfaceDot11nHTProtMode:
+ val->v.integer = wif->ht_prot_mode;
+ break;
+ case LEAF_wlanIfaceDot11nRIFS:
+ val->v.integer = wif->rifs;
+ break;
+ case LEAF_wlanIfaceDot11nShortGI:
+ val->v.integer = wif->short_gi;
+ break;
+ case LEAF_wlanIfaceDot11nSMPSMode:
+ val->v.integer = wif->smps_mode;
+ break;
+ case LEAF_wlanIfaceTdmaSlot:
+ val->v.integer = wif->tdma_slot;
+ break;
+ case LEAF_wlanIfaceTdmaSlotCount:
+ val->v.integer = wif->tdma_slot_count;
+ break;
+ case LEAF_wlanIfaceTdmaSlotLength:
+ val->v.integer = wif->tdma_slot_length;
+ break;
+ case LEAF_wlanIfaceTdmaBeaconInterval:
+ val->v.integer = wif->tdma_binterval;
+ break;
+ }
+
+ return (SNMP_ERR_NOERROR);
+
+set_config:
+ rc = wlan_config_set_ioctl(wif, val->var.subs[sub - 1], intval,
+ strval, vlen);
+
+ if (op == SNMP_OP_ROLLBACK) {
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfaceCountryCode:
+ case LEAF_wlanIfaceDesiredSsid:
+ case LEAF_wlanIfaceDesiredBssid:
+ free(ctx->scratch->ptr1);
+ /* FALLTHROUGH */
+ default:
+ break;
+ }
+ }
+
+ if (rc < 0)
+ return (SNMP_ERR_GENERR);
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_if_peer(struct snmp_context *ctx, struct snmp_value *val, uint32_t sub,
+ uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_peer *wip;
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+ wlan_update_peers();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wip = wlan_get_peer(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+ case SNMP_OP_GETNEXT:
+ if ((wip = wlan_get_next_peer(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_mac_index(&val->var, sub, wif->wname, wip->pmac);
+ break;
+ case SNMP_OP_SET:
+ if ((wip = wlan_get_peer(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ if (val->var.subs[sub - 1] != LEAF_wlanIfacePeerVlanTag)
+ return (SNMP_ERR_GENERR);
+ ctx->scratch->int1 = wip->vlan;
+ if (wlan_peer_set_vlan(wif, wip, val->v.integer) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+ case SNMP_OP_COMMIT:
+ return (SNMP_ERR_NOERROR);
+ case SNMP_OP_ROLLBACK:
+ if ((wip = wlan_get_peer(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ if (val->var.subs[sub - 1] != LEAF_wlanIfacePeerVlanTag)
+ return (SNMP_ERR_GENERR);
+ if (wlan_peer_set_vlan(wif, wip, ctx->scratch->int1) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfacePeerAddress:
+ return (string_get(val, wip->pmac, IEEE80211_ADDR_LEN));
+ case LEAF_wlanIfacePeerAssociationId:
+ val->v.integer = wip->associd;
+ break;
+ case LEAF_wlanIfacePeerVlanTag:
+ val->v.integer = wip->vlan;
+ break;
+ case LEAF_wlanIfacePeerFrequency:
+ val->v.integer = wip->frequency;
+ break;
+ case LEAF_wlanIfacePeerCurrentTXRate:
+ val->v.integer = wip->txrate;
+ break;
+ case LEAF_wlanIfacePeerRxSignalStrength:
+ val->v.integer = wip->rssi;
+ break;
+ case LEAF_wlanIfacePeerIdleTimer:
+ val->v.integer = wip->idle;
+ break;
+ case LEAF_wlanIfacePeerTxSequenceNo:
+ val->v.integer = wip->txseqs;
+ break;
+ case LEAF_wlanIfacePeerRxSequenceNo:
+ val->v.integer = wip->rxseqs;
+ break;
+ case LEAF_wlanIfacePeerTxPower:
+ val->v.integer = wip->txpower;
+ break;
+ case LEAF_wlanIfacePeerCapabilities:
+ return (bits_get(val, (uint8_t *)&wip->capinfo,
+ sizeof(wip->capinfo)));
+ case LEAF_wlanIfacePeerFlags:
+ return (bits_get(val, (uint8_t *)&wip->state,
+ sizeof(wip->state)));
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_channels(struct snmp_context *ctx __unused, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ int32_t bits;
+ struct ieee80211_channel *channel;
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+ wlan_update_channels();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((channel = wlan_get_channel(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+ case SNMP_OP_GETNEXT:
+ channel = wlan_get_next_channel(&val->var, sub, &wif);
+ if (channel == NULL || wif == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_channel_index(&val->var, sub, wif, channel);
+ break;
+ case SNMP_OP_SET:
+ return (SNMP_ERR_NOT_WRITEABLE);
+ case SNMP_OP_COMMIT:
+ /* FALLTHROUGH */
+ case SNMP_OP_ROLLBACK:
+ /* FALLTHROUGH */
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfaceChannelIeeeId:
+ val->v.integer = channel->ic_ieee;
+ break;
+ case LEAF_wlanIfaceChannelType:
+ val->v.integer = wlan_get_channel_type(channel);
+ break;
+ case LEAF_wlanIfaceChannelFlags:
+ bits = wlan_channel_flags_to_snmp(channel->ic_flags);
+ return (bits_get(val, (uint8_t *)&bits, sizeof(bits)));
+ case LEAF_wlanIfaceChannelFrequency:
+ val->v.integer = channel->ic_freq;
+ break;
+ case LEAF_wlanIfaceChannelMaxRegPower:
+ val->v.integer = channel->ic_maxregpower;
+ break;
+ case LEAF_wlanIfaceChannelMaxTxPower:
+ val->v.integer = channel->ic_maxpower;
+ break;
+ case LEAF_wlanIfaceChannelMinTxPower:
+ val->v.integer = channel->ic_minpower;
+ break;
+ case LEAF_wlanIfaceChannelState:
+ bits = wlan_channel_state_to_snmp(channel->ic_state);
+ return (bits_get(val, (uint8_t *)&bits, sizeof(bits)));
+ case LEAF_wlanIfaceChannelHTExtension:
+ val->v.integer = channel->ic_extieee;
+ break;
+ case LEAF_wlanIfaceChannelMaxAntennaGain:
+ val->v.integer = channel->ic_maxantgain;
+ break;
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_roam_params(struct snmp_context *ctx __unused, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ uint32_t phy;
+ struct ieee80211_roamparam *rparam;
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+ wlan_update_roam_params();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ rparam = wlan_get_roam_param(&val->var, sub, &wif);
+ if (rparam == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+ case SNMP_OP_GETNEXT:
+ rparam = wlan_get_next_roam_param(&val->var, sub, &wif, &phy);
+ if (rparam == NULL || wif == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_phy_index(&val->var, sub, wif->wname, phy);
+ break;
+ case SNMP_OP_SET:
+ return (SNMP_ERR_NOT_WRITEABLE);
+ case SNMP_OP_COMMIT:
+ /* FALLTHROUGH */
+ case SNMP_OP_ROLLBACK:
+ /* FALLTHROUGH */
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfRoamRxSignalStrength:
+ val->v.integer = rparam->rssi/2;
+ break;
+ case LEAF_wlanIfRoamTxRateThreshold:
+ val->v.integer = rparam->rate/2;
+ break;
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_tx_params(struct snmp_context *ctx, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ uint32_t phy;
+ struct ieee80211_txparam *txparam;
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+ wlan_update_tx_params();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ txparam = wlan_get_tx_param(&val->var, sub, &wif, &phy);
+ if (txparam == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ goto get_txparams;
+
+ case SNMP_OP_GETNEXT:
+ txparam = wlan_get_next_tx_param(&val->var, sub, &wif, &phy);
+ if (txparam == NULL || wif == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_phy_index(&val->var, sub, wif->wname, phy);
+ goto get_txparams;
+
+ case SNMP_OP_SET:
+ txparam = wlan_get_tx_param(&val->var, sub, &wif, &phy);
+ if (txparam == NULL || wif == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfTxUnicastRate:
+ ctx->scratch->int1 = txparam->ucastrate;
+ txparam->ucastrate = val->v.integer * 2;
+ break;
+ case LEAF_wlanIfTxMcastRate:
+ ctx->scratch->int1 = txparam->mcastrate;
+ txparam->mcastrate = val->v.integer * 2;
+ break;
+ case LEAF_wlanIfTxMgmtRate:
+ ctx->scratch->int1 = txparam->mgmtrate;
+ txparam->mgmtrate = val->v.integer * 2;
+ break;
+ case LEAF_wlanIfTxMaxRetryCount:
+ ctx->scratch->int1 = txparam->maxretry;
+ txparam->maxretry = val->v.integer;
+ break;
+ default:
+ abort();
+ }
+ if (wlan_set_tx_params(wif, phy) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_COMMIT:
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_ROLLBACK:
+ txparam = wlan_get_tx_param(&val->var, sub, &wif, &phy);
+ if (txparam == NULL || wif == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfTxUnicastRate:
+ txparam->ucastrate = ctx->scratch->int1;
+ break;
+ case LEAF_wlanIfTxMcastRate:
+ txparam->mcastrate = ctx->scratch->int1;
+ break;
+ case LEAF_wlanIfTxMgmtRate:
+ txparam->mgmtrate = ctx->scratch->int1;
+ break;
+ case LEAF_wlanIfTxMaxRetryCount:
+ txparam->maxretry = ctx->scratch->int1;
+ break;
+ default:
+ abort();
+ }
+ if (wlan_set_tx_params(wif, phy) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+ default:
+ abort();
+ }
+
+get_txparams:
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanIfTxUnicastRate:
+ val->v.integer = txparam->ucastrate / 2;
+ break;
+ case LEAF_wlanIfTxMcastRate:
+ val->v.integer = txparam->mcastrate / 2;
+ break;
+ case LEAF_wlanIfTxMgmtRate:
+ val->v.integer = txparam->mgmtrate / 2;
+ break;
+ case LEAF_wlanIfTxMaxRetryCount:
+ val->v.integer = txparam->maxretry;
+ break;
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_scan_config(struct snmp_context *ctx, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+
+ case SNMP_OP_GETNEXT:
+ if ((wif = wlan_get_next_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_ifindex(&val->var, sub, wif);
+ break;
+
+ case SNMP_OP_SET:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ if (wif->scan_status == wlanScanConfigStatus_running
+ && val->var.subs[sub - 1] != LEAF_wlanScanConfigStatus)
+ return (SNMP_ERR_INCONS_VALUE);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanScanFlags:
+ ctx->scratch->int1 = wif->scan_flags;
+ wif->scan_flags = val->v.integer;
+ break;
+ case LEAF_wlanScanDuration:
+ ctx->scratch->int1 = wif->scan_duration;
+ wif->scan_duration = val->v.integer;
+ break;
+ case LEAF_wlanScanMinChannelDwellTime:
+ ctx->scratch->int1 = wif->scan_mindwell;
+ wif->scan_mindwell = val->v.integer;
+ break;
+ case LEAF_wlanScanMaxChannelDwellTime:
+ ctx->scratch->int1 = wif->scan_maxdwell;
+ wif->scan_maxdwell = val->v.integer;
+ break;
+ case LEAF_wlanScanConfigStatus:
+ if (val->v.integer == wlanScanConfigStatus_running ||
+ val->v.integer == wlanScanConfigStatus_cancel) {
+ ctx->scratch->int1 = wif->scan_status;
+ wif->scan_status = val->v.integer;
+ break;
+ }
+ return (SNMP_ERR_INCONS_VALUE);
+ }
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_COMMIT:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ if (val->var.subs[sub - 1] == LEAF_wlanScanConfigStatus)
+ if (wif->scan_status == wlanScanConfigStatus_running)
+ (void)wlan_set_scan_config(wif); /* XXX */
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_ROLLBACK:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanScanFlags:
+ wif->scan_flags = ctx->scratch->int1;
+ break;
+ case LEAF_wlanScanDuration:
+ wif->scan_duration = ctx->scratch->int1;
+ break;
+ case LEAF_wlanScanMinChannelDwellTime:
+ wif->scan_mindwell = ctx->scratch->int1;
+ break;
+ case LEAF_wlanScanMaxChannelDwellTime:
+ wif->scan_maxdwell = ctx->scratch->int1;
+ break;
+ case LEAF_wlanScanConfigStatus:
+ wif->scan_status = ctx->scratch->int1;
+ break;
+ }
+ return (SNMP_ERR_NOERROR);
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanScanFlags:
+ val->v.integer = wif->scan_flags;
+ break;
+ case LEAF_wlanScanDuration:
+ val->v.integer = wif->scan_duration;
+ break;
+ case LEAF_wlanScanMinChannelDwellTime:
+ val->v.integer = wif->scan_mindwell;
+ break;
+ case LEAF_wlanScanMaxChannelDwellTime:
+ val->v.integer = wif->scan_maxdwell;
+ break;
+ case LEAF_wlanScanConfigStatus:
+ val->v.integer = wif->scan_status;
+ break;
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_scan_results(struct snmp_context *ctx __unused, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_scan_result *sr;
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+ wlan_scan_update_results();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((sr = wlan_get_scanr(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+
+ case SNMP_OP_GETNEXT:
+ if ((sr = wlan_get_next_scanr(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_scanr_index(&val->var, sub, wif->wname, sr->ssid,
+ sr->bssid);
+ break;
+
+ case SNMP_OP_SET:
+ return (SNMP_ERR_NOT_WRITEABLE);
+ case SNMP_OP_COMMIT:
+ /* FALLTHROUGH */
+ case SNMP_OP_ROLLBACK:
+ /* FALLTHROUGH */
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanScanResultID:
+ return (string_get(val, sr->ssid, -1));
+ case LEAF_wlanScanResultBssid:
+ return (string_get(val, sr->bssid, IEEE80211_ADDR_LEN));
+ case LEAF_wlanScanResultChannel:
+ val->v.integer = sr->opchannel; /* XXX */
+ break;
+ case LEAF_wlanScanResultRate:
+ val->v.integer = sr->rssi;
+ break;
+ case LEAF_wlanScanResultNoise:
+ val->v.integer = sr->noise;
+ break;
+ case LEAF_wlanScanResultBeaconInterval:
+ val->v.integer = sr->bintval;
+ break;
+ case LEAF_wlanScanResultCapabilities:
+ return (bits_get(val, &sr->capinfo, sizeof(sr->capinfo)));
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_iface_stats(struct snmp_context *ctx __unused, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+ case SNMP_OP_GETNEXT:
+ if ((wif = wlan_get_next_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_ifindex(&val->var, sub, wif);
+ break;
+ case SNMP_OP_SET:
+ /* XXX: LEAF_wlanStatsReset */
+ return (SNMP_ERR_NOT_WRITEABLE);
+ case SNMP_OP_COMMIT:
+ /* FALLTHROUGH */
+ case SNMP_OP_ROLLBACK:
+ /* FALLTHROUGH */
+ default:
+ abort();
+ }
+
+ if (wlan_get_stats(wif) < 0)
+ return (SNMP_ERR_GENERR);
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanStatsRxBadVersion:
+ val->v.uint32 = wif->stats.is_rx_badversion;
+ break;
+ case LEAF_wlanStatsRxTooShort:
+ val->v.uint32 = wif->stats.is_rx_tooshort;
+ break;
+ case LEAF_wlanStatsRxWrongBssid:
+ val->v.uint32 = wif->stats.is_rx_wrongbss;
+ break;
+ case LEAF_wlanStatsRxDiscardedDups:
+ val->v.uint32 = wif->stats.is_rx_dup;
+ break;
+ case LEAF_wlanStatsRxWrongDir:
+ val->v.uint32 = wif->stats.is_rx_wrongdir;
+ break;
+ case LEAF_wlanStatsRxDiscardMcastEcho:
+ val->v.uint32 = wif->stats.is_rx_mcastecho;
+ break;
+ case LEAF_wlanStatsRxDiscardNoAssoc:
+ val->v.uint32 = wif->stats.is_rx_notassoc;
+ break;
+ case LEAF_wlanStatsRxWepNoPrivacy:
+ val->v.uint32 = wif->stats.is_rx_noprivacy;
+ break;
+ case LEAF_wlanStatsRxWepUnencrypted:
+ val->v.uint32 = wif->stats.is_rx_unencrypted;
+ break;
+ case LEAF_wlanStatsRxWepFailed:
+ val->v.uint32 = wif->stats.is_rx_wepfail;
+ break;
+ case LEAF_wlanStatsRxDecapsulationFailed:
+ val->v.uint32 = wif->stats.is_rx_decap;
+ break;
+ case LEAF_wlanStatsRxDiscardMgmt:
+ val->v.uint32 = wif->stats.is_rx_mgtdiscard;
+ break;
+ case LEAF_wlanStatsRxControl:
+ val->v.uint32 = wif->stats.is_rx_ctl;
+ break;
+ case LEAF_wlanStatsRxBeacon:
+ val->v.uint32 = wif->stats.is_rx_beacon;
+ break;
+ case LEAF_wlanStatsRxRateSetTooBig:
+ val->v.uint32 = wif->stats.is_rx_rstoobig;
+ break;
+ case LEAF_wlanStatsRxElemMissing:
+ val->v.uint32 = wif->stats.is_rx_elem_missing;
+ break;
+ case LEAF_wlanStatsRxElemTooBig:
+ val->v.uint32 = wif->stats.is_rx_elem_toobig;
+ break;
+ case LEAF_wlanStatsRxElemTooSmall:
+ val->v.uint32 = wif->stats.is_rx_elem_toosmall;
+ break;
+ case LEAF_wlanStatsRxElemUnknown:
+ val->v.uint32 = wif->stats.is_rx_elem_unknown;
+ break;
+ case LEAF_wlanStatsRxChannelMismatch:
+ val->v.uint32 = wif->stats.is_rx_chanmismatch;
+ break;
+ case LEAF_wlanStatsRxDropped:
+ val->v.uint32 = wif->stats.is_rx_nodealloc;
+ break;
+ case LEAF_wlanStatsRxSsidMismatch:
+ val->v.uint32 = wif->stats.is_rx_ssidmismatch;
+ break;
+ case LEAF_wlanStatsRxAuthNotSupported:
+ val->v.uint32 = wif->stats.is_rx_auth_unsupported;
+ break;
+ case LEAF_wlanStatsRxAuthFailed:
+ val->v.uint32 = wif->stats.is_rx_auth_fail;
+ break;
+ case LEAF_wlanStatsRxAuthCM:
+ val->v.uint32 = wif->stats.is_rx_auth_countermeasures;
+ break;
+ case LEAF_wlanStatsRxAssocWrongBssid:
+ val->v.uint32 = wif->stats.is_rx_assoc_bss;
+ break;
+ case LEAF_wlanStatsRxAssocNoAuth:
+ val->v.uint32 = wif->stats.is_rx_assoc_notauth;
+ break;
+ case LEAF_wlanStatsRxAssocCapMismatch:
+ val->v.uint32 = wif->stats.is_rx_assoc_capmismatch;
+ break;
+ case LEAF_wlanStatsRxAssocNoRateMatch:
+ val->v.uint32 = wif->stats.is_rx_assoc_norate;
+ break;
+ case LEAF_wlanStatsRxBadWpaIE:
+ val->v.uint32 = wif->stats.is_rx_assoc_badwpaie;
+ break;
+ case LEAF_wlanStatsRxDeauthenticate:
+ val->v.uint32 = wif->stats.is_rx_deauth;
+ break;
+ case LEAF_wlanStatsRxDisassociate:
+ val->v.uint32 = wif->stats.is_rx_disassoc;
+ break;
+ case LEAF_wlanStatsRxUnknownSubtype:
+ val->v.uint32 = wif->stats.is_rx_badsubtype;
+ break;
+ case LEAF_wlanStatsRxFailedNoBuf:
+ val->v.uint32 = wif->stats.is_rx_nobuf;
+ break;
+ case LEAF_wlanStatsRxBadAuthRequest:
+ val->v.uint32 = wif->stats.is_rx_bad_auth;
+ break;
+ case LEAF_wlanStatsRxUnAuthorized:
+ val->v.uint32 = wif->stats.is_rx_unauth;
+ break;
+ case LEAF_wlanStatsRxBadKeyId:
+ val->v.uint32 = wif->stats.is_rx_badkeyid;
+ break;
+ case LEAF_wlanStatsRxCCMPSeqViolation:
+ val->v.uint32 = wif->stats.is_rx_ccmpreplay;
+ break;
+ case LEAF_wlanStatsRxCCMPBadFormat:
+ val->v.uint32 = wif->stats.is_rx_ccmpformat;
+ break;
+ case LEAF_wlanStatsRxCCMPFailedMIC:
+ val->v.uint32 = wif->stats.is_rx_ccmpmic;
+ break;
+ case LEAF_wlanStatsRxTKIPSeqViolation:
+ val->v.uint32 = wif->stats.is_rx_tkipreplay;
+ break;
+ case LEAF_wlanStatsRxTKIPBadFormat:
+ val->v.uint32 = wif->stats.is_rx_tkipformat;
+ break;
+ case LEAF_wlanStatsRxTKIPFailedMIC:
+ val->v.uint32 = wif->stats.is_rx_tkipmic;
+ break;
+ case LEAF_wlanStatsRxTKIPFailedICV:
+ val->v.uint32 = wif->stats.is_rx_tkipicv;
+ break;
+ case LEAF_wlanStatsRxDiscardACL:
+ val->v.uint32 = wif->stats.is_rx_acl;
+ break;
+ case LEAF_wlanStatsTxFailedNoBuf:
+ val->v.uint32 = wif->stats.is_tx_nobuf;
+ break;
+ case LEAF_wlanStatsTxFailedNoNode:
+ val->v.uint32 = wif->stats.is_tx_nonode;
+ break;
+ case LEAF_wlanStatsTxUnknownMgmt:
+ val->v.uint32 = wif->stats.is_tx_unknownmgt;
+ break;
+ case LEAF_wlanStatsTxBadCipher:
+ val->v.uint32 = wif->stats.is_tx_badcipher;
+ break;
+ case LEAF_wlanStatsTxNoDefKey:
+ val->v.uint32 = wif->stats.is_tx_nodefkey;
+ break;
+ case LEAF_wlanStatsTxFragmented:
+ val->v.uint32 = wif->stats.is_tx_fragframes;
+ break;
+ case LEAF_wlanStatsTxFragmentsCreated:
+ val->v.uint32 = wif->stats.is_tx_frags;
+ break;
+ case LEAF_wlanStatsActiveScans:
+ val->v.uint32 = wif->stats.is_scan_active;
+ break;
+ case LEAF_wlanStatsPassiveScans:
+ val->v.uint32 = wif->stats.is_scan_passive;
+ break;
+ case LEAF_wlanStatsTimeoutInactivity:
+ val->v.uint32 = wif->stats.is_node_timeout;
+ break;
+ case LEAF_wlanStatsCryptoNoMem:
+ val->v.uint32 = wif->stats.is_crypto_nomem;
+ break;
+ case LEAF_wlanStatsSwCryptoTKIP:
+ val->v.uint32 = wif->stats.is_crypto_tkip;
+ break;
+ case LEAF_wlanStatsSwCryptoTKIPEnMIC:
+ val->v.uint32 = wif->stats.is_crypto_tkipenmic;
+ break;
+ case LEAF_wlanStatsSwCryptoTKIPDeMIC:
+ val->v.uint32 = wif->stats.is_crypto_tkipdemic;
+ break;
+ case LEAF_wlanStatsCryptoTKIPCM:
+ val->v.uint32 = wif->stats.is_crypto_tkipcm;
+ break;
+ case LEAF_wlanStatsSwCryptoCCMP:
+ val->v.uint32 = wif->stats.is_crypto_ccmp;
+ break;
+ case LEAF_wlanStatsSwCryptoWEP:
+ val->v.uint32 = wif->stats.is_crypto_wep;
+ break;
+ case LEAF_wlanStatsCryptoCipherKeyRejected:
+ val->v.uint32 = wif->stats.is_crypto_setkey_cipher;
+ break;
+ case LEAF_wlanStatsCryptoNoKey:
+ val->v.uint32 = wif->stats.is_crypto_setkey_nokey;
+ break;
+ case LEAF_wlanStatsCryptoDeleteKeyFailed:
+ val->v.uint32 = wif->stats.is_crypto_delkey;
+ break;
+ case LEAF_wlanStatsCryptoUnknownCipher:
+ val->v.uint32 = wif->stats.is_crypto_badcipher;
+ break;
+ case LEAF_wlanStatsCryptoAttachFailed:
+ val->v.uint32 = wif->stats.is_crypto_attachfail;
+ break;
+ case LEAF_wlanStatsCryptoKeyFailed:
+ val->v.uint32 = wif->stats.is_crypto_keyfail;
+ break;
+ case LEAF_wlanStatsCryptoEnMICFailed:
+ val->v.uint32 = wif->stats.is_crypto_enmicfail;
+ break;
+ case LEAF_wlanStatsIBSSCapMismatch:
+ val->v.uint32 = wif->stats.is_ibss_capmismatch;
+ break;
+ case LEAF_wlanStatsUnassocStaPSPoll:
+ val->v.uint32 = wif->stats.is_ps_unassoc;
+ break;
+ case LEAF_wlanStatsBadAidPSPoll:
+ val->v.uint32 = wif->stats.is_ps_badaid;
+ break;
+ case LEAF_wlanStatsEmptyPSPoll:
+ val->v.uint32 = wif->stats.is_ps_qempty;
+ break;
+ case LEAF_wlanStatsRxFFBadHdr:
+ val->v.uint32 = wif->stats.is_ff_badhdr;
+ break;
+ case LEAF_wlanStatsRxFFTooShort:
+ val->v.uint32 = wif->stats.is_ff_tooshort;
+ break;
+ case LEAF_wlanStatsRxFFSplitError:
+ val->v.uint32 = wif->stats.is_ff_split;
+ break;
+ case LEAF_wlanStatsRxFFDecap:
+ val->v.uint32 = wif->stats.is_ff_decap;
+ break;
+ case LEAF_wlanStatsTxFFEncap:
+ val->v.uint32 = wif->stats.is_ff_encap;
+ break;
+ case LEAF_wlanStatsRxBadBintval:
+ val->v.uint32 = wif->stats.is_rx_badbintval;
+ break;
+ case LEAF_wlanStatsRxDemicFailed:
+ val->v.uint32 = wif->stats.is_rx_demicfail;
+ break;
+ case LEAF_wlanStatsRxDefragFailed:
+ val->v.uint32 = wif->stats.is_rx_defrag;
+ break;
+ case LEAF_wlanStatsRxMgmt:
+ val->v.uint32 = wif->stats.is_rx_mgmt;
+ break;
+ case LEAF_wlanStatsRxActionMgmt:
+ val->v.uint32 = wif->stats.is_rx_action;
+ break;
+ case LEAF_wlanStatsRxAMSDUTooShort:
+ val->v.uint32 = wif->stats.is_amsdu_tooshort;
+ break;
+ case LEAF_wlanStatsRxAMSDUSplitError:
+ val->v.uint32 = wif->stats.is_amsdu_split;
+ break;
+ case LEAF_wlanStatsRxAMSDUDecap:
+ val->v.uint32 = wif->stats.is_amsdu_decap;
+ break;
+ case LEAF_wlanStatsTxAMSDUEncap:
+ val->v.uint32 = wif->stats.is_amsdu_encap;
+ break;
+ case LEAF_wlanStatsAMPDUBadBAR:
+ val->v.uint32 = wif->stats.is_ampdu_bar_bad;
+ break;
+ case LEAF_wlanStatsAMPDUOowBar:
+ val->v.uint32 = wif->stats.is_ampdu_bar_oow;
+ break;
+ case LEAF_wlanStatsAMPDUMovedBAR:
+ val->v.uint32 = wif->stats.is_ampdu_bar_move;
+ break;
+ case LEAF_wlanStatsAMPDURxBAR:
+ val->v.uint32 = wif->stats.is_ampdu_bar_rx;
+ break;
+ case LEAF_wlanStatsAMPDURxOor:
+ val->v.uint32 = wif->stats.is_ampdu_rx_oor;
+ break;
+ case LEAF_wlanStatsAMPDURxCopied:
+ val->v.uint32 = wif->stats.is_ampdu_rx_copy;
+ break;
+ case LEAF_wlanStatsAMPDURxDropped:
+ val->v.uint32 = wif->stats.is_ampdu_rx_drop;
+ break;
+ case LEAF_wlanStatsTxDiscardBadState:
+ val->v.uint32 = wif->stats.is_tx_badstate;
+ break;
+ case LEAF_wlanStatsTxFailedNoAssoc:
+ val->v.uint32 = wif->stats.is_tx_notassoc;
+ break;
+ case LEAF_wlanStatsTxClassifyFailed:
+ val->v.uint32 = wif->stats.is_tx_classify;
+ break;
+ case LEAF_wlanStatsDwdsMcastDiscard:
+ val->v.uint32 = wif->stats.is_dwds_mcast;
+ break;
+ case LEAF_wlanStatsHTAssocRejectNoHT:
+ val->v.uint32 = wif->stats.is_ht_assoc_nohtcap;
+ break;
+ case LEAF_wlanStatsHTAssocDowngrade:
+ val->v.uint32 = wif->stats.is_ht_assoc_downgrade;
+ break;
+ case LEAF_wlanStatsHTAssocRateMismatch:
+ val->v.uint32 = wif->stats.is_ht_assoc_norate;
+ break;
+ case LEAF_wlanStatsAMPDURxAge:
+ val->v.uint32 = wif->stats.is_ampdu_rx_age;
+ break;
+ case LEAF_wlanStatsAMPDUMoved:
+ val->v.uint32 = wif->stats.is_ampdu_rx_move;
+ break;
+ case LEAF_wlanStatsADDBADisabledReject:
+ val->v.uint32 = wif->stats.is_addba_reject;
+ break;
+ case LEAF_wlanStatsADDBANoRequest:
+ val->v.uint32 = wif->stats.is_addba_norequest;
+ break;
+ case LEAF_wlanStatsADDBABadToken:
+ val->v.uint32 = wif->stats.is_addba_badtoken;
+ break;
+ case LEAF_wlanStatsADDBABadPolicy:
+ val->v.uint32 = wif->stats.is_addba_badpolicy;
+ break;
+ case LEAF_wlanStatsAMPDUStopped:
+ val->v.uint32 = wif->stats.is_ampdu_stop;
+ break;
+ case LEAF_wlanStatsAMPDUStopFailed:
+ val->v.uint32 = wif->stats.is_ampdu_stop_failed;
+ break;
+ case LEAF_wlanStatsAMPDURxReorder:
+ val->v.uint32 = wif->stats.is_ampdu_rx_reorder;
+ break;
+ case LEAF_wlanStatsScansBackground:
+ val->v.uint32 = wif->stats.is_scan_bg;
+ break;
+ case LEAF_wlanLastDeauthReason:
+ val->v.uint32 = wif->stats.is_rx_deauth_code;
+ break;
+ case LEAF_wlanLastDissasocReason:
+ val->v.uint32 = wif->stats.is_rx_disassoc_code;
+ break;
+ case LEAF_wlanLastAuthFailReason:
+ val->v.uint32 = wif->stats.is_rx_authfail_code;
+ break;
+ case LEAF_wlanStatsBeaconMissedEvents:
+ val->v.uint32 = wif->stats.is_beacon_miss;
+ break;
+ case LEAF_wlanStatsRxDiscardBadStates:
+ val->v.uint32 = wif->stats.is_rx_badstate;
+ break;
+ case LEAF_wlanStatsFFFlushed:
+ val->v.uint32 = wif->stats.is_ff_flush;
+ break;
+ case LEAF_wlanStatsTxControlFrames:
+ val->v.uint32 = wif->stats.is_tx_ctl;
+ break;
+ case LEAF_wlanStatsAMPDURexmt:
+ val->v.uint32 = wif->stats.is_ampdu_rexmt;
+ break;
+ case LEAF_wlanStatsAMPDURexmtFailed:
+ val->v.uint32 = wif->stats.is_ampdu_rexmt_fail;
+ break;
+ case LEAF_wlanStatsReset:
+ val->v.uint32 = wlanStatsReset_no_op;
+ break;
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_wep_iface(struct snmp_context *ctx, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL ||
+ !wif->wepsupported)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+
+ case SNMP_OP_GETNEXT:
+ /* XXX: filter wif->wepsupported */
+ if ((wif = wlan_get_next_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_ifindex(&val->var, sub, wif);
+ break;
+
+ case SNMP_OP_SET:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL ||
+ !wif->wepsupported)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanWepMode:
+ if (val->v.integer < wlanWepMode_off ||
+ val->v.integer > wlanWepMode_mixed)
+ return (SNMP_ERR_INCONS_VALUE);
+ ctx->scratch->int1 = wif->wepmode;
+ wif->wepmode = val->v.integer;
+ if (wlan_set_wepmode(wif) < 0) {
+ wif->wepmode = ctx->scratch->int1;
+ return (SNMP_ERR_GENERR);
+ }
+ break;
+ case LEAF_wlanWepDefTxKey:
+ if (val->v.integer < 0 ||
+ val->v.integer > IEEE80211_WEP_NKID)
+ return (SNMP_ERR_INCONS_VALUE);
+ ctx->scratch->int1 = wif->weptxkey;
+ wif->weptxkey = val->v.integer;
+ if (wlan_set_weptxkey(wif) < 0) {
+ wif->weptxkey = ctx->scratch->int1;
+ return (SNMP_ERR_GENERR);
+ }
+ break;
+ default:
+ abort();
+ }
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_COMMIT:
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_ROLLBACK:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanWepMode:
+ wif->wepmode = ctx->scratch->int1;
+ if (wlan_set_wepmode(wif) < 0)
+ return (SNMP_ERR_GENERR);
+ break;
+ case LEAF_wlanWepDefTxKey:
+ wif->weptxkey = ctx->scratch->int1;
+ if (wlan_set_weptxkey(wif) < 0)
+ return (SNMP_ERR_GENERR);
+ break;
+ default:
+ abort();
+ }
+ return (SNMP_ERR_NOERROR);
+
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanWepMode:
+ if (wlan_get_wepmode(wif) < 0)
+ return (SNMP_ERR_GENERR);
+ val->v.integer = wif->wepmode;
+ break;
+ case LEAF_wlanWepDefTxKey:
+ if (wlan_get_weptxkey(wif) < 0)
+ return (SNMP_ERR_GENERR);
+ val->v.integer = wif->weptxkey;
+ break;
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_wep_key(struct snmp_context *ctx __unused,
+ struct snmp_value *val __unused, uint32_t sub __unused,
+ uint32_t iidx __unused, enum snmp_op op __unused)
+{
+ return (SNMP_ERR_NOSUCHNAME);
+}
+
+int
+op_wlan_mac_access_control(struct snmp_context *ctx, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL ||
+ !wif->macsupported)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+
+ case SNMP_OP_GETNEXT:
+ /* XXX: filter wif->macsupported */
+ if ((wif = wlan_get_next_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_ifindex(&val->var, sub, wif);
+ break;
+
+ case SNMP_OP_SET:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL ||
+ !wif->macsupported)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMACAccessControlPolicy:
+ ctx->scratch->int1 = wif->mac_policy;
+ wif->mac_policy = val->v.integer;
+ break;
+ case LEAF_wlanMACAccessControlNacl:
+ return (SNMP_ERR_NOT_WRITEABLE);
+ case LEAF_wlanMACAccessControlFlush:
+ break;
+ default:
+ abort();
+ }
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_COMMIT:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMACAccessControlPolicy:
+ if (wlan_set_mac_policy(wif) < 0) {
+ wif->mac_policy = ctx->scratch->int1;
+ return (SNMP_ERR_GENERR);
+ }
+ break;
+ case LEAF_wlanMACAccessControlFlush:
+ if (wlan_flush_mac_mac(wif) < 0)
+ return (SNMP_ERR_GENERR);
+ break;
+ default:
+ abort();
+ }
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_ROLLBACK:
+ if ((wif = wlan_get_interface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ if (val->var.subs[sub - 1] == LEAF_wlanMACAccessControlPolicy)
+ wif->mac_policy = ctx->scratch->int1;
+ return (SNMP_ERR_NOERROR);
+
+ default:
+ abort();
+ }
+
+ if (wlan_get_mac_policy(wif) < 0)
+ return (SNMP_ERR_GENERR);
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMACAccessControlPolicy:
+ val->v.integer = wif->mac_policy;
+ break;
+ case LEAF_wlanMACAccessControlNacl:
+ val->v.integer = wif->mac_nacls;
+ break;
+ case LEAF_wlanMACAccessControlFlush:
+ val->v.integer = wlanMACAccessControlFlush_no_op;
+ break;
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_mac_acl_mac(struct snmp_context *ctx, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_iface *wif;
+ struct wlan_mac_mac *macl;
+
+ wlan_update_interface_list();
+ wlan_mac_update_aclmacs();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((macl = wlan_get_acl_mac(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+
+ case SNMP_OP_GETNEXT:
+ if ((macl = wlan_get_next_acl_mac(&val->var, sub, &wif))
+ == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_mac_index(&val->var, sub, wif->wname, macl->mac);
+ break;
+
+ case SNMP_OP_SET:
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMACAccessControlMAC:
+ return (SNMP_ERR_INCONS_NAME);
+ case LEAF_wlanMACAccessControlMACStatus:
+ return(wlan_acl_mac_set_status(ctx, val, sub));
+ default:
+ abort();
+ }
+
+ case SNMP_OP_COMMIT:
+ if ((macl = wlan_get_acl_mac(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ if (val->v.integer == RowStatus_destroy &&
+ wlan_mac_delete_mac(wif, macl) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_ROLLBACK:
+ if ((macl = wlan_get_acl_mac(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ if (ctx->scratch->int1 == RowStatus_destroy &&
+ wlan_mac_delete_mac(wif, macl) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMACAccessControlMAC:
+ return (string_get(val, macl->mac, IEEE80211_ADDR_LEN));
+ case LEAF_wlanMACAccessControlMACStatus:
+ val->v.integer = macl->mac_status;
+ break;
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_mesh_config(struct snmp_context *ctx, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ int which;
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMeshMaxRetries:
+ which = WLAN_MESH_MAX_RETRIES;
+ break;
+ case LEAF_wlanMeshHoldingTimeout:
+ which = WLAN_MESH_HOLDING_TO;
+ break;
+ case LEAF_wlanMeshConfirmTimeout:
+ which = WLAN_MESH_CONFIRM_TO;
+ break;
+ case LEAF_wlanMeshRetryTimeout:
+ which = WLAN_MESH_RETRY_TO;
+ break;
+ default:
+ abort();
+ }
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if (wlan_do_sysctl(&wlan_config, which, 0) < 0)
+ return (SNMP_ERR_GENERR);
+ break;
+
+ case SNMP_OP_GETNEXT:
+ abort();
+
+ case SNMP_OP_SET:
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMeshRetryTimeout :
+ ctx->scratch->int1 = wlan_config.mesh_retryto;
+ wlan_config.mesh_retryto = val->v.integer;
+ break;
+ case LEAF_wlanMeshHoldingTimeout:
+ ctx->scratch->int1 = wlan_config.mesh_holdingto;
+ wlan_config.mesh_holdingto = val->v.integer;
+ break;
+ case LEAF_wlanMeshConfirmTimeout:
+ ctx->scratch->int1 = wlan_config.mesh_confirmto;
+ wlan_config.mesh_confirmto = val->v.integer;
+ break;
+ case LEAF_wlanMeshMaxRetries:
+ ctx->scratch->int1 = wlan_config.mesh_maxretries;
+ wlan_config.mesh_maxretries = val->v.integer;
+ break;
+ }
+ if (wlan_do_sysctl(&wlan_config, which, 1) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_COMMIT:
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_ROLLBACK:
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMeshRetryTimeout:
+ wlan_config.mesh_retryto = ctx->scratch->int1;
+ break;
+ case LEAF_wlanMeshConfirmTimeout:
+ wlan_config.mesh_confirmto = ctx->scratch->int1;
+ break;
+ case LEAF_wlanMeshHoldingTimeout:
+ wlan_config.mesh_holdingto= ctx->scratch->int1;
+ break;
+ case LEAF_wlanMeshMaxRetries:
+ wlan_config.mesh_maxretries = ctx->scratch->int1;
+ break;
+ }
+ if (wlan_do_sysctl(&wlan_config, which, 1) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMeshRetryTimeout:
+ val->v.integer = wlan_config.mesh_retryto;
+ break;
+ case LEAF_wlanMeshHoldingTimeout:
+ val->v.integer = wlan_config.mesh_holdingto;
+ break;
+ case LEAF_wlanMeshConfirmTimeout:
+ val->v.integer = wlan_config.mesh_confirmto;
+ break;
+ case LEAF_wlanMeshMaxRetries:
+ val->v.integer = wlan_config.mesh_maxretries;
+ break;
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_mesh_iface(struct snmp_context *ctx, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ int rc;
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+
+ case SNMP_OP_GETNEXT:
+ if ((wif = wlan_mesh_get_next_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_ifindex(&val->var, sub, wif);
+ break;
+
+ case SNMP_OP_SET:
+ if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMeshId:
+ if (val->v.octetstring.len > IEEE80211_NWID_LEN)
+ return (SNMP_ERR_INCONS_VALUE);
+ ctx->scratch->ptr1 = malloc(val->v.octetstring.len + 1);
+ if (ctx->scratch->ptr1 == NULL)
+ return (SNMP_ERR_GENERR);
+ strlcpy(ctx->scratch->ptr1, wif->desired_ssid,
+ val->v.octetstring.len + 1);
+ ctx->scratch->int1 = strlen(wif->desired_ssid);
+ memcpy(wif->desired_ssid, val->v.octetstring.octets,
+ val->v.octetstring.len);
+ wif->desired_ssid[val->v.octetstring.len] = '\0';
+ break;
+ case LEAF_wlanMeshTTL:
+ ctx->scratch->int1 = wif->mesh_ttl;
+ wif->mesh_ttl = val->v.integer;
+ break;
+ case LEAF_wlanMeshPeeringEnabled:
+ ctx->scratch->int1 = wif->mesh_peering;
+ wif->mesh_peering = val->v.integer;
+ break;
+ case LEAF_wlanMeshForwardingEnabled:
+ ctx->scratch->int1 = wif->mesh_forwarding;
+ wif->mesh_forwarding = val->v.integer;
+ break;
+ case LEAF_wlanMeshMetric:
+ ctx->scratch->int1 = wif->mesh_metric;
+ wif->mesh_metric = val->v.integer;
+ break;
+ case LEAF_wlanMeshPath:
+ ctx->scratch->int1 = wif->mesh_path;
+ wif->mesh_path = val->v.integer;
+ break;
+ case LEAF_wlanMeshRoutesFlush:
+ if (val->v.integer != wlanMeshRoutesFlush_flush)
+ return (SNMP_ERR_INCONS_VALUE);
+ return (SNMP_ERR_NOERROR);
+ default:
+ abort();
+ }
+ if (val->var.subs[sub - 1] == LEAF_wlanMeshId)
+ rc = wlan_config_set_dssid(wif,
+ val->v.octetstring.octets, val->v.octetstring.len);
+ else
+ rc = wlan_mesh_config_set(wif, val->var.subs[sub - 1]);
+ if (rc < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_COMMIT:
+ if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ if (val->var.subs[sub - 1] == LEAF_wlanMeshRoutesFlush &&
+ wlan_mesh_flush_routes(wif) < 0)
+ return (SNMP_ERR_GENERR);
+ if (val->var.subs[sub - 1] == LEAF_wlanMeshId)
+ free(ctx->scratch->ptr1);
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_ROLLBACK:
+ if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMeshId:
+ strlcpy(wif->desired_ssid, ctx->scratch->ptr1,
+ IEEE80211_NWID_LEN);
+ free(ctx->scratch->ptr1);
+ break;
+ case LEAF_wlanMeshTTL:
+ wif->mesh_ttl = ctx->scratch->int1;
+ break;
+ case LEAF_wlanMeshPeeringEnabled:
+ wif->mesh_peering = ctx->scratch->int1;
+ break;
+ case LEAF_wlanMeshForwardingEnabled:
+ wif->mesh_forwarding = ctx->scratch->int1;
+ break;
+ case LEAF_wlanMeshMetric:
+ wif->mesh_metric = ctx->scratch->int1;
+ break;
+ case LEAF_wlanMeshPath:
+ wif->mesh_path = ctx->scratch->int1;
+ break;
+ case LEAF_wlanMeshRoutesFlush:
+ return (SNMP_ERR_NOERROR);
+ default:
+ abort();
+ }
+ if (val->var.subs[sub - 1] == LEAF_wlanMeshId)
+ rc = wlan_config_set_dssid(wif, wif->desired_ssid,
+ strlen(wif->desired_ssid));
+ else
+ rc = wlan_mesh_config_set(wif, val->var.subs[sub - 1]);
+ if (rc < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ default:
+ abort();
+ }
+
+ if (val->var.subs[sub - 1] == LEAF_wlanMeshId)
+ rc = wlan_config_get_dssid(wif);
+ else
+ rc = wlan_mesh_config_get(wif, val->var.subs[sub - 1]);
+ if (rc < 0)
+ return (SNMP_ERR_GENERR);
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMeshId:
+ return (string_get(val, wif->desired_ssid, -1));
+ case LEAF_wlanMeshTTL:
+ val->v.integer = wif->mesh_ttl;
+ break;
+ case LEAF_wlanMeshPeeringEnabled:
+ val->v.integer = wif->mesh_peering;
+ break;
+ case LEAF_wlanMeshForwardingEnabled:
+ val->v.integer = wif->mesh_forwarding;
+ break;
+ case LEAF_wlanMeshMetric:
+ val->v.integer = wif->mesh_metric;
+ break;
+ case LEAF_wlanMeshPath:
+ val->v.integer = wif->mesh_path;
+ break;
+ case LEAF_wlanMeshRoutesFlush:
+ val->v.integer = wlanMeshRoutesFlush_no_op;
+ break;
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_mesh_neighbor(struct snmp_context *ctx __unused, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_peer *wip;
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+ wlan_update_peers();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wip = wlan_mesh_get_peer(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+ case SNMP_OP_GETNEXT:
+ wip = wlan_mesh_get_next_peer(&val->var, sub, &wif);
+ if (wip == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_mac_index(&val->var, sub, wif->wname,
+ wip->pmac);
+ break;
+ case SNMP_OP_SET:
+ return (SNMP_ERR_NOT_WRITEABLE);
+ case SNMP_OP_COMMIT:
+ /* FALLTHROUGH */
+ case SNMP_OP_ROLLBACK:
+ /* FALLTHROUGH */
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMeshNeighborAddress:
+ return (string_get(val, wip->pmac, IEEE80211_ADDR_LEN));
+ case LEAF_wlanMeshNeighborFrequency:
+ val->v.integer = wip->frequency;
+ break;
+ case LEAF_wlanMeshNeighborLocalId:
+ val->v.integer = wip->local_id;
+ break;
+ case LEAF_wlanMeshNeighborPeerId:
+ val->v.integer = wip->peer_id;
+ break;
+ case LEAF_wlanMeshNeighborPeerState:
+ return (bits_get(val, (uint8_t *)&wip->state,
+ sizeof(wip->state)));
+ case LEAF_wlanMeshNeighborCurrentTXRate:
+ val->v.integer = wip->txrate;
+ break;
+ case LEAF_wlanMeshNeighborRxSignalStrength:
+ val->v.integer = wip->rssi;
+ break;
+ case LEAF_wlanMeshNeighborIdleTimer:
+ val->v.integer = wip->idle;
+ break;
+ case LEAF_wlanMeshNeighborTxSequenceNo:
+ val->v.integer = wip->txseqs;
+ break;
+ case LEAF_wlanMeshNeighborRxSequenceNo:
+ val->v.integer = wip->rxseqs;
+ break;
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_mesh_route(struct snmp_context *ctx, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_mesh_route *wmr;
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+ wlan_mesh_update_routes();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wmr = wlan_mesh_get_route(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+
+ case SNMP_OP_GETNEXT:
+ wmr = wlan_mesh_get_next_route(&val->var, sub, &wif);
+ if (wmr == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_mac_index(&val->var, sub, wif->wname,
+ wmr->imroute.imr_dest);
+ break;
+
+ case SNMP_OP_SET:
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMeshRouteDestination:
+ return (SNMP_ERR_INCONS_NAME);
+ case LEAF_wlanMeshRouteStatus:
+ return(wlan_mesh_route_set_status(ctx, val, sub));
+ default:
+ return (SNMP_ERR_NOT_WRITEABLE);
+ }
+ abort();
+
+ case SNMP_OP_COMMIT:
+ if ((wmr = wlan_mesh_get_route(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ if (val->v.integer == RowStatus_destroy &&
+ wlan_mesh_delete_route(wif, wmr) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_ROLLBACK:
+ if ((wmr = wlan_mesh_get_route(&val->var, sub, &wif)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ if (ctx->scratch->int1 == RowStatus_destroy &&
+ wlan_mesh_delete_route(wif, wmr) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMeshRouteDestination:
+ return (string_get(val, wmr->imroute.imr_dest,
+ IEEE80211_ADDR_LEN));
+ case LEAF_wlanMeshRouteNextHop:
+ return (string_get(val, wmr->imroute.imr_nexthop,
+ IEEE80211_ADDR_LEN));
+ case LEAF_wlanMeshRouteHops:
+ val->v.integer = wmr->imroute.imr_nhops;
+ break;
+ case LEAF_wlanMeshRouteMetric:
+ val->v.integer = wmr->imroute.imr_metric;
+ break;
+ case LEAF_wlanMeshRouteLifeTime:
+ val->v.integer = wmr->imroute.imr_lifetime;
+ break;
+ case LEAF_wlanMeshRouteLastMseq:
+ val->v.integer = wmr->imroute.imr_lastmseq;
+ break;
+ case LEAF_wlanMeshRouteFlags:
+ val->v.integer = 0;
+ if ((wmr->imroute.imr_flags &
+ IEEE80211_MESHRT_FLAGS_VALID) != 0)
+ val->v.integer |= (0x1 << wlanMeshRouteFlags_valid);
+ if ((wmr->imroute.imr_flags &
+ IEEE80211_MESHRT_FLAGS_PROXY) != 0)
+ val->v.integer |= (0x1 << wlanMeshRouteFlags_proxy);
+ return (bits_get(val, (uint8_t *)&val->v.integer,
+ sizeof(val->v.integer)));
+ case LEAF_wlanMeshRouteStatus:
+ val->v.integer = wmr->mroute_status;
+ break;
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_mesh_stats(struct snmp_context *ctx __unused, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+ case SNMP_OP_GETNEXT:
+ if ((wif = wlan_mesh_get_next_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_ifindex(&val->var, sub, wif);
+ break;
+ case SNMP_OP_SET:
+ return (SNMP_ERR_NOT_WRITEABLE);
+ case SNMP_OP_COMMIT:
+ /* FALLTHROUGH */
+ case SNMP_OP_ROLLBACK:
+ /* FALLTHROUGH */
+ default:
+ abort();
+ }
+
+ if (wlan_get_stats(wif) < 0)
+ return (SNMP_ERR_GENERR);
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMeshDroppedBadSta:
+ val->v.uint32 = wif->stats.is_mesh_wrongmesh;
+ break;
+ case LEAF_wlanMeshDroppedNoLink:
+ val->v.uint32 = wif->stats.is_mesh_nolink;
+ break;
+ case LEAF_wlanMeshNoFwdTtl:
+ val->v.uint32 = wif->stats.is_mesh_fwd_ttl;
+ break;
+ case LEAF_wlanMeshNoFwdBuf:
+ val->v.uint32 = wif->stats.is_mesh_fwd_nobuf;
+ break;
+ case LEAF_wlanMeshNoFwdTooShort:
+ val->v.uint32 = wif->stats.is_mesh_fwd_tooshort;
+ break;
+ case LEAF_wlanMeshNoFwdDisabled:
+ val->v.uint32 = wif->stats.is_mesh_fwd_disabled;
+ break;
+ case LEAF_wlanMeshNoFwdPathUnknown:
+ val->v.uint32 = wif->stats.is_mesh_fwd_nopath;
+ break;
+ case LEAF_wlanMeshDroppedBadAE:
+ val->v.uint32 = wif->stats.is_mesh_badae;
+ break;
+ case LEAF_wlanMeshRouteAddFailed:
+ val->v.uint32 = wif->stats.is_mesh_rtaddfailed;
+ break;
+ case LEAF_wlanMeshDroppedNoProxy:
+ val->v.uint32 = wif->stats.is_mesh_notproxy;
+ break;
+ case LEAF_wlanMeshDroppedMisaligned:
+ val->v.uint32 = wif->stats.is_rx_badalign;
+ break;
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_hwmp_config(struct snmp_context *ctx, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ int which;
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanHWMPRouteInactiveTimeout:
+ which = WLAN_HWMP_INACTIVITY_TO;
+ break;
+ case LEAF_wlanHWMPRootAnnounceInterval:
+ which = WLAN_HWMP_RANN_INT;
+ break;
+ case LEAF_wlanHWMPRootInterval:
+ which = WLAN_HWMP_ROOT_INT;
+ break;
+ case LEAF_wlanHWMPRootTimeout:
+ which = WLAN_HWMP_ROOT_TO;
+ break;
+ case LEAF_wlanHWMPPathLifetime:
+ which = WLAN_HWMP_PATH_LIFETIME;
+ break;
+ case LEAF_wlanHWMPReplyForwardBit:
+ which = WLAN_HWMP_REPLY_FORWARD;
+ break;
+ case LEAF_wlanHWMPTargetOnlyBit:
+ which = WLAN_HWMP_TARGET_ONLY;
+ break;
+ default:
+ abort();
+ }
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if (wlan_do_sysctl(&wlan_config, which, 0) < 0)
+ return (SNMP_ERR_GENERR);
+ break;
+
+ case SNMP_OP_GETNEXT:
+ abort();
+
+ case SNMP_OP_SET:
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanHWMPRouteInactiveTimeout:
+ ctx->scratch->int1 = wlan_config.hwmp_inact;
+ wlan_config.hwmp_inact = val->v.integer;
+ break;
+ case LEAF_wlanHWMPRootAnnounceInterval:
+ ctx->scratch->int1 = wlan_config.hwmp_rannint;
+ wlan_config.hwmp_rannint = val->v.integer;
+ break;
+ case LEAF_wlanHWMPRootInterval:
+ ctx->scratch->int1 = wlan_config.hwmp_rootint;
+ wlan_config.hwmp_rootint = val->v.integer;
+ break;
+ case LEAF_wlanHWMPRootTimeout:
+ ctx->scratch->int1 = wlan_config.hwmp_roottimeout;
+ wlan_config.hwmp_roottimeout = val->v.integer;
+ break;
+ case LEAF_wlanHWMPPathLifetime:
+ ctx->scratch->int1 = wlan_config.hwmp_pathlifetime;
+ wlan_config.hwmp_pathlifetime = val->v.integer;
+ break;
+ case LEAF_wlanHWMPReplyForwardBit:
+ ctx->scratch->int1 = wlan_config.hwmp_replyforward;
+ wlan_config.hwmp_replyforward = val->v.integer;
+ break;
+ case LEAF_wlanHWMPTargetOnlyBit:
+ ctx->scratch->int1 = wlan_config.hwmp_targetonly;
+ wlan_config.hwmp_targetonly = val->v.integer;
+ break;
+ }
+ if (wlan_do_sysctl(&wlan_config, which, 1) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_COMMIT:
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_ROLLBACK:
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanHWMPRouteInactiveTimeout:
+ wlan_config.hwmp_inact = ctx->scratch->int1;
+ break;
+ case LEAF_wlanHWMPRootAnnounceInterval:
+ wlan_config.hwmp_rannint = ctx->scratch->int1;
+ break;
+ case LEAF_wlanHWMPRootInterval:
+ wlan_config.hwmp_rootint = ctx->scratch->int1;
+ break;
+ case LEAF_wlanHWMPRootTimeout:
+ wlan_config.hwmp_roottimeout = ctx->scratch->int1;
+ break;
+ case LEAF_wlanHWMPPathLifetime:
+ wlan_config.hwmp_pathlifetime = ctx->scratch->int1;
+ break;
+ case LEAF_wlanHWMPReplyForwardBit:
+ wlan_config.hwmp_replyforward = ctx->scratch->int1;
+ break;
+ case LEAF_wlanHWMPTargetOnlyBit:
+ wlan_config.hwmp_targetonly = ctx->scratch->int1;
+ break;
+ }
+ if (wlan_do_sysctl(&wlan_config, which, 1) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ default:
+ abort();
+ }
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanHWMPRouteInactiveTimeout:
+ val->v.integer = wlan_config.hwmp_inact;
+ break;
+ case LEAF_wlanHWMPRootAnnounceInterval:
+ val->v.integer = wlan_config.hwmp_rannint;
+ break;
+ case LEAF_wlanHWMPRootInterval:
+ val->v.integer = wlan_config.hwmp_rootint;
+ break;
+ case LEAF_wlanHWMPRootTimeout:
+ val->v.integer = wlan_config.hwmp_roottimeout;
+ break;
+ case LEAF_wlanHWMPPathLifetime:
+ val->v.integer = wlan_config.hwmp_pathlifetime;
+ break;
+ case LEAF_wlanHWMPReplyForwardBit:
+ val->v.integer = wlan_config.hwmp_replyforward;
+ break;
+ case LEAF_wlanHWMPTargetOnlyBit:
+ val->v.integer = wlan_config.hwmp_targetonly;
+ break;
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_hwmp_iface(struct snmp_context *ctx, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+
+ case SNMP_OP_GETNEXT:
+ if ((wif = wlan_mesh_get_next_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_ifindex(&val->var, sub, wif);
+ break;
+
+ case SNMP_OP_SET:
+ if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanHWMPRootMode:
+ ctx->scratch->int1 = wif->hwmp_root_mode;
+ wif->hwmp_root_mode = val->v.integer;
+ break;
+ case LEAF_wlanHWMPMaxHops:
+ ctx->scratch->int1 = wif->hwmp_max_hops;
+ wif->hwmp_max_hops = val->v.integer;
+ break;
+ default:
+ abort();
+ }
+ if (wlan_hwmp_config_set(wif, val->var.subs[sub - 1]) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_COMMIT:
+ return (SNMP_ERR_NOERROR);
+
+ case SNMP_OP_ROLLBACK:
+ if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanHWMPRootMode:
+ wif->hwmp_root_mode = ctx->scratch->int1;
+ break;
+ case LEAF_wlanHWMPMaxHops:
+ wif->hwmp_max_hops = ctx->scratch->int1;
+ break;
+ default:
+ abort();
+ }
+ if (wlan_hwmp_config_set(wif, val->var.subs[sub - 1]) < 0)
+ return (SNMP_ERR_GENERR);
+ return (SNMP_ERR_NOERROR);
+
+ default:
+ abort();
+ }
+
+ if (wlan_hwmp_config_get(wif, val->var.subs[sub - 1]) < 0)
+ return (SNMP_ERR_GENERR);
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanHWMPRootMode:
+ val->v.integer = wif->hwmp_root_mode;
+ break;
+ case LEAF_wlanHWMPMaxHops:
+ val->v.integer = wif->hwmp_max_hops;
+ break;
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_wlan_hwmp_stats(struct snmp_context *ctx __unused, struct snmp_value *val,
+ uint32_t sub, uint32_t iidx __unused, enum snmp_op op)
+{
+ struct wlan_iface *wif;
+
+ wlan_update_interface_list();
+
+ switch (op) {
+ case SNMP_OP_GET:
+ if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+ case SNMP_OP_GETNEXT:
+ if ((wif = wlan_mesh_get_next_iface(&val->var, sub)) == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ wlan_append_ifindex(&val->var, sub, wif);
+ break;
+ case SNMP_OP_SET:
+ return (SNMP_ERR_NOT_WRITEABLE);
+ case SNMP_OP_COMMIT:
+ /* FALLTHROUGH */
+ case SNMP_OP_ROLLBACK:
+ /* FALLTHROUGH */
+ default:
+ abort();
+ }
+
+ if (wlan_get_stats(wif) < 0)
+ return (SNMP_ERR_GENERR);
+
+ switch (val->var.subs[sub - 1]) {
+ case LEAF_wlanMeshHWMPWrongSeqNo:
+ val->v.uint32 = wif->stats.is_hwmp_wrongseq;
+ break;
+ case LEAF_wlanMeshHWMPTxRootPREQ:
+ val->v.uint32 = wif->stats.is_hwmp_rootreqs;
+ break;
+ case LEAF_wlanMeshHWMPTxRootRANN:
+ val->v.uint32 = wif->stats.is_hwmp_rootrann;
+ break;
+ case LEAF_wlanMeshHWMPProxy:
+ val->v.uint32 = wif->stats.is_hwmp_proxy;
+ break;
+ default:
+ abort();
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+/*
+ * Encode BITS type for a response packet - XXX: this belongs to the snmp lib.
+ */
+static int
+bits_get(struct snmp_value *value, const u_char *ptr, ssize_t len)
+{
+ int size;
+
+ if (ptr == NULL) {
+ value->v.octetstring.len = 0;
+ value->v.octetstring.octets = NULL;
+ return (SNMP_ERR_NOERROR);
+ }
+
+ /* Determine length - up to 8 octets supported so far. */
+ for (size = len; size > 0; size--)
+ if (ptr[size - 1] != 0)
+ break;
+ if (size == 0)
+ size = 1;
+
+ value->v.octetstring.len = (u_long)size;
+ if ((value->v.octetstring.octets = malloc((size_t)size)) == NULL)
+ return (SNMP_ERR_RES_UNAVAIL);
+ memcpy(value->v.octetstring.octets, ptr, (size_t)size);
+ return (SNMP_ERR_NOERROR);
+}
+
+/*
+ * Calls for adding/updating/freeing/etc of wireless interfaces.
+ */
+static void
+wlan_free_interface(struct wlan_iface *wif)
+{
+ wlan_free_peerlist(wif);
+ free(wif->chanlist);
+ wlan_scan_free_results(wif);
+ wlan_mac_free_maclist(wif);
+ wlan_mesh_free_routes(wif);
+ free(wif);
+}
+
+static void
+wlan_free_iflist(void)
+{
+ struct wlan_iface *w;
+
+ while ((w = SLIST_FIRST(&wlan_ifaces)) != NULL) {
+ SLIST_REMOVE_HEAD(&wlan_ifaces, w_if);
+ wlan_free_interface(w);
+ }
+}
+
+static struct wlan_iface *
+wlan_find_interface(const char *wname)
+{
+ struct wlan_iface *wif;
+
+ SLIST_FOREACH(wif, &wlan_ifaces, w_if)
+ if (strcmp(wif->wname, wname) == 0) {
+ if (wif->status != RowStatus_active)
+ return (NULL);
+ break;
+ }
+
+ return (wif);
+}
+
+static struct wlan_iface *
+wlan_first_interface(void)
+{
+ return (SLIST_FIRST(&wlan_ifaces));
+}
+
+static struct wlan_iface *
+wlan_next_interface(struct wlan_iface *wif)
+{
+ if (wif == NULL)
+ return (NULL);
+
+ return (SLIST_NEXT(wif, w_if));
+}
+
+/*
+ * Add a new interface to the list - sorted by name.
+ */
+static int
+wlan_add_wif(struct wlan_iface *wif)
+{
+ int cmp;
+ struct wlan_iface *temp, *prev;
+
+ if ((prev = SLIST_FIRST(&wlan_ifaces)) == NULL ||
+ strcmp(wif->wname, prev->wname) < 0) {
+ SLIST_INSERT_HEAD(&wlan_ifaces, wif, w_if);
+ return (0);
+ }
+
+ SLIST_FOREACH(temp, &wlan_ifaces, w_if) {
+ if ((cmp = strcmp(wif->wname, temp->wname)) <= 0)
+ break;
+ prev = temp;
+ }
+
+ if (temp == NULL)
+ SLIST_INSERT_AFTER(prev, wif, w_if);
+ else if (cmp > 0)
+ SLIST_INSERT_AFTER(temp, wif, w_if);
+ else {
+ syslog(LOG_ERR, "Wlan iface %s already in list", wif->wname);
+ return (-1);
+ }
+
+ return (0);
+}
+
+static struct wlan_iface *
+wlan_new_wif(char *wname)
+{
+ struct wlan_iface *wif;
+
+ /* Make sure it's not in the list. */
+ for (wif = wlan_first_interface(); wif != NULL;
+ wif = wlan_next_interface(wif))
+ if (strcmp(wname, wif->wname) == 0) {
+ wif->internal = 0;
+ return (wif);
+ }
+
+ if ((wif = (struct wlan_iface *)malloc(sizeof(*wif))) == NULL)
+ return (NULL);
+
+ memset(wif, 0, sizeof(struct wlan_iface));
+ strlcpy(wif->wname, wname, IFNAMSIZ);
+ wif->status = RowStatus_notReady;
+ wif->state = wlanIfaceState_down;
+ wif->mode = WlanIfaceOperatingModeType_station;
+
+ if (wlan_add_wif(wif) < 0) {
+ free(wif);
+ return (NULL);
+ }
+
+ return (wif);
+}
+
+static void
+wlan_delete_wif(struct wlan_iface *wif)
+{
+ SLIST_REMOVE(&wlan_ifaces, wif, wlan_iface, w_if);
+ wlan_free_interface(wif);
+}
+
+static int
+wlan_attach_newif(struct mibif *mif)
+{
+ struct wlan_iface *wif;
+
+ if (mif->mib.ifmd_data.ifi_type != IFT_ETHER ||
+ wlan_check_media(mif->name) != IFM_IEEE80211)
+ return (0);
+
+ if ((wif = wlan_new_wif(mif->name)) == NULL)
+ return (-1);
+
+ (void)wlan_get_opmode(wif);
+ wif->index = mif->index;
+ wif->status = RowStatus_active;
+ (void)wlan_update_interface(wif);
+
+ return (0);
+}
+
+static int
+wlan_iface_create(struct wlan_iface *wif)
+{
+ int rc;
+
+ if ((rc = wlan_clone_create(wif)) == SNMP_ERR_NOERROR) {
+ /*
+ * The rest of the info will be updated once the
+ * snmp_mibII module notifies us of the interface.
+ */
+ wif->status = RowStatus_active;
+ if (wif->state == wlanIfaceState_up)
+ (void)wlan_config_state(wif, 1);
+ }
+
+ return (rc);
+}
+
+static int
+wlan_iface_destroy(struct wlan_iface *wif)
+{
+ int rc = SNMP_ERR_NOERROR;
+
+ if (wif->internal == 0)
+ rc = wlan_clone_destroy(wif);
+
+ if (rc == SNMP_ERR_NOERROR)
+ wlan_delete_wif(wif);
+
+ return (rc);
+}
+
+static int
+wlan_update_interface(struct wlan_iface *wif)
+{
+ int i;
+
+ (void)wlan_config_state(wif, 0);
+ (void)wlan_get_driver_caps(wif);
+ for (i = LEAF_wlanIfacePacketBurst;
+ i <= LEAF_wlanIfaceTdmaBeaconInterval; i++)
+ (void)wlan_config_get_ioctl(wif, i);
+ (void)wlan_get_stats(wif);
+ /*
+ * XXX: wlan_get_channel_list() not needed -
+ * fetched with wlan_get_driver_caps()
+ */
+ (void)wlan_get_channel_list(wif);
+ (void)wlan_get_roam_params(wif);
+ (void)wlan_get_tx_params(wif);
+ (void)wlan_get_scan_results(wif);
+ (void)wlan_get_wepmode(wif);
+ (void)wlan_get_weptxkey(wif);
+ (void)wlan_get_mac_policy(wif);
+ (void)wlan_get_mac_acl_macs(wif);
+ (void)wlan_get_peerinfo(wif);
+
+ if (wif->mode == WlanIfaceOperatingModeType_meshPoint) {
+ for (i = LEAF_wlanMeshTTL; i <= LEAF_wlanMeshPath; i++)
+ (void)wlan_mesh_config_get(wif, i);
+ (void)wlan_mesh_get_routelist(wif);
+ for (i = LEAF_wlanHWMPRootMode; i <= LEAF_wlanHWMPMaxHops; i++)
+ (void)wlan_hwmp_config_get(wif, i);
+ }
+
+ return (0);
+}
+
+static void
+wlan_update_interface_list(void)
+{
+ struct wlan_iface *wif, *twif;
+
+ if ((time(NULL) - wlan_iflist_age) <= WLAN_LIST_MAXAGE)
+ return;
+
+ /*
+ * The snmp_mibII module would have notified us for new interfaces,
+ * so only check if any have been deleted.
+ */
+ SLIST_FOREACH_SAFE(wif, &wlan_ifaces, w_if, twif)
+ if (wif->status == RowStatus_active && wlan_get_opmode(wif) < 0)
+ wlan_delete_wif(wif);
+
+ wlan_iflist_age = time(NULL);
+}
+
+static void
+wlan_append_ifindex(struct asn_oid *oid, uint sub, const struct wlan_iface *w)
+{
+ uint32_t i;
+
+ oid->len = sub + strlen(w->wname) + 1;
+ oid->subs[sub] = strlen(w->wname);
+ for (i = 1; i <= strlen(w->wname); i++)
+ oid->subs[sub + i] = w->wname[i - 1];
+}
+
+static uint8_t *
+wlan_get_ifname(const struct asn_oid *oid, uint sub, uint8_t *wname)
+{
+ uint32_t i;
+
+ memset(wname, 0, IFNAMSIZ);
+
+ if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >= IFNAMSIZ)
+ return (NULL);
+
+ for (i = 0; i < oid->subs[sub]; i++)
+ wname[i] = oid->subs[sub + i + 1];
+ wname[i] = '\0';
+
+ return (wname);
+}
+
+static struct wlan_iface *
+wlan_get_interface(const struct asn_oid *oid, uint sub)
+{
+ uint8_t wname[IFNAMSIZ];
+
+ if (wlan_get_ifname(oid, sub, wname) == NULL)
+ return (NULL);
+
+ return (wlan_find_interface(wname));
+}
+
+static struct wlan_iface *
+wlan_get_next_interface(const struct asn_oid *oid, uint sub)
+{
+ uint32_t i;
+ uint8_t wname[IFNAMSIZ];
+ struct wlan_iface *wif;
+
+ if (oid->len - sub == 0) {
+ for (wif = wlan_first_interface(); wif != NULL;
+ wif = wlan_next_interface(wif))
+ if (wif->status == RowStatus_active)
+ break;
+ return (wif);
+ }
+
+ if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >= IFNAMSIZ)
+ return (NULL);
+
+ memset(wname, 0, IFNAMSIZ);
+ for (i = 0; i < oid->subs[sub]; i++)
+ wname[i] = oid->subs[sub + i + 1];
+ wname[i] = '\0';
+ if ((wif = wlan_find_interface(wname)) == NULL)
+ return (NULL);
+
+ while ((wif = wlan_next_interface(wif)) != NULL)
+ if (wif->status == RowStatus_active)
+ break;
+
+ return (wif);
+}
+
+static struct wlan_iface *
+wlan_get_snmp_interface(const struct asn_oid *oid, uint sub)
+{
+ uint8_t wname[IFNAMSIZ];
+ struct wlan_iface *wif;
+
+ if (wlan_get_ifname(oid, sub, wname) == NULL)
+ return (NULL);
+
+ for (wif = wlan_first_interface(); wif != NULL;
+ wif = wlan_next_interface(wif))
+ if (strcmp(wif->wname, wname) == 0)
+ break;
+
+ return (wif);
+}
+
+static struct wlan_iface *
+wlan_get_next_snmp_interface(const struct asn_oid *oid, uint sub)
+{
+ uint32_t i;
+ uint8_t wname[IFNAMSIZ];
+ struct wlan_iface *wif;
+
+ if (oid->len - sub == 0)
+ return (wlan_first_interface());
+
+ if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >= IFNAMSIZ)
+ return (NULL);
+
+ memset(wname, 0, IFNAMSIZ);
+ for (i = 0; i < oid->subs[sub]; i++)
+ wname[i] = oid->subs[sub + i + 1];
+ wname[i] = '\0';
+
+ for (wif = wlan_first_interface(); wif != NULL;
+ wif = wlan_next_interface(wif))
+ if (strcmp(wif->wname, wname) == 0)
+ break;
+
+ return (wlan_next_interface(wif));
+}
+
+/*
+ * Decode/Append an index for tables indexed by the wireless interface
+ * name and a MAC address - ACL MACs and Mesh Routes.
+ */
+static int
+wlan_mac_index_decode(const struct asn_oid *oid, uint sub,
+ char *wname, uint8_t *mac)
+{
+ uint32_t i;
+ int mac_off;
+
+ if (oid->len - sub != oid->subs[sub] + 2 + IEEE80211_ADDR_LEN
+ || oid->subs[sub] >= IFNAMSIZ)
+ return (-1);
+
+ for (i = 0; i < oid->subs[sub]; i++)
+ wname[i] = oid->subs[sub + i + 1];
+ wname[i] = '\0';
+
+ mac_off = sub + oid->subs[sub] + 1;
+ if (oid->subs[mac_off] != IEEE80211_ADDR_LEN)
+ return (-1);
+ for (i = 0; i < IEEE80211_ADDR_LEN; i++)
+ mac[i] = oid->subs[mac_off + i + 1];
+
+ return (0);
+}
+
+static void
+wlan_append_mac_index(struct asn_oid *oid, uint sub, char *wname, uint8_t *mac)
+{
+ uint32_t i;
+
+ oid->len = sub + strlen(wname) + IEEE80211_ADDR_LEN + 2;
+ oid->subs[sub] = strlen(wname);
+ for (i = 1; i <= strlen(wname); i++)
+ oid->subs[sub + i] = wname[i - 1];
+
+ sub += strlen(wname) + 1;
+ oid->subs[sub] = IEEE80211_ADDR_LEN;
+ for (i = 1; i <= IEEE80211_ADDR_LEN; i++)
+ oid->subs[sub + i] = mac[i - 1];
+}
+
+/*
+ * Decode/Append an index for tables indexed by the wireless interface
+ * name and the PHY mode - Roam and TX params.
+ */
+static int
+wlan_phy_index_decode(const struct asn_oid *oid, uint sub, char *wname,
+ uint32_t *phy)
+{
+ uint32_t i;
+
+ if (oid->len - sub != oid->subs[sub] + 2 || oid->subs[sub] >= IFNAMSIZ)
+ return (-1);
+
+ for (i = 0; i < oid->subs[sub]; i++)
+ wname[i] = oid->subs[sub + i + 1];
+ wname[i] = '\0';
+
+ *phy = oid->subs[sub + oid->subs[sub] + 1];
+ return (0);
+}
+
+static void
+wlan_append_phy_index(struct asn_oid *oid, uint sub, char *wname, uint32_t phy)
+{
+ uint32_t i;
+
+ oid->len = sub + strlen(wname) + 2;
+ oid->subs[sub] = strlen(wname);
+ for (i = 1; i <= strlen(wname); i++)
+ oid->subs[sub + i] = wname[i - 1];
+ oid->subs[sub + strlen(wname) + 1] = phy;
+}
+
+/*
+ * Calls for manipulating the peerlist of a wireless interface.
+ */
+static void
+wlan_free_peerlist(struct wlan_iface *wif)
+{
+ struct wlan_peer *wip;
+
+ while ((wip = SLIST_FIRST(&wif->peerlist)) != NULL) {
+ SLIST_REMOVE_HEAD(&wif->peerlist, wp);
+ free(wip);
+ }
+
+ SLIST_INIT(&wif->peerlist);
+}
+
+static struct wlan_peer *
+wlan_find_peer(struct wlan_iface *wif, uint8_t *peermac)
+{
+ struct wlan_peer *wip;
+
+ SLIST_FOREACH(wip, &wif->peerlist, wp)
+ if (memcmp(wip->pmac, peermac, IEEE80211_ADDR_LEN) == 0)
+ break;
+
+ return (wip);
+}
+
+struct wlan_peer *
+wlan_new_peer(const uint8_t *pmac)
+{
+ struct wlan_peer *wip;
+
+ if ((wip = (struct wlan_peer *)malloc(sizeof(*wip))) == NULL)
+ return (NULL);
+
+ memset(wip, 0, sizeof(struct wlan_peer));
+ memcpy(wip->pmac, pmac, IEEE80211_ADDR_LEN);
+
+ return (wip);
+}
+
+void
+wlan_free_peer(struct wlan_peer *wip)
+{
+ free(wip);
+}
+
+int
+wlan_add_peer(struct wlan_iface *wif, struct wlan_peer *wip)
+{
+ struct wlan_peer *temp, *prev;
+
+ SLIST_FOREACH(temp, &wif->peerlist, wp)
+ if (memcmp(temp->pmac, wip->pmac, IEEE80211_ADDR_LEN) == 0)
+ return (-1);
+
+ if ((prev = SLIST_FIRST(&wif->peerlist)) == NULL ||
+ memcmp(wip->pmac, prev->pmac, IEEE80211_ADDR_LEN) < 0) {
+ SLIST_INSERT_HEAD(&wif->peerlist, wip, wp);
+ return (0);
+ }
+
+ SLIST_FOREACH(temp, &wif->peerlist, wp) {
+ if (memcmp(wip->pmac, temp->pmac, IEEE80211_ADDR_LEN) < 0)
+ break;
+ prev = temp;
+ }
+
+ SLIST_INSERT_AFTER(prev, wip, wp);
+ return (0);
+}
+
+static void
+wlan_update_peers(void)
+{
+ struct wlan_iface *wif;
+
+ if ((time(NULL) - wlan_peerlist_age) <= WLAN_LIST_MAXAGE)
+ return;
+
+ for (wif = wlan_first_interface(); wif != NULL;
+ wif = wlan_next_interface(wif)) {
+ if (wif->status != RowStatus_active)
+ continue;
+ wlan_free_peerlist(wif);
+ (void)wlan_get_peerinfo(wif);
+ }
+ wlan_peerlist_age = time(NULL);
+}
+
+static struct wlan_peer *
+wlan_get_peer(const struct asn_oid *oid, uint sub, struct wlan_iface **wif)
+{
+ char wname[IFNAMSIZ];
+ uint8_t pmac[IEEE80211_ADDR_LEN];
+
+ if (wlan_mac_index_decode(oid, sub, wname, pmac) < 0)
+ return (NULL);
+
+ if ((*wif = wlan_find_interface(wname)) == NULL)
+ return (NULL);
+
+ return (wlan_find_peer(*wif, pmac));
+}
+
+static struct wlan_peer *
+wlan_get_next_peer(const struct asn_oid *oid, uint sub, struct wlan_iface **wif)
+{
+ char wname[IFNAMSIZ];
+ char pmac[IEEE80211_ADDR_LEN];
+ struct wlan_peer *wip;
+
+ if (oid->len - sub == 0) {
+ for (*wif = wlan_first_interface(); *wif != NULL;
+ *wif = wlan_next_interface(*wif)) {
+ if ((*wif)->mode ==
+ WlanIfaceOperatingModeType_meshPoint)
+ continue;
+ wip = SLIST_FIRST(&(*wif)->peerlist);
+ if (wip != NULL)
+ return (wip);
+ }
+ return (NULL);
+ }
+
+ if (wlan_mac_index_decode(oid, sub, wname, pmac) < 0 ||
+ (*wif = wlan_find_interface(wname)) == NULL ||
+ (wip = wlan_find_peer(*wif, pmac)) == NULL)
+ return (NULL);
+
+ if ((wip = SLIST_NEXT(wip, wp)) != NULL)
+ return (wip);
+
+ while ((*wif = wlan_next_interface(*wif)) != NULL) {
+ if ((*wif)->mode == WlanIfaceOperatingModeType_meshPoint)
+ continue;
+ if ((wip = SLIST_FIRST(&(*wif)->peerlist)) != NULL)
+ break;
+ }
+
+ return (wip);
+}
+
+/*
+ * Calls for manipulating the active channel list of a wireless interface.
+ */
+static void
+wlan_update_channels(void)
+{
+ struct wlan_iface *wif;
+
+ if ((time(NULL) - wlan_chanlist_age) <= WLAN_LIST_MAXAGE)
+ return;
+
+ for (wif = wlan_first_interface(); wif != NULL;
+ wif = wlan_next_interface(wif)) {
+ if (wif->status != RowStatus_active)
+ continue;
+ (void)wlan_get_channel_list(wif);
+ }
+ wlan_chanlist_age = time(NULL);
+}
+
+static int
+wlan_channel_index_decode(const struct asn_oid *oid, uint sub, char *wname,
+ uint32_t *cindex)
+{
+ uint32_t i;
+ if (oid->len - sub != oid->subs[sub] + 2 || oid->subs[sub] >= IFNAMSIZ)
+ return (-1);
+
+ for (i = 0; i < oid->subs[sub]; i++)
+ wname[i] = oid->subs[sub + i + 1];
+ wname[i] = '\0';
+
+ *cindex = oid->subs[sub + oid->subs[sub] + 1];
+
+ return (0);
+}
+
+static void
+wlan_append_channel_index(struct asn_oid *oid, uint sub,
+ const struct wlan_iface *wif, const struct ieee80211_channel *channel)
+{
+ uint32_t i;
+
+ oid->len = sub + strlen(wif->wname) + 2;
+ oid->subs[sub] = strlen(wif->wname);
+ for (i = 1; i <= strlen(wif->wname); i++)
+ oid->subs[sub + i] = wif->wname[i - 1];
+ oid->subs[sub + strlen(wif->wname) + 1] = (channel - wif->chanlist) + 1;
+}
+
+static int32_t
+wlan_get_channel_type(struct ieee80211_channel *c)
+{
+ if (IEEE80211_IS_CHAN_FHSS(c))
+ return (WlanChannelType_fhss);
+ if (IEEE80211_IS_CHAN_A(c))
+ return (WlanChannelType_dot11a);
+ if (IEEE80211_IS_CHAN_B(c))
+ return (WlanChannelType_dot11b);
+ if (IEEE80211_IS_CHAN_ANYG(c))
+ return (WlanChannelType_dot11g);
+ if (IEEE80211_IS_CHAN_HALF(c))
+ return (WlanChannelType_tenMHz);
+ if (IEEE80211_IS_CHAN_QUARTER(c))
+ return (WlanChannelType_fiveMHz);
+ if (IEEE80211_IS_CHAN_TURBO(c))
+ return (WlanChannelType_turbo);
+ if (IEEE80211_IS_CHAN_HT(c))
+ return (WlanChannelType_ht);
+
+ return (-1);
+}
+
+static struct ieee80211_channel *
+wlan_find_channel(struct wlan_iface *wif, uint32_t cindex)
+{
+ if (wif->chanlist == NULL || cindex > wif->nchannels)
+ return (NULL);
+
+ return (wif->chanlist + cindex - 1);
+}
+
+static struct ieee80211_channel *
+wlan_get_channel(const struct asn_oid *oid, uint sub, struct wlan_iface **wif)
+{
+ uint32_t cindex;
+ char wname[IFNAMSIZ];
+
+ if (wlan_channel_index_decode(oid, sub, wname, &cindex) < 0)
+ return (NULL);
+
+ if ((*wif = wlan_find_interface(wname)) == NULL)
+ return (NULL);
+
+ return (wlan_find_channel(*wif, cindex));
+}
+
+static struct ieee80211_channel *
+wlan_get_next_channel(const struct asn_oid *oid, uint sub,
+ struct wlan_iface **wif)
+{
+ uint32_t cindex;
+ char wname[IFNAMSIZ];
+
+ if (oid->len - sub == 0) {
+ for (*wif = wlan_first_interface(); *wif != NULL;
+ *wif = wlan_next_interface(*wif)) {
+ if ((*wif)->status != RowStatus_active)
+ continue;
+ if ((*wif)->nchannels != 0 && (*wif)->chanlist != NULL)
+ return ((*wif)->chanlist);
+ }
+ return (NULL);
+ }
+
+ if (wlan_channel_index_decode(oid, sub, wname, &cindex) < 0)
+ return (NULL);
+
+ if ((*wif = wlan_find_interface(wname)) == NULL)
+ return (NULL);
+
+ if (cindex < (*wif)->nchannels)
+ return ((*wif)->chanlist + cindex);
+
+ while ((*wif = wlan_next_interface(*wif)) != NULL)
+ if ((*wif)->status == RowStatus_active)
+ if ((*wif)->nchannels != 0 && (*wif)->chanlist != NULL)
+ return ((*wif)->chanlist);
+
+ return (NULL);
+}
+
+/*
+ * Calls for manipulating the roam params of a wireless interface.
+ */
+static void
+wlan_update_roam_params(void)
+{
+ struct wlan_iface *wif;
+
+ if ((time(NULL) - wlan_roamlist_age) <= WLAN_LIST_MAXAGE)
+ return;
+
+ for (wif = wlan_first_interface(); wif != NULL;
+ wif = wlan_next_interface(wif)) {
+ if (wif->status != RowStatus_active)
+ continue;
+ (void)wlan_get_roam_params(wif);
+ }
+ wlan_roamlist_age = time(NULL);
+}
+
+static struct ieee80211_roamparam *
+wlan_get_roam_param(const struct asn_oid *oid, uint sub, struct wlan_iface **wif)
+{
+ uint32_t phy;
+ char wname[IFNAMSIZ];
+
+ if (wlan_phy_index_decode(oid, sub, wname, &phy) < 0)
+ return (NULL);
+
+ if ((*wif = wlan_find_interface(wname)) == NULL)
+ return (NULL);
+
+ if (phy == 0 || phy > IEEE80211_MODE_MAX)
+ return (NULL);
+
+ return ((*wif)->roamparams.params + phy - 1);
+}
+
+static struct ieee80211_roamparam *
+wlan_get_next_roam_param(const struct asn_oid *oid, uint sub,
+ struct wlan_iface **wif, uint32_t *phy)
+{
+ char wname[IFNAMSIZ];
+
+ if (oid->len - sub == 0) {
+ for (*wif = wlan_first_interface(); *wif != NULL;
+ *wif = wlan_next_interface(*wif)) {
+ if ((*wif)->status != RowStatus_active)
+ continue;
+ *phy = 1;
+ return ((*wif)->roamparams.params);
+ }
+ return (NULL);
+ }
+
+ if (wlan_phy_index_decode(oid, sub, wname, phy) < 0)
+ return (NULL);
+
+ if (*phy == 0 || (*wif = wlan_find_interface(wname)) == NULL)
+ return (NULL);
+
+ if (++(*phy) <= IEEE80211_MODE_MAX)
+ return ((*wif)->roamparams.params + *phy - 1);
+
+ *phy = 1;
+ while ((*wif = wlan_next_interface(*wif)) != NULL)
+ if ((*wif)->status == RowStatus_active)
+ return ((*wif)->roamparams.params);
+
+ return (NULL);
+}
+
+/*
+ * Calls for manipulating the tx params of a wireless interface.
+ */
+static void
+wlan_update_tx_params(void)
+{
+ struct wlan_iface *wif;
+
+ if ((time(NULL) - wlan_tx_paramlist_age) <= WLAN_LIST_MAXAGE)
+ return;
+
+ for (wif = wlan_first_interface(); wif != NULL;
+ wif = wlan_next_interface(wif)) {
+ if (wif->status != RowStatus_active)
+ continue;
+ (void)wlan_get_tx_params(wif);
+ }
+
+ wlan_tx_paramlist_age = time(NULL);
+}
+
+static struct ieee80211_txparam *
+wlan_get_tx_param(const struct asn_oid *oid, uint sub, struct wlan_iface **wif,
+ uint32_t *phy)
+{
+ char wname[IFNAMSIZ];
+
+ if (wlan_phy_index_decode(oid, sub, wname, phy) < 0)
+ return (NULL);
+
+ if ((*wif = wlan_find_interface(wname)) == NULL)
+ return (NULL);
+
+ if (*phy == 0 || *phy > IEEE80211_MODE_MAX)
+ return (NULL);
+
+ return ((*wif)->txparams.params + *phy - 1);
+}
+
+static struct ieee80211_txparam *
+wlan_get_next_tx_param(const struct asn_oid *oid, uint sub,
+ struct wlan_iface **wif, uint32_t *phy)
+{
+ char wname[IFNAMSIZ];
+
+ if (oid->len - sub == 0) {
+ for (*wif = wlan_first_interface(); *wif != NULL;
+ *wif = wlan_next_interface(*wif)) {
+ if ((*wif)->status != RowStatus_active)
+ continue;
+ *phy = 1;
+ return ((*wif)->txparams.params);
+ }
+ return (NULL);
+ }
+
+ if (wlan_phy_index_decode(oid, sub, wname, phy) < 0)
+ return (NULL);
+
+ if (*phy == 0 || (*wif = wlan_find_interface(wname)) == NULL)
+ return (NULL);
+
+ if (++(*phy) <= IEEE80211_MODE_MAX)
+ return ((*wif)->txparams.params + *phy - 1);
+
+ *phy = 1;
+ while ((*wif = wlan_next_interface(*wif)) != NULL)
+ if ((*wif)->status == RowStatus_active)
+ return ((*wif)->txparams.params);
+
+ return (NULL);
+}
+
+/*
+ * Calls for manipulating the scan results for a wireless interface.
+ */
+static void
+wlan_scan_free_results(struct wlan_iface *wif)
+{
+ struct wlan_scan_result *sr;
+
+ while ((sr = SLIST_FIRST(&wif->scanlist)) != NULL) {
+ SLIST_REMOVE_HEAD(&wif->scanlist, wsr);
+ free(sr);
+ }
+
+ SLIST_INIT(&wif->scanlist);
+}
+
+static struct wlan_scan_result *
+wlan_scan_find_result(struct wlan_iface *wif, uint8_t *ssid, uint8_t *bssid)
+{
+ struct wlan_scan_result *sr;
+
+ SLIST_FOREACH(sr, &wif->scanlist, wsr)
+ if (strlen(ssid) == strlen(sr->ssid) &&
+ strcmp(sr->ssid, ssid) == 0 &&
+ memcmp(sr->bssid, bssid, IEEE80211_ADDR_LEN) == 0)
+ break;
+
+ return (sr);
+}
+
+struct wlan_scan_result *
+wlan_scan_new_result(const uint8_t *ssid, const uint8_t *bssid)
+{
+ struct wlan_scan_result *sr;
+
+ sr = (struct wlan_scan_result *)malloc(sizeof(*sr));
+ if (sr == NULL)
+ return (NULL);
+
+ memset(sr, 0, sizeof(*sr));
+ if (ssid[0] != '\0')
+ strlcpy(sr->ssid, ssid, IEEE80211_NWID_LEN + 1);
+ memcpy(sr->bssid, bssid, IEEE80211_ADDR_LEN);
+
+ return (sr);
+}
+
+void
+wlan_scan_free_result(struct wlan_scan_result *sr)
+{
+ free(sr);
+}
+
+static int
+wlan_scan_compare_result(struct wlan_scan_result *sr1,
+ struct wlan_scan_result *sr2)
+{
+ uint32_t i;
+
+ if (strlen(sr1->ssid) < strlen(sr2->ssid))
+ return (-1);
+ if (strlen(sr1->ssid) > strlen(sr2->ssid))
+ return (1);
+
+ for (i = 0; i < strlen(sr1->ssid) && i < strlen(sr2->ssid); i++) {
+ if (sr1->ssid[i] < sr2->ssid[i])
+ return (-1);
+ if (sr1->ssid[i] > sr2->ssid[i])
+ return (1);
+ }
+
+ for (i = 0; i < IEEE80211_ADDR_LEN; i++) {
+ if (sr1->bssid[i] < sr2->bssid[i])
+ return (-1);
+ if (sr1->bssid[i] > sr2->bssid[i])
+ return (1);
+ }
+
+ return (0);
+}
+
+int
+wlan_scan_add_result(struct wlan_iface *wif, struct wlan_scan_result *sr)
+{
+ struct wlan_scan_result *prev, *temp;
+
+ SLIST_FOREACH(temp, &wif->scanlist, wsr)
+ if (strlen(temp->ssid) == strlen(sr->ssid) &&
+ strcmp(sr->ssid, temp->ssid) == 0 &&
+ memcmp(sr->bssid, temp->bssid, IEEE80211_ADDR_LEN) == 0)
+ return (-1);
+
+ if ((prev = SLIST_FIRST(&wif->scanlist)) == NULL ||
+ wlan_scan_compare_result(sr, prev) < 0) {
+ SLIST_INSERT_HEAD(&wif->scanlist, sr, wsr);
+ return (0);
+ }
+
+ SLIST_FOREACH(temp, &wif->scanlist, wsr) {
+ if (wlan_scan_compare_result(sr, temp) < 0)
+ break;
+ prev = temp;
+ }
+
+ SLIST_INSERT_AFTER(prev, sr, wsr);
+ return (0);
+}
+
+static void
+wlan_scan_update_results(void)
+{
+ struct wlan_iface *wif;
+
+ if ((time(NULL) - wlan_scanlist_age) <= WLAN_LIST_MAXAGE)
+ return;
+
+ for (wif = wlan_first_interface(); wif != NULL;
+ wif = wlan_next_interface(wif)) {
+ if (wif->status != RowStatus_active)
+ continue;
+ wlan_scan_free_results(wif);
+ (void)wlan_get_scan_results(wif);
+ }
+ wlan_scanlist_age = time(NULL);
+}
+
+static int
+wlan_scanr_index_decode(const struct asn_oid *oid, uint sub,
+ char *wname, uint8_t *ssid, uint8_t *bssid)
+{
+ uint32_t i;
+ int offset;
+
+ if (oid->subs[sub] >= IFNAMSIZ)
+ return (-1);
+ for (i = 0; i < oid->subs[sub]; i++)
+ wname[i] = oid->subs[sub + i + 1];
+ wname[oid->subs[sub]] = '\0';
+
+ offset = sub + oid->subs[sub] + 1;
+ if (oid->subs[offset] > IEEE80211_NWID_LEN)
+ return (-1);
+ for (i = 0; i < oid->subs[offset]; i++)
+ ssid[i] = oid->subs[offset + i + 1];
+ ssid[i] = '\0';
+
+ offset = sub + oid->subs[sub] + oid->subs[offset] + 2;
+ if (oid->subs[offset] != IEEE80211_ADDR_LEN)
+ return (-1);
+ for (i = 0; i < IEEE80211_ADDR_LEN; i++)
+ bssid[i] = oid->subs[offset + i + 1];
+
+ return (0);
+}
+
+static void
+wlan_append_scanr_index(struct asn_oid *oid, uint sub, char *wname,
+ uint8_t *ssid, uint8_t *bssid)
+{
+ uint32_t i;
+
+ oid->len = sub + strlen(wname) + strlen(ssid) + IEEE80211_ADDR_LEN + 3;
+ oid->subs[sub] = strlen(wname);
+ for (i = 1; i <= strlen(wname); i++)
+ oid->subs[sub + i] = wname[i - 1];
+
+ sub += strlen(wname) + 1;
+ oid->subs[sub] = strlen(ssid);
+ for (i = 1; i <= strlen(ssid); i++)
+ oid->subs[sub + i] = ssid[i - 1];
+
+ sub += strlen(ssid) + 1;
+ oid->subs[sub] = IEEE80211_ADDR_LEN;
+ for (i = 1; i <= IEEE80211_ADDR_LEN; i++)
+ oid->subs[sub + i] = bssid[i - 1];
+}
+
+static struct wlan_scan_result *
+wlan_get_scanr(const struct asn_oid *oid, uint sub, struct wlan_iface **wif)
+{
+ char wname[IFNAMSIZ];
+ uint8_t ssid[IEEE80211_NWID_LEN + 1];
+ uint8_t bssid[IEEE80211_ADDR_LEN];
+
+ if (wlan_scanr_index_decode(oid, sub, wname, ssid, bssid) < 0)
+ return (NULL);
+
+ if ((*wif = wlan_find_interface(wname)) == NULL)
+ return (NULL);
+
+ return (wlan_scan_find_result(*wif, ssid, bssid));
+}
+
+static struct wlan_scan_result *
+wlan_get_next_scanr(const struct asn_oid *oid, uint sub,
+ struct wlan_iface **wif)
+{
+ char wname[IFNAMSIZ];
+ uint8_t ssid[IEEE80211_NWID_LEN + 1];
+ uint8_t bssid[IEEE80211_ADDR_LEN];
+ struct wlan_scan_result *sr;
+
+ if (oid->len - sub == 0) {
+ for (*wif = wlan_first_interface(); *wif != NULL;
+ *wif = wlan_next_interface(*wif)) {
+ sr = SLIST_FIRST(&(*wif)->scanlist);
+ if (sr != NULL)
+ return (sr);
+ }
+ return (NULL);
+ }
+
+ if (wlan_scanr_index_decode(oid, sub, wname, ssid, bssid) < 0 ||
+ (*wif = wlan_find_interface(wname)) == NULL ||
+ (sr = wlan_scan_find_result(*wif, ssid, bssid)) == NULL)
+ return (NULL);
+
+ if ((sr = SLIST_NEXT(sr, wsr)) != NULL)
+ return (sr);
+
+ while ((*wif = wlan_next_interface(*wif)) != NULL)
+ if ((sr = SLIST_FIRST(&(*wif)->scanlist)) != NULL)
+ break;
+
+ return (sr);
+}
+
+/*
+ * MAC Access Control.
+ */
+static void
+wlan_mac_free_maclist(struct wlan_iface *wif)
+{
+ struct wlan_mac_mac *wmm;
+
+ while ((wmm = SLIST_FIRST(&wif->mac_maclist)) != NULL) {
+ SLIST_REMOVE_HEAD(&wif->mac_maclist, wm);
+ free(wmm);
+ }
+
+ SLIST_INIT(&wif->mac_maclist);
+}
+
+static struct wlan_mac_mac *
+wlan_mac_find_mac(struct wlan_iface *wif, uint8_t *mac)
+{
+ struct wlan_mac_mac *wmm;
+
+ SLIST_FOREACH(wmm, &wif->mac_maclist, wm)
+ if (memcmp(wmm->mac, mac, IEEE80211_ADDR_LEN) == 0)
+ break;
+
+ return (wmm);
+}
+
+struct wlan_mac_mac *
+wlan_mac_new_mac(const uint8_t *mac)
+{
+ struct wlan_mac_mac *wmm;
+
+ if ((wmm = (struct wlan_mac_mac *)malloc(sizeof(*wmm))) == NULL)
+ return (NULL);
+
+ memset(wmm, 0, sizeof(*wmm));
+ memcpy(wmm->mac, mac, IEEE80211_ADDR_LEN);
+ wmm->mac_status = RowStatus_notReady;
+
+ return (wmm);
+}
+
+void
+wlan_mac_free_mac(struct wlan_mac_mac *wmm)
+{
+ free(wmm);
+}
+
+int
+wlan_mac_add_mac(struct wlan_iface *wif, struct wlan_mac_mac *wmm)
+{
+ struct wlan_mac_mac *temp, *prev;
+
+ SLIST_FOREACH(temp, &wif->mac_maclist, wm)
+ if (memcmp(temp->mac, wmm->mac, IEEE80211_ADDR_LEN) == 0)
+ return (-1);
+
+ if ((prev = SLIST_FIRST(&wif->mac_maclist)) == NULL ||
+ memcmp(wmm->mac, prev->mac,IEEE80211_ADDR_LEN) < 0) {
+ SLIST_INSERT_HEAD(&wif->mac_maclist, wmm, wm);
+ return (0);
+ }
+
+ SLIST_FOREACH(temp, &wif->mac_maclist, wm) {
+ if (memcmp(wmm->mac, temp->mac, IEEE80211_ADDR_LEN) < 0)
+ break;
+ prev = temp;
+ }
+
+ SLIST_INSERT_AFTER(prev, wmm, wm);
+ return (0);
+}
+
+static int
+wlan_mac_delete_mac(struct wlan_iface *wif, struct wlan_mac_mac *wmm)
+{
+ if (wmm->mac_status == RowStatus_active &&
+ wlan_del_mac_acl_mac(wif, wmm) < 0)
+ return (-1);
+
+ SLIST_REMOVE(&wif->mac_maclist, wmm, wlan_mac_mac, wm);
+ free(wmm);
+
+ return (0);
+}
+
+static void
+wlan_mac_update_aclmacs(void)
+{
+ struct wlan_iface *wif;
+ struct wlan_mac_mac *wmm, *twmm;
+
+ if ((time(NULL) - wlan_maclist_age) <= WLAN_LIST_MAXAGE)
+ return;
+
+ for (wif = wlan_first_interface(); wif != NULL;
+ wif = wlan_next_interface(wif)) {
+ if (wif->status != RowStatus_active)
+ continue;
+ /*
+ * Nuke old entries - XXX - they are likely not to
+ * change often - reconsider.
+ */
+ SLIST_FOREACH_SAFE(wmm, &wif->mac_maclist, wm, twmm)
+ if (wmm->mac_status == RowStatus_active) {
+ SLIST_REMOVE(&wif->mac_maclist, wmm,
+ wlan_mac_mac, wm);
+ wlan_mac_free_mac(wmm);
+ }
+ (void)wlan_get_mac_acl_macs(wif);
+ }
+ wlan_maclist_age = time(NULL);
+}
+
+static struct wlan_mac_mac *
+wlan_get_acl_mac(const struct asn_oid *oid, uint sub, struct wlan_iface **wif)
+{
+ char wname[IFNAMSIZ];
+ char mac[IEEE80211_ADDR_LEN];
+
+ if (wlan_mac_index_decode(oid, sub, wname, mac) < 0)
+ return (NULL);
+
+ if ((*wif = wlan_find_interface(wname)) == NULL)
+ return (NULL);
+
+ return (wlan_mac_find_mac(*wif, mac));
+}
+
+static struct wlan_mac_mac *
+wlan_get_next_acl_mac(const struct asn_oid *oid, uint sub,
+ struct wlan_iface **wif)
+{
+ char wname[IFNAMSIZ];
+ char mac[IEEE80211_ADDR_LEN];
+ struct wlan_mac_mac *wmm;
+
+ if (oid->len - sub == 0) {
+ for (*wif = wlan_first_interface(); *wif != NULL;
+ *wif = wlan_next_interface(*wif)) {
+ wmm = SLIST_FIRST(&(*wif)->mac_maclist);
+ if (wmm != NULL)
+ return (wmm);
+ }
+ return (NULL);
+ }
+
+ if (wlan_mac_index_decode(oid, sub, wname, mac) < 0 ||
+ (*wif = wlan_find_interface(wname)) == NULL ||
+ (wmm = wlan_mac_find_mac(*wif, mac)) == NULL)
+ return (NULL);
+
+ if ((wmm = SLIST_NEXT(wmm, wm)) != NULL)
+ return (wmm);
+
+ while ((*wif = wlan_next_interface(*wif)) != NULL)
+ if ((wmm = SLIST_FIRST(&(*wif)->mac_maclist)) != NULL)
+ break;
+
+ return (wmm);
+}
+
+static int
+wlan_acl_mac_set_status(struct snmp_context *ctx, struct snmp_value *val,
+ uint sub)
+{
+ char wname[IFNAMSIZ];
+ uint8_t mac[IEEE80211_ADDR_LEN];
+ struct wlan_iface *wif;
+ struct wlan_mac_mac *macl;
+
+ if (wlan_mac_index_decode(&val->var, sub, wname, mac) < 0)
+ return (SNMP_ERR_GENERR);
+ macl = wlan_get_acl_mac(&val->var, sub, &wif);
+
+ switch (val->v.integer) {
+ case RowStatus_createAndGo:
+ if (macl != NULL)
+ return (SNMP_ERR_INCONS_NAME);
+ break;
+ case RowStatus_destroy:
+ if (macl == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ ctx->scratch->int1 = RowStatus_active;
+ return (SNMP_ERR_NOERROR);
+ default:
+ return (SNMP_ERR_INCONS_VALUE);
+ }
+
+
+ if (wif == NULL || !wif->macsupported)
+ return (SNMP_ERR_INCONS_VALUE);
+
+ if ((macl = wlan_mac_new_mac((const uint8_t *)mac)) == NULL)
+ return (SNMP_ERR_GENERR);
+
+ ctx->scratch->int1 = RowStatus_destroy;
+
+ if (wlan_mac_add_mac(wif, macl) < 0) {
+ wlan_mac_free_mac(macl);
+ return (SNMP_ERR_GENERR);
+ }
+
+ ctx->scratch->int1 = RowStatus_destroy;
+ if (wlan_add_mac_acl_mac(wif, macl) < 0) {
+ (void)wlan_mac_delete_mac(wif, macl);
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+/*
+ * Wireless interfaces operating as mesh points.
+ */
+static struct wlan_iface *
+wlan_mesh_first_interface(void)
+{
+ struct wlan_iface *wif;
+
+ SLIST_FOREACH(wif, &wlan_ifaces, w_if)
+ if (wif->mode == WlanIfaceOperatingModeType_meshPoint &&
+ wif->status == RowStatus_active)
+ break;
+
+ return (wif);
+}
+
+static struct wlan_iface *
+wlan_mesh_next_interface(struct wlan_iface *wif)
+{
+ struct wlan_iface *nwif;
+
+ while ((nwif = wlan_next_interface(wif)) != NULL) {
+ if (nwif->mode == WlanIfaceOperatingModeType_meshPoint &&
+ nwif->status == RowStatus_active)
+ break;
+ wif = nwif;
+ }
+
+ return (nwif);
+}
+
+static struct wlan_iface *
+wlan_mesh_get_iface(const struct asn_oid *oid, uint sub)
+{
+ struct wlan_iface *wif;
+
+ if ((wif = wlan_get_interface(oid, sub)) == NULL)
+ return (NULL);
+
+ if (wif->mode != WlanIfaceOperatingModeType_meshPoint)
+ return (NULL);
+
+ return (wif);
+}
+
+static struct wlan_iface *
+wlan_mesh_get_next_iface(const struct asn_oid *oid, uint sub)
+{
+ uint32_t i;
+ uint8_t wname[IFNAMSIZ];
+ struct wlan_iface *wif;
+
+ if (oid->len - sub == 0)
+ return (wlan_mesh_first_interface());
+
+ if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >= IFNAMSIZ)
+ return (NULL);
+
+ memset(wname, 0, IFNAMSIZ);
+ for (i = 0; i < oid->subs[sub]; i++)
+ wname[i] = oid->subs[sub + i + 1];
+ wname[i] = '\0';
+
+ if ((wif = wlan_find_interface(wname)) == NULL)
+ return (NULL);
+
+ return (wlan_mesh_next_interface(wif));
+}
+
+/*
+ * The neighbors of wireless interfaces operating as mesh points.
+ */
+static struct wlan_peer *
+wlan_mesh_get_peer(const struct asn_oid *oid, uint sub, struct wlan_iface **wif)
+{
+ char wname[IFNAMSIZ];
+ uint8_t pmac[IEEE80211_ADDR_LEN];
+
+ if (wlan_mac_index_decode(oid, sub, wname, pmac) < 0)
+ return (NULL);
+
+ if ((*wif = wlan_find_interface(wname)) == NULL ||
+ (*wif)->mode != WlanIfaceOperatingModeType_meshPoint)
+ return (NULL);
+
+ return (wlan_find_peer(*wif, pmac));
+}
+
+static struct wlan_peer *
+wlan_mesh_get_next_peer(const struct asn_oid *oid, uint sub, struct wlan_iface **wif)
+{
+ char wname[IFNAMSIZ];
+ char pmac[IEEE80211_ADDR_LEN];
+ struct wlan_peer *wip;
+
+ if (oid->len - sub == 0) {
+ for (*wif = wlan_mesh_first_interface(); *wif != NULL;
+ *wif = wlan_mesh_next_interface(*wif)) {
+ wip = SLIST_FIRST(&(*wif)->peerlist);
+ if (wip != NULL)
+ return (wip);
+ }
+ return (NULL);
+ }
+
+ if (wlan_mac_index_decode(oid, sub, wname, pmac) < 0 ||
+ (*wif = wlan_find_interface(wname)) == NULL ||
+ (*wif)->mode != WlanIfaceOperatingModeType_meshPoint ||
+ (wip = wlan_find_peer(*wif, pmac)) == NULL)
+ return (NULL);
+
+ if ((wip = SLIST_NEXT(wip, wp)) != NULL)
+ return (wip);
+
+ while ((*wif = wlan_mesh_next_interface(*wif)) != NULL)
+ if ((wip = SLIST_FIRST(&(*wif)->peerlist)) != NULL)
+ break;
+
+ return (wip);
+}
+
+/*
+ * Mesh routing table.
+ */
+static void
+wlan_mesh_free_routes(struct wlan_iface *wif)
+{
+ struct wlan_mesh_route *wmr;
+
+ while ((wmr = SLIST_FIRST(&wif->mesh_routelist)) != NULL) {
+ SLIST_REMOVE_HEAD(&wif->mesh_routelist, wr);
+ free(wmr);
+ }
+
+ SLIST_INIT(&wif->mesh_routelist);
+}
+
+static struct wlan_mesh_route *
+wlan_mesh_find_route(struct wlan_iface *wif, uint8_t *dstmac)
+{
+ struct wlan_mesh_route *wmr;
+
+ if (wif->mode != WlanIfaceOperatingModeType_meshPoint)
+ return (NULL);
+
+ SLIST_FOREACH(wmr, &wif->mesh_routelist, wr)
+ if (memcmp(wmr->imroute.imr_dest, dstmac,
+ IEEE80211_ADDR_LEN) == 0)
+ break;
+
+ return (wmr);
+}
+
+struct wlan_mesh_route *
+wlan_mesh_new_route(const uint8_t *dstmac)
+{
+ struct wlan_mesh_route *wmr;
+
+ if ((wmr = (struct wlan_mesh_route *)malloc(sizeof(*wmr))) == NULL)
+ return (NULL);
+
+ memset(wmr, 0, sizeof(*wmr));
+ memcpy(wmr->imroute.imr_dest, dstmac, IEEE80211_ADDR_LEN);
+ wmr->mroute_status = RowStatus_notReady;
+
+ return (wmr);
+}
+
+void
+wlan_mesh_free_route(struct wlan_mesh_route *wmr)
+{
+ free(wmr);
+}
+
+int
+wlan_mesh_add_rtentry(struct wlan_iface *wif, struct wlan_mesh_route *wmr)
+{
+ struct wlan_mesh_route *temp, *prev;
+
+ SLIST_FOREACH(temp, &wif->mesh_routelist, wr)
+ if (memcmp(temp->imroute.imr_dest, wmr->imroute.imr_dest,
+ IEEE80211_ADDR_LEN) == 0)
+ return (-1);
+
+ if ((prev = SLIST_FIRST(&wif->mesh_routelist)) == NULL ||
+ memcmp(wmr->imroute.imr_dest, prev->imroute.imr_dest,
+ IEEE80211_ADDR_LEN) < 0) {
+ SLIST_INSERT_HEAD(&wif->mesh_routelist, wmr, wr);
+ return (0);
+ }
+
+ SLIST_FOREACH(temp, &wif->mesh_routelist, wr) {
+ if (memcmp(wmr->imroute.imr_dest, temp->imroute.imr_dest,
+ IEEE80211_ADDR_LEN) < 0)
+ break;
+ prev = temp;
+ }
+
+ SLIST_INSERT_AFTER(prev, wmr, wr);
+ return (0);
+}
+
+static int
+wlan_mesh_delete_route(struct wlan_iface *wif, struct wlan_mesh_route *wmr)
+{
+ if (wmr->mroute_status == RowStatus_active &&
+ wlan_mesh_del_route(wif, wmr) < 0)
+ return (-1);
+
+ SLIST_REMOVE(&wif->mesh_routelist, wmr, wlan_mesh_route, wr);
+ free(wmr);
+
+ return (0);
+}
+
+static void
+wlan_mesh_update_routes(void)
+{
+ struct wlan_iface *wif;
+ struct wlan_mesh_route *wmr, *twmr;
+
+ if ((time(NULL) - wlan_mrlist_age) <= WLAN_LIST_MAXAGE)
+ return;
+
+ for (wif = wlan_mesh_first_interface(); wif != NULL;
+ wif = wlan_mesh_next_interface(wif)) {
+ /*
+ * Nuke old entries - XXX - they are likely not to
+ * change often - reconsider.
+ */
+ SLIST_FOREACH_SAFE(wmr, &wif->mesh_routelist, wr, twmr)
+ if (wmr->mroute_status == RowStatus_active) {
+ SLIST_REMOVE(&wif->mesh_routelist, wmr,
+ wlan_mesh_route, wr);
+ wlan_mesh_free_route(wmr);
+ }
+ (void)wlan_mesh_get_routelist(wif);
+ }
+ wlan_mrlist_age = time(NULL);
+}
+
+static struct wlan_mesh_route *
+wlan_mesh_get_route(const struct asn_oid *oid, uint sub, struct wlan_iface **wif)
+{
+ char wname[IFNAMSIZ];
+ char dstmac[IEEE80211_ADDR_LEN];
+
+ if (wlan_mac_index_decode(oid, sub, wname, dstmac) < 0)
+ return (NULL);
+
+ if ((*wif = wlan_find_interface(wname)) == NULL)
+ return (NULL);
+
+ return (wlan_mesh_find_route(*wif, dstmac));
+}
+
+static struct wlan_mesh_route *
+wlan_mesh_get_next_route(const struct asn_oid *oid, uint sub,
+ struct wlan_iface **wif)
+{
+ char wname[IFNAMSIZ];
+ char dstmac[IEEE80211_ADDR_LEN];
+ struct wlan_mesh_route *wmr;
+
+ if (oid->len - sub == 0) {
+ for (*wif = wlan_mesh_first_interface(); *wif != NULL;
+ *wif = wlan_mesh_next_interface(*wif)) {
+ wmr = SLIST_FIRST(&(*wif)->mesh_routelist);
+ if (wmr != NULL)
+ return (wmr);
+ }
+ return (NULL);
+ }
+
+ if (wlan_mac_index_decode(oid, sub, wname, dstmac) < 0 ||
+ (*wif = wlan_find_interface(wname)) == NULL ||
+ (wmr = wlan_mesh_find_route(*wif, dstmac)) == NULL)
+ return (NULL);
+
+ if ((wmr = SLIST_NEXT(wmr, wr)) != NULL)
+ return (wmr);
+
+ while ((*wif = wlan_mesh_next_interface(*wif)) != NULL)
+ if ((wmr = SLIST_FIRST(&(*wif)->mesh_routelist)) != NULL)
+ break;
+
+ return (wmr);
+}
+
+static int
+wlan_mesh_route_set_status(struct snmp_context *ctx, struct snmp_value *val,
+ uint sub)
+{
+ char wname[IFNAMSIZ];
+ char mac[IEEE80211_ADDR_LEN];
+ struct wlan_mesh_route *wmr;
+ struct wlan_iface *wif;
+
+ if (wlan_mac_index_decode(&val->var, sub, wname, mac) < 0)
+ return (SNMP_ERR_GENERR);
+ wmr = wlan_mesh_get_route(&val->var, sub, &wif);
+
+ switch (val->v.integer) {
+ case RowStatus_createAndGo:
+ if (wmr != NULL)
+ return (SNMP_ERR_INCONS_NAME);
+ break;
+ case RowStatus_destroy:
+ if (wmr == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ ctx->scratch->int1 = RowStatus_active;
+ return (SNMP_ERR_NOERROR);
+ default:
+ return (SNMP_ERR_INCONS_VALUE);
+ }
+
+ if ((wif = wlan_find_interface(wname)) == NULL)
+ return (SNMP_ERR_INCONS_NAME);
+
+ if ((wmr = wlan_mesh_new_route(mac)) == NULL)
+ return (SNMP_ERR_GENERR);
+
+ if (wlan_mesh_add_rtentry(wif, wmr) < 0) {
+ wlan_mesh_free_route(wmr);
+ return (SNMP_ERR_GENERR);
+ }
+
+ ctx->scratch->int1 = RowStatus_destroy;
+ if (wlan_mesh_add_route(wif, wmr) < 0) {
+ (void)wlan_mesh_delete_route(wif, wmr);
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+/*
+ * Wlan snmp module initialization hook.
+ * Returns 0 on success, < 0 on error.
+ */
+static int
+wlan_init(struct lmodule * mod __unused, int argc __unused,
+ char *argv[] __unused)
+{
+ if (wlan_kmodules_load() < 0)
+ return (-1);
+
+ if (wlan_ioctl_init() < 0)
+ return (-1);
+
+ /* Register for new interface creation notifications. */
+ if (mib_register_newif(wlan_attach_newif, wlan_module)) {
+ syslog(LOG_ERR, "Cannot register newif function: %s",
+ strerror(errno));
+ return (-1);
+ }
+
+ return (0);
+}
+
+/*
+ * Wlan snmp module finalization hook.
+ */
+static int
+wlan_fini(void)
+{
+ mib_unregister_newif(wlan_module);
+ or_unregister(reg_wlan);
+
+ /* XXX: Cleanup! */
+ wlan_free_iflist();
+
+ return (0);
+}
+
+/*
+ * Refetch all available data from the kernel.
+ */
+static void
+wlan_update_data(void *arg __unused)
+{
+}
+
+/*
+ * Wlan snmp module start operation.
+ */
+static void
+wlan_start(void)
+{
+ struct mibif *ifp;
+
+ reg_wlan = or_register(&oid_wlan,
+ "The MIB module for managing wireless networking.", wlan_module);
+
+ /* Add the existing wlan interfaces. */
+ for (ifp = mib_first_if(); ifp != NULL; ifp = mib_next_if(ifp))
+ wlan_attach_newif(ifp);
+
+ wlan_data_timer = timer_start_repeat(wlan_poll_ticks,
+ wlan_poll_ticks, wlan_update_data, NULL, wlan_module);
+}
+
+/*
+ * Dump the Wlan snmp module data on SIGUSR1.
+ */
+static void
+wlan_dump(void)
+{
+ /* XXX: Print some debug info to syslog. */
+ struct wlan_iface *wif;
+
+ for (wif = wlan_first_interface(); wif != NULL;
+ wif = wlan_next_interface(wif))
+ syslog(LOG_ERR, "wlan iface %s", wif->wname);
+}
+
+const char wlan_comment[] = \
+"This module implements the BEGEMOT MIB for wireless networking.";
+
+const struct snmp_module config = {
+ .comment = wlan_comment,
+ .init = wlan_init,
+ .fini = wlan_fini,
+ .start = wlan_start,
+ .tree = wlan_ctree,
+ .dump = wlan_dump,
+ .tree_size = wlan_CTREE_SIZE,
+};
diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h
new file mode 100644
index 0000000..16632d3
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h
@@ -0,0 +1,286 @@
+/*-
+ * Copyright (c) 2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Shteryana Sotirova Shopova under
+ * sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#define WLAN_IFMODE_MAX WlanIfaceOperatingModeType_tdma
+#define WLAN_COUNTRY_CODE_SIZE 3
+#define WLAN_BGSCAN_IDLE_MIN 100 /* XXX */
+#define WLAN_SCAN_VALID_MIN 10 /* XXX */
+#define WLAN_TDMA_MAXSLOTS 2 /* XXX */
+
+struct wlan_iface;
+
+struct wlan_peer {
+ uint8_t pmac[IEEE80211_ADDR_LEN]; /* key */
+ uint16_t associd;
+ uint16_t vlan;
+ uint16_t frequency;
+ uint32_t fflags;
+ uint8_t txrate;
+ int8_t rssi;
+ uint16_t idle;
+ uint16_t txseqs;
+ uint16_t rxseqs;
+ uint16_t txpower;
+ uint8_t capinfo;
+ uint32_t state;
+ uint16_t local_id;
+ uint16_t peer_id;
+ SLIST_ENTRY(wlan_peer) wp;
+};
+
+SLIST_HEAD(wlan_peerlist, wlan_peer);
+
+struct wlan_scan_result {
+ uint8_t ssid[IEEE80211_NWID_LEN + 1];
+ uint8_t bssid[IEEE80211_ADDR_LEN];
+ uint8_t opchannel;
+ int8_t rssi;
+ uint16_t frequency;
+ int8_t noise;
+ uint16_t bintval;
+ uint8_t capinfo;
+ struct wlan_iface *pwif;
+ SLIST_ENTRY(wlan_scan_result) wsr;
+};
+
+SLIST_HEAD(wlan_scanlist, wlan_scan_result);
+
+struct wlan_mac_mac {
+ uint8_t mac[IEEE80211_ADDR_LEN];
+ enum RowStatus mac_status;
+ SLIST_ENTRY(wlan_mac_mac) wm;
+};
+
+SLIST_HEAD(wlan_maclist, wlan_mac_mac);
+
+struct wlan_mesh_route {
+ struct ieee80211req_mesh_route imroute;
+ enum RowStatus mroute_status;
+ SLIST_ENTRY(wlan_mesh_route) wr;
+};
+
+SLIST_HEAD(wlan_mesh_routes, wlan_mesh_route);
+
+struct wlan_iface {
+ char wname[IFNAMSIZ];
+ uint32_t index;
+ char pname[IFNAMSIZ];
+ enum WlanIfaceOperatingModeType mode;
+ uint32_t flags;
+ uint8_t dbssid[IEEE80211_ADDR_LEN];
+ uint8_t dlmac[IEEE80211_ADDR_LEN];
+ enum RowStatus status;
+ enum wlanIfaceState state;
+ uint8_t internal;
+
+ uint32_t drivercaps;
+ uint32_t cryptocaps;
+ uint32_t htcaps;
+
+ uint32_t packet_burst;
+ uint8_t country_code[WLAN_COUNTRY_CODE_SIZE];
+ enum WlanRegDomainCode reg_domain;
+ uint8_t desired_ssid[IEEE80211_NWID_LEN + 1];
+ uint32_t desired_channel;
+ enum TruthValue dyn_frequency;
+ enum TruthValue fast_frames;
+ enum TruthValue dturbo;
+ int32_t tx_power;
+ int32_t frag_threshold;
+ int32_t rts_threshold;
+ enum TruthValue priv_subscribe;
+ enum TruthValue bg_scan;
+ int32_t bg_scan_idle;
+ int32_t bg_scan_interval;
+ int32_t beacons_missed;
+ uint8_t desired_bssid[IEEE80211_ADDR_LEN];
+ enum wlanIfaceRoamingMode roam_mode;
+ enum TruthValue dot11d;
+ enum TruthValue dot11h;
+ enum TruthValue dynamic_wds;
+ enum TruthValue power_save;
+ enum TruthValue ap_bridge;
+ int32_t beacon_interval;
+ int32_t dtim_period;
+ enum TruthValue hide_ssid;
+ enum TruthValue inact_process;
+ enum wlanIfaceDot11gProtMode do11g_protect;
+ enum TruthValue dot11g_pure;
+ enum TruthValue dot11n_pure;
+ enum WlanIfaceDot11nPduType ampdu;
+ int32_t ampdu_density;
+ int32_t ampdu_limit;
+ enum WlanIfaceDot11nPduType amsdu;
+ int32_t amsdu_limit;
+ enum TruthValue ht_enabled;
+ enum TruthValue ht_compatible;
+ enum wlanIfaceDot11nHTProtMode ht_prot_mode;
+ enum TruthValue rifs;
+ enum TruthValue short_gi;
+ enum wlanIfaceDot11nSMPSMode smps_mode;
+ int32_t tdma_slot;
+ int32_t tdma_slot_count;
+ int32_t tdma_slot_length;
+ int32_t tdma_binterval;
+
+ struct wlan_peerlist peerlist;
+ struct ieee80211_stats stats;
+ uint32_t nchannels;
+ struct ieee80211_channel *chanlist;
+ struct ieee80211_roamparams_req roamparams;
+ struct ieee80211_txparams_req txparams;
+
+ uint32_t scan_flags;
+ uint32_t scan_duration;
+ uint32_t scan_mindwell;
+ uint32_t scan_maxdwell;
+ enum wlanScanConfigStatus scan_status;
+ struct wlan_scanlist scanlist;
+
+ uint8_t wepsupported;
+ enum wlanWepMode wepmode;
+ int32_t weptxkey;
+
+ uint8_t macsupported;
+ enum wlanMACAccessControlPolicy mac_policy;
+ uint32_t mac_nacls;
+ struct wlan_maclist mac_maclist;
+
+ uint32_t mesh_ttl;
+ enum TruthValue mesh_peering;
+ enum TruthValue mesh_forwarding;
+ enum wlanMeshMetric mesh_metric;
+ enum wlanMeshPath mesh_path;
+ enum wlanHWMPRootMode hwmp_root_mode;
+ uint32_t hwmp_max_hops;
+ struct wlan_mesh_routes mesh_routelist;
+
+ SLIST_ENTRY(wlan_iface) w_if;
+};
+
+enum wlan_syscl {
+ WLAN_MESH_RETRY_TO = 0,
+ WLAN_MESH_HOLDING_TO,
+ WLAN_MESH_CONFIRM_TO,
+ WLAN_MESH_MAX_RETRIES,
+ WLAN_HWMP_TARGET_ONLY,
+ WLAN_HWMP_REPLY_FORWARD,
+ WLAN_HWMP_PATH_LIFETIME,
+ WLAN_HWMP_ROOT_TO,
+ WLAN_HWMP_ROOT_INT,
+ WLAN_HWMP_RANN_INT,
+ WLAN_HWMP_INACTIVITY_TO,
+ WLAN_SYSCTL_MAX
+};
+
+struct wlan_config {
+ int32_t mesh_retryto;
+ int32_t mesh_holdingto;
+ int32_t mesh_confirmto;
+ int32_t mesh_maxretries;
+ int32_t hwmp_targetonly;
+ int32_t hwmp_replyforward;
+ int32_t hwmp_pathlifetime;
+ int32_t hwmp_roottimeout;
+ int32_t hwmp_rootint;
+ int32_t hwmp_rannint;
+ int32_t hwmp_inact;
+};
+
+int wlan_ioctl_init(void);
+int wlan_kmodules_load(void);
+int wlan_check_media(char *);
+int wlan_config_state(struct wlan_iface *, uint8_t);
+int wlan_get_opmode(struct wlan_iface *wif);
+int wlan_get_local_addr(struct wlan_iface *wif);
+int wlan_get_parent(struct wlan_iface *wif);
+int wlan_get_driver_caps(struct wlan_iface *wif);
+uint8_t wlan_channel_state_to_snmp(uint8_t cstate);
+uint32_t wlan_channel_flags_to_snmp(uint32_t cflags);
+int wlan_get_channel_list(struct wlan_iface *wif);
+int wlan_get_roam_params(struct wlan_iface *wif);
+int wlan_get_tx_params(struct wlan_iface *wif);
+int wlan_set_tx_params(struct wlan_iface *wif, int32_t pmode);
+int wlan_clone_create(struct wlan_iface *);
+int wlan_clone_destroy(struct wlan_iface *wif);
+int wlan_config_get_dssid(struct wlan_iface *wif);
+int wlan_config_set_dssid(struct wlan_iface *wif, char *ssid, int slen);
+int wlan_config_get_ioctl(struct wlan_iface *wif, int which);
+int wlan_config_set_ioctl(struct wlan_iface *wif, int which, int val,
+ char *strval, int len);
+int wlan_set_scan_config(struct wlan_iface *wif);
+int wlan_get_scan_results(struct wlan_iface *wif);
+int wlan_get_stats(struct wlan_iface *wif);
+int wlan_get_wepmode(struct wlan_iface *wif);
+int wlan_set_wepmode(struct wlan_iface *wif);
+int wlan_get_weptxkey(struct wlan_iface *wif);
+int wlan_set_weptxkey(struct wlan_iface *wif);
+int wlan_get_wepkeys(struct wlan_iface *wif);
+int wlan_set_wepkeys(struct wlan_iface *wif);
+int wlan_get_mac_policy(struct wlan_iface *wif);
+int wlan_set_mac_policy(struct wlan_iface *wif);
+int wlan_flush_mac_mac(struct wlan_iface *wif);
+int wlan_get_mac_acl_macs(struct wlan_iface *wif);
+int wlan_add_mac_acl_mac(struct wlan_iface *wif, struct wlan_mac_mac *mmac);
+int wlan_del_mac_acl_mac(struct wlan_iface *wif, struct wlan_mac_mac *mmac);
+
+int32_t wlan_do_sysctl(struct wlan_config *cfg, enum wlan_syscl which, int set);
+int wlan_mesh_config_get(struct wlan_iface *wif, int which);
+int wlan_mesh_config_set(struct wlan_iface *wif, int which);
+int wlan_mesh_flush_routes(struct wlan_iface *wif);
+int wlan_mesh_add_route(struct wlan_iface *wif, struct wlan_mesh_route *wmr);
+int wlan_mesh_del_route(struct wlan_iface *wif, struct wlan_mesh_route *wmr);
+int wlan_mesh_get_routelist(struct wlan_iface *wif);
+int wlan_hwmp_config_get(struct wlan_iface *wif, int which);
+int wlan_hwmp_config_set(struct wlan_iface *wif, int which);
+
+/* XXX: static */
+
+int wlan_peer_set_vlan(struct wlan_iface *wif, struct wlan_peer *wip, int vlan);
+int wlan_get_peerinfo(struct wlan_iface *wif);
+
+/* XXX*/
+struct wlan_peer *wlan_new_peer(const uint8_t *pmac);
+void wlan_free_peer(struct wlan_peer *wip);
+int wlan_add_peer(struct wlan_iface *wif, struct wlan_peer *wip);
+
+struct wlan_scan_result * wlan_scan_new_result(const uint8_t *ssid,
+ const uint8_t *bssid);
+void wlan_scan_free_result(struct wlan_scan_result *sr);
+int wlan_scan_add_result(struct wlan_iface *wif, struct wlan_scan_result *sr);
+
+struct wlan_mac_mac *wlan_mac_new_mac(const uint8_t *mac);
+void wlan_mac_free_mac(struct wlan_mac_mac *wmm);
+int wlan_mac_add_mac(struct wlan_iface *wif, struct wlan_mac_mac *wmm);
+
+struct wlan_mesh_route *wlan_mesh_new_route(const uint8_t *dstmac);
+int wlan_mesh_add_rtentry(struct wlan_iface *wif, struct wlan_mesh_route *wmr);
+void wlan_mesh_free_route(struct wlan_mesh_route *wmr);
diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c
new file mode 100644
index 0000000..739f11f
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c
@@ -0,0 +1,3145 @@
+/*-
+ * Copyright (c) 2010 The FreeBSD Foundation
+ * All rights reserved.
+
+ * This software was developed by Shteryana Sotirova Shopova under
+ * sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/ioctl.h>
+#include <sys/param.h>
+#include <sys/module.h>
+#include <sys/linker.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/if_mib.h>
+#include <net/if_types.h>
+#include <net80211/ieee80211.h>
+#include <net80211/ieee80211_ioctl.h>
+#include <net80211/ieee80211_regdomain.h>
+
+#include <errno.h>
+#include <ifaddrs.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <syslog.h>
+
+#include <bsnmp/snmpmod.h>
+#include <bsnmp/snmp_mibII.h>
+
+#include "wlan_tree.h"
+#include "wlan_snmp.h"
+
+static int sock = -1;
+
+static int wlan_ioctl(char *, uint16_t, int *, void *, size_t *, int);
+static int wlan_kmod_load(const char *);
+static uint32_t wlan_drivercaps_to_snmp(uint32_t);
+static uint32_t wlan_cryptocaps_to_snmp(uint32_t);
+static uint32_t wlan_htcaps_to_snmp(uint32_t);
+static uint32_t wlan_peerstate_to_snmp(uint32_t);
+static uint32_t wlan_peercaps_to_snmp(uint32_t );
+static uint32_t wlan_channel_flags_to_snmp_phy(uint32_t);
+static uint32_t wlan_regdomain_to_snmp(int);
+static uint32_t wlan_snmp_to_scan_flags(int);
+static int wlan_config_snmp2ioctl(int);
+static int wlan_snmp_to_regdomain(enum WlanRegDomainCode);
+static int wlan_config_get_country(struct wlan_iface *);
+static int wlan_config_set_country(struct wlan_iface *, char *, int);
+static int wlan_config_get_dchannel(struct wlan_iface *wif);
+static int wlan_config_set_dchannel(struct wlan_iface *wif, uint32_t);
+static int wlan_config_get_bssid(struct wlan_iface *);
+static int wlan_config_set_bssid(struct wlan_iface *, uint8_t *);
+static void wlan_config_set_snmp_intval(struct wlan_iface *, int, int);
+static int wlan_config_snmp2value(int, int, int *);
+static int wlan_config_check(struct wlan_iface *, int);
+static int wlan_config_get_intval(struct wlan_iface *, int);
+static int wlan_config_set_intval(struct wlan_iface *, int, int);
+static int wlan_add_new_scan_result(struct wlan_iface *,
+ const struct ieee80211req_scan_result *, uint8_t *);
+static int wlan_add_mac_macinfo(struct wlan_iface *,
+ const struct ieee80211req_maclist *);
+static struct wlan_peer *wlan_add_peerinfo(const struct ieee80211req_sta_info *);
+
+int
+wlan_ioctl_init(void)
+{
+ if ((sock = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
+ syslog(LOG_ERR, "cannot open socket : %s", strerror(errno));
+ return (-1);
+ }
+
+ return (0);
+}
+/*
+ * Load the needed modules in kernel if not already there.
+ */
+enum wlan_kmodules {
+ WLAN_KMOD = 0,
+ WLAN_KMOD_ACL,
+ WLAN_KMOD_WEP,
+ WLAN_KMODS_MAX
+};
+
+static const char *wmod_names[] = {
+ "wlan",
+ "wlan_wlan_acl",
+ "wlan_wep",
+ NULL
+};
+
+static int
+wlan_kmod_load(const char *modname)
+{
+ int fileid, modid;
+ struct module_stat mstat;
+
+ mstat.version = sizeof(struct module_stat);
+ for (fileid = kldnext(0); fileid > 0; fileid = kldnext(fileid)) {
+ for (modid = kldfirstmod(fileid); modid > 0;
+ modid = modfnext(modid)) {
+ if (modstat(modid, &mstat) < 0)
+ continue;
+ if (strcmp(modname, mstat.name) == 0)
+ return (0);
+ }
+ }
+
+ /* Not present - load it. */
+ if (kldload(modname) < 0) {
+ syslog(LOG_ERR, "failed to load %s kernel module - %s", modname,
+ strerror(errno));
+ return (-1);
+ }
+
+ return (1);
+}
+
+int
+wlan_kmodules_load(void)
+{
+ if (wlan_kmod_load(wmod_names[WLAN_KMOD]) < 0)
+ return (-1);
+
+ if (wlan_kmod_load(wmod_names[WLAN_KMOD_ACL]) > 0)
+ syslog(LOG_NOTICE, "SNMP wlan loaded %s module",
+ wmod_names[WLAN_KMOD_ACL]);
+
+ if (wlan_kmod_load(wmod_names[WLAN_KMOD_WEP]) > 0)
+ syslog(LOG_NOTICE, "SNMP wlan loaded %s module",
+ wmod_names[WLAN_KMOD_WEP]);
+
+ return (0);
+}
+
+/* XXX: FIXME */
+static int
+wlan_ioctl(char *wif_name, uint16_t req_type, int *val, void *arg,
+ size_t *argsize, int set)
+{
+ struct ieee80211req ireq;
+
+ memset(&ireq, 0, sizeof(struct ieee80211req));
+ strlcpy(ireq.i_name, wif_name, IFNAMSIZ);
+
+ ireq.i_type = req_type;
+ ireq.i_val = *val;
+ ireq.i_len = *argsize;
+ ireq.i_data = arg;
+
+ if (ioctl(sock, set ? SIOCS80211 : SIOCG80211, &ireq) < 0) {
+ syslog(LOG_ERR, "iface %s - %s param: ioctl(%d) "
+ "failed: %s", wif_name, set ? "set" : "get",
+ req_type, strerror(errno));
+ return (-1);
+ }
+
+ *argsize = ireq.i_len;
+ *val = ireq.i_val;
+
+ return (0);
+}
+
+int
+wlan_check_media(char *ifname)
+{
+ struct ifmediareq ifmr;
+
+ memset(&ifmr, 0, sizeof(struct ifmediareq));
+ strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
+
+ if (ioctl(sock, SIOCGIFMEDIA, &ifmr) < 0 || ifmr.ifm_count == 0)
+ return (0); /* Interface doesn't support SIOCGIFMEDIA. */
+
+ if ((ifmr.ifm_status & IFM_AVALID) == 0)
+ return (0);
+
+ return (IFM_TYPE(ifmr.ifm_active));
+}
+
+int
+wlan_get_opmode(struct wlan_iface *wif)
+{
+ struct ifmediareq ifmr;
+
+ memset(&ifmr, 0, sizeof(struct ifmediareq));
+ strlcpy(ifmr.ifm_name, wif->wname, sizeof(ifmr.ifm_name));
+
+ if (ioctl(sock, SIOCGIFMEDIA, &ifmr) < 0) {
+ if (errno == ENXIO)
+ return (-1);
+ wif->mode = WlanIfaceOperatingModeType_station;
+ return (0);
+ }
+
+ if (ifmr.ifm_current & IFM_IEEE80211_ADHOC) {
+ if (ifmr.ifm_current & IFM_FLAG0)
+ wif->mode = WlanIfaceOperatingModeType_adhocDemo;
+ else
+ wif->mode = WlanIfaceOperatingModeType_ibss;
+ } else if (ifmr.ifm_current & IFM_IEEE80211_HOSTAP)
+ wif->mode = WlanIfaceOperatingModeType_hostAp;
+ else if (ifmr.ifm_current & IFM_IEEE80211_MONITOR)
+ wif->mode = WlanIfaceOperatingModeType_monitor;
+ else if (ifmr.ifm_current & IFM_IEEE80211_MBSS)
+ wif->mode = WlanIfaceOperatingModeType_meshPoint;
+ else if (ifmr.ifm_current & IFM_IEEE80211_WDS)
+ wif->mode = WlanIfaceOperatingModeType_wds;
+
+ return (0);
+}
+
+int
+wlan_config_state(struct wlan_iface *wif, uint8_t set)
+{
+ int flags;
+ struct ifreq ifr;
+
+ memset(&ifr, 0, sizeof(ifr));
+ strcpy(ifr.ifr_name, wif->wname);
+
+ if (ioctl(sock, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
+ syslog(LOG_ERR, "set %s status: ioctl(SIOCGIFFLAGS) "
+ "failed: %s", wif->wname, strerror(errno));
+ return (-1);
+ }
+
+ if (set == 0) {
+ if ((ifr.ifr_flags & IFF_UP) != 0)
+ wif->state = wlanIfaceState_up;
+ else
+ wif->state = wlanIfaceState_down;
+ return (0);
+ }
+
+ flags = (ifr.ifr_flags & 0xffff) | (ifr.ifr_flagshigh << 16);
+
+ if (wif->state == wlanIfaceState_up)
+ flags |= IFF_UP;
+ else
+ flags &= ~IFF_UP;
+
+ ifr.ifr_flags = flags & 0xffff;
+ ifr.ifr_flagshigh = flags >> 16;
+ if (ioctl(sock, SIOCSIFFLAGS, (caddr_t) &ifr) < 0) {
+ syslog(LOG_ERR, "set %s %s: ioctl(SIOCSIFFLAGS) failed: %s",
+ wif->wname, wif->state == wlanIfaceState_up?"up":"down",
+ strerror(errno));
+ return (-1);
+ }
+
+ return (0);
+}
+
+int
+wlan_get_local_addr(struct wlan_iface *wif)
+{
+ int len;
+ char ifname[IFNAMSIZ];
+ struct ifaddrs *ifap, *ifa;
+ struct sockaddr_dl sdl;
+
+ if (getifaddrs(&ifap) != 0) {
+ syslog(LOG_ERR, "wlan get mac: getifaddrs() failed - %s",
+ strerror(errno));
+ return (-1);
+ }
+
+ for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
+ if (ifa->ifa_addr->sa_family != AF_LINK)
+ continue;
+ memcpy(&sdl, ifa->ifa_addr, sizeof(struct sockaddr_dl));
+ if (sdl.sdl_alen > IEEE80211_ADDR_LEN)
+ continue;
+ if ((len = sdl.sdl_nlen) >= IFNAMSIZ)
+ len = IFNAMSIZ - 1;
+ memcpy(ifname, sdl.sdl_data, len);
+ ifname[len] = '\0';
+ if (strcmp(wif->wname, ifname) == 0)
+ break;
+ }
+
+ freeifaddrs(ifap);
+ return (0);
+}
+
+int
+wlan_get_parent(struct wlan_iface *wif __unused)
+{
+ /* XXX: There's no way to fetch this from the kernel. */
+ return (0);
+}
+
+/* XXX */
+#define IEEE80211_C_STA 0x00000001 /* CAPABILITY: STA available */
+#define IEEE80211_C_8023ENCAP 0x00000002 /* CAPABILITY: 802.3 encap */
+#define IEEE80211_C_FF 0x00000040 /* CAPABILITY: ATH FF avail */
+#define IEEE80211_C_TURBOP 0x00000080 /* CAPABILITY: ATH Turbo avail*/
+#define IEEE80211_C_IBSS 0x00000100 /* CAPABILITY: IBSS available */
+#define IEEE80211_C_PMGT 0x00000200 /* CAPABILITY: Power mgmt */
+#define IEEE80211_C_HOSTAP 0x00000400 /* CAPABILITY: HOSTAP avail */
+#define IEEE80211_C_AHDEMO 0x00000800 /* CAPABILITY: Old Adhoc Demo */
+#define IEEE80211_C_SWRETRY 0x00001000 /* CAPABILITY: sw tx retry */
+#define IEEE80211_C_TXPMGT 0x00002000 /* CAPABILITY: tx power mgmt */
+#define IEEE80211_C_SHSLOT 0x00004000 /* CAPABILITY: short slottime */
+#define IEEE80211_C_SHPREAMBLE 0x00008000 /* CAPABILITY: short preamble */
+#define IEEE80211_C_MONITOR 0x00010000 /* CAPABILITY: monitor mode */
+#define IEEE80211_C_DFS 0x00020000 /* CAPABILITY: DFS/radar avail*/
+#define IEEE80211_C_MBSS 0x00040000 /* CAPABILITY: MBSS available */
+/* 0x7c0000 available */
+#define IEEE80211_C_WPA1 0x00800000 /* CAPABILITY: WPA1 avail */
+#define IEEE80211_C_WPA2 0x01000000 /* CAPABILITY: WPA2 avail */
+#define IEEE80211_C_WPA 0x01800000 /* CAPABILITY: WPA1+WPA2 avail*/
+#define IEEE80211_C_BURST 0x02000000 /* CAPABILITY: frame bursting */
+#define IEEE80211_C_WME 0x04000000 /* CAPABILITY: WME avail */
+#define IEEE80211_C_WDS 0x08000000 /* CAPABILITY: 4-addr support */
+/* 0x10000000 reserved */
+#define IEEE80211_C_BGSCAN 0x20000000 /* CAPABILITY: bg scanning */
+#define IEEE80211_C_TXFRAG 0x40000000 /* CAPABILITY: tx fragments */
+#define IEEE80211_C_TDMA 0x80000000 /* CAPABILITY: TDMA avail */
+
+static uint32_t
+wlan_drivercaps_to_snmp(uint32_t dcaps)
+{
+ uint32_t scaps = 0;
+
+ if ((dcaps & IEEE80211_C_STA) != 0)
+ scaps |= (0x1 << WlanDriverCaps_station);
+ if ((dcaps & IEEE80211_C_8023ENCAP) != 0)
+ scaps |= (0x1 << WlanDriverCaps_ieee8023encap);
+ if ((dcaps & IEEE80211_C_FF) != 0)
+ scaps |= (0x1 << WlanDriverCaps_athFastFrames);
+ if ((dcaps & IEEE80211_C_TURBOP) != 0)
+ scaps |= (0x1 << WlanDriverCaps_athTurbo);
+ if ((dcaps & IEEE80211_C_IBSS) != 0)
+ scaps |= (0x1 << WlanDriverCaps_ibss);
+ if ((dcaps & IEEE80211_C_PMGT) != 0)
+ scaps |= (0x1 << WlanDriverCaps_pmgt);
+ if ((dcaps & IEEE80211_C_HOSTAP) != 0)
+ scaps |= (0x1 << WlanDriverCaps_hostAp);
+ if ((dcaps & IEEE80211_C_AHDEMO) != 0)
+ scaps |= (0x1 << WlanDriverCaps_ahDemo);
+ if ((dcaps & IEEE80211_C_SWRETRY) != 0)
+ scaps |= (0x1 << WlanDriverCaps_swRetry);
+ if ((dcaps & IEEE80211_C_TXPMGT) != 0)
+ scaps |= (0x1 << WlanDriverCaps_txPmgt);
+ if ((dcaps & IEEE80211_C_SHSLOT) != 0)
+ scaps |= (0x1 << WlanDriverCaps_shortSlot);
+ if ((dcaps & IEEE80211_C_SHPREAMBLE) != 0)
+ scaps |= (0x1 << WlanDriverCaps_shortPreamble);
+ if ((dcaps & IEEE80211_C_MONITOR) != 0)
+ scaps |= (0x1 << WlanDriverCaps_monitor);
+ if ((dcaps & IEEE80211_C_DFS) != 0)
+ scaps |= (0x1 << WlanDriverCaps_dfs);
+ if ((dcaps & IEEE80211_C_MBSS) != 0)
+ scaps |= (0x1 << WlanDriverCaps_mbss);
+ if ((dcaps & IEEE80211_C_WPA1) != 0)
+ scaps |= (0x1 << WlanDriverCaps_wpa1);
+ if ((dcaps & IEEE80211_C_WPA2) != 0)
+ scaps |= (0x1 << WlanDriverCaps_wpa2);
+ if ((dcaps & IEEE80211_C_BURST) != 0)
+ scaps |= (0x1 << WlanDriverCaps_burst);
+ if ((dcaps & IEEE80211_C_WME) != 0)
+ scaps |= (0x1 << WlanDriverCaps_wme);
+ if ((dcaps & IEEE80211_C_WDS) != 0)
+ scaps |= (0x1 << WlanDriverCaps_wds);
+ if ((dcaps & IEEE80211_C_BGSCAN) != 0)
+ scaps |= (0x1 << WlanDriverCaps_bgScan);
+ if ((dcaps & IEEE80211_C_TXFRAG) != 0)
+ scaps |= (0x1 << WlanDriverCaps_txFrag);
+ if ((dcaps & IEEE80211_C_TDMA) != 0)
+ scaps |= (0x1 << WlanDriverCaps_tdma);
+
+ return (scaps);
+}
+
+static uint32_t
+wlan_cryptocaps_to_snmp(uint32_t ccaps)
+{
+ uint32_t scaps = 0;
+
+#if NOT_YET
+ if ((ccaps & IEEE80211_CRYPTO_WEP) != 0)
+ scaps |= (0x1 << wlanCryptoCaps_wep);
+ if ((ccaps & IEEE80211_CRYPTO_TKIP) != 0)
+ scaps |= (0x1 << wlanCryptoCaps_tkip);
+ if ((ccaps & IEEE80211_CRYPTO_AES_OCB) != 0)
+ scaps |= (0x1 << wlanCryptoCaps_aes);
+ if ((ccaps & IEEE80211_CRYPTO_AES_CCM) != 0)
+ scaps |= (0x1 << wlanCryptoCaps_aesCcm);
+ if ((ccaps & IEEE80211_CRYPTO_TKIPMIC) != 0)
+ scaps |= (0x1 << wlanCryptoCaps_tkipMic);
+ if ((ccaps & IEEE80211_CRYPTO_CKIP) != 0)
+ scaps |= (0x1 << wlanCryptoCaps_ckip);
+#else /* !NOT_YET */
+ scaps = ccaps;
+#endif
+ return (scaps);
+}
+
+#define IEEE80211_HTC_AMPDU 0x00010000 /* CAPABILITY: A-MPDU tx */
+#define IEEE80211_HTC_AMSDU 0x00020000 /* CAPABILITY: A-MSDU tx */
+/* NB: HT40 is implied by IEEE80211_HTCAP_CHWIDTH40 */
+#define IEEE80211_HTC_HT 0x00040000 /* CAPABILITY: HT operation */
+#define IEEE80211_HTC_SMPS 0x00080000 /* CAPABILITY: MIMO power save*/
+#define IEEE80211_HTC_RIFS 0x00100000 /* CAPABILITY: RIFS support */
+
+static uint32_t
+wlan_htcaps_to_snmp(uint32_t hcaps)
+{
+ uint32_t scaps = 0;
+
+ if ((hcaps & IEEE80211_HTCAP_LDPC) != 0)
+ scaps |= (0x1 << WlanHTCaps_ldpc);
+ if ((hcaps & IEEE80211_HTCAP_CHWIDTH40) != 0)
+ scaps |= (0x1 << WlanHTCaps_chwidth40);
+ if ((hcaps & IEEE80211_HTCAP_GREENFIELD) != 0)
+ scaps |= (0x1 << WlanHTCaps_greenField);
+ if ((hcaps & IEEE80211_HTCAP_SHORTGI20) != 0)
+ scaps |= (0x1 << WlanHTCaps_shortGi20);
+ if ((hcaps & IEEE80211_HTCAP_SHORTGI40) != 0)
+ scaps |= (0x1 << WlanHTCaps_shortGi40);
+ if ((hcaps & IEEE80211_HTCAP_TXSTBC) != 0)
+ scaps |= (0x1 << WlanHTCaps_txStbc);
+ if ((hcaps & IEEE80211_HTCAP_DELBA) != 0)
+ scaps |= (0x1 << WlanHTCaps_delba);
+ if ((hcaps & IEEE80211_HTCAP_MAXAMSDU_7935) != 0)
+ scaps |= (0x1 << WlanHTCaps_amsdu7935);
+ if ((hcaps & IEEE80211_HTCAP_DSSSCCK40) != 0)
+ scaps |= (0x1 << WlanHTCaps_dssscck40);
+ if ((hcaps & IEEE80211_HTCAP_PSMP) != 0)
+ scaps |= (0x1 << WlanHTCaps_psmp);
+ if ((hcaps & IEEE80211_HTCAP_40INTOLERANT) != 0)
+ scaps |= (0x1 << WlanHTCaps_fortyMHzIntolerant);
+ if ((hcaps & IEEE80211_HTCAP_LSIGTXOPPROT) != 0)
+ scaps |= (0x1 << WlanHTCaps_lsigTxOpProt);
+ if ((hcaps & IEEE80211_HTC_AMPDU) != 0)
+ scaps |= (0x1 << WlanHTCaps_htcAmpdu);
+ if ((hcaps & IEEE80211_HTC_AMSDU) != 0)
+ scaps |= (0x1 << WlanHTCaps_htcAmsdu);
+ if ((hcaps & IEEE80211_HTC_HT) != 0)
+ scaps |= (0x1 << WlanHTCaps_htcHt);
+ if ((hcaps & IEEE80211_HTC_SMPS) != 0)
+ scaps |= (0x1 << WlanHTCaps_htcSmps);
+ if ((hcaps & IEEE80211_HTC_RIFS) != 0)
+ scaps |= (0x1 << WlanHTCaps_htcRifs);
+
+ return (scaps);
+}
+
+/* XXX: Not here? */
+#define WLAN_SET_TDMA_OPMODE(w) do { \
+ if ((w)->mode == WlanIfaceOperatingModeType_adhocDemo && \
+ ((w)->drivercaps & WlanDriverCaps_tdma) != 0) \
+ (w)->mode = WlanIfaceOperatingModeType_tdma; \
+} while (0)
+int
+wlan_get_driver_caps(struct wlan_iface *wif)
+{
+ int val = 0;
+ size_t argsize;
+ struct ieee80211_devcaps_req dc;
+
+ memset(&dc, 0, sizeof(struct ieee80211_devcaps_req));
+ argsize = sizeof(struct ieee80211_devcaps_req);
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_DEVCAPS, &val, &dc,
+ &argsize, 0) < 0)
+ return (-1);
+
+ wif->drivercaps = wlan_drivercaps_to_snmp(dc.dc_drivercaps);
+ wif->cryptocaps = wlan_cryptocaps_to_snmp(dc.dc_cryptocaps);
+ wif->htcaps = wlan_htcaps_to_snmp(dc.dc_htcaps);
+
+ WLAN_SET_TDMA_OPMODE(wif);
+
+ argsize = dc.dc_chaninfo.ic_nchans * sizeof(struct ieee80211_channel);
+ wif->chanlist = (struct ieee80211_channel *)malloc(argsize);
+ if (wif->chanlist == NULL)
+ return (0);
+
+ memcpy(wif->chanlist, dc.dc_chaninfo.ic_chans, argsize);
+ wif->nchannels = dc.dc_chaninfo.ic_nchans;
+
+ return (0);
+}
+
+uint8_t
+wlan_channel_state_to_snmp(uint8_t cstate)
+{
+ uint8_t cs = 0;
+
+ if ((cstate & IEEE80211_CHANSTATE_RADAR) != 0)
+ cs |= (0x1 << WlanIfaceChannelStateType_radar);
+ if ((cstate & IEEE80211_CHANSTATE_CACDONE) != 0)
+ cs |= (0x1 << WlanIfaceChannelStateType_cacDone);
+ if ((cstate & IEEE80211_CHANSTATE_CWINT) != 0)
+ cs |= (0x1 << WlanIfaceChannelStateType_interferenceDetected);
+ if ((cstate & IEEE80211_CHANSTATE_NORADAR) != 0)
+ cs |= (0x1 << WlanIfaceChannelStateType_radarClear);
+
+ return (cs);
+}
+
+uint32_t
+wlan_channel_flags_to_snmp(uint32_t cflags)
+{
+ uint32_t cf = 0;
+
+ if ((cflags & IEEE80211_CHAN_TURBO) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_turbo);
+ if ((cflags & IEEE80211_CHAN_CCK) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_cck);
+ if ((cflags & IEEE80211_CHAN_OFDM) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_ofdm);
+ if ((cflags & IEEE80211_CHAN_2GHZ) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_spectrum2Ghz);
+ if ((cflags & IEEE80211_CHAN_5GHZ) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_spectrum5Ghz);
+ if ((cflags & IEEE80211_CHAN_PASSIVE) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_passiveScan);
+ if ((cflags & IEEE80211_CHAN_DYN) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_dynamicCckOfdm);
+ if ((cflags & IEEE80211_CHAN_GFSK) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_gfsk);
+ if ((cflags & IEEE80211_CHAN_GSM) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_spectrum900Mhz);
+ if ((cflags & IEEE80211_CHAN_STURBO) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_dot11aStaticTurbo);
+ if ((cflags & IEEE80211_CHAN_HALF) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_halfRate);
+ if ((cflags & IEEE80211_CHAN_QUARTER) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_quarterRate);
+ if ((cflags & IEEE80211_CHAN_HT20) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_ht20);
+ if ((cflags & IEEE80211_CHAN_HT40U) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_ht40u);
+ if ((cflags & IEEE80211_CHAN_HT40D) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_ht40d);
+ if ((cflags & IEEE80211_CHAN_DFS) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_dfs);
+ if ((cflags & IEEE80211_CHAN_4MSXMIT) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_xmit4ms);
+ if ((cflags & IEEE80211_CHAN_NOADHOC) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_noAdhoc);
+ if ((cflags & IEEE80211_CHAN_NOHOSTAP) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_noHostAp);
+ if ((cflags & IEEE80211_CHAN_11D) != 0)
+ cf |= (0x1 << WlanIfaceChannelFlagsType_dot11d);
+
+ return (cf);
+}
+
+/* XXX: */
+#define WLAN_SNMP_MAX_CHANS 256
+int
+wlan_get_channel_list(struct wlan_iface *wif)
+{
+ int val = 0;
+ uint32_t i, nchans;
+ size_t argsize;
+ struct ieee80211req_chaninfo *chaninfo;
+ struct ieee80211req_chanlist active;
+ const struct ieee80211_channel *c;
+
+ argsize = sizeof(struct ieee80211req_chaninfo) +
+ sizeof(struct ieee80211_channel) * WLAN_SNMP_MAX_CHANS;
+ chaninfo = (struct ieee80211req_chaninfo *)malloc(argsize);
+ if (chaninfo == NULL)
+ return (-1);
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_CHANINFO, &val, chaninfo,
+ &argsize, 0) < 0)
+ return (-1);
+
+ argsize = sizeof(active);
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_CHANLIST, &val, &active,
+ &argsize, 0) < 0)
+ goto error;
+
+ for (i = 0, nchans = 0; i < chaninfo->ic_nchans; i++) {
+ c = &chaninfo->ic_chans[i];
+ if (!isset(active.ic_channels, c->ic_ieee))
+ continue;
+ nchans++;
+ }
+ wif->chanlist = (struct ieee80211_channel *)reallocf(wif->chanlist,
+ nchans * sizeof(*c));
+ if (wif->chanlist == NULL)
+ goto error;
+ wif->nchannels = nchans;
+ for (i = 0, nchans = 0; i < chaninfo->ic_nchans; i++) {
+ c = &chaninfo->ic_chans[i];
+ if (!isset(active.ic_channels, c->ic_ieee))
+ continue;
+ memcpy(wif->chanlist + nchans, c, sizeof (*c));
+ nchans++;
+ }
+
+ free(chaninfo);
+ return (0);
+error:
+ wif->nchannels = 0;
+ free(chaninfo);
+ return (-1);
+}
+
+static enum WlanIfPhyMode
+wlan_channel_flags_to_snmp_phy(uint32_t cflags)
+{
+ /* XXX: recheck */
+ if ((cflags & IEEE80211_CHAN_A) != 0)
+ return (WlanIfPhyMode_dot11a);
+ if ((cflags & IEEE80211_CHAN_B) != 0)
+ return (WlanIfPhyMode_dot11b);
+ if ((cflags & IEEE80211_CHAN_G) != 0 ||
+ (cflags & IEEE80211_CHAN_PUREG) != 0)
+ return (WlanIfPhyMode_dot11g);
+ if ((cflags & IEEE80211_CHAN_FHSS) != 0)
+ return (WlanIfPhyMode_fh);
+ if ((cflags & IEEE80211_CHAN_TURBO) != 0 &&
+ (cflags & IEEE80211_CHAN_A) != 0)
+ return (WlanIfPhyMode_turboA);
+ if ((cflags & IEEE80211_CHAN_TURBO) != 0 &&
+ (cflags & IEEE80211_CHAN_G) != 0)
+ return (WlanIfPhyMode_turboG);
+ if ((cflags & IEEE80211_CHAN_STURBO) != 0)
+ return (WlanIfPhyMode_sturboA);
+ if ((cflags & IEEE80211_CHAN_HALF) != 0)
+ return (WlanIfPhyMode_ofdmHalf);
+ if ((cflags & IEEE80211_CHAN_QUARTER) != 0)
+ return (WlanIfPhyMode_ofdmQuarter);
+
+ return (WlanIfPhyMode_auto);
+}
+
+int
+wlan_get_roam_params(struct wlan_iface *wif)
+{
+ int val = 0;
+ size_t argsize;
+
+ argsize = sizeof(struct ieee80211_roamparams_req);
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_ROAM, &val,
+ &wif->roamparams, &argsize, 0) < 0)
+ return (-1);
+
+ return (0);
+}
+
+int
+wlan_get_tx_params(struct wlan_iface *wif)
+{
+ int val = 0;
+ size_t argsize;
+
+ /*
+ * XXX: Reset IEEE80211_RATE_MCS bit on IEEE80211_MODE_11NA
+ * and IEEE80211_MODE_11NG modes.
+ */
+ argsize = sizeof(struct ieee80211_txparams_req);
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_TXPARAMS, &val,
+ &wif->txparams, &argsize, 0) < 0)
+ return (-1);
+
+ return (0);
+}
+
+int
+wlan_set_tx_params(struct wlan_iface *wif, int32_t pmode __unused)
+{
+ int val = 0;
+ size_t argsize;
+
+ /*
+ * XXX: Set IEEE80211_RATE_MCS bit on IEEE80211_MODE_11NA
+ * and IEEE80211_MODE_11NG modes.
+ */
+ argsize = sizeof(struct ieee80211_txparams_req);
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_TXPARAMS, &val,
+ &wif->txparams, &argsize, 1) < 0)
+ return (-1);
+
+ return (0);
+}
+
+int
+wlan_clone_create(struct wlan_iface *wif)
+{
+ struct ifreq ifr;
+ struct ieee80211_clone_params wcp;
+ static const uint8_t zerobssid[IEEE80211_ADDR_LEN];
+
+ memset(&wcp, 0, sizeof(wcp));
+ memset(&ifr, 0, sizeof(ifr));
+
+ /* Sanity checks. */
+ if (wif == NULL || wif->pname[0] == '\0' || wif->mode > WLAN_IFMODE_MAX)
+ return (SNMP_ERR_INCONS_VALUE);
+
+ if (wif->mode == WlanIfaceOperatingModeType_wds &&
+ memcmp(wif->dbssid, zerobssid, IEEE80211_ADDR_LEN) == 0)
+ return (SNMP_ERR_INCONS_VALUE);
+
+ strlcpy(wcp.icp_parent, wif->pname, IFNAMSIZ);
+ if ((wif->flags & WlanIfaceFlagsType_uniqueBssid) != 0)
+ wcp.icp_flags |= IEEE80211_CLONE_BSSID;
+ if ((wif->flags & WlanIfaceFlagsType_noBeacons) != 0)
+ wcp.icp_flags |= IEEE80211_CLONE_NOBEACONS;
+ if (wif->mode == WlanIfaceOperatingModeType_wds &&
+ (wif->flags & WlanIfaceFlagsType_wdsLegacy) != 0)
+ wcp.icp_flags |= IEEE80211_CLONE_WDSLEGACY;
+
+ switch (wif->mode) {
+ case WlanIfaceOperatingModeType_ibss:
+ wcp.icp_opmode = IEEE80211_M_IBSS;
+ break;
+ case WlanIfaceOperatingModeType_station:
+ wcp.icp_opmode = IEEE80211_M_STA;
+ break;
+ case WlanIfaceOperatingModeType_wds:
+ wcp.icp_opmode = IEEE80211_M_WDS;
+ break;
+ case WlanIfaceOperatingModeType_adhocDemo:
+ wcp.icp_opmode = IEEE80211_M_AHDEMO;
+ break;
+ case WlanIfaceOperatingModeType_hostAp:
+ wcp.icp_opmode = IEEE80211_M_HOSTAP;
+ break;
+ case WlanIfaceOperatingModeType_monitor:
+ wcp.icp_opmode = IEEE80211_M_MONITOR;
+ break;
+ case WlanIfaceOperatingModeType_meshPoint:
+ wcp.icp_opmode = IEEE80211_M_MBSS;
+ break;
+ case WlanIfaceOperatingModeType_tdma:
+ wcp.icp_opmode = IEEE80211_M_AHDEMO;
+ wcp.icp_flags |= IEEE80211_CLONE_TDMA;
+ break;
+ }
+
+ memcpy(wcp.icp_bssid, wif->dbssid, IEEE80211_ADDR_LEN);
+ if (memcmp(wif->dlmac, zerobssid, IEEE80211_ADDR_LEN) != 0) {
+ memcpy(wcp.icp_macaddr, wif->dlmac, IEEE80211_ADDR_LEN);
+ wcp.icp_flags |= IEEE80211_CLONE_MACADDR;
+ }
+
+ strlcpy(ifr.ifr_name, wif->wname, IFNAMSIZ);
+ ifr.ifr_data = (caddr_t) &wcp;
+
+ if (ioctl(sock, SIOCIFCREATE2, (caddr_t) &ifr) < 0) {
+ syslog(LOG_ERR, "wlan clone create: ioctl(SIOCIFCREATE2) "
+ "failed: %s", strerror(errno));
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+wlan_clone_destroy(struct wlan_iface *wif)
+{
+ struct ifreq ifr;
+
+ if (wif == NULL)
+ return (SNMP_ERR_INCONS_VALUE);
+
+ memset(&ifr, 0, sizeof(ifr));
+ strcpy(ifr.ifr_name, wif->wname);
+
+ if (ioctl(sock, SIOCIFDESTROY, &ifr) < 0) {
+ syslog(LOG_ERR, "wlan clone destroy: ioctl(SIOCIFDESTROY) "
+ "failed: %s", strerror(errno));
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+static int
+wlan_config_snmp2ioctl(int which)
+{
+ int op;
+
+ switch (which) {
+ case LEAF_wlanIfacePacketBurst:
+ op = IEEE80211_IOC_BURST;
+ break;
+ case LEAF_wlanIfaceCountryCode:
+ op = IEEE80211_IOC_REGDOMAIN;
+ break;
+ case LEAF_wlanIfaceRegDomain:
+ op = IEEE80211_IOC_REGDOMAIN;
+ break;
+ case LEAF_wlanIfaceDesiredSsid:
+ op = IEEE80211_IOC_SSID;
+ break;
+ case LEAF_wlanIfaceDesiredChannel:
+ op = IEEE80211_IOC_CURCHAN;
+ break;
+ case LEAF_wlanIfaceDynamicFreqSelection:
+ op = IEEE80211_IOC_DFS;
+ break;
+ case LEAF_wlanIfaceFastFrames:
+ op = IEEE80211_IOC_FF;
+ break;
+ case LEAF_wlanIfaceDturbo:
+ op = IEEE80211_IOC_TURBOP;
+ break;
+ case LEAF_wlanIfaceTxPower:
+ op = IEEE80211_IOC_TXPOWER;
+ break;
+ case LEAF_wlanIfaceFragmentThreshold:
+ op = IEEE80211_IOC_FRAGTHRESHOLD;
+ break;
+ case LEAF_wlanIfaceRTSThreshold:
+ op = IEEE80211_IOC_RTSTHRESHOLD;
+ break;
+ case LEAF_wlanIfaceWlanPrivacySubscribe:
+ op = IEEE80211_IOC_WPS;
+ break;
+ case LEAF_wlanIfaceBgScan:
+ op = IEEE80211_IOC_BGSCAN;
+ break;
+ case LEAF_wlanIfaceBgScanIdle:
+ op = IEEE80211_IOC_BGSCAN_IDLE;
+ break;
+ case LEAF_wlanIfaceBgScanInterval:
+ op = IEEE80211_IOC_BGSCAN_INTERVAL;
+ break;
+ case LEAF_wlanIfaceBeaconMissedThreshold:
+ op = IEEE80211_IOC_BMISSTHRESHOLD;
+ break;
+ case LEAF_wlanIfaceDesiredBssid:
+ op = IEEE80211_IOC_BSSID;
+ break;
+ case LEAF_wlanIfaceRoamingMode:
+ op = IEEE80211_IOC_ROAMING;
+ break;
+ case LEAF_wlanIfaceDot11d:
+ op = IEEE80211_IOC_DOTD;
+ break;
+ case LEAF_wlanIfaceDot11h:
+ op = IEEE80211_IOC_DOTH;
+ break;
+ case LEAF_wlanIfaceDynamicWds:
+ op = IEEE80211_IOC_DWDS;
+ break;
+ case LEAF_wlanIfacePowerSave:
+ op = IEEE80211_IOC_POWERSAVE;
+ break;
+ case LEAF_wlanIfaceApBridge:
+ op = IEEE80211_IOC_APBRIDGE;
+ break;
+ case LEAF_wlanIfaceBeaconInterval:
+ op = IEEE80211_IOC_BEACON_INTERVAL;
+ break;
+ case LEAF_wlanIfaceDtimPeriod:
+ op = IEEE80211_IOC_DTIM_PERIOD;
+ break;
+ case LEAF_wlanIfaceHideSsid:
+ op = IEEE80211_IOC_HIDESSID;
+ break;
+ case LEAF_wlanIfaceInactivityProccess:
+ op = IEEE80211_IOC_INACTIVITY;
+ break;
+ case LEAF_wlanIfaceDot11gProtMode:
+ op = IEEE80211_IOC_PROTMODE;
+ break;
+ case LEAF_wlanIfaceDot11gPureMode:
+ op = IEEE80211_IOC_PUREG;
+ break;
+ case LEAF_wlanIfaceDot11nPureMode:
+ op = IEEE80211_IOC_PUREN;
+ break;
+ case LEAF_wlanIfaceDot11nAmpdu:
+ op = IEEE80211_IOC_AMPDU;
+ break;
+ case LEAF_wlanIfaceDot11nAmpduDensity:
+ op = IEEE80211_IOC_AMPDU_DENSITY;
+ break;
+ case LEAF_wlanIfaceDot11nAmpduLimit:
+ op = IEEE80211_IOC_AMPDU_LIMIT;
+ break;
+ case LEAF_wlanIfaceDot11nAmsdu:
+ op = IEEE80211_IOC_AMSDU;
+ break;
+ case LEAF_wlanIfaceDot11nAmsduLimit:
+ op = IEEE80211_IOC_AMSDU_LIMIT;
+ break;
+ case LEAF_wlanIfaceDot11nHighThroughput:
+ op = IEEE80211_IOC_HTCONF;
+ break;
+ case LEAF_wlanIfaceDot11nHTCompatible:
+ op = IEEE80211_IOC_HTCOMPAT;
+ break;
+ case LEAF_wlanIfaceDot11nHTProtMode:
+ op = IEEE80211_IOC_HTPROTMODE;
+ break;
+ case LEAF_wlanIfaceDot11nRIFS:
+ op = IEEE80211_IOC_RIFS;
+ break;
+ case LEAF_wlanIfaceDot11nShortGI:
+ op = IEEE80211_IOC_SHORTGI;
+ break;
+ case LEAF_wlanIfaceDot11nSMPSMode:
+ op = IEEE80211_IOC_SMPS;
+ break;
+ case LEAF_wlanIfaceTdmaSlot:
+ op = IEEE80211_IOC_TDMA_SLOT;
+ break;
+ case LEAF_wlanIfaceTdmaSlotCount:
+ op = IEEE80211_IOC_TDMA_SLOTCNT;
+ break;
+ case LEAF_wlanIfaceTdmaSlotLength:
+ op = IEEE80211_IOC_TDMA_SLOTLEN;
+ break;
+ case LEAF_wlanIfaceTdmaBeaconInterval:
+ op = IEEE80211_IOC_TDMA_BINTERVAL;
+ break;
+ default:
+ op = -1;
+ }
+
+ return (op);
+}
+
+static enum WlanRegDomainCode
+wlan_regdomain_to_snmp(int which)
+{
+ enum WlanRegDomainCode reg_domain;
+
+ switch (which) {
+ case SKU_FCC:
+ reg_domain = WlanRegDomainCode_fcc;
+ break;
+ case SKU_CA:
+ reg_domain = WlanRegDomainCode_ca;
+ break;
+ case SKU_ETSI:
+ reg_domain = WlanRegDomainCode_etsi;
+ break;
+ case SKU_ETSI2:
+ reg_domain = WlanRegDomainCode_etsi2;
+ break;
+ case SKU_ETSI3:
+ reg_domain = WlanRegDomainCode_etsi3;
+ break;
+ case SKU_FCC3:
+ reg_domain = WlanRegDomainCode_fcc3;
+ break;
+ case SKU_JAPAN:
+ reg_domain = WlanRegDomainCode_japan;
+ break;
+ case SKU_KOREA:
+ reg_domain = WlanRegDomainCode_korea;
+ break;
+ case SKU_APAC:
+ reg_domain = WlanRegDomainCode_apac;
+ break;
+ case SKU_APAC2:
+ reg_domain = WlanRegDomainCode_apac2;
+ break;
+ case SKU_APAC3:
+ reg_domain = WlanRegDomainCode_apac3;
+ break;
+ case SKU_ROW:
+ reg_domain = WlanRegDomainCode_row;
+ break;
+ case SKU_NONE:
+ reg_domain = WlanRegDomainCode_none;
+ break;
+ case SKU_DEBUG:
+ reg_domain = WlanRegDomainCode_debug;
+ break;
+ case SKU_SR9:
+ reg_domain = WlanRegDomainCode_sr9;
+ break;
+ case SKU_XR9:
+ reg_domain = WlanRegDomainCode_xr9;
+ break;
+ case SKU_GZ901:
+ reg_domain = WlanRegDomainCode_gz901;
+ break;
+ case 0:
+ reg_domain = WlanRegDomainCode_none;
+ break;
+ default:
+ syslog(LOG_ERR, "unknown regdomain (0x%x) ", which);
+ reg_domain = WlanRegDomainCode_none;
+ break;
+ }
+
+ return (reg_domain);
+}
+
+static int
+wlan_snmp_to_regdomain(enum WlanRegDomainCode regdomain)
+{
+ int which;
+
+ switch (regdomain) {
+ case WlanRegDomainCode_fcc:
+ which = SKU_FCC;
+ break;
+ case WlanRegDomainCode_ca:
+ which = SKU_CA;
+ break;
+ case WlanRegDomainCode_etsi:
+ which = SKU_ETSI;
+ break;
+ case WlanRegDomainCode_etsi2:
+ which = SKU_ETSI2;
+ break;
+ case WlanRegDomainCode_etsi3:
+ which = SKU_ETSI3;
+ break;
+ case WlanRegDomainCode_fcc3:
+ which = SKU_FCC3;
+ break;
+ case WlanRegDomainCode_japan:
+ which = SKU_JAPAN;
+ break;
+ case WlanRegDomainCode_korea:
+ which = SKU_KOREA;
+ break;
+ case WlanRegDomainCode_apac:
+ which = SKU_APAC;
+ break;
+ case WlanRegDomainCode_apac2:
+ which = SKU_APAC2;
+ break;
+ case WlanRegDomainCode_apac3:
+ which = SKU_APAC3;
+ break;
+ case WlanRegDomainCode_row:
+ which = SKU_ROW;
+ break;
+ case WlanRegDomainCode_none:
+ which = SKU_NONE;
+ break;
+ case WlanRegDomainCode_debug:
+ which = SKU_DEBUG;
+ break;
+ case WlanRegDomainCode_sr9:
+ which = SKU_SR9;
+ break;
+ case WlanRegDomainCode_xr9:
+ which = SKU_XR9;
+ break;
+ case WlanRegDomainCode_gz901:
+ which = SKU_GZ901;
+ break;
+ default:
+ syslog(LOG_ERR, "unknown snmp regdomain (0x%x) ", regdomain);
+ which = SKU_NONE;
+ break;
+ }
+
+ return (which);
+}
+
+static int
+wlan_config_get_country(struct wlan_iface *wif)
+{
+ int val = 0;
+ size_t argsize;
+ struct ieee80211_regdomain regdomain;
+
+ memset(&regdomain, 0, sizeof(regdomain));
+ argsize = sizeof(regdomain);
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_REGDOMAIN, &val, &regdomain,
+ &argsize, 0) < 0)
+ return (-1);
+
+ wif->reg_domain = wlan_regdomain_to_snmp(regdomain.regdomain);
+ wif->country_code[0] = regdomain.isocc[0];
+ wif->country_code[1] = regdomain.isocc[1];
+ wif->country_code[2] = regdomain.location;
+
+ return (0);
+}
+
+static int
+wlan_config_set_country(struct wlan_iface *wif, char *ccode, int rdomain)
+{
+ int val = 0, txpowermax;
+ uint32_t i;
+ size_t argsize = 0;
+ struct ieee80211_regdomain_req *regdomain;
+
+ if (wlan_get_channel_list(wif) < 0)
+ return (-1);
+
+ if (wif->nchannels == 0) {
+ syslog(LOG_ERR, "iface %s - set regdomain failed", wif->wname);
+ return (-1);
+ }
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_TXPOWMAX, &txpowermax, 0,
+ &argsize, 0) < 0)
+ return (-1);
+
+ regdomain = malloc(IEEE80211_REGDOMAIN_SIZE(wif->nchannels));
+ if (regdomain == NULL)
+ return (-1);
+ memset(regdomain, 0, IEEE80211_REGDOMAIN_SIZE(wif->nchannels));
+ argsize = IEEE80211_REGDOMAIN_SIZE(wif->nchannels);
+
+ /* XXX: recheck with how this is done by ifconfig(8) */
+ regdomain->rd.regdomain = wlan_snmp_to_regdomain(rdomain);
+ regdomain->rd.isocc[0] = ccode[0];
+ regdomain->rd.isocc[1] = ccode[1];
+ regdomain->rd.location = ccode[2];
+
+ /* XXX: fill the channel list properly */
+ regdomain->chaninfo.ic_nchans = wif->nchannels;
+ memcpy(regdomain->chaninfo.ic_chans, wif->chanlist,
+ wif->nchannels * sizeof(struct ieee80211_channel));
+ for (i = 0; i < wif->nchannels; i++)
+ regdomain->chaninfo.ic_chans[i].ic_maxregpower = txpowermax;
+
+ wif->state = wlanIfaceState_down;
+ if (wlan_config_state(wif, 1) < 0 ||
+ wlan_ioctl(wif->wname, IEEE80211_IOC_REGDOMAIN, &val, regdomain,
+ &argsize, 1) < 0) {
+ free(regdomain);
+ return (-1);
+ }
+
+ wif->state = wlanIfaceState_up;
+ (void)wlan_config_state(wif, 1);
+ wif->reg_domain = wlan_regdomain_to_snmp(regdomain->rd.regdomain);
+ wif->country_code[0] = regdomain->rd.isocc[0];
+ wif->country_code[1] = regdomain->rd.isocc[1];
+ wif->country_code[2] = regdomain->rd.location;
+ free(regdomain);
+
+ return (0);
+}
+
+int
+wlan_config_get_dssid(struct wlan_iface *wif)
+{
+ int val = -1;
+ size_t argsize = IEEE80211_NWID_LEN + 1;
+ char ssid[IEEE80211_NWID_LEN + 1];
+
+ memset(ssid, 0, IEEE80211_NWID_LEN + 1);
+
+ if (wlan_ioctl(wif->wname,
+ (wif->mode == WlanIfaceOperatingModeType_meshPoint) ?
+ IEEE80211_IOC_MESH_ID : IEEE80211_IOC_SSID, &val, ssid,
+ &argsize, 0) < 0)
+ return (-1);
+
+ if (argsize > IEEE80211_NWID_LEN)
+ argsize = IEEE80211_NWID_LEN;
+ memcpy(wif->desired_ssid, ssid, argsize);
+ wif->desired_ssid[argsize] = '\0';
+
+ return (0);
+}
+
+int
+wlan_config_set_dssid(struct wlan_iface *wif, char *ssid, int slen)
+{
+ int val = 0;
+ size_t argsize = slen;
+
+ if (wlan_ioctl(wif->wname,
+ (wif->mode == WlanIfaceOperatingModeType_meshPoint) ?
+ IEEE80211_IOC_MESH_ID : IEEE80211_IOC_SSID, &val, ssid,
+ &argsize, 1) < 0)
+ return (-1);
+
+ if (argsize > IEEE80211_NWID_LEN)
+ argsize = IEEE80211_NWID_LEN;
+ memcpy(wif->desired_ssid, ssid, argsize);
+ wif->desired_ssid[argsize] = '\0';
+
+ return (0);
+}
+
+static int
+wlan_config_get_dchannel(struct wlan_iface *wif)
+{
+ uint32_t i = 0;
+ int val = 0;
+ size_t argsize = sizeof(struct ieee80211_channel);
+ struct ieee80211_channel chan;
+
+ if (wlan_get_channel_list(wif) < 0)
+ return (-1);
+
+ memset(&chan, 0, sizeof(chan));
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_CURCHAN, &val, &chan,
+ &argsize, 0) < 0)
+ return (-1);
+
+ for (i = 0; i < wif->nchannels; i++)
+ if (chan.ic_ieee == wif->chanlist[i].ic_ieee &&
+ chan.ic_flags == wif->chanlist[i].ic_flags) {
+ wif->desired_channel = i + 1;
+ break;
+ }
+
+ return (0);
+}
+
+static int
+wlan_config_set_dchannel(struct wlan_iface *wif, uint32_t dchannel)
+{
+ int val = 0;
+ size_t argsize = sizeof(struct ieee80211_channel);
+ struct ieee80211_channel chan;
+
+ if (wlan_get_channel_list(wif) < 0)
+ return (-1);
+
+ if (dchannel > wif->nchannels)
+ return (-1);
+
+ memcpy(&chan, wif->chanlist + dchannel - 1, sizeof(chan));
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_CURCHAN, &val, &chan,
+ &argsize, 1) < 0)
+ return (-1);
+
+ wif->desired_channel = dchannel;
+
+ return (0);
+}
+
+static int
+wlan_config_get_bssid(struct wlan_iface *wif)
+{
+ int val = 0;
+ size_t argsize = IEEE80211_ADDR_LEN;
+ char bssid[IEEE80211_ADDR_LEN];
+
+ memset(bssid, 0, IEEE80211_ADDR_LEN);
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_BSSID, &val, bssid,
+ &argsize, 0) < 0 || argsize != IEEE80211_ADDR_LEN)
+ return (-1);
+
+ memcpy(wif->desired_bssid, bssid, IEEE80211_ADDR_LEN);
+
+ return (0);
+}
+
+static int
+wlan_config_set_bssid(struct wlan_iface *wif, uint8_t *bssid)
+{
+ int val = 0;
+ size_t argsize = IEEE80211_ADDR_LEN;
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_BSSID, &val, bssid,
+ &argsize, 1) < 0 || argsize != IEEE80211_ADDR_LEN)
+ return (-1);
+
+ memcpy(wif->desired_bssid, bssid, IEEE80211_ADDR_LEN);
+
+ return (0);
+}
+
+/*
+ * Convert the value returned by the kernel to the appropriate SNMP
+ * representation and set the corresponding interface member accordingly.
+ */
+static void
+wlan_config_set_snmp_intval(struct wlan_iface *wif, int op, int val)
+{
+ switch (op) {
+ case IEEE80211_IOC_BURST:
+ if (val == 0)
+ wif->packet_burst = TruthValue_false;
+ else
+ wif->packet_burst = TruthValue_true;
+ break;
+ case IEEE80211_IOC_DFS:
+ if (val == 0)
+ wif->dyn_frequency = TruthValue_false;
+ else
+ wif->dyn_frequency = TruthValue_true;
+ break;
+ case IEEE80211_IOC_FF:
+ if (val == 0)
+ wif->fast_frames = TruthValue_false;
+ else
+ wif->fast_frames = TruthValue_true;
+ break;
+ case IEEE80211_IOC_TURBOP:
+ if (val == 0)
+ wif->dturbo = TruthValue_false;
+ else
+ wif->dturbo = TruthValue_true;
+ break;
+ case IEEE80211_IOC_TXPOWER:
+ wif->tx_power = val / 2;
+ break;
+ case IEEE80211_IOC_FRAGTHRESHOLD:
+ wif->frag_threshold = val;
+ break;
+ case IEEE80211_IOC_RTSTHRESHOLD:
+ wif->rts_threshold = val;
+ break;
+ case IEEE80211_IOC_WPS:
+ if (val == 0)
+ wif->priv_subscribe = TruthValue_false;
+ else
+ wif->priv_subscribe = TruthValue_true;
+ break;
+ case IEEE80211_IOC_BGSCAN:
+ if (val == 0)
+ wif->bg_scan = TruthValue_false;
+ else
+ wif->bg_scan = TruthValue_true;
+ break;
+ case IEEE80211_IOC_BGSCAN_IDLE:
+ wif->bg_scan_idle = val;
+ break;
+ case IEEE80211_IOC_BGSCAN_INTERVAL:
+ wif->bg_scan_interval = val;
+ break;
+ case IEEE80211_IOC_BMISSTHRESHOLD:
+ wif->beacons_missed = val;
+ break;
+ case IEEE80211_IOC_ROAMING:
+ switch (val) {
+ case IEEE80211_ROAMING_DEVICE:
+ wif->roam_mode = wlanIfaceRoamingMode_device;
+ break;
+ case IEEE80211_ROAMING_MANUAL:
+ wif->roam_mode = wlanIfaceRoamingMode_manual;
+ break;
+ case IEEE80211_ROAMING_AUTO:
+ /* FALTHROUGH */
+ default:
+ wif->roam_mode = wlanIfaceRoamingMode_auto;
+ break;
+ }
+ break;
+ case IEEE80211_IOC_DOTD:
+ if (val == 0)
+ wif->dot11d = TruthValue_false;
+ else
+ wif->dot11d = TruthValue_true;
+ break;
+ case IEEE80211_IOC_DOTH:
+ if (val == 0)
+ wif->dot11h = TruthValue_false;
+ else
+ wif->dot11h = TruthValue_true;
+ break;
+ case IEEE80211_IOC_DWDS:
+ if (val == 0)
+ wif->dynamic_wds = TruthValue_false;
+ else
+ wif->dynamic_wds = TruthValue_true;
+ break;
+ case IEEE80211_IOC_POWERSAVE:
+ if (val == 0)
+ wif->power_save = TruthValue_false;
+ else
+ wif->power_save = TruthValue_true;
+ break;
+ case IEEE80211_IOC_APBRIDGE:
+ if (val == 0)
+ wif->ap_bridge = TruthValue_false;
+ else
+ wif->ap_bridge = TruthValue_true;
+ break;
+ case IEEE80211_IOC_BEACON_INTERVAL:
+ wif->beacon_interval = val;
+ break;
+ case IEEE80211_IOC_DTIM_PERIOD:
+ wif->dtim_period = val;
+ break;
+ case IEEE80211_IOC_HIDESSID:
+ if (val == 0)
+ wif->hide_ssid = TruthValue_false;
+ else
+ wif->hide_ssid = TruthValue_true;
+ break;
+ case IEEE80211_IOC_INACTIVITY:
+ if (val == 0)
+ wif->inact_process = TruthValue_false;
+ else
+ wif->inact_process = TruthValue_true;
+ break;
+ case IEEE80211_IOC_PROTMODE:
+ switch (val) {
+ case IEEE80211_PROTMODE_CTS:
+ wif->do11g_protect = wlanIfaceDot11gProtMode_cts;
+ break;
+ case IEEE80211_PROTMODE_RTSCTS:
+ wif->do11g_protect = wlanIfaceDot11gProtMode_rtscts;
+ break;
+ case IEEE80211_PROTMODE_OFF:
+ /* FALLTHROUGH */
+ default:
+ wif->do11g_protect = wlanIfaceDot11gProtMode_off;
+ break;
+ }
+ break;
+ case IEEE80211_IOC_PUREG:
+ if (val == 0)
+ wif->dot11g_pure = TruthValue_false;
+ else
+ wif->dot11g_pure = TruthValue_true;
+ break;
+ case IEEE80211_IOC_PUREN:
+ if (val == 0)
+ wif->dot11n_pure = TruthValue_false;
+ else
+ wif->dot11n_pure = TruthValue_true;
+ break;
+ case IEEE80211_IOC_AMPDU:
+ switch (val) {
+ case 0:
+ wif->ampdu = WlanIfaceDot11nPduType_disabled;
+ break;
+ case 1:
+ wif->ampdu = WlanIfaceDot11nPduType_txOnly;
+ break;
+ case 2:
+ wif->ampdu = WlanIfaceDot11nPduType_rxOnly;
+ break;
+ case 3:
+ /* FALLTHROUGH */
+ default:
+ wif->ampdu = WlanIfaceDot11nPduType_txAndRx;
+ break;
+ }
+ break;
+ case IEEE80211_IOC_AMPDU_DENSITY:
+ switch (val) {
+ case IEEE80211_HTCAP_MPDUDENSITY_025:
+ wif->ampdu_density = 25;
+ break;
+ case IEEE80211_HTCAP_MPDUDENSITY_05:
+ wif->ampdu_density = 50;
+ break;
+ case IEEE80211_HTCAP_MPDUDENSITY_1:
+ wif->ampdu_density = 100;
+ break;
+ case IEEE80211_HTCAP_MPDUDENSITY_2:
+ wif->ampdu_density = 200;
+ break;
+ case IEEE80211_HTCAP_MPDUDENSITY_4:
+ wif->ampdu_density = 400;
+ break;
+ case IEEE80211_HTCAP_MPDUDENSITY_8:
+ wif->ampdu_density = 800;
+ break;
+ case IEEE80211_HTCAP_MPDUDENSITY_16:
+ wif->ampdu_density = 1600;
+ break;
+ case IEEE80211_HTCAP_MPDUDENSITY_NA:
+ default:
+ wif->ampdu_density = 0;
+ break;
+ }
+ break;
+ case IEEE80211_IOC_AMPDU_LIMIT:
+ switch (val) {
+ case IEEE80211_HTCAP_MAXRXAMPDU_8K:
+ wif->ampdu_limit = 8192;
+ break;
+ case IEEE80211_HTCAP_MAXRXAMPDU_16K:
+ wif->ampdu_limit = 16384;
+ break;
+ case IEEE80211_HTCAP_MAXRXAMPDU_32K:
+ wif->ampdu_limit = 32768;
+ break;
+ case IEEE80211_HTCAP_MAXRXAMPDU_64K:
+ default:
+ wif->ampdu_limit = 65536;
+ break;
+ }
+ break;
+ case IEEE80211_IOC_AMSDU:
+ switch (val) {
+ case 0:
+ wif->amsdu = WlanIfaceDot11nPduType_disabled;
+ break;
+ case 1:
+ wif->amsdu = WlanIfaceDot11nPduType_txOnly;
+ break;
+ case 3:
+ wif->amsdu = WlanIfaceDot11nPduType_txAndRx;
+ break;
+ case 2:
+ default:
+ /* FALLTHROUGH */
+ wif->amsdu = WlanIfaceDot11nPduType_rxOnly;
+ break;
+ }
+ break;
+ case IEEE80211_IOC_AMSDU_LIMIT:
+ wif->amsdu_limit = val;
+ break;
+ case IEEE80211_IOC_HTCONF:
+ if (val == 0) /* XXX */
+ wif->ht_enabled = TruthValue_false;
+ else
+ wif->ht_enabled = TruthValue_true;
+ break;
+ case IEEE80211_IOC_HTCOMPAT:
+ if (val == 0)
+ wif->ht_compatible = TruthValue_false;
+ else
+ wif->ht_compatible = TruthValue_true;
+ break;
+ case IEEE80211_IOC_HTPROTMODE:
+ if (val == IEEE80211_PROTMODE_RTSCTS)
+ wif->ht_prot_mode = wlanIfaceDot11nHTProtMode_rts;
+ else
+ wif->ht_prot_mode = wlanIfaceDot11nHTProtMode_off;
+ break;
+ case IEEE80211_IOC_RIFS:
+ if (val == 0)
+ wif->rifs = TruthValue_false;
+ else
+ wif->rifs = TruthValue_true;
+ break;
+ case IEEE80211_IOC_SHORTGI:
+ if (val == 0)
+ wif->short_gi = TruthValue_false;
+ else
+ wif->short_gi = TruthValue_true;
+ break;
+ case IEEE80211_IOC_SMPS:
+ switch (val) {
+ case IEEE80211_HTCAP_SMPS_DYNAMIC:
+ wif->smps_mode = wlanIfaceDot11nSMPSMode_dynamic;
+ break;
+ case IEEE80211_HTCAP_SMPS_ENA:
+ wif->smps_mode = wlanIfaceDot11nSMPSMode_static;
+ break;
+ case IEEE80211_HTCAP_SMPS_OFF:
+ /* FALLTHROUGH */
+ default:
+ wif->smps_mode = wlanIfaceDot11nSMPSMode_disabled;
+ break;
+ }
+ break;
+ case IEEE80211_IOC_TDMA_SLOT:
+ wif->tdma_slot = val;
+ break;
+ case IEEE80211_IOC_TDMA_SLOTCNT:
+ wif->tdma_slot_count = val;
+ break;
+ case IEEE80211_IOC_TDMA_SLOTLEN:
+ wif->tdma_slot_length = val;
+ break;
+ case IEEE80211_IOC_TDMA_BINTERVAL:
+ wif->tdma_binterval = val;
+ break;
+ default:
+ break;
+ }
+}
+
+/*
+ * Convert an SNMP value to the kernel equivalent and also do sanity check
+ * for each specific type.
+ */
+static int
+wlan_config_snmp2value(int which, int sval, int *value)
+{
+ *value = 0;
+
+ switch (which) {
+ case IEEE80211_IOC_BURST:
+ case IEEE80211_IOC_DFS:
+ case IEEE80211_IOC_FF:
+ case IEEE80211_IOC_TURBOP:
+ case IEEE80211_IOC_WPS:
+ case IEEE80211_IOC_BGSCAN:
+ case IEEE80211_IOC_DOTD:
+ case IEEE80211_IOC_DOTH:
+ case IEEE80211_IOC_DWDS:
+ case IEEE80211_IOC_POWERSAVE:
+ case IEEE80211_IOC_APBRIDGE:
+ case IEEE80211_IOC_HIDESSID:
+ case IEEE80211_IOC_INACTIVITY:
+ case IEEE80211_IOC_PUREG:
+ case IEEE80211_IOC_PUREN:
+ case IEEE80211_IOC_HTCONF:
+ case IEEE80211_IOC_HTCOMPAT:
+ case IEEE80211_IOC_RIFS:
+ if (sval == TruthValue_true)
+ *value = 1;
+ else if (sval != TruthValue_false)
+ return (SNMP_ERR_INCONS_VALUE);
+ break;
+ case IEEE80211_IOC_REGDOMAIN:
+ break;
+ case IEEE80211_IOC_SSID:
+ break;
+ case IEEE80211_IOC_CURCHAN:
+ break;
+ case IEEE80211_IOC_TXPOWER:
+ *value = sval * 2;
+ break;
+ case IEEE80211_IOC_FRAGTHRESHOLD:
+ if (sval < IEEE80211_FRAG_MIN || sval > IEEE80211_FRAG_MAX)
+ return (SNMP_ERR_INCONS_VALUE);
+ *value = sval;
+ break;
+ case IEEE80211_IOC_RTSTHRESHOLD:
+ if (sval < IEEE80211_RTS_MIN || sval > IEEE80211_RTS_MAX)
+ return (SNMP_ERR_INCONS_VALUE);
+ *value = sval;
+ break;
+ case IEEE80211_IOC_BGSCAN_IDLE:
+ if (sval < WLAN_BGSCAN_IDLE_MIN)
+ return (SNMP_ERR_INCONS_VALUE);
+ *value = sval;
+ break;
+ case IEEE80211_IOC_BGSCAN_INTERVAL:
+ if (sval < WLAN_SCAN_VALID_MIN)
+ return (SNMP_ERR_INCONS_VALUE);
+ *value = sval;
+ break;
+ case IEEE80211_IOC_BMISSTHRESHOLD:
+ if (sval < IEEE80211_HWBMISS_MIN || sval > IEEE80211_HWBMISS_MAX)
+ return (SNMP_ERR_INCONS_VALUE);
+ *value = sval;
+ break;
+ case IEEE80211_IOC_BSSID:
+ break;
+ case IEEE80211_IOC_ROAMING:
+ switch (sval) {
+ case wlanIfaceRoamingMode_device:
+ *value = IEEE80211_ROAMING_DEVICE;
+ break;
+ case wlanIfaceRoamingMode_manual:
+ *value = IEEE80211_ROAMING_MANUAL;
+ break;
+ case wlanIfaceRoamingMode_auto:
+ *value = IEEE80211_ROAMING_AUTO;
+ break;
+ default:
+ return (SNMP_ERR_INCONS_VALUE);
+ }
+ break;
+ case IEEE80211_IOC_BEACON_INTERVAL:
+ if (sval < IEEE80211_BINTVAL_MIN || sval > IEEE80211_BINTVAL_MAX)
+ return (SNMP_ERR_INCONS_VALUE);
+ *value = sval;
+ break;
+ case IEEE80211_IOC_DTIM_PERIOD:
+ if (sval < IEEE80211_DTIM_MIN || sval > IEEE80211_DTIM_MAX)
+ return (SNMP_ERR_INCONS_VALUE);
+ *value = sval;
+ break;
+ case IEEE80211_IOC_PROTMODE:
+ switch (sval) {
+ case wlanIfaceDot11gProtMode_cts:
+ *value = IEEE80211_PROTMODE_CTS;
+ break;
+ case wlanIfaceDot11gProtMode_rtscts:
+ *value = IEEE80211_PROTMODE_RTSCTS;
+ break;
+ case wlanIfaceDot11gProtMode_off:
+ *value = IEEE80211_PROTMODE_OFF;
+ break;
+ default:
+ return (SNMP_ERR_INCONS_VALUE);
+ }
+ break;
+ case IEEE80211_IOC_AMPDU:
+ switch (sval) {
+ case WlanIfaceDot11nPduType_disabled:
+ break;
+ case WlanIfaceDot11nPduType_txOnly:
+ *value = 1;
+ break;
+ case WlanIfaceDot11nPduType_rxOnly:
+ *value = 2;
+ break;
+ case WlanIfaceDot11nPduType_txAndRx:
+ *value = 3;
+ break;
+ default:
+ return (SNMP_ERR_INCONS_VALUE);
+ }
+ break;
+ case IEEE80211_IOC_AMPDU_DENSITY:
+ switch (sval) {
+ case 0:
+ *value = IEEE80211_HTCAP_MPDUDENSITY_NA;
+ break;
+ case 25:
+ *value = IEEE80211_HTCAP_MPDUDENSITY_025;
+ break;
+ case 50:
+ *value = IEEE80211_HTCAP_MPDUDENSITY_05;
+ break;
+ case 100:
+ *value = IEEE80211_HTCAP_MPDUDENSITY_1;
+ break;
+ case 200:
+ *value = IEEE80211_HTCAP_MPDUDENSITY_2;
+ break;
+ case 400:
+ *value = IEEE80211_HTCAP_MPDUDENSITY_4;
+ break;
+ case 800:
+ *value = IEEE80211_HTCAP_MPDUDENSITY_8;
+ break;
+ case 1600:
+ *value = IEEE80211_HTCAP_MPDUDENSITY_16;
+ break;
+ default:
+ return (SNMP_ERR_INCONS_VALUE);
+ }
+ break;
+ case IEEE80211_IOC_AMPDU_LIMIT:
+ switch (sval) {
+ case 8192:
+ *value = IEEE80211_HTCAP_MAXRXAMPDU_8K;
+ break;
+ case 16384:
+ *value = IEEE80211_HTCAP_MAXRXAMPDU_16K;
+ break;
+ case 32768:
+ *value = IEEE80211_HTCAP_MAXRXAMPDU_32K;
+ break;
+ case 65536:
+ *value = IEEE80211_HTCAP_MAXRXAMPDU_64K;
+ break;
+ default:
+ return (SNMP_ERR_INCONS_VALUE);
+ }
+ break;
+ case IEEE80211_IOC_AMSDU:
+ switch (sval) {
+ case WlanIfaceDot11nPduType_disabled:
+ break;
+ case WlanIfaceDot11nPduType_txOnly:
+ *value = 1;
+ break;
+ case WlanIfaceDot11nPduType_rxOnly:
+ *value = 2;
+ break;
+ case WlanIfaceDot11nPduType_txAndRx:
+ *value = 3;
+ break;
+ default:
+ return (SNMP_ERR_INCONS_VALUE);
+ }
+ break;
+ case IEEE80211_IOC_AMSDU_LIMIT:
+ if (sval == 3839 || sval == 0)
+ *value = IEEE80211_HTCAP_MAXAMSDU_3839;
+ else if (sval == 7935)
+ *value = IEEE80211_HTCAP_MAXAMSDU_7935;
+ else
+ return (SNMP_ERR_INCONS_VALUE);
+ break;
+ case IEEE80211_IOC_HTPROTMODE:
+ switch (sval) {
+ case wlanIfaceDot11nHTProtMode_rts:
+ *value = IEEE80211_PROTMODE_RTSCTS;
+ break;
+ case wlanIfaceDot11nHTProtMode_off:
+ break;
+ default:
+ return (SNMP_ERR_INCONS_VALUE);
+ }
+ break;
+ case IEEE80211_IOC_SHORTGI:
+ if (sval == TruthValue_true)
+ *value = IEEE80211_HTCAP_SHORTGI20 |
+ IEEE80211_HTCAP_SHORTGI40;
+ else if (sval != TruthValue_false)
+ return (SNMP_ERR_INCONS_VALUE);
+ break;
+ case IEEE80211_IOC_SMPS:
+ switch (sval) {
+ case wlanIfaceDot11nSMPSMode_disabled:
+ *value = IEEE80211_HTCAP_SMPS_OFF;
+ break;
+ case wlanIfaceDot11nSMPSMode_static:
+ *value = IEEE80211_HTCAP_SMPS_ENA;
+ break;
+ case wlanIfaceDot11nSMPSMode_dynamic:
+ *value = IEEE80211_HTCAP_SMPS_DYNAMIC;
+ break;
+ default:
+ return (SNMP_ERR_INCONS_VALUE);
+ }
+ break;
+ case IEEE80211_IOC_TDMA_SLOT:
+ if (sval < 0 || sval > WLAN_TDMA_MAXSLOTS) /* XXX */
+ return (SNMP_ERR_INCONS_VALUE);
+ *value = sval;
+ break;
+ case IEEE80211_IOC_TDMA_SLOTCNT:
+ if (sval < 0 || sval > WLAN_TDMA_MAXSLOTS) /* XXX */
+ return (SNMP_ERR_INCONS_VALUE);
+ *value = sval;
+ break;
+ case IEEE80211_IOC_TDMA_SLOTLEN:
+ if (sval < 2*100 || sval > 0xfffff) /* XXX */
+ return (SNMP_ERR_INCONS_VALUE);
+ *value = sval;
+ break;
+ case IEEE80211_IOC_TDMA_BINTERVAL:
+ if (sval < 1) /* XXX */
+ return (SNMP_ERR_INCONS_VALUE);
+ *value = sval;
+ break;
+ default:
+ return (SNMP_ERR_INCONS_VALUE);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+/*
+ * Sanity checks for the wlanIfaceConfigTable.
+ */
+static int
+wlan_config_check(struct wlan_iface *wif, int op)
+{
+ switch (op) {
+ case IEEE80211_IOC_BURST:
+ if ((wif->drivercaps & (0x1 << WlanDriverCaps_burst)) == 0) {
+ wif->packet_burst = TruthValue_false;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_DFS:
+ if ((wif->drivercaps & (0x1 << WlanDriverCaps_dfs)) == 0) {
+ wif->dyn_frequency = TruthValue_false;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_FF:
+ if ((wif->drivercaps & (0x1 << WlanDriverCaps_athFastFrames))
+ == 0) {
+ wif->fast_frames = TruthValue_false;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_TURBOP:
+ if ((wif->drivercaps & (0x1 << WlanDriverCaps_athTurbo)) == 0) {
+ wif->dturbo = TruthValue_false;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_TXPOWER:
+ if ((wif->drivercaps & (0x1 << WlanDriverCaps_txPmgt)) == 0) {
+ wif->tx_power = 0;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_FRAGTHRESHOLD:
+ if ((wif->drivercaps & (0x1 << WlanDriverCaps_txFrag)) == 0) {
+ wif->frag_threshold = IEEE80211_FRAG_MAX;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_DWDS:
+ if ((wif->drivercaps & (0x1 << WlanDriverCaps_wds)) == 0) {
+ wif->dynamic_wds = TruthValue_false;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_POWERSAVE:
+ if ((wif->drivercaps & (0x1 << WlanDriverCaps_pmgt)) == 0) {
+ wif->power_save = TruthValue_false;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_BEACON_INTERVAL:
+ if (wif->mode != WlanIfaceOperatingModeType_hostAp &&
+ wif->mode != WlanIfaceOperatingModeType_meshPoint &&
+ wif->mode != WlanIfaceOperatingModeType_ibss) {
+ wif->beacon_interval = 100; /* XXX */
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_DTIM_PERIOD:
+ if (wif->mode != WlanIfaceOperatingModeType_hostAp &&
+ wif->mode != WlanIfaceOperatingModeType_meshPoint &&
+ wif->mode != WlanIfaceOperatingModeType_ibss) {
+ wif->dtim_period = 1; /* XXX */
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_PUREN:
+ if ((wif->htcaps & (0x1 << WlanHTCaps_htcHt)) == 0) {
+ wif->dot11n_pure = TruthValue_false;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_AMPDU:
+ if ((wif->htcaps & (0x1 << WlanHTCaps_htcAmpdu)) == 0) {
+ wif->ampdu = WlanIfaceDot11nPduType_disabled;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_AMSDU:
+ if ((wif->htcaps & (0x1 << WlanHTCaps_htcAmsdu)) == 0) {
+ wif->amsdu = WlanIfaceDot11nPduType_disabled;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_RIFS:
+ if ((wif->htcaps & (0x1 << WlanHTCaps_htcRifs)) == 0) {
+ wif->rifs = TruthValue_false;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_SHORTGI:
+ if ((wif->htcaps & (0x1 << WlanHTCaps_shortGi20 |
+ 0x1 << WlanHTCaps_shortGi40)) == 0) {
+ wif->short_gi = TruthValue_false;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_SMPS:
+ if ((wif->htcaps & (0x1 << WlanHTCaps_htcSmps)) == 0) {
+ wif->smps_mode = wlanIfaceDot11nSMPSMode_disabled;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_TDMA_SLOT:
+ if ((wif->drivercaps & (0x1 << WlanDriverCaps_tdma)) == 0) {
+ wif->tdma_slot = 0;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_TDMA_SLOTCNT:
+ if ((wif->drivercaps & (0x1 << WlanDriverCaps_tdma)) == 0) {
+ wif->tdma_slot_count = 0;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_TDMA_SLOTLEN:
+ if ((wif->drivercaps & (0x1 << WlanDriverCaps_tdma)) == 0) {
+ wif->tdma_slot_length = 0;
+ return (-1);
+ }
+ break;
+ case IEEE80211_IOC_TDMA_BINTERVAL:
+ if ((wif->drivercaps & (0x1 << WlanDriverCaps_tdma)) == 0) {
+ wif->tdma_binterval = 0;
+ return (-1);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return (0);
+}
+
+static int
+wlan_config_get_intval(struct wlan_iface *wif, int op)
+{
+ int val = 0;
+ size_t argsize = 0;
+
+ if (wlan_config_check(wif, op) < 0)
+ return (0);
+ if (wlan_ioctl(wif->wname, op, &val, NULL, &argsize, 0) < 0)
+ return (-1);
+ wlan_config_set_snmp_intval(wif, op, val);
+
+ return (0);
+}
+
+static int
+wlan_config_set_intval(struct wlan_iface *wif, int op, int sval)
+{
+ size_t argsize = 0;
+ int val;
+
+ if (wlan_config_check(wif, op) < 0)
+ return (-1);
+ if (wlan_config_snmp2value(op, sval, &val) != SNMP_ERR_NOERROR)
+ return (-1);
+ if (wlan_ioctl(wif->wname, op, &val, NULL, &argsize, 1) < 0)
+ return (-1);
+ wlan_config_set_snmp_intval(wif, op, val);
+
+ return (0);
+}
+
+int
+wlan_config_get_ioctl(struct wlan_iface *wif, int which)
+{
+ int op;
+
+ switch (which) {
+ case LEAF_wlanIfaceCountryCode:
+ /* FALLTHROUGH */
+ case LEAF_wlanIfaceRegDomain:
+ return (wlan_config_get_country(wif));
+ case LEAF_wlanIfaceDesiredSsid:
+ return (wlan_config_get_dssid(wif));
+ case LEAF_wlanIfaceDesiredChannel:
+ return (wlan_config_get_dchannel(wif));
+ case LEAF_wlanIfaceDesiredBssid:
+ return (wlan_config_get_bssid(wif));
+ default:
+ op = wlan_config_snmp2ioctl(which);
+ return (wlan_config_get_intval(wif, op));
+ }
+
+ return (-1);
+}
+
+int
+wlan_config_set_ioctl(struct wlan_iface *wif, int which, int val,
+ char *strval, int len)
+{
+ int op;
+
+ switch (which) {
+ case LEAF_wlanIfaceCountryCode:
+ return (wlan_config_set_country(wif, strval,
+ wif->reg_domain));
+ case LEAF_wlanIfaceRegDomain:
+ return (wlan_config_set_country(wif, wif->country_code,
+ val));
+ case LEAF_wlanIfaceDesiredSsid:
+ return (wlan_config_set_dssid(wif, strval, len));
+ case LEAF_wlanIfaceDesiredChannel:
+ return (wlan_config_set_dchannel(wif, val));
+ case LEAF_wlanIfaceDesiredBssid:
+ return (wlan_config_set_bssid(wif, strval));
+ default:
+ op = wlan_config_snmp2ioctl(which);
+ return (wlan_config_set_intval(wif, op, val));
+ }
+
+ return (-1);
+}
+
+static uint32_t
+wlan_snmp_to_scan_flags(int flags)
+{
+ int sr_flags = 0;
+
+ if ((flags & (0x1 << WlanScanFlagsType_noSelection)) != 0)
+ sr_flags |= IEEE80211_IOC_SCAN_NOPICK;
+ if ((flags & (0x1 << WlanScanFlagsType_activeScan)) != 0)
+ sr_flags |= IEEE80211_IOC_SCAN_ACTIVE;
+ if ((flags & (0x1 << WlanScanFlagsType_pickFirst)) != 0)
+ sr_flags |= IEEE80211_IOC_SCAN_PICK1ST;
+ if ((flags & (0x1 << WlanScanFlagsType_backgroundScan)) != 0)
+ sr_flags |= IEEE80211_IOC_SCAN_BGSCAN;
+ if ((flags & (0x1 << WlanScanFlagsType_once)) != 0)
+ sr_flags |= IEEE80211_IOC_SCAN_ONCE;
+ if ((flags & (0x1 << WlanScanFlagsType_noBroadcast)) != 0)
+ sr_flags |= IEEE80211_IOC_SCAN_NOBCAST;
+ if ((flags & (0x1 << WlanScanFlagsType_noAutoSequencing)) != 0)
+ sr_flags |= IEEE80211_IOC_SCAN_NOJOIN;
+ if ((flags & (0x1 << WlanScanFlagsType_flushCashe)) != 0)
+ sr_flags |= IEEE80211_IOC_SCAN_FLUSH;
+ if ((flags & (0x1 << WlanScanFlagsType_chechCashe)) != 0)
+ sr_flags |= IEEE80211_IOC_SCAN_CHECK;
+
+ return (sr_flags);
+}
+
+int
+wlan_set_scan_config(struct wlan_iface *wif)
+{
+ int val = 0;
+ size_t argsize;
+ struct ieee80211_scan_req sr;
+
+
+ memset(&sr, 0, sizeof(sr));
+ argsize = sizeof(struct ieee80211_scan_req);
+ sr.sr_flags = wlan_snmp_to_scan_flags(wif->scan_flags);
+ sr.sr_flags |= IEEE80211_IOC_SCAN_BGSCAN;
+ sr.sr_duration = wif->scan_duration;
+ sr.sr_mindwell = wif->scan_mindwell;
+ sr.sr_maxdwell = wif->scan_maxdwell;
+ sr.sr_nssid = 0;
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_SCAN_REQ,
+ &val, &sr, &argsize, 1) < 0)
+ return (-1);
+
+ wif->scan_status = wlanScanConfigStatus_running;
+ return (0);
+}
+
+static uint32_t
+wlan_peercaps_to_snmp(uint32_t pcaps)
+{
+ uint32_t scaps = 0;
+
+ if ((pcaps & IEEE80211_CAPINFO_ESS) != 0)
+ scaps |= (0x1 << WlanPeerCapabilityFlags_ess);
+ if ((pcaps & IEEE80211_CAPINFO_IBSS) != 0)
+ scaps |= (0x1 << WlanPeerCapabilityFlags_ibss);
+ if ((pcaps & IEEE80211_CAPINFO_CF_POLLABLE) != 0)
+ scaps |= (0x1 << WlanPeerCapabilityFlags_cfPollable);
+ if ((pcaps & IEEE80211_CAPINFO_CF_POLLREQ) != 0)
+ scaps |= (0x1 << WlanPeerCapabilityFlags_cfPollRequest);
+ if ((pcaps & IEEE80211_CAPINFO_PRIVACY) != 0)
+ scaps |= (0x1 << WlanPeerCapabilityFlags_privacy);
+ if ((pcaps & IEEE80211_CAPINFO_SHORT_PREAMBLE) != 0)
+ scaps |= (0x1 << WlanPeerCapabilityFlags_shortPreamble);
+ if ((pcaps & IEEE80211_CAPINFO_PBCC) != 0)
+ scaps |= (0x1 << WlanPeerCapabilityFlags_pbcc);
+ if ((pcaps & IEEE80211_CAPINFO_CHNL_AGILITY) != 0)
+ scaps |= (0x1 << WlanPeerCapabilityFlags_channelAgility);
+ if ((pcaps & IEEE80211_CAPINFO_SHORT_SLOTTIME) != 0)
+ scaps |= (0x1 << WlanPeerCapabilityFlags_shortSlotTime);
+ if ((pcaps & IEEE80211_CAPINFO_RSN) != 0)
+ scaps |= (0x1 << WlanPeerCapabilityFlags_rsn);
+ if ((pcaps & IEEE80211_CAPINFO_DSSSOFDM) != 0)
+ scaps |= (0x1 << WlanPeerCapabilityFlags_dsssofdm);
+
+ return (scaps);
+}
+
+static int
+wlan_add_new_scan_result(struct wlan_iface *wif,
+ const struct ieee80211req_scan_result *isr, uint8_t *ssid)
+{
+ struct wlan_scan_result *sr;
+
+ if ((sr = wlan_scan_new_result(ssid, isr->isr_bssid)) == NULL)
+ return (-1);
+
+ sr->opchannel = wlan_channel_flags_to_snmp_phy(isr->isr_flags);
+ sr->rssi = isr->isr_rssi;
+ sr->frequency = isr->isr_freq;
+ sr->noise = isr->isr_noise;
+ sr->bintval = isr->isr_intval;
+ sr->capinfo = wlan_peercaps_to_snmp(isr->isr_capinfo);
+
+ if (wlan_scan_add_result(wif, sr) < 0) {
+ wlan_scan_free_result(sr);
+ return (-1);
+ }
+
+ return (0);
+}
+
+int
+wlan_get_scan_results(struct wlan_iface *wif)
+{
+ int ssidlen, val = 0;
+ uint8_t buf[24 * 1024];
+ size_t argsize;
+ const uint8_t *cp, *idp;
+ uint8_t ssid[IEEE80211_NWID_LEN + 1];
+ struct ieee80211req_scan_result isr;
+
+ argsize = sizeof(buf);
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_SCAN_RESULTS, &val, &buf,
+ &argsize, 0) < 0)
+ return (-1);
+
+ if (argsize < sizeof(struct ieee80211req_scan_result))
+ return (0);
+
+ cp = buf;
+ do {
+ memcpy(&isr, cp, sizeof(struct ieee80211req_scan_result));
+ memset(ssid, 0, IEEE80211_NWID_LEN + 1);
+
+ if (isr.isr_meshid_len) {
+ idp = cp + isr.isr_ie_off + isr.isr_ssid_len;
+ ssidlen = isr.isr_meshid_len;
+ } else {
+ idp = cp + isr.isr_ie_off;
+ ssidlen = isr.isr_ssid_len;
+ }
+ if (ssidlen > IEEE80211_NWID_LEN)
+ ssidlen = IEEE80211_NWID_LEN;
+ memcpy(ssid, idp, ssidlen);
+ ssid[IEEE80211_NWID_LEN] = '\0';
+ (void)wlan_add_new_scan_result(wif, &isr, ssid);
+ cp += isr.isr_len;
+ argsize -= isr.isr_len;
+ } while (argsize >= sizeof(struct ieee80211req_scan_result));
+
+ return (0);
+}
+
+int
+wlan_get_stats(struct wlan_iface *wif)
+{
+ struct ifreq ifr;
+
+ memset(&ifr, 0, sizeof(struct ifreq));
+ strlcpy(ifr.ifr_name, wif->wname, IFNAMSIZ);
+
+ ifr.ifr_data = (caddr_t) &wif->stats;
+
+ if (ioctl(sock, SIOCG80211STATS, &ifr) < 0) {
+ syslog(LOG_ERR, "iface %s - ioctl(SIOCG80211STATS) failed: %s",
+ wif->wname, strerror(errno));
+ return (-1);
+ }
+
+ return (0);
+}
+
+int
+wlan_get_wepmode(struct wlan_iface *wif)
+{
+ int val = 0;
+ size_t argsize = 0;
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_WEP, &val, NULL,
+ &argsize, 0) < 0 || val == IEEE80211_WEP_NOSUP) {
+ wif->wepsupported = 0; /* XXX */
+ wif->wepmode = wlanWepMode_off;
+ wif->weptxkey = 0;
+ return (-1);
+ }
+
+ wif->wepsupported = 1;
+
+ switch (val) {
+ case IEEE80211_WEP_ON:
+ wif->wepmode = wlanWepMode_on;
+ break;
+ case IEEE80211_WEP_MIXED:
+ wif->wepmode = wlanWepMode_mixed;
+ break;
+ case IEEE80211_WEP_OFF:
+ /* FALLTHROUGH */
+ default:
+ wif->wepmode = wlanWepMode_off;
+ break;
+ }
+
+ return (0);
+}
+
+int
+wlan_set_wepmode(struct wlan_iface *wif)
+{
+ int val;
+ size_t argsize = 0;
+
+ if (!wif->wepsupported)
+ return (-1);
+
+ switch (wif->wepmode) {
+ case wlanWepMode_off:
+ val = IEEE80211_WEP_OFF;
+ break;
+ case wlanWepMode_on:
+ val = IEEE80211_WEP_ON;
+ break;
+ case wlanWepMode_mixed:
+ val = IEEE80211_WEP_MIXED;
+ break;
+ default:
+ return (-1);
+ }
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_WEP, &val, NULL,
+ &argsize, 1) < 0)
+ return (-1);
+
+ return (0);
+}
+
+int
+wlan_get_weptxkey(struct wlan_iface *wif)
+{
+ int val;
+ size_t argsize = 0;
+
+ if (!wif->wepsupported)
+ return (0);
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_WEPTXKEY, &val, NULL,
+ &argsize, 0) < 0)
+ return (-1);
+
+ if (val == IEEE80211_KEYIX_NONE)
+ wif->weptxkey = 0;
+ else
+ wif->weptxkey = val + 1;
+
+ return (0);
+}
+
+int
+wlan_set_weptxkey(struct wlan_iface *wif)
+{
+ int val;
+ size_t argsize = 0;
+
+ if (!wif->wepsupported)
+ return (0);
+
+ if (wif->weptxkey >= IEEE80211_WEP_NKID)
+ return (-1);
+
+ if (wif->weptxkey == 0)
+ val = IEEE80211_KEYIX_NONE;
+ else
+ val = wif->weptxkey - 1;
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_WEPTXKEY, &val, NULL,
+ &argsize, 1) < 0)
+ return (-1);
+
+ return (0);
+}
+
+int
+wlan_get_wepkeys(struct wlan_iface *wif __unused)
+{
+ /* XXX: should they be visible via SNMP */
+ return (0);
+}
+
+int
+wlan_set_wepkeys(struct wlan_iface *wif __unused)
+{
+ /* XXX: should they be configurable via SNMP */
+ return (0);
+}
+
+int
+wlan_get_mac_policy(struct wlan_iface *wif)
+{
+ int val = IEEE80211_MACCMD_POLICY;
+ size_t argsize = 0;
+ struct ieee80211req ireq;
+
+ memset(&ireq, 0, sizeof(struct ieee80211req));
+ strlcpy(ireq.i_name, wif->wname, IFNAMSIZ);
+ ireq.i_type = IEEE80211_IOC_MACCMD;
+ ireq.i_val = IEEE80211_MACCMD_POLICY;
+
+ if (ioctl(sock, SIOCG80211, &ireq) < 0) {
+ if (errno != EINVAL) {
+ syslog(LOG_ERR, "iface %s - get param: ioctl(%d) "
+ "failed: %s", wif->wname, ireq.i_type,
+ strerror(errno));
+ wif->macsupported = 0;
+ return (-1);
+ } else {
+ wif->macsupported = 1;
+ wif->mac_policy = wlanMACAccessControlPolicy_open;
+ return (0);
+ }
+
+ }
+
+ wif->macsupported = 1;
+
+ switch (val) {
+ case IEEE80211_MACCMD_POLICY_ALLOW:
+ wif->mac_policy = wlanMACAccessControlPolicy_allow;
+ break;
+ case IEEE80211_MACCMD_POLICY_DENY:
+ wif->mac_policy = wlanMACAccessControlPolicy_deny;
+ break;
+ case IEEE80211_MACCMD_POLICY_RADIUS:
+ wif->mac_policy = wlanMACAccessControlPolicy_radius;
+ break;
+ case IEEE80211_MACCMD_POLICY_OPEN:
+ /* FALLTHROUGH */
+ default:
+ wif->mac_policy = wlanMACAccessControlPolicy_open;
+ break;
+ }
+
+ argsize = 0;
+ val = IEEE80211_MACCMD_LIST;
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_MACCMD, &val, NULL,
+ &argsize, 0) < 0)
+ return (-1);
+
+ wif->mac_nacls = argsize / sizeof(struct ieee80211req_maclist *);
+ return (0);
+}
+
+int
+wlan_set_mac_policy(struct wlan_iface *wif)
+{
+ int val;
+ size_t argsize = 0;
+
+ if (!wif->macsupported)
+ return (-1);
+
+ switch (wif->mac_policy) {
+ case wlanMACAccessControlPolicy_allow:
+ val = IEEE80211_MACCMD_POLICY_ALLOW;
+ break;
+ case wlanMACAccessControlPolicy_deny:
+ val = IEEE80211_MACCMD_POLICY_DENY;
+ break;
+ case wlanMACAccessControlPolicy_radius:
+ val = IEEE80211_MACCMD_POLICY_RADIUS;
+ break;
+ case wlanMACAccessControlPolicy_open:
+ val = IEEE80211_MACCMD_POLICY_OPEN;
+ break;
+ default:
+ return (-1);
+ }
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_MACCMD, &val, NULL,
+ &argsize, 1) < 0)
+ return (-1);
+
+ return (0);
+}
+
+int
+wlan_flush_mac_mac(struct wlan_iface *wif)
+{
+ int val = IEEE80211_MACCMD_FLUSH;
+ size_t argsize = 0;
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_MACCMD, &val, NULL,
+ &argsize, 1) < 0)
+ return (-1);
+
+ return (0);
+}
+
+static int
+wlan_add_mac_macinfo(struct wlan_iface *wif,
+ const struct ieee80211req_maclist *ml)
+{
+ struct wlan_mac_mac *mmac;
+
+ if ((mmac = wlan_mac_new_mac(ml->ml_macaddr)) == NULL)
+ return (-1);
+
+ mmac->mac_status = RowStatus_active;
+ if (wlan_mac_add_mac(wif, mmac) < 0) {
+ wlan_mac_free_mac(mmac);
+ return (-1);
+ }
+
+ return (0);
+}
+
+int
+wlan_get_mac_acl_macs(struct wlan_iface *wif)
+{
+ int i, nacls, val = IEEE80211_MACCMD_LIST;
+ size_t argsize = 0;
+ uint8_t *data;
+ struct ieee80211req ireq;
+ const struct ieee80211req_maclist *acllist;
+
+ if (wif->mac_policy == wlanMACAccessControlPolicy_radius) {
+ wif->mac_nacls = 0;
+ return (0);
+ }
+
+ memset(&ireq, 0, sizeof(struct ieee80211req));
+ strlcpy(ireq.i_name, wif->wname, IFNAMSIZ);
+ ireq.i_type = IEEE80211_IOC_MACCMD;
+ ireq.i_val = IEEE80211_MACCMD_LIST;
+
+
+ if (ioctl(sock, SIOCG80211, &ireq) < 0) {
+ if (errno != EINVAL) {
+ syslog(LOG_ERR, "iface %s - get param: ioctl(%d) "
+ "failed: %s", wif->wname, ireq.i_type,
+ strerror(errno));
+ wif->macsupported = 0;
+ return (-1);
+ }
+ }
+
+ if (argsize == 0) {
+ wif->mac_nacls = 0;
+ return (0);
+ }
+
+ if ((data = (uint8_t *)malloc(argsize)) == NULL)
+ return (-1);
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_MACCMD, &val, data,
+ &argsize, 0) < 0)
+ return (-1);
+
+ nacls = argsize / sizeof(*acllist);
+ acllist = (struct ieee80211req_maclist *) data;
+ for (i = 0; i < nacls; i++)
+ (void)wlan_add_mac_macinfo(wif, acllist + i);
+
+ wif->mac_nacls = nacls;
+ return (0);
+}
+
+int
+wlan_add_mac_acl_mac(struct wlan_iface *wif, struct wlan_mac_mac *mmac)
+{
+ int val = 0;
+ size_t argsize = IEEE80211_ADDR_LEN;
+ struct ieee80211req_mlme mlme;
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_ADDMAC, &val,
+ mmac->mac, &argsize, 1) < 0)
+ return (-1);
+
+ mmac->mac_status = RowStatus_active;
+
+ /* If policy is deny, try to kick the station just in case. */
+ if (wif->mac_policy != wlanMACAccessControlPolicy_deny)
+ return (0);
+
+ memset(&mlme, 0, sizeof(mlme));
+ mlme.im_op = IEEE80211_MLME_DEAUTH;
+ mlme.im_reason = IEEE80211_REASON_AUTH_EXPIRE;
+ memcpy(mlme.im_macaddr, mmac->mac, IEEE80211_ADDR_LEN);
+ argsize = sizeof(struct ieee80211req_mlme);
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_MLME, &val, &mlme,
+ &argsize, 1) < 0 && errno != ENOENT)
+ return (-1);
+
+ return (0);
+}
+
+int
+wlan_del_mac_acl_mac(struct wlan_iface *wif, struct wlan_mac_mac *mmac)
+{
+ int val = 0;
+ size_t argsize = IEEE80211_ADDR_LEN;
+ struct ieee80211req_mlme mlme;
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_DELMAC, &val,
+ mmac->mac, &argsize, 1) < 0)
+ return (-1);
+
+ mmac->mac_status = RowStatus_active;
+
+ /* If policy is allow, try to kick the station just in case. */
+ if (wif->mac_policy != wlanMACAccessControlPolicy_allow)
+ return (0);
+
+ memset(&mlme, 0, sizeof(mlme));
+ mlme.im_op = IEEE80211_MLME_DEAUTH;
+ mlme.im_reason = IEEE80211_REASON_AUTH_EXPIRE;
+ memcpy(mlme.im_macaddr, mmac->mac, IEEE80211_ADDR_LEN);
+ argsize = sizeof(struct ieee80211req_mlme);
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_MLME, &val, &mlme,
+ &argsize, 1) < 0 && errno != ENOENT)
+ return (-1);
+
+ return (0);
+}
+
+int
+wlan_peer_set_vlan(struct wlan_iface *wif, struct wlan_peer *wip, int vlan)
+{
+ int val = 0;
+ size_t argsize;
+ struct ieee80211req_sta_vlan vreq;
+
+ memcpy(vreq.sv_macaddr, wip->pmac, IEEE80211_ADDR_LEN);
+ vreq.sv_vlan = vlan;
+ argsize = sizeof(struct ieee80211req_sta_vlan);
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_STA_VLAN,
+ &val, &vreq, &argsize, 1) < 0)
+ return (-1);
+
+ wip->vlan = vlan;
+
+ return (0);
+}
+
+/* XXX */
+#ifndef IEEE80211_NODE_AUTH
+#define IEEE80211_NODE_AUTH 0x000001 /* authorized for data */
+#define IEEE80211_NODE_QOS 0x000002 /* QoS enabled */
+#define IEEE80211_NODE_ERP 0x000004 /* ERP enabled */
+#define IEEE80211_NODE_PWR_MGT 0x000010 /* power save mode enabled */
+#define IEEE80211_NODE_AREF 0x000020 /* authentication ref held */
+#define IEEE80211_NODE_HT 0x000040 /* HT enabled */
+#define IEEE80211_NODE_HTCOMPAT 0x000080 /* HT setup w/ vendor OUI's */
+#define IEEE80211_NODE_WPS 0x000100 /* WPS association */
+#define IEEE80211_NODE_TSN 0x000200 /* TSN association */
+#define IEEE80211_NODE_AMPDU_RX 0x000400 /* AMPDU rx enabled */
+#define IEEE80211_NODE_AMPDU_TX 0x000800 /* AMPDU tx enabled */
+#define IEEE80211_NODE_MIMO_PS 0x001000 /* MIMO power save enabled */
+#define IEEE80211_NODE_MIMO_RTS 0x002000 /* send RTS in MIMO PS */
+#define IEEE80211_NODE_RIFS 0x004000 /* RIFS enabled */
+#define IEEE80211_NODE_SGI20 0x008000 /* Short GI in HT20 enabled */
+#define IEEE80211_NODE_SGI40 0x010000 /* Short GI in HT40 enabled */
+#define IEEE80211_NODE_ASSOCID 0x020000 /* xmit requires associd */
+#define IEEE80211_NODE_AMSDU_RX 0x040000 /* AMSDU rx enabled */
+#define IEEE80211_NODE_AMSDU_TX 0x080000 /* AMSDU tx enabled */
+#endif
+
+static uint32_t
+wlan_peerstate_to_snmp(uint32_t pstate)
+{
+ uint32_t sstate = 0;
+
+ if ((pstate & IEEE80211_NODE_AUTH) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_authorizedForData);
+ if ((pstate & IEEE80211_NODE_QOS) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_qosEnabled);
+ if ((pstate & IEEE80211_NODE_ERP) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_erpEnabled);
+ if ((pstate & IEEE80211_NODE_PWR_MGT) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_powerSaveMode);
+ if ((pstate & IEEE80211_NODE_AREF) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_authRefHeld);
+ if ((pstate & IEEE80211_NODE_HT) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_htEnabled);
+ if ((pstate & IEEE80211_NODE_HTCOMPAT) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_htCompat);
+ if ((pstate & IEEE80211_NODE_WPS) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_wpsAssoc);
+ if ((pstate & IEEE80211_NODE_TSN) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_tsnAssoc);
+ if ((pstate & IEEE80211_NODE_AMPDU_RX) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_ampduRx);
+ if ((pstate & IEEE80211_NODE_AMPDU_TX) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_ampduTx);
+ if ((pstate & IEEE80211_NODE_MIMO_PS) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_mimoPowerSave);
+ if ((pstate & IEEE80211_NODE_MIMO_RTS) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_sendRts);
+ if ((pstate & IEEE80211_NODE_RIFS) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_rifs);
+ if ((pstate & IEEE80211_NODE_SGI20) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_shortGiHT20);
+ if ((pstate & IEEE80211_NODE_SGI40) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_shortGiHT40);
+ if ((pstate & IEEE80211_NODE_AMSDU_RX) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_amsduRx);
+ if ((pstate & IEEE80211_NODE_AMSDU_TX) != 0)
+ sstate |= (0x1 << WlanIfacePeerFlagsType_amsduTx);
+
+ return (sstate);
+}
+
+static struct wlan_peer *
+wlan_add_peerinfo(const struct ieee80211req_sta_info *si)
+{
+ struct wlan_peer *wip;
+
+ if ((wip = wlan_new_peer(si->isi_macaddr))== NULL)
+ return (NULL);
+
+ wip->associd = IEEE80211_AID(si->isi_associd);
+ wip->vlan = si->isi_vlan;
+ wip->frequency = si->isi_freq;
+ wip->fflags = si->isi_flags;
+ wip->txrate = si->isi_txrate;
+ wip->rssi = si->isi_rssi;
+ wip->idle = si->isi_inact;
+ wip->txseqs = si->isi_txseqs[0]; /* XXX */
+ wip->rxseqs = si->isi_rxseqs[0]; /* XXX */
+ wip->txpower = si->isi_txpower;
+ wip->capinfo = wlan_peercaps_to_snmp(si->isi_capinfo);
+ wip->state = wlan_peerstate_to_snmp(si->isi_state);
+ wip->local_id = si->isi_localid;
+ wip->peer_id = si->isi_peerid;
+
+ return (wip);
+}
+
+int
+wlan_get_peerinfo(struct wlan_iface *wif)
+{
+ union {
+ struct ieee80211req_sta_req req;
+ uint8_t buf[24 * 1024];
+ } u;
+ const uint8_t *cp;
+ int val = 0;
+ size_t len;
+ struct ieee80211req_sta_info si;
+ struct wlan_peer *wip;
+
+ /* Get all stations - broadcast address */
+ (void) memset(u.req.is_u.macaddr, 0xff, IEEE80211_ADDR_LEN);
+ len = sizeof(u);
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_STA_INFO,
+ & val, &u, &len, 0) < 0)
+ return (-1);
+
+ if (len < sizeof(struct ieee80211req_sta_info))
+ return (-1);
+
+ cp = (const uint8_t *) u.req.info;
+ do {
+ memcpy(&si, cp, sizeof(struct ieee80211req_sta_info));
+ if ((wip = wlan_add_peerinfo(&si)) != NULL &&
+ wlan_add_peer(wif, wip) < 0)
+ wlan_free_peer(wip);
+ cp += si.isi_len, len -= si.isi_len;
+ } while (len >= sizeof(struct ieee80211req_sta_info));
+
+ return (0);
+}
+
+/************************************************************************
+ * Wireless MESH & HWMP sysctl config.
+ */
+const char wlan_sysctl_name[] = "net.wlan.";
+
+static const char *wlan_sysctl[] = {
+ "mesh.retrytimeout",
+ "mesh.holdingtimeout",
+ "mesh.confirmtimeout",
+ "mesh.maxretries",
+ "hwmp.targetonly",
+ "hwmp.replyforward",
+ "hwmp.pathlifetime",
+ "hwmp.roottimeout",
+ "hwmp.rootint",
+ "hwmp.rannint",
+ "hwmp.inact",
+};
+
+int32_t
+wlan_do_sysctl(struct wlan_config *cfg, enum wlan_syscl which, int set)
+{
+ char mib_name[100];
+ int val, sval;
+ size_t len, vlen;
+
+ if (set) {
+ vlen = sizeof(sval);
+ switch (which) {
+ case WLAN_MESH_RETRY_TO:
+ sval = cfg->mesh_retryto;
+ break;
+ case WLAN_MESH_HOLDING_TO:
+ sval = cfg->mesh_holdingto;
+ break;
+ case WLAN_MESH_CONFIRM_TO:
+ sval = cfg->mesh_confirmto;
+ break;
+ case WLAN_MESH_MAX_RETRIES:
+ sval = cfg->mesh_maxretries;
+ break;
+ case WLAN_HWMP_TARGET_ONLY:
+ sval = cfg->hwmp_targetonly;
+ break;
+ case WLAN_HWMP_REPLY_FORWARD:
+ sval = cfg->hwmp_replyforward;
+ break;
+ case WLAN_HWMP_PATH_LIFETIME:
+ sval = cfg->hwmp_pathlifetime;
+ break;
+ case WLAN_HWMP_ROOT_TO:
+ sval = cfg->hwmp_roottimeout;
+ break;
+ case WLAN_HWMP_ROOT_INT:
+ sval = cfg->hwmp_rootint;
+ break;
+ case WLAN_HWMP_RANN_INT:
+ sval = cfg->hwmp_rannint;
+ break;
+ case WLAN_HWMP_INACTIVITY_TO:
+ sval = cfg->hwmp_inact;
+ break;
+ default:
+ return (-1);
+ }
+ } else {
+ if (which >= WLAN_SYSCTL_MAX)
+ return (-1);
+ vlen = 0;
+ }
+
+ strlcpy(mib_name, wlan_sysctl_name, sizeof(mib_name));
+ strlcat(mib_name, wlan_sysctl[which], sizeof(mib_name));
+ len = sizeof (val);
+
+ if (sysctlbyname(mib_name, &val, &len, (set? &sval : NULL), vlen) < 0) {
+ syslog(LOG_ERR, "sysctl(%s) failed - %s", mib_name,
+ strerror(errno));
+ return (-1);
+ }
+
+ switch (which) {
+ case WLAN_MESH_RETRY_TO:
+ cfg->mesh_retryto = val;
+ break;
+ case WLAN_MESH_HOLDING_TO:
+ cfg->mesh_holdingto = val;
+ break;
+ case WLAN_MESH_CONFIRM_TO:
+ cfg->mesh_confirmto = val;
+ break;
+ case WLAN_MESH_MAX_RETRIES:
+ cfg->mesh_maxretries = val;
+ break;
+ case WLAN_HWMP_TARGET_ONLY:
+ cfg->hwmp_targetonly = val;
+ break;
+ case WLAN_HWMP_REPLY_FORWARD:
+ cfg->hwmp_replyforward = val;
+ break;
+ case WLAN_HWMP_PATH_LIFETIME:
+ cfg->hwmp_pathlifetime = val;
+ break;
+ case WLAN_HWMP_ROOT_TO:
+ cfg->hwmp_roottimeout = val;
+ break;
+ case WLAN_HWMP_ROOT_INT:
+ cfg->hwmp_rootint = val;
+ break;
+ case WLAN_HWMP_RANN_INT:
+ cfg->hwmp_rannint = val;
+ break;
+ case WLAN_HWMP_INACTIVITY_TO:
+ cfg->hwmp_inact = val;
+ break;
+ default:
+ /* NOTREACHED */
+ abort();
+ }
+
+ return (0);
+}
+
+int
+wlan_mesh_config_get(struct wlan_iface *wif, int which)
+{
+ int op, val = 0;
+ size_t argsize = 0;
+ uint8_t data[32], *pd = NULL;
+
+ switch (which) {
+ case LEAF_wlanMeshTTL:
+ op = IEEE80211_IOC_MESH_TTL;
+ break;
+ case LEAF_wlanMeshPeeringEnabled:
+ op = IEEE80211_IOC_MESH_AP;
+ break;
+ case LEAF_wlanMeshForwardingEnabled:
+ op = IEEE80211_IOC_MESH_FWRD;
+ break;
+ case LEAF_wlanMeshMetric:
+ op = IEEE80211_IOC_MESH_PR_METRIC;
+ pd = data;
+ argsize = sizeof(data);
+ break;
+ case LEAF_wlanMeshPath:
+ op = IEEE80211_IOC_MESH_PR_PATH;
+ pd = data;
+ argsize = sizeof(data);
+ break;
+ case LEAF_wlanMeshRoutesFlush:
+ return (0);
+ default:
+ return (-1);
+ }
+
+ if (wlan_ioctl(wif->wname, op, &val, pd, &argsize, 0) < 0)
+ return (-1);
+
+ switch (which) {
+ case LEAF_wlanMeshTTL:
+ wif->mesh_ttl = val;
+ break;
+ case LEAF_wlanMeshPeeringEnabled:
+ if (val)
+ wif->mesh_peering = wlanMeshPeeringEnabled_true;
+ else
+ wif->mesh_peering = wlanMeshPeeringEnabled_false;
+ break;
+ case LEAF_wlanMeshForwardingEnabled:
+ if (val)
+ wif->mesh_forwarding = wlanMeshForwardingEnabled_true;
+ else
+ wif->mesh_forwarding = wlanMeshForwardingEnabled_false;
+ break;
+ case LEAF_wlanMeshMetric:
+ data[argsize] = '\0';
+ if (strcmp(data, "AIRTIME") == 0)
+ wif->mesh_metric = wlanMeshMetric_airtime;
+ else
+ wif->mesh_metric = wlanMeshMetric_unknown;
+ break;
+ case LEAF_wlanMeshPath:
+ data[argsize] = '\0';
+ if (strcmp(data, "HWMP") == 0)
+ wif->mesh_path = wlanMeshPath_hwmp;
+ else
+ wif->mesh_path = wlanMeshPath_unknown;
+ }
+
+ return (0);
+}
+
+int
+wlan_mesh_config_set(struct wlan_iface *wif, int which)
+{
+ int op, val = 0;
+ size_t argsize = 0;
+ uint8_t data[32], *pd = NULL;
+
+ switch (which) {
+ case LEAF_wlanMeshTTL:
+ op = IEEE80211_IOC_MESH_TTL;
+ val = wif->mesh_ttl;
+ break;
+ case LEAF_wlanMeshPeeringEnabled:
+ op = IEEE80211_IOC_MESH_AP;
+ if (wif->mesh_peering == wlanMeshPeeringEnabled_true)
+ val = 1;
+ break;
+ case LEAF_wlanMeshForwardingEnabled:
+ if (wif->mesh_forwarding == wlanMeshForwardingEnabled_true)
+ val = 1;
+ op = IEEE80211_IOC_MESH_FWRD;
+ break;
+ case LEAF_wlanMeshMetric:
+ op = IEEE80211_IOC_MESH_PR_METRIC;
+ if (wif->mesh_metric == wlanMeshMetric_airtime)
+ strcpy(data, "AIRTIME");
+ else
+ return (-1);
+ pd = data;
+ argsize = sizeof(data);
+ break;
+ case LEAF_wlanMeshPath:
+ op = IEEE80211_IOC_MESH_PR_PATH;
+ if (wif->mesh_path == wlanMeshPath_hwmp)
+ strcpy(data, "HWMP");
+ else
+ return (-1);
+ pd = data;
+ argsize = sizeof(data);
+ break;
+ default:
+ return (-1);
+ }
+
+ if (wlan_ioctl(wif->wname, op, &val, pd, &argsize, 1) < 0)
+ return (-1);
+
+ return(0);
+}
+
+int
+wlan_mesh_flush_routes(struct wlan_iface *wif)
+{
+ int val = IEEE80211_MESH_RTCMD_FLUSH;
+ size_t argsize = 0;
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_MESH_RTCMD, &val, NULL,
+ &argsize, 1) < 0)
+ return (-1);
+
+ return (0);
+}
+
+int
+wlan_mesh_add_route(struct wlan_iface *wif, struct wlan_mesh_route *wmr)
+{
+ int val = IEEE80211_MESH_RTCMD_ADD;
+ size_t argsize = IEEE80211_ADDR_LEN;
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_MESH_RTCMD, &val,
+ wmr->imroute.imr_dest, &argsize, 1) < 0)
+ return (-1);
+
+ wmr->mroute_status = RowStatus_active;
+
+ return (0);
+}
+
+int
+wlan_mesh_del_route(struct wlan_iface *wif, struct wlan_mesh_route *wmr)
+{
+ int val = IEEE80211_MESH_RTCMD_DELETE;
+ size_t argsize = IEEE80211_ADDR_LEN;
+
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_MESH_RTCMD, &val,
+ wmr->imroute.imr_dest, &argsize, 1) < 0)
+ return (-1);
+
+ wmr->mroute_status = RowStatus_destroy;
+
+ return (0);
+}
+
+int
+wlan_mesh_get_routelist(struct wlan_iface *wif)
+{
+ int i, nroutes, val = IEEE80211_MESH_RTCMD_LIST;
+ size_t argsize;
+ struct ieee80211req_mesh_route routes[128];
+ struct ieee80211req_mesh_route *rt;
+ struct wlan_mesh_route *wmr;
+
+ argsize = sizeof(routes);
+ if (wlan_ioctl(wif->wname, IEEE80211_IOC_MESH_RTCMD, &val, routes,
+ &argsize, 0) < 0) /* XXX: ENOMEM? */
+ return (-1);
+
+ nroutes = argsize / sizeof(*rt);
+ for (i = 0; i < nroutes; i++) {
+ rt = routes + i;
+ if ((wmr = wlan_mesh_new_route(rt->imr_dest)) == NULL)
+ return (-1);
+ memcpy(&wmr->imroute, rt, sizeof(*rt));
+ wmr->mroute_status = RowStatus_active;
+ if (wlan_mesh_add_rtentry(wif, wmr) < 0)
+ wlan_mesh_free_route(wmr);
+ }
+
+ return (0);
+}
+
+int
+wlan_hwmp_config_get(struct wlan_iface *wif, int which)
+{
+ int op, val = 0;
+ size_t argsize = 0;
+
+ switch (which) {
+ case LEAF_wlanHWMPRootMode:
+ op = IEEE80211_IOC_HWMP_ROOTMODE;
+ break;
+ case LEAF_wlanHWMPMaxHops:
+ op = IEEE80211_IOC_HWMP_MAXHOPS;
+ break;
+ default:
+ return (-1);
+ }
+
+ if (wlan_ioctl(wif->wname, op, &val, NULL, &argsize, 0) < 0)
+ return (-1);
+
+ switch (which) {
+ case LEAF_wlanHWMPRootMode:
+ switch (val) {
+ case IEEE80211_HWMP_ROOTMODE_NORMAL:
+ wif->hwmp_root_mode = wlanHWMPRootMode_normal;
+ break;
+ case IEEE80211_HWMP_ROOTMODE_PROACTIVE:
+ wif->hwmp_root_mode = wlanHWMPRootMode_proactive;
+ break;
+ case IEEE80211_HWMP_ROOTMODE_RANN:
+ wif->hwmp_root_mode = wlanHWMPRootMode_rann;
+ break;
+ case IEEE80211_HWMP_ROOTMODE_DISABLED:
+ default:
+ wif->hwmp_root_mode = wlanHWMPRootMode_disabled;
+ break;
+ }
+ break;
+ case LEAF_wlanHWMPMaxHops:
+ wif->hwmp_max_hops = val;
+ break;
+ }
+
+ return (0);
+}
+
+int
+wlan_hwmp_config_set(struct wlan_iface *wif, int which)
+{
+ int op, val = 0;
+ size_t argsize = 0;
+
+ switch (which) {
+ case LEAF_wlanHWMPRootMode:
+ op = IEEE80211_IOC_HWMP_ROOTMODE;
+ switch (wif->hwmp_root_mode) {
+ case wlanHWMPRootMode_disabled:
+ val = IEEE80211_HWMP_ROOTMODE_DISABLED;
+ break;
+ case wlanHWMPRootMode_normal:
+ val = IEEE80211_HWMP_ROOTMODE_NORMAL;
+ break;
+ case wlanHWMPRootMode_proactive:
+ val = IEEE80211_HWMP_ROOTMODE_PROACTIVE;
+ break;
+ case wlanHWMPRootMode_rann:
+ val = IEEE80211_HWMP_ROOTMODE_RANN;
+ break;
+ default:
+ return (-1);
+ }
+ break;
+ case LEAF_wlanHWMPMaxHops:
+ op = IEEE80211_IOC_HWMP_MAXHOPS;
+ val = wif->hwmp_max_hops;
+ break;
+ default:
+ return (-1);
+ }
+
+ if (wlan_ioctl(wif->wname, op, &val, NULL, &argsize, 1) < 0)
+ return (-1);
+
+ return (0);
+}
diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def
new file mode 100644
index 0000000..f267f76
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def
@@ -0,0 +1,675 @@
+#-
+# Copyright (C) 2010 The FreeBSD Foundation
+# All rights reserved.
+#
+# This software was developed by Shteryana Sotirova Shopova under
+# sponsorship from the FreeBSD Foundation.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+typedef RowStatus ENUM (
+ 1 active
+ 2 notInService
+ 3 notReady
+ 4 createAndGo
+ 5 createAndWait
+ 6 destroy
+)
+
+typedef TruthValue ENUM (
+ 1 true
+ 2 false
+)
+
+typedef WlanRegDomainCode ENUM (
+ 1 fcc
+ 2 ca
+ 3 etsi
+ 4 etsi2
+ 5 etsi3
+ 6 fcc3
+ 7 japan
+ 8 korea
+ 9 apac
+ 10 apac2
+ 11 apac3
+ 12 row
+ 13 none
+ 14 debug
+ 15 sr9
+ 16 xr9
+ 17 gz901
+)
+
+typedef WlanMgmtReasonCode ENUM (
+ 1 unspecified
+ 2 authenticationExpire
+ 3 authenticationLeave
+ 4 associationExpire
+ 5 associationTooMany
+ 6 notAuthenticated
+ 7 notAssociated
+ 8 associationLeave
+ 9 associationNotAuthenticated
+ 10 dissasocPwrcapBad
+ 11 dissasocSuperchanBad
+ 13 ieInvalid
+ 14 micFailure
+ 15 fourWayHandshakeTimeout
+ 16 groupKeyUpdateTimeout
+ 17 ieIn4FourWayDiffers
+ 18 groupCipherInvalid
+ 19 pairwiseCiherInvalid
+ 20 akmpInvalid
+ 21 unsupportedRsnIeVersion
+ 22 invalidRsnIeCap
+ 23 dot1xAuthFailed
+ 24 cipherSuiteRejected
+ 32 unspeciffiedQos
+ 33 insufficientBw
+ 34 tooManyFrames
+ 35 outsideTxOp
+ 36 leavingQbss
+ 37 badMechanism
+ 38 setupNeeded
+ 39 timeout
+)
+
+typedef WlanIfaceOperatingModeType ENUM (
+ 0 ibss
+ 1 station
+ 2 wds
+ 3 adhocDemo
+ 4 hostAp
+ 5 monitor
+ 6 meshPoint
+ 7 tdma
+)
+
+typedef WlanIfaceFlagsType BITS (
+ 1 uniqueBssid
+ 2 noBeacons
+ 3 wdsLegacy
+)
+
+typedef WlanDriverCaps BITS (
+ 1 station
+ 2 ieee8023encap
+ 3 athFastFrames
+ 4 athTurbo
+ 5 ibss
+ 6 pmgt
+ 7 hostAp
+ 8 ahDemo
+ 9 swRetry
+ 10 txPmgt
+ 11 shortSlot
+ 12 shortPreamble
+ 13 monitor
+ 14 dfs
+ 15 mbss
+ 16 wpa1
+ 17 wpa2
+ 18 burst
+ 19 wme
+ 20 wds
+ 21 bgScan
+ 22 txFrag
+ 23 tdma
+)
+
+typedef WlanCryptoCaps BITS (
+ 1 wep
+ 2 tkip
+ 3 aes
+ 4 aesCcm
+ 5 tkipMic
+ 6 ckip
+)
+
+typedef WlanHTCaps BITS (
+ 1 ldpc
+ 2 chwidth40
+ 3 greenField
+ 4 shortGi20
+ 5 shortGi40
+ 6 txStbc
+ 7 delba
+ 8 amsdu7935
+ 9 dssscck40
+ 10 psmp
+ 11 fortyMHzIntolerant
+ 12 lsigTxOpProt
+ 13 htcAmpdu
+ 14 htcAmsdu
+ 15 htcHt
+ 16 htcSmps
+ 17 htcRifs
+)
+
+typedef WlanIfaceDot11nPduType ENUM (
+ 0 disabled
+ 1 rxOnly
+ 2 txOnly
+ 3 txAndRx
+)
+
+typedef WlanPeerCapabilityFlags BITS (
+ 1 ess
+ 2 ibss
+ 3 cfPollable
+ 4 cfPollRequest
+ 5 privacy
+ 6 shortPreamble
+ 7 pbcc
+ 8 channelAgility
+ 9 shortSlotTime
+ 10 rsn
+ 11 dsssofdm
+)
+
+typedef WlanIfacePeerFlagsType BITS (
+ 1 authorizedForData
+ 2 qosEnabled
+ 3 erpEnabled
+ 4 powerSaveMode
+ 5 authRefHeld
+ 6 htEnabled
+ 7 htCompat
+ 8 wpsAssoc
+ 9 tsnAssoc
+ 10 ampduRx
+ 11 ampduTx
+ 12 mimoPowerSave
+ 13 sendRts
+ 14 rifs
+ 15 shortGiHT20
+ 16 shortGiHT40
+ 17 amsduRx
+ 18 amsduTx
+)
+
+typedef WlanIfaceChannelFlagsType BITS (
+ 1 turbo
+ 2 cck
+ 3 ofdm
+ 4 spectrum2Ghz
+ 5 spectrum5Ghz
+ 6 passiveScan
+ 7 dynamicCckOfdm
+ 8 gfsk
+ 9 spectrum900Mhz
+ 10 dot11aStaticTurbo
+ 11 halfRate
+ 12 quarterRate
+ 13 ht20
+ 14 ht40u
+ 15 ht40d
+ 16 dfs
+ 17 xmit4ms
+ 18 noAdhoc
+ 19 noHostAp
+ 20 dot11d
+)
+
+typedef WlanIfaceChannelStateType BITS (
+ 1 radar
+ 2 cacDone
+ 3 interferenceDetected
+ 4 radarClear
+)
+
+typedef WlanIfPhyMode ENUM (
+ 1 auto
+ 2 dot11a
+ 3 dot11b
+ 4 dot11g
+ 5 fh
+ 6 turboA
+ 7 turboG
+ 8 sturboA
+ 9 dot11na
+ 10 dot11ng
+ 11 ofdmHalf
+ 12 ofdmQuarter
+)
+
+typedef WlanChannelType ENUM (
+ 1 fhss
+ 2 dot11a
+ 3 dot11b
+ 4 dot11g
+ 5 tenMHz
+ 6 fiveMHz
+ 7 turbo
+ 8 ht
+)
+
+typedef WlanScanFlagsType BITS (
+ 1 noSelection
+ 2 activeScan
+ 3 pickFirst
+ 4 backgroundScan
+ 5 once
+ 6 noBroadcast
+ 7 noAutoSequencing
+ 8 flushCashe
+ 9 chechCashe
+)
+
+typedef WlanMeshNeighborPeerStateType ENUM (
+ 0 idle
+ 1 openTx
+ 2 openRx
+ 3 confirmRx
+ 4 established
+ 5 closing
+)
+
+(1 internet
+ (4 private
+ (1 enterprises
+ (12325 fokus
+ (1 begemot
+ (210 begemotWlan
+ (0 begemotWlanNotifications
+ )
+ (1 begemotWlanInterface
+ (1 wlanInterfaceTable
+ (1 wlanInterfaceEntry : OCTETSTRING op_wlan_iface
+ (1 wlanIfaceIndex INTEGER GET)
+ (2 wlanIfaceName OCTETSTRING GET SET)
+ (3 wlanParentIfName OCTETSTRING GET SET)
+ (4 wlanIfaceOperatingMode WlanIfaceOperatingModeType GET SET)
+ (5 wlanIfaceFlags WlanIfaceFlagsType GET SET)
+ (6 wlanIfaceBssid OCTETSTRING | MacAddress GET SET)
+ (7 wlanIfaceLocalAddress OCTETSTRING | MacAddress GET SET)
+ (8 wlanIfaceStatus RowStatus GET SET)
+ (9 wlanIfaceState ENUM ( 1 up 2 down ) GET SET)
+ ))
+ (2 wlanIfParentTable
+ (1 wlanIfParentEntry : OCTETSTRING op_wlan_if_parent
+ (1 wlanIfParentDriverCapabilities WlanDriverCaps GET)
+ (2 wlanIfParentCryptoCapabilities WlanCryptoCaps GET)
+ (3 wlanIfParentHTCapabilities WlanHTCaps GET)
+ ))
+ (3 wlanIfaceConfigTable
+ (1 wlanIfaceConfigEntry : OCTETSTRING op_wlan_iface_config
+ (1 wlanIfacePacketBurst ENUM ( 1 true 2 false ) GET SET)
+ (2 wlanIfaceCountryCode OCTETSTRING GET SET)
+ (3 wlanIfaceRegDomain WlanRegDomainCode GET SET)
+ (4 wlanIfaceDesiredSsid OCTETSTRING GET SET)
+ (5 wlanIfaceDesiredChannel INTEGER32 GET SET)
+ (6 wlanIfaceDynamicFreqSelection ENUM ( 1 true 2 false ) GET SET)
+ (7 wlanIfaceFastFrames ENUM ( 1 true 2 false ) GET SET)
+ (8 wlanIfaceDturbo ENUM ( 1 true 2 false ) GET SET)
+ (9 wlanIfaceTxPower INTEGER32 GET SET)
+ (10 wlanIfaceFragmentThreshold INTEGER GET SET)
+ (11 wlanIfaceRTSThreshold INTEGER GET SET)
+ (12 wlanIfaceWlanPrivacySubscribe ENUM ( 1 true 2 false ) GET SET)
+ (13 wlanIfaceBgScan ENUM ( 1 true 2 false ) GET SET)
+ (14 wlanIfaceBgScanIdle INTEGER32 GET SET)
+ (15 wlanIfaceBgScanInterval INTEGER32 GET SET)
+ (16 wlanIfaceBeaconMissedThreshold INTEGER GET SET)
+ (17 wlanIfaceDesiredBssid OCTETSTRING | MacAddress GET SET)
+ (18 wlanIfaceRoamingMode ENUM ( 1 device 2 auto 3 manual ) GET SET)
+ (19 wlanIfaceDot11d ENUM ( 1 true 2 false ) GET SET)
+ (20 wlanIfaceDot11h ENUM ( 1 true 2 false ) GET SET)
+ (21 wlanIfaceDynamicWds ENUM ( 1 true 2 false ) GET SET)
+ (22 wlanIfacePowerSave ENUM ( 1 true 2 false ) GET SET)
+ (23 wlanIfaceApBridge ENUM ( 1 true 2 false ) GET SET)
+ (24 wlanIfaceBeaconInterval INTEGER GET SET)
+ (25 wlanIfaceDtimPeriod INTEGER GET SET)
+ (26 wlanIfaceHideSsid ENUM ( 1 true 2 false ) GET SET)
+ (27 wlanIfaceInactivityProccess ENUM ( 1 true 2 false ) GET SET)
+ (28 wlanIfaceDot11gProtMode ENUM ( 1 off 2 cts 3 rtscts ) GET SET)
+ (29 wlanIfaceDot11gPureMode ENUM ( 1 true 2 false ) GET SET)
+ (30 wlanIfaceDot11nPureMode ENUM ( 1 true 2 false ) GET SET)
+ (31 wlanIfaceDot11nAmpdu WlanIfaceDot11nPduType GET SET)
+ (32 wlanIfaceDot11nAmpduDensity INTEGER GET SET)
+ (33 wlanIfaceDot11nAmpduLimit INTEGER GET SET)
+ (34 wlanIfaceDot11nAmsdu WlanIfaceDot11nPduType GET SET)
+ (35 wlanIfaceDot11nAmsduLimit INTEGER GET SET)
+ (36 wlanIfaceDot11nHighThroughput ENUM ( 1 true 2 false ) GET SET)
+ (37 wlanIfaceDot11nHTCompatible ENUM ( 1 true 2 false ) GET SET)
+ (38 wlanIfaceDot11nHTProtMode ENUM ( 1 off 2 rts ) GET SET)
+ (39 wlanIfaceDot11nRIFS ENUM ( 1 true 2 false ) GET SET)
+ (40 wlanIfaceDot11nShortGI ENUM ( 1 true 2 false ) GET SET)
+ (41 wlanIfaceDot11nSMPSMode ENUM ( 1 disabled 2 static 3 dynamic ) GET SET)
+ (42 wlanIfaceTdmaSlot INTEGER GET SET)
+ (43 wlanIfaceTdmaSlotCount INTEGER GET SET)
+ (44 wlanIfaceTdmaSlotLength INTEGER GET SET)
+ (45 wlanIfaceTdmaBeaconInterval INTEGER32 GET SET)
+ ))
+ (4 wlanIfacePeerTable
+ (1 wlanIfacePeerEntry : OCTETSTRING OCTETSTRING | MacAddress op_wlan_if_peer
+ (1 wlanIfacePeerAddress OCTETSTRING | MacAddress GET)
+ (2 wlanIfacePeerAssociationId INTEGER32 GET)
+ (3 wlanIfacePeerVlanTag INTEGER GET SET)
+ (4 wlanIfacePeerFrequency INTEGER32 GET)
+ (5 wlanIfacePeerCurrentTXRate INTEGER32 GET)
+ (6 wlanIfacePeerRxSignalStrength INTEGER32 GET)
+ (7 wlanIfacePeerIdleTimer INTEGER32 GET)
+ (8 wlanIfacePeerTxSequenceNo INTEGER32 GET)
+ (9 wlanIfacePeerRxSequenceNo INTEGER32 GET)
+ (10 wlanIfacePeerTxPower INTEGER32 GET)
+ (11 wlanIfacePeerCapabilities WlanPeerCapabilityFlags GET)
+ (12 wlanIfacePeerFlags WlanIfacePeerFlagsType GET)
+ ))
+ (5 wlanIfaceChannelTable
+ (1 wlanIfaceChannelEntry : OCTETSTRING INTEGER op_wlan_channels
+ (1 wlanIfaceChannelId INTEGER)
+ (2 wlanIfaceChannelIeeeId INTEGER GET)
+ (3 wlanIfaceChannelType WlanChannelType GET)
+ (4 wlanIfaceChannelFlags WlanIfaceChannelFlagsType GET)
+ (5 wlanIfaceChannelFrequency INTEGER32 GET)
+ (6 wlanIfaceChannelMaxRegPower INTEGER32 GET)
+ (7 wlanIfaceChannelMaxTxPower INTEGER32 GET)
+ (8 wlanIfaceChannelMinTxPower INTEGER32 GET)
+ (9 wlanIfaceChannelState WlanIfaceChannelStateType GET)
+ (10 wlanIfaceChannelHTExtension INTEGER32 GET)
+ (11 wlanIfaceChannelMaxAntennaGain INTEGER32 GET)
+ ))
+ (6 wlanIfRoamParamsTable
+ (1 wlanIfRoamParamsEntry : OCTETSTRING WlanIfPhyMode op_wlan_roam_params
+ (1 wlanIfRoamPhyMode WlanIfPhyMode)
+ (2 wlanIfRoamRxSignalStrength INTEGER32 GET)
+ (3 wlanIfRoamTxRateThreshold INTEGER32 GET)
+ ))
+ (7 wlanIfTxParamsTable
+ (1 wlanIfTxParamsEntry : OCTETSTRING WlanIfPhyMode op_wlan_tx_params
+ (1 wlanIfTxPhyMode WlanIfPhyMode)
+ (2 wlanIfTxUnicastRate INTEGER32 GET SET)
+ (3 wlanIfTxMcastRate INTEGER32 GET SET)
+ (4 wlanIfTxMgmtRate INTEGER32 GET SET)
+ (5 wlanIfTxMaxRetryCount INTEGER32 GET SET)
+ ))
+ )
+ (2 begemotWlanScanning
+ (1 wlanScanConfigTable
+ (1 wlanScanConfigEntry : OCTETSTRING op_wlan_scan_config
+ (1 wlanScanFlags WlanScanFlagsType GET SET)
+ (2 wlanScanDuration INTEGER GET SET)
+ (3 wlanScanMinChannelDwellTime INTEGER32 GET SET)
+ (4 wlanScanMaxChannelDwellTime INTEGER32 GET SET)
+ (5 wlanScanConfigStatus ENUM ( 0 unknown 1 notStarted 2 running 3 finished 4 cancel ) GET SET)
+ ))
+ (2 wlanScanResultsTable
+ (1 wlanScanResultsEntry : OCTETSTRING OCTETSTRING OCTETSTRING | MacAddress op_wlan_scan_results
+ (1 wlanScanResultID OCTETSTRING GET)
+ (2 wlanScanResultBssid OCTETSTRING | MacAddress GET)
+ (3 wlanScanResultChannel INTEGER32 GET)
+ (4 wlanScanResultRate INTEGER32 GET)
+ (5 wlanScanResultNoise INTEGER32 GET)
+ (6 wlanScanResultBeaconInterval INTEGER32 GET)
+ (7 wlanScanResultCapabilities WlanPeerCapabilityFlags GET)
+ ))
+ )
+ (3 begemotWlanStatistics
+ (1 wlanIfaceStatisticsTable
+ (1 wlanIfaceStatisticsEntry : OCTETSTRING op_wlan_iface_stats
+ (1 wlanStatsRxBadVersion COUNTER GET)
+ (2 wlanStatsRxTooShort COUNTER GET)
+ (3 wlanStatsRxWrongBssid COUNTER GET)
+ (4 wlanStatsRxDiscardedDups COUNTER GET)
+ (5 wlanStatsRxWrongDir COUNTER GET)
+ (6 wlanStatsRxDiscardMcastEcho COUNTER GET)
+ (7 wlanStatsRxDiscardNoAssoc COUNTER GET)
+ (8 wlanStatsRxWepNoPrivacy COUNTER GET)
+ (9 wlanStatsRxWepUnencrypted COUNTER GET)
+ (10 wlanStatsRxWepFailed COUNTER GET)
+ (11 wlanStatsRxDecapsulationFailed COUNTER GET)
+ (12 wlanStatsRxDiscardMgmt COUNTER GET)
+ (13 wlanStatsRxControl COUNTER GET)
+ (14 wlanStatsRxBeacon COUNTER GET)
+ (15 wlanStatsRxRateSetTooBig COUNTER GET)
+ (16 wlanStatsRxElemMissing COUNTER GET)
+ (17 wlanStatsRxElemTooBig COUNTER GET)
+ (18 wlanStatsRxElemTooSmall COUNTER GET)
+ (19 wlanStatsRxElemUnknown COUNTER GET)
+ (20 wlanStatsRxChannelMismatch COUNTER GET)
+ (21 wlanStatsRxDropped COUNTER GET)
+ (22 wlanStatsRxSsidMismatch COUNTER GET)
+ (23 wlanStatsRxAuthNotSupported COUNTER GET)
+ (24 wlanStatsRxAuthFailed COUNTER GET)
+ (25 wlanStatsRxAuthCM COUNTER GET)
+ (26 wlanStatsRxAssocWrongBssid COUNTER GET)
+ (27 wlanStatsRxAssocNoAuth COUNTER GET)
+ (28 wlanStatsRxAssocCapMismatch COUNTER GET)
+ (29 wlanStatsRxAssocNoRateMatch COUNTER GET)
+ (30 wlanStatsRxBadWpaIE COUNTER GET)
+ (31 wlanStatsRxDeauthenticate COUNTER GET)
+ (32 wlanStatsRxDisassociate COUNTER GET)
+ (33 wlanStatsRxUnknownSubtype COUNTER GET)
+ (34 wlanStatsRxFailedNoBuf COUNTER GET)
+ (35 wlanStatsRxBadAuthRequest COUNTER GET)
+ (36 wlanStatsRxUnAuthorized COUNTER GET)
+ (37 wlanStatsRxBadKeyId COUNTER GET)
+ (38 wlanStatsRxCCMPSeqViolation COUNTER GET)
+ (39 wlanStatsRxCCMPBadFormat COUNTER GET)
+ (40 wlanStatsRxCCMPFailedMIC COUNTER GET)
+ (41 wlanStatsRxTKIPSeqViolation COUNTER GET)
+ (42 wlanStatsRxTKIPBadFormat COUNTER GET)
+ (43 wlanStatsRxTKIPFailedMIC COUNTER GET)
+ (44 wlanStatsRxTKIPFailedICV COUNTER GET)
+ (45 wlanStatsRxDiscardACL COUNTER GET)
+ (46 wlanStatsTxFailedNoBuf COUNTER GET)
+ (47 wlanStatsTxFailedNoNode COUNTER GET)
+ (48 wlanStatsTxUnknownMgmt COUNTER GET)
+ (49 wlanStatsTxBadCipher COUNTER GET)
+ (50 wlanStatsTxNoDefKey COUNTER GET)
+ (51 wlanStatsTxFragmented COUNTER GET)
+ (52 wlanStatsTxFragmentsCreated COUNTER GET)
+ (53 wlanStatsActiveScans COUNTER GET)
+ (54 wlanStatsPassiveScans COUNTER GET)
+ (55 wlanStatsTimeoutInactivity COUNTER GET)
+ (56 wlanStatsCryptoNoMem COUNTER GET)
+ (57 wlanStatsSwCryptoTKIP COUNTER GET)
+ (58 wlanStatsSwCryptoTKIPEnMIC COUNTER GET)
+ (59 wlanStatsSwCryptoTKIPDeMIC COUNTER GET)
+ (60 wlanStatsCryptoTKIPCM COUNTER GET)
+ (61 wlanStatsSwCryptoCCMP COUNTER GET)
+ (62 wlanStatsSwCryptoWEP COUNTER GET)
+ (63 wlanStatsCryptoCipherKeyRejected COUNTER GET)
+ (64 wlanStatsCryptoNoKey COUNTER GET)
+ (65 wlanStatsCryptoDeleteKeyFailed COUNTER GET)
+ (66 wlanStatsCryptoUnknownCipher COUNTER GET)
+ (67 wlanStatsCryptoAttachFailed COUNTER GET)
+ (68 wlanStatsCryptoKeyFailed COUNTER GET)
+ (69 wlanStatsCryptoEnMICFailed COUNTER GET)
+ (70 wlanStatsIBSSCapMismatch COUNTER GET)
+ (71 wlanStatsUnassocStaPSPoll COUNTER GET)
+ (72 wlanStatsBadAidPSPoll COUNTER GET)
+ (73 wlanStatsEmptyPSPoll COUNTER GET)
+ (74 wlanStatsRxFFBadHdr COUNTER GET)
+ (75 wlanStatsRxFFTooShort COUNTER GET)
+ (76 wlanStatsRxFFSplitError COUNTER GET)
+ (77 wlanStatsRxFFDecap COUNTER GET)
+ (78 wlanStatsTxFFEncap COUNTER GET)
+ (79 wlanStatsRxBadBintval COUNTER GET)
+ (80 wlanStatsRxDemicFailed COUNTER GET)
+ (81 wlanStatsRxDefragFailed COUNTER GET)
+ (82 wlanStatsRxMgmt COUNTER GET)
+ (83 wlanStatsRxActionMgmt COUNTER GET)
+ (84 wlanStatsRxAMSDUTooShort COUNTER GET)
+ (85 wlanStatsRxAMSDUSplitError COUNTER GET)
+ (86 wlanStatsRxAMSDUDecap COUNTER GET)
+ (87 wlanStatsTxAMSDUEncap COUNTER GET)
+ (88 wlanStatsAMPDUBadBAR COUNTER GET)
+ (89 wlanStatsAMPDUOowBar COUNTER GET)
+ (90 wlanStatsAMPDUMovedBAR COUNTER GET)
+ (91 wlanStatsAMPDURxBAR COUNTER GET)
+ (92 wlanStatsAMPDURxOor COUNTER GET)
+ (93 wlanStatsAMPDURxCopied COUNTER GET)
+ (94 wlanStatsAMPDURxDropped COUNTER GET)
+ (95 wlanStatsTxDiscardBadState COUNTER GET)
+ (96 wlanStatsTxFailedNoAssoc COUNTER GET)
+ (97 wlanStatsTxClassifyFailed COUNTER GET)
+ (98 wlanStatsDwdsMcastDiscard COUNTER GET)
+ (99 wlanStatsHTAssocRejectNoHT COUNTER GET)
+ (100 wlanStatsHTAssocDowngrade COUNTER GET)
+ (101 wlanStatsHTAssocRateMismatch COUNTER GET)
+ (102 wlanStatsAMPDURxAge COUNTER GET)
+ (103 wlanStatsAMPDUMoved COUNTER GET)
+ (104 wlanStatsADDBADisabledReject COUNTER GET)
+ (105 wlanStatsADDBANoRequest COUNTER GET)
+ (106 wlanStatsADDBABadToken COUNTER GET)
+ (107 wlanStatsADDBABadPolicy COUNTER GET)
+ (108 wlanStatsAMPDUStopped COUNTER GET)
+ (109 wlanStatsAMPDUStopFailed COUNTER GET)
+ (110 wlanStatsAMPDURxReorder COUNTER GET)
+ (111 wlanStatsScansBackground COUNTER GET)
+ (112 wlanLastDeauthReason WlanMgmtReasonCode GET)
+ (113 wlanLastDissasocReason WlanMgmtReasonCode GET)
+ (114 wlanLastAuthFailReason WlanMgmtReasonCode GET)
+ (115 wlanStatsBeaconMissedEvents COUNTER GET)
+ (116 wlanStatsRxDiscardBadStates COUNTER GET)
+ (117 wlanStatsFFFlushed COUNTER GET)
+ (118 wlanStatsTxControlFrames COUNTER GET)
+ (119 wlanStatsAMPDURexmt COUNTER GET)
+ (120 wlanStatsAMPDURexmtFailed COUNTER GET)
+ (121 wlanStatsReset ENUM ( 1 no-op 2 clear ) GET SET)
+ ))
+ )
+ (4 begemotWlanWep
+ (1 wlanWepInterfaceTable
+ (1 wlanWepInterfaceEntry : OCTETSTRING op_wlan_wep_iface
+ (1 wlanWepMode ENUM ( 0 off 1 on 2 mixed ) GET SET)
+ (2 wlanWepDefTxKey INTEGER32 GET SET)
+ ))
+ (2 wlanWepKeyTable
+ (1 wlanWepKeyEntry : OCTETSTRING INTEGER op_wlan_wep_key
+ (1 wlanWepKeyID INTEGER GET SET)
+ (2 wlanWepKeyLength INTEGER32 GET)
+ (3 wlanWepKeySet OCTETSTRING | OctetString GET SET)
+ (4 wlanWepKeyHash OCTETSTRING | OctetString GET)
+ (5 wlanWepKeyStatus RowStatus GET SET)
+ ))
+ )
+ (5 begemotWlanMACAccessControl
+ (1 wlanMACAccessControlTable
+ (1 wlanMACAccessControlEntry : OCTETSTRING op_wlan_mac_access_control
+ (1 wlanMACAccessControlPolicy ENUM ( 0 open 1 allow 2 deny 7 radius ) GET SET)
+ (2 wlanMACAccessControlNacl COUNTER GET)
+ (3 wlanMACAccessControlFlush ENUM ( 0 no-op 1 flush ) GET SET)
+ ))
+ (2 wlanMACAccessControlMACTable
+ (1 wlanMACAccessControlMACEntry : OCTETSTRING OCTETSTRING | MacAddress op_wlan_mac_acl_mac
+ (1 wlanMACAccessControlMAC OCTETSTRING | MacAddress GET SET)
+ (2 wlanMACAccessControlMACStatus RowStatus GET SET)
+ ))
+ )
+ (6 begemotWlanMeshRouting
+ (1 wlanMeshRoutingConfig
+ (1 wlanMeshMaxRetries INTEGER32 op_wlan_mesh_config GET SET)
+ (2 wlanMeshConfirmTimeout INTEGER32 op_wlan_mesh_config GET SET)
+ (3 wlanMeshHoldingTimeout INTEGER32 op_wlan_mesh_config GET SET)
+ (4 wlanMeshRetryTimeout INTEGER32 op_wlan_mesh_config GET SET)
+ )
+ (2 wlanMeshInterface
+ (1 wlanMeshInterfaceTable
+ (1 wlanMeshInterfaceEntry : OCTETSTRING op_wlan_mesh_iface
+ (1 wlanMeshId OCTETSTRING GET SET)
+ (2 wlanMeshTTL INTEGER32 GET SET)
+ (3 wlanMeshPeeringEnabled ENUM ( 1 true 2 false ) GET SET)
+ (4 wlanMeshForwardingEnabled ENUM ( 1 true 2 false ) GET SET)
+ (5 wlanMeshMetric ENUM ( 0 unknown 1 airtime ) GET SET)
+ (6 wlanMeshPath ENUM ( 0 unknown 1 hwmp ) GET SET)
+ (7 wlanMeshRoutesFlush ENUM ( 0 no-op 1 flush ) GET SET)
+ ))
+ (2 wlanMeshNeighborTable
+ (1 wlanMeshNeighborEntry : OCTETSTRING OCTETSTRING | MacAddress op_wlan_mesh_neighbor
+ (1 wlanMeshNeighborAddress OCTETSTRING | MacAddress GET)
+ (2 wlanMeshNeighborFrequency INTEGER32 GET)
+ (3 wlanMeshNeighborLocalId INTEGER32 GET)
+ (4 wlanMeshNeighborPeerId INTEGER32 GET)
+ (5 wlanMeshNeighborPeerState WlanMeshNeighborPeerStateType GET)
+ (6 wlanMeshNeighborCurrentTXRate INTEGER32 GET)
+ (7 wlanMeshNeighborRxSignalStrength INTEGER32 GET)
+ (8 wlanMeshNeighborIdleTimer INTEGER32 GET)
+ (9 wlanMeshNeighborTxSequenceNo INTEGER32 GET)
+ (10 wlanMeshNeighborRxSequenceNo INTEGER32 GET)
+ ))
+ )
+ (3 wlanMeshRoute
+ (1 wlanMeshRouteTable
+ (1 wlanMeshRouteEntry : OCTETSTRING OCTETSTRING | MacAddress op_wlan_mesh_route
+ (1 wlanMeshRouteDestination OCTETSTRING | MacAddress GET SET)
+ (2 wlanMeshRouteNextHop OCTETSTRING | MacAddress GET)
+ (3 wlanMeshRouteHops INTEGER32 GET)
+ (4 wlanMeshRouteMetric UNSIGNED32 GET)
+ (5 wlanMeshRouteLifeTime UNSIGNED32 GET)
+ (6 wlanMeshRouteLastMseq UNSIGNED32 GET)
+ (7 wlanMeshRouteFlags BITS ( 1 valid 2 proxy ) GET)
+ (8 wlanMeshRouteStatus RowStatus GET SET)
+ ))
+ )
+ (4 wlanMeshStatistics
+ (1 wlanMeshStatsTable
+ (1 wlanMeshStatsEntry : OCTETSTRING op_wlan_mesh_stats
+ (1 wlanMeshDroppedBadSta COUNTER GET)
+ (2 wlanMeshDroppedNoLink COUNTER GET)
+ (3 wlanMeshNoFwdTtl COUNTER GET)
+ (4 wlanMeshNoFwdBuf COUNTER GET)
+ (5 wlanMeshNoFwdTooShort COUNTER GET)
+ (6 wlanMeshNoFwdDisabled COUNTER GET)
+ (7 wlanMeshNoFwdPathUnknown COUNTER GET)
+ (8 wlanMeshDroppedBadAE COUNTER GET)
+ (9 wlanMeshRouteAddFailed COUNTER GET)
+ (10 wlanMeshDroppedNoProxy COUNTER GET)
+ (11 wlanMeshDroppedMisaligned COUNTER GET)
+ ))
+ )
+ (5 wlanMeshRouteProtocols
+ (1 wlanMeshProtoHWMP
+ (1 wlanMeshHWMPConfig
+ (1 wlanHWMPRouteInactiveTimeout INTEGER32 op_wlan_hwmp_config GET SET)
+ (2 wlanHWMPRootAnnounceInterval INTEGER32 op_wlan_hwmp_config GET SET)
+ (3 wlanHWMPRootInterval INTEGER32 op_wlan_hwmp_config GET SET)
+ (4 wlanHWMPRootTimeout INTEGER32 op_wlan_hwmp_config GET SET)
+ (5 wlanHWMPPathLifetime INTEGER32 op_wlan_hwmp_config GET SET)
+ (6 wlanHWMPReplyForwardBit INTEGER32 op_wlan_hwmp_config GET SET)
+ (7 wlanHWMPTargetOnlyBit INTEGER32 op_wlan_hwmp_config GET SET)
+ )
+ (2 wlanMeshHWMPInterface
+ (1 wlanHWMPInterfaceTable
+ (1 wlanHWMPInterfaceEntry : OCTETSTRING op_wlan_hwmp_iface
+ (1 wlanHWMPRootMode ENUM ( 1 disabled 2 normal 3 proactive 4 rann ) GET SET)
+ (2 wlanHWMPMaxHops INTEGER32 GET SET)
+ ))
+ )
+ (3 wlanMeshHWMPStatistics
+ (1 wlanMeshHWMPStatsTable
+ (1 wlanMeshHWMPStatsEntry : OCTETSTRING op_wlan_hwmp_stats
+ (1 wlanMeshHWMPWrongSeqNo COUNTER GET)
+ (2 wlanMeshHWMPTxRootPREQ COUNTER GET)
+ (3 wlanMeshHWMPTxRootRANN COUNTER GET)
+ (4 wlanMeshHWMPProxy COUNTER GET)
+ ))
+ )
+ )
+ )
+ ))))))
+)
OpenPOWER on IntegriCloud