Bug Summary

File:src/libexec/snmpd/snmpd_metrics/mib.c
Warning:line 421, column 2
Value stored to 'maxsize' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple amd64-unknown-openbsd7.4 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name mib.c -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 -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -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/libexec/snmpd/snmpd_metrics/obj -resource-dir /usr/local/llvm16/lib/clang/16 -I /usr/src/libexec/snmpd/snmpd_metrics -internal-isystem /usr/local/llvm16/lib/clang/16/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/usr/src/libexec/snmpd/snmpd_metrics/obj -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fcf-protection=branch -fno-jump-tables -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/scan/2024-01-11-140451-98009-1 -x c /usr/src/libexec/snmpd/snmpd_metrics/mib.c
1/* $OpenBSD: mib.c,v 1.7 2023/11/21 08:49:08 martijn Exp $ */
2
3/*
4 * Copyright (c) 2022 Martijn van Duren <martijn@openbsd.org>
5 * Copyright (c) 2012 Joel Knight <joel@openbsd.org>
6 * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
7 *
8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 */
20
21#include <sys/types.h>
22#include <sys/signal.h>
23#include <sys/queue.h>
24#include <sys/proc.h>
25#include <sys/stat.h>
26#include <sys/socket.h>
27#include <sys/un.h>
28#include <sys/time.h>
29#include <sys/tree.h>
30#include <sys/utsname.h>
31#include <sys/sysctl.h>
32#include <sys/sensors.h>
33#include <sys/sched.h>
34#include <sys/mount.h>
35#include <sys/ioctl.h>
36#include <sys/disk.h>
37
38#include <netinet/in.h>
39#include <netinet/ip.h>
40#include <netinet/ip_carp.h>
41#include <netinet/ip_var.h>
42#include <arpa/inet.h>
43#include <net/if.h>
44#include <net/if_types.h>
45#include <net/pfvar.h>
46#include <netinet/ip_ipsp.h>
47#include <net/if_pfsync.h>
48
49#include <stdlib.h>
50#include <stdio.h>
51#include <errno(*__errno()).h>
52#include <event.h>
53#include <fcntl.h>
54#include <grp.h>
55#include <pwd.h>
56#include <string.h>
57#include <syslog.h>
58#include <time.h>
59#include <unistd.h>
60#include <libgen.h>
61#include <limits.h>
62#include <kvm.h>
63
64#include "log.h"
65#include "snmpd.h"
66#include "mib.h"
67
68struct event connev;
69const char *agentxsocket = NULL((void *)0);
70int agentxfd = -1;
71
72int pageshift;
73#define pagetok(size)((size) << pageshift) ((size) << pageshift)
74
75void pageshift_init(void);
76void snmp_connect(struct agentx *, void *, int);
77void snmp_tryconnect(int, short, void *);
78void snmp_read(int, short, void *);
79
80struct agentx_context *sac;
81struct snmpd *snmpd_env;
82
83/* HOST-RESOURCES-MIB */
84struct agentx_object *hrSystemProcesses, *hrSystemMaxProcesses;
85struct agentx_index *hrStorageIdx;
86struct agentx_object *hrStorageIndex, *hrStorageType, *hrStorageDescr;
87struct agentx_object *hrStorageAllocationUnits, *hrStorageSize, *hrStorageUsed;
88struct agentx_object *hrStorageAllocationFailures;
89struct agentx_index *hrDeviceIdx;
90struct agentx_object *hrDeviceIndex, *hrDeviceType, *hrDeviceDescr, *hrDeviceID;
91struct agentx_object *hrDeviceStatus, *hrDeviceErrors, *hrProcessorFrwID;
92struct agentx_object *hrProcessorLoad;
93struct agentx_index *hrSWRunIdx;
94struct agentx_object *hrSWRunIndex, *hrSWRunName, *hrSWRunID, *hrSWRunPath;
95struct agentx_object *hrSWRunParameters, *hrSWRunType, *hrSWRunStatus;
96struct agentx_object *hrSWRunPerfCPU, *hrSWRunPerfMem;
97
98void mib_hrsystemuptime(struct agentx_varbind *);
99void mib_hrsystemdate(struct agentx_varbind *);
100void mib_hrsystemprocs(struct agentx_varbind *);
101void mib_hrmemory(struct agentx_varbind *);
102void mib_hrstorage(struct agentx_varbind *);
103void mib_hrdevice(struct agentx_varbind *);
104void mib_hrprocessor(struct agentx_varbind *);
105void mib_hrswrun(struct agentx_varbind *);
106
107int kinfo_proc_comp(const void *, const void *);
108int kinfo_proc(u_int32_t, struct kinfo_proc **);
109void kinfo_timer_cb(int, short, void *);
110void kinfo_proc_free(void);
111int kinfo_args(struct kinfo_proc *, char ***);
112int kinfo_path(struct kinfo_proc *, char **);
113int kinfo_parameters(struct kinfo_proc *, char **);
114
115/* IF-MIB */
116struct agentx_index *ifIdx;
117struct agentx_object *ifName, *ifInMulticastPkts, *ifInBroadcastPkts;
118struct agentx_object *ifOutMulticastPkts, *ifOutBroadcastPkts;
119struct agentx_object *ifOutBroadcastPkts, *ifHCInOctets, *ifHCInUcastPkts;
120struct agentx_object *ifHCInMulticastPkts, *ifHCInBroadcastPkts, *ifHCOutOctets;
121struct agentx_object *ifHCOutUcastPkts, *ifHCOutMulticastPkts;
122struct agentx_object *ifHCOutBroadcastPkts, *ifLinkUpDownTrapEnable;
123struct agentx_object *ifHighSpeed, *ifPromiscuousMode, *ifConnectorPresent;
124struct agentx_object *ifAlias, *ifCounterDiscontinuityTime;
125struct agentx_index *ifRcvAddressAddress;
126struct agentx_object *ifRcvAddressStatus, *ifRcvAddressType;
127struct agentx_object *ifStackLastChange, *ifNumber, *ifIndex, *ifDescr, *ifType;
128struct agentx_object *ifMtu, *ifSpeed, *ifPhysAddress, *ifAdminStatus;
129struct agentx_object *ifOperStatus, *ifLastChange, *ifInOctets, *ifInUcastPkts;
130struct agentx_object *ifInNUcastPkts, *ifInDiscards, *ifInErrors;
131struct agentx_object *ifInUnknownProtos, *ifOutOctets, *ifOutUcastPkts;
132struct agentx_object *ifOutNUcastPkts, *ifOutDiscards, *ifOutErrors, *ifOutQLen;
133struct agentx_object *ifSpecific;
134
135/* OPENBSD-PF-MIB */
136struct agentx_object *pfRunning, *pfRuntime, *pfDebug, *pfHostid;
137struct agentx_object *pfCntMatch, *pfCntBadOffset, *pfCntFragment, *pfCntShort;
138struct agentx_object *pfCntNormalize, *pfCntMemory, *pfCntTimestamp;
139struct agentx_object *pfCntCongestion, *pfCntIpOption, *pfCntProtoCksum;
140struct agentx_object *pfCntStateMismatch, *pfCntStateInsert, *pfCntStateLimit;
141struct agentx_object *pfCntSrcLimit, *pfCntSynproxy, *pfCntTranslate;
142struct agentx_object *pfCntNoRoute;
143struct agentx_object *pfStateCount, *pfStateSearches, *pfStateInserts;
144struct agentx_object *pfStateRemovals;
145struct agentx_object *pfLogIfName, *pfLogIfIpBytesIn, *pfLogIfIpBytesOut;
146struct agentx_object *pfLogIfIpPktsInPass, *pfLogIfIpPktsInDrop;
147struct agentx_object *pfLogIfIpPktsOutPass, *pfLogIfIpPktsOutDrop;
148struct agentx_object *pfLogIfIp6BytesIn, *pfLogIfIp6BytesOut;
149struct agentx_object *pfLogIfIp6PktsInPass, *pfLogIfIp6PktsInDrop;
150struct agentx_object *pfLogIfIp6PktsOutPass, *pfLogIfIp6PktsOutDrop;
151struct agentx_object *pfSrcTrackCount, *pfSrcTrackSearches, *pfSrcTrackInserts;
152struct agentx_object *pfSrcTrackRemovals;
153struct agentx_object *pfLimitStates, *pfLimitSourceNodes, *pfLimitFragments;
154struct agentx_object *pfLimitMaxTables, *pfLimitMaxTableEntries;
155struct agentx_object *pfTimeoutTcpFirst, *pfTimeoutTcpOpening;
156struct agentx_object *pfTimeoutTcpEstablished, *pfTimeoutTcpClosing;
157struct agentx_object *pfTimeoutTcpFinWait, *pfTimeoutTcpClosed;
158struct agentx_object *pfTimeoutUdpFirst, *pfTimeoutUdpSingle;
159struct agentx_object *pfTimeoutUdpMultiple, *pfTimeoutIcmpFirst;
160struct agentx_object *pfTimeoutIcmpError, *pfTimeoutOtherFirst;
161struct agentx_object *pfTimeoutOtherSingle, *pfTimeoutOtherMultiple;
162struct agentx_object *pfTimeoutFragment, *pfTimeoutInterval, *pfTimeoutInterval;
163struct agentx_object *pfTimeoutAdaptiveStart, *pfTimeoutAdaptiveEnd;
164struct agentx_object *pfTimeoutSrcTrack;
165struct agentx_index *pfIfIdx;
166struct agentx_object *pfIfNumber, *pfIfIndex, *pfIfDescr, *pfIfType, *pfIfRefs;
167struct agentx_object *pfIfRules, *pfIfIn4PassPkts, *pfIfIn4PassBytes;
168struct agentx_object *pfIfIn4BlockPkts, *pfIfIn4BlockBytes, *pfIfOut4PassPkts;
169struct agentx_object *pfIfOut4PassBytes, *pfIfOut4BlockPkts;
170struct agentx_object *pfIfOut4BlockBytes, *pfIfIn6PassPkts, *pfIfIn6PassBytes;
171struct agentx_object *pfIfIn6BlockPkts, *pfIfIn6BlockBytes, *pfIfOut6PassPkts;
172struct agentx_object *pfIfOut6PassBytes, *pfIfOut6BlockPkts;
173struct agentx_object *pfIfOut6BlockBytes;
174struct agentx_index *pfTblIdx;
175struct agentx_object *pfTblNumber, *pfTblIndex, *pfTblName, *pfTblAddresses;
176struct agentx_object *pfTblAnchorRefs, *pfTblRuleRefs, *pfTblEvalsMatch;
177struct agentx_object *pfTblEvalsNoMatch, *pfTblInPassPkts, *pfTblInPassBytes;
178struct agentx_object *pfTblInBlockPkts, *pfTblInBlockBytes, *pfTblInXPassPkts;
179struct agentx_object *pfTblInXPassBytes, *pfTblOutPassPkts, *pfTblOutPassBytes;
180struct agentx_object *pfTblOutBlockPkts, *pfTblOutBlockBytes;
181struct agentx_object *pfTblOutXPassPkts, *pfTblOutXPassBytes;
182struct agentx_object *pfTblStatsCleared, *pfTblInMatchPkts, *pfTblInMatchBytes;
183struct agentx_object *pfTblOutMatchPkts, *pfTblOutMatchBytes;
184struct agentx_index *pfTblAddrTblIdx, *pfTblAddrNetIdx, *pfTblAddrMaskIdx;
185struct agentx_object *pfTblAddrTblIndex, *pfTblAddrNet, *pfTblAddrMask;
186struct agentx_object *pfTblAddrCleared, *pfTblAddrInBlockPkts;
187struct agentx_object *pfTblAddrInBlockBytes, *pfTblAddrInPassPkts;
188struct agentx_object *pfTblAddrInPassBytes, *pfTblAddrOutBlockPkts;
189struct agentx_object *pfTblAddrOutBlockBytes, *pfTblAddrOutPassPkts;
190struct agentx_object *pfTblAddrOutPassBytes, *pfTblAddrInMatchPkts;
191struct agentx_object *pfTblAddrInMatchBytes, *pfTblAddrOutMatchPkts;
192struct agentx_object *pfTblAddrOutMatchBytes;
193struct agentx_index *pfLabelIdx;
194struct agentx_object *pfLabelNumber, *pfLabelIndex, *pfLabelName, *pfLabelEvals;
195struct agentx_object *pfLabelPkts, *pfLabelBytes, *pfLabelInPkts;
196struct agentx_object *pfLabelInBytes, *pfLabelOutPkts, *pfLabelOutBytes;
197struct agentx_object *pfLabelTotalStates;
198struct agentx_object *pfsyncIpPktsRecv, *pfsyncIp6PktsRecv;
199struct agentx_object *pfsyncPktDiscardsForBadInterface;
200struct agentx_object *pfsyncPktDiscardsForBadTtl, *pfsyncPktShorterThanHeader;
201struct agentx_object *pfsyncPktDiscardsForBadVersion;
202struct agentx_object *pfsyncPktDiscardsForBadAction;
203struct agentx_object *pfsyncPktDiscardsForBadLength;
204struct agentx_object *pfsyncPktDiscardsForBadAuth;
205struct agentx_object *pfsyncPktDiscardsForStaleState;
206struct agentx_object *pfsyncPktDiscardsForBadValues;
207struct agentx_object *pfsyncPktDiscardsForBadState;
208struct agentx_object *pfsyncIpPktsSent, *pfsyncIp6PktsSent, *pfsyncNoMemory;
209struct agentx_object *pfsyncOutputErrors;
210
211/* OPENBSD-SENSORS-MIB */
212struct agentx_index *sensorIdx;
213struct agentx_object *sensorNumber, *sensorIndex, *sensorDescr, *sensorType;
214struct agentx_object *sensorDevice, *sensorValue, *sensorUnits, *sensorStatus;
215
216/* OPENBSD-CARP-MIB */
217struct agentx_object *carpAllow, *carpPreempt, *carpLog;
218struct agentx_index *carpIfIdx;
219struct agentx_object *carpIfNumber, *carpIfIndex, *carpIfDescr, *carpIfVhid;
220struct agentx_object *carpIfDev, *carpIfAdvbase, *carpIfAdvskew, *carpIfState;
221struct agentx_index *carpGroupIdx;
222struct agentx_object *carpGroupIndex, *carpGroupName, *carpGroupDemote;
223struct agentx_object *carpIpPktsRecv, *carpIp6PktsRecv;
224struct agentx_object *carpPktDiscardsForBadInterface;
225struct agentx_object *carpPktDiscardsForWrongTtl, *carpPktShorterThanHeader;
226struct agentx_object *carpPktDiscardsForBadChecksum;
227struct agentx_object *carpPktDiscardsForBadVersion, *carpPktDiscardsForTooShort;
228struct agentx_object *carpPktDiscardsForBadAuth, *carpPktDiscardsForBadVhid;
229struct agentx_object *carpPktDiscardsForBadAddressList, *carpIpPktsSent;
230struct agentx_object *carpIp6PktsSent, *carpNoMemory, *carpTransitionsToMaster;
231
232/* OPENBSD-MEM-MIB */
233struct agentx_object *memMIBVersion, *memIfName, *memIfLiveLocks;
234
235/* IP-MIB */
236struct agentx_object *ipForwarding, *ipDefaultTTL, *ipInReceives;
237struct agentx_object *ipInHdrErrors, *ipInAddrErrors, *ipForwDatagrams;
238struct agentx_object *ipInUnknownProtos, *ipInDelivers, *ipOutRequests;
239struct agentx_object *ipOutDiscards, *ipOutNoRoutes, *ipReasmTimeout;
240struct agentx_object *ipReasmReqds, *ipReasmOKs, *ipReasmFails, *ipFragOKs;
241struct agentx_object *ipFragFails, *ipFragCreates, *ipAdEntAddr;
242struct agentx_index *ipAdEntAddrIdx;
243struct agentx_object *ipAdEntAddr, *ipAdEntIfIndex, *ipAdEntNetMask;
244struct agentx_object *ipAdEntBcastAddr, *ipAdEntReasmMaxSize;
245struct agentx_index *ipNetToMediaIfIdx, *ipNetToMediaNetAddressIdx;
246struct agentx_object *ipNetToMediaIfIndex, *ipNetToMediaPhysAddress;
247struct agentx_object *ipNetToMediaNetAddress, *ipNetToMediaType;
248
249/* IP-FORWARD-MIB */
250struct agentx_object *inetCidrRouteNumber;
251struct agentx_index *inetCidrRouteDestTypeIdx, *inetCidrRouteDestIdx;
252struct agentx_index *inetCidrRoutePfxLenIdx, *inetCidrRoutePolicyIdx;
253struct agentx_index *inetCidrRouteNextHopTypeIdx, *inetCidrRouteNextHopIdx;
254struct agentx_object *inetCidrRouteIfIndex, *inetCidrRouteType;
255struct agentx_object *inetCidrRouteProto, *inetCidrRouteAge;
256struct agentx_object *inetCidrRouteNextHopAS, *inetCidrRouteMetric1;
257struct agentx_object *inetCidrRouteMetric2, *inetCidrRouteMetric3;
258struct agentx_object *inetCidrRouteMetric4, *inetCidrRouteMetric5;
259struct agentx_object *inetCidrRouteStatus;
260
261/* UCD-DISKIO-MIB */
262struct agentx_index *diskIOIdx;
263struct agentx_object *diskIOIndex, *diskIODevice, *diskIONRead, *diskIONWritten;
264struct agentx_object *diskIOReads, *diskIOWrites, *diskIONReadX;
265struct agentx_object *diskIONWrittenX;
266
267/* BRIDGE-MIB */
268struct agentx_object *dot1dBaseNumPorts, *dot1dBaseType;
269struct agentx_index *dot1dBasePortIdx;
270struct agentx_object *dot1dBasePort, *dot1dBasePortIfIndex;
271struct agentx_object *dot1dBasePortCircuit, *dot1dBasePortDelayExceededDiscards;
272struct agentx_object *dot1dBasePortMtuExceededDiscards;
273
274/* HOST-RESOURCES-MIB */
275void
276mib_hrsystemuptime(struct agentx_varbind *vb)
277{
278 struct timespec uptime;
279 long long ticks;
280
281 if (clock_gettime(CLOCK_BOOTTIME6, &uptime) == -1) {
282 log_warn("clock_gettime");
283 agentx_varbind_error(vb);
284 return;
285 }
286 ticks = uptime.tv_sec * 100 + uptime.tv_nsec / 10000000;
287 agentx_varbind_timeticks(vb, ticks);
288}
289
290void
291mib_hrsystemdate(struct agentx_varbind *vb)
292{
293 struct tm *ptm;
294 u_char s[11];
295 time_t now;
296 int tzoffset;
297 unsigned short year;
298
299 (void)time(&now);
300 ptm = localtime(&now);
301
302 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))
;
303 memcpy(s, &year, 2);
304 s[2] = ptm->tm_mon + 1;
305 s[3] = ptm->tm_mday;
306 s[4] = ptm->tm_hour;
307 s[5] = ptm->tm_min;
308 s[6] = ptm->tm_sec;
309 s[7] = 0;
310
311 tzoffset = ptm->tm_gmtoff;
312 if (tzoffset < 0)
313 s[8] = '-';
314 else
315 s[8] = '+';
316
317 s[9] = abs(tzoffset) / 3600;
318 s[10] = (abs(tzoffset) - (s[9] * 3600)) / 60;
319
320 agentx_varbind_nstring(vb, s, sizeof(s));
321}
322
323void
324mib_hrsystemprocs(struct agentx_varbind *vb)
325{
326 struct agentx_object *obj;
327 char errbuf[_POSIX2_LINE_MAX2048];
328 int val;
329 int mib[] = { CTL_KERN1, KERN_MAXPROC6 };
330 kvm_t *kd;
331 size_t len;
332
333 obj = agentx_varbind_get_object(vb);
334 if (obj == hrSystemProcesses) {
335 if ((kd = kvm_openfiles(NULL((void *)0), NULL((void *)0), NULL((void *)0),
336 KVM_NO_FILES0x80000000, errbuf)) == NULL((void *)0)) {
337 log_warn("kvm_openfiles");
338 agentx_varbind_error(vb);
339 return;
340 }
341
342 if (kvm_getprocs(kd, KERN_PROC_ALL0, 0,
343 sizeof(struct kinfo_proc), &val) == NULL((void *)0)) {
344 log_warn("kvm_getprocs");
345 kvm_close(kd);
346 agentx_varbind_error(vb);
347 return;
348 }
349
350 agentx_varbind_gauge32(vb, val);
351
352 kvm_close(kd);
353 } else if (obj == hrSystemMaxProcesses) {
354 len = sizeof(val);
355 if (sysctl(mib, 2, &val, &len, NULL((void *)0), 0) == -1) {
356 log_warn("sysctl");
357 agentx_varbind_error(vb);
358 return;
359 }
360
361 agentx_varbind_integer(vb, val);
362 } else
363 fatal("%s: Unexpected object", __func__);
364}
365
366void
367mib_hrmemory(struct agentx_varbind *vb)
368{
369 int mib[] = { CTL_HW6, HW_PHYSMEM6419 };
370 u_int64_t physmem;
371 size_t len = sizeof(physmem);
372
373 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &physmem, &len, NULL((void *)0), 0) == -1) {
374 log_warn("sysctl");
375 agentx_varbind_error(vb);
376 return;
377 }
378
379 agentx_varbind_integer(vb, physmem / 1024);
380}
381
382void
383mib_hrstorage(struct agentx_varbind *vb)
384{
385 struct agentx_object *obj;
386 enum agentx_request_type req;
387 int32_t idx;
388 struct statfs *mntbuf, *mnt;
389 int mntsize, maxsize;
390 uint64_t units, size, used, fail = 0;
391 const char *descr = NULL((void *)0);
392 int mib[] = { CTL_HW6, 0 };
393 u_int64_t physmem, realmem;
394 struct uvmexp uvm;
395 size_t len;
396 uint32_t sop[] = { HRSTORAGEOTHER1, 3, 6, 1, 2, 1, 25, 2, 1, 1 };
397
398 /* Physical memory, real memory, swap */
399 mib[1] = HW_PHYSMEM6419;
400 len = sizeof(physmem);
401 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &physmem, &len, NULL((void *)0), 0) == -1) {
402 log_warn("sysctl");
403 agentx_varbind_error(vb);
404 return;
405 }
406 mib[1] = HW_USERMEM6420;
407 len = sizeof(realmem);
408 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &realmem, &len, NULL((void *)0), 0) == -1) {
409 log_warn("sysctl");
410 agentx_varbind_error(vb);
411 return;
412 }
413 mib[0] = CTL_VM2;
414 mib[1] = VM_UVMEXP4;
415 len = sizeof(uvm);
416 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &uvm, &len, NULL((void *)0), 0) == -1) {
417 log_warn("sysctl");
418 agentx_varbind_error(vb);
419 return;
420 }
421 maxsize = 10;
Value stored to 'maxsize' is never read
422
423 /* Disks */
424 if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT2)) == 0) {
425 log_warn("getmntinfo");
426 agentx_varbind_error(vb);
427 return;
428 }
429 maxsize = 30 + mntsize;
430
431 /*
432 * Get and verify the current row index.
433 *
434 * We use a special mapping here that is inspired by other SNMP
435 * agents: index 1 + 2 for RAM, index 10 for swap, index 31 and
436 * higher for disk storage.
437 */
438 obj = agentx_varbind_get_object(vb);
439 req = agentx_varbind_request(vb);
440 idx = agentx_varbind_get_index_integer(vb, hrStorageIdx);
441 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
442 if (idx == INT32_MAX0x7fffffff) {
443 agentx_varbind_notfound(vb);
444 return;
445 }
446 idx++;
447 }
448 if (idx > maxsize) {
449 agentx_varbind_notfound(vb);
450 return;
451 }
452 if (req == AGENTX_REQUEST_TYPE_GET) {
453 if (idx < 1 || (idx > 2 && idx < 10) ||
454 (idx > 10 && idx < 31)) {
455 agentx_varbind_notfound(vb);
456 return;
457 }
458 } else {
459 if (idx < 1)
460 idx = 1;
461 else if (idx > 2 && idx < 10)
462 idx = 10;
463 else if (idx > 10 && idx < 31)
464 idx = 31;
465 }
466
467 switch (idx) {
468 case 1:
469 descr = "Physical memory";
470 units = uvm.pagesize;
471 size = physmem / uvm.pagesize;
472 used = size - uvm.free;
473 memcpy(sop, (uint32_t[]){ HRSTORAGERAM1, 3, 6, 1, 2, 1, 25, 2, 1, 2 }, sizeof(sop));
474 break;
475 case 2:
476 descr = "Real memory";
477 units = uvm.pagesize;
478 size = realmem / uvm.pagesize;
479 used = size - uvm.free;
480 memcpy(sop, (uint32_t[]){ HRSTORAGERAM1, 3, 6, 1, 2, 1, 25, 2, 1, 2 }, sizeof(sop));
481 break;
482 case 10:
483 descr = "Swap space";
484 units = uvm.pagesize;
485 size = uvm.swpages;
486 used = uvm.swpginuse;
487 memcpy(sop, (uint32_t[]){ HRSTORAGEVIRTUALMEMORY1, 3, 6, 1, 2, 1, 25, 2, 1, 3 },
488 sizeof(sop));
489 break;
490 default:
491 mnt = &mntbuf[idx - 31];
492 descr = mnt->f_mntonname;
493 units = mnt->f_bsize;
494 size = mnt->f_blocks;
495 used = mnt->f_blocks - mnt->f_bfree;
496 memcpy(sop, (uint32_t[]){ HRSTORAGEFIXEDDISK1, 3, 6, 1, 2, 1, 25, 2, 1, 4 }, sizeof(sop));
497 break;
498 }
499
500 while (size > INT32_MAX0x7fffffff) {
501 units *= 2;
502 size /= 2;
503 used /= 2;
504 }
505
506 agentx_varbind_set_index_integer(vb, hrStorageIdx, idx);
507
508 if (obj == hrStorageIndex)
509 agentx_varbind_integer(vb, idx);
510 else if (obj == hrStorageType)
511 agentx_varbind_oid(vb, sop, nitems(sop)(sizeof((sop)) / sizeof((sop)[0])));
512 else if (obj == hrStorageDescr)
513 agentx_varbind_string(vb, descr);
514 else if (obj == hrStorageAllocationUnits)
515 agentx_varbind_integer(vb, units);
516 else if (obj == hrStorageSize)
517 agentx_varbind_integer(vb, size);
518 else if (obj == hrStorageUsed)
519 agentx_varbind_integer(vb, used);
520 else if (obj == hrStorageAllocationFailures)
521 agentx_varbind_counter32(vb, fail);
522 else
523 fatal("%s: Unexpected object", __func__);
524}
525
526void
527mib_hrdevice(struct agentx_varbind *vb)
528{
529 struct agentx_object *obj;
530 enum agentx_request_type req;
531 int32_t idx;
532 uint32_t fail = 0;
533 int status;
534 int mib[] = { CTL_HW6, HW_MODEL2 };
535 size_t len;
536 char descr[BUFSIZ1024];
537 uint32_t sop[] = { HRDEVICEPROCESSOR1, 3, 6, 1, 2, 1, 25, 3, 1, 3 };
538
539 /* Get and verify the current row index */
540 obj = agentx_varbind_get_object(vb);
541 idx = agentx_varbind_get_index_integer(vb, hrDeviceIdx);
542 req = agentx_varbind_request(vb);
543 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
544 if (idx == INT32_MAX0x7fffffff) {
545 agentx_varbind_notfound(vb);
546 return;
547 }
548 idx++;
549 if (idx < 1)
550 idx = 1;
551 } else if (req == AGENTX_REQUEST_TYPE_GETNEXTINCLUSIVE) {
552 if (idx < 1)
553 idx = 1;
554 }
555 if (idx < 1 || idx > snmpd_env->sc_ncpu) {
556 agentx_varbind_notfound(vb);
557 return;
558 }
559
560 agentx_varbind_set_index_integer(vb, hrDeviceIdx, idx);
561
562 len = sizeof(descr);
563 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &descr, &len, NULL((void *)0), 0) == -1) {
564 log_warn("sysctl");
565 agentx_varbind_error(vb);
566 return;
567 }
568 /* unknown(1), running(2), warning(3), testing(4), down(5) */
569 status = 2;
570
571 if (obj == hrDeviceIndex)
572 agentx_varbind_integer(vb, idx);
573 else if (obj == hrDeviceType)
574 agentx_varbind_oid(vb, sop, nitems(sop)(sizeof((sop)) / sizeof((sop)[0])));
575 else if (obj == hrDeviceDescr)
576 agentx_varbind_string(vb, descr);
577 else if (obj == hrDeviceID)
578 agentx_varbind_oid(vb, AGENTX_OID(0, 0)(uint32_t []) { 0, 0 }, (sizeof((uint32_t []) { 0, 0 }) / sizeof
(uint32_t))
);
579 else if (obj == hrDeviceStatus)
580 agentx_varbind_integer(vb, status);
581 else if (obj == hrDeviceErrors)
582 agentx_varbind_counter32(vb, fail);
583 else
584 fatal("%s: Unexpected object", __func__);
585}
586
587void
588mib_hrprocessor(struct agentx_varbind *vb)
589{
590 struct agentx_object *obj;
591 enum agentx_request_type req;
592 int32_t idx;
593 int64_t *cptime2, val;
594
595 obj = agentx_varbind_get_object(vb);
596 idx = agentx_varbind_get_index_integer(vb, hrDeviceIdx);
597 req = agentx_varbind_request(vb);
598 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
599 if (idx == INT32_MAX0x7fffffff) {
600 agentx_varbind_notfound(vb);
601 return;
602 }
603 idx++;
604 if (idx < 1)
605 idx = 1;
606 }
607 else if (req == AGENTX_REQUEST_TYPE_GETNEXTINCLUSIVE) {
608 if (idx < 1)
609 idx = 1;
610 }
611 if (idx < 1 || idx > snmpd_env->sc_ncpu) {
612 agentx_varbind_notfound(vb);
613 return;
614 }
615
616 agentx_varbind_set_index_integer(vb, hrDeviceIdx, idx);
617
618 if (obj == hrProcessorFrwID)
619 agentx_varbind_oid(vb, AGENTX_OID(0, 0)(uint32_t []) { 0, 0 }, (sizeof((uint32_t []) { 0, 0 }) / sizeof
(uint32_t))
);
620 else if (obj == hrProcessorLoad) {
621 /*
622 * The percentage of time that the system was not
623 * idle during the last minute.
624 */
625 if (snmpd_env->sc_cpustates == NULL((void *)0)) {
626 log_warnx("cpustates not initialized");
627 agentx_varbind_error(vb);
628 return;
629 }
630 cptime2 = snmpd_env->sc_cpustates + (CPUSTATES6 * (idx - 1));
631 val = 100 -
632 (cptime2[CP_IDLE5] > 1000 ? 1000 : (cptime2[CP_IDLE5] / 10));
633 agentx_varbind_integer(vb, val);
634 } else
635 fatal("%s: Unexpected object", __func__);
636}
637
638void
639mib_hrswrun(struct agentx_varbind *vb)
640{
641 struct agentx_object *obj;
642 enum agentx_request_type req;
643 int32_t idx;
644 int32_t time;
645 struct kinfo_proc *kinfo;
646 char *s;
647
648 obj = agentx_varbind_get_object(vb);
649 idx = agentx_varbind_get_index_integer(vb, hrSWRunIdx);
650 req = agentx_varbind_request(vb);
651
652 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
653 if (idx == INT32_MAX0x7fffffff) {
654 agentx_varbind_notfound(vb);
655 return;
656 }
657 idx++;
658 }
659 /* Get and verify the current row index */
660 if (kinfo_proc(idx, &kinfo) == -1) {
661 log_warn("kinfo_proc");
662 agentx_varbind_error(vb);
663 return;
664 }
665
666 if (kinfo == NULL((void *)0)) {
667 agentx_varbind_notfound(vb);
668 return;
669 }
670 if (req == AGENTX_REQUEST_TYPE_GET) {
671 if (kinfo->p_pid != idx) {
672 agentx_varbind_notfound(vb);
673 return;
674 }
675 }
676 agentx_varbind_set_index_integer(vb, hrSWRunIdx, kinfo->p_pid);
677
678 if (obj == hrSWRunIndex)
679 agentx_varbind_integer(vb, kinfo->p_pid);
680 else if (obj == hrSWRunName)
681 agentx_varbind_string(vb, kinfo->p_comm);
682 else if (obj == hrSWRunPath) {
683 if (kinfo_path(kinfo, &s) == -1) {
684 log_warn("kinfo_path");
685 agentx_varbind_error(vb);
686 return;
687 }
688
689 agentx_varbind_string(vb, s);
690 } else if (obj == hrSWRunID)
691 agentx_varbind_oid(vb, AGENTX_OID(0, 0)(uint32_t []) { 0, 0 }, (sizeof((uint32_t []) { 0, 0 }) / sizeof
(uint32_t))
);
692 else if (obj == hrSWRunParameters) {
693 if (kinfo_parameters(kinfo, &s) == -1) {
694 log_warn("kinfo_parameters");
695 agentx_varbind_error(vb);
696 return;
697 }
698
699 agentx_varbind_string(vb, s);
700 } else if (obj == hrSWRunType) {
701 if (kinfo->p_flag & P_SYSTEM0x00000200) {
702 /* operatingSystem(2) */
703 agentx_varbind_integer(vb, 2);
704 } else {
705 /* application(4) */
706 agentx_varbind_integer(vb, 4);
707 }
708 } else if (obj == hrSWRunStatus) {
709 switch (kinfo->p_stat) {
710 case SONPROC7:
711 /* running(1) */
712 agentx_varbind_integer(vb, 1);
713 break;
714 case SIDL1:
715 case SRUN2:
716 case SSLEEP3:
717 /* runnable(2) */
718 agentx_varbind_integer(vb, 2);
719 break;
720 case SSTOP4:
721 /* notRunnable(3) */
722 agentx_varbind_integer(vb, 3);
723 break;
724 case SDEAD6:
725 default:
726 /* invalid(4) */
727 agentx_varbind_integer(vb, 4);
728 break;
729 }
730 } else if (obj == hrSWRunPerfCPU) {
731 time = kinfo->p_rtime_sec * 100;
732 time += (kinfo->p_rtime_usec + 5000) / 10000;
733 agentx_varbind_integer(vb, time);
734 } else if (obj == hrSWRunPerfMem) {
735 agentx_varbind_integer(vb, pagetok(kinfo->p_vm_tsize +((kinfo->p_vm_tsize + kinfo->p_vm_dsize + kinfo->p_vm_ssize
) << pageshift)
736 kinfo->p_vm_dsize + kinfo->p_vm_ssize)((kinfo->p_vm_tsize + kinfo->p_vm_dsize + kinfo->p_vm_ssize
) << pageshift)
);
737 } else
738 fatal("%s: Unexpected object", __func__);
739}
740
741int
742kinfo_proc_comp(const void *a, const void *b)
743{
744 struct kinfo_proc * const *k1 = a;
745 struct kinfo_proc * const *k2 = b;
746
747 return (((*k1)->p_pid > (*k2)->p_pid) ? 1 : -1);
748}
749
750static struct event kinfo_timer;
751static struct kinfo_proc *kp = NULL((void *)0);
752static struct kinfo_proc **klist = NULL((void *)0);
753static size_t nkp = 0, nklist = 0;
754
755int
756kinfo_proc(u_int32_t idx, struct kinfo_proc **kinfo)
757{
758 int mib[] = { CTL_KERN1, KERN_PROC66,
759 KERN_PROC_ALL0, 0, sizeof(*kp), 0 };
760 size_t size, count, i;
761 struct timeval timer;
762
763 if (kp != NULL((void *)0) && klist != NULL((void *)0))
764 goto cached;
765
766 kinfo_proc_free();
767 for (;;) {
768 size = nkp * sizeof(*kp);
769 mib[5] = nkp;
770 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), kp, &size, NULL((void *)0), 0) == -1) {
771 if (errno(*__errno()) == ENOMEM12) {
772 kinfo_proc_free();
773 continue;
774 }
775
776 return (-1);
777 }
778
779 count = size / sizeof(*kp);
780 if (count <= nkp)
781 break;
782
783 kp = malloc(size);
784 if (kp == NULL((void *)0)) {
785 kinfo_proc_free();
786 return (-1);
787 }
788 nkp = count;
789 }
790
791 klist = calloc(count, sizeof(*klist));
792 if (klist == NULL((void *)0)) {
793 kinfo_proc_free();
794 return (-1);
795 }
796 nklist = count;
797
798 for (i = 0; i < nklist; i++)
799 klist[i] = &kp[i];
800 qsort(klist, nklist, sizeof(*klist), kinfo_proc_comp);
801
802 evtimer_set(&kinfo_timer, kinfo_timer_cb, NULL)event_set(&kinfo_timer, -1, 0, kinfo_timer_cb, ((void *)0
))
;
803 timer.tv_sec = 5;
804 timer.tv_usec = 0;
805 evtimer_add(&kinfo_timer, &timer)event_add(&kinfo_timer, &timer);
806
807cached:
808 *kinfo = NULL((void *)0);
809 for (i = 0; i < nklist; i++) {
810 if (klist[i]->p_pid >= (int32_t)idx) {
811 *kinfo = klist[i];
812 break;
813 }
814 }
815
816 return (0);
817}
818
819void
820kinfo_timer_cb(int fd, short event, void *arg)
821{
822 kinfo_proc_free();
823}
824
825void
826kinfo_proc_free(void)
827{
828 free(kp);
829 kp = NULL((void *)0);
830 nkp = 0;
831 free(klist);
832 klist = NULL((void *)0);
833 nklist = 0;
834}
835
836int
837kinfo_args(struct kinfo_proc *kinfo, char ***s)
838{
839 static char *buf = NULL((void *)0);
840 static size_t buflen = 128;
841
842 int mib[] = { CTL_KERN1, KERN_PROC_ARGS55,
843 kinfo->p_pid, KERN_PROC_ARGV1 };
844 char *nbuf;
845
846 *s = NULL((void *)0);
847 if (buf == NULL((void *)0)) {
848 buf = malloc(buflen);
849 if (buf == NULL((void *)0))
850 return (-1);
851 }
852
853 while (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), buf, &buflen, NULL((void *)0), 0) == -1) {
854 if (errno(*__errno()) != ENOMEM12) {
855 /* some errors are expected, dont get too upset */
856 return (0);
857 }
858
859 nbuf = realloc(buf, buflen + 128);
860 if (nbuf == NULL((void *)0))
861 return (-1);
862
863 buf = nbuf;
864 buflen += 128;
865 }
866
867 *s = (char **)buf;
868 return (0);
869}
870
871int
872kinfo_path(struct kinfo_proc *kinfo, char **s)
873{
874 static char str[129];
875 char **argv;
876
877 if (kinfo_args(kinfo, &argv) == -1)
878 return (-1);
879
880 str[0] = '\0';
881 *s = str;
882 if (argv != NULL((void *)0) && argv[0] != NULL((void *)0))
883 strlcpy(str, argv[0], sizeof(str));
884 return (0);
885}
886
887int
888kinfo_parameters(struct kinfo_proc *kinfo, char **s)
889{
890 static char str[129];
891 char **argv;
892
893 if (kinfo_args(kinfo, &argv) == -1)
894 return (-1);
895
896 str[0] = '\0';
897 *s = str;
898 if (argv == NULL((void *)0) || argv[0] == NULL((void *)0))
899 return (0);
900 argv++;
901
902 while (*argv != NULL((void *)0)) {
903 strlcat(str, *argv, sizeof(str));
904 argv++;
905 if (*argv != NULL((void *)0))
906 strlcat(str, " ", sizeof(str));
907 }
908
909 return (0);
910}
911
912/*
913 * Defined in IF-MIB.txt (RFCs 1229, 1573, 2233, 2863)
914 */
915
916void mib_ifnumber(struct agentx_varbind *);
917struct kif
918 *mib_ifget(u_int);
919void mib_iftable(struct agentx_varbind *);
920void mib_ifxtable(struct agentx_varbind *);
921void mib_ifstacklast(struct agentx_varbind *);
922void mib_ifrcvtable(struct agentx_varbind *);
923
924static uint8_t ether_zeroaddr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
925
926void
927mib_ifnumber(struct agentx_varbind *vb)
928{
929 agentx_varbind_integer(vb, kr_ifnumber());
930}
931
932struct kif *
933mib_ifget(u_int idx)
934{
935 struct kif *kif;
936
937 if ((kif = kr_getif(idx)) == NULL((void *)0)) {
938 /*
939 * It may happen that an interface with a specific index
940 * does not exist or has been removed. Jump to the next
941 * available interface index.
942 */
943 for (kif = kr_getif(0); kif != NULL((void *)0);
944 kif = kr_getnextif(kif->if_index))
945 if (kif->if_index > idx)
946 break;
947 if (kif == NULL((void *)0))
948 return (NULL((void *)0));
949 }
950 idx = kif->if_index;
951
952 /* Update interface information */
953 kr_updateif(idx);
954 if ((kif = kr_getif(idx)) == NULL((void *)0)) {
955 log_debug("mib_ifxtable: interface %d disappeared?", idx);
956 return (NULL((void *)0));
957 }
958
959 return (kif);
960}
961
962void
963mib_iftable(struct agentx_varbind *vb)
964{
965 struct agentx_object *obj;
966 enum agentx_request_type req;
967 int32_t idx = 0;
968 struct kif *kif;
969 long long i;
970
971 obj = agentx_varbind_get_object(vb);
972 idx = agentx_varbind_get_index_integer(vb, ifIdx);
973 req = agentx_varbind_request(vb);
974 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
975 if (idx == INT32_MAX0x7fffffff) {
976 agentx_varbind_notfound(vb);
977 return;
978 }
979 idx++;
980 }
981 if ((kif = mib_ifget(idx)) == NULL((void *)0)) {
982 agentx_varbind_notfound(vb);
983 return;
984 }
985 if (req == AGENTX_REQUEST_TYPE_GET) {
986 if (idx != kif->if_index) {
987 agentx_varbind_notfound(vb);
988 return;
989 }
990 }
991 agentx_varbind_set_index_integer(vb, ifIdx, kif->if_index);
992
993 if (obj == ifIndex)
994 agentx_varbind_integer(vb, kif->if_index);
995 else if (obj == ifDescr) {
996 /*
997 * The ifDescr should contain a vendor, product, etc.
998 * but we just use the interface name (like ifName).
999 * The interface name includes the driver name on OpenBSD.
1000 */
1001 agentx_varbind_string(vb, kif->if_name);
1002 } else if (obj == ifType) {
1003 if (kif->if_typeif_data.ifi_type >= 0xf0) {
1004 /*
1005 * It does not make sense to announce the private
1006 * interface types for CARP, ENC, PFSYNC, etc.
1007 */
1008 agentx_varbind_integer(vb, IFT_OTHER0x01);
1009 } else
1010 agentx_varbind_integer(vb, kif->if_typeif_data.ifi_type);
1011 } else if (obj == ifMtu)
1012 agentx_varbind_integer(vb, kif->if_mtuif_data.ifi_mtu);
1013 else if (obj == ifSpeed) {
1014 if (kif->if_baudrateif_data.ifi_baudrate > UINT32_MAX0xffffffffU) {
1015 /* speed should be obtained from ifHighSpeed instead */
1016 agentx_varbind_gauge32(vb, UINT32_MAX0xffffffffU);
1017 } else
1018 agentx_varbind_gauge32(vb, kif->if_baudrateif_data.ifi_baudrate);
1019 } else if (obj == ifPhysAddress) {
1020 if (bcmp(kif->if_lladdr, ether_zeroaddr,
1021 sizeof(kif->if_lladdr)) == 0) {
1022 agentx_varbind_string(vb, "");
1023 } else {
1024 agentx_varbind_nstring(vb, kif->if_lladdr,
1025 sizeof(kif->if_lladdr));
1026 }
1027 } else if (obj == ifAdminStatus) {
1028 /* ifAdminStatus up(1), down(2), testing(3) */
1029 i = (kif->if_flags & IFF_UP0x1) ? 1 : 2;
1030 agentx_varbind_integer(vb, i);
1031 } else if (obj == ifOperStatus) {
1032 if ((kif->if_flags & IFF_UP0x1) == 0)
1033 i = 2; /* down(2) */
1034 else if (kif->if_link_stateif_data.ifi_link_state == LINK_STATE_UNKNOWN0)
1035 i = 4; /* unknown(4) */
1036 else if (LINK_STATE_IS_UP(kif->if_link_state)((kif->if_data.ifi_link_state) >= 4 || (kif->if_data
.ifi_link_state) == 0)
)
1037 i = 1; /* up(1) */
1038 else
1039 i = 7; /* lowerLayerDown(7) or dormant(5)? */
1040 agentx_varbind_integer(vb, i);
1041 } else if (obj == ifLastChange)
1042 agentx_varbind_timeticks(vb, kif->if_ticks);
1043 else if (obj == ifInOctets)
1044 agentx_varbind_counter32(vb, (uint32_t)kif->if_ibytesif_data.ifi_ibytes);
1045 else if (obj == ifInUcastPkts)
1046 agentx_varbind_counter32(vb, (uint32_t)kif->if_ipacketsif_data.ifi_ipackets);
1047 else if (obj == ifInNUcastPkts)
1048 agentx_varbind_counter32(vb, (uint32_t)kif->if_imcastsif_data.ifi_imcasts);
1049 else if (obj == ifInDiscards)
1050 agentx_varbind_counter32(vb, (uint32_t)kif->if_iqdropsif_data.ifi_iqdrops);
1051 else if (obj == ifInErrors)
1052 agentx_varbind_counter32(vb, (uint32_t)kif->if_ierrorsif_data.ifi_ierrors);
1053 else if (obj == ifInUnknownProtos)
1054 agentx_varbind_counter32(vb, (uint32_t)kif->if_noprotoif_data.ifi_noproto);
1055 else if (obj == ifOutOctets)
1056 agentx_varbind_counter32(vb, (uint32_t)kif->if_obytesif_data.ifi_obytes);
1057 else if (obj == ifOutUcastPkts)
1058 agentx_varbind_counter32(vb, (uint32_t)kif->if_opacketsif_data.ifi_opackets);
1059 else if (obj == ifOutNUcastPkts)
1060 agentx_varbind_counter32(vb, (uint32_t)kif->if_omcastsif_data.ifi_omcasts);
1061 else if (obj == ifOutDiscards)
1062 agentx_varbind_counter32(vb, (uint32_t)kif->if_oqdropsif_data.ifi_oqdrops);
1063 else if (obj == ifOutErrors)
1064 agentx_varbind_counter32(vb, (uint32_t)kif->if_oerrorsif_data.ifi_oerrors);
1065 else if (obj == ifOutQLen)
1066 agentx_varbind_gauge32(vb, 0);
1067 else if (obj == ifSpecific)
1068 agentx_varbind_oid(vb, AGENTX_OID(0, 0)(uint32_t []) { 0, 0 }, (sizeof((uint32_t []) { 0, 0 }) / sizeof
(uint32_t))
);
1069 else
1070 fatal("%s: Unexpected object", __func__);
1071}
1072
1073void
1074mib_ifxtable(struct agentx_varbind *vb)
1075{
1076 struct agentx_object *obj;
1077 enum agentx_request_type req;
1078 int32_t idx = 0;
1079 struct kif *kif;
1080 int i = 0;
1081
1082 obj = agentx_varbind_get_object(vb);
1083 idx = agentx_varbind_get_index_integer(vb, ifIdx);
1084 req = agentx_varbind_request(vb);
1085 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
1086 if (idx == INT32_MAX0x7fffffff) {
1087 agentx_varbind_notfound(vb);
1088 return;
1089 }
1090 idx++;
1091 }
1092 if ((kif = mib_ifget(idx)) == NULL((void *)0)) {
1093 agentx_varbind_notfound(vb);
1094 return;
1095 }
1096 if (req == AGENTX_REQUEST_TYPE_GET) {
1097 if (idx != kif->if_index) {
1098 agentx_varbind_notfound(vb);
1099 return;
1100 }
1101 }
1102 agentx_varbind_set_index_integer(vb, ifIdx, kif->if_index);
1103
1104 if (obj == ifName)
1105 agentx_varbind_string(vb, kif->if_name);
1106 else if (obj == ifInMulticastPkts)
1107 agentx_varbind_counter32(vb, (uint32_t)kif->if_imcastsif_data.ifi_imcasts);
1108 else if (obj == ifInBroadcastPkts)
1109 agentx_varbind_counter32(vb, 0);
1110 else if (obj == ifOutMulticastPkts)
1111 agentx_varbind_counter32(vb, (uint32_t)kif->if_omcastsif_data.ifi_omcasts);
1112 else if (obj == ifOutBroadcastPkts)
1113 agentx_varbind_counter32(vb, 0);
1114 else if (obj == ifHCInOctets)
1115 agentx_varbind_counter64(vb, (uint64_t)kif->if_ibytesif_data.ifi_ibytes);
1116 else if (obj == ifHCInUcastPkts)
1117 agentx_varbind_counter64(vb, (uint64_t)kif->if_ipacketsif_data.ifi_ipackets);
1118 else if (obj == ifHCInMulticastPkts)
1119 agentx_varbind_counter64(vb, (uint64_t)kif->if_imcastsif_data.ifi_imcasts);
1120 else if (obj == ifHCInBroadcastPkts)
1121 agentx_varbind_counter64(vb, 0);
1122 else if (obj == ifHCOutOctets)
1123 agentx_varbind_counter64(vb, (uint64_t)kif->if_obytesif_data.ifi_obytes);
1124 else if (obj == ifHCOutUcastPkts)
1125 agentx_varbind_counter64(vb, (uint64_t)kif->if_opacketsif_data.ifi_opackets);
1126 else if (obj == ifHCOutMulticastPkts)
1127 agentx_varbind_counter64(vb, (uint64_t)kif->if_omcastsif_data.ifi_omcasts);
1128 else if (obj == ifHCOutBroadcastPkts)
1129 agentx_varbind_counter64(vb, 0);
1130 else if (obj == ifLinkUpDownTrapEnable)
1131 agentx_varbind_integer(vb, 0); /* enabled(1), disabled(2) */
1132 else if (obj == ifHighSpeed) {
1133 i = kif->if_baudrateif_data.ifi_baudrate >= 1000000 ?
1134 kif->if_baudrateif_data.ifi_baudrate / 1000000 : 0;
1135 agentx_varbind_gauge32(vb, i);
1136 } else if (obj == ifPromiscuousMode) {
1137 /* ifPromiscuousMode: true(1), false(2) */
1138 i = kif->if_flags & IFF_PROMISC0x100 ? 1 : 2;
1139 agentx_varbind_integer(vb, i);
1140 } else if (obj == ifConnectorPresent) {
1141 /* ifConnectorPresent: false(2), true(1) */
1142 i = kif->if_typeif_data.ifi_type == IFT_ETHER0x06 ? 1 : 2;
1143 agentx_varbind_integer(vb, i);
1144 } else if (obj == ifAlias)
1145 agentx_varbind_string(vb, kif->if_descr);
1146 else if (obj == ifCounterDiscontinuityTime)
1147 agentx_varbind_timeticks(vb, 0);
1148 else
1149 fatal("%s: Unexpected object", __func__);
1150}
1151
1152void
1153mib_ifstacklast(struct agentx_varbind *vb)
1154{
1155 agentx_varbind_timeticks(vb, kr_iflastchange());
1156}
1157
1158void
1159mib_ifrcvtable(struct agentx_varbind *vb)
1160{
1161 struct agentx_object *obj;
1162 enum agentx_request_type req;
1163 int32_t idx = 0;
1164 const uint8_t *lladdr;
1165 struct kif *kif;
1166 int i = 0, llcmp, impl;
1167 size_t slen;
1168
1169 obj = agentx_varbind_get_object(vb);
1170 idx = agentx_varbind_get_index_integer(vb, ifIdx);
1171 lladdr = (const uint8_t *)agentx_varbind_get_index_string(vb,
1172 ifRcvAddressAddress, &slen, &impl);
1173 if (lladdr == NULL((void *)0))
1174 lladdr = ether_zeroaddr;
1175 req = agentx_varbind_request(vb);
1176
1177 if ((kif = mib_ifget(idx)) == NULL((void *)0)) {
1178 agentx_varbind_notfound(vb);
1179 return;
1180 }
1181 /*
1182 * The lladdr of the interface will be encoded in the returned OID
1183 * ifRcvAddressX.ifindex.6.x.x.x.x.x.x = val
1184 * Thanks to the virtual cloner interfaces, it is an easy 1:1
1185 * mapping in OpenBSD; only one lladdr (MAC) address per interface.
1186 */
1187 if (slen == 6)
1188 llcmp = bcmp(lladdr, kif->if_lladdr, sizeof(kif->if_lladdr));
1189 if (req == AGENTX_REQUEST_TYPE_GET) {
1190 if (idx != kif->if_index || slen != 6 || llcmp != 0) {
1191 agentx_varbind_notfound(vb);
1192 return;
1193 }
1194 } else if (idx == kif->if_index) {
1195 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
1196 if (slen > 6 || llcmp >= 0)
1197 kif = kr_getnextif(kif->if_index);
1198 } else {
1199 if (slen > 6 || llcmp > 0)
1200 kif = kr_getnextif(kif->if_index);
1201 }
1202 if (kif == NULL((void *)0)) {
1203 agentx_varbind_notfound(vb);
1204 return;
1205 }
1206 }
1207 agentx_varbind_set_index_integer(vb, ifIdx, kif->if_index);
1208 agentx_varbind_set_index_nstring(vb, ifRcvAddressAddress,
1209 kif->if_lladdr, sizeof(kif->if_lladdr));
1210
1211 if (obj == ifRcvAddressStatus) {
1212 /* ifRcvAddressStatus: RowStatus active(1), notInService(2) */
1213 i = kif->if_flags & IFF_UP0x1 ? 1 : 2;
1214 agentx_varbind_integer(vb, i);
1215 } else if (obj == ifRcvAddressType) {
1216 /* ifRcvAddressType: other(1), volatile(2), nonVolatile(3) */
1217 agentx_varbind_integer(vb, 1);
1218 } else
1219 fatal("%s: Unexpected object", __func__);
1220}
1221
1222/*
1223 * Defined in
1224 * - OPENBSD-PF-MIB.txt
1225 * - OPENBSD-SENSORS-MIB.txt
1226 * - OPENBSD-CARP-MIB.txt
1227 * (http://www.packetmischief.ca/openbsd-snmp-mibs/)
1228 */
1229#define OIDVER_OPENBSD_MEM1 1
1230
1231struct carpif {
1232 struct carpreq carpr;
1233 struct kif kif;
1234};
1235
1236void mib_close_pftrans(struct agentx_varbind *, u_int32_t);
1237
1238void mib_pfinfo(struct agentx_varbind *);
1239void mib_pfcounters(struct agentx_varbind *);
1240void mib_pfscounters(struct agentx_varbind *);
1241void mib_pflogif(struct agentx_varbind *);
1242void mib_pfsrctrack(struct agentx_varbind *);
1243void mib_pflimits(struct agentx_varbind *);
1244void mib_pftimeouts(struct agentx_varbind *);
1245void mib_pfifnum(struct agentx_varbind *);
1246void mib_pfiftable(struct agentx_varbind *);
1247void mib_pftablenum(struct agentx_varbind *);
1248void mib_pftables(struct agentx_varbind *);
1249void mib_pftableaddrs(struct agentx_varbind *);
1250void mib_pflabelnum(struct agentx_varbind *);
1251void mib_pflabels(struct agentx_varbind *);
1252void mib_pfsyncstats(struct agentx_varbind *);
1253
1254void mib_sensornum(struct agentx_varbind *);
1255void mib_sensors(struct agentx_varbind *);
1256const char *mib_sensorunit(struct sensor *);
1257char *mib_sensorvalue(struct sensor *);
1258
1259void mib_carpsysctl(struct agentx_varbind *);
1260void mib_carpstats(struct agentx_varbind *);
1261void mib_carpiftable(struct agentx_varbind *);
1262void mib_carpgrouptable(struct agentx_varbind *);
1263void mib_carpifnum(struct agentx_varbind *);
1264struct carpif
1265 *mib_carpifget(u_int);
1266void mib_memversion(struct agentx_varbind *);
1267void mib_memiftable(struct agentx_varbind *);
1268
1269void
1270mib_pfinfo(struct agentx_varbind *vb)
1271{
1272 struct agentx_object *obj;
1273 struct pf_status s;
1274 time_t runtime = 0;
1275 struct timespec uptime;
1276
1277 if (pf_get_stats(&s)) {
1278 agentx_varbind_error(vb);
1279 return;
1280 }
1281
1282 obj = agentx_varbind_get_object(vb);
1283 if (obj == pfRunning)
1284 agentx_varbind_integer(vb, s.running);
1285 else if (obj == pfRuntime) {
1286 if (!clock_gettime(CLOCK_BOOTTIME6, &uptime))
1287 runtime = uptime.tv_sec - s.since;
1288 runtime *= 100;
1289 agentx_varbind_timeticks(vb, runtime);
1290 } else if (obj == pfDebug)
1291 agentx_varbind_integer(vb, s.debug);
1292 else if (obj == pfHostid)
1293 agentx_varbind_printf(vb, "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))
);
1294 else
1295 fatal("%s: Unexpected object", __func__);
1296}
1297
1298void
1299mib_pfcounters(struct agentx_varbind *vb)
1300{
1301 struct agentx_object *obj;
1302 struct pf_status s;
1303
1304 if (pf_get_stats(&s)) {
1305 agentx_varbind_error(vb);
1306 return;
1307 }
1308
1309 obj = agentx_varbind_get_object(vb);
1310 if (obj == pfCntMatch)
1311 agentx_varbind_counter64(vb, s.counters[PFRES_MATCH0]);
1312 else if (obj == pfCntBadOffset)
1313 agentx_varbind_counter64(vb, s.counters[PFRES_BADOFF1]);
1314 else if (obj == pfCntFragment)
1315 agentx_varbind_counter64(vb, s.counters[PFRES_FRAG2]);
1316 else if (obj == pfCntShort)
1317 agentx_varbind_counter64(vb, s.counters[PFRES_SHORT3]);
1318 else if (obj == pfCntNormalize)
1319 agentx_varbind_counter64(vb, s.counters[PFRES_NORM4]);
1320 else if (obj == pfCntMemory)
1321 agentx_varbind_counter64(vb, s.counters[PFRES_MEMORY5]);
1322 else if (obj == pfCntTimestamp)
1323 agentx_varbind_counter64(vb, s.counters[PFRES_TS6]);
1324 else if (obj == pfCntCongestion)
1325 agentx_varbind_counter64(vb, s.counters[PFRES_CONGEST7]);
1326 else if (obj == pfCntIpOption)
1327 agentx_varbind_counter64(vb, s.counters[PFRES_IPOPTIONS8]);
1328 else if (obj == pfCntProtoCksum)
1329 agentx_varbind_counter64(vb, s.counters[PFRES_PROTCKSUM9]);
1330 else if (obj == pfCntStateMismatch)
1331 agentx_varbind_counter64(vb, s.counters[PFRES_BADSTATE10]);
1332 else if (obj == pfCntStateInsert)
1333 agentx_varbind_counter64(vb, s.counters[PFRES_STATEINS11]);
1334 else if (obj == pfCntStateLimit)
1335 agentx_varbind_counter64(vb, s.counters[PFRES_MAXSTATES12]);
1336 else if (obj == pfCntSrcLimit)
1337 agentx_varbind_counter64(vb, s.counters[PFRES_SRCLIMIT13]);
1338 else if (obj == pfCntSynproxy)
1339 agentx_varbind_counter64(vb, s.counters[PFRES_SYNPROXY14]);
1340 else if (obj == pfCntTranslate)
1341 agentx_varbind_counter64(vb, s.counters[PFRES_TRANSLATE15]);
1342 else if (obj == pfCntNoRoute)
1343 agentx_varbind_counter64(vb, s.counters[PFRES_NOROUTE16]);
1344 else
1345 fatal("%s: Unexpected object", __func__);
1346}
1347
1348void
1349mib_pfscounters(struct agentx_varbind *vb)
1350{
1351 struct agentx_object *obj;
1352 struct pf_status s;
1353
1354 if (pf_get_stats(&s)) {
1355 agentx_varbind_error(vb);
1356 return;
1357 }
1358
1359 obj = agentx_varbind_get_object(vb);
1360 if (obj == pfStateCount)
1361 agentx_varbind_unsigned32(vb, s.states);
1362 else if (obj == pfStateSearches)
1363 agentx_varbind_counter64(vb, s.fcounters[FCNT_STATE_SEARCH0]);
1364 else if (obj == pfStateInserts)
1365 agentx_varbind_counter64(vb, s.fcounters[FCNT_STATE_INSERT1]);
1366 else if (obj == pfStateRemovals)
1367 agentx_varbind_counter64(vb, s.fcounters[FCNT_STATE_REMOVALS2]);
1368 else
1369 fatal("%s: Unexpected object", __func__);
1370}
1371
1372void
1373mib_pflogif(struct agentx_varbind *vb)
1374{
1375 struct agentx_object *obj;
1376 struct pf_status s;
1377
1378 if (pf_get_stats(&s)) {
1379 agentx_varbind_error(vb);
1380 return;
1381 }
1382
1383 obj = agentx_varbind_get_object(vb);
1384 if (obj == pfLogIfName)
1385 agentx_varbind_string(vb, s.ifname);
1386 else if (obj == pfLogIfIpBytesIn)
1387 agentx_varbind_counter64(vb, s.bcounters[IPV4][IN]);
1388 else if (obj == pfLogIfIpBytesOut)
1389 agentx_varbind_counter64(vb, s.bcounters[IPV4][OUT]);
1390 else if (obj == pfLogIfIpPktsInPass)
1391 agentx_varbind_counter64(vb, s.pcounters[IPV4][IN][PF_PASS]);
1392 else if (obj == pfLogIfIpPktsInDrop)
1393 agentx_varbind_counter64(vb, s.pcounters[IPV4][IN][PF_DROP]);
1394 else if (obj == pfLogIfIpPktsOutPass)
1395 agentx_varbind_counter64(vb, s.pcounters[IPV4][OUT][PF_PASS]);
1396 else if (obj == pfLogIfIpPktsOutDrop)
1397 agentx_varbind_counter64(vb, s.pcounters[IPV4][OUT][PF_DROP]);
1398 else if (obj == pfLogIfIp6BytesIn)
1399 agentx_varbind_counter64(vb, s.bcounters[IPV6][IN]);
1400 else if (obj == pfLogIfIp6BytesOut)
1401 agentx_varbind_counter64(vb, s.bcounters[IPV6][OUT]);
1402 else if (obj == pfLogIfIp6PktsInPass)
1403 agentx_varbind_counter64(vb, s.pcounters[IPV6][IN][PF_PASS]);
1404 else if (obj == pfLogIfIp6PktsInDrop)
1405 agentx_varbind_counter64(vb, s.pcounters[IPV6][IN][PF_DROP]);
1406 else if (obj == pfLogIfIp6PktsOutPass)
1407 agentx_varbind_counter64(vb, s.pcounters[IPV6][OUT][PF_PASS]);
1408 else if (obj == pfLogIfIp6PktsOutDrop)
1409 agentx_varbind_counter64(vb, s.pcounters[IPV6][OUT][PF_DROP]);
1410 else
1411 fatal("%s: Unexpected object", __func__);
1412}
1413
1414void
1415mib_pfsrctrack(struct agentx_varbind *vb)
1416{
1417 struct agentx_object *obj;
1418 struct pf_status s;
1419
1420 if (pf_get_stats(&s)) {
1421 agentx_varbind_error(vb);
1422 return;
1423 }
1424
1425 obj = agentx_varbind_get_object(vb);
1426 if (obj == pfSrcTrackCount)
1427 agentx_varbind_unsigned32(vb, s.src_nodes);
1428 else if (obj == pfSrcTrackSearches)
1429 agentx_varbind_counter64(vb, s.scounters[SCNT_SRC_NODE_SEARCH0]);
1430 else if (obj == pfSrcTrackInserts)
1431 agentx_varbind_counter64(vb, s.scounters[SCNT_SRC_NODE_INSERT1]);
1432 else if (obj == pfSrcTrackRemovals)
1433 agentx_varbind_counter64(vb,
1434 s.scounters[SCNT_SRC_NODE_REMOVALS2]);
1435 else
1436 fatal("%s: Unexpected object", __func__);
1437}
1438
1439void
1440mib_pflimits(struct agentx_varbind *vb)
1441{
1442 struct agentx_object *obj;
1443 struct pfioc_limit pl;
1444 extern int devpf;
1445
1446 obj = agentx_varbind_get_object(vb);
1447 memset(&pl, 0, sizeof(pl));
1448 if (obj == pfLimitStates)
1449 pl.index = PF_LIMIT_STATES;
1450 else if (obj == pfLimitSourceNodes)
1451 pl.index = PF_LIMIT_SRC_NODES;
1452 else if (obj == pfLimitFragments)
1453 pl.index = PF_LIMIT_FRAGS;
1454 else if (obj == pfLimitMaxTables)
1455 pl.index = PF_LIMIT_TABLES;
1456 else if (obj == pfLimitMaxTableEntries)
1457 pl.index = PF_LIMIT_TABLE_ENTRIES;
1458 else
1459 fatal("%s: Unexpected object", __func__);
1460
1461 if (ioctl(devpf, DIOCGETLIMIT(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct pfioc_limit) & 0x1fff) << 16) | ((('D')) <<
8) | ((39)))
, &pl) == -1) {
1462 log_warn("DIOCGETLIMIT");
1463 agentx_varbind_error(vb);
1464 return;
1465 }
1466
1467 agentx_varbind_unsigned32(vb, pl.limit);
1468}
1469
1470void
1471mib_pftimeouts(struct agentx_varbind *vb)
1472{
1473 struct agentx_object *obj;
1474 struct pfioc_tm pt;
1475 extern int devpf;
1476
1477 obj = agentx_varbind_get_object(vb);
1478 memset(&pt, 0, sizeof(pt));
1479 if (obj == pfTimeoutTcpFirst)
1480 pt.timeout = PFTM_TCP_FIRST_PACKET;
1481 else if (obj == pfTimeoutTcpOpening)
1482 pt.timeout = PFTM_TCP_OPENING;
1483 else if (obj == pfTimeoutTcpEstablished)
1484 pt.timeout = PFTM_TCP_ESTABLISHED;
1485 else if (obj == pfTimeoutTcpClosing)
1486 pt.timeout = PFTM_TCP_CLOSING;
1487 else if (obj == pfTimeoutTcpFinWait)
1488 pt.timeout = PFTM_TCP_FIN_WAIT;
1489 else if (obj == pfTimeoutTcpClosed)
1490 pt.timeout = PFTM_TCP_CLOSED;
1491 else if (obj == pfTimeoutUdpFirst)
1492 pt.timeout = PFTM_UDP_FIRST_PACKET;
1493 else if (obj == pfTimeoutUdpSingle)
1494 pt.timeout = PFTM_UDP_SINGLE;
1495 else if (obj == pfTimeoutUdpMultiple)
1496 pt.timeout = PFTM_UDP_MULTIPLE;
1497 else if (obj == pfTimeoutIcmpFirst)
1498 pt.timeout = PFTM_ICMP_FIRST_PACKET;
1499 else if (obj == pfTimeoutIcmpError)
1500 pt.timeout = PFTM_ICMP_ERROR_REPLY;
1501 else if (obj == pfTimeoutOtherFirst)
1502 pt.timeout = PFTM_OTHER_FIRST_PACKET;
1503 else if (obj == pfTimeoutOtherSingle)
1504 pt.timeout = PFTM_OTHER_SINGLE;
1505 else if (obj == pfTimeoutOtherMultiple)
1506 pt.timeout = PFTM_OTHER_MULTIPLE;
1507 else if (obj == pfTimeoutFragment)
1508 pt.timeout = PFTM_FRAG;
1509 else if (obj == pfTimeoutInterval)
1510 pt.timeout = PFTM_INTERVAL;
1511 else if (obj == pfTimeoutAdaptiveStart)
1512 pt.timeout = PFTM_ADAPTIVE_START;
1513 else if (obj == pfTimeoutAdaptiveEnd)
1514 pt.timeout = PFTM_ADAPTIVE_END;
1515 else if (obj == pfTimeoutSrcTrack)
1516 pt.timeout = PFTM_SRC_NODE;
1517 else
1518 fatal("%s: Unexpected object", __func__);
1519
1520 if (ioctl(devpf, DIOCGETTIMEOUT(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct pfioc_tm) & 0x1fff) << 16) | ((('D')) <<
8) | ((30)))
, &pt) == -1) {
1521 log_warn("DIOCGETTIMEOUT");
1522 agentx_varbind_error(vb);
1523 return;
1524 }
1525
1526 agentx_varbind_integer(vb, pt.seconds);
1527}
1528
1529void
1530mib_pfifnum(struct agentx_varbind *vb)
1531{
1532 int c;
1533
1534 if ((c = pfi_count()) == -1)
1535 agentx_varbind_error(vb);
1536 else
1537 agentx_varbind_integer(vb, c);
1538}
1539
1540void
1541mib_pfiftable(struct agentx_varbind *vb)
1542{
1543 struct agentx_object *obj;
1544 enum agentx_request_type req;
1545 struct pfi_kif pif;
1546 int idx, iftype;
1547
1548 obj = agentx_varbind_get_object(vb);
1549 idx = agentx_varbind_get_index_integer(vb, pfIfIdx);
1550 req = agentx_varbind_request(vb);
1551
1552 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
1553 if (idx < 1)
1554 idx = 1;
1555 else if (idx == INT32_MAX0x7fffffff) {
1556 agentx_varbind_notfound(vb);
1557 return;
1558 } else
1559 idx++;
1560 } else if (req == AGENTX_REQUEST_TYPE_GETNEXTINCLUSIVE) {
1561 if (idx < 1)
1562 idx = 1;
1563 }
1564 if (pfi_get_if(&pif, idx)) {
1565 agentx_varbind_notfound(vb);
1566 return;
1567 }
1568 agentx_varbind_set_index_integer(vb, pfIfIdx, idx);
1569
1570 if (obj == pfIfIndex)
1571 agentx_varbind_integer(vb, idx);
1572 else if (obj == pfIfDescr)
1573 agentx_varbind_string(vb, pif.pfik_name);
1574 else if (obj == pfIfType) {
1575 iftype = (pif.pfik_ifp == NULL((void *)0) ? PFI_IFTYPE_GROUP
1576 : PFI_IFTYPE_INSTANCE);
1577 agentx_varbind_integer(vb, iftype);
1578 } else if (obj == pfIfRefs)
1579 agentx_varbind_unsigned32(vb, pif.pfik_states);
1580 else if (obj == pfIfRules)
1581 agentx_varbind_unsigned32(vb, pif.pfik_rules);
1582 else if (obj == pfIfIn4PassPkts)
1583 agentx_varbind_counter64(vb, pif.pfik_packets[IPV4][IN][PASS]);
1584 else if (obj == pfIfIn4PassBytes)
1585 agentx_varbind_counter64(vb, pif.pfik_bytes[IPV4][IN][PASS]);
1586 else if (obj == pfIfIn4BlockPkts)
1587 agentx_varbind_counter64(vb, pif.pfik_packets[IPV4][IN][BLOCK]);
1588 else if (obj == pfIfIn4BlockBytes)
1589 agentx_varbind_counter64(vb, pif.pfik_bytes[IPV4][IN][BLOCK]);
1590 else if (obj == pfIfOut4PassPkts)
1591 agentx_varbind_counter64(vb, pif.pfik_packets[IPV4][OUT][PASS]);
1592 else if (obj == pfIfOut4PassBytes)
1593 agentx_varbind_counter64(vb, pif.pfik_bytes[IPV4][OUT][PASS]);
1594 else if (obj == pfIfOut4BlockPkts)
1595 agentx_varbind_counter64(vb, pif.pfik_packets[IPV4][OUT][BLOCK]);
1596 else if (obj == pfIfOut4BlockBytes)
1597 agentx_varbind_counter64(vb, pif.pfik_bytes[IPV4][OUT][BLOCK]);
1598 else if (obj == pfIfIn6PassPkts)
1599 agentx_varbind_counter64(vb, pif.pfik_packets[IPV6][IN][PASS]);
1600 else if (obj == pfIfIn6PassBytes)
1601 agentx_varbind_counter64(vb, pif.pfik_bytes[IPV6][IN][PASS]);
1602 else if (obj == pfIfIn6BlockPkts)
1603 agentx_varbind_counter64(vb, pif.pfik_packets[IPV6][IN][BLOCK]);
1604 else if (obj == pfIfIn6BlockBytes)
1605 agentx_varbind_counter64(vb, pif.pfik_bytes[IPV6][IN][BLOCK]);
1606 else if (obj == pfIfOut6PassPkts)
1607 agentx_varbind_counter64(vb, pif.pfik_packets[IPV6][OUT][PASS]);
1608 else if (obj == pfIfOut6PassBytes)
1609 agentx_varbind_counter64(vb, pif.pfik_bytes[IPV6][OUT][PASS]);
1610 else if (obj == pfIfOut6BlockPkts)
1611 agentx_varbind_counter64(vb, pif.pfik_packets[IPV6][OUT][BLOCK]);
1612 else if (obj == pfIfOut6BlockBytes)
1613 agentx_varbind_counter64(vb, pif.pfik_bytes[IPV6][OUT][BLOCK]);
1614 else
1615 fatal("%s: Unexpected object", __func__);
1616}
1617
1618void
1619mib_pftablenum(struct agentx_varbind *vb)
1620{
1621 int c;
1622
1623 if ((c = pft_count()) == -1)
1624 agentx_varbind_error(vb);
1625 else
1626 agentx_varbind_integer(vb, c);
1627}
1628
1629void
1630mib_pftables(struct agentx_varbind *vb)
1631{
1632 struct agentx_object *obj;
1633 enum agentx_request_type req;
1634 struct pfr_tstats ts;
1635 time_t tzero;
1636 int idx;
1637
1638 obj = agentx_varbind_get_object(vb);
1639 idx = agentx_varbind_get_index_integer(vb, pfTblIdx);
1640 req = agentx_varbind_request(vb);
1641
1642 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
1643 if (idx < 1)
1644 idx = 1;
1645 else if (idx == INT32_MAX0x7fffffff) {
1646 agentx_varbind_notfound(vb);
1647 return;
1648 } else
1649 idx++;
1650 } else if (req == AGENTX_REQUEST_TYPE_GETNEXTINCLUSIVE) {
1651 if (idx < 1)
1652 idx = 1;
1653 }
1654 if (pft_get_table(&ts, idx)) {
1655 agentx_varbind_notfound(vb);
1656 return;
1657 }
1658 agentx_varbind_set_index_integer(vb, pfTblIdx, idx);
1659
1660 if (obj == pfTblIndex)
1661 agentx_varbind_integer(vb, idx);
1662 else if (obj == pfTblName)
1663 agentx_varbind_string(vb, ts.pfrts_namepfrts_t.pfrt_name);
1664 else if (obj == pfTblAddresses)
1665 agentx_varbind_integer(vb, ts.pfrts_cnt);
1666 else if (obj == pfTblAnchorRefs)
1667 agentx_varbind_integer(vb, ts.pfrts_refcnt[PFR_REFCNT_ANCHOR]);
1668 else if (obj == pfTblRuleRefs)
1669 agentx_varbind_integer(vb, ts.pfrts_refcnt[PFR_REFCNT_RULE]);
1670 else if (obj == pfTblEvalsMatch)
1671 agentx_varbind_counter64(vb, ts.pfrts_match);
1672 else if (obj == pfTblEvalsNoMatch)
1673 agentx_varbind_counter64(vb, ts.pfrts_nomatch);
1674 else if (obj == pfTblInPassPkts)
1675 agentx_varbind_counter64(vb, ts.pfrts_packets[IN][PFR_OP_PASS]);
1676 else if (obj == pfTblInPassBytes)
1677 agentx_varbind_counter64(vb, ts.pfrts_bytes[IN][PFR_OP_PASS]);
1678 else if (obj == pfTblInBlockPkts)
1679 agentx_varbind_counter64(vb, ts.pfrts_packets[IN][PFR_OP_BLOCK]);
1680 else if (obj == pfTblInBlockBytes)
1681 agentx_varbind_counter64(vb, ts.pfrts_bytes[IN][PFR_OP_BLOCK]);
1682 else if (obj == pfTblInXPassPkts)
1683 agentx_varbind_counter64(vb, ts.pfrts_packets[IN][PFR_OP_XPASSPFR_OP_ADDR_MAX]);
1684 else if (obj == pfTblInXPassBytes)
1685 agentx_varbind_counter64(vb, ts.pfrts_bytes[IN][PFR_OP_XPASSPFR_OP_ADDR_MAX]);
1686 else if (obj == pfTblOutPassPkts)
1687 agentx_varbind_counter64(vb, ts.pfrts_packets[OUT][PFR_OP_PASS]);
1688 else if (obj == pfTblOutPassBytes)
1689 agentx_varbind_counter64(vb, ts.pfrts_bytes[OUT][PFR_OP_PASS]);
1690 else if (obj == pfTblOutBlockPkts)
1691 agentx_varbind_counter64(vb, ts.pfrts_packets[OUT][PFR_OP_BLOCK]);
1692 else if (obj == pfTblOutBlockBytes)
1693 agentx_varbind_counter64(vb, ts.pfrts_bytes[OUT][PFR_OP_BLOCK]);
1694 else if (obj == pfTblOutXPassPkts)
1695 agentx_varbind_counter64(vb, ts.pfrts_packets[OUT][PFR_OP_XPASSPFR_OP_ADDR_MAX]);
1696 else if (obj == pfTblOutXPassBytes)
1697 agentx_varbind_counter64(vb, ts.pfrts_bytes[OUT][PFR_OP_XPASSPFR_OP_ADDR_MAX]);
1698 else if (obj == pfTblStatsCleared) {
1699 tzero = (time(NULL((void *)0)) - ts.pfrts_tzero) * 100;
1700 agentx_varbind_timeticks(vb, tzero);
1701 } else if (obj == pfTblInMatchPkts)
1702 agentx_varbind_counter64(vb, ts.pfrts_packets[IN][PFR_OP_MATCH]);
1703 else if (obj == pfTblInMatchBytes)
1704 agentx_varbind_counter64(vb, ts.pfrts_bytes[IN][PFR_OP_MATCH]);
1705 else if (obj == pfTblOutMatchPkts)
1706 agentx_varbind_counter64(vb, ts.pfrts_packets[OUT][PFR_OP_MATCH]);
1707 else if (obj == pfTblOutMatchBytes)
1708 agentx_varbind_counter64(vb, ts.pfrts_bytes[OUT][PFR_OP_MATCH]);
1709 else
1710 fatal("%s: Unexpected object", __func__);
1711}
1712
1713void
1714mib_pftableaddrs(struct agentx_varbind *vb)
1715{
1716 struct agentx_object *obj;
1717 enum agentx_request_type req;
1718 struct pfr_astats as;
1719 int tblidx;
1720
1721 obj = agentx_varbind_get_object(vb);
1722 tblidx = agentx_varbind_get_index_integer(vb, pfTblAddrTblIdx);
1723 req = agentx_varbind_request(vb);
1724
1725 /*
1726 * XXX No consistent way to differentiate between not found and error
1727 * Treat everything as not found.
1728 */
1729 if (req == AGENTX_REQUEST_TYPE_GET ||
1730 req == AGENTX_REQUEST_TYPE_GETNEXTINCLUSIVE) {
1731 as.pfras_a.pfra_ip4addrpfra_u._pfra_ip4addr = *agentx_varbind_get_index_ipaddress(
1732 vb, pfTblAddrNetIdx);
1733 as.pfras_a.pfra_net = agentx_varbind_get_index_integer(vb,
1734 pfTblAddrMaskIdx);
1735
1736 if (pfta_get_addr(&as, tblidx)) {
1737 if (req == AGENTX_REQUEST_TYPE_GET) {
1738 agentx_varbind_notfound(vb);
1739 return;
1740 }
1741 req = AGENTX_REQUEST_TYPE_GETNEXT;
1742 }
1743 }
1744 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
1745 if (tblidx < 1)
1746 tblidx = 1;
1747 as.pfras_a.pfra_ip4addrpfra_u._pfra_ip4addr = *agentx_varbind_get_index_ipaddress(
1748 vb, pfTblAddrNetIdx);
1749 as.pfras_a.pfra_net = agentx_varbind_get_index_integer(vb,
1750 pfTblAddrMaskIdx);
1751
1752 if (pfta_get_nextaddr(&as, &tblidx)){
1753 agentx_varbind_notfound(vb);
1754 return;
1755 }
1756 }
1757 agentx_varbind_set_index_integer(vb, pfTblAddrTblIdx, tblidx);
1758 agentx_varbind_set_index_ipaddress(vb, pfTblAddrNetIdx,
1759 &as.pfras_a.pfra_ip4addrpfra_u._pfra_ip4addr);
1760 agentx_varbind_set_index_integer(vb, pfTblAddrMaskIdx,
1761 as.pfras_a.pfra_net);
1762
1763 if (obj == pfTblAddrTblIndex)
1764 agentx_varbind_integer(vb, tblidx);
1765 else if (obj == pfTblAddrNet)
1766 agentx_varbind_ipaddress(vb, &as.pfras_a.pfra_ip4addrpfra_u._pfra_ip4addr);
1767 else if (obj == pfTblAddrMask)
1768 agentx_varbind_integer(vb, as.pfras_a.pfra_net);
1769 else if (obj == pfTblAddrCleared)
1770 agentx_varbind_timeticks(vb, (time(NULL((void *)0)) - as.pfras_tzero) * 100);
1771 else if (obj == pfTblAddrInBlockPkts)
1772 agentx_varbind_counter64(vb, as.pfras_packets[IN][PFR_OP_BLOCK]);
1773 else if (obj == pfTblAddrInBlockBytes)
1774 agentx_varbind_counter64(vb, as.pfras_bytes[IN][PFR_OP_BLOCK]);
1775 else if (obj == pfTblAddrInPassPkts)
1776 agentx_varbind_counter64(vb, as.pfras_packets[IN][PFR_OP_PASS]);
1777 else if (obj == pfTblAddrInPassBytes)
1778 agentx_varbind_counter64(vb, as.pfras_bytes[IN][PFR_OP_PASS]);
1779 else if (obj == pfTblAddrOutBlockPkts)
1780 agentx_varbind_counter64(vb, as.pfras_packets[OUT][PFR_OP_BLOCK]);
1781 else if (obj == pfTblAddrOutBlockBytes)
1782 agentx_varbind_counter64(vb, as.pfras_bytes[OUT][PFR_OP_BLOCK]);
1783 else if (obj == pfTblAddrOutPassPkts)
1784 agentx_varbind_counter64(vb, as.pfras_packets[OUT][PFR_OP_PASS]);
1785 else if (obj == pfTblAddrOutPassBytes)
1786 agentx_varbind_counter64(vb, as.pfras_bytes[OUT][PFR_OP_PASS]);
1787 else if (obj == pfTblAddrInMatchPkts)
1788 agentx_varbind_counter64(vb, as.pfras_packets[IN][PFR_OP_MATCH]);
1789 else if (obj == pfTblAddrInMatchBytes)
1790 agentx_varbind_counter64(vb, as.pfras_bytes[IN][PFR_OP_MATCH]);
1791 else if (obj == pfTblAddrOutMatchPkts)
1792 agentx_varbind_counter64(vb, as.pfras_packets[OUT][PFR_OP_MATCH]);
1793 else if (obj == pfTblAddrOutMatchBytes)
1794 agentx_varbind_counter64(vb, as.pfras_bytes[OUT][PFR_OP_MATCH]);
1795 else
1796 fatal("%s: Unexpected object", __func__);
1797}
1798
1799void
1800mib_close_pftrans(struct agentx_varbind *vb, u_int32_t ticket)
1801{
1802 extern int devpf;
1803
1804 if (ioctl(devpf, DIOCXEND(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(u_int32_t) & 0x1fff) << 16) | ((('D')) << 8)
| ((100)))
, &ticket) == -1) {
1805 log_warn("DIOCXEND");
1806 agentx_varbind_error(vb);
1807 }
1808}
1809
1810void
1811mib_pflabelnum(struct agentx_varbind *vb)
1812{
1813 struct pfioc_rule pr;
1814 u_int32_t nr, mnr, lnr;
1815 extern int devpf;
1816
1817 memset(&pr, 0, sizeof(pr));
1818 if (ioctl(devpf, DIOCGETRULES(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct pfioc_rule) & 0x1fff) << 16) | ((('D')) <<
8) | ((6)))
, &pr) == -1) {
1819 log_warn("DIOCGETRULES");
1820 agentx_varbind_error(vb);
1821 return;
1822 }
1823
1824 mnr = pr.nr;
1825 lnr = 0;
1826 for (nr = 0; nr < mnr; ++nr) {
1827 pr.nr = nr;
1828 if (ioctl(devpf, DIOCGETRULE(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct pfioc_rule) & 0x1fff) << 16) | ((('D')) <<
8) | ((7)))
, &pr) == -1) {
1829 log_warn("DIOCGETRULE");
1830 agentx_varbind_error(vb);
1831 mib_close_pftrans(vb, pr.ticket);
1832 return;
1833 }
1834
1835 if (pr.rule.label[0])
1836 lnr++;
1837 }
1838
1839 agentx_varbind_integer(vb, lnr);
1840
1841 mib_close_pftrans(vb, pr.ticket);
1842}
1843
1844void
1845mib_pflabels(struct agentx_varbind *vb)
1846{
1847 struct agentx_object *obj;
1848 enum agentx_request_type req;
1849 struct pfioc_rule pr;
1850 struct pf_rule *r = NULL((void *)0);
1851 u_int32_t nr, mnr, lnr;
1852 u_int32_t idx;
1853 extern int devpf;
1854
1855 memset(&pr, 0, sizeof(pr));
1856 if (ioctl(devpf, DIOCGETRULES(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct pfioc_rule) & 0x1fff) << 16) | ((('D')) <<
8) | ((6)))
, &pr) == -1) {
1857 log_warn("DIOCGETRULES");
1858 agentx_varbind_error(vb);
1859 return;
1860 }
1861
1862 obj = agentx_varbind_get_object(vb);
1863 idx = agentx_varbind_get_index_integer(vb, pfLabelIdx);
1864 req = agentx_varbind_request(vb);
1865
1866 if (idx < 1) {
1867 if (req == AGENTX_REQUEST_TYPE_GET) {
1868 agentx_varbind_notfound(vb);
1869 return;
1870 }
1871 idx = 1;
1872 } else if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
1873 if (idx == INT32_MAX0x7fffffff) {
1874 agentx_varbind_notfound(vb);
1875 return;
1876 }
1877 idx++;
1878 }
1879
1880 mnr = pr.nr;
1881 lnr = 0;
1882 for (nr = 0; nr < mnr; ++nr) {
1883 pr.nr = nr;
1884 if (ioctl(devpf, DIOCGETRULE(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct pfioc_rule) & 0x1fff) << 16) | ((('D')) <<
8) | ((7)))
, &pr) == -1) {
1885 log_warn("DIOCGETRULE");
1886 agentx_varbind_error(vb);
1887 mib_close_pftrans(vb, pr.ticket);
1888 return;
1889 }
1890
1891 if (pr.rule.label[0] && ++lnr == idx) {
1892 r = &pr.rule;
1893 break;
1894 }
1895 }
1896
1897 mib_close_pftrans(vb, pr.ticket);
1898
1899 if (r == NULL((void *)0)) {
1900 agentx_varbind_notfound(vb);
1901 return;
1902 }
1903 agentx_varbind_set_index_integer(vb, pfLabelIdx, idx);
1904
1905 if (obj == pfLabelIndex)
1906 agentx_varbind_integer(vb, lnr);
1907 else if (obj == pfLabelName)
1908 agentx_varbind_string(vb, r->label);
1909 else if (obj == pfLabelEvals)
1910 agentx_varbind_counter64(vb, r->evaluations);
1911 else if (obj == pfLabelPkts)
1912 agentx_varbind_counter64(vb, r->packets[IN] + r->packets[OUT]);
1913 else if (obj == pfLabelBytes)
1914 agentx_varbind_counter64(vb, r->bytes[IN] + r->bytes[OUT]);
1915 else if (obj == pfLabelInPkts)
1916 agentx_varbind_counter64(vb, r->packets[IN]);
1917 else if (obj == pfLabelInBytes)
1918 agentx_varbind_counter64(vb, r->bytes[IN]);
1919 else if (obj == pfLabelOutPkts)
1920 agentx_varbind_counter64(vb, r->packets[OUT]);
1921 else if (obj == pfLabelOutBytes)
1922 agentx_varbind_counter64(vb, r->bytes[OUT]);
1923 else if (obj == pfLabelTotalStates)
1924 agentx_varbind_counter32(vb, r->states_tot);
1925 else
1926 fatal("%s: Unexpected object", __func__);
1927}
1928
1929void
1930mib_pfsyncstats(struct agentx_varbind *vb)
1931{
1932 struct agentx_object *obj;
1933 int mib[] = { CTL_NET4, PF_INET2, IPPROTO_PFSYNC240,
1934 PFSYNCCTL_STATS1 };
1935 size_t len = sizeof(struct pfsyncstats);
1936 struct pfsyncstats s;
1937
1938 if (sysctl(mib, 4, &s, &len, NULL((void *)0), 0) == -1) {
1939 log_warn("sysctl");
1940 agentx_varbind_error(vb);
1941 return;
1942 }
1943
1944 obj = agentx_varbind_get_object(vb);
1945 if (obj == pfsyncIpPktsRecv)
1946 agentx_varbind_counter64(vb, s.pfsyncs_ipackets);
1947 else if (obj == pfsyncIp6PktsRecv)
1948 agentx_varbind_counter64(vb, s.pfsyncs_ipackets6);
1949 else if (obj == pfsyncPktDiscardsForBadInterface)
1950 agentx_varbind_counter64(vb, s.pfsyncs_badif);
1951 else if (obj == pfsyncPktDiscardsForBadTtl)
1952 agentx_varbind_counter64(vb, s.pfsyncs_badttl);
1953 else if (obj == pfsyncPktShorterThanHeader)
1954 agentx_varbind_counter64(vb, s.pfsyncs_hdrops);
1955 else if (obj == pfsyncPktDiscardsForBadVersion)
1956 agentx_varbind_counter64(vb, s.pfsyncs_badver);
1957 else if (obj == pfsyncPktDiscardsForBadAction)
1958 agentx_varbind_counter64(vb, s.pfsyncs_badact);
1959 else if (obj == pfsyncPktDiscardsForBadLength)
1960 agentx_varbind_counter64(vb, s.pfsyncs_badlen);
1961 else if (obj == pfsyncPktDiscardsForBadAuth)
1962 agentx_varbind_counter64(vb, s.pfsyncs_badauth);
1963 else if (obj == pfsyncPktDiscardsForStaleState)
1964 agentx_varbind_counter64(vb, s.pfsyncs_stale);
1965 else if (obj == pfsyncPktDiscardsForBadValues)
1966 agentx_varbind_counter64(vb, s.pfsyncs_badval);
1967 else if (obj == pfsyncPktDiscardsForBadState)
1968 agentx_varbind_counter64(vb, s.pfsyncs_badstate);
1969 else if (obj == pfsyncIpPktsSent)
1970 agentx_varbind_counter64(vb, s.pfsyncs_opackets);
1971 else if (obj == pfsyncIp6PktsSent)
1972 agentx_varbind_counter64(vb, s.pfsyncs_opackets6);
1973 else if (obj == pfsyncNoMemory)
1974 agentx_varbind_counter64(vb, s.pfsyncs_onomem);
1975 else if (obj == pfsyncOutputErrors)
1976 agentx_varbind_counter64(vb, s.pfsyncs_oerrors);
1977 else
1978 fatal("%s: Unexpected object", __func__);
1979}
1980
1981/* OPENBSD-SENSORS-MIB */
1982void
1983mib_sensornum(struct agentx_varbind *vb)
1984{
1985 struct sensordev sensordev;
1986 size_t len = sizeof(sensordev);
1987 int mib[] = { CTL_HW6, HW_SENSORS11, 0 };
1988 int i, c;
1989
1990 for (i = c = 0; ; i++) {
1991 mib[2] = i;
1992 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])),
1993 &sensordev, &len, NULL((void *)0), 0) == -1) {
1994 if (errno(*__errno()) == ENXIO6)
1995 continue;
1996 if (errno(*__errno()) == ENOENT2)
1997 break;
1998 log_warn("sysctl");
1999 agentx_varbind_error(vb);
2000 return;
2001 }
2002 c += sensordev.sensors_count;
2003 }
2004
2005 agentx_varbind_integer(vb, c);
2006}
2007
2008void
2009mib_sensors(struct agentx_varbind *vb)
2010{
2011 struct agentx_object *obj;
2012 enum agentx_request_type req;
2013 struct sensordev sensordev;
2014 size_t len = sizeof(sensordev);
2015 struct sensor sensor;
2016 size_t slen = sizeof(sensor);
2017 char desc[32];
2018 int mib[] =
2019 { CTL_HW6, HW_SENSORS11, 0, 0, 0 };
2020 int i, j, k;
2021 u_int32_t idx = 0, n;
2022 char *s;
2023
2024 obj = agentx_varbind_get_object(vb);
2025 idx = agentx_varbind_get_index_integer(vb, sensorIdx);
2026 req = agentx_varbind_request(vb);
2027
2028 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
2029 if (idx == INT32_MAX0x7fffffff) {
2030 agentx_varbind_notfound(vb);
2031 return;
2032 }
2033 idx++;
2034 }
2035 if (idx < 1 &&
2036 (req == AGENTX_REQUEST_TYPE_GETNEXT ||
2037 req == AGENTX_REQUEST_TYPE_GETNEXTINCLUSIVE))
2038 idx = 1;
2039
2040 for (i = 0, n = 1; ; i++) {
2041 mib[2] = i;
2042 if (sysctl(mib, 3, &sensordev, &len, NULL((void *)0), 0) == -1) {
2043 if (errno(*__errno()) == ENXIO6)
2044 continue;
2045 if (errno(*__errno()) == ENOENT2)
2046 break;
2047 log_warn("sysctl");
2048 agentx_varbind_error(vb);
2049 return;
2050 }
2051 for (j = 0; j < SENSOR_MAX_TYPES; j++) {
2052 mib[3] = j;
2053 for (k = 0; k < sensordev.maxnumt[j]; k++) {
2054 mib[4] = k;
2055 if (sysctl(mib, 5,
2056 &sensor, &slen, NULL((void *)0), 0) == -1) {
2057 if (errno(*__errno()) == ENXIO6)
2058 continue;
2059 if (errno(*__errno()) == ENOENT2)
2060 break;
2061 log_warn("sysctl");
2062 agentx_varbind_error(vb);
2063 return;
2064 }
2065 if (sensor.flags & SENSOR_FINVALID0x0001)
2066 continue;
2067 if (n == idx)
2068 goto found;
2069 n++;
2070 }
2071 }
2072 }
2073 agentx_varbind_notfound(vb);
2074 return;
2075
2076 found:
2077 agentx_varbind_set_index_integer(vb, sensorIdx, idx);
2078 if (obj == sensorIndex)
2079 agentx_varbind_integer(vb, (int32_t)n);
2080 else if (obj == sensorDescr) {
2081 if (sensor.desc[0] == '\0') {
2082 snprintf(desc, sizeof(desc), "%s%d",
2083 sensor_type_s[sensor.type],
2084 sensor.numt);
2085 agentx_varbind_string(vb, desc);
2086 } else
2087 agentx_varbind_string(vb, sensor.desc);
2088 } else if (obj == sensorType)
2089 agentx_varbind_integer(vb, sensor.type);
2090 else if (obj == sensorDevice)
2091 agentx_varbind_string(vb, sensordev.xname);
2092 else if (obj == sensorValue) {
2093 if ((s = mib_sensorvalue(&sensor)) == NULL((void *)0)) {
2094 log_warn("asprintf");
2095 agentx_varbind_error(vb);
2096 return;
2097 }
2098 agentx_varbind_string(vb, s);
2099 free(s);
2100 } else if (obj == sensorUnits)
2101 agentx_varbind_string(vb, mib_sensorunit(&sensor));
2102 else if (obj == sensorStatus)
2103 agentx_varbind_integer(vb, sensor.status);
2104 else
2105 fatal("%s: Unexpected object", __func__);
2106}
2107
2108#define SENSOR_DRIVE_STATES(10 + 1) (SENSOR_DRIVE_PFAIL10 + 1)
2109static const char * const sensor_drive_s[SENSOR_DRIVE_STATES(10 + 1)] = {
2110 NULL((void *)0), "empty", "ready", "powerup", "online", "idle", "active",
2111 "rebuild", "powerdown", "fail", "pfail"
2112};
2113
2114static const char * const sensor_unit_s[SENSOR_MAX_TYPES + 1] = {
2115 "degC", "RPM", "V DC", "V AC", "Ohm", "W", "A", "Wh", "Ah",
2116 "", "", "%", "lx", "", "sec", "%RH", "Hz", "degree",
2117 "m", "Pa", "m/s^2", "m/s", ""
2118};
2119
2120const char *
2121mib_sensorunit(struct sensor *s)
2122{
2123 u_int idx;
2124 idx = s->type > SENSOR_MAX_TYPES ?
2125 SENSOR_MAX_TYPES : s->type;
2126 return (sensor_unit_s[idx]);
2127}
2128
2129char *
2130mib_sensorvalue(struct sensor *s)
2131{
2132 char *v;
2133 int ret = -1;
2134
2135 switch (s->type) {
2136 case SENSOR_TEMP:
2137 ret = asprintf(&v, "%.2f",
2138 (s->value - 273150000) / 1000000.0);
2139 break;
2140 case SENSOR_VOLTS_DC:
2141 case SENSOR_VOLTS_AC:
2142 case SENSOR_WATTS:
2143 case SENSOR_AMPS:
2144 case SENSOR_WATTHOUR:
2145 case SENSOR_AMPHOUR:
2146 case SENSOR_LUX:
2147 case SENSOR_FREQ:
2148 case SENSOR_ACCEL:
2149 case SENSOR_VELOCITY:
2150 case SENSOR_DISTANCE:
2151 ret = asprintf(&v, "%.2f", s->value / 1000000.0);
2152 break;
2153 case SENSOR_INDICATOR:
2154 ret = asprintf(&v, "%s", s->value ? "on" : "off");
2155 break;
2156 case SENSOR_PERCENT:
2157 case SENSOR_HUMIDITY:
2158 ret = asprintf(&v, "%.2f", s->value / 1000.0);
2159 break;
2160 case SENSOR_PRESSURE:
2161 ret = asprintf(&v, "%.2f", s->value / 1000.0);
2162 break;
2163 case SENSOR_TIMEDELTA:
2164 ret = asprintf(&v, "%.6f", s->value / 1000000000.0);
2165 break;
2166 case SENSOR_DRIVE:
2167 if (s->value > 0 && s->value < SENSOR_DRIVE_STATES(10 + 1)) {
2168 ret = asprintf(&v, "%s", sensor_drive_s[s->value]);
2169 break;
2170 }
2171 /* FALLTHROUGH */
2172 case SENSOR_FANRPM:
2173 case SENSOR_OHMS:
2174 case SENSOR_INTEGER:
2175 default:
2176 ret = asprintf(&v, "%lld", s->value);
2177 break;
2178 }
2179
2180 if (ret == -1)
2181 return (NULL((void *)0));
2182 return (v);
2183}
2184
2185void
2186mib_carpsysctl(struct agentx_varbind *vb)
2187{
2188 struct agentx_object *obj;
2189 size_t len;
2190 int mib[] = { CTL_NET4, PF_INET2, IPPROTO_CARP112, 0 };
2191 int v;
2192
2193 obj = agentx_varbind_get_object(vb);
2194 if (obj == carpAllow)
2195 mib[3] = CARPCTL_ALLOW1;
2196 else if (obj == carpPreempt)
2197 mib[3] = CARPCTL_PREEMPT2;
2198 else if (obj == carpLog)
2199 mib[3] = CARPCTL_LOG3;
2200 else
2201 fatal("%s: Unexpected object", __func__);
2202 len = sizeof(v);
2203
2204 if (sysctl(mib, 4, &v, &len, NULL((void *)0), 0) == -1) {
2205 log_warn("sysctl");
2206 agentx_varbind_error(vb);
2207 return;
2208 }
2209
2210 agentx_varbind_integer(vb, v);
2211}
2212
2213void
2214mib_carpstats(struct agentx_varbind *vb)
2215{
2216 struct agentx_object *obj;
2217 int mib[] = { CTL_NET4, PF_INET2, IPPROTO_CARP112,
2218 CARPCTL_STATS4 };
2219 size_t len;
2220 struct carpstats stats;
2221
2222 len = sizeof(stats);
2223
2224 if (sysctl(mib, 4, &stats, &len, NULL((void *)0), 0) == -1) {
2225 log_warn("sysctl");
2226 agentx_varbind_error(vb);
2227 return;
2228 }
2229
2230 obj = agentx_varbind_get_object(vb);
2231 if (obj == carpIpPktsRecv)
2232 agentx_varbind_counter64(vb, stats.carps_ipackets);
2233 else if (obj == carpIp6PktsRecv)
2234 agentx_varbind_counter64(vb, stats.carps_ipackets6);
2235 else if (obj == carpPktDiscardsForBadInterface)
2236 agentx_varbind_counter64(vb, stats.carps_badif);
2237 else if (obj == carpPktDiscardsForWrongTtl)
2238 agentx_varbind_counter64(vb, stats.carps_badttl);
2239 else if (obj == carpPktShorterThanHeader)
2240 agentx_varbind_counter64(vb, stats.carps_hdrops);
2241 else if (obj == carpPktDiscardsForBadChecksum)
2242 agentx_varbind_counter64(vb, stats.carps_badsum);
2243 else if (obj == carpPktDiscardsForBadVersion)
2244 agentx_varbind_counter64(vb, stats.carps_badver);
2245 else if (obj == carpPktDiscardsForTooShort)
2246 agentx_varbind_counter64(vb, stats.carps_badlen);
2247 else if (obj == carpPktDiscardsForBadAuth)
2248 agentx_varbind_counter64(vb, stats.carps_badauth);
2249 else if (obj == carpPktDiscardsForBadVhid)
2250 agentx_varbind_counter64(vb, stats.carps_badvhid);
2251 else if (obj == carpPktDiscardsForBadAddressList)
2252 agentx_varbind_counter64(vb, stats.carps_badaddrs);
2253 else if (obj == carpIpPktsSent)
2254 agentx_varbind_counter64(vb, stats.carps_opackets);
2255 else if (obj == carpIp6PktsSent)
2256 agentx_varbind_counter64(vb, stats.carps_opackets6);
2257 else if (obj == carpNoMemory)
2258 agentx_varbind_counter64(vb, stats.carps_onomem);
2259 else if (obj == carpTransitionsToMaster)
2260 agentx_varbind_counter64(vb, stats.carps_preempt);
2261 else
2262 fatal("%s: Unexpected object", __func__);
2263}
2264
2265void
2266mib_carpifnum(struct agentx_varbind *vb)
2267{
2268 struct kif *kif;
2269 int c = 0;
2270
2271 for (kif = kr_getif(0); kif != NULL((void *)0);
2272 kif = kr_getnextif(kif->if_index))
2273 if (kif->if_typeif_data.ifi_type == IFT_CARP0xf7)
2274 c++;
2275
2276 agentx_varbind_integer(vb, c);
2277}
2278
2279struct carpif *
2280mib_carpifget(u_int idx)
2281{
2282 struct kif *kif;
2283 struct carpif *cif;
2284 int s;
2285 struct ifreq ifr;
2286 struct carpreq carpr;
2287
2288 if ((kif = kr_getif(idx)) == NULL((void *)0) || kif->if_typeif_data.ifi_type != IFT_CARP0xf7) {
2289 /*
2290 * It may happen that an interface with a specific index
2291 * does not exist, has been removed, or is not a carp(4)
2292 * interface. Jump to the next available carp(4) interface
2293 * index.
2294 */
2295 for (kif = kr_getif(0); kif != NULL((void *)0);
2296 kif = kr_getnextif(kif->if_index)) {
2297 if (kif->if_typeif_data.ifi_type != IFT_CARP0xf7)
2298 continue;
2299 if (kif->if_index > idx)
2300 break;
2301
2302 }
2303 if (kif == NULL((void *)0))
2304 return (NULL((void *)0));
2305 }
2306 idx = kif->if_index;
2307
2308 /* Update interface information */
2309 kr_updateif(idx);
2310 if ((kif = kr_getif(idx)) == NULL((void *)0)) {
2311 log_debug("mib_carpifget: interface %d disappeared?", idx);
2312 return (NULL((void *)0));
2313 }
2314
2315 if ((s = socket(AF_INET2, SOCK_DGRAM2, 0)) == -1)
2316 return (NULL((void *)0));
2317
2318 memset(&ifr, 0, sizeof(ifr));
2319 strlcpy(ifr.ifr_name, kif->if_name, sizeof(ifr.ifr_name));
2320 memset((char *)&carpr, 0, sizeof(carpr));
2321 ifr.ifr_dataifr_ifru.ifru_data = (caddr_t)&carpr;
2322
2323 if (ioctl(s, SIOCGVH(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct ifreq) & 0x1fff) << 16) | ((('i')) <<
8) | ((246)))
, (caddr_t)&ifr) == -1) {
2324 close(s);
2325 return (NULL((void *)0));
2326 }
2327
2328 cif = calloc(1, sizeof(struct carpif));
2329 if (cif != NULL((void *)0)) {
2330 memcpy(&cif->carpr, &carpr, sizeof(struct carpreq));
2331 memcpy(&cif->kif, kif, sizeof(struct kif));
2332 }
2333
2334 close(s);
2335
2336 return (cif);
2337}
2338
2339void
2340mib_carpiftable(struct agentx_varbind *vb)
2341{
2342 struct agentx_object *obj;
2343 enum agentx_request_type req;
2344 u_int32_t idx;
2345 struct carpif *cif;
2346
2347 obj = agentx_varbind_get_object(vb);
2348 idx = agentx_varbind_get_index_integer(vb, carpIfIdx);
2349 req = agentx_varbind_request(vb);
2350
2351 if (idx < 1) {
2352 if (req == AGENTX_REQUEST_TYPE_GET) {
2353 agentx_varbind_notfound(vb);
2354 return;
2355 }
2356 idx = 1;
2357 } else if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
2358 if (idx == INT32_MAX0x7fffffff) {
2359 agentx_varbind_notfound(vb);
2360 return;
2361 }
2362 idx++;
2363 }
2364
2365 /*
2366 * XXX No consistent way to differentiate between not found and error
2367 * Treat everything as not found.
2368 */
2369 if ((cif = mib_carpifget(idx)) == NULL((void *)0)) {
2370 agentx_varbind_notfound(vb);
2371 return;
2372 }
2373
2374 if (req == AGENTX_REQUEST_TYPE_GET && cif->kif.if_index != idx) {
2375 agentx_varbind_notfound(vb);
2376 return;
2377 }
2378 agentx_varbind_set_index_integer(vb, carpIfIdx, cif->kif.if_index);
2379
2380 if (obj == carpIfIndex)
2381 agentx_varbind_integer(vb, cif->kif.if_index);
2382 else if (obj == carpIfDescr)
2383 agentx_varbind_string(vb, cif->kif.if_name);
2384 else if (obj == carpIfVhid)
2385 agentx_varbind_integer(vb, cif->carpr.carpr_vhids[0]);
2386 else if (obj == carpIfDev)
2387 agentx_varbind_string(vb, cif->carpr.carpr_carpdev);
2388 else if (obj == carpIfAdvbase)
2389 agentx_varbind_integer(vb, cif->carpr.carpr_advbase);
2390 else if (obj == carpIfAdvskew)
2391 agentx_varbind_integer(vb, cif->carpr.carpr_advskews[0]);
2392 else if (obj == carpIfState)
2393 agentx_varbind_integer(vb, cif->carpr.carpr_states[0]);
2394 else
2395 fatal("%s: Unexpected object", __func__);
2396 free(cif);
2397}
2398
2399static struct ifg_req *
2400mib_carpgroupget(u_int idx)
2401{
2402 struct ifgroupreq ifgr;
2403 struct ifg_req *ifg = NULL((void *)0);
2404 u_int len;
2405 int s = -1;
2406
2407 bzero(&ifgr, sizeof(ifgr));
2408
2409 if ((s = socket(AF_INET2, SOCK_DGRAM2, 0)) == -1) {
2410 log_warn("socket");
2411 return (NULL((void *)0));
2412 }
2413
2414 if (ioctl(s, SIOCGIFGLIST(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct ifgroupreq) & 0x1fff) << 16) | ((('i')) <<
8) | ((141)))
, (caddr_t)&ifgr) == -1) {
2415 log_warn("SIOCGIFGLIST");
2416 goto err;
2417 }
2418 len = ifgr.ifgr_len;
2419
2420 if (len / sizeof(*ifgr.ifgr_groupsifgr_ifgru.ifgru_groups) <= idx-1)
2421 goto err;
2422
2423 if ((ifgr.ifgr_groupsifgr_ifgru.ifgru_groups = calloc(1, len)) == NULL((void *)0)) {
2424 log_warn("alloc");
2425 goto err;
2426 }
2427 if (ioctl(s, SIOCGIFGLIST(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct ifgroupreq) & 0x1fff) << 16) | ((('i')) <<
8) | ((141)))
, (caddr_t)&ifgr) == -1) {
2428 log_warn("SIOCGIFGLIST");
2429 goto err;
2430 }
2431 close(s);
2432
2433 if ((ifg = calloc(1, sizeof *ifg)) == NULL((void *)0)) {
2434 log_warn("alloc");
2435 goto err;
2436 }
2437
2438 memcpy(ifg, &ifgr.ifgr_groupsifgr_ifgru.ifgru_groups[idx-1], sizeof *ifg);
2439 free(ifgr.ifgr_groupsifgr_ifgru.ifgru_groups);
2440 return ifg;
2441 err:
2442 free(ifgr.ifgr_groupsifgr_ifgru.ifgru_groups);
2443 close(s);
2444 return (NULL((void *)0));
2445}
2446
2447void
2448mib_carpgrouptable(struct agentx_varbind *vb)
2449{
2450 struct agentx_object *obj;
2451 enum agentx_request_type req;
2452 struct ifgroupreq ifgr;
2453 struct ifg_req *ifg;
2454 uint32_t idx;
2455 int s;
2456
2457 obj = agentx_varbind_get_object(vb);
2458 idx = agentx_varbind_get_index_integer(vb, carpGroupIdx);
2459 req = agentx_varbind_request(vb);
2460
2461 if (idx < 1) {
2462 if (req == AGENTX_REQUEST_TYPE_GET) {
2463 agentx_varbind_notfound(vb);
2464 return;
2465 }
2466 idx = 1;
2467 } else if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
2468 if (idx == INT32_MAX0x7fffffff) {
2469 agentx_varbind_notfound(vb);
2470 return;
2471 }
2472 idx++;
2473 }
2474
2475 /*
2476 * XXX No consistent way to differentiate between not found and error
2477 * Treat everything as not found.
2478 */
2479 if ((ifg = mib_carpgroupget(idx)) == NULL((void *)0)) {
2480 agentx_varbind_notfound(vb);
2481 return;
2482 }
2483 agentx_varbind_set_index_integer(vb, carpGroupIdx, idx);
2484
2485 if (obj == carpGroupName)
2486 agentx_varbind_string(vb, ifg->ifgrq_groupifgrq_ifgrqu.ifgrqu_group);
2487 else if (obj == carpGroupDemote) {
2488 if ((s = socket(AF_INET2, SOCK_DGRAM2, 0)) == -1) {
2489 log_warn("socket");
2490 free(ifg);
2491 agentx_varbind_error(vb);
2492 return;
2493 }
2494
2495 bzero(&ifgr, sizeof(ifgr));
2496 strlcpy(ifgr.ifgr_name, ifg->ifgrq_groupifgrq_ifgrqu.ifgrqu_group, sizeof(ifgr.ifgr_name));
2497 if (ioctl(s, SIOCGIFGATTR(((unsigned long)0x80000000|(unsigned long)0x40000000) | ((sizeof
(struct ifgroupreq) & 0x1fff) << 16) | ((('i')) <<
8) | ((139)))
, (caddr_t)&ifgr) == -1) {
2498 log_warn("SIOCGIFGATTR");
2499 close(s);
2500 free(ifg);
2501 agentx_varbind_error(vb);
2502 return;
2503 }
2504
2505 close(s);
2506 agentx_varbind_integer(vb, ifgr.ifgr_attribifgr_ifgru.ifgru_attrib.ifg_carp_demoted);
2507 } else
2508 fatal("%s: Unexpected object", __func__);
2509
2510 free(ifg);
2511}
2512
2513void
2514mib_memversion(struct agentx_varbind *vb)
2515{
2516 agentx_varbind_integer(vb, 1);
2517}
2518
2519void
2520mib_memiftable(struct agentx_varbind *vb)
2521{
2522 struct agentx_object *obj;
2523 enum agentx_request_type req;
2524 u_int32_t idx = 0;
2525 struct kif *kif;
2526
2527 obj = agentx_varbind_get_object(vb);
2528 idx = agentx_varbind_get_index_integer(vb, ifIdx);
2529 req = agentx_varbind_request(vb);
2530 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
2531 if (idx == INT32_MAX0x7fffffff) {
2532 agentx_varbind_notfound(vb);
2533 return;
2534 }
2535 idx++;
2536 }
2537 if ((kif = mib_ifget(idx)) == NULL((void *)0)) {
2538 agentx_varbind_notfound(vb);
2539 return;
2540 }
2541 if (req == AGENTX_REQUEST_TYPE_GET) {
2542 if (idx != kif->if_index) {
2543 agentx_varbind_notfound(vb);
2544 return;
2545 }
2546 }
2547 agentx_varbind_set_index_integer(vb, ifIdx, kif->if_index);
2548
2549 if (obj == memIfName)
2550 agentx_varbind_string(vb, kif->if_name);
2551 else if (obj == memIfLiveLocks)
2552 agentx_varbind_counter64(vb, 0);
2553 else
2554 fatal("%s: Unexpected object", __func__);
2555}
2556
2557/*
2558 * Defined in IP-MIB.txt
2559 */
2560int mib_getipstat(struct ipstat *);
2561void mib_ipstat(struct agentx_varbind *);
2562void mib_ipforwarding(struct agentx_varbind *);
2563void mib_ipdefaultttl(struct agentx_varbind *);
2564void mib_ipinhdrerrs(struct agentx_varbind *);
2565void mib_ipinaddrerrs(struct agentx_varbind *);
2566void mib_ipforwdgrams(struct agentx_varbind *);
2567void mib_ipreasmtimeout(struct agentx_varbind *);
2568void mib_ipreasmfails(struct agentx_varbind *);
2569void mib_ipfragfails(struct agentx_varbind *);
2570void mib_ipaddr(struct agentx_varbind *);
2571void mib_physaddr(struct agentx_varbind *);
2572
2573void
2574mib_ipforwarding(struct agentx_varbind *vb)
2575{
2576 int mib[] = { CTL_NET4, PF_INET2, IPPROTO_IP0, IPCTL_FORWARDING1 };
2577 int v;
2578 size_t len = sizeof(v);
2579
2580 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &v, &len, NULL((void *)0), 0) == -1) {
2581 log_warn("sysctl");
2582 agentx_varbind_error(vb);
2583 return;
2584 }
2585
2586 /* ipForwarding: forwarding(1), notForwarding(2) */
2587 agentx_varbind_integer(vb, (v == 0) ? 2 : 1);
2588}
2589
2590void
2591mib_ipdefaultttl(struct agentx_varbind *vb)
2592{
2593 int mib[] = { CTL_NET4, PF_INET2, IPPROTO_IP0, IPCTL_DEFTTL3 };
2594 int v;
2595 size_t len = sizeof(v);
2596
2597 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &v, &len, NULL((void *)0), 0) == -1) {
2598 log_warn("sysctl");
2599 agentx_varbind_error(vb);
2600 return;
2601 }
2602
2603 agentx_varbind_integer(vb, v);
2604}
2605
2606int
2607mib_getipstat(struct ipstat *ipstat)
2608{
2609 int mib[] = { CTL_NET4, PF_INET2, IPPROTO_IP0, IPCTL_STATS33 };
2610 size_t len = sizeof(*ipstat);
2611
2612 return (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), ipstat, &len, NULL((void *)0), 0));
2613}
2614
2615void
2616mib_ipstat(struct agentx_varbind *vb)
2617{
2618 struct agentx_object *obj;
2619 struct ipstat ipstat;
2620
2621 if (mib_getipstat(&ipstat) == -1) {
2622 log_warn("sysctl");
2623 agentx_varbind_error(vb);
2624 return;
2625 }
2626
2627 obj = agentx_varbind_get_object(vb);
2628 if (obj == ipInReceives)
2629 agentx_varbind_counter32(vb, ipstat.ips_total);
2630 else if (obj == ipInUnknownProtos)
2631 agentx_varbind_counter32(vb, ipstat.ips_noproto);
2632 else if (obj == ipInDelivers)
2633 agentx_varbind_counter32(vb, ipstat.ips_delivered);
2634 else if (obj == ipOutRequests)
2635 agentx_varbind_counter32(vb, ipstat.ips_localout);
2636 else if (obj == ipOutDiscards)
2637 agentx_varbind_counter32(vb, ipstat.ips_odropped);
2638 else if (obj == ipOutNoRoutes)
2639 agentx_varbind_counter32(vb, ipstat.ips_noroute);
2640 else if (obj == ipReasmReqds)
2641 agentx_varbind_counter32(vb, ipstat.ips_fragments);
2642 else if (obj == ipReasmOKs)
2643 agentx_varbind_counter32(vb, ipstat.ips_reassembled);
2644 else if (obj == ipFragOKs)
2645 agentx_varbind_counter32(vb, ipstat.ips_fragmented);
2646 else if (obj == ipFragCreates)
2647 agentx_varbind_counter32(vb, ipstat.ips_ofragments);
2648 else
2649 fatal("%s: Unexpected object", __func__);
2650}
2651
2652void
2653mib_ipinhdrerrs(struct agentx_varbind *vb)
2654{
2655 u_int32_t errors;
2656 struct ipstat ipstat;
2657
2658 if (mib_getipstat(&ipstat) == -1) {
2659 log_warn("sysctl");
2660 agentx_varbind_error(vb);
2661 return;
2662 }
2663
2664 errors = ipstat.ips_badsum + ipstat.ips_badvers +
2665 ipstat.ips_tooshort + ipstat.ips_toosmall +
2666 ipstat.ips_badhlen + ipstat.ips_badlen +
2667 ipstat.ips_badoptions + ipstat.ips_toolong +
2668 ipstat.ips_badaddr;
2669
2670 agentx_varbind_counter32(vb, errors);
2671}
2672
2673void
2674mib_ipinaddrerrs(struct agentx_varbind *vb)
2675{
2676 u_int32_t errors;
2677 struct ipstat ipstat;
2678
2679 if (mib_getipstat(&ipstat) == -1) {
2680 log_warn("sysctl");
2681 agentx_varbind_error(vb);
2682 return;
2683 }
2684
2685 errors = ipstat.ips_cantforward + ipstat.ips_badaddr;
2686
2687 agentx_varbind_counter32(vb, errors);
2688}
2689
2690void
2691mib_ipforwdgrams(struct agentx_varbind *vb)
2692{
2693 u_int32_t counter;
2694 struct ipstat ipstat;
2695
2696 if (mib_getipstat(&ipstat) == -1) {
2697 log_warn("sysctl");
2698 agentx_varbind_error(vb);
2699 return;
2700 }
2701
2702 counter = ipstat.ips_forward + ipstat.ips_redirectsent;
2703
2704 agentx_varbind_counter32(vb, counter);
2705}
2706
2707void
2708mib_ipreasmtimeout(struct agentx_varbind *vb)
2709{
2710 agentx_varbind_integer(vb, IPFRAGTTL60);
2711}
2712
2713void
2714mib_ipreasmfails(struct agentx_varbind *vb)
2715{
2716 u_int32_t counter;
2717 struct ipstat ipstat;
2718
2719 if (mib_getipstat(&ipstat) == -1) {
2720 log_warn("sysctl");
2721 agentx_varbind_error(vb);
2722 return;
2723 }
2724
2725 counter = ipstat.ips_fragdropped + ipstat.ips_fragtimeout;
2726
2727 agentx_varbind_counter32(vb, counter);
2728}
2729
2730void
2731mib_ipfragfails(struct agentx_varbind *vb)
2732{
2733 u_int32_t counter;
2734 struct ipstat ipstat;
2735
2736 if (mib_getipstat(&ipstat) == -1) {
2737 log_warn("sysctl");
2738 agentx_varbind_error(vb);
2739 return;
2740 }
2741
2742 counter = ipstat.ips_badfrags + ipstat.ips_cantfrag;
2743 agentx_varbind_counter32(vb, counter);
2744}
2745
2746void
2747mib_ipaddr(struct agentx_varbind *vb)
2748{
2749 struct agentx_object *obj;
2750 enum agentx_request_type req;
2751 struct sockaddr_in addr;
2752 struct kif_addr *ka;
2753
2754 obj = agentx_varbind_get_object(vb);
2755 req = agentx_varbind_request(vb);
2756 bzero(&addr, sizeof(addr));
2757 addr.sin_family = AF_INET2;
2758 addr.sin_len = sizeof(addr);
2759 addr.sin_addr = *agentx_varbind_get_index_ipaddress(vb, ipAdEntAddrIdx);
2760
2761 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
2762 if (addr.sin_addr.s_addr == UINT32_MAX0xffffffffU) {
2763 agentx_varbind_notfound(vb);
2764 return;
2765 }
2766 addr.sin_addr.s_addr = htonl(ntohl(addr.sin_addr.s_addr) + 1)(__uint32_t)(__builtin_constant_p((__uint32_t)(__builtin_constant_p
(addr.sin_addr.s_addr) ? (__uint32_t)(((__uint32_t)(addr.sin_addr
.s_addr) & 0xff) << 24 | ((__uint32_t)(addr.sin_addr
.s_addr) & 0xff00) << 8 | ((__uint32_t)(addr.sin_addr
.s_addr) & 0xff0000) >> 8 | ((__uint32_t)(addr.sin_addr
.s_addr) & 0xff000000) >> 24) : __swap32md(addr.sin_addr
.s_addr)) + 1) ? (__uint32_t)(((__uint32_t)((__uint32_t)(__builtin_constant_p
(addr.sin_addr.s_addr) ? (__uint32_t)(((__uint32_t)(addr.sin_addr
.s_addr) & 0xff) << 24 | ((__uint32_t)(addr.sin_addr
.s_addr) & 0xff00) << 8 | ((__uint32_t)(addr.sin_addr
.s_addr) & 0xff0000) >> 8 | ((__uint32_t)(addr.sin_addr
.s_addr) & 0xff000000) >> 24) : __swap32md(addr.sin_addr
.s_addr)) + 1) & 0xff) << 24 | ((__uint32_t)((__uint32_t
)(__builtin_constant_p(addr.sin_addr.s_addr) ? (__uint32_t)((
(__uint32_t)(addr.sin_addr.s_addr) & 0xff) << 24 | (
(__uint32_t)(addr.sin_addr.s_addr) & 0xff00) << 8 |
((__uint32_t)(addr.sin_addr.s_addr) & 0xff0000) >>
8 | ((__uint32_t)(addr.sin_addr.s_addr) & 0xff000000) >>
24) : __swap32md(addr.sin_addr.s_addr)) + 1) & 0xff00) <<
8 | ((__uint32_t)((__uint32_t)(__builtin_constant_p(addr.sin_addr
.s_addr) ? (__uint32_t)(((__uint32_t)(addr.sin_addr.s_addr) &
0xff) << 24 | ((__uint32_t)(addr.sin_addr.s_addr) &
0xff00) << 8 | ((__uint32_t)(addr.sin_addr.s_addr) &
0xff0000) >> 8 | ((__uint32_t)(addr.sin_addr.s_addr) &
0xff000000) >> 24) : __swap32md(addr.sin_addr.s_addr))
+ 1) & 0xff0000) >> 8 | ((__uint32_t)((__uint32_t)
(__builtin_constant_p(addr.sin_addr.s_addr) ? (__uint32_t)(((
__uint32_t)(addr.sin_addr.s_addr) & 0xff) << 24 | (
(__uint32_t)(addr.sin_addr.s_addr) & 0xff00) << 8 |
((__uint32_t)(addr.sin_addr.s_addr) & 0xff0000) >>
8 | ((__uint32_t)(addr.sin_addr.s_addr) & 0xff000000) >>
24) : __swap32md(addr.sin_addr.s_addr)) + 1) & 0xff000000
) >> 24) : __swap32md((__uint32_t)(__builtin_constant_p
(addr.sin_addr.s_addr) ? (__uint32_t)(((__uint32_t)(addr.sin_addr
.s_addr) & 0xff) << 24 | ((__uint32_t)(addr.sin_addr
.s_addr) & 0xff00) << 8 | ((__uint32_t)(addr.sin_addr
.s_addr) & 0xff0000) >> 8 | ((__uint32_t)(addr.sin_addr
.s_addr) & 0xff000000) >> 24) : __swap32md(addr.sin_addr
.s_addr)) + 1))
;
2767 }
2768 /*
2769 * XXX No consistent way to differentiate between not found and error
2770 * Treat everything as not found.
2771 */
2772 ka = kr_getnextaddr((struct sockaddr *)&addr);
2773 if (ka == NULL((void *)0) || ka->addr.sa.sa_family != AF_INET2) {
2774 agentx_varbind_notfound(vb);
2775 return;
2776 }
2777 if (req == AGENTX_REQUEST_TYPE_GET) {
2778 if (addr.sin_addr.s_addr !=
2779 ((struct sockaddr_in *)&ka->addr.sa)->sin_addr.s_addr) {
2780 agentx_varbind_notfound(vb);
2781 return;
2782 }
2783 }
2784 agentx_varbind_set_index_ipaddress(vb, ipAdEntAddrIdx,
2785 &((struct sockaddr_in *)&ka->addr.sa)->sin_addr);
2786
2787 if (obj == ipAdEntAddr)
2788 agentx_varbind_ipaddress(vb,
2789 &((struct sockaddr_in *)&ka->addr.sa)->sin_addr);
2790 else if (obj == ipAdEntIfIndex)
2791 agentx_varbind_integer(vb, ka->if_index);
2792 else if (obj == ipAdEntNetMask)
2793 agentx_varbind_ipaddress(vb, &ka->mask.sin.sin_addr);
2794 else if (obj == ipAdEntBcastAddr)
2795 agentx_varbind_integer(vb, ka->dstbrd.sa.sa_len ? 1 : 0);
2796 else if (obj == ipAdEntReasmMaxSize)
2797 agentx_varbind_integer(vb, IP_MAXPACKET65535);
2798 else
2799 fatal("%s: Unexpected object", __func__);
2800}
2801
2802void
2803mib_physaddr(struct agentx_varbind *vb)
2804{
2805 struct agentx_object *obj;
2806 enum agentx_request_type req;
2807 struct sockaddr_in addr;
2808 struct kif *kif;
2809 struct kif_arp *ka;
2810 u_int32_t idx = 0;
2811
2812 obj = agentx_varbind_get_object(vb);
2813 idx = agentx_varbind_get_index_integer(vb, ipNetToMediaIfIdx);
2814 req = agentx_varbind_request(vb);
2815
2816 /* Get the IP address */
2817 bzero(&addr, sizeof(addr));
2818 addr.sin_family = AF_INET2;
2819 addr.sin_len = sizeof(addr);
2820 addr.sin_addr = *agentx_varbind_get_index_ipaddress(vb,
2821 ipNetToMediaNetAddressIdx);
2822
2823 if (req == AGENTX_REQUEST_TYPE_GET ||
2824 req == AGENTX_REQUEST_TYPE_GETNEXTINCLUSIVE) {
2825 if ((ka = karp_getaddr((struct sockaddr *)&addr, idx, 0)) == NULL((void *)0)) {
2826 if (req == AGENTX_REQUEST_TYPE_GET) {
2827 agentx_varbind_notfound(vb);
2828 return;
2829 }
2830 req = AGENTX_REQUEST_TYPE_GETNEXT;
2831 } else {
2832 if (req == AGENTX_REQUEST_TYPE_GET &&
2833 (idx != ka->if_index ||
2834 addr.sin_addr.s_addr !=
2835 ka->addr.sin.sin_addr.s_addr)) {
2836 agentx_varbind_notfound(vb);
2837 return;
2838 }
2839 }
2840 }
2841 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
2842 if ((kif = kr_getif(idx)) == NULL((void *)0)) {
2843 /* No configured interfaces */
2844 if (idx == 0) {
2845 agentx_varbind_notfound(vb);
2846 return;
2847 }
2848 /*
2849 * It may happen that an interface with a specific index
2850 * does not exist or has been removed. Jump to the next
2851 * available interface.
2852 */
2853 kif = kr_getif(0);
2854 nextif:
2855 for (; kif != NULL((void *)0); kif = kr_getnextif(kif->if_index))
2856 if (kif->if_index > idx &&
2857 (ka = karp_first(kif->if_index)) != NULL((void *)0))
2858 break;
2859 if (kif == NULL((void *)0)) {
2860 /* No more interfaces with addresses on them */
2861 agentx_varbind_notfound(vb);
2862 return;
2863 }
2864 } else {
2865 if (idx == 0 || addr.sin_addr.s_addr == 0)
2866 ka = karp_first(kif->if_index);
2867 else {
2868 /* XXX This only works on a walk. */
2869 ka = karp_getaddr((struct sockaddr *)&addr, idx, 1);
2870 }
2871 if (ka == NULL((void *)0)) {
2872 /* Try next interface */
2873 goto nextif;
2874 }
2875 }
2876 }
2877 agentx_varbind_set_index_integer(vb, ipNetToMediaIfIdx, ka->if_index);
2878 agentx_varbind_set_index_ipaddress(vb, ipNetToMediaNetAddressIdx,
2879 &ka->addr.sin.sin_addr);
2880
2881 if (obj == ipNetToMediaIfIndex)
2882 agentx_varbind_integer(vb, ka->if_index);
2883 else if (obj == ipNetToMediaPhysAddress) {
2884 if (bcmp(LLADDR(&ka->target.sdl)((caddr_t)((&ka->target.sdl)->sdl_data + (&ka->
target.sdl)->sdl_nlen))
, ether_zeroaddr,
2885 sizeof(ether_zeroaddr)) == 0)
2886 agentx_varbind_nstring(vb, ether_zeroaddr,
2887 sizeof(ether_zeroaddr));
2888 else
2889 agentx_varbind_nstring(vb, LLADDR(&ka->target.sdl)((caddr_t)((&ka->target.sdl)->sdl_data + (&ka->
target.sdl)->sdl_nlen))
,
2890 ka->target.sdl.sdl_alen);
2891 } else if (obj == ipNetToMediaNetAddress)
2892 agentx_varbind_ipaddress(vb, &ka->addr.sin.sin_addr);
2893 else if (obj == ipNetToMediaType) {
2894 if (ka->flags & F_STATIC0x0002)
2895 agentx_varbind_integer(vb, 4); /* static */
2896 else
2897 agentx_varbind_integer(vb, 3); /* dynamic */
2898 } else
2899 fatal("%s: Unexpected object", __func__);
2900}
2901
2902/*
2903 * Defined in IP-FORWARD-MIB.txt (rfc4292)
2904 */
2905
2906void mib_ipfnroutes(struct agentx_varbind *);
2907//struct ber_oid *
2908//mib_ipfroutetable(struct oid *oid, struct ber_oid *o, struct ber_oid *no);
2909void mib_ipfroute(struct agentx_varbind *);
2910
2911void
2912mib_ipfnroutes(struct agentx_varbind *vb)
2913{
2914 agentx_varbind_gauge32(vb, kr_routenumber());
2915}
2916
2917#define INETADDRESSTYPE_IPV41 1
2918void
2919mib_ipfroute(struct agentx_varbind *vb)
2920{
2921 struct agentx_object *obj;
2922 enum agentx_request_type req;
2923 struct kroute *kr;
2924 const in_addr_t *addr, *nhaddr;
2925 const uint32_t *policy;
2926 size_t alen, plen, nlen;
2927 int af;
2928 int implied;
2929 u_int8_t prefixlen, prio, type, proto;
2930
2931
2932 obj = agentx_varbind_get_object(vb);
2933 req = agentx_varbind_request(vb);
2934 af = agentx_varbind_get_index_integer(vb, inetCidrRouteDestTypeIdx);
2935 addr = (const in_addr_t *)agentx_varbind_get_index_string(vb,
2936 inetCidrRouteDestIdx, &alen, &implied);
2937 prefixlen = agentx_varbind_get_index_integer(vb,
2938 inetCidrRoutePfxLenIdx);
2939 policy = agentx_varbind_get_index_oid(vb, inetCidrRoutePolicyIdx,
2940 &plen, &implied);
2941 nhaddr = ((const in_addr_t *)agentx_varbind_get_index_string(vb,
2942 inetCidrRouteNextHopIdx, &nlen, &implied));
2943
2944 if (plen >= 2)
2945 prio = policy[1];
2946 /* Initial 2 sub-identifiers should always be the same for us */
2947 if (af < INETADDRESSTYPE_IPV41 ||
2948 (af == INETADDRESSTYPE_IPV41 && alen < 4)) {
2949 if (req == AGENTX_REQUEST_TYPE_GET) {
2950 agentx_varbind_notfound(vb);
2951 return;
2952 }
2953 kr = kroute_first();
2954 } else if (af > INETADDRESSTYPE_IPV41 ||
2955 (af == INETADDRESSTYPE_IPV41 && alen > 4)) {
2956 agentx_varbind_notfound(vb);
2957 return;
2958 } else {
2959 /* XXX This only works when requesting known values. */
2960 kr = kroute_getaddr(*addr, prefixlen, prio,
2961 req == AGENTX_REQUEST_TYPE_GETNEXT);
2962 if (kr == NULL((void *)0)) {
2963 agentx_varbind_notfound(vb);
2964 return;
2965 }
2966 if (req == AGENTX_REQUEST_TYPE_GETNEXT)
2967 goto done;
2968 if (nlen < 4) {
2969 if (req == AGENTX_REQUEST_TYPE_GET) {
2970 agentx_varbind_notfound(vb);
2971 return;
2972 }
2973 } else if (nlen > 4) {
2974 kr = kroute_getaddr(*addr, prefixlen, prio, 1);
2975 if (req == AGENTX_REQUEST_TYPE_GET || kr == NULL((void *)0)) {
2976 agentx_varbind_notfound(vb);
2977 return;
2978 }
2979 } else {
2980 if (ntohl(kr->nexthop.s_addr)(__uint32_t)(__builtin_constant_p(kr->nexthop.s_addr) ? (__uint32_t
)(((__uint32_t)(kr->nexthop.s_addr) & 0xff) << 24
| ((__uint32_t)(kr->nexthop.s_addr) & 0xff00) <<
8 | ((__uint32_t)(kr->nexthop.s_addr) & 0xff0000) >>
8 | ((__uint32_t)(kr->nexthop.s_addr) & 0xff000000) >>
24) : __swap32md(kr->nexthop.s_addr))
< ntohl(*nhaddr)(__uint32_t)(__builtin_constant_p(*nhaddr) ? (__uint32_t)(((__uint32_t
)(*nhaddr) & 0xff) << 24 | ((__uint32_t)(*nhaddr) &
0xff00) << 8 | ((__uint32_t)(*nhaddr) & 0xff0000) >>
8 | ((__uint32_t)(*nhaddr) & 0xff000000) >> 24) : __swap32md
(*nhaddr))
) {
2981 if (req == AGENTX_REQUEST_TYPE_GET) {
2982 agentx_varbind_notfound(vb);
2983 return;
2984 }
2985 } else if (ntohl(kr->nexthop.s_addr)(__uint32_t)(__builtin_constant_p(kr->nexthop.s_addr) ? (__uint32_t
)(((__uint32_t)(kr->nexthop.s_addr) & 0xff) << 24
| ((__uint32_t)(kr->nexthop.s_addr) & 0xff00) <<
8 | ((__uint32_t)(kr->nexthop.s_addr) & 0xff0000) >>
8 | ((__uint32_t)(kr->nexthop.s_addr) & 0xff000000) >>
24) : __swap32md(kr->nexthop.s_addr))
> ntohl(*nhaddr)(__uint32_t)(__builtin_constant_p(*nhaddr) ? (__uint32_t)(((__uint32_t
)(*nhaddr) & 0xff) << 24 | ((__uint32_t)(*nhaddr) &
0xff00) << 8 | ((__uint32_t)(*nhaddr) & 0xff0000) >>
8 | ((__uint32_t)(*nhaddr) & 0xff000000) >> 24) : __swap32md
(*nhaddr))
) {
2986 kr = kroute_getaddr(*addr, prefixlen, prio, 1);
2987 if (req == AGENTX_REQUEST_TYPE_GET ||
2988 kr == NULL((void *)0)) {
2989 agentx_varbind_notfound(vb);
2990 return;
2991 }
2992 }
2993
2994 }
2995 }
2996 done:
2997 agentx_varbind_set_index_integer(vb, inetCidrRouteDestTypeIdx,
2998 INETADDRESSTYPE_IPV41);
2999 agentx_varbind_set_index_nstring(vb, inetCidrRouteDestIdx,
3000 (unsigned char *)&kr->prefix.s_addr, 4);
3001 agentx_varbind_set_index_integer(vb, inetCidrRoutePfxLenIdx,
3002 kr->prefixlen);
3003 agentx_varbind_set_index_oid(vb, inetCidrRoutePolicyIdx,
3004 AGENTX_OID(0, kr->priority)(uint32_t []) { 0, kr->priority }, (sizeof((uint32_t []) {
0, kr->priority }) / sizeof(uint32_t))
);
3005 agentx_varbind_set_index_integer(vb, inetCidrRouteNextHopTypeIdx,
3006 INETADDRESSTYPE_IPV41);
3007 agentx_varbind_set_index_nstring(vb, inetCidrRouteNextHopIdx,
3008 (unsigned char *)&kr->nexthop.s_addr, 4);
3009
3010 if (obj == inetCidrRouteIfIndex)
3011 agentx_varbind_integer(vb, kr->if_index);
3012 else if (obj == inetCidrRouteType) {
3013 if (kr->flags & F_REJECT0x0008)
3014 type = 2;
3015 else if (kr->flags & F_BLACKHOLE0x0004)
3016 type = 5;
3017 else if (kr->flags & F_CONNECTED0x0001)
3018 type = 3;
3019 else
3020 type = 4;
3021 agentx_varbind_integer(vb, type);
3022 } else if (obj == inetCidrRouteProto) {
3023 switch (kr->priority) {
3024 case RTP_CONNECTED4:
3025 proto = 2;
3026 break;
3027 case RTP_STATIC8:
3028 proto = 3;
3029 break;
3030 case RTP_OSPF32:
3031 proto = 13;
3032 break;
3033 case RTP_ISIS36:
3034 proto = 9;
3035 break;
3036 case RTP_RIP40:
3037 proto = 8;
3038 break;
3039 case RTP_BGP48:
3040 proto = 14;
3041 break;
3042 default:
3043 if (kr->flags & F_DYNAMIC0x0010)
3044 proto = 4;
3045 else
3046 proto = 1; /* not specified */
3047 break;
3048 }
3049 agentx_varbind_integer(vb, proto);
3050 } else if (obj == inetCidrRouteAge)
3051 agentx_varbind_gauge32(vb, 0);
3052 else if (obj == inetCidrRouteNextHopAS)
3053 agentx_varbind_unsigned32(vb, 0); /* unknown */
3054 else if (obj == inetCidrRouteMetric1)
3055 agentx_varbind_integer(vb, -1);
3056 else if (obj == inetCidrRouteMetric2)
3057 agentx_varbind_integer(vb, -1);
3058 else if (obj == inetCidrRouteMetric3)
3059 agentx_varbind_integer(vb, -1);
3060 else if (obj == inetCidrRouteMetric4)
3061 agentx_varbind_integer(vb, -1);
3062 else if (obj == inetCidrRouteMetric5)
3063 agentx_varbind_integer(vb, -1);
3064 else if (obj == inetCidrRouteStatus)
3065 agentx_varbind_integer(vb, 1); /* XXX */
3066 else
3067 fatal("%s: Unexpected object", __func__);
3068}
3069
3070/*
3071 * Defined in UCD-DISKIO-MIB.txt.
3072 */
3073
3074void mib_diskio(struct agentx_varbind *vb);
3075
3076void
3077mib_diskio(struct agentx_varbind *vb)
3078{
3079 struct agentx_object *obj;
3080 enum agentx_request_type req;
3081 u_int32_t idx;
3082 int mib[] = { CTL_HW6, 0 };
3083 unsigned int diskcount;
3084 struct diskstats *stats;
3085 size_t len;
3086
3087 len = sizeof(diskcount);
3088 mib[1] = HW_DISKCOUNT10;
3089 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), &diskcount, &len, NULL((void *)0), 0) == -1) {
3090 log_warn("sysctl");
3091 agentx_varbind_error(vb);
3092 return;
3093 }
3094
3095 obj = agentx_varbind_get_object(vb);
3096 req = agentx_varbind_request(vb);
3097 idx = agentx_varbind_get_index_integer(vb, diskIOIdx);
3098
3099 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
3100 if (idx == INT32_MAX0x7fffffff) {
3101 agentx_varbind_notfound(vb);
3102 return;
3103 }
3104 idx++;
3105 }
3106 if(idx < 1) {
3107 if (req == AGENTX_REQUEST_TYPE_GET) {
3108 agentx_varbind_notfound(vb);
3109 return;
3110 }
3111 idx = 1;
3112 } else if (idx > diskcount) {
3113 agentx_varbind_notfound(vb);
3114 return;
3115 }
3116 agentx_varbind_set_index_integer(vb, diskIOIdx, idx);
3117
3118 stats = calloc(diskcount, sizeof(*stats));
3119 if (stats == NULL((void *)0)) {
3120 log_warn("malloc");
3121 agentx_varbind_error(vb);
3122 return;
3123 }
3124 /* We know len won't overflow, otherwise calloc() would have failed. */
3125 len = diskcount * sizeof(*stats);
3126 mib[1] = HW_DISKSTATS9;
3127 if (sysctl(mib, nitems(mib)(sizeof((mib)) / sizeof((mib)[0])), stats, &len, NULL((void *)0), 0) == -1) {
3128 log_warn("sysctl");
3129 free(stats);
3130 agentx_varbind_error(vb);
3131 return;
3132 }
3133
3134 if (obj == diskIOIndex)
3135 agentx_varbind_integer(vb, idx);
3136 else if (obj == diskIODevice)
3137 agentx_varbind_string(vb, stats[idx - 1].ds_name);
3138 else if (obj == diskIONRead)
3139 agentx_varbind_counter32(vb,
3140 (u_int32_t)stats[idx - 1].ds_rbytes);
3141 else if (obj == diskIONWritten)
3142 agentx_varbind_counter32(vb,
3143 (u_int32_t)stats[idx - 1].ds_wbytes);
3144 else if (obj == diskIOReads)
3145 agentx_varbind_counter32(vb,
3146 (u_int32_t)stats[idx - 1].ds_rxfer);
3147 else if (obj == diskIOWrites)
3148 agentx_varbind_counter32(vb,
3149 (u_int32_t)stats[idx - 1].ds_wxfer);
3150 else if (obj == diskIONReadX)
3151 agentx_varbind_counter64(vb, stats[idx - 1].ds_rbytes);
3152 else if (obj == diskIONWrittenX)
3153 agentx_varbind_counter64(vb, stats[idx - 1].ds_wbytes);
3154 else
3155 fatal("%s: Unexpected object", __func__);
3156 free(stats);
3157}
3158
3159/*
3160 * Defined in BRIDGE-MIB.txt (rfc1493)
3161 *
3162 * This MIB is required by some NMS to accept the device because
3163 * the RFC says that mostly any network device has to provide this MIB... :(
3164 */
3165
3166void mib_dot1basetype(struct agentx_varbind *);
3167void mib_dot1dtable(struct agentx_varbind *);
3168
3169void
3170mib_dot1basetype(struct agentx_varbind *vb)
3171{
3172 /* srt (sourceroute + transparent) */
3173 agentx_varbind_integer(vb, 4);
3174}
3175
3176void
3177mib_dot1dtable(struct agentx_varbind *vb)
3178{
3179 struct agentx_object *obj;
3180 enum agentx_request_type req;
3181 u_int32_t idx = 0;
3182 struct kif *kif;
3183
3184 obj = agentx_varbind_get_object(vb);
3185 req = agentx_varbind_request(vb);
3186 idx = agentx_varbind_get_index_integer(vb, dot1dBasePortIdx);
3187
3188 if (req == AGENTX_REQUEST_TYPE_GETNEXT) {
3189 if (idx == INT32_MAX0x7fffffff) {
3190 agentx_varbind_notfound(vb);
3191 return;
3192 }
3193 idx++;
3194 }
3195 if ((kif = mib_ifget(idx)) == NULL((void *)0)) {
3196 agentx_varbind_notfound(vb);
3197 return;
3198 }
3199 if (req == AGENTX_REQUEST_TYPE_GET) {
3200 if (idx != kif->if_index) {
3201 agentx_varbind_notfound(vb);
3202 return;
3203 }
3204 }
3205 agentx_varbind_set_index_integer(vb, dot1dBasePortIdx, kif->if_index);
3206
3207 if (obj == dot1dBasePort)
3208 agentx_varbind_integer(vb, kif->if_index);
3209 else if (obj == dot1dBasePortIfIndex)
3210 agentx_varbind_integer(vb, kif->if_index);
3211 else if (obj == dot1dBasePortCircuit)
3212 agentx_varbind_oid(vb, AGENTX_OID(0, 0)(uint32_t []) { 0, 0 }, (sizeof((uint32_t []) { 0, 0 }) / sizeof
(uint32_t))
);
3213 else if (obj == dot1dBasePortDelayExceededDiscards)
3214 agentx_varbind_counter32(vb, 0);
3215 else if (obj == dot1dBasePortMtuExceededDiscards)
3216 agentx_varbind_counter32(vb, 0);
3217 else
3218 fatal("%s: Unexpected object", __func__);
3219}
3220
3221/*
3222 * Import all MIBs
3223 */
3224
3225int
3226main(int argc, char *argv[])
3227{
3228 static struct snmpd conf;
3229 struct agentx *sa;
3230 struct agentx_session *sas;
3231 struct agentx_index *indices[6];
3232 struct passwd *pw;
3233 struct group *gr;
3234 char agentxsocketdir[PATH_MAX1024];
3235 int ch;
3236 int verbose = 0, daemonize = 1, debug = 0;
3237 char *context = NULL((void *)0);
3238 const char *errstr;
3239 /* HOST-RESOURCES-MIB */
3240 struct agentx_region *host;
3241 struct agentx_object *hrSystemUptime, *hrSystemDate, *hrMemorySize;
3242 /* IF-MIB */
3243 struct agentx_region *ifMIB, *interfaces;
3244 /* OPENBSD-PF-MIB */
3245 struct agentx_region *pfMIBObjects;
3246 /* OPENBSD-SENSOR-MIB */
3247 struct agentx_region *sensorsMIBObjects;
3248 /* OPENBSD-CARP-MIB */
3249 struct agentx_region *carpMIBObjects;
3250 /* OPENBSD-MEM-MIB */
3251 struct agentx_region *memMIBObjects;
3252 /* IP-MIB */
3253 struct agentx_region *ip;
3254 /* IP-FORWARD-MIB */
3255 struct agentx_region *ipForward;
3256 /* UCD-DISKIO-MIB */
3257 struct agentx_region *ucdDiskIOMIB;
3258 /* BRIDGE-MIB */
3259 struct agentx_region *dot1dBridge;
3260
3261 snmpd_env = &conf;
3262 log_init(2, LOG_DAEMON(3<<3));
3263
3264 agentx_log_fatal = fatalx;
3265 agentx_log_warn = log_warnx;
3266 agentx_log_info = log_info;
3267 agentx_log_debug = log_debug;
3268
3269 while ((ch = getopt(argc, argv, "C:c:ds:vx:")) != -1) {
3270 switch (ch) {
3271 case 'C':
3272 if (strcmp(optarg, "filter-routes") == 0) {
3273 conf.sc_rtfilter = ROUTE_FILTER(RTM_NEWADDR)(1 << (0xc)) |
3274 ROUTE_FILTER(RTM_DELADDR)(1 << (0xd)) |
3275 ROUTE_FILTER(RTM_IFINFO)(1 << (0xe)) |
3276 ROUTE_FILTER(RTM_IFANNOUNCE)(1 << (0xf));
3277
3278 }
3279 break;
3280 case 'c':
3281 context = optarg;
3282 break;
3283 case 'd':
3284 daemonize = 0;
3285 debug = 1;
3286 break;
3287 case 's':
3288 if (optarg[0] != '/')
3289 fatalx("agentx socket path must be absolute");
3290 agentxsocket = optarg;
3291 break;
3292 case 'v':
3293 verbose++;
3294 break;
3295 case 'x':
3296 /* Undocumented flag for snmpd(8) spawning */
3297 agentxfd = strtonum(optarg, 0, INT_MAX0x7fffffff, &errstr);
3298 if (errstr != NULL((void *)0))
3299 fatalx("invalid agentx fd: %s", errstr);
3300 daemonize = 0;
3301 break;
3302 default:
3303 fatalx("usage: snmpd_metrics [-dv] [-C option] "
3304 "[-c context] [-s master]\n");
3305 }
3306 }
3307
3308 if (agentxfd != -1 && !debug)
3309 /* Initialize syslog logging asap for snmpd */
3310 log_init(0, LOG_DAEMON(3<<3));
3311
3312 if ((pw = getpwnam("_snmpd")) == NULL((void *)0))
3313 fatal("can't find _snmpd user");
3314 if ((gr = getgrnam("_agentx")) == NULL((void *)0))
3315 fatal("can't find _agentx group");
3316
3317 if (agentxfd != -1 && agentxsocket != NULL((void *)0))
3318 fatalx("-s and -x are mutually exclusive");
3319 if (agentxfd == -1 && agentxsocket == NULL((void *)0))
3320 agentxsocket = AGENTX_MASTER_PATH"/var/agentx/master";
3321
3322 event_init();
3323
3324 if ((sa = agentx(snmp_connect, NULL((void *)0))) == NULL((void *)0))
3325 fatal("agentx");
3326 if ((sas = agentx_session(sa, NULL((void *)0), 0, "OpenSNMPd metrics", 0)) == NULL((void *)0))
3327 fatal("agentx_session");
3328 if ((sac = agentx_context(sas, context)) == NULL((void *)0))
3329 fatal("agentx_context");
3330
3331 /* kr_init requires sac */
3332 kr_init();
3333 pf_init();
3334 timer_init();
3335 pageshift_init();
3336
3337 if (agentxsocket != NULL((void *)0)) {
3338 if (strlcpy(agentxsocketdir, agentxsocket,
3339 sizeof(agentxsocketdir)) >= sizeof(agentxsocketdir)) {
3340 errno(*__errno()) = ENAMETOOLONG63;
3341 fatal("-s");
3342 }
3343 if (unveil(dirname(agentxsocketdir), "r") == -1)
3344 fatal("unveil");
3345 }
3346
3347 /* Can't pledge: kvm_getfiles */
3348 if (unveil(NULL((void *)0), NULL((void *)0)) == -1)
3349 fatal("unveil");
3350
3351 if (setgid(gr->gr_gid) == -1)
3352 fatal("setgid");
3353 if (setuid(pw->pw_uid) == -1)
3354 fatal("setuid");
3355
3356 /* HOST-RESOURCES-MIB */
3357 if ((host = agentx_region(sac, AGENTX_OID(HOST)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25 }, (sizeof((uint32_t [])
{ 1, 3, 6, 1, 2, 1, 25 }) / sizeof(uint32_t))
, 0)) == NULL((void *)0))
3358 fatal("agentx_region");
3359
3360 if ((hrSystemUptime = agentx_object(host, AGENTX_OID(HRSYSTEMUPTIME)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 1, 1 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 25, 1, 1 }) / sizeof(uint32_t))
,
3361 NULL((void *)0), 0, 0, mib_hrsystemuptime)) == NULL((void *)0) ||
3362 (hrSystemDate = agentx_object(host, AGENTX_OID(HRSYSTEMDATE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 1, 2 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 25, 1, 2 }) / sizeof(uint32_t))
,
3363 NULL((void *)0), 0, 0, mib_hrsystemdate)) == NULL((void *)0) ||
3364 (hrSystemProcesses = agentx_object(host,
3365 AGENTX_OID(HRSYSTEMPROCESSES)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 1, 6 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 25, 1, 6 }) / sizeof(uint32_t))
, NULL((void *)0), 0, 0,
3366 mib_hrsystemprocs)) == NULL((void *)0) ||
3367 (hrSystemMaxProcesses = agentx_object(host,
3368 AGENTX_OID(HRSYSTEMMAXPROCESSES)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 1, 7 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 25, 1, 7 }) / sizeof(uint32_t))
, NULL((void *)0), 0, 0,
3369 mib_hrsystemprocs)) == NULL((void *)0) ||
3370 (hrMemorySize = agentx_object(host, AGENTX_OID(HRMEMORYSIZE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 2 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 25, 2, 2 }) / sizeof(uint32_t))
,
3371 NULL((void *)0), 0, 0, mib_hrmemory)) == NULL((void *)0))
3372 fatal("agentx_object");
3373
3374 if ((hrStorageIdx = agentx_index_integer_dynamic(host,
3375 AGENTX_OID(HRSTORAGEINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 1 }) / sizeof(uint32_t
))
)) == NULL((void *)0))
3376 fatal("agentx_index_integer_dynamic");
3377 if ((hrStorageIndex = agentx_object(host, AGENTX_OID(HRSTORAGEINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 1 }) / sizeof(uint32_t
))
,
3378 &hrStorageIdx, 1, 0, mib_hrstorage)) == NULL((void *)0) ||
3379 (hrStorageType = agentx_object(host, AGENTX_OID(HRSTORAGETYPE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 2 }) / sizeof(uint32_t
))
,
3380 &hrStorageIdx, 1, 0, mib_hrstorage)) == NULL((void *)0) ||
3381 (hrStorageDescr = agentx_object(host, AGENTX_OID(HRSTORAGEDESCR)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 3 }) / sizeof(uint32_t
))
,
3382 &hrStorageIdx, 1, 0, mib_hrstorage)) == NULL((void *)0) ||
3383 (hrStorageAllocationUnits = agentx_object(host,
3384 AGENTX_OID(HRSTORAGEALLOCATIONUNITS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 4 }) / sizeof(uint32_t
))
, &hrStorageIdx, 1, 0,
3385 mib_hrstorage)) == NULL((void *)0) ||
3386 (hrStorageSize = agentx_object(host, AGENTX_OID(HRSTORAGESIZE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 5 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 5 }) / sizeof(uint32_t
))
,
3387 &hrStorageIdx, 1, 0, mib_hrstorage)) == NULL((void *)0) ||
3388 (hrStorageUsed = agentx_object(host, AGENTX_OID(HRSTORAGEUSED)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 6 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 6 }) / sizeof(uint32_t
))
,
3389 &hrStorageIdx, 1, 0, mib_hrstorage)) == NULL((void *)0) ||
3390 (hrStorageAllocationFailures = agentx_object(host,
3391 AGENTX_OID(HRSTORAGEALLOCATIONFAILURES)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 7 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 2, 3, 1, 7 }) / sizeof(uint32_t
))
, &hrStorageIdx, 1, 0,
3392 mib_hrstorage)) == NULL((void *)0))
3393 fatal("agentx_object");
3394
3395 if ((hrDeviceIdx = agentx_index_integer_dynamic(host,
3396 AGENTX_OID(HRDEVICEINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 1 }) / sizeof(uint32_t
))
)) == NULL((void *)0))
3397 fatal("agentx_index_integer_dynamic");
3398 if ((hrDeviceIndex = agentx_object(host, AGENTX_OID(HRDEVICEINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 1 }) / sizeof(uint32_t
))
,
3399 &hrDeviceIdx, 1, 0, mib_hrdevice)) == NULL((void *)0) ||
3400 (hrDeviceType = agentx_object(host, AGENTX_OID(HRDEVICETYPE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 2 }) / sizeof(uint32_t
))
,
3401 &hrDeviceIdx, 1, 0, mib_hrdevice)) == NULL((void *)0) ||
3402 (hrDeviceDescr = agentx_object(host, AGENTX_OID(HRDEVICEDESCR)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 3 }) / sizeof(uint32_t
))
,
3403 &hrDeviceIdx, 1, 0, mib_hrdevice)) == NULL((void *)0) ||
3404 (hrDeviceID = agentx_object(host, AGENTX_OID(HRDEVICEID)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 4 }) / sizeof(uint32_t
))
,
3405 &hrDeviceIdx, 1, 0, mib_hrdevice)) == NULL((void *)0) ||
3406 (hrDeviceStatus = agentx_object(host, AGENTX_OID(HRDEVICESTATUS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 5 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 5 }) / sizeof(uint32_t
))
,
3407 &hrDeviceIdx, 1, 0, mib_hrdevice)) == NULL((void *)0) ||
3408 (hrDeviceErrors = agentx_object(host, AGENTX_OID(HRDEVICEERRORS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 6 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 2, 1, 6 }) / sizeof(uint32_t
))
,
3409 &hrDeviceIdx, 1, 0, mib_hrdevice)) == NULL((void *)0))
3410 fatal("agentx_object");
3411 if ((hrProcessorFrwID = agentx_object(host, AGENTX_OID(HRPROCESSORFRWID)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 3, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 3, 1, 1 }) / sizeof(uint32_t
))
,
3412 &hrDeviceIdx, 1, 0, mib_hrprocessor)) == NULL((void *)0) ||
3413 (hrProcessorLoad = agentx_object(host, AGENTX_OID(HRPROCESSORLOAD)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 3, 1, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 3, 3, 1, 2 }) / sizeof(uint32_t
))
,
3414 &hrDeviceIdx, 1, 0, mib_hrprocessor)) == NULL((void *)0))
3415 fatal("agentx_object");
3416 if ((hrSWRunIdx = agentx_index_integer_dynamic(host,
3417 AGENTX_OID(HRSWRUNINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 1 }) / sizeof(uint32_t
))
)) == NULL((void *)0))
3418 fatal("agentx_index_integer_dynamic");
3419 if ((hrSWRunIndex = agentx_object(host, AGENTX_OID(HRSWRUNINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 1 }) / sizeof(uint32_t
))
,
3420 &hrSWRunIdx, 1, 0, mib_hrswrun)) == NULL((void *)0) ||
3421 (hrSWRunName = agentx_object(host, AGENTX_OID(HRSWRUNNAME)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 2 }) / sizeof(uint32_t
))
,
3422 &hrSWRunIdx, 1, 0, mib_hrswrun)) == NULL((void *)0) ||
3423 (hrSWRunID = agentx_object(host, AGENTX_OID(HRSWRUNID)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 3 }) / sizeof(uint32_t
))
,
3424 &hrSWRunIdx, 1, 0, mib_hrswrun)) == NULL((void *)0) ||
3425 (hrSWRunPath = agentx_object(host, AGENTX_OID(HRSWRUNPATH)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 4 }) / sizeof(uint32_t
))
,
3426 &hrSWRunIdx, 1, 0, mib_hrswrun)) == NULL((void *)0) ||
3427 (hrSWRunParameters = agentx_object(host,
3428 AGENTX_OID(HRSWRUNPARAMETERS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 5 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 5 }) / sizeof(uint32_t
))
, &hrSWRunIdx, 1, 0,
3429 mib_hrswrun)) == NULL((void *)0) ||
3430 (hrSWRunType = agentx_object(host, AGENTX_OID(HRSWRUNTYPE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 6 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 6 }) / sizeof(uint32_t
))
,
3431 &hrSWRunIdx, 1, 0, mib_hrswrun)) == NULL((void *)0) ||
3432 (hrSWRunStatus = agentx_object(host, AGENTX_OID(HRSWRUNSTATUS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 7 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 4, 2, 1, 7 }) / sizeof(uint32_t
))
,
3433 &hrSWRunIdx, 1, 0, mib_hrswrun)) == NULL((void *)0) ||
3434 (hrSWRunPerfCPU = agentx_object(host, AGENTX_OID(HRSWRUNPERFCPU)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 5, 1, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 5, 1, 1, 1 }) / sizeof(uint32_t
))
,
3435 &hrSWRunIdx, 1, 0, mib_hrswrun)) == NULL((void *)0) ||
3436 (hrSWRunPerfMem = agentx_object(host, AGENTX_OID(HRSWRUNPERFMEM)(uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 5, 1, 1, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 25, 5, 1, 1, 2 }) / sizeof(uint32_t
))
,
3437 &hrSWRunIdx, 1, 0, mib_hrswrun)) == NULL((void *)0))
3438 fatal("agentx_object");
3439
3440 /* IF-MIB */
3441 if ((ifMIB = agentx_region(sac, AGENTX_OID(IFMIB)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31 }, (sizeof((uint32_t [])
{ 1, 3, 6, 1, 2, 1, 31 }) / sizeof(uint32_t))
, 0)) == NULL((void *)0) ||
3442 (interfaces = agentx_region(sac,
3443 AGENTX_OID(INTERFACES)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2 }, (sizeof((uint32_t []) {
1, 3, 6, 1, 2, 1, 2 }) / sizeof(uint32_t))
, 0)) == NULL((void *)0))
3444 fatal("agentx_region");
3445
3446 if ((ifIdx = agentx_index_integer_dynamic(interfaces,
3447 AGENTX_OID(IFINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 1 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 1 }) / sizeof(uint32_t))
)) == NULL((void *)0))
3448 fatal("agentx_index_integer_dynamic");
3449 if ((ifName = agentx_object(ifMIB, AGENTX_OID(IFNAME)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 1 }) / sizeof(uint32_t
))
,
3450 &ifIdx, 1, 0, mib_ifxtable)) == NULL((void *)0) ||
3451 (ifInMulticastPkts = agentx_object(ifMIB,
3452 AGENTX_OID(IFINMULTICASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 2 }) / sizeof(uint32_t
))
, &ifIdx, 1, 0,
3453 mib_ifxtable)) == NULL((void *)0) ||
3454 (ifInBroadcastPkts = agentx_object(ifMIB,
3455 AGENTX_OID(IFINBROADCASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 3 }) / sizeof(uint32_t
))
, &ifIdx, 1, 0,
3456 mib_ifxtable)) == NULL((void *)0) ||
3457 (ifOutMulticastPkts = agentx_object(ifMIB,
3458 AGENTX_OID(IFOUTMULTICASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 4 }) / sizeof(uint32_t
))
, &ifIdx, 1, 0,
3459 mib_ifxtable)) == NULL((void *)0) ||
3460 (ifOutBroadcastPkts = agentx_object(ifMIB,
3461 AGENTX_OID(IFOUTBROADCASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 5 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 5 }) / sizeof(uint32_t
))
, &ifIdx, 1, 0,
3462 mib_ifxtable)) == NULL((void *)0) ||
3463 (ifHCInOctets = agentx_object(ifMIB, AGENTX_OID(IFHCINOCTETS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 6 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 6 }) / sizeof(uint32_t
))
,
3464 &ifIdx, 1, 0, mib_ifxtable)) == NULL((void *)0) ||
3465 (ifHCInUcastPkts = agentx_object(ifMIB, AGENTX_OID(IFHCINUCASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 7 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 7 }) / sizeof(uint32_t
))
,
3466 &ifIdx, 1, 0, mib_ifxtable)) == NULL((void *)0) ||
3467 (ifHCInMulticastPkts = agentx_object(ifMIB,
3468 AGENTX_OID(IFHCINMULTICASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 8 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 8 }) / sizeof(uint32_t
))
, &ifIdx, 1, 0,
3469 mib_ifxtable)) == NULL((void *)0) ||
3470 (ifHCInBroadcastPkts = agentx_object(ifMIB,
3471 AGENTX_OID(IFHCINBROADCASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 9 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 9 }) / sizeof(uint32_t
))
, &ifIdx, 1, 0,
3472 mib_ifxtable)) == NULL((void *)0) ||
3473 (ifHCOutOctets = agentx_object(ifMIB, AGENTX_OID(IFHCOUTOCTETS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 10 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 10 }) / sizeof
(uint32_t))
,
3474 &ifIdx, 1, 0, mib_ifxtable)) == NULL((void *)0) ||
3475 (ifHCOutUcastPkts = agentx_object(ifMIB,
3476 AGENTX_OID(IFHCOUTUCASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 11 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 11 }) / sizeof
(uint32_t))
, &ifIdx, 1, 0,
3477 mib_ifxtable)) == NULL((void *)0) ||
3478 (ifHCOutMulticastPkts = agentx_object(ifMIB,
3479 AGENTX_OID(IFHCOUTMULTICASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 12 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 12 }) / sizeof
(uint32_t))
, &ifIdx, 1, 0,
3480 mib_ifxtable)) == NULL((void *)0) ||
3481 (ifHCOutBroadcastPkts = agentx_object(ifMIB,
3482 AGENTX_OID(IFHCOUTBROADCASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 13 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 13 }) / sizeof
(uint32_t))
, &ifIdx, 1, 0,
3483 mib_ifxtable)) == NULL((void *)0) ||
3484 (ifLinkUpDownTrapEnable = agentx_object(ifMIB,
3485 AGENTX_OID(IFLINKUPDOWNTRAPENABLE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 14 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 14 }) / sizeof
(uint32_t))
, &ifIdx, 1, 0,
3486 mib_ifxtable)) == NULL((void *)0) ||
3487 (ifHighSpeed = agentx_object(ifMIB, AGENTX_OID(IFHIGHSPEED)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 15 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 15 }) / sizeof
(uint32_t))
,
3488 &ifIdx, 1, 0, mib_ifxtable)) == NULL((void *)0) ||
3489 (ifPromiscuousMode = agentx_object(ifMIB,
3490 AGENTX_OID(IFPROMISCUOUSMODE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 16 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 16 }) / sizeof
(uint32_t))
, &ifIdx, 1, 0,
3491 mib_ifxtable)) == NULL((void *)0) ||
3492 (ifConnectorPresent = agentx_object(ifMIB,
3493 AGENTX_OID(IFCONNECTORPRESENT)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 17 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 17 }) / sizeof
(uint32_t))
, &ifIdx, 1, 0,
3494 mib_ifxtable)) == NULL((void *)0) ||
3495 (ifAlias = agentx_object(ifMIB, AGENTX_OID(IFALIAS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 18 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 18 }) / sizeof
(uint32_t))
,
3496 &ifIdx, 1, 0, mib_ifxtable)) == NULL((void *)0) ||
3497 (ifCounterDiscontinuityTime = agentx_object(ifMIB,
3498 AGENTX_OID(IFCOUNTERDISCONTINUITYTIME)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 19 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 19 }) / sizeof
(uint32_t))
, &ifIdx, 1, 0,
3499 mib_ifxtable)) == NULL((void *)0))
3500 fatal("agentx_object");
3501
3502 if ((ifRcvAddressAddress = agentx_index_string_dynamic(ifMIB,
3503 AGENTX_OID(IFRCVADDRESSADDRESS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 4, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 4, 1, 1 }) / sizeof(uint32_t
))
)) == NULL((void *)0))
3504 fatal("agentx_index_string_dynamic");
3505 indices[0] = ifIdx;
3506 indices[1] = ifRcvAddressAddress;
3507 if ((ifRcvAddressStatus = agentx_object(ifMIB,
3508 AGENTX_OID(IFRCVADDRESSSTATUS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 4, 1, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 4, 1, 2 }) / sizeof(uint32_t
))
, indices, 2, 0,
3509 mib_ifrcvtable)) == NULL((void *)0) ||
3510 (ifRcvAddressType = agentx_object(ifMIB,
3511 AGENTX_OID(IFRCVADDRESSTYPE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 4, 1, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 4, 1, 3 }) / sizeof(uint32_t
))
, indices, 2, 0,
3512 mib_ifrcvtable)) == NULL((void *)0))
3513 fatal("agentx_object");
3514
3515 if ((ifStackLastChange = agentx_object(ifMIB,
3516 AGENTX_OID(IFSTACKLASTCHANGE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 31, 1, 6 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 31, 1, 6 }) / sizeof(uint32_t))
, NULL((void *)0), 0, 0,
3517 mib_ifstacklast)) == NULL((void *)0))
3518 fatal("agentx_object");
3519
3520 if ((ifNumber = agentx_object(interfaces, AGENTX_OID(IFNUMBER)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 1 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 2, 1 }) / sizeof(uint32_t))
,
3521 NULL((void *)0), 0, 0, mib_ifnumber)) == NULL((void *)0))
3522 fatal("agentx_object");
3523
3524 if ((ifIndex = agentx_object(interfaces, AGENTX_OID(IFINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 1 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 1 }) / sizeof(uint32_t))
,
3525 &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3526 (ifDescr = agentx_object(interfaces, AGENTX_OID(IFDESCR)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 2 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 2 }) / sizeof(uint32_t))
,
3527 &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3528 (ifType = agentx_object(interfaces, AGENTX_OID(IFTYPE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 3 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 3 }) / sizeof(uint32_t))
,
3529 &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3530 (ifMtu = agentx_object(interfaces, AGENTX_OID(IFMTU)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 4 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 4 }) / sizeof(uint32_t))
,
3531 &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3532 (ifSpeed = agentx_object(interfaces, AGENTX_OID(IFSPEED)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 5 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 5 }) / sizeof(uint32_t))
,
3533 &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3534 (ifPhysAddress = agentx_object(interfaces,
3535 AGENTX_OID(IFPHYSADDRESS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 6 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 6 }) / sizeof(uint32_t))
, &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3536 (ifAdminStatus = agentx_object(interfaces,
3537 AGENTX_OID(IFADMINSTATUS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 7 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 7 }) / sizeof(uint32_t))
, &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3538 (ifOperStatus = agentx_object(interfaces,
3539 AGENTX_OID(IFOPERSTATUS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 8 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 8 }) / sizeof(uint32_t))
, &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3540 (ifLastChange = agentx_object(interfaces,
3541 AGENTX_OID(IFLASTCHANGE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 9 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 9 }) / sizeof(uint32_t))
, &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3542 (ifInOctets = agentx_object(interfaces, AGENTX_OID(IFINOCTETS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 10 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 10 }) / sizeof(uint32_t))
,
3543 &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3544 (ifInUcastPkts = agentx_object(interfaces,
3545 AGENTX_OID(IFINUCASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 11 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 11 }) / sizeof(uint32_t))
, &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3546 (ifInNUcastPkts = agentx_object(interfaces,
3547 AGENTX_OID(IFINNUCASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 12 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 12 }) / sizeof(uint32_t))
, &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3548 (ifInDiscards = agentx_object(interfaces,
3549 AGENTX_OID(IFINDISCARDS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 13 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 13 }) / sizeof(uint32_t))
, &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3550 (ifInErrors = agentx_object(interfaces, AGENTX_OID(IFINERRORS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 14 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 14 }) / sizeof(uint32_t))
,
3551 &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3552 (ifInUnknownProtos = agentx_object(interfaces,
3553 AGENTX_OID(IFINUNKNOWNPROTOS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 15 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 15 }) / sizeof(uint32_t))
, &ifIdx, 1, 0,
3554 mib_iftable)) == NULL((void *)0) ||
3555 (ifOutOctets = agentx_object(interfaces, AGENTX_OID(IFOUTOCTETS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 16 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 16 }) / sizeof(uint32_t))
,
3556 &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3557 (ifOutUcastPkts = agentx_object(interfaces,
3558 AGENTX_OID(IFOUTUCASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 17 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 17 }) / sizeof(uint32_t))
, &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3559 (ifOutNUcastPkts = agentx_object(interfaces,
3560 AGENTX_OID(IFOUTNUCASTPKTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 18 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 18 }) / sizeof(uint32_t))
, &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3561 (ifOutDiscards = agentx_object(interfaces,
3562 AGENTX_OID(IFOUTDISCARDS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 19 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 19 }) / sizeof(uint32_t))
, &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3563 (ifOutErrors = agentx_object(interfaces, AGENTX_OID(IFOUTERRORS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 20 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 20 }) / sizeof(uint32_t))
,
3564 &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3565 (ifOutQLen = agentx_object(interfaces, AGENTX_OID(IFOUTQLEN)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 21 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 21 }) / sizeof(uint32_t))
,
3566 &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0) ||
3567 (ifSpecific = agentx_object(interfaces, AGENTX_OID(IFSPECIFIC)(uint32_t []) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 22 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 2, 2, 1, 22 }) / sizeof(uint32_t))
,
3568 &ifIdx, 1, 0, mib_iftable)) == NULL((void *)0))
3569 fatal("agentx_object");
3570
3571 /* OPENBSD-PF-MIB */
3572 if ((pfMIBObjects = agentx_region(sac,
3573 AGENTX_OID(PFMIBOBJECTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 4, 1, 30155, 1 }) / sizeof(uint32_t))
, 0)) == NULL((void *)0))
3574 fatal("agentx_region");
3575 if ((pfRunning = agentx_object(pfMIBObjects, AGENTX_OID(PFRUNNING)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 1, 1 }) / sizeof(uint32_t
))
,
3576 NULL((void *)0), 0, 0, mib_pfinfo)) == NULL((void *)0) ||
3577 (pfRuntime = agentx_object(pfMIBObjects, AGENTX_OID(PFRUNTIME)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 1, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 1, 2 }) / sizeof(uint32_t
))
,
3578 NULL((void *)0), 0, 0, mib_pfinfo)) == NULL((void *)0) ||
3579 (pfDebug = agentx_object(pfMIBObjects, AGENTX_OID(PFDEBUG)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 1, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 1, 3 }) / sizeof(uint32_t
))
,
3580 NULL((void *)0), 0, 0, mib_pfinfo)) == NULL((void *)0) ||
3581 (pfHostid = agentx_object(pfMIBObjects, AGENTX_OID(PFHOSTID)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 1, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 1, 4 }) / sizeof(uint32_t
))
,
3582 NULL((void *)0), 0, 0, mib_pfinfo)) == NULL((void *)0))
3583 fatal("agentx_object");
3584
3585 if ((pfCntMatch = agentx_object(pfMIBObjects, AGENTX_OID(PFCNTMATCH)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 1 }) / sizeof(uint32_t
))
,
3586 NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3587 (pfCntBadOffset = agentx_object(pfMIBObjects,
3588 AGENTX_OID(PFCNTBADOFFSET)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 2 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3589 (pfCntFragment = agentx_object(pfMIBObjects,
3590 AGENTX_OID(PFCNTFRAGMENT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 3 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3591 (pfCntShort = agentx_object(pfMIBObjects, AGENTX_OID(PFCNTSHORT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 4 }) / sizeof(uint32_t
))
,
3592 NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3593 (pfCntNormalize = agentx_object(pfMIBObjects,
3594 AGENTX_OID(PFCNTNORMALIZE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 5 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 5 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3595 (pfCntMemory = agentx_object(pfMIBObjects, AGENTX_OID(PFCNTMEMORY)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 6 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 6 }) / sizeof(uint32_t
))
,
3596 NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3597 (pfCntTimestamp = agentx_object(pfMIBObjects,
3598 AGENTX_OID(PFCNTTIMESTAMP)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 7 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 7 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3599 (pfCntCongestion = agentx_object(pfMIBObjects,
3600 AGENTX_OID(PFCNTCONGESTION)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 8 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 8 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3601 (pfCntIpOption = agentx_object(pfMIBObjects,
3602 AGENTX_OID(PFCNTIPOPTION)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 9 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 9 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3603 (pfCntProtoCksum = agentx_object(pfMIBObjects,
3604 AGENTX_OID(PFCNTPROTOCKSUM)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 10 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 10 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3605 (pfCntStateMismatch = agentx_object(pfMIBObjects,
3606 AGENTX_OID(PFCNTSTATEMISMATCH)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 11 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 11 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3607 mib_pfcounters)) == NULL((void *)0) ||
3608 (pfCntStateInsert = agentx_object(pfMIBObjects,
3609 AGENTX_OID(PFCNTSTATEINSERT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 12 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 12 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3610 mib_pfcounters)) == NULL((void *)0) ||
3611 (pfCntStateLimit = agentx_object(pfMIBObjects,
3612 AGENTX_OID(PFCNTSTATELIMIT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 13 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 13 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3613 (pfCntSrcLimit = agentx_object(pfMIBObjects,
3614 AGENTX_OID(PFCNTSRCLIMIT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 14 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 14 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3615 (pfCntSynproxy = agentx_object(pfMIBObjects,
3616 AGENTX_OID(PFCNTSYNPROXY)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 15 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 15 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3617 (pfCntTranslate = agentx_object(pfMIBObjects,
3618 AGENTX_OID(PFCNTTRANSLATE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 16 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 16 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0) ||
3619 (pfCntNoRoute = agentx_object(pfMIBObjects,
3620 AGENTX_OID(PFCNTNOROUTE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 17 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 2, 17 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0, mib_pfcounters)) == NULL((void *)0))
3621 fatal("agentx_object");
3622
3623 if ((pfStateCount = agentx_object(pfMIBObjects,
3624 AGENTX_OID(PFSTATECOUNT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 1 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pfscounters)) == NULL((void *)0) ||
3625 (pfStateSearches = agentx_object(pfMIBObjects,
3626 AGENTX_OID(PFSTATESEARCHES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 2 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3627 mib_pfscounters)) == NULL((void *)0) ||
3628 (pfStateInserts = agentx_object(pfMIBObjects,
3629 AGENTX_OID(PFSTATEINSERTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 3 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pfscounters)) == NULL((void *)0) ||
3630 (pfStateRemovals = agentx_object(pfMIBObjects,
3631 AGENTX_OID(PFSTATEREMOVALS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 3, 4 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pfscounters)) == NULL((void *)0))
3632 fatal("agentx_object");
3633
3634 if ((pfLogIfName = agentx_object(pfMIBObjects, AGENTX_OID(PFLOGIFNAME)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 1 }) / sizeof(uint32_t
))
,
3635 NULL((void *)0), 0, 0, mib_pflogif)) == NULL((void *)0) ||
3636 (pfLogIfIpBytesIn = agentx_object(pfMIBObjects,
3637 AGENTX_OID(PFLOGIFIPBYTESIN)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 2 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pflogif)) == NULL((void *)0) ||
3638 (pfLogIfIpBytesOut = agentx_object(pfMIBObjects,
3639 AGENTX_OID(PFLOGIFIPBYTESOUT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 3 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pflogif)) == NULL((void *)0) ||
3640 (pfLogIfIpPktsInPass = agentx_object(pfMIBObjects,
3641 AGENTX_OID(PFLOGIFIPPKTSINPASS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 4 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3642 mib_pflogif)) == NULL((void *)0) ||
3643 (pfLogIfIpPktsInDrop = agentx_object(pfMIBObjects,
3644 AGENTX_OID(PFLOGIFIPPKTSINDROP)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 5 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 5 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3645 mib_pflogif)) == NULL((void *)0) ||
3646 (pfLogIfIpPktsOutPass = agentx_object(pfMIBObjects,
3647 AGENTX_OID(PFLOGIFIPPKTSOUTPASS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 6 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 6 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3648 mib_pflogif)) == NULL((void *)0) ||
3649 (pfLogIfIpPktsOutDrop = agentx_object(pfMIBObjects,
3650 AGENTX_OID(PFLOGIFIPPKTSOUTDROP)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 7 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 7 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3651 mib_pflogif)) == NULL((void *)0) ||
3652 (pfLogIfIp6BytesIn = agentx_object(pfMIBObjects,
3653 AGENTX_OID(PFLOGIFIP6BYTESIN)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 8 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 8 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pflogif)) == NULL((void *)0) ||
3654 (pfLogIfIp6BytesOut = agentx_object(pfMIBObjects,
3655 AGENTX_OID(PFLOGIFIP6BYTESOUT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 9 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 9 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pflogif)) == NULL((void *)0) ||
3656 (pfLogIfIp6PktsInPass = agentx_object(pfMIBObjects,
3657 AGENTX_OID(PFLOGIFIP6PKTSINPASS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 10 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 10 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3658 mib_pflogif)) == NULL((void *)0) ||
3659 (pfLogIfIp6PktsInDrop = agentx_object(pfMIBObjects,
3660 AGENTX_OID(PFLOGIFIP6PKTSINDROP)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 11 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 11 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3661 mib_pflogif)) == NULL((void *)0) ||
3662 (pfLogIfIp6PktsOutPass = agentx_object(pfMIBObjects,
3663 AGENTX_OID(PFLOGIFIP6PKTSOUTPASS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 12 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 12 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3664 mib_pflogif)) == NULL((void *)0) ||
3665 (pfLogIfIp6PktsOutDrop = agentx_object(pfMIBObjects,
3666 AGENTX_OID(PFLOGIFIP6PKTSOUTDROP)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 13 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 4, 13 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3667 mib_pflogif)) == NULL((void *)0))
3668 fatal("agentx_object");
3669
3670 if ((pfSrcTrackCount = agentx_object(pfMIBObjects,
3671 AGENTX_OID(PFSRCTRACKCOUNT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 1 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pfsrctrack)) == NULL((void *)0) ||
3672 (pfSrcTrackSearches = agentx_object(pfMIBObjects,
3673 AGENTX_OID(PFSRCTRACKSEARCHES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 2 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3674 mib_pfsrctrack)) == NULL((void *)0) ||
3675 (pfSrcTrackInserts = agentx_object(pfMIBObjects,
3676 AGENTX_OID(PFSRCTRACKINSERTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 3 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3677 mib_pfsrctrack)) == NULL((void *)0) ||
3678 (pfSrcTrackRemovals = agentx_object(pfMIBObjects,
3679 AGENTX_OID(PFSRCTRACKREMOVALS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 5, 4 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3680 mib_pfsrctrack)) == NULL((void *)0))
3681 fatal("agentx_object");
3682
3683 if ((pfLimitStates = agentx_object(pfMIBObjects,
3684 AGENTX_OID(PFLIMITSTATES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 1 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pflimits)) == NULL((void *)0) ||
3685 (pfLimitSourceNodes = agentx_object(pfMIBObjects,
3686 AGENTX_OID(PFLIMITSOURCENODES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 2 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3687 mib_pflimits)) == NULL((void *)0) ||
3688 (pfLimitFragments = agentx_object(pfMIBObjects,
3689 AGENTX_OID(PFLIMITFRAGMENTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 3 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pflimits)) == NULL((void *)0) ||
3690 (pfLimitMaxTables = agentx_object(pfMIBObjects,
3691 AGENTX_OID(PFLIMITMAXTABLES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 4 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_pflimits)) == NULL((void *)0) ||
3692 (pfLimitMaxTableEntries = agentx_object(pfMIBObjects,
3693 AGENTX_OID(PFLIMITMAXTABLEENTRIES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 5 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 6, 5 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3694 mib_pflimits)) == NULL((void *)0))
3695 fatal("agentx_object");
3696
3697 if ((pfTimeoutTcpFirst = agentx_object(pfMIBObjects,
3698 AGENTX_OID(PFTIMEOUTTCPFIRST)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 1 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3699 mib_pftimeouts)) == NULL((void *)0) ||
3700 (pfTimeoutTcpOpening = agentx_object(pfMIBObjects,
3701 AGENTX_OID(PFTIMEOUTTCPOPENING)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 2 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3702 mib_pftimeouts)) == NULL((void *)0) ||
3703 (pfTimeoutTcpEstablished = agentx_object(pfMIBObjects,
3704 AGENTX_OID(PFTIMEOUTTCPESTABLISHED)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 3 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3705 mib_pftimeouts)) == NULL((void *)0) ||
3706 (pfTimeoutTcpClosing = agentx_object(pfMIBObjects,
3707 AGENTX_OID(PFTIMEOUTTCPCLOSING)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 4 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3708 mib_pftimeouts)) == NULL((void *)0) ||
3709 (pfTimeoutTcpFinWait = agentx_object(pfMIBObjects,
3710 AGENTX_OID(PFTIMEOUTTCPFINWAIT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 5 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 5 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3711 mib_pftimeouts)) == NULL((void *)0) ||
3712 (pfTimeoutTcpClosed = agentx_object(pfMIBObjects,
3713 AGENTX_OID(PFTIMEOUTTCPCLOSED)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 6 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 6 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3714 mib_pftimeouts)) == NULL((void *)0) ||
3715 (pfTimeoutUdpFirst = agentx_object(pfMIBObjects,
3716 AGENTX_OID(PFTIMEOUTUDPFIRST)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 7 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 7 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3717 mib_pftimeouts)) == NULL((void *)0) ||
3718 (pfTimeoutUdpSingle = agentx_object(pfMIBObjects,
3719 AGENTX_OID(PFTIMEOUTUDPSINGLE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 8 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 8 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3720 mib_pftimeouts)) == NULL((void *)0) ||
3721 (pfTimeoutUdpMultiple = agentx_object(pfMIBObjects,
3722 AGENTX_OID(PFTIMEOUTUDPMULTIPLE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 9 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 9 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
3723 mib_pftimeouts)) == NULL((void *)0) ||
3724 (pfTimeoutIcmpFirst = agentx_object(pfMIBObjects,
3725 AGENTX_OID(PFTIMEOUTICMPFIRST)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 10 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 10 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3726 mib_pftimeouts)) == NULL((void *)0) ||
3727 (pfTimeoutIcmpError = agentx_object(pfMIBObjects,
3728 AGENTX_OID(PFTIMEOUTICMPERROR)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 11 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 11 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3729 mib_pftimeouts)) == NULL((void *)0) ||
3730 (pfTimeoutOtherFirst = agentx_object(pfMIBObjects,
3731 AGENTX_OID(PFTIMEOUTOTHERFIRST)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 12 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 12 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3732 mib_pftimeouts)) == NULL((void *)0) ||
3733 (pfTimeoutOtherSingle = agentx_object(pfMIBObjects,
3734 AGENTX_OID(PFTIMEOUTOTHERSINGLE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 13 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 13 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3735 mib_pftimeouts)) == NULL((void *)0) ||
3736 (pfTimeoutOtherMultiple = agentx_object(pfMIBObjects,
3737 AGENTX_OID(PFTIMEOUTOTHERMULTIPLE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 14 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 14 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3738 mib_pftimeouts)) == NULL((void *)0) ||
3739 (pfTimeoutFragment = agentx_object(pfMIBObjects,
3740 AGENTX_OID(PFTIMEOUTFRAGMENT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 15 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 15 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3741 mib_pftimeouts)) == NULL((void *)0) ||
3742 (pfTimeoutInterval = agentx_object(pfMIBObjects,
3743 AGENTX_OID(PFTIMEOUTINTERVAL)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 16 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 16 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3744 mib_pftimeouts)) == NULL((void *)0) ||
3745 (pfTimeoutAdaptiveStart = agentx_object(pfMIBObjects,
3746 AGENTX_OID(PFTIMEOUTADAPTIVESTART)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 17 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 17 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3747 mib_pftimeouts)) == NULL((void *)0) ||
3748 (pfTimeoutAdaptiveEnd = agentx_object(pfMIBObjects,
3749 AGENTX_OID(PFTIMEOUTADAPTIVEEND)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 18 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 18 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3750 mib_pftimeouts)) == NULL((void *)0) ||
3751 (pfTimeoutSrcTrack = agentx_object(pfMIBObjects,
3752 AGENTX_OID(PFTIMEOUTSRCTRACK)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 19 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 7, 19 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3753 mib_pftimeouts)) == NULL((void *)0))
3754 fatal("agentx_object");
3755
3756 if ((pfIfNumber = agentx_object(pfMIBObjects, AGENTX_OID(PFIFNUMBER)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 1 }) / sizeof(uint32_t
))
,
3757 NULL((void *)0), 0, 0, mib_pfifnum)) == NULL((void *)0))
3758 fatal("agentx_object");
3759 if ((pfIfIdx = agentx_index_integer_dynamic(pfMIBObjects,
3760 AGENTX_OID(PFIFINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 1 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
1 }) / sizeof(uint32_t))
)) == NULL((void *)0))
3761 fatal("agentx_index_integer_dynamic");
3762 if ((pfIfIndex = agentx_object(pfMIBObjects, AGENTX_OID(PFIFINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 1 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
1 }) / sizeof(uint32_t))
,
3763 &pfIfIdx, 1, 0, mib_pfiftable)) == NULL((void *)0) ||
3764 (pfIfDescr = agentx_object(pfMIBObjects, AGENTX_OID(PFIFDESCR)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 2 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
2 }) / sizeof(uint32_t))
,
3765 &pfIfIdx, 1, 0, mib_pfiftable)) == NULL((void *)0) ||
3766 (pfIfType = agentx_object(pfMIBObjects, AGENTX_OID(PFIFTYPE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 3 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
3 }) / sizeof(uint32_t))
,
3767 &pfIfIdx, 1, 0, mib_pfiftable)) == NULL((void *)0) ||
3768 (pfIfRefs = agentx_object(pfMIBObjects, AGENTX_OID(PFIFREFS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 4 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
4 }) / sizeof(uint32_t))
,
3769 &pfIfIdx, 1, 0, mib_pfiftable)) == NULL((void *)0) ||
3770 (pfIfRules = agentx_object(pfMIBObjects, AGENTX_OID(PFIFRULES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 5 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
5 }) / sizeof(uint32_t))
,
3771 &pfIfIdx, 1, 0, mib_pfiftable)) == NULL((void *)0) ||
3772 (pfIfIn4PassPkts = agentx_object(pfMIBObjects,
3773 AGENTX_OID(PFIFIN4PASSPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 6 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
6 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3774 mib_pfiftable)) == NULL((void *)0) ||
3775 (pfIfIn4PassBytes = agentx_object(pfMIBObjects,
3776 AGENTX_OID(PFIFIN4PASSBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 7 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
7 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3777 mib_pfiftable)) == NULL((void *)0) ||
3778 (pfIfIn4BlockPkts = agentx_object(pfMIBObjects,
3779 AGENTX_OID(PFIFIN4BLOCKPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 8 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
8 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3780 mib_pfiftable)) == NULL((void *)0) ||
3781 (pfIfIn4BlockBytes = agentx_object(pfMIBObjects,
3782 AGENTX_OID(PFIFIN4BLOCKBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 9 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
9 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3783 mib_pfiftable)) == NULL((void *)0) ||
3784 (pfIfOut4PassPkts = agentx_object(pfMIBObjects,
3785 AGENTX_OID(PFIFOUT4PASSPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 10 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
10 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3786 mib_pfiftable)) == NULL((void *)0) ||
3787 (pfIfOut4PassBytes = agentx_object(pfMIBObjects,
3788 AGENTX_OID(PFIFOUT4PASSBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 11 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
11 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3789 mib_pfiftable)) == NULL((void *)0) ||
3790 (pfIfOut4BlockPkts = agentx_object(pfMIBObjects,
3791 AGENTX_OID(PFIFOUT4BLOCKPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 12 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
12 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3792 mib_pfiftable)) == NULL((void *)0) ||
3793 (pfIfOut4BlockBytes = agentx_object(pfMIBObjects,
3794 AGENTX_OID(PFIFOUT4BLOCKBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 13 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
13 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3795 mib_pfiftable)) == NULL((void *)0) ||
3796 (pfIfIn6PassPkts = agentx_object(pfMIBObjects,
3797 AGENTX_OID(PFIFIN6PASSPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 14 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
14 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3798 mib_pfiftable)) == NULL((void *)0) ||
3799 (pfIfIn6PassBytes = agentx_object(pfMIBObjects,
3800 AGENTX_OID(PFIFIN6PASSBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 15 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
15 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3801 mib_pfiftable)) == NULL((void *)0) ||
3802 (pfIfIn6BlockPkts = agentx_object(pfMIBObjects,
3803 AGENTX_OID(PFIFIN6BLOCKPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 16 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
16 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3804 mib_pfiftable)) == NULL((void *)0) ||
3805 (pfIfIn6BlockBytes = agentx_object(pfMIBObjects,
3806 AGENTX_OID(PFIFIN6BLOCKBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 17 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
17 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3807 mib_pfiftable)) == NULL((void *)0) ||
3808 (pfIfOut6PassPkts = agentx_object(pfMIBObjects,
3809 AGENTX_OID(PFIFOUT6PASSPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 18 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
18 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3810 mib_pfiftable)) == NULL((void *)0) ||
3811 (pfIfOut6PassBytes = agentx_object(pfMIBObjects,
3812 AGENTX_OID(PFIFOUT6PASSBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 19 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
19 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3813 mib_pfiftable)) == NULL((void *)0) ||
3814 (pfIfOut6BlockPkts = agentx_object(pfMIBObjects,
3815 AGENTX_OID(PFIFOUT6BLOCKPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 20 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
20 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3816 mib_pfiftable)) == NULL((void *)0) ||
3817 (pfIfOut6BlockBytes = agentx_object(pfMIBObjects,
3818 AGENTX_OID(PFIFOUT6BLOCKBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1, 21 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 8, 128, 1,
21 }) / sizeof(uint32_t))
, &pfIfIdx, 1, 0,
3819 mib_pfiftable)) == NULL((void *)0))
3820 fatal("agentx_object");
3821
3822 if ((pfTblNumber = agentx_object(pfMIBObjects, AGENTX_OID(PFTBLNUMBER)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 1 }) / sizeof(uint32_t
))
,
3823 NULL((void *)0), 0, 0, mib_pftablenum)) == NULL((void *)0))
3824 fatal("agentx_object");
3825 if ((pfTblIdx = agentx_index_integer_dynamic(pfMIBObjects,
3826 AGENTX_OID(PFTBLINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 1 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
1 }) / sizeof(uint32_t))
)) == NULL((void *)0))
3827 fatal("agentx_index_integer_dynamic");
3828 if ((pfTblIndex = agentx_object(pfMIBObjects, AGENTX_OID(PFTBLINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 1 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
1 }) / sizeof(uint32_t))
,
3829 &pfTblIdx, 1, 0, mib_pftables)) == NULL((void *)0) ||
3830 (pfTblName = agentx_object(pfMIBObjects, AGENTX_OID(PFTBLNAME)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 2 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
2 }) / sizeof(uint32_t))
,
3831 &pfTblIdx, 1, 0, mib_pftables)) == NULL((void *)0) ||
3832 (pfTblAddresses = agentx_object(pfMIBObjects,
3833 AGENTX_OID(PFTBLADDRESSES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 3 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
3 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3834 mib_pftables)) == NULL((void *)0) ||
3835 (pfTblAnchorRefs = agentx_object(pfMIBObjects,
3836 AGENTX_OID(PFTBLANCHORREFS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 4 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
4 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3837 mib_pftables)) == NULL((void *)0) ||
3838 (pfTblRuleRefs = agentx_object(pfMIBObjects,
3839 AGENTX_OID(PFTBLRULEREFS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 5 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
5 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3840 mib_pftables)) == NULL((void *)0) ||
3841 (pfTblEvalsMatch = agentx_object(pfMIBObjects,
3842 AGENTX_OID(PFTBLEVALSMATCH)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 6 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
6 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3843 mib_pftables)) == NULL((void *)0) ||
3844 (pfTblEvalsNoMatch = agentx_object(pfMIBObjects,
3845 AGENTX_OID(PFTBLEVALSNOMATCH)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 7 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
7 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3846 mib_pftables)) == NULL((void *)0) ||
3847 (pfTblInPassPkts = agentx_object(pfMIBObjects,
3848 AGENTX_OID(PFTBLINPASSPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 8 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
8 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3849 mib_pftables)) == NULL((void *)0) ||
3850 (pfTblInPassBytes = agentx_object(pfMIBObjects,
3851 AGENTX_OID(PFTBLINPASSBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 9 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
9 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3852 mib_pftables)) == NULL((void *)0) ||
3853 (pfTblInBlockPkts = agentx_object(pfMIBObjects,
3854 AGENTX_OID(PFTBLINBLOCKPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 10 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
10 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3855 mib_pftables)) == NULL((void *)0) ||
3856 (pfTblInBlockBytes = agentx_object(pfMIBObjects,
3857 AGENTX_OID(PFTBLINBLOCKBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 11 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
11 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3858 mib_pftables)) == NULL((void *)0) ||
3859 (pfTblInXPassPkts = agentx_object(pfMIBObjects,
3860 AGENTX_OID(PFTBLINXPASSPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 12 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
12 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3861 mib_pftables)) == NULL((void *)0) ||
3862 (pfTblInXPassBytes = agentx_object(pfMIBObjects,
3863 AGENTX_OID(PFTBLINXPASSBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 13 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
13 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3864 mib_pftables)) == NULL((void *)0) ||
3865 (pfTblOutPassPkts = agentx_object(pfMIBObjects,
3866 AGENTX_OID(PFTBLOUTPASSPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 14 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
14 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3867 mib_pftables)) == NULL((void *)0) ||
3868 (pfTblOutPassBytes = agentx_object(pfMIBObjects,
3869 AGENTX_OID(PFTBLOUTPASSBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 15 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
15 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3870 mib_pftables)) == NULL((void *)0) ||
3871 (pfTblOutBlockPkts = agentx_object(pfMIBObjects,
3872 AGENTX_OID(PFTBLOUTBLOCKPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 16 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
16 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3873 mib_pftables)) == NULL((void *)0) ||
3874 (pfTblOutBlockBytes = agentx_object(pfMIBObjects,
3875 AGENTX_OID(PFTBLOUTBLOCKBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 17 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
17 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3876 mib_pftables)) == NULL((void *)0) ||
3877 (pfTblOutXPassPkts = agentx_object(pfMIBObjects,
3878 AGENTX_OID(PFTBLOUTXPASSPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 18 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
18 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3879 mib_pftables)) == NULL((void *)0) ||
3880 (pfTblOutXPassBytes = agentx_object(pfMIBObjects,
3881 AGENTX_OID(PFTBLOUTXPASSBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 19 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
19 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3882 mib_pftables)) == NULL((void *)0) ||
3883 (pfTblStatsCleared = agentx_object(pfMIBObjects,
3884 AGENTX_OID(PFTBLSTATSCLEARED)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 20 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
20 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3885 mib_pftables)) == NULL((void *)0) ||
3886 (pfTblInMatchPkts = agentx_object(pfMIBObjects,
3887 AGENTX_OID(PFTBLINMATCHPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 21 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
21 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3888 mib_pftables)) == NULL((void *)0) ||
3889 (pfTblInMatchBytes = agentx_object(pfMIBObjects,
3890 AGENTX_OID(PFTBLINMATCHBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 22 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
22 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3891 mib_pftables)) == NULL((void *)0) ||
3892 (pfTblOutMatchPkts = agentx_object(pfMIBObjects,
3893 AGENTX_OID(PFTBLOUTMATCHPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 23 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
23 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3894 mib_pftables)) == NULL((void *)0) ||
3895 (pfTblOutMatchBytes = agentx_object(pfMIBObjects,
3896 AGENTX_OID(PFTBLOUTMATCHBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1, 24 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 128, 1,
24 }) / sizeof(uint32_t))
, &pfTblIdx, 1, 0,
3897 mib_pftables)) == NULL((void *)0))
3898 fatal("agentx_object");
3899
3900 if ((pfTblAddrTblIdx = agentx_index_integer_dynamic(pfMIBObjects,
3901 AGENTX_OID(PFTBLADDRTBLINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 1 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
1 }) / sizeof(uint32_t))
)) == NULL((void *)0) ||
3902 (pfTblAddrNetIdx = agentx_index_ipaddress_dynamic(pfMIBObjects,
3903 AGENTX_OID(PFTBLADDRNET)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 2 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
2 }) / sizeof(uint32_t))
)) == NULL((void *)0) ||
3904 (pfTblAddrMaskIdx = agentx_index_integer_dynamic(pfMIBObjects,
3905 AGENTX_OID(PFTBLADDRMASK)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 3 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
3 }) / sizeof(uint32_t))
)) == NULL((void *)0))
3906 fatal("agentx_index_integer_dynamic");
3907 indices[0] = pfTblAddrTblIdx;
3908 indices[1] = pfTblAddrNetIdx;
3909 indices[2] = pfTblAddrMaskIdx;
3910 if ((pfTblAddrTblIndex = agentx_object(pfMIBObjects,
3911 AGENTX_OID(PFTBLADDRTBLINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 1 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
1 }) / sizeof(uint32_t))
, indices, 3, 0,
3912 mib_pftableaddrs)) == NULL((void *)0) ||
3913 (pfTblAddrNet = agentx_object(pfMIBObjects,
3914 AGENTX_OID(PFTBLADDRNET)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 2 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
2 }) / sizeof(uint32_t))
, indices, 3, 0,
3915 mib_pftableaddrs)) == NULL((void *)0) ||
3916 (pfTblAddrMask = agentx_object(pfMIBObjects,
3917 AGENTX_OID(PFTBLADDRMASK)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 3 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
3 }) / sizeof(uint32_t))
, indices, 3, 0,
3918 mib_pftableaddrs)) == NULL((void *)0) ||
3919 (pfTblAddrCleared = agentx_object(pfMIBObjects,
3920 AGENTX_OID(PFTBLADDRCLEARED)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 4 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
4 }) / sizeof(uint32_t))
, indices, 3, 0,
3921 mib_pftableaddrs)) == NULL((void *)0) ||
3922 (pfTblAddrInBlockPkts = agentx_object(pfMIBObjects,
3923 AGENTX_OID(PFTBLADDRINBLOCKPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 5 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
5 }) / sizeof(uint32_t))
, indices, 3, 0,
3924 mib_pftableaddrs)) == NULL((void *)0) ||
3925 (pfTblAddrInBlockBytes = agentx_object(pfMIBObjects,
3926 AGENTX_OID(PFTBLADDRINBLOCKBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 6 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
6 }) / sizeof(uint32_t))
, indices, 3, 0,
3927 mib_pftableaddrs)) == NULL((void *)0) ||
3928 (pfTblAddrInPassPkts = agentx_object(pfMIBObjects,
3929 AGENTX_OID(PFTBLADDRINPASSPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 7 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
7 }) / sizeof(uint32_t))
, indices, 3, 0,
3930 mib_pftableaddrs)) == NULL((void *)0) ||
3931 (pfTblAddrInPassBytes = agentx_object(pfMIBObjects,
3932 AGENTX_OID(PFTBLADDRINPASSBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 8 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
8 }) / sizeof(uint32_t))
, indices, 3, 0,
3933 mib_pftableaddrs)) == NULL((void *)0) ||
3934 (pfTblAddrOutBlockPkts = agentx_object(pfMIBObjects,
3935 AGENTX_OID(PFTBLADDROUTBLOCKPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 9 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
9 }) / sizeof(uint32_t))
, indices, 3, 0,
3936 mib_pftableaddrs)) == NULL((void *)0) ||
3937 (pfTblAddrOutBlockBytes = agentx_object(pfMIBObjects,
3938 AGENTX_OID(PFTBLADDROUTBLOCKBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 10 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
10 }) / sizeof(uint32_t))
, indices, 3, 0,
3939 mib_pftableaddrs)) == NULL((void *)0) ||
3940 (pfTblAddrOutPassPkts = agentx_object(pfMIBObjects,
3941 AGENTX_OID(PFTBLADDROUTPASSPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 11 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
11 }) / sizeof(uint32_t))
, indices, 3, 0,
3942 mib_pftableaddrs)) == NULL((void *)0) ||
3943 (pfTblAddrOutPassBytes = agentx_object(pfMIBObjects,
3944 AGENTX_OID(PFTBLADDROUTPASSBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 12 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
12 }) / sizeof(uint32_t))
, indices, 3, 0,
3945 mib_pftableaddrs)) == NULL((void *)0) ||
3946 (pfTblAddrInMatchPkts = agentx_object(pfMIBObjects,
3947 AGENTX_OID(PFTBLADDRINMATCHPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 13 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
13 }) / sizeof(uint32_t))
, indices, 3, 0,
3948 mib_pftableaddrs)) == NULL((void *)0) ||
3949 (pfTblAddrInMatchBytes = agentx_object(pfMIBObjects,
3950 AGENTX_OID(PFTBLADDRINMATCHBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 14 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
14 }) / sizeof(uint32_t))
, indices, 3, 0,
3951 mib_pftableaddrs)) == NULL((void *)0) ||
3952 (pfTblAddrOutMatchPkts = agentx_object(pfMIBObjects,
3953 AGENTX_OID(PFTBLADDROUTMATCHPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 15 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
15 }) / sizeof(uint32_t))
, indices, 3, 0,
3954 mib_pftableaddrs)) == NULL((void *)0) ||
3955 (pfTblAddrOutMatchBytes = agentx_object(pfMIBObjects,
3956 AGENTX_OID(PFTBLADDROUTMATCHBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1, 16 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 9, 129, 1,
16 }) / sizeof(uint32_t))
, indices, 3, 0,
3957 mib_pftableaddrs)) == NULL((void *)0))
3958 fatal("agentx_object");
3959
3960 if ((pfLabelNumber = agentx_object(pfMIBObjects,
3961 AGENTX_OID(PFLABELNUMBER)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 1 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 1 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0, mib_pflabelnum)) == NULL((void *)0))
3962 fatal("agentx_object");
3963 if ((pfLabelIdx = agentx_index_integer_dynamic(pfMIBObjects,
3964 AGENTX_OID(PFLABELINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 1 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1
, 1 }) / sizeof(uint32_t))
)) == NULL((void *)0))
3965 fatal("agentx_index_integer_dynamic");
3966 if ((pfLabelIndex = agentx_object(pfMIBObjects,
3967 AGENTX_OID(PFLABELINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 1 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1
, 1 }) / sizeof(uint32_t))
, &pfLabelIdx, 1, 0,
3968 mib_pflabels)) == NULL((void *)0) ||
3969 (pfLabelName = agentx_object(pfMIBObjects, AGENTX_OID(PFLABELNAME)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 2 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1
, 2 }) / sizeof(uint32_t))
,
3970 &pfLabelIdx, 1, 0, mib_pflabels)) == NULL((void *)0) ||
3971 (pfLabelEvals = agentx_object(pfMIBObjects,
3972 AGENTX_OID(PFLABELEVALS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 3 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1
, 3 }) / sizeof(uint32_t))
, &pfLabelIdx, 1, 0,
3973 mib_pflabels)) == NULL((void *)0) ||
3974 (pfLabelPkts = agentx_object(pfMIBObjects, AGENTX_OID(PFLABELPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 4 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1
, 4 }) / sizeof(uint32_t))
,
3975 &pfLabelIdx, 1, 0, mib_pflabels)) == NULL((void *)0) ||
3976 (pfLabelBytes = agentx_object(pfMIBObjects,
3977 AGENTX_OID(PFLABELBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 5 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1
, 5 }) / sizeof(uint32_t))
, &pfLabelIdx, 1, 0,
3978 mib_pflabels)) == NULL((void *)0) ||
3979 (pfLabelInPkts = agentx_object(pfMIBObjects,
3980 AGENTX_OID(PFLABELINPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 6 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1
, 6 }) / sizeof(uint32_t))
, &pfLabelIdx, 1, 0,
3981 mib_pflabels)) == NULL((void *)0) ||
3982 (pfLabelInBytes = agentx_object(pfMIBObjects,
3983 AGENTX_OID(PFLABELINBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 7 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1
, 7 }) / sizeof(uint32_t))
, &pfLabelIdx, 1, 0,
3984 mib_pflabels)) == NULL((void *)0) ||
3985 (pfLabelOutPkts = agentx_object(pfMIBObjects,
3986 AGENTX_OID(PFLABELOUTPKTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 8 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1
, 8 }) / sizeof(uint32_t))
, &pfLabelIdx, 1, 0,
3987 mib_pflabels)) == NULL((void *)0) ||
3988 (pfLabelOutBytes = agentx_object(pfMIBObjects,
3989 AGENTX_OID(PFLABELOUTBYTES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 9 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1
, 9 }) / sizeof(uint32_t))
, &pfLabelIdx, 1, 0,
3990 mib_pflabels)) == NULL((void *)0) ||
3991 (pfLabelTotalStates = agentx_object(pfMIBObjects,
3992 AGENTX_OID(PFLABELTOTALSTATES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128, 1, 10 },
(sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 10, 128,
1, 10 }) / sizeof(uint32_t))
, &pfLabelIdx, 1, 0,
3993 mib_pflabels)) == NULL((void *)0))
3994 fatal("agentx_object");
3995
3996 if ((pfsyncIpPktsRecv = agentx_object(pfMIBObjects,
3997 AGENTX_OID(PFSYNCIPPKTSRECV)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 1 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 1 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
3998 mib_pfsyncstats)) == NULL((void *)0) ||
3999 (pfsyncIp6PktsRecv = agentx_object(pfMIBObjects,
4000 AGENTX_OID(PFSYNCIP6PKTSRECV)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 2 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 2 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4001 mib_pfsyncstats)) == NULL((void *)0) ||
4002 (pfsyncPktDiscardsForBadInterface = agentx_object(pfMIBObjects,
4003 AGENTX_OID(PFSYNCPKTDISCARDSFORBADINTERFACE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 3 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 3 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4004 mib_pfsyncstats)) == NULL((void *)0) ||
4005 (pfsyncPktDiscardsForBadTtl = agentx_object(pfMIBObjects,
4006 AGENTX_OID(PFSYNCPKTDISCARDSFORBADTTL)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 4 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 4 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4007 mib_pfsyncstats)) == NULL((void *)0) ||
4008 (pfsyncPktShorterThanHeader = agentx_object(pfMIBObjects,
4009 AGENTX_OID(PFSYNCPKTSHORTERTHANHEADER)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 5 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 5 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4010 mib_pfsyncstats)) == NULL((void *)0) ||
4011 (pfsyncPktDiscardsForBadVersion = agentx_object(pfMIBObjects,
4012 AGENTX_OID(PFSYNCPKTDISCARDSFORBADVERSION)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 6 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 6 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4013 mib_pfsyncstats)) == NULL((void *)0) ||
4014 (pfsyncPktDiscardsForBadAction = agentx_object(pfMIBObjects,
4015 AGENTX_OID(PFSYNCPKTDISCARDSFORBADACTION)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 7 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 7 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4016 mib_pfsyncstats)) == NULL((void *)0) ||
4017 (pfsyncPktDiscardsForBadLength = agentx_object(pfMIBObjects,
4018 AGENTX_OID(PFSYNCPKTDISCARDSFORBADLENGTH)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 8 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 8 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4019 mib_pfsyncstats)) == NULL((void *)0) ||
4020 (pfsyncPktDiscardsForBadAuth = agentx_object(pfMIBObjects,
4021 AGENTX_OID(PFSYNCPKTDISCARDSFORBADAUTH)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 9 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 9 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4022 mib_pfsyncstats)) == NULL((void *)0) ||
4023 (pfsyncPktDiscardsForStaleState = agentx_object(pfMIBObjects,
4024 AGENTX_OID(PFSYNCPKTDISCARDSFORSTALESTATE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 10 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 10 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4025 mib_pfsyncstats)) == NULL((void *)0) ||
4026 (pfsyncPktDiscardsForBadValues = agentx_object(pfMIBObjects,
4027 AGENTX_OID(PFSYNCPKTDISCARDSFORBADVALUES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 11 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 11 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4028 mib_pfsyncstats)) == NULL((void *)0) ||
4029 (pfsyncPktDiscardsForBadState = agentx_object(pfMIBObjects,
4030 AGENTX_OID(PFSYNCPKTDISCARDSFORBADSTATE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 12 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 12 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4031 mib_pfsyncstats)) == NULL((void *)0) ||
4032 (pfsyncIpPktsSent = agentx_object(pfMIBObjects,
4033 AGENTX_OID(PFSYNCIPPKTSSENT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 13 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 13 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4034 mib_pfsyncstats)) == NULL((void *)0) ||
4035 (pfsyncIp6PktsSent = agentx_object(pfMIBObjects,
4036 AGENTX_OID(PFSYNCIP6PKTSSENT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 14 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 14 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4037 mib_pfsyncstats)) == NULL((void *)0) ||
4038 (pfsyncNoMemory = agentx_object(pfMIBObjects,
4039 AGENTX_OID(PFSYNCNOMEMORY)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 15 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 15 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4040 mib_pfsyncstats)) == NULL((void *)0) ||
4041 (pfsyncOutputErrors = agentx_object(pfMIBObjects,
4042 AGENTX_OID(PFSYNCOUTPUTERRORS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 16 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 1, 11, 16 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4043 mib_pfsyncstats)) == NULL((void *)0))
4044 fatal("agentx_object");
4045
4046 if ((sensorsMIBObjects = agentx_region(sac,
4047 AGENTX_OID(SENSORSMIBOBJECTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 4, 1, 30155, 2 }) / sizeof(uint32_t))
, 0)) == NULL((void *)0))
4048 fatal("agentx_region");
4049 if ((sensorNumber = agentx_object(sensorsMIBObjects,
4050 AGENTX_OID(SENSORNUMBER)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 1 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_sensornum)) == NULL((void *)0))
4051 fatal("agentx_object");
4052 if ((sensorIdx = agentx_index_integer_dynamic(sensorsMIBObjects,
4053 AGENTX_OID(SENSORINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 1 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 1 }) / sizeof
(uint32_t))
)) == NULL((void *)0))
4054 fatal("agentx_index_integer_dynamic");
4055 if ((sensorIndex = agentx_object(sensorsMIBObjects,
4056 AGENTX_OID(SENSORINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 1 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 1 }) / sizeof
(uint32_t))
, &sensorIdx, 1, 0, mib_sensors)) == NULL((void *)0) ||
4057 (sensorDescr = agentx_object(sensorsMIBObjects,
4058 AGENTX_OID(SENSORDESCR)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 2 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 2 }) / sizeof
(uint32_t))
, &sensorIdx, 1, 0, mib_sensors)) == NULL((void *)0) ||
4059 (sensorType = agentx_object(sensorsMIBObjects,
4060 AGENTX_OID(SENSORTYPE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 3 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 3 }) / sizeof
(uint32_t))
, &sensorIdx, 1, 0, mib_sensors)) == NULL((void *)0) ||
4061 (sensorDevice = agentx_object(sensorsMIBObjects,
4062 AGENTX_OID(SENSORDEVICE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 4 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 4 }) / sizeof
(uint32_t))
, &sensorIdx, 1, 0, mib_sensors)) == NULL((void *)0) ||
4063 (sensorValue = agentx_object(sensorsMIBObjects,
4064 AGENTX_OID(SENSORVALUE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 5 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 5 }) / sizeof
(uint32_t))
, &sensorIdx, 1, 0, mib_sensors)) == NULL((void *)0) ||
4065 (sensorUnits = agentx_object(sensorsMIBObjects,
4066 AGENTX_OID(SENSORUNITS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 6 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 6 }) / sizeof
(uint32_t))
, &sensorIdx, 1, 0, mib_sensors)) == NULL((void *)0) ||
4067 (sensorStatus = agentx_object(sensorsMIBObjects,
4068 AGENTX_OID(SENSORSTATUS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 7 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 2, 1, 2, 1, 7 }) / sizeof
(uint32_t))
, &sensorIdx, 1, 0, mib_sensors)) == NULL((void *)0))
4069 fatal("agentx_object");
4070
4071 if ((carpMIBObjects = agentx_region(sac,
4072 AGENTX_OID(CARPMIBOBJECTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 4, 1, 30155, 6 }) / sizeof(uint32_t))
, 0)) == NULL((void *)0))
4073 fatal("agentx_region");
4074 if ((carpAllow = agentx_object(carpMIBObjects, AGENTX_OID(CARPALLOW)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 1, 1 }) / sizeof(uint32_t
))
,
4075 NULL((void *)0), 0, 0, mib_carpsysctl)) == NULL((void *)0) ||
4076 (carpPreempt = agentx_object(carpMIBObjects,
4077 AGENTX_OID(CARPPREEMPT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 1, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 1, 2 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_carpsysctl)) == NULL((void *)0) ||
4078 (carpLog = agentx_object(carpMIBObjects, AGENTX_OID(CARPLOG)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 1, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 1, 3 }) / sizeof(uint32_t
))
,
4079 NULL((void *)0), 0, 0, mib_carpsysctl)) == NULL((void *)0))
4080 fatal("agentx_object");
4081
4082 if ((carpIfNumber = agentx_object(carpMIBObjects,
4083 AGENTX_OID(CARPIFNUMBER)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 1 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_carpifnum)) == NULL((void *)0))
4084 fatal("agentx_object");
4085 if ((carpIfIdx = agentx_index_integer_dynamic(carpMIBObjects,
4086 AGENTX_OID(CARPIFINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 1 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 1 }) / sizeof
(uint32_t))
)) == NULL((void *)0))
4087 fatal("agentx_index_integer_dynamic");
4088 if ((carpIfIndex = agentx_object(carpMIBObjects,
4089 AGENTX_OID(CARPIFINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 1 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 1 }) / sizeof
(uint32_t))
, &carpIfIdx, 1, 0,
4090 mib_carpiftable)) == NULL((void *)0) ||
4091 (carpIfDescr = agentx_object(carpMIBObjects,
4092 AGENTX_OID(CARPIFDESCR)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 2 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 2 }) / sizeof
(uint32_t))
, &carpIfIdx, 1, 0,
4093 mib_carpiftable)) == NULL((void *)0) ||
4094 (carpIfVhid = agentx_object(carpMIBObjects, AGENTX_OID(CARPIFVHID)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 3 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 3 }) / sizeof
(uint32_t))
,
4095 &carpIfIdx, 1, 0, mib_carpiftable)) == NULL((void *)0) ||
4096 (carpIfDev = agentx_object(carpMIBObjects, AGENTX_OID(CARPIFDEV)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 4 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 4 }) / sizeof
(uint32_t))
,
4097 &carpIfIdx, 1, 0, mib_carpiftable)) == NULL((void *)0) ||
4098 (carpIfAdvbase = agentx_object(carpMIBObjects,
4099 AGENTX_OID(CARPIFADVBASE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 5 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 5 }) / sizeof
(uint32_t))
, &carpIfIdx, 1, 0,
4100 mib_carpiftable)) == NULL((void *)0) ||
4101 (carpIfAdvskew = agentx_object(carpMIBObjects,
4102 AGENTX_OID(CARPIFADVSKEW)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 6 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 6 }) / sizeof
(uint32_t))
, &carpIfIdx, 1, 0,
4103 mib_carpiftable)) == NULL((void *)0) ||
4104 (carpIfState = agentx_object(carpMIBObjects,
4105 AGENTX_OID(CARPIFSTATE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 7 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 2, 2, 1, 7 }) / sizeof
(uint32_t))
, &carpIfIdx, 1, 0,
4106 mib_carpiftable)) == NULL((void *)0))
4107 fatal("agentx_object");
4108
4109 if ((carpGroupIdx = agentx_index_integer_dynamic(carpMIBObjects,
4110 AGENTX_OID(CARPGROUPINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 4, 1, 1 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 4, 1, 1 }) / sizeof
(uint32_t))
)) == NULL((void *)0))
4111 fatal("agentx_index_integer_dynamic");
4112 if ((carpGroupName = agentx_object(carpMIBObjects,
4113 AGENTX_OID(CARPGROUPNAME)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 4, 1, 2 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 4, 1, 2 }) / sizeof
(uint32_t))
, &carpGroupIdx, 1, 0,
4114 mib_carpgrouptable)) == NULL((void *)0) ||
4115 (carpGroupDemote = agentx_object(carpMIBObjects,
4116 AGENTX_OID(CARPGROUPDEMOTE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 4, 1, 3 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 4, 1, 3 }) / sizeof
(uint32_t))
, &carpGroupIdx, 1, 0,
4117 mib_carpgrouptable)) == NULL((void *)0))
4118 fatal("agentx_object");
4119
4120 if ((carpIpPktsRecv = agentx_object(carpMIBObjects,
4121 AGENTX_OID(CARPIPPKTSRECV)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 1 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_carpstats)) == NULL((void *)0) ||
4122 (carpIp6PktsRecv = agentx_object(carpMIBObjects,
4123 AGENTX_OID(CARPIP6PKTSRECV)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 2 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0, mib_carpstats)) == NULL((void *)0) ||
4124 (carpPktDiscardsForBadInterface = agentx_object(carpMIBObjects,
4125 AGENTX_OID(CARPPKTDISCARDSFORBADINTERFACE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 3 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
4126 mib_carpstats)) == NULL((void *)0) ||
4127 (carpPktDiscardsForWrongTtl = agentx_object(carpMIBObjects,
4128 AGENTX_OID(CARPPKTDISCARDSFORWRONGTTL)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 4 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
4129 mib_carpstats)) == NULL((void *)0) ||
4130 (carpPktShorterThanHeader = agentx_object(carpMIBObjects,
4131 AGENTX_OID(CARPPKTSHORTERTHANHEADER)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 5 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 5 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
4132 mib_carpstats)) == NULL((void *)0) ||
4133 (carpPktDiscardsForBadChecksum = agentx_object(carpMIBObjects,
4134 AGENTX_OID(CARPPKTDISCARDSFORBADCHECKSUM)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 6 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 6 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
4135 mib_carpstats)) == NULL((void *)0) ||
4136 (carpPktDiscardsForBadVersion = agentx_object(carpMIBObjects,
4137 AGENTX_OID(CARPPKTDISCARDSFORBADVERSION)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 7 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 7 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
4138 mib_carpstats)) == NULL((void *)0) ||
4139 (carpPktDiscardsForTooShort = agentx_object(carpMIBObjects,
4140 AGENTX_OID(CARPPKTDISCARDSFORTOOSHORT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 8 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 8 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
4141 mib_carpstats)) == NULL((void *)0) ||
4142 (carpPktDiscardsForBadAuth = agentx_object(carpMIBObjects,
4143 AGENTX_OID(CARPPKTDISCARDSFORBADAUTH)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 9 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 9 }) / sizeof(uint32_t
))
, NULL((void *)0), 0, 0,
4144 mib_carpstats)) == NULL((void *)0) ||
4145 (carpPktDiscardsForBadVhid = agentx_object(carpMIBObjects,
4146 AGENTX_OID(CARPPKTDISCARDSFORBADVHID)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 10 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 10 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4147 mib_carpstats)) == NULL((void *)0) ||
4148 (carpPktDiscardsForBadAddressList = agentx_object(carpMIBObjects,
4149 AGENTX_OID(CARPPKTDISCARDSFORBADADDRESSLIST)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 11 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 11 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4150 mib_carpstats)) == NULL((void *)0) ||
4151 (carpIpPktsSent = agentx_object(carpMIBObjects,
4152 AGENTX_OID(CARPIPPKTSSENT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 12 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 12 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4153 mib_carpstats)) == NULL((void *)0) ||
4154 (carpIp6PktsSent = agentx_object(carpMIBObjects,
4155 AGENTX_OID(CARPIP6PKTSSENT)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 13 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 13 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4156 mib_carpstats)) == NULL((void *)0) ||
4157 (carpNoMemory = agentx_object(carpMIBObjects,
4158 AGENTX_OID(CARPNOMEMORY)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 14 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 14 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4159 mib_carpstats)) == NULL((void *)0) ||
4160 (carpTransitionsToMaster = agentx_object(carpMIBObjects,
4161 AGENTX_OID(CARPTRANSITIONSTOMASTER)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 15 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 6, 3, 15 }) / sizeof
(uint32_t))
, NULL((void *)0), 0, 0,
4162 mib_carpstats)) == NULL((void *)0))
4163 fatal("agentx_object");
4164
4165 /* OPENBSD-MEM-MIB */
4166 if ((memMIBObjects = agentx_region(sac,
4167 AGENTX_OID(MEMMIBOBJECTS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 5 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 4, 1, 30155, 5 }) / sizeof(uint32_t))
, 0)) == NULL((void *)0))
4168 fatal("agentx_region");
4169 if ((memMIBVersion = agentx_object(memMIBObjects,
4170 AGENTX_OID(MEMMIBVERSION)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 5, 1 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 4, 1, 30155, 5, 1 }) / sizeof(uint32_t))
, NULL((void *)0), 0, 0, mib_memversion)) == NULL((void *)0))
4171 fatal("agentx_object");
4172 if ((memIfName = agentx_object(memMIBObjects, AGENTX_OID(MEMIFNAME)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 5, 2, 1, 1 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 5, 2, 1, 1 }) / sizeof
(uint32_t))
,
4173 &ifIdx, 1, 0, mib_memiftable)) == NULL((void *)0) ||
4174 (memIfLiveLocks = agentx_object(memMIBObjects,
4175 AGENTX_OID(MEMIFLIVELOCKS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 5, 2, 1, 2 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 30155, 5, 2, 1, 2 }) / sizeof
(uint32_t))
, &ifIdx, 1, 0,
4176 mib_memiftable)) == NULL((void *)0))
4177 fatal("agentx_object");
4178
4179 /* IP-MIB */
4180 if ((ip = agentx_region(sac, AGENTX_OID(IP)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4 }, (sizeof((uint32_t []) {
1, 3, 6, 1, 2, 1, 4 }) / sizeof(uint32_t))
, 0)) == NULL((void *)0))
4181 fatal("agentx_region");
4182 if ((ipForwarding = agentx_object(ip, AGENTX_OID(IPFORWARDING)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 1 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 1 }) / sizeof(uint32_t))
,
4183 NULL((void *)0), 0, 0, mib_ipforwarding)) == NULL((void *)0) ||
4184 (ipDefaultTTL = agentx_object(ip, AGENTX_OID(IPDEFAULTTTL)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 2 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 2 }) / sizeof(uint32_t))
,
4185 NULL((void *)0), 0, 0, mib_ipdefaultttl)) == NULL((void *)0) ||
4186 (ipInReceives = agentx_object(ip, AGENTX_OID(IPINRECEIVES)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 3 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 3 }) / sizeof(uint32_t))
,
4187 NULL((void *)0), 0, 0, mib_ipstat)) == NULL((void *)0) ||
4188 (ipInHdrErrors = agentx_object(ip, AGENTX_OID(IPINHDRERRORS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 4 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 4 }) / sizeof(uint32_t))
,
4189 NULL((void *)0), 0, 0, mib_ipinhdrerrs)) == NULL((void *)0) ||
4190 (ipInAddrErrors = agentx_object(ip, AGENTX_OID(IPINADDRERRORS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 5 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 5 }) / sizeof(uint32_t))
,
4191 NULL((void *)0), 0, 0, mib_ipinaddrerrs)) == NULL((void *)0) ||
4192 (ipForwDatagrams = agentx_object(ip, AGENTX_OID(IPFORWDATAGRAMS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 6 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 6 }) / sizeof(uint32_t))
,
4193 NULL((void *)0), 0, 0, mib_ipforwdgrams)) == NULL((void *)0) ||
4194 (ipInUnknownProtos = agentx_object(ip,
4195 AGENTX_OID(IPINUNKNOWNPROTOS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 7 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 7 }) / sizeof(uint32_t))
, NULL((void *)0), 0, 0, mib_ipstat)) == NULL((void *)0) ||
4196 (ipInDelivers = agentx_object(ip, AGENTX_OID(IPINDELIVERS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 9 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 9 }) / sizeof(uint32_t))
,
4197 NULL((void *)0), 0, 0, mib_ipstat)) == NULL((void *)0) ||
4198 (ipOutRequests = agentx_object(ip, AGENTX_OID(IPOUTREQUESTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 10 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 10 }) / sizeof(uint32_t))
,
4199 NULL((void *)0), 0, 0, mib_ipstat)) == NULL((void *)0) ||
4200 (ipOutDiscards = agentx_object(ip, AGENTX_OID(IPOUTDISCARDS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 11 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 11 }) / sizeof(uint32_t))
,
4201 NULL((void *)0), 0, 0, mib_ipstat)) == NULL((void *)0) ||
4202 (ipOutNoRoutes = agentx_object(ip, AGENTX_OID(IPOUTNOROUTES)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 12 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 12 }) / sizeof(uint32_t))
,
4203 NULL((void *)0), 0, 0, mib_ipstat)) == NULL((void *)0) ||
4204 (ipReasmTimeout = agentx_object(ip, AGENTX_OID(IPREASMTIMEOUT)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 13 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 13 }) / sizeof(uint32_t))
,
4205 NULL((void *)0), 0, 0, mib_ipreasmtimeout)) == NULL((void *)0) ||
4206 (ipReasmReqds = agentx_object(ip, AGENTX_OID(IPREASMREQDS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 14 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 14 }) / sizeof(uint32_t))
,
4207 NULL((void *)0), 0, 0, mib_ipstat)) == NULL((void *)0) ||
4208 (ipReasmOKs = agentx_object(ip, AGENTX_OID(IPREASMOKS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 15 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 15 }) / sizeof(uint32_t))
,
4209 NULL((void *)0), 0, 0, mib_ipstat)) == NULL((void *)0) ||
4210 (ipReasmFails = agentx_object(ip, AGENTX_OID(IPREASMFAILS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 16 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 16 }) / sizeof(uint32_t))
,
4211 NULL((void *)0), 0, 0, mib_ipreasmfails)) == NULL((void *)0) ||
4212 (ipFragOKs = agentx_object(ip, AGENTX_OID(IPFRAGOKS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 17 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 17 }) / sizeof(uint32_t))
,
4213 NULL((void *)0), 0, 0, mib_ipstat)) == NULL((void *)0) ||
4214 (ipFragFails = agentx_object(ip, AGENTX_OID(IPFRAGFAILS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 18 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 18 }) / sizeof(uint32_t))
,
4215 NULL((void *)0), 0, 0, mib_ipfragfails)) == NULL((void *)0) ||
4216 (ipFragCreates = agentx_object(ip, AGENTX_OID(IPFRAGCREATES)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 19 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 19 }) / sizeof(uint32_t))
,
4217 NULL((void *)0), 0, 0, mib_ipstat)) == NULL((void *)0))
4218 fatal("agentx_object");
4219
4220 if ((ipAdEntAddrIdx = agentx_index_ipaddress_dynamic(ip,
4221 AGENTX_OID(IPADENTADDR)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 20, 1, 1 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 20, 1, 1 }) / sizeof(uint32_t))
)) == NULL((void *)0))
4222 fatal("agentx_index_integer_dynamic");
4223 if ((ipAdEntAddr = agentx_object(ip, AGENTX_OID(IPADENTADDR)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 20, 1, 1 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 20, 1, 1 }) / sizeof(uint32_t))
,
4224 &ipAdEntAddrIdx, 1, 0, mib_ipaddr)) == NULL((void *)0) ||
4225 (ipAdEntIfIndex = agentx_object(ip, AGENTX_OID(IPADENTIFINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 20, 1, 2 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 20, 1, 2 }) / sizeof(uint32_t))
,
4226 &ipAdEntAddrIdx, 1, 0, mib_ipaddr)) == NULL((void *)0) ||
4227 (ipAdEntNetMask = agentx_object(ip, AGENTX_OID(IPADENTNETMASK)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 20, 1, 3 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 20, 1, 3 }) / sizeof(uint32_t))
,
4228 &ipAdEntAddrIdx, 1, 0, mib_ipaddr)) == NULL((void *)0) ||
4229 (ipAdEntBcastAddr = agentx_object(ip, AGENTX_OID(IPADENTBCASTADDR)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 20, 1, 4 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 20, 1, 4 }) / sizeof(uint32_t))
,
4230 &ipAdEntAddrIdx, 1, 0, mib_ipaddr)) == NULL((void *)0) ||
4231 (ipAdEntReasmMaxSize = agentx_object(ip,
4232 AGENTX_OID(IPADENTREASMMAXSIZE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 20, 1, 5 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 20, 1, 5 }) / sizeof(uint32_t))
, &ipAdEntAddrIdx, 1, 0,
4233 mib_ipaddr)) == NULL((void *)0))
4234 fatal("agentx_object");
4235
4236 if ((ipNetToMediaIfIdx = agentx_index_integer_dynamic(ip,
4237 AGENTX_OID(IPNETTOMEDIAIFINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 22, 1, 1 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 22, 1, 1 }) / sizeof(uint32_t))
)) == NULL((void *)0))
4238 fatal("agentx_index_integer_dynamic");
4239 if ((ipNetToMediaNetAddressIdx = agentx_index_ipaddress_dynamic(ip,
4240 AGENTX_OID(IPNETTOMEDIANETADDRESS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 22, 1, 3 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 22, 1, 3 }) / sizeof(uint32_t))
)) == NULL((void *)0))
4241 fatal("agentx_index_string_dynamic");
4242 indices[0] = ipNetToMediaIfIdx;
4243 indices[1] = ipNetToMediaNetAddressIdx;
4244 if ((ipNetToMediaIfIndex = agentx_object(ip,
4245 AGENTX_OID(IPNETTOMEDIAIFINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 22, 1, 1 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 22, 1, 1 }) / sizeof(uint32_t))
, indices, 2, 0,
4246 mib_physaddr)) == NULL((void *)0) ||
4247 (ipNetToMediaPhysAddress = agentx_object(ip,
4248 AGENTX_OID(IPNETTOMEDIAPHYSADDRESS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 22, 1, 2 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 22, 1, 2 }) / sizeof(uint32_t))
, indices, 2, 0,
4249 mib_physaddr)) == NULL((void *)0) ||
4250 (ipNetToMediaNetAddress = agentx_object(ip,
4251 AGENTX_OID(IPNETTOMEDIANETADDRESS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 22, 1, 3 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 22, 1, 3 }) / sizeof(uint32_t))
, indices, 2, 0,
4252 mib_physaddr)) == NULL((void *)0) ||
4253 (ipNetToMediaType = agentx_object(ip, AGENTX_OID(IPNETTOMEDIATYPE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 22, 1, 4 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 22, 1, 4 }) / sizeof(uint32_t))
,
4254 indices, 2, 0, mib_physaddr)) == NULL((void *)0))
4255 fatal("agentx_object");
4256
4257 if ((ipForward = agentx_region(sac, AGENTX_OID(IPFORWARD)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24 }, (sizeof((uint32_t [
]) { 1, 3, 6, 1, 2, 1, 4, 24 }) / sizeof(uint32_t))
, 0)) == NULL((void *)0))
4258 fatal("agentx_region");
4259 if ((inetCidrRouteNumber = agentx_object(ipForward,
4260 AGENTX_OID(INETCIDRROUTENUMBER)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 6 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 4, 24, 6 }) / sizeof(uint32_t))
, NULL((void *)0), 0, 0,
4261 mib_ipfnroutes)) == NULL((void *)0))
4262 fatal("agentx_object");
4263 if ((inetCidrRouteDestTypeIdx = agentx_index_integer_dynamic(ipForward,
4264 AGENTX_OID(INETCIDRROUTEDESTTYPE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 1 }) / sizeof(uint32_t
))
)) == NULL((void *)0) ||
4265 (inetCidrRouteDestIdx = agentx_index_string_dynamic(ipForward,
4266 AGENTX_OID(INETCIDRROUTEDEST)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 2 }) / sizeof(uint32_t
))
)) == NULL((void *)0) ||
4267 (inetCidrRoutePfxLenIdx = agentx_index_integer_dynamic(ipForward,
4268 AGENTX_OID(INETCIDRROUTEPFXLEN)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 3 }) / sizeof(uint32_t
))
)) == NULL((void *)0) ||
4269 (inetCidrRoutePolicyIdx = agentx_index_oid_dynamic(ipForward,
4270 AGENTX_OID(INETCIDRROUTEPOLICY)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 4 }) / sizeof(uint32_t
))
)) == NULL((void *)0) ||
4271 (inetCidrRouteNextHopTypeIdx = agentx_index_integer_dynamic(
4272 ipForward, AGENTX_OID(INETCIDRROUTENEXTHOPTYPE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 5 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 5 }) / sizeof(uint32_t
))
)) == NULL((void *)0) ||
4273 (inetCidrRouteNextHopIdx = agentx_index_string_dynamic(ipForward,
4274 AGENTX_OID(INETCIDRROUTENEXTHOP)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 6 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 6 }) / sizeof(uint32_t
))
)) == NULL((void *)0))
4275 fatal("agentx_index_*_dynamic");
4276 indices[0] = inetCidrRouteDestTypeIdx;
4277 indices[1] = inetCidrRouteDestIdx;
4278 indices[2] = inetCidrRoutePfxLenIdx;
4279 indices[3] = inetCidrRoutePolicyIdx;
4280 indices[4] = inetCidrRouteNextHopTypeIdx;
4281 indices[5] = inetCidrRouteNextHopIdx;
4282 if ((inetCidrRouteIfIndex = agentx_object(ipForward,
4283 AGENTX_OID(INETCIDRROUTEIFINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 7 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 7 }) / sizeof(uint32_t
))
, indices, 6, 0,
4284 mib_ipfroute)) == NULL((void *)0) ||
4285 (inetCidrRouteType = agentx_object(ipForward,
4286 AGENTX_OID(INETCIDRROUTETYPE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 8 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 8 }) / sizeof(uint32_t
))
, indices, 6, 0,
4287 mib_ipfroute)) == NULL((void *)0) ||
4288 (inetCidrRouteProto = agentx_object(ipForward,
4289 AGENTX_OID(INETCIDRROUTEPROTO)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 9 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 9 }) / sizeof(uint32_t
))
, indices, 6, 0,
4290 mib_ipfroute)) == NULL((void *)0) ||
4291 (inetCidrRouteAge = agentx_object(ipForward,
4292 AGENTX_OID(INETCIDRROUTEAGE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 10 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 10 }) / sizeof
(uint32_t))
, indices, 6, 0,
4293 mib_ipfroute)) == NULL((void *)0) ||
4294 (inetCidrRouteNextHopAS = agentx_object(ipForward,
4295 AGENTX_OID(INETCIDRROUTENEXTHOPAS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 11 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 11 }) / sizeof
(uint32_t))
, indices, 6, 0,
4296 mib_ipfroute)) == NULL((void *)0) ||
4297 (inetCidrRouteMetric1 = agentx_object(ipForward,
4298 AGENTX_OID(INETCIDRROUTEMETRIC1)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 12 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 12 }) / sizeof
(uint32_t))
, indices, 6, 0,
4299 mib_ipfroute)) == NULL((void *)0) ||
4300 (inetCidrRouteMetric2 = agentx_object(ipForward,
4301 AGENTX_OID(INETCIDRROUTEMETRIC2)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 13 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 13 }) / sizeof
(uint32_t))
, indices, 6, 0,
4302 mib_ipfroute)) == NULL((void *)0) ||
4303 (inetCidrRouteMetric3 = agentx_object(ipForward,
4304 AGENTX_OID(INETCIDRROUTEMETRIC3)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 14 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 14 }) / sizeof
(uint32_t))
, indices, 6, 0,
4305 mib_ipfroute)) == NULL((void *)0) ||
4306 (inetCidrRouteMetric4 = agentx_object(ipForward,
4307 AGENTX_OID(INETCIDRROUTEMETRIC4)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 15 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 15 }) / sizeof
(uint32_t))
, indices, 6, 0,
4308 mib_ipfroute)) == NULL((void *)0) ||
4309 (inetCidrRouteMetric5 = agentx_object(ipForward,
4310 AGENTX_OID(INETCIDRROUTEMETRIC5)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 16 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 16 }) / sizeof
(uint32_t))
, indices, 6, 0,
4311 mib_ipfroute)) == NULL((void *)0) ||
4312 (inetCidrRouteStatus = agentx_object(ipForward,
4313 AGENTX_OID(INETCIDRROUTESTATUS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 17 }, (sizeof(
(uint32_t []) { 1, 3, 6, 1, 2, 1, 4, 24, 7, 1, 17 }) / sizeof
(uint32_t))
, indices, 6, 0,
4314 mib_ipfroute)) == NULL((void *)0))
4315 fatal("agentx_object");
4316
4317 /* UCD-DISKIO-MIB */
4318 if ((ucdDiskIOMIB = agentx_region(sac, AGENTX_OID(UCDDISKIOMIB)(uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 4, 1, 2021, 13, 15 }) / sizeof(uint32_t))
,
4319 0)) == NULL((void *)0))
4320 fatal("agentx_region");
4321 if ((diskIOIdx = agentx_index_integer_dynamic(ucdDiskIOMIB,
4322 AGENTX_OID(DISKIOINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 1 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 1 }) /
sizeof(uint32_t))
)) == NULL((void *)0))
4323 fatal("agentx_index_integer_dynamic");
4324 if ((diskIOIndex = agentx_object(ucdDiskIOMIB, AGENTX_OID(DISKIOINDEX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 1 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 1 }) /
sizeof(uint32_t))
,
4325 &diskIOIdx, 1, 0, mib_diskio)) == NULL((void *)0) ||
4326 (diskIODevice = agentx_object(ucdDiskIOMIB,
4327 AGENTX_OID(DISKIODEVICE)(uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 2 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 2 }) /
sizeof(uint32_t))
, &diskIOIdx, 1, 0, mib_diskio)) == NULL((void *)0) ||
4328 (diskIONRead = agentx_object(ucdDiskIOMIB, AGENTX_OID(DISKIONREAD)(uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 3 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 3 }) /
sizeof(uint32_t))
,
4329 &diskIOIdx, 1, 0, mib_diskio)) == NULL((void *)0) ||
4330 (diskIONWritten = agentx_object(ucdDiskIOMIB,
4331 AGENTX_OID(DISKIONWRITTEN)(uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 4 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 4 }) /
sizeof(uint32_t))
, &diskIOIdx, 1, 0,
4332 mib_diskio)) == NULL((void *)0) ||
4333 (diskIOReads = agentx_object(ucdDiskIOMIB,
4334 AGENTX_OID(DISKIOREADS)(uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 5 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 5 }) /
sizeof(uint32_t))
, &diskIOIdx, 1, 0, mib_diskio)) == NULL((void *)0) ||
4335 (diskIOWrites = agentx_object(ucdDiskIOMIB,
4336 AGENTX_OID(DISKIOWRITES)(uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 6 }, (sizeof
((uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 6 }) /
sizeof(uint32_t))
, &diskIOIdx, 1, 0, mib_diskio)) == NULL((void *)0) ||
4337 (diskIONReadX = agentx_object(ucdDiskIOMIB,
4338 AGENTX_OID(DISKIONREADX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 12 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 12
}) / sizeof(uint32_t))
, &diskIOIdx, 1, 0, mib_diskio)) == NULL((void *)0) ||
4339 (diskIONWrittenX = agentx_object(ucdDiskIOMIB,
4340 AGENTX_OID(DISKIONWRITTENX)(uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 13 }, (
sizeof((uint32_t []) { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1, 13
}) / sizeof(uint32_t))
, &diskIOIdx, 1, 0,
4341 mib_diskio)) == NULL((void *)0))
4342 fatal("agentx_object");
4343
4344 if ((dot1dBridge = agentx_region(sac, AGENTX_OID(DOT1DBRIDGE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 17 }, (sizeof((uint32_t [])
{ 1, 3, 6, 1, 2, 1, 17 }) / sizeof(uint32_t))
,
4345 0)) == NULL((void *)0))
4346 fatal("agentx_region");
4347 if ((dot1dBaseNumPorts = agentx_object(dot1dBridge,
4348 AGENTX_OID(DOT1DBASENUMPORTS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 2 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 17, 1, 2 }) / sizeof(uint32_t))
, NULL((void *)0), 0, 0, mib_ifnumber)) == NULL((void *)0) ||
4349 (dot1dBaseType = agentx_object(dot1dBridge,
4350 AGENTX_OID(DOT1DBASETYPE)(uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 3 }, (sizeof((uint32_t
[]) { 1, 3, 6, 1, 2, 1, 17, 1, 3 }) / sizeof(uint32_t))
, NULL((void *)0), 0, 0, mib_dot1basetype)) == NULL((void *)0))
4351 fatal("agentx_object");
4352
4353 if ((dot1dBasePortIdx = agentx_index_integer_dynamic(dot1dBridge,
4354 AGENTX_OID(DOT1DBASEPORT)(uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 1 }) / sizeof(uint32_t
))
)) == NULL((void *)0))
4355 fatal("agentx_index_integer_dynamic");
4356 if ((dot1dBasePort = agentx_object(dot1dBridge,
4357 AGENTX_OID(DOT1DBASEPORT)(uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 1 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 1 }) / sizeof(uint32_t
))
, &dot1dBasePortIdx, 1, 0,
4358 mib_dot1dtable)) == NULL((void *)0) ||
4359 (dot1dBasePortIfIndex = agentx_object(dot1dBridge,
4360 AGENTX_OID(DOT1DBASEPORTIFINDEX)(uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 2 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 2 }) / sizeof(uint32_t
))
, &dot1dBasePortIdx, 1, 0,
4361 mib_dot1dtable)) == NULL((void *)0) ||
4362 (dot1dBasePortCircuit = agentx_object(dot1dBridge,
4363 AGENTX_OID(DOT1DBASEPORTCIRCUIT)(uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 3 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 3 }) / sizeof(uint32_t
))
, &dot1dBasePortIdx, 1, 0,
4364 mib_dot1dtable)) == NULL((void *)0) ||
4365 (dot1dBasePortDelayExceededDiscards = agentx_object(dot1dBridge,
4366 AGENTX_OID(DOT1DBASEPORTDELAYEXCEEDEDDISCARDS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 4 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 4 }) / sizeof(uint32_t
))
, &dot1dBasePortIdx,
4367 1, 0, mib_dot1dtable)) == NULL((void *)0) ||
4368 (dot1dBasePortMtuExceededDiscards = agentx_object(dot1dBridge,
4369 AGENTX_OID(DOT1DBASEPORTMTUEXCEEDEDDISCARDS)(uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 5 }, (sizeof((
uint32_t []) { 1, 3, 6, 1, 2, 1, 17, 1, 4, 1, 5 }) / sizeof(uint32_t
))
, &dot1dBasePortIdx,
4370 1, 0, mib_dot1dtable)) == NULL((void *)0))
4371 fatal("agentx_object");
4372
4373 if (daemonize) {
4374 log_init(0, LOG_DAEMON(3<<3));
4375 daemon(0, 0);
4376 }
4377 log_setverbose(verbose);
4378
4379 event_dispatch();
4380}
4381
4382#define LOG102410 10
4383void
4384pageshift_init(void)
4385{
4386 long pagesize;
4387
4388 if ((pagesize = sysconf(_SC_PAGESIZE28)) == -1)
4389 fatal("sysconf(_SC_PAGESIZE)");
4390 while (pagesize > 1) {
4391 pageshift++;
4392 pagesize >>= 1;
4393 }
4394 /* we only need the amount of log(2)1024 for our conversion */
4395 pageshift -= LOG102410;
4396}
4397
4398void
4399snmp_connect(struct agentx *sa, void *cookie, int close)
4400{
4401 static int init = 0;
4402
4403 if (close) {
4404 event_del(&connev);
4405 return;
4406 }
4407
4408 if (agentxfd != -1) {
4409 /* Exit if snmpd(8) leaves */
4410 if (init)
4411 exit(0);
4412 agentx_connect(sa, agentxfd);
4413 event_set(&connev, agentxfd, EV_READ0x02 | EV_PERSIST0x10,
4414 snmp_read, sa);
4415 event_add(&connev, NULL((void *)0));
4416 init = 1;
4417 } else
4418 snmp_tryconnect(-1, 0, sa);
4419}
4420
4421void
4422snmp_tryconnect(int fd, short event, void *cookie)
4423{
4424 struct timeval timeout = {3, 0};
4425 struct agentx *sa = cookie;
4426 struct sockaddr_un sun;
4427
4428 sun.sun_len = sizeof(sun);
4429 sun.sun_family = AF_UNIX1;
4430 strlcpy(sun.sun_path, AGENTX_MASTER_PATH"/var/agentx/master", sizeof(sun.sun_path));
4431
4432 if ((fd = socket(AF_UNIX1, SOCK_STREAM1, 0)) == -1 ||
4433 connect(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
4434 if (fd != -1)
4435 close(fd);
4436 log_warn("Failed to connect to snmpd");
4437 evtimer_set(&connev, snmp_tryconnect, sa)event_set(&connev, -1, 0, snmp_tryconnect, sa);
4438 evtimer_add(&connev, &timeout)event_add(&connev, &timeout);
4439 return;
4440 }
4441
4442 event_set(&connev, fd, EV_READ0x02 | EV_PERSIST0x10, snmp_read, sa);
4443 event_add(&connev, NULL((void *)0));
4444
4445 agentx_connect(sa, fd);
4446}
4447
4448void
4449snmp_read(int fd, short event, void *cookie)
4450{
4451 struct agentx *sa = cookie;
4452
4453 agentx_read(sa);
4454}
4455
4456u_long
4457smi_getticks(void)
4458{
4459 return agentx_context_uptime(sac);
4460}