]>
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"
63 struct list
*eigrp_snmp_iflist
;
65 /* Declare static local variables for convenience. */
68 /* EIGRP-MIB - 1.3.6.1.4.1.9.9.449.1*/
69 #define EIGRPMIB 1,3,6,1,4,1,9,9,449,1
71 /* EIGRP-MIB instances. */
72 oid eigrp_oid
[] = { EIGRPMIB
};
76 #define EIGRPVPNNAME 2
78 /* EIGRP Traffic statistics entry */
79 #define EIGRPASNUMBER 1
80 #define EIGRPNBRCOUNT 2
81 #define EIGRPHELLOSSENT 3
82 #define EIGRPHELLOSRCVD 4
83 #define EIGRPUPDATESSENT 5
84 #define EIGRPUPDATESRCVD 6
85 #define EIGRPQUERIESSENT 7
86 #define EIGRPQUERIESRCVD 8
87 #define EIGRPREPLIESSENT 9
88 #define EIGRPREPLIESRCVD 10
89 #define EIGRPACKSSENT 11
90 #define EIGRPACKSRCVD 12
91 #define EIGRPINPUTQHIGHMARK 13
92 #define EIGRPINPUTQDROPS 14
93 #define EIGRPSIAQUERIESSENT 15
94 #define EIGRPSIAQUERIESRCVD 16
95 #define EIGRPASROUTERIDTYPE 17
96 #define EIGRPASROUTERID 18
97 #define EIGRPTOPOROUTES 19
98 #define EIGRPHEADSERIAL 20
99 #define EIGRPNEXTSERIAL 21
100 #define EIGRPXMITPENDREPLIES 22
101 #define EIGRPXMITDUMMIES 23
103 /* EIGRP topology entry */
104 #define EIGRPDESTNETTYPE 1
105 #define EIGRPDESTNET 2
106 #define EIGRPDESTNETPREFIXLEN 4
107 #define EIGRPACTIVE 5
108 #define EIGRPSTUCKINACTIVE 6
109 #define EIGRPDESTSUCCESSORS 7
110 #define EIGRPFDISTANCE 8
111 #define EIGRPROUTEORIGINTYPE 9
112 #define EIGRPROUTEORIGINADDRTYPE 10
113 #define EIGRPROUTEORIGINADDR 11
114 #define EIGRPNEXTHOPADDRESSTYPE 12
115 #define EIGRPNEXTHOPADDRESS 13
116 #define EIGRPNEXTHOPINTERFACE 14
117 #define EIGRPDISTANCE 15
118 #define EIGRPREPORTDISTANCE 16
120 /* EIGRP peer entry */
121 #define EIGRPHANDLE 1
122 #define EIGRPPEERADDRTYPE 2
123 #define EIGRPPEERADDR 3
124 #define EIGRPPEERIFINDEX 4
125 #define EIGRPHOLDTIME 5
126 #define EIGRPUPTIME 6
129 #define EIGRPPKTSENQUEUED 9
130 #define EIGRPLASTSEQ 10
131 #define EIGRPVERSION 11
132 #define EIGRPRETRANS 12
133 #define EIGRPRETRIES 13
135 /* EIGRP interface entry */
136 #define EIGRPPEERCOUNT 3
137 #define EIGRPXMITRELIABLEQ 4
138 #define EIGRPXMITUNRELIABLEQ 5
139 #define EIGRPMEANSRTT 6
140 #define EIGRPPACINGRELIABLE 7
141 #define EIGRPPACINGUNRELIABLE 8
142 #define EIGRPMFLOWTIMER 9
143 #define EIGRPPENDINGROUTES 10
144 #define EIGRPHELLOINTERVAL 11
145 #define EIGRPXMITNEXTSERIAL 12
146 #define EIGRPUMCASTS 13
147 #define EIGRPRMCASTS 14
148 #define EIGRPUUCASTS 15
149 #define EIGRPRUCASTS 16
150 #define EIGRPMCASTEXCEPTS 17
151 #define EIGRPCRPKTS 18
152 #define EIGRPACKSSUPPRESSED 19
153 #define EIGRPRETRANSSENT 20
154 #define EIGRPOOSRCVD 21
155 #define EIGRPAUTHMODE 22
156 #define EIGRPAUTHKEYCHAIN 23
158 /* SNMP value hack. */
159 #define COUNTER ASN_COUNTER
160 #define INTEGER ASN_INTEGER
161 #define GAUGE ASN_GAUGE
162 #define TIMETICKS ASN_TIMETICKS
163 #define IPADDRESS ASN_IPADDRESS
164 #define STRING ASN_OCTET_STR
165 #define IPADDRESSPREFIXLEN ASN_INTEGER
166 #define IPADDRESSTYPE ASN_INTEGER
167 #define INTERFACEINDEXORZERO ASN_INTEGER
168 #define UINTEGER ASN_UNSIGNED
173 /* Hook functions. */
174 static u_char
*eigrpVpnEntry (struct variable
*, oid
*, size_t *,
175 int, size_t *, WriteMethod
**);
176 static u_char
*eigrpTraffStatsEntry (struct variable
*, oid
*, size_t *, int,
177 size_t *, WriteMethod
**);
178 static u_char
*eigrpTopologyEntry (struct variable
*, oid
*, size_t *,
179 int, size_t *, WriteMethod
**);
180 static u_char
*eigrpPeerEntry (struct variable
*, oid
*, size_t *, int,
181 size_t *, WriteMethod
**);
182 static u_char
*eigrpInterfaceEntry (struct variable
*, oid
*, size_t *, int,
183 size_t *, WriteMethod
**);
186 struct variable eigrp_variables
[] =
188 /* EIGRP vpn variables */
189 {EIGRPVPNID
, INTEGER
, NOACCESS
, eigrpVpnEntry
,
191 {EIGRPVPNNAME
, STRING
, RONLY
, eigrpVpnEntry
,
194 /* EIGRP traffic stats variables */
195 {EIGRPASNUMBER
, UINTEGER
, NOACCESS
, eigrpTraffStatsEntry
,
197 {EIGRPNBRCOUNT
, UINTEGER
, RONLY
, eigrpTraffStatsEntry
,
199 {EIGRPHELLOSSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
201 {EIGRPHELLOSRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
203 {EIGRPUPDATESSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
205 {EIGRPUPDATESRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
207 {EIGRPQUERIESSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
209 {EIGRPQUERIESRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
211 {EIGRPREPLIESSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
213 {EIGRPREPLIESRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
215 {EIGRPACKSSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
217 {EIGRPACKSRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
219 {EIGRPINPUTQHIGHMARK
, INTEGER
, RONLY
, eigrpTraffStatsEntry
,
221 {EIGRPINPUTQDROPS
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
223 {EIGRPSIAQUERIESSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
225 {EIGRPSIAQUERIESRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
227 {EIGRPASROUTERIDTYPE
, IPADDRESSTYPE
, RONLY
, eigrpTraffStatsEntry
,
229 {EIGRPASROUTERID
, IPADDRESS
, RONLY
, eigrpTraffStatsEntry
,
231 {EIGRPTOPOROUTES
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
233 {EIGRPHEADSERIAL
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
235 {EIGRPNEXTSERIAL
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
237 {EIGRPXMITPENDREPLIES
, INTEGER
, RONLY
, eigrpTraffStatsEntry
,
239 {EIGRPXMITDUMMIES
, COUNTER
, RONLY
, eigrpTraffStatsEntry
,
242 /* EIGRP topology variables */
243 {EIGRPDESTNETTYPE
, IPADDRESSTYPE
, NOACCESS
, eigrpTopologyEntry
,
245 {EIGRPDESTNET
, IPADDRESSPREFIXLEN
, NOACCESS
, eigrpTopologyEntry
,
247 {EIGRPDESTNETPREFIXLEN
, IPADDRESSTYPE
, NOACCESS
, eigrpTopologyEntry
,
249 {EIGRPACTIVE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
251 {EIGRPSTUCKINACTIVE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
253 {EIGRPDESTSUCCESSORS
, INTEGER
, RONLY
, eigrpTopologyEntry
,
255 {EIGRPFDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
257 {EIGRPROUTEORIGINTYPE
, STRING
, RONLY
, eigrpTopologyEntry
,
259 {EIGRPROUTEORIGINADDRTYPE
, IPADDRESSTYPE
, RONLY
, eigrpTopologyEntry
,
261 {EIGRPROUTEORIGINADDR
, IPADDRESS
, RONLY
, eigrpTopologyEntry
,
263 {EIGRPNEXTHOPADDRESSTYPE
, IPADDRESSTYPE
, RONLY
, eigrpTopologyEntry
,
265 {EIGRPNEXTHOPADDRESS
, IPADDRESS
, RONLY
, eigrpTopologyEntry
,
267 {EIGRPNEXTHOPINTERFACE
, STRING
, RONLY
, eigrpTopologyEntry
,
269 {EIGRPDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
271 {EIGRPREPORTDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
,
274 /* EIGRP peer variables */
275 {EIGRPHANDLE
, INTEGER
, NOACCESS
, eigrpPeerEntry
,
277 {EIGRPPEERADDRTYPE
, IPADDRESSTYPE
, RONLY
, eigrpPeerEntry
,
279 {EIGRPPEERADDR
, IPADDRESS
, RONLY
, eigrpPeerEntry
,
281 {EIGRPPEERIFINDEX
, INTERFACEINDEXORZERO
, RONLY
, eigrpPeerEntry
,
283 {EIGRPHOLDTIME
, INTEGER
, RONLY
, eigrpPeerEntry
,
285 {EIGRPUPTIME
, STRING
, RONLY
, eigrpPeerEntry
,
287 {EIGRPSRTT
, INTEGER
, RONLY
, eigrpPeerEntry
,
289 {EIGRPRTO
, INTEGER
, RONLY
, eigrpPeerEntry
,
291 {EIGRPPKTSENQUEUED
, INTEGER
, RONLY
, eigrpPeerEntry
,
293 {EIGRPLASTSEQ
, INTEGER
, RONLY
, eigrpPeerEntry
,
295 {EIGRPVERSION
, STRING
, RONLY
, eigrpPeerEntry
,
297 {EIGRPRETRANS
, COUNTER
, RONLY
, eigrpPeerEntry
,
299 {EIGRPRETRIES
, INTEGER
, RONLY
, eigrpPeerEntry
,
302 /* EIGRP interface variables */
303 {EIGRPPEERCOUNT
, GAUGE
, RONLY
, eigrpInterfaceEntry
,
305 {EIGRPXMITRELIABLEQ
, GAUGE
, RONLY
, eigrpInterfaceEntry
,
307 {EIGRPXMITUNRELIABLEQ
, GAUGE
, RONLY
, eigrpInterfaceEntry
,
309 {EIGRPMEANSRTT
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
311 {EIGRPPACINGRELIABLE
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
313 {EIGRPPACINGUNRELIABLE
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
315 {EIGRPMFLOWTIMER
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
317 {EIGRPPENDINGROUTES
, GAUGE
, RONLY
, eigrpInterfaceEntry
,
319 {EIGRPHELLOINTERVAL
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
321 {EIGRPXMITNEXTSERIAL
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
323 {EIGRPUMCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
325 {EIGRPRMCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
327 {EIGRPUUCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
329 {EIGRPRUCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
331 {EIGRPMCASTEXCEPTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
333 {EIGRPCRPKTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
335 {EIGRPACKSSUPPRESSED
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
337 {EIGRPRETRANSSENT
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
339 {EIGRPOOSRCVD
, COUNTER
, RONLY
, eigrpInterfaceEntry
,
341 {EIGRPAUTHMODE
, INTEGER
, RONLY
, eigrpInterfaceEntry
,
343 {EIGRPAUTHKEYCHAIN
, STRING
, RONLY
, eigrpInterfaceEntry
,
347 static struct eigrp_neighbor
*
348 eigrp_snmp_nbr_lookup (struct eigrp
*eigrp
, struct in_addr
*nbr_addr
,
349 unsigned int *ifindex
)
351 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
352 struct eigrp_interface
*ei
;
353 struct eigrp_neighbor
*nbr
;
355 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
357 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
359 if (IPV4_ADDR_SAME (&nbr
->src
, nbr_addr
))
368 static struct eigrp_neighbor
*
369 eigrp_snmp_nbr_lookup_next (struct in_addr
*nbr_addr
, unsigned int *ifindex
,
372 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
373 struct eigrp_interface
*ei
;
374 struct eigrp_neighbor
*nbr
;
375 struct route_node
*rn
;
376 struct eigrp_neighbor
*min
= NULL
;
377 struct eigrp
*eigrp
= eigrp
;
379 eigrp
= eigrp_lookup ();
381 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
383 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
389 else if (ntohl (nbr
->src
.s_addr
) < ntohl (min
->src
.s_addr
))
392 else if (ntohl (nbr
->src
.s_addr
) > ntohl (nbr_addr
->s_addr
))
396 else if (ntohl (nbr
->src
.s_addr
) < ntohl (min
->src
.s_addr
))
403 *nbr_addr
= min
->src
;
410 static struct eigrp_neighbor
*
411 eigrpNbrLookup (struct variable
*v
, oid
*name
, size_t *length
,
412 struct in_addr
*nbr_addr
, unsigned int *ifindex
, int exact
)
416 struct eigrp_neighbor
*nbr
;
419 eigrp
= eigrp_lookup ();
426 if (*length
!= v
->namelen
+ IN_ADDR_SIZE
+ 1)
429 oid2in_addr (name
+ v
->namelen
, IN_ADDR_SIZE
, nbr_addr
);
430 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
432 return eigrp_snmp_nbr_lookup (eigrp
, nbr_addr
, ifindex
);
437 len
= *length
- v
->namelen
;
442 if (len
> IN_ADDR_SIZE
)
445 oid2in_addr (name
+ v
->namelen
, len
, nbr_addr
);
447 len
= *length
- v
->namelen
- IN_ADDR_SIZE
;
449 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
451 nbr
= eigrp_snmp_nbr_lookup_next (nbr_addr
, ifindex
, first
);
455 *length
= v
->namelen
+ IN_ADDR_SIZE
+ 1;
456 oid_copy_addr (name
+ v
->namelen
, nbr_addr
, IN_ADDR_SIZE
);
457 name
[v
->namelen
+ IN_ADDR_SIZE
] = *ifindex
;
466 eigrpVpnEntry (struct variable
*v
, oid
*name
, size_t *length
,
467 int exact
, size_t *var_len
, WriteMethod
**write_method
)
471 eigrp
= eigrp_lookup ();
473 /* Check whether the instance identifier is valid */
474 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
478 /* Return the current value of the variable */
481 case EIGRPVPNID
: /* 1 */
482 /* The unique VPN identifier */
485 return SNMP_INTEGER(1);
488 return SNMP_INTEGER (0);
490 case EIGRPVPNNAME
: /* 2 */
491 /* The name given to the VPN */
494 return SNMP_INTEGER(1);
497 return SNMP_INTEGER (0);
506 eigrp_neighbor_count(struct eigrp
*eigrp
)
509 struct eigrp_interface
*ei
;
510 struct listnode
*node
, *node2
, *nnode2
;
511 struct eigrp_neighbor
*nbr
;
519 for (ALL_LIST_ELEMENTS_RO (eigrp
->eiflist
, node
, ei
))
521 for (ALL_LIST_ELEMENTS (ei
->nbrs
, node2
, nnode2
, nbr
))
523 if (nbr
->state
== EIGRP_NEIGHBOR_UP
)
533 eigrpTraffStatsEntry (struct variable
*v
, oid
*name
, size_t *length
,
534 int exact
, size_t *var_len
, WriteMethod
**write_method
)
537 struct eigrp_interface
*ei
;
538 struct listnode
*node
, *nnode
;
541 eigrp
= eigrp_lookup ();
543 /* Check whether the instance identifier is valid */
544 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
548 /* Return the current value of the variable */
551 case EIGRPASNUMBER
: /* 1 */
552 /* AS-number of this EIGRP instance. */
554 return SNMP_INTEGER (eigrp
->AS
);
556 return SNMP_INTEGER (0);
558 case EIGRPNBRCOUNT
: /* 2 */
559 /* Neighbor count of this EIGRP instance */
561 return SNMP_INTEGER (eigrp_neighbor_count (eigrp
));
563 return SNMP_INTEGER (0);
565 case EIGRPHELLOSSENT
: /* 3 */
566 /* Hello packets output count */
570 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
572 counter
+= ei
->hello_out
;
574 return SNMP_INTEGER (counter
);
577 return SNMP_INTEGER (0);
579 case EIGRPHELLOSRCVD
: /* 4 */
580 /* Hello packets input count */
584 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
586 counter
+= ei
->hello_in
;
588 return SNMP_INTEGER (counter
);
591 return SNMP_INTEGER (0);
593 case EIGRPUPDATESSENT
: /* 5 */
594 /* Update packets output count */
598 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
600 counter
+= ei
->update_out
;
602 return SNMP_INTEGER (counter
);
605 return SNMP_INTEGER (0);
607 case EIGRPUPDATESRCVD
: /* 6 */
608 /* Update packets input count */
612 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
614 counter
+= ei
->update_in
;
616 return SNMP_INTEGER (counter
);
619 return SNMP_INTEGER (0);
621 case EIGRPQUERIESSENT
: /* 7 */
622 /* Querry packets output count */
626 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
628 counter
+= ei
->query_out
;
630 return SNMP_INTEGER (counter
);
633 return SNMP_INTEGER (0);
635 case EIGRPQUERIESRCVD
: /* 8 */
636 /* Querry packets input count */
640 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
642 counter
+= ei
->query_in
;
644 return SNMP_INTEGER (counter
);
647 return SNMP_INTEGER (0);
649 case EIGRPREPLIESSENT
: /* 9 */
650 /* Reply packets output count */
654 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
656 counter
+= ei
->reply_out
;
658 return SNMP_INTEGER (counter
);
661 return SNMP_INTEGER (0);
663 case EIGRPREPLIESRCVD
: /* 10 */
664 /* Reply packets input count */
668 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
670 counter
+= ei
->reply_in
;
672 return SNMP_INTEGER (counter
);
675 return SNMP_INTEGER (0);
677 case EIGRPACKSSENT
: /* 11 */
678 /* Acknowledgement packets output count */
682 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
684 counter
+= ei
->ack_out
;
686 return SNMP_INTEGER (counter
);
689 return SNMP_INTEGER (0);
691 case EIGRPACKSRCVD
: /* 12 */
692 /* Acknowledgement packets input count */
696 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
698 counter
+= ei
->ack_in
;
700 return SNMP_INTEGER (counter
);
703 return SNMP_INTEGER (0);
705 case EIGRPINPUTQHIGHMARK
: /* 13 */
706 /* The highest number of EIGRP packets in the input queue */
709 return SNMP_INTEGER(1);
712 return SNMP_INTEGER (0);
714 case EIGRPINPUTQDROPS
: /* 14 */
715 /* The number of EIGRP packets dropped from the input queue */
718 return SNMP_INTEGER(1);
721 return SNMP_INTEGER (0);
723 case EIGRPSIAQUERIESSENT
: /* 15 */
724 /* SIA querry packets output count */
728 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
730 counter
+= ei
->siaQuery_out
;
732 return SNMP_INTEGER (counter
);
735 return SNMP_INTEGER (0);
737 case EIGRPSIAQUERIESRCVD
: /* 16 */
738 /* SIA querry packets input count */
742 for (ALL_LIST_ELEMENTS (eigrp
->eiflist
, node
, nnode
, ei
))
744 counter
+= ei
->siaQuery_in
;
746 return SNMP_INTEGER (counter
);
749 return SNMP_INTEGER (0);
751 case EIGRPASROUTERIDTYPE
: /* 17 */
752 /* Whether the router ID is set manually or automatically */
754 if(eigrp
->router_id_static
!=0)
755 return SNMP_INTEGER(1);
757 return SNMP_INTEGER(1);
759 return SNMP_INTEGER (0);
761 case EIGRPASROUTERID
: /* 18 */
762 /* Router ID for this EIGRP AS */
764 if(eigrp
->router_id_static
!=0)
765 return SNMP_INTEGER (eigrp
->router_id_static
);
767 return SNMP_INTEGER (eigrp
->router_id
);
769 return SNMP_INTEGER (0);
771 case EIGRPTOPOROUTES
: /* 19 */
772 /* The total number of EIGRP derived routes currently existing
773 in the topology table for the AS */
776 return SNMP_INTEGER(1);
779 return SNMP_INTEGER (0);
781 case EIGRPHEADSERIAL
: /* 20 */
782 /* The serial number of the first route in the internal
786 return SNMP_INTEGER(1);
789 return SNMP_INTEGER (0);
791 case EIGRPNEXTSERIAL
: /* 21 */
792 /* The serial number that would be assigned to the next new
793 or changed route in the topology table for the AS*/
796 return SNMP_INTEGER(1);
799 return SNMP_INTEGER (0);
801 case EIGRPXMITPENDREPLIES
: /* 22 */
802 /* Total number of outstanding replies expected to queries
803 that have been sent to peers in the current AS*/
806 return SNMP_INTEGER(1);
809 return SNMP_INTEGER (0);
811 case EIGRPXMITDUMMIES
: /* 23 */
812 /* Total number of currently existing dummies associated with the AS*/
815 return SNMP_INTEGER(1);
818 return SNMP_INTEGER (0);
827 eigrpTopologyEntry (struct variable
*v
, oid
*name
, size_t *length
,
828 int exact
, size_t *var_len
, WriteMethod
**write_method
)
831 struct eigrp_interface
*ei
;
832 struct listnode
*node
, *nnode
;
834 eigrp
= eigrp_lookup ();
836 /* Check whether the instance identifier is valid */
837 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
841 /* Return the current value of the variable */
844 case EIGRPDESTNETTYPE
: /* 1 */
845 /* The format of the destination IP network number for a single
846 route in the topology table*/
849 return SNMP_INTEGER(1);
852 return SNMP_INTEGER (0);
854 case EIGRPDESTNET
: /* 2 */
855 /* The destination IP network number for a single route in the topology table*/
858 return SNMP_INTEGER(1);
861 return SNMP_INTEGER (0);
863 case EIGRPDESTNETPREFIXLEN
: /* 4 */
864 /* The prefix length associated with the destination IP network address
865 for a single route in the topology table in the AS*/
868 return SNMP_INTEGER(1);
871 return SNMP_INTEGER (0);
873 case EIGRPACTIVE
: /* 5 */
874 /* A value of true(1) indicates the route to the destination network has failed
875 A value of false(2) indicates the route is stable (passive).*/
878 return SNMP_INTEGER(1);
881 return SNMP_INTEGER (0);
883 case EIGRPSTUCKINACTIVE
: /* 6 */
884 /* A value of true(1) indicates that that this route which is in active state
885 has not received any replies to queries for alternate paths */
888 return SNMP_INTEGER(1);
891 return SNMP_INTEGER (0);
893 case EIGRPDESTSUCCESSORS
: /* 7 */
894 /* Next routing hop for a path to the destination IP network */
897 return SNMP_INTEGER(1);
900 return SNMP_INTEGER (0);
902 case EIGRPFDISTANCE
: /* 8 */
903 /* Minimum distance from this router to the destination IP network */
906 return SNMP_INTEGER(1);
909 return SNMP_INTEGER (0);
911 case EIGRPROUTEORIGINTYPE
: /* 9 */
912 /* Text string describing the internal origin of the EIGRP route */
915 return SNMP_INTEGER(1);
918 return SNMP_INTEGER (0);
920 case EIGRPROUTEORIGINADDRTYPE
: /* 10 */
921 /* The format of the IP address defined as the origin of this
922 topology route entry */
925 return SNMP_INTEGER(1);
928 return SNMP_INTEGER (0);
930 case EIGRPROUTEORIGINADDR
: /* 11 */
931 /* If the origin of the topology route entry is external to this router,
932 then this object is the IP address of the router from which it originated */
935 return SNMP_INTEGER(1);
938 return SNMP_INTEGER (0);
940 case EIGRPNEXTHOPADDRESSTYPE
: /* 12 */
941 /* The format of the next hop IP address */
944 return SNMP_INTEGER(1);
947 return SNMP_INTEGER (0);
949 case EIGRPNEXTHOPADDRESS
: /* 13 */
950 /* Next hop IP address for the route */
953 return SNMP_INTEGER(1);
956 return SNMP_INTEGER (0);
958 case EIGRPNEXTHOPINTERFACE
: /* 14 */
959 /* The interface through which the next hop IP address is reached */
962 return SNMP_INTEGER(1);
965 return SNMP_INTEGER (0);
967 case EIGRPDISTANCE
: /* 15 */
968 /* The computed distance to the destination network entry from this router */
971 return SNMP_INTEGER(1);
974 return SNMP_INTEGER (0);
976 case EIGRPREPORTDISTANCE
: /* 16 */
977 /* The computed distance to the destination network in the topology entry
978 reported to this router by the originator of this route */
981 return SNMP_INTEGER(1);
984 return SNMP_INTEGER (0);
993 eigrpPeerEntry (struct variable
*v
, oid
*name
, size_t *length
,
994 int exact
, size_t *var_len
, WriteMethod
**write_method
)
997 struct eigrp_interface
*ei
;
998 struct listnode
*node
, *nnode
;
999 struct eigrp_neighbor
*nbr
;
1000 struct in_addr nbr_addr
;
1001 unsigned int ifindex
;
1003 eigrp
= eigrp_lookup ();
1005 /* Check whether the instance identifier is valid */
1006 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
1010 memset (&nbr_addr
, 0, sizeof (struct in_addr
));
1013 nbr
= eigrpNbrLookup (v
, name
, length
, &nbr_addr
, &ifindex
, exact
);
1020 /* Return the current value of the variable */
1023 case EIGRPHANDLE
: /* 1 */
1024 /* The unique internal identifier for the peer in the AS */
1027 return SNMP_INTEGER(1);
1030 return SNMP_INTEGER (0);
1032 case EIGRPPEERADDRTYPE
: /* 2 */
1033 /* The format of the remote source IP address used by the peer */
1036 return SNMP_INTEGER(1);
1039 return SNMP_INTEGER (0);
1041 case EIGRPPEERADDR
: /* 3 */
1042 /* The source IP address used by the peer */
1045 return SNMP_INTEGER(1);
1048 return SNMP_INTEGER (0);
1050 case EIGRPPEERIFINDEX
: /* 4 */
1051 /* The ifIndex of the interface on this router */
1054 return SNMP_INTEGER(1);
1057 return SNMP_INTEGER (0);
1059 case EIGRPHOLDTIME
: /* 5 */
1060 /* How much time must pass without receiving a hello packet from this
1061 EIGRP peer before this router declares the peer down */
1064 return SNMP_INTEGER(1);
1067 return SNMP_INTEGER (0);
1069 case EIGRPUPTIME
: /* 6 */
1070 /* The elapsed time since the EIGRP adjacency was first established */
1073 return SNMP_INTEGER(1);
1076 return SNMP_INTEGER (0);
1078 case EIGRPSRTT
: /* 7 */
1079 /* The computed smooth round trip time for packets to and from the peer */
1082 return SNMP_INTEGER(1);
1085 return SNMP_INTEGER (0);
1087 case EIGRPRTO
: /* 8 */
1088 /* The computed retransmission timeout for the peer */
1091 return SNMP_INTEGER(1);
1094 return SNMP_INTEGER (0);
1096 case EIGRPPKTSENQUEUED
: /* 9 */
1097 /* The number of any EIGRP packets currently enqueued */
1100 return SNMP_INTEGER(1);
1103 return SNMP_INTEGER (0);
1105 case EIGRPLASTSEQ
: /* 10 */
1106 /* sequence number of the last EIGRP packet sent to this peer */
1109 return SNMP_INTEGER(1);
1112 return SNMP_INTEGER (0);
1114 case EIGRPVERSION
: /* 11 */
1115 /* The EIGRP version information reported by the remote peer */
1118 return SNMP_INTEGER(1);
1121 return SNMP_INTEGER (0);
1123 case EIGRPRETRANS
: /* 12 */
1124 /* The cumulative number of retransmissions to this peer */
1127 return SNMP_INTEGER(1);
1130 return SNMP_INTEGER (0);
1132 case EIGRPRETRIES
: /* 13 */
1133 /* The number of times the current unacknowledged packet has been retried */
1136 return SNMP_INTEGER(1);
1139 return SNMP_INTEGER (0);
1148 eigrpInterfaceEntry (struct variable
*v
, oid
*name
, size_t *length
,
1149 int exact
, size_t *var_len
, WriteMethod
**write_method
)
1151 struct eigrp
*eigrp
;
1152 struct eigrp_interface
*ei
;
1153 struct listnode
*node
, *nnode
;
1154 struct keychain
*keychain
;
1155 struct list
*keylist
;
1158 eigrp
= eigrp_lookup ();
1160 /* Check whether the instance identifier is valid */
1161 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
1165 /* Return the current value of the variable */
1168 case EIGRPPEERCOUNT
: /* 3 */
1169 /* The number of EIGRP adjacencies currently formed with
1170 peers reached through this interface */
1173 return SNMP_INTEGER (eigrp_neighbor_count (eigrp
));
1176 return SNMP_INTEGER (0);
1178 case EIGRPXMITRELIABLEQ
: /* 4 */
1179 /* The number of EIGRP packets currently waiting in the reliable
1180 transport transmission queue */
1183 return SNMP_INTEGER (1);
1186 return SNMP_INTEGER (0);
1188 case EIGRPXMITUNRELIABLEQ
: /* 5 */
1189 /* The number of EIGRP packets currently waiting in the unreliable
1190 transport transmission queue */
1193 return SNMP_INTEGER (1);
1196 return SNMP_INTEGER (0);
1198 case EIGRPMEANSRTT
: /* 6 */
1199 /* The average of all the computed smooth round trip time values
1200 for a packet to and from all peers established on this interface */
1203 return SNMP_INTEGER(1);
1206 return SNMP_INTEGER (0);
1208 case EIGRPPACINGRELIABLE
: /* 7 */
1209 /* The configured time interval between EIGRP packet transmissions */
1212 return SNMP_INTEGER(1);
1215 return SNMP_INTEGER (0);
1217 case EIGRPPACINGUNRELIABLE
: /* 8 */
1218 /* The configured time interval between EIGRP packet transmissions
1219 on the interface when the unreliable transport method is used */
1222 return SNMP_INTEGER (1);
1225 return SNMP_INTEGER (0);
1227 case EIGRPMFLOWTIMER
: /* 9 */
1228 /* The configured multicast flow control timer value */
1231 return SNMP_INTEGER(1);
1234 return SNMP_INTEGER (0);
1236 case EIGRPPENDINGROUTES
: /* 10 */
1237 /* The number of queued EIGRP routing updates awaiting transmission */
1240 return SNMP_INTEGER(1);
1243 return SNMP_INTEGER (0);
1245 case EIGRPHELLOINTERVAL
: /* 11 */
1246 /* The configured time interval between Hello packet transmissions */
1249 return SNMP_INTEGER(1);
1252 return SNMP_INTEGER (0);
1254 case EIGRPXMITNEXTSERIAL
: /* 12 */
1255 /* The serial number of the next EIGRP packet that is to be queued
1259 return SNMP_INTEGER(1);
1262 return SNMP_INTEGER (0);
1264 case EIGRPUMCASTS
: /* 13 */
1265 /* The total number of unreliable EIGRP multicast packets sent
1266 on this interface */
1269 return SNMP_INTEGER(1);
1272 return SNMP_INTEGER (0);
1274 case EIGRPRMCASTS
: /* 14 */
1275 /* The total number of reliable EIGRP multicast packets sent
1276 on this interface */
1279 return SNMP_INTEGER(1);
1282 return SNMP_INTEGER (0);
1284 case EIGRPUUCASTS
: /* 15 */
1285 /* The total number of unreliable EIGRP unicast packets sent
1286 on this interface */
1289 return SNMP_INTEGER(1);
1292 return SNMP_INTEGER (0);
1294 case EIGRPRUCASTS
: /* 16 */
1295 /* The total number of reliable EIGRP unicast packets sent
1296 on this interface */
1299 return SNMP_INTEGER(1);
1302 return SNMP_INTEGER (0);
1304 case EIGRPMCASTEXCEPTS
: /* 17 */
1305 /* The total number of EIGRP multicast exception transmissions */
1308 return SNMP_INTEGER(1);
1311 return SNMP_INTEGER (0);
1313 case EIGRPCRPKTS
: /* 18 */
1314 /* The total number EIGRP Conditional-Receive packets sent on this interface */
1317 return SNMP_INTEGER(1);
1320 return SNMP_INTEGER (0);
1322 case EIGRPACKSSUPPRESSED
: /* 19 */
1323 /* The total number of individual EIGRP acknowledgement packets that have been
1324 suppressed and combined in an already enqueued outbound reliable packet on this interface */
1327 return SNMP_INTEGER(1);
1330 return SNMP_INTEGER (0);
1332 case EIGRPRETRANSSENT
: /* 20 */
1333 /* The total number EIGRP packet retransmissions sent on the interface */
1336 return SNMP_INTEGER(1);
1339 return SNMP_INTEGER (0);
1341 case EIGRPOOSRCVD
: /* 21 */
1342 /* The total number of out-of-sequence EIGRP packets received */
1345 return SNMP_INTEGER(1);
1348 return SNMP_INTEGER (0);
1350 case EIGRPAUTHMODE
: /* 22 */
1351 /* The EIGRP authentication mode of the interface */
1354 return SNMP_INTEGER(1);
1357 return SNMP_INTEGER (0);
1359 case EIGRPAUTHKEYCHAIN
: /* 23 */
1360 /* The name of the authentication key-chain configured
1361 on this interface. */
1362 keylist
= keychain_list_get();
1363 for (ALL_LIST_ELEMENTS (keylist
, node
, nnode
, keychain
))
1365 return (u_char
*) keychain
->name
;
1367 if (eigrp
&& keychain
)
1369 *var_len
= str_len (keychain
->name
);
1370 return (u_char
*) keychain
->name
;
1373 return (u_char
*) "TEST";
1381 /* Register EIGRP-MIB. */
1385 eigrp_snmp_iflist
= list_new ();
1386 smux_init (eigrp_om
->master
);
1387 REGISTER_MIB("ciscoEigrpMIB", eigrp_variables
, variable
, eigrp_oid
);