summaryrefslogtreecommitdiffstats
path: root/eigrpd/eigrp_snmp.c
blob: 5a930424c004785eb76020513f6dee9e272e7b76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
/*
 * EIGRP SNMP Support.
 * Copyright (C) 2013-2014
 * Authors:
 *   Donnie Savage
 *   Jan Janovic
 *   Matej Perina
 *   Peter Orsag
 *   Peter Paluch
 *
 * This file is part of GNU Zebra.
 *
 * GNU Zebra is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * GNU Zebra is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; see the file COPYING; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */

#include <zebra.h>

#ifdef HAVE_SNMP
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>

#include "thread.h"
#include "memory.h"
#include "linklist.h"
#include "prefix.h"
#include "if.h"
#include "table.h"
#include "sockunion.h"
#include "stream.h"
#include "log.h"
#include "sockopt.h"
#include "checksum.h"
#include "md5.h"
#include "keychain.h"
#include "smux.h"

#include "eigrpd/eigrp_structs.h"
#include "eigrpd/eigrpd.h"
#include "eigrpd/eigrp_interface.h"
#include "eigrpd/eigrp_neighbor.h"
#include "eigrpd/eigrp_packet.h"
#include "eigrpd/eigrp_zebra.h"
#include "eigrpd/eigrp_vty.h"
#include "eigrpd/eigrp_dump.h"
#include "eigrpd/eigrp_network.h"
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
#include "eigrpd/eigrp_snmp.h"

struct list *eigrp_snmp_iflist;

/* Declare static local variables for convenience. */
SNMP_LOCAL_VARIABLES

/* EIGRP-MIB - 1.3.6.1.4.1.9.9.449.1*/
#define EIGRPMIB 1,3,6,1,4,1,9,9,449,1

/* EIGRP-MIB instances. */
oid eigrp_oid[] = {EIGRPMIB};

/* EIGRP VPN entry */
#define EIGRPVPNID						1
#define EIGRPVPNNAME						2

/* EIGRP Traffic statistics entry */
#define EIGRPASNUMBER					1
#define EIGRPNBRCOUNT					2
#define EIGRPHELLOSSENT					3
#define EIGRPHELLOSRCVD					4
#define EIGRPUPDATESSENT				5
#define EIGRPUPDATESRCVD				6
#define EIGRPQUERIESSENT				7
#define EIGRPQUERIESRCVD				8
#define EIGRPREPLIESSENT				9
#define EIGRPREPLIESRCVD				10
#define EIGRPACKSSENT					11
#define EIGRPACKSRCVD					12
#define EIGRPINPUTQHIGHMARK				13
#define EIGRPINPUTQDROPS				14
#define EIGRPSIAQUERIESSENT				15
#define EIGRPSIAQUERIESRCVD				16
#define EIGRPASROUTERIDTYPE				17
#define EIGRPASROUTERID					18
#define EIGRPTOPOROUTES					19
#define EIGRPHEADSERIAL					20
#define EIGRPNEXTSERIAL					21
#define EIGRPXMITPENDREPLIES				22
#define EIGRPXMITDUMMIES				23

/* EIGRP topology entry */
#define EIGRPDESTNETTYPE				1
#define EIGRPDESTNET					2
#define EIGRPDESTNETPREFIXLEN				4
#define EIGRPACTIVE					5
#define EIGRPSTUCKINACTIVE				6
#define EIGRPDESTSUCCESSORS				7
#define EIGRPFDISTANCE					8
#define EIGRPROUTEORIGINTYPE				9
#define EIGRPROUTEORIGINADDRTYPE			10
#define EIGRPROUTEORIGINADDR				11
#define EIGRPNEXTHOPADDRESSTYPE				12
#define EIGRPNEXTHOPADDRESS				13
#define EIGRPNEXTHOPINTERFACE				14
#define EIGRPDISTANCE					15
#define EIGRPREPORTDISTANCE				16

/* EIGRP peer entry */
#define EIGRPHANDLE							1
#define EIGRPPEERADDRTYPE					2
#define EIGRPPEERADDR						3
#define EIGRPPEERIFINDEX					4
#define EIGRPHOLDTIME						5
#define EIGRPUPTIME							6
#define EIGRPSRTT							7
#define EIGRPRTO							8
#define EIGRPPKTSENQUEUED					9
#define EIGRPLASTSEQ						10
#define EIGRPVERSION						11
#define EIGRPRETRANS						12
#define EIGRPRETRIES						13

