]>
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
169 /* Hook functions. */
170 static uint8_t *eigrpVpnEntry(struct variable
*, oid
*, size_t *, int, size_t *,
172 static uint8_t *eigrpTraffStatsEntry(struct variable
*, oid
*, size_t *, int,
173 size_t *, WriteMethod
**);
174 static uint8_t *eigrpTopologyEntry(struct variable
*, oid
*, size_t *, int,
175 size_t *, WriteMethod
**);
176 static uint8_t *eigrpPeerEntry(struct variable
*, oid
*, size_t *, int,
177 size_t *, WriteMethod
**);
178 static uint8_t *eigrpInterfaceEntry(struct variable
*, oid
*, size_t *, int,
179 size_t *, WriteMethod
**);
182 struct variable eigrp_variables
[] = {
183 /* EIGRP vpn variables */
184 {EIGRPVPNID
, INTEGER
, NOACCESS
, eigrpVpnEntry
, 4, {1, 1, 1, 1}},
185 {EIGRPVPNNAME
, STRING
, RONLY
, eigrpVpnEntry
, 4, {1, 1, 1, 2}},
187 /* EIGRP traffic stats variables */
191 eigrpTraffStatsEntry
,
194 {EIGRPNBRCOUNT
, UINTEGER
, RONLY
, eigrpTraffStatsEntry
, 4, {2, 1, 1, 2}},
198 eigrpTraffStatsEntry
,
204 eigrpTraffStatsEntry
,
210 eigrpTraffStatsEntry
,
216 eigrpTraffStatsEntry
,
222 eigrpTraffStatsEntry
,
228 eigrpTraffStatsEntry
,
234 eigrpTraffStatsEntry
,
240 eigrpTraffStatsEntry
,
243 {EIGRPACKSSENT
, COUNTER
, RONLY
, eigrpTraffStatsEntry
, 4, {2, 1, 1, 11}},
244 {EIGRPACKSRCVD
, COUNTER
, RONLY
, eigrpTraffStatsEntry
, 4, {2, 1, 1, 12}},
245 {EIGRPINPUTQHIGHMARK
,
248 eigrpTraffStatsEntry
,
254 eigrpTraffStatsEntry
,
257 {EIGRPSIAQUERIESSENT
,
260 eigrpTraffStatsEntry
,
263 {EIGRPSIAQUERIESRCVD
,
266 eigrpTraffStatsEntry
,
269 {EIGRPASROUTERIDTYPE
,
272 eigrpTraffStatsEntry
,
278 eigrpTraffStatsEntry
,
284 eigrpTraffStatsEntry
,
290 eigrpTraffStatsEntry
,
296 eigrpTraffStatsEntry
,
299 {EIGRPXMITPENDREPLIES
,
302 eigrpTraffStatsEntry
,
308 eigrpTraffStatsEntry
,
312 /* EIGRP topology variables */
325 {EIGRPDESTNETPREFIXLEN
,
331 {EIGRPACTIVE
, INTEGER
, RONLY
, eigrpTopologyEntry
, 4, {3, 1, 1, 5}},
338 {EIGRPDESTSUCCESSORS
,
344 {EIGRPFDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
, 4, {3, 1, 1, 8}},
345 {EIGRPROUTEORIGINTYPE
,
351 {EIGRPROUTEORIGINADDRTYPE
,
357 {EIGRPROUTEORIGINADDR
,
363 {EIGRPNEXTHOPADDRESSTYPE
,
369 {EIGRPNEXTHOPADDRESS
,
375 {EIGRPNEXTHOPINTERFACE
,
381 {EIGRPDISTANCE
, INTEGER
, RONLY
, eigrpTopologyEntry
, 4, {3, 1, 1, 15}},
382 {EIGRPREPORTDISTANCE
,
389 /* EIGRP peer variables */
390 {EIGRPHANDLE
, INTEGER
, NOACCESS
, eigrpPeerEntry
, 4, {4, 1, 1, 1}},
397 {EIGRPPEERADDR
, IPADDRESS
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 3}},
399 INTERFACEINDEXORZERO
,
404 {EIGRPHOLDTIME
, INTEGER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 5}},
405 {EIGRPUPTIME
, STRING
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 6}},
406 {EIGRPSRTT
, INTEGER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 7}},
407 {EIGRPRTO
, INTEGER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 8}},
408 {EIGRPPKTSENQUEUED
, INTEGER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 9}},
409 {EIGRPLASTSEQ
, INTEGER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 10}},
410 {EIGRPVERSION
, STRING
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 11}},
411 {EIGRPRETRANS
, COUNTER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 12}},
412 {EIGRPRETRIES
, INTEGER
, RONLY
, eigrpPeerEntry
, 4, {4, 1, 1, 13}},
414 /* EIGRP interface variables */
415 {EIGRPPEERCOUNT
, GAUGE
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 3}},
422 {EIGRPXMITUNRELIABLEQ
,
428 {EIGRPMEANSRTT
, INTEGER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 6}},
429 {EIGRPPACINGRELIABLE
,
435 {EIGRPPACINGUNRELIABLE
,
441 {EIGRPMFLOWTIMER
, INTEGER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 9}},
454 {EIGRPXMITNEXTSERIAL
,
460 {EIGRPUMCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 13}},
461 {EIGRPRMCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 14}},
462 {EIGRPUUCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 15}},
463 {EIGRPRUCASTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 16}},
470 {EIGRPCRPKTS
, COUNTER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 18}},
471 {EIGRPACKSSUPPRESSED
,
483 {EIGRPOOSRCVD
, COUNTER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 21}},
484 {EIGRPAUTHMODE
, INTEGER
, RONLY
, eigrpInterfaceEntry
, 4, {5, 1, 1, 22}},
492 static struct eigrp_neighbor
*eigrp_snmp_nbr_lookup(struct eigrp
*eigrp
,
493 struct in_addr
*nbr_addr
,
494 unsigned int *ifindex
)
496 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
497 struct eigrp_interface
*ei
;
498 struct eigrp_neighbor
*nbr
;
500 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
, ei
)) {
501 for (ALL_LIST_ELEMENTS(ei
->nbrs
, node2
, nnode2
, nbr
)) {
502 if (IPV4_ADDR_SAME(&nbr
->src
, nbr_addr
)) {
510 static struct eigrp_neighbor
*
511 eigrp_snmp_nbr_lookup_next(struct in_addr
*nbr_addr
, unsigned int *ifindex
,
514 struct listnode
*node
, *nnode
, *node2
, *nnode2
;
515 struct eigrp_interface
*ei
;
516 struct eigrp_neighbor
*nbr
;
517 struct route_node
*rn
;
518 struct eigrp_neighbor
*min
= NULL
;
521 eigrp
= eigrp_lookup();
523 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
, ei
)) {
524 for (ALL_LIST_ELEMENTS(ei
->nbrs
, node2
, nnode2
, nbr
)) {
528 else if (ntohl(nbr
->src
.s_addr
)
529 < ntohl(min
->src
.s_addr
))
531 } else if (ntohl(nbr
->src
.s_addr
)
532 > ntohl(nbr_addr
->s_addr
)) {
535 else if (ntohl(nbr
->src
.s_addr
)
536 < ntohl(min
->src
.s_addr
))
542 *nbr_addr
= min
->src
;
549 static struct eigrp_neighbor
*eigrpNbrLookup(struct variable
*v
, oid
*name
,
551 struct in_addr
*nbr_addr
,
552 unsigned int *ifindex
, int exact
)
556 struct eigrp_neighbor
*nbr
;
559 eigrp
= eigrp_lookup();
565 if (*length
!= v
->namelen
+ IN_ADDR_SIZE
+ 1)
568 oid2in_addr(name
+ v
->namelen
, IN_ADDR_SIZE
, nbr_addr
);
569 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
571 return eigrp_snmp_nbr_lookup(eigrp
, nbr_addr
, ifindex
);
574 len
= *length
- v
->namelen
;
579 if (len
> IN_ADDR_SIZE
)
582 oid2in_addr(name
+ v
->namelen
, len
, nbr_addr
);
584 len
= *length
- v
->namelen
- IN_ADDR_SIZE
;
586 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
588 nbr
= eigrp_snmp_nbr_lookup_next(nbr_addr
, ifindex
, first
);
591 *length
= v
->namelen
+ IN_ADDR_SIZE
+ 1;
592 oid_copy_addr(name
+ v
->namelen
, nbr_addr
,
594 name
[v
->namelen
+ IN_ADDR_SIZE
] = *ifindex
;
602 static uint8_t *eigrpVpnEntry(struct variable
*v
, oid
*name
, size_t *length
,
603 int exact
, size_t *var_len
,
604 WriteMethod
**write_method
)
608 eigrp
= eigrp_lookup();
610 /* Check whether the instance identifier is valid */
611 if (smux_header_generic(v
, name
, length
, exact
, var_len
, write_method
)
615 /* Return the current value of the variable */
617 case EIGRPVPNID
: /* 1 */
618 /* The unique VPN identifier */
620 return SNMP_INTEGER(1);
622 return SNMP_INTEGER(0);
624 case EIGRPVPNNAME
: /* 2 */
625 /* The name given to the VPN */
627 return SNMP_INTEGER(1);
629 return SNMP_INTEGER(0);
637 static uint32_t eigrp_neighbor_count(struct eigrp
*eigrp
)
640 struct eigrp_interface
*ei
;
641 struct listnode
*node
, *node2
, *nnode2
;
642 struct eigrp_neighbor
*nbr
;
649 for (ALL_LIST_ELEMENTS_RO(eigrp
->eiflist
, node
, ei
)) {
650 for (ALL_LIST_ELEMENTS(ei
->nbrs
, node2
, nnode2
, nbr
)) {
651 if (nbr
->state
== EIGRP_NEIGHBOR_UP
)
660 static uint8_t *eigrpTraffStatsEntry(struct variable
*v
, oid
*name
,
661 size_t *length
, int exact
, size_t *var_len
,
662 WriteMethod
**write_method
)
665 struct eigrp_interface
*ei
;
666 struct listnode
*node
, *nnode
;
669 eigrp
= eigrp_lookup();
671 /* Check whether the instance identifier is valid */
672 if (smux_header_generic(v
, name
, length
, exact
, var_len
, write_method
)
676 /* Return the current value of the variable */
678 case EIGRPASNUMBER
: /* 1 */
679 /* AS-number of this EIGRP instance. */
681 return SNMP_INTEGER(eigrp
->AS
);
683 return SNMP_INTEGER(0);
685 case EIGRPNBRCOUNT
: /* 2 */
686 /* Neighbor count of this EIGRP instance */
688 return SNMP_INTEGER(eigrp_neighbor_count(eigrp
));
690 return SNMP_INTEGER(0);
692 case EIGRPHELLOSSENT
: /* 3 */
693 /* Hello packets output count */
696 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
698 counter
+= ei
->hello_out
;
700 return SNMP_INTEGER(counter
);
702 return SNMP_INTEGER(0);
704 case EIGRPHELLOSRCVD
: /* 4 */
705 /* Hello packets input count */
708 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
710 counter
+= ei
->hello_in
;
712 return SNMP_INTEGER(counter
);
714 return SNMP_INTEGER(0);
716 case EIGRPUPDATESSENT
: /* 5 */
717 /* Update packets output count */
720 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
722 counter
+= ei
->update_out
;
724 return SNMP_INTEGER(counter
);
726 return SNMP_INTEGER(0);
728 case EIGRPUPDATESRCVD
: /* 6 */
729 /* Update packets input count */
732 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
734 counter
+= ei
->update_in
;
736 return SNMP_INTEGER(counter
);
738 return SNMP_INTEGER(0);
740 case EIGRPQUERIESSENT
: /* 7 */
741 /* Querry packets output count */
744 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
746 counter
+= ei
->query_out
;
748 return SNMP_INTEGER(counter
);
750 return SNMP_INTEGER(0);
752 case EIGRPQUERIESRCVD
: /* 8 */
753 /* Querry packets input count */
756 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
758 counter
+= ei
->query_in
;
760 return SNMP_INTEGER(counter
);
762 return SNMP_INTEGER(0);
764 case EIGRPREPLIESSENT
: /* 9 */
765 /* Reply packets output count */
768 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
770 counter
+= ei
->reply_out
;
772 return SNMP_INTEGER(counter
);
774 return SNMP_INTEGER(0);
776 case EIGRPREPLIESRCVD
: /* 10 */
777 /* Reply packets input count */
780 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
782 counter
+= ei
->reply_in
;
784 return SNMP_INTEGER(counter
);
786 return SNMP_INTEGER(0);
788 case EIGRPACKSSENT
: /* 11 */
789 /* Acknowledgement packets output count */
792 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
794 counter
+= ei
->ack_out
;
796 return SNMP_INTEGER(counter
);
798 return SNMP_INTEGER(0);
800 case EIGRPACKSRCVD
: /* 12 */
801 /* Acknowledgement packets input count */
804 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
806 counter
+= ei
->ack_in
;
808 return SNMP_INTEGER(counter
);
810 return SNMP_INTEGER(0);
812 case EIGRPINPUTQHIGHMARK
: /* 13 */
813 /* The highest number of EIGRP packets in the input queue */
815 return SNMP_INTEGER(1);
817 return SNMP_INTEGER(0);
819 case EIGRPINPUTQDROPS
: /* 14 */
820 /* The number of EIGRP packets dropped from the input queue */
822 return SNMP_INTEGER(1);
824 return SNMP_INTEGER(0);
826 case EIGRPSIAQUERIESSENT
: /* 15 */
827 /* SIA querry packets output count */
830 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
832 counter
+= ei
->siaQuery_out
;
834 return SNMP_INTEGER(counter
);
836 return SNMP_INTEGER(0);
838 case EIGRPSIAQUERIESRCVD
: /* 16 */
839 /* SIA querry packets input count */
842 for (ALL_LIST_ELEMENTS(eigrp
->eiflist
, node
, nnode
,
844 counter
+= ei
->siaQuery_in
;
846 return SNMP_INTEGER(counter
);
848 return SNMP_INTEGER(0);
850 case EIGRPASROUTERIDTYPE
: /* 17 */
851 /* Whether the router ID is set manually or automatically */
853 if (eigrp
->router_id_static
!= 0)
854 return SNMP_INTEGER(1);
856 return SNMP_INTEGER(1);
858 return SNMP_INTEGER(0);
860 case EIGRPASROUTERID
: /* 18 */
861 /* Router ID for this EIGRP AS */
863 if (eigrp
->router_id_static
!= 0)
864 return SNMP_INTEGER(eigrp
->router_id_static
);
866 return SNMP_INTEGER(eigrp
->router_id
);
868 return SNMP_INTEGER(0);
870 case EIGRPTOPOROUTES
: /* 19 */
871 /* The total number of EIGRP derived routes currently existing
872 in the topology table for the AS */
874 return SNMP_INTEGER(1);
876 return SNMP_INTEGER(0);
878 case EIGRPHEADSERIAL
: /* 20 */
879 /* The serial number of the first route in the internal
882 return SNMP_INTEGER(1);
884 return SNMP_INTEGER(0);
886 case EIGRPNEXTSERIAL
: /* 21 */
887 /* The serial number that would be assigned to the next new
888 or changed route in the topology table for the AS*/
890 return SNMP_INTEGER(1);
892 return SNMP_INTEGER(0);
894 case EIGRPXMITPENDREPLIES
: /* 22 */
895 /* Total number of outstanding replies expected to queries
896 that have been sent to peers in the current AS*/
898 return SNMP_INTEGER(1);
900 return SNMP_INTEGER(0);
902 case EIGRPXMITDUMMIES
: /* 23 */
903 /* Total number of currently existing dummies associated with
906 return SNMP_INTEGER(1);
908 return SNMP_INTEGER(0);
916 static uint8_t *eigrpTopologyEntry(struct variable
*v
, oid
*name
,
917 size_t *length
, int exact
, size_t *var_len
,
918 WriteMethod
**write_method
)
921 struct eigrp_interface
*ei
;
922 struct listnode
*node
, *nnode
;
924 eigrp
= eigrp_lookup();
926 /* Check whether the instance identifier is valid */
927 if (smux_header_generic(v
, name
, length
, exact
, var_len
, write_method
)
931 /* Return the current value of the variable */
933 case EIGRPDESTNETTYPE
: /* 1 */
934 /* The format of the destination IP network number for a single
935 route in the topology table*/
937 return SNMP_INTEGER(1);
939 return SNMP_INTEGER(0);
941 case EIGRPDESTNET
: /* 2 */
942 /* The destination IP network number for a single route in the
945 return SNMP_INTEGER(1);
947 return SNMP_INTEGER(0);
949 case EIGRPDESTNETPREFIXLEN
: /* 4 */
950 /* The prefix length associated with the destination IP network
952 for a single route in the topology table in the AS*/
954 return SNMP_INTEGER(1);
956 return SNMP_INTEGER(0);
958 case EIGRPACTIVE
: /* 5 */
959 /* A value of true(1) indicates the route to the destination
961 A value of false(2) indicates the route is stable
964 return SNMP_INTEGER(1);
966 return SNMP_INTEGER(0);
968 case EIGRPSTUCKINACTIVE
: /* 6 */
969 /* A value of true(1) indicates that that this route which is in
971 has not received any replies to queries for alternate paths
974 return SNMP_INTEGER(1);
976 return SNMP_INTEGER(0);
978 case EIGRPDESTSUCCESSORS
: /* 7 */
979 /* Next routing hop for a path to the destination IP network */
981 return SNMP_INTEGER(1);
983 return SNMP_INTEGER(0);
985 case EIGRPFDISTANCE
: /* 8 */
986 /* Minimum distance from this router to the destination IP
989 return SNMP_INTEGER(1);
991 return SNMP_INTEGER(0);
993 case EIGRPROUTEORIGINTYPE
: /* 9 */
994 /* Text string describing the internal origin of the EIGRP route
997 return SNMP_INTEGER(1);
999 return SNMP_INTEGER(0);
1001 case EIGRPROUTEORIGINADDRTYPE
: /* 10 */
1002 /* The format of the IP address defined as the origin of this
1003 topology route entry */
1005 return SNMP_INTEGER(1);
1007 return SNMP_INTEGER(0);
1009 case EIGRPROUTEORIGINADDR
: /* 11 */
1010 /* If the origin of the topology route entry is external to this
1012 then this object is the IP address of the router from which
1015 return SNMP_INTEGER(1);
1017 return SNMP_INTEGER(0);
1019 case EIGRPNEXTHOPADDRESSTYPE
: /* 12 */
1020 /* The format of the next hop IP address */
1022 return SNMP_INTEGER(1);
1024 return SNMP_INTEGER(0);
1026 case EIGRPNEXTHOPADDRESS
: /* 13 */
1027 /* Next hop IP address for the route */
1029 return SNMP_INTEGER(1);
1031 return SNMP_INTEGER(0);
1033 case EIGRPNEXTHOPINTERFACE
: /* 14 */
1034 /* The interface through which the next hop IP address is
1037 return SNMP_INTEGER(1);
1039 return SNMP_INTEGER(0);
1041 case EIGRPDISTANCE
: /* 15 */
1042 /* The computed distance to the destination network entry from
1045 return SNMP_INTEGER(1);
1047 return SNMP_INTEGER(0);
1049 case EIGRPREPORTDISTANCE
: /* 16 */
1050 /* The computed distance to the destination network in the
1052 reported to this router by the originator of this route */
1054 return SNMP_INTEGER(1);
1056 return SNMP_INTEGER(0);
1064 static uint8_t *eigrpPeerEntry(struct variable
*v
, oid
*name
, size_t *length
,
1065 int exact
, size_t *var_len
,
1066 WriteMethod
**write_method
)
1068 struct eigrp
*eigrp
;
1069 struct eigrp_interface
*ei
;
1070 struct listnode
*node
, *nnode
;
1071 struct eigrp_neighbor
*nbr
;
1072 struct in_addr nbr_addr
;
1073 unsigned int ifindex
;
1075 eigrp
= eigrp_lookup();
1077 /* Check whether the instance identifier is valid */
1078 if (smux_header_generic(v
, name
, length
, exact
, var_len
, write_method
)
1082 memset(&nbr_addr
, 0, sizeof(struct in_addr
));
1085 nbr
= eigrpNbrLookup(v
, name
, length
, &nbr_addr
, &ifindex
, exact
);
1092 /* Return the current value of the variable */
1094 case EIGRPHANDLE
: /* 1 */
1095 /* The unique internal identifier for the peer in the AS */
1097 return SNMP_INTEGER(1);
1099 return SNMP_INTEGER(0);
1101 case EIGRPPEERADDRTYPE
: /* 2 */
1102 /* The format of the remote source IP address used by the peer
1105 return SNMP_INTEGER(1);
1107 return SNMP_INTEGER(0);
1109 case EIGRPPEERADDR
: /* 3 */
1110 /* The source IP address used by the peer */
1112 return SNMP_INTEGER(1);
1114 return SNMP_INTEGER(0);
1116 case EIGRPPEERIFINDEX
: /* 4 */
1117 /* The ifIndex of the interface on this router */
1119 return SNMP_INTEGER(1);
1121 return SNMP_INTEGER(0);
1123 case EIGRPHOLDTIME
: /* 5 */
1124 /* How much time must pass without receiving a hello packet from
1126 EIGRP peer before this router declares the peer down */
1128 return SNMP_INTEGER(1);
1130 return SNMP_INTEGER(0);
1132 case EIGRPUPTIME
: /* 6 */
1133 /* The elapsed time since the EIGRP adjacency was first
1136 return SNMP_INTEGER(1);
1138 return SNMP_INTEGER(0);
1140 case EIGRPSRTT
: /* 7 */
1141 /* The computed smooth round trip time for packets to and from
1144 return SNMP_INTEGER(1);
1146 return SNMP_INTEGER(0);
1148 case EIGRPRTO
: /* 8 */
1149 /* The computed retransmission timeout for the peer */
1151 return SNMP_INTEGER(1);
1153 return SNMP_INTEGER(0);
1155 case EIGRPPKTSENQUEUED
: /* 9 */
1156 /* The number of any EIGRP packets currently enqueued */
1158 return SNMP_INTEGER(1);
1160 return SNMP_INTEGER(0);
1162 case EIGRPLASTSEQ
: /* 10 */
1163 /* sequence number of the last EIGRP packet sent to this peer */
1165 return SNMP_INTEGER(1);
1167 return SNMP_INTEGER(0);
1169 case EIGRPVERSION
: /* 11 */
1170 /* The EIGRP version information reported by the remote peer */
1172 return SNMP_INTEGER(1);
1174 return SNMP_INTEGER(0);
1176 case EIGRPRETRANS
: /* 12 */
1177 /* The cumulative number of retransmissions to this peer */
1179 return SNMP_INTEGER(1);
1181 return SNMP_INTEGER(0);
1183 case EIGRPRETRIES
: /* 13 */
1184 /* The number of times the current unacknowledged packet has
1187 return SNMP_INTEGER(1);
1189 return SNMP_INTEGER(0);
1197 static uint8_t *eigrpInterfaceEntry(struct variable
*v
, oid
*name
,
1198 size_t *length
, int exact
, size_t *var_len
,
1199 WriteMethod
**write_method
)
1201 struct eigrp
*eigrp
;
1202 struct eigrp_interface
*ei
;
1203 struct listnode
*node
, *nnode
;
1204 struct keychain
*keychain
;
1205 struct list
*keylist
;
1208 eigrp
= eigrp_lookup();
1210 /* Check whether the instance identifier is valid */
1211 if (smux_header_generic(v
, name
, length
, exact
, var_len
, write_method
)
1215 /* Return the current value of the variable */
1217 case EIGRPPEERCOUNT
: /* 3 */
1218 /* The number of EIGRP adjacencies currently formed with
1219 peers reached through this interface */
1221 return SNMP_INTEGER(eigrp_neighbor_count(eigrp
));
1223 return SNMP_INTEGER(0);
1225 case EIGRPXMITRELIABLEQ
: /* 4 */
1226 /* The number of EIGRP packets currently waiting in the reliable
1227 transport transmission queue */
1229 return SNMP_INTEGER(1);
1231 return SNMP_INTEGER(0);
1233 case EIGRPXMITUNRELIABLEQ
: /* 5 */
1234 /* The number of EIGRP packets currently waiting in the
1236 transport transmission queue */
1238 return SNMP_INTEGER(1);
1240 return SNMP_INTEGER(0);
1242 case EIGRPMEANSRTT
: /* 6 */
1243 /* The average of all the computed smooth round trip time values
1244 for a packet to and from all peers established on this
1247 return SNMP_INTEGER(1);
1249 return SNMP_INTEGER(0);
1251 case EIGRPPACINGRELIABLE
: /* 7 */
1252 /* The configured time interval between EIGRP packet
1255 return SNMP_INTEGER(1);
1257 return SNMP_INTEGER(0);
1259 case EIGRPPACINGUNRELIABLE
: /* 8 */
1260 /* The configured time interval between EIGRP packet
1262 on the interface when the unreliable transport method is used
1265 return SNMP_INTEGER(1);
1267 return SNMP_INTEGER(0);
1269 case EIGRPMFLOWTIMER
: /* 9 */
1270 /* The configured multicast flow control timer value */
1272 return SNMP_INTEGER(1);
1274 return SNMP_INTEGER(0);
1276 case EIGRPPENDINGROUTES
: /* 10 */
1277 /* The number of queued EIGRP routing updates awaiting
1280 return SNMP_INTEGER(1);
1282 return SNMP_INTEGER(0);
1284 case EIGRPHELLOINTERVAL
: /* 11 */
1285 /* The configured time interval between Hello packet
1288 return SNMP_INTEGER(1);
1290 return SNMP_INTEGER(0);
1292 case EIGRPXMITNEXTSERIAL
: /* 12 */
1293 /* The serial number of the next EIGRP packet that is to be
1297 return SNMP_INTEGER(1);
1299 return SNMP_INTEGER(0);
1301 case EIGRPUMCASTS
: /* 13 */
1302 /* The total number of unreliable EIGRP multicast packets sent
1303 on this interface */
1305 return SNMP_INTEGER(1);
1307 return SNMP_INTEGER(0);
1309 case EIGRPRMCASTS
: /* 14 */
1310 /* The total number of reliable EIGRP multicast packets sent
1311 on this interface */
1313 return SNMP_INTEGER(1);
1315 return SNMP_INTEGER(0);
1317 case EIGRPUUCASTS
: /* 15 */
1318 /* The total number of unreliable EIGRP unicast packets sent
1319 on this interface */
1321 return SNMP_INTEGER(1);
1323 return SNMP_INTEGER(0);
1325 case EIGRPRUCASTS
: /* 16 */
1326 /* The total number of reliable EIGRP unicast packets sent
1327 on this interface */
1329 return SNMP_INTEGER(1);
1331 return SNMP_INTEGER(0);
1333 case EIGRPMCASTEXCEPTS
: /* 17 */
1334 /* The total number of EIGRP multicast exception transmissions
1337 return SNMP_INTEGER(1);
1339 return SNMP_INTEGER(0);
1341 case EIGRPCRPKTS
: /* 18 */
1342 /* The total number EIGRP Conditional-Receive packets sent on
1345 return SNMP_INTEGER(1);
1347 return SNMP_INTEGER(0);
1349 case EIGRPACKSSUPPRESSED
: /* 19 */
1350 /* The total number of individual EIGRP acknowledgement packets
1352 suppressed and combined in an already enqueued outbound
1353 reliable packet on this interface */
1355 return SNMP_INTEGER(1);
1357 return SNMP_INTEGER(0);
1359 case EIGRPRETRANSSENT
: /* 20 */
1360 /* The total number EIGRP packet retransmissions sent on the
1363 return SNMP_INTEGER(1);
1365 return SNMP_INTEGER(0);
1367 case EIGRPOOSRCVD
: /* 21 */
1368 /* The total number of out-of-sequence EIGRP packets received */
1370 return SNMP_INTEGER(1);
1372 return SNMP_INTEGER(0);
1374 case EIGRPAUTHMODE
: /* 22 */
1375 /* The EIGRP authentication mode of the interface */
1377 return SNMP_INTEGER(1);
1379 return SNMP_INTEGER(0);
1381 case EIGRPAUTHKEYCHAIN
: /* 23 */
1382 /* The name of the authentication key-chain configured
1383 on this interface. */
1384 keylist
= keychain_list_get();
1385 for (ALL_LIST_ELEMENTS(keylist
, node
, nnode
, keychain
)) {
1386 return (uint8_t *)keychain
->name
;
1388 if (eigrp
&& keychain
) {
1389 *var_len
= str_len(keychain
->name
);
1390 return (uint8_t *)keychain
->name
;
1392 return (uint8_t *)"TEST";
1400 /* Register EIGRP-MIB. */
1401 void eigrp_snmp_init()
1403 eigrp_snmp_iflist
= list_new();
1404 smux_init(eigrp_om
->master
);
1405 REGISTER_MIB("ciscoEigrpMIB", eigrp_variables
, variable
, eigrp_oid
);