]>
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
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
32 #include <net-snmp/net-snmp-config.h>
33 #include <net-snmp/net-snmp-includes.h>
41 #include "sockunion.h"
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"
64 struct list
*eigrp_snmp_iflist
;
66 /* Declare static local variables for convenience. */
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
72 /* EIGRP-MIB instances. */
73 oid eigrp_oid
[] = { EIGRPMIB
};
77 #define EIGRPVPNNAME 2
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
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
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
130 #define EIGRPPKTSENQUEUED 9
131 #define EIGRPLASTSEQ 10
132 #define EIGRPVERSION 11
133 #define EIGRPRETRANS 12
134 #define EIGRPRETRIES 13
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
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
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
**);
187 struct variable eigrp_variables
[] =
189 /* EIGRP vpn variables */
190 {EIGRPVPNID
, INTEGER
, NOACCESS
, eigrpVpnEntry
,
192 {EIGRPVPNNAME
, STRING
, RONLY
, eigrpVpnEntry
,
195 /* EIGRP traffic stats variables */
196 {EIGRPASNUMBER
, UINTEGER
, NOACCESS
, eigrpTraffStatsEntry
,
198 {EIGRPNBRCOUNT
, UINTEGER
, RONLY
, eigrpTraffStatsEntry
,
200 {EIGRPHELLOSSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
202 {EIGRPHELLOSRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
204 {EIGRPUPDATESSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
206 {EIGRPUPDATESRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
208 {EIGRPQUERIESSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
210 {EIGRPQUERIESRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
212 {EIGRPREPLIESSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
214 {EIGRPREPLIESRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
216 {EIGRPACKSSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
218 {EIGRPACKSRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
220 {EIGRPINPUTQHIGHMARK
, INTEGER
, RONLY
, eigrpTraffStatsEntry
,
222 {EIGRPINPUTQDROPS
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
224 {EIGRPSIAQUERIESSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
226 {EIGRPSIAQUERIESRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
228 {EIGRPASROUTERIDTYPE
, IPADDRESSTYPE
, RONLY
, eigrpTraffStatsEntry
,
230 {EIGRPASROUTERID
, IPADDRESS
, RONLY
, eigrpTraffStatsEntry
,
232 {EIGRPTOPOROUTES
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
234 {EIGRPHEADSERIAL
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
236 {EIGRPNEXTSERIAL
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
238 {EIGRPXMITPENDREPLIES
, INTEGER
, RONLY
, eigrpTraffStatsEntry
,
240 {EIGRPXMITDUMMIES
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
243 /* EIGRP topology variables */
244 {EIGRPDESTNETTYPE
, IPADDRESSTYPE
, NOACCESS
, eigrpTopologyEntry
,
246 {EIGRPDESTNET
, IPADDRESSPREFIXLEN
, NOACCESS
, eigrpTopologyEntry
,
248 {EIGRPDESTNETPREFIXLEN
, IPADDRESSTYPE
, NOACCESS
, eigrpTopologyEntry
,
250 {EIGRPACTIVE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
252 {EIGRPSTUCKINACTIVE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
254 {EIGRPDESTSUCCESSORS
, INTEGER
, RONLY
, eigrpTopologyEntry
,
256 {EIGRPFDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
258 {EIGRPROUTEORIGINTYPE
, STRING
, RONLY
, eigrpTopologyEntry
,
260 {EIGRPROUTEORIGINADDRTYPE
, IPADDRESSTYPE
, RONLY
, eigrpTopologyEntry
,
262 {EIGRPROUTEORIGINADDR
, IPADDRESS
, RONLY
, eigrpTopologyEntry
,
264 {EIGRPNEXTHOPADDRESSTYPE
, IPADDRESSTYPE
, RONLY
, eigrpTopologyEntry
,
266 {EIGRPNEXTHOPADDRESS
, IPADDRESS
, RONLY
, eigrpTopologyEntry
,
268 {EIGRPNEXTHOPINTERFACE
, STRING
, RONLY
, eigrpTopologyEntry
,
270 {EIGRPDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
272 {EIGRPREPORTDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
275 /* EIGRP peer variables */
276 {EIGRPHANDLE
, INTEGER
, NOACCESS
, eigrpPeerEntry
,
278 {EIGRPPEERADDRTYPE
, IPADDRESSTYPE
, RONLY
, eigrpPeerEntry
,
280 {EIGRPPEERADDR
, IPADDRESS
, RONLY
, eigrpPeerEntry
,
282 {EIGRPPEERIFINDEX
, INTERFACEINDEXORZERO
, RONLY
, eigrpPeerEntry
,
284 {EIGRPHOLDTIME
, INTEGER
, RONLY
, eigrpPeerEntry
,
286 {EIGRPUPTIME
, STRING
, RONLY
, eigrpPeerEntry
,
288 {EIGRPSRTT
, INTEGER
, RONLY
, eigrpPeerEntry
,
290 {EIGRPRTO
, INTEGER
, RONLY
, eigrpPeerEntry
,
292 {EIGRPPKTSENQUEUED
, INTEGER
, RONLY
, eigrpPeerEntry
,
294 {EIGRPLASTSEQ
, INTEGER
, RONLY
, eigrpPeerEntry
,
296 {EIGRPVERSION
, STRING
, RONLY
, eigrpPeerEntry
,
298 {EIGRPRETRANS
, COUNTER
, RONLY
, eigrpPeerEntry
,
300 {EIGRPRETRIES
, INTEGER
, RONLY
, eigrpPeerEntry
,
303 /* EIGRP interface variables */
304 {EIGRPPEERCOUNT
, GAUGE
, RONLY
, eigrpInterfaceEntry
,
306 {EIGRPXMITRELIABLEQ
, GAUGE
, RONLY
, eigrpInterfaceEntry
,
308 {EIGRPXMITUNRELIABLEQ
, GAUGE
, RONLY
, eigrpInterfaceEntry
,
310 {EIGRPMEANSRTT
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
312 {EIGRPPACINGRELIABLE
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
314 {EIGRPPACINGUNRELIABLE
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
316 {EIGRPMFLOWTIMER
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
318 {EIGRPPENDINGROUTES
, GAUGE
, RONLY
, eigrpInterfaceEntry
,
320 {EIGRPHELLOINTERVAL
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
322 {EIGRPXMITNEXTSERIAL
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
324 {EIGRPUMCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
326 {EIGRPRMCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
328 {EIGRPUUCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
330 {EIGRPRUCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
332 {EIGRPMCASTEXCEPTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
334 {EIGRPCRPKTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
336 {EIGRPACKSSUPPRESSED
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
338 {EIGRPRETRANSSENT
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
340 {EIGRPOOSRCVD
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
342 {EIGRPAUTHMODE
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
344 {EIGRPAUTHKEYCHAIN
, STRING
, RONLY
, eigrpInterfaceEntry
,
348 static struct eigrp_neighbor
*
349 eigrp_snmp_nbr_lookup (struct eigrp
*eigrp
, struct in_addr
*nbr_addr
,
350 unsigned int *ifindex
)
352 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
353 struct eigrp_interface
*ei
;
354 struct eigrp_neighbor
*nbr
;
356 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
358 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
360 if (IPV4_ADDR_SAME (&nbr
->src
, nbr_addr
))
369 static struct eigrp_neighbor
*
370 eigrp_snmp_nbr_lookup_next (struct in_addr
*nbr_addr
, unsigned int *ifindex
,
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
;
380 eigrp
= eigrp_lookup ();
382 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
384 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
390 else if (ntohl (nbr
->src
.s_addr
) < ntohl (min
->src
.s_addr
))
393 else if (ntohl (nbr
->src
.s_addr
) > ntohl (nbr_addr
->s_addr
))
397 else if (ntohl (nbr
->src
.s_addr
) < ntohl (min
->src
.s_addr
))
404 *nbr_addr
= min
->src
;
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
)
417 struct eigrp_neighbor
*nbr
;
420 eigrp
= eigrp_lookup ();
427 if (*length
!= v
->namelen
+ IN_ADDR_SIZE
+ 1)
430 oid2in_addr (name
+ v
->namelen
, IN_ADDR_SIZE
, nbr_addr
);
431 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
433 return eigrp_snmp_nbr_lookup (eigrp
, nbr_addr
, ifindex
);
438 len
= *length
- v
->namelen
;
443 if (len
> IN_ADDR_SIZE
)
446 oid2in_addr (name
+ v
->namelen
, len
, nbr_addr
);
448 len
= *length
- v
->namelen
- IN_ADDR_SIZE
;
450 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
452 nbr
= eigrp_snmp_nbr_lookup_next (nbr_addr
, ifindex
, first
);
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
;
467 eigrpVpnEntry (struct variable
*v
, oid
*name
, size_t *length
,
468 int exact
, size_t *var_len
, WriteMethod
**write_method
)
473 eigrp
= eigrp_lookup ();
475 /* Check whether the instance identifier is valid */
476 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
480 /* Return the current value of the variable */
483 case EIGRPVPNID
: /* 1 */
484 /* The unique VPN identifier */
487 return SNMP_INTEGER(1);
490 return SNMP_INTEGER (0);
492 case EIGRPVPNNAME
: /* 2 */
493 /* The name given to the VPN */
496 return SNMP_INTEGER(1);
499 return SNMP_INTEGER (0);
508 eigrp_neighbor_count(struct eigrp
*eigrp
)
511 struct eigrp_interface
*ei
;
512 struct listnode
*node
, *node2
, *nnode2
;
513 struct eigrp_neighbor
*nbr
;
521 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
523 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
525 if (nbr
->state
== EIGRP_NEIGHBOR_UP
)
535 eigrpTraffStatsEntry (struct variable
*v
, oid
*name
, size_t *length
,
536 int exact
, size_t *var_len
, WriteMethod
**write_method
)
539 struct eigrp_interface
*ei
;
540 struct listnode
*node
, *nnode
;
544 eigrp
= eigrp_lookup ();
546 /* Check whether the instance identifier is valid */
547 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
551 /* Return the current value of the variable */
554 case EIGRPASNUMBER
: /* 1 */
555 /* AS-number of this EIGRP instance. */
557 return SNMP_INTEGER (eigrp
->AS
);
559 return SNMP_INTEGER (0);
561 case EIGRPNBRCOUNT
: /* 2 */
562 /* Neighbor count of this EIGRP instance */
564 return SNMP_INTEGER (eigrp_neighbor_count (eigrp
));
566 return SNMP_INTEGER (0);
568 case EIGRPHELLOSSENT
: /* 3 */
569 /* Hello packets output count */
573 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
575 counter
+= ei
->hello_out
;
577 return SNMP_INTEGER (counter
);
580 return SNMP_INTEGER (0);
582 case EIGRPHELLOSRCVD
: /* 4 */
583 /* Hello packets input count */
587 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
589 counter
+= ei
->hello_in
;
591 return SNMP_INTEGER (counter
);
594 return SNMP_INTEGER (0);
596 case EIGRPUPDATESSENT
: /* 5 */
597 /* Update packets output count */
601 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
603 counter
+= ei
->update_out
;
605 return SNMP_INTEGER (counter
);
608 return SNMP_INTEGER (0);
610 case EIGRPUPDATESRCVD
: /* 6 */
611 /* Update packets input count */
615 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
617 counter
+= ei
->update_in
;
619 return SNMP_INTEGER (counter
);
622 return SNMP_INTEGER (0);
624 case EIGRPQUERIESSENT
: /* 7 */
625 /* Querry packets output count */
629 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
631 counter
+= ei
->query_out
;
633 return SNMP_INTEGER (counter
);
636 return SNMP_INTEGER (0);
638 case EIGRPQUERIESRCVD
: /* 8 */
639 /* Querry packets input count */
643 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
645 counter
+= ei
->query_in
;
647 return SNMP_INTEGER (counter
);
650 return SNMP_INTEGER (0);
652 case EIGRPREPLIESSENT
: /* 9 */
653 /* Reply packets output count */
657 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
659 counter
+= ei
->reply_out
;
661 return SNMP_INTEGER (counter
);
664 return SNMP_INTEGER (0);
666 case EIGRPREPLIESRCVD
: /* 10 */
667 /* Reply packets input count */
671 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
673 counter
+= ei
->reply_in
;
675 return SNMP_INTEGER (counter
);
678 return SNMP_INTEGER (0);
680 case EIGRPACKSSENT
: /* 11 */
681 /* Acknowledgement packets output count */
685 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
687 counter
+= ei
->ack_out
;
689 return SNMP_INTEGER (counter
);
692 return SNMP_INTEGER (0);
694 case EIGRPACKSRCVD
: /* 12 */
695 /* Acknowledgement packets input count */
699 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
701 counter
+= ei
->ack_in
;
703 return SNMP_INTEGER (counter
);
706 return SNMP_INTEGER (0);
708 case EIGRPINPUTQHIGHMARK
: /* 13 */
709 /* The highest number of EIGRP packets in the input queue */
712 return SNMP_INTEGER(1);
715 return SNMP_INTEGER (0);
717 case EIGRPINPUTQDROPS
: /* 14 */
718 /* The number of EIGRP packets dropped from the input queue */
721 return SNMP_INTEGER(1);
724 return SNMP_INTEGER (0);
726 case EIGRPSIAQUERIESSENT
: /* 15 */
727 /* SIA querry packets output count */
731 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
733 counter
+= ei
->siaQuery_out
;
735 return SNMP_INTEGER (counter
);
738 return SNMP_INTEGER (0);
740 case EIGRPSIAQUERIESRCVD
: /* 16 */
741 /* SIA querry packets input count */
745 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
747 counter
+= ei
->siaQuery_in
;
749 return SNMP_INTEGER (counter
);
752 return SNMP_INTEGER (0);
754 case EIGRPASROUTERIDTYPE
: /* 17 */
755 /* Whether the router ID is set manually or automatically */
757 if(eigrp
->router_id_static
!=0)
758 return SNMP_INTEGER(1);
760 return SNMP_INTEGER(1);
762 return SNMP_INTEGER (0);
764 case EIGRPASROUTERID
: /* 18 */
765 /* Router ID for this EIGRP AS */
767 if(eigrp
->router_id_static
!=0)
768 return SNMP_INTEGER (eigrp
->router_id_static
);
770 return SNMP_INTEGER (eigrp
->router_id
);
772 return SNMP_INTEGER (0);
774 case EIGRPTOPOROUTES
: /* 19 */
775 /* The total number of EIGRP derived routes currently existing
776 in the topology table for the AS */
779 return SNMP_INTEGER(1);
782 return SNMP_INTEGER (0);
784 case EIGRPHEADSERIAL
: /* 20 */
785 /* The serial number of the first route in the internal
789 return SNMP_INTEGER(1);
792 return SNMP_INTEGER (0);
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*/
799 return SNMP_INTEGER(1);
802 return SNMP_INTEGER (0);
804 case EIGRPXMITPENDREPLIES
: /* 22 */
805 /* Total number of outstanding replies expected to queries
806 that have been sent to peers in the current AS*/
809 return SNMP_INTEGER(1);
812 return SNMP_INTEGER (0);
814 case EIGRPXMITDUMMIES
: /* 23 */
815 /* Total number of currently existing dummies associated with the AS*/
818 return SNMP_INTEGER(1);
821 return SNMP_INTEGER (0);
829 eigrpTopologyEntry (struct variable
*v
, oid
*name
, size_t *length
,
830 int exact
, size_t *var_len
, WriteMethod
**write_method
)
833 struct eigrp_interface
*ei
;
834 struct listnode
*node
, *nnode
;
837 eigrp
= eigrp_lookup ();
839 /* Check whether the instance identifier is valid */
840 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
844 /* Return the current value of the variable */
847 case EIGRPDESTNETTYPE
: /* 1 */
848 /* The format of the destination IP network number for a single
849 route in the topology table*/
852 return SNMP_INTEGER(1);
855 return SNMP_INTEGER (0);
857 case EIGRPDESTNET
: /* 2 */
858 /* The destination IP network number for a single route in the topology table*/
861 return SNMP_INTEGER(1);
864 return SNMP_INTEGER (0);
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*/
871 return SNMP_INTEGER(1);
874 return SNMP_INTEGER (0);
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).*/
881 return SNMP_INTEGER(1);
884 return SNMP_INTEGER (0);
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 */
891 return SNMP_INTEGER(1);
894 return SNMP_INTEGER (0);
896 case EIGRPDESTSUCCESSORS
: /* 7 */
897 /* Next routing hop for a path to the destination IP network */
900 return SNMP_INTEGER(1);
903 return SNMP_INTEGER (0);
905 case EIGRPFDISTANCE
: /* 8 */
906 /* Minimum distance from this router to the destination IP network */
909 return SNMP_INTEGER(1);
912 return SNMP_INTEGER (0);
914 case EIGRPROUTEORIGINTYPE
: /* 9 */
915 /* Text string describing the internal origin of the EIGRP route */
918 return SNMP_INTEGER(1);
921 return SNMP_INTEGER (0);
923 case EIGRPROUTEORIGINADDRTYPE
: /* 10 */
924 /* The format of the IP address defined as the origin of this
925 topology route entry */
928 return SNMP_INTEGER(1);
931 return SNMP_INTEGER (0);
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 */
938 return SNMP_INTEGER(1);
941 return SNMP_INTEGER (0);
943 case EIGRPNEXTHOPADDRESSTYPE
: /* 12 */
944 /* The format of the next hop IP address */
947 return SNMP_INTEGER(1);
950 return SNMP_INTEGER (0);
952 case EIGRPNEXTHOPADDRESS
: /* 13 */
953 /* Next hop IP address for the route */
956 return SNMP_INTEGER(1);
959 return SNMP_INTEGER (0);
961 case EIGRPNEXTHOPINTERFACE
: /* 14 */
962 /* The interface through which the next hop IP address is reached */
965 return SNMP_INTEGER(1);
968 return SNMP_INTEGER (0);
970 case EIGRPDISTANCE
: /* 15 */
971 /* The computed distance to the destination network entry from this router */
974 return SNMP_INTEGER(1);
977 return SNMP_INTEGER (0);
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 */
984 return SNMP_INTEGER(1);
987 return SNMP_INTEGER (0);
996 eigrpPeerEntry (struct variable
*v
, oid
*name
, size_t *length
,
997 int exact
, size_t *var_len
, WriteMethod
**write_method
)
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
;
1006 eigrp
= eigrp_lookup ();
1008 /* Check whether the instance identifier is valid */
1009 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
1013 memset (&nbr_addr
, 0, sizeof (struct in_addr
));
1016 nbr
= eigrpNbrLookup (v
, name
, length
, &nbr_addr
, &ifindex
, exact
);
1023 /* Return the current value of the variable */
1026 case EIGRPHANDLE
: /* 1 */
1027 /* The unique internal identifier for the peer in the AS */
1030 return SNMP_INTEGER(1);
1033 return SNMP_INTEGER (0);
1035 case EIGRPPEERADDRTYPE
: /* 2 */
1036 /* The format of the remote source IP address used by the peer */
1039 return SNMP_INTEGER(1);
1042 return SNMP_INTEGER (0);
1044 case EIGRPPEERADDR
: /* 3 */
1045 /* The source IP address used by the peer */
1048 return SNMP_INTEGER(1);
1051 return SNMP_INTEGER (0);
1053 case EIGRPPEERIFINDEX
: /* 4 */
1054 /* The ifIndex of the interface on this router */
1057 return SNMP_INTEGER(1);
1060 return SNMP_INTEGER (0);
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 */
1067 return SNMP_INTEGER(1);
1070 return SNMP_INTEGER (0);
1072 case EIGRPUPTIME
: /* 6 */
1073 /* The elapsed time since the EIGRP adjacency was first established */
1076 return SNMP_INTEGER(1);
1079 return SNMP_INTEGER (0);
1081 case EIGRPSRTT
: /* 7 */
1082 /* The computed smooth round trip time for packets to and from the peer */
1085 return SNMP_INTEGER(1);
1088 return SNMP_INTEGER (0);
1090 case EIGRPRTO
: /* 8 */
1091 /* The computed retransmission timeout for the peer */
1094 return SNMP_INTEGER(1);
1097 return SNMP_INTEGER (0);
1099 case EIGRPPKTSENQUEUED
: /* 9 */
1100 /* The number of any EIGRP packets currently enqueued */
1103 return SNMP_INTEGER(1);
1106 return SNMP_INTEGER (0);
1108 case EIGRPLASTSEQ
: /* 10 */
1109 /* sequence number of the last EIGRP packet sent to this peer */
1112 return SNMP_INTEGER(1);
1115 return SNMP_INTEGER (0);
1117 case EIGRPVERSION
: /* 11 */
1118 /* The EIGRP version information reported by the remote peer */
1121 return SNMP_INTEGER(1);
1124 return SNMP_INTEGER (0);
1126 case EIGRPRETRANS
: /* 12 */
1127 /* The cumulative number of retransmissions to this peer */
1130 return SNMP_INTEGER(1);
1133 return SNMP_INTEGER (0);
1135 case EIGRPRETRIES
: /* 13 */
1136 /* The number of times the current unacknowledged packet has been retried */
1139 return SNMP_INTEGER(1);
1142 return SNMP_INTEGER (0);
1150 eigrpInterfaceEntry (struct variable
*v
, oid
*name
, size_t *length
,
1151 int exact
, size_t *var_len
, WriteMethod
**write_method
)
1153 struct eigrp
*eigrp
;
1154 struct eigrp_interface
*ei
;
1155 struct listnode
*node
, *nnode
;
1156 struct keychain
*keychain
;
1157 struct list
*keylist
;
1161 eigrp
= eigrp_lookup ();
1163 /* Check whether the instance identifier is valid */
1164 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
1168 /* Return the current value of the variable */
1171 case EIGRPPEERCOUNT
: /* 3 */
1172 /* The number of EIGRP adjacencies currently formed with
1173 peers reached through this interface */
1176 return SNMP_INTEGER (eigrp_neighbor_count (eigrp
));
1179 return SNMP_INTEGER (0);
1181 case EIGRPXMITRELIABLEQ
: /* 4 */
1182 /* The number of EIGRP packets currently waiting in the reliable
1183 transport transmission queue */
1186 return SNMP_INTEGER (1);
1189 return SNMP_INTEGER (0);
1191 case EIGRPXMITUNRELIABLEQ
: /* 5 */
1192 /* The number of EIGRP packets currently waiting in the unreliable
1193 transport transmission queue */
1196 return SNMP_INTEGER (1);
1199 return SNMP_INTEGER (0);
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 */
1206 return SNMP_INTEGER(1);
1209 return SNMP_INTEGER (0);
1211 case EIGRPPACINGRELIABLE
: /* 7 */
1212 /* The configured time interval between EIGRP packet transmissions */
1215 return SNMP_INTEGER(1);
1218 return SNMP_INTEGER (0);
1220 case EIGRPPACINGUNRELIABLE
: /* 8 */
1221 /* The configured time interval between EIGRP packet transmissions
1222 on the interface when the unreliable transport method is used */
1225 return SNMP_INTEGER (1);
1228 return SNMP_INTEGER (0);
1230 case EIGRPMFLOWTIMER
: /* 9 */
1231 /* The configured multicast flow control timer value */
1234 return SNMP_INTEGER(1);
1237 return SNMP_INTEGER (0);
1239 case EIGRPPENDINGROUTES
: /* 10 */
1240 /* The number of queued EIGRP routing updates awaiting transmission */
1243 return SNMP_INTEGER(1);
1246 return SNMP_INTEGER (0);
1248 case EIGRPHELLOINTERVAL
: /* 11 */
1249 /* The configured time interval between Hello packet transmissions */
1252 return SNMP_INTEGER(1);
1255 return SNMP_INTEGER (0);
1257 case EIGRPXMITNEXTSERIAL
: /* 12 */
1258 /* The serial number of the next EIGRP packet that is to be queued
1262 return SNMP_INTEGER(1);
1265 return SNMP_INTEGER (0);
1267 case EIGRPUMCASTS
: /* 13 */
1268 /* The total number of unreliable EIGRP multicast packets sent
1269 on this interface */
1272 return SNMP_INTEGER(1);
1275 return SNMP_INTEGER (0);
1277 case EIGRPRMCASTS
: /* 14 */
1278 /* The total number of reliable EIGRP multicast packets sent
1279 on this interface */
1282 return SNMP_INTEGER(1);
1285 return SNMP_INTEGER (0);
1287 case EIGRPUUCASTS
: /* 15 */
1288 /* The total number of unreliable EIGRP unicast packets sent
1289 on this interface */
1292 return SNMP_INTEGER(1);
1295 return SNMP_INTEGER (0);
1297 case EIGRPRUCASTS
: /* 16 */
1298 /* The total number of reliable EIGRP unicast packets sent
1299 on this interface */
1302 return SNMP_INTEGER(1);
1305 return SNMP_INTEGER (0);
1307 case EIGRPMCASTEXCEPTS
: /* 17 */
1308 /* The total number of EIGRP multicast exception transmissions */
1311 return SNMP_INTEGER(1);
1314 return SNMP_INTEGER (0);
1316 case EIGRPCRPKTS
: /* 18 */
1317 /* The total number EIGRP Conditional-Receive packets sent on this interface */
1320 return SNMP_INTEGER(1);
1323 return SNMP_INTEGER (0);
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 */
1330 return SNMP_INTEGER(1);
1333 return SNMP_INTEGER (0);
1335 case EIGRPRETRANSSENT
: /* 20 */
1336 /* The total number EIGRP packet retransmissions sent on the interface */
1339 return SNMP_INTEGER(1);
1342 return SNMP_INTEGER (0);
1344 case EIGRPOOSRCVD
: /* 21 */
1345 /* The total number of out-of-sequence EIGRP packets received */
1348 return SNMP_INTEGER(1);
1351 return SNMP_INTEGER (0);
1353 case EIGRPAUTHMODE
: /* 22 */
1354 /* The EIGRP authentication mode of the interface */
1357 return SNMP_INTEGER(1);
1360 return SNMP_INTEGER (0);
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
))
1368 return (u_char
*) keychain
->name
;
1370 if (eigrp
&& keychain
)
1372 *var_len
= str_len (keychain
->name
);
1373 return (u_char
*) keychain
->name
;
1376 return (u_char
*) "TEST";
1385 /* Register EIGRP-MIB. */
1389 eigrp_snmp_iflist
= list_new ();
1390 smux_init (eigrp_om
->master
);
1391 REGISTER_MIB("ciscoEigrpMIB", eigrp_variables
, variable
, eigrp_oid
);