Bug Summary

File:src/usr.sbin/snmpd/mib.c
Warning:line 1399, column 3
Value stored to 'ber' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple amd64-unknown-openbsd7.0 -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name mib.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 1 -pic-is-pie -mframe-pointer=all -relaxed-aliasing -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature +retpoline-indirect-calls -target-feature +retpoline-indirect-branches -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/src/usr.sbin/snmpd/obj -resource-dir /usr/local/lib/clang/13.0.0 -I /usr/src/usr.sbin/snmpd -internal-isystem /usr/local/lib/clang/13.0.0/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/usr/src/usr.sbin/snmpd/obj -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/ben/Projects/vmm/scan-build/2022-01-12-194120-40624-1 -x c /usr/src/usr.sbin/snmpd/mib.c
1/* $OpenBSD: mib.c,v 1.102 2021/09/01 15:54:40 deraadt Exp $ */
2
3/*
4 * Copyright (c) 2012 Joel Knight <joel@openbsd.org>
5 * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#include <sys/types.h>
21#include <sys/signal.h>
22#include <sys/queue.h>
23#include <sys/proc.h>
24#include <sys/stat.h>
25#include <sys/socket.h>
26#include <sys/un.h>
27#include <sys/time.h>
28#include <sys/tree.h>
29#include <sys/utsname.h>
30#include <sys/sysctl.h>
31#include <sys/sensors.h>
32#include <sys/sched.h>
33#include <sys/mount.h>
34#include <sys/ioctl.h>
35#include <sys/disk.h>
36
37#include <netinet/in.h>
38#include <netinet/ip.h>
39#include <netinet/ip_carp.h>
40#include <netinet/ip_var.h>
41#include <arpa/inet.h>
42#include <net/if.h>
43#include <net/if_types.h>
44#include <net/pfvar.h>
45#include <netinet/ip_ipsp.h>
46#include <net/if_pfsync.h>
47
48#include <stdlib.h>
49#include <stdio.h>
50#include <errno(*__errno()).h>
51#include <event.h>
52#include <fcntl.h>
53#include <string.h>
54#include <time.h>
55#include <unistd.h>
56#include <pwd.h>
57#include <limits.h>
58#include <kvm.h>
59
60#include "snmpd.h"
61#include "mib.h"
62
63/*
64 * Defined in SNMPv2-MIB.txt (RFC 3418)
65 */
66
67int mib_getsys(struct oid *, struct ber_oid *, struct ber_element **);
68int mib_getsnmp(struct oid *, struct ber_oid *, struct ber_element **);
69int mib_sysor(struct oid *, struct ber_oid *, struct ber_element **);
70int mib_setsnmp(struct oid *, struct ber_oid *, struct ber_element **);
71
72static struct oid mib_tree[] = MIB_TREE{ { { { 1 } }, "iso" }, { { { 1, 3 } }, "org" }, { { { 1, 3, 6
} }, "dod" }, { { { 1, 3, 6, 1 } }, "internet" }, { { { 1, 3
, 6, 1, 1 } }, "directory" }, { { { 1, 3, 6, 1, 2 } }, "mgmt"
}, { { { 1, 3, 6, 1, 2, 1 } }, "mib_2" }, { { { 1, 3, 6, 1, 2
, 1, 1 } }, "system" }, { { { 1, 3, 6, 1, 2, 1, 1, 1 } }, "sysDescr"
}, { { { 1, 3, 6, 1, 2, 1, 1, 2 } }, "sysOID" }, { { { 1, 3,
6, 1, 2, 1, 1, 3 } }, "sysUpTime" }, { { { 1, 3, 6, 1, 2, 1,
1, 4 } }, "sysContact" }, { { { 1, 3, 6, 1, 2, 1, 1, 5 } }, "sysName"
}, { { { 1, 3, 6, 1, 2, 1, 1, 6 } }, "sysLocation" }, { { { 1
, 3, 6, 1, 2, 1, 1, 7 } }, "sysServices" }, { { { 1, 3, 6, 1,
2, 1, 1, 8 } }, "sysORLastChange" }, { { { 1, 3, 6, 1, 2, 1,
1, 9 } }, "sysORTable" }, { { { 1, 3, 6, 1, 2, 1, 1, 9, 1 } }
, "sysOREntry" }, { { { 1, 3, 6, 1, 2, 1, 1, 9, 1, 1 } }, "sysORIndex"
}, { { { 1, 3, 6, 1, 2, 1, 1, 9, 1, 2 } }, "sysORID" }, { { {
1, 3, 6, 1, 2, 1, 1, 9, 1, 3 } }, "sysORDescr" }, { { { 1, 3
, 6, 1, 2, 1, 1, 9, 1, 4 } }, "sysORUpTime" }, { { { 1, 3, 6,
1, 2, 1, 10 } }, "transmission" }, { { { 1, 3, 6, 1, 2, 1, 11
} }, "snmp" }, { { { 1, 3, 6, 1, 2, 1, 11, 1 } }, "snmpInPkts"
}, { { { 1, 3, 6, 1, 2, 1, 11, 2 } }, "snmpOutPkts" }, { { {
1, 3, 6, 1, 2, 1, 11, 3 } }, "snmpInBadVersions" }, { { { 1,
3, 6, 1, 2, 1, 11, 4 } }, "snmpInBadCommunityNames" }, { { {
1, 3, 6, 1, 2, 1, 11, 5 } }, "snmpInBadCommunityUses" }, { {
{ 1, 3, 6, 1, 2, 1, 11, 6 } }, "snmpInASNParseErrs" }, { { {
1, 3, 6, 1, 2, 1, 11, 8 } }, "snmpInTooBigs" }, { { { 1, 3, 6
, 1, 2, 1, 11, 9 } }, "snmpInNoSuchNames" }, { { { 1, 3, 6, 1
, 2, 1, 11, 10 } }, "snmpInBadValues" }, { { { 1, 3, 6, 1, 2,
1, 11, 11 } }, "snmpInReadOnlys" }, { { { 1, 3, 6, 1, 2, 1, 11
, 12 } }, "snmpInGenErrs" }, { { { 1, 3, 6, 1, 2, 1, 11, 13 }
}, "snmpInTotalReqVars" }, { { { 1, 3, 6, 1, 2, 1, 11, 14 } }
, "snmpInTotalSetVars" }, { { { 1, 3, 6, 1, 2, 1, 11, 15 } },
"snmpInGetRequests" }, { { { 1, 3, 6, 1, 2, 1, 11, 16 } }, "snmpInGetNexts"
}, { { { 1, 3, 6, 1, 2, 1, 11, 17 } }, "snmpInSetRequests" }
, { { { 1, 3, 6, 1, 2, 1, 11, 18 } }, "snmpInGetResponses" },
{ { { 1, 3, 6, 1, 2, 1, 11, 19 } }, "snmpInTraps" }, { { { 1
, 3, 6, 1, 2, 1, 11, 20 } }, "snmpOutTooBigs" }, { { { 1, 3, 6
, 1, 2, 1, 11, 21 } }, "snmpOutNoSuchNames" }, { { { 1, 3, 6,
1, 2, 1, 11, 22 } }, "snmpOutBadValues" }, { { { 1, 3, 6, 1,
2, 1, 11, 24 } }, "snmpOutGenErrs" }, { { { 1, 3, 6, 1, 2, 1
, 11, 25 } }, "snmpOutGetRequests" }, { { { 1, 3, 6, 1, 2, 1,
11, 26 } }, "snmpOutGetNexts" }, { { { 1, 3, 6, 1, 2, 1, 11,
27 } }, "snmpOutSetRequests" }, { { { 1, 3, 6, 1, 2, 1, 11, 28
} }, "snmpOutGetResponses" }, { { { 1, 3, 6, 1, 2, 1, 11, 29
} }, "snmpOutTraps" }, { { { 1, 3, 6, 1, 2, 1, 11, 30 } }, "snmpEnableAuthenTraps"
}, { { { 1, 3, 6, 1, 2, 1, 11, 31 } }, "snmpSilentDrops" }, {
{ { 1, 3, 6, 1, 2, 1, 11, 32 } }, "snmpProxyDrops" }, { { { 1
, 3, 6, 1, 3 } }, "experimental" }, { { { 1, 3, 6, 1, 4 } }, "private"
}, { { { 1, 3, 6, 1, 4, 1 } }, "enterprises" }, { { { 1, 3, 6
, 1, 5 } }, "security" }, { { { 1, 3, 6, 1, 6 } }, "snmpV2" }
, { { { 1, 3, 6, 1, 6, 1 } }, "snmpDomains" }, { { { 1, 3, 6,
1, 6, 2 } }, "snmpProxies" }, { { { 1, 3, 6, 1, 6, 3 } }, "snmpModules"
}, { { { 1, 3, 6, 1, 6, 3, 1 } }, "snmpMIB" }, { { { 1, 3, 6
, 1, 6, 3, 1, 1 } }, "snmpMIBObjects" }, { { { 1, 3, 6, 1, 6,
3, 1, 1, 4 } }, "snmpTrap" }, { { { 1, 3, 6, 1, 6, 3, 1, 1, 4
, 1 } }, "snmpTrapOID" }, { { { 1, 3, 6, 1, 6, 3, 1, 1, 4, 3 }
}, "snmpTrapEnterprise" }, { { { 1, 3, 6, 1, 6, 3, 1, 1, 5 }
}, "snmpTraps" }, { { { 1, 3, 6, 1, 6, 3, 1, 1, 5, 1 } }, "coldStart"
}, { { { 1, 3, 6, 1, 6, 3, 1, 1, 5, 2 } }, "warmStart" }, { {
{ 1, 3, 6, 1, 6, 3, 1, 1, 5, 3 } }, "linkDown" }, { { { 1, 3
, 6, 1, 6, 3, 1, 1, 5, 4 } }, "linkUp" }, { { { 1, 3, 6, 1, 6
, 3, 1, 1, 5, 5 } }, "authenticationFailure" }, { { { 1, 3, 6
, 1, 6, 3, 1, 1, 5, 6 } }, "egpNeighborLoss" }, { { { 1, 3, 6
, 1, 6, 3, 10 } }, "framework" }, { { { 1, 3, 6, 1, 6, 3, 10,
2 } }, "frameworkObjects" }, { { { 1, 3, 6, 1, 6, 3, 10, 2, 1
} }, "snmpEngine" }, { { { 1, 3, 6, 1, 6, 3, 10, 2, 1, 1 } }
, "snmpEngineID" }, { { { 1, 3, 6, 1, 6, 3, 10, 2, 1, 2 } }, "snmpEngineBoots"
}, { { { 1, 3, 6, 1, 6, 3, 10, 2, 1, 3 } }, "snmpEngineTime"
}, { { { 1, 3, 6, 1, 6, 3, 10, 2, 1, 4 } }, "snmpEngineMaxMsgSize"
}, { { { 1, 3, 6, 1, 6, 3, 15 } }, "usm" }, { { { 1, 3, 6, 1
, 6, 3, 15, 1 } }, "usmObjects" }, { { { 1, 3, 6, 1, 6, 3, 15
, 1, 1 } }, "usmStats" }, { { { 1, 3, 6, 1, 6, 3, 15, 1, 1, 1
} }, "usmStatsUnsupportedSecLevels" }, { { { 1, 3, 6, 1, 6, 3
, 15, 1, 1, 2 } }, "usmStatsNotInTimeWindow" }, { { { 1, 3, 6
, 1, 6, 3, 15, 1, 1, 3 } }, "usmStatsUnknownUserNames" }, { {
{ 1, 3, 6, 1, 6, 3, 15, 1, 1, 4 } }, "usmStatsUnknownEngineId"
}, { { { 1, 3, 6, 1, 6, 3, 15, 1, 1, 5 } }, "usmStatsWrongDigests"
}, { { { 1, 3, 6, 1, 6, 3, 15, 1, 1, 6 } }, "usmStatsDecryptionErrors"
}, { { { 1, 3, 6, 1, 2, 1, 25 } }, "host" }, { { { 1, 3, 6, 1
, 2, 1, 25, 1 } }, "hrSystem" }, { { { 1, 3, 6, 1, 2, 1, 25, 1
, 1 } }, "hrSystemUptime" }, { { { 1, 3, 6, 1, 2, 1, 25, 1, 2
} }, "hrSystemDate" }, { { { 1, 3, 6, 1, 2, 1, 25, 1, 3 } },
"hrSystemInitialLoadDevice" }, { { { 1, 3, 6, 1, 2, 1, 25, 1
, 4 } }, "hrSystemInitialLoadParameters" }, { { { 1, 3, 6, 1,
2, 1, 25, 1, 5 } }, "hrSystemNumUsers" }, { { { 1, 3, 6, 1, 2
, 1, 25, 1, 6 } }, "hrSystemProcesses" }, { { { 1, 3, 6, 1, 2
, 1, 25, 1, 7 } }, "hrSystemMaxProcesses" }, { { { 1, 3, 6, 1
, 2, 1, 25, 2 } }, "hrStorage" }, { { { 1, 3, 6, 1, 2, 1, 25,
2, 1 } }, "hrStorageTypes" }, { { { 1, 3, 6, 1, 2, 1, 25, 2,
2 } }, "hrMemorySize" }, { { { 1, 3, 6, 1, 2, 1, 25, 2, 3 } }
, "hrStorageTable" }, { { { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1 } }
, "hrStorageEntry" }, { { { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 1 }
}, "hrStorageIndex" }, { { { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 2
} }, "hrStorageType" }, { { { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1,
3 } }, "hrStorageDescr" }, { { { 1, 3, 6, 1, 2, 1, 25, 2, 3,
1, 4 } }, "hrStorageAllocationUnits" }, { { { 1, 3, 6, 1, 2,
1, 25, 2, 3, 1, 5 } }, "hrStorageSize" }, { { { 1, 3, 6, 1, 2
, 1, 25, 2, 3, 1, 6 } }, "hrStorageUsed" }, { { { 1, 3, 6, 1,
2, 1, 25, 2, 3, 1, 7 } }, "hrStorageAllocationFailures" }, {
{ { 1, 3, 6, 1, 2, 1, 25, 3 } }, "hrDevice" }, { { { 1, 3, 6
, 1, 2, 1, 25, 3, 1 } }, "hrDeviceTypes" }, { { { 1, 3, 6, 1,
2, 1, 25, 3, 1, 1 } }, "hrDeviceOther" }, { { { 1, 3, 6, 1, 2
, 1, 25, 3, 1, 2 } }, "hrDeviceUnknown" }, { { { 1, 3, 6, 1, 2
, 1, 25, 3, 1, 3 } }, "hrDeviceProcessor" }, { { { 1, 3, 6, 1
, 2, 1, 25, 3, 1, 4 } }, "hrDeviceNetwork" }, { { { 1, 3, 6, 1
, 2, 1, 25, 3, 1, 5 } }, "hrDevicePrinter" }, { { { 1, 3, 6, 1
, 2, 1, 25, 3, 1, 6 } }, "hrDeviceDiskStorage" }, { { { 1, 3,
6, 1, 2, 1, 25, 3, 1, 10 } }, "hrDeviceVideo" }, { { { 1, 3,
6, 1, 2, 1, 25, 3, 1, 11 } }, "hrDeviceAudio" }, { { { 1, 3,
6, 1, 2, 1, 25, 3, 1, 12 } }, "hrDeviceCoprocessor" }, { { {
1, 3, 6, 1, 2, 1, 25, 3, 1, 13 } }, "hrDeviceKeyboard" }, { {
{ 1, 3, 6, 1, 2, 1, 25, 3, 1, 14 } }, "hrDeviceModem" }, { {
{ 1, 3, 6, 1, 2, 1, 25, 3, 1, 15 } }, "hrDeviceParallelPort"
}, { { { 1, 3, 6, 1, 2, 1, 25, 3, 1, 16 } }, "hrDevicePointing"
}, { { { 1, 3, 6, 1, 2, 1, 25, 3, 1, 17 } }, "hrDeviceSerialPort"
}, { { { 1, 3, 6, 1, 2, 1, 25, 3, 1, 18 } }, "hrDeviceTape" }
, { { { 1, 3, 6, 1, 2, 1, 25, 3, 1, 19 } }, "hrDeviceClock" }
, { { { 1, 3, 6, 1, 2, 1, 25, 3, 1, 20 } }, "hrDeviceVolatileMemory"
}, { { { 1, 3, 6, 1, 2, 1, 25, 3, 1, 21 } }, "hrDeviceNonVolatileMemory"
}, { { { 1, 3, 6, 1, 2, 1, 25, 3, 2 } }, "hrDeviceTable" }, {
{ { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1 } }, "hrDeviceEntry" }, { {
{ 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 1 } }, "hrDeviceIndex" }, {
{ { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 2 } }, "hrDeviceType" }, {
{ { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 3 } }, "hrDeviceDescr" },
{ { { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 4 } }, "hrDeviceID" }, {
{ { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 5 } }, "hrDeviceStatus" }
, { { { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 6 } }, "hrDeviceErrors"
}, { { { 1, 3, 6, 1, 2, 1, 25, 3, 3 } }, "hrProcessorTable" }
, { { { 1, 3, 6, 1, 2, 1, 25, 3, 3, 1 } }, "hrProcessorEntry"
}, { { { 1, 3, 6, 1, 2, 1, 25, 3, 3, 1, 1 } }, "hrProcessorFrwID"
}, { { { 1, 3, 6, 1, 2, 1, 25, 3, 3, 1, 2 } }, "hrProcessorLoad"
}, { { { 1, 3, 6, 1, 2, 1, 25, 4 } }, "hrSWRun" }, { { { 1, 3
, 6, 1, 2, 1, 25, 4, 1 } }, "hrSWOSIndex" }, { { { 1, 3, 6, 1
, 2, 1, 25, 4, 2 } }, "hrSWRunTable" }, { { { 1, 3, 6, 1, 2, 1
, 25, 4, 2, 1 } }, "hrSWRunEntry" }, { { { 1, 3, 6, 1, 2, 1, 25
, 4, 2, 1, 1 } }, "hrSWRunIndex" }, { { { 1, 3, 6, 1, 2, 1, 25
, 4, 2, 1, 2 } }, "hrSWRunName" }, { { { 1, 3, 6, 1, 2, 1, 25
, 4, 2, 1, 3 } }, "hrSWRunID" }, { { { 1, 3, 6, 1, 2, 1, 25, 4
, 2, 1, 4 } }, "hrSWRunPath" }, { { { 1, 3, 6, 1, 2, 1, 25, 4
, 2, 1, 5 } }, "hrSWRunParameters" }, { { { 1, 3, 6, 1, 2, 1,
25, 4, 2, 1, 6 } }, "hrSWRunType" }, { { { 1, 3, 6, 1, 2, 1,
25, 4, 2, 1, 7 } }, "hrSWRunStatus" }, { { { 1, 3, 6, 1, 2, 1
, 25, 5 } }, "hrSWRunPerf" }, { { { 1, 3, 6, 1, 2, 1, 25, 5, 1
} }, "hrSWRunPerfTable" }, { { { 1, 3, 6, 1, 2, 1, 25, 5, 1,
1 } }, "hrSWRunPerfEntry" }, { { { 1, 3, 6, 1, 2, 1, 25, 5, 1
, 1, 1 } }, "hrSWRunPerfCPU" }, { { { 1, 3, 6, 1, 2, 1, 25, 5
, 1, 1, 2 } }, "hrSWRunPerfMem" }, { { { 1, 3, 6, 1, 2, 1, 31
} }, "ifMIB" }, { { { 1, 3, 6, 1, 2, 1, 31, 1 } }, "ifMIBObjects"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1 } }, "ifXTable" }, { { {
1, 3, 6, 1, 2, 1, 31, 1, 1, 1 } }, "ifXEntry" }, { { { 1, 3,
6, 1, 2, 1, 31, 1, 1, 1, 1 } }, "ifName" }, { { { 1, 3, 6, 1
, 2, 1, 31, 1, 1, 1, 2 } }, "ifInMulticastPkts" }, { { { 1, 3
, 6, 1, 2, 1, 31, 1, 1, 1, 3 } }, "ifInBroadcastPkts" }, { { {
1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 4 } }, "ifOutMulticastPkts" }
, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 5 } }, "ifOutBroadcastPkts"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 6 } }, "ifHCInOctets"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 7 } }, "ifHCInUcastPkts"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 8 } }, "ifHCInMulticastPkts"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 9 } }, "ifHCInBroadcastPkts"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 10 } }, "ifHCOutOctets"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 11 } }, "ifHCOutUcastPkts"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 12 } }, "ifHCOutMulticastPkts"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 13 } }, "ifHCOutBroadcastPkts"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 14 } }, "ifLinkUpDownTrapEnable"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 15 } }, "ifHighSpeed"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 16 } }, "ifPromiscuousMode"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 17 } }, "ifConnectorPresent"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 18 } }, "ifAlias" },
{ { { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 19 } }, "ifCounterDiscontinuityTime"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 2 } }, "ifStackTable" }, {
{ { 1, 3, 6, 1, 2, 1, 31, 1, 2, 1 } }, "ifStackEntry" }, { {
{ 1, 3, 6, 1, 2, 1, 31, 1, 4 } }, "ifRcvAddressTable" }, { {
{ 1, 3, 6, 1, 2, 1, 31, 1, 4, 1 } }, "ifRcvAddressEntry" }, {
{ { 1, 3, 6, 1, 2, 1, 31, 1, 4, 1, 2 } }, "ifRcvAddressStatus"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 4, 1, 3 } }, "ifRcvAddressType"
}, { { { 1, 3, 6, 1, 2, 1, 31, 1, 6 } }, "ifStackLastChange"
}, { { { 1, 3, 6, 1, 2, 1, 2 } }, "interfaces" }, { { { 1, 3
, 6, 1, 2, 1, 2, 1 } }, "ifNumber" }, { { { 1, 3, 6, 1, 2, 1,
2, 2 } }, "ifTable" }, { { { 1, 3, 6, 1, 2, 1, 2, 2, 1 } }, "ifEntry"
}, { { { 1, 3, 6, 1, 2, 1, 2, 2, 1, 1 } }, "ifIndex" }, { { {
1, 3, 6, 1, 2, 1, 2, 2, 1, 2 } }, "ifDescr" }, { { { 1, 3, 6
, 1, 2, 1, 2, 2, 1, 3 } }, "ifType" }, { { { 1, 3, 6, 1, 2, 1
, 2, 2, 1, 4 } }, "ifMtu" }, { { { 1, 3, 6, 1, 2, 1, 2, 2, 1,
5 } }, "ifSpeed" }, { { { 1, 3, 6, 1, 2, 1, 2, 2, 1, 6 } }, "ifPhysAddress"
}, { { { 1, 3, 6, 1, 2, 1, 2, 2, 1, 7 } }, "ifAdminStatus" }
, { { { 1, 3, 6, 1, 2, 1, 2, 2, 1, 8 } }, "ifOperStatus" }, {
{ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 9 } }, "ifLastChange" }, { { {
1, 3, 6, 1, 2, 1, 2, 2, 1, 10 } }, "ifInOctets" }, { { { 1, 3
, 6, 1, 2, 1, 2, 2, 1, 11 } }, "ifInUcastPkts" }, { { { 1, 3,
6, 1, 2, 1, 2, 2, 1, 12 } }, "ifInNUcastPkts" }, { { { 1, 3,
6, 1, 2, 1, 2, 2, 1, 13 } }, "ifInDiscards" }, { { { 1, 3, 6
, 1, 2, 1, 2, 2, 1, 14 } }, "ifInErrors" }, { { { 1, 3, 6, 1,
2, 1, 2, 2, 1, 15 } }, "ifInUnknownProtos" }, { { { 1, 3, 6,
1, 2, 1, 2, 2, 1, 16 } }, "ifOutOctets" }, { { { 1, 3, 6, 1,
2, 1, 2, 2, 1, 17 } }, "ifOutUcastPkts" }, { { { 1, 3, 6, 1,
2, 1, 2, 2, 1, 18 } }, "ifOutNUcastPkts" }, { { { 1, 3, 6, 1
, 2, 1, 2, 2, 1, 19 } }, "ifOutDiscards" }, { { { 1, 3, 6, 1,
2, 1, 2, 2, 1, 20 } }, "ifOutErrors" }, { { { 1, 3, 6, 1, 2,
1, 2, 2, 1, 21 } }, "ifOutQLen" }, { { { 1, 3, 6, 1, 2, 1, 2
, 2, 1, 22 } }, "ifSpecific" }, { { { 1, 3, 6, 1, 2, 1, 17 } }
, "dot1dBridge" }, { { { 1, 3, 6, 1, 2, 1, 17, 1 } }, "dot1dBase"
}, { { { 1, 3, 6, 1, 2, 1, 17, 1, 1 } }, "dot1dBaseBridgeAddress"
}, { { { 1, 3, 6, 1, 2, 1, 17, 1, 2 } }, "dot1dBaseNumPorts"
}, { { { 1, 3, 6, 1, 2, 1, 17, 1, 3 } }, "dot1dBaseType" }, {
{ { 1, 3, 6, 1, 2, 1, 17, 1, 4 } }, "dot1dBasePortTable" }, {
{ { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1 } }, "dot1dBasePortEntry" }
, { { { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 1 } }, "dot1dBasePort"
}, { { { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 2 } }, "dot1dBasePortIfIndex"
}, { { { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 3 } }, "dot1dBasePortCircuit"
}, { { { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 4 } }, "dot1dBasePortDelayExceededDiscards"
}, { { { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 5 } }, "dot1dBasePortMtuExceededDiscards"
}, { { { 1, 3, 6, 1, 2, 1, 17, 2 } }, "dot1dStp" }, { { { 1,
3, 6, 1, 2, 1, 17, 3 } }, "dot1dSr" }, { { { 1, 3, 6, 1, 2, 1
, 17, 4 } }, "dot1dTp" }, { { { 1, 3, 6, 1, 2, 1, 17, 5 } }, "dot1dStatic"
}, { { { 1, 3, 6, 1, 4, 1, 2 } }, "ibm" }, { { { 1, 3, 6, 1,
4, 1, 3 } }, "cmu" }, { { { 1, 3, 6, 1, 4, 1, 4 } }, "unix" }
, { { { 1, 3, 6, 1, 4, 1, 9 } }, "ciscoSystems" }, { { { 1, 3
, 6, 1, 4, 1, 11 } }, "hp" }, { { { 1, 3, 6, 1, 4, 1, 20 } },
"mit" }, { { { 1, 3, 6, 1, 4, 1, 35 } }, "nortelNetworks" },
{ { { 1, 3, 6, 1, 4, 1, 42 } }, "sun" }, { { { 1, 3, 6, 1, 4
, 1, 43 } }, "3com" }, { { { 1, 3, 6, 1, 4, 1, 45 } }, "synOptics"
}, { { { 1, 3, 6, 1, 4, 1, 52 } }, "enterasys" }, { { { 1, 3
, 6, 1, 4, 1, 59 } }, "sgi" }, { { { 1, 3, 6, 1, 4, 1, 63 } }
, "apple" }, { { { 1, 3, 6, 1, 4, 1, 71 } }, "nasa" }, { { { 1
, 3, 6, 1, 4, 1, 74 } }, "att" }, { { { 1, 3, 6, 1, 4, 1, 94 }
}, "nokia" }, { { { 1, 3, 6, 1, 4, 1, 96 } }, "cern" }, { { {
1, 3, 6, 1, 4, 1, 111 } }, "oracle" }, { { { 1, 3, 6, 1, 4, 1
, 161 } }, "motorola" }, { { { 1, 3, 6, 1, 4, 1, 191 } }, "ncr"
}, { { { 1, 3, 6, 1, 4, 1, 193 } }, "ericsson" }, { { { 1, 3
, 6, 1, 4, 1, 231 } }, "fsc" }, { { { 1, 3, 6, 1, 4, 1, 232 }
}, "compaq" }, { { { 1, 3, 6, 1, 4, 1, 513 } }, "bmw" }, { {
{ 1, 3, 6, 1, 4, 1, 674 } }, "dell" }, { { { 1, 3, 6, 1, 4, 1
, 770 } }, "iij" }, { { { 1, 3, 6, 1, 4, 1, 1400 } }, "sandia"
}, { { { 1, 3, 6, 1, 4, 1, 1635 } }, "mercedesBenz" }, { { {
1, 3, 6, 1, 4, 1, 1872 } }, "alteon" }, { { { 1, 3, 6, 1, 4,
1, 1916 } }, "extremeNetworks" }, { { { 1, 3, 6, 1, 4, 1, 1991
} }, "foundryNetworks" }, { { { 1, 3, 6, 1, 4, 1, 2011 } }, "huawaiTechnology"
}, { { { 1, 3, 6, 1, 4, 1, 2021 } }, "ucDavis" }, { { { 1, 3
, 6, 1, 4, 1, 2238 } }, "freeBSD" }, { { { 1, 3, 6, 1, 4, 1, 2620
} }, "checkPoint" }, { { { 1, 3, 6, 1, 4, 1, 2636 } }, "juniper"
}, { { { 1, 3, 6, 1, 4, 1, 2699 } }, "printerWorkingGroup" }
, { { { 1, 3, 6, 1, 4, 1, 3195 } }, "audi" }, { { { 1, 3, 6, 1
, 4, 1, 3210 } }, "volkswagen" }, { { { 1, 3, 6, 1, 4, 1, 3717
} }, "genua" }, { { { 1, 3, 6, 1, 4, 1, 4843 } }, "amazon" }
, { { { 1, 3, 6, 1, 4, 1, 6027 } }, "force10Networks" }, { { {
1, 3, 6, 1, 4, 1, 6876 } }, "vMware" }, { { { 1, 3, 6, 1, 4,
1, 7483 } }, "alcatelLucent" }, { { { 1, 3, 6, 1, 4, 1, 7526
} }, "snom" }, { { { 1, 3, 6, 1, 4, 1, 8072 } }, "netSNMP" }
, { { { 1, 3, 6, 1, 4, 1, 10949 } }, "netflix" }, { { { 1, 3,
6, 1, 4, 1, 11129 } }, "google" }, { { { 1, 3, 6, 1, 4, 1, 12276
} }, "f5Networks" }, { { { 1, 3, 6, 1, 4, 1, 13635 } }, "bsws"
}, { { { 1, 3, 6, 1, 4, 1, 14706 } }, "sFlow" }, { { { 1, 3,
6, 1, 4, 1, 18623 } }, "microSystems" }, { { { 1, 3, 6, 1, 4
, 1, 25461 } }, "paloAltoNetworks" }, { { { 1, 3, 6, 1, 4, 1,
25506 } }, "h3c" }, { { { 1, 3, 6, 1, 4, 1, 26766 } }, "vantronix"
}, { { { 1, 3, 6, 1, 4, 1, 32388 } }, "netBSD" }, { { { 1, 3
, 6, 1, 4, 1, 30155 } }, "openBSD" }, { { { 1, 3, 6, 1, 4, 1,
39961 } }, "nicira" }, { { { 1, 3, 6, 1, 4, 1, 42459 } }, "esdenera"
}, { { { 1, 3, 6, 1, 4, 1, 52198 } }, "arcaTrust" }, { { { 1
, 3, 6, 1, 4, 1, 2021, 13 } }, "ucdExperimental" }, { { { 1, 3
, 6, 1, 4, 1, 2021, 13, 15 } }, "ucdDiskIOMIB" }, { { { 1, 3,
6, 1, 4, 1, 2021, 13, 15, 1 } }, "diskIOTable" }, { { { 1, 3
, 6, 1, 4, 1, 2021, 13, 15, 1, 1 } }, "diskIOEntry" }, { { { 1
, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 1 } }, "diskIOIndex" }, {
{ { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 2 } }, "diskIODevice"
}, { { { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 3 } }, "diskIONRead"
}, { { { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 4 } }, "diskIONWritten"
}, { { { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 5 } }, "diskIOReads"
}, { { { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 6 } }, "diskIOWrites"
}, { { { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 12 } }, "diskIONReadX"
}, { { { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 13 } }, "diskIONWrittenX"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1 } }, "pfMIBObjects" }, {
{ { 1, 3, 6, 1, 4, 1, 30155, 1, 1 } }, "pfInfo" }, { { { 1, 3
, 6, 1, 4, 1, 30155, 1, 1, 1 } }, "pfRunning" }, { { { 1, 3, 6
, 1, 4, 1, 30155, 1, 1, 2 } }, "pfRuntime" }, { { { 1, 3, 6, 1
, 4, 1, 30155, 1, 1, 3 } }, "pfDebug" }, { { { 1, 3, 6, 1, 4,
1, 30155, 1, 1, 4 } }, "pfHostid" }, { { { 1, 3, 6, 1, 4, 1,
30155, 1, 2 } }, "pfCounters" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 1, 2, 1 } }, "pfCntMatch" }, { { { 1, 3, 6, 1, 4, 1, 30155,
1, 2, 2 } }, "pfCntBadOffset" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 1, 2, 3 } }, "pfCntFragment" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 1, 2, 4 } }, "pfCntShort" }, { { { 1, 3, 6, 1, 4, 1, 30155,
1, 2, 5 } }, "pfCntNormalize" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 1, 2, 6 } }, "pfCntMemory" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 1, 2, 7 } }, "pfCntTimestamp" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 1, 2, 8 } }, "pfCntCongestion" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 1, 2, 9 } }, "pfCntIpOptions" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 1, 2, 10 } }, "pfCntProtoCksum" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 1, 2, 11 } }, "pfCntStateMismatch" }, { { { 1, 3, 6, 1, 4, 1
, 30155, 1, 2, 12 } }, "pfCntStateInsert" }, { { { 1, 3, 6, 1
, 4, 1, 30155, 1, 2, 13 } }, "pfCntStateLimit" }, { { { 1, 3,
6, 1, 4, 1, 30155, 1, 2, 14 } }, "pfCntSrcLimit" }, { { { 1,
3, 6, 1, 4, 1, 30155, 1, 2, 15 } }, "pfCntSynproxy" }, { { {
1, 3, 6, 1, 4, 1, 30155, 1, 2, 16 } }, "pfCntTranslate" }, {
{ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 17 } }, "pfCntNoRoute" },
{ { { 1, 3, 6, 1, 4, 1, 30155, 1, 3 } }, "pfStateTable" }, {
{ { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 1 } }, "pfStateCount" }, {
{ { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 2 } }, "pfStateSearches" }
, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 3 } }, "pfStateInserts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 4 } }, "pfStateRemovals"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4 } }, "pfLogInterface"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 1 } }, "pfLogIfName"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 2 } }, "pfLogIfIpBytesIn"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 3 } }, "pfLogIfIpBytesOut"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 4 } }, "pfLogIfIpPktsInPass"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 5 } }, "pfLogIfIpPktsInDrop"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 6 } }, "pfLogIfIpPktsOutPass"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 7 } }, "pfLogIfIpPktsOutDrop"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 8 } }, "pfLogIfIp6BytesIn"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 9 } }, "pfLogIfIp6BytesOut"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 10 } }, "pfLogIfIp6PktsInPass"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 11 } }, "pfLogIfIp6PktsInDrop"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 12 } }, "pfLogIfIp6PktsOutPass"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 13 } }, "pfLogIfIp6PktsOutDrop"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 5 } }, "pfSrcTracking" }
, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 1 } }, "pfSrcTrackCount"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 2 } }, "pfSrcTrackSearches"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 3 } }, "pfSrcTrackInserts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 4 } }, "pfSrcTrackRemovals"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 6 } }, "pfLimits" }, { {
{ 1, 3, 6, 1, 4, 1, 30155, 1, 6, 1 } }, "pfLimitStates" }, {
{ { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 2 } }, "pfLimitSourceNodes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 3 } }, "pfLimitFragments"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 4 } }, "pfLimitMaxTables"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 5 } }, "pfLimitMaxTableEntries"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7 } }, "pfTimeouts" }, {
{ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 1 } }, "pfTimeoutTcpFirst"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 2 } }, "pfTimeoutTcpOpening"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 3 } }, "pfTimeoutTcpEstablished"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 4 } }, "pfTimeoutTcpClosing"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 5 } }, "pfTimeoutTcpFinWait"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 6 } }, "pfTimeoutTcpClosed"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 7 } }, "pfTimeoutUdpFirst"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 8 } }, "pfTimeoutUdpSingle"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 9 } }, "pfTimeoutUdpMultiple"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 10 } }, "pfTimeoutIcmpFirst"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 11 } }, "pfTimeoutIcmpError"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 12 } }, "pfTimeoutOtherFirst"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 13 } }, "pfTimeoutOtherSingle"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 14 } }, "pfTimeoutOtherMultiple"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 15 } }, "pfTimeoutFragment"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 16 } }, "pfTimeoutInterval"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 17 } }, "pfTimeoutAdaptiveStart"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 18 } }, "pfTimeoutAdaptiveEnd"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 19 } }, "pfTimeoutSrcTrack"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8 } }, "pfInterfaces" }
, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 1 } }, "pfIfNumber" },
{ { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128 } }, "pfIfTable" },
{ { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1 } }, "pfIfEntry"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 1 } }, "pfIfIndex"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 2 } }, "pfIfDescr"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 3 } }, "pfIfType"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 4 } }, "pfIfRefs"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 5 } }, "pfIfRules"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 6 } }, "pfIfIn4PassPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 7 } }, "pfIfIn4PassBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 8 } }, "pfIfIn4BlockPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 9 } }, "pfIfIn4BlockBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 10 } }, "pfIfOut4PassPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 11 } }, "pfIfOut4PassBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 12 } }, "pfIfOut4BlockPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 13 } }, "pfIfOut4BlockBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 14 } }, "pfIfIn6PassPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 15 } }, "pfIfIn6PassBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 16 } }, "pfIfIn6BlockPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 17 } }, "pfIfIn6BlockBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 18 } }, "pfIfOut6PassPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 19 } }, "pfIfOut6PassBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 20 } }, "pfIfOut6BlockPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 21 } }, "pfIfOut6BlockBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9 } }, "pfTables" }, { {
{ 1, 3, 6, 1, 4, 1, 30155, 1, 9, 1 } }, "pfTblNumber" }, { {
{ 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128 } }, "pfTblTable" }, { {
{ 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1 } }, "pfTblEntry" },
{ { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 1 } }, "pfTblIndex"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 2 } }, "pfTblName"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 3 } }, "pfTblAddresses"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 4 } }, "pfTblAnchorRefs"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 5 } }, "pfTblRuleRefs"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 6 } }, "pfTblEvalsMatch"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 7 } }, "pfTblEvalsNoMatch"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 8 } }, "pfTblInPassPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 9 } }, "pfTblInPassBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 10 } }, "pfTblInBlockPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 11 } }, "pfTblInBlockBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 12 } }, "pfTblInXPassPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 13 } }, "pfTblInXPassBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 14 } }, "pfTblOutPassPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 15 } }, "pfTblOutPassBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 16 } }, "pfTblOutBlockPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 17 } }, "pfTblOutBlockBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 18 } }, "pfTblOutXPassPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 19 } }, "pfTblOutXPassBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 20 } }, "pfTblStatsCleared"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 21 } }, "pfTblInMatchPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 22 } }, "pfTblInMatchBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 23 } }, "pfTblOutMatchPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 24 } }, "pfTblOutMatchBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129 } }, "pfTblAddrTable"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1 } }, "pfTblAddrEntry"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 1 } }, "pfTblAddrTblIndex"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 2 } }, "pfTblAddrNet"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 3 } }, "pfTblAddrMask"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 4 } }, "pfTblAddrCleared"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 5 } }, "pfTblAddrInBlockPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 6 } }, "pfTblAddrInBlockBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 7 } }, "pfTblAddrInPassPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 8 } }, "pfTblAddrInPassBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 9 } }, "pfTblAddrOutBlockPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 10 } }, "pfTblAddrOutBlockBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 11 } }, "pfTblAddrOutPassPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 12 } }, "pfTblAddrOutPassBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 13 } }, "pfTblAddrInMatchPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 14 } }, "pfTblAddrInMatchBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 15 } }, "pfTblAddrOutMatchPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 16 } }, "pfTblAddrOutMatchBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10 } }, "pfLabels" }, {
{ { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 1 } }, "pfLabelNumber" }
, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128 } }, "pfLabelTable"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1 } }, "pfLabelEntry"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 1 } }, "pfLabelIndex"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 2 } }, "pfLabelName"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 3 } }, "pfLabelEvals"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 4 } }, "pfLabelPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 5 } }, "pfLabelBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 6 } }, "pfLabelInPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 7 } }, "pfLabelInBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 8 } }, "pfLabelOutPkts"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 9 } }, "pfLabelOutBytes"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 10 } }, "pfLabelTotalStates"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11 } }, "pfsyncStats" }
, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 1 } }, "pfsyncIpPktsRecv"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 2 } }, "pfsyncIp6PktsRecv"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 3 } }, "pfsyncPktDiscardsForBadInterface"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 4 } }, "pfsyncPktDiscardsForBadTtl"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 5 } }, "pfsyncPktShorterThanHeader"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 6 } }, "pfsyncPktDiscardsForBadVersion"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 7 } }, "pfsyncPktDiscardsForBadAction"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 8 } }, "pfsyncPktDiscardsForBadLength"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 9 } }, "pfsyncPktDiscardsForBadAuth"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 10 } }, "pfsyncPktDiscardsForStaleState"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 11 } }, "pfsyncPktDiscardsForBadValues"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 12 } }, "pfsyncPktDiscardsForBadState"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 13 } }, "pfsyncIpPktsSent"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 14 } }, "pfsyncIp6PktsSent"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 15 } }, "pfsyncNoMemory"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 16 } }, "pfsyncOutputErrors"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 2 } }, "sensorsMIBObjects"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 3 } }, "relaydMIBObjects" }
, { { { 1, 3, 6, 1, 4, 1, 30155, 3, 1 } }, "relaydHostTrap" }
, { { { 1, 3, 6, 1, 4, 1, 30155, 3, 1, 1 } }, "relaydHostTrapHostName"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 3, 1, 2 } }, "relaydHostTrapUp"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 3, 1, 3 } }, "relaydHostTrapLastUp"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 3, 1, 4 } }, "relaydHostTrapUpCount"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 3, 1, 5 } }, "relaydHostTrapCheckCount"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 3, 1, 6 } }, "relaydHostTrapTableName"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 3, 1, 7 } }, "relaydHostTrapTableUp"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 3, 1, 8 } }, "relaydHostTrapRetry"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 3, 1, 9 } }, "relaydHostTrapRetryCount"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 2, 1 } }, "sensors" }, { {
{ 1, 3, 6, 1, 4, 1, 30155, 2, 1, 1 } }, "sensorNumber" }, { {
{ 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2 } }, "sensorTable" }, { {
{ 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1 } }, "sensorEntry" }, {
{ { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 1 } }, "sensorIndex"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 2 } }, "sensorDescr"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 3 } }, "sensorType"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 4 } }, "sensorDevice"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 5 } }, "sensorValue"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 6 } }, "sensorUnits"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 7 } }, "sensorStatus"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 5 } }, "memMIBObjects" }, {
{ { 1, 3, 6, 1, 4, 1, 30155, 5, 1 } }, "memMIBVersion" }, { {
{ 1, 3, 6, 1, 4, 1, 30155, 5, 2 } }, "memIfTable" }, { { { 1
, 3, 6, 1, 4, 1, 30155, 5, 2, 1 } }, "memIfEntry" }, { { { 1,
3, 6, 1, 4, 1, 30155, 5, 2, 1, 1 } }, "memIfName" }, { { { 1
, 3, 6, 1, 4, 1, 30155, 5, 2, 1, 2 } }, "memIfLiveLocks" }, {
{ { 1, 3, 6, 1, 4, 1, 30155, 6 } }, "carpMIBObjects" }, { { {
1, 3, 6, 1, 4, 1, 30155, 6, 1 } }, "carpSysctl" }, { { { 1, 3
, 6, 1, 4, 1, 30155, 6, 1, 1 } }, "carpAllow" }, { { { 1, 3, 6
, 1, 4, 1, 30155, 6, 1, 2 } }, "carpPreempt" }, { { { 1, 3, 6
, 1, 4, 1, 30155, 6, 1, 3 } }, "carpLog" }, { { { 1, 3, 6, 1,
4, 1, 30155, 6, 2 } }, "carpIf" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 6, 2, 1 } }, "carpIfNumber" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 6, 2, 2 } }, "carpIfTable" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 6, 2, 2, 1 } }, "carpIfEntry" }, { { { 1, 3, 6, 1, 4, 1, 30155
, 6, 2, 2, 1, 1 } }, "carpIfIndex" }, { { { 1, 3, 6, 1, 4, 1,
30155, 6, 2, 2, 1, 2 } }, "carpIfDescr" }, { { { 1, 3, 6, 1,
4, 1, 30155, 6, 2, 2, 1, 3 } }, "carpIfVhid" }, { { { 1, 3, 6
, 1, 4, 1, 30155, 6, 2, 2, 1, 4 } }, "carpIfDev" }, { { { 1, 3
, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 5 } }, "carpIfAdvbase" }, { {
{ 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 6 } }, "carpIfAdvskew"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 7 } }, "carpIfState"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3 } }, "carpStats" }, {
{ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 1 } }, "carpIpPktsRecv" }
, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 2 } }, "carpIp6PktsRecv"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 3 } }, "carpPktDiscardsBadIface"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 4 } }, "carpPktDiscardsBadTtl"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 5 } }, "carpPktShorterThanHdr"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 6 } }, "carpDiscardsBadCksum"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 7 } }, "carpDiscardsBadVersion"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 8 } }, "carpDiscardsTooShort"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 9 } }, "carpDiscardsBadAuth"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 10 } }, "carpDiscardsBadVhid"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 11 } }, "carpDiscardsBadAddrList"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 12 } }, "carpIpPktsSent"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 13 } }, "carpIp6PktsSent"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 14 } }, "carpNoMemory"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 15 } }, "carpTransitionsToMaster"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 4 } }, "carpGroupTable"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 4, 1 } }, "carpGroupEntry"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 4, 1, 2 } }, "carpGroupName"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 6, 4, 1, 3 } }, "carpGroupDemote"
}, { { { 1, 3, 6, 1, 4, 1, 30155, 23 } }, "localSystem" }, {
{ { 1, 3, 6, 1, 4, 1, 30155, 42 } }, "localTest" }, { { { 1,
3, 6, 1, 2, 1, 4 } }, "ipMIB" }, { { { 1, 3, 6, 1, 2, 1, 4, 1
} }, "ipForwarding" }, { { { 1, 3, 6, 1, 2, 1, 4, 2 } }, "ipDefaultTTL"
}, { { { 1, 3, 6, 1, 2, 1, 4, 3 } }, "ipInReceives" }, { { {
1, 3, 6, 1, 2, 1, 4, 4 } }, "ipInHdrErrors" }, { { { 1, 3, 6
, 1, 2, 1, 4, 5 } }, "ipInAddrErrors" }, { { { 1, 3, 6, 1, 2,
1, 4, 6 } }, "ipForwDatagrams" }, { { { 1, 3, 6, 1, 2, 1, 4,
7 } }, "ipInUnknownProtos" }, { { { 1, 3, 6, 1, 2, 1, 4, 8 }
}, "ipInDiscards" }, { { { 1, 3, 6, 1, 2, 1, 4, 9 } }, "ipInDelivers"
}, { { { 1, 3, 6, 1, 2, 1, 4, 10 } }, "ipOutRequests" }, { {
{ 1, 3, 6, 1, 2, 1, 4, 11 } }, "ipOutDiscards" }, { { { 1, 3
, 6, 1, 2, 1, 4, 12 } }, "ipOutNoRoutes" }, { { { 1, 3, 6, 1,
2, 1, 4, 13 } }, "ipReasmTimeout" }, { { { 1, 3, 6, 1, 2, 1,
4, 14 } }, "ipReasmReqds" }, { { { 1, 3, 6, 1, 2, 1, 4, 15 }
}, "ipReasmOKs" }, { { { 1, 3, 6, 1, 2, 1, 4, 16 } }, "ipReasmFails"
}, { { { 1, 3, 6, 1, 2, 1, 4, 17 } }, "ipFragOKs" }, { { { 1
, 3, 6, 1, 2, 1, 4, 18 } }, "ipFragFails" }, { { { 1, 3, 6, 1
, 2, 1, 4, 19 } }, "ipFragCreates" }, { { { 1, 3, 6, 1, 2, 1,
4, 23 } }, "ipRoutingDiscards" }, { { { 1, 3, 6, 1, 2, 1, 4,
20 } }, "ipAddrTable" }, { { { 1, 3, 6, 1, 2, 1, 4, 20, 1 } }
, "ipAddrEntry" }, { { { 1, 3, 6, 1, 2, 1, 4, 20, 1, 1 } }, "ipAdEntAddr"
}, { { { 1, 3, 6, 1, 2, 1, 4, 20, 1, 2 } }, "ipAdEntIfIndex"
}, { { { 1, 3, 6, 1, 2, 1, 4, 20, 1, 3 } }, "ipAdEntNetMask"
}, { { { 1, 3, 6, 1, 2, 1, 4, 20, 1, 4 } }, "ipAdEntBcastAddr"
}, { { { 1, 3, 6, 1, 2, 1, 4, 20, 1, 5 } }, "ipAdEntReasmMaxSize"
}, { { { 1, 3, 6, 1, 2, 1, 4, 22 } }, "ipNetToMediaTable" },
{ { { 1, 3, 6, 1, 2, 1, 4, 22, 1 } }, "ipNetToMediaEntry" },
{ { { 1, 3, 6, 1, 2, 1, 4, 22, 1, 1 } }, "ipNetToMediaIfIndex"
}, { { { 1, 3, 6, 1, 2, 1, 4, 22, 1, 2 } }, "ipNetToMediaPhysAddress"
}, { { { 1, 3, 6, 1, 2, 1, 4, 22, 1, 3 } }, "ipNetToMediaNetAddress"
}, { { { 1, 3, 6, 1, 2, 1, 4, 22, 1, 4 } }, "ipNetToMediaType"
}, { { { 1, 3, 6, 1, 2, 1, 4, 24 } }, "ipfMIB" }, { { { 1, 3
, 6, 1, 2, 1, 4, 24, 6 } }, "ipfInetCidrRouteNumber" }, { { {
1, 3, 6, 1, 2, 1, 4, 24, 7 } }, "ipfInetCidrRouteTable" }, {
{ { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1 } }, "ipfInetCidrRouteEntry"
}, { { { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 7 } }, "ipfRouteEntIfIndex"
}, { { { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 8 } }, "ipfRouteEntType"
}, { { { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 9 } }, "ipfRouteEntProto"
}, { { { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 10 } }, "ipfRouteEntAge"
}, { { { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 11 } }, "ipfRouteEntNextHopAS"
}, { { { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 12 } }, "ipfRouteEntRouteMetric1"
}, { { { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 13 } }, "ipfRouteEntRouteMetric2"
}, { { { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 14 } }, "ipfRouteEntRouteMetric3"
}, { { { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 15 } }, "ipfRouteEntRouteMetric4"
}, { { { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 16 } }, "ipfRouteEntRouteMetric5"
}, { { { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 17 } }, "ipfRouteEntStatus"
}, { { { 0 } }, ((void *)0) } }
;
73static struct ber_oid zerodotzero = { { 0, 0 }, 2 };
74
75/* base MIB tree */
76static struct oid base_mib[] = {
77 { MIB(mib_2){ { 1, 3, 6, 1, 2, 1 } }, ((void *)0), OID_MIB0x20 },
78 { MIB(sysDescr){ { 1, 3, 6, 1, 2, 1, 1, 1 } }, ((void *)0), OID_RD0x01, mib_getsys },
79 { MIB(sysOID){ { 1, 3, 6, 1, 2, 1, 1, 2 } }, ((void *)0), OID_RD0x01, mib_getsys },
80 { MIB(sysUpTime){ { 1, 3, 6, 1, 2, 1, 1, 3 } }, ((void *)0), OID_RD0x01, mib_getsys },
81 { MIB(sysContact){ { 1, 3, 6, 1, 2, 1, 1, 4 } }, ((void *)0), OID_RW(0x01|0x02), mib_getsys, mps_setstr },
82 { MIB(sysName){ { 1, 3, 6, 1, 2, 1, 1, 5 } }, ((void *)0), OID_RW(0x01|0x02), mib_getsys, mps_setstr },
83 { MIB(sysLocation){ { 1, 3, 6, 1, 2, 1, 1, 6 } }, ((void *)0), OID_RW(0x01|0x02), mib_getsys, mps_setstr },
84 { MIB(sysServices){ { 1, 3, 6, 1, 2, 1, 1, 7 } }, ((void *)0), OID_RS(0x01|0x04), mib_getsys },
85 { MIB(sysORLastChange){ { 1, 3, 6, 1, 2, 1, 1, 8 } }, ((void *)0), OID_RD0x01, mps_getts },
86 { MIB(sysORIndex){ { 1, 3, 6, 1, 2, 1, 1, 9, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_sysor },
87 { MIB(sysORID){ { 1, 3, 6, 1, 2, 1, 1, 9, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_sysor },
88 { MIB(sysORDescr){ { 1, 3, 6, 1, 2, 1, 1, 9, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_sysor },
89 { MIB(sysORUpTime){ { 1, 3, 6, 1, 2, 1, 1, 9, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_sysor },
90 { MIB(snmp){ { 1, 3, 6, 1, 2, 1, 11 } }, ((void *)0), OID_MIB0x20 },
91 { MIB(snmpInPkts){ { 1, 3, 6, 1, 2, 1, 11, 1 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
92 { MIB(snmpOutPkts){ { 1, 3, 6, 1, 2, 1, 11, 2 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
93 { MIB(snmpInBadVersions){ { 1, 3, 6, 1, 2, 1, 11, 3 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
94 { MIB(snmpInBadCommunityNames){ { 1, 3, 6, 1, 2, 1, 11, 4 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
95 { MIB(snmpInBadCommunityUses){ { 1, 3, 6, 1, 2, 1, 11, 5 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
96 { MIB(snmpInASNParseErrs){ { 1, 3, 6, 1, 2, 1, 11, 6 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
97 { MIB(snmpInTooBigs){ { 1, 3, 6, 1, 2, 1, 11, 8 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
98 { MIB(snmpInNoSuchNames){ { 1, 3, 6, 1, 2, 1, 11, 9 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
99 { MIB(snmpInBadValues){ { 1, 3, 6, 1, 2, 1, 11, 10 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
100 { MIB(snmpInReadOnlys){ { 1, 3, 6, 1, 2, 1, 11, 11 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
101 { MIB(snmpInGenErrs){ { 1, 3, 6, 1, 2, 1, 11, 12 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
102 { MIB(snmpInTotalReqVars){ { 1, 3, 6, 1, 2, 1, 11, 13 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
103 { MIB(snmpInTotalSetVars){ { 1, 3, 6, 1, 2, 1, 11, 14 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
104 { MIB(snmpInGetRequests){ { 1, 3, 6, 1, 2, 1, 11, 15 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
105 { MIB(snmpInGetNexts){ { 1, 3, 6, 1, 2, 1, 11, 16 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
106 { MIB(snmpInSetRequests){ { 1, 3, 6, 1, 2, 1, 11, 17 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
107 { MIB(snmpInGetResponses){ { 1, 3, 6, 1, 2, 1, 11, 18 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
108 { MIB(snmpInTraps){ { 1, 3, 6, 1, 2, 1, 11, 19 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
109 { MIB(snmpOutTooBigs){ { 1, 3, 6, 1, 2, 1, 11, 20 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
110 { MIB(snmpOutNoSuchNames){ { 1, 3, 6, 1, 2, 1, 11, 21 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
111 { MIB(snmpOutBadValues){ { 1, 3, 6, 1, 2, 1, 11, 22 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
112 { MIB(snmpOutGenErrs){ { 1, 3, 6, 1, 2, 1, 11, 24 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
113 { MIB(snmpOutGetRequests){ { 1, 3, 6, 1, 2, 1, 11, 25 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
114 { MIB(snmpOutGetNexts){ { 1, 3, 6, 1, 2, 1, 11, 26 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
115 { MIB(snmpOutSetRequests){ { 1, 3, 6, 1, 2, 1, 11, 27 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
116 { MIB(snmpOutGetResponses){ { 1, 3, 6, 1, 2, 1, 11, 28 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
117 { MIB(snmpOutTraps){ { 1, 3, 6, 1, 2, 1, 11, 29 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
118 { MIB(snmpEnableAuthenTraps){ { 1, 3, 6, 1, 2, 1, 11, 30 } }, ((void *)0), OID_RW(0x01|0x02), mib_getsnmp, mib_setsnmp },
119 { MIB(snmpSilentDrops){ { 1, 3, 6, 1, 2, 1, 11, 31 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
120 { MIB(snmpProxyDrops){ { 1, 3, 6, 1, 2, 1, 11, 32 } }, ((void *)0), OID_RD0x01, mib_getsnmp },
121 { MIBEND{ { 0 } }, ((void *)0) }
122};
123
124int
125mib_getsys(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
126{
127 struct ber_oid sysoid = OID(MIB_SYSOID_DEFAULT){ { 1, 3, 6, 1, 4, 1, 30155, 23, 1 } };
128 char *s = oid->o_data;
129 struct ber_oid *so = oid->o_data;
130 struct utsname u;
131 long long ticks;
132
133 if (uname(&u) == -1)
134 return (-1);
135
136 switch (oid->o_oido_id.bo_id[OIDIDX_system7]) {
137 case 1:
138 if (s == NULL((void *)0)) {
139 if (asprintf(&s, "%s %s %s %s %s",
140 u.sysname, u.nodename, u.release,
141 u.version, u.machine) == -1)
142 return (-1);
143 oid->o_data = s;
144 oid->o_val = strlen(s);
145 }
146 *elm = ober_add_string(*elm, s);
147 break;
148 case 2:
149 if (so == NULL((void *)0))
150 so = &sysoid;
151 smi_oidlen(so);
152 *elm = ober_add_oid(*elm, so);
153 break;
154 case 3:
155 ticks = smi_getticks();
156 *elm = ober_add_integer(*elm, ticks);
157 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_TIMETICKS);
158 break;
159 case 4:
160 if (s == NULL((void *)0)) {
161 if (asprintf(&s, "root@%s", u.nodename) == -1)
162 return (-1);
163 oid->o_data = s;
164 oid->o_val = strlen(s);
165 }
166 *elm = ober_add_string(*elm, s);
167 break;
168 case 5:
169 if (s == NULL((void *)0)) {
170 if ((s = strdup(u.nodename)) == NULL((void *)0))
171 return (-1);
172 oid->o_data = s;
173 oid->o_val = strlen(s);
174 }
175 *elm = ober_add_string(*elm, s);
176 break;
177 case 6:
178 if (s == NULL((void *)0))
179 s = "";
180 *elm = ober_add_string(*elm, s);
181 break;
182 case 7:
183 *elm = ober_add_integer(*elm, oid->o_val);
184 break;
185 default:
186 return (-1);
187 }
188 return (0);
189}
190
191int
192mib_sysor(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
193{
194 struct ber_element *ber = *elm;
195 u_int32_t idx = 1, nmib = 0;
196 struct oid *next, *miboid;
197 char buf[SNMPD_MAXSTRLEN484];
198
199 /* Count MIB root OIDs in the tree */
200 for (next = NULL((void *)0);
201 (next = smi_foreach(next, OID_MIB0x20)) != NULL((void *)0); nmib++);
202
203 /* Get and verify the current row index */
204 idx = o->bo_id[OIDIDX_sysOREntry10];
205 if (idx > nmib)
206 return (1);
207
208 /* Find the MIB root element for this Id */
209 for (next = miboid = NULL((void *)0), nmib = 1;
210 (next = smi_foreach(next, OID_MIB0x20)) != NULL((void *)0); nmib++) {
211 if (nmib == idx)
212 miboid = next;
213 }
214 if (miboid == NULL((void *)0))
215 return (-1);
216
217 /* Tables need to prepend the OID on their own */
218 ber = ober_add_oid(ber, o);
219
220 switch (o->bo_id[OIDIDX_sysOR9]) {
221 case 1:
222 ber = ober_add_integer(ber, idx);
223 break;
224 case 2:
225 ber = ober_add_oid(ber, &miboid->o_id);
226 break;
227 case 3:
228 /*
229 * This should be a description of the MIB.
230 * But we use the symbolic OID string for now, it may
231 * help to display names of internal OIDs.
232 */
233 smi_oid2string(&miboid->o_id, buf, sizeof(buf), 0);
234 ber = ober_add_string(ber, buf);
235 break;
236 case 4:
237 /*
238 * We do not support dynamic loading of MIB at runtime,
239 * the sysORUpTime value of 0 will indicate "loaded at
240 * startup".
241 */
242 ber = ober_add_integer(ber, 0);
243 ober_set_header(ber,
244 BER_CLASS_APPLICATION0x1, SNMP_T_TIMETICKS);
245 break;
246 default:
247 return (-1);
248 }
249
250 return (0);
251}
252
253int
254mib_getsnmp(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
255{
256 struct snmp_stats *stats = &snmpd_env->sc_stats;
257 long long i;
258 struct statsmap {
259 u_int8_t m_id;
260 u_int32_t *m_ptr;
261 } mapping[] = {
262 { 1, &stats->snmp_inpkts },
263 { 2, &stats->snmp_outpkts },
264 { 3, &stats->snmp_inbadversions },
265 { 4, &stats->snmp_inbadcommunitynames },
266 { 5, &stats->snmp_inbadcommunityuses },
267 { 6, &stats->snmp_inasnparseerrs },
268 { 8, &stats->snmp_intoobigs },
269 { 9, &stats->snmp_innosuchnames },
270 { 10, &stats->snmp_inbadvalues },
271 { 11, &stats->snmp_inreadonlys },
272 { 12, &stats->snmp_ingenerrs },
273 { 13, &stats->snmp_intotalreqvars },
274 { 14, &stats->snmp_intotalsetvars },
275 { 15, &stats->snmp_ingetrequests },
276 { 16, &stats->snmp_ingetnexts },
277 { 17, &stats->snmp_insetrequests },
278 { 18, &stats->snmp_ingetresponses },
279 { 19, &stats->snmp_intraps },
280 { 20, &stats->snmp_outtoobigs },
281 { 21, &stats->snmp_outnosuchnames },
282 { 22, &stats->snmp_outbadvalues },
283 { 24, &stats->snmp_outgenerrs },
284 { 25, &stats->snmp_outgetrequests },
285 { 26, &stats->snmp_outgetnexts },
286 { 27, &stats->snmp_outsetrequests },
287 { 28, &stats->snmp_outgetresponses },
288 { 29, &stats->snmp_outtraps },
289 { 31, &stats->snmp_silentdrops },
290 { 32, &stats->snmp_proxydrops }
291 };
292
293 switch (oid->o_oido_id.bo_id[OIDIDX_snmp7]) {
294 case 30:
295 i = stats->snmp_enableauthentraps == 1 ? 1 : 2;
296 *elm = ober_add_integer(*elm, i);
297 break;
298 default:
299 for (i = 0;
300 (u_int)i < (sizeof(mapping) / sizeof(mapping[0])); i++) {
301 if (oid->o_oido_id.bo_id[OIDIDX_snmp7] == mapping[i].m_id) {
302 *elm = ober_add_integer(*elm, *mapping[i].m_ptr);
303 ober_set_header(*elm,
304 BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
305 return (0);
306 }
307 }
308 return (-1);
309 }
310
311 return (0);
312}
313
314int
315mib_setsnmp(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
316{
317 struct snmp_stats *stats = &snmpd_env->sc_stats;
318 long long i;
319
320 if (ober_get_integer(*elm, &i) == -1)
321 return (-1);
322
323 stats->snmp_enableauthentraps = i == 1 ? 1 : 0;
324
325 return (0);
326}
327
328/*
329 * Defined in SNMP-USER-BASED-SM-MIB.txt (RFC 3414)
330 */
331int mib_engine(struct oid *, struct ber_oid *, struct ber_element **);
332int mib_usmstats(struct oid *, struct ber_oid *, struct ber_element **);
333
334static struct oid usm_mib[] = {
335 { MIB(snmpEngine){ { 1, 3, 6, 1, 6, 3, 10, 2, 1 } }, ((void *)0), OID_MIB0x20 },
336 { MIB(snmpEngineID){ { 1, 3, 6, 1, 6, 3, 10, 2, 1, 1 } }, ((void *)0), OID_RD0x01, mib_engine },
337 { MIB(snmpEngineBoots){ { 1, 3, 6, 1, 6, 3, 10, 2, 1, 2 } }, ((void *)0), OID_RD0x01, mib_engine },
338 { MIB(snmpEngineTime){ { 1, 3, 6, 1, 6, 3, 10, 2, 1, 3 } }, ((void *)0), OID_RD0x01, mib_engine },
339 { MIB(snmpEngineMaxMsgSize){ { 1, 3, 6, 1, 6, 3, 10, 2, 1, 4 } }, ((void *)0), OID_RD0x01, mib_engine },
340 { MIB(usmStats){ { 1, 3, 6, 1, 6, 3, 15, 1, 1 } }, ((void *)0), OID_MIB0x20 },
341 { MIB(usmStatsUnsupportedSecLevels){ { 1, 3, 6, 1, 6, 3, 15, 1, 1, 1 } }, ((void *)0), OID_RD0x01, mib_usmstats },
342 { MIB(usmStatsNotInTimeWindow){ { 1, 3, 6, 1, 6, 3, 15, 1, 1, 2 } }, ((void *)0), OID_RD0x01, mib_usmstats },
343 { MIB(usmStatsUnknownUserNames){ { 1, 3, 6, 1, 6, 3, 15, 1, 1, 3 } }, ((void *)0), OID_RD0x01, mib_usmstats },
344 { MIB(usmStatsUnknownEngineId){ { 1, 3, 6, 1, 6, 3, 15, 1, 1, 4 } }, ((void *)0), OID_RD0x01, mib_usmstats },
345 { MIB(usmStatsWrongDigests){ { 1, 3, 6, 1, 6, 3, 15, 1, 1, 5 } }, ((void *)0), OID_RD0x01, mib_usmstats },
346 { MIB(usmStatsDecryptionErrors){ { 1, 3, 6, 1, 6, 3, 15, 1, 1, 6 } }, ((void *)0), OID_RD0x01, mib_usmstats },
347 { MIBEND{ { 0 } }, ((void *)0) }
348};
349
350int
351mib_engine(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
352{
353 switch (oid->o_oido_id.bo_id[OIDIDX_snmpEngine9]) {
354 case 1:
355 *elm = ober_add_nstring(*elm, snmpd_env->sc_engineid,
356 snmpd_env->sc_engineid_len);
357 break;
358 case 2:
359 *elm = ober_add_integer(*elm, snmpd_env->sc_engine_boots);
360 break;
361 case 3:
362 *elm = ober_add_integer(*elm, snmpd_engine_time());
363 break;
364 case 4:
365 *elm = ober_add_integer(*elm, READ_BUF_SIZE65535);
366 break;
367 default:
368 return -1;
369 }
370 return 0;
371}
372
373int
374mib_usmstats(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
375{
376 struct snmp_stats *stats = &snmpd_env->sc_stats;
377 long long i;
378 struct statsmap {
379 u_int8_t m_id;
380 u_int32_t *m_ptr;
381 } mapping[] = {
382 { OIDVAL_usmErrSecLevel1, &stats->snmp_usmbadseclevel },
383 { OIDVAL_usmErrTimeWindow2, &stats->snmp_usmtimewindow },
384 { OIDVAL_usmErrUserName3, &stats->snmp_usmnosuchuser },
385 { OIDVAL_usmErrEngineId4, &stats->snmp_usmnosuchengine },
386 { OIDVAL_usmErrDigest5, &stats->snmp_usmwrongdigest },
387 { OIDVAL_usmErrDecrypt6, &stats->snmp_usmdecrypterr },
388 };
389
390 for (i = 0; (u_int)i < (sizeof(mapping) / sizeof(mapping[0])); i++) {
391 if (oid->o_oido_id.bo_id[OIDIDX_usmStats9] == mapping[i].m_id) {
392 *elm = ober_add_integer(*elm, *mapping[i].m_ptr);
393 ober_set_header(*elm, BER_CLASS_APPLICATION0x1,
394 SNMP_T_COUNTER32);
395 return (0);
396 }
397 }
398 return (-1);
399}
400
401/*
402 * Defined in HOST-RESOURCES-MIB.txt (RFC 2790)
403 */
404
405int mib_hrsystemuptime(struct oid *, struct ber_oid *, struct ber_element **);
406int mib_hrsystemdate(struct oid *, struct ber_oid *, struct ber_element **);
407int mib_hrsystemprocs(struct oid *, struct ber_oid *, struct ber_element **);
408int mib_hrmemory(struct oid *, struct ber_oid *, struct ber_element **);
409int mib_hrstorage(struct oid *, struct ber_oid *, struct ber_element **);
410int mib_hrdevice(struct oid *, struct ber_oid *, struct ber_element **);
411int mib_hrprocessor(struct oid *, struct ber_oid *, struct ber_element **);
412int mib_hrswrun(struct oid *, struct ber_oid *, struct ber_element **);
413
414int kinfo_proc_comp(const void *, const void *);
415int kinfo_proc(u_int32_t, struct kinfo_proc **);
416void kinfo_timer_cb(int, short, void *);
417void kinfo_proc_free(void);
418int kinfo_args(struct kinfo_proc *, char **);
419
420static struct oid hr_mib[] = {
421 { MIB(host){ { 1, 3, 6, 1, 2, 1, 25 } }, ((void *)0), OID_MIB0x20 },
422 { MIB(hrSystemUptime){ { 1, 3, 6, 1, 2, 1, 25, 1, 1 } }, ((void *)0), OID_RD0x01, mib_hrsystemuptime },
423 { MIB(hrSystemDate){ { 1, 3, 6, 1, 2, 1, 25, 1, 2 } }, ((void *)0), OID_RD0x01, mib_hrsystemdate },
424 { MIB(hrSystemProcesses){ { 1, 3, 6, 1, 2, 1, 25, 1, 6 } }, ((void *)0), OID_RD0x01, mib_hrsystemprocs },
425 { MIB(hrSystemMaxProcesses){ { 1, 3, 6, 1, 2, 1, 25, 1, 7 } }, ((void *)0), OID_RD0x01, mib_hrsystemprocs },
426 { MIB(hrMemorySize){ { 1, 3, 6, 1, 2, 1, 25, 2, 2 } }, ((void *)0), OID_RD0x01, mib_hrmemory },
427 { MIB(hrStorageIndex){ { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrstorage },
428 { MIB(hrStorageType){ { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrstorage },
429 { MIB(hrStorageDescr){ { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrstorage },
430 { MIB(hrStorageAllocationUnits){ { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrstorage },
431 { MIB(hrStorageSize){ { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrstorage },
432 { MIB(hrStorageUsed){ { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 6 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrstorage },
433 { MIB(hrStorageAllocationFailures){ { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 7 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrstorage },
434 { MIB(hrDeviceIndex){ { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrdevice },
435 { MIB(hrDeviceType){ { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrdevice },
436 { MIB(hrDeviceDescr){ { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrdevice },
437 { MIB(hrDeviceID){ { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrdevice },
438 { MIB(hrDeviceStatus){ { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrdevice },
439 { MIB(hrDeviceErrors){ { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 6 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrdevice },
440 { MIB(hrProcessorFrwID){ { 1, 3, 6, 1, 2, 1, 25, 3, 3, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrprocessor },
441 { MIB(hrProcessorLoad){ { 1, 3, 6, 1, 2, 1, 25, 3, 3, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrprocessor },
442 { MIB(hrSWRunIndex){ { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrswrun },
443 { MIB(hrSWRunName){ { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrswrun },
444 { MIB(hrSWRunID){ { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrswrun },
445 { MIB(hrSWRunPath){ { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrswrun },
446 { MIB(hrSWRunParameters){ { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrswrun },
447 { MIB(hrSWRunType){ { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 6 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrswrun },
448 { MIB(hrSWRunStatus){ { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 7 } }, ((void *)0), OID_TRD(0x01|0x10), mib_hrswrun },
449 { MIBEND{ { 0 } }, ((void *)0) }
450};
451
452int
453mib_hrsystemuptime(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
454{
455 struct timespec uptime;
456 long long ticks;
457
458 if (clock_gettime(CLOCK_BOOTTIME6, &uptime) == -1)
459 return (-1);
460 ticks = uptime.tv_sec * 100 + uptime.tv_nsec / 10000000;
461 *elm = ober_add_integer(*elm, ticks);
462 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_TIMETICKS);
463
464 return (0);
465}
466
467int
468mib_hrsystemdate(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
469{
470 struct tm *ptm;
471 u_char s[11];
472 time_t now;
473 int tzoffset;
474 unsigned short year;
475
476 (void)time(&now);
477 ptm = localtime(&now);
478
479 year = htons(ptm->tm_year + 1900)(__uint16_t)(__builtin_constant_p(ptm->tm_year + 1900) ? (
__uint16_t)(((__uint16_t)(ptm->tm_year + 1900) & 0xffU
) << 8 | ((__uint16_t)(ptm->tm_year + 1900) & 0xff00U
) >> 8) : __swap16md(ptm->tm_year + 1900))
;
480 memcpy(s, &year, 2);
481 s[2] = ptm->tm_mon + 1;
482 s[3] = ptm->tm_mday;
483 s[4] = ptm->tm_hour;
484 s[5] = ptm->tm_min;
485 s[6] = ptm->tm_sec;
486 s[7] = 0;
487
488 tzoffset = ptm->tm_gmtoff;
489 if (tzoffset < 0)
490 s[8] = '-';
491 else
492 s[8] = '+';
493
494 s[9] = abs(tzoffset) / 3600;
495 s[10] = (abs(tzoffset) - (s[9] * 3600)) / 60;
496
497 *elm = ober_add_nstring(*elm, s, sizeof(s));
498
499 return (0);
500}
501
502int
503mib_hrsystemprocs(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
504{
505 char errbuf[_POSIX2_LINE_MAX2048];
506 int val;
507 int mib[] = { CTL_KERN1, KERN_MAXPROC6 };
508 kvm_t *kd;
509 size_t len;
510
511 switch (oid->o_oido_id.bo_id[OIDIDX_hrsystem8]) {
512 case 6:
513 if ((kd = kvm_openfiles(NULL((void *)0), NULL((void *)0), NULL((void *)0),
514 KVM_NO_FILES0x80000000, errbuf)) == NULL((void *)0))
515 return (-1);
516
517 if (kvm_getprocs(kd, KERN_PROC_ALL0, 0,
518 sizeof(struct kinfo_proc), &val) == NULL((void *)0)) {
519 kvm_close(kd);
520 return (-1);
521 }
522
523 *elm = ober_add_integer(*elm, val);
524 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_GAUGE32);
525
526 kvm_close(kd);
527 break;
528 case 7:
529 len = sizeof(val);
530 if (sysctl(mib, 2, &val, &len, NULL((void *)0), 0) == -1)
531 return (-1);
532
533 *elm = ober_add_integer(*elm, val);
534 break;
535 default:
536 return (-1);
537 }
538
539 return (0);
540}
541
542int
543mib_hrmemory(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
544{
545 struct ber_element *ber = *elm;
546 int mib[] = { CTL_HW6, HW_PHYSMEM6419 };
547 u_int64_t physmem;
548 size_t len = sizeof(physmem);
549
550 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &physmem, &len, NULL((void *)0), 0) == -1)
551 return (-1);
552
553 ber = ober_add_integer(ber, physmem / 1024);
554
555 return (0);
556}
557
558int
559mib_hrstorage(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
560{
561 struct ber_element *ber = *elm;
562 u_int32_t idx;
563 struct statfs *mntbuf, *mnt;
564 int mntsize, maxsize;
565 u_int64_t units, size, used, fail = 0;
566 const char *descr = NULL((void *)0);
567 int mib[] = { CTL_HW6, 0 };
568 u_int64_t physmem, realmem;
569 struct uvmexp uvm;
570 size_t len;
571 static struct ber_oid *sop, so[] = {
572 { { MIB_hrStorageOther1, 3, 6, 1, 2, 1, 25, 2, 1, 1 } },
573 { { MIB_hrStorageRam1, 3, 6, 1, 2, 1, 25, 2, 1, 2 } },
574 { { MIB_hrStorageVirtualMemory1, 3, 6, 1, 2, 1, 25, 2, 1, 3 } },
575 { { MIB_hrStorageFixedDisk1, 3, 6, 1, 2, 1, 25, 2, 1, 4 } }
576 };
577
578 /* Physical memory, real memory, swap */
579 mib[1] = HW_PHYSMEM6419;
580 len = sizeof(physmem);
581 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &physmem, &len, NULL((void *)0), 0) == -1)
582 return (-1);
583 mib[1] = HW_USERMEM6420;
584 len = sizeof(realmem);
585 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &realmem, &len, NULL((void *)0), 0) == -1)
586 return (-1);
587 mib[0] = CTL_VM2;
588 mib[1] = VM_UVMEXP4;
589 len = sizeof(uvm);
590 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &uvm, &len, NULL((void *)0), 0) == -1)
591 return (-1);
592 maxsize = 10;
593
594 /* Disks */
595 mntsize = getmntinfo(&mntbuf, MNT_NOWAIT2);
596 if (mntsize)
597 maxsize = 30 + mntsize;
598
599 /*
600 * Get and verify the current row index.
601 *
602 * We use a special mapping here that is inspired by other SNMP
603 * agents: index 1 + 2 for RAM, index 10 for swap, index 31 and
604 * higher for disk storage.
605 */
606 idx = o->bo_id[OIDIDX_hrStorageEntry11];
607 if (idx > (u_int)maxsize)
608 return (1);
609 else if (idx > 2 && idx < 10)
610 idx = 10;
611 else if (idx > 10 && idx < 31)
612 idx = 31;
613
614 sop = &so[0];
615 switch (idx) {
616 case 0:
617 return (-1);
618 case 1:
619 descr = "Physical memory";
620 units = uvm.pagesize;
621 size = physmem / uvm.pagesize;
622 used = size - uvm.free;
623 sop = &so[1];
624 break;
625 case 2:
626 descr = "Real memory";
627 units = uvm.pagesize;
628 size = realmem / uvm.pagesize;
629 used = size - uvm.free;
630 sop = &so[1];
631 break;
632 case 10:
633 descr = "Swap space";
634 units = uvm.pagesize;
635 size = uvm.swpages;
636 used = uvm.swpginuse;
637 sop = &so[2];
638 break;
639 default:
640 mnt = &mntbuf[idx - 31];
641 descr = mnt->f_mntonname;
642 units = mnt->f_bsize;
643 size = mnt->f_blocks;
644 used = mnt->f_blocks - mnt->f_bfree;
645 sop = &so[3];
646 break;
647 }
648
649 while (size > INT32_MAX0x7fffffff) {
650 units *= 2;
651 size /= 2;
652 used /= 2;
653 }
654
655 /* Tables need to prepend the OID on their own */
656 o->bo_id[OIDIDX_hrStorageEntry11] = idx;
657 ber = ober_add_oid(ber, o);
658
659 switch (o->bo_id[OIDIDX_hrStorage10]) {
660 case 1: /* hrStorageIndex */
661 ber = ober_add_integer(ber, idx);
662 break;
663 case 2: /* hrStorageType */
664 smi_oidlen(sop);
665 ber = ober_add_oid(ber, sop);
666 break;
667 case 3: /* hrStorageDescr */
668 ber = ober_add_string(ber, descr);
669 break;
670 case 4: /* hrStorageAllocationUnits */
671 ber = ober_add_integer(ber, units);
672 break;
673 case 5: /* hrStorageSize */
674 ber = ober_add_integer(ber, size);
675 break;
676 case 6: /* hrStorageUsed */
677 ber = ober_add_integer(ber, used);
678 break;
679 case 7: /* hrStorageAllocationFailures */
680 ber = ober_add_integer(ber, fail);
681 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
682 break;
683 default:
684 return (-1);
685 }
686
687 return (0);
688}
689
690int
691mib_hrdevice(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
692{
693 struct ber_element *ber = *elm;
694 u_int32_t idx, fail = 0;
695 int status;
696 int mib[] = { CTL_HW6, HW_MODEL2 };
697 size_t len;
698 char descr[BUFSIZ1024];
699 static struct ber_oid *sop, so[] = {
700 { { MIB_hrDeviceProcessor1, 3, 6, 1, 2, 1, 25, 3, 1, 3 } },
701 };
702
703 /* Get and verify the current row index */
704 idx = o->bo_id[OIDIDX_hrDeviceEntry11];
705 if (idx > (u_int)snmpd_env->sc_ncpu)
706 return (1);
707
708 /* Tables need to prepend the OID on their own */
709 o->bo_id[OIDIDX_hrDeviceEntry11] = idx;
710 ber = ober_add_oid(ber, o);
711
712 len = sizeof(descr);
713 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &descr, &len, NULL((void *)0), 0) == -1)
714 return (-1);
715 /* unknown(1), running(2), warning(3), testing(4), down(5) */
716 status = 2;
717 sop = &so[0];
718
719 switch (o->bo_id[OIDIDX_hrDevice10]) {
720 case 1: /* hrDeviceIndex */
721 ber = ober_add_integer(ber, idx);
722 break;
723 case 2: /* hrDeviceType */
724 smi_oidlen(sop);
725 ber = ober_add_oid(ber, sop);
726 break;
727 case 3: /* hrDeviceDescr */
728 ber = ober_add_string(ber, descr);
729 break;
730 case 4: /* hrDeviceID */
731 ber = ober_add_oid(ber, &zerodotzero);
732 break;
733 case 5: /* hrDeviceStatus */
734 ber = ober_add_integer(ber, status);
735 break;
736 case 6: /* hrDeviceErrors */
737 ber = ober_add_integer(ber, fail);
738 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
739 break;
740 default:
741 return (-1);
742 }
743
744 return (0);
745}
746
747int
748mib_hrprocessor(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
749{
750 struct ber_element *ber = *elm;
751 u_int32_t idx;
752 int64_t *cptime2, val;
753
754 /* Get and verify the current row index */
755 idx = o->bo_id[OIDIDX_hrDeviceEntry11];
756 if (idx > (u_int)snmpd_env->sc_ncpu)
757 return (1);
758 else if (idx < 1)
759 idx = 1;
760
761 /* Tables need to prepend the OID on their own */
762 o->bo_id[OIDIDX_hrDeviceEntry11] = idx;
763 ber = ober_add_oid(ber, o);
764
765 switch (o->bo_id[OIDIDX_hrDevice10]) {
766 case 1: /* hrProcessorFrwID */
767 ber = ober_add_oid(ber, &zerodotzero);
768 break;
769 case 2: /* hrProcessorLoad */
770 /*
771 * The percentage of time that the system was not
772 * idle during the last minute.
773 */
774 if (snmpd_env->sc_cpustates == NULL((void *)0))
775 return (-1);
776 cptime2 = snmpd_env->sc_cpustates + (CPUSTATES6 * (idx - 1));
777 val = 100 -
778 (cptime2[CP_IDLE5] > 1000 ? 1000 : (cptime2[CP_IDLE5] / 10));
779 ber = ober_add_integer(ber, val);
780 break;
781 default:
782 return (-1);
783 }
784
785 return (0);
786}
787
788int
789mib_hrswrun(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
790{
791 struct ber_element *ber = *elm;
792 struct kinfo_proc *kinfo;
793 char *s;
794
795 /* Get and verify the current row index */
796 if (kinfo_proc(o->bo_id[OIDIDX_hrSWRunEntry11], &kinfo) == -1)
797 return (1);
798
799 if (kinfo == NULL((void *)0))
800 return (1);
801
802 /* Tables need to prepend the OID on their own */
803 o->bo_id[OIDIDX_hrSWRunEntry11] = kinfo->p_pid;
804 ber = ober_add_oid(ber, o);
805
806 switch (o->bo_id[OIDIDX_hrSWRun10]) {
807 case 1: /* hrSWRunIndex */
808 ber = ober_add_integer(ber, kinfo->p_pid);
809 break;
810 case 2: /* hrSWRunName */
811 case 4: /* hrSWRunPath */
812 ber = ober_add_string(ber, kinfo->p_comm);
813 break;
814 case 3: /* hrSWRunID */
815 ber = ober_add_oid(ber, &zerodotzero);
816 break;
817 case 5: /* hrSWRunParameters */
818 if (kinfo_args(kinfo, &s) == -1)
819 return (-1);
820
821 ber = ober_add_string(ber, s);
822 break;
823 case 6: /* hrSWRunType */
824 if (kinfo->p_flag & P_SYSTEM0x00000200) {
825 /* operatingSystem(2) */
826 ber = ober_add_integer(ber, 2);
827 } else {
828 /* application(4) */
829 ber = ober_add_integer(ber, 4);
830 }
831 break;
832 case 7: /* hrSWRunStatus */
833 switch (kinfo->p_stat) {
834 case SONPROC7:
835 /* running(1) */
836 ber = ober_add_integer(ber, 1);
837 break;
838 case SIDL1:
839 case SRUN2:
840 case SSLEEP3:
841 /* runnable(2) */
842 ber = ober_add_integer(ber, 2);
843 break;
844 case SSTOP4:
845 /* notRunnable(3) */
846 ber = ober_add_integer(ber, 3);
847 break;
848 case SDEAD6:
849 default:
850 /* invalid(4) */
851 ber = ober_add_integer(ber, 4);
852 break;
853 }
854 break;
855 default:
856 return (-1);
857 }
858
859 return (0);
860}
861
862int
863kinfo_proc_comp(const void *a, const void *b)
864{
865 struct kinfo_proc * const *k1 = a;
866 struct kinfo_proc * const *k2 = b;
867
868 return (((*k1)->p_pid > (*k2)->p_pid) ? 1 : -1);
869}
870
871static struct event kinfo_timer;
872static struct kinfo_proc *kp = NULL((void *)0);
873static struct kinfo_proc **klist = NULL((void *)0);
874static size_t nkp = 0, nklist = 0;
875
876int
877kinfo_proc(u_int32_t idx, struct kinfo_proc **kinfo)
878{
879 int mib[] = { CTL_KERN1, KERN_PROC66,
880 KERN_PROC_ALL0, 0, sizeof(*kp), 0 };
881 size_t size, count, i;
882 struct timeval timer;
883
884 if (kp != NULL((void *)0) && klist != NULL((void *)0))
885 goto cached;
886
887 kinfo_proc_free();
888 for (;;) {
889 size = nkp * sizeof(*kp);
890 mib[5] = nkp;
891 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), kp, &size, NULL((void *)0), 0) == -1) {
892 if (errno(*__errno()) == ENOMEM12) {
893 kinfo_proc_free();
894 continue;
895 }
896
897 return (-1);
898 }
899
900 count = size / sizeof(*kp);
901 if (count <= nkp)
902 break;
903
904 kp = malloc(size);
905 if (kp == NULL((void *)0)) {
906 kinfo_proc_free();
907 return (-1);
908 }
909 nkp = count;
910 }
911
912 klist = calloc(count, sizeof(*klist));
913 if (klist == NULL((void *)0)) {
914 kinfo_proc_free();
915 return (-1);
916 }
917 nklist = count;
918
919 for (i = 0; i < nklist; i++)
920 klist[i] = &kp[i];
921 qsort(klist, nklist, sizeof(*klist), kinfo_proc_comp);
922
923 evtimer_set(&kinfo_timer, kinfo_timer_cb, NULL)event_set(&kinfo_timer, -1, 0, kinfo_timer_cb, ((void *)0
))
;
924 timer.tv_sec = 5;
925 timer.tv_usec = 0;
926 evtimer_add(&kinfo_timer, &timer)event_add(&kinfo_timer, &timer);
927
928cached:
929 *kinfo = NULL((void *)0);
930 for (i = 0; i < nklist; i++) {
931 if (klist[i]->p_pid >= (int32_t)idx) {
932 *kinfo = klist[i];
933 break;
934 }
935 }
936
937 return (0);
938}
939
940void
941kinfo_timer_cb(int fd, short event, void *arg)
942{
943 kinfo_proc_free();
944}
945
946void
947kinfo_proc_free(void)
948{
949 free(kp);
950 kp = NULL((void *)0);
951 nkp = 0;
952 free(klist);
953 klist = NULL((void *)0);
954 nklist = 0;
955}
956
957int
958kinfo_args(struct kinfo_proc *kinfo, char **s)
959{
960 static char str[128];
961 static char *buf = NULL((void *)0);
962 static size_t buflen = 128;
963
964 int mib[] = { CTL_KERN1, KERN_PROC_ARGS55,
965 kinfo->p_pid, KERN_PROC_ARGV1 };
966 char *nbuf, **argv;
967
968 if (buf == NULL((void *)0)) {
969 buf = malloc(buflen);
970 if (buf == NULL((void *)0))
971 return (-1);
972 }
973
974 str[0] = '\0';
975 *s = str;
976
977 while (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), buf, &buflen, NULL((void *)0), 0) == -1) {
978 if (errno(*__errno()) != ENOMEM12) {
979 /* some errors are expected, dont get too upset */
980 return (0);
981 }
982
983 nbuf = realloc(buf, buflen + 128);
984 if (nbuf == NULL((void *)0))
985 return (-1);
986
987 buf = nbuf;
988 buflen += 128;
989 }
990
991 argv = (char **)buf;
992 if (argv[0] == NULL((void *)0))
993 return (0);
994
995 argv++;
996 while (*argv != NULL((void *)0)) {
997 strlcat(str, *argv, sizeof(str));
998 argv++;
999 if (*argv != NULL((void *)0))
1000 strlcat(str, " ", sizeof(str));
1001 }
1002
1003 return (0);
1004}
1005
1006/*
1007 * Defined in IF-MIB.txt (RFCs 1229, 1573, 2233, 2863)
1008 */
1009
1010int mib_ifnumber(struct oid *, struct ber_oid *, struct ber_element **);
1011struct kif
1012 *mib_ifget(u_int);
1013int mib_iftable(struct oid *, struct ber_oid *, struct ber_element **);
1014int mib_ifxtable(struct oid *, struct ber_oid *, struct ber_element **);
1015int mib_ifstacklast(struct oid *, struct ber_oid *, struct ber_element **);
1016int mib_ifrcvtable(struct oid *, struct ber_oid *, struct ber_element **);
1017
1018static u_int8_t ether_zeroaddr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
1019
1020static struct oid if_mib[] = {
1021 { MIB(ifMIB){ { 1, 3, 6, 1, 2, 1, 31 } }, ((void *)0), OID_MIB0x20 },
1022 { MIB(ifName){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1023 { MIB(ifInMulticastPkts){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1024 { MIB(ifInBroadcastPkts){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1025 { MIB(ifOutMulticastPkts){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1026 { MIB(ifOutBroadcastPkts){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1027 { MIB(ifHCInOctets){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 6 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1028 { MIB(ifHCInUcastPkts){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 7 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1029 { MIB(ifHCInMulticastPkts){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 8 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1030 { MIB(ifHCInBroadcastPkts){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 9 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1031 { MIB(ifHCOutOctets){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 10 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1032 { MIB(ifHCOutUcastPkts){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 11 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1033 { MIB(ifHCOutMulticastPkts){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 12 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1034 { MIB(ifHCOutBroadcastPkts){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 13 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1035 { MIB(ifLinkUpDownTrapEnable){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 14 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1036 { MIB(ifHighSpeed){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 15 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1037 { MIB(ifPromiscuousMode){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 16 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1038 { MIB(ifConnectorPresent){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 17 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1039 { MIB(ifAlias){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 18 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1040 { MIB(ifCounterDiscontinuityTime){ { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 19 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifxtable },
1041 { MIB(ifRcvAddressStatus){ { 1, 3, 6, 1, 2, 1, 31, 1, 4, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifrcvtable },
1042 { MIB(ifRcvAddressType){ { 1, 3, 6, 1, 2, 1, 31, 1, 4, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ifrcvtable },
1043 { MIB(ifStackLastChange){ { 1, 3, 6, 1, 2, 1, 31, 1, 6 } }, ((void *)0), OID_RD0x01, mib_ifstacklast },
1044 { MIB(ifNumber){ { 1, 3, 6, 1, 2, 1, 2, 1 } }, ((void *)0), OID_RD0x01, mib_ifnumber },
1045 { MIB(ifIndex){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1046 { MIB(ifDescr){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1047 { MIB(ifType){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1048 { MIB(ifMtu){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1049 { MIB(ifSpeed){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1050 { MIB(ifPhysAddress){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 6 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1051 { MIB(ifAdminStatus){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 7 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1052 { MIB(ifOperStatus){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 8 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1053 { MIB(ifLastChange){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 9 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1054 { MIB(ifInOctets){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 10 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1055 { MIB(ifInUcastPkts){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 11 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1056 { MIB(ifInNUcastPkts){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 12 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1057 { MIB(ifInDiscards){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 13 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1058 { MIB(ifInErrors){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 14 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1059 { MIB(ifInUnknownProtos){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 15 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1060 { MIB(ifOutOctets){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 16 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1061 { MIB(ifOutUcastPkts){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 17 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1062 { MIB(ifOutNUcastPkts){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 18 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1063 { MIB(ifOutDiscards){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 19 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1064 { MIB(ifOutErrors){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 20 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1065 { MIB(ifOutQLen){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 21 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1066 { MIB(ifSpecific){ { 1, 3, 6, 1, 2, 1, 2, 2, 1, 22 } }, ((void *)0), OID_TRD(0x01|0x10), mib_iftable },
1067 { MIBEND{ { 0 } }, ((void *)0) }
1068};
1069
1070int
1071mib_ifnumber(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1072{
1073 *elm = ober_add_integer(*elm, kr_ifnumber());
1074 return (0);
1075}
1076
1077struct kif *
1078mib_ifget(u_int idx)
1079{
1080 struct kif *kif;
1081
1082 if ((kif = kr_getif(idx)) == NULL((void *)0)) {
1083 /*
1084 * It may happen that an interface with a specific index
1085 * does not exist or has been removed. Jump to the next
1086 * available interface index.
1087 */
1088 for (kif = kr_getif(0); kif != NULL((void *)0);
1089 kif = kr_getnextif(kif->if_index))
1090 if (kif->if_index > idx)
1091 break;
1092 if (kif == NULL((void *)0))
1093 return (NULL((void *)0));
1094 }
1095 idx = kif->if_index;
1096
1097 /* Update interface information */
1098 kr_updateif(idx);
1099 if ((kif = kr_getif(idx)) == NULL((void *)0)) {
1100 log_debug("mib_ifxtable: interface %d disappeared?", idx);
1101 return (NULL((void *)0));
1102 }
1103
1104 return (kif);
1105}
1106
1107int
1108mib_iftable(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1109{
1110 struct ber_element *ber = *elm;
1111 u_int32_t idx = 0;
1112 struct kif *kif;
1113 long long i;
1114
1115 /* Get and verify the current row index */
1116 idx = o->bo_id[OIDIDX_ifEntry10];
1117 if ((kif = mib_ifget(idx)) == NULL((void *)0))
1118 return (1);
1119
1120 /* Tables need to prepend the OID on their own */
1121 o->bo_id[OIDIDX_ifEntry10] = kif->if_index;
1122 ber = ober_add_oid(ber, o);
1123
1124 switch (o->bo_id[OIDIDX_if9]) {
1125 case 1:
1126 ber = ober_add_integer(ber, kif->if_index);
1127 break;
1128 case 2:
1129 /*
1130 * The ifDescr should contain a vendor, product, etc.
1131 * but we just use the interface name (like ifName).
1132 * The interface name includes the driver name on OpenBSD.
1133 */
1134 ber = ober_add_string(ber, kif->if_name);
1135 break;
1136 case 3:
1137 if (kif->if_typeif_data.ifi_type >= 0xf0) {
1138 /*
1139 * It does not make sense to announce the private
1140 * interface types for CARP, ENC, PFSYNC, etc.
1141 */
1142 ber = ober_add_integer(ber, IFT_OTHER0x01);
1143 } else
1144 ber = ober_add_integer(ber, kif->if_typeif_data.ifi_type);
1145 break;
1146 case 4:
1147 ber = ober_add_integer(ber, kif->if_mtuif_data.ifi_mtu);
1148 break;
1149 case 5:
1150 if (kif->if_baudrateif_data.ifi_baudrate > UINT32_MAX0xffffffffU) {
1151 /* speed should be obtained from ifHighSpeed instead */
1152 ber = ober_add_integer(ber, UINT32_MAX0xffffffffU);
1153 } else
1154 ber = ober_add_integer(ber, kif->if_baudrateif_data.ifi_baudrate);
1155 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_GAUGE32);
1156 break;
1157 case 6:
1158 if (bcmp(kif->if_lladdr, ether_zeroaddr,
1159 sizeof(kif->if_lladdr)) == 0) {
1160 ber = ober_add_string(ber, "");
1161 } else {
1162 ber = ober_add_nstring(ber, kif->if_lladdr,
1163 sizeof(kif->if_lladdr));
1164 }
1165 break;
1166 case 7:
1167 /* ifAdminStatus up(1), down(2), testing(3) */
1168 i = (kif->if_flags & IFF_UP0x1) ? 1 : 2;
1169 ber = ober_add_integer(ber, i);
1170 break;
1171 case 8:
1172 /* ifOperStatus */
1173 if ((kif->if_flags & IFF_UP0x1) == 0)
1174 i = 2; /* down(2) */
1175 else if (kif->if_link_stateif_data.ifi_link_state == LINK_STATE_UNKNOWN0)
1176 i = 4; /* unknown(4) */
1177 else if (LINK_STATE_IS_UP(kif->if_link_state)((kif->if_data.ifi_link_state) >= 4 || (kif->if_data
.ifi_link_state) == 0)
)
1178 i = 1; /* up(1) */
1179 else
1180 i = 7; /* lowerLayerDown(7) or dormant(5)? */
1181 ber = ober_add_integer(ber, i);
1182 break;
1183 case 9:
1184 ber = ober_add_integer(ber, kif->if_ticks);
1185 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_TIMETICKS);
1186 break;
1187 case 10:
1188 ber = ober_add_integer(ber, (u_int32_t)kif->if_ibytesif_data.ifi_ibytes);
1189 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1190 break;
1191 case 11:
1192 ber = ober_add_integer(ber, (u_int32_t)kif->if_ipacketsif_data.ifi_ipackets);
1193 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1194 break;
1195 case 12:
1196 ber = ober_add_integer(ber, (u_int32_t)kif->if_imcastsif_data.ifi_imcasts);
1197 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1198 break;
1199 case 13:
1200 ber = ober_add_integer(ber, (u_int32_t)kif->if_iqdropsif_data.ifi_iqdrops);
1201 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1202 break;
1203 case 14:
1204 ber = ober_add_integer(ber, (u_int32_t)kif->if_ierrorsif_data.ifi_ierrors);
1205 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1206 break;
1207 case 15:
1208 ber = ober_add_integer(ber, (u_int32_t)kif->if_noprotoif_data.ifi_noproto);
1209 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1210 break;
1211 case 16:
1212 ber = ober_add_integer(ber, (u_int32_t)kif->if_obytesif_data.ifi_obytes);
1213 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1214 break;
1215 case 17:
1216 ber = ober_add_integer(ber, (u_int32_t)kif->if_opacketsif_data.ifi_opackets);
1217 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1218 break;
1219 case 18:
1220 ber = ober_add_integer(ber, (u_int32_t)kif->if_omcastsif_data.ifi_omcasts);
1221 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1222 break;
1223 case 19:
1224 ber = ober_add_integer(ber, (u_int32_t)kif->if_oqdropsif_data.ifi_oqdrops);
1225 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1226 break;
1227 case 20:
1228 ber = ober_add_integer(ber, (u_int32_t)kif->if_oerrorsif_data.ifi_oerrors);
1229 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1230 break;
1231 case 21:
1232 ber = ober_add_integer(ber, 0);
1233 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_GAUGE32);
1234 break;
1235 case 22:
1236 ber = ober_add_oid(ber, &zerodotzero);
1237 break;
1238 default:
1239 return (-1);
1240 }
1241
1242 return (0);
1243}
1244
1245int
1246mib_ifxtable(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1247{
1248 struct ber_element *ber = *elm;
1249 u_int32_t idx = 0;
1250 struct kif *kif;
1251 int i = 0;
1252
1253 /* Get and verify the current row index */
1254 idx = o->bo_id[OIDIDX_ifXEntry11];
1255 if ((kif = mib_ifget(idx)) == NULL((void *)0))
1256 return (1);
1257
1258 /* Tables need to prepend the OID on their own */
1259 o->bo_id[OIDIDX_ifXEntry11] = kif->if_index;
1260 ber = ober_add_oid(ber, o);
1261
1262 switch (o->bo_id[OIDIDX_ifX10]) {
1263 case 1:
1264 ber = ober_add_string(ber, kif->if_name);
1265 break;
1266 case 2:
1267 ber = ober_add_integer(ber, (u_int32_t)kif->if_imcastsif_data.ifi_imcasts);
1268 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1269 break;
1270 case 3:
1271 ber = ober_add_integer(ber, 0);
1272 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1273 break;
1274 case 4:
1275 ber = ober_add_integer(ber, (u_int32_t)kif->if_omcastsif_data.ifi_omcasts);
1276 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1277 break;
1278 case 5:
1279 ber = ober_add_integer(ber, 0);
1280 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
1281 break;
1282 case 6:
1283 ber = ober_add_integer(ber, (u_int64_t)kif->if_ibytesif_data.ifi_ibytes);
1284 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
1285 break;
1286 case 7:
1287 ber = ober_add_integer(ber, (u_int64_t)kif->if_ipacketsif_data.ifi_ipackets);
1288 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
1289 break;
1290 case 8:
1291 ber = ober_add_integer(ber, (u_int64_t)kif->if_imcastsif_data.ifi_imcasts);
1292 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
1293 break;
1294 case 9:
1295 ber = ober_add_integer(ber, 0);
1296 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
1297 break;
1298 case 10:
1299 ber = ober_add_integer(ber, (u_int64_t)kif->if_obytesif_data.ifi_obytes);
1300 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
1301 break;
1302 case 11:
1303 ber = ober_add_integer(ber, (u_int64_t)kif->if_opacketsif_data.ifi_opackets);
1304 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
1305 break;
1306 case 12:
1307 ber = ober_add_integer(ber, (u_int64_t)kif->if_omcastsif_data.ifi_omcasts);
1308 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
1309 break;
1310 case 13:
1311 ber = ober_add_integer(ber, 0);
1312 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
1313 break;
1314 case 14:
1315 ber = ober_add_integer(ber, 0); /* enabled(1), disabled(2) */
1316 break;
1317 case 15:
1318 i = kif->if_baudrateif_data.ifi_baudrate >= 1000000 ?
1319 kif->if_baudrateif_data.ifi_baudrate / 1000000 : 0;
1320 ber = ober_add_integer(ber, i);
1321 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_GAUGE32);
1322 break;
1323 case 16:
1324 /* ifPromiscuousMode: true(1), false(2) */
1325 i = kif->if_flags & IFF_PROMISC0x100 ? 1 : 2;
1326 ber = ober_add_integer(ber, i);
1327 break;
1328 case 17:
1329 /* ifConnectorPresent: false(2), true(1) */
1330 i = kif->if_typeif_data.ifi_type == IFT_ETHER0x06 ? 1 : 2;
1331 ber = ober_add_integer(ber, i);
1332 break;
1333 case 18:
1334 ber = ober_add_string(ber, kif->if_descr);
1335 break;
1336 case 19:
1337 ber = ober_add_integer(ber, 0);
1338 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_TIMETICKS);
1339 break;
1340 default:
1341 return (-1);
1342 }
1343
1344 return (0);
1345}
1346
1347int
1348mib_ifstacklast(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1349{
1350 struct ber_element *ber = *elm;
1351 ber = ober_add_integer(ber, kr_iflastchange());
1352 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_TIMETICKS);
1353 return (0);
1354}
1355
1356int
1357mib_ifrcvtable(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1358{
1359 struct ber_element *ber = *elm;
1360 u_int32_t idx = 0;
1361 struct kif *kif;
1362 u_int i = 0;
1363
1364 /* Get and verify the current row index */
1365 idx = o->bo_id[OIDIDX_ifRcvAddressEntry11];
1366 if ((kif = mib_ifget(idx)) == NULL((void *)0))
1367 return (1);
1368
1369 /*
1370 * The lladdr of the interface will be encoded in the returned OID
1371 * ifRcvAddressX.ifindex.6.x.x.x.x.x.x = val
1372 * Thanks to the virtual cloner interfaces, it is an easy 1:1
1373 * mapping in OpenBSD; only one lladdr (MAC) address per interface.
1374 */
1375
1376 /* first set the base OID and caluculate the length */
1377 idx = 0;
1378 o->bo_id[OIDIDX_ifRcvAddressEntry11 + idx++] = kif->if_index;
1379 o->bo_id[OIDIDX_ifRcvAddressEntry11 + idx] = 0;
1380 smi_oidlen(o);
1381
1382 /* extend the OID with the lladdr length and octets */
1383 o->bo_id[OIDIDX_ifRcvAddressEntry11 + idx++] = sizeof(kif->if_lladdr);
1384 o->bo_n++;
1385 for (i = 0; i < sizeof(kif->if_lladdr); i++, o->bo_n++)
1386 o->bo_id[OIDIDX_ifRcvAddressEntry11 + idx++] = kif->if_lladdr[i];
1387
1388 /* write OID */
1389 ber = ober_add_oid(ber, o);
1390
1391 switch (o->bo_id[OIDIDX_ifRcvAddress10]) {
1392 case 2:
1393 /* ifRcvAddressStatus: RowStatus active(1), notInService(2) */
1394 i = kif->if_flags & IFF_UP0x1 ? 1 : 2;
1395 ber = ober_add_integer(ber, i);
1396 break;
1397 case 3:
1398 /* ifRcvAddressType: other(1), volatile(2), nonVolatile(3) */
1399 ber = ober_add_integer(ber, 1);
Value stored to 'ber' is never read
1400 break;
1401 default:
1402 return (-1);
1403 }
1404
1405 return (0);
1406}
1407
1408/*
1409 * Defined in
1410 * - OPENBSD-PF-MIB.txt
1411 * - OPENBSD-SENSORS-MIB.txt
1412 * - OPENBSD-CARP-MIB.txt
1413 * (http://www.packetmischief.ca/openbsd-snmp-mibs/)
1414 */
1415
1416struct carpif {
1417 struct carpreq carpr;
1418 struct kif kif;
1419};
1420
1421int mib_pfinfo(struct oid *, struct ber_oid *, struct ber_element **);
1422int mib_pfcounters(struct oid *, struct ber_oid *, struct ber_element **);
1423int mib_pfscounters(struct oid *, struct ber_oid *, struct ber_element **);
1424int mib_pflogif(struct oid *, struct ber_oid *, struct ber_element **);
1425int mib_pfsrctrack(struct oid *, struct ber_oid *, struct ber_element **);
1426int mib_pflimits(struct oid *, struct ber_oid *, struct ber_element **);
1427int mib_pftimeouts(struct oid *, struct ber_oid *, struct ber_element **);
1428int mib_pfifnum(struct oid *, struct ber_oid *, struct ber_element **);
1429int mib_pfiftable(struct oid *, struct ber_oid *, struct ber_element **);
1430int mib_pftablenum(struct oid *, struct ber_oid *, struct ber_element **);
1431int mib_pftables(struct oid *, struct ber_oid *, struct ber_element **);
1432int mib_pftableaddrs(struct oid *, struct ber_oid *, struct ber_element **);
1433struct ber_oid *
1434 mib_pftableaddrstable(struct oid *, struct ber_oid *, struct ber_oid *);
1435int mib_pflabelnum(struct oid *, struct ber_oid *, struct ber_element **);
1436int mib_pflabels(struct oid *, struct ber_oid *, struct ber_element **);
1437int mib_pfsyncstats(struct oid *, struct ber_oid *, struct ber_element **);
1438
1439int mib_sensornum(struct oid *, struct ber_oid *, struct ber_element **);
1440int mib_sensors(struct oid *, struct ber_oid *, struct ber_element **);
1441const char *mib_sensorunit(struct sensor *);
1442char *mib_sensorvalue(struct sensor *);
1443
1444int mib_carpsysctl(struct oid *, struct ber_oid *, struct ber_element **);
1445int mib_carpstats(struct oid *, struct ber_oid *, struct ber_element **);
1446int mib_carpiftable(struct oid *, struct ber_oid *, struct ber_element **);
1447int mib_carpgrouptable(struct oid *, struct ber_oid *, struct ber_element **);
1448int mib_carpifnum(struct oid *, struct ber_oid *, struct ber_element **);
1449struct carpif
1450 *mib_carpifget(u_int);
1451int mib_memiftable(struct oid *, struct ber_oid *, struct ber_element **);
1452
1453static struct oid openbsd_mib[] = {
1454 { MIB(pfMIBObjects){ { 1, 3, 6, 1, 4, 1, 30155, 1 } }, ((void *)0), OID_MIB0x20 },
1455 { MIB(pfRunning){ { 1, 3, 6, 1, 4, 1, 30155, 1, 1, 1 } }, ((void *)0), OID_RD0x01, mib_pfinfo },
1456 { MIB(pfRuntime){ { 1, 3, 6, 1, 4, 1, 30155, 1, 1, 2 } }, ((void *)0), OID_RD0x01, mib_pfinfo },
1457 { MIB(pfDebug){ { 1, 3, 6, 1, 4, 1, 30155, 1, 1, 3 } }, ((void *)0), OID_RD0x01, mib_pfinfo },
1458 { MIB(pfHostid){ { 1, 3, 6, 1, 4, 1, 30155, 1, 1, 4 } }, ((void *)0), OID_RD0x01, mib_pfinfo },
1459 { MIB(pfCntMatch){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 1 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1460 { MIB(pfCntBadOffset){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 2 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1461 { MIB(pfCntFragment){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 3 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1462 { MIB(pfCntShort){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 4 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1463 { MIB(pfCntNormalize){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 5 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1464 { MIB(pfCntMemory){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 6 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1465 { MIB(pfCntTimestamp){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 7 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1466 { MIB(pfCntCongestion){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 8 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1467 { MIB(pfCntIpOptions){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 9 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1468 { MIB(pfCntProtoCksum){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 10 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1469 { MIB(pfCntStateMismatch){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 11 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1470 { MIB(pfCntStateInsert){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 12 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1471 { MIB(pfCntStateLimit){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 13 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1472 { MIB(pfCntSrcLimit){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 14 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1473 { MIB(pfCntSynproxy){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 15 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1474 { MIB(pfCntTranslate){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 16 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1475 { MIB(pfCntNoRoute){ { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 17 } }, ((void *)0), OID_RD0x01, mib_pfcounters },
1476 { MIB(pfStateCount){ { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 1 } }, ((void *)0), OID_RD0x01, mib_pfscounters },
1477 { MIB(pfStateSearches){ { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 2 } }, ((void *)0), OID_RD0x01, mib_pfscounters },
1478 { MIB(pfStateInserts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 3 } }, ((void *)0), OID_RD0x01, mib_pfscounters },
1479 { MIB(pfStateRemovals){ { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 4 } }, ((void *)0), OID_RD0x01, mib_pfscounters },
1480 { MIB(pfLogIfName){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 1 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1481 { MIB(pfLogIfIpBytesIn){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 2 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1482 { MIB(pfLogIfIpBytesOut){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 3 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1483 { MIB(pfLogIfIpPktsInPass){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 4 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1484 { MIB(pfLogIfIpPktsInDrop){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 5 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1485 { MIB(pfLogIfIpPktsOutPass){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 6 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1486 { MIB(pfLogIfIpPktsOutDrop){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 7 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1487 { MIB(pfLogIfIp6BytesIn){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 8 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1488 { MIB(pfLogIfIp6BytesOut){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 9 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1489 { MIB(pfLogIfIp6PktsInPass){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 10 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1490 { MIB(pfLogIfIp6PktsInDrop){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 11 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1491 { MIB(pfLogIfIp6PktsOutPass){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 12 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1492 { MIB(pfLogIfIp6PktsOutDrop){ { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 13 } }, ((void *)0), OID_RD0x01, mib_pflogif },
1493 { MIB(pfSrcTrackCount){ { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 1 } }, ((void *)0), OID_RD0x01, mib_pfsrctrack },
1494 { MIB(pfSrcTrackSearches){ { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 2 } }, ((void *)0), OID_RD0x01, mib_pfsrctrack },
1495 { MIB(pfSrcTrackInserts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 3 } }, ((void *)0), OID_RD0x01, mib_pfsrctrack },
1496 { MIB(pfSrcTrackRemovals){ { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 4 } }, ((void *)0), OID_RD0x01, mib_pfsrctrack },
1497 { MIB(pfLimitStates){ { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 1 } }, ((void *)0), OID_RD0x01, mib_pflimits },
1498 { MIB(pfLimitSourceNodes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 2 } }, ((void *)0), OID_RD0x01, mib_pflimits },
1499 { MIB(pfLimitFragments){ { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 3 } }, ((void *)0), OID_RD0x01, mib_pflimits },
1500 { MIB(pfLimitMaxTables){ { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 4 } }, ((void *)0), OID_RD0x01, mib_pflimits },
1501 { MIB(pfLimitMaxTableEntries){ { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 5 } }, ((void *)0), OID_RD0x01, mib_pflimits },
1502 { MIB(pfTimeoutTcpFirst){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 1 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1503 { MIB(pfTimeoutTcpOpening){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 2 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1504 { MIB(pfTimeoutTcpEstablished){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 3 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1505 { MIB(pfTimeoutTcpClosing){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 4 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1506 { MIB(pfTimeoutTcpFinWait){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 5 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1507 { MIB(pfTimeoutTcpClosed){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 6 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1508 { MIB(pfTimeoutUdpFirst){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 7 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1509 { MIB(pfTimeoutUdpSingle){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 8 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1510 { MIB(pfTimeoutUdpMultiple){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 9 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1511 { MIB(pfTimeoutIcmpFirst){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 10 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1512 { MIB(pfTimeoutIcmpError){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 11 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1513 { MIB(pfTimeoutOtherFirst){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 12 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1514 { MIB(pfTimeoutOtherSingle){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 13 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1515 { MIB(pfTimeoutOtherMultiple){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 14 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1516 { MIB(pfTimeoutFragment){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 15 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1517 { MIB(pfTimeoutInterval){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 16 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1518 { MIB(pfTimeoutAdaptiveStart){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 17 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1519 { MIB(pfTimeoutAdaptiveEnd){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 18 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1520 { MIB(pfTimeoutSrcTrack){ { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 19 } }, ((void *)0), OID_RD0x01, mib_pftimeouts },
1521 { MIB(pfIfNumber){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 1 } }, ((void *)0), OID_RD0x01, mib_pfifnum },
1522 { MIB(pfIfIndex){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pfiftable },
1523 { MIB(pfIfDescr){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pfiftable },
1524 { MIB(pfIfType){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pfiftable },
1525 { MIB(pfIfRefs){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pfiftable },
1526 { MIB(pfIfRules){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pfiftable },
1527 { MIB(pfIfIn4PassPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 6 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pfiftable },
1528 { MIB(pfIfIn4PassBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 7 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pfiftable },
1529 { MIB(pfIfIn4BlockPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 8 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pfiftable },
1530 { MIB(pfIfIn4BlockBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 9 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pfiftable },
1531 { MIB(pfIfOut4PassPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 10 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pfiftable },
1532 { MIB(pfIfOut4PassBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 11 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pfiftable },
1533 { MIB(pfIfOut4BlockPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 12 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pfiftable },
1534 { MIB(pfIfOut4BlockBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 13 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pfiftable },
1535 { MIB(pfIfIn6PassPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 14 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pfiftable },
1536 { MIB(pfIfIn6PassBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 15 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pfiftable },
1537 { MIB(pfIfIn6BlockPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 16 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pfiftable },
1538 { MIB(pfIfIn6BlockBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 17 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pfiftable },
1539 { MIB(pfIfOut6PassPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 18 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pfiftable },
1540 { MIB(pfIfOut6PassBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 19 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pfiftable },
1541 { MIB(pfIfOut6BlockPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 20 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pfiftable },
1542 { MIB(pfIfOut6BlockBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 21 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pfiftable },
1543 { MIB(pfTblNumber){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 1 } }, ((void *)0), OID_RD0x01, mib_pftablenum },
1544 { MIB(pfTblIndex){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftables },
1545 { MIB(pfTblName){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftables },
1546 { MIB(pfTblAddresses){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftables },
1547 { MIB(pfTblAnchorRefs){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftables },
1548 { MIB(pfTblRuleRefs){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftables },
1549 { MIB(pfTblEvalsMatch){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 6 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftables },
1550 { MIB(pfTblEvalsNoMatch){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 7 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftables },
1551 { MIB(pfTblInPassPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 8 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftables },
1552 { MIB(pfTblInPassBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 9 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftables },
1553 { MIB(pfTblInBlockPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 10 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1554 { MIB(pfTblInBlockBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 11 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1555 { MIB(pfTblInXPassPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 12 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1556 { MIB(pfTblInXPassBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 13 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1557 { MIB(pfTblOutPassPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 14 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1558 { MIB(pfTblOutPassBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 15 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1559 { MIB(pfTblOutBlockPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 16 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1560 { MIB(pfTblOutBlockBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 17 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1561 { MIB(pfTblOutXPassPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 18 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1562 { MIB(pfTblOutXPassBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 19 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1563 { MIB(pfTblStatsCleared){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 20 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1564 { MIB(pfTblInMatchPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 21 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1565 { MIB(pfTblInMatchBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 22 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1566 { MIB(pfTblOutMatchPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 23 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1567 { MIB(pfTblOutMatchBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 24 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftables },
1568 { MIB(pfTblAddrTblIndex){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftableaddrs,
1569 NULL((void *)0), mib_pftableaddrstable },
1570 { MIB(pfTblAddrNet){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftableaddrs,
1571 NULL((void *)0), mib_pftableaddrstable },
1572 { MIB(pfTblAddrMask){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftableaddrs,
1573 NULL((void *)0), mib_pftableaddrstable },
1574 { MIB(pfTblAddrCleared){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftableaddrs,
1575 NULL((void *)0), mib_pftableaddrstable },
1576 { MIB(pfTblAddrInBlockPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftableaddrs,
1577 NULL((void *)0), mib_pftableaddrstable },
1578 { MIB(pfTblAddrInBlockBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 6 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftableaddrs,
1579 NULL((void *)0), mib_pftableaddrstable },
1580 { MIB(pfTblAddrInPassPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 7 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftableaddrs,
1581 NULL((void *)0), mib_pftableaddrstable },
1582 { MIB(pfTblAddrInPassBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 8 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftableaddrs,
1583 NULL((void *)0), mib_pftableaddrstable },
1584 { MIB(pfTblAddrOutBlockPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 9 } }, ((void *)0), OID_TRD(0x01|0x10), mib_pftableaddrs,
1585 NULL((void *)0), mib_pftableaddrstable },
1586 { MIB(pfTblAddrOutBlockBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 10 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftableaddrs,
1587 NULL((void *)0), mib_pftableaddrstable },
1588 { MIB(pfTblAddrOutPassPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 11 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftableaddrs,
1589 NULL((void *)0), mib_pftableaddrstable },
1590 { MIB(pfTblAddrOutPassBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 12 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftableaddrs,
1591 NULL((void *)0), mib_pftableaddrstable },
1592 { MIB(pfTblAddrInMatchPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 13 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftableaddrs,
1593 NULL((void *)0), mib_pftableaddrstable },
1594 { MIB(pfTblAddrInMatchBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 14 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftableaddrs,
1595 NULL((void *)0), mib_pftableaddrstable },
1596 { MIB(pfTblAddrOutMatchPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 15 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftableaddrs,
1597 NULL((void *)0), mib_pftableaddrstable },
1598 { MIB(pfTblAddrOutMatchBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 16 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pftableaddrs,
1599 NULL((void *)0), mib_pftableaddrstable },
1600 { MIB(pfLabelNumber){ { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 1 } }, ((void *)0), OID_RD0x01, mib_pflabelnum },
1601 { MIB(pfLabelIndex){ { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 1 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pflabels },
1602 { MIB(pfLabelName){ { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 2 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pflabels },
1603 { MIB(pfLabelEvals){ { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 3 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pflabels },
1604 { MIB(pfLabelPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 4 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pflabels },
1605 { MIB(pfLabelBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 5 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pflabels },
1606 { MIB(pfLabelInPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 6 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pflabels },
1607 { MIB(pfLabelInBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 7 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pflabels },
1608 { MIB(pfLabelOutPkts){ { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 8 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pflabels },
1609 { MIB(pfLabelOutBytes){ { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 9 } }, ((void *)0
)
, OID_TRD(0x01|0x10), mib_pflabels },
1610 { MIB(pfLabelTotalStates){ { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 10 } }, ((void *)
0)
, OID_TRD(0x01|0x10), mib_pflabels },
1611 { MIB(pfsyncIpPktsRecv){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 1 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1612 { MIB(pfsyncIp6PktsRecv){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 2 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1613 { MIB(pfsyncPktDiscardsForBadInterface){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 3 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1614 { MIB(pfsyncPktDiscardsForBadTtl){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 4 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1615 { MIB(pfsyncPktShorterThanHeader){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 5 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1616 { MIB(pfsyncPktDiscardsForBadVersion){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 6 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1617 { MIB(pfsyncPktDiscardsForBadAction){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 7 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1618 { MIB(pfsyncPktDiscardsForBadLength){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 8 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1619 { MIB(pfsyncPktDiscardsForBadAuth){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 9 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1620 { MIB(pfsyncPktDiscardsForStaleState){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 10 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1621 { MIB(pfsyncPktDiscardsForBadValues){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 11 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1622 { MIB(pfsyncPktDiscardsForBadState){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 12 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1623 { MIB(pfsyncIpPktsSent){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 13 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1624 { MIB(pfsyncIp6PktsSent){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 14 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1625 { MIB(pfsyncNoMemory){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 15 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1626 { MIB(pfsyncOutputErrors){ { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 16 } }, ((void *)0), OID_RD0x01, mib_pfsyncstats },
1627 { MIB(sensorsMIBObjects){ { 1, 3, 6, 1, 4, 1, 30155, 2 } }, ((void *)0), OID_MIB0x20 },
1628 { MIB(sensorNumber){ { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 1 } }, ((void *)0), OID_RD0x01, mib_sensornum },
1629 { MIB(sensorIndex){ { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_sensors },
1630 { MIB(sensorDescr){ { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_sensors },
1631 { MIB(sensorType){ { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_sensors },
1632 { MIB(sensorDevice){ { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_sensors },
1633 { MIB(sensorValue){ { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_sensors },
1634 { MIB(sensorUnits){ { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 6 } }, ((void *)0), OID_TRD(0x01|0x10), mib_sensors },
1635 { MIB(sensorStatus){ { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 7 } }, ((void *)0), OID_TRD(0x01|0x10), mib_sensors },
1636 { MIB(carpMIBObjects){ { 1, 3, 6, 1, 4, 1, 30155, 6 } }, ((void *)0), OID_MIB0x20 },
1637 { MIB(carpAllow){ { 1, 3, 6, 1, 4, 1, 30155, 6, 1, 1 } }, ((void *)0), OID_RD0x01, mib_carpsysctl },
1638 { MIB(carpPreempt){ { 1, 3, 6, 1, 4, 1, 30155, 6, 1, 2 } }, ((void *)0), OID_RD0x01, mib_carpsysctl },
1639 { MIB(carpLog){ { 1, 3, 6, 1, 4, 1, 30155, 6, 1, 3 } }, ((void *)0), OID_RD0x01, mib_carpsysctl },
1640 { MIB(carpIpPktsRecv){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 1 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1641 { MIB(carpIp6PktsRecv){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 2 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1642 { MIB(carpPktDiscardsBadIface){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 3 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1643 { MIB(carpPktDiscardsBadTtl){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 4 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1644 { MIB(carpPktShorterThanHdr){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 5 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1645 { MIB(carpDiscardsBadCksum){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 6 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1646 { MIB(carpDiscardsBadVersion){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 7 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1647 { MIB(carpDiscardsTooShort){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 8 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1648 { MIB(carpDiscardsBadAuth){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 9 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1649 { MIB(carpDiscardsBadVhid){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 10 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1650 { MIB(carpDiscardsBadAddrList){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 11 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1651 { MIB(carpIpPktsSent){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 12 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1652 { MIB(carpIp6PktsSent){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 13 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1653 { MIB(carpNoMemory){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 14 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1654 { MIB(carpTransitionsToMaster){ { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 15 } }, ((void *)0), OID_RD0x01, mib_carpstats },
1655 { MIB(carpIfNumber){ { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 1 } }, ((void *)0), OID_RD0x01, mib_carpifnum },
1656 { MIB(carpIfIndex){ { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_carpiftable },
1657 { MIB(carpIfDescr){ { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_carpiftable },
1658 { MIB(carpIfVhid){ { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_carpiftable },
1659 { MIB(carpIfDev ){ { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_carpiftable },
1660 { MIB(carpIfAdvbase){ { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_carpiftable },
1661 { MIB(carpIfAdvskew){ { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 6 } }, ((void *)0), OID_TRD(0x01|0x10), mib_carpiftable },
1662 { MIB(carpIfState){ { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 7 } }, ((void *)0), OID_TRD(0x01|0x10), mib_carpiftable },
1663 { MIB(carpGroupName){ { 1, 3, 6, 1, 4, 1, 30155, 6, 4, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_carpgrouptable },
1664 { MIB(carpGroupDemote){ { 1, 3, 6, 1, 4, 1, 30155, 6, 4, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_carpgrouptable },
1665 { MIB(memMIBObjects){ { 1, 3, 6, 1, 4, 1, 30155, 5 } }, ((void *)0), OID_MIB0x20 },
1666 { MIB(memMIBVersion){ { 1, 3, 6, 1, 4, 1, 30155, 5, 1 } }, ((void *)0), OID_RD0x01, mps_getint, NULL((void *)0), NULL((void *)0),
1667 OIDVER_OPENBSD_MEM1 },
1668 { MIB(memIfName){ { 1, 3, 6, 1, 4, 1, 30155, 5, 2, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_memiftable },
1669 { MIB(memIfLiveLocks){ { 1, 3, 6, 1, 4, 1, 30155, 5, 2, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_memiftable },
1670 { MIBEND{ { 0 } }, ((void *)0) }
1671};
1672
1673int
1674mib_pfinfo(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1675{
1676 struct pf_status s;
1677 time_t runtime = 0;
1678 struct timespec uptime;
1679 char str[11];
1680
1681 if (pf_get_stats(&s))
1682 return (-1);
1683
1684 switch (oid->o_oido_id.bo_id[OIDIDX_pfstatus9]) {
1685 case 1:
1686 *elm = ober_add_integer(*elm, s.running);
1687 break;
1688 case 2:
1689 if (!clock_gettime(CLOCK_BOOTTIME6, &uptime))
1690 runtime = uptime.tv_sec - s.since;
1691 runtime *= 100;
1692 *elm = ober_add_integer(*elm, runtime);
1693 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_TIMETICKS);
1694 break;
1695 case 3:
1696 *elm = ober_add_integer(*elm, s.debug);
1697 break;
1698 case 4:
1699 snprintf(str, sizeof(str), "0x%08x", ntohl(s.hostid)(__uint32_t)(__builtin_constant_p(s.hostid) ? (__uint32_t)(((
__uint32_t)(s.hostid) & 0xff) << 24 | ((__uint32_t)
(s.hostid) & 0xff00) << 8 | ((__uint32_t)(s.hostid)
& 0xff0000) >> 8 | ((__uint32_t)(s.hostid) & 0xff000000
) >> 24) : __swap32md(s.hostid))
);
1700 *elm = ober_add_string(*elm, str);
1701 break;
1702 default:
1703 return (-1);
1704 }
1705
1706 return (0);
1707}
1708
1709int
1710mib_pfcounters(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1711{
1712 struct pf_status s;
1713 int i;
1714 struct statsmap {
1715 u_int8_t m_id;
1716 u_int64_t *m_ptr;
1717 } mapping[] = {
1718 { 1, &s.counters[PFRES_MATCH0] },
1719 { 2, &s.counters[PFRES_BADOFF1] },
1720 { 3, &s.counters[PFRES_FRAG2] },
1721 { 4, &s.counters[PFRES_SHORT3] },
1722 { 5, &s.counters[PFRES_NORM4] },
1723 { 6, &s.counters[PFRES_MEMORY5] },
1724 { 7, &s.counters[PFRES_TS6] },
1725 { 8, &s.counters[PFRES_CONGEST7] },
1726 { 9, &s.counters[PFRES_IPOPTIONS8] },
1727 { 10, &s.counters[PFRES_PROTCKSUM9] },
1728 { 11, &s.counters[PFRES_BADSTATE10] },
1729 { 12, &s.counters[PFRES_STATEINS11] },
1730 { 13, &s.counters[PFRES_MAXSTATES12] },
1731 { 14, &s.counters[PFRES_SRCLIMIT13] },
1732 { 15, &s.counters[PFRES_SYNPROXY14] },
1733 { 16, &s.counters[PFRES_TRANSLATE15] },
1734 { 17, &s.counters[PFRES_NOROUTE16] }
1735 };
1736
1737 if (pf_get_stats(&s))
1738 return (-1);
1739
1740 for (i = 0;
1741 (u_int)i < (sizeof(mapping) / sizeof(mapping[0])); i++) {
1742 if (oid->o_oido_id.bo_id[OIDIDX_pfstatus9] == mapping[i].m_id) {
1743 *elm = ober_add_integer(*elm, *mapping[i].m_ptr);
1744 ober_set_header(*elm, BER_CLASS_APPLICATION0x1,
1745 SNMP_T_COUNTER64);
1746 return (0);
1747 }
1748 }
1749 return (-1);
1750}
1751
1752int
1753mib_pfscounters(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1754{
1755 struct pf_status s;
1756 int i;
1757 struct statsmap {
1758 u_int8_t m_id;
1759 u_int64_t *m_ptr;
1760 } mapping[] = {
1761 { 2, &s.fcounters[FCNT_STATE_SEARCH0] },
1762 { 3, &s.fcounters[FCNT_STATE_INSERT1] },
1763 { 4, &s.fcounters[FCNT_STATE_REMOVALS2] },
1764 };
1765
1766 if (pf_get_stats(&s))
1767 return (-1);
1768
1769 switch (oid->o_oido_id.bo_id[OIDIDX_pfstatus9]) {
1770 case 1:
1771 *elm = ober_add_integer(*elm, s.states);
1772 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_UNSIGNED32);
1773 break;
1774 default:
1775 for (i = 0;
1776 (u_int)i < (sizeof(mapping) / sizeof(mapping[0])); i++) {
1777 if (oid->o_oido_id.bo_id[OIDIDX_pfstatus9] == mapping[i].m_id) {
1778 *elm = ober_add_integer(*elm, *mapping[i].m_ptr);
1779 ober_set_header(*elm, BER_CLASS_APPLICATION0x1,
1780 SNMP_T_COUNTER64);
1781 return (0);
1782 }
1783 }
1784 return (-1);
1785 }
1786
1787 return (0);
1788}
1789
1790int
1791mib_pflogif(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1792{
1793 struct pf_status s;
1794 int i;
1795 struct statsmap {
1796 u_int8_t m_id;
1797 u_int64_t *m_ptr;
1798 } mapping[] = {
1799 { 2, &s.bcounters[IPV4][IN] },
1800 { 3, &s.bcounters[IPV4][OUT] },
1801 { 4, &s.pcounters[IPV4][IN][PF_PASS] },
1802 { 5, &s.pcounters[IPV4][IN][PF_DROP] },
1803 { 6, &s.pcounters[IPV4][OUT][PF_PASS] },
1804 { 7, &s.pcounters[IPV4][OUT][PF_DROP] },
1805 { 8, &s.bcounters[IPV6][IN] },
1806 { 9, &s.bcounters[IPV6][OUT] },
1807 { 10, &s.pcounters[IPV6][IN][PF_PASS] },
1808 { 11, &s.pcounters[IPV6][IN][PF_DROP] },
1809 { 12, &s.pcounters[IPV6][OUT][PF_PASS] },
1810 { 13, &s.pcounters[IPV6][OUT][PF_DROP] }
1811 };
1812
1813 if (pf_get_stats(&s))
1814 return (-1);
1815
1816 switch (oid->o_oido_id.bo_id[OIDIDX_pfstatus9]) {
1817 case 1:
1818 *elm = ober_add_string(*elm, s.ifname);
1819 break;
1820 default:
1821 for (i = 0;
1822 (u_int)i < (sizeof(mapping) / sizeof(mapping[0])); i++) {
1823 if (oid->o_oido_id.bo_id[OIDIDX_pfstatus9] == mapping[i].m_id) {
1824 *elm = ober_add_integer(*elm, *mapping[i].m_ptr);
1825 ober_set_header(*elm, BER_CLASS_APPLICATION0x1,
1826 SNMP_T_COUNTER64);
1827 return (0);
1828 }
1829 }
1830 return (-1);
1831 }
1832
1833 return (0);
1834}
1835
1836int
1837mib_pfsrctrack(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1838{
1839 struct pf_status s;
1840 int i;
1841 struct statsmap {
1842 u_int8_t m_id;
1843 u_int64_t *m_ptr;
1844 } mapping[] = {
1845 { 2, &s.scounters[SCNT_SRC_NODE_SEARCH0] },
1846 { 3, &s.scounters[SCNT_SRC_NODE_INSERT1] },
1847 { 4, &s.scounters[SCNT_SRC_NODE_REMOVALS2] }
1848 };
1849
1850 if (pf_get_stats(&s))
1851 return (-1);
1852
1853 switch (oid->o_oido_id.bo_id[OIDIDX_pfstatus9]) {
1854 case 1:
1855 *elm = ober_add_integer(*elm, s.src_nodes);
1856 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_UNSIGNED32);
1857 break;
1858 default:
1859 for (i = 0;
1860 (u_int)i < (sizeof(mapping) / sizeof(mapping[0])); i++) {
1861 if (oid->o_oido_id.bo_id[OIDIDX_pfstatus9] == mapping[i].m_id) {
1862 *elm = ober_add_integer(*elm, *mapping[i].m_ptr);
1863 ober_set_header(*elm, BER_CLASS_APPLICATION0x1,
1864 SNMP_T_COUNTER64);
1865 return (0);
1866 }
1867 }
1868 return (-1);
1869 }
1870
1871 return (0);
1872}
1873
1874int
1875mib_pflimits(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1876{
1877 struct pfioc_limit pl;
1878 int i;
1879 extern int devpf;
1880 struct statsmap {
1881 u_int8_t m_id;
1882 u_int8_t m_limit;
1883 } mapping[] = {
1884 { 1, PF_LIMIT_STATES },
1885 { 2, PF_LIMIT_SRC_NODES },
1886 { 3, PF_LIMIT_FRAGS },
1887 { 4, PF_LIMIT_TABLES },
1888 { 5, PF_LIMIT_TABLE_ENTRIES }
1889 };
1890
1891 memset(&pl, 0, sizeof(pl));
1892 pl.index = PF_LIMIT_MAX;
1893
1894 for (i = 0;
1895 (u_int)i < (sizeof(mapping) / sizeof(mapping[0])); i++) {
1896 if (oid->o_oido_id.bo_id[OIDIDX_pfstatus9] == mapping[i].m_id) {
1897 pl.index = mapping[i].m_limit;
1898 break;
1899 }
1900 }
1901
1902 if (pl.index == PF_LIMIT_MAX)
1903 return (-1);
1904
1905 if (ioctl(devpf, DIOCGETLIMIT(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct pfioc_limit) & 0x1fff) << 16) | ((('D')) <<
8) | ((39)))
, &pl) == -1) {
1906 log_warn("DIOCGETLIMIT");
1907 return (-1);
1908 }
1909
1910 *elm = ober_add_integer(*elm, pl.limit);
1911 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_UNSIGNED32);
1912
1913 return (0);
1914}
1915
1916int
1917mib_pftimeouts(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1918{
1919 struct pfioc_tm pt;
1920 int i;
1921 extern int devpf;
1922 struct statsmap {
1923 u_int8_t m_id;
1924 u_int8_t m_tm;
1925 } mapping[] = {
1926 { 1, PFTM_TCP_FIRST_PACKET },
1927 { 2, PFTM_TCP_OPENING },
1928 { 3, PFTM_TCP_ESTABLISHED },
1929 { 4, PFTM_TCP_CLOSING },
1930 { 5, PFTM_TCP_FIN_WAIT },
1931 { 6, PFTM_TCP_CLOSED },
1932 { 7, PFTM_UDP_FIRST_PACKET },
1933 { 8, PFTM_UDP_SINGLE },
1934 { 9, PFTM_UDP_MULTIPLE },
1935 { 10, PFTM_ICMP_FIRST_PACKET },
1936 { 11, PFTM_ICMP_ERROR_REPLY },
1937 { 12, PFTM_OTHER_FIRST_PACKET },
1938 { 13, PFTM_OTHER_SINGLE },
1939 { 14, PFTM_OTHER_MULTIPLE },
1940 { 15, PFTM_FRAG },
1941 { 16, PFTM_INTERVAL },
1942 { 17, PFTM_ADAPTIVE_START },
1943 { 18, PFTM_ADAPTIVE_END },
1944 { 19, PFTM_SRC_NODE }
1945 };
1946
1947 memset(&pt, 0, sizeof(pt));
1948 pt.timeout = PFTM_MAX;
1949
1950 for (i = 0;
1951 (u_int)i < (sizeof(mapping) / sizeof(mapping[0])); i++) {
1952 if (oid->o_oido_id.bo_id[OIDIDX_pfstatus9] == mapping[i].m_id) {
1953 pt.timeout = mapping[i].m_tm;
1954 break;
1955 }
1956 }
1957
1958 if (pt.timeout == PFTM_MAX)
1959 return (-1);
1960
1961 if (ioctl(devpf, DIOCGETTIMEOUT(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct pfioc_tm) & 0x1fff) << 16) | ((('D')) <<
8) | ((30)))
, &pt) == -1) {
1962 log_warn("DIOCGETTIMEOUT");
1963 return (-1);
1964 }
1965
1966 *elm = ober_add_integer(*elm, pt.seconds);
1967
1968 return (0);
1969}
1970
1971int
1972mib_pfifnum(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1973{
1974 int c;
1975
1976 if ((c = pfi_count()) == -1)
1977 return (-1);
1978
1979 *elm = ober_add_integer(*elm, c);
1980
1981 return (0);
1982}
1983
1984int
1985mib_pfiftable(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
1986{
1987 struct ber_element *ber = *elm;
1988 struct pfi_kif pif;
1989 int idx, iftype;
1990
1991 /* Get and verify the current row index */
1992 idx = o->bo_id[OIDIDX_pfIfEntry12];
1993
1994 if (pfi_get_if(&pif, idx))
1995 return (1);
1996
1997 ber = ober_add_oid(ber, o);
1998
1999 switch (o->bo_id[OIDIDX_pfInterface11]) {
2000 case 1:
2001 ber = ober_add_integer(ber, idx);
2002 break;
2003 case 2:
2004 ber = ober_add_string(ber, pif.pfik_name);
2005 break;
2006 case 3:
2007 iftype = (pif.pfik_ifp == NULL((void *)0) ? PFI_IFTYPE_GROUP
2008 : PFI_IFTYPE_INSTANCE);
2009 ber = ober_add_integer(ber, iftype);
2010 break;
2011 case 4:
2012 ber = ober_add_integer(ber, pif.pfik_states);
2013 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_UNSIGNED32);
2014 break;
2015 case 5:
2016 ber = ober_add_integer(ber, pif.pfik_rules);
2017 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_UNSIGNED32);
2018 break;
2019 case 6:
2020 ber = ober_add_integer(ber, pif.pfik_packets[IPV4][IN][PASS]);
2021 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2022 break;
2023 case 7:
2024 ber = ober_add_integer(ber, pif.pfik_bytes[IPV4][IN][PASS]);
2025 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2026 break;
2027 case 8:
2028 ber = ober_add_integer(ber, pif.pfik_packets[IPV4][IN][BLOCK]);
2029 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2030 break;
2031 case 9:
2032 ber = ober_add_integer(ber, pif.pfik_bytes[IPV4][IN][BLOCK]);
2033 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2034 break;
2035 case 10:
2036 ber = ober_add_integer(ber, pif.pfik_packets[IPV4][OUT][PASS]);
2037 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2038 break;
2039 case 11:
2040 ber = ober_add_integer(ber, pif.pfik_bytes[IPV4][OUT][PASS]);
2041 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2042 break;
2043 case 12:
2044 ber = ober_add_integer(ber, pif.pfik_packets[IPV4][OUT][BLOCK]);
2045 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2046 break;
2047 case 13:
2048 ber = ober_add_integer(ber, pif.pfik_bytes[IPV4][OUT][BLOCK]);
2049 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2050 break;
2051 case 14:
2052 ber = ober_add_integer(ber, pif.pfik_packets[IPV6][IN][PASS]);
2053 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2054 break;
2055 case 15:
2056 ber = ober_add_integer(ber, pif.pfik_bytes[IPV6][IN][PASS]);
2057 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2058 break;
2059 case 16:
2060 ber = ober_add_integer(ber, pif.pfik_packets[IPV6][IN][BLOCK]);
2061 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2062 break;
2063 case 17:
2064 ber = ober_add_integer(ber, pif.pfik_bytes[IPV6][IN][BLOCK]);
2065 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2066 break;
2067 case 18:
2068 ber = ober_add_integer(ber, pif.pfik_packets[IPV6][OUT][PASS]);
2069 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2070 break;
2071 case 19:
2072 ber = ober_add_integer(ber, pif.pfik_bytes[IPV6][OUT][PASS]);
2073 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2074 break;
2075 case 20:
2076 ber = ober_add_integer(ber, pif.pfik_packets[IPV6][OUT][BLOCK]);
2077 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2078 break;
2079 case 21:
2080 ber = ober_add_integer(ber, pif.pfik_bytes[IPV6][OUT][BLOCK]);
2081 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2082 break;
2083 default:
2084 return (1);
2085 }
2086
2087 return (0);
2088}
2089
2090int
2091mib_pftablenum(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2092{
2093 int c;
2094
2095 if ((c = pft_count()) == -1)
2096 return (-1);
2097
2098 *elm = ober_add_integer(*elm, c);
2099
2100 return (0);
2101}
2102
2103int
2104mib_pftables(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2105{
2106 struct ber_element *ber = *elm;
2107 struct pfr_tstats ts;
2108 time_t tzero;
2109 int idx;
2110
2111 /* Get and verify the current row index */
2112 idx = o->bo_id[OIDIDX_pfTableEntry12];
2113
2114 if (pft_get_table(&ts, idx))
2115 return (1);
2116
2117 ber = ober_add_oid(ber, o);
2118
2119 switch (o->bo_id[OIDIDX_pfTable11]) {
2120 case 1:
2121 ber = ober_add_integer(ber, idx);
2122 break;
2123 case 2:
2124 ber = ober_add_string(ber, ts.pfrts_namepfrts_t.pfrt_name);
2125 break;
2126 case 3:
2127 ber = ober_add_integer(ber, ts.pfrts_cnt);
2128 break;
2129 case 4:
2130 ber = ober_add_integer(ber, ts.pfrts_refcnt[PFR_REFCNT_ANCHOR]);
2131 break;
2132 case 5:
2133 ber = ober_add_integer(ber, ts.pfrts_refcnt[PFR_REFCNT_RULE]);
2134 break;
2135 case 6:
2136 ber = ober_add_integer(ber, ts.pfrts_match);
2137 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2138 break;
2139 case 7:
2140 ber = ober_add_integer(ber, ts.pfrts_nomatch);
2141 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2142 break;
2143 case 8:
2144 ber = ober_add_integer(ber, ts.pfrts_packets[IN][PFR_OP_PASS]);
2145 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2146 break;
2147 case 9:
2148 ber = ober_add_integer(ber, ts.pfrts_bytes[IN][PFR_OP_PASS]);
2149 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2150 break;
2151 case 10:
2152 ber = ober_add_integer(ber, ts.pfrts_packets[IN][PFR_OP_BLOCK]);
2153 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2154 break;
2155 case 11:
2156 ber = ober_add_integer(ber, ts.pfrts_bytes[IN][PFR_OP_BLOCK]);
2157 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2158 break;
2159 case 12:
2160 ber = ober_add_integer(ber, ts.pfrts_packets[IN][PFR_OP_XPASSPFR_OP_ADDR_MAX]);
2161 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2162 break;
2163 case 13:
2164 ber = ober_add_integer(ber, ts.pfrts_bytes[IN][PFR_OP_XPASSPFR_OP_ADDR_MAX]);
2165 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2166 break;
2167 case 14:
2168 ber = ober_add_integer(ber, ts.pfrts_packets[OUT][PFR_OP_PASS]);
2169 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2170 break;
2171 case 15:
2172 ber = ober_add_integer(ber, ts.pfrts_bytes[OUT][PFR_OP_PASS]);
2173 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2174 break;
2175 case 16:
2176 ber = ober_add_integer(ber, ts.pfrts_packets[OUT][PFR_OP_BLOCK]);
2177 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2178 break;
2179 case 17:
2180 ber = ober_add_integer(ber, ts.pfrts_bytes[OUT][PFR_OP_BLOCK]);
2181 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2182 break;
2183 case 18:
2184 ber = ober_add_integer(ber, ts.pfrts_packets[OUT][PFR_OP_XPASSPFR_OP_ADDR_MAX]);
2185 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2186 break;
2187 case 19:
2188 ber = ober_add_integer(ber, ts.pfrts_bytes[OUT][PFR_OP_XPASSPFR_OP_ADDR_MAX]);
2189 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2190 break;
2191 case 20:
2192 tzero = (time(NULL((void *)0)) - ts.pfrts_tzero) * 100;
2193 ber = ober_add_integer(ber, tzero);
2194 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_TIMETICKS);
2195 break;
2196 case 21:
2197 ber = ober_add_integer(ber, ts.pfrts_packets[IN][PFR_OP_MATCH]);
2198 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2199 break;
2200 case 22:
2201 ber = ober_add_integer(ber, ts.pfrts_bytes[IN][PFR_OP_MATCH]);
2202 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2203 break;
2204 case 23:
2205 ber = ober_add_integer(ber, ts.pfrts_packets[OUT][PFR_OP_MATCH]);
2206 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2207 break;
2208 case 24:
2209 ber = ober_add_integer(ber, ts.pfrts_bytes[OUT][PFR_OP_MATCH]);
2210 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2211 break;
2212 default:
2213 return (1);
2214 }
2215
2216 return (0);
2217}
2218
2219int
2220mib_pftableaddrs(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2221{
2222 struct ber_element *ber = *elm;
2223 struct pfr_astats as;
2224 int tblidx;
2225
2226 if (snmpd_env->sc_pfaddrfilter)
2227 return (-1);
2228
2229 tblidx = o->bo_id[OIDIDX_pfTblAddr11 + 1];
2230 mps_decodeinaddr(o, &as.pfras_a.pfra_ip4addrpfra_u._pfra_ip4addr, OIDIDX_pfTblAddr11 + 2);
2231 as.pfras_a.pfra_net = o->bo_id[OIDIDX_pfTblAddr11 + 6];
2232
2233 if (pfta_get_addr(&as, tblidx))
2234 return (-1);
2235
2236 /* write OID */
2237 ber = ober_add_oid(ber, o);
2238
2239 switch (o->bo_id[OIDIDX_pfTblAddr11]) {
2240 case 1:
2241 ber = ober_add_integer(ber, tblidx);
2242 break;
2243 case 2:
2244 ber = ober_add_nstring(ber, (char *)&as.pfras_a.pfra_ip4addrpfra_u._pfra_ip4addr,
2245 sizeof(u_int32_t));
2246 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_IPADDR);
2247 break;
2248 case 3:
2249 ber = ober_add_integer(ber, as.pfras_a.pfra_net);
2250 break;
2251 case 4:
2252 ber = ober_add_integer(ber, (time(NULL((void *)0)) - as.pfras_tzero) * 100);
2253 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_TIMETICKS);
2254 break;
2255 case 5:
2256 ber = ober_add_integer(ber, as.pfras_packets[IN][PFR_OP_BLOCK]);
2257 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2258 break;
2259 case 6:
2260 ber = ober_add_integer(ber, as.pfras_bytes[IN][PFR_OP_BLOCK]);
2261 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2262 break;
2263 case 7:
2264 ber = ober_add_integer(ber, as.pfras_packets[IN][PFR_OP_PASS]);
2265 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2266 break;
2267 case 8:
2268 ber = ober_add_integer(ber, as.pfras_bytes[IN][PFR_OP_PASS]);
2269 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2270 break;
2271 case 9:
2272 ber = ober_add_integer(ber, as.pfras_packets[OUT][PFR_OP_BLOCK]);
2273 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2274 break;
2275 case 10:
2276 ber = ober_add_integer(ber, as.pfras_bytes[OUT][PFR_OP_BLOCK]);
2277 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2278 break;
2279 case 11:
2280 ber = ober_add_integer(ber, as.pfras_packets[OUT][PFR_OP_PASS]);
2281 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2282 break;
2283 case 12:
2284 ber = ober_add_integer(ber, as.pfras_bytes[OUT][PFR_OP_PASS]);
2285 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2286 break;
2287 case 13:
2288 ber = ober_add_integer(ber, as.pfras_packets[IN][PFR_OP_MATCH]);
2289 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2290 break;
2291 case 14:
2292 ber = ober_add_integer(ber, as.pfras_bytes[IN][PFR_OP_MATCH]);
2293 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2294 break;
2295 case 15:
2296 ber = ober_add_integer(ber, as.pfras_packets[OUT][PFR_OP_MATCH]);
2297 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2298 break;
2299 case 16:
2300 ber = ober_add_integer(ber, as.pfras_bytes[OUT][PFR_OP_MATCH]);
2301 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2302 break;
2303 default:
2304 return (-1);
2305 }
2306
2307 return (0);
2308}
2309
2310struct ber_oid *
2311mib_pftableaddrstable(struct oid *oid, struct ber_oid *o, struct ber_oid *no)
2312{
2313 struct pfr_astats as;
2314 struct oid a, b;
2315 u_int32_t id, tblidx;
2316
2317 if (snmpd_env->sc_pfaddrfilter)
2318 return (NULL((void *)0));
2319
2320 bcopy(&oid->o_id, no, sizeof(*no));
2321 id = oid->o_oidleno_id.bo_n - 1;
2322
2323 if (o->bo_n >= oid->o_oidleno_id.bo_n) {
2324 /*
2325 * Compare the requested and the matched OID to see
2326 * if we have to iterate to the next element.
2327 */
2328 bzero(&a, sizeof(a));
2329 bcopy(o, &a.o_id, sizeof(struct ber_oid));
2330 bzero(&b, sizeof(b));
2331 bcopy(&oid->o_id, &b.o_id, sizeof(struct ber_oid));
2332 b.o_oidleno_id.bo_n--;
2333 b.o_flags |= OID_TABLE0x10;
2334 if (smi_oid_cmp(&a, &b) == 0) {
2335 o->bo_id[id] = oid->o_oido_id.bo_id[id];
2336 bcopy(o, no, sizeof(*no));
2337 }
2338 }
2339
2340 tblidx = no->bo_id[OIDIDX_pfTblAddr11 + 1];
2341 mps_decodeinaddr(no, &as.pfras_a.pfra_ip4addrpfra_u._pfra_ip4addr, OIDIDX_pfTblAddr11 + 2);
2342 as.pfras_a.pfra_net = no->bo_id[OIDIDX_pfTblAddr11 + 6];
2343
2344 if (tblidx == 0) {
2345 if (pfta_get_first(&as))
2346 return (NULL((void *)0));
2347 tblidx = 1;
2348 } else {
2349 if (pfta_get_nextaddr(&as, &tblidx)) {
2350 /* We reached the last addr in the last table.
2351 * When the next OIDIDX_pfTblAddr'th OID is requested,
2352 * get the first table address again.
2353 */
2354 o->bo_id[OIDIDX_pfTblAddr11 + 1] = 0;
2355 smi_oidlen(o);
2356 return (NULL((void *)0));
2357 }
2358 }
2359
2360 no->bo_id[OIDIDX_pfTblAddr11 + 1] = tblidx;
2361 mps_encodeinaddr(no, &as.pfras_a.pfra_ip4addrpfra_u._pfra_ip4addr, OIDIDX_pfTblAddr11 + 2);
2362 no->bo_id[OIDIDX_pfTblAddr11 + 6] = as.pfras_a.pfra_net;
2363 no->bo_n += 1;
2364
2365 smi_oidlen(o);
2366
2367 return (no);
2368}
2369
2370int
2371mib_pflabelnum(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2372{
2373 struct pfioc_rule pr;
2374 u_int32_t nr, mnr, lnr;
2375 extern int devpf;
2376
2377 memset(&pr, 0, sizeof(pr));
2378 if (ioctl(devpf, DIOCGETRULES(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct pfioc_rule) & 0x1fff) << 16) | ((('D')) <<
8) | ((6)))
, &pr) == -1) {
2379 log_warn("DIOCGETRULES");
2380 return (-1);
2381 }
2382
2383 mnr = pr.nr;
2384 lnr = 0;
2385 for (nr = 0; nr < mnr; ++nr) {
2386 pr.nr = nr;
2387 if (ioctl(devpf, DIOCGETRULE(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct pfioc_rule) & 0x1fff) << 16) | ((('D')) <<
8) | ((7)))
, &pr) == -1) {
2388 log_warn("DIOCGETRULE");
2389 return (-1);
2390 }
2391
2392 if (pr.rule.label[0])
2393 lnr++;
2394 }
2395
2396 *elm = ober_add_integer(*elm, lnr);
2397
2398 return (0);
2399}
2400
2401int
2402mib_pflabels(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2403{
2404 struct ber_element *ber = *elm;
2405 struct pfioc_rule pr;
2406 struct pf_rule *r = NULL((void *)0);
2407 u_int32_t nr, mnr, lnr;
2408 u_int32_t idx;
2409 extern int devpf;
2410
2411 /* Get and verify the current row index */
2412 idx = o->bo_id[OIDIDX_pfLabelEntry12];
2413
2414 memset(&pr, 0, sizeof(pr));
2415 if (ioctl(devpf, DIOCGETRULES(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct pfioc_rule) & 0x1fff) << 16) | ((('D')) <<
8) | ((6)))
, &pr) == -1) {
2416 log_warn("DIOCGETRULES");
2417 return (-1);
2418 }
2419
2420 mnr = pr.nr;
2421 lnr = 0;
2422 for (nr = 0; nr < mnr; ++nr) {
2423 pr.nr = nr;
2424 if (ioctl(devpf, DIOCGETRULE(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct pfioc_rule) & 0x1fff) << 16) | ((('D')) <<
8) | ((7)))
, &pr) == -1) {
2425 log_warn("DIOCGETRULE");
2426 return (-1);
2427 }
2428
2429 if (pr.rule.label[0] && ++lnr == idx) {
2430 r = &pr.rule;
2431 break;
2432 }
2433 }
2434
2435 if (r == NULL((void *)0))
2436 return (1);
2437
2438 ber = ober_add_oid(ber, o);
2439
2440 switch (o->bo_id[OIDIDX_pfLabel11]) {
2441 case 1:
2442 ber = ober_add_integer(ber, lnr);
2443 break;
2444 case 2:
2445 ber = ober_add_string(ber, r->label);
2446 break;
2447 case 3:
2448 ber = ober_add_integer(ber, r->evaluations);
2449 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2450 break;
2451 case 4:
2452 ber = ober_add_integer(ber, r->packets[IN] + r->packets[OUT]);
2453 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2454 break;
2455 case 5:
2456 ber = ober_add_integer(ber, r->bytes[IN] + r->bytes[OUT]);
2457 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2458 break;
2459 case 6:
2460 ber = ober_add_integer(ber, r->packets[IN]);
2461 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2462 break;
2463 case 7:
2464 ber = ober_add_integer(ber, r->bytes[IN]);
2465 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2466 break;
2467 case 8:
2468 ber = ober_add_integer(ber, r->packets[OUT]);
2469 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2470 break;
2471 case 9:
2472 ber = ober_add_integer(ber, r->bytes[OUT]);
2473 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
2474 break;
2475 case 10:
2476 ber = ober_add_integer(ber, r->states_tot);
2477 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
2478 break;
2479 default:
2480 return (1);
2481 }
2482
2483 return (0);
2484}
2485
2486int
2487mib_pfsyncstats(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2488{
2489 int i;
2490 int mib[] = { CTL_NET4, PF_INET2, IPPROTO_PFSYNC240,
2491 PFSYNCCTL_STATS1 };
2492 size_t len = sizeof(struct pfsyncstats);
2493 struct pfsyncstats s;
2494 struct statsmap {
2495 u_int8_t m_id;
2496 u_int64_t *m_ptr;
2497 } mapping[] = {
2498 { 1, &s.pfsyncs_ipackets },
2499 { 2, &s.pfsyncs_ipackets6 },
2500 { 3, &s.pfsyncs_badif },
2501 { 4, &s.pfsyncs_badttl },
2502 { 5, &s.pfsyncs_hdrops },
2503 { 6, &s.pfsyncs_badver },
2504 { 7, &s.pfsyncs_badact },
2505 { 8, &s.pfsyncs_badlen },
2506 { 9, &s.pfsyncs_badauth },
2507 { 10, &s.pfsyncs_stale },
2508 { 11, &s.pfsyncs_badval },
2509 { 12, &s.pfsyncs_badstate },
2510 { 13, &s.pfsyncs_opackets },
2511 { 14, &s.pfsyncs_opackets6 },
2512 { 15, &s.pfsyncs_onomem },
2513 { 16, &s.pfsyncs_oerrors }
2514 };
2515
2516 if (sysctl(mib, 4, &s, &len, NULL((void *)0), 0) == -1) {
2517 log_warn("sysctl");
2518 return (-1);
2519 }
2520
2521 for (i = 0;
2522 (u_int)i < (sizeof(mapping) / sizeof(mapping[0])); i++) {
2523 if (oid->o_oido_id.bo_id[OIDIDX_pfstatus9] == mapping[i].m_id) {
2524 *elm = ober_add_integer(*elm, *mapping[i].m_ptr);
2525 ober_set_header(*elm, BER_CLASS_APPLICATION0x1,
2526 SNMP_T_COUNTER64);
2527 return (0);
2528 }
2529 }
2530
2531 return (-1);
2532}
2533
2534int
2535mib_sensornum(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2536{
2537 struct sensordev sensordev;
2538 size_t len = sizeof(sensordev);
2539 int mib[] = { CTL_HW6, HW_SENSORS11, 0 };
2540 int i, c;
2541
2542 for (i = c = 0; ; i++) {
2543 mib[2] = i;
2544 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])),
2545 &sensordev, &len, NULL((void *)0), 0) == -1) {
2546 if (errno(*__errno()) == ENXIO6)
2547 continue;
2548 if (errno(*__errno()) == ENOENT2)
2549 break;
2550 return (-1);
2551 }
2552 c += sensordev.sensors_count;
2553 }
2554
2555 *elm = ober_add_integer(*elm, c);
2556 return (0);
2557}
2558
2559int
2560mib_sensors(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2561{
2562 struct ber_element *ber = *elm;
2563 struct sensordev sensordev;
2564 size_t len = sizeof(sensordev);
2565 struct sensor sensor;
2566 size_t slen = sizeof(sensor);
2567 char desc[32];
2568 int mib[] = { CTL_HW6, HW_SENSORS11, 0, 0, 0 };
2569 int i, j, k;
2570 u_int32_t idx = 0, n;
2571 char *s;
2572
2573 /* Get and verify the current row index */
2574 idx = o->bo_id[OIDIDX_sensorEntry12];
2575
2576 for (i = 0, n = 1; ; i++) {
2577 mib[2] = i;
2578 if (sysctl(mib, 3, &sensordev, &len, NULL((void *)0), 0) == -1) {
2579 if (errno(*__errno()) == ENXIO6)
2580 continue;
2581 if (errno(*__errno()) == ENOENT2)
2582 break;
2583 return (-1);
2584 }
2585 for (j = 0; j < SENSOR_MAX_TYPES; j++) {
2586 mib[3] = j;
2587 for (k = 0; k < sensordev.maxnumt[j]; k++) {
2588 mib[4] = k;
2589 if (sysctl(mib, 5,
2590 &sensor, &slen, NULL((void *)0), 0) == -1) {
2591 if (errno(*__errno()) == ENXIO6)
2592 continue;
2593 if (errno(*__errno()) == ENOENT2)
2594 break;
2595 return (-1);
2596 }
2597 if (sensor.flags & SENSOR_FINVALID0x0001)
2598 continue;
2599 if (n == idx)
2600 goto found;
2601 n++;
2602 }
2603 }
2604 }
2605 return (1);
2606
2607 found:
2608 ber = ober_add_oid(ber, o);
2609
2610 switch (o->bo_id[OIDIDX_sensor11]) {
2611 case 1:
2612 ber = ober_add_integer(ber, (int32_t)n);
2613 break;
2614 case 2:
2615 if (sensor.desc[0] == '\0') {
2616 snprintf(desc, sizeof(desc), "%s%d",
2617 sensor_type_s[sensor.type],
2618 sensor.numt);
2619 ber = ober_add_string(ber, desc);
2620 } else
2621 ber = ober_add_string(ber, sensor.desc);
2622 break;
2623 case 3:
2624 ber = ober_add_integer(ber, sensor.type);
2625 break;
2626 case 4:
2627 ber = ober_add_string(ber, sensordev.xname);
2628 break;
2629 case 5:
2630 if ((s = mib_sensorvalue(&sensor)) == NULL((void *)0))
2631 return (-1);
2632 ber = ober_add_string(ber, s);
2633 free(s);
2634 break;
2635 case 6:
2636 ber = ober_add_string(ber, mib_sensorunit(&sensor));
2637 break;
2638 case 7:
2639 ber = ober_add_integer(ber, sensor.status);
2640 break;
2641 }
2642
2643 return (0);
2644}
2645
2646#define SENSOR_DRIVE_STATES(10 + 1) (SENSOR_DRIVE_PFAIL10 + 1)
2647static const char * const sensor_drive_s[SENSOR_DRIVE_STATES(10 + 1)] = {
2648 NULL((void *)0), "empty", "ready", "powerup", "online", "idle", "active",
2649 "rebuild", "powerdown", "fail", "pfail"
2650};
2651
2652static const char * const sensor_unit_s[SENSOR_MAX_TYPES + 1] = {
2653 "degC", "RPM", "V DC", "V AC", "Ohm", "W", "A", "Wh", "Ah",
2654 "", "", "%", "lx", "", "sec", "%RH", "Hz", "degree",
2655 "m", "Pa", "m/s^2", "m/s", ""
2656};
2657
2658const char *
2659mib_sensorunit(struct sensor *s)
2660{
2661 u_int idx;
2662 idx = s->type > SENSOR_MAX_TYPES ?
2663 SENSOR_MAX_TYPES : s->type;
2664 return (sensor_unit_s[idx]);
2665}
2666
2667char *
2668mib_sensorvalue(struct sensor *s)
2669{
2670 char *v;
2671 int ret = -1;
2672
2673 switch (s->type) {
2674 case SENSOR_TEMP:
2675 ret = asprintf(&v, "%.2f",
2676 (s->value - 273150000) / 1000000.0);
2677 break;
2678 case SENSOR_VOLTS_DC:
2679 case SENSOR_VOLTS_AC:
2680 case SENSOR_WATTS:
2681 case SENSOR_AMPS:
2682 case SENSOR_WATTHOUR:
2683 case SENSOR_AMPHOUR:
2684 case SENSOR_LUX:
2685 case SENSOR_FREQ:
2686 case SENSOR_ACCEL:
2687 case SENSOR_VELOCITY:
2688 case SENSOR_DISTANCE:
2689 ret = asprintf(&v, "%.2f", s->value / 1000000.0);
2690 break;
2691 case SENSOR_INDICATOR:
2692 ret = asprintf(&v, "%s", s->value ? "on" : "off");
2693 break;
2694 case SENSOR_PERCENT:
2695 case SENSOR_HUMIDITY:
2696 ret = asprintf(&v, "%.2f", s->value / 1000.0);
2697 break;
2698 case SENSOR_PRESSURE:
2699 ret = asprintf(&v, "%.2f", s->value / 1000.0);
2700 break;
2701 case SENSOR_TIMEDELTA:
2702 ret = asprintf(&v, "%.6f", s->value / 1000000000.0);
2703 break;
2704 case SENSOR_DRIVE:
2705 if (s->value > 0 && s->value < SENSOR_DRIVE_STATES(10 + 1)) {
2706 ret = asprintf(&v, "%s", sensor_drive_s[s->value]);
2707 break;
2708 }
2709 /* FALLTHROUGH */
2710 case SENSOR_FANRPM:
2711 case SENSOR_OHMS:
2712 case SENSOR_INTEGER:
2713 default:
2714 ret = asprintf(&v, "%lld", s->value);
2715 break;
2716 }
2717
2718 if (ret == -1)
2719 return (NULL((void *)0));
2720 return (v);
2721}
2722
2723int
2724mib_carpsysctl(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2725{
2726 size_t len;
2727 int mib[] = { CTL_NET4, PF_INET2, IPPROTO_CARP112, 0 };
2728 int v;
2729
2730 mib[3] = oid->o_oido_id.bo_id[OIDIDX_carpsysctl9];
2731 len = sizeof(v);
2732
2733 if (sysctl(mib, 4, &v, &len, NULL((void *)0), 0) == -1)
2734 return (1);
2735
2736 *elm = ober_add_integer(*elm, v);
2737 return (0);
2738}
2739
2740int
2741mib_carpstats(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2742{
2743 int mib[] = { CTL_NET4, PF_INET2, IPPROTO_CARP112,
2744 CARPCTL_STATS4 };
2745 size_t len;
2746 struct carpstats stats;
2747 int i;
2748 struct statsmap {
2749 u_int8_t m_id;
2750 u_int64_t *m_ptr;
2751 } mapping[] = {
2752 { 1, &stats.carps_ipackets },
2753 { 2, &stats.carps_ipackets6 },
2754 { 3, &stats.carps_badif },
2755 { 4, &stats.carps_badttl },
2756 { 5, &stats.carps_hdrops },
2757 { 6, &stats.carps_badsum },
2758 { 7, &stats.carps_badver },
2759 { 8, &stats.carps_badlen },
2760 { 9, &stats.carps_badauth },
2761 { 10, &stats.carps_badvhid },
2762 { 11, &stats.carps_badaddrs },
2763 { 12, &stats.carps_opackets },
2764 { 13, &stats.carps_opackets6 },
2765 { 14, &stats.carps_onomem },
2766 { 15, &stats.carps_preempt }
2767 };
2768
2769 len = sizeof(stats);
2770
2771 if (sysctl(mib, 4, &stats, &len, NULL((void *)0), 0) == -1)
2772 return (1);
2773
2774 for (i = 0;
2775 (u_int)i < (sizeof(mapping) / sizeof(mapping[0])); i++) {
2776 if (oid->o_oido_id.bo_id[OIDIDX_carpstats9] == mapping[i].m_id) {
2777 *elm = ober_add_integer(*elm, *mapping[i].m_ptr);
2778 ober_set_header(*elm, BER_CLASS_APPLICATION0x1,
2779 SNMP_T_COUNTER64);
2780 return (0);
2781 }
2782 }
2783
2784 return (-1);
2785}
2786
2787int
2788mib_carpifnum(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2789{
2790 struct kif *kif;
2791 int c = 0;
2792
2793 for (kif = kr_getif(0); kif != NULL((void *)0);
2794 kif = kr_getnextif(kif->if_index))
2795 if (kif->if_typeif_data.ifi_type == IFT_CARP0xf7)
2796 c++;
2797
2798 *elm = ober_add_integer(*elm, c);
2799 return (0);
2800}
2801
2802struct carpif *
2803mib_carpifget(u_int idx)
2804{
2805 struct kif *kif;
2806 struct carpif *cif;
2807 int s;
2808 struct ifreq ifr;
2809 struct carpreq carpr;
2810
2811 if ((kif = kr_getif(idx)) == NULL((void *)0) || kif->if_typeif_data.ifi_type != IFT_CARP0xf7) {
2812 /*
2813 * It may happen that an interface with a specific index
2814 * does not exist, has been removed, or is not a carp(4)
2815 * interface. Jump to the next available carp(4) interface
2816 * index.
2817 */
2818 for (kif = kr_getif(0); kif != NULL((void *)0);
2819 kif = kr_getnextif(kif->if_index)) {
2820 if (kif->if_typeif_data.ifi_type != IFT_CARP0xf7)
2821 continue;
2822 if (kif->if_index > idx)
2823 break;
2824
2825 }
2826 if (kif == NULL((void *)0))
2827 return (NULL((void *)0));
2828 }
2829 idx = kif->if_index;
2830
2831 /* Update interface information */
2832 kr_updateif(idx);
2833 if ((kif = kr_getif(idx)) == NULL((void *)0)) {
2834 log_debug("mib_carpifget: interface %d disappeared?", idx);
2835 return (NULL((void *)0));
2836 }
2837
2838 if ((s = socket(AF_INET2, SOCK_DGRAM2, 0)) == -1)
2839 return (NULL((void *)0));
2840
2841 memset(&ifr, 0, sizeof(ifr));
2842 strlcpy(ifr.ifr_name, kif->if_name, sizeof(ifr.ifr_name));
2843 memset((char *)&carpr, 0, sizeof(carpr));
2844 ifr.ifr_dataifr_ifru.ifru_data = (caddr_t)&carpr;
2845
2846 if (ioctl(s, SIOCGVH(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct ifreq) & 0x1fff) << 16) | ((('i')) <<
8) | ((246)))
, (caddr_t)&ifr) == -1) {
2847 close(s);
2848 return (NULL((void *)0));
2849 }
2850
2851 cif = calloc(1, sizeof(struct carpif));
2852 if (cif != NULL((void *)0)) {
2853 memcpy(&cif->carpr, &carpr, sizeof(struct carpreq));
2854 memcpy(&cif->kif, kif, sizeof(struct kif));
2855 }
2856
2857 close(s);
2858
2859 return (cif);
2860}
2861
2862int
2863mib_carpiftable(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2864{
2865 u_int32_t idx;
2866 struct carpif *cif;
2867
2868 /* Get and verify the current row index */
2869 idx = o->bo_id[OIDIDX_carpIfEntry12];
2870
2871 if ((cif = mib_carpifget(idx)) == NULL((void *)0))
2872 return (1);
2873
2874 /* Tables need to prepend the OID on their own */
2875 o->bo_id[OIDIDX_carpIfEntry12] = cif->kif.if_index;
2876 *elm = ober_add_oid(*elm, o);
2877
2878 switch (o->bo_id[OIDIDX_carpIf11]) {
2879 case 1:
2880 *elm = ober_add_integer(*elm, cif->kif.if_index);
2881 break;
2882 case 2:
2883 *elm = ober_add_string(*elm, cif->kif.if_name);
2884 break;
2885 case 3:
2886 *elm = ober_add_integer(*elm, cif->carpr.carpr_vhids[0]);
2887 break;
2888 case 4:
2889 *elm = ober_add_string(*elm, cif->carpr.carpr_carpdev);
2890 break;
2891 case 5:
2892 *elm = ober_add_integer(*elm, cif->carpr.carpr_advbase);
2893 break;
2894 case 6:
2895 *elm = ober_add_integer(*elm, cif->carpr.carpr_advskews[0]);
2896 break;
2897 case 7:
2898 *elm = ober_add_integer(*elm, cif->carpr.carpr_states[0]);
2899 break;
2900 default:
2901 free(cif);
2902 return (1);
2903 }
2904
2905 free(cif);
2906 return (0);
2907}
2908
2909static struct ifg_req *
2910mib_carpgroupget(u_int idx)
2911{
2912 struct ifgroupreq ifgr;
2913 struct ifg_req *ifg = NULL((void *)0);
2914 u_int len;
2915 int s = -1;
2916
2917 bzero(&ifgr, sizeof(ifgr));
2918
2919 if ((s = socket(AF_INET2, SOCK_DGRAM2, 0)) == -1) {
2920 log_warn("socket");
2921 return (NULL((void *)0));
2922 }
2923
2924 if (ioctl(s, SIOCGIFGLIST(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct ifgroupreq) & 0x1fff) << 16) | ((('i')) <<
8) | ((141)))
, (caddr_t)&ifgr) == -1) {
2925 log_warn("SIOCGIFGLIST");
2926 goto err;
2927 }
2928 len = ifgr.ifgr_len;
2929
2930 if (len / sizeof(*ifgr.ifgr_groupsifgr_ifgru.ifgru_groups) <= idx-1)
2931 goto err;
2932
2933 if ((ifgr.ifgr_groupsifgr_ifgru.ifgru_groups = calloc(1, len)) == NULL((void *)0)) {
2934 log_warn("alloc");
2935 goto err;
2936 }
2937 if (ioctl(s, SIOCGIFGLIST(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct ifgroupreq) & 0x1fff) << 16) | ((('i')) <<
8) | ((141)))
, (caddr_t)&ifgr) == -1) {
2938 log_warn("SIOCGIFGLIST");
2939 goto err;
2940 }
2941 close(s);
2942
2943 if ((ifg = calloc(1, sizeof *ifg)) == NULL((void *)0)) {
2944 log_warn("alloc");
2945 goto err;
2946 }
2947
2948 memcpy(ifg, &ifgr.ifgr_groupsifgr_ifgru.ifgru_groups[idx-1], sizeof *ifg);
2949 free(ifgr.ifgr_groupsifgr_ifgru.ifgru_groups);
2950 return ifg;
2951 err:
2952 free(ifgr.ifgr_groupsifgr_ifgru.ifgru_groups);
2953 close(s);
2954 return (NULL((void *)0));
2955}
2956
2957int
2958mib_carpgrouptable(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
2959{
2960 struct ifgroupreq ifgr;
2961 struct ifg_req *ifg;
2962 uint32_t idx;
2963 int s;
2964
2965 /* Get and verify the current row index */
2966 idx = o->bo_id[OIDIDX_carpGroupIndex11];
2967
2968 if ((ifg = mib_carpgroupget(idx)) == NULL((void *)0))
2969 return (1);
2970
2971 /* Tables need to prepend the OID on their own */
2972 o->bo_id[OIDIDX_carpGroupIndex11] = idx;
2973 *elm = ober_add_oid(*elm, o);
2974
2975 switch (o->bo_id[OIDIDX_carpGroupEntry10]) {
2976 case 2:
2977 *elm = ober_add_string(*elm, ifg->ifgrq_groupifgrq_ifgrqu.ifgrqu_group);
2978 break;
2979 case 3:
2980 if ((s = socket(AF_INET2, SOCK_DGRAM2, 0)) == -1) {
2981 log_warn("socket");
2982 free(ifg);
2983 return (1);
2984 }
2985
2986 bzero(&ifgr, sizeof(ifgr));
2987 strlcpy(ifgr.ifgr_name, ifg->ifgrq_groupifgrq_ifgrqu.ifgrqu_group, sizeof(ifgr.ifgr_name));
2988 if (ioctl(s, SIOCGIFGATTR(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct ifgroupreq) & 0x1fff) << 16) | ((('i')) <<
8) | ((139)))
, (caddr_t)&ifgr) == -1) {
2989 log_warn("SIOCGIFGATTR");
2990 close(s);
2991 free(ifg);
2992 return (1);
2993 }
2994
2995 close(s);
2996 *elm = ober_add_integer(*elm, ifgr.ifgr_attribifgr_ifgru.ifgru_attrib.ifg_carp_demoted);
2997 break;
2998 default:
2999 free(ifg);
3000 return (1);
3001 }
3002
3003 free(ifg);
3004 return (0);
3005}
3006
3007int
3008mib_memiftable(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3009{
3010 struct ber_element *ber = *elm;
3011 u_int32_t idx = 0;
3012 struct kif *kif;
3013
3014 idx = o->bo_id[OIDIDX_memIfEntry11];
3015 if ((kif = mib_ifget(idx)) == NULL((void *)0))
3016 return (1);
3017
3018 o->bo_id[OIDIDX_memIfEntry11] = kif->if_index;
3019 ber = ober_add_oid(ber, o);
3020
3021 switch (o->bo_id[OIDIDX_memIf10]) {
3022 case 1:
3023 ber = ober_add_string(ber, kif->if_name);
3024 break;
3025 case 2:
3026 ber = ober_add_integer(ber, 0);
3027 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
3028 break;
3029 default:
3030 return (-1);
3031 }
3032
3033 return (0);
3034}
3035
3036/*
3037 * Defined in IP-MIB.txt
3038 */
3039
3040int mib_getipstat(struct ipstat *);
3041int mib_ipstat(struct oid *, struct ber_oid *, struct ber_element **);
3042int mib_ipforwarding(struct oid *, struct ber_oid *, struct ber_element **);
3043int mib_ipdefaultttl(struct oid *, struct ber_oid *, struct ber_element **);
3044int mib_ipinhdrerrs(struct oid *, struct ber_oid *, struct ber_element **);
3045int mib_ipinaddrerrs(struct oid *, struct ber_oid *, struct ber_element **);
3046int mib_ipforwdgrams(struct oid *, struct ber_oid *, struct ber_element **);
3047int mib_ipindiscards(struct oid *, struct ber_oid *, struct ber_element **);
3048int mib_ipreasmfails(struct oid *, struct ber_oid *, struct ber_element **);
3049int mib_ipfragfails(struct oid *, struct ber_oid *, struct ber_element **);
3050int mib_iproutingdiscards(struct oid *, struct ber_oid *,
3051 struct ber_element **);
3052int mib_ipaddr(struct oid *, struct ber_oid *, struct ber_element **);
3053struct ber_oid *
3054 mib_ipaddrtable(struct oid *, struct ber_oid *, struct ber_oid *);
3055int mib_physaddr(struct oid *, struct ber_oid *, struct ber_element **);
3056struct ber_oid *
3057 mib_physaddrtable(struct oid *, struct ber_oid *, struct ber_oid *);
3058
3059static struct oid ip_mib[] = {
3060 { MIB(ipMIB){ { 1, 3, 6, 1, 2, 1, 4 } }, ((void *)0), OID_MIB0x20 },
3061 { MIB(ipForwarding){ { 1, 3, 6, 1, 2, 1, 4, 1 } }, ((void *)0), OID_RD0x01, mib_ipforwarding },
3062 { MIB(ipDefaultTTL){ { 1, 3, 6, 1, 2, 1, 4, 2 } }, ((void *)0), OID_RD0x01, mib_ipdefaultttl },
3063 { MIB(ipInReceives){ { 1, 3, 6, 1, 2, 1, 4, 3 } }, ((void *)0), OID_RD0x01, mib_ipstat },
3064 { MIB(ipInHdrErrors){ { 1, 3, 6, 1, 2, 1, 4, 4 } }, ((void *)0), OID_RD0x01, mib_ipinhdrerrs },
3065 { MIB(ipInAddrErrors){ { 1, 3, 6, 1, 2, 1, 4, 5 } }, ((void *)0), OID_RD0x01, mib_ipinaddrerrs },
3066 { MIB(ipForwDatagrams){ { 1, 3, 6, 1, 2, 1, 4, 6 } }, ((void *)0), OID_RD0x01, mib_ipforwdgrams },
3067 { MIB(ipInUnknownProtos){ { 1, 3, 6, 1, 2, 1, 4, 7 } }, ((void *)0), OID_RD0x01, mib_ipstat },
3068#ifdef notyet
3069 { MIB(ipInDiscards){ { 1, 3, 6, 1, 2, 1, 4, 8 } }, ((void *)0) },
3070#endif
3071 { MIB(ipInDelivers){ { 1, 3, 6, 1, 2, 1, 4, 9 } }, ((void *)0), OID_RD0x01, mib_ipstat },
3072 { MIB(ipOutRequests){ { 1, 3, 6, 1, 2, 1, 4, 10 } }, ((void *)0), OID_RD0x01, mib_ipstat },
3073 { MIB(ipOutDiscards){ { 1, 3, 6, 1, 2, 1, 4, 11 } }, ((void *)0), OID_RD0x01, mib_ipstat },
3074 { MIB(ipOutNoRoutes){ { 1, 3, 6, 1, 2, 1, 4, 12 } }, ((void *)0), OID_RD0x01, mib_ipstat },
3075 { MIB(ipReasmTimeout){ { 1, 3, 6, 1, 2, 1, 4, 13 } }, ((void *)0), OID_RD0x01, mps_getint, NULL((void *)0),
3076 NULL((void *)0), IPFRAGTTL60 },
3077 { MIB(ipReasmReqds){ { 1, 3, 6, 1, 2, 1, 4, 14 } }, ((void *)0), OID_RD0x01, mib_ipstat },
3078 { MIB(ipReasmOKs){ { 1, 3, 6, 1, 2, 1, 4, 15 } }, ((void *)0), OID_RD0x01, mib_ipstat },
3079 { MIB(ipReasmFails){ { 1, 3, 6, 1, 2, 1, 4, 16 } }, ((void *)0), OID_RD0x01, mib_ipreasmfails },
3080 { MIB(ipFragOKs){ { 1, 3, 6, 1, 2, 1, 4, 17 } }, ((void *)0), OID_RD0x01, mib_ipstat },
3081 { MIB(ipFragFails){ { 1, 3, 6, 1, 2, 1, 4, 18 } }, ((void *)0), OID_RD0x01, mib_ipfragfails },
3082 { MIB(ipFragCreates){ { 1, 3, 6, 1, 2, 1, 4, 19 } }, ((void *)0), OID_RD0x01, mib_ipstat },
3083 { MIB(ipAdEntAddr){ { 1, 3, 6, 1, 2, 1, 4, 20, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipaddr, NULL((void *)0),
3084 mib_ipaddrtable },
3085 { MIB(ipAdEntIfIndex){ { 1, 3, 6, 1, 2, 1, 4, 20, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipaddr, NULL((void *)0),
3086 mib_ipaddrtable },
3087 { MIB(ipAdEntNetMask){ { 1, 3, 6, 1, 2, 1, 4, 20, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipaddr, NULL((void *)0),
3088 mib_ipaddrtable },
3089 { MIB(ipAdEntBcastAddr){ { 1, 3, 6, 1, 2, 1, 4, 20, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipaddr, NULL((void *)0),
3090 mib_ipaddrtable },
3091 { MIB(ipAdEntReasmMaxSize){ { 1, 3, 6, 1, 2, 1, 4, 20, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipaddr, NULL((void *)0),
3092 mib_ipaddrtable },
3093 { MIB(ipNetToMediaIfIndex){ { 1, 3, 6, 1, 2, 1, 4, 22, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_physaddr, NULL((void *)0),
3094 mib_physaddrtable },
3095 { MIB(ipNetToMediaPhysAddress){ { 1, 3, 6, 1, 2, 1, 4, 22, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_physaddr, NULL((void *)0),
3096 mib_physaddrtable },
3097 { MIB(ipNetToMediaNetAddress){ { 1, 3, 6, 1, 2, 1, 4, 22, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_physaddr, NULL((void *)0),
3098 mib_physaddrtable },
3099 { MIB(ipNetToMediaType){ { 1, 3, 6, 1, 2, 1, 4, 22, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_physaddr, NULL((void *)0),
3100 mib_physaddrtable },
3101#ifdef notyet
3102 { MIB(ipRoutingDiscards){ { 1, 3, 6, 1, 2, 1, 4, 23 } }, ((void *)0) },
3103#endif
3104 { MIBEND{ { 0 } }, ((void *)0) }
3105};
3106
3107int
3108mib_ipforwarding(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3109{
3110 int mib[] = { CTL_NET4, PF_INET2, IPPROTO_IP0, IPCTL_FORWARDING1 };
3111 int v;
3112 size_t len = sizeof(v);
3113
3114 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &v, &len, NULL((void *)0), 0) == -1)
3115 return (-1);
3116
3117 /* ipForwarding: forwarding(1), notForwarding(2) */
3118 *elm = ober_add_integer(*elm, (v == 0) ? 2 : 1);
3119
3120 return (0);
3121}
3122
3123int
3124mib_ipdefaultttl(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3125{
3126 int mib[] = { CTL_NET4, PF_INET2, IPPROTO_IP0, IPCTL_DEFTTL3 };
3127 int v;
3128 size_t len = sizeof(v);
3129
3130 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &v, &len, NULL((void *)0), 0) == -1)
3131 return (-1);
3132
3133 *elm = ober_add_integer(*elm, v);
3134
3135 return (0);
3136}
3137
3138int
3139mib_getipstat(struct ipstat *ipstat)
3140{
3141 int mib[] = { CTL_NET4, PF_INET2, IPPROTO_IP0, IPCTL_STATS33 };
3142 size_t len = sizeof(*ipstat);
3143
3144 return (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), ipstat, &len, NULL((void *)0), 0));
3145}
3146
3147int
3148mib_ipstat(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3149{
3150 struct ipstat ipstat;
3151 long long i;
3152 struct statsmap {
3153 u_int8_t m_id;
3154 u_long *m_ptr;
3155 } mapping[] = {
3156 { 3, &ipstat.ips_total },
3157 { 7, &ipstat.ips_noproto },
3158 { 9, &ipstat.ips_delivered },
3159 { 10, &ipstat.ips_localout },
3160 { 11, &ipstat.ips_odropped },
3161 { 12, &ipstat.ips_noroute },
3162 { 14, &ipstat.ips_fragments },
3163 { 15, &ipstat.ips_reassembled },
3164 { 17, &ipstat.ips_fragmented },
3165 { 19, &ipstat.ips_ofragments }
3166 };
3167
3168 if (mib_getipstat(&ipstat) == -1)
3169 return (-1);
3170
3171 for (i = 0;
3172 (u_int)i < (sizeof(mapping) / sizeof(mapping[0])); i++) {
3173 if (oid->o_oido_id.bo_id[OIDIDX_ip7] == mapping[i].m_id) {
3174 *elm = ober_add_integer(*elm, *mapping[i].m_ptr);
3175 ober_set_header(*elm,
3176 BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
3177 return (0);
3178 }
3179 }
3180
3181 return (-1);
3182}
3183
3184int
3185mib_ipinhdrerrs(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3186{
3187 u_int32_t errors;
3188 struct ipstat ipstat;
3189
3190 if (mib_getipstat(&ipstat) == -1)
3191 return (-1);
3192
3193 errors = ipstat.ips_badsum + ipstat.ips_badvers +
3194 ipstat.ips_tooshort + ipstat.ips_toosmall +
3195 ipstat.ips_badhlen + ipstat.ips_badlen +
3196 ipstat.ips_badoptions + ipstat.ips_toolong +
3197 ipstat.ips_badaddr;
3198
3199 *elm = ober_add_integer(*elm, errors);
3200 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
3201
3202 return (0);
3203}
3204
3205int
3206mib_ipinaddrerrs(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3207{
3208 u_int32_t errors;
3209 struct ipstat ipstat;
3210
3211 if (mib_getipstat(&ipstat) == -1)
3212 return (-1);
3213
3214 errors = ipstat.ips_cantforward + ipstat.ips_badaddr;
3215
3216 *elm = ober_add_integer(*elm, errors);
3217 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
3218
3219 return (0);
3220}
3221
3222int
3223mib_ipforwdgrams(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3224{
3225 u_int32_t counter;
3226 struct ipstat ipstat;
3227
3228 if (mib_getipstat(&ipstat) == -1)
3229 return (-1);
3230
3231 counter = ipstat.ips_forward + ipstat.ips_redirectsent;
3232
3233 *elm = ober_add_integer(*elm, counter);
3234 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
3235
3236 return (0);
3237}
3238
3239int
3240mib_ipindiscards(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3241{
3242 return (0);
3243}
3244
3245int
3246mib_ipreasmfails(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3247{
3248 u_int32_t counter;
3249 struct ipstat ipstat;
3250
3251 if (mib_getipstat(&ipstat) == -1)
3252 return (-1);
3253
3254 counter = ipstat.ips_fragdropped + ipstat.ips_fragtimeout;
3255
3256 *elm = ober_add_integer(*elm, counter);
3257 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
3258
3259 return (0);
3260}
3261
3262int
3263mib_ipfragfails(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3264{
3265 u_int32_t counter;
3266 struct ipstat ipstat;
3267
3268 if (mib_getipstat(&ipstat) == -1)
3269 return (-1);
3270
3271 counter = ipstat.ips_badfrags + ipstat.ips_cantfrag;
3272 *elm = ober_add_integer(*elm, counter);
3273 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
3274
3275 return (0);
3276}
3277
3278int
3279mib_iproutingdiscards(struct oid *oid, struct ber_oid *o,
3280 struct ber_element **elm)
3281{
3282 return (0);
3283}
3284
3285struct ber_oid *
3286mib_ipaddrtable(struct oid *oid, struct ber_oid *o, struct ber_oid *no)
3287{
3288 struct sockaddr_in addr;
3289 u_int32_t col, id;
3290 struct oid a, b;
3291 struct kif_addr *ka;
3292
3293 bzero(&addr, sizeof(addr));
3294 addr.sin_family = AF_INET2;
3295 addr.sin_len = sizeof(addr);
3296
3297 bcopy(&oid->o_id, no, sizeof(*no));
3298 id = oid->o_oidleno_id.bo_n - 1;
3299
3300 if (o->bo_n >= oid->o_oidleno_id.bo_n) {
3301 /*
3302 * Compare the requested and the matched OID to see
3303 * if we have to iterate to the next element.
3304 */
3305 bzero(&a, sizeof(a));
3306 bcopy(o, &a.o_id, sizeof(struct ber_oid));
3307 bzero(&b, sizeof(b));
3308 bcopy(&oid->o_id, &b.o_id, sizeof(struct ber_oid));
3309 b.o_oidleno_id.bo_n--;
3310 b.o_flags |= OID_TABLE0x10;
3311 if (smi_oid_cmp(&a, &b) == 0) {
3312 col = oid->o_oido_id.bo_id[id];
3313 o->bo_id[id] = col;
3314 bcopy(o, no, sizeof(*no));
3315 }
3316 }
3317
3318 mps_decodeinaddr(no, &addr.sin_addr, OIDIDX_ipAddr9 + 1);
3319 if (o->bo_n <= (OIDIDX_ipAddr9 + 1))
3320 ka = kr_getaddr(NULL((void *)0));
3321 else
3322 ka = kr_getnextaddr((struct sockaddr *)&addr);
3323 if (ka == NULL((void *)0) || ka->addr.sa.sa_family != AF_INET2) {
3324 /*
3325 * Encode invalid "last address" marker which will tell
3326 * mib_ipaddr() to fail and the SNMP engine to find the
3327 * next OID.
3328 */
3329 mps_encodeinaddr(no, NULL((void *)0), OIDIDX_ipAddr9 + 1);
3330 } else {
3331 /* Encode real IPv4 address */
3332 addr.sin_addr.s_addr = ka->addr.sin.sin_addr.s_addr;
3333 mps_encodeinaddr(no, &addr.sin_addr, OIDIDX_ipAddr9 + 1);
3334 }
3335 smi_oidlen(o);
3336
3337 return (no);
3338}
3339
3340int
3341mib_ipaddr(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3342{
3343 struct sockaddr_in addr;
3344 struct ber_element *ber = *elm;
3345 struct kif_addr *ka;
3346 u_int32_t val;
3347
3348 bzero(&addr, sizeof(addr));
3349 addr.sin_family = AF_INET2;
3350 addr.sin_len = sizeof(addr);
3351
3352 if (mps_decodeinaddr(o, &addr.sin_addr, OIDIDX_ipAddr9 + 1) == -1) {
3353 /* Strip invalid address and fail */
3354 o->bo_n = OIDIDX_ipAddr9 + 1;
3355 return (1);
3356 }
3357 ka = kr_getaddr((struct sockaddr *)&addr);
3358 if (ka == NULL((void *)0) || ka->addr.sa.sa_family != AF_INET2)
3359 return (1);
3360
3361 /* write OID */
3362 ber = ober_add_oid(ber, o);
3363
3364 switch (o->bo_id[OIDIDX_ipAddr9]) {
3365 case 1:
3366 val = addr.sin_addr.s_addr;
3367 ber = ober_add_nstring(ber, (char *)&val, sizeof(u_int32_t));
3368 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_IPADDR);
3369 break;
3370 case 2:
3371 ber = ober_add_integer(ber, ka->if_index);
3372 break;
3373 case 3:
3374 val = ka->mask.sin.sin_addr.s_addr;
3375 ber = ober_add_nstring(ber, (char *)&val, sizeof(u_int32_t));
3376 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_IPADDR);
3377 break;
3378 case 4:
3379 ber = ober_add_integer(ber, ka->dstbrd.sa.sa_len ? 1 : 0);
3380 break;
3381 case 5:
3382 ber = ober_add_integer(ber, IP_MAXPACKET65535);
3383 break;
3384 default:
3385 return (-1);
3386 }
3387
3388 return (0);
3389}
3390
3391struct ber_oid *
3392mib_physaddrtable(struct oid *oid, struct ber_oid *o, struct ber_oid *no)
3393{
3394 struct sockaddr_in addr;
3395 struct oid a, b;
3396 struct kif *kif;
3397 struct kif_arp *ka;
3398 u_int32_t id, idx = 0;
3399
3400 bcopy(&oid->o_id, no, sizeof(*no));
3401 id = oid->o_oidleno_id.bo_n - 1;
3402
3403 if (o->bo_n >= oid->o_oidleno_id.bo_n) {
3404 /*
3405 * Compare the requested and the matched OID to see
3406 * if we have to iterate to the next element.
3407 */
3408 bzero(&a, sizeof(a));
3409 bcopy(o, &a.o_id, sizeof(struct ber_oid));
3410 bzero(&b, sizeof(b));
3411 bcopy(&oid->o_id, &b.o_id, sizeof(struct ber_oid));
3412 b.o_oidleno_id.bo_n--;
3413 b.o_flags |= OID_TABLE0x10;
3414 if (smi_oid_cmp(&a, &b) == 0) {
3415 o->bo_id[id] = oid->o_oido_id.bo_id[id];
3416 bcopy(o, no, sizeof(*no));
3417 }
3418 }
3419
3420 if (o->bo_n > OIDIDX_ipNetToMedia9 + 1)
3421 idx = o->bo_id[OIDIDX_ipNetToMedia9 + 1];
3422
3423 bzero(&addr, sizeof(addr));
3424 addr.sin_family = AF_INET2;
3425 addr.sin_len = sizeof(addr);
3426 if (o->bo_n > OIDIDX_ipNetToMedia9 + 2)
3427 mps_decodeinaddr(no, &addr.sin_addr, OIDIDX_ipNetToMedia9 + 2);
3428
3429 if ((kif = kr_getif(idx)) == NULL((void *)0)) {
3430 /* No configured interfaces */
3431 if (idx == 0)
3432 return (NULL((void *)0));
3433 /*
3434 * It may happen that an interface with a specific index
3435 * does not exist or has been removed. Jump to the next
3436 * available interface.
3437 */
3438 kif = kr_getif(0);
3439 nextif:
3440 for (; kif != NULL((void *)0); kif = kr_getnextif(kif->if_index))
3441 if (kif->if_index > idx &&
3442 (ka = karp_first(kif->if_index)) != NULL((void *)0))
3443 break;
3444 if (kif == NULL((void *)0)) {
3445 /* No more interfaces with addresses on them */
3446 o->bo_id[OIDIDX_ipNetToMedia9 + 1] = 0;
3447 mps_encodeinaddr(no, NULL((void *)0), OIDIDX_ipNetToMedia9 + 2);
3448 smi_oidlen(o);
3449 return (NULL((void *)0));
3450 }
3451 } else {
3452 if (idx == 0 || addr.sin_addr.s_addr == 0)
3453 ka = karp_first(kif->if_index);
3454 else
3455 ka = karp_getaddr((struct sockaddr *)&addr, idx, 1);
3456 if (ka == NULL((void *)0)) {
3457 /* Try next interface */
3458 goto nextif;
3459 }
3460 }
3461 idx = kif->if_index;
3462
3463 no->bo_id[OIDIDX_ipNetToMedia9 + 1] = idx;
3464 /* Encode real IPv4 address */
3465 memcpy(&addr, &ka->addr.sin, ka->addr.sin.sin_len);
3466 mps_encodeinaddr(no, &addr.sin_addr, OIDIDX_ipNetToMedia9 + 2);
3467
3468 smi_oidlen(o);
3469 return (no);
3470}
3471
3472int
3473mib_physaddr(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3474{
3475 struct ber_element *ber = *elm;
3476 struct sockaddr_in addr;
3477 struct kif_arp *ka;
3478 u_int32_t val, idx = 0;
3479
3480 idx = o->bo_id[OIDIDX_ipNetToMedia9 + 1];
3481 if (idx == 0) {
3482 /* Strip invalid interface index and fail */
3483 o->bo_n = OIDIDX_ipNetToMedia9 + 1;
3484 return (1);
3485 }
3486
3487 /* Get the IP address */
3488 bzero(&addr, sizeof(addr));
3489 addr.sin_family = AF_INET2;
3490 addr.sin_len = sizeof(addr);
3491
3492 if (mps_decodeinaddr(o, &addr.sin_addr,
3493 OIDIDX_ipNetToMedia9 + 2) == -1) {
3494 /* Strip invalid address and fail */
3495 o->bo_n = OIDIDX_ipNetToMedia9 + 2;
3496 return (1);
3497 }
3498 if ((ka = karp_getaddr((struct sockaddr *)&addr, idx, 0)) == NULL((void *)0))
3499 return (1);
3500
3501 /* write OID */
3502 ber = ober_add_oid(ber, o);
3503
3504 switch (o->bo_id[OIDIDX_ipNetToMedia9]) {
3505 case 1: /* ipNetToMediaIfIndex */
3506 ber = ober_add_integer(ber, ka->if_index);
3507 break;
3508 case 2: /* ipNetToMediaPhysAddress */
3509 if (bcmp(LLADDR(&ka->target.sdl)((caddr_t)((&ka->target.sdl)->sdl_data + (&ka->
target.sdl)->sdl_nlen))
, ether_zeroaddr,
3510 sizeof(ether_zeroaddr)) == 0)
3511 ber = ober_add_nstring(ber, ether_zeroaddr,
3512 sizeof(ether_zeroaddr));
3513 else
3514 ber = ober_add_nstring(ber, LLADDR(&ka->target.sdl)((caddr_t)((&ka->target.sdl)->sdl_data + (&ka->
target.sdl)->sdl_nlen))
,
3515 ka->target.sdl.sdl_alen);
3516 break;
3517 case 3: /* ipNetToMediaNetAddress */
3518 val = addr.sin_addr.s_addr;
3519 ber = ober_add_nstring(ber, (char *)&val, sizeof(u_int32_t));
3520 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_IPADDR);
3521 break;
3522 case 4: /* ipNetToMediaType */
3523 if (ka->flags & F_STATIC0x0002)
3524 ber = ober_add_integer(ber, 4); /* static */
3525 else
3526 ber = ober_add_integer(ber, 3); /* dynamic */
3527 break;
3528 default:
3529 return (-1);
3530 }
3531 return (0);
3532}
3533
3534/*
3535 * Defined in IP-FORWARD-MIB.txt (rfc4292)
3536 */
3537
3538int mib_ipfnroutes(struct oid *, struct ber_oid *, struct ber_element **);
3539struct ber_oid *
3540mib_ipfroutetable(struct oid *oid, struct ber_oid *o, struct ber_oid *no);
3541int mib_ipfroute(struct oid *, struct ber_oid *, struct ber_element **);
3542
3543static struct oid ipf_mib[] = {
3544 { MIB(ipfMIB){ { 1, 3, 6, 1, 2, 1, 4, 24 } }, ((void *)0), OID_MIB0x20 },
3545 { MIB(ipfInetCidrRouteNumber){ { 1, 3, 6, 1, 2, 1, 4, 24, 6 } }, ((void *)0), OID_RD0x01, mib_ipfnroutes },
3546
3547 { MIB(ipfRouteEntIfIndex){ { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 7 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipfroute, NULL((void *)0),
3548 mib_ipfroutetable },
3549 { MIB(ipfRouteEntType){ { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 8 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipfroute, NULL((void *)0),
3550 mib_ipfroutetable },
3551 { MIB(ipfRouteEntProto){ { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 9 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipfroute, NULL((void *)0),
3552 mib_ipfroutetable },
3553 { MIB(ipfRouteEntAge){ { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 10 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipfroute, NULL((void *)0),
3554 mib_ipfroutetable },
3555 { MIB(ipfRouteEntNextHopAS){ { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 11 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipfroute, NULL((void *)0),
3556 mib_ipfroutetable },
3557 { MIB(ipfRouteEntRouteMetric1){ { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 12 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipfroute, NULL((void *)0),
3558 mib_ipfroutetable },
3559 { MIB(ipfRouteEntRouteMetric2){ { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 13 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipfroute, NULL((void *)0),
3560 mib_ipfroutetable },
3561 { MIB(ipfRouteEntRouteMetric3){ { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 14 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipfroute, NULL((void *)0),
3562 mib_ipfroutetable },
3563 { MIB(ipfRouteEntRouteMetric4){ { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 15 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipfroute, NULL((void *)0),
3564 mib_ipfroutetable },
3565 { MIB(ipfRouteEntRouteMetric5){ { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 16 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipfroute, NULL((void *)0),
3566 mib_ipfroutetable },
3567 { MIB(ipfRouteEntStatus){ { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 17 } }, ((void *)0), OID_TRD(0x01|0x10), mib_ipfroute, NULL((void *)0),
3568 mib_ipfroutetable },
3569 { MIBEND{ { 0 } }, ((void *)0) }
3570};
3571
3572int
3573mib_ipfnroutes(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3574{
3575 *elm = ober_add_integer(*elm, kr_routenumber());
3576 ober_set_header(*elm, BER_CLASS_APPLICATION0x1, SNMP_T_GAUGE32);
3577
3578 return (0);
3579}
3580
3581struct ber_oid *
3582mib_ipfroutetable(struct oid *oid, struct ber_oid *o, struct ber_oid *no)
3583{
3584 u_int32_t col, id;
3585 struct oid a, b;
3586 struct sockaddr_in addr;
3587 struct kroute *kr;
3588 int af, atype, idx;
3589 u_int8_t prefixlen;
3590 u_int8_t prio;
3591
3592 bzero(&addr, sizeof(addr));
3593 addr.sin_family = AF_INET2;
3594 addr.sin_len = sizeof(addr);
3595
3596 bcopy(&oid->o_id, no, sizeof(*no));
3597 id = oid->o_oidleno_id.bo_n - 1;
3598
3599 if (o->bo_n >= oid->o_oidleno_id.bo_n) {
3600 /*
3601 * Compare the requested and the matched OID to see
3602 * if we have to iterate to the next element.
3603 */
3604 bzero(&a, sizeof(a));
3605 bcopy(o, &a.o_id, sizeof(struct ber_oid));
3606 bzero(&b, sizeof(b));
3607 bcopy(&oid->o_id, &b.o_id, sizeof(struct ber_oid));
3608 b.o_oidleno_id.bo_n--;
3609 b.o_flags |= OID_TABLE0x10;
3610 if (smi_oid_cmp(&a, &b) == 0) {
3611 col = oid->o_oido_id.bo_id[id];
3612 o->bo_id[id] = col;
3613 bcopy(o, no, sizeof(*no));
3614 }
3615 }
3616
3617 af = no->bo_id[OIDIDX_ipfInetCidrRoute10 + 1];
3618 mps_decodeinaddr(no, &addr.sin_addr, OIDIDX_ipfInetCidrRoute10 + 3);
3619 prefixlen = o->bo_id[OIDIDX_ipfInetCidrRoute10 + 7];
3620 prio = o->bo_id[OIDIDX_ipfInetCidrRoute10 + 10];
3621
3622 if (af == 0)
3623 kr = kroute_first();
3624 else
3625 kr = kroute_getaddr(addr.sin_addr.s_addr, prefixlen, prio, 1);
3626
3627 if (kr == NULL((void *)0)) {
3628 addr.sin_addr.s_addr = 0;
3629 prefixlen = 0;
3630 prio = 0;
3631 addr.sin_family = 0;
3632 } else {
3633 addr.sin_addr.s_addr = kr->prefix.s_addr;
3634 prefixlen = kr->prefixlen;
3635 prio = kr->priority;
3636 }
3637
3638 switch (addr.sin_family) {
3639 case AF_INET2:
3640 atype = 1;
3641 break;
3642 case AF_INET624:
3643 atype = 2;
3644 break;
3645 default:
3646 atype = 0;
3647 break;
3648 }
3649 idx = OIDIDX_ipfInetCidrRoute10 + 1;
3650 no->bo_id[idx++] = atype;
3651 no->bo_id[idx++] = 0x04;
3652 no->bo_n++;
3653
3654 mps_encodeinaddr(no, &addr.sin_addr, idx);
3655 no->bo_id[no->bo_n++] = prefixlen;
3656 no->bo_id[no->bo_n++] = 0x02;
3657 no->bo_n += 2; /* policy */
3658 no->bo_id[OIDIDX_ipfInetCidrRoute10 + 10] = prio;
3659
3660 if (kr != NULL((void *)0)) {
3661 no->bo_id[no->bo_n++] = atype;
3662 no->bo_id[no->bo_n++] = 0x04;
3663 mps_encodeinaddr(no, &kr->nexthop, no->bo_n);
3664 } else
3665 no->bo_n += 2;
3666
3667 smi_oidlen(o);
3668
3669 return (no);
3670}
3671
3672int
3673mib_ipfroute(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3674{
3675 struct ber_element *ber = *elm;
3676 struct kroute *kr;
3677 struct sockaddr_in addr, nhaddr;
3678 int idx = o->bo_id[OIDIDX_ipfInetCidrRoute10];
3679 int af;
3680 u_int8_t prefixlen, prio, type, proto;
3681
3682
3683 bzero(&addr, sizeof(addr));
3684 addr.sin_family = AF_INET2;
3685 addr.sin_len = sizeof(addr);
3686
3687 af = o->bo_id[OIDIDX_ipfInetCidrRoute10 + 1];
3688 mps_decodeinaddr(o, &addr.sin_addr, OIDIDX_ipfInetCidrRoute10 + 3);
3689 mps_decodeinaddr(o, &nhaddr.sin_addr, OIDIDX_ipfInetCidrRoute10 + 23);
3690 prefixlen = o->bo_id[OIDIDX_ipfInetCidrRoute10 + 7];
3691 prio = o->bo_id[OIDIDX_ipfInetCidrRoute10 + 10];
3692 kr = kroute_getaddr(addr.sin_addr.s_addr, prefixlen, prio, 0);
3693 if (kr == NULL((void *)0) || af == 0) {
3694 return (1);
3695 }
3696
3697 /* write OID */
3698 ber = ober_add_oid(ber, o);
3699
3700 switch (idx) {
3701 case 7: /* IfIndex */
3702 ber = ober_add_integer(ber, kr->if_index);
3703 break;
3704 case 8: /* Type */
3705 if (kr->flags & F_REJECT0x0008)
3706 type = 2;
3707 else if (kr->flags & F_BLACKHOLE0x0004)
3708 type = 5;
3709 else if (kr->flags & F_CONNECTED0x0001)
3710 type = 3;
3711 else
3712 type = 4;
3713 ber = ober_add_integer(ber, type);
3714 break;
3715 case 9: /* Proto */
3716 switch (kr->priority) {
3717 case RTP_CONNECTED4:
3718 proto = 2;
3719 break;
3720 case RTP_STATIC8:
3721 proto = 3;
3722 break;
3723 case RTP_OSPF32:
3724 proto = 13;
3725 break;
3726 case RTP_ISIS36:
3727 proto = 9;
3728 break;
3729 case RTP_RIP40:
3730 proto = 8;
3731 break;
3732 case RTP_BGP48:
3733 proto = 14;
3734 break;
3735 default:
3736 if (kr->flags & F_DYNAMIC0x0010)
3737 proto = 4;
3738 else
3739 proto = 1; /* not specified */
3740 break;
3741 }
3742 ber = ober_add_integer(ber, proto);
3743 break;
3744 case 10: /* Age */
3745 ber = ober_add_integer(ber, 0);
3746 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_GAUGE32);
3747 break;
3748 case 11: /* NextHopAS */
3749 ber = ober_add_integer(ber, 0); /* unknown */
3750 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_GAUGE32);
3751 break;
3752 case 12: /* Metric1 */
3753 ber = ober_add_integer(ber, -1); /* XXX */
3754 break;
3755 case 13: /* Metric2 */
3756 ber = ober_add_integer(ber, -1); /* XXX */
3757 break;
3758 case 14: /* Metric3 */
3759 ber = ober_add_integer(ber, -1); /* XXX */
3760 break;
3761 case 15: /* Metric4 */
3762 ber = ober_add_integer(ber, -1); /* XXX */
3763 break;
3764 case 16: /* Metric5 */
3765 ber = ober_add_integer(ber, -1); /* XXX */
3766 break;
3767 case 17: /* Status */
3768 ber = ober_add_integer(ber, 1); /* XXX */
3769 break;
3770 default:
3771 return (-1);
3772 }
3773
3774 return (0);
3775}
3776
3777/*
3778 * Defined in UCD-DISKIO-MIB.txt.
3779 */
3780
3781int mib_diskio(struct oid *oid, struct ber_oid *o, struct ber_element **elm);
3782
3783static struct oid diskio_mib[] = {
3784 { MIB(ucdDiskIOMIB){ { 1, 3, 6, 1, 4, 1, 2021, 13, 15 } }, ((void *)0), OID_MIB0x20 },
3785 { MIB(diskIOIndex){ { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_diskio },
3786 { MIB(diskIODevice){ { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_diskio },
3787 { MIB(diskIONRead){ { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_diskio },
3788 { MIB(diskIONWritten){ { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_diskio },
3789 { MIB(diskIOReads){ { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_diskio },
3790 { MIB(diskIOWrites){ { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 6 } }, ((void *)0), OID_TRD(0x01|0x10), mib_diskio },
3791 { MIB(diskIONReadX){ { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 12 } }, ((void *)0), OID_TRD(0x01|0x10), mib_diskio },
3792 { MIB(diskIONWrittenX){ { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 13 } }, ((void *)0), OID_TRD(0x01|0x10), mib_diskio },
3793 { MIBEND{ { 0 } }, ((void *)0) }
3794};
3795
3796int
3797mib_diskio(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3798{
3799 struct ber_element *ber = *elm;
3800 u_int32_t idx;
3801 int mib[] = { CTL_HW6, 0 };
3802 unsigned int diskcount;
3803 struct diskstats *stats;
3804 size_t len;
3805
3806 len = sizeof(diskcount);
3807 mib[1] = HW_DISKCOUNT10;
3808 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &diskcount, &len, NULL((void *)0), 0) == -1)
3809 return (-1);
3810
3811 /* Get and verify the current row index */
3812 idx = o->bo_id[OIDIDX_diskIOEntry12];
3813 if (idx > diskcount)
3814 return (1);
3815
3816 /* Tables need to prepend the OID on their own */
3817 o->bo_id[OIDIDX_diskIOEntry12] = idx;
3818 ber = ober_add_oid(ber, o);
3819
3820 stats = calloc(diskcount, sizeof(*stats));
3821 if (stats == NULL((void *)0))
3822 return (-1);
3823 /* We know len won't overflow, otherwise calloc() would have failed. */
3824 len = diskcount * sizeof(*stats);
3825 mib[1] = HW_DISKSTATS9;
3826 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), stats, &len, NULL((void *)0), 0) == -1) {
3827 free(stats);
3828 return (-1);
3829 }
3830
3831 switch (o->bo_id[OIDIDX_diskIO11]) {
3832 case 1: /* diskIOIndex */
3833 ber = ober_add_integer(ber, idx);
3834 break;
3835 case 2: /* diskIODevice */
3836 ber = ober_add_string(ber, stats[idx - 1].ds_name);
3837 break;
3838 case 3: /* diskIONRead */
3839 ber = ober_add_integer(ber, (u_int32_t)stats[idx - 1].ds_rbytes);
3840 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
3841 break;
3842 case 4: /* diskIONWritten */
3843 ber = ober_add_integer(ber, (u_int32_t)stats[idx - 1].ds_wbytes);
3844 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
3845 break;
3846 case 5: /* diskIOReads */
3847 ber = ober_add_integer(ber, (u_int32_t)stats[idx - 1].ds_rxfer);
3848 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
3849 break;
3850 case 6: /* diskIOWrites */
3851 ber = ober_add_integer(ber, (u_int32_t)stats[idx - 1].ds_wxfer);
3852 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
3853 break;
3854 case 12: /* diskIONReadX */
3855 ber = ober_add_integer(ber, stats[idx - 1].ds_rbytes);
3856 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
3857 break;
3858 case 13: /* diskIONWrittenX */
3859 ber = ober_add_integer(ber, stats[idx - 1].ds_wbytes);
3860 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER64);
3861 break;
3862 default:
3863 free(stats);
3864 return (-1);
3865 }
3866
3867 free(stats);
3868 return (0);
3869}
3870
3871/*
3872 * Defined in BRIDGE-MIB.txt (rfc1493)
3873 *
3874 * This MIB is required by some NMS to accept the device because
3875 * the RFC says that mostly any network device has to provide this MIB... :(
3876 */
3877
3878int mib_dot1dtable(struct oid *, struct ber_oid *, struct ber_element **);
3879
3880static struct oid bridge_mib[] = {
3881 { MIB(dot1dBridge){ { 1, 3, 6, 1, 2, 1, 17 } }, ((void *)0), OID_MIB0x20 },
3882 { MIB(dot1dBaseBridgeAddress){ { 1, 3, 6, 1, 2, 1, 17, 1, 1 } }, ((void *)0) },
3883 { MIB(dot1dBaseNumPorts){ { 1, 3, 6, 1, 2, 1, 17, 1, 2 } }, ((void *)0), OID_RD0x01, mib_ifnumber },
3884 { MIB(dot1dBaseType){ { 1, 3, 6, 1, 2, 1, 17, 1, 3 } }, ((void *)0), OID_RD0x01, mps_getint, NULL((void *)0),
3885 NULL((void *)0), 4 /* srt (sourceroute + transparent) */ },
3886 { MIB(dot1dBasePort){ { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 1 } }, ((void *)0), OID_TRD(0x01|0x10), mib_dot1dtable },
3887 { MIB(dot1dBasePortIfIndex){ { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 2 } }, ((void *)0), OID_TRD(0x01|0x10), mib_dot1dtable },
3888 { MIB(dot1dBasePortCircuit){ { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 3 } }, ((void *)0), OID_TRD(0x01|0x10), mib_dot1dtable},
3889 { MIB(dot1dBasePortDelayExceededDiscards){ { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 4 } }, ((void *)0), OID_TRD(0x01|0x10), mib_dot1dtable },
3890 { MIB(dot1dBasePortMtuExceededDiscards){ { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 5 } }, ((void *)0), OID_TRD(0x01|0x10), mib_dot1dtable },
3891 { MIBEND{ { 0 } }, ((void *)0) }
3892};
3893
3894int
3895mib_dot1dtable(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
3896{
3897 struct ber_element *ber = *elm;
3898 u_int32_t idx = 0;
3899 struct kif *kif;
3900
3901 /* Get and verify the current row index */
3902 idx = o->bo_id[OIDIDX_dot1dEntry11];
3903 if ((kif = mib_ifget(idx)) == NULL((void *)0))
3904 return (1);
3905
3906 /* Tables need to prepend the OID on their own */
3907 o->bo_id[OIDIDX_dot1dEntry11] = kif->if_index;
3908 ber = ober_add_oid(ber, o);
3909
3910 switch (o->bo_id[OIDIDX_dot1d10]) {
3911 case 1:
3912 case 2:
3913 ber = ober_add_integer(ber, kif->if_index);
3914 break;
3915 case 3:
3916 ber = ober_add_oid(ber, &zerodotzero);
3917 break;
3918 case 4:
3919 case 5:
3920 ber = ober_add_integer(ber, 0);
3921 ober_set_header(ber, BER_CLASS_APPLICATION0x1, SNMP_T_COUNTER32);
3922 break;
3923 }
3924
3925 return (0);
3926}
3927
3928/*
3929 * Import all MIBs
3930 */
3931
3932void
3933mib_init(void)
3934{
3935 /*
3936 * MIB declarations (to register the OID names)
3937 */
3938 smi_mibtree(mib_tree);
3939
3940 /*
3941 * MIB definitions (the implementation)
3942 */
3943
3944 /* SNMPv2-MIB */
3945 smi_mibtree(base_mib);
3946
3947 /* SNMP-USER-BASED-SM-MIB */
3948 smi_mibtree(usm_mib);
3949
3950 /* HOST-RESOURCES-MIB */
3951 smi_mibtree(hr_mib);
3952
3953 /* IF-MIB */
3954 smi_mibtree(if_mib);
3955
3956 /* IP-MIB */
3957 smi_mibtree(ip_mib);
3958
3959 /* IP-FORWARD-MIB */
3960 smi_mibtree(ipf_mib);
3961
3962 /* BRIDGE-MIB */
3963 smi_mibtree(bridge_mib);
3964
3965 /* UCD-DISKIO-MIB */
3966 smi_mibtree(diskio_mib);
3967
3968 /* OPENBSD-MIB */
3969 smi_mibtree(openbsd_mib);
3970}