-
Notifications
You must be signed in to change notification settings - Fork 129
/
snmp_NETFLOW.c
665 lines (586 loc) · 17 KB
/
snmp_NETFLOW.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
/* SPDX-License-Identifier: GPL-2.0-only
*
* dlmod plugin for net-snmp for monitoring
* ipt_NETFLOW module via IPT-NETFLOW-MIB.
*
* (c) 2014 <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#define iptNetflowMIB_oid 1, 3, 6, 1, 4, 1, 37476, 9000, 10, 1 /* .1.3.6.1.4.1.37476.9000.10.1 */
/* iptNetflowObjects */
static oid iptNetflowModule_oid[] = { iptNetflowMIB_oid, 1, 1 };
static oid iptNetflowSysctl_oid[] = { iptNetflowMIB_oid, 1, 2 };
/* iptNetflowStatistics */
static oid iptNetflowTotals_oid[] = { iptNetflowMIB_oid, 2, 1 };
static oid iptNetflowCpuTable_oid[] = { iptNetflowMIB_oid, 2, 2 };
static oid iptNetflowSockTable_oid[] = { iptNetflowMIB_oid, 2, 3 };
struct snmp_vars {
int obj;
int type;
char *name;
time_t ts; /* when value last read */
long long val64;
};
struct snmp_vars modinfos[] = {
{1, ASN_OCTET_STR, "name"},
{2, ASN_OCTET_STR, "version"},
{3, ASN_OCTET_STR, "srcversion"},
{4, ASN_OCTET_STR, "loadTime"}, /* DateAndTime */
{5, ASN_INTEGER, "refcnt"},
{ 0 }
};
#define MODINFO_NAME "ipt_NETFLOW"
#define MODINFO_NAME_ID 1
#define MODINFO_DATE_ID 4
struct snmp_vars sysctls[] = {
{1, ASN_INTEGER, "protocol"},
{2, ASN_INTEGER, "hashsize"},
{3, ASN_INTEGER, "maxflows"},
{4, ASN_INTEGER, "active_timeout"},
{5, ASN_INTEGER, "inactive_timeout"},
{6, ASN_INTEGER, "sndbuf"},
{7, ASN_OCTET_STR, "destination"},
{8, ASN_OCTET_STR, "aggregation"},
{9, ASN_OCTET_STR, "sampler"},
{10, ASN_INTEGER, "natevents"},
{11, ASN_INTEGER, "promisc"},
{12, ASN_OCTET_STR, "snmp-rules"},
{13, ASN_INTEGER, "scan-min"},
{ 0 }
};
struct snmp_vars totals[] = {
{1, ASN_COUNTER64, "inBitRate"},
{2, ASN_GAUGE, "inPacketRate"},
{3, ASN_COUNTER64, "inFlows"},
{4, ASN_COUNTER64, "inPackets"},
{5, ASN_COUNTER64, "inBytes"},
{6, ASN_GAUGE, "hashMetric"},
{7, ASN_GAUGE, "hashMemory"},
{8, ASN_GAUGE, "hashFlows"},
{9, ASN_GAUGE, "hashPackets"},
{10, ASN_COUNTER64, "hashBytes"},
{11, ASN_COUNTER64, "dropPackets"},
{12, ASN_COUNTER64, "dropBytes"},
{13, ASN_GAUGE, "outByteRate"},
{14, ASN_COUNTER64, "outFlows"},
{15, ASN_COUNTER64, "outPackets"},
{16, ASN_COUNTER64, "outBytes"},
{17, ASN_COUNTER64, "lostFlows"},
{18, ASN_COUNTER64, "lostPackets"},
{19, ASN_COUNTER64, "lostBytes"},
{20, ASN_COUNTER, "errTotal"},
{21, ASN_COUNTER, "sndbufPeak"},
{ 0 }
};
#define TOTALS_METRIC_ID 6
static netsnmp_table_data_set *cpu_data_set;
static netsnmp_cache *stat_cache = NULL;
struct snmp_vars cputable[] = {
{1, ASN_INTEGER, "cpuIndex"},
{2, ASN_GAUGE, "cpuInPacketRate"},
{3, ASN_COUNTER64, "cpuInFlows"},
{4, ASN_COUNTER64, "cpuInPackets"},
{5, ASN_COUNTER64, "cpuInBytes"},
{6, ASN_GAUGE, "cpuHashMetric"},
{7, ASN_COUNTER64, "cpuDropPackets"},
{8, ASN_COUNTER64, "cpuDropBytes"},
{9, ASN_COUNTER, "cpuErrTrunc"},
{10, ASN_COUNTER, "cpuErrFrag"},
{11, ASN_COUNTER, "cpuErrAlloc"},
{12, ASN_COUNTER, "cpuErrMaxflows"},
{ 0 }
};
static netsnmp_table_data_set *sock_data_set;
struct snmp_vars socktable[] = {
{1, ASN_INTEGER, "sockIndex"},
{2, ASN_OCTET_STR, "sockDestination"},
{3, ASN_INTEGER, "sockActive"},
{4, ASN_COUNTER, "sockErrConnect"},
{5, ASN_COUNTER, "sockErrFull"},
{6, ASN_COUNTER, "sockErrCberr"},
{7, ASN_COUNTER, "sockErrOther"},
{8, ASN_GAUGE, "sockSndbuf"},
{9, ASN_GAUGE, "sockSndbufFill"},
{10, ASN_GAUGE, "sockSndbufPeak"},
{ 0 }
};
static time_t totals_ts; /* when statistics last read from kernel */
static int var_max(struct snmp_vars *head)
{
struct snmp_vars *sys;
int max = 0;
for (sys = head; sys->obj; sys++)
if (max < sys->obj)
max = sys->obj;
return max;
}
static struct snmp_vars *find_varinfo(struct snmp_vars *head, const int obj)
{
struct snmp_vars *sys;
for (sys = head; sys->obj; sys++) {
if (sys->obj == obj)
return sys;
}
return NULL;
}
static struct snmp_vars *find_varinfo_str(struct snmp_vars *head, const char *name)
{
struct snmp_vars *sys;
for (sys = head; sys->obj; sys++) {
if (!strcmp(sys->name, name))
return sys;
}
return NULL;
}
static void modinfo_fname(char *name, char *fname, size_t flen)
{
snprintf(fname, flen, "/sys/module/" MODINFO_NAME "/%s", name);
}
static void sysctl_fname(char *name, char *fname, size_t flen)
{
snprintf(fname, flen, "/proc/sys/net/netflow/%s", name);
}
static int sysctl_access_ok(char *name)
{
char fname[64];
sysctl_fname(name, fname, sizeof(fname));
if (access(fname, W_OK) < 0)
return 0;
return 1;
}
static char *file_read_string(char *name, char *buf, size_t size)
{
int fd = open(name, O_RDONLY);
if (fd < 0)
return NULL;
int n = read(fd, buf, size - 1);
if (n < 0) {
close(fd);
return NULL;
}
buf[n] = '\0';
close(fd);
return buf;
}
static char *modinfo_read_string(char *name, char *buf, size_t size)
{
char fname[64];
modinfo_fname(name, fname, sizeof(fname));
return file_read_string(fname, buf, size);
}
static char *sysctl_read_string(char *name, char *buf, size_t size)
{
char fname[64];
sysctl_fname(name, fname, sizeof(fname));
return file_read_string(fname, buf, size);
}
static int sysctl_write_string(char *name, char *buf, size_t size)
{
char fname[64];
int fd;
int n;
sysctl_fname(name, fname, sizeof(fname));
fd = open(fname, O_RDWR, 0644);
if (fd < 0)
return fd;
n = write(fd, buf, size);
close(fd);
return n;
}
static int sysctl_read(netsnmp_request_info *request, int obj)
{
struct snmp_vars *sys = find_varinfo(sysctls, obj);
char buf[225];
char *p;
long value;
if (!sys)
goto nosuchobject;
p = sysctl_read_string(sys->name, buf, sizeof(buf));
if (!p)
goto nosuchobject;
switch (sys->type) {
case ASN_INTEGER:
value = atoi(p);
snmp_set_var_typed_value(request->requestvb,
sys->type,
(u_char *)&value, sizeof(value));
return SNMP_ERR_NOERROR;
case ASN_OCTET_STR:
snmp_set_var_typed_value(request->requestvb,
sys->type,
(u_char *)p, strcspn(p, "\n"));
return SNMP_ERR_NOERROR;
}
nosuchobject:
netsnmp_request_set_error(request, SNMP_NOSUCHOBJECT);
return SNMP_ERR_NOERROR;
}
static int sysctl_write(netsnmp_request_info *request, int obj)
{
struct snmp_vars *sys = find_varinfo(sysctls, obj);
char buf[225];
int len;
if (!sys) {
netsnmp_request_set_error(request, SNMP_NOSUCHOBJECT);
return SNMP_ERR_NOERROR;
}
switch (sys->type) {
case ASN_INTEGER:
snprintf(buf, sizeof(buf), "%ld\n", *(request->requestvb->val.integer));
break;
case ASN_UNSIGNED:
snprintf(buf, sizeof(buf), "%lu\n", *(request->requestvb->val.integer));
break;
case ASN_OCTET_STR:
snprintf(buf, sizeof(buf), "%s\n", request->requestvb->val.string);
break;
default:
netsnmp_request_set_error(request, SNMP_ERR_WRONGTYPE);
return SNMP_ERR_NOERROR;
}
len = strlen(buf);
if (sysctl_write_string(sys->name, buf, len) < len)
netsnmp_request_set_error(request, SNMP_ERR_BADVALUE);
return SNMP_ERR_NOERROR;
}
static int iptNetflowModule_handler(
netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *request)
{
struct snmp_vars *sys;
oid obj;
char buf[225];
char *p = NULL;
long value;
obj = request->requestvb->name[request->requestvb->name_length - 2];
sys = find_varinfo(modinfos, obj);
if (!sys) {
netsnmp_request_set_error(request, SNMP_ERR_NOSUCHNAME);
return SNMP_ERR_NOERROR;
}
if (reqinfo->mode != MODE_GET) {
netsnmp_request_set_error(request, SNMP_ERR_READONLY);
return SNMP_ERR_NOERROR;
}
switch (obj) {
case MODINFO_NAME_ID:
p = MODINFO_NAME;
break;
case MODINFO_DATE_ID: {
size_t len;
struct stat st;
modinfo_fname(".", buf, sizeof(buf));
if (stat(buf, &st) < 0)
break;
p = (char *)date_n_time(&st.st_mtime, &len);
snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, p, len);
return SNMP_ERR_NOERROR;
}
default:
p = modinfo_read_string(sys->name, buf, sizeof(buf));
}
if (!p) {
netsnmp_request_set_error(request, SNMP_ERR_NOSUCHNAME);
return SNMP_ERR_NOERROR;
}
switch (sys->type) {
case ASN_INTEGER:
value = atoi(p);
snmp_set_var_typed_value(request->requestvb,
sys->type,
(u_char *)&value, sizeof(value));
break;
case ASN_OCTET_STR:
snmp_set_var_typed_value(request->requestvb,
sys->type,
(u_char *)p, strcspn(p, "\n"));
break;
default:
netsnmp_request_set_error(request, SNMP_ERR_WRONGTYPE);
}
return SNMP_ERR_NOERROR;
}
static int iptNetflowSysctl_handler(
netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *request)
{
struct snmp_vars *sys;
oid obj;
obj = request->requestvb->name[request->requestvb->name_length - 2];
switch (reqinfo->mode) {
case MODE_GET:
return sysctl_read(request, obj);
case MODE_SET_RESERVE1:
sys = find_varinfo(sysctls, obj);
if (!sys || !sysctl_access_ok(sys->name))
netsnmp_request_set_error(request, SNMP_ERR_NOSUCHNAME);
if (sys && request->requestvb->type != sys->type)
netsnmp_request_set_error(request, SNMP_ERR_WRONGTYPE);
break;
case MODE_SET_RESERVE2:
case MODE_SET_FREE:
case MODE_SET_UNDO:
case MODE_SET_COMMIT:
return SNMP_ERR_NOERROR;
case MODE_SET_ACTION:
return sysctl_write(request, obj);
default:
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
#define TOTAL_INTERVAL 1
static void clear_data_set(netsnmp_table_data_set *data_set)
{
netsnmp_table_row *row, *nextrow;
for (row = netsnmp_table_data_set_get_first_row(data_set); row; row = nextrow) {
nextrow = netsnmp_table_data_set_get_next_row(data_set, row);
netsnmp_table_dataset_remove_and_delete_row(data_set, row);
}
}
static void parse_table_row(
int cpu,
char *p,
struct snmp_vars *sys,
netsnmp_table_data_set *data_set)
{
netsnmp_table_row *row;
row = netsnmp_create_table_data_row();
netsnmp_table_row_add_index(row, ASN_INTEGER, (u_char *)&cpu, sizeof(cpu));
if (sys == cputable) {
/* add cpuIndex as column too to break SMIv2 */
netsnmp_set_row_column(row, 1, sys->type, (char *)&cpu, sizeof(cpu));
}
for (++sys; p && sys->obj; sys++) {
char *val;
long long val64;
unsigned int uval32;
int val32;
struct counter64 c64;
p += strspn(p, " \t");
val = p;
if ((p = strpbrk(p, " \t")))
*p++ = '\0';
if (index(val, '.')) {
double d = strtod(val, NULL);
val64 = (long long)(d * 100);
} else
val64 = strtoll(val, NULL, 10);
switch (sys->type) {
case ASN_OCTET_STR:
netsnmp_set_row_column(row, sys->obj,
sys->type, (char *)val, strlen(val));
break;
case ASN_INTEGER:
case ASN_GAUGE:
val32 = (int)val64;
netsnmp_set_row_column(row, sys->obj,
sys->type, (char *)&val32, sizeof(val32));
break;
case ASN_COUNTER:
uval32 = (unsigned int)val64;
netsnmp_set_row_column(row, sys->obj,
sys->type, (char *)&uval32, sizeof(uval32));
break;
case ASN_COUNTER64:
c64.low = (uint32_t)val64;
c64.high = val64 >> 32;
netsnmp_set_row_column(row, sys->obj,
sys->type, (char *)&c64, sizeof(c64));
break;
default:
netsnmp_table_dataset_delete_row(row);
continue;
}
}
netsnmp_table_data_add_row(data_set->table, row);
}
static void grab_ipt_netflow_snmp(time_t now)
{
static char buf[4096];
int fd;
int n;
char *p = buf;
if ((now - totals_ts) < (TOTAL_INTERVAL + 1))
return;
if ((fd = open("/proc/net/stat/ipt_netflow_snmp", O_RDONLY)) < 0)
return;
n = read(fd, buf, sizeof(buf) - 1);
close(fd);
if (n <= 0)
return;
buf[n] = '\0';
DEBUGMSGTL(("netflow", "%s\n", buf));
clear_data_set(cpu_data_set);
clear_data_set(sock_data_set);
while (*p) {
struct snmp_vars *sys;
char *name = p;
char *val;
if (!(p = strpbrk(p, " \t")))
break;
*p++ = '\0';
val = p + strspn(p, " \t");
p = index(p, '\n');
*p++ = '\0';
if (!strncmp(name, "cpu", 3)) {
parse_table_row(atoi(name + 3), val, cputable, cpu_data_set);
continue;
} else if (!strncmp(name, "sock", 4)) {
parse_table_row(atoi(name + 4), val, socktable, sock_data_set);
continue;
}
if (!(sys = find_varinfo_str(totals, name)))
continue;
if (index(val, '.')) {
double d = strtod(val, NULL);
sys->val64 = (long long)(d * 100);
} else
sys->val64 = strtoll(val, NULL, 10);
sys->ts = now;
}
totals_ts = now;
}
static int iptNetflowTotals_handler(
netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *request)
{
struct snmp_vars *sys;
time_t now = time(NULL);
oid obj;
unsigned int uval32;
int val32;
struct counter64 c64;
grab_ipt_netflow_snmp(now);
obj = request->requestvb->name[request->requestvb->name_length - 2];
sys = find_varinfo(totals, obj);
if (!sys || ((now - sys->ts) > (TOTAL_INTERVAL * 2 + 3))) {
netsnmp_request_set_error(request, SNMP_ERR_NOSUCHNAME);
return SNMP_ERR_NOERROR;
}
if (reqinfo->mode != MODE_GET) {
netsnmp_request_set_error(request, SNMP_ERR_READONLY);
return SNMP_ERR_NOERROR;
}
switch (sys->type) {
case ASN_GAUGE:
val32 = (int)sys->val64;
snmp_set_var_typed_value(request->requestvb,
sys->type, (u_char *)&val32, sizeof(val32));
break;
case ASN_COUNTER:
uval32 = (unsigned int)sys->val64;
snmp_set_var_typed_value(request->requestvb,
sys->type, (u_char *)&uval32, sizeof(uval32));
break;
case ASN_COUNTER64:
c64.low = (uint32_t)sys->val64;
c64.high = sys->val64 >> 32;
snmp_set_var_typed_value(request->requestvb,
ASN_COUNTER64, (u_char *)&c64, sizeof(c64));
break;
default:
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
static int stat_cache_load(netsnmp_cache *cache, void *x)
{
grab_ipt_netflow_snmp(time(NULL));
return 0;
}
static void dummy_cache_free(netsnmp_cache *cache, void *x)
{
/* free_cache callback is not always checked for NULL
* pointer. */
}
void init_netflow(void)
{
netsnmp_handler_registration *reg;
struct snmp_vars *sys;
/* snmpd -f -L -Dnetflow,dlmod */
DEBUGMSGTL(("netflow", "init_netflow\n"));
netsnmp_register_scalar_group(
netsnmp_create_handler_registration(
"iptNetflowModule",
iptNetflowModule_handler,
iptNetflowModule_oid,
OID_LENGTH(iptNetflowModule_oid),
HANDLER_CAN_RONLY),
1, var_max(modinfos));
netsnmp_register_scalar_group(
netsnmp_create_handler_registration(
"iptNetflowSysctl",
iptNetflowSysctl_handler,
iptNetflowSysctl_oid,
OID_LENGTH(iptNetflowSysctl_oid),
HANDLER_CAN_RWRITE),
1, var_max(sysctls));
netsnmp_register_scalar_group(
netsnmp_create_handler_registration(
"iptNetflowTotals",
iptNetflowTotals_handler,
iptNetflowTotals_oid,
OID_LENGTH(iptNetflowTotals_oid),
HANDLER_CAN_RONLY),
1, var_max(totals));
/* Register first table. */
reg = netsnmp_create_handler_registration(
"iptNetflowCpuTable", /* no handler */ NULL,
iptNetflowCpuTable_oid, OID_LENGTH(iptNetflowCpuTable_oid),
HANDLER_CAN_RONLY);
/* set up columns */
cpu_data_set = netsnmp_create_table_data_set("iptNetflowCpuDataSet");
netsnmp_table_set_add_indexes(cpu_data_set, ASN_INTEGER, 0);
/* I include cpuIndex into columns, which is not SMIv2'ish */
for (sys = cputable; sys->obj; sys++)
netsnmp_table_set_add_default_row(cpu_data_set, sys->obj, sys->type, 0, NULL, 0);
netsnmp_register_table_data_set(reg, cpu_data_set, NULL);
/* cache handler will load actual data, and it needs to be
* injected in front of dataset handler to be called first */
stat_cache = netsnmp_cache_create(
/* no timeout */ -1,
stat_cache_load, dummy_cache_free,
iptNetflowCpuTable_oid, OID_LENGTH(iptNetflowCpuTable_oid));
netsnmp_inject_handler(reg, netsnmp_cache_handler_get(stat_cache));
/* Register second table. */
reg = netsnmp_create_handler_registration(
"iptNetflowSockTable", /* no handler */ NULL,
iptNetflowSockTable_oid, OID_LENGTH(iptNetflowSockTable_oid),
HANDLER_CAN_RONLY);
/* set up columns */
sock_data_set = netsnmp_create_table_data_set("iptNetflowSockDataSet");
/* I don't include sockIndex into columns, which is more SMIv2'ish */
netsnmp_table_set_add_indexes(sock_data_set, ASN_INTEGER, 0);
for (sys = &socktable[1]; sys->obj; sys++)
netsnmp_table_set_add_default_row(sock_data_set, sys->obj, sys->type, 0, NULL, 0);
netsnmp_register_table_data_set(reg, sock_data_set, NULL);
/* as before, cache handler will load actual data, and it needs
* to be injected in front of dataset handler to be called first */
stat_cache = netsnmp_cache_create(
/* no timeout */ -1,
stat_cache_load, dummy_cache_free,
iptNetflowSockTable_oid, OID_LENGTH(iptNetflowSockTable_oid));
netsnmp_inject_handler(reg, netsnmp_cache_handler_get(stat_cache));
}
void deinit_netflow(void)
{
DEBUGMSGTL(("netflow", "deinit_netflow\n"));
}