hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 1 | /* OSPFv3 SNMP support |
| 2 | * Copyright (C) 2004 Yasuhiro Ohara |
| 3 | * |
| 4 | * This file is part of GNU Zebra. |
| 5 | * |
| 6 | * GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the |
| 8 | * Free Software Foundation; either version 2, or (at your option) any |
| 9 | * later version. |
| 10 | * |
| 11 | * GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with GNU Zebra; see the file COPYING. If not, write to the |
| 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | * Boston, MA 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | #include <zebra.h> |
| 23 | |
| 24 | #ifdef HAVE_SNMP |
| 25 | |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 26 | #include <net-snmp/net-snmp-config.h> |
Joakim Tjernlund | fb62a3c | 2008-05-13 20:03:32 +0200 | [diff] [blame] | 27 | #include <net-snmp/net-snmp-includes.h> |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 28 | |
| 29 | #include "log.h" |
| 30 | #include "vty.h" |
| 31 | #include "linklist.h" |
| 32 | #include "smux.h" |
| 33 | |
| 34 | #include "ospf6_proto.h" |
| 35 | #include "ospf6_lsa.h" |
| 36 | #include "ospf6_lsdb.h" |
| 37 | #include "ospf6_route.h" |
| 38 | #include "ospf6_top.h" |
| 39 | #include "ospf6_area.h" |
| 40 | #include "ospf6_interface.h" |
| 41 | #include "ospf6_message.h" |
| 42 | #include "ospf6_neighbor.h" |
| 43 | #include "ospf6d.h" |
Chris Caputo | 0be8dfb | 2009-06-02 18:40:07 +0100 | [diff] [blame] | 44 | #include "ospf6_snmp.h" |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 45 | |
| 46 | /* OSPFv3-MIB */ |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 47 | #define OSPFv3MIB 1,3,6,1,2,1,191 |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 48 | |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 49 | /* OSPFv3 MIB General Group values. */ |
| 50 | #define OSPFv3ROUTERID 1 |
| 51 | #define OSPFv3ADMINSTAT 2 |
| 52 | #define OSPFv3VERSIONNUMBER 3 |
| 53 | #define OSPFv3AREABDRRTRSTATUS 4 |
| 54 | #define OSPFv3ASBDRRTRSTATUS 5 |
| 55 | #define OSPFv3ASSCOPELSACOUNT 6 |
| 56 | #define OSPFv3ASSCOPELSACHECKSUMSUM 7 |
| 57 | #define OSPFv3ORIGINATENEWLSAS 8 |
| 58 | #define OSPFv3RXNEWLSAS 9 |
| 59 | #define OSPFv3EXTLSACOUNT 10 |
| 60 | #define OSPFv3EXTAREALSDBLIMIT 11 |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 61 | #define OSPFv3EXITOVERFLOWINTERVAL 12 |
| 62 | #define OSPFv3DEMANDEXTENSIONS 13 |
| 63 | #define OSPFv3REFERENCEBANDWIDTH 14 |
| 64 | #define OSPFv3RESTARTSUPPORT 15 |
| 65 | #define OSPFv3RESTARTINTERVAL 16 |
| 66 | #define OSPFv3RESTARTSTRICTLSACHECKING 17 |
| 67 | #define OSPFv3RESTARTSTATUS 18 |
| 68 | #define OSPFv3RESTARTAGE 19 |
| 69 | #define OSPFv3RESTARTEXITREASON 20 |
| 70 | #define OSPFv3NOTIFICATIONENABLE 21 |
| 71 | #define OSPFv3STUBROUTERSUPPORT 22 |
| 72 | #define OSPFv3STUBROUTERADVERTISEMENT 23 |
| 73 | #define OSPFv3DISCONTINUITYTIME 24 |
| 74 | #define OSPFv3RESTARTTIME 25 |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 75 | |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 76 | /* OSPFv3 MIB Area Table values: ospfv3AreaTable */ |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 77 | #define OSPFv3IMPORTASEXTERN 2 |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 78 | #define OSPFv3AREASPFRUNS 3 |
| 79 | #define OSPFv3AREABDRRTRCOUNT 4 |
| 80 | #define OSPFv3AREAASBDRRTRCOUNT 5 |
| 81 | #define OSPFv3AREASCOPELSACOUNT 6 |
| 82 | #define OSPFv3AREASCOPELSACKSUMSUM 7 |
| 83 | #define OSPFv3AREASUMMARY 8 |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 84 | #define OSPFv3AREAROWSTATUS 9 |
| 85 | #define OSPFv3AREASTUBMETRIC 10 |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 86 | #define OSPFv3AREANSSATRANSLATORROLE 11 |
| 87 | #define OSPFv3AREANSSATRANSLATORSTATE 12 |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 88 | #define OSPFv3AREANSSATRANSLATORSTABINTERVAL 13 |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 89 | #define OSPFv3AREANSSATRANSLATOREVENTS 14 |
| 90 | #define OSPFv3AREASTUBMETRICTYPE 15 |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 91 | #define OSPFv3AREATEENABLED 16 |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 92 | |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 93 | /* OSPFv3 MIB AS Lsdb Table values: ospfv3AsLsdbTable */ |
| 94 | #define OSPFv3ASLSDBSEQUENCE 4 |
| 95 | #define OSPFv3ASLSDBAGE 5 |
| 96 | #define OSPFv3ASLSDBCHECKSUM 6 |
| 97 | #define OSPFv3ASLSDBADVERTISEMENT 7 |
| 98 | #define OSPFv3ASLSDBTYPEKNOWN 8 |
| 99 | |
| 100 | /* OSPFv3 MIB Area Lsdb Table values: ospfv3AreaLsdbTable */ |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 101 | #define OSPFv3AREALSDBSEQUENCE 5 |
| 102 | #define OSPFv3AREALSDBAGE 6 |
| 103 | #define OSPFv3AREALSDBCHECKSUM 7 |
| 104 | #define OSPFv3AREALSDBADVERTISEMENT 8 |
| 105 | #define OSPFv3AREALSDBTYPEKNOWN 9 |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 106 | |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 107 | /* OSPFv3 MIB Link Lsdb Table values: ospfv3LinkLsdbTable */ |
| 108 | #define OSPFv3LINKLSDBSEQUENCE 6 |
| 109 | #define OSPFv3LINKLSDBAGE 7 |
| 110 | #define OSPFv3LINKLSDBCHECKSUM 8 |
| 111 | #define OSPFv3LINKLSDBADVERTISEMENT 9 |
| 112 | #define OSPFv3LINKLSDBTYPEKNOWN 10 |
| 113 | |
| 114 | /* OSPFv3 MIB Host Table values: ospfv3HostTable */ |
| 115 | #define OSPFv3HOSTMETRIC 3 |
| 116 | #define OSPFv3HOSTROWSTATUS 4 |
| 117 | #define OSPFv3HOSTAREAID 5 |
| 118 | |
| 119 | /* OSPFv3 MIB Interface Table values: ospfv3IfTable */ |
| 120 | #define OSPFv3IFAREAID 3 |
| 121 | #define OSPFv3IFTYPE 4 |
| 122 | #define OSPFv3IFADMINSTATUS 5 |
| 123 | #define OSPFv3IFRTRPRIORITY 6 |
| 124 | #define OSPFv3IFTRANSITDELAY 7 |
| 125 | #define OSPFv3IFRETRANSINTERVAL 8 |
| 126 | #define OSPFv3IFHELLOINTERVAL 9 |
| 127 | #define OSPFv3IFRTRDEADINTERVAL 10 |
| 128 | #define OSPFv3IFPOLLINTERVAL 11 |
| 129 | #define OSPFv3IFSTATE 12 |
| 130 | #define OSPFv3IFDESIGNATEDROUTER 13 |
| 131 | #define OSPFv3IFBACKUPDESIGNATEDROUTER 14 |
| 132 | #define OSPFv3IFEVENTS 15 |
| 133 | #define OSPFv3IFROWSTATUS 16 |
| 134 | #define OSPFv3IFDEMAND 17 |
| 135 | #define OSPFv3IFMETRICVALUE 18 |
| 136 | #define OSPFv3IFLINKSCOPELSACOUNT 19 |
| 137 | #define OSPFv3IFLINKLSACKSUMSUM 20 |
| 138 | #define OSPFv3IFDEMANDNBRPROBE 21 |
| 139 | #define OSPFv3IFDEMANDNBRPROBERETRANSLIMIT 22 |
| 140 | #define OSPFv3IFDEMANDNBRPROBEINTERVAL 23 |
| 141 | #define OSPFv3IFTEDISABLED 24 |
| 142 | #define OSPFv3IFLINKLSASUPPRESSION 25 |
| 143 | |
| 144 | /* OSPFv3 MIB Virtual Interface Table values: ospfv3VirtIfTable */ |
| 145 | #define OSPFv3VIRTIFINDEX 3 |
| 146 | #define OSPFv3VIRTIFINSTID 4 |
| 147 | #define OSPFv3VIRTIFTRANSITDELAY 5 |
| 148 | #define OSPFv3VIRTIFRETRANSINTERVAL 6 |
| 149 | #define OSPFv3VIRTIFHELLOINTERVAL 7 |
| 150 | #define OSPFv3VIRTIFRTRDEADINTERVAL 8 |
| 151 | #define OSPFv3VIRTIFSTATE 9 |
| 152 | #define OSPFv3VIRTIFEVENTS 10 |
| 153 | #define OSPFv3VIRTIFROWSTATUS 11 |
| 154 | #define OSPFv3VIRTIFLINKSCOPELSACOUNT 12 |
| 155 | #define OSPFv3VIRTIFLINKLSACKSUMSUM 13 |
| 156 | |
| 157 | /* OSPFv3 MIB Neighbors Table values: ospfv3NbrTable */ |
| 158 | #define OSPFv3NBRADDRESSTYPE 4 |
| 159 | #define OSPFv3NBRADDRESS 5 |
| 160 | #define OSPFv3NBROPTIONS 6 |
| 161 | #define OSPFv3NBRPRIORITY 7 |
| 162 | #define OSPFv3NBRSTATE 8 |
| 163 | #define OSPFv3NBREVENTS 9 |
| 164 | #define OSPFv3NBRLSRETRANSQLEN 10 |
| 165 | #define OSPFv3NBRHELLOSUPPRESSED 11 |
| 166 | #define OSPFv3NBRIFID 12 |
| 167 | #define OSPFv3NBRRESTARTHELPERSTATUS 13 |
| 168 | #define OSPFv3NBRRESTARTHELPERAGE 14 |
| 169 | #define OSPFv3NBRRESTARTHELPEREXITREASON 15 |
| 170 | |
| 171 | /* OSPFv3 MIB Configured Neighbors Table values: ospfv3CfgNbrTable */ |
| 172 | #define OSPFv3CFGNBRPRIORITY 5 |
| 173 | #define OSPFv3CFGNBRROWSTATUS 6 |
| 174 | |
| 175 | /* OSPFv3 MIB Virtual Neighbors Table values: ospfv3VirtNbrTable */ |
| 176 | #define OSPFv3VIRTNBRIFINDEX 3 |
| 177 | #define OSPFv3VIRTNBRIFINSTID 4 |
| 178 | #define OSPFv3VIRTNBRADDRESSTYPE 5 |
| 179 | #define OSPFv3VIRTNBRADDRESS 6 |
| 180 | #define OSPFv3VIRTNBROPTIONS 7 |
| 181 | #define OSPFv3VIRTNBRSTATE 8 |
| 182 | #define OSPFv3VIRTNBREVENTS 9 |
| 183 | #define OSPFv3VIRTNBRLSRETRANSQLEN 10 |
| 184 | #define OSPFv3VIRTNBRHELLOSUPPRESSED 11 |
| 185 | #define OSPFv3VIRTNBRIFID 12 |
| 186 | #define OSPFv3VIRTNBRRESTARTHELPERSTATUS 13 |
| 187 | #define OSPFv3VIRTNBRRESTARTHELPERAGE 14 |
| 188 | #define OSPFv3VIRTNBRRESTARTHELPEREXITREASON 15 |
| 189 | |
| 190 | /* OSPFv3 MIB Area Aggregate Table values: ospfv3AreaAggregateTable */ |
| 191 | #define OSPFv3AREAAGGREGATEROWSTATUS 6 |
| 192 | #define OSPFv3AREAAGGREGATEEFFECT 7 |
| 193 | #define OSPFv3AREAAGGREGATEROUTETAG 8 |
| 194 | |
| 195 | /* OSPFv3 MIB Virtual Link Lsdb Table values: ospfv3VirtLinkLsdbTable */ |
| 196 | #define OSPFv3VIRTLINKLSDBSEQUENCE 6 |
| 197 | #define OSPFv3VIRTLINKLSDBAGE 7 |
| 198 | #define OSPFv3VIRTLINKLSDBCHECKSUM 8 |
| 199 | #define OSPFv3VIRTLINKLSDBADVERTISEMENT 9 |
| 200 | #define OSPFv3VIRTLINKLSDBTYPEKNOWN 10 |
| 201 | |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 202 | /* SYNTAX Status from OSPF-MIB. */ |
| 203 | #define OSPF_STATUS_ENABLED 1 |
| 204 | #define OSPF_STATUS_DISABLED 2 |
| 205 | |
| 206 | /* SNMP value hack. */ |
| 207 | #define COUNTER ASN_COUNTER |
| 208 | #define INTEGER ASN_INTEGER |
| 209 | #define GAUGE ASN_GAUGE |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 210 | #define UNSIGNED ASN_UNSIGNED |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 211 | #define TIMETICKS ASN_TIMETICKS |
| 212 | #define IPADDRESS ASN_IPADDRESS |
| 213 | #define STRING ASN_OCTET_STR |
| 214 | |
| 215 | /* For return values e.g. SNMP_INTEGER macro */ |
| 216 | SNMP_LOCAL_VARIABLES |
| 217 | |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 218 | /* OSPFv3-MIB instances. */ |
| 219 | oid ospfv3_oid [] = { OSPFv3MIB }; |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 220 | |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 221 | /* Hook functions. */ |
Chris Caputo | 0be8dfb | 2009-06-02 18:40:07 +0100 | [diff] [blame] | 222 | static u_char *ospfv3GeneralGroup (struct variable *, oid *, size_t *, |
| 223 | int, size_t *, WriteMethod **); |
| 224 | static u_char *ospfv3AreaEntry (struct variable *, oid *, size_t *, |
| 225 | int, size_t *, WriteMethod **); |
| 226 | static u_char *ospfv3AreaLsdbEntry (struct variable *, oid *, size_t *, |
| 227 | int, size_t *, WriteMethod **); |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 228 | |
| 229 | struct variable ospfv3_variables[] = |
| 230 | { |
| 231 | /* OSPF general variables */ |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 232 | {OSPFv3ROUTERID, UNSIGNED, RWRITE, ospfv3GeneralGroup, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 233 | 3, {1, 1, 1}}, |
| 234 | {OSPFv3ADMINSTAT, INTEGER, RWRITE, ospfv3GeneralGroup, |
| 235 | 3, {1, 1, 2}}, |
| 236 | {OSPFv3VERSIONNUMBER, INTEGER, RONLY, ospfv3GeneralGroup, |
| 237 | 3, {1, 1, 3}}, |
| 238 | {OSPFv3AREABDRRTRSTATUS, INTEGER, RONLY, ospfv3GeneralGroup, |
| 239 | 3, {1, 1, 4}}, |
| 240 | {OSPFv3ASBDRRTRSTATUS, INTEGER, RWRITE, ospfv3GeneralGroup, |
| 241 | 3, {1, 1, 5}}, |
| 242 | {OSPFv3ASSCOPELSACOUNT, GAUGE, RONLY, ospfv3GeneralGroup, |
| 243 | 3, {1, 1, 6}}, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 244 | {OSPFv3ASSCOPELSACHECKSUMSUM,UNSIGNED, RONLY, ospfv3GeneralGroup, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 245 | 3, {1, 1, 7}}, |
| 246 | {OSPFv3ORIGINATENEWLSAS, COUNTER, RONLY, ospfv3GeneralGroup, |
| 247 | 3, {1, 1, 8}}, |
| 248 | {OSPFv3RXNEWLSAS, COUNTER, RONLY, ospfv3GeneralGroup, |
| 249 | 3, {1, 1, 9}}, |
| 250 | {OSPFv3EXTLSACOUNT, GAUGE, RONLY, ospfv3GeneralGroup, |
| 251 | 3, {1, 1, 10}}, |
| 252 | {OSPFv3EXTAREALSDBLIMIT, INTEGER, RWRITE, ospfv3GeneralGroup, |
| 253 | 3, {1, 1, 11}}, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 254 | {OSPFv3EXITOVERFLOWINTERVAL, UNSIGNED, RWRITE, ospfv3GeneralGroup, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 255 | 3, {1, 1, 12}}, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 256 | {OSPFv3DEMANDEXTENSIONS, INTEGER, RWRITE, ospfv3GeneralGroup, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 257 | 3, {1, 1, 13}}, |
| 258 | {OSPFv3REFERENCEBANDWIDTH, UNSIGNED, RWRITE, ospfv3GeneralGroup, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 259 | 3, {1, 1, 14}}, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 260 | {OSPFv3RESTARTSUPPORT, INTEGER, RWRITE, ospfv3GeneralGroup, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 261 | 3, {1, 1, 15}}, |
| 262 | {OSPFv3RESTARTINTERVAL, UNSIGNED, RWRITE, ospfv3GeneralGroup, |
| 263 | 3, {1, 1, 16}}, |
| 264 | {OSPFv3RESTARTSTRICTLSACHECKING, INTEGER, RWRITE, ospfv3GeneralGroup, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 265 | 3, {1, 1, 17}}, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 266 | {OSPFv3RESTARTSTATUS, INTEGER, RONLY, ospfv3GeneralGroup, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 267 | 3, {1, 1, 18}}, |
| 268 | {OSPFv3RESTARTAGE, UNSIGNED, RONLY, ospfv3GeneralGroup, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 269 | 3, {1, 1, 19}}, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 270 | {OSPFv3RESTARTEXITREASON, INTEGER, RONLY, ospfv3GeneralGroup, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 271 | 3, {1, 1, 20}}, |
| 272 | {OSPFv3NOTIFICATIONENABLE, INTEGER, RWRITE, ospfv3GeneralGroup, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 273 | 3, {1, 1, 21}}, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 274 | {OSPFv3STUBROUTERSUPPORT, INTEGER, RONLY, ospfv3GeneralGroup, |
| 275 | 3, {1, 1, 22}}, |
| 276 | {OSPFv3STUBROUTERADVERTISEMENT, INTEGER, RWRITE, ospfv3GeneralGroup, |
| 277 | 3, {1, 1, 23}}, |
| 278 | {OSPFv3DISCONTINUITYTIME, TIMETICKS, RONLY, ospfv3GeneralGroup, |
| 279 | 3, {1, 1, 24}}, |
| 280 | {OSPFv3RESTARTTIME, TIMETICKS, RONLY, ospfv3GeneralGroup, |
| 281 | 3, {1, 1, 25}}, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 282 | |
| 283 | /* OSPFv3 Area Data Structure */ |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 284 | {OSPFv3IMPORTASEXTERN, INTEGER, RWRITE, ospfv3AreaEntry, |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 285 | 4, {1, 2, 1, 2}}, |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 286 | {OSPFv3AREASPFRUNS, COUNTER, RONLY, ospfv3AreaEntry, |
| 287 | 4, {1, 2, 1, 3}}, |
| 288 | {OSPFv3AREABDRRTRCOUNT, GAUGE, RONLY, ospfv3AreaEntry, |
| 289 | 4, {1, 2, 1, 4}}, |
| 290 | {OSPFv3AREAASBDRRTRCOUNT, GAUGE, RONLY, ospfv3AreaEntry, |
| 291 | 4, {1, 2, 1, 5}}, |
| 292 | {OSPFv3AREASCOPELSACOUNT, GAUGE, RONLY, ospfv3AreaEntry, |
| 293 | 4, {1, 2, 1, 6}}, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 294 | {OSPFv3AREASCOPELSACKSUMSUM, UNSIGNED, RONLY, ospfv3AreaEntry, |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 295 | 4, {1, 2, 1, 7}}, |
| 296 | {OSPFv3AREASUMMARY, INTEGER, RWRITE, ospfv3AreaEntry, |
| 297 | 4, {1, 2, 1, 8}}, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 298 | {OSPFv3AREAROWSTATUS, INTEGER, RWRITE, ospfv3AreaEntry, |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 299 | 4, {1, 2, 1, 9}}, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 300 | {OSPFv3AREASTUBMETRIC, INTEGER, RWRITE, ospfv3AreaEntry, |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 301 | 4, {1, 2, 1, 10}}, |
| 302 | {OSPFv3AREANSSATRANSLATORROLE, INTEGER, RWRITE, ospfv3AreaEntry, |
| 303 | 4, {1, 2, 1, 11}}, |
| 304 | {OSPFv3AREANSSATRANSLATORSTATE, INTEGER, RONLY, ospfv3AreaEntry, |
| 305 | 4, {1, 2, 1, 12}}, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 306 | {OSPFv3AREANSSATRANSLATORSTABINTERVAL, UNSIGNED, RWRITE, ospfv3AreaEntry, |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 307 | 4, {1, 2, 1, 13}}, |
| 308 | {OSPFv3AREANSSATRANSLATOREVENTS, COUNTER, RONLY, ospfv3AreaEntry, |
| 309 | 4, {1, 2, 1, 14}}, |
| 310 | {OSPFv3AREASTUBMETRICTYPE, INTEGER, RWRITE, ospfv3AreaEntry, |
| 311 | 4, {1, 2, 1, 15}}, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 312 | {OSPFv3AREATEENABLED, INTEGER, RWRITE, ospfv3AreaEntry, |
| 313 | 4, {1, 2, 1, 16}}, |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 314 | |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 315 | /* OSPFv3 Area LSDB */ |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 316 | {OSPFv3AREALSDBSEQUENCE, INTEGER, RONLY, ospfv3AreaLsdbEntry, |
| 317 | 4, {1, 4, 1, 5}}, |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 318 | {OSPFv3AREALSDBAGE, UNSIGNED, RONLY, ospfv3AreaLsdbEntry, |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 319 | 4, {1, 4, 1, 6}}, |
| 320 | {OSPFv3AREALSDBCHECKSUM, INTEGER, RONLY, ospfv3AreaLsdbEntry, |
| 321 | 4, {1, 4, 1, 7}}, |
| 322 | {OSPFv3AREALSDBADVERTISEMENT, STRING, RONLY, ospfv3AreaLsdbEntry, |
| 323 | 4, {1, 4, 1, 8}}, |
| 324 | {OSPFv3AREALSDBTYPEKNOWN, INTEGER, RONLY, ospfv3AreaLsdbEntry, |
| 325 | 4, {1, 4, 1, 9}}, |
| 326 | |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 327 | }; |
| 328 | |
| 329 | static u_char * |
| 330 | ospfv3GeneralGroup (struct variable *v, oid *name, size_t *length, |
| 331 | int exact, size_t *var_len, WriteMethod **write_method) |
| 332 | { |
| 333 | /* Check whether the instance identifier is valid */ |
| 334 | if (smux_header_generic (v, name, length, exact, var_len, write_method) |
| 335 | == MATCH_FAILED) |
| 336 | return NULL; |
| 337 | |
| 338 | /* Return the current value of the variable */ |
| 339 | switch (v->magic) |
| 340 | { |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 341 | case OSPFv3ROUTERID: |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 342 | /* Router-ID of this OSPF instance. */ |
| 343 | if (ospf6) |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 344 | return SNMP_INTEGER (ntohl (ospf6->router_id)); |
| 345 | return SNMP_INTEGER (0); |
| 346 | case OSPFv3ADMINSTAT: |
| 347 | case OSPFv3VERSIONNUMBER: |
| 348 | case OSPFv3AREABDRRTRSTATUS: |
| 349 | case OSPFv3ASBDRRTRSTATUS: |
| 350 | case OSPFv3ASSCOPELSACOUNT: |
| 351 | case OSPFv3ASSCOPELSACHECKSUMSUM: |
| 352 | case OSPFv3ORIGINATENEWLSAS: |
| 353 | case OSPFv3RXNEWLSAS: |
| 354 | case OSPFv3EXTLSACOUNT: |
| 355 | case OSPFv3EXTAREALSDBLIMIT: |
| 356 | case OSPFv3EXITOVERFLOWINTERVAL: |
| 357 | case OSPFv3DEMANDEXTENSIONS: |
| 358 | case OSPFv3REFERENCEBANDWIDTH: |
| 359 | case OSPFv3RESTARTSUPPORT: |
| 360 | case OSPFv3RESTARTINTERVAL: |
| 361 | case OSPFv3RESTARTSTRICTLSACHECKING: |
| 362 | case OSPFv3RESTARTSTATUS: |
| 363 | case OSPFv3RESTARTAGE: |
| 364 | case OSPFv3RESTARTEXITREASON: |
| 365 | case OSPFv3NOTIFICATIONENABLE: |
| 366 | case OSPFv3STUBROUTERSUPPORT: |
| 367 | case OSPFv3STUBROUTERADVERTISEMENT: |
| 368 | case OSPFv3DISCONTINUITYTIME: |
| 369 | case OSPFv3RESTARTTIME: |
| 370 | /* TODO: Not implemented */ |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 371 | return NULL; |
| 372 | } |
| 373 | return NULL; |
| 374 | } |
| 375 | |
| 376 | static u_char * |
| 377 | ospfv3AreaEntry (struct variable *v, oid *name, size_t *length, |
| 378 | int exact, size_t *var_len, WriteMethod **write_method) |
| 379 | { |
| 380 | struct ospf6_area *oa, *area = NULL; |
| 381 | u_int32_t area_id = 0; |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 382 | struct listnode *node; |
| 383 | unsigned int len; |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 384 | char a[16]; |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 385 | |
| 386 | if (ospf6 == NULL) |
| 387 | return NULL; |
| 388 | |
Vincent Bernat | 8046ba6 | 2012-05-31 13:30:28 +0200 | [diff] [blame] | 389 | if (smux_header_table(v, name, length, exact, var_len, write_method) |
| 390 | == MATCH_FAILED) |
| 391 | return NULL; |
| 392 | |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 393 | len = *length - v->namelen; |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 394 | len = (len >= 1 ? sizeof 1 : 0); |
| 395 | if (exact && len != 1) |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 396 | return NULL; |
| 397 | if (len) |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 398 | area_id = htonl (name[v->namelen]); |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 399 | |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 400 | inet_ntop (AF_INET, &area_id, a, sizeof (a)); |
Andrew J. Schorr | eda9ba7 | 2007-04-27 18:13:15 +0000 | [diff] [blame] | 401 | zlog_debug ("SNMP access by area: %s, exact=%d len=%d length=%lu", |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 402 | a, exact, len, (u_long)*length); |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 403 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 404 | for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa)) |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 405 | { |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 406 | if (area == NULL) |
| 407 | { |
| 408 | if (len == 0) /* return first area entry */ |
| 409 | area = oa; |
| 410 | else if (exact && ntohl (oa->area_id) == ntohl (area_id)) |
| 411 | area = oa; |
| 412 | else if (ntohl (oa->area_id) > ntohl (area_id)) |
| 413 | area = oa; |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | if (area == NULL) |
| 418 | return NULL; |
| 419 | |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 420 | *length = v->namelen + 1; |
| 421 | name[v->namelen] = ntohl (area->area_id); |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 422 | |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 423 | inet_ntop (AF_INET, &area->area_id, a, sizeof (a)); |
Andrew J. Schorr | eda9ba7 | 2007-04-27 18:13:15 +0000 | [diff] [blame] | 424 | zlog_debug ("SNMP found area: %s, exact=%d len=%d length=%lu", |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 425 | a, exact, len, (u_long)*length); |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 426 | |
| 427 | switch (v->magic) |
| 428 | { |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 429 | case OSPFv3IMPORTASEXTERN: |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 430 | return SNMP_INTEGER (ospf6->external_table->count); |
| 431 | break; |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 432 | case OSPFv3AREASPFRUNS: |
| 433 | case OSPFv3AREABDRRTRCOUNT: |
| 434 | case OSPFv3AREAASBDRRTRCOUNT: |
| 435 | case OSPFv3AREASCOPELSACOUNT: |
| 436 | case OSPFv3AREASCOPELSACKSUMSUM: |
| 437 | case OSPFv3AREASUMMARY: |
| 438 | case OSPFv3AREAROWSTATUS: |
| 439 | case OSPFv3AREASTUBMETRIC: |
| 440 | case OSPFv3AREANSSATRANSLATORROLE: |
| 441 | case OSPFv3AREANSSATRANSLATORSTATE: |
| 442 | case OSPFv3AREANSSATRANSLATORSTABINTERVAL: |
| 443 | case OSPFv3AREANSSATRANSLATOREVENTS: |
| 444 | case OSPFv3AREASTUBMETRICTYPE: |
| 445 | case OSPFv3AREATEENABLED: |
| 446 | /* Not implemented. */ |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 447 | return NULL; |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 448 | } |
| 449 | return NULL; |
| 450 | } |
| 451 | |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 452 | static u_char * |
| 453 | ospfv3AreaLsdbEntry (struct variable *v, oid *name, size_t *length, |
| 454 | int exact, size_t *var_len, WriteMethod **write_method) |
| 455 | { |
| 456 | struct ospf6_lsa *lsa = NULL; |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 457 | u_int32_t area_id, id, adv_router; |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 458 | u_int16_t type; |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 459 | int len; |
| 460 | oid *offset; |
| 461 | int offsetlen; |
| 462 | char a[16], b[16], c[16]; |
| 463 | struct ospf6_area *oa; |
hasso | b3c8c46 | 2004-11-26 12:55:51 +0000 | [diff] [blame] | 464 | struct listnode *node; |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 465 | |
Vincent Bernat | 8046ba6 | 2012-05-31 13:30:28 +0200 | [diff] [blame] | 466 | if (smux_header_table(v, name, length, exact, var_len, write_method) |
| 467 | == MATCH_FAILED) |
| 468 | return NULL; |
| 469 | |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 470 | area_id = type = id = adv_router = 0; |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 471 | |
| 472 | /* Check OSPFv3 instance. */ |
| 473 | if (ospf6 == NULL) |
| 474 | return NULL; |
| 475 | |
| 476 | /* Get variable length. */ |
| 477 | offset = name + v->namelen; |
| 478 | offsetlen = *length - v->namelen; |
| 479 | |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 480 | #define OSPFV3_AREA_LSDB_ENTRY_EXACT_OFFSET 4 |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 481 | |
| 482 | if (exact && offsetlen != OSPFV3_AREA_LSDB_ENTRY_EXACT_OFFSET) |
| 483 | return NULL; |
| 484 | |
| 485 | /* Parse area-id */ |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 486 | len = (offsetlen < 1 ? 0 : 1); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 487 | if (len) |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 488 | area_id = htonl (*offset); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 489 | offset += len; |
| 490 | offsetlen -= len; |
| 491 | |
| 492 | /* Parse type */ |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 493 | len = (offsetlen < 1 ? 0 : 1); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 494 | if (len) |
| 495 | type = htons (*offset); |
| 496 | offset += len; |
| 497 | offsetlen -= len; |
| 498 | |
| 499 | /* Parse Router-ID */ |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 500 | len = (offsetlen < 1 ? 0 : 1); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 501 | if (len) |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 502 | adv_router = htonl (*offset); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 503 | offset += len; |
| 504 | offsetlen -= len; |
| 505 | |
| 506 | /* Parse LS-ID */ |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 507 | len = (offsetlen < 1 ? 0 : 1); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 508 | if (len) |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 509 | id = htonl (*offset); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 510 | offset += len; |
| 511 | offsetlen -= len; |
| 512 | |
| 513 | inet_ntop (AF_INET, &area_id, a, sizeof (a)); |
| 514 | inet_ntop (AF_INET, &adv_router, b, sizeof (b)); |
| 515 | inet_ntop (AF_INET, &id, c, sizeof (c)); |
Andrew J. Schorr | eda9ba7 | 2007-04-27 18:13:15 +0000 | [diff] [blame] | 516 | zlog_debug ("SNMP access by lsdb: area=%s exact=%d length=%lu magic=%d" |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 517 | " type=%#x adv_router=%s id=%s", |
Andrew J. Schorr | eda9ba7 | 2007-04-27 18:13:15 +0000 | [diff] [blame] | 518 | a, exact, (u_long)*length, v->magic, ntohs (type), b, c); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 519 | |
| 520 | if (exact) |
| 521 | { |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 522 | oa = ospf6_area_lookup (area_id, ospf6); |
| 523 | lsa = ospf6_lsdb_lookup (type, id, adv_router, oa->lsdb); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 524 | } |
| 525 | else |
| 526 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 527 | for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa)) |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 528 | { |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 529 | if (lsa) |
| 530 | continue; |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 531 | if (oa->area_id < area_id) |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 532 | continue; |
| 533 | |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 534 | lsa = ospf6_lsdb_lookup_next (type, id, adv_router, |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 535 | oa->lsdb); |
| 536 | if (! lsa) |
| 537 | { |
| 538 | type = 0; |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 539 | id = 0; |
| 540 | adv_router = 0; |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 541 | } |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | if (! lsa) |
| 546 | { |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 547 | zlog_debug ("SNMP respond: No LSA to return"); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 548 | return NULL; |
| 549 | } |
| 550 | oa = OSPF6_AREA (lsa->lsdb->data); |
| 551 | |
hasso | c6487d6 | 2004-12-24 06:00:11 +0000 | [diff] [blame] | 552 | zlog_debug ("SNMP respond: area: %s lsa: %s", oa->name, lsa->name); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 553 | |
| 554 | /* Add Index (AreaId, Type, RouterId, Lsid) */ |
| 555 | *length = v->namelen + OSPFV3_AREA_LSDB_ENTRY_EXACT_OFFSET; |
| 556 | offset = name + v->namelen; |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 557 | *offset = ntohl (oa->area_id); |
| 558 | offset++; |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 559 | *offset = ntohs (lsa->header->type); |
| 560 | offset++; |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 561 | *offset = ntohl (lsa->header->adv_router); |
| 562 | offset++; |
| 563 | *offset = ntohl (lsa->header->id); |
| 564 | offset++; |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 565 | |
| 566 | /* Return the current value of the variable */ |
| 567 | switch (v->magic) |
| 568 | { |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 569 | case OSPFv3AREALSDBSEQUENCE: |
| 570 | return SNMP_INTEGER (ntohl (lsa->header->seqnum)); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 571 | break; |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 572 | case OSPFv3AREALSDBAGE: |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 573 | ospf6_lsa_age_current (lsa); |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 574 | return SNMP_INTEGER (ntohs (lsa->header->age)); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 575 | break; |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 576 | case OSPFv3AREALSDBCHECKSUM: |
| 577 | return SNMP_INTEGER (ntohs (lsa->header->checksum)); |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 578 | break; |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 579 | case OSPFv3AREALSDBADVERTISEMENT: |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 580 | *var_len = ntohs (lsa->header->length); |
| 581 | return (u_char *) lsa->header; |
| 582 | break; |
Vincent Bernat | 0f0ab51 | 2012-05-22 13:34:24 +0200 | [diff] [blame^] | 583 | case OSPFv3AREALSDBTYPEKNOWN: |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 584 | return SNMP_INTEGER (OSPF6_LSA_IS_KNOWN (lsa->header->type) ? |
| 585 | SNMP_TRUE : SNMP_FALSE); |
| 586 | break; |
hasso | 2680aa2 | 2004-11-25 20:54:46 +0000 | [diff] [blame] | 587 | } |
| 588 | return NULL; |
| 589 | } |
| 590 | |
| 591 | |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 592 | /* Register OSPFv3-MIB. */ |
| 593 | void |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame] | 594 | ospf6_snmp_init (struct thread_master *master) |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 595 | { |
hasso | c75105a | 2004-10-13 10:33:26 +0000 | [diff] [blame] | 596 | smux_init (master); |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 597 | REGISTER_MIB ("OSPFv3MIB", ospfv3_variables, variable, ospfv3_oid); |
hasso | ef1bbf5 | 2004-10-08 12:04:21 +0000 | [diff] [blame] | 598 | } |
| 599 | |
| 600 | #endif /* HAVE_SNMP */ |
| 601 | |