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