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