]>
git.proxmox.com Git - mirror_frr.git/blob - eigrpd/eigrp_snmp.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (C) 2013-2014
16 #include <net-snmp/net-snmp-config.h>
17 #include <net-snmp/net-snmp-includes.h>
25 #include "sockunion.h"
34 #include "eigrpd/eigrp_structs.h"
35 #include "eigrpd/eigrpd.h"
36 #include "eigrpd/eigrp_interface.h"
37 #include "eigrpd/eigrp_neighbor.h"
38 #include "eigrpd/eigrp_packet.h"
39 #include "eigrpd/eigrp_zebra.h"
40 #include "eigrpd/eigrp_vty.h"
41 #include "eigrpd/eigrp_dump.h"
42 #include "eigrpd/eigrp_network.h"
43 #include "eigrpd/eigrp_topology.h"
44 #include "eigrpd/eigrp_fsm.h"
45 #include "eigrpd/eigrp_snmp.h"
47 struct list
*eigrp_snmp_iflist
;
49 /* Declare static local variables for convenience. */
52 /* EIGRP-MIB - 1.3.6.1.4.1.9.9.449.1*/
53 #define EIGRPMIB 1,3,6,1,4,1,9,9,449,1
55 /* EIGRP-MIB instances. */
56 oid eigrp_oid
[] = {EIGRPMIB
};
60 #define EIGRPVPNNAME 2
62 /* EIGRP Traffic statistics entry */
63 #define EIGRPASNUMBER 1
64 #define EIGRPNBRCOUNT 2
65 #define EIGRPHELLOSSENT 3
66 #define EIGRPHELLOSRCVD 4
67 #define EIGRPUPDATESSENT 5
68 #define EIGRPUPDATESRCVD 6
69 #define EIGRPQUERIESSENT 7
70 #define EIGRPQUERIESRCVD 8
71 #define EIGRPREPLIESSENT 9
72 #define EIGRPREPLIESRCVD 10
73 #define EIGRPACKSSENT 11
74 #define EIGRPACKSRCVD 12
75 #define EIGRPINPUTQHIGHMARK 13
76 #define EIGRPINPUTQDROPS 14
77 #define EIGRPSIAQUERIESSENT 15
78 #define EIGRPSIAQUERIESRCVD 16
79 #define EIGRPASROUTERIDTYPE 17
80 #define EIGRPASROUTERID 18
81 #define EIGRPTOPOROUTES 19
82 #define EIGRPHEADSERIAL 20
83 #define EIGRPNEXTSERIAL 21
84 #define EIGRPXMITPENDREPLIES 22
85 #define EIGRPXMITDUMMIES 23
87 /* EIGRP topology entry */
88 #define EIGRPDESTNETTYPE 1
89 #define EIGRPDESTNET 2
90 #define EIGRPDESTNETPREFIXLEN 4
92 #define EIGRPSTUCKINACTIVE 6
93 #define EIGRPDESTSUCCESSORS 7
94 #define EIGRPFDISTANCE 8
95 #define EIGRPROUTEORIGINTYPE 9
96 #define EIGRPROUTEORIGINADDRTYPE 10
97 #define EIGRPROUTEORIGINADDR 11
98 #define EIGRPNEXTHOPADDRESSTYPE 12
99 #define EIGRPNEXTHOPADDRESS 13
100 #define EIGRPNEXTHOPINTERFACE 14
101 #define EIGRPDISTANCE 15
102 #define EIGRPREPORTDISTANCE 16
104 /* EIGRP peer entry */
105 #define EIGRPHANDLE 1
106 #define EIGRPPEERADDRTYPE 2
107 #define EIGRPPEERADDR 3
108 #define EIGRPPEERIFINDEX 4
109 #define EIGRPHOLDTIME 5
110 #define EIGRPUPTIME 6
113 #define EIGRPPKTSENQUEUED 9
114 #define EIGRPLASTSEQ 10
115 #define EIGRPVERSION 11
116 #define EIGRPRETRANS 12
117 #define EIGRPRETRIES 13
119 /* EIGRP interface entry */
120 #define EIGRPPEERCOUNT 3
121 #define EIGRPXMITRELIABLEQ 4
122 #define EIGRPXMITUNRELIABLEQ 5
123 #define EIGRPMEANSRTT 6
124 #define EIGRPPACINGRELIABLE 7
125 #define EIGRPPACINGUNRELIABLE 8
126 #define EIGRPMFLOWTIMER 9
127 #define EIGRPPENDINGROUTES 10
128 #define EIGRPHELLOINTERVAL 11
129 #define EIGRPXMITNEXTSERIAL 12
130 #define EIGRPUMCASTS 13
131 #define EIGRPRMCASTS 14
132 #define EIGRPUUCASTS 15
133 #define EIGRPRUCASTS 16
134 #define EIGRPMCASTEXCEPTS 17
135 #define EIGRPCRPKTS 18
136 #define EIGRPACKSSUPPRESSED 19
137 #define EIGRPRETRANSSENT 20
138 #define EIGRPOOSRCVD 21
139 #define EIGRPAUTHMODE 22
140 #define EIGRPAUTHKEYCHAIN 23
142 /* SNMP value hack. */
143 #define COUNTER ASN_COUNTER
144 #define INTEGER ASN_INTEGER
145 #define GAUGE ASN_GAUGE
146 #define TIMETICKS ASN_TIMETICKS
147 #define IPADDRESS ASN_IPADDRESS
148 #define STRING ASN_OCTET_STR
149 #define IPADDRESSPREFIXLEN ASN_INTEGER
150 #define IPADDRESSTYPE ASN_INTEGER
151 #define INTERFACEINDEXORZERO ASN_INTEGER
152 #define UINTEGER ASN_UNSIGNED
154 /* Hook functions. */
155 static uint8_t *eigrpVpnEntry(struct variable
*, oid
*, size_t *, int, size_t *,
157 static uint8_t *eigrpTraffStatsEntry(struct variable
*, oid
*, size_t *, int,
158 size_t *, WriteMethod
**);
159 static uint8_t *eigrpTopologyEntry(struct variable
*, oid
*, size_t *, int,
160 size_t *, WriteMethod
**);
161 static uint8_t *eigrpPeerEntry(struct variable
*, oid
*, size_t *, int,
162 size_t *, WriteMethod
**);
163 static uint8_t *eigrpInterfaceEntry(struct variable
*, oid
*, size_t *, int,
164 size_t *, WriteMethod
**);
167 struct variable eigrp_variables
[] = {
168 /* EIGRP vpn variables */
169 {EIGRPVPNID
, INTEGER
, NOACCESS
, eigrpVpnEntry
, 4, {1, 1, 1, 1}},
170 {EIGRPVPNNAME
, STRING
, RONLY
, eigrpVpnEntry
, 4, {1, 1, 1, 2}},
172 /* EIGRP traffic stats variables */
176 eigrpTraffStatsEntry
,
179 {EIGRPNBRCOUNT
, UINTEGER
, RONLY
, eigrpTraffStatsEntry
, 4, {2, 1, 1, 2}},
183 eigrpTraffStatsEntry
,
189 eigrpTraffStatsEntry
,
195 eigrpTraffStatsEntry
,
201 eigrpTraffStatsEntry
,
207 eigrpTraffStatsEntry
,
213 eigrpTraffStatsEntry
,
219 eigrpTraffStatsEntry
,
225 eigrpTraffStatsEntry
,
228 {EIGRPACKSSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
, 4, {2, 1, 1, 11}},
229 {EIGRPACKSRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
, 4, {2, 1, 1, 12}},
230 {EIGRPINPUTQHIGHMARK
,
233 eigrpTraffStatsEntry
,
239 eigrpTraffStatsEntry
,
242 {EIGRPSIAQUERIESSENT
,
245 eigrpTraffStatsEntry
,
248 {EIGRPSIAQUERIESRCVD
,
251 eigrpTraffStatsEntry
,
254 {EIGRPASROUTERIDTYPE
,
257 eigrpTraffStatsEntry
,
263 eigrpTraffStatsEntry
,
269 eigrpTraffStatsEntry
,
275 eigrpTraffStatsEntry
,
281 eigrpTraffStatsEntry
,
284 {EIGRPXMITPENDREPLIES
,
287 eigrpTraffStatsEntry
,
293 eigrpTraffStatsEntry
,
297 /* EIGRP topology variables */
310 {EIGRPDESTNETPREFIXLEN
,
316 {EIGRPACTIVE
, INTEGER
, RONLY
, eigrpTopologyEntry
, 4, {3, 1, 1, 5}},
323 {EIGRPDESTSUCCESSORS
,
329 {EIGRPFDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
, 4, {3, 1, 1, 8}},
330 {EIGRPROUTEORIGINTYPE
,
336 {EIGRPROUTEORIGINADDRTYPE
,
342 {EIGRPROUTEORIGINADDR
,
348 {EIGRPNEXTHOPADDRESSTYPE
,
354 {EIGRPNEXTHOPADDRESS
,
360 {EIGRPNEXTHOPINTERFACE
,
366 {EIGRPDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
, 4, {3, 1, 1, 15}},
367 {EIGRPREPORTDISTANCE
,
374 /* EIGRP peer variables */
375 {EIGRPHANDLE
, INTEGER
, NOACCESS
, eigrpPeerEntry
, 4, {4, 1, 1, 1}},
382 {EIGRPPEERADDR
, IPADDRESS
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 3}},
384 INTERFACEINDEXORZERO
,
389 {EIGRPHOLDTIME
, INTEGER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 5}},
390 {EIGRPUPTIME
, STRING
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 6}},
391 {EIGRPSRTT
, INTEGER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 7}},
392 {EIGRPRTO
, INTEGER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 8}},
393 {EIGRPPKTSENQUEUED
, INTEGER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 9}},
394 {EIGRPLASTSEQ
, INTEGER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 10}},
395 {EIGRPVERSION
, STRING
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 11}},
396 {EIGRPRETRANS
, COUNTER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 12}},
397 {EIGRPRETRIES
, INTEGER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 13}},
399 /* EIGRP interface variables */
400 {EIGRPPEERCOUNT
, GAUGE
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 3}},
407 {EIGRPXMITUNRELIABLEQ
,
413 {EIGRPMEANSRTT
, INTEGER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 6}},
414 {EIGRPPACINGRELIABLE
,
420 {EIGRPPACINGUNRELIABLE
,
426 {EIGRPMFLOWTIMER
, INTEGER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 9}},
439 {EIGRPXMITNEXTSERIAL
,
445 {EIGRPUMCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 13}},
446 {EIGRPRMCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 14}},
447 {EIGRPUUCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 15}},
448 {EIGRPRUCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 16}},
455 {EIGRPCRPKTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 18}},
456 {EIGRPACKSSUPPRESSED
,
468 {EIGRPOOSRCVD
, COUNTER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 21}},
469 {EIGRPAUTHMODE
, INTEGER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 22}},
477 static struct eigrp_neighbor
*eigrp_snmp_nbr_lookup(struct eigrp
*eigrp
,
478 struct in_addr
*nbr_addr
,
479 unsigned int *ifindex
)
481 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
482 struct eigrp_interface
*ei
;
483 struct eigrp_neighbor
*nbr
;
485 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
, ei
)) {
486 for (ALL_LIST_ELEMENTS(ei
->nbrs
, node2
, nnode2
, nbr
)) {
487 if (IPV4_ADDR_SAME(&nbr
->src
, nbr_addr
)) {
495 static struct eigrp_neighbor
*
496 eigrp_snmp_nbr_lookup_next(struct in_addr
*nbr_addr
, unsigned int *ifindex
,
499 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
500 struct eigrp_interface
*ei
;
501 struct eigrp_neighbor
*nbr
;
502 struct eigrp_neighbor
*min
= NULL
;
505 eigrp
= eigrp_lookup();
507 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
, ei
)) {
508 for (ALL_LIST_ELEMENTS(ei
->nbrs
, node2
, nnode2
, nbr
)) {
512 else if (ntohl(nbr
->src
.s_addr
)
513 < ntohl(min
->src
.s_addr
))
515 } else if (ntohl(nbr
->src
.s_addr
)
516 > ntohl(nbr_addr
->s_addr
)) {
519 else if (ntohl(nbr
->src
.s_addr
)
520 < ntohl(min
->src
.s_addr
))
526 *nbr_addr
= min
->src
;
533 static struct eigrp_neighbor
*eigrpNbrLookup(struct variable
*v
, oid
*name
,
535 struct in_addr
*nbr_addr
,
536 unsigned int *ifindex
, int exact
)
540 struct eigrp_neighbor
*nbr
;
543 eigrp
= eigrp_lookup();
549 if (*length
!= v
->namelen
+ IN_ADDR_SIZE
+ 1)
552 oid2in_addr(name
+ v
->namelen
, IN_ADDR_SIZE
, nbr_addr
);
553 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
555 return eigrp_snmp_nbr_lookup(eigrp
, nbr_addr
, ifindex
);
558 len
= *length
- v
->namelen
;
563 if (len
> IN_ADDR_SIZE
)
566 oid2in_addr(name
+ v
->namelen
, len
, nbr_addr
);
568 len
= *length
- v
->namelen
- IN_ADDR_SIZE
;
570 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
572 nbr
= eigrp_snmp_nbr_lookup_next(nbr_addr
, ifindex
, first
);
575 *length
= v
->namelen
+ IN_ADDR_SIZE
+ 1;
576 oid_copy_in_addr(name
+ v
->namelen
, nbr_addr
);
577 name
[v
->namelen
+ IN_ADDR_SIZE
] = *ifindex
;
585 static uint8_t *eigrpVpnEntry(struct variable
*v
, oid
*name
, size_t *length
,
586 int exact
, size_t *var_len
,
587 WriteMethod
**write_method
)
591 eigrp
= eigrp_lookup();
593 /* Check whether the instance identifier is valid */
594 if (smux_header_generic(v
, name
, length
, exact
, var_len
, write_method
)
598 /* Return the current value of the variable */
600 case EIGRPVPNID
: /* 1 */
601 /* The unique VPN identifier */
603 return SNMP_INTEGER(1);
605 return SNMP_INTEGER(0);
606 case EIGRPVPNNAME
: /* 2 */
607 /* The name given to the VPN */
609 return SNMP_INTEGER(1);
611 return SNMP_INTEGER(0);
618 static uint32_t eigrp_neighbor_count(struct eigrp
*eigrp
)
621 struct eigrp_interface
*ei
;
622 struct listnode
*node
, *node2
, *nnode2
;
623 struct eigrp_neighbor
*nbr
;
630 for (ALL_LIST_ELEMENTS_RO(eigrp
->eiflist
, node
, ei
)) {
631 for (ALL_LIST_ELEMENTS(ei
->nbrs
, node2
, nnode2
, nbr
)) {
632 if (nbr
->state
== EIGRP_NEIGHBOR_UP
)
641 static uint8_t *eigrpTraffStatsEntry(struct variable
*v
, oid
*name
,
642 size_t *length
, int exact
, size_t *var_len
,
643 WriteMethod
**write_method
)
646 struct eigrp_interface
*ei
;
647 struct listnode
*node
, *nnode
;
650 eigrp
= eigrp_lookup();
652 /* Check whether the instance identifier is valid */
653 if (smux_header_generic(v
, name
, length
, exact
, var_len
, write_method
)
657 /* Return the current value of the variable */
659 case EIGRPASNUMBER
: /* 1 */
660 /* AS-number of this EIGRP instance. */
662 return SNMP_INTEGER(eigrp
->AS
);
664 return SNMP_INTEGER(0);
665 case EIGRPNBRCOUNT
: /* 2 */
666 /* Neighbor count of this EIGRP instance */
668 return SNMP_INTEGER(eigrp_neighbor_count(eigrp
));
670 return SNMP_INTEGER(0);
671 case EIGRPHELLOSSENT
: /* 3 */
672 /* Hello packets output count */
675 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
677 counter
+= ei
->hello_out
;
679 return SNMP_INTEGER(counter
);
681 return SNMP_INTEGER(0);
682 case EIGRPHELLOSRCVD
: /* 4 */
683 /* Hello packets input count */
686 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
688 counter
+= ei
->hello_in
;
690 return SNMP_INTEGER(counter
);
692 return SNMP_INTEGER(0);
693 case EIGRPUPDATESSENT
: /* 5 */
694 /* Update packets output count */
697 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
699 counter
+= ei
->update_out
;
701 return SNMP_INTEGER(counter
);
703 return SNMP_INTEGER(0);
704 case EIGRPUPDATESRCVD
: /* 6 */
705 /* Update packets input count */
708 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
710 counter
+= ei
->update_in
;
712 return SNMP_INTEGER(counter
);
714 return SNMP_INTEGER(0);
715 case EIGRPQUERIESSENT
: /* 7 */
716 /* Querry packets output count */
719 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
721 counter
+= ei
->query_out
;
723 return SNMP_INTEGER(counter
);
725 return SNMP_INTEGER(0);
726 case EIGRPQUERIESRCVD
: /* 8 */
727 /* Querry packets input count */
730 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
732 counter
+= ei
->query_in
;
734 return SNMP_INTEGER(counter
);
736 return SNMP_INTEGER(0);
737 case EIGRPREPLIESSENT
: /* 9 */
738 /* Reply packets output count */
741 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
743 counter
+= ei
->reply_out
;
745 return SNMP_INTEGER(counter
);
747 return SNMP_INTEGER(0);
748 case EIGRPREPLIESRCVD
: /* 10 */
749 /* Reply packets input count */
752 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
754 counter
+= ei
->reply_in
;
756 return SNMP_INTEGER(counter
);
758 return SNMP_INTEGER(0);
759 case EIGRPACKSSENT
: /* 11 */
760 /* Acknowledgement packets output count */
763 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
765 counter
+= ei
->ack_out
;
767 return SNMP_INTEGER(counter
);
769 return SNMP_INTEGER(0);
770 case EIGRPACKSRCVD
: /* 12 */
771 /* Acknowledgement packets input count */
774 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
776 counter
+= ei
->ack_in
;
778 return SNMP_INTEGER(counter
);
780 return SNMP_INTEGER(0);
781 case EIGRPINPUTQHIGHMARK
: /* 13 */
782 /* The highest number of EIGRP packets in the input queue */
784 return SNMP_INTEGER(1);
786 return SNMP_INTEGER(0);
787 case EIGRPINPUTQDROPS
: /* 14 */
788 /* The number of EIGRP packets dropped from the input queue */
790 return SNMP_INTEGER(1);
792 return SNMP_INTEGER(0);
793 case EIGRPSIAQUERIESSENT
: /* 15 */
794 /* SIA querry packets output count */
797 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
799 counter
+= ei
->siaQuery_out
;
801 return SNMP_INTEGER(counter
);
803 return SNMP_INTEGER(0);
804 case EIGRPSIAQUERIESRCVD
: /* 16 */
805 /* SIA querry packets input count */
808 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
810 counter
+= ei
->siaQuery_in
;
812 return SNMP_INTEGER(counter
);
814 return SNMP_INTEGER(0);
815 case EIGRPASROUTERIDTYPE
: /* 17 */
816 /* Whether the router ID is set manually or automatically */
818 if (eigrp
->router_id_static
!= 0)
819 return SNMP_INTEGER(1);
821 return SNMP_INTEGER(1);
823 return SNMP_INTEGER(0);
824 case EIGRPASROUTERID
: /* 18 */
825 /* Router ID for this EIGRP AS */
827 if (eigrp
->router_id_static
!= 0)
828 return SNMP_INTEGER(eigrp
->router_id_static
);
830 return SNMP_INTEGER(eigrp
->router_id
);
832 return SNMP_INTEGER(0);
833 case EIGRPTOPOROUTES
: /* 19 */
834 /* The total number of EIGRP derived routes currently existing
835 in the topology table for the AS */
837 return SNMP_INTEGER(1);
839 return SNMP_INTEGER(0);
840 case EIGRPHEADSERIAL
: /* 20 */
841 /* The serial number of the first route in the internal
844 return SNMP_INTEGER(1);
846 return SNMP_INTEGER(0);
847 case EIGRPNEXTSERIAL
: /* 21 */
848 /* The serial number that would be assigned to the next new
849 or changed route in the topology table for the AS*/
851 return SNMP_INTEGER(1);
853 return SNMP_INTEGER(0);
854 case EIGRPXMITPENDREPLIES
: /* 22 */
855 /* Total number of outstanding replies expected to queries
856 that have been sent to peers in the current AS*/
858 return SNMP_INTEGER(1);
860 return SNMP_INTEGER(0);
861 case EIGRPXMITDUMMIES
: /* 23 */
862 /* Total number of currently existing dummies associated with
865 return SNMP_INTEGER(1);
867 return SNMP_INTEGER(0);
874 static uint8_t *eigrpTopologyEntry(struct variable
*v
, oid
*name
,
875 size_t *length
, int exact
, size_t *var_len
,
876 WriteMethod
**write_method
)
880 eigrp
= eigrp_lookup();
882 /* Check whether the instance identifier is valid */
883 if (smux_header_generic(v
, name
, length
, exact
, var_len
, write_method
)
887 /* Return the current value of the variable */
889 case EIGRPDESTNETTYPE
: /* 1 */
890 /* The format of the destination IP network number for a single
891 route in the topology table*/
893 return SNMP_INTEGER(1);
895 return SNMP_INTEGER(0);
896 case EIGRPDESTNET
: /* 2 */
897 /* The destination IP network number for a single route in the
900 return SNMP_INTEGER(1);
902 return SNMP_INTEGER(0);
903 case EIGRPDESTNETPREFIXLEN
: /* 4 */
904 /* The prefix length associated with the destination IP network
906 for a single route in the topology table in the AS*/
908 return SNMP_INTEGER(1);
910 return SNMP_INTEGER(0);
911 case EIGRPACTIVE
: /* 5 */
912 /* A value of true(1) indicates the route to the destination
914 A value of false(2) indicates the route is stable
917 return SNMP_INTEGER(1);
919 return SNMP_INTEGER(0);
920 case EIGRPSTUCKINACTIVE
: /* 6 */
921 /* A value of true(1) indicates that that this route which is in
923 has not received any replies to queries for alternate paths
926 return SNMP_INTEGER(1);
928 return SNMP_INTEGER(0);
929 case EIGRPDESTSUCCESSORS
: /* 7 */
930 /* Next routing hop for a path to the destination IP network */
932 return SNMP_INTEGER(1);
934 return SNMP_INTEGER(0);
935 case EIGRPFDISTANCE
: /* 8 */
936 /* Minimum distance from this router to the destination IP
939 return SNMP_INTEGER(1);
941 return SNMP_INTEGER(0);
942 case EIGRPROUTEORIGINTYPE
: /* 9 */
943 /* Text string describing the internal origin of the EIGRP route
946 return SNMP_INTEGER(1);
948 return SNMP_INTEGER(0);
949 case EIGRPROUTEORIGINADDRTYPE
: /* 10 */
950 /* The format of the IP address defined as the origin of this
951 topology route entry */
953 return SNMP_INTEGER(1);
955 return SNMP_INTEGER(0);
956 case EIGRPROUTEORIGINADDR
: /* 11 */
957 /* If the origin of the topology route entry is external to this
959 then this object is the IP address of the router from which
962 return SNMP_INTEGER(1);
964 return SNMP_INTEGER(0);
965 case EIGRPNEXTHOPADDRESSTYPE
: /* 12 */
966 /* The format of the next hop IP address */
968 return SNMP_INTEGER(1);
970 return SNMP_INTEGER(0);
971 case EIGRPNEXTHOPADDRESS
: /* 13 */
972 /* Next hop IP address for the route */
974 return SNMP_INTEGER(1);
976 return SNMP_INTEGER(0);
977 case EIGRPNEXTHOPINTERFACE
: /* 14 */
978 /* The interface through which the next hop IP address is
981 return SNMP_INTEGER(1);
983 return SNMP_INTEGER(0);
984 case EIGRPDISTANCE
: /* 15 */
985 /* The computed distance to the destination network entry from
988 return SNMP_INTEGER(1);
990 return SNMP_INTEGER(0);
991 case EIGRPREPORTDISTANCE
: /* 16 */
992 /* The computed distance to the destination network in the
994 reported to this router by the originator of this route */
996 return SNMP_INTEGER(1);
998 return SNMP_INTEGER(0);
1005 static uint8_t *eigrpPeerEntry(struct variable
*v
, oid
*name
, size_t *length
,
1006 int exact
, size_t *var_len
,
1007 WriteMethod
**write_method
)
1009 struct eigrp
*eigrp
;
1010 struct eigrp_interface
*ei
;
1011 struct eigrp_neighbor
*nbr
;
1012 struct in_addr nbr_addr
;
1013 unsigned int ifindex
;
1015 eigrp
= eigrp_lookup();
1017 /* Check whether the instance identifier is valid */
1018 if (smux_header_generic(v
, name
, length
, exact
, var_len
, write_method
)
1022 memset(&nbr_addr
, 0, sizeof(nbr_addr
));
1025 nbr
= eigrpNbrLookup(v
, name
, length
, &nbr_addr
, &ifindex
, exact
);
1032 /* Return the current value of the variable */
1034 case EIGRPHANDLE
: /* 1 */
1035 /* The unique internal identifier for the peer in the AS */
1037 return SNMP_INTEGER(1);
1039 return SNMP_INTEGER(0);
1040 case EIGRPPEERADDRTYPE
: /* 2 */
1041 /* The format of the remote source IP address used by the peer
1044 return SNMP_INTEGER(1);
1046 return SNMP_INTEGER(0);
1047 case EIGRPPEERADDR
: /* 3 */
1048 /* The source IP address used by the peer */
1050 return SNMP_INTEGER(1);
1052 return SNMP_INTEGER(0);
1053 case EIGRPPEERIFINDEX
: /* 4 */
1054 /* The ifIndex of the interface on this router */
1056 return SNMP_INTEGER(1);
1058 return SNMP_INTEGER(0);
1059 case EIGRPHOLDTIME
: /* 5 */
1060 /* How much time must pass without receiving a hello packet from
1062 EIGRP peer before this router declares the peer down */
1064 return SNMP_INTEGER(1);
1066 return SNMP_INTEGER(0);
1067 case EIGRPUPTIME
: /* 6 */
1068 /* The elapsed time since the EIGRP adjacency was first
1071 return SNMP_INTEGER(1);
1073 return SNMP_INTEGER(0);
1074 case EIGRPSRTT
: /* 7 */
1075 /* The computed smooth round trip time for packets to and from
1078 return SNMP_INTEGER(1);
1080 return SNMP_INTEGER(0);
1081 case EIGRPRTO
: /* 8 */
1082 /* The computed retransmission timeout for the peer */
1084 return SNMP_INTEGER(1);
1086 return SNMP_INTEGER(0);
1087 case EIGRPPKTSENQUEUED
: /* 9 */
1088 /* The number of any EIGRP packets currently enqueued */
1090 return SNMP_INTEGER(1);
1092 return SNMP_INTEGER(0);
1093 case EIGRPLASTSEQ
: /* 10 */
1094 /* sequence number of the last EIGRP packet sent to this peer */
1096 return SNMP_INTEGER(1);
1098 return SNMP_INTEGER(0);
1099 case EIGRPVERSION
: /* 11 */
1100 /* The EIGRP version information reported by the remote peer */
1102 return SNMP_INTEGER(1);
1104 return SNMP_INTEGER(0);
1105 case EIGRPRETRANS
: /* 12 */
1106 /* The cumulative number of retransmissions to this peer */
1108 return SNMP_INTEGER(1);
1110 return SNMP_INTEGER(0);
1111 case EIGRPRETRIES
: /* 13 */
1112 /* The number of times the current unacknowledged packet has
1115 return SNMP_INTEGER(1);
1117 return SNMP_INTEGER(0);
1124 static uint8_t *eigrpInterfaceEntry(struct variable
*v
, oid
*name
,
1125 size_t *length
, int exact
, size_t *var_len
,
1126 WriteMethod
**write_method
)
1128 struct eigrp
*eigrp
;
1129 struct listnode
*node
, *nnode
;
1130 struct keychain
*keychain
;
1131 struct list
*keylist
;
1133 eigrp
= eigrp_lookup();
1135 /* Check whether the instance identifier is valid */
1136 if (smux_header_generic(v
, name
, length
, exact
, var_len
, write_method
)
1140 /* Return the current value of the variable */
1142 case EIGRPPEERCOUNT
: /* 3 */
1143 /* The number of EIGRP adjacencies currently formed with
1144 peers reached through this interface */
1146 return SNMP_INTEGER(eigrp_neighbor_count(eigrp
));
1148 return SNMP_INTEGER(0);
1149 case EIGRPXMITRELIABLEQ
: /* 4 */
1150 /* The number of EIGRP packets currently waiting in the reliable
1151 transport transmission queue */
1153 return SNMP_INTEGER(1);
1155 return SNMP_INTEGER(0);
1156 case EIGRPXMITUNRELIABLEQ
: /* 5 */
1157 /* The number of EIGRP packets currently waiting in the
1159 transport transmission queue */
1161 return SNMP_INTEGER(1);
1163 return SNMP_INTEGER(0);
1164 case EIGRPMEANSRTT
: /* 6 */
1165 /* The average of all the computed smooth round trip time values
1166 for a packet to and from all peers established on this
1169 return SNMP_INTEGER(1);
1171 return SNMP_INTEGER(0);
1172 case EIGRPPACINGRELIABLE
: /* 7 */
1173 /* The configured time interval between EIGRP packet
1176 return SNMP_INTEGER(1);
1178 return SNMP_INTEGER(0);
1179 case EIGRPPACINGUNRELIABLE
: /* 8 */
1180 /* The configured time interval between EIGRP packet
1182 on the interface when the unreliable transport method is used
1185 return SNMP_INTEGER(1);
1187 return SNMP_INTEGER(0);
1188 case EIGRPMFLOWTIMER
: /* 9 */
1189 /* The configured multicast flow control timer value */
1191 return SNMP_INTEGER(1);
1193 return SNMP_INTEGER(0);
1194 case EIGRPPENDINGROUTES
: /* 10 */
1195 /* The number of queued EIGRP routing updates awaiting
1198 return SNMP_INTEGER(1);
1200 return SNMP_INTEGER(0);
1201 case EIGRPHELLOINTERVAL
: /* 11 */
1202 /* The configured time interval between Hello packet
1205 return SNMP_INTEGER(1);
1207 return SNMP_INTEGER(0);
1208 case EIGRPXMITNEXTSERIAL
: /* 12 */
1209 /* The serial number of the next EIGRP packet that is to be
1213 return SNMP_INTEGER(1);
1215 return SNMP_INTEGER(0);
1216 case EIGRPUMCASTS
: /* 13 */
1217 /* The total number of unreliable EIGRP multicast packets sent
1218 on this interface */
1220 return SNMP_INTEGER(1);
1222 return SNMP_INTEGER(0);
1223 case EIGRPRMCASTS
: /* 14 */
1224 /* The total number of reliable EIGRP multicast packets sent
1225 on this interface */
1227 return SNMP_INTEGER(1);
1229 return SNMP_INTEGER(0);
1230 case EIGRPUUCASTS
: /* 15 */
1231 /* The total number of unreliable EIGRP unicast packets sent
1232 on this interface */
1234 return SNMP_INTEGER(1);
1236 return SNMP_INTEGER(0);
1237 case EIGRPRUCASTS
: /* 16 */
1238 /* The total number of reliable EIGRP unicast packets sent
1239 on this interface */
1241 return SNMP_INTEGER(1);
1243 return SNMP_INTEGER(0);
1244 case EIGRPMCASTEXCEPTS
: /* 17 */
1245 /* The total number of EIGRP multicast exception transmissions
1248 return SNMP_INTEGER(1);
1250 return SNMP_INTEGER(0);
1251 case EIGRPCRPKTS
: /* 18 */
1252 /* The total number EIGRP Conditional-Receive packets sent on
1255 return SNMP_INTEGER(1);
1257 return SNMP_INTEGER(0);
1258 case EIGRPACKSSUPPRESSED
: /* 19 */
1259 /* The total number of individual EIGRP acknowledgement packets
1261 suppressed and combined in an already enqueued outbound
1262 reliable packet on this interface */
1264 return SNMP_INTEGER(1);
1266 return SNMP_INTEGER(0);
1267 case EIGRPRETRANSSENT
: /* 20 */
1268 /* The total number EIGRP packet retransmissions sent on the
1271 return SNMP_INTEGER(1);
1273 return SNMP_INTEGER(0);
1274 case EIGRPOOSRCVD
: /* 21 */
1275 /* The total number of out-of-sequence EIGRP packets received */
1277 return SNMP_INTEGER(1);
1279 return SNMP_INTEGER(0);
1280 case EIGRPAUTHMODE
: /* 22 */
1281 /* The EIGRP authentication mode of the interface */
1283 return SNMP_INTEGER(1);
1285 return SNMP_INTEGER(0);
1286 case EIGRPAUTHKEYCHAIN
: /* 23 */
1287 /* The name of the authentication key-chain configured
1288 on this interface. */
1289 keylist
= keychain_list_get();
1290 for (ALL_LIST_ELEMENTS(keylist
, node
, nnode
, keychain
)) {
1291 return (uint8_t *)keychain
->name
;
1293 if (eigrp
&& keychain
) {
1294 *var_len
= str_len(keychain
->name
);
1295 return (uint8_t *)keychain
->name
;
1297 return (uint8_t *)"TEST";
1305 /* Register EIGRP-MIB. */
1306 void eigrp_snmp_init()
1308 eigrp_snmp_iflist
= list_new();
1309 smux_init(eigrp_om
->master
);
1310 REGISTER_MIB("ciscoEigrpMIB", eigrp_variables
, variable
, eigrp_oid
);