]>
git.proxmox.com Git - mirror_frr.git/blob - eigrpd/eigrp_snmp.c
3 * Copyright (C) 2013-2014
11 * This file is part of GNU Zebra.
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
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.
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
31 #include <net-snmp/net-snmp-config.h>
32 #include <net-snmp/net-snmp-includes.h>
40 #include "sockunion.h"
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"
62 struct list
*eigrp_snmp_iflist
;
64 /* Declare static local variables for convenience. */
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
70 /* EIGRP-MIB instances. */
71 oid eigrp_oid
[] = { EIGRPMIB
};
75 #define EIGRPVPNNAME 2
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
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
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
128 #define EIGRPPKTSENQUEUED 9
129 #define EIGRPLASTSEQ 10
130 #define EIGRPVERSION 11
131 #define EIGRPRETRANS 12
132 #define EIGRPRETRIES 13
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
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
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
**);
185 struct variable eigrp_variables
[] =
187 /* EIGRP vpn variables */
188 {EIGRPVPNID
, INTEGER
, NOACCESS
, eigrpVpnEntry
,
190 {EIGRPVPNNAME
, STRING
, RONLY
, eigrpVpnEntry
,
193 /* EIGRP traffic stats variables */
194 {EIGRPASNUMBER
, UINTEGER
, NOACCESS
, eigrpTraffStatsEntry
,
196 {EIGRPNBRCOUNT
, UINTEGER
, RONLY
, eigrpTraffStatsEntry
,
198 {EIGRPHELLOSSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
200 {EIGRPHELLOSRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
202 {EIGRPUPDATESSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
204 {EIGRPUPDATESRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
206 {EIGRPQUERIESSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
208 {EIGRPQUERIESRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
210 {EIGRPREPLIESSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
212 {EIGRPREPLIESRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
214 {EIGRPACKSSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
216 {EIGRPACKSRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
218 {EIGRPINPUTQHIGHMARK
, INTEGER
, RONLY
, eigrpTraffStatsEntry
,
220 {EIGRPINPUTQDROPS
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
222 {EIGRPSIAQUERIESSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
224 {EIGRPSIAQUERIESRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
226 {EIGRPASROUTERIDTYPE
, IPADDRESSTYPE
, RONLY
, eigrpTraffStatsEntry
,
228 {EIGRPASROUTERID
, IPADDRESS
, RONLY
, eigrpTraffStatsEntry
,
230 {EIGRPTOPOROUTES
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
232 {EIGRPHEADSERIAL
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
234 {EIGRPNEXTSERIAL
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
236 {EIGRPXMITPENDREPLIES
, INTEGER
, RONLY
, eigrpTraffStatsEntry
,
238 {EIGRPXMITDUMMIES
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
241 /* EIGRP topology variables */
242 {EIGRPDESTNETTYPE
, IPADDRESSTYPE
, NOACCESS
, eigrpTopologyEntry
,
244 {EIGRPDESTNET
, IPADDRESSPREFIXLEN
, NOACCESS
, eigrpTopologyEntry
,
246 {EIGRPDESTNETPREFIXLEN
, IPADDRESSTYPE
, NOACCESS
, eigrpTopologyEntry
,
248 {EIGRPACTIVE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
250 {EIGRPSTUCKINACTIVE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
252 {EIGRPDESTSUCCESSORS
, INTEGER
, RONLY
, eigrpTopologyEntry
,
254 {EIGRPFDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
256 {EIGRPROUTEORIGINTYPE
, STRING
, RONLY
, eigrpTopologyEntry
,
258 {EIGRPROUTEORIGINADDRTYPE
, IPADDRESSTYPE
, RONLY
, eigrpTopologyEntry
,
260 {EIGRPROUTEORIGINADDR
, IPADDRESS
, RONLY
, eigrpTopologyEntry
,
262 {EIGRPNEXTHOPADDRESSTYPE
, IPADDRESSTYPE
, RONLY
, eigrpTopologyEntry
,
264 {EIGRPNEXTHOPADDRESS
, IPADDRESS
, RONLY
, eigrpTopologyEntry
,
266 {EIGRPNEXTHOPINTERFACE
, STRING
, RONLY
, eigrpTopologyEntry
,
268 {EIGRPDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
270 {EIGRPREPORTDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
273 /* EIGRP peer variables */
274 {EIGRPHANDLE
, INTEGER
, NOACCESS
, eigrpPeerEntry
,
276 {EIGRPPEERADDRTYPE
, IPADDRESSTYPE
, RONLY
, eigrpPeerEntry
,
278 {EIGRPPEERADDR
, IPADDRESS
, RONLY
, eigrpPeerEntry
,
280 {EIGRPPEERIFINDEX
, INTERFACEINDEXORZERO
, RONLY
, eigrpPeerEntry
,
282 {EIGRPHOLDTIME
, INTEGER
, RONLY
, eigrpPeerEntry
,
284 {EIGRPUPTIME
, STRING
, RONLY
, eigrpPeerEntry
,
286 {EIGRPSRTT
, INTEGER
, RONLY
, eigrpPeerEntry
,
288 {EIGRPRTO
, INTEGER
, RONLY
, eigrpPeerEntry
,
290 {EIGRPPKTSENQUEUED
, INTEGER
, RONLY
, eigrpPeerEntry
,
292 {EIGRPLASTSEQ
, INTEGER
, RONLY
, eigrpPeerEntry
,
294 {EIGRPVERSION
, STRING
, RONLY
, eigrpPeerEntry
,
296 {EIGRPRETRANS
, COUNTER
, RONLY
, eigrpPeerEntry
,
298 {EIGRPRETRIES
, INTEGER
, RONLY
, eigrpPeerEntry
,
301 /* EIGRP interface variables */
302 {EIGRPPEERCOUNT
, GAUGE
, RONLY
, eigrpInterfaceEntry
,
304 {EIGRPXMITRELIABLEQ
, GAUGE
, RONLY
, eigrpInterfaceEntry
,
306 {EIGRPXMITUNRELIABLEQ
, GAUGE
, RONLY
, eigrpInterfaceEntry
,
308 {EIGRPMEANSRTT
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
310 {EIGRPPACINGRELIABLE
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
312 {EIGRPPACINGUNRELIABLE
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
314 {EIGRPMFLOWTIMER
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
316 {EIGRPPENDINGROUTES
, GAUGE
, RONLY
, eigrpInterfaceEntry
,
318 {EIGRPHELLOINTERVAL
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
320 {EIGRPXMITNEXTSERIAL
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
322 {EIGRPUMCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
324 {EIGRPRMCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
326 {EIGRPUUCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
328 {EIGRPRUCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
330 {EIGRPMCASTEXCEPTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
332 {EIGRPCRPKTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
334 {EIGRPACKSSUPPRESSED
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
336 {EIGRPRETRANSSENT
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
338 {EIGRPOOSRCVD
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
340 {EIGRPAUTHMODE
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
342 {EIGRPAUTHKEYCHAIN
, STRING
, RONLY
, eigrpInterfaceEntry
,
346 static struct eigrp_neighbor
*
347 eigrp_snmp_nbr_lookup (struct eigrp
*eigrp
, struct in_addr
*nbr_addr
,
348 unsigned int *ifindex
)
350 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
351 struct eigrp_interface
*ei
;
352 struct eigrp_neighbor
*nbr
;
354 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
356 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
358 if (IPV4_ADDR_SAME (&nbr
->src
, nbr_addr
))
367 static struct eigrp_neighbor
*
368 eigrp_snmp_nbr_lookup_next (struct in_addr
*nbr_addr
, unsigned int *ifindex
,
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
;
378 eigrp
= eigrp_lookup ();
380 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
382 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
388 else if (ntohl (nbr
->src
.s_addr
) < ntohl (min
->src
.s_addr
))
391 else if (ntohl (nbr
->src
.s_addr
) > ntohl (nbr_addr
->s_addr
))
395 else if (ntohl (nbr
->src
.s_addr
) < ntohl (min
->src
.s_addr
))
402 *nbr_addr
= min
->src
;
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
)
415 struct eigrp_neighbor
*nbr
;
418 eigrp
= eigrp_lookup ();
425 if (*length
!= v
->namelen
+ IN_ADDR_SIZE
+ 1)
428 oid2in_addr (name
+ v
->namelen
, IN_ADDR_SIZE
, nbr_addr
);
429 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
431 return eigrp_snmp_nbr_lookup (eigrp
, nbr_addr
, ifindex
);
436 len
= *length
- v
->namelen
;
441 if (len
> IN_ADDR_SIZE
)
444 oid2in_addr (name
+ v
->namelen
, len
, nbr_addr
);
446 len
= *length
- v
->namelen
- IN_ADDR_SIZE
;
448 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
450 nbr
= eigrp_snmp_nbr_lookup_next (nbr_addr
, ifindex
, first
);
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
;
465 eigrpVpnEntry (struct variable
*v
, oid
*name
, size_t *length
,
466 int exact
, size_t *var_len
, WriteMethod
**write_method
)
470 eigrp
= eigrp_lookup ();
472 /* Check whether the instance identifier is valid */
473 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
477 /* Return the current value of the variable */
480 case EIGRPVPNID
: /* 1 */
481 /* The unique VPN identifier */
484 return SNMP_INTEGER(1);
487 return SNMP_INTEGER (0);
489 case EIGRPVPNNAME
: /* 2 */
490 /* The name given to the VPN */
493 return SNMP_INTEGER(1);
496 return SNMP_INTEGER (0);
505 eigrp_neighbor_count(struct eigrp
*eigrp
)
508 struct eigrp_interface
*ei
;
509 struct listnode
*node
, *node2
, *nnode2
;
510 struct eigrp_neighbor
*nbr
;
518 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
520 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
522 if (nbr
->state
== EIGRP_NEIGHBOR_UP
)
532 eigrpTraffStatsEntry (struct variable
*v
, oid
*name
, size_t *length
,
533 int exact
, size_t *var_len
, WriteMethod
**write_method
)
536 struct eigrp_interface
*ei
;
537 struct listnode
*node
, *nnode
;
540 eigrp
= eigrp_lookup ();
542 /* Check whether the instance identifier is valid */
543 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
547 /* Return the current value of the variable */
550 case EIGRPASNUMBER
: /* 1 */
551 /* AS-number of this EIGRP instance. */
553 return SNMP_INTEGER (eigrp
->AS
);
555 return SNMP_INTEGER (0);
557 case EIGRPNBRCOUNT
: /* 2 */
558 /* Neighbor count of this EIGRP instance */
560 return SNMP_INTEGER (eigrp_neighbor_count (eigrp
));
562 return SNMP_INTEGER (0);
564 case EIGRPHELLOSSENT
: /* 3 */
565 /* Hello packets output count */
569 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
571 counter
+= ei
->hello_out
;
573 return SNMP_INTEGER (counter
);
576 return SNMP_INTEGER (0);
578 case EIGRPHELLOSRCVD
: /* 4 */
579 /* Hello packets input count */
583 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
585 counter
+= ei
->hello_in
;
587 return SNMP_INTEGER (counter
);
590 return SNMP_INTEGER (0);
592 case EIGRPUPDATESSENT
: /* 5 */
593 /* Update packets output count */
597 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
599 counter
+= ei
->update_out
;
601 return SNMP_INTEGER (counter
);
604 return SNMP_INTEGER (0);
606 case EIGRPUPDATESRCVD
: /* 6 */
607 /* Update packets input count */
611 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
613 counter
+= ei
->update_in
;
615 return SNMP_INTEGER (counter
);
618 return SNMP_INTEGER (0);
620 case EIGRPQUERIESSENT
: /* 7 */
621 /* Querry packets output count */
625 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
627 counter
+= ei
->query_out
;
629 return SNMP_INTEGER (counter
);
632 return SNMP_INTEGER (0);
634 case EIGRPQUERIESRCVD
: /* 8 */
635 /* Querry packets input count */
639 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
641 counter
+= ei
->query_in
;
643 return SNMP_INTEGER (counter
);
646 return SNMP_INTEGER (0);
648 case EIGRPREPLIESSENT
: /* 9 */
649 /* Reply packets output count */
653 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
655 counter
+= ei
->reply_out
;
657 return SNMP_INTEGER (counter
);
660 return SNMP_INTEGER (0);
662 case EIGRPREPLIESRCVD
: /* 10 */
663 /* Reply packets input count */
667 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
669 counter
+= ei
->reply_in
;
671 return SNMP_INTEGER (counter
);
674 return SNMP_INTEGER (0);
676 case EIGRPACKSSENT
: /* 11 */
677 /* Acknowledgement packets output count */
681 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
683 counter
+= ei
->ack_out
;
685 return SNMP_INTEGER (counter
);
688 return SNMP_INTEGER (0);
690 case EIGRPACKSRCVD
: /* 12 */
691 /* Acknowledgement packets input count */
695 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
697 counter
+= ei
->ack_in
;
699 return SNMP_INTEGER (counter
);
702 return SNMP_INTEGER (0);
704 case EIGRPINPUTQHIGHMARK
: /* 13 */
705 /* The highest number of EIGRP packets in the input queue */
708 return SNMP_INTEGER(1);
711 return SNMP_INTEGER (0);
713 case EIGRPINPUTQDROPS
: /* 14 */
714 /* The number of EIGRP packets dropped from the input queue */
717 return SNMP_INTEGER(1);
720 return SNMP_INTEGER (0);
722 case EIGRPSIAQUERIESSENT
: /* 15 */
723 /* SIA querry packets output count */
727 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
729 counter
+= ei
->siaQuery_out
;
731 return SNMP_INTEGER (counter
);
734 return SNMP_INTEGER (0);
736 case EIGRPSIAQUERIESRCVD
: /* 16 */
737 /* SIA querry packets input count */
741 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
743 counter
+= ei
->siaQuery_in
;
745 return SNMP_INTEGER (counter
);
748 return SNMP_INTEGER (0);
750 case EIGRPASROUTERIDTYPE
: /* 17 */
751 /* Whether the router ID is set manually or automatically */
753 if(eigrp
->router_id_static
!=0)
754 return SNMP_INTEGER(1);
756 return SNMP_INTEGER(1);
758 return SNMP_INTEGER (0);
760 case EIGRPASROUTERID
: /* 18 */
761 /* Router ID for this EIGRP AS */
763 if(eigrp
->router_id_static
!=0)
764 return SNMP_INTEGER (eigrp
->router_id_static
);
766 return SNMP_INTEGER (eigrp
->router_id
);
768 return SNMP_INTEGER (0);
770 case EIGRPTOPOROUTES
: /* 19 */
771 /* The total number of EIGRP derived routes currently existing
772 in the topology table for the AS */
775 return SNMP_INTEGER(1);
778 return SNMP_INTEGER (0);
780 case EIGRPHEADSERIAL
: /* 20 */
781 /* The serial number of the first route in the internal
785 return SNMP_INTEGER(1);
788 return SNMP_INTEGER (0);
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*/
795 return SNMP_INTEGER(1);
798 return SNMP_INTEGER (0);
800 case EIGRPXMITPENDREPLIES
: /* 22 */
801 /* Total number of outstanding replies expected to queries
802 that have been sent to peers in the current AS*/
805 return SNMP_INTEGER(1);
808 return SNMP_INTEGER (0);
810 case EIGRPXMITDUMMIES
: /* 23 */
811 /* Total number of currently existing dummies associated with the AS*/
814 return SNMP_INTEGER(1);
817 return SNMP_INTEGER (0);
826 eigrpTopologyEntry (struct variable
*v
, oid
*name
, size_t *length
,
827 int exact
, size_t *var_len
, WriteMethod
**write_method
)
830 struct eigrp_interface
*ei
;
831 struct listnode
*node
, *nnode
;
833 eigrp
= eigrp_lookup ();
835 /* Check whether the instance identifier is valid */
836 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
840 /* Return the current value of the variable */
843 case EIGRPDESTNETTYPE
: /* 1 */
844 /* The format of the destination IP network number for a single
845 route in the topology table*/
848 return SNMP_INTEGER(1);
851 return SNMP_INTEGER (0);
853 case EIGRPDESTNET
: /* 2 */
854 /* The destination IP network number for a single route in the topology table*/
857 return SNMP_INTEGER(1);
860 return SNMP_INTEGER (0);
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*/
867 return SNMP_INTEGER(1);
870 return SNMP_INTEGER (0);
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).*/
877 return SNMP_INTEGER(1);
880 return SNMP_INTEGER (0);
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 */
887 return SNMP_INTEGER(1);
890 return SNMP_INTEGER (0);
892 case EIGRPDESTSUCCESSORS
: /* 7 */
893 /* Next routing hop for a path to the destination IP network */
896 return SNMP_INTEGER(1);
899 return SNMP_INTEGER (0);
901 case EIGRPFDISTANCE
: /* 8 */
902 /* Minimum distance from this router to the destination IP network */
905 return SNMP_INTEGER(1);
908 return SNMP_INTEGER (0);
910 case EIGRPROUTEORIGINTYPE
: /* 9 */
911 /* Text string describing the internal origin of the EIGRP route */
914 return SNMP_INTEGER(1);
917 return SNMP_INTEGER (0);
919 case EIGRPROUTEORIGINADDRTYPE
: /* 10 */
920 /* The format of the IP address defined as the origin of this
921 topology route entry */
924 return SNMP_INTEGER(1);
927 return SNMP_INTEGER (0);
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 */
934 return SNMP_INTEGER(1);
937 return SNMP_INTEGER (0);
939 case EIGRPNEXTHOPADDRESSTYPE
: /* 12 */
940 /* The format of the next hop IP address */
943 return SNMP_INTEGER(1);
946 return SNMP_INTEGER (0);
948 case EIGRPNEXTHOPADDRESS
: /* 13 */
949 /* Next hop IP address for the route */
952 return SNMP_INTEGER(1);
955 return SNMP_INTEGER (0);
957 case EIGRPNEXTHOPINTERFACE
: /* 14 */
958 /* The interface through which the next hop IP address is reached */
961 return SNMP_INTEGER(1);
964 return SNMP_INTEGER (0);
966 case EIGRPDISTANCE
: /* 15 */
967 /* The computed distance to the destination network entry from this router */
970 return SNMP_INTEGER(1);
973 return SNMP_INTEGER (0);
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 */
980 return SNMP_INTEGER(1);
983 return SNMP_INTEGER (0);
992 eigrpPeerEntry (struct variable
*v
, oid
*name
, size_t *length
,
993 int exact
, size_t *var_len
, WriteMethod
**write_method
)
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
;
1002 eigrp
= eigrp_lookup ();
1004 /* Check whether the instance identifier is valid */
1005 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
1009 memset (&nbr_addr
, 0, sizeof (struct in_addr
));
1012 nbr
= eigrpNbrLookup (v
, name
, length
, &nbr_addr
, &ifindex
, exact
);
1019 /* Return the current value of the variable */
1022 case EIGRPHANDLE
: /* 1 */
1023 /* The unique internal identifier for the peer in the AS */
1026 return SNMP_INTEGER(1);
1029 return SNMP_INTEGER (0);
1031 case EIGRPPEERADDRTYPE
: /* 2 */
1032 /* The format of the remote source IP address used by the peer */
1035 return SNMP_INTEGER(1);
1038 return SNMP_INTEGER (0);
1040 case EIGRPPEERADDR
: /* 3 */
1041 /* The source IP address used by the peer */
1044 return SNMP_INTEGER(1);
1047 return SNMP_INTEGER (0);
1049 case EIGRPPEERIFINDEX
: /* 4 */
1050 /* The ifIndex of the interface on this router */
1053 return SNMP_INTEGER(1);
1056 return SNMP_INTEGER (0);
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 */
1063 return SNMP_INTEGER(1);
1066 return SNMP_INTEGER (0);
1068 case EIGRPUPTIME
: /* 6 */
1069 /* The elapsed time since the EIGRP adjacency was first established */
1072 return SNMP_INTEGER(1);
1075 return SNMP_INTEGER (0);
1077 case EIGRPSRTT
: /* 7 */
1078 /* The computed smooth round trip time for packets to and from the peer */
1081 return SNMP_INTEGER(1);
1084 return SNMP_INTEGER (0);
1086 case EIGRPRTO
: /* 8 */
1087 /* The computed retransmission timeout for the peer */
1090 return SNMP_INTEGER(1);
1093 return SNMP_INTEGER (0);
1095 case EIGRPPKTSENQUEUED
: /* 9 */
1096 /* The number of any EIGRP packets currently enqueued */
1099 return SNMP_INTEGER(1);
1102 return SNMP_INTEGER (0);
1104 case EIGRPLASTSEQ
: /* 10 */
1105 /* sequence number of the last EIGRP packet sent to this peer */
1108 return SNMP_INTEGER(1);
1111 return SNMP_INTEGER (0);
1113 case EIGRPVERSION
: /* 11 */
1114 /* The EIGRP version information reported by the remote peer */
1117 return SNMP_INTEGER(1);
1120 return SNMP_INTEGER (0);
1122 case EIGRPRETRANS
: /* 12 */
1123 /* The cumulative number of retransmissions to this peer */
1126 return SNMP_INTEGER(1);
1129 return SNMP_INTEGER (0);
1131 case EIGRPRETRIES
: /* 13 */
1132 /* The number of times the current unacknowledged packet has been retried */
1135 return SNMP_INTEGER(1);
1138 return SNMP_INTEGER (0);
1147 eigrpInterfaceEntry (struct variable
*v
, oid
*name
, size_t *length
,
1148 int exact
, size_t *var_len
, WriteMethod
**write_method
)
1150 struct eigrp
*eigrp
;
1151 struct eigrp_interface
*ei
;
1152 struct listnode
*node
, *nnode
;
1153 struct keychain
*keychain
;
1154 struct list
*keylist
;
1157 eigrp
= eigrp_lookup ();
1159 /* Check whether the instance identifier is valid */
1160 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
1164 /* Return the current value of the variable */
1167 case EIGRPPEERCOUNT
: /* 3 */
1168 /* The number of EIGRP adjacencies currently formed with
1169 peers reached through this interface */
1172 return SNMP_INTEGER (eigrp_neighbor_count (eigrp
));
1175 return SNMP_INTEGER (0);
1177 case EIGRPXMITRELIABLEQ
: /* 4 */
1178 /* The number of EIGRP packets currently waiting in the reliable
1179 transport transmission queue */
1182 return SNMP_INTEGER (1);
1185 return SNMP_INTEGER (0);
1187 case EIGRPXMITUNRELIABLEQ
: /* 5 */
1188 /* The number of EIGRP packets currently waiting in the unreliable
1189 transport transmission queue */
1192 return SNMP_INTEGER (1);
1195 return SNMP_INTEGER (0);
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 */
1202 return SNMP_INTEGER(1);
1205 return SNMP_INTEGER (0);
1207 case EIGRPPACINGRELIABLE
: /* 7 */
1208 /* The configured time interval between EIGRP packet transmissions */
1211 return SNMP_INTEGER(1);
1214 return SNMP_INTEGER (0);
1216 case EIGRPPACINGUNRELIABLE
: /* 8 */
1217 /* The configured time interval between EIGRP packet transmissions
1218 on the interface when the unreliable transport method is used */
1221 return SNMP_INTEGER (1);
1224 return SNMP_INTEGER (0);
1226 case EIGRPMFLOWTIMER
: /* 9 */
1227 /* The configured multicast flow control timer value */
1230 return SNMP_INTEGER(1);
1233 return SNMP_INTEGER (0);
1235 case EIGRPPENDINGROUTES
: /* 10 */
1236 /* The number of queued EIGRP routing updates awaiting transmission */
1239 return SNMP_INTEGER(1);
1242 return SNMP_INTEGER (0);
1244 case EIGRPHELLOINTERVAL
: /* 11 */
1245 /* The configured time interval between Hello packet transmissions */
1248 return SNMP_INTEGER(1);
1251 return SNMP_INTEGER (0);
1253 case EIGRPXMITNEXTSERIAL
: /* 12 */
1254 /* The serial number of the next EIGRP packet that is to be queued
1258 return SNMP_INTEGER(1);
1261 return SNMP_INTEGER (0);
1263 case EIGRPUMCASTS
: /* 13 */
1264 /* The total number of unreliable EIGRP multicast packets sent
1265 on this interface */
1268 return SNMP_INTEGER(1);
1271 return SNMP_INTEGER (0);
1273 case EIGRPRMCASTS
: /* 14 */
1274 /* The total number of reliable EIGRP multicast packets sent
1275 on this interface */
1278 return SNMP_INTEGER(1);
1281 return SNMP_INTEGER (0);
1283 case EIGRPUUCASTS
: /* 15 */
1284 /* The total number of unreliable EIGRP unicast packets sent
1285 on this interface */
1288 return SNMP_INTEGER(1);
1291 return SNMP_INTEGER (0);
1293 case EIGRPRUCASTS
: /* 16 */
1294 /* The total number of reliable EIGRP unicast packets sent
1295 on this interface */
1298 return SNMP_INTEGER(1);
1301 return SNMP_INTEGER (0);
1303 case EIGRPMCASTEXCEPTS
: /* 17 */
1304 /* The total number of EIGRP multicast exception transmissions */
1307 return SNMP_INTEGER(1);
1310 return SNMP_INTEGER (0);
1312 case EIGRPCRPKTS
: /* 18 */
1313 /* The total number EIGRP Conditional-Receive packets sent on this interface */
1316 return SNMP_INTEGER(1);
1319 return SNMP_INTEGER (0);
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 */
1326 return SNMP_INTEGER(1);
1329 return SNMP_INTEGER (0);
1331 case EIGRPRETRANSSENT
: /* 20 */
1332 /* The total number EIGRP packet retransmissions sent on the interface */
1335 return SNMP_INTEGER(1);
1338 return SNMP_INTEGER (0);
1340 case EIGRPOOSRCVD
: /* 21 */
1341 /* The total number of out-of-sequence EIGRP packets received */
1344 return SNMP_INTEGER(1);
1347 return SNMP_INTEGER (0);
1349 case EIGRPAUTHMODE
: /* 22 */
1350 /* The EIGRP authentication mode of the interface */
1353 return SNMP_INTEGER(1);
1356 return SNMP_INTEGER (0);
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
))
1364 return (u_char
*) keychain
->name
;
1366 if (eigrp
&& keychain
)
1368 *var_len
= str_len (keychain
->name
);
1369 return (u_char
*) keychain
->name
;
1372 return (u_char
*) "TEST";
1380 /* Register EIGRP-MIB. */
1384 eigrp_snmp_iflist
= list_new ();
1385 smux_init (eigrp_om
->master
);
1386 REGISTER_MIB("ciscoEigrpMIB", eigrp_variables
, variable
, eigrp_oid
);