/* EIGRP interface entry */
#define EIGRPPEERCOUNT						3
#define EIGRPXMITRELIABLEQ					4
#define EIGRPXMITUNRELIABLEQ	        	5
#define EIGRPMEANSRTT						6
#define EIGRPPACINGRELIABLE					7
#define EIGRPPACINGUNRELIABLE		        8
#define EIGRPMFLOWTIMER						9
#define EIGRPPENDINGROUTES					10
#define EIGRPHELLOINTERVAL					11
#define EIGRPXMITNEXTSERIAL					12
#define EIGRPUMCASTS						13
#define EIGRPRMCASTS						14
#define EIGRPUUCASTS						15
#define EIGRPRUCASTS						16
#define EIGRPMCASTEXCEPTS					17
#define EIGRPCRPKTS							18
#define EIGRPACKSSUPPRESSED					19
#define EIGRPRETRANSSENT					20
#define EIGRPOOSRCVD						21
#define EIGRPAUTHMODE						22
#define EIGRPAUTHKEYCHAIN					23

/* SNMP value hack. */
#define COUNTER                 ASN_COUNTER
#define INTEGER                 ASN_INTEGER
#define GAUGE                   ASN_GAUGE
#define TIMETICKS               ASN_TIMETICKS
#define IPADDRESS               ASN_IPADDRESS
#define STRING                  ASN_OCTET_STR
#define IPADDRESSPREFIXLEN      ASN_INTEGER
#define IPADDRESSTYPE           ASN_INTEGER
#define INTERFACEINDEXORZERO    ASN_INTEGER
#define UINTEGER                ASN_UNSIGNED

/* Hook functions. */
static uint8_t *eigrpVpnEntry(struct variable *, oid *, size_t *, int, size_t *,
			      WriteMethod **);
static uint8_t *eigrpTraffStatsEntry(struct variable *, oid *, size_t *, int,
				     size_t *, WriteMethod **);
static uint8_t *eigrpTopologyEntry(struct variable *, oid *, size_t *, int,
				   size_t *, WriteMethod **);
static uint8_t *eigrpPeerEntry(struct variable *, oid *, size_t *, int,
			       size_t *, WriteMethod **);
static uint8_t *eigrpInterfaceEntry(struct variable *, oid *, size_t *, int,
				    size_t *, WriteMethod **);


struct variable eigrp_variables[] = {
	/* EIGRP vpn variables */
	{EIGRPVPNID, INTEGER, NOACCESS, eigrpVpnEntry, 4, {1, 1, 1, 1}},
	{EIGRPVPNNAME, STRING, RONLY, eigrpVpnEntry, 4, {1, 1, 1, 2}},

