]> git.proxmox.com Git - mirror_frr.git/blame - eigrpd/eigrp_snmp.c
lib: enforce vrf_name_to_id by returning default_vrf when name is null
[mirror_frr.git] / eigrpd / eigrp_snmp.c
CommitLineData
7f57883e
DS
1/*
2 * EIGRP SNMP Support.
3 * Copyright (C) 2013-2014
4 * Authors:
5 * Donnie Savage
6 * Jan Janovic
7 * Matej Perina
8 * Peter Orsag
9 * Peter Paluch
10 *
11 * This file is part of GNU Zebra.
12 *
13 * GNU Zebra is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2, or (at your option) any
16 * later version.
17 *
18 * GNU Zebra is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
896014f4
DL
23 * You should have received a copy of the GNU General Public License along
24 * with this program; see the file COPYING; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
7f57883e
DS
26 */
27
28#include <zebra.h>
29
30#ifdef HAVE_SNMP
31#include <net-snmp/net-snmp-config.h>
32#include <net-snmp/net-snmp-includes.h>
33
34#include "thread.h"
35#include "memory.h"
36#include "linklist.h"
37#include "prefix.h"
38#include "if.h"
39#include "table.h"
40#include "sockunion.h"
41#include "stream.h"
42#include "log.h"
43#include "sockopt.h"
44#include "checksum.h"
45#include "md5.h"
46#include "keychain.h"
47#include "smux.h"
48
49#include "eigrpd/eigrp_structs.h"
50#include "eigrpd/eigrpd.h"
51#include "eigrpd/eigrp_interface.h"
52#include "eigrpd/eigrp_neighbor.h"
53#include "eigrpd/eigrp_packet.h"
54#include "eigrpd/eigrp_zebra.h"
55#include "eigrpd/eigrp_vty.h"
56#include "eigrpd/eigrp_dump.h"
57#include "eigrpd/eigrp_network.h"
58#include "eigrpd/eigrp_topology.h"
59#include "eigrpd/eigrp_fsm.h"
60#include "eigrpd/eigrp_snmp.h"
61
7f57883e
DS
62struct list *eigrp_snmp_iflist;
63
64/* Declare static local variables for convenience. */
65SNMP_LOCAL_VARIABLES
66
67/* EIGRP-MIB - 1.3.6.1.4.1.9.9.449.1*/
68#define EIGRPMIB 1,3,6,1,4,1,9,9,449,1
69
70/* EIGRP-MIB instances. */
d62a17ae 71oid eigrp_oid[] = {EIGRPMIB};
7f57883e
DS
72
73/* EIGRP VPN entry */
f9e5c9ca 74#define EIGRPVPNID 1
7f57883e
DS
75#define EIGRPVPNNAME 2
76
77/* EIGRP Traffic statistics entry */
f9e5c9ca
DS
78#define EIGRPASNUMBER 1
79#define EIGRPNBRCOUNT 2
80#define EIGRPHELLOSSENT 3
81#define EIGRPHELLOSRCVD 4
82#define EIGRPUPDATESSENT 5
83#define EIGRPUPDATESRCVD 6
84#define EIGRPQUERIESSENT 7
85#define EIGRPQUERIESRCVD 8
86#define EIGRPREPLIESSENT 9
87#define EIGRPREPLIESRCVD 10
88#define EIGRPACKSSENT 11
89#define EIGRPACKSRCVD 12
90#define EIGRPINPUTQHIGHMARK 13
91#define EIGRPINPUTQDROPS 14
92#define EIGRPSIAQUERIESSENT 15
93#define EIGRPSIAQUERIESRCVD 16
94#define EIGRPASROUTERIDTYPE 17
95#define EIGRPASROUTERID 18
96#define EIGRPTOPOROUTES 19
97#define EIGRPHEADSERIAL 20
98#define EIGRPNEXTSERIAL 21
7f57883e 99#define EIGRPXMITPENDREPLIES 22
f9e5c9ca 100#define EIGRPXMITDUMMIES 23
7f57883e
DS
101
102/* EIGRP topology entry */
f9e5c9ca
DS
103#define EIGRPDESTNETTYPE 1
104#define EIGRPDESTNET 2
7f57883e 105#define EIGRPDESTNETPREFIXLEN 4
f9e5c9ca
DS
106#define EIGRPACTIVE 5
107#define EIGRPSTUCKINACTIVE 6
108#define EIGRPDESTSUCCESSORS 7
109#define EIGRPFDISTANCE 8
7f57883e
DS
110#define EIGRPROUTEORIGINTYPE 9
111#define EIGRPROUTEORIGINADDRTYPE 10
112#define EIGRPROUTEORIGINADDR 11
113#define EIGRPNEXTHOPADDRESSTYPE 12
f9e5c9ca 114#define EIGRPNEXTHOPADDRESS 13
7f57883e 115#define EIGRPNEXTHOPINTERFACE 14
f9e5c9ca
DS
116#define EIGRPDISTANCE 15
117#define EIGRPREPORTDISTANCE 16
7f57883e
DS
118
119/* EIGRP peer entry */
120#define EIGRPHANDLE 1
121#define EIGRPPEERADDRTYPE 2
122#define EIGRPPEERADDR 3
123#define EIGRPPEERIFINDEX 4
124#define EIGRPHOLDTIME 5
125#define EIGRPUPTIME 6
126#define EIGRPSRTT 7
127#define EIGRPRTO 8
128#define EIGRPPKTSENQUEUED 9
129#define EIGRPLASTSEQ 10
130#define EIGRPVERSION 11
131#define EIGRPRETRANS 12
132#define EIGRPRETRIES 13
133
134/* EIGRP interface entry */
135#define EIGRPPEERCOUNT 3
136#define EIGRPXMITRELIABLEQ 4
137#define EIGRPXMITUNRELIABLEQ 5
138#define EIGRPMEANSRTT 6
139#define EIGRPPACINGRELIABLE 7
140#define EIGRPPACINGUNRELIABLE 8
141#define EIGRPMFLOWTIMER 9
142#define EIGRPPENDINGROUTES 10
143#define EIGRPHELLOINTERVAL 11
144#define EIGRPXMITNEXTSERIAL 12
145#define EIGRPUMCASTS 13
146#define EIGRPRMCASTS 14
147#define EIGRPUUCASTS 15
148#define EIGRPRUCASTS 16
149#define EIGRPMCASTEXCEPTS 17
150#define EIGRPCRPKTS 18
151#define EIGRPACKSSUPPRESSED 19
152#define EIGRPRETRANSSENT 20
153#define EIGRPOOSRCVD 21
154#define EIGRPAUTHMODE 22
155#define EIGRPAUTHKEYCHAIN 23
156
157/* SNMP value hack. */
158#define COUNTER ASN_COUNTER
159#define INTEGER ASN_INTEGER
160#define GAUGE ASN_GAUGE
161#define TIMETICKS ASN_TIMETICKS
162#define IPADDRESS ASN_IPADDRESS
163#define STRING ASN_OCTET_STR
164#define IPADDRESSPREFIXLEN ASN_INTEGER
165#define IPADDRESSTYPE ASN_INTEGER
166#define INTERFACEINDEXORZERO ASN_INTEGER
167#define UINTEGER ASN_UNSIGNED
168
7f57883e 169/* Hook functions. */
d7c0a89a 170static uint8_t *eigrpVpnEntry(struct variable *, oid *, size_t *, int, size_t *,
d62a17ae 171 WriteMethod **);
d7c0a89a
QY
172static uint8_t *eigrpTraffStatsEntry(struct variable *, oid *, size_t *, int,
173 size_t *, WriteMethod **);
174static uint8_t *eigrpTopologyEntry(struct variable *, oid *, size_t *, int,
d62a17ae 175 size_t *, WriteMethod **);
d7c0a89a
QY
176static uint8_t *eigrpPeerEntry(struct variable *, oid *, size_t *, int,
177 size_t *, WriteMethod **);
178static uint8_t *eigrpInterfaceEntry(struct variable *, oid *, size_t *, int,
179 size_t *, WriteMethod **);
d62a17ae 180
181
182struct variable eigrp_variables[] = {
183 /* EIGRP vpn variables */
184 {EIGRPVPNID, INTEGER, NOACCESS, eigrpVpnEntry, 4, {1, 1, 1, 1}},
185 {EIGRPVPNNAME, STRING, RONLY, eigrpVpnEntry, 4, {1, 1, 1, 2}},
186
187 /* EIGRP traffic stats variables */
188 {EIGRPASNUMBER,
189 UINTEGER,
190 NOACCESS,
191 eigrpTraffStatsEntry,
192 4,
193 {2, 1, 1, 1}},
194 {EIGRPNBRCOUNT, UINTEGER, RONLY, eigrpTraffStatsEntry, 4, {2, 1, 1, 2}},
195 {EIGRPHELLOSSENT,
196 COUNTER,
197 RONLY,
198 eigrpTraffStatsEntry,
199 4,
200 {2, 1, 1, 3}},
201 {EIGRPHELLOSRCVD,
202 COUNTER,
203 RONLY,
204 eigrpTraffStatsEntry,
205 4,
206 {2, 1, 1, 4}},
207 {EIGRPUPDATESSENT,
208 COUNTER,
209 RONLY,
210 eigrpTraffStatsEntry,
211 4,
212 {2, 1, 1, 5}},
213 {EIGRPUPDATESRCVD,
214 COUNTER,
215 RONLY,
216 eigrpTraffStatsEntry,
217 4,
218 {2, 1, 1, 6}},
219 {EIGRPQUERIESSENT,
220 COUNTER,
221 RONLY,
222 eigrpTraffStatsEntry,
223 4,
224 {2, 1, 1, 7}},
225 {EIGRPQUERIESRCVD,
226 COUNTER,
227 RONLY,
228 eigrpTraffStatsEntry,
229 4,
230 {2, 1, 1, 8}},
231 {EIGRPREPLIESSENT,
232 COUNTER,
233 RONLY,
234 eigrpTraffStatsEntry,
235 4,
236 {2, 1, 1, 9}},
237 {EIGRPREPLIESRCVD,
238 COUNTER,
239 RONLY,
240 eigrpTraffStatsEntry,
241 4,
242 {2, 1, 1, 10}},
243 {EIGRPACKSSENT, COUNTER, RONLY, eigrpTraffStatsEntry, 4, {2, 1, 1, 11}},
244 {EIGRPACKSRCVD, COUNTER, RONLY, eigrpTraffStatsEntry, 4, {2, 1, 1, 12}},
245 {EIGRPINPUTQHIGHMARK,
246 INTEGER,
247 RONLY,
248 eigrpTraffStatsEntry,
249 4,
250 {2, 1, 1, 13}},
251 {EIGRPINPUTQDROPS,
252 COUNTER,
253 RONLY,
254 eigrpTraffStatsEntry,
255 4,
256 {2, 1, 1, 14}},
257 {EIGRPSIAQUERIESSENT,
258 COUNTER,
259 RONLY,
260 eigrpTraffStatsEntry,
261 4,
262 {2, 1, 1, 15}},
263 {EIGRPSIAQUERIESRCVD,
264 COUNTER,
265 RONLY,
266 eigrpTraffStatsEntry,
267 4,
268 {2, 1, 1, 16}},
269 {EIGRPASROUTERIDTYPE,
270 IPADDRESSTYPE,
271 RONLY,
272 eigrpTraffStatsEntry,
273 4,
274 {2, 1, 1, 17}},
275 {EIGRPASROUTERID,
276 IPADDRESS,
277 RONLY,
278 eigrpTraffStatsEntry,
279 4,
280 {2, 1, 1, 18}},
281 {EIGRPTOPOROUTES,
282 COUNTER,
283 RONLY,
284 eigrpTraffStatsEntry,
285 4,
286 {2, 1, 1, 19}},
287 {EIGRPHEADSERIAL,
288 COUNTER,
289 RONLY,
290 eigrpTraffStatsEntry,
291 4,
292 {2, 1, 1, 20}},
293 {EIGRPNEXTSERIAL,
294 COUNTER,
295 RONLY,
296 eigrpTraffStatsEntry,
297 4,
298 {2, 1, 1, 21}},
299 {EIGRPXMITPENDREPLIES,
300 INTEGER,
301 RONLY,
302 eigrpTraffStatsEntry,
303 4,
304 {2, 1, 1, 22}},
305 {EIGRPXMITDUMMIES,
306 COUNTER,
307 RONLY,
308 eigrpTraffStatsEntry,
309 4,
310 {2, 1, 1, 23}},
311
312 /* EIGRP topology variables */
313 {EIGRPDESTNETTYPE,
314 IPADDRESSTYPE,
315 NOACCESS,
316 eigrpTopologyEntry,
317 4,
318 {3, 1, 1, 1}},
319 {EIGRPDESTNET,
320 IPADDRESSPREFIXLEN,
321 NOACCESS,
322 eigrpTopologyEntry,
323 4,
324 {3, 1, 1, 2}},
325 {EIGRPDESTNETPREFIXLEN,
326 IPADDRESSTYPE,
327 NOACCESS,
328 eigrpTopologyEntry,
329 4,
330 {3, 1, 1, 4}},
331 {EIGRPACTIVE, INTEGER, RONLY, eigrpTopologyEntry, 4, {3, 1, 1, 5}},
332 {EIGRPSTUCKINACTIVE,
333 INTEGER,
334 RONLY,
335 eigrpTopologyEntry,
336 4,
337 {3, 1, 1, 6}},
338 {EIGRPDESTSUCCESSORS,
339 INTEGER,
340 RONLY,
341 eigrpTopologyEntry,
342 4,
343 {3, 1, 1, 7}},
344 {EIGRPFDISTANCE, INTEGER, RONLY, eigrpTopologyEntry, 4, {3, 1, 1, 8}},
345 {EIGRPROUTEORIGINTYPE,
346 STRING,
347 RONLY,
348 eigrpTopologyEntry,
349 4,
350 {3, 1, 1, 9}},
351 {EIGRPROUTEORIGINADDRTYPE,
352 IPADDRESSTYPE,
353 RONLY,
354 eigrpTopologyEntry,
355 4,
356 {3, 1, 1, 10}},
357 {EIGRPROUTEORIGINADDR,
358 IPADDRESS,
359 RONLY,
360 eigrpTopologyEntry,
361 4,
362 {3, 1, 1, 11}},
363 {EIGRPNEXTHOPADDRESSTYPE,
364 IPADDRESSTYPE,
365 RONLY,
366 eigrpTopologyEntry,
367 4,
368 {3, 1, 1, 12}},
369 {EIGRPNEXTHOPADDRESS,
370 IPADDRESS,
371 RONLY,
372 eigrpTopologyEntry,
373 4,
374 {3, 1, 1, 13}},
375 {EIGRPNEXTHOPINTERFACE,
376 STRING,
377 RONLY,
378 eigrpTopologyEntry,
379 4,
380 {3, 1, 1, 14}},
381 {EIGRPDISTANCE, INTEGER, RONLY, eigrpTopologyEntry, 4, {3, 1, 1, 15}},
382 {EIGRPREPORTDISTANCE,
383 INTEGER,
384 RONLY,
385 eigrpTopologyEntry,
386 4,
387 {3, 1, 1, 16}},
388
389 /* EIGRP peer variables */
390 {EIGRPHANDLE, INTEGER, NOACCESS, eigrpPeerEntry, 4, {4, 1, 1, 1}},
391 {EIGRPPEERADDRTYPE,
392 IPADDRESSTYPE,
393 RONLY,
394 eigrpPeerEntry,
395 4,
396 {4, 1, 1, 2}},
397 {EIGRPPEERADDR, IPADDRESS, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 3}},
398 {EIGRPPEERIFINDEX,
399 INTERFACEINDEXORZERO,
400 RONLY,
401 eigrpPeerEntry,
402 4,
403 {4, 1, 1, 4}},
404 {EIGRPHOLDTIME, INTEGER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 5}},
405 {EIGRPUPTIME, STRING, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 6}},
406 {EIGRPSRTT, INTEGER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 7}},
407 {EIGRPRTO, INTEGER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 8}},
408 {EIGRPPKTSENQUEUED, INTEGER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 9}},
409 {EIGRPLASTSEQ, INTEGER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 10}},
410 {EIGRPVERSION, STRING, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 11}},
411 {EIGRPRETRANS, COUNTER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 12}},
412 {EIGRPRETRIES, INTEGER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 13}},
413
414 /* EIGRP interface variables */
415 {EIGRPPEERCOUNT, GAUGE, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 3}},
416 {EIGRPXMITRELIABLEQ,
417 GAUGE,
418 RONLY,
419 eigrpInterfaceEntry,
420 4,
421 {5, 1, 1, 4}},
422 {EIGRPXMITUNRELIABLEQ,
423 GAUGE,
424 RONLY,
425 eigrpInterfaceEntry,
426 4,
427 {5, 1, 1, 5}},
428 {EIGRPMEANSRTT, INTEGER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 6}},
429 {EIGRPPACINGRELIABLE,
430 INTEGER,
431 RONLY,
432 eigrpInterfaceEntry,
433 4,
434 {5, 1, 1, 7}},
435 {EIGRPPACINGUNRELIABLE,
436 INTEGER,
437 RONLY,
438 eigrpInterfaceEntry,
439 4,
440 {5, 1, 1, 8}},
441 {EIGRPMFLOWTIMER, INTEGER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 9}},
442 {EIGRPPENDINGROUTES,
443 GAUGE,
444 RONLY,
445 eigrpInterfaceEntry,
446 4,
447 {5, 1, 1, 10}},
448 {EIGRPHELLOINTERVAL,
449 INTEGER,
450 RONLY,
451 eigrpInterfaceEntry,
452 4,
453 {5, 1, 1, 11}},
454 {EIGRPXMITNEXTSERIAL,
455 COUNTER,
456 RONLY,
457 eigrpInterfaceEntry,
458 4,
459 {5, 1, 1, 12}},
460 {EIGRPUMCASTS, COUNTER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 13}},
461 {EIGRPRMCASTS, COUNTER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 14}},
462 {EIGRPUUCASTS, COUNTER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 15}},
463 {EIGRPRUCASTS, COUNTER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 16}},
464 {EIGRPMCASTEXCEPTS,
465 COUNTER,
466 RONLY,
467 eigrpInterfaceEntry,
468 4,
469 {5, 1, 1, 17}},
470 {EIGRPCRPKTS, COUNTER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 18}},
471 {EIGRPACKSSUPPRESSED,
472 COUNTER,
473 RONLY,
474 eigrpInterfaceEntry,
475 4,
476 {5, 1, 1, 19}},
477 {EIGRPRETRANSSENT,
478 COUNTER,
479 RONLY,
480 eigrpInterfaceEntry,
481 4,
482 {5, 1, 1, 20}},
483 {EIGRPOOSRCVD, COUNTER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 21}},
484 {EIGRPAUTHMODE, INTEGER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 22}},
485 {EIGRPAUTHKEYCHAIN,
486 STRING,
487 RONLY,
488 eigrpInterfaceEntry,
489 4,
490 {5, 1, 1, 23}}};
491
492static struct eigrp_neighbor *eigrp_snmp_nbr_lookup(struct eigrp *eigrp,
493 struct in_addr *nbr_addr,
494 unsigned int *ifindex)
7f57883e 495{
d62a17ae 496 struct listnode *node, *nnode, *node2, *nnode2;
497 struct eigrp_interface *ei;
498 struct eigrp_neighbor *nbr;
499
500 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode, ei)) {
501 for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) {
502 if (IPV4_ADDR_SAME(&nbr->src, nbr_addr)) {
503 return nbr;
504 }
505 }
506 }
507 return NULL;
7f57883e
DS
508}
509
510static struct eigrp_neighbor *
d62a17ae 511eigrp_snmp_nbr_lookup_next(struct in_addr *nbr_addr, unsigned int *ifindex,
512 int first)
7f57883e 513{
d62a17ae 514 struct listnode *node, *nnode, *node2, *nnode2;
515 struct eigrp_interface *ei;
516 struct eigrp_neighbor *nbr;
d62a17ae 517 struct eigrp_neighbor *min = NULL;
1aa37b48 518 struct eigrp *eigrp;
d62a17ae 519
520 eigrp = eigrp_lookup();
521
522 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode, ei)) {
523 for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) {
524 if (first) {
525 if (!min)
526 min = nbr;
527 else if (ntohl(nbr->src.s_addr)
528 < ntohl(min->src.s_addr))
529 min = nbr;
530 } else if (ntohl(nbr->src.s_addr)
531 > ntohl(nbr_addr->s_addr)) {
532 if (!min)
533 min = nbr;
534 else if (ntohl(nbr->src.s_addr)
535 < ntohl(min->src.s_addr))
536 min = nbr;
537 }
538 }
539 }
540 if (min) {
541 *nbr_addr = min->src;
542 *ifindex = 0;
543 return min;
544 }
545 return NULL;
7f57883e
DS
546}
547
d62a17ae 548static struct eigrp_neighbor *eigrpNbrLookup(struct variable *v, oid *name,
549 size_t *length,
550 struct in_addr *nbr_addr,
551 unsigned int *ifindex, int exact)
7f57883e 552{
d62a17ae 553 unsigned int len;
554 int first;
555 struct eigrp_neighbor *nbr;
556 struct eigrp *eigrp;
557
558 eigrp = eigrp_lookup();
559
560 if (!eigrp)
561 return NULL;
562
563 if (exact) {
564 if (*length != v->namelen + IN_ADDR_SIZE + 1)
565 return NULL;
566
567 oid2in_addr(name + v->namelen, IN_ADDR_SIZE, nbr_addr);
568 *ifindex = name[v->namelen + IN_ADDR_SIZE];
569
570 return eigrp_snmp_nbr_lookup(eigrp, nbr_addr, ifindex);
571 } else {
572 first = 0;
573 len = *length - v->namelen;
574
d11c6941 575 if (len == 0)
d62a17ae 576 first = 1;
577
578 if (len > IN_ADDR_SIZE)
579 len = IN_ADDR_SIZE;
580
581 oid2in_addr(name + v->namelen, len, nbr_addr);
582
583 len = *length - v->namelen - IN_ADDR_SIZE;
584 if (len >= 1)
585 *ifindex = name[v->namelen + IN_ADDR_SIZE];
586
587 nbr = eigrp_snmp_nbr_lookup_next(nbr_addr, ifindex, first);
588
589 if (nbr) {
590 *length = v->namelen + IN_ADDR_SIZE + 1;
591 oid_copy_addr(name + v->namelen, nbr_addr,
592 IN_ADDR_SIZE);
593 name[v->namelen + IN_ADDR_SIZE] = *ifindex;
594 return nbr;
595 }
596 }
597 return NULL;
7f57883e
DS
598}
599
600
d7c0a89a
QY
601static uint8_t *eigrpVpnEntry(struct variable *v, oid *name, size_t *length,
602 int exact, size_t *var_len,
603 WriteMethod **write_method)
f9e5c9ca 604{
d62a17ae 605 struct eigrp *eigrp;
606
607 eigrp = eigrp_lookup();
608
609 /* Check whether the instance identifier is valid */
610 if (smux_header_generic(v, name, length, exact, var_len, write_method)
611 == MATCH_FAILED)
612 return NULL;
613
614 /* Return the current value of the variable */
615 switch (v->magic) {
616 case EIGRPVPNID: /* 1 */
617 /* The unique VPN identifier */
618 if (eigrp) {
619 return SNMP_INTEGER(1);
620 } else
621 return SNMP_INTEGER(0);
622 break;
623 case EIGRPVPNNAME: /* 2 */
624 /* The name given to the VPN */
625 if (eigrp) {
626 return SNMP_INTEGER(1);
627 } else
628 return SNMP_INTEGER(0);
629 break;
630 default:
631 return NULL;
632 }
633 return NULL;
f9e5c9ca
DS
634}
635
d62a17ae 636static uint32_t eigrp_neighbor_count(struct eigrp *eigrp)
f9e5c9ca 637{
d62a17ae 638 uint32_t count;
639 struct eigrp_interface *ei;
640 struct listnode *node, *node2, *nnode2;
641 struct eigrp_neighbor *nbr;
642
643 if (eigrp == NULL) {
644 return 0;
645 }
646
647 count = 0;
648 for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) {
649 for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) {
650 if (nbr->state == EIGRP_NEIGHBOR_UP)
651 count++;
652 }
653 }
654
655 return count;
f9e5c9ca 656}
7f57883e
DS
657
658
d7c0a89a
QY
659static uint8_t *eigrpTraffStatsEntry(struct variable *v, oid *name,
660 size_t *length, int exact, size_t *var_len,
661 WriteMethod **write_method)
f9e5c9ca 662{
d62a17ae 663 struct eigrp *eigrp;
664 struct eigrp_interface *ei;
665 struct listnode *node, *nnode;
666 int counter;
667
668 eigrp = eigrp_lookup();
669
670 /* Check whether the instance identifier is valid */
671 if (smux_header_generic(v, name, length, exact, var_len, write_method)
672 == MATCH_FAILED)
673 return NULL;
674
675 /* Return the current value of the variable */
676 switch (v->magic) {
677 case EIGRPASNUMBER: /* 1 */
678 /* AS-number of this EIGRP instance. */
679 if (eigrp)
680 return SNMP_INTEGER(eigrp->AS);
681 else
682 return SNMP_INTEGER(0);
683 break;
684 case EIGRPNBRCOUNT: /* 2 */
685 /* Neighbor count of this EIGRP instance */
686 if (eigrp)
687 return SNMP_INTEGER(eigrp_neighbor_count(eigrp));
688 else
689 return SNMP_INTEGER(0);
690 break;
691 case EIGRPHELLOSSENT: /* 3 */
692 /* Hello packets output count */
693 if (eigrp) {
694 counter = 0;
695 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
696 ei)) {
697 counter += ei->hello_out;
698 }
699 return SNMP_INTEGER(counter);
700 } else
701 return SNMP_INTEGER(0);
702 break;
703 case EIGRPHELLOSRCVD: /* 4 */
704 /* Hello packets input count */
705 if (eigrp) {
706 counter = 0;
707 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
708 ei)) {
709 counter += ei->hello_in;
710 }
711 return SNMP_INTEGER(counter);
712 } else
713 return SNMP_INTEGER(0);
714 break;
715 case EIGRPUPDATESSENT: /* 5 */
716 /* Update packets output count */
717 if (eigrp) {
718 counter = 0;
719 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
720 ei)) {
721 counter += ei->update_out;
722 }
723 return SNMP_INTEGER(counter);
724 } else
725 return SNMP_INTEGER(0);
726 break;
727 case EIGRPUPDATESRCVD: /* 6 */
728 /* Update packets input count */
729 if (eigrp) {
730 counter = 0;
731 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
732 ei)) {
733 counter += ei->update_in;
734 }
735 return SNMP_INTEGER(counter);
736 } else
737 return SNMP_INTEGER(0);
738 break;
739 case EIGRPQUERIESSENT: /* 7 */
740 /* Querry packets output count */
741 if (eigrp) {
742 counter = 0;
743 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
744 ei)) {
745 counter += ei->query_out;
746 }
747 return SNMP_INTEGER(counter);
748 } else
749 return SNMP_INTEGER(0);
750 break;
751 case EIGRPQUERIESRCVD: /* 8 */
752 /* Querry packets input count */
753 if (eigrp) {
754 counter = 0;
755 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
756 ei)) {
757 counter += ei->query_in;
758 }
759 return SNMP_INTEGER(counter);
760 } else
761 return SNMP_INTEGER(0);
762 break;
763 case EIGRPREPLIESSENT: /* 9 */
764 /* Reply packets output count */
765 if (eigrp) {
766 counter = 0;
767 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
768 ei)) {
769 counter += ei->reply_out;
770 }
771 return SNMP_INTEGER(counter);
772 } else
773 return SNMP_INTEGER(0);
774 break;
775 case EIGRPREPLIESRCVD: /* 10 */
776 /* Reply packets input count */
777 if (eigrp) {
778 counter = 0;
779 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
780 ei)) {
781 counter += ei->reply_in;
782 }
783 return SNMP_INTEGER(counter);
784 } else
785 return SNMP_INTEGER(0);
786 break;
787 case EIGRPACKSSENT: /* 11 */
788 /* Acknowledgement packets output count */
789 if (eigrp) {
790 counter = 0;
791 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
792 ei)) {
793 counter += ei->ack_out;
794 }
795 return SNMP_INTEGER(counter);
796 } else
797 return SNMP_INTEGER(0);
798 break;
799 case EIGRPACKSRCVD: /* 12 */
800 /* Acknowledgement packets input count */
801 if (eigrp) {
802 counter = 0;
803 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
804 ei)) {
805 counter += ei->ack_in;
806 }
807 return SNMP_INTEGER(counter);
808 } else
809 return SNMP_INTEGER(0);
810 break;
811 case EIGRPINPUTQHIGHMARK: /* 13 */
812 /* The highest number of EIGRP packets in the input queue */
813 if (eigrp) {
814 return SNMP_INTEGER(1);
815 } else
816 return SNMP_INTEGER(0);
817 break;
818 case EIGRPINPUTQDROPS: /* 14 */
819 /* The number of EIGRP packets dropped from the input queue */
820 if (eigrp) {
821 return SNMP_INTEGER(1);
822 } else
823 return SNMP_INTEGER(0);
824 break;
825 case EIGRPSIAQUERIESSENT: /* 15 */
826 /* SIA querry packets output count */
827 if (eigrp) {
828 counter = 0;
829 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
830 ei)) {
831 counter += ei->siaQuery_out;
832 }
833 return SNMP_INTEGER(counter);
834 } else
835 return SNMP_INTEGER(0);
836 break;
837 case EIGRPSIAQUERIESRCVD: /* 16 */
838 /* SIA querry packets input count */
839 if (eigrp) {
840 counter = 0;
841 for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
842 ei)) {
843 counter += ei->siaQuery_in;
844 }
845 return SNMP_INTEGER(counter);
846 } else
847 return SNMP_INTEGER(0);
848 break;
849 case EIGRPASROUTERIDTYPE: /* 17 */
850 /* Whether the router ID is set manually or automatically */
851 if (eigrp)
852 if (eigrp->router_id_static != 0)
853 return SNMP_INTEGER(1);
854 else
855 return SNMP_INTEGER(1);
856 else
857 return SNMP_INTEGER(0);
858 break;
859 case EIGRPASROUTERID: /* 18 */
860 /* Router ID for this EIGRP AS */
861 if (eigrp)
862 if (eigrp->router_id_static != 0)
863 return SNMP_INTEGER(eigrp->router_id_static);
864 else
865 return SNMP_INTEGER(eigrp->router_id);
866 else
867 return SNMP_INTEGER(0);
868 break;
869 case EIGRPTOPOROUTES: /* 19 */
870 /* The total number of EIGRP derived routes currently existing
871 in the topology table for the AS */
872 if (eigrp) {
873 return SNMP_INTEGER(1);
874 } else
875 return SNMP_INTEGER(0);
876 break;
877 case EIGRPHEADSERIAL: /* 20 */
878 /* The serial number of the first route in the internal
879 sequence for an AS*/
880 if (eigrp) {
881 return SNMP_INTEGER(1);
882 } else
883 return SNMP_INTEGER(0);
884 break;
885 case EIGRPNEXTSERIAL: /* 21 */
886 /* The serial number that would be assigned to the next new
887 or changed route in the topology table for the AS*/
888 if (eigrp) {
889 return SNMP_INTEGER(1);
890 } else
891 return SNMP_INTEGER(0);
892 break;
893 case EIGRPXMITPENDREPLIES: /* 22 */
894 /* Total number of outstanding replies expected to queries
895 that have been sent to peers in the current AS*/
896 if (eigrp) {
897 return SNMP_INTEGER(1);
898 } else
899 return SNMP_INTEGER(0);
900 break;
901 case EIGRPXMITDUMMIES: /* 23 */
902 /* Total number of currently existing dummies associated with
903 * the AS*/
904 if (eigrp) {
905 return SNMP_INTEGER(1);
906 } else
907 return SNMP_INTEGER(0);
908 break;
909 default:
910 return NULL;
911 }
912 return NULL;
f9e5c9ca
DS
913}
914
d7c0a89a
QY
915static uint8_t *eigrpTopologyEntry(struct variable *v, oid *name,
916 size_t *length, int exact, size_t *var_len,
917 WriteMethod **write_method)
f9e5c9ca 918{
d62a17ae 919 struct eigrp *eigrp;
d62a17ae 920
921 eigrp = eigrp_lookup();
922
923 /* Check whether the instance identifier is valid */
924 if (smux_header_generic(v, name, length, exact, var_len, write_method)
925 == MATCH_FAILED)
926 return NULL;
927
928 /* Return the current value of the variable */
929 switch (v->magic) {
930 case EIGRPDESTNETTYPE: /* 1 */
931 /* The format of the destination IP network number for a single
932 route in the topology table*/
933 if (eigrp) {
934 return SNMP_INTEGER(1);
935 } else
936 return SNMP_INTEGER(0);
937 break;
938 case EIGRPDESTNET: /* 2 */
939 /* The destination IP network number for a single route in the
940 * topology table*/
941 if (eigrp) {
942 return SNMP_INTEGER(1);
943 } else
944 return SNMP_INTEGER(0);
945 break;
946 case EIGRPDESTNETPREFIXLEN: /* 4 */
947 /* The prefix length associated with the destination IP network
948 address
949 for a single route in the topology table in the AS*/
950 if (eigrp) {
951 return SNMP_INTEGER(1);
952 } else
953 return SNMP_INTEGER(0);
954 break;
955 case EIGRPACTIVE: /* 5 */
956 /* A value of true(1) indicates the route to the destination
957 network has failed
958 A value of false(2) indicates the route is stable
959 (passive).*/
960 if (eigrp) {
961 return SNMP_INTEGER(1);
962 } else
963 return SNMP_INTEGER(0);
964 break;
965 case EIGRPSTUCKINACTIVE: /* 6 */
966 /* A value of true(1) indicates that that this route which is in
967 active state
968 has not received any replies to queries for alternate paths
969 */
970 if (eigrp) {
971 return SNMP_INTEGER(1);
972 } else
973 return SNMP_INTEGER(0);
974 break;
975 case EIGRPDESTSUCCESSORS: /* 7 */
976 /* Next routing hop for a path to the destination IP network */
977 if (eigrp) {
978 return SNMP_INTEGER(1);
979 } else
980 return SNMP_INTEGER(0);
981 break;
982 case EIGRPFDISTANCE: /* 8 */
983 /* Minimum distance from this router to the destination IP
984 * network */
985 if (eigrp) {
986 return SNMP_INTEGER(1);
987 } else
988 return SNMP_INTEGER(0);
989 break;
990 case EIGRPROUTEORIGINTYPE: /* 9 */
991 /* Text string describing the internal origin of the EIGRP route
992 */
993 if (eigrp) {
994 return SNMP_INTEGER(1);
995 } else
996 return SNMP_INTEGER(0);
997 break;
998 case EIGRPROUTEORIGINADDRTYPE: /* 10 */
999 /* The format of the IP address defined as the origin of this
1000 topology route entry */
1001 if (eigrp) {
1002 return SNMP_INTEGER(1);
1003 } else
1004 return SNMP_INTEGER(0);
1005 break;
1006 case EIGRPROUTEORIGINADDR: /* 11 */
1007 /* If the origin of the topology route entry is external to this
1008 router,
1009 then this object is the IP address of the router from which
1010 it originated */
1011 if (eigrp) {
1012 return SNMP_INTEGER(1);
1013 } else
1014 return SNMP_INTEGER(0);
1015 break;
1016 case EIGRPNEXTHOPADDRESSTYPE: /* 12 */
1017 /* The format of the next hop IP address */
1018 if (eigrp) {
1019 return SNMP_INTEGER(1);
1020 } else
1021 return SNMP_INTEGER(0);
1022 break;
1023 case EIGRPNEXTHOPADDRESS: /* 13 */
1024 /* Next hop IP address for the route */
1025 if (eigrp) {
1026 return SNMP_INTEGER(1);
1027 } else
1028 return SNMP_INTEGER(0);
1029 break;
1030 case EIGRPNEXTHOPINTERFACE: /* 14 */
1031 /* The interface through which the next hop IP address is
1032 * reached */
1033 if (eigrp) {
1034 return SNMP_INTEGER(1);
1035 } else
1036 return SNMP_INTEGER(0);
1037 break;
1038 case EIGRPDISTANCE: /* 15 */
1039 /* The computed distance to the destination network entry from
1040 * this router */
1041 if (eigrp) {
1042 return SNMP_INTEGER(1);
1043 } else
1044 return SNMP_INTEGER(0);
1045 break;
1046 case EIGRPREPORTDISTANCE: /* 16 */
1047 /* The computed distance to the destination network in the
1048 topology entry
1049 reported to this router by the originator of this route */
1050 if (eigrp) {
1051 return SNMP_INTEGER(1);
1052 } else
1053 return SNMP_INTEGER(0);
1054 break;
1055 default:
1056 return NULL;
1057 }
1058 return NULL;
f9e5c9ca
DS
1059}
1060
d7c0a89a
QY
1061static uint8_t *eigrpPeerEntry(struct variable *v, oid *name, size_t *length,
1062 int exact, size_t *var_len,
1063 WriteMethod **write_method)
f9e5c9ca 1064{
d62a17ae 1065 struct eigrp *eigrp;
1066 struct eigrp_interface *ei;
d62a17ae 1067 struct eigrp_neighbor *nbr;
1068 struct in_addr nbr_addr;
1069 unsigned int ifindex;
1070
1071 eigrp = eigrp_lookup();
1072
1073 /* Check whether the instance identifier is valid */
1074 if (smux_header_generic(v, name, length, exact, var_len, write_method)
1075 == MATCH_FAILED)
1076 return NULL;
1077
1078 memset(&nbr_addr, 0, sizeof(struct in_addr));
1079 ifindex = 0;
1080
1081 nbr = eigrpNbrLookup(v, name, length, &nbr_addr, &ifindex, exact);
1082 if (!nbr)
1083 return NULL;
1084 ei = nbr->ei;
1085 if (!ei)
1086 return NULL;
1087
1088 /* Return the current value of the variable */
1089 switch (v->magic) {
1090 case EIGRPHANDLE: /* 1 */
1091 /* The unique internal identifier for the peer in the AS */
1092 if (eigrp) {
1093 return SNMP_INTEGER(1);
1094 } else
1095 return SNMP_INTEGER(0);
1096 break;
1097 case EIGRPPEERADDRTYPE: /* 2 */
1098 /* The format of the remote source IP address used by the peer
1099 */
1100 if (eigrp) {
1101 return SNMP_INTEGER(1);
1102 } else
1103 return SNMP_INTEGER(0);
1104 break;
1105 case EIGRPPEERADDR: /* 3 */
1106 /* The source IP address used by the peer */
1107 if (eigrp) {
1108 return SNMP_INTEGER(1);
1109 } else
1110 return SNMP_INTEGER(0);
1111 break;
1112 case EIGRPPEERIFINDEX: /* 4 */
1113 /* The ifIndex of the interface on this router */
1114 if (eigrp) {
1115 return SNMP_INTEGER(1);
1116 } else
1117 return SNMP_INTEGER(0);
1118 break;
1119 case EIGRPHOLDTIME: /* 5 */
1120 /* How much time must pass without receiving a hello packet from
1121 this
1122 EIGRP peer before this router declares the peer down */
1123 if (eigrp) {
1124 return SNMP_INTEGER(1);
1125 } else
1126 return SNMP_INTEGER(0);
1127 break;
1128 case EIGRPUPTIME: /* 6 */
1129 /* The elapsed time since the EIGRP adjacency was first
1130 * established */
1131 if (eigrp) {
1132 return SNMP_INTEGER(1);
1133 } else
1134 return SNMP_INTEGER(0);
1135 break;
1136 case EIGRPSRTT: /* 7 */
1137 /* The computed smooth round trip time for packets to and from
1138 * the peer */
1139 if (eigrp) {
1140 return SNMP_INTEGER(1);
1141 } else
1142 return SNMP_INTEGER(0);
1143 break;
1144 case EIGRPRTO: /* 8 */
1145 /* The computed retransmission timeout for the peer */
1146 if (eigrp) {
1147 return SNMP_INTEGER(1);
1148 } else
1149 return SNMP_INTEGER(0);
1150 break;
1151 case EIGRPPKTSENQUEUED: /* 9 */
1152 /* The number of any EIGRP packets currently enqueued */
1153 if (eigrp) {
1154 return SNMP_INTEGER(1);
1155 } else
1156 return SNMP_INTEGER(0);
1157 break;
1158 case EIGRPLASTSEQ: /* 10 */
1159 /* sequence number of the last EIGRP packet sent to this peer */
1160 if (eigrp) {
1161 return SNMP_INTEGER(1);
1162 } else
1163 return SNMP_INTEGER(0);
1164 break;
1165 case EIGRPVERSION: /* 11 */
1166 /* The EIGRP version information reported by the remote peer */
1167 if (eigrp) {
1168 return SNMP_INTEGER(1);
1169 } else
1170 return SNMP_INTEGER(0);
1171 break;
1172 case EIGRPRETRANS: /* 12 */
1173 /* The cumulative number of retransmissions to this peer */
1174 if (eigrp) {
1175 return SNMP_INTEGER(1);
1176 } else
1177 return SNMP_INTEGER(0);
1178 break;
1179 case EIGRPRETRIES: /* 13 */
1180 /* The number of times the current unacknowledged packet has
1181 * been retried */
1182 if (eigrp) {
1183 return SNMP_INTEGER(1);
1184 } else
1185 return SNMP_INTEGER(0);
1186 break;
1187 default:
1188 return NULL;
1189 }
1190 return NULL;
f9e5c9ca 1191}
7f57883e 1192
d7c0a89a
QY
1193static uint8_t *eigrpInterfaceEntry(struct variable *v, oid *name,
1194 size_t *length, int exact, size_t *var_len,
1195 WriteMethod **write_method)
f9e5c9ca 1196{
d62a17ae 1197 struct eigrp *eigrp;
d62a17ae 1198 struct listnode *node, *nnode;
1199 struct keychain *keychain;
1200 struct list *keylist;
d62a17ae 1201
1202 eigrp = eigrp_lookup();
1203
1204 /* Check whether the instance identifier is valid */
1205 if (smux_header_generic(v, name, length, exact, var_len, write_method)
1206 == MATCH_FAILED)
1207 return NULL;
1208
1209 /* Return the current value of the variable */
1210 switch (v->magic) {
1211 case EIGRPPEERCOUNT: /* 3 */
1212 /* The number of EIGRP adjacencies currently formed with
1213 peers reached through this interface */
1214 if (eigrp) {
1215 return SNMP_INTEGER(eigrp_neighbor_count(eigrp));
1216 } else
1217 return SNMP_INTEGER(0);
1218 break;
1219 case EIGRPXMITRELIABLEQ: /* 4 */
1220 /* The number of EIGRP packets currently waiting in the reliable
1221 transport transmission queue */
1222 if (eigrp) {
1223 return SNMP_INTEGER(1);
1224 } else
1225 return SNMP_INTEGER(0);
1226 break;
1227 case EIGRPXMITUNRELIABLEQ: /* 5 */
1228 /* The number of EIGRP packets currently waiting in the
1229 unreliable
1230 transport transmission queue */
1231 if (eigrp) {
1232 return SNMP_INTEGER(1);
1233 } else
1234 return SNMP_INTEGER(0);
1235 break;
1236 case EIGRPMEANSRTT: /* 6 */
1237 /* The average of all the computed smooth round trip time values
1238 for a packet to and from all peers established on this
1239 interface */
1240 if (eigrp) {
1241 return SNMP_INTEGER(1);
1242 } else
1243 return SNMP_INTEGER(0);
1244 break;
1245 case EIGRPPACINGRELIABLE: /* 7 */
1246 /* The configured time interval between EIGRP packet
1247 * transmissions */
1248 if (eigrp) {
1249 return SNMP_INTEGER(1);
1250 } else
1251 return SNMP_INTEGER(0);
1252 break;
1253 case EIGRPPACINGUNRELIABLE: /* 8 */
1254 /* The configured time interval between EIGRP packet
1255 transmissions
1256 on the interface when the unreliable transport method is used
1257 */
1258 if (eigrp) {
1259 return SNMP_INTEGER(1);
1260 } else
1261 return SNMP_INTEGER(0);
1262 break;
1263 case EIGRPMFLOWTIMER: /* 9 */
1264 /* The configured multicast flow control timer value */
1265 if (eigrp) {
1266 return SNMP_INTEGER(1);
1267 } else
1268 return SNMP_INTEGER(0);
1269 break;
1270 case EIGRPPENDINGROUTES: /* 10 */
1271 /* The number of queued EIGRP routing updates awaiting
1272 * transmission */
1273 if (eigrp) {
1274 return SNMP_INTEGER(1);
1275 } else
1276 return SNMP_INTEGER(0);
1277 break;
1278 case EIGRPHELLOINTERVAL: /* 11 */
1279 /* The configured time interval between Hello packet
1280 * transmissions */
1281 if (eigrp) {
1282 return SNMP_INTEGER(1);
1283 } else
1284 return SNMP_INTEGER(0);
1285 break;
1286 case EIGRPXMITNEXTSERIAL: /* 12 */
1287 /* The serial number of the next EIGRP packet that is to be
1288 queued
1289 for transmission */
1290 if (eigrp) {
1291 return SNMP_INTEGER(1);
1292 } else
1293 return SNMP_INTEGER(0);
1294 break;
1295 case EIGRPUMCASTS: /* 13 */
1296 /* The total number of unreliable EIGRP multicast packets sent
1297 on this interface */
1298 if (eigrp) {
1299 return SNMP_INTEGER(1);
1300 } else
1301 return SNMP_INTEGER(0);
1302 break;
1303 case EIGRPRMCASTS: /* 14 */
1304 /* The total number of reliable EIGRP multicast packets sent
1305 on this interface */
1306 if (eigrp) {
1307 return SNMP_INTEGER(1);
1308 } else
1309 return SNMP_INTEGER(0);
1310 break;
1311 case EIGRPUUCASTS: /* 15 */
1312 /* The total number of unreliable EIGRP unicast packets sent
1313 on this interface */
1314 if (eigrp) {
1315 return SNMP_INTEGER(1);
1316 } else
1317 return SNMP_INTEGER(0);
1318 break;
1319 case EIGRPRUCASTS: /* 16 */
1320 /* The total number of reliable EIGRP unicast packets sent
1321 on this interface */
1322 if (eigrp) {
1323 return SNMP_INTEGER(1);
1324 } else
1325 return SNMP_INTEGER(0);
1326 break;
1327 case EIGRPMCASTEXCEPTS: /* 17 */
1328 /* The total number of EIGRP multicast exception transmissions
1329 */
1330 if (eigrp) {
1331 return SNMP_INTEGER(1);
1332 } else
1333 return SNMP_INTEGER(0);
1334 break;
1335 case EIGRPCRPKTS: /* 18 */
1336 /* The total number EIGRP Conditional-Receive packets sent on
1337 * this interface */
1338 if (eigrp) {
1339 return SNMP_INTEGER(1);
1340 } else
1341 return SNMP_INTEGER(0);
1342 break;
1343 case EIGRPACKSSUPPRESSED: /* 19 */
1344 /* The total number of individual EIGRP acknowledgement packets
1345 that have been
1346 suppressed and combined in an already enqueued outbound
1347 reliable packet on this interface */
1348 if (eigrp) {
1349 return SNMP_INTEGER(1);
1350 } else
1351 return SNMP_INTEGER(0);
1352 break;
1353 case EIGRPRETRANSSENT: /* 20 */
1354 /* The total number EIGRP packet retransmissions sent on the
1355 * interface */
1356 if (eigrp) {
1357 return SNMP_INTEGER(1);
1358 } else
1359 return SNMP_INTEGER(0);
1360 break;
1361 case EIGRPOOSRCVD: /* 21 */
1362 /* The total number of out-of-sequence EIGRP packets received */
1363 if (eigrp) {
1364 return SNMP_INTEGER(1);
1365 } else
1366 return SNMP_INTEGER(0);
1367 break;
1368 case EIGRPAUTHMODE: /* 22 */
1369 /* The EIGRP authentication mode of the interface */
1370 if (eigrp) {
1371 return SNMP_INTEGER(1);
1372 } else
1373 return SNMP_INTEGER(0);
1374 break;
1375 case EIGRPAUTHKEYCHAIN: /* 23 */
1376 /* The name of the authentication key-chain configured
1377 on this interface. */
1378 keylist = keychain_list_get();
1379 for (ALL_LIST_ELEMENTS(keylist, node, nnode, keychain)) {
d7c0a89a 1380 return (uint8_t *)keychain->name;
d62a17ae 1381 }
1382 if (eigrp && keychain) {
1383 *var_len = str_len(keychain->name);
d7c0a89a 1384 return (uint8_t *)keychain->name;
d62a17ae 1385 } else
d7c0a89a 1386 return (uint8_t *)"TEST";
d62a17ae 1387 break;
1388 default:
1389 return NULL;
1390 }
1391 return NULL;
f9e5c9ca 1392}
7f57883e 1393
f9e5c9ca 1394/* Register EIGRP-MIB. */
d62a17ae 1395void eigrp_snmp_init()
f9e5c9ca 1396{
d62a17ae 1397 eigrp_snmp_iflist = list_new();
1398 smux_init(eigrp_om->master);
1399 REGISTER_MIB("ciscoEigrpMIB", eigrp_variables, variable, eigrp_oid);
f9e5c9ca 1400}
7f57883e 1401#endif