2 * Copyright (C) 2000 IP Infusion Inc.
4 * Written by Kunihiro Ishiguro <kunihiro@zebra.org>
6 * This file is part of GNU Zebra.
8 * GNU Zebra is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
13 * GNU Zebra is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with GNU Zebra; see the file COPYING. If not, write to the Free
20 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 #include <net-snmp/net-snmp-config.h>
32 #include <snmp_impl.h>
42 #include "ospfd/ospfd.h"
43 #include "ospfd/ospf_interface.h"
44 #include "ospfd/ospf_asbr.h"
45 #include "ospfd/ospf_lsa.h"
46 #include "ospfd/ospf_lsdb.h"
47 #include "ospfd/ospf_abr.h"
48 #include "ospfd/ospf_neighbor.h"
49 #include "ospfd/ospf_nsm.h"
50 #include "ospfd/ospf_flood.h"
53 #define OSPF2MIB 1,3,6,1,2,1,14
55 /* Zebra enterprise OSPF MIB. This variable is used for register
56 OSPF MIB to SNMP agent under SMUX protocol. */
57 #define OSPFDOID 1,3,6,1,4,1,3317,1,2,5
59 /* OSPF MIB General Group values. */
60 #define OSPFROUTERID 1
61 #define OSPFADMINSTAT 2
62 #define OSPFVERSIONNUMBER 3
63 #define OSPFAREABDRRTRSTATUS 4
64 #define OSPFASBDRRTRSTATUS 5
65 #define OSPFEXTERNLSACOUNT 6
66 #define OSPFEXTERNLSACKSUMSUM 7
67 #define OSPFTOSSUPPORT 8
68 #define OSPFORIGINATENEWLSAS 9
69 #define OSPFRXNEWLSAS 10
70 #define OSPFEXTLSDBLIMIT 11
71 #define OSPFMULTICASTEXTENSIONS 12
72 #define OSPFEXITOVERFLOWINTERVAL 13
73 #define OSPFDEMANDEXTENSIONS 14
75 /* OSPF MIB ospfAreaTable. */
77 #define OSPFAUTHTYPE 2
78 #define OSPFIMPORTASEXTERN 3
80 #define OSPFAREABDRRTRCOUNT 5
81 #define OSPFASBDRRTRCOUNT 6
82 #define OSPFAREALSACOUNT 7
83 #define OSPFAREALSACKSUMSUM 8
84 #define OSPFAREASUMMARY 9
85 #define OSPFAREASTATUS 10
87 /* OSPF MIB ospfStubAreaTable. */
88 #define OSPFSTUBAREAID 1
90 #define OSPFSTUBMETRIC 3
91 #define OSPFSTUBSTATUS 4
92 #define OSPFSTUBMETRICTYPE 5
94 /* OSPF MIB ospfLsdbTable. */
95 #define OSPFLSDBAREAID 1
96 #define OSPFLSDBTYPE 2
97 #define OSPFLSDBLSID 3
98 #define OSPFLSDBROUTERID 4
99 #define OSPFLSDBSEQUENCE 5
100 #define OSPFLSDBAGE 6
101 #define OSPFLSDBCHECKSUM 7
102 #define OSPFLSDBADVERTISEMENT 8
104 /* OSPF MIB ospfAreaRangeTable. */
105 #define OSPFAREARANGEAREAID 1
106 #define OSPFAREARANGENET 2
107 #define OSPFAREARANGEMASK 3
108 #define OSPFAREARANGESTATUS 4
109 #define OSPFAREARANGEEFFECT 5
111 /* OSPF MIB ospfHostTable. */
112 #define OSPFHOSTIPADDRESS 1
113 #define OSPFHOSTTOS 2
114 #define OSPFHOSTMETRIC 3
115 #define OSPFHOSTSTATUS 4
116 #define OSPFHOSTAREAID 5
118 /* OSPF MIB ospfIfTable. */
119 #define OSPFIFIPADDRESS 1
120 #define OSPFADDRESSLESSIF 2
121 #define OSPFIFAREAID 3
123 #define OSPFIFADMINSTAT 5
124 #define OSPFIFRTRPRIORITY 6
125 #define OSPFIFTRANSITDELAY 7
126 #define OSPFIFRETRANSINTERVAL 8
127 #define OSPFIFHELLOINTERVAL 9
128 #define OSPFIFRTRDEADINTERVAL 10
129 #define OSPFIFPOLLINTERVAL 11
130 #define OSPFIFSTATE 12
131 #define OSPFIFDESIGNATEDROUTER 13
132 #define OSPFIFBACKUPDESIGNATEDROUTER 14
133 #define OSPFIFEVENTS 15
134 #define OSPFIFAUTHKEY 16
135 #define OSPFIFSTATUS 17
136 #define OSPFIFMULTICASTFORWARDING 18
137 #define OSPFIFDEMAND 19
138 #define OSPFIFAUTHTYPE 20
140 /* OSPF MIB ospfIfMetricTable. */
141 #define OSPFIFMETRICIPADDRESS 1
142 #define OSPFIFMETRICADDRESSLESSIF 2
143 #define OSPFIFMETRICTOS 3
144 #define OSPFIFMETRICVALUE 4
145 #define OSPFIFMETRICSTATUS 5
147 /* OSPF MIB ospfVirtIfTable. */
148 #define OSPFVIRTIFAREAID 1
149 #define OSPFVIRTIFNEIGHBOR 2
150 #define OSPFVIRTIFTRANSITDELAY 3
151 #define OSPFVIRTIFRETRANSINTERVAL 4
152 #define OSPFVIRTIFHELLOINTERVAL 5
153 #define OSPFVIRTIFRTRDEADINTERVAL 6
154 #define OSPFVIRTIFSTATE 7
155 #define OSPFVIRTIFEVENTS 8
156 #define OSPFVIRTIFAUTHKEY 9
157 #define OSPFVIRTIFSTATUS 10
158 #define OSPFVIRTIFAUTHTYPE 11
160 /* OSPF MIB ospfNbrTable. */
161 #define OSPFNBRIPADDR 1
162 #define OSPFNBRADDRESSLESSINDEX 2
163 #define OSPFNBRRTRID 3
164 #define OSPFNBROPTIONS 4
165 #define OSPFNBRPRIORITY 5
166 #define OSPFNBRSTATE 6
167 #define OSPFNBREVENTS 7
168 #define OSPFNBRLSRETRANSQLEN 8
169 #define OSPFNBMANBRSTATUS 9
170 #define OSPFNBMANBRPERMANENCE 10
171 #define OSPFNBRHELLOSUPPRESSED 11
173 /* OSPF MIB ospfVirtNbrTable. */
174 #define OSPFVIRTNBRAREA 1
175 #define OSPFVIRTNBRRTRID 2
176 #define OSPFVIRTNBRIPADDR 3
177 #define OSPFVIRTNBROPTIONS 4
178 #define OSPFVIRTNBRSTATE 5
179 #define OSPFVIRTNBREVENTS 6
180 #define OSPFVIRTNBRLSRETRANSQLEN 7
181 #define OSPFVIRTNBRHELLOSUPPRESSED 8
183 /* OSPF MIB ospfExtLsdbTable. */
184 #define OSPFEXTLSDBTYPE 1
185 #define OSPFEXTLSDBLSID 2
186 #define OSPFEXTLSDBROUTERID 3
187 #define OSPFEXTLSDBSEQUENCE 4
188 #define OSPFEXTLSDBAGE 5
189 #define OSPFEXTLSDBCHECKSUM 6
190 #define OSPFEXTLSDBADVERTISEMENT 7
192 /* OSPF MIB ospfAreaAggregateTable. */
193 #define OSPFAREAAGGREGATEAREAID 1
194 #define OSPFAREAAGGREGATELSDBTYPE 2
195 #define OSPFAREAAGGREGATENET 3
196 #define OSPFAREAAGGREGATEMASK 4
197 #define OSPFAREAAGGREGATESTATUS 5
198 #define OSPFAREAAGGREGATEEFFECT 6
200 /* SYNTAX Status from OSPF-MIB. */
201 #define OSPF_STATUS_ENABLED 1
202 #define OSPF_STATUS_DISABLED 2
204 /* SNMP value hack. */
205 #define COUNTER ASN_COUNTER
206 #define INTEGER ASN_INTEGER
207 #define GAUGE ASN_GAUGE
208 #define TIMETICKS ASN_TIMETICKS
209 #define IPADDRESS ASN_IPADDRESS
210 #define STRING ASN_OCTET_STR
212 /* Declare static local variables for convenience. */
215 /* OSPF-MIB instances. */
216 oid ospf_oid
[] = { OSPF2MIB
};
217 oid ospfd_oid
[] = { OSPFDOID
};
219 /* IP address 0.0.0.0. */
220 static struct in_addr ospf_empty_addr
= {0};
222 /* Hook functions. */
223 static u_char
*ospfGeneralGroup ();
224 static u_char
*ospfAreaEntry ();
225 static u_char
*ospfStubAreaEntry ();
226 static u_char
*ospfLsdbEntry ();
227 static u_char
*ospfAreaRangeEntry ();
228 static u_char
*ospfHostEntry ();
229 static u_char
*ospfIfEntry ();
230 static u_char
*ospfIfMetricEntry ();
231 static u_char
*ospfVirtIfEntry ();
232 static u_char
*ospfNbrEntry ();
233 static u_char
*ospfVirtNbrEntry ();
234 static u_char
*ospfExtLsdbEntry ();
235 static u_char
*ospfAreaAggregateEntry ();
237 struct variable ospf_variables
[] =
239 /* OSPF general variables */
240 {OSPFROUTERID
, IPADDRESS
, RWRITE
, ospfGeneralGroup
,
242 {OSPFADMINSTAT
, INTEGER
, RWRITE
, ospfGeneralGroup
,
244 {OSPFVERSIONNUMBER
, INTEGER
, RONLY
, ospfGeneralGroup
,
246 {OSPFAREABDRRTRSTATUS
, INTEGER
, RONLY
, ospfGeneralGroup
,
248 {OSPFASBDRRTRSTATUS
, INTEGER
, RWRITE
, ospfGeneralGroup
,
250 {OSPFEXTERNLSACOUNT
, GAUGE
, RONLY
, ospfGeneralGroup
,
252 {OSPFEXTERNLSACKSUMSUM
, INTEGER
, RONLY
, ospfGeneralGroup
,
254 {OSPFTOSSUPPORT
, INTEGER
, RWRITE
, ospfGeneralGroup
,
256 {OSPFORIGINATENEWLSAS
, COUNTER
, RONLY
, ospfGeneralGroup
,
258 {OSPFRXNEWLSAS
, COUNTER
, RONLY
, ospfGeneralGroup
,
260 {OSPFEXTLSDBLIMIT
, INTEGER
, RWRITE
, ospfGeneralGroup
,
262 {OSPFMULTICASTEXTENSIONS
, INTEGER
, RWRITE
, ospfGeneralGroup
,
264 {OSPFEXITOVERFLOWINTERVAL
, INTEGER
, RWRITE
, ospfGeneralGroup
,
266 {OSPFDEMANDEXTENSIONS
, INTEGER
, RWRITE
, ospfGeneralGroup
,
269 /* OSPF area data structure. */
270 {OSPFAREAID
, IPADDRESS
, RONLY
, ospfAreaEntry
,
272 {OSPFAUTHTYPE
, INTEGER
, RWRITE
, ospfAreaEntry
,
274 {OSPFIMPORTASEXTERN
, INTEGER
, RWRITE
, ospfAreaEntry
,
276 {OSPFSPFRUNS
, COUNTER
, RONLY
, ospfAreaEntry
,
278 {OSPFAREABDRRTRCOUNT
, GAUGE
, RONLY
, ospfAreaEntry
,
280 {OSPFASBDRRTRCOUNT
, GAUGE
, RONLY
, ospfAreaEntry
,
282 {OSPFAREALSACOUNT
, GAUGE
, RONLY
, ospfAreaEntry
,
284 {OSPFAREALSACKSUMSUM
, INTEGER
, RONLY
, ospfAreaEntry
,
286 {OSPFAREASUMMARY
, INTEGER
, RWRITE
, ospfAreaEntry
,
288 {OSPFAREASTATUS
, INTEGER
, RWRITE
, ospfAreaEntry
,
291 /* OSPF stub area information. */
292 {OSPFSTUBAREAID
, IPADDRESS
, RONLY
, ospfStubAreaEntry
,
294 {OSPFSTUBTOS
, INTEGER
, RONLY
, ospfStubAreaEntry
,
296 {OSPFSTUBMETRIC
, INTEGER
, RWRITE
, ospfStubAreaEntry
,
298 {OSPFSTUBSTATUS
, INTEGER
, RWRITE
, ospfStubAreaEntry
,
300 {OSPFSTUBMETRICTYPE
, INTEGER
, RWRITE
, ospfStubAreaEntry
,
303 /* OSPF link state database. */
304 {OSPFLSDBAREAID
, IPADDRESS
, RONLY
, ospfLsdbEntry
,
306 {OSPFLSDBTYPE
, INTEGER
, RONLY
, ospfLsdbEntry
,
308 {OSPFLSDBLSID
, IPADDRESS
, RONLY
, ospfLsdbEntry
,
310 {OSPFLSDBROUTERID
, IPADDRESS
, RONLY
, ospfLsdbEntry
,
312 {OSPFLSDBSEQUENCE
, INTEGER
, RONLY
, ospfLsdbEntry
,
314 {OSPFLSDBAGE
, INTEGER
, RONLY
, ospfLsdbEntry
,
316 {OSPFLSDBCHECKSUM
, INTEGER
, RONLY
, ospfLsdbEntry
,
318 {OSPFLSDBADVERTISEMENT
, STRING
, RONLY
, ospfLsdbEntry
,
321 /* Area range table. */
322 {OSPFAREARANGEAREAID
, IPADDRESS
, RONLY
, ospfAreaRangeEntry
,
324 {OSPFAREARANGENET
, IPADDRESS
, RONLY
, ospfAreaRangeEntry
,
326 {OSPFAREARANGEMASK
, IPADDRESS
, RWRITE
, ospfAreaRangeEntry
,
328 {OSPFAREARANGESTATUS
, INTEGER
, RWRITE
, ospfAreaRangeEntry
,
330 {OSPFAREARANGEEFFECT
, INTEGER
, RWRITE
, ospfAreaRangeEntry
,
333 /* OSPF host table. */
334 {OSPFHOSTIPADDRESS
, IPADDRESS
, RONLY
, ospfHostEntry
,
336 {OSPFHOSTTOS
, INTEGER
, RONLY
, ospfHostEntry
,
338 {OSPFHOSTMETRIC
, INTEGER
, RWRITE
, ospfHostEntry
,
340 {OSPFHOSTSTATUS
, INTEGER
, RWRITE
, ospfHostEntry
,
342 {OSPFHOSTAREAID
, IPADDRESS
, RONLY
, ospfHostEntry
,
345 /* OSPF interface table. */
346 {OSPFIFIPADDRESS
, IPADDRESS
, RONLY
, ospfIfEntry
,
348 {OSPFADDRESSLESSIF
, INTEGER
, RONLY
, ospfIfEntry
,
350 {OSPFIFAREAID
, IPADDRESS
, RWRITE
, ospfIfEntry
,
352 {OSPFIFTYPE
, INTEGER
, RWRITE
, ospfIfEntry
,
354 {OSPFIFADMINSTAT
, INTEGER
, RWRITE
, ospfIfEntry
,
356 {OSPFIFRTRPRIORITY
, INTEGER
, RWRITE
, ospfIfEntry
,
358 {OSPFIFTRANSITDELAY
, INTEGER
, RWRITE
, ospfIfEntry
,
360 {OSPFIFRETRANSINTERVAL
, INTEGER
, RWRITE
, ospfIfEntry
,
362 {OSPFIFHELLOINTERVAL
, INTEGER
, RWRITE
, ospfIfEntry
,
364 {OSPFIFRTRDEADINTERVAL
, INTEGER
, RWRITE
, ospfIfEntry
,
366 {OSPFIFPOLLINTERVAL
, INTEGER
, RWRITE
, ospfIfEntry
,
368 {OSPFIFSTATE
, INTEGER
, RONLY
, ospfIfEntry
,
370 {OSPFIFDESIGNATEDROUTER
, IPADDRESS
, RONLY
, ospfIfEntry
,
372 {OSPFIFBACKUPDESIGNATEDROUTER
, IPADDRESS
, RONLY
, ospfIfEntry
,
374 {OSPFIFEVENTS
, COUNTER
, RONLY
, ospfIfEntry
,
376 {OSPFIFAUTHKEY
, STRING
, RWRITE
, ospfIfEntry
,
378 {OSPFIFSTATUS
, INTEGER
, RWRITE
, ospfIfEntry
,
380 {OSPFIFMULTICASTFORWARDING
, INTEGER
, RWRITE
, ospfIfEntry
,
382 {OSPFIFDEMAND
, INTEGER
, RWRITE
, ospfIfEntry
,
384 {OSPFIFAUTHTYPE
, INTEGER
, RWRITE
, ospfIfEntry
,
387 /* OSPF interface metric table. */
388 {OSPFIFMETRICIPADDRESS
, IPADDRESS
, RONLY
, ospfIfMetricEntry
,
390 {OSPFIFMETRICADDRESSLESSIF
, INTEGER
, RONLY
, ospfIfMetricEntry
,
392 {OSPFIFMETRICTOS
, INTEGER
, RONLY
, ospfIfMetricEntry
,
394 {OSPFIFMETRICVALUE
, INTEGER
, RWRITE
, ospfIfMetricEntry
,
396 {OSPFIFMETRICSTATUS
, INTEGER
, RWRITE
, ospfIfMetricEntry
,
399 /* OSPF virtual interface table. */
400 {OSPFVIRTIFAREAID
, IPADDRESS
, RONLY
, ospfVirtIfEntry
,
402 {OSPFVIRTIFNEIGHBOR
, IPADDRESS
, RONLY
, ospfVirtIfEntry
,
404 {OSPFVIRTIFTRANSITDELAY
, INTEGER
, RWRITE
, ospfVirtIfEntry
,
406 {OSPFVIRTIFRETRANSINTERVAL
, INTEGER
, RWRITE
, ospfVirtIfEntry
,
408 {OSPFVIRTIFHELLOINTERVAL
, INTEGER
, RWRITE
, ospfVirtIfEntry
,
410 {OSPFVIRTIFRTRDEADINTERVAL
, INTEGER
, RWRITE
, ospfVirtIfEntry
,
412 {OSPFVIRTIFSTATE
, INTEGER
, RONLY
, ospfVirtIfEntry
,
414 {OSPFVIRTIFEVENTS
, COUNTER
, RONLY
, ospfVirtIfEntry
,
416 {OSPFVIRTIFAUTHKEY
, STRING
, RWRITE
, ospfVirtIfEntry
,
418 {OSPFVIRTIFSTATUS
, INTEGER
, RWRITE
, ospfVirtIfEntry
,
420 {OSPFVIRTIFAUTHTYPE
, INTEGER
, RWRITE
, ospfVirtIfEntry
,
423 /* OSPF neighbor table. */
424 {OSPFNBRIPADDR
, IPADDRESS
, RONLY
, ospfNbrEntry
,
426 {OSPFNBRADDRESSLESSINDEX
, INTEGER
, RONLY
, ospfNbrEntry
,
428 {OSPFNBRRTRID
, IPADDRESS
, RONLY
, ospfNbrEntry
,
430 {OSPFNBROPTIONS
, INTEGER
, RONLY
, ospfNbrEntry
,
432 {OSPFNBRPRIORITY
, INTEGER
, RWRITE
, ospfNbrEntry
,
434 {OSPFNBRSTATE
, INTEGER
, RONLY
, ospfNbrEntry
,
436 {OSPFNBREVENTS
, COUNTER
, RONLY
, ospfNbrEntry
,
438 {OSPFNBRLSRETRANSQLEN
, GAUGE
, RONLY
, ospfNbrEntry
,
440 {OSPFNBMANBRSTATUS
, INTEGER
, RWRITE
, ospfNbrEntry
,
442 {OSPFNBMANBRPERMANENCE
, INTEGER
, RONLY
, ospfNbrEntry
,
444 {OSPFNBRHELLOSUPPRESSED
, INTEGER
, RONLY
, ospfNbrEntry
,
447 /* OSPF virtual neighbor table. */
448 {OSPFVIRTNBRAREA
, IPADDRESS
, RONLY
, ospfVirtNbrEntry
,
450 {OSPFVIRTNBRRTRID
, IPADDRESS
, RONLY
, ospfVirtNbrEntry
,
452 {OSPFVIRTNBRIPADDR
, IPADDRESS
, RONLY
, ospfVirtNbrEntry
,
454 {OSPFVIRTNBROPTIONS
, INTEGER
, RONLY
, ospfVirtNbrEntry
,
456 {OSPFVIRTNBRSTATE
, INTEGER
, RONLY
, ospfVirtNbrEntry
,
458 {OSPFVIRTNBREVENTS
, COUNTER
, RONLY
, ospfVirtNbrEntry
,
460 {OSPFVIRTNBRLSRETRANSQLEN
, INTEGER
, RONLY
, ospfVirtNbrEntry
,
462 {OSPFVIRTNBRHELLOSUPPRESSED
, INTEGER
, RONLY
, ospfVirtNbrEntry
,
465 /* OSPF link state database, external. */
466 {OSPFEXTLSDBTYPE
, INTEGER
, RONLY
, ospfExtLsdbEntry
,
468 {OSPFEXTLSDBLSID
, IPADDRESS
, RONLY
, ospfExtLsdbEntry
,
470 {OSPFEXTLSDBROUTERID
, IPADDRESS
, RONLY
, ospfExtLsdbEntry
,
472 {OSPFEXTLSDBSEQUENCE
, INTEGER
, RONLY
, ospfExtLsdbEntry
,
474 {OSPFEXTLSDBAGE
, INTEGER
, RONLY
, ospfExtLsdbEntry
,
476 {OSPFEXTLSDBCHECKSUM
, INTEGER
, RONLY
, ospfExtLsdbEntry
,
478 {OSPFEXTLSDBADVERTISEMENT
, STRING
, RONLY
, ospfExtLsdbEntry
,
481 /* OSPF area aggregate table. */
482 {OSPFAREAAGGREGATEAREAID
, IPADDRESS
, RONLY
, ospfAreaAggregateEntry
,
484 {OSPFAREAAGGREGATELSDBTYPE
, INTEGER
, RONLY
, ospfAreaAggregateEntry
,
486 {OSPFAREAAGGREGATENET
, IPADDRESS
, RONLY
, ospfAreaAggregateEntry
,
488 {OSPFAREAAGGREGATEMASK
, IPADDRESS
, RONLY
, ospfAreaAggregateEntry
,
490 {OSPFAREAAGGREGATESTATUS
, INTEGER
, RWRITE
, ospfAreaAggregateEntry
,
492 {OSPFAREAAGGREGATEEFFECT
, INTEGER
, RWRITE
, ospfAreaAggregateEntry
,
496 /* The administrative status of OSPF. When OSPF is enbled on at least
497 one interface return 1. */
499 ospf_admin_stat (struct ospf
*ospf
)
502 struct ospf_interface
*oi
;
507 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
511 if (oi
&& oi
->address
)
518 ospfGeneralGroup (struct variable
*v
, oid
*name
, size_t *length
,
519 int exact
, size_t *var_len
, WriteMethod
**write_method
)
521 struct ospf
*ospf
= ospf_top
;
523 /* Check whether the instance identifier is valid */
524 if (smux_header_generic (v
, name
, length
, exact
, var_len
, write_method
)
528 /* Return the current value of the variable */
531 case OSPFROUTERID
: /* 1 */
532 /* Router-ID of this OSPF instance. */
534 return SNMP_IPADDRESS (ospf
->router_id
);
536 return SNMP_IPADDRESS (ospf_empty_addr
);
538 case OSPFADMINSTAT
: /* 2 */
539 /* The administrative status of OSPF in the router. */
540 if (ospf_admin_stat (ospf
))
541 return SNMP_INTEGER (OSPF_STATUS_ENABLED
);
543 return SNMP_INTEGER (OSPF_STATUS_DISABLED
);
545 case OSPFVERSIONNUMBER
: /* 3 */
546 /* OSPF version 2. */
547 return SNMP_INTEGER (OSPF_VERSION
);
549 case OSPFAREABDRRTRSTATUS
: /* 4 */
550 /* Area Border router status. */
551 if (ospf
&& CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ABR
))
552 return SNMP_INTEGER (SNMP_TRUE
);
554 return SNMP_INTEGER (SNMP_FALSE
);
556 case OSPFASBDRRTRSTATUS
: /* 5 */
557 /* AS Border router status. */
558 if (ospf
&& CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ASBR
))
559 return SNMP_INTEGER (SNMP_TRUE
);
561 return SNMP_INTEGER (SNMP_FALSE
);
563 case OSPFEXTERNLSACOUNT
: /* 6 */
564 /* External LSA counts. */
566 return SNMP_INTEGER (ospf_lsdb_count_all (ospf
->lsdb
));
568 return SNMP_INTEGER (0);
570 case OSPFEXTERNLSACKSUMSUM
: /* 7 */
571 /* External LSA checksum. */
572 return SNMP_INTEGER (0);
574 case OSPFTOSSUPPORT
: /* 8 */
575 /* TOS is not supported. */
576 return SNMP_INTEGER (SNMP_FALSE
);
578 case OSPFORIGINATENEWLSAS
: /* 9 */
579 /* The number of new link-state advertisements. */
581 return SNMP_INTEGER (ospf
->lsa_originate_count
);
583 return SNMP_INTEGER (0);
585 case OSPFRXNEWLSAS
: /* 10 */
586 /* The number of link-state advertisements received determined
587 to be new instantiations. */
589 return SNMP_INTEGER (ospf
->rx_lsa_count
);
591 return SNMP_INTEGER (0);
593 case OSPFEXTLSDBLIMIT
: /* 11 */
594 /* There is no limit for the number of non-default
596 return SNMP_INTEGER (-1);
598 case OSPFMULTICASTEXTENSIONS
: /* 12 */
599 /* Multicast Extensions to OSPF is not supported. */
600 return SNMP_INTEGER (0);
602 case OSPFEXITOVERFLOWINTERVAL
: /* 13 */
603 /* Overflow is not supported. */
604 return SNMP_INTEGER (0);
606 case OSPFDEMANDEXTENSIONS
: /* 14 */
607 /* Demand routing is not supported. */
608 return SNMP_INTEGER (SNMP_FALSE
);
617 ospf_area_lookup_next (struct ospf
*ospf
, struct in_addr
*area_id
, int first
)
619 struct ospf_area
*area
;
627 node
= listhead (ospf
->areas
);
630 area
= getdata (node
);
631 *area_id
= area
->area_id
;
636 for (node
= listhead (ospf
->areas
); node
; nextnode (node
))
638 area
= getdata (node
);
640 if (ntohl (area
->area_id
.s_addr
) > ntohl (area_id
->s_addr
))
642 *area_id
= area
->area_id
;
650 ospfAreaLookup (struct variable
*v
, oid name
[], size_t *length
,
651 struct in_addr
*addr
, int exact
)
653 struct ospf
*ospf
= ospf_top
;
654 struct ospf_area
*area
;
662 /* Length is insufficient to lookup OSPF area. */
663 if (*length
- v
->namelen
!= sizeof (struct in_addr
))
666 oid2in_addr (name
+ v
->namelen
, sizeof (struct in_addr
), addr
);
668 area
= ospf_area_lookup_by_area_id (ospf
, *addr
);
674 len
= *length
- v
->namelen
;
678 oid2in_addr (name
+ v
->namelen
, len
, addr
);
680 area
= ospf_area_lookup_next (ospf
, addr
, len
== 0 ? 1 : 0);
685 oid_copy_addr (name
+ v
->namelen
, addr
, sizeof (struct in_addr
));
686 *length
= sizeof (struct in_addr
) + v
->namelen
;
694 ospfAreaEntry (struct variable
*v
, oid
*name
, size_t *length
, int exact
,
695 size_t *var_len
, WriteMethod
**write_method
)
697 struct ospf_area
*area
;
700 memset (&addr
, 0, sizeof (struct in_addr
));
702 area
= ospfAreaLookup (v
, name
, length
, &addr
, exact
);
706 /* Return the current value of the variable */
709 case OSPFAREAID
: /* 1 */
710 return SNMP_IPADDRESS (area
->area_id
);
712 case OSPFAUTHTYPE
: /* 2 */
713 return SNMP_INTEGER (area
->auth_type
);
715 case OSPFIMPORTASEXTERN
: /* 3 */
716 return SNMP_INTEGER (area
->external_routing
+ 1);
718 case OSPFSPFRUNS
: /* 4 */
719 return SNMP_INTEGER (area
->spf_calculation
);
721 case OSPFAREABDRRTRCOUNT
: /* 5 */
722 return SNMP_INTEGER (area
->abr_count
);
724 case OSPFASBDRRTRCOUNT
: /* 6 */
725 return SNMP_INTEGER (area
->asbr_count
);
727 case OSPFAREALSACOUNT
: /* 7 */
728 return SNMP_INTEGER (area
->lsdb
->total
);
730 case OSPFAREALSACKSUMSUM
: /* 8 */
731 return SNMP_INTEGER (0);
733 case OSPFAREASUMMARY
: /* 9 */
734 #define OSPF_noAreaSummary 1
735 #define OSPF_sendAreaSummary 2
736 if (area
->no_summary
)
737 return SNMP_INTEGER (OSPF_noAreaSummary
);
739 return SNMP_INTEGER (OSPF_sendAreaSummary
);
741 case OSPFAREASTATUS
: /* 10 */
742 return SNMP_INTEGER (SNMP_VALID
);
752 ospf_stub_area_lookup_next (struct in_addr
*area_id
, int first
)
754 struct ospf_area
*area
;
760 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
762 area
= getdata (node
);
764 if (area
->external_routing
== OSPF_AREA_STUB
)
768 *area_id
= area
->area_id
;
771 else if (ntohl (area
->area_id
.s_addr
) > ntohl (area_id
->s_addr
))
773 *area_id
= area
->area_id
;
782 ospfStubAreaLookup (struct variable
*v
, oid name
[], size_t *length
,
783 struct in_addr
*addr
, int exact
)
785 struct ospf
*ospf
= ospf_top
;
786 struct ospf_area
*area
;
795 /* ospfStubAreaID + ospfStubTOS. */
796 if (*length
!= v
->namelen
+ sizeof (struct in_addr
) + 1)
799 /* Check ospfStubTOS is zero. */
800 if (name
[*length
- 1] != 0)
803 oid2in_addr (name
+ v
->namelen
, sizeof (struct in_addr
), addr
);
805 area
= ospf_area_lookup_by_area_id (ospf
, *addr
);
807 if (area
->external_routing
== OSPF_AREA_STUB
)
814 len
= *length
- v
->namelen
;
818 oid2in_addr (name
+ v
->namelen
, len
, addr
);
820 area
= ospf_stub_area_lookup_next (addr
, len
== 0 ? 1 : 0);
825 oid_copy_addr (name
+ v
->namelen
, addr
, sizeof (struct in_addr
));
827 name
[v
->namelen
+ sizeof (struct in_addr
)] = 0;
828 *length
= v
->namelen
+ sizeof (struct in_addr
) + 1;
836 ospfStubAreaEntry (struct variable
*v
, oid
*name
, size_t *length
,
837 int exact
, size_t *var_len
, WriteMethod
**write_method
)
839 struct ospf_area
*area
;
842 memset (&addr
, 0, sizeof (struct in_addr
));
844 area
= ospfStubAreaLookup (v
, name
, length
, &addr
, exact
);
848 /* Return the current value of the variable */
851 case OSPFSTUBAREAID
: /* 1 */
852 /* OSPF stub area id. */
853 return SNMP_IPADDRESS (area
->area_id
);
855 case OSPFSTUBTOS
: /* 2 */
856 /* TOS value is not supported. */
857 return SNMP_INTEGER (0);
859 case OSPFSTUBMETRIC
: /* 3 */
860 /* Default cost to stub area. */
861 return SNMP_INTEGER (area
->default_cost
);
863 case OSPFSTUBSTATUS
: /* 4 */
864 /* Status of the stub area. */
865 return SNMP_INTEGER (SNMP_VALID
);
867 case OSPFSTUBMETRICTYPE
: /* 5 */
868 /* OSPF Metric type. */
869 #define OSPF_ospfMetric 1
870 #define OSPF_comparableCost 2
871 #define OSPF_nonComparable 3
872 return SNMP_INTEGER (OSPF_ospfMetric
);
882 lsdb_lookup_next (struct ospf_area
*area
, u_char
*type
, int type_next
,
883 struct in_addr
*ls_id
, int ls_id_next
,
884 struct in_addr
*router_id
, int router_id_next
)
886 struct ospf_lsa
*lsa
;
894 for (; i
< OSPF_MAX_LSA
; i
++)
898 lsa
= ospf_lsdb_lookup_by_id_next (area
->lsdb
, *type
, *ls_id
, *router_id
,
909 ospfLsdbLookup (struct variable
*v
, oid
*name
, size_t *length
,
910 struct in_addr
*area_id
, u_char
*type
,
911 struct in_addr
*ls_id
, struct in_addr
*router_id
, int exact
)
913 struct ospf
*ospf
= ospf_top
;
914 struct ospf_area
*area
;
915 struct ospf_lsa
*lsa
;
923 #define OSPF_LSDB_ENTRY_OFFSET \
924 (IN_ADDR_SIZE + 1 + IN_ADDR_SIZE + IN_ADDR_SIZE)
928 /* Area ID + Type + LS ID + Router ID. */
929 if (*length
- v
->namelen
!= OSPF_LSDB_ENTRY_OFFSET
)
932 /* Set OID offset for Area ID. */
933 offset
= name
+ v
->namelen
;
935 /* Lookup area first. */
936 oid2in_addr (offset
, IN_ADDR_SIZE
, area_id
);
937 area
= ospf_area_lookup_by_area_id (ospf
, *area_id
);
940 offset
+= IN_ADDR_SIZE
;
947 oid2in_addr (offset
, IN_ADDR_SIZE
, ls_id
);
948 offset
+= IN_ADDR_SIZE
;
951 oid2in_addr (offset
, IN_ADDR_SIZE
, router_id
);
954 return ospf_lsdb_lookup_by_id (area
->lsdb
, *type
, *ls_id
, *router_id
);
958 /* Get variable length. */
959 offset
= name
+ v
->namelen
;
960 offsetlen
= *length
- v
->namelen
;
963 if (len
> IN_ADDR_SIZE
)
966 oid2in_addr (offset
, len
, area_id
);
968 /* First we search area. */
969 if (len
== IN_ADDR_SIZE
)
970 area
= ospf_area_lookup_by_area_id (ospf
, *area_id
);
972 area
= ospf_area_lookup_next (ospf
, area_id
, len
== 0 ? 1 : 0);
979 /* Next we lookup type. */
980 offset
+= IN_ADDR_SIZE
;
981 offsetlen
-= IN_ADDR_SIZE
;
1003 if (len
> IN_ADDR_SIZE
)
1006 oid2in_addr (offset
, len
, ls_id
);
1010 offset
+= IN_ADDR_SIZE
;
1011 offsetlen
-= IN_ADDR_SIZE
;
1019 if (len
> IN_ADDR_SIZE
)
1022 oid2in_addr (offset
, len
, router_id
);
1025 lsa
= lsdb_lookup_next (area
, type
, type_next
, ls_id
, ls_id_next
,
1026 router_id
, router_id_next
);
1030 /* Fill in length. */
1031 *length
= v
->namelen
+ OSPF_LSDB_ENTRY_OFFSET
;
1033 /* Fill in value. */
1034 offset
= name
+ v
->namelen
;
1035 oid_copy_addr (offset
, area_id
, IN_ADDR_SIZE
);
1036 offset
+= IN_ADDR_SIZE
;
1037 *offset
= lsa
->data
->type
;
1039 oid_copy_addr (offset
, &lsa
->data
->id
, IN_ADDR_SIZE
);
1040 offset
+= IN_ADDR_SIZE
;
1041 oid_copy_addr (offset
, &lsa
->data
->adv_router
, IN_ADDR_SIZE
);
1046 while ((area
= ospf_area_lookup_next (ospf
, area_id
, 0)) != NULL
);
1052 ospfLsdbEntry (struct variable
*v
, oid
*name
, size_t *length
, int exact
,
1053 size_t *var_len
, WriteMethod
**write_method
)
1055 struct ospf_lsa
*lsa
;
1056 struct lsa_header
*lsah
;
1057 struct in_addr area_id
;
1059 struct in_addr ls_id
;
1060 struct in_addr router_id
;
1062 /* INDEX { ospfLsdbAreaId, ospfLsdbType,
1063 ospfLsdbLsid, ospfLsdbRouterId } */
1065 memset (&area_id
, 0, sizeof (struct in_addr
));
1067 memset (&ls_id
, 0, sizeof (struct in_addr
));
1068 memset (&router_id
, 0, sizeof (struct in_addr
));
1070 /* Check OSPF instance. */
1074 lsa
= ospfLsdbLookup (v
, name
, length
, &area_id
, &type
, &ls_id
, &router_id
,
1081 /* Return the current value of the variable */
1084 case OSPFLSDBAREAID
: /* 1 */
1085 return SNMP_IPADDRESS (lsa
->area
->area_id
);
1087 case OSPFLSDBTYPE
: /* 2 */
1088 return SNMP_INTEGER (lsah
->type
);
1090 case OSPFLSDBLSID
: /* 3 */
1091 return SNMP_IPADDRESS (lsah
->id
);
1093 case OSPFLSDBROUTERID
: /* 4 */
1094 return SNMP_IPADDRESS (lsah
->adv_router
);
1096 case OSPFLSDBSEQUENCE
: /* 5 */
1097 return SNMP_INTEGER (lsah
->ls_seqnum
);
1099 case OSPFLSDBAGE
: /* 6 */
1100 return SNMP_INTEGER (lsah
->ls_age
);
1102 case OSPFLSDBCHECKSUM
: /* 7 */
1103 return SNMP_INTEGER (lsah
->checksum
);
1105 case OSPFLSDBADVERTISEMENT
: /* 8 */
1106 *var_len
= ntohs (lsah
->length
);
1107 return (u_char
*) lsah
;
1116 struct ospf_area_range
*
1117 ospfAreaRangeLookup (struct variable
*v
, oid
*name
, size_t *length
,
1118 struct in_addr
*area_id
, struct in_addr
*range_net
,
1124 struct ospf
*ospf
= ospf_top
;
1125 struct ospf_area
*area
;
1126 struct ospf_area_range
*range
;
1127 struct prefix_ipv4 p
;
1129 p
.prefixlen
= IPV4_MAX_BITLEN
;
1133 /* Area ID + Range Network. */
1134 if (v
->namelen
+ IN_ADDR_SIZE
+ IN_ADDR_SIZE
!= *length
)
1137 /* Set OID offset for Area ID. */
1138 offset
= name
+ v
->namelen
;
1140 /* Lookup area first. */
1141 oid2in_addr (offset
, IN_ADDR_SIZE
, area_id
);
1143 area
= ospf_area_lookup_by_area_id (ospf
, *area_id
);
1147 offset
+= IN_ADDR_SIZE
;
1149 /* Lookup area range. */
1150 oid2in_addr (offset
, IN_ADDR_SIZE
, range_net
);
1151 p
.prefix
= *range_net
;
1153 return ospf_area_range_lookup (area
, &p
);
1157 /* Set OID offset for Area ID. */
1158 offset
= name
+ v
->namelen
;
1159 offsetlen
= *length
- v
->namelen
;
1162 if (len
> IN_ADDR_SIZE
)
1165 oid2in_addr (offset
, len
, area_id
);
1167 /* First we search area. */
1168 if (len
== IN_ADDR_SIZE
)
1169 area
= ospf_area_lookup_by_area_id (ospf
,*area_id
);
1171 area
= ospf_area_lookup_next (ospf
, area_id
, len
== 0 ? 1 : 0);
1178 offset
+= IN_ADDR_SIZE
;
1179 offsetlen
-= IN_ADDR_SIZE
;
1184 if (len
> IN_ADDR_SIZE
)
1187 oid2in_addr (offset
, len
, range_net
);
1189 range
= ospf_area_range_lookup_next (area
, range_net
,
1194 /* Fill in length. */
1195 *length
= v
->namelen
+ IN_ADDR_SIZE
+ IN_ADDR_SIZE
;
1197 /* Fill in value. */
1198 offset
= name
+ v
->namelen
;
1199 oid_copy_addr (offset
, area_id
, IN_ADDR_SIZE
);
1200 offset
+= IN_ADDR_SIZE
;
1201 oid_copy_addr (offset
, range_net
, IN_ADDR_SIZE
);
1206 while ((area
= ospf_area_lookup_next (ospf
, area_id
, 0)) != NULL
);
1212 ospfAreaRangeEntry (struct variable
*v
, oid
*name
, size_t *length
, int exact
,
1213 size_t *var_len
, WriteMethod
**write_method
)
1215 struct ospf_area_range
*range
;
1216 struct in_addr area_id
;
1217 struct in_addr range_net
;
1218 struct in_addr mask
;
1219 struct ospf
*ospf
= ospf_top
;
1221 /* Check OSPF instance. */
1225 memset (&area_id
, 0, IN_ADDR_SIZE
);
1226 memset (&range_net
, 0, IN_ADDR_SIZE
);
1228 range
= ospfAreaRangeLookup (v
, name
, length
, &area_id
, &range_net
, exact
);
1232 /* Convert prefixlen to network mask format. */
1233 masklen2ip (range
->subst_masklen
, &mask
);
1235 /* Return the current value of the variable */
1238 case OSPFAREARANGEAREAID
: /* 1 */
1239 return SNMP_IPADDRESS (area_id
);
1241 case OSPFAREARANGENET
: /* 2 */
1242 return SNMP_IPADDRESS (range_net
);
1244 case OSPFAREARANGEMASK
: /* 3 */
1245 return SNMP_IPADDRESS (mask
);
1247 case OSPFAREARANGESTATUS
: /* 4 */
1248 return SNMP_INTEGER (SNMP_VALID
);
1250 case OSPFAREARANGEEFFECT
: /* 5 */
1251 #define OSPF_advertiseMatching 1
1252 #define OSPF_doNotAdvertiseMatching 2
1253 return SNMP_INTEGER (OSPF_advertiseMatching
);
1262 struct ospf_nbr_nbma
*
1263 ospfHostLookup (struct variable
*v
, oid
*name
, size_t *length
,
1264 struct in_addr
*addr
, int exact
)
1267 struct ospf_nbr_nbma
*nbr_nbma
;
1268 struct ospf
*ospf
= ospf_top
;
1275 /* INDEX { ospfHostIpAddress, ospfHostTOS } */
1276 if (*length
!= v
->namelen
+ IN_ADDR_SIZE
+ 1)
1279 /* Check ospfHostTOS. */
1280 if (name
[*length
- 1] != 0)
1283 oid2in_addr (name
+ v
->namelen
, IN_ADDR_SIZE
, addr
);
1285 nbr_nbma
= ospf_nbr_nbma_lookup (ospf
, *addr
);
1291 len
= *length
- v
->namelen
;
1295 oid2in_addr (name
+ v
->namelen
, len
, addr
);
1297 nbr_nbma
= ospf_nbr_nbma_lookup_next (ospf
, addr
, len
== 0 ? 1 : 0);
1299 if (nbr_nbma
== NULL
)
1302 oid_copy_addr (name
+ v
->namelen
, addr
, IN_ADDR_SIZE
);
1305 name
[v
->namelen
+ IN_ADDR_SIZE
] = 0;
1307 *length
= v
->namelen
+ IN_ADDR_SIZE
+ 1;
1315 ospfHostEntry (struct variable
*v
, oid
*name
, size_t *length
, int exact
,
1316 size_t *var_len
, WriteMethod
**write_method
)
1318 struct ospf_nbr_nbma
*nbr_nbma
;
1319 struct ospf_interface
*oi
;
1320 struct in_addr addr
;
1321 struct ospf
*ospf
= ospf_top
;
1323 /* Check OSPF instance. */
1327 memset (&addr
, 0, sizeof (struct in_addr
));
1329 nbr_nbma
= ospfHostLookup (v
, name
, length
, &addr
, exact
);
1330 if (nbr_nbma
== NULL
)
1335 /* Return the current value of the variable */
1338 case OSPFHOSTIPADDRESS
: /* 1 */
1339 return SNMP_IPADDRESS (nbr_nbma
->addr
);
1341 case OSPFHOSTTOS
: /* 2 */
1342 return SNMP_INTEGER (0);
1344 case OSPFHOSTMETRIC
: /* 3 */
1346 return SNMP_INTEGER (oi
->output_cost
);
1348 return SNMP_INTEGER (1);
1350 case OSPFHOSTSTATUS
: /* 4 */
1351 return SNMP_INTEGER (SNMP_VALID
);
1353 case OSPFHOSTAREAID
: /* 5 */
1355 return SNMP_IPADDRESS (oi
->area
->area_id
);
1357 return SNMP_IPADDRESS (ospf_empty_addr
);
1366 struct list
*ospf_snmp_iflist
;
1370 struct in_addr addr
;
1371 unsigned int ifindex
;
1372 struct interface
*ifp
;
1375 struct ospf_snmp_if
*
1378 struct ospf_snmp_if
*osif
;
1380 osif
= XMALLOC (0, sizeof (struct ospf_snmp_if
));
1381 memset (osif
, 0, sizeof (struct ospf_snmp_if
));
1386 ospf_snmp_if_free (struct ospf_snmp_if
*osif
)
1392 ospf_snmp_if_delete (struct interface
*ifp
)
1394 struct listnode
*nn
;
1395 struct ospf_snmp_if
*osif
;
1397 LIST_LOOP (ospf_snmp_iflist
, osif
, nn
)
1399 if (osif
->ifp
== ifp
)
1401 list_delete_node (ospf_snmp_iflist
, nn
);
1402 ospf_snmp_if_free (osif
);
1409 ospf_snmp_if_update (struct interface
*ifp
)
1411 struct listnode
*nn
;
1412 struct listnode
*pn
;
1413 struct connected
*ifc
;
1415 struct ospf_snmp_if
*osif
;
1416 struct in_addr
*addr
;
1417 unsigned int ifindex
;
1419 ospf_snmp_if_delete (ifp
);
1425 /* Lookup first IPv4 address entry. */
1426 LIST_LOOP (ifp
->connected
, ifc
, nn
)
1428 if (ifc_pointopoint (ifc
))
1429 p
= ifc
->destination
;
1433 if (p
->family
== AF_INET
)
1435 addr
= &p
->u
.prefix4
;
1440 ifindex
= ifp
->ifindex
;
1442 /* Add interface to the list. */
1444 LIST_LOOP (ospf_snmp_iflist
, osif
, nn
)
1448 if (ntohl (osif
->addr
.s_addr
) > ntohl (addr
->s_addr
))
1453 /* Unnumbered interface. */
1454 if (osif
->addr
.s_addr
!= 0 || osif
->ifindex
> ifindex
)
1460 osif
= ospf_snmp_if_new ();
1464 osif
->ifindex
= ifindex
;
1467 listnode_add_after (ospf_snmp_iflist
, pn
, osif
);
1471 ospf_snmp_if_lookup (struct in_addr
*ifaddr
, unsigned int *ifindex
)
1473 struct listnode
*nn
;
1474 struct ospf_snmp_if
*osif
;
1476 LIST_LOOP (ospf_snmp_iflist
, osif
, nn
)
1480 if (IPV4_ADDR_SAME (&osif
->addr
, ifaddr
))
1485 if (osif
->ifindex
== *ifindex
)
1493 ospf_snmp_if_lookup_next (struct in_addr
*ifaddr
, unsigned int *ifindex
,
1494 int ifaddr_next
, int ifindex_next
)
1496 struct ospf_snmp_if
*osif
;
1497 struct listnode
*nn
;
1501 nn
= listhead (ospf_snmp_iflist
);
1504 osif
= getdata (nn
);
1505 *ifaddr
= osif
->addr
;
1506 *ifindex
= osif
->ifindex
;
1512 LIST_LOOP (ospf_snmp_iflist
, osif
, nn
)
1516 if (ntohl (osif
->addr
.s_addr
) > ntohl (ifaddr
->s_addr
))
1518 *ifaddr
= osif
->addr
;
1519 *ifindex
= osif
->ifindex
;
1525 if (osif
->ifindex
> *ifindex
|| osif
->addr
.s_addr
)
1527 *ifaddr
= osif
->addr
;
1528 *ifindex
= osif
->ifindex
;
1537 ospf_snmp_iftype (struct interface
*ifp
)
1539 #define ospf_snmp_iftype_broadcast 1
1540 #define ospf_snmp_iftype_nbma 2
1541 #define ospf_snmp_iftype_pointToPoint 3
1542 #define ospf_snmp_iftype_pointToMultipoint 5
1543 if (if_is_broadcast (ifp
))
1544 return ospf_snmp_iftype_broadcast
;
1545 if (if_is_pointopoint (ifp
))
1546 return ospf_snmp_iftype_pointToPoint
;
1547 return ospf_snmp_iftype_broadcast
;
1551 ospfIfLookup (struct variable
*v
, oid
*name
, size_t *length
,
1552 struct in_addr
*ifaddr
, unsigned int *ifindex
, int exact
)
1555 int ifaddr_next
= 0;
1556 int ifindex_next
= 0;
1557 struct interface
*ifp
;
1562 if (*length
!= v
->namelen
+ IN_ADDR_SIZE
+ 1)
1565 oid2in_addr (name
+ v
->namelen
, IN_ADDR_SIZE
, ifaddr
);
1566 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
1568 return ospf_snmp_if_lookup (ifaddr
, ifindex
);
1572 len
= *length
- v
->namelen
;
1573 if (len
>= IN_ADDR_SIZE
)
1578 oid2in_addr (name
+ v
->namelen
, len
, ifaddr
);
1580 len
= *length
- v
->namelen
- IN_ADDR_SIZE
;
1587 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
1589 ifp
= ospf_snmp_if_lookup_next (ifaddr
, ifindex
, ifaddr_next
,
1593 *length
= v
->namelen
+ IN_ADDR_SIZE
+ 1;
1594 offset
= name
+ v
->namelen
;
1595 oid_copy_addr (offset
, ifaddr
, IN_ADDR_SIZE
);
1596 offset
+= IN_ADDR_SIZE
;
1605 ospfIfEntry (struct variable
*v
, oid
*name
, size_t *length
, int exact
,
1606 size_t *var_len
, WriteMethod
**write_method
)
1608 struct interface
*ifp
;
1609 unsigned int ifindex
;
1610 struct in_addr ifaddr
;
1611 struct ospf_interface
*oi
;
1612 struct ospf
*ospf
= ospf_top
;
1615 memset (&ifaddr
, 0, sizeof (struct in_addr
));
1617 /* Check OSPF instance. */
1621 ifp
= ospfIfLookup (v
, name
, length
, &ifaddr
, &ifindex
, exact
);
1625 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, ifaddr
);
1629 /* Return the current value of the variable */
1632 case OSPFIFIPADDRESS
: /* 1 */
1633 return SNMP_IPADDRESS (ifaddr
);
1635 case OSPFADDRESSLESSIF
: /* 2 */
1636 return SNMP_INTEGER (ifindex
);
1638 case OSPFIFAREAID
: /* 3 */
1640 return SNMP_IPADDRESS (oi
->area
->area_id
);
1642 return SNMP_IPADDRESS (ospf_empty_addr
);
1644 case OSPFIFTYPE
: /* 4 */
1645 return SNMP_INTEGER (ospf_snmp_iftype (ifp
));
1647 case OSPFIFADMINSTAT
: /* 5 */
1649 return SNMP_INTEGER (OSPF_STATUS_ENABLED
);
1651 return SNMP_INTEGER (OSPF_STATUS_DISABLED
);
1653 case OSPFIFRTRPRIORITY
: /* 6 */
1654 return SNMP_INTEGER (PRIORITY (oi
));
1656 case OSPFIFTRANSITDELAY
: /* 7 */
1657 return SNMP_INTEGER (OSPF_IF_PARAM (oi
, transmit_delay
));
1659 case OSPFIFRETRANSINTERVAL
: /* 8 */
1660 return SNMP_INTEGER (OSPF_IF_PARAM (oi
, retransmit_interval
));
1662 case OSPFIFHELLOINTERVAL
: /* 9 */
1663 return SNMP_INTEGER (OSPF_IF_PARAM (oi
, v_hello
));
1665 case OSPFIFRTRDEADINTERVAL
: /* 10 */
1666 return SNMP_INTEGER (OSPF_IF_PARAM (oi
, v_wait
));
1668 case OSPFIFPOLLINTERVAL
: /* 11 */
1669 return SNMP_INTEGER (OSPF_POLL_INTERVAL_DEFAULT
);
1671 case OSPFIFSTATE
: /* 12 */
1672 return SNMP_INTEGER (oi
->state
);
1674 case OSPFIFDESIGNATEDROUTER
: /* 13 */
1675 return SNMP_IPADDRESS (DR (oi
));
1677 case OSPFIFBACKUPDESIGNATEDROUTER
: /* 14 */
1678 return SNMP_IPADDRESS (BDR (oi
));
1680 case OSPFIFEVENTS
: /* 15 */
1681 return SNMP_INTEGER (oi
->state_change
);
1683 case OSPFIFAUTHKEY
: /* 16 */
1685 return (u_char
*) OSPF_IF_PARAM (oi
, auth_simple
);
1687 case OSPFIFSTATUS
: /* 17 */
1688 return SNMP_INTEGER (SNMP_VALID
);
1690 case OSPFIFMULTICASTFORWARDING
: /* 18 */
1691 #define ospf_snmp_multiforward_blocked 1
1692 #define ospf_snmp_multiforward_multicast 2
1693 #define ospf_snmp_multiforward_unicast 3
1694 return SNMP_INTEGER (ospf_snmp_multiforward_blocked
);
1696 case OSPFIFDEMAND
: /* 19 */
1697 return SNMP_INTEGER (SNMP_FALSE
);
1699 case OSPFIFAUTHTYPE
: /* 20 */
1701 return SNMP_INTEGER (oi
->area
->auth_type
);
1703 return SNMP_INTEGER (0);
1712 #define OSPF_SNMP_METRIC_VALUE 1
1715 ospfIfMetricLookup (struct variable
*v
, oid
*name
, size_t *length
,
1716 struct in_addr
*ifaddr
, unsigned int *ifindex
, int exact
)
1719 int ifaddr_next
= 0;
1720 int ifindex_next
= 0;
1721 struct interface
*ifp
;
1727 if (*length
!= v
->namelen
+ IN_ADDR_SIZE
+ 1 + 1)
1730 oid2in_addr (name
+ v
->namelen
, IN_ADDR_SIZE
, ifaddr
);
1731 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
1732 metric
= name
[v
->namelen
+ IN_ADDR_SIZE
+ 1];
1734 if (metric
!= OSPF_SNMP_METRIC_VALUE
)
1737 return ospf_snmp_if_lookup (ifaddr
, ifindex
);
1741 len
= *length
- v
->namelen
;
1742 if (len
>= IN_ADDR_SIZE
)
1747 oid2in_addr (name
+ v
->namelen
, len
, ifaddr
);
1749 len
= *length
- v
->namelen
- IN_ADDR_SIZE
;
1756 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
1758 ifp
= ospf_snmp_if_lookup_next (ifaddr
, ifindex
, ifaddr_next
,
1762 *length
= v
->namelen
+ IN_ADDR_SIZE
+ 1 + 1;
1763 offset
= name
+ v
->namelen
;
1764 oid_copy_addr (offset
, ifaddr
, IN_ADDR_SIZE
);
1765 offset
+= IN_ADDR_SIZE
;
1768 *offset
= OSPF_SNMP_METRIC_VALUE
;
1776 ospfIfMetricEntry (struct variable
*v
, oid
*name
, size_t *length
, int exact
,
1777 size_t *var_len
, WriteMethod
**write_method
)
1779 /* Currently we support metric 1 only. */
1780 struct interface
*ifp
;
1781 unsigned int ifindex
;
1782 struct in_addr ifaddr
;
1783 struct ospf_interface
*oi
;
1784 struct ospf
*ospf
= ospf_top
;
1787 memset (&ifaddr
, 0, sizeof (struct in_addr
));
1789 /* Check OSPF instance. */
1793 ifp
= ospfIfMetricLookup (v
, name
, length
, &ifaddr
, &ifindex
, exact
);
1797 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, ifaddr
);
1801 /* Return the current value of the variable */
1804 case OSPFIFMETRICIPADDRESS
:
1805 return SNMP_IPADDRESS (ifaddr
);
1807 case OSPFIFMETRICADDRESSLESSIF
:
1808 return SNMP_INTEGER (ifindex
);
1810 case OSPFIFMETRICTOS
:
1811 return SNMP_INTEGER (0);
1813 case OSPFIFMETRICVALUE
:
1814 return SNMP_INTEGER (OSPF_SNMP_METRIC_VALUE
);
1816 case OSPFIFMETRICSTATUS
:
1817 return SNMP_INTEGER (1);
1826 struct route_table
*ospf_snmp_vl_table
;
1829 ospf_snmp_vl_add (struct ospf_vl_data
*vl_data
)
1831 struct prefix_ls lp
;
1832 struct route_node
*rn
;
1834 memset (&lp
, 0, sizeof (struct prefix_ls
));
1837 lp
.id
= vl_data
->vl_area_id
;
1838 lp
.adv_router
= vl_data
->vl_peer
;
1840 rn
= route_node_get (ospf_snmp_vl_table
, (struct prefix
*) &lp
);
1845 ospf_snmp_vl_delete (struct ospf_vl_data
*vl_data
)
1847 struct prefix_ls lp
;
1848 struct route_node
*rn
;
1850 memset (&lp
, 0, sizeof (struct prefix_ls
));
1853 lp
.id
= vl_data
->vl_area_id
;
1854 lp
.adv_router
= vl_data
->vl_peer
;
1856 rn
= route_node_lookup (ospf_snmp_vl_table
, (struct prefix
*) &lp
);
1860 route_unlock_node (rn
);
1861 route_unlock_node (rn
);
1864 struct ospf_vl_data
*
1865 ospf_snmp_vl_lookup (struct in_addr
*area_id
, struct in_addr
*neighbor
)
1867 struct prefix_ls lp
;
1868 struct route_node
*rn
;
1869 struct ospf_vl_data
*vl_data
;
1871 memset (&lp
, 0, sizeof (struct prefix_ls
));
1875 lp
.adv_router
= *neighbor
;
1877 rn
= route_node_lookup (ospf_snmp_vl_table
, (struct prefix
*) &lp
);
1881 route_unlock_node (rn
);
1887 struct ospf_vl_data
*
1888 ospf_snmp_vl_lookup_next (struct in_addr
*area_id
, struct in_addr
*neighbor
,
1891 struct prefix_ls lp
;
1892 struct route_node
*rn
;
1893 struct ospf_vl_data
*vl_data
;
1895 memset (&lp
, 0, sizeof (struct prefix_ls
));
1899 lp
.adv_router
= *neighbor
;
1902 rn
= route_top (ospf_snmp_vl_table
);
1905 rn
= route_node_get (ospf_snmp_vl_table
, (struct prefix
*) &lp
);
1906 rn
= route_next (rn
);
1909 for (; rn
; rn
= route_next (rn
))
1916 *area_id
= vl_data
->vl_area_id
;
1917 *neighbor
= vl_data
->vl_peer
;
1918 route_unlock_node (rn
);
1924 struct ospf_vl_data
*
1925 ospfVirtIfLookup (struct variable
*v
, oid
*name
, size_t *length
,
1926 struct in_addr
*area_id
, struct in_addr
*neighbor
, int exact
)
1930 struct ospf_vl_data
*vl_data
;
1934 if (*length
!= v
->namelen
+ IN_ADDR_SIZE
+ IN_ADDR_SIZE
)
1937 oid2in_addr (name
+ v
->namelen
, IN_ADDR_SIZE
, area_id
);
1938 oid2in_addr (name
+ v
->namelen
+ IN_ADDR_SIZE
, IN_ADDR_SIZE
, neighbor
);
1940 return ospf_snmp_vl_lookup (area_id
, neighbor
);
1946 len
= *length
- v
->namelen
;
1949 if (len
> IN_ADDR_SIZE
)
1951 oid2in_addr (name
+ v
->namelen
, len
, area_id
);
1953 len
= *length
- v
->namelen
- IN_ADDR_SIZE
;
1954 if (len
> IN_ADDR_SIZE
)
1956 oid2in_addr (name
+ v
->namelen
+ IN_ADDR_SIZE
, len
, neighbor
);
1958 vl_data
= ospf_snmp_vl_lookup_next (area_id
, neighbor
, first
);
1962 *length
= v
->namelen
+ IN_ADDR_SIZE
+ IN_ADDR_SIZE
;
1963 oid_copy_addr (name
+ v
->namelen
, area_id
, IN_ADDR_SIZE
);
1964 oid_copy_addr (name
+ v
->namelen
+ IN_ADDR_SIZE
, neighbor
,
1973 ospfVirtIfEntry (struct variable
*v
, oid
*name
, size_t *length
, int exact
,
1974 size_t *var_len
, WriteMethod
**write_method
)
1976 struct ospf_vl_data
*vl_data
;
1977 struct ospf_interface
*oi
;
1978 struct in_addr area_id
;
1979 struct in_addr neighbor
;
1981 memset (&area_id
, 0, sizeof (struct in_addr
));
1982 memset (&neighbor
, 0, sizeof (struct in_addr
));
1984 vl_data
= ospfVirtIfLookup (v
, name
, length
, &area_id
, &neighbor
, exact
);
1987 oi
= vl_data
->vl_oi
;
1991 /* Return the current value of the variable */
1994 case OSPFVIRTIFAREAID
:
1995 return SNMP_IPADDRESS (area_id
);
1997 case OSPFVIRTIFNEIGHBOR
:
1998 return SNMP_IPADDRESS (neighbor
);
2000 case OSPFVIRTIFTRANSITDELAY
:
2001 return SNMP_INTEGER (OSPF_IF_PARAM (oi
, transmit_delay
));
2003 case OSPFVIRTIFRETRANSINTERVAL
:
2004 return SNMP_INTEGER (OSPF_IF_PARAM (oi
, retransmit_interval
));
2006 case OSPFVIRTIFHELLOINTERVAL
:
2007 return SNMP_INTEGER (OSPF_IF_PARAM (oi
, v_hello
));
2009 case OSPFVIRTIFRTRDEADINTERVAL
:
2010 return SNMP_INTEGER (OSPF_IF_PARAM (oi
, v_wait
));
2012 case OSPFVIRTIFSTATE
:
2013 return SNMP_INTEGER (oi
->state
);
2015 case OSPFVIRTIFEVENTS
:
2016 return SNMP_INTEGER (oi
->state_change
);
2018 case OSPFVIRTIFAUTHKEY
:
2020 return (u_char
*) OSPF_IF_PARAM (oi
, auth_simple
);
2022 case OSPFVIRTIFSTATUS
:
2023 return SNMP_INTEGER (SNMP_VALID
);
2025 case OSPFVIRTIFAUTHTYPE
:
2027 return SNMP_INTEGER (oi
->area
->auth_type
);
2029 return SNMP_INTEGER (0);
2038 struct ospf_neighbor
*
2039 ospf_snmp_nbr_lookup (struct ospf
*ospf
, struct in_addr
*nbr_addr
,
2040 unsigned int *ifindex
)
2042 struct listnode
*nn
;
2043 struct ospf_interface
*oi
;
2044 struct ospf_neighbor
*nbr
;
2045 struct route_node
*rn
;
2047 LIST_LOOP (ospf
->oiflist
, oi
, nn
)
2049 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2050 if ((nbr
= rn
->info
) != NULL
2051 && nbr
!= oi
->nbr_self
2052 && nbr
->state
!= NSM_Down
2053 && nbr
->src
.s_addr
!= 0)
2055 if (IPV4_ADDR_SAME (&nbr
->src
, nbr_addr
))
2057 route_unlock_node (rn
);
2065 struct ospf_neighbor
*
2066 ospf_snmp_nbr_lookup_next (struct in_addr
*nbr_addr
, unsigned int *ifindex
,
2069 struct listnode
*nn
;
2070 struct ospf_interface
*oi
;
2071 struct ospf_neighbor
*nbr
;
2072 struct route_node
*rn
;
2073 struct ospf_neighbor
*min
= NULL
;
2074 struct ospf
*ospf
= ospf_top
;
2076 LIST_LOOP (ospf
->oiflist
, oi
, nn
)
2078 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2079 if ((nbr
= rn
->info
) != NULL
2080 && nbr
!= oi
->nbr_self
2081 && nbr
->state
!= NSM_Down
2082 && nbr
->src
.s_addr
!= 0)
2088 else if (ntohl (nbr
->src
.s_addr
) < ntohl (min
->src
.s_addr
))
2091 else if (ntohl (nbr
->src
.s_addr
) > ntohl (nbr_addr
->s_addr
))
2095 else if (ntohl (nbr
->src
.s_addr
) < ntohl (min
->src
.s_addr
))
2102 *nbr_addr
= min
->src
;
2109 struct ospf_neighbor
*
2110 ospfNbrLookup (struct variable
*v
, oid
*name
, size_t *length
,
2111 struct in_addr
*nbr_addr
, unsigned int *ifindex
, int exact
)
2115 struct ospf_neighbor
*nbr
;
2116 struct ospf
*ospf
= ospf_top
;
2120 if (*length
!= v
->namelen
+ IN_ADDR_SIZE
+ 1)
2123 oid2in_addr (name
+ v
->namelen
, IN_ADDR_SIZE
, nbr_addr
);
2124 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
2126 return ospf_snmp_nbr_lookup (ospf
, nbr_addr
, ifindex
);
2131 len
= *length
- v
->namelen
;
2136 if (len
> IN_ADDR_SIZE
)
2139 oid2in_addr (name
+ v
->namelen
, len
, nbr_addr
);
2141 len
= *length
- v
->namelen
- IN_ADDR_SIZE
;
2143 *ifindex
= name
[v
->namelen
+ IN_ADDR_SIZE
];
2145 nbr
= ospf_snmp_nbr_lookup_next (nbr_addr
, ifindex
, first
);
2149 *length
= v
->namelen
+ IN_ADDR_SIZE
+ 1;
2150 oid_copy_addr (name
+ v
->namelen
, nbr_addr
, IN_ADDR_SIZE
);
2151 name
[v
->namelen
+ IN_ADDR_SIZE
] = *ifindex
;
2159 ospfNbrEntry (struct variable
*v
, oid
*name
, size_t *length
, int exact
,
2160 size_t *var_len
, WriteMethod
**write_method
)
2162 struct in_addr nbr_addr
;
2163 unsigned int ifindex
;
2164 struct ospf_neighbor
*nbr
;
2165 struct ospf_interface
*oi
;
2167 memset (&nbr_addr
, 0, sizeof (struct in_addr
));
2170 nbr
= ospfNbrLookup (v
, name
, length
, &nbr_addr
, &ifindex
, exact
);
2177 /* Return the current value of the variable */
2181 return SNMP_IPADDRESS (nbr_addr
);
2183 case OSPFNBRADDRESSLESSINDEX
:
2184 return SNMP_INTEGER (ifindex
);
2187 return SNMP_IPADDRESS (nbr
->router_id
);
2189 case OSPFNBROPTIONS
:
2190 return SNMP_INTEGER (oi
->nbr_self
->options
);
2192 case OSPFNBRPRIORITY
:
2193 return SNMP_INTEGER (nbr
->priority
);
2196 return SNMP_INTEGER (nbr
->state
);
2199 return SNMP_INTEGER (nbr
->state_change
);
2201 case OSPFNBRLSRETRANSQLEN
:
2202 return SNMP_INTEGER (ospf_ls_retransmit_count (nbr
));
2204 case OSPFNBMANBRSTATUS
:
2205 return SNMP_INTEGER (SNMP_VALID
);
2207 case OSPFNBMANBRPERMANENCE
:
2208 return SNMP_INTEGER (2);
2210 case OSPFNBRHELLOSUPPRESSED
:
2211 return SNMP_INTEGER (SNMP_FALSE
);
2221 ospfVirtNbrEntry (struct variable
*v
, oid
*name
, size_t *length
, int exact
,
2222 size_t *var_len
, WriteMethod
**write_method
)
2224 struct ospf_vl_data
*vl_data
;
2225 struct in_addr area_id
;
2226 struct in_addr neighbor
;
2227 struct ospf
*ospf
= ospf_top
;
2229 memset (&area_id
, 0, sizeof (struct in_addr
));
2230 memset (&neighbor
, 0, sizeof (struct in_addr
));
2232 /* Check OSPF instance. */
2236 vl_data
= ospfVirtIfLookup (v
, name
, length
, &area_id
, &neighbor
, exact
);
2240 /* Return the current value of the variable */
2243 case OSPFVIRTNBRAREA
:
2244 return (u_char
*) NULL
;
2246 case OSPFVIRTNBRRTRID
:
2247 return (u_char
*) NULL
;
2249 case OSPFVIRTNBRIPADDR
:
2250 return (u_char
*) NULL
;
2252 case OSPFVIRTNBROPTIONS
:
2253 return (u_char
*) NULL
;
2255 case OSPFVIRTNBRSTATE
:
2256 return (u_char
*) NULL
;
2258 case OSPFVIRTNBREVENTS
:
2259 return (u_char
*) NULL
;
2261 case OSPFVIRTNBRLSRETRANSQLEN
:
2262 return (u_char
*) NULL
;
2264 case OSPFVIRTNBRHELLOSUPPRESSED
:
2265 return (u_char
*) NULL
;
2275 ospfExtLsdbLookup (struct variable
*v
, oid
*name
, size_t *length
, u_char
*type
,
2276 struct in_addr
*ls_id
, struct in_addr
*router_id
, int exact
)
2283 struct ospf_lsa
*lsa
;
2284 struct ospf
*ospf
= ospf_top
;
2288 if (*length
!= v
->namelen
+ 1 + IN_ADDR_SIZE
+ IN_ADDR_SIZE
)
2291 offset
= name
+ v
->namelen
;
2293 /* Make it sure given value match to type. */
2297 if (lsa_type
!= *type
)
2301 oid2in_addr (offset
, IN_ADDR_SIZE
, ls_id
);
2302 offset
+= IN_ADDR_SIZE
;
2305 oid2in_addr (offset
, IN_ADDR_SIZE
, router_id
);
2307 return ospf_lsdb_lookup_by_id (ospf
->lsdb
, *type
, *ls_id
, *router_id
);
2311 /* Get variable length. */
2313 offset
= name
+ v
->namelen
;
2314 offsetlen
= *length
- v
->namelen
;
2316 /* LSA type value. */
2321 if (offsetlen
<= 0 || lsa_type
< OSPF_AS_EXTERNAL_LSA
)
2326 if (len
> IN_ADDR_SIZE
)
2329 oid2in_addr (offset
, len
, ls_id
);
2331 offset
+= IN_ADDR_SIZE
;
2332 offsetlen
-= IN_ADDR_SIZE
;
2336 if (len
> IN_ADDR_SIZE
)
2339 oid2in_addr (offset
, len
, router_id
);
2341 lsa
= ospf_lsdb_lookup_by_id_next (ospf
->lsdb
, *type
, *ls_id
,
2346 /* Fill in length. */
2347 *length
= v
->namelen
+ 1 + IN_ADDR_SIZE
+ IN_ADDR_SIZE
;
2349 /* Fill in value. */
2350 offset
= name
+ v
->namelen
;
2352 *offset
= OSPF_AS_EXTERNAL_LSA
;
2354 oid_copy_addr (offset
, &lsa
->data
->id
, IN_ADDR_SIZE
);
2355 offset
+= IN_ADDR_SIZE
;
2356 oid_copy_addr (offset
, &lsa
->data
->adv_router
, IN_ADDR_SIZE
);
2365 ospfExtLsdbEntry (struct variable
*v
, oid
*name
, size_t *length
, int exact
,
2366 size_t *var_len
, WriteMethod
**write_method
)
2368 struct ospf_lsa
*lsa
;
2369 struct lsa_header
*lsah
;
2371 struct in_addr ls_id
;
2372 struct in_addr router_id
;
2373 struct ospf
*ospf
= ospf_top
;
2375 type
= OSPF_AS_EXTERNAL_LSA
;
2376 memset (&ls_id
, 0, sizeof (struct in_addr
));
2377 memset (&router_id
, 0, sizeof (struct in_addr
));
2379 /* Check OSPF instance. */
2383 lsa
= ospfExtLsdbLookup (v
, name
, length
, &type
, &ls_id
, &router_id
, exact
);
2389 /* Return the current value of the variable */
2392 case OSPFEXTLSDBTYPE
:
2393 return SNMP_INTEGER (OSPF_AS_EXTERNAL_LSA
);
2395 case OSPFEXTLSDBLSID
:
2396 return SNMP_IPADDRESS (lsah
->id
);
2398 case OSPFEXTLSDBROUTERID
:
2399 return SNMP_IPADDRESS (lsah
->adv_router
);
2401 case OSPFEXTLSDBSEQUENCE
:
2402 return SNMP_INTEGER (lsah
->ls_seqnum
);
2404 case OSPFEXTLSDBAGE
:
2405 return SNMP_INTEGER (lsah
->ls_age
);
2407 case OSPFEXTLSDBCHECKSUM
:
2408 return SNMP_INTEGER (lsah
->checksum
);
2410 case OSPFEXTLSDBADVERTISEMENT
:
2411 *var_len
= ntohs (lsah
->length
);
2412 return (u_char
*) lsah
;
2422 ospfAreaAggregateEntry (struct variable
*v
, oid
*name
, size_t *length
,
2423 int exact
, size_t *var_len
, WriteMethod
**write_method
)
2425 /* Return the current value of the variable */
2428 case OSPFAREAAGGREGATEAREAID
:
2429 return (u_char
*) NULL
;
2431 case OSPFAREAAGGREGATELSDBTYPE
:
2432 return (u_char
*) NULL
;
2434 case OSPFAREAAGGREGATENET
:
2435 return (u_char
*) NULL
;
2437 case OSPFAREAAGGREGATEMASK
:
2438 return (u_char
*) NULL
;
2440 case OSPFAREAAGGREGATESTATUS
:
2441 return (u_char
*) NULL
;
2443 case OSPFAREAAGGREGATEEFFECT
:
2444 return (u_char
*) NULL
;
2453 /* Register OSPF2-MIB. */
2457 ospf_snmp_iflist
= list_new ();
2458 ospf_snmp_vl_table
= route_table_init ();
2459 smux_init (ospfd_oid
, sizeof (ospfd_oid
) / sizeof (oid
));
2460 REGISTER_MIB("mibII/ospf", ospf_variables
, variable
, ospf_oid
);
2463 #endif /* HAVE_SNMP */