	/* EIGRP traffic stats variables */
	{EIGRPASNUMBER,
	 UINTEGER,
	 NOACCESS,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 1}},
	{EIGRPNBRCOUNT, UINTEGER, RONLY, eigrpTraffStatsEntry, 4, {2, 1, 1, 2}},
	{EIGRPHELLOSSENT,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 3}},
	{EIGRPHELLOSRCVD,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 4}},
	{EIGRPUPDATESSENT,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 5}},
	{EIGRPUPDATESRCVD,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 6}},
	{EIGRPQUERIESSENT,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 7}},
	{EIGRPQUERIESRCVD,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 8}},
	{EIGRPREPLIESSENT,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 9}},
	{EIGRPREPLIESRCVD,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 10}},
	{EIGRPACKSSENT, COUNTER, RONLY, eigrpTraffStatsEntry, 4, {2, 1, 1, 11}},
	{EIGRPACKSRCVD, COUNTER, RONLY, eigrpTraffStatsEntry, 4, {2, 1, 1, 12}},
	{EIGRPINPUTQHIGHMARK,
	 INTEGER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 13}},
	{EIGRPINPUTQDROPS,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 14}},
	{EIGRPSIAQUERIESSENT,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 15}},
	{EIGRPSIAQUERIESRCVD,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 16}},
	{EIGRPASROUTERIDTYPE,
	 IPADDRESSTYPE,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 17}},
	{EIGRPASROUTERID,
	 IPADDRESS,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 18}},
	{EIGRPTOPOROUTES,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 19}},
	{EIGRPHEADSERIAL,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 20}},
	{EIGRPNEXTSERIAL,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 21}},
	{EIGRPXMITPENDREPLIES,
	 INTEGER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 22}},
	{EIGRPXMITDUMMIES,
	 COUNTER,
	 RONLY,
	 eigrpTraffStatsEntry,
	 4,
	 {2, 1, 1, 23}},

	/* EIGRP topology variables */
	{EIGRPDESTNETTYPE,
	 IPADDRESSTYPE,
	 NOACCESS,
	 eigrpTopologyEntry,
	 4,
	 {3, 1, 1, 1}},
	{EIGRPDESTNET,
	 IPADDRESSPREFIXLEN,
	 NOACCESS,
	 eigrpTopologyEntry,
	 4,
	 {3, 1, 1, 2}},
	{EIGRPDESTNETPREFIXLEN,
	 IPADDRESSTYPE,
	 NOACCESS,
	 eigrpTopologyEntry,
	 4,
	 {3, 1, 1, 4}},
	{EIGRPACTIVE, INTEGER, RONLY, eigrpTopologyEntry, 4, {3, 1, 1, 5}},
	{EIGRPSTUCKINACTIVE,
	 INTEGER,
	 RONLY,
	 eigrpTopologyEntry,
	 4,
	 {3, 1, 1, 6}},
	{EIGRPDESTSUCCESSORS,
	 INTEGER,
	 RONLY,
	 eigrpTopologyEntry,
	 4,
	 {3, 1, 1, 7}},
	{EIGRPFDISTANCE, INTEGER, RONLY, eigrpTopologyEntry, 4, {3, 1, 1, 8}},
	{EIGRPROUTEORIGINTYPE,
	 STRING,
	 RONLY,
	 eigrpTopologyEntry,
	 4,
	 {3, 1, 1, 9}},
	{EIGRPROUTEORIGINADDRTYPE,
	 IPADDRESSTYPE,
	 RONLY,
	 eigrpTopologyEntry,
	 4,
	 {3, 1, 1, 10}},
	{EIGRPROUTEORIGINADDR,
	 IPADDRESS,
	 RONLY,
	 eigrpTopologyEntry,
	 4,
	 {3, 1, 1, 11}},
	{EIGRPNEXTHOPADDRESSTYPE,
	 IPADDRESSTYPE,
	 RONLY,
	 eigrpTopologyEntry,
	 4,
	 {3, 1, 1, 12}},
	{EIGRPNEXTHOPADDRESS,
	 IPADDRESS,
	 RONLY,
	 eigrpTopologyEntry,
	 4,
	 {3, 1, 1, 13}},
	{EIGRPNEXTHOPINTERFACE,
	 STRING,
	 RONLY,
	 eigrpTopologyEntry,
	 4,
	 {3, 1, 1, 14}},
	{EIGRPDISTANCE, INTEGER, RONLY, eigrpTopologyEntry, 4, {3, 1, 1, 15}},
	{EIGRPREPORTDISTANCE,
	 INTEGER,
	 RONLY,
	 eigrpTopologyEntry,
	 4,
	 {3, 1, 1, 16}},

	/* EIGRP peer variables */
	{EIGRPHANDLE, INTEGER, NOACCESS, eigrpPeerEntry, 4, {4, 1, 1, 1}},
	{EIGRPPEERADDRTYPE,
	 IPADDRESSTYPE,
	 RONLY,
	 eigrpPeerEntry,
	 4,
	 {4, 1, 1, 2}},
	{EIGRPPEERADDR, IPADDRESS, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 3}},
	{EIGRPPEERIFINDEX,
	 INTERFACEINDEXORZERO,
	 RONLY,
	 eigrpPeerEntry,
	 4,
	 {4, 1, 1, 4}},
	{EIGRPHOLDTIME, INTEGER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 5}},
	{EIGRPUPTIME, STRING, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 6}},
	{EIGRPSRTT, INTEGER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 7}},
	{EIGRPRTO, INTEGER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 8}},
	{EIGRPPKTSENQUEUED, INTEGER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 9}},
	{EIGRPLASTSEQ, INTEGER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 10}},
	{EIGRPVERSION, STRING, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 11}},
	{EIGRPRETRANS, COUNTER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 12}},
	{EIGRPRETRIES, INTEGER, RONLY, eigrpPeerEntry, 4, {4, 1, 1, 13}},

	/* EIGRP interface variables */
	{EIGRPPEERCOUNT, GAUGE, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 3}},
	{EIGRPXMITRELIABLEQ,
	 GAUGE,
	 RONLY,
	 eigrpInterfaceEntry,
	 4,
	 {5, 1, 1, 4}},
	{EIGRPXMITUNRELIABLEQ,
	 GAUGE,
	 RONLY,
	 eigrpInterfaceEntry,
	 4,
	 {5, 1, 1, 5}},
	{EIGRPMEANSRTT, INTEGER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 6}},
	{EIGRPPACINGRELIABLE,
	 INTEGER,
	 RONLY,
	 eigrpInterfaceEntry,
	 4,
	 {5, 1, 1, 7}},
	{EIGRPPACINGUNRELIABLE,
	 INTEGER,
	 RONLY,
	 eigrpInterfaceEntry,
	 4,
	 {5, 1, 1, 8}},
	{EIGRPMFLOWTIMER, INTEGER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 9}},
	{EIGRPPENDINGROUTES,
	 GAUGE,
	 RONLY,
	 eigrpInterfaceEntry,
	 4,
	 {5, 1, 1, 10}},
	{EIGRPHELLOINTERVAL,
	 INTEGER,
	 RONLY,
	 eigrpInterfaceEntry,
	 4,
	 {5, 1, 1, 11}},
	{EIGRPXMITNEXTSERIAL,
	 COUNTER,
	 RONLY,
	 eigrpInterfaceEntry,
	 4,
	 {5, 1, 1, 12}},
	{EIGRPUMCASTS, COUNTER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 13}},
	{EIGRPRMCASTS, COUNTER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 14}},
	{EIGRPUUCASTS, COUNTER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 15}},
	{EIGRPRUCASTS, COUNTER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 16}},
	{EIGRPMCASTEXCEPTS,
	 COUNTER,
	 RONLY,
	 eigrpInterfaceEntry,
	 4,
	 {5, 1, 1, 17}},
	{EIGRPCRPKTS, COUNTER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 18}},
	{EIGRPACKSSUPPRESSED,
	 COUNTER,
	 RONLY,
	 eigrpInterfaceEntry,
	 4,
	 {5, 1, 1, 19}},
	{EIGRPRETRANSSENT,
	 COUNTER,
	 RONLY,
	 eigrpInterfaceEntry,
	 4,
	 {5, 1, 1, 20}},
	{EIGRPOOSRCVD, COUNTER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 21}},
	{EIGRPAUTHMODE, INTEGER, RONLY, eigrpInterfaceEntry, 4, {5, 1, 1, 22}},
	{EIGRPAUTHKEYCHAIN,
	 STRING,
	 RONLY,
	 eigrpInterfaceEntry,
	 4,
	 {5, 1, 1, 23}}};

static struct eigrp_neighbor *eigrp_snmp_nbr_lookup(struct eigrp *eigrp,
						    struct in_addr *nbr_addr,
						    unsigned int *ifindex)
{
	struct listnode *node, *nnode, *node2, *nnode2;
	struct eigrp_interface *ei;
	struct eigrp_neighbor *nbr;

	for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode, ei)) {
		for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) {
			if (IPV4_ADDR_SAME(&nbr->src, nbr_addr)) {
				return nbr;
			}
		}
	}
	return NULL;
}

static struct eigrp_neighbor *
eigrp_snmp_nbr_lookup_next(struct in_addr *nbr_addr, unsigned int *ifindex,
			   int first)
{
	struct listnode *node, *nnode, *node2, *nnode2;
	struct eigrp_interface *ei;
	struct eigrp_neighbor *nbr;
	struct eigrp_neighbor *min = NULL;
	struct eigrp *eigrp;

	eigrp = eigrp_lookup();

	for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode, ei)) {
		for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) {
			if (first) {
				if (!min)
					min = nbr;
				else if (ntohl(nbr->src.s_addr)
					 < ntohl(min->src.s_addr))
					min = nbr;
			} else if (ntohl(nbr->src.s_addr)
				   > ntohl(nbr_addr->s_addr)) {
				if (!min)
					min = nbr;
				else if (ntohl(nbr->src.s_addr)
					 < ntohl(min->src.s_addr))
					min = nbr;
			}
		}
	}
	if (min) {
		*nbr_addr = min->src;
		*ifindex = 0;
		return min;
	}
	return NULL;
}

static struct eigrp_neighbor *eigrpNbrLookup(struct variable *v, oid *name,
					     size_t *length,
					     struct in_addr *nbr_addr,
					     unsigned int *ifindex, int exact)
{
	unsigned int len;
	int first;
	struct eigrp_neighbor *nbr;
	struct eigrp *eigrp;

	eigrp = eigrp_lookup();

	if (!eigrp)
		return NULL;

	if (exact) {
		if (*length != v->namelen + IN_ADDR_SIZE + 1)
			return NULL;

		oid2in_addr(name + v->namelen, IN_ADDR_SIZE, nbr_addr);
		*ifindex = name[v->namelen + IN_ADDR_SIZE];

		return eigrp_snmp_nbr_lookup(eigrp, nbr_addr, ifindex);
	} else {
		first = 0;
		len = *length - v->namelen;

		if (len == 0)
			first = 1;

		if (len > IN_ADDR_SIZE)
			len = IN_ADDR_SIZE;

		oid2in_addr(name + v->namelen, len, nbr_addr);

		len = *length - v->namelen - IN_ADDR_SIZE;
		if (len >= 1)
			*ifindex = name[v->namelen + IN_ADDR_SIZE];

		nbr = eigrp_snmp_nbr_lookup_next(nbr_addr, ifindex, first);

		if (nbr) {
			*length = v->namelen + IN_ADDR_SIZE + 1;
			oid_copy_in_addr(name + v->namelen, nbr_addr);
			name[v->namelen + IN_ADDR_SIZE] = *ifindex;
			return nbr;
		}
	}
	return NULL;
}


static uint8_t *eigrpVpnEntry(struct variable *v, oid *name, size_t *length,
			      int exact, size_t *var_len,
			      WriteMethod **write_method)
{
	struct eigrp *eigrp;

	eigrp = eigrp_lookup();

	/* Check whether the instance identifier is valid */
	if (smux_header_generic(v, name, length, exact, var_len, write_method)
	    == MATCH_FAILED)
		return NULL;

	/* Return the current value of the variable */
	switch (v->magic) {
	case EIGRPVPNID: /* 1 */
		/* The unique VPN identifier */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPVPNNAME: /* 2 */
		/* The name given to the VPN */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	default:
		return NULL;
	}
	return NULL;
}

static uint32_t eigrp_neighbor_count(struct eigrp *eigrp)
{
	uint32_t count;
	struct eigrp_interface *ei;
	struct listnode *node, *node2, *nnode2;
	struct eigrp_neighbor *nbr;

	if (eigrp == NULL) {
		return 0;
	}

	count = 0;
	for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) {
		for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) {
			if (nbr->state == EIGRP_NEIGHBOR_UP)
				count++;
		}
	}

	return count;
}


static uint8_t *eigrpTraffStatsEntry(struct variable *v, oid *name,
				     size_t *length, int exact, size_t *var_len,
				     WriteMethod **write_method)
{
	struct eigrp *eigrp;
	struct eigrp_interface *ei;
	struct listnode *node, *nnode;
	int counter;

	eigrp = eigrp_lookup();

	/* Check whether the instance identifier is valid */
	if (smux_header_generic(v, name, length, exact, var_len, write_method)
	    == MATCH_FAILED)
		return NULL;

	/* Return the current value of the variable */
	switch (v->magic) {
	case EIGRPASNUMBER: /* 1 */
		/* AS-number of this EIGRP instance. */
		if (eigrp)
			return SNMP_INTEGER(eigrp->AS);
		else
			return SNMP_INTEGER(0);
	case EIGRPNBRCOUNT: /* 2 */
		/* Neighbor count of this EIGRP instance */
		if (eigrp)
			return SNMP_INTEGER(eigrp_neighbor_count(eigrp));
		else
			return SNMP_INTEGER(0);
	case EIGRPHELLOSSENT: /* 3 */
		/* Hello packets output count */
		if (eigrp) {
			counter = 0;
			for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
					       ei)) {
				counter += ei->hello_out;
			}
			return SNMP_INTEGER(counter);
		} else
			return SNMP_INTEGER(0);
	case EIGRPHELLOSRCVD: /* 4 */
		/* Hello packets input count */
		if (eigrp) {
			counter = 0;
			for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
					       ei)) {
				counter += ei->hello_in;
			}
			return SNMP_INTEGER(counter);
		} else
			return SNMP_INTEGER(0);
	case EIGRPUPDATESSENT: /* 5 */
		/* Update packets output count */
		if (eigrp) {
			counter = 0;
			for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
					       ei)) {
				counter += ei->update_out;
			}
			return SNMP_INTEGER(counter);
		} else
			return SNMP_INTEGER(0);
	case EIGRPUPDATESRCVD: /* 6 */
		/* Update packets input count */
		if (eigrp) {
			counter = 0;
			for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
					       ei)) {
				counter += ei->update_in;
			}
			return SNMP_INTEGER(counter);
		} else
			return SNMP_INTEGER(0);
	case EIGRPQUERIESSENT: /* 7 */
		/* Querry packets output count */
		if (eigrp) {
			counter = 0;
			for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
					       ei)) {
				counter += ei->query_out;
			}
			return SNMP_INTEGER(counter);
		} else
			return SNMP_INTEGER(0);
	case EIGRPQUERIESRCVD: /* 8 */
		/* Querry packets input count */
		if (eigrp) {
			counter = 0;
			for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
					       ei)) {
				counter += ei->query_in;
			}
			return SNMP_INTEGER(counter);
		} else
			return SNMP_INTEGER(0);
	case EIGRPREPLIESSENT: /* 9 */
		/* Reply packets output count */
		if (eigrp) {
			counter = 0;
			for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
					       ei)) {
				counter += ei->reply_out;
			}
			return SNMP_INTEGER(counter);
		} else
			return SNMP_INTEGER(0);
	case EIGRPREPLIESRCVD: /* 10 */
		/* Reply packets input count */
		if (eigrp) {
			counter = 0;
			for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
					       ei)) {
				counter += ei->reply_in;
			}
			return SNMP_INTEGER(counter);
		} else
			return SNMP_INTEGER(0);
	case EIGRPACKSSENT: /* 11 */
		/* Acknowledgement packets output count */
		if (eigrp) {
			counter = 0;
			for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
					       ei)) {
				counter += ei->ack_out;
			}
			return SNMP_INTEGER(counter);
		} else
			return SNMP_INTEGER(0);
	case EIGRPACKSRCVD: /* 12 */
		/* Acknowledgement packets input count */
		if (eigrp) {
			counter = 0;
			for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
					       ei)) {
				counter += ei->ack_in;
			}
			return SNMP_INTEGER(counter);
		} else
			return SNMP_INTEGER(0);
	case EIGRPINPUTQHIGHMARK: /* 13 */
		/* The highest number of EIGRP packets in the input queue */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPINPUTQDROPS: /* 14 */
		/* The number of EIGRP packets dropped from the input queue */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPSIAQUERIESSENT: /* 15 */
		/* SIA querry packets output count */
		if (eigrp) {
			counter = 0;
			for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
					       ei)) {
				counter += ei->siaQuery_out;
			}
			return SNMP_INTEGER(counter);
		} else
			return SNMP_INTEGER(0);
	case EIGRPSIAQUERIESRCVD: /* 16 */
		/* SIA querry packets input count */
		if (eigrp) {
			counter = 0;
			for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode,
					       ei)) {
				counter += ei->siaQuery_in;
			}
			return SNMP_INTEGER(counter);
		} else
			return SNMP_INTEGER(0);
	case EIGRPASROUTERIDTYPE: /* 17 */
		/* Whether the router ID is set manually or automatically */
		if (eigrp)
			if (eigrp->router_id_static != 0)
				return SNMP_INTEGER(1);
			else
				return SNMP_INTEGER(1);
		else
			return SNMP_INTEGER(0);
	case EIGRPASROUTERID: /* 18 */
		/* Router ID for this EIGRP AS */
		if (eigrp)
			if (eigrp->router_id_static != 0)
				return SNMP_INTEGER(eigrp->router_id_static);
			else
				return SNMP_INTEGER(eigrp->router_id);
		else
			return SNMP_INTEGER(0);
	case EIGRPTOPOROUTES: /* 19 */
		/* The total number of EIGRP derived routes currently existing
		   in the topology table for the AS */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPHEADSERIAL: /* 20 */
		/* The serial number of the first route in the internal
		   sequence for an AS*/
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPNEXTSERIAL: /* 21 */
		/* The serial number that would be assigned to the next new
		 or changed route in the topology table for the AS*/
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPXMITPENDREPLIES: /* 22 */
		/* Total number of outstanding replies expected to queries
		   that have been sent to peers in the current AS*/
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPXMITDUMMIES: /* 23 */
		/* Total number of currently existing dummies associated with
		 * the AS*/
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	default:
		return NULL;
	}
	return NULL;
}

static uint8_t *eigrpTopologyEntry(struct variable *v, oid *name,
				   size_t *length, int exact, size_t *var_len,
				   WriteMethod **write_method)
{
	struct eigrp *eigrp;

	eigrp = eigrp_lookup();

	/* Check whether the instance identifier is valid */
	if (smux_header_generic(v, name, length, exact, var_len, write_method)
	    == MATCH_FAILED)
		return NULL;

	/* Return the current value of the variable */
	switch (v->magic) {
	case EIGRPDESTNETTYPE: /* 1 */
		/* The format of the destination IP network number for a single
		   route in the topology table*/
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPDESTNET: /* 2 */
		/* The destination IP network number for a single route in the
		 * topology table*/
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPDESTNETPREFIXLEN: /* 4 */
		/* The prefix length associated with the destination IP network
		   address
		   for a single route in the topology table in the AS*/
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPACTIVE: /* 5 */
		/* A value of true(1) indicates the route to the destination
		   network has failed
		   A value of false(2) indicates the route is stable
		   (passive).*/
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPSTUCKINACTIVE: /* 6 */
		/* A value of true(1) indicates that that this route which is in
		   active state
		   has not received any replies to queries for alternate paths
		   */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPDESTSUCCESSORS: /* 7 */
		/* Next routing hop for a path to the destination IP network */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPFDISTANCE: /* 8 */
		/* Minimum distance from this router to the destination IP
		 * network */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPROUTEORIGINTYPE: /* 9 */
		/* Text string describing the internal origin of the EIGRP route
		 */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPROUTEORIGINADDRTYPE: /* 10 */
		/* The format of the IP address defined as the origin of this
		   topology route entry */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPROUTEORIGINADDR: /* 11 */
		/* If the origin of the topology route entry is external to this
		   router,
		   then this object is the IP address of the router from which
		   it originated */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPNEXTHOPADDRESSTYPE: /* 12 */
		/* The format of the next hop IP address */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPNEXTHOPADDRESS: /* 13 */
		/* Next hop IP address for the route */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPNEXTHOPINTERFACE: /* 14 */
		/* The interface through which the next hop IP address is
		 * reached */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPDISTANCE: /* 15 */
		/* The computed distance to the destination network entry from
		 * this router */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPREPORTDISTANCE: /* 16 */
		/* The computed distance to the destination network in the
		   topology entry
		   reported to this router by the originator of this route */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	default:
		return NULL;
	}
	return NULL;
}

static uint8_t *eigrpPeerEntry(struct variable *v, oid *name, size_t *length,
			       int exact, size_t *var_len,
			       WriteMethod **write_method)
{
	struct eigrp *eigrp;
	struct eigrp_interface *ei;
	struct eigrp_neighbor *nbr;
	struct in_addr nbr_addr;
	unsigned int ifindex;

	eigrp = eigrp_lookup();

	/* Check whether the instance identifier is valid */
	if (smux_header_generic(v, name, length, exact, var_len, write_method)
	    == MATCH_FAILED)
		return NULL;

	memset(&nbr_addr, 0, sizeof(nbr_addr));
	ifindex = 0;

	nbr = eigrpNbrLookup(v, name, length, &nbr_addr, &ifindex, exact);
	if (!nbr)
		return NULL;
	ei = nbr->ei;
	if (!ei)
		return NULL;

	/* Return the current value of the variable */
	switch (v->magic) {
	case EIGRPHANDLE: /* 1 */
		/* The unique internal identifier for the peer in the AS */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPPEERADDRTYPE: /* 2 */
		/* The format of the remote source IP address used by the peer
		 */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPPEERADDR: /* 3 */
		/* The source IP address used by the peer */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPPEERIFINDEX: /* 4 */
		/* The ifIndex of the interface on this router */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPHOLDTIME: /* 5 */
		/* How much time must pass without receiving a hello packet from
		   this
		   EIGRP peer before this router declares the peer down */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPUPTIME: /* 6 */
		/* The elapsed time since the EIGRP adjacency was first
		 * established */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPSRTT: /* 7 */
		/* The computed smooth round trip time for packets to and from
		 * the peer */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPRTO: /* 8 */
		/* The computed retransmission timeout for the peer */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPPKTSENQUEUED: /* 9 */
		/* The number of any EIGRP packets currently enqueued */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPLASTSEQ: /* 10 */
		/* sequence number of the last EIGRP packet sent to this peer */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPVERSION: /* 11 */
		/* The EIGRP version information reported by the remote peer */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPRETRANS: /* 12 */
		/* The cumulative number of retransmissions to this peer */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPRETRIES: /* 13 */
		/* The number of times the current unacknowledged packet has
		 * been retried */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	default:
		return NULL;
	}
	return NULL;
}

static uint8_t *eigrpInterfaceEntry(struct variable *v, oid *name,
				    size_t *length, int exact, size_t *var_len,
				    WriteMethod **write_method)
{
	struct eigrp *eigrp;
	struct listnode *node, *nnode;
	struct keychain *keychain;
	struct list *keylist;

	eigrp = eigrp_lookup();

	/* Check whether the instance identifier is valid */
	if (smux_header_generic(v, name, length, exact, var_len, write_method)
	    == MATCH_FAILED)
		return NULL;

	/* Return the current value of the variable */
	switch (v->magic) {
	case EIGRPPEERCOUNT: /* 3 */
		/* The number of EIGRP adjacencies currently formed with
		   peers reached through this interface */
		if (eigrp) {
			return SNMP_INTEGER(eigrp_neighbor_count(eigrp));
		} else
			return SNMP_INTEGER(0);
	case EIGRPXMITRELIABLEQ: /* 4 */
		/* The number of EIGRP packets currently waiting in the reliable
		   transport transmission queue */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPXMITUNRELIABLEQ: /* 5 */
		/* The number of EIGRP packets currently waiting in the
		   unreliable
		   transport transmission queue */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPMEANSRTT: /* 6 */
		/* The average of all the computed smooth round trip time values
		   for a packet to and from all peers established on this
		   interface */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPPACINGRELIABLE: /* 7 */
		/* The configured time interval between EIGRP packet
		 * transmissions */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPPACINGUNRELIABLE: /* 8 */
		/* The configured time interval between EIGRP packet
		   transmissions
		   on the interface when the unreliable transport method is used
		   */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPMFLOWTIMER: /* 9 */
		/* The configured multicast flow control timer value */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPPENDINGROUTES: /* 10 */
		/* The number of queued EIGRP routing updates awaiting
		 * transmission */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPHELLOINTERVAL: /* 11 */
		/* The configured time interval between Hello packet
		 * transmissions */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPXMITNEXTSERIAL: /* 12 */
		/* The serial number of the next EIGRP packet that is to be
		   queued
		   for transmission */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPUMCASTS: /* 13 */
		/* The total number of unreliable EIGRP multicast packets sent
		   on this interface */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPRMCASTS: /* 14 */
		/* The total number of reliable EIGRP multicast packets sent
		   on this interface */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPUUCASTS: /* 15 */
		/* The total number of unreliable EIGRP unicast packets sent
		   on this interface */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPRUCASTS: /* 16 */
		/* The total number of reliable EIGRP unicast packets sent
		   on this interface */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPMCASTEXCEPTS: /* 17 */
		/* The total number of EIGRP multicast exception transmissions
		 */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPCRPKTS: /* 18 */
		/* The total number EIGRP Conditional-Receive packets sent on
		 * this interface */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPACKSSUPPRESSED: /* 19 */
		/* The total number of individual EIGRP acknowledgement packets
		   that have been
		   suppressed and combined in an already enqueued outbound
		   reliable packet on this interface */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPRETRANSSENT: /* 20 */
		/* The total number EIGRP packet retransmissions sent on the
		 * interface */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPOOSRCVD: /* 21 */
		/* The total number of out-of-sequence EIGRP packets received */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPAUTHMODE: /* 22 */
		/* The EIGRP authentication mode of the interface */
		if (eigrp) {
			return SNMP_INTEGER(1);
		} else
			return SNMP_INTEGER(0);
	case EIGRPAUTHKEYCHAIN: /* 23 */
		/* The name of the authentication key-chain configured
		   on this interface. */
		keylist = keychain_list_get();
		for (ALL_LIST_ELEMENTS(keylist, node, nnode, keychain)) {
			return (uint8_t *)keychain->name;
		}
		if (eigrp && keychain) {
			*var_len = str_len(keychain->name);
			return (uint8_t *)keychain->name;
		} else
			return (uint8_t *)"TEST";
		break;
	default:
		return NULL;
	}
	return NULL;
}

/* Register EIGRP-MIB. */
void eigrp_snmp_init()
{
	eigrp_snmp_iflist = list_new();
	smux_init(eigrp_om->master);
	REGISTER_MIB("ciscoEigrpMIB", eigrp_variables, variable, eigrp_oid);
}
#endif