2 * Routines for OSPF packet disassembly
3 * (c) Copyright Hannes R. Boehm <hannes@boehm.org>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 * At this time, this module is able to analyze OSPF
13 * packets as specified in RFC2328. MOSPF (RFC1584) and other
14 * OSPF Extensions which introduce new Packet types
15 * (e.g the External Attributes LSA) are not supported.
16 * Furthermore RFC2740 (OSPFv3 - OSPF for IPv6) is now supported
17 * - (c) 2001 Palle Lyckegaard <palle[AT]lyckegaard.dk>
19 * Added support to E-NNI routing (OIF2003.259.02)
20 * - (c) 2004 Roberto Morro <roberto.morro[AT]tilab.com>
22 * Added support for OSPF restart signaling:
23 * draft-nguyen-ospf-lls-05.txt
24 * draft-nguyen-ospf-oob-resync-05.txt
25 * draft-nguyen-ospf-restart-05.txt
26 * - (c) 2005 Michael Rozhavsky <mrozhavsky@fortinet.com>
28 * Added support of MPLS Diffserv-aware TE (RFC 4124); new BC sub-TLV
29 * - (c) 2006 (FF) <francesco.fondelli[AT]gmail.com>
31 * Added support for decoding the TLVs in a grace-LSA
32 * - (c) 2007 Todd J Martin <todd.martin@acm.org>
34 * Added support for draft-ietf-ospf-manet-or-02
35 * Added support for draft-ietf-ospf-af-alt-06
36 * - (c) 2008 Cisco Systems
38 * Added support for Multi-Topology (MT) Routing (RFC4915)
39 * - (c) 2009 Stig Bjorlykke <stig@bjorlykke.org>, Thales Norway AS
41 * Added support for OSPFv2 & OSPFv3 Router Information (RI) Opaque LSA (RFC4970); RI Capabilities TLV
42 * Added support for OSPFv2 & OSPFv3 Dynamic Hostname TLV in RI Opaque LSA (RFC5642)
43 * - (c) 2011 Salil Kanitkar <sskanitk@ncsu.edu>, North Carolina State University
45 * Added support for Type Classification of Experimental and Reserved sub-TLVs (RFC3630)
46 * - (c) 2013 Kaushal Shah <kshah3@ncsu.edu>, North Carolina State University
48 * Added support for Authentication Trailer for OSPFv3 (RFC6506)
49 * - (c) 2014 Alexis La Goutte (See AUTHORS)
51 * Added support for optical spectrum occupation for fixed grid WDM links (RFC 7688)
52 * Added support for optical spectrum occupation for flexi grid WDM links (RFC 8363)
53 * - (c) 2018 Julien Meuric <julien.meuric@orange.com>
54 * - (c) 2018 Khalifa Ndiaye <khalifa.ndiaye@orange.com>
56 * Added support for OSPFv3 Link State Advertisement Extensibility (RFC 8362)
57 * - (c) 2024 Jacob Lodge
62 #include <epan/packet.h>
64 #include <epan/capture_dissectors.h>
65 #include <epan/ipproto.h>
66 #include <epan/in_cksum.h>
67 #include <epan/expert.h>
68 #include <epan/addr_resolv.h>
69 #include <epan/unit_strings.h>
70 #include <wsutil/ws_roundup.h>
71 #include "packet-rsvp.h"
73 void proto_register_ospf(void);
74 void proto_reg_handoff_ospf(void);
76 static dissector_handle_t ospf_handle
;
77 static capture_dissector_handle_t ospf_cap_handle
;
79 #define OSPF_VERSION_2 2
80 #define OSPF_VERSION_3 3
83 #define OSPF_VERSION_2_HEADER_LENGTH 24
84 #define OSPF_VERSION_3_HEADER_LENGTH 16
88 #define OSPF_DB_DESC 2
92 #define OSPF_LS_BASE OSPF_HELLO
94 static const value_string pt_vals
[] = {
95 {OSPF_HELLO
, "Hello Packet" },
96 {OSPF_DB_DESC
, "DB Description" },
97 {OSPF_LS_REQ
, "LS Request" },
98 {OSPF_LS_UPD
, "LS Update" },
99 {OSPF_LS_ACK
, "LS Acknowledge" },
103 static const value_string ospf_at_authentication_type_vals
[] = {
105 {1, "HMAC Cryptographic Authentication" },
109 #define OSPF_AUTH_NONE 0
110 #define OSPF_AUTH_SIMPLE 1
111 #define OSPF_AUTH_CRYPT 2
113 static const value_string auth_vals
[] = {
114 {OSPF_AUTH_NONE
, "Null" },
115 {OSPF_AUTH_SIMPLE
, "Simple password" },
116 {OSPF_AUTH_CRYPT
, "Cryptographic" },
120 #define OSPF_V2_OPTIONS_MT 0x01
121 #define OSPF_V2_OPTIONS_E 0x02
122 #define OSPF_V2_OPTIONS_MC 0x04
123 #define OSPF_V2_OPTIONS_NP 0x08
124 #define OSPF_V2_OPTIONS_L 0x10
125 #define OSPF_V2_OPTIONS_DC 0x20
126 #define OSPF_V2_OPTIONS_O 0x40
127 #define OSPF_V2_OPTIONS_DN 0x80
128 #define OSPF_V3_OPTIONS_V6 0x000001
129 #define OSPF_V3_OPTIONS_E 0x000002
130 #define OSPF_V3_OPTIONS_MC 0x000004
131 #define OSPF_V3_OPTIONS_N 0x000008
132 #define OSPF_V3_OPTIONS_R 0x000010
133 #define OSPF_V3_OPTIONS_DC 0x000020
134 #define OSPF_V3_OPTIONS_AF 0x000100
135 #define OSPF_V3_OPTIONS_L 0x000200
136 #define OSPF_V3_OPTIONS_AT 0x000400
138 /* Bitmask definitions for the informational capabilities bits. */
139 #define OSPF_RI_OPTIONS_GRC 0x80
140 #define OSPF_RI_OPTIONS_GRH 0x40
141 #define OSPF_RI_OPTIONS_SRS 0x20
142 #define OSPF_RI_OPTIONS_TES 0x10
143 #define OSPF_RI_OPTIONS_P2PLAN 0x08
144 #define OSPF_RI_OPTIONS_ETE 0x04
145 #define OSPF_RI_OPTIONS_HOST 0x01
147 #define OSPF_LLS_EXT_OPTIONS_LR 0x00000001
148 #define OSPF_LLS_EXT_OPTIONS_RS 0x00000002
150 #define OSPF_V3_LLS_EXT_OPTIONS_LR 0x00000001
151 #define OSPF_V3_LLS_EXT_OPTIONS_RS 0x00000002
153 #define OSPF_V3_LLS_STATE_OPTIONS_R 0x80
154 #define OSPF_V3_LLS_STATE_OPTIONS_A 0x40
155 #define OSPF_V3_LLS_STATE_OPTIONS_N 0x20
156 #define OSPF_V3_LLS_RELAY_OPTIONS_A 0x80
157 #define OSPF_V3_LLS_RELAY_OPTIONS_N 0x40
159 #define OSPF_DBD_FLAG_MS 1
160 #define OSPF_DBD_FLAG_M 2
161 #define OSPF_DBD_FLAG_I 4
162 #define OSPF_DBD_FLAG_R 8
164 #define OSPF_LS_REQ_LENGTH 12
166 #define OSPF_LSTYPE_ROUTER 1
167 #define OSPF_LSTYPE_NETWORK 2
168 #define OSPF_LSTYPE_SUMMARY 3
169 #define OSPF_LSTYPE_ASBR 4
170 #define OSPF_LSTYPE_ASEXT 5
171 #define OSPF_LSTYPE_GRPMEMBER 6
172 #define OSPF_LSTYPE_ASEXT7 7
173 #define OSPF_LSTYPE_EXTATTR 8
174 #define OSPF_LSTYPE_BASE OSPF_LSTYPE_ROUTER
175 #define OSPF_V3_LSTYPE_ROUTER 1
176 #define OSPF_V3_LSTYPE_NETWORK 2
177 #define OSPF_V3_LSTYPE_INTER_AREA_PREFIX 3
178 #define OSPF_V3_LSTYPE_INTER_AREA_ROUTER 4
179 #define OSPF_V3_LSTYPE_AS_EXTERNAL 5
180 #define OSPF_V3_LSTYPE_GROUP_MEMBERSHIP 6
181 #define OSPF_V3_LSTYPE_NSSA 7
182 #define OSPF_V3_LSTYPE_LINK 8
183 #define OSPF_V3_LSTYPE_INTRA_AREA_PREFIX 9
184 #define OSPF_V3_LSTYPE_OPAQUE_RI 12
187 #define OSPF_V3_LSTYPE_E_ROUTER 33
188 #define OSPF_V3_LSTYPE_E_NETWORK 34
189 #define OSPF_V3_LSTYPE_E_INTER_AREA_PREFIX 35
190 #define OSPF_V3_LSTYPE_E_INTER_AREA_ROUTER 36
191 #define OSPF_V3_LSTYPE_E_AS_EXTERNAL 37
192 // Not to be used per RFC 8362 38
193 #define OSPF_V3_LSTYPE_E_TYPE_7 39
194 #define OSPF_V3_LSTYPE_E_LINK 40
195 #define OSPF_V3_LSTYPE_E_INTRA_AREA_PREFIX 41
197 /* Opaque LSA types */
198 #define OSPF_LSTYPE_OP_BASE 8
199 #define OSPF_LSTYPE_OP_LINKLOCAL 9
200 #define OSPF_LSTYPE_OP_AREALOCAL 10
201 #define OSPF_LSTYPE_OP_ASWIDE 11
203 #define OSPF_V3_LSA_FUNCTION_CODE_ROUTER 1
204 #define OSPF_V3_LSA_FUNCTION_CODE_NETWORK 2
205 #define OSPF_V3_LSA_FUNCTION_CODE_INTER_AREA_PREFIX 3
206 #define OSPF_V3_LSA_FUNCTION_CODE_INTER_AREA_ROUTER 4
207 #define OSPF_V3_LSA_FUNCTION_CODE_AS_EXTERNAL 5
208 #define OSPF_V3_LSA_FUNCTION_CODE_GROUP_MEMBERSHIP 6
209 #define OSPF_V3_LSA_FUNCTION_CODE_NSSA 7
210 #define OSPF_V3_LSA_FUNCTION_CODE_LINK 8
211 #define OSPF_V3_LSA_FUNCTION_CODE_INTRA_AREA_PREFIX 9
212 #define OSPF_V3_LSA_FUNCTION_CODE_BASE OSPF_V3_LSA_FUNCTION_CODE_ROUTER
213 #define OSPF_V3_LSA_FUNCTION_CODE_OPAQUE_RI 12
214 #define OSPF_V3_LSA_FUNCTION_CODE_OPAQUE_RI_BASE 9
216 #define OSPF_LINK_PTP 1
217 #define OSPF_LINK_TRANSIT 2
218 #define OSPF_LINK_STUB 3
219 #define OSPF_LINK_VIRTUAL 4
221 #define OSPF_V3_LINK_PTP 1
222 #define OSPF_V3_LINK_TRANSIT 2
223 #define OSPF_V3_LINK_RESERVED 3
224 #define OSPF_V3_LINK_VIRTUAL 4
226 #define OSPF_LSA_HEADER_LENGTH 20
228 #define OSPF_DNA_LSA 0x8000
229 /* Opaque Link-State Advertisements (LSA) Option Types
230 * https://www.iana.org/assignments/ospf-opaque-types/ospf-opaque-types.xhtml */
231 #define OSPF_LSA_MPLS_TE 1
232 #define OSPF_LSA_SYCAMORE 2
233 #define OSPF_LSA_GRACE 3
234 #define OSPF_LSA_OPAQUE_RI 4
235 #define OSPF_LSA_L1VPN 5
236 #define OSPF_LSA_IAS_TE_V2 6
237 #define OSPF_LSA_EXT_PREFIX 7
238 #define OSPF_LSA_EXT_LINK 8
239 #define OSPF_LSA_TTZ 9
240 #define OSPF_RESTART_REASON_UNKNOWN 0
241 #define OSPF_RESTART_REASON_SWRESTART 1
242 #define OSPF_RESTART_REASON_SWRELOAD 2
243 #define OSPF_RESTART_REASON_SWITCH 3
245 static const value_string restart_reason_vals
[] = {
246 {OSPF_RESTART_REASON_UNKNOWN
, "Unknown" },
247 {OSPF_RESTART_REASON_SWRESTART
, "Software Restart" },
248 {OSPF_RESTART_REASON_SWRELOAD
, "Software Reload/Upgrade" },
249 {OSPF_RESTART_REASON_SWITCH
, "Processor Switchover" },
253 /* grace-LSA TLV Types */
254 #define GRACE_TLV_PERIOD 1
255 #define GRACE_TLV_REASON 2
256 #define GRACE_TLV_IP 3
258 static const value_string grace_tlv_type_vals
[] = {
259 {GRACE_TLV_PERIOD
, "grace-LSA Grace Period"},
260 {GRACE_TLV_REASON
, "grace-LSA Restart Reason"},
261 {GRACE_TLV_IP
, "grace-LSA Restart IP"},
265 /* http://www.iana.org/assignments/ospf-parameters/ospf-parameters.xhtml#ri-tlv */
267 /* Opaque-LSA - Router Informational Capabilities: TLV Types*/
268 #define OPAQUE_TLV_RI 1
269 #define OPAQUE_TLV_RF 2
270 #define OPAQUE_TLV_TMG_IP4 3
271 #define OPAQUE_TLV_TMG_IP6 4
272 #define OPAQUE_TLV_TNCD 5
273 #define OPAQUE_TLV_PCED 6
274 #define OPAQUE_TLV_DH 7
275 #define OPAQUE_TLV_SA 8
276 #define OPAQUE_TLV_SLR 9
277 #define OPAQUE_TLV_NAT 10
278 #define OPAQUE_TLV_SBD 11
279 #define OPAQUE_TLV_NODE_MSD 12
280 #define OPAQUE_TLV_TUNN_ENCAPS 13
281 #define OPAQUE_TLV_SRLB 14
282 #define OPAQUE_TLV_SRMS_PREF 15
283 #define OPAQUE_TLV_FLEX_ALGO_DEF 16
285 /* The Opaque RI LSA TLV types definitions. */
286 static const value_string ri_tlv_type_vals
[] = {
287 {OPAQUE_TLV_RI
, "Router Informational Capabilities" },
288 {OPAQUE_TLV_RF
, "Router Functional Capabilities" },
289 {OPAQUE_TLV_TMG_IP4
, "TE-MESH-GROUP TLV (IPv4)" },
290 {OPAQUE_TLV_TMG_IP6
, "TE-MESH-GROUP TLV (IPv6)" },
291 {OPAQUE_TLV_TNCD
, "TE Node Capability Descriptor" },
292 {OPAQUE_TLV_PCED
, "PCED" },
293 {OPAQUE_TLV_DH
, "OSPF Dynamic Hostname" },
294 {OPAQUE_TLV_SA
, "SR-Algorithm " },
295 {OPAQUE_TLV_SLR
, "SID/Label Range" },
296 {OPAQUE_TLV_NAT
, "Node Admin Tag " },
297 {OPAQUE_TLV_SBD
, "S-BFD Discriminator" },
298 {OPAQUE_TLV_NODE_MSD
, "Node MSD" },
299 {OPAQUE_TLV_TUNN_ENCAPS
, "Tunnel Encapsulations" },
300 {OPAQUE_TLV_SRLB
, "SR Local Block" },
301 {OPAQUE_TLV_SRMS_PREF
, "SRMS Preference" },
302 {OPAQUE_TLV_FLEX_ALGO_DEF
, "Flexible Algorithm Definition" },
306 static const value_string ri_lsa_sa_tlv_type_vals
[] = {
307 {0, "Shortest Path First" },
308 {1, "Strict Shortest Path First" },
312 /* https://www.iana.org/assignments/ospfv3-parameters/ospfv3-parameters.xhtml#extended-lsa-tlvs */
314 /* OSPFv3 Extended-LSA TLVS (RFC 8362)*/
315 #define OSPF6_TLV_RESERVED 0
316 #define OSPF6_TLV_ROUTER_LINK 1
317 #define OSPF6_TLV_ATTACHED_ROUTERS 2
318 #define OSPF6_TLV_INTER_AREA_PREFIX 3
319 #define OSPF6_TLV_INTER_AREA_ROUTER 4
320 #define OSPF6_TLV_EXTERNAL_PREFIX 5
321 #define OSPF6_TLV_INTRA_AREA_PREFIX 6
322 #define OSPF6_TLV_IPV6_LL_ADDR 7
323 #define OSPF6_TLV_IPV4_LL_ADDR 8
325 static const value_string ospf6_extended_lsa_tlv_type_vals
[] = {
326 {OSPF6_TLV_ROUTER_LINK
, "Router-Link TLV"},
327 {OSPF6_TLV_ATTACHED_ROUTERS
, "Attached-Routers TLV"},
328 {OSPF6_TLV_INTER_AREA_PREFIX
, "Inter-Area-Prefix TLV"},
329 {OSPF6_TLV_INTER_AREA_ROUTER
, "Inter-Area-Router TLV"},
330 {OSPF6_TLV_EXTERNAL_PREFIX
, "External-Prefix TLV"},
331 {OSPF6_TLV_INTRA_AREA_PREFIX
, "Intra-Area-Prefix TLV"},
332 {OSPF6_TLV_IPV6_LL_ADDR
, "IPv6 Link-Local Address TLV"},
333 {OSPF6_TLV_IPV4_LL_ADDR
, "IPv4 Link-Local Address TLV"},
338 /* OSPFv3 Extended-LSA Sub-TLVs */
339 #define OSPF6_STLV_RESERVED 0
340 #define OSPF6_STLV_IPV6_FWD_ADDR 1
341 #define OSPF6_STLV_IPV4_FWD_ADDR 2
343 /* IGP MSD Type (rfc8491) */
344 #define IGP_MSD_TYPE_RESERVED 0
345 #define IGP_MSD_TYPE_MPLS 1
346 #define IGP_MSD_TYPE_SEGMENT_LEFT 41
347 #define IGP_MSD_TYPE_END_POP 42
348 #define IGP_MSD_TYPE_T_INSERT 43
349 #define IGP_MSD_TYPE_T_ENCAP 44
350 #define IGP_MSD_TYPE_END_D 45
352 static const value_string ospf_igp_msd_types
[] = {
353 { IGP_MSD_TYPE_RESERVED
, "Reserved" },
354 { IGP_MSD_TYPE_MPLS
, "Base MPLS Imposition" },
355 { IGP_MSD_TYPE_SEGMENT_LEFT
, "Maximum Segments Left" },
356 { IGP_MSD_TYPE_END_POP
, "Maximum End Pop" },
357 { IGP_MSD_TYPE_T_INSERT
, "Maximum T.Insert" },
358 { IGP_MSD_TYPE_T_ENCAP
, "Maximum T.Encaps" },
359 { IGP_MSD_TYPE_END_D
, "Maximum End D" },
363 static const value_string ri_lsa_fad_metric_type_vals
[] = {
365 {1, "Min Unidirectional Link Delay" },
366 {2, "Traffic Engineering Metric" },
370 /* Flex Algo Definition Sub-TLV (draft-ietf-lsr-flex-algo-17) */
371 #define FAD_EXCLUDE_AG 1
372 #define FAD_INCLUDE_ANY_AG 2
373 #define FAD_INCLUDE_ALL_AG 3
374 #define FAD_DEF_FLAGS 4
375 #define FAD_EXCLUDE_SRLG 5
377 static const value_string ri_lsa_fad_stlv_type_vals
[] = {
378 { FAD_EXCLUDE_AG
, "Flexible Algorithm Exclude Admin Group"},
379 { FAD_INCLUDE_ANY_AG
, "Flexible Algorithm Include-Any Admin Group"},
380 { FAD_INCLUDE_ALL_AG
, "Flexible Algorithm Include-All Admin Group"},
381 { FAD_DEF_FLAGS
, "Flexible Algorithm Definition Flags"},
382 { FAD_EXCLUDE_SRLG
, "Flexible Algorithm Exclude SRLG"},
386 static const value_string ls_type_vals
[] = {
387 {OSPF_LSTYPE_ROUTER
, "Router-LSA" },
388 {OSPF_LSTYPE_NETWORK
, "Network-LSA" },
389 {OSPF_LSTYPE_SUMMARY
, "Summary-LSA (IP network)" },
390 {OSPF_LSTYPE_ASBR
, "Summary-LSA (ASBR)" },
391 {OSPF_LSTYPE_ASEXT
, "AS-External-LSA (ASBR)" },
392 {OSPF_LSTYPE_GRPMEMBER
, "Group Membership LSA" },
393 {OSPF_LSTYPE_ASEXT7
, "NSSA AS-External-LSA" },
394 {OSPF_LSTYPE_EXTATTR
, "External Attributes LSA" },
395 {OSPF_LSTYPE_OP_LINKLOCAL
, "Opaque LSA, Link-local scope" },
396 {OSPF_LSTYPE_OP_AREALOCAL
, "Opaque LSA, Area-local scope" },
397 {OSPF_LSTYPE_OP_ASWIDE
, "Opaque LSA, AS-local scope" },
402 static const value_string ls_opaque_type_vals
[] = {
403 {OSPF_LSA_MPLS_TE
, "Traffic Engineering LSA" },
404 {OSPF_LSA_SYCAMORE
, "Sycamore Optical Topology Descriptions" },
405 {OSPF_LSA_GRACE
, "Grace-LSA" },
406 {OSPF_LSA_OPAQUE_RI
, "Router Information (RI)" },
407 {OSPF_LSA_L1VPN
, "L1VPN LSA" },
408 {OSPF_LSA_IAS_TE_V2
, "Inter-AS-TE-v2 LSA" },
409 {OSPF_LSA_EXT_PREFIX
, "OSPFv2 Extended Prefix Opaque LSA" },
410 {OSPF_LSA_EXT_LINK
, "OSPFv2 Extended Link Opaque LSA" },
411 {OSPF_LSA_TTZ
, "TTZ LSA" },
415 static const value_string v3_ls_type_vals
[] = {
416 {OSPF_V3_LSTYPE_ROUTER
, "Router-LSA" },
417 {OSPF_V3_LSTYPE_NETWORK
, "Network-LSA" },
418 {OSPF_V3_LSTYPE_INTER_AREA_PREFIX
, "Inter-Area-Prefix-LSA" },
419 {OSPF_V3_LSTYPE_INTER_AREA_ROUTER
, "Inter-Area-Router-LSA" },
420 {OSPF_V3_LSTYPE_AS_EXTERNAL
, "AS-External-LSA" },
421 {OSPF_V3_LSTYPE_GROUP_MEMBERSHIP
, "Group-Membership-LSA" },
422 {OSPF_V3_LSTYPE_NSSA
, "NSSA-LSA" },
423 {OSPF_V3_LSTYPE_LINK
, "Link-LSA" },
424 {OSPF_V3_LSTYPE_INTRA_AREA_PREFIX
, "Intra-Area-Prefix-LSA" },
425 {OSPF_V3_LSTYPE_E_ROUTER
, "E-Router-LSA" },
426 {OSPF_V3_LSTYPE_E_NETWORK
, "E-Network-LSA" },
427 {OSPF_V3_LSTYPE_E_INTER_AREA_PREFIX
, "E-Inter-Area-Prefix-LSA" },
428 {OSPF_V3_LSTYPE_E_INTER_AREA_ROUTER
, "E-Inter-Area-Router-LSA" },
429 {OSPF_V3_LSTYPE_E_AS_EXTERNAL
, "E-AS-External-LSA" },
430 {OSPF_V3_LSTYPE_E_LINK
, "E-Link-LSA" },
431 {OSPF_V3_LSTYPE_E_INTRA_AREA_PREFIX
, "E-Intra-Area-Prefix-LSA" },
432 {OSPF_V3_LSTYPE_OPAQUE_RI
, "Router Information Opaque-LSA"},
436 static const value_string v3_ls_type_s12_vals
[] = {
437 {0, "Link-Local Scoping - Flooded only on originating link" },
438 {1, "Area Scoping - Flooded only in originating area" },
439 {2, "AS Scoping - Flooded throughout AS" },
444 static const true_false_string tfs_v3_ls_type_u
= {
445 "Treat the LSA as if it had link-local flooding scope",
446 "Store and flood the LSA as if the type is understood"
449 static const true_false_string tfs_lsa_external_type
= { "Type 2 (metric is larger than any other link state path)",
450 "Type 1 (metric is specified in the same units as interface cost)" };
452 static const value_string ospf_v3_lsa_type_vals
[] = {
453 {OSPF_V3_LINK_PTP
, "Point-to-point connection to another router"},
454 {OSPF_V3_LINK_TRANSIT
, "Connection to a transit network"},
455 {OSPF_LINK_STUB
, "Connection to a stub network"},
456 {OSPF_V3_LINK_VIRTUAL
, "Virtual link"},
460 static const value_string ospf_v3_lsa_type_short_vals
[] = {
461 {OSPF_V3_LINK_PTP
, "PTP"},
462 {OSPF_V3_LINK_TRANSIT
, "Transit"},
463 {OSPF_LINK_STUB
, "Stub"},
464 {OSPF_V3_LINK_VIRTUAL
, "Virtual"},
468 static const value_string ospf_v3_lsa_link_id_vals
[] = {
469 {OSPF_V3_LINK_PTP
, "Neighboring router's Router ID"},
470 {OSPF_V3_LINK_TRANSIT
, "IP address of Designated Router"},
471 {OSPF_LINK_STUB
, "IP network/subnet number"},
472 {OSPF_V3_LINK_VIRTUAL
, "Neighboring router's Router ID"},
476 /* OSPFv3 LLS TLV Types */
477 #define LLS_V2_EXT_OPT 1
478 #define LLS_V2_CRYPTO_OPT 2
479 #define LLS_V2_LI_ID_OPT 18
481 static const value_string lls_tlv_type_vals
[] = {
482 {LLS_V2_EXT_OPT
, "Extended options TLV" },
483 {LLS_V2_CRYPTO_OPT
, "Crypto Authentication TLV" },
484 {LLS_V2_LI_ID_OPT
, "Local Interface ID" },
488 /* OSPFv3 LLS TLV Types */
489 #define LLS_V3_EXT_OPT 1
490 #define LLS_V3_STATE_CHECK 3
491 #define LLS_V3_NBR_DROP 4
492 #define LLS_V3_RELAYS 7
493 #define LLS_V3_WILLING 8
494 #define LLS_V3_RQST_FROM 5
495 #define LLS_V3_FULL_STATE 6
497 static const value_string lls_v3_tlv_type_vals
[] = {
498 {LLS_V3_EXT_OPT
, "Extended Options TLV" },
499 {LLS_V3_STATE_CHECK
, "State Check Sequence TLV" },
500 {LLS_V3_NBR_DROP
, "Neighbor Drop TLV" },
501 {LLS_V3_RELAYS
, "Active Overlapping Relays TLV" },
502 {LLS_V3_WILLING
, "Willingness TLV" },
503 {LLS_V3_RQST_FROM
, "Request From LTV" },
504 {LLS_V3_FULL_STATE
, "Full State For TLV" },
508 static const value_string mpls_link_stlv_ltype_str
[] = {
509 {1, "Point-to-point"},
514 /* FF: from www.iana.org/assignments/bandwidth-constraints-model-ids */
515 static const range_string mpls_link_stlv_bcmodel_rvals
[] = {
516 { 0, 0, "(Russian Dolls Model - RDM)" },
517 { 1, 1, "(Maximum Allocation Model - MAM)" },
518 { 2, 2, "(Maximum Allocation with Reservation Model - MAR)" },
519 { 3, 239, "(Unassigned, Specification Required)" },
520 { 240, 255, "(Reserved, Private Use)" },
524 static const true_false_string tfs_arbitrary_standard
= { "Arbitrary", "Standard" };
526 #define OSPF_V2_ROUTER_LSA_FLAG_B 0x01
527 #define OSPF_V2_ROUTER_LSA_FLAG_E 0x02
528 #define OSPF_V2_ROUTER_LSA_FLAG_V 0x04
529 #define OSPF_V2_ROUTER_LSA_FLAG_W 0x08
530 #define OSPF_V2_ROUTER_LSA_FLAG_N 0x10
531 #define OSPF_V2_ROUTER_LSA_FLAG_S 0x20
532 #define OSPF_V2_ROUTER_LSA_FLAG_H 0x80
533 #define OSPF_V3_ROUTER_LSA_FLAG_B 0x01
534 #define OSPF_V3_ROUTER_LSA_FLAG_E 0x02
535 #define OSPF_V3_ROUTER_LSA_FLAG_V 0x04
536 #define OSPF_V3_ROUTER_LSA_FLAG_W 0x08
538 #define OSPF_V3_PREFIX_OPTION_NU 0x01
539 #define OSPF_V3_PREFIX_OPTION_LA 0x02
540 #define OSPF_V3_PREFIX_OPTION_MC 0x04
541 #define OSPF_V3_PREFIX_OPTION_P 0x08
543 #define OSPF_V3_AS_EXTERNAL_FLAG_T 0x01
544 #define OSPF_V3_AS_EXTERNAL_FLAG_F 0x02
545 #define OSPF_V3_AS_EXTERNAL_FLAG_E 0x04
547 /* OSPFv2 Extended Prefix LSA TLV types definitions. (RFC7684) */
548 /* OSPF Extended Prefix TLV Registry */
549 #define EXT_PREFIX_TLV_PREFIX 1
550 #define EXT_PREFIX_TLV_PREFIX_RANGE 2
552 #define EXT_PREFIX_TLV_ROUTE_UNSPEC 0
553 #define EXT_PREFIX_TLV_ROUTE_INTRA 1
554 #define EXT_PREFIX_TLV_ROUTE_INTER 3
555 #define EXT_PREFIX_TLV_ROUTE_ASEXT 5
556 #define EXT_PREFIX_TLV_ROUTE_NSSAEXT 7
558 #define EXT_PREFIX_TLV_AF_IPV4_UNI 0
560 #define EXT_PREFIX_TLV_FLAG_A 0x80
561 #define EXT_PREFIX_TLV_FLAG_N 0x40
562 #define EXT_PREFIX_TLV_FLAG_UNKNOWN ~(EXT_PREFIX_TLV_FLAG_A | EXT_PREFIX_TLV_FLAG_N)
564 #define EXT_PREFIX_RANGE_TLV_FLAG_IA 0x80
565 #define EXT_PREFIX_RANGE_TLV_FLAG_UNKNOWN ~(EXT_PREFIX_RANGE_TLV_FLAG_IA)
567 static const value_string ext_pfx_tlv_type_vals
[] = {
568 {EXT_PREFIX_TLV_PREFIX
, "OSPFv2 Extended Prefix" },
569 {EXT_PREFIX_TLV_PREFIX_RANGE
, "OSPFv2 Extended Prefix Range" },
572 static const value_string ext_pfx_tlv_route_vals
[] = {
573 {EXT_PREFIX_TLV_ROUTE_UNSPEC
, "Unspecified" },
574 {EXT_PREFIX_TLV_ROUTE_INTRA
, "Intra-Area" },
575 {EXT_PREFIX_TLV_ROUTE_INTER
, "Inter-Area" },
576 {EXT_PREFIX_TLV_ROUTE_ASEXT
, "AS-External" },
577 {EXT_PREFIX_TLV_ROUTE_NSSAEXT
, "NSSA-External" },
580 static const value_string ext_pfx_tlv_af_vals
[] = {
581 {EXT_PREFIX_TLV_AF_IPV4_UNI
, "IPv4 Unicast" },
585 /* OSPF Extended Prefix Sub-TLV Registry */
586 #define SR_STLV_SID_LABEL 1
587 #define SR_STLV_PREFIX_SID 2
589 #define SR_STLV_PFXSID_FLAG_NP 0x40
590 #define SR_STLV_PFXSID_FLAG_M 0x20
591 #define SR_STLV_PFXSID_FLAG_E 0x10
592 #define SR_STLV_PFXSID_FLAG_V 0x08
593 #define SR_STLV_PFXSID_FLAG_L 0x04
594 #define SR_STLV_PFXSID_FLAG_UNKNOWN ~(SR_STLV_PFXSID_FLAG_NP | SR_STLV_PFXSID_FLAG_M | SR_STLV_PFXSID_FLAG_E | SR_STLV_PFXSID_FLAG_V | SR_STLV_PFXSID_FLAG_L)
596 static const value_string ext_pfx_stlv_type_vals
[] = {
597 {SR_STLV_SID_LABEL
, "SID/Label" },
598 {SR_STLV_PREFIX_SID
, "Prefix SID" },
602 /* OSPFv2 Extended Link LSA TLV types definitions. (RFC7684) */
603 /* OSPF Extended Link TLV Registry */
604 #define EXT_LINK_TLV_LINK 1
606 static const value_string ext_link_tlv_type_vals
[] = {
607 {EXT_LINK_TLV_LINK
, "OSPFv2 Extended Link" },
611 /* OSPF Extended Link Sub-TLV Registry */
612 #define SR_STLV_ADJSID 2
613 #define SR_STLV_LAN_ADJSID 3
614 #define SR_STLV_LINK_MSD 6
615 #define SR_STLV_GRACEFUL_LINK_SHUTDOWN 7
616 #define SR_STLV_REMOTE_IPV4_ADDRESS 8
617 #define SR_STLV_LOCAL_REMOTE_INTERFACE_ID 9
618 #define SR_STLV_APP_SPEC_LINK_ATTR 10
619 #define SR_STLV_UNIDIR_LINK_DELAY 12
620 #define SR_STLV_UNIDIR_LINK_DELAY_MIN_MAX 13
621 #define SR_STLV_UNIDIR_DELAY_VARIATION 14
622 #define SR_STLV_ADMIN_GROUP 19
623 #define SR_STLV_EXT_ADMIN_GROUP 20
624 #define SR_STLV_TE_METRIC 22
626 #define SR_STLV_ADJSID_FLAG_B 0x80
627 #define SR_STLV_ADJSID_FLAG_V 0x40
628 #define SR_STLV_ADJSID_FLAG_L 0x20
629 #define SR_STLV_ADJSID_FLAG_G 0x10
630 #define SR_STLV_ADJSID_FLAG_P 0x08
631 #define SR_STLV_ADJSID_FLAG_UNKNOWN ~(SR_STLV_ADJSID_FLAG_B | SR_STLV_ADJSID_FLAG_V | SR_STLV_ADJSID_FLAG_L | SR_STLV_ADJSID_FLAG_G | SR_STLV_ADJSID_FLAG_P)
633 static const value_string ext_link_stlv_type_vals
[] = {
634 {SR_STLV_SID_LABEL
, "SID/Label" },
635 {SR_STLV_ADJSID
, "Adj-SID" },
636 {SR_STLV_LAN_ADJSID
, "LAN Adj-SID" },
637 {SR_STLV_LINK_MSD
, "Link MSD" },
638 {SR_STLV_GRACEFUL_LINK_SHUTDOWN
, "Graceful Link Shutdown" },
639 {SR_STLV_REMOTE_IPV4_ADDRESS
, "Remote IPv4 Address" },
640 {SR_STLV_LOCAL_REMOTE_INTERFACE_ID
, "Local/Remote Interface ID" },
641 {SR_STLV_APP_SPEC_LINK_ATTR
, "Application-Specific Link Attributes"},
642 {SR_STLV_UNIDIR_LINK_DELAY
, "Unidirectional Link Delay" },
643 {SR_STLV_UNIDIR_LINK_DELAY_MIN_MAX
, "Min/Max Unidirectional Link Delay"},
644 {SR_STLV_UNIDIR_DELAY_VARIATION
, "Unidirectional Delay Variation"},
645 {SR_STLV_ADMIN_GROUP
, "Administrative Group" },
646 {SR_STLV_EXT_ADMIN_GROUP
, "Extended Administrative Group"},
647 {SR_STLV_TE_METRIC
, "TE Metric" },
651 static int proto_ospf
;
654 static int ett_ospf_at
;
655 static int ett_ospf_hdr
;
656 static int ett_ospf_hello
;
657 static int ett_ospf_desc
;
658 static int ett_ospf_lsr
;
659 static int ett_ospf_lsa
;
660 static int ett_ospf_elsa
;
661 static int ett_ospf_elsa_pfx_tlv
;
662 static int ett_ospf_lsa_router_link
;
663 static int ett_ospf_lsa_upd
;
664 static int ett_ospf_v2_options
;
665 static int ett_ospf_ri_options
;
666 static int ett_ospf_v3_options
;
667 static int ett_ospf_dbd
;
668 static int ett_ospf_lls_data_block
;
669 static int ett_ospf_lls_tlv
;
670 static int ett_ospf_lls_ext_options
;
671 static int ett_ospf_v3_lls_ext_options_tlv
;
672 static int ett_ospf_v3_lls_ext_options
;
673 static int ett_ospf_v3_lls_state_tlv
;
674 static int ett_ospf_v3_lls_state_scs
;
675 static int ett_ospf_v3_lls_state_options
;
676 static int ett_ospf_v3_lls_drop_tlv
;
677 static int ett_ospf_v3_lls_relay_tlv
;
678 static int ett_ospf_v3_lls_relay_added
;
679 static int ett_ospf_v3_lls_relay_options
;
680 static int ett_ospf_v3_lls_willingness_tlv
;
681 static int ett_ospf_v3_lls_willingness
;
682 static int ett_ospf_v3_lls_rf_tlv
;
683 static int ett_ospf_v3_lls_fsf_tlv
;
684 static int ett_ospf_v2_router_lsa_flags
;
685 static int ett_ospf_v3_router_lsa_flags
;
686 static int ett_ospf_v3_as_external_flags
;
687 static int ett_ospf_v3_prefix_options
;
688 static int ett_ospf_v3_router_interface
;
689 static int ett_ospf_v3_router_interface_entry
;
690 static int ett_ospf_mpls_pri
;
691 static int ett_ospf_mpls_bitmap
;
693 /* Trees for opaque LSAs */
694 static int ett_ospf_lsa_mpls
;
695 static int ett_ospf_lsa_mpls_bandwidth_sstlv
;
696 static int ett_ospf_lsa_mpls_base_label
;
697 static int ett_ospf_lsa_mpls_router
;
698 static int ett_ospf_lsa_mpls_link
;
699 static int ett_ospf_lsa_mpls_link_stlv
;
700 static int ett_ospf_lsa_mpls_link_stlv_admingrp
;
701 static int ett_ospf_lsa_oif_tna
;
702 static int ett_ospf_lsa_oif_tna_stlv
;
703 static int ett_ospf_lsa_grace_tlv
;
704 static int ett_ospf_lsa_opaque_ri
;
705 static int ett_ospf_lsa_ri_tlv
;
706 static int ett_ospf_lsa_dh_tlv
;
707 static int ett_ospf_lsa_sa_tlv
;
708 static int ett_ospf_lsa_slr_tlv
;
709 static int ett_ospf_lsa_slr_stlv
;
710 static int ett_ospf_lsa_srms_tlv
;
711 static int ett_ospf_lsa_node_msd_tlv
;
712 static int ett_ospf_lsa_fad_tlv
;
713 static int ett_ospf_lsa_fad_stlv
;
714 static int ett_ospf_lsa_elink
;
715 static int ett_ospf_lsa_epfx
;
716 static int ett_ospf_lsa_elink_tlv
;
717 static int ett_ospf_lsa_elink_stlv
;
718 static int ett_ospf_lsa_epfx_tlv
;
719 static int ett_ospf_lsa_epfx_flags
;
720 static int ett_ospf_lsa_epfx_stlv
;
721 static int ett_ospf_lsa_epfx_range_flags
;
722 static int ett_ospf_lsa_pfxsid_flags
;
723 static int ett_ospf_lsa_adjsid_flags
;
724 static int ett_ospf_lsa_app_sabm_bits
;
725 static int ett_ospf_lsa_app_link_attrs_stlv
;
726 static int ett_ospf_lsa_unidir_link_flags
;
727 static int ett_ospf_lsa_unknown_tlv
;
729 static int ett_ospf_lsa_type
;
732 /* The Options field in the first TLV of the Opaque RI LSA with type field set to "4" for OSPFv2
733 and type field set to "12" in OSPFv3, is interpreted as advertizing optional router capabilties.
735 static const true_false_string tfs_v3_as_external_flags_e
= {
740 /*-----------------------------------------------------------------------
742 *-----------------------------------------------------------------------*/
745 static int hf_ospf_msg_hello
;
746 static int hf_ospf_msg_db_desc
;
747 static int hf_ospf_msg_ls_req
;
748 static int hf_ospf_msg_ls_upd
;
749 static int hf_ospf_msg_ls_ack
;
751 static int *hf_ospf_msg_type_array
[] = {
753 &hf_ospf_msg_db_desc
,
759 static int hf_ospf_ls_type
;
760 static int hf_ospf_ls_age
;
761 static int hf_ospf_ls_donotage
;
762 static int hf_ospf_ls_id
;
763 static int hf_ospf_ls_seqnum
;
764 static int hf_ospf_ls_chksum
;
765 static int hf_ospf_ls_length
;
766 static int hf_ospf_ls_opaque_type
;
767 static int hf_ospf_ls_mpls_te_instance
;
769 /* OSPF V2 LSA Type */
770 static int hf_ospf_ls_router
;
771 static int hf_ospf_ls_router_linktype
;
772 static int hf_ospf_ls_router_linkid
;
773 static int hf_ospf_ls_router_linkdata
;
774 static int hf_ospf_ls_router_nummetrics
;
775 static int hf_ospf_ls_router_metric0
;
776 static int hf_ospf_ls_network
;
777 static int hf_ospf_ls_network_netmask
;
778 static int hf_ospf_ls_network_attachrtr
;
779 static int hf_ospf_ls_summary
;
780 static int hf_ospf_ls_asbr
;
781 static int hf_ospf_ls_asbr_netmask
;
782 static int hf_ospf_ls_asext
;
783 static int hf_ospf_ls_asext_netmask
;
784 static int hf_ospf_ls_asext_fwdaddr
;
785 static int hf_ospf_ls_asext_extrtrtag
;
786 static int hf_ospf_ls_grpmember
;
787 static int hf_ospf_ls_asext7
;
788 static int hf_ospf_ls_extattr
;
789 static int hf_ospf_ls_opaque
;
791 static int *hf_ospf_ls_type_array
[] = {
797 &hf_ospf_ls_grpmember
,
803 static int hf_ospf_v3_ls_type
;
804 static int hf_ospf_v3_ls_type_u
;
805 static int hf_ospf_v3_ls_type_s12
;
806 static int hf_ospf_v3_ls_type_fc
;
808 /* OSPF V3 LSA Type */
809 static int hf_ospf_v3_ls_router
;
810 static int hf_ospf_v3_ls_network
;
811 static int hf_ospf_v3_ls_inter_area_prefix
;
812 static int hf_ospf_v3_ls_inter_area_router
;
813 static int hf_ospf_v3_ls_as_external
;
814 static int hf_ospf_v3_ls_group_membership
;
815 static int hf_ospf_v3_ls_nssa
;
816 static int hf_ospf_v3_ls_link
;
817 static int hf_ospf_v3_ls_intra_area_prefix
;
818 static int hf_ospf_v3_ls_opaque_ri
;
820 static int hf_ospf_v3_elsa_intra_area_prefix
;
822 static int *hf_ospf_v3_ls_type_array
[] = {
823 &hf_ospf_v3_ls_router
,
824 &hf_ospf_v3_ls_network
,
825 &hf_ospf_v3_ls_inter_area_prefix
,
826 &hf_ospf_v3_ls_inter_area_router
,
827 &hf_ospf_v3_ls_as_external
,
828 &hf_ospf_v3_ls_group_membership
,
831 &hf_ospf_v3_ls_intra_area_prefix
,
832 &hf_ospf_v3_ls_opaque_ri
,
833 &hf_ospf_v3_elsa_intra_area_prefix
836 static int hf_ospf_adv_router
;
837 static int hf_ospf_ls_mpls
;
838 static int hf_ospf_ls_mpls_routerid
;
839 static int hf_ospf_ls_mpls_linktype
;
840 static int hf_ospf_ls_mpls_linkid
;
841 static int hf_ospf_ls_mpls_local_addr
;
842 static int hf_ospf_ls_mpls_remote_addr
;
843 static int hf_ospf_ls_mpls_local_ifid
;
844 static int hf_ospf_ls_mpls_remote_ifid
;
845 static int hf_ospf_ls_mpls_te_metric
;
846 static int hf_ospf_ls_mpls_linkcolor
;
847 static int hf_ospf_ls_mpls_group
;
848 static int hf_ospf_ls_mpls_link_max_bw
;
849 static int hf_ospf_ls_mpls_bc_model_id
;
850 static int hf_ospf_ls_oif_local_node_id
;
851 static int hf_ospf_ls_oif_remote_node_id
;
852 static int hf_ospf_v2_options
;
853 static int hf_ospf_v2_options_mt
;
854 static int hf_ospf_v2_options_e
;
855 static int hf_ospf_v2_options_mc
;
856 static int hf_ospf_v2_options_n
;
857 static int hf_ospf_v2_options_p
;
858 static int hf_ospf_v2_options_l
;
859 static int hf_ospf_v2_options_dc
;
860 static int hf_ospf_v2_options_o
;
861 static int hf_ospf_v2_options_dn
;
863 static int hf_ospf_tlv_type_opaque
;
865 static int hf_ospf_ri_options
;
866 /* OSPF Router Informational Capabilities Options */
867 static int hf_ospf_ri_options_grc
;
868 static int hf_ospf_ri_options_grh
;
869 static int hf_ospf_ri_options_srs
;
870 static int hf_ospf_ri_options_tes
;
871 static int hf_ospf_ri_options_p2plan
;
872 static int hf_ospf_ri_options_ete
;
873 static int hf_ospf_ri_options_host
;
875 /* OSPF Extended Link Opaque LSA */
876 static int hf_ospf_ls_elink_tlv
;
877 static int hf_ospf_ls_elink_stlv
;
878 static int hf_ospf_ls_elink_mt_id
;
879 static int hf_ospf_ls_elink_weight
;
880 static int hf_ospf_ls_elink_nbr
;
881 static int hf_ospf_ls_pfxsid_flags
;
882 static int hf_ospf_ls_pfxsid_flag_np
;
883 static int hf_ospf_ls_pfxsid_flag_m
;
884 static int hf_ospf_ls_pfxsid_flag_e
;
885 static int hf_ospf_ls_pfxsid_flag_v
;
886 static int hf_ospf_ls_pfxsid_flag_l
;
887 static int hf_ospf_ls_pfxsid_flag_unknown
;
888 static int hf_ospf_ls_adjsid_flags
;
889 static int hf_ospf_ls_adjsid_flag_b
;
890 static int hf_ospf_ls_adjsid_flag_v
;
891 static int hf_ospf_ls_adjsid_flag_l
;
892 static int hf_ospf_ls_adjsid_flag_g
;
893 static int hf_ospf_ls_adjsid_flag_p
;
894 static int hf_ospf_ls_adjsid_flag_unknown
;
895 static int hf_ospf_ls_app_sabm_length
;
896 static int hf_ospf_ls_app_udabm_length
;
897 static int hf_ospf_ls_app_sabm_bits
;
898 static int hf_ospf_ls_app_sabm_bits_r
;
899 static int hf_ospf_ls_app_sabm_bits_s
;
900 static int hf_ospf_ls_app_sabm_bits_f
;
901 static int hf_ospf_ls_app_sabm_bits_x
;
902 static int hf_ospf_ls_app_udabm_bits
;
903 static int hf_ospf_ls_app_link_attrs_stlv
;
904 static int hf_ospf_ls_admin_group
;
905 static int hf_ospf_ls_ext_admin_group
;
906 static int hf_ospf_ls_unidir_link_flags
;
907 static int hf_ospf_ls_unidir_link_flags_a
;
908 static int hf_ospf_ls_unidir_link_flags_reserved
;
909 static int hf_ospf_ls_unidir_link_delay
;
910 static int hf_ospf_ls_unidir_link_reserved
;
911 static int hf_ospf_ls_unidir_link_delay_min
;
912 static int hf_ospf_ls_unidir_link_delay_max
;
913 static int hf_ospf_ls_unidir_delay_variation
;
915 /* OSPF Extended Prefix Opaque LSA */
916 static int hf_ospf_ls_epfx_tlv
;
917 static int hf_ospf_ls_epfx_stlv
;
918 static int hf_ospf_ls_epfx_route_type
;
919 static int hf_ospf_ls_epfx_af
;
920 static int hf_ospf_ls_epfx_flags
;
921 static int hf_ospf_ls_epfx_flag_a
;
922 static int hf_ospf_ls_epfx_flag_n
;
923 static int hf_ospf_ls_epfx_flag_unknown
;
924 static int hf_ospf_ls_epfx_range_flags
;
925 static int hf_ospf_ls_epfx_range_flag_ia
;
926 static int hf_ospf_ls_epfx_range_flag_unknown
;
928 /* OSPF Dynamic Hostname support (RFC5642) */
929 static int hf_ospf_v3_options
;
930 static int hf_ospf_v3_options_v6
;
931 static int hf_ospf_v3_options_e
;
932 static int hf_ospf_v3_options_mc
;
933 static int hf_ospf_v3_options_n
;
934 static int hf_ospf_v3_options_r
;
935 static int hf_ospf_v3_options_dc
;
936 static int hf_ospf_v3_options_af
;
937 static int hf_ospf_v3_options_l
;
938 static int hf_ospf_v3_options_at
;
939 static int hf_ospf_dbd
;
940 static int hf_ospf_dbd_r
;
941 static int hf_ospf_dbd_i
;
942 static int hf_ospf_dbd_m
;
943 static int hf_ospf_dbd_ms
;
944 static int hf_ospf_lls_ext_options
;
945 static int hf_ospf_lls_ext_options_lr
;
946 static int hf_ospf_lls_ext_options_rs
;
947 static int hf_ospf_v2_router_lsa_flag
;
948 static int hf_ospf_v2_router_lsa_flag_b
;
949 static int hf_ospf_v2_router_lsa_flag_e
;
950 static int hf_ospf_v2_router_lsa_flag_v
;
951 static int hf_ospf_v2_router_lsa_flag_w
;
952 static int hf_ospf_v2_router_lsa_flag_n
;
953 static int hf_ospf_v2_router_lsa_flag_s
;
954 static int hf_ospf_v2_router_lsa_flag_h
;
955 static int hf_ospf_v3_router_lsa_flag
;
956 static int hf_ospf_v3_router_lsa_flag_b
;
957 static int hf_ospf_v3_router_lsa_flag_e
;
958 static int hf_ospf_v3_router_lsa_flag_v
;
959 static int hf_ospf_v3_router_lsa_flag_w
;
960 static int hf_ospf_v3_as_external_flag
;
961 static int hf_ospf_v3_as_external_flag_t
;
962 static int hf_ospf_v3_as_external_flag_f
;
963 static int hf_ospf_v3_as_external_flag_e
;
964 static int hf_ospf_v3_prefix_option
;
965 static int hf_ospf_v3_prefix_option_nu
;
966 static int hf_ospf_v3_prefix_option_la
;
967 static int hf_ospf_v3_prefix_option_mc
;
968 static int hf_ospf_v3_prefix_option_p
;
969 static int hf_ospf_dyn_hostname
;
970 static int hf_ospf_lsa_sa
;
971 static int hf_ospf_ls_slr_stlv
;
972 static int hf_ospf_ls_range_size
;
973 static int hf_ospf_ls_sid_label
;
974 static int hf_ospf_ls_preference
;
975 static int hf_ospf_ls_igp_msd_type
;
976 static int hf_ospf_ls_igp_msd_value
;
977 static int hf_ospf_ls_remote_ipv4_addr
;
978 static int hf_ospf_ls_local_interface_id
;
979 static int hf_ospf_ls_remote_interface_id
;
980 static int hf_ospf_ls_fad_flex_algorithm
;
981 static int hf_ospf_ls_fad_metric_type
;
982 static int hf_ospf_ls_fad_calc_type
;
983 static int hf_ospf_ls_fad_priority
;
984 static int hf_ospf_ls_fad_stlv
;
985 static int hf_ospf_unknown_tlv
;
986 static int hf_ospf_v2_grace_tlv
;
987 static int hf_ospf_v2_grace_period
;
988 static int hf_ospf_v2_grace_reason
;
989 static int hf_ospf_v2_grace_ip
;
990 static int hf_ospf_v3_lls_ext_options_tlv
;
991 static int hf_ospf_v3_lls_ext_options
;
992 static int hf_ospf_v3_lls_ext_options_lr
;
993 static int hf_ospf_v3_lls_ext_options_rs
;
994 static int hf_ospf_v3_lls_state_tlv
;
995 static int hf_ospf_v3_lls_state_scs
;
996 static int hf_ospf_v3_lls_state_options
;
997 static int hf_ospf_v3_lls_state_options_r
;
998 static int hf_ospf_v3_lls_state_options_a
;
999 static int hf_ospf_v3_lls_state_options_n
;
1000 static int hf_ospf_v3_lls_drop_tlv
;
1001 static int hf_ospf_v3_lls_relay_tlv
;
1002 static int hf_ospf_v3_lls_relay_added
;
1003 static int hf_ospf_v3_lls_relay_options
;
1004 static int hf_ospf_v3_lls_relay_options_a
;
1005 static int hf_ospf_v3_lls_relay_options_n
;
1006 static int hf_ospf_v3_lls_willingness_tlv
;
1007 static int hf_ospf_v3_lls_willingness
;
1008 static int hf_ospf_v3_lls_rf_tlv
;
1009 static int hf_ospf_v3_lls_fsf_tlv
;
1011 static int hf_ospf_header
;
1012 static int hf_ospf_header_version
;
1013 static int hf_ospf_header_msg_type
;
1014 static int hf_ospf_header_packet_length
;
1015 static int hf_ospf_header_src_router
;
1016 static int hf_ospf_header_area_id
;
1017 static int hf_ospf_header_checksum
;
1018 static int hf_ospf_tlv_type
;
1019 static int hf_ospf_tlv_length
;
1022 /* OSPF v3 Extended LSA TLV's RFC 8362*/
1023 static int hf_ospf_v3_e_lsa_tlv_type
;
1024 static int hf_ospf_v3_e_lsa_tlv_length
;
1026 /* Header OSPF v2 auth */
1027 static int hf_ospf_header_auth_type
;
1028 static int hf_ospf_header_auth_data_none
;
1029 static int hf_ospf_header_auth_data_simple
;
1030 static int hf_ospf_header_auth_crypt_key_id
;
1031 static int hf_ospf_header_auth_crypt_data_length
;
1032 static int hf_ospf_header_auth_crypt_seq_nbr
;
1033 static int hf_ospf_header_auth_crypt_data
;
1034 static int hf_ospf_header_auth_data_unknown
;
1036 /* Header OSPF v3 */
1037 static int hf_ospf_header_instance_id
;
1038 static int hf_ospf_header_reserved
;
1041 static int hf_ospf_hello
;
1042 static int hf_ospf_hello_network_mask
;
1043 static int hf_ospf_hello_interface_id
;
1044 static int hf_ospf_hello_hello_interval
;
1045 static int hf_ospf_hello_router_priority
;
1046 static int hf_ospf_hello_router_dead_interval
;
1047 static int hf_ospf_hello_designated_router
;
1048 static int hf_ospf_hello_backup_designated_router
;
1049 static int hf_ospf_hello_active_neighbor
;
1051 /* Authentication Trailer RFC6506 */
1052 static int hf_ospf_at
;
1053 static int hf_ospf_at_auth_type
;
1054 static int hf_ospf_at_auth_data_len
;
1055 static int hf_ospf_at_reserved
;
1056 static int hf_ospf_at_sa_id
;
1057 static int hf_ospf_at_crypto_seq_nbr
;
1058 static int hf_ospf_at_auth_data
;
1060 /* Generated from convert_proto_tree_add_text.pl */
1061 static int hf_ospf_referenced_advertising_router
;
1062 static int hf_ospf_v3_lsa_referenced_link_state_id
;
1063 static int hf_ospf_mpls_protection_capability
;
1064 static int hf_ospf_oif_encoding
;
1065 static int hf_ospf_ls_id_te_lsa_reserved
;
1066 static int hf_ospf_db_interface_mtu
;
1067 static int hf_ospf_v3_lls_full_state_for
;
1068 static int hf_ospf_v3_lsa_interface_id
;
1069 static int hf_ospf_v3_lsa_router_priority
;
1070 static int hf_ospf_v3_lsa_forwarding_address_ipv6
;
1071 static int hf_ospf_v3_lls_dropped_neighbor
;
1072 static int hf_ospf_v3_lsa_external_route_tag
;
1073 static int hf_ospf_tna_addr
;
1074 static int hf_ospf_v3_lsa_neighbor_router_id
;
1075 static int hf_ospf_mpls_switching_type
;
1076 static int hf_ospf_oif_tna_addr_length
;
1077 static int hf_ospf_oif_tna_addr_ipv4
;
1078 static int hf_ospf_link_state_id
;
1079 static int hf_ospf_ls_id_opaque_id
;
1080 static int hf_ospf_v2_lls_sequence_number
;
1081 static int hf_ospf_v3_lsa_do_not_age
;
1082 static int hf_ospf_lls_data_length
;
1083 static int hf_ospf_mpls_shared_risk_link_group
;
1084 static int hf_ospf_db_dd_sequence
;
1085 static int hf_ospf_v3_lsa_destination_router_id
;
1086 static int hf_ospf_tna_addr_ipv6
;
1087 static int hf_ospf_v3_lsa_link_local_interface_address
;
1088 static int hf_ospf_mpls_interface_mtu
;
1089 static int hf_ospf_v3_lsa_neighbor_interface_id
;
1090 static int hf_ospf_lsa_number_of_links
;
1091 static int hf_ospf_v2_lls_auth_data
;
1092 static int hf_ospf_v2_lls_li_id
;
1093 static int hf_ospf_oif_switching_cap
;
1094 static int hf_ospf_ls_number_of_lsas
;
1095 static int hf_ospf_v3_lls_neighbor
;
1096 static int hf_ospf_v3_lls_request_from
;
1097 static int hf_ospf_lls_checksum
;
1098 static int hf_ospf_v3_lsa_attached_router
;
1099 static int hf_ospf_v3_lsa_referenced_ls_type
;
1100 static int hf_ospf_mpls_encoding
;
1101 static int hf_ospf_mpls_num_labels
;
1102 static int hf_ospf_lsa_external_type
;
1103 static int hf_ospf_lsa_tos
;
1104 static int hf_ospf_lsa_external_tos
;
1105 static int hf_ospf_v3_lsa_type
;
1106 static int hf_ospf_metric
;
1107 static int hf_ospf_prefix_length
;
1108 static int hf_ospf_ls_mpls_pri
;
1109 static int hf_ospf_ls_mpls_bc
;
1110 static int hf_ospf_mpls_action
;
1111 static int hf_ospf_mpls_bandwidth_type
;
1112 static int hf_ospf_mpls_bitmap
;
1113 static int hf_ospf_mpls_grid
;
1114 static int hf_ospf_mpls_cs2
;
1115 static int hf_ospf_mpls_n
;
1116 static int hf_ospf_mpls_cs
;
1117 static int hf_ospf_mpls_length
;
1118 static int hf_ospf_mpls_minimum_lsp_bandwidth
;
1119 static int hf_ospf_mpls_pri
;
1120 static int hf_ospf_mpls_sonet_sdh
;
1121 static int hf_ospf_mpls_starting
;
1122 static int hf_ospf_mpls_no_effective_bits
;
1123 static int hf_ospf_mpls_type
;
1124 static int hf_ospf_oif_signal_type
;
1125 static int hf_ospf_tlv_value
;
1126 static int hf_ospf_oif_node_id
;
1127 static int hf_ospf_pad_bytes
;
1128 static int hf_ospf_ls_metric
;
1129 static int hf_ospf_v3_lsa_forwarding_address_ipv4
;
1130 static int hf_ospf_link_local_interface_address_ipv4
;
1131 static int hf_ospf_v3_lsa_num_prefixes
;
1132 static int hf_ospf_v3_address_prefix_ipv6
;
1133 static int hf_ospf_v3_address_prefix_ipv4
;
1135 static expert_field ei_ospf_header_reserved
;
1136 static expert_field ei_ospf_lsa_bad_length
;
1137 static expert_field ei_ospf_lsa_constraint_missing
;
1138 static expert_field ei_ospf_lsa_bc_error
;
1139 static expert_field ei_ospf_lsa_unknown_type
;
1140 static expert_field ei_ospf_unknown_link_subtype
;
1141 static expert_field ei_ospf_stlv_length_invalid
;
1143 static int ospf_msg_type_to_filter (uint8_t msg_type
)
1145 if (msg_type
>= OSPF_HELLO
&&
1146 msg_type
<= OSPF_LS_ACK
)
1147 return msg_type
- OSPF_LS_BASE
;
1151 static int ospf_ls_type_to_filter (uint8_t ls_type
)
1153 if (ls_type
>= OSPF_LSTYPE_ROUTER
&&
1154 ls_type
<= OSPF_LSTYPE_EXTATTR
)
1155 return ls_type
- OSPF_LSTYPE_BASE
;
1156 else if (ls_type
>= OSPF_LSTYPE_OP_LINKLOCAL
&&
1157 ls_type
<= OSPF_LSTYPE_OP_ASWIDE
)
1158 return OSPF_LSTYPE_OP_BASE
;
1163 static int ospf_v3_ls_type_to_filter (uint16_t ls_type
)
1165 uint16_t function_code
;
1167 function_code
= ls_type
& 0x1fff;
1168 if (function_code
>= OSPF_V3_LSA_FUNCTION_CODE_ROUTER
&&
1169 function_code
<= OSPF_V3_LSA_FUNCTION_CODE_INTRA_AREA_PREFIX
)
1170 return function_code
- OSPF_V3_LSA_FUNCTION_CODE_BASE
;
1171 else if (function_code
== OSPF_V3_LSA_FUNCTION_CODE_OPAQUE_RI
)
1172 return OSPF_V3_LSA_FUNCTION_CODE_OPAQUE_RI_BASE
;
1177 static int * const bf_dbd
[] = {
1184 static int * const bf_lls_ext_options
[] = {
1185 &hf_ospf_lls_ext_options_rs
,
1186 &hf_ospf_lls_ext_options_lr
,
1189 static int * const bf_v3_lls_ext_options
[] = {
1190 &hf_ospf_v3_lls_ext_options_lr
,
1191 &hf_ospf_v3_lls_ext_options_rs
,
1195 static int * const bf_v3_lls_state_options
[] = {
1196 &hf_ospf_v3_lls_state_options_r
,
1197 &hf_ospf_v3_lls_state_options_a
,
1198 &hf_ospf_v3_lls_state_options_n
,
1201 static int * const bf_v3_lls_relay_options
[] = {
1202 &hf_ospf_v3_lls_relay_options_a
,
1203 &hf_ospf_v3_lls_relay_options_n
,
1206 static int * const bf_v2_router_lsa_flags
[] = {
1207 &hf_ospf_v2_router_lsa_flag_h
,
1208 &hf_ospf_v2_router_lsa_flag_s
,
1209 &hf_ospf_v2_router_lsa_flag_n
,
1210 &hf_ospf_v2_router_lsa_flag_w
,
1211 &hf_ospf_v2_router_lsa_flag_v
,
1212 &hf_ospf_v2_router_lsa_flag_e
,
1213 &hf_ospf_v2_router_lsa_flag_b
,
1216 static int * const bf_v3_router_lsa_flags
[] = {
1217 &hf_ospf_v3_router_lsa_flag_w
,
1218 &hf_ospf_v3_router_lsa_flag_v
,
1219 &hf_ospf_v3_router_lsa_flag_e
,
1220 &hf_ospf_v3_router_lsa_flag_b
,
1223 static int * const bf_v3_as_external_flags
[] = {
1224 &hf_ospf_v3_as_external_flag_e
,
1225 &hf_ospf_v3_as_external_flag_f
,
1226 &hf_ospf_v3_as_external_flag_t
,
1229 static int * const bf_v2_options
[] = {
1230 &hf_ospf_v2_options_dn
,
1231 &hf_ospf_v2_options_o
,
1232 &hf_ospf_v2_options_dc
,
1233 &hf_ospf_v2_options_l
,
1234 &hf_ospf_v2_options_n
,
1235 &hf_ospf_v2_options_mc
,
1236 &hf_ospf_v2_options_e
,
1237 &hf_ospf_v2_options_mt
,
1240 static int * const bf_v2_options_lsa7
[] = {
1241 &hf_ospf_v2_options_dn
,
1242 &hf_ospf_v2_options_o
,
1243 &hf_ospf_v2_options_dc
,
1244 &hf_ospf_v2_options_l
,
1245 &hf_ospf_v2_options_p
,
1246 &hf_ospf_v2_options_mc
,
1247 &hf_ospf_v2_options_e
,
1248 &hf_ospf_v2_options_mt
,
1251 /* Structures for handling the bitfield of the Options field of Optional Router Capabilities LSA (RFC4970). */
1252 static int * const bf_ri_options
[] = {
1253 &hf_ospf_ri_options_grc
,
1254 &hf_ospf_ri_options_grh
,
1255 &hf_ospf_ri_options_srs
,
1256 &hf_ospf_ri_options_tes
,
1257 &hf_ospf_ri_options_p2plan
,
1258 &hf_ospf_ri_options_ete
,
1259 &hf_ospf_ri_options_host
,
1262 static int * const bf_v3_options
[] = {
1263 &hf_ospf_v3_options_at
,
1264 &hf_ospf_v3_options_l
,
1265 &hf_ospf_v3_options_af
,
1266 &hf_ospf_v3_options_dc
,
1267 &hf_ospf_v3_options_r
,
1268 &hf_ospf_v3_options_n
,
1269 &hf_ospf_v3_options_mc
,
1270 &hf_ospf_v3_options_e
,
1271 &hf_ospf_v3_options_v6
,
1274 static int * const bf_v3_prefix_options
[] = {
1275 &hf_ospf_v3_prefix_option_p
,
1276 &hf_ospf_v3_prefix_option_mc
,
1277 &hf_ospf_v3_prefix_option_la
,
1278 &hf_ospf_v3_prefix_option_nu
,
1281 static int * const bf_ospf_epfx_flags
[] = {
1282 &hf_ospf_ls_epfx_flag_a
,
1283 &hf_ospf_ls_epfx_flag_n
,
1284 &hf_ospf_ls_epfx_flag_unknown
,
1287 static int * const bf_ospf_epfx_range_flags
[] = {
1288 &hf_ospf_ls_epfx_range_flag_ia
,
1289 &hf_ospf_ls_epfx_range_flag_unknown
,
1292 static int * const bf_ospf_pfxsid_flags
[] = {
1293 &hf_ospf_ls_pfxsid_flag_np
,
1294 &hf_ospf_ls_pfxsid_flag_m
,
1295 &hf_ospf_ls_pfxsid_flag_e
,
1296 &hf_ospf_ls_pfxsid_flag_v
,
1297 &hf_ospf_ls_pfxsid_flag_l
,
1298 &hf_ospf_ls_pfxsid_flag_unknown
,
1301 static int * const bf_ospf_adjsid_flags
[] = {
1302 &hf_ospf_ls_adjsid_flag_b
,
1303 &hf_ospf_ls_adjsid_flag_v
,
1304 &hf_ospf_ls_adjsid_flag_l
,
1305 &hf_ospf_ls_adjsid_flag_g
,
1306 &hf_ospf_ls_adjsid_flag_p
,
1307 &hf_ospf_ls_adjsid_flag_unknown
,
1310 static int * const bf_ospf_app_sabm_bits
[] = {
1311 &hf_ospf_ls_app_sabm_bits_r
,
1312 &hf_ospf_ls_app_sabm_bits_s
,
1313 &hf_ospf_ls_app_sabm_bits_f
,
1314 &hf_ospf_ls_app_sabm_bits_x
,
1317 static int * const unidir_link_flags
[] = {
1318 &hf_ospf_ls_unidir_link_flags_a
,
1319 &hf_ospf_ls_unidir_link_flags_reserved
,
1323 static void dissect_ospf_hello(tvbuff_t
*, int, proto_tree
*, uint8_t, uint16_t);
1324 static void dissect_ospf_db_desc(tvbuff_t
*, packet_info
*, int, proto_tree
*, uint8_t, uint16_t, uint8_t);
1325 static void dissect_ospf_ls_req(tvbuff_t
*, packet_info
*, int, proto_tree
*, uint8_t, uint16_t);
1326 static void dissect_ospf_ls_upd(tvbuff_t
*, packet_info
*, int, proto_tree
*, uint8_t, uint16_t, uint8_t);
1327 static void dissect_ospf_ls_ack(tvbuff_t
*, packet_info
*, int, proto_tree
*, uint8_t, uint16_t, uint8_t);
1328 static int dissect_ospf_authentication_trailer(tvbuff_t
*, int, proto_tree
*);
1329 static void dissect_ospf_lls_data_block(tvbuff_t
*, packet_info
*, int, proto_tree
*, uint8_t);
1331 /* dissect_ospf_v[23]lsa returns the offset of the next LSA
1332 * if disassemble_body is set to false (e.g. in LSA ACK
1333 * packets), the offset is set to the offset of the next
1336 static int dissect_ospf_v2_lsa(tvbuff_t
*, packet_info
*, int, proto_tree
*, bool disassemble_body
);
1337 static int dissect_ospf_v3_lsa(tvbuff_t
*, packet_info
*, int, proto_tree
*, bool disassemble_body
,
1340 static void dissect_ospf_v3_address_prefix(tvbuff_t
*, packet_info
*, int, int, proto_tree
*, uint8_t);
1343 ospf_has_lls_block(tvbuff_t
*tvb
, int offset
, uint8_t packet_type
, uint8_t version
)
1348 /* LLS block can be found only in HELLO and DBDESC packets */
1349 switch (packet_type
) {
1352 case OSPF_VERSION_2
:
1353 flags
= tvb_get_uint8 (tvb
, offset
+ 6);
1354 return flags
& OSPF_V2_OPTIONS_L
;
1355 case OSPF_VERSION_3
:
1356 v3flags
= tvb_get_ntohl(tvb
, offset
+ 5);
1357 v3flags
= v3flags
>> 8;
1358 return v3flags
& OSPF_V3_OPTIONS_L
;
1363 case OSPF_VERSION_2
:
1364 flags
= tvb_get_uint8 (tvb
, offset
+ 2);
1365 return flags
& OSPF_V2_OPTIONS_L
;
1366 case OSPF_VERSION_3
:
1367 v3flags
= tvb_get_ntohl(tvb
, offset
+ 1);
1368 v3flags
= v3flags
>> 8;
1369 return v3flags
& OSPF_V3_OPTIONS_L
;
1378 ospf_has_at_block(tvbuff_t
*tvb
, int offset
, uint8_t packet_type
, uint8_t version
)
1382 /* AT (Authentication Trailer) block can be found in OSPFv3 HELLO and DD packets */
1383 switch (packet_type
) {
1386 case OSPF_VERSION_3
:
1387 v3flags
= tvb_get_ntohl(tvb
, offset
+ 5);
1388 v3flags
= v3flags
>> 8;
1389 return v3flags
& OSPF_V3_OPTIONS_AT
;
1394 case OSPF_VERSION_3
:
1395 v3flags
= tvb_get_ntohl(tvb
, offset
+ 1);
1396 v3flags
= v3flags
>> 8;
1397 return v3flags
& OSPF_V3_OPTIONS_AT
;
1406 capture_ospf(const unsigned char *pd _U_
, int offset _U_
, int len _U_
, capture_packet_info_t
*cpinfo
, const union wtap_pseudo_header
*pseudo_header _U_
)
1408 capture_dissector_increment_count(cpinfo
, proto_ospf
);
1413 dissect_ospf(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
1415 proto_tree
*ospf_tree
= NULL
;
1416 proto_item
*ti
, *ti_sum
, *hidden_item
;
1417 proto_tree
*ospf_header_tree
;
1419 uint8_t packet_type
;
1424 uint16_t cksum
, computed_cksum
;
1425 unsigned length
, reported_length
;
1428 unsigned int ospf_header_length
;
1429 uint8_t instance_id
;
1431 uint8_t address_family
= OSPF_AF_6
;
1433 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "OSPF");
1434 col_clear(pinfo
->cinfo
, COL_INFO
);
1436 version
= tvb_get_uint8(tvb
, 0);
1438 case OSPF_VERSION_2
:
1439 ospf_header_length
= OSPF_VERSION_2_HEADER_LENGTH
;
1441 case OSPF_VERSION_3
:
1442 ospf_header_length
= OSPF_VERSION_3_HEADER_LENGTH
;
1445 ospf_header_length
= 14;
1449 packet_type
= tvb_get_uint8(tvb
, 1);
1450 col_add_str(pinfo
->cinfo
, COL_INFO
,
1451 val_to_str(packet_type
, pt_vals
, "Unknown (%u)"));
1453 ospflen
= tvb_get_ntohs(tvb
, 2);
1455 ti
= proto_tree_add_item(tree
, proto_ospf
, tvb
, 0, -1, ENC_NA
);
1456 ospf_tree
= proto_item_add_subtree(ti
, ett_ospf
);
1459 ti
= proto_tree_add_item(ospf_tree
, hf_ospf_header
, tvb
, 0, ospf_header_length
, ENC_NA
);
1460 ospf_header_tree
= proto_item_add_subtree(ti
, ett_ospf_hdr
);
1462 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_version
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
1463 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_msg_type
, tvb
, 1, 1, ENC_BIG_ENDIAN
);
1465 if (ospf_msg_type_to_filter(packet_type
) != -1) {
1466 hidden_item
= proto_tree_add_item(ospf_header_tree
,
1467 *hf_ospf_msg_type_array
[ospf_msg_type_to_filter(packet_type
)],
1468 tvb
, 1, 1, ENC_BIG_ENDIAN
);
1469 proto_item_set_hidden(hidden_item
);
1471 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_packet_length
, tvb
, 2, 2, ENC_BIG_ENDIAN
);
1472 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_src_router
, tvb
, 4, 4, ENC_BIG_ENDIAN
);
1475 ti
= proto_tree_add_item(ospf_header_tree
, hf_ospf_header_area_id
, tvb
, 8, 4, ENC_BIG_ENDIAN
);
1476 areaid
= tvb_get_ntohl(tvb
,8);
1478 proto_item_append_text(ti
, " (Backbone)");
1481 ti_sum
= proto_tree_add_item(ospf_header_tree
, hf_ospf_header_checksum
, tvb
, 12, 2, ENC_BIG_ENDIAN
);
1482 cksum
= tvb_get_ntohs(tvb
, 12);
1484 proto_item_append_text(ti_sum
, " (None)");
1487 /* Quit at this point if it's an unknown OSPF version. */
1488 if(version
!= OSPF_VERSION_2
&& version
!= OSPF_VERSION_3
) {
1492 length
= tvb_captured_length(tvb
);
1493 /* XXX - include only the length from the OSPF header? */
1494 reported_length
= tvb_reported_length(tvb
);
1495 if (cksum
!=0 && !pinfo
->fragmented
&& length
>= reported_length
1496 && length
>= ospf_header_length
) {
1497 /* The packet isn't part of a fragmented datagram and isn't
1498 truncated, so we can checksum it. */
1502 case OSPF_VERSION_2
:
1503 /* Header, not including the authentication data (the OSPFv2
1504 checksum excludes the 64-bit authentication field). */
1505 SET_CKSUM_VEC_TVB(cksum_vec
[0], tvb
, 0, 16);
1506 if (length
> ospf_header_length
) {
1507 /* Rest of the packet, again not including the
1508 authentication data. */
1509 reported_length
-= ospf_header_length
;
1510 SET_CKSUM_VEC_TVB(cksum_vec
[1], tvb
, ospf_header_length
, reported_length
);
1513 /* There's nothing but a header. */
1518 case OSPF_VERSION_3
:
1519 /* IPv6-style checksum, covering the entire OSPF packet
1520 and a prepended IPv6 pseudo-header. */
1522 /* Set up the fields of the pseudo-header. */
1523 SET_CKSUM_VEC_PTR(cksum_vec
[0], (const uint8_t *)pinfo
->src
.data
, pinfo
->src
.len
);
1524 SET_CKSUM_VEC_PTR(cksum_vec
[1], (const uint8_t *)pinfo
->dst
.data
, pinfo
->dst
.len
);
1525 phdr
[0] = g_htonl(ospflen
);
1526 phdr
[1] = g_htonl(IP_PROTO_OSPF
);
1527 SET_CKSUM_VEC_PTR(cksum_vec
[2], (const uint8_t *)&phdr
, 8);
1528 SET_CKSUM_VEC_TVB(cksum_vec
[3], tvb
, 0, reported_length
);
1533 DISSECTOR_ASSERT_NOT_REACHED();
1536 computed_cksum
= in_cksum(cksum_vec
, cksum_vec_len
);
1538 * in_cksum() should never return 0xFFFF here, because, to quote
1539 * RFC 1624 section 3 "Discussion":
1541 * In one's complement, there are two representations of
1542 * zero: the all zero and the all one bit values, often
1543 * referred to as +0 and -0. One's complement addition
1544 * of non-zero inputs can produce -0 as a result, but
1545 * never +0. Since there is guaranteed to be at least
1546 * one non-zero field in the IP header, and the checksum
1547 * field in the protocol header is the complement of the
1548 * sum, the checksum field can never contain ~(+0), which
1549 * is -0 (0xFFFF). It can, however, contain ~(-0), which
1552 * RFC 1624 is discussing the checksum of the *IPv4* header,
1553 * where the "version" field is 4, ensuring that, in a valid
1554 * IPv4 header, there is at least one non-zero field, but it
1555 * also applies to an OSPF packet, because, for OSPFv2, the
1556 * header includes a version field with the value 2 and, for
1557 * OSPFv3, the pseudo-header includes the non-zero IP protocol
1558 * number for OSPF, so at least one field in the checksummed
1561 * in_cksum() returns the negation of the one's-complement
1562 * sum of all the data handed to it, and that data won't be
1563 * all zero, so the sum won't be 0 (+0), and thus the negation
1564 * won't be -0, i.e. won't be 0xFFFF.
1566 if (computed_cksum
== 0) {
1567 proto_item_append_text(ti_sum
, " [correct]");
1569 proto_item_append_text(ti_sum
, " [incorrect, should be 0x%04x]", in_cksum_shouldbe(cksum
, computed_cksum
));
1575 case OSPF_VERSION_2
:
1576 /* Authentication is only valid for OSPFv2 */
1577 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_auth_type
, tvb
, 14, 2, ENC_BIG_ENDIAN
);
1578 auth_type
= tvb_get_ntohs(tvb
, 14);
1579 switch (auth_type
) {
1580 case OSPF_AUTH_NONE
:
1581 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_auth_data_none
, tvb
, 16, 8, ENC_NA
);
1584 case OSPF_AUTH_SIMPLE
:
1585 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_auth_data_simple
, tvb
, 16, 8, ENC_ASCII
);
1588 case OSPF_AUTH_CRYPT
:
1589 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_auth_crypt_key_id
, tvb
, 18, 1, ENC_BIG_ENDIAN
);
1591 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_auth_crypt_data_length
, tvb
, 19, 1, ENC_BIG_ENDIAN
);
1592 crypto_len
= tvb_get_uint8(tvb
, 19);
1594 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_auth_crypt_seq_nbr
, tvb
, 20, 4, ENC_BIG_ENDIAN
);
1595 /* Show the message digest that was appended to the end of the
1596 OSPF message - but only if it's present (we don't want
1597 to get an exception before we've tried dissecting OSPF
1599 if (tvb_bytes_exist(tvb
, ospflen
, crypto_len
)) {
1600 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_auth_crypt_data
, tvb
, ospflen
, crypto_len
, ENC_NA
);
1601 proto_tree_set_appendix(ospf_header_tree
, tvb
, ospflen
, crypto_len
);
1606 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_auth_data_unknown
, tvb
, 16, 8, ENC_NA
);
1611 case OSPF_VERSION_3
:
1612 /* Instance ID and "reserved" is OSPFv3-only */
1613 proto_tree_add_item(ospf_header_tree
, hf_ospf_header_instance_id
, tvb
, 14, 1, ENC_BIG_ENDIAN
);
1614 instance_id
= tvb_get_uint8(tvb
, 14);
1615 /* By default set address_family to OSPF_AF_6 */
1616 address_family
= OSPF_AF_6
;
1617 if(instance_id
> 65 && instance_id
< 128) {
1618 address_family
= OSPF_AF_4
;
1621 ti
= proto_tree_add_item(ospf_header_tree
, hf_ospf_header_reserved
, tvb
, 15, 1, ENC_NA
);
1622 if(tvb_get_uint8(tvb
, 15)){
1623 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
1628 DISSECTOR_ASSERT_NOT_REACHED();
1632 switch (packet_type
){
1635 dissect_ospf_hello(tvb
, ospf_header_length
, ospf_tree
, version
,
1636 (uint16_t)(ospflen
- ospf_header_length
));
1640 dissect_ospf_db_desc(tvb
, pinfo
, (int)ospf_header_length
, ospf_tree
, version
,
1641 (uint16_t)(ospflen
- ospf_header_length
),
1646 dissect_ospf_ls_req(tvb
, pinfo
, (int)ospf_header_length
, ospf_tree
, version
,
1647 (uint16_t)(ospflen
- ospf_header_length
));
1651 dissect_ospf_ls_upd(tvb
, pinfo
, (int)ospf_header_length
, ospf_tree
, version
,
1652 (uint16_t)(ospflen
- ospf_header_length
),
1657 dissect_ospf_ls_ack(tvb
, pinfo
, (int)ospf_header_length
, ospf_tree
, version
,
1658 (uint16_t)(ospflen
- ospf_header_length
),
1663 call_data_dissector(tvb_new_subset_remaining(tvb
, ospf_header_length
), pinfo
, tree
);
1667 /* take care of the LLS data block */
1668 if (ospf_has_lls_block(tvb
, ospf_header_length
, packet_type
, version
)) {
1669 dissect_ospf_lls_data_block(tvb
, pinfo
, ospflen
+ crypto_len
, ospf_tree
,
1673 /* take care of the AT (Authentication Trailer) data block */
1674 if (ospf_has_at_block(tvb
, ospf_header_length
, packet_type
, version
)) {
1675 dissect_ospf_authentication_trailer(tvb
, ospflen
+ crypto_len
, ospf_tree
);
1678 return tvb_captured_length(tvb
);
1682 dissect_ospfv2_lls_tlv(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
)
1684 proto_tree
*ospf_lls_tlv_tree
;
1688 type
= tvb_get_ntohs(tvb
, offset
);
1689 length
= tvb_get_ntohs(tvb
, offset
+ 2);
1691 ospf_lls_tlv_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, length
+ 4, ett_ospf_lls_tlv
,
1692 NULL
, val_to_str_const(type
, lls_tlv_type_vals
, "Unknown LLS TLV"));
1694 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_tlv_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1695 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
1698 case LLS_V2_EXT_OPT
:
1699 proto_tree_add_bitmask(ospf_lls_tlv_tree
, tvb
, offset
+ 4, hf_ospf_lls_ext_options
, ett_ospf_lls_ext_options
, bf_lls_ext_options
, ENC_BIG_ENDIAN
);
1701 case LLS_V2_CRYPTO_OPT
:
1702 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_v2_lls_sequence_number
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
1703 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_v2_lls_auth_data
, tvb
, offset
+ 8, length
- 4, ENC_NA
);
1705 case LLS_V2_LI_ID_OPT
:
1706 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_v2_lls_li_id
, tvb
, offset
+ 4, 4, ENC_NA
);
1709 return offset
+ length
+ 4;
1713 dissect_ospfv3_lls_tlv(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
)
1715 proto_item
*ti
= NULL
;
1716 proto_tree
*ospf_lls_tlv_tree
= NULL
;
1719 uint8_t relays_added
;
1722 type
= tvb_get_ntohs(tvb
, offset
);
1723 length
= tvb_get_ntohs(tvb
, offset
+ 2);
1726 case LLS_V3_EXT_OPT
:
1727 ti
= proto_tree_add_item(tree
, hf_ospf_v3_lls_ext_options_tlv
, tvb
,
1728 offset
, length
+ 4, ENC_NA
);
1730 case LLS_V3_STATE_CHECK
:
1731 ti
= proto_tree_add_item(tree
, hf_ospf_v3_lls_state_tlv
, tvb
,
1732 offset
, length
+ 4, ENC_NA
);
1734 case LLS_V3_NBR_DROP
:
1735 ti
= proto_tree_add_item(tree
, hf_ospf_v3_lls_drop_tlv
, tvb
,
1736 offset
, length
+ 4, ENC_NA
);
1739 ti
= proto_tree_add_item(tree
, hf_ospf_v3_lls_relay_tlv
, tvb
,
1740 offset
, length
+ 4, ENC_NA
);
1742 case LLS_V3_WILLING
:
1743 ti
= proto_tree_add_item(tree
, hf_ospf_v3_lls_willingness_tlv
, tvb
,
1744 offset
, length
+ 4, ENC_NA
);
1746 case LLS_V3_RQST_FROM
:
1747 ti
= proto_tree_add_item(tree
, hf_ospf_v3_lls_rf_tlv
, tvb
,
1748 offset
, length
+ 4, ENC_NA
);
1750 case LLS_V3_FULL_STATE
:
1751 ti
= proto_tree_add_item(tree
, hf_ospf_v3_lls_fsf_tlv
, tvb
,
1752 offset
, length
+ 4, ENC_NA
);
1755 ospf_lls_tlv_tree
= proto_tree_add_subtree_format(tree
, tvb
, offset
, length
+ 4, ett_ospf_lls_tlv
, NULL
,
1756 "%s", val_to_str_const(type
, lls_v3_tlv_type_vals
, "Unknown LLS TLV"));
1760 ospf_lls_tlv_tree
= proto_item_add_subtree(ti
, ett_ospf_lls_tlv
);
1761 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_tlv_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1762 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
1764 orig_offset
= offset
;
1767 case LLS_V3_EXT_OPT
:
1768 proto_tree_add_bitmask(ospf_lls_tlv_tree
, tvb
, offset
+ 4, hf_ospf_v3_lls_ext_options
, ett_ospf_v3_lls_ext_options
, bf_v3_lls_ext_options
, ENC_BIG_ENDIAN
);
1770 case LLS_V3_STATE_CHECK
:
1771 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_v3_lls_state_scs
,
1772 tvb
, offset
+4, 2, ENC_BIG_ENDIAN
);
1773 proto_tree_add_bitmask(ospf_lls_tlv_tree
, tvb
, offset
+ 6, hf_ospf_v3_lls_state_options
, ett_ospf_v3_lls_state_options
, bf_v3_lls_state_options
, ENC_BIG_ENDIAN
);
1775 case LLS_V3_NBR_DROP
:
1777 while (orig_offset
+ length
>= offset
) {
1778 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_v3_lls_dropped_neighbor
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1781 offset
= orig_offset
;
1784 relays_added
= tvb_get_uint8(tvb
, offset
+4);
1785 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_v3_lls_relay_added
,
1786 tvb
, offset
+4, 1, ENC_BIG_ENDIAN
);
1787 proto_tree_add_bitmask(ospf_lls_tlv_tree
, tvb
, offset
+ 5, hf_ospf_v3_lls_relay_options
, ett_ospf_v3_lls_relay_options
, bf_v3_lls_relay_options
, ENC_BIG_ENDIAN
);
1789 while (orig_offset
+ length
>= offset
) {
1790 ti
= proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_v3_lls_neighbor
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1791 if (relays_added
> 0) {
1792 proto_item_append_text(ti
, " Added");
1794 proto_item_append_text(ti
, " Deleted");
1801 case LLS_V3_WILLING
:
1802 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_v3_lls_willingness
,
1803 tvb
, offset
+4, 1, ENC_BIG_ENDIAN
);
1806 case LLS_V3_RQST_FROM
:
1808 while (orig_offset
+ length
>= offset
) {
1809 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_v3_lls_request_from
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1812 offset
= orig_offset
;
1814 case LLS_V3_FULL_STATE
:
1816 while (orig_offset
+ length
>= offset
) {
1817 proto_tree_add_item(ospf_lls_tlv_tree
, hf_ospf_v3_lls_full_state_for
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1820 offset
= orig_offset
;
1824 return offset
+ length
+ 4;
1829 dissect_ospf_lls_data_block(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
,
1832 proto_tree
*ospf_lls_data_block_tree
;
1834 int orig_offset
= offset
;
1835 unsigned length_remaining
;
1837 length_remaining
= tvb_reported_length_remaining(tvb
, offset
);
1838 if (length_remaining
< 4) {
1839 proto_tree_add_expert_format(tree
, pinfo
, &ei_ospf_lsa_bad_length
,
1840 tvb
, offset
, length_remaining
, "LLS option bit set but data block missing");
1844 ospf_lls_len
= tvb_get_ntohs(tvb
, offset
+ 2) * 4;
1845 ospf_lls_data_block_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, -1, ett_ospf_lls_data_block
, NULL
, "OSPF LLS Data Block");
1847 /* TODO: verify checksum */
1848 proto_tree_add_checksum(ospf_lls_data_block_tree
, tvb
, offset
, hf_ospf_lls_checksum
, -1, NULL
, pinfo
, 0, ENC_BIG_ENDIAN
, PROTO_CHECKSUM_NO_FLAGS
);
1849 proto_tree_add_uint(ospf_lls_data_block_tree
, hf_ospf_lls_data_length
, tvb
, offset
+ 2, 2, ospf_lls_len
);
1852 DISSECTOR_ASSERT((version
== OSPF_VERSION_2
) || (version
== OSPF_VERSION_3
));
1853 while (orig_offset
+ ospf_lls_len
> offset
) {
1854 if (version
== OSPF_VERSION_2
)
1855 offset
= dissect_ospfv2_lls_tlv (tvb
, offset
, ospf_lls_data_block_tree
);
1857 offset
= dissect_ospfv3_lls_tlv (tvb
, offset
, ospf_lls_data_block_tree
);
1862 dissect_ospf_authentication_trailer(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
)
1864 proto_tree
*ospf_at_tree
;
1866 uint32_t auth_data_len
;
1868 ti
= proto_tree_add_item(tree
, hf_ospf_at
, tvb
, offset
, -1, ENC_NA
);
1869 ospf_at_tree
= proto_item_add_subtree(ti
, ett_ospf_at
);
1871 proto_tree_add_item(ospf_at_tree
, hf_ospf_at_auth_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1874 proto_tree_add_item_ret_uint(ospf_at_tree
, hf_ospf_at_auth_data_len
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &auth_data_len
);
1876 if (auth_data_len
< (2 + 2 + 2 + 8)) {
1877 /* XXX - report an error here */
1878 proto_item_set_len(ti
, 4);
1881 proto_item_set_len(ti
, auth_data_len
);
1883 proto_tree_add_item(ospf_at_tree
, hf_ospf_at_reserved
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1886 proto_tree_add_item(ospf_at_tree
, hf_ospf_at_sa_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1889 proto_tree_add_item(ospf_at_tree
, hf_ospf_at_crypto_seq_nbr
, tvb
, offset
, 8, ENC_BIG_ENDIAN
);
1892 /* Add Check of Data ? */
1893 proto_tree_add_item(ospf_at_tree
, hf_ospf_at_auth_data
, tvb
, offset
, auth_data_len
- ( 2 + 2 + 2 + 2 + 8), ENC_NA
);
1894 offset
= auth_data_len
;
1900 dissect_ospf_hello(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, uint8_t version
,
1903 proto_tree
*ospf_hello_tree
;
1905 int orig_offset
= offset
;
1907 ti
= proto_tree_add_item(tree
, hf_ospf_hello
, tvb
, offset
, length
, ENC_NA
);
1908 ospf_hello_tree
= proto_item_add_subtree(ti
, ett_ospf_hello
);
1911 case OSPF_VERSION_2
:
1912 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_network_mask
, tvb
, offset
, 4, ENC_NA
);
1913 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_hello_interval
, tvb
, offset
+ 4, 2, ENC_BIG_ENDIAN
);
1914 proto_tree_add_bitmask(ospf_hello_tree
, tvb
, offset
+ 6, hf_ospf_v2_options
, ett_ospf_v2_options
, bf_v2_options
, ENC_BIG_ENDIAN
);
1915 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_router_priority
, tvb
, offset
+ 7, 1, ENC_BIG_ENDIAN
);
1916 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_router_dead_interval
, tvb
, offset
+ 8, 4, ENC_BIG_ENDIAN
);
1917 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_designated_router
, tvb
, offset
+ 12, 4, ENC_NA
);
1918 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_backup_designated_router
, tvb
, offset
+ 16, 4, ENC_NA
);
1921 while (orig_offset
+ length
> offset
) {
1922 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_active_neighbor
, tvb
, offset
, 4, ENC_NA
);
1926 case OSPF_VERSION_3
:
1927 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_interface_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1928 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_router_priority
, tvb
, offset
+ 4, 1, ENC_BIG_ENDIAN
);
1929 proto_tree_add_bitmask(ospf_hello_tree
, tvb
, offset
+ 5, hf_ospf_v3_options
, ett_ospf_v3_options
, bf_v3_options
, ENC_BIG_ENDIAN
);
1930 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_hello_interval
, tvb
, offset
+ 8, 2, ENC_BIG_ENDIAN
);
1931 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_router_dead_interval
, tvb
, offset
+ 10, 2, ENC_BIG_ENDIAN
);
1932 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_designated_router
, tvb
, offset
+ 12, 4, ENC_NA
);
1933 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_backup_designated_router
, tvb
, offset
+ 16, 4, ENC_NA
);
1936 while (orig_offset
+ length
> offset
) {
1937 proto_tree_add_item(ospf_hello_tree
, hf_ospf_hello_active_neighbor
, tvb
, offset
, 4, ENC_NA
);
1945 dissect_ospf_db_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
,
1946 uint8_t version
, uint16_t length
, uint8_t address_family
)
1948 proto_tree
*ospf_db_desc_tree
;
1951 int orig_offset
= offset
;
1954 ospf_db_desc_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, length
, ett_ospf_desc
, NULL
, "OSPF DB Description");
1958 case OSPF_VERSION_2
:
1959 proto_tree_add_item(ospf_db_desc_tree
, hf_ospf_db_interface_mtu
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1961 proto_tree_add_bitmask(ospf_db_desc_tree
, tvb
, offset
+ 2, hf_ospf_v2_options
, ett_ospf_v2_options
, bf_v2_options
, ENC_BIG_ENDIAN
);
1962 proto_tree_add_bitmask(ospf_db_desc_tree
, tvb
, offset
+ 3, hf_ospf_dbd
, ett_ospf_dbd
, bf_dbd
, ENC_BIG_ENDIAN
);
1964 proto_tree_add_item(ospf_db_desc_tree
, hf_ospf_db_dd_sequence
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
1967 case OSPF_VERSION_3
:
1969 reserved
= tvb_get_uint8(tvb
, offset
);
1970 ti
= proto_tree_add_item(ospf_db_desc_tree
, hf_ospf_header_reserved
, tvb
, offset
, 1, ENC_NA
);
1972 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
1974 proto_tree_add_bitmask(ospf_db_desc_tree
, tvb
, offset
+ 1, hf_ospf_v3_options
, ett_ospf_v3_options
, bf_v3_options
, ENC_BIG_ENDIAN
);
1976 proto_tree_add_item(ospf_db_desc_tree
, hf_ospf_db_interface_mtu
, tvb
, offset
+ 4, 2, ENC_BIG_ENDIAN
);
1978 reserved
= tvb_get_uint8(tvb
, offset
+ 6);
1979 ti
= proto_tree_add_item(ospf_db_desc_tree
, hf_ospf_header_reserved
, tvb
, offset
+ 6, 1, ENC_NA
);
1981 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
1983 proto_tree_add_bitmask(ospf_db_desc_tree
, tvb
, offset
+ 7, hf_ospf_dbd
, ett_ospf_dbd
, bf_dbd
, ENC_BIG_ENDIAN
);
1985 proto_tree_add_item(ospf_db_desc_tree
, hf_ospf_db_dd_sequence
, tvb
, offset
+ 8, 4, ENC_BIG_ENDIAN
);
1990 case OSPF_VERSION_2
:
1993 case OSPF_VERSION_3
:
1998 /* LS Headers will be processed here */
1999 /* skip to the end of DB-Desc header */
2000 DISSECTOR_ASSERT((version
== OSPF_VERSION_2
) || (version
== OSPF_VERSION_3
));
2001 while (orig_offset
+ length
> offset
) {
2002 if ( version
== OSPF_VERSION_2
)
2003 offset
= dissect_ospf_v2_lsa(tvb
, pinfo
, offset
, tree
, false);
2005 offset
= dissect_ospf_v3_lsa(tvb
, pinfo
, offset
, tree
, false, address_family
);
2011 dissect_ospf_ls_req(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
, uint8_t version
,
2015 proto_tree
*ospf_lsr_tree
;
2016 proto_tree
*lsa_type_tree
;
2018 int orig_offset
= offset
;
2020 /* zero or more LS requests may be within a LS Request */
2021 /* we place every request for a LSA in a single subtree */
2022 while (orig_offset
+ length
> offset
) {
2023 ospf_lsr_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, OSPF_LS_REQ_LENGTH
,
2024 ett_ospf_lsr
, NULL
, "Link State Request");
2026 switch ( version
) {
2028 case OSPF_VERSION_2
:
2029 proto_tree_add_item(ospf_lsr_tree
, hf_ospf_ls_type
,
2030 tvb
, offset
, 4, ENC_BIG_ENDIAN
);
2032 case OSPF_VERSION_3
:
2033 reserved
= tvb_get_ntohs(tvb
, offset
);
2034 ti
= proto_tree_add_item(ospf_lsr_tree
, hf_ospf_header_reserved
, tvb
, offset
, 2, ENC_NA
);
2036 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
2038 ti
= proto_tree_add_item(ospf_lsr_tree
, hf_ospf_v3_ls_type
,
2039 tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
2040 lsa_type_tree
= proto_item_add_subtree(ti
, ett_ospf_lsa_type
);
2041 proto_tree_add_item(lsa_type_tree
, hf_ospf_v3_ls_type_u
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
2042 proto_tree_add_item(lsa_type_tree
, hf_ospf_v3_ls_type_s12
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
2043 proto_tree_add_item(lsa_type_tree
, hf_ospf_v3_ls_type_fc
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
2048 proto_tree_add_item(ospf_lsr_tree
, hf_ospf_link_state_id
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
2049 proto_tree_add_item(ospf_lsr_tree
, hf_ospf_adv_router
,
2050 tvb
, offset
+ 8, 4, ENC_BIG_ENDIAN
);
2057 dissect_ospf_ls_upd(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
, uint8_t version
,
2058 uint16_t length
, uint8_t address_family
)
2060 proto_tree
*ospf_lsa_upd_tree
;
2062 uint32_t lsa_counter
;
2064 ospf_lsa_upd_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, length
, ett_ospf_lsa_upd
, NULL
, "LS Update Packet");
2066 lsa_nr
= tvb_get_ntohl(tvb
, offset
);
2067 proto_tree_add_item(ospf_lsa_upd_tree
, hf_ospf_ls_number_of_lsas
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
2068 /* skip to the beginning of the first LSA */
2069 offset
+= 4; /* the LS Upd Packet contains only a 32 bit #LSAs field */
2071 DISSECTOR_ASSERT((version
== OSPF_VERSION_2
) || (version
== OSPF_VERSION_3
));
2073 while (lsa_counter
< lsa_nr
) {
2074 if (version
== OSPF_VERSION_2
)
2075 offset
= dissect_ospf_v2_lsa(tvb
, pinfo
, offset
, ospf_lsa_upd_tree
, true);
2077 offset
= dissect_ospf_v3_lsa(tvb
, pinfo
, offset
, ospf_lsa_upd_tree
, true,
2084 dissect_ospf_ls_ack(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
, uint8_t version
,
2085 uint16_t length
, uint8_t address_family
)
2087 int orig_offset
= offset
;
2088 DISSECTOR_ASSERT((version
== OSPF_VERSION_2
) || (version
== OSPF_VERSION_3
));
2089 /* the body of a LS Ack packet simply contains zero or more LSA Headers */
2090 while (orig_offset
+ length
> offset
) {
2091 if (version
== OSPF_VERSION_2
)
2092 offset
= dissect_ospf_v2_lsa(tvb
, pinfo
, offset
, tree
, false);
2094 offset
= dissect_ospf_v3_lsa(tvb
, pinfo
, offset
, tree
, false, address_family
);
2099 * Returns if an LSA is opaque, i.e. requires special treatment
2102 is_opaque(int lsa_type
)
2104 return (lsa_type
>= OSPF_LSTYPE_OP_LINKLOCAL
&&
2105 lsa_type
<= OSPF_LSTYPE_OP_ASWIDE
);
2108 /* MPLS/TE TLV types */
2109 #define MPLS_TLV_ROUTER 1
2110 #define MPLS_TLV_LINK 2
2111 #define OIF_TLV_TNA 32768
2113 /* MPLS/TE Link STLV types */
2115 MPLS_LINK_TYPE
= 1, /* RFC 3630, OSPF-TE */
2118 MPLS_LINK_REMOTE_IF
,
2119 MPLS_LINK_TE_METRIC
,
2121 MPLS_LINK_MAX_RES_BW
,
2124 MPLS_LINK_LOCAL_REMOTE_ID
= 11, /* RFC 4203, GMPLS */
2125 MPLS_LINK_PROTECTION
= 14,
2126 MPLS_LINK_IF_SWITCHING_DESC
,
2127 MPLS_LINK_SHARED_RISK_GROUP
,
2128 MPLS_LINK_BANDWIDTH_CONSTRAINT
= 17,/* RFC 4124, OSPF-DSTE */
2129 MPLS_LINK_EXT_ADMIN_GROUP
= 26, /* RFC 7308 */
2130 MPLS_LINK_UNIDIR_LINK_DELAY
, /* RFC 7471 */
2131 MPLS_LINK_UNIDIR_LINK_DELAY_MIN_MAX
,
2132 MPLS_LINK_UNIDIR_DELAY_VARIATION
,
2136 MPLS_BANDWIDTH_AVAILABLE
= 1, /* RFC 3630, OSPF-TE */
2137 MPLS_BANDWIDTH_SHARED
= 2
2142 OIF_LOCAL_NODE_ID
= 32773,
2144 OIF_SONET_SDH_SWITCHING_CAPABILITY
,
2145 OIF_TNA_IPv4_ADDRESS
,
2147 OIF_TNA_IPv6_ADDRESS
,
2148 OIF_TNA_NSAP_ADDRESS
2151 static const value_string mpls_link_stlv_str
[] = {
2152 {MPLS_LINK_TYPE
, "Link Type"},
2153 {MPLS_LINK_ID
, "Link ID"},
2154 {MPLS_LINK_LOCAL_IF
, "Local Interface IP Address"},
2155 {MPLS_LINK_REMOTE_IF
, "Remote Interface IP Address"},
2156 {MPLS_LINK_TE_METRIC
, "Traffic Engineering Metric"},
2157 {MPLS_LINK_MAX_BW
, "Maximum Bandwidth"},
2158 {MPLS_LINK_MAX_RES_BW
, "Maximum Reservable Bandwidth"},
2159 {MPLS_LINK_UNRES_BW
, "Unreserved Bandwidth"},
2160 {MPLS_LINK_COLOR
, "Resource Class/Color"},
2161 {MPLS_LINK_LOCAL_REMOTE_ID
, "Link Local/Remote Identifier"},
2162 {MPLS_LINK_PROTECTION
, "Link Protection Type"},
2163 {MPLS_LINK_IF_SWITCHING_DESC
, "Interface Switching Capability Descriptor"},
2164 {MPLS_LINK_SHARED_RISK_GROUP
, "Shared Risk Link Group"},
2165 {MPLS_LINK_BANDWIDTH_CONSTRAINT
, "Bandwidth Constraints"},
2166 {MPLS_LINK_EXT_ADMIN_GROUP
, "Extended Administrative Group"},
2167 {MPLS_LINK_UNIDIR_LINK_DELAY
, "Unidirectional Link Delay"},
2168 {MPLS_LINK_UNIDIR_LINK_DELAY_MIN_MAX
, "Min/Max Unidirectional Link Delay"},
2169 {MPLS_LINK_UNIDIR_DELAY_VARIATION
, "Unidirectional Delay Variation"},
2170 {OIF_LOCAL_NODE_ID
, "Local Node ID"},
2171 {OIF_REMOTE_NODE_ID
, "Remote Node ID"},
2172 {OIF_SONET_SDH_SWITCHING_CAPABILITY
, "Sonet/SDH Interface Switching Capability"},
2176 static const value_string mpls_bandwidth_sstlv_str
[] = {
2177 {MPLS_BANDWIDTH_AVAILABLE
, "Available Label"},
2178 {MPLS_BANDWIDTH_SHARED
, "Shared Backup Label"},
2182 static const range_string mpls_te_tlv_rvals
[] = {
2183 { 3, 32767, "(Assigned via Standards Action)"},
2184 { 32768, 32777, "(For Experimental Use)"},
2185 { 32778, 65535, "(Not to be Assigned)"},
2189 static const range_string mpls_te_sub_tlv_rvals
[] = {
2190 { 10, 32767, "(Assigned via Standards Action)"},
2191 { 32768, 32777, "(For Experimental Use)"},
2192 { 32778, 65535, "(Not to be Assigned)"},
2196 static const value_string oif_stlv_str
[] = {
2197 {OIF_TNA_IPv4_ADDRESS
, "TNA address"},
2198 {OIF_NODE_ID
, "Node ID"},
2199 {OIF_TNA_IPv6_ADDRESS
, "TNA address"},
2200 {OIF_TNA_NSAP_ADDRESS
, "TNA address"},
2204 static const range_string ospf_instance_id_rvals
[] = {
2205 { 0, 31, "IPv6 unicast AF" },
2206 { 32, 63, "IPv6 multicast AF" },
2207 { 64, 95, "IPv4 unicast AF" },
2208 { 96, 127, "IPv4 multicast AF" },
2209 { 128, 255, "Reserved" },
2214 * Name : dissect_ospf_subtlv_ext_admin_group()
2218 * Dissect Extended Administrative Groups Sub-TLV
2221 * tvbuff_t * : tvbuffer for packet data
2222 * proto_tree * : protocol display tree to fill out.
2223 * int : offset into packet data where we are (beginning of the sub_clv value).
2225 * int : subtlv length
2231 dissect_ospf_subtlv_ext_admin_group(tvbuff_t
*tvb
, proto_tree
*tree
,
2232 int offset
, int subtype _U_
, int sublen
)
2235 uint32_t admin_group
;
2237 /* Number of Extended Admin Groups */
2238 for (i
= 0; i
< (sublen
/ 4); i
++) {
2239 admin_group
= tvb_get_uint32(tvb
, offset
+ (i
* 4), ENC_BIG_ENDIAN
);
2240 proto_tree_add_uint_format(tree
, hf_ospf_ls_ext_admin_group
,
2241 tvb
, offset
+ (i
* 4), 4, admin_group
,
2242 "Extended Admin Group[%d]: 0x%08x",
2248 * Dissect MPLS/TE opaque LSA
2251 dissect_ospf_lsa_mpls(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
,
2254 proto_item
*ti
, *hidden_item
;
2255 proto_tree
*mpls_tree
, *cs_tree
, *label_tree
, *grid_tree
;
2256 proto_tree
*tlv_tree
;
2257 proto_tree
*stlv_tree
;
2258 proto_tree
*sstlv_tree
;
2259 proto_tree
*stlv_admingrp_tree
= NULL
;
2265 int stlv_type
, stlv_len
, stlv_offset
;
2266 int sstlv_type
, sstlv_len
, sstlv_offset
;
2267 int bitmap_length
, no_eff_bits
, nb_octets
;
2268 int bitmap_offset
, bitmap_end_offset
;
2270 const char *stlv_name
;
2271 const char *sstlv_name
;
2272 uint32_t stlv_admingrp
, mask
, reserved
;
2278 static const value_string lambda_grid_vals
[] = {
2285 static const value_string grid1_cs_vals
[] = {
2292 static const value_string grid2_cs_vals
[] = {
2296 static const value_string grid3_cs_vals
[] = {
2301 static const uint8_t allzero
[] = { 0x00, 0x00, 0x00 };
2302 unsigned num_bcs
= 0;
2304 mpls_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, length
,
2305 ett_ospf_lsa_mpls
, NULL
, "MPLS Traffic Engineering LSA");
2306 hidden_item
= proto_tree_add_item(tree
, hf_ospf_ls_mpls
,
2307 tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2308 proto_item_set_hidden(hidden_item
);
2310 while (length
!= 0) {
2311 tlv_type
= tvb_get_ntohs(tvb
, offset
);
2312 tlv_length
= tvb_get_ntohs(tvb
, offset
+ 2);
2313 tlv_end_offset
= offset
+ tlv_length
+ 4;
2317 case MPLS_TLV_ROUTER
:
2318 tlv_tree
= proto_tree_add_subtree_format(mpls_tree
, tvb
, offset
, tlv_length
+4,
2319 ett_ospf_lsa_mpls_router
, NULL
, "Router Address: %s",
2320 tvb_ip_to_str(pinfo
->pool
, tvb
, offset
+4));
2321 proto_tree_add_uint_format_value(tlv_tree
, hf_ospf_tlv_type
, tvb
, offset
, 2, tlv_type
, "1 - Router Address");
2322 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
2323 proto_tree_add_item(tlv_tree
, hf_ospf_ls_mpls_routerid
,
2324 tvb
, offset
+4, 4, ENC_BIG_ENDIAN
);
2328 tlv_tree
= proto_tree_add_subtree(mpls_tree
, tvb
, offset
, tlv_length
+4,
2329 ett_ospf_lsa_mpls_link
, NULL
, "Link Information");
2330 proto_tree_add_uint_format_value(tlv_tree
, hf_ospf_tlv_type
, tvb
, offset
, 2, tlv_type
, "2 - Link Information");
2331 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
2332 stlv_offset
= offset
+ 4;
2334 /* Walk down the sub-TLVs for link information */
2335 while (stlv_offset
< tlv_end_offset
) {
2336 stlv_type
= tvb_get_ntohs(tvb
, stlv_offset
);
2337 stlv_len
= tvb_get_ntohs(tvb
, stlv_offset
+ 2);
2338 stlv_name
= val_to_str_const(stlv_type
, mpls_link_stlv_str
, "Unknown sub-TLV");
2339 switch (stlv_type
) {
2341 case MPLS_LINK_TYPE
:
2342 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2343 ett_ospf_lsa_mpls_link_stlv
, NULL
, "%s: %u - %s", stlv_name
,
2344 tvb_get_uint8(tvb
, stlv_offset
+ 4),
2345 val_to_str_const(tvb_get_uint8(tvb
, stlv_offset
+ 4),
2346 mpls_link_stlv_ltype_str
, "Unknown Link Type"));
2347 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2348 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2349 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2350 proto_tree_add_item(stlv_tree
, hf_ospf_ls_mpls_linktype
,
2351 tvb
, stlv_offset
+4, 1,ENC_BIG_ENDIAN
);
2355 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2356 ett_ospf_lsa_mpls_link_stlv
, NULL
, "%s: %s", stlv_name
,
2357 tvb_ip_to_str(pinfo
->pool
, tvb
, stlv_offset
+ 4));
2358 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2359 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2360 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2361 proto_tree_add_item(stlv_tree
, hf_ospf_ls_mpls_linkid
,
2362 tvb
, stlv_offset
+4, 4, ENC_BIG_ENDIAN
);
2365 case MPLS_LINK_LOCAL_IF
:
2366 case MPLS_LINK_REMOTE_IF
:
2367 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2368 ett_ospf_lsa_mpls_link_stlv
, NULL
, "%s: %s", stlv_name
,
2369 tvb_ip_to_str(pinfo
->pool
, tvb
, stlv_offset
+ 4));
2370 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2371 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2372 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2373 /* The Local/Remote Interface IP Address sub-TLV is TLV type 3/4, and is 4N
2374 octets in length, where N is the number of neighbor addresses. */
2375 for (i
=0; i
< stlv_len
; i
+=4)
2376 proto_tree_add_item(stlv_tree
,
2377 stlv_type
==MPLS_LINK_LOCAL_IF
?
2378 hf_ospf_ls_mpls_local_addr
:
2379 hf_ospf_ls_mpls_remote_addr
,
2380 tvb
, stlv_offset
+4+i
, 4, ENC_BIG_ENDIAN
);
2383 case MPLS_LINK_TE_METRIC
:
2384 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2385 ett_ospf_lsa_mpls_link_stlv
, NULL
, "%s: %u", stlv_name
,
2386 tvb_get_ntohl(tvb
, stlv_offset
+ 4));
2387 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2388 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2389 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2390 proto_tree_add_uint_format(stlv_tree
, hf_ospf_ls_mpls_te_metric
, tvb
, stlv_offset
+4, 4,
2391 tvb_get_ntohl(tvb
, stlv_offset
+ 4), "%s: %u", stlv_name
,
2392 tvb_get_ntohl(tvb
, stlv_offset
+ 4));
2395 case MPLS_LINK_COLOR
:
2396 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2397 ett_ospf_lsa_mpls_link_stlv
, NULL
, "%s: 0x%08x", stlv_name
,
2398 tvb_get_ntohl(tvb
, stlv_offset
+ 4));
2399 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2400 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2401 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2402 stlv_admingrp
= tvb_get_ntohl(tvb
, stlv_offset
+ 4);
2404 ti
= proto_tree_add_item(stlv_tree
, hf_ospf_ls_mpls_linkcolor
,
2405 tvb
, stlv_offset
+4, 4, ENC_BIG_ENDIAN
);
2406 stlv_admingrp_tree
= proto_item_add_subtree(ti
, ett_ospf_lsa_mpls_link_stlv_admingrp
);
2407 if (stlv_admingrp_tree
== NULL
)
2409 for (i
= 0 ; i
< 32 ; i
++) {
2410 if ((stlv_admingrp
& mask
) != 0) {
2411 proto_tree_add_uint_format(stlv_admingrp_tree
, hf_ospf_ls_mpls_group
, tvb
, stlv_offset
+4,
2412 4, 1 << i
, "Group %d", i
);
2418 case MPLS_LINK_MAX_BW
:
2419 case MPLS_LINK_MAX_RES_BW
:
2420 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2421 ett_ospf_lsa_mpls_link_stlv
, NULL
, "%s: %.10g bytes/s (%.0f bits/s)", stlv_name
,
2422 tvb_get_ntohieee_float(tvb
, stlv_offset
+ 4),
2423 tvb_get_ntohieee_float(tvb
, stlv_offset
+ 4) * 8.0);
2424 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2425 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2426 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2427 proto_tree_add_float_format(stlv_tree
, hf_ospf_ls_mpls_link_max_bw
, tvb
, stlv_offset
+4, 4,
2428 tvb_get_ntohieee_float(tvb
, stlv_offset
+ 4), "%s: %.10g bytes/s (%.0f bits/s)", stlv_name
,
2429 tvb_get_ntohieee_float(tvb
, stlv_offset
+ 4),
2430 tvb_get_ntohieee_float(tvb
, stlv_offset
+ 4) * 8.0);
2433 case MPLS_LINK_UNRES_BW
:
2434 stlv_tree
= proto_tree_add_subtree(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2435 ett_ospf_lsa_mpls_link_stlv
, NULL
, stlv_name
);
2436 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2437 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2438 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2439 for (i
= 0; i
< 8; i
++) {
2440 tmp_float
= tvb_get_ntohieee_float(tvb
, stlv_offset
+ 4 + i
*4);
2441 proto_tree_add_float_format(stlv_tree
, hf_ospf_ls_mpls_pri
, tvb
, stlv_offset
+4+(i
*4), 4,
2442 tmp_float
, "Pri (or TE-Class) %d: %.10g bytes/s (%.0f bits/s)", i
,
2443 tmp_float
, tmp_float
* 8.0);
2447 case MPLS_LINK_BANDWIDTH_CONSTRAINT
:
2449 The "Bandwidth Constraints" sub-TLV format is illustrated below:
2452 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
2453 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2454 | BC Model Id | Reserved |
2455 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2457 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2459 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2461 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2464 stlv_tree
= proto_tree_add_subtree(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2465 ett_ospf_lsa_mpls_link_stlv
, NULL
, stlv_name
);
2467 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2468 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2470 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2472 proto_tree_add_item(stlv_tree
, hf_ospf_ls_mpls_bc_model_id
,
2473 tvb
, stlv_offset
+4, 1, ENC_BIG_ENDIAN
);
2475 /* 3 octets reserved +5, +6 and +7 (all 0x00) */
2476 if(tvb_memeql(tvb
, stlv_offset
+5, allzero
, 3) == -1) {
2477 proto_tree_add_expert_format(stlv_tree
, pinfo
, &ei_ospf_header_reserved
,
2478 tvb
, stlv_offset
+5, 3,
2479 "These bytes are reserved and must be 0x00");
2482 if(((stlv_len
% 4)!=0)) {
2483 proto_tree_add_expert_format(stlv_tree
, pinfo
, &ei_ospf_lsa_bad_length
, tvb
, stlv_offset
+4, stlv_len
,
2484 "Malformed Packet: Length must be N x 4 octets");
2488 /* stlv_len should range from 4 to 36 bytes */
2489 num_bcs
= (stlv_len
- 4)/4;
2492 proto_tree_add_expert_format(stlv_tree
, pinfo
, &ei_ospf_lsa_bc_error
, tvb
, stlv_offset
+4, stlv_len
,
2493 "Malformed Packet: too many BC (%u)", num_bcs
);
2498 proto_tree_add_expert_format(stlv_tree
, pinfo
, &ei_ospf_lsa_bc_error
, tvb
, stlv_offset
+4, stlv_len
,
2499 "Malformed Packet: Bandwidth Constraints sub-TLV with no BC?");
2503 for(i
= 0; i
< (int) num_bcs
; i
++) {
2504 tmp_float
= tvb_get_ntohieee_float(tvb
, stlv_offset
+ 8 + i
*4);
2505 proto_tree_add_float_format(stlv_tree
, hf_ospf_ls_mpls_bc
, tvb
, stlv_offset
+8+(i
*4), 4,
2506 tmp_float
, "BC %d: %.10g bytes/s (%.0f bits/s)", i
,
2507 tmp_float
, tmp_float
* 8.0);
2511 case MPLS_LINK_LOCAL_REMOTE_ID
:
2512 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2513 ett_ospf_lsa_mpls_link_stlv
, NULL
, "%s: %d (0x%x) - %d (0x%x)", stlv_name
,
2514 tvb_get_ntohl(tvb
, stlv_offset
+ 4),
2515 tvb_get_ntohl(tvb
, stlv_offset
+ 4),
2516 tvb_get_ntohl(tvb
, stlv_offset
+ 8),
2517 tvb_get_ntohl(tvb
, stlv_offset
+ 8));
2519 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2520 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2521 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2522 proto_tree_add_item(stlv_tree
,
2523 hf_ospf_ls_mpls_local_ifid
,
2524 tvb
, stlv_offset
+4, 4, ENC_BIG_ENDIAN
);
2525 proto_tree_add_item(stlv_tree
,
2526 hf_ospf_ls_mpls_remote_ifid
,
2527 tvb
, stlv_offset
+8, 4, ENC_BIG_ENDIAN
);
2530 case MPLS_LINK_IF_SWITCHING_DESC
:
2531 stlv_tree
= proto_tree_add_subtree(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2532 ett_ospf_lsa_mpls_link_stlv
, NULL
, stlv_name
);
2533 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2534 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2535 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2536 switch_cap
= tvb_get_uint8 (tvb
, stlv_offset
+ 4);
2537 proto_tree_add_item(stlv_tree
, hf_ospf_mpls_switching_type
, tvb
, stlv_offset
+ 4, 1, ENC_BIG_ENDIAN
);
2538 proto_tree_add_item(stlv_tree
, hf_ospf_mpls_encoding
, tvb
, stlv_offset
+5, 1, ENC_BIG_ENDIAN
);
2539 for (i
= 0; i
< 8; i
++) {
2540 tmp_float
= tvb_get_ntohieee_float(tvb
, stlv_offset
+ 8 + i
*4);
2541 proto_tree_add_float_format(stlv_tree
, hf_ospf_ls_mpls_pri
, tvb
, stlv_offset
+8+(i
*4), 4,
2542 tmp_float
, "Pri %d: %.10g bytes/s (%.0f bits/s)", i
,
2543 tmp_float
, tmp_float
* 8.0);
2545 if (switch_cap
>=1 && switch_cap
<=4) { /* PSC-1 .. PSC-4 */
2546 tmp_float
= tvb_get_ntohieee_float(tvb
, stlv_offset
+ 40);
2547 proto_tree_add_float_format_value(stlv_tree
, hf_ospf_mpls_minimum_lsp_bandwidth
, tvb
, stlv_offset
+40, 4,
2548 tmp_float
, "%.10g bytes/s (%.0f bits/s)",
2549 tmp_float
, tmp_float
* 8.0);
2550 proto_tree_add_item(stlv_tree
, hf_ospf_mpls_interface_mtu
, tvb
, stlv_offset
+44, 2, ENC_BIG_ENDIAN
);
2553 if (switch_cap
== 100) { /* TDM */
2554 tmp_float
= tvb_get_ntohieee_float(tvb
, stlv_offset
+ 40);
2555 proto_tree_add_float_format_value(stlv_tree
, hf_ospf_mpls_minimum_lsp_bandwidth
, tvb
, stlv_offset
+40, 4,
2556 tmp_float
, "%.10g bytes/s (%.0f bits/s)",
2557 tmp_float
, tmp_float
* 8.0);
2558 proto_tree_add_item(stlv_tree
, hf_ospf_mpls_sonet_sdh
, tvb
, stlv_offset
+44, 1, ENC_NA
);
2560 if (switch_cap
== 150) {
2561 if(tvb_get_ntohs(tvb
, stlv_offset
+2) > 36){
2562 sstlv_offset
= stlv_offset
+ 40;
2563 sstlv_type
= tvb_get_ntohs(tvb
, sstlv_offset
);
2564 sstlv_len
= tvb_get_ntohs(tvb
, sstlv_offset
+ 2);
2565 sstlv_name
= val_to_str_const(sstlv_type
, mpls_bandwidth_sstlv_str
, "Unknown sub-TLV");
2567 sstlv_tree
= proto_tree_add_subtree(stlv_tree
, tvb
, sstlv_offset
, sstlv_len
,ett_ospf_lsa_mpls_bandwidth_sstlv
, NULL
, sstlv_name
);
2568 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_bandwidth_type
, tvb
, sstlv_offset
, 2, ENC_NA
);
2569 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_length
, tvb
, sstlv_offset
+ 2, 2, ENC_NA
);
2570 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_pri
, tvb
, sstlv_offset
+ 4, 1, ENC_NA
);
2571 action
= ((tvb_get_uint8(tvb
, sstlv_offset
+ 8) & 0xF0 ) >> 4);
2572 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_action
, tvb
, sstlv_offset
+ 8, 1, ENC_NA
);
2573 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_num_labels
, tvb
, sstlv_offset
+ 8, 2, ENC_NA
);
2574 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_length
, tvb
, sstlv_offset
+ 10, 2, ENC_NA
);
2575 bitmap_length
= tvb_get_ntohs(tvb
, sstlv_offset
+ 10);
2577 bitmap_offset
= sstlv_offset
+ 16;
2578 bitmap_end_offset
= sstlv_offset
+ 8 + bitmap_length
;
2579 label_tree
= proto_tree_add_subtree(sstlv_tree
, tvb
, sstlv_offset
+ 12, 4,ett_ospf_lsa_mpls_bandwidth_sstlv
, NULL
, "Base label");
2580 proto_tree_add_item(label_tree
, hf_ospf_mpls_grid
, tvb
, sstlv_offset
+ 12, 1, ENC_NA
);
2581 proto_tree_add_item(label_tree
, hf_ospf_mpls_cs2
, tvb
, sstlv_offset
+ 12, 1, ENC_NA
);
2582 proto_tree_add_item(label_tree
, hf_ospf_mpls_n
, tvb
, sstlv_offset
+ 14, 2, ENC_NA
);
2583 while(bitmap_offset
< bitmap_end_offset
){
2584 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_bitmap
, tvb
, bitmap_offset
, 4, ENC_NA
);
2591 /* WSON_LSC, see RFC 7579 */
2592 if (switch_cap
== 151) {
2593 sstlv_offset
= stlv_offset
+ 40;
2594 sstlv_type
= tvb_get_ntohs(tvb
, sstlv_offset
);
2595 sstlv_len
= tvb_get_ntohs(tvb
, sstlv_offset
+ 2);
2596 sstlv_name
= val_to_str_const(sstlv_type
, mpls_bandwidth_sstlv_str
, "Unknown sub-TLV");
2597 sstlv_tree
= proto_tree_add_subtree(stlv_tree
, tvb
, sstlv_offset
, sstlv_len
,ett_ospf_lsa_mpls_bandwidth_sstlv
, NULL
, sstlv_name
);
2598 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_bandwidth_type
, tvb
, sstlv_offset
, 2, ENC_NA
);
2599 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_length
, tvb
, sstlv_offset
+ 2, 2, ENC_NA
);
2600 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_pri
, tvb
, sstlv_offset
+ 4, 1, ENC_NA
);
2601 action
= ((tvb_get_uint8(tvb
, sstlv_offset
+ 8) & 0xF0 ) >> 4);
2602 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_action
, tvb
, sstlv_offset
+ 8, 1, ENC_NA
);
2603 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_num_labels
, tvb
, sstlv_offset
+8, 2, ENC_NA
);
2604 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_length
, tvb
, sstlv_offset
+ 10, 2, ENC_NA
);
2605 bitmap_length
= tvb_get_ntohs(tvb
, sstlv_offset
+ 10);
2607 bitmap_offset
= sstlv_offset
+ 16;
2608 bitmap_end_offset
= sstlv_offset
+ 8 + bitmap_length
;
2609 grid
=((tvb_get_uint8(tvb
, sstlv_offset
+ 12) & 0xE0) >> 5);
2610 label_tree
= proto_tree_add_subtree(sstlv_tree
, tvb
, sstlv_offset
+ 12, 4,ett_ospf_lsa_mpls_bandwidth_sstlv
, NULL
, "Base label");
2611 grid_tree
= proto_tree_add_item(label_tree
, hf_ospf_mpls_grid
, tvb
, sstlv_offset
+ 12, 1, ENC_NA
);
2612 proto_item_set_text(grid_tree
, "Grid: %s (%u)",val_to_str_const(grid
, lambda_grid_vals
, "Unknown"),
2616 cs_tree
= proto_tree_add_item(label_tree
, hf_ospf_mpls_cs2
, tvb
, stlv_offset
+ 12, 1, ENC_NA
);
2617 proto_item_set_text(cs_tree
, "Channel Spacing: %s (%d)",val_to_str_const((tvb_get_uint8(tvb
, stlv_offset
+ 12) & 0x1E) >> 1, grid1_cs_vals
, "Unknown"),
2618 (tvb_get_uint8(tvb
, stlv_offset
+ 12) & 0x1E) >> 1 );
2621 cs_tree
= proto_tree_add_item(label_tree
, hf_ospf_mpls_cs2
, tvb
, stlv_offset
+ 12, 1, ENC_NA
);
2622 proto_item_set_text(cs_tree
, "Channel Spacing: %s (%d)",val_to_str_const((tvb_get_uint8(tvb
, stlv_offset
+ 12) & 0x1E) >> 1, grid2_cs_vals
, "Unknown"),
2623 (tvb_get_uint8(tvb
, stlv_offset
+ 12) & 0x1E) >> 1 );
2626 proto_tree_add_item(label_tree
, hf_ospf_mpls_cs2
, tvb
, sstlv_offset
+ 12, 1, ENC_NA
);
2629 proto_tree_add_item(label_tree
, hf_ospf_mpls_n
, tvb
, sstlv_offset
+ 14, 2, ENC_NA
);
2630 while(bitmap_offset
< bitmap_end_offset
){
2631 proto_tree_add_item(sstlv_tree
, hf_ospf_mpls_bitmap
, tvb
, bitmap_offset
, 4, ENC_NA
);
2636 /* flexi-grid_lsc, see RFC 8363 */
2637 if (switch_cap
== 152){
2638 bitmap_offset
= stlv_offset
+ 40 + 16;
2639 no_eff_bits
= tvb_get_ntohs(tvb
, stlv_offset
+ 54) & 0x0FFF;
2640 if(no_eff_bits
% 32 == 0){
2641 nb_octets
= (( no_eff_bits
/ 32 ) * 4);
2644 nb_octets
= ((( no_eff_bits
/ 32 ) + 1 ) * 4);
2646 bitmap_end_offset
= bitmap_offset
+ nb_octets
;
2647 proto_tree_add_item(stlv_tree
, hf_ospf_mpls_type
, tvb
, stlv_offset
+ 40, 2, ENC_NA
);
2648 proto_tree_add_item(stlv_tree
, hf_ospf_mpls_length
, tvb
, stlv_offset
+ 42, 2, ENC_NA
);
2649 proto_tree_add_item(stlv_tree
, hf_ospf_mpls_pri
, tvb
, stlv_offset
+ 44, 1, ENC_NA
);
2650 cs_tree
= proto_tree_add_item(stlv_tree
, hf_ospf_mpls_cs
, tvb
, stlv_offset
+ 52, 1, ENC_NA
);
2651 proto_item_set_text(cs_tree
, "Channel Spacing: %s (%d)",val_to_str_const((tvb_get_uint8(tvb
, stlv_offset
+ 52) & 0xF0) >> 4, grid3_cs_vals
, "Unknown"),
2652 (tvb_get_uint8(tvb
, stlv_offset
+ 52) & 0xF0) >> 4 );
2653 proto_tree_add_item(stlv_tree
, hf_ospf_mpls_starting
, tvb
, stlv_offset
+ 52, 4, ENC_NA
);
2654 proto_tree_add_item(stlv_tree
, hf_ospf_mpls_no_effective_bits
, tvb
, stlv_offset
+ 54, 2, ENC_NA
);
2655 while(bitmap_offset
< bitmap_end_offset
){
2656 proto_tree_add_item(stlv_tree
, hf_ospf_mpls_bitmap
, tvb
, bitmap_offset
, 4, ENC_NA
);
2661 case MPLS_LINK_PROTECTION
:
2662 stlv_tree
= proto_tree_add_subtree(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2663 ett_ospf_lsa_mpls_link_stlv
, NULL
, stlv_name
);
2664 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2665 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2666 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2667 proto_tree_add_item(stlv_tree
, hf_ospf_mpls_protection_capability
, tvb
, stlv_offset
+4, 1, ENC_BIG_ENDIAN
);
2670 case MPLS_LINK_SHARED_RISK_GROUP
:
2671 stlv_tree
= proto_tree_add_subtree(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2672 ett_ospf_lsa_mpls_link_stlv
, NULL
, stlv_name
);
2673 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2674 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2675 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2676 for (i
=0; i
< stlv_len
; i
+=4)
2677 proto_tree_add_item(stlv_tree
, hf_ospf_mpls_shared_risk_link_group
, tvb
, stlv_offset
+4+i
, 4, ENC_BIG_ENDIAN
);
2680 case MPLS_LINK_EXT_ADMIN_GROUP
:
2681 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2682 ett_ospf_lsa_mpls_link_stlv
, NULL
,
2684 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2685 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2686 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2687 dissect_ospf_subtlv_ext_admin_group(tvb
, stlv_tree
, stlv_offset
+4, stlv_type
, stlv_len
);
2690 case MPLS_LINK_UNIDIR_LINK_DELAY
:
2691 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2692 ett_ospf_lsa_mpls_link_stlv
, NULL
,
2693 "%s: %u usec", stlv_name
,
2694 tvb_get_uint24(tvb
, stlv_offset
+ 5, ENC_BIG_ENDIAN
));
2695 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2696 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2697 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2698 ti
= proto_tree_add_bitmask(stlv_tree
, tvb
, stlv_offset
+4,
2699 hf_ospf_ls_unidir_link_flags
,
2700 ett_ospf_lsa_unidir_link_flags
,
2701 unidir_link_flags
, ENC_NA
);
2702 reserved
= tvb_get_uint8(tvb
, stlv_offset
) & 0x7f;
2703 if (reserved
!= 0) {
2704 expert_add_info_format(pinfo
, ti
, &ei_ospf_header_reserved
,
2705 "Reserved field should be 0");
2707 proto_tree_add_item(stlv_tree
, hf_ospf_ls_unidir_link_delay
, tvb
, stlv_offset
+5, 3, ENC_BIG_ENDIAN
);
2710 case MPLS_LINK_UNIDIR_LINK_DELAY_MIN_MAX
:
2711 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2712 ett_ospf_lsa_mpls_link_stlv
, NULL
,
2713 "%s: Min/Max %u/%u usec", stlv_name
,
2714 tvb_get_uint24(tvb
, stlv_offset
+ 5, ENC_BIG_ENDIAN
),
2715 tvb_get_uint24(tvb
, stlv_offset
+ 9, ENC_BIG_ENDIAN
));
2716 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2717 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2718 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2719 ti
= proto_tree_add_bitmask(stlv_tree
, tvb
, stlv_offset
+4,
2720 hf_ospf_ls_unidir_link_flags
,
2721 ett_ospf_lsa_unidir_link_flags
,
2722 unidir_link_flags
, ENC_NA
);
2723 reserved
= tvb_get_uint8(tvb
, stlv_offset
) & 0x7f;
2724 if (reserved
!= 0) {
2725 expert_add_info_format(pinfo
, ti
, &ei_ospf_header_reserved
,
2726 "Reserved field should be 0");
2728 proto_tree_add_item(stlv_tree
, hf_ospf_ls_unidir_link_delay_min
, tvb
, stlv_offset
+5, 3, ENC_BIG_ENDIAN
);
2729 ti
= proto_tree_add_item(stlv_tree
, hf_ospf_ls_unidir_link_reserved
, tvb
, stlv_offset
+8, 1, ENC_NA
);
2730 reserved
= tvb_get_uint8(tvb
, stlv_offset
+8);
2731 if (reserved
!= 0) {
2732 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
2734 proto_tree_add_item(stlv_tree
, hf_ospf_ls_unidir_link_delay_max
, tvb
, stlv_offset
+9, 3, ENC_BIG_ENDIAN
);
2737 case MPLS_LINK_UNIDIR_DELAY_VARIATION
:
2738 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2739 ett_ospf_lsa_mpls_link_stlv
, NULL
,
2740 "%s: %u usec", stlv_name
,
2741 tvb_get_uint24(tvb
, stlv_offset
+ 5, ENC_BIG_ENDIAN
));
2742 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2743 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2744 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2745 ti
= proto_tree_add_item(stlv_tree
, hf_ospf_ls_unidir_link_reserved
, tvb
, stlv_offset
+4, 1, ENC_NA
);
2746 reserved
= tvb_get_uint8(tvb
, stlv_offset
+4);
2747 if (reserved
!= 0) {
2748 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
2750 proto_tree_add_item(stlv_tree
, hf_ospf_ls_unidir_delay_variation
, tvb
, stlv_offset
+5, 3, ENC_BIG_ENDIAN
);
2753 case OIF_LOCAL_NODE_ID
:
2754 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2755 ett_ospf_lsa_mpls_link_stlv
, NULL
, "%s: %s", stlv_name
,
2756 tvb_ip_to_str(pinfo
->pool
, tvb
, stlv_offset
+ 4));
2757 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2758 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2759 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2760 proto_tree_add_item(stlv_tree
,
2761 hf_ospf_ls_oif_local_node_id
,
2762 tvb
, stlv_offset
+ 4, 4, ENC_BIG_ENDIAN
);
2765 case OIF_REMOTE_NODE_ID
:
2766 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2767 ett_ospf_lsa_mpls_link_stlv
, NULL
, "%s: %s", stlv_name
,
2768 tvb_ip_to_str(pinfo
->pool
, tvb
, stlv_offset
+ 4));
2769 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2770 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2771 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2772 proto_tree_add_item(stlv_tree
,
2773 hf_ospf_ls_oif_remote_node_id
,
2774 tvb
, stlv_offset
+ 4, 4, ENC_BIG_ENDIAN
);
2777 case OIF_SONET_SDH_SWITCHING_CAPABILITY
:
2778 stlv_tree
= proto_tree_add_subtree(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2779 ett_ospf_lsa_mpls_link_stlv
, NULL
, stlv_name
);
2780 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2781 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2782 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2783 proto_tree_add_item(stlv_tree
, hf_ospf_oif_switching_cap
, tvb
, stlv_offset
+4, 1, ENC_BIG_ENDIAN
);
2784 proto_tree_add_item(stlv_tree
, hf_ospf_oif_encoding
, tvb
, stlv_offset
+5, 1, ENC_BIG_ENDIAN
);
2785 for (i
= 0; i
< (stlv_len
- 4) / 4; i
++) {
2786 proto_tree_add_uint_format(stlv_tree
, hf_ospf_oif_signal_type
, tvb
, stlv_offset
+8+(i
*4), 4,
2787 tvb_get_uint8(tvb
, stlv_offset
+8+(i
*4)), "%s: %d free timeslots",
2788 val_to_str_ext(tvb_get_uint8(tvb
, stlv_offset
+8+(i
*4)),
2789 &gmpls_sonet_signal_type_str_ext
,
2790 "Unknown Signal Type (%d)"),
2791 tvb_get_ntoh24(tvb
, stlv_offset
+ 9 + i
*4));
2796 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2797 ett_ospf_lsa_mpls_link_stlv
, NULL
, "Unknown Link sub-TLV: %u %s", stlv_type
,
2798 rval_to_str_const(stlv_type
, mpls_te_sub_tlv_rvals
, "Unknown"));
2799 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2800 stlv_type
, "%u: %s %s", stlv_type
, stlv_name
,
2801 rval_to_str_const(stlv_type
, mpls_te_sub_tlv_rvals
, "Unknown"));
2802 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2803 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_value
, tvb
, stlv_offset
+4, stlv_len
, ENC_NA
);
2806 stlv_offset
+= ((stlv_len
+4+3)/4)*4;
2811 tlv_tree
= proto_tree_add_subtree(mpls_tree
, tvb
, offset
, tlv_length
+4,
2812 ett_ospf_lsa_oif_tna
, NULL
, "TNA Information");
2813 proto_tree_add_uint_format_value(tlv_tree
, hf_ospf_tlv_type
, tvb
, offset
, 2, 32768, "32768 - TNA Information");
2814 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
2815 stlv_offset
= offset
+ 4;
2817 /* Walk down the sub-TLVs for TNA information */
2818 while (stlv_offset
< tlv_end_offset
) {
2819 stlv_type
= tvb_get_ntohs(tvb
, stlv_offset
);
2820 stlv_len
= tvb_get_ntohs(tvb
, stlv_offset
+ 2);
2823 proto_tree_add_expert_format(tlv_tree
, pinfo
, &ei_ospf_stlv_length_invalid
, tvb
, stlv_offset
+ 2, 2,
2824 "Invalid sub-TLV length: %u", stlv_len
);
2828 stlv_name
= val_to_str_const(stlv_type
, oif_stlv_str
, "Unknown sub-TLV");
2829 switch (stlv_type
) {
2832 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2833 ett_ospf_lsa_oif_tna_stlv
, NULL
, "%s: %s", stlv_name
,
2834 tvb_ip_to_str(pinfo
->pool
, tvb
, stlv_offset
+ 4));
2835 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2836 stlv_type
, "%u: %s", stlv_type
, stlv_name
);
2837 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2838 proto_tree_add_ipv4_format(stlv_tree
, hf_ospf_oif_node_id
, tvb
, stlv_offset
+4, 4,
2839 tvb_get_ntohl(tvb
, stlv_offset
+ 4), "%s: %s", stlv_name
,
2840 tvb_ip_to_str(pinfo
->pool
, tvb
, stlv_offset
+ 4));
2843 case OIF_TNA_IPv4_ADDRESS
:
2844 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2845 ett_ospf_lsa_oif_tna_stlv
, NULL
, "%s (IPv4): %s", stlv_name
,
2846 tvb_ip_to_str(pinfo
->pool
, tvb
, stlv_offset
+ 8));
2847 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2848 stlv_type
, "%u: %s (IPv4)", stlv_type
, stlv_name
);
2849 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2850 proto_tree_add_item(stlv_tree
, hf_ospf_oif_tna_addr_length
, tvb
, stlv_offset
+4, 1, ENC_BIG_ENDIAN
);
2851 proto_tree_add_item(stlv_tree
, hf_ospf_oif_tna_addr_ipv4
, tvb
, stlv_offset
+8, stlv_len
- 4, ENC_BIG_ENDIAN
);
2854 case OIF_TNA_IPv6_ADDRESS
:
2855 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2856 ett_ospf_lsa_oif_tna_stlv
, NULL
, "%s (IPv6): %s", stlv_name
,
2857 tvb_ip6_to_str(pinfo
->pool
, tvb
, stlv_offset
+ 8));
2858 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2859 stlv_type
, "%u: %s (IPv6)", stlv_type
, stlv_name
);
2860 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2861 proto_tree_add_item(stlv_tree
, hf_ospf_oif_tna_addr_length
, tvb
, stlv_offset
+4, 1, ENC_BIG_ENDIAN
);
2862 proto_tree_add_item(stlv_tree
, hf_ospf_tna_addr_ipv6
, tvb
, stlv_offset
+8, stlv_len
- 4, ENC_NA
);
2865 case OIF_TNA_NSAP_ADDRESS
:
2866 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_len
+4,
2867 ett_ospf_lsa_oif_tna_stlv
, NULL
, "%s (NSAP): %s", stlv_name
,
2868 tvb_bytes_to_str(pinfo
->pool
, tvb
, stlv_offset
+ 8, stlv_len
- 4));
2869 proto_tree_add_uint_format_value(stlv_tree
, hf_ospf_tlv_type
, tvb
, stlv_offset
, 2,
2870 stlv_type
, "%u: %s (NSAP)", stlv_type
, stlv_name
);
2871 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+2, 2, ENC_BIG_ENDIAN
);
2872 proto_tree_add_item(stlv_tree
, hf_ospf_oif_tna_addr_length
, tvb
, stlv_offset
+4, 1, ENC_BIG_ENDIAN
);
2873 proto_tree_add_item(stlv_tree
, hf_ospf_tna_addr
, tvb
, stlv_offset
+8, stlv_len
- 4, ENC_NA
);
2877 proto_tree_add_expert_format(tlv_tree
, pinfo
, &ei_ospf_unknown_link_subtype
, tvb
, stlv_offset
, stlv_len
+4,
2878 "Unknown Link sub-TLV: %u", stlv_type
);
2881 stlv_offset
+= ((stlv_len
+4+3)/4)*4;
2885 tlv_tree
= proto_tree_add_subtree_format(mpls_tree
, tvb
, offset
, tlv_length
+4,
2886 ett_ospf_lsa_mpls_link
, NULL
, "Unknown LSA: %u %s", tlv_type
,
2887 rval_to_str_const(tlv_type
, mpls_te_tlv_rvals
, "Unknown"));
2888 proto_tree_add_uint_format_value(tlv_tree
, hf_ospf_tlv_type
, tvb
, offset
, 2, tlv_type
, "%u - Unknown %s",
2889 tlv_type
, rval_to_str_const(tlv_type
, mpls_te_tlv_rvals
, "Unknown"));
2890 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
2891 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_value
, tvb
, offset
+4, tlv_length
, ENC_NA
);
2895 offset
+= tlv_length
+ 4;
2896 length
-= tlv_length
+ 4;
2901 * Dissect the TLVs within a Grace-LSA as defined by RFC 3623
2903 static void dissect_ospf_lsa_grace_tlv (tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
,
2904 proto_tree
*tree
, uint32_t length
)
2907 uint16_t tlv_length
;
2908 int tlv_length_with_pad
; /* The total length of the TLV including the type
2909 and length fields and any padding */
2910 uint32_t grace_period
;
2911 uint8_t restart_reason
;
2912 proto_tree
*tlv_tree
;
2913 proto_item
*tree_item
;
2914 proto_item
*grace_tree_item
;
2916 if (!tree
) { return; }
2920 tlv_type
= tvb_get_ntohs(tvb
, offset
);
2921 tlv_length
= tvb_get_ntohs(tvb
, offset
+ 2);
2922 /* The total length of the TLV including the type, length, value and
2923 * pad bytes (TLVs are padded to 4 octet alignment).
2925 tlv_length_with_pad
= tlv_length
+ 4 + ((4 - (tlv_length
% 4)) % 4);
2927 tree_item
= proto_tree_add_item(tree
, hf_ospf_v2_grace_tlv
, tvb
, offset
,
2928 tlv_length_with_pad
, ENC_NA
);
2929 tlv_tree
= proto_item_add_subtree(tree_item
, ett_ospf_lsa_grace_tlv
);
2930 proto_tree_add_uint_format_value(tlv_tree
, hf_ospf_tlv_type
, tvb
, offset
, 2, tlv_type
, "%s (%u)",
2931 val_to_str_const(tlv_type
, grace_tlv_type_vals
, "Unknown grace-LSA TLV"), tlv_type
);
2932 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
2935 case GRACE_TLV_PERIOD
:
2936 grace_period
= tvb_get_ntohl(tvb
, offset
+ 4);
2937 grace_tree_item
= proto_tree_add_item(tlv_tree
, hf_ospf_v2_grace_period
, tvb
,
2938 offset
+ 4, tlv_length
, ENC_BIG_ENDIAN
);
2939 proto_item_append_text(grace_tree_item
, " seconds");
2940 proto_item_set_text(tree_item
, "Grace Period: %u seconds", grace_period
);
2942 case GRACE_TLV_REASON
:
2943 restart_reason
= tvb_get_uint8(tvb
, offset
+ 4);
2944 proto_tree_add_item(tlv_tree
, hf_ospf_v2_grace_reason
, tvb
, offset
+ 4,
2945 tlv_length
, ENC_BIG_ENDIAN
);
2946 proto_item_set_text(tree_item
, "Restart Reason: %s (%u)",
2947 val_to_str_const(restart_reason
, restart_reason_vals
, "Unknown Restart Reason"),
2951 proto_tree_add_item(tlv_tree
, hf_ospf_v2_grace_ip
, tvb
, offset
+ 4,
2952 tlv_length
, ENC_BIG_ENDIAN
);
2954 proto_item_set_text(tree_item
, "Restart IP: %s", tvb_address_with_resolution_to_str(pinfo
->pool
, tvb
, AT_IPv4
, offset
+ 4));
2957 proto_item_set_text(tree_item
, "Unknown grace-LSA TLV");
2960 if (4 + tlv_length
< tlv_length_with_pad
) {
2961 proto_tree_add_item(tlv_tree
, hf_ospf_pad_bytes
, tvb
, offset
+ 4 + tlv_length
, tlv_length_with_pad
- (4 + tlv_length
), ENC_NA
);
2963 offset
+= tlv_length_with_pad
;
2964 length
-= tlv_length_with_pad
;
2969 * Dissect the TLVs within a Extended-LSA as defined by RFC 8362
2971 static void dissect_ospf6_e_lsa_tlv(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
,
2972 uint32_t length
, uint8_t address_family
)
2975 unsigned tlv_length
;
2976 uint8_t prefix_length
;
2978 int offset_end
= offset
+ length
;
2980 proto_tree
*tlv_tree
;
2982 while(offset
< offset_end
) {
2983 tlv_type
= tvb_get_ntohs(tvb
, offset
);
2984 tlv_length
= tvb_get_ntohs(tvb
, offset
+ 2);
2986 tlv_tree
= proto_tree_add_subtree_format(tree
, tvb
, offset
, tlv_length
+4,
2987 ett_ospf_elsa_pfx_tlv
, NULL
, "%s", val_to_str_const(tlv_type
, ospf6_extended_lsa_tlv_type_vals
, "Unknown E-LSA TLV"));
2989 proto_tree_add_item(tlv_tree
, hf_ospf_v3_e_lsa_tlv_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2991 proto_tree_add_item(tlv_tree
, hf_ospf_v3_e_lsa_tlv_length
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
2995 case OSPF6_TLV_INTRA_AREA_PREFIX
:
2997 proto_tree_add_item(tlv_tree
, hf_ospf_metric
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
3000 prefix_length
=tvb_get_uint8(tvb
, offset
+ 8);
3001 proto_tree_add_item(tlv_tree
, hf_ospf_prefix_length
, tvb
, offset
+ 8, 1, ENC_BIG_ENDIAN
);
3003 /* prefix options */
3004 proto_tree_add_bitmask(tlv_tree
, tvb
, offset
+ 9, hf_ospf_v3_prefix_option
, ett_ospf_v3_prefix_options
, bf_v3_prefix_options
, ENC_BIG_ENDIAN
);
3006 /* address_prefix */
3007 dissect_ospf_v3_address_prefix(tvb
, pinfo
, offset
+ 12, prefix_length
, tlv_tree
, address_family
);
3009 offset
+= 4 + WS_ROUNDUP_4(tlv_length
);
3012 case OSPF6_TLV_ROUTER_LINK
:
3014 proto_tree_add_item(tlv_tree
, hf_ospf_v3_lsa_type
, tvb
, offset
+ 4, 1, ENC_BIG_ENDIAN
);
3016 proto_tree_add_item(tlv_tree
, hf_ospf_header_reserved
, tvb
, offset
+5, 1, ENC_NA
);
3018 proto_tree_add_item(tlv_tree
, hf_ospf_metric
, tvb
, offset
+ 6, 2, ENC_BIG_ENDIAN
);
3020 proto_tree_add_item(tlv_tree
, hf_ospf_v3_lsa_interface_id
, tvb
, offset
+ 8, 4, ENC_BIG_ENDIAN
);
3021 /* Neighbor Interface ID */
3022 proto_tree_add_item(tlv_tree
, hf_ospf_v3_lsa_neighbor_interface_id
, tvb
, offset
+ 12, 4, ENC_BIG_ENDIAN
);
3023 /* Neighbor Router ID */
3024 proto_tree_add_item(tlv_tree
, hf_ospf_v3_lsa_neighbor_router_id
, tvb
, offset
+ 16, 4, ENC_BIG_ENDIAN
);
3026 offset
+= 4 + WS_ROUNDUP_4(tlv_length
);
3029 case OSPF6_TLV_IPV6_LL_ADDR
:
3031 proto_tree_add_item(tlv_tree
, hf_ospf_v3_lsa_link_local_interface_address
, tvb
, offset
+ 4, 16, ENC_NA
);
3032 offset
+= 4 + WS_ROUNDUP_4(tlv_length
);
3034 case OSPF6_TLV_ATTACHED_ROUTERS
:
3035 proto_tree_add_item(tlv_tree
, hf_ospf_v3_lsa_attached_router
, tvb
, offset
+4, 4, ENC_BIG_ENDIAN
);
3036 offset
+= 4 + WS_ROUNDUP_4(tlv_length
);
3038 case OSPF6_TLV_EXTERNAL_PREFIX
:
3039 /* FIXME: first 8 bits unclear in RFC 8362. */
3040 proto_tree_add_bitmask(tlv_tree
, tvb
, offset
+4, hf_ospf_v3_as_external_flag
, ett_ospf_v3_as_external_flags
, bf_v3_as_external_flags
, ENC_BIG_ENDIAN
);
3043 proto_tree_add_item(tlv_tree
, hf_ospf_metric
, tvb
, offset
+5, 3, ENC_BIG_ENDIAN
);
3045 prefix_length
=tvb_get_uint8(tvb
, offset
+8);
3046 proto_tree_add_item(tlv_tree
, hf_ospf_prefix_length
, tvb
, offset
+8, 1, ENC_BIG_ENDIAN
);
3048 /* prefix options */
3049 proto_tree_add_bitmask(tlv_tree
, tvb
, offset
+ 9, hf_ospf_v3_prefix_option
, ett_ospf_v3_prefix_options
, bf_v3_prefix_options
, ENC_BIG_ENDIAN
);
3051 /* address_prefix */
3052 dissect_ospf_v3_address_prefix(tvb
, pinfo
, offset
+ 12, prefix_length
, tlv_tree
, address_family
);
3053 offset
+= 4 + WS_ROUNDUP_4(tlv_length
);
3057 offset
+= 4 + WS_ROUNDUP_4(tlv_length
);
3066 * This function dissects the Optional Router capabilities LSA.
3067 * In case of OSPFv2, the Router Capabilities would be advertized via the first TLV
3068 * of an RI LSA and in the case of OSPFv3, the router capabilities would be advertized
3069 * using a special purpose type field value. (RFC 4970)
3070 * Also, the Dynamic Hostname or FQDN is advertized via a special purpose TLV type.
3071 * The below function adds the support to handle this as well. (RFC5642).
3074 dissect_ospf_lsa_opaque_ri(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
,
3077 proto_tree
*ri_tree
;
3078 proto_tree
*tlv_tree
;
3079 proto_tree
*stlv_tree
;
3080 proto_item
*ti_tree
= NULL
;
3082 int offset_end
= offset
+ length
;
3085 unsigned tlv_length
;
3086 int tlv_offset
, tlv_end_offset
;
3088 uint16_t stlv_length
;
3090 const char *tlv_name
;
3091 const char *stlv_name
;
3092 uint32_t range_size
;
3095 ri_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, length
,
3096 ett_ospf_lsa_opaque_ri
, NULL
, "Opaque Router Information LSA");
3098 while (offset
< offset_end
) {
3099 tlv_type
= tvb_get_ntohs(tvb
, offset
);
3100 tlv_length
= tvb_get_ntohs(tvb
, offset
+ 2);
3101 tlv_end_offset
= offset
+ tlv_length
+ 4;
3102 tlv_name
= val_to_str_const(tlv_type
, ri_tlv_type_vals
, "Unknown");
3107 tlv_tree
= proto_tree_add_subtree_format(ri_tree
, tvb
, offset
, tlv_length
+4,
3108 ett_ospf_lsa_ri_tlv
, NULL
, "%s", val_to_str_const(tlv_type
, ri_tlv_type_vals
, "Unknown Opaque RI LSA TLV"));
3110 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_type_opaque
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3112 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
3114 proto_tree_add_bitmask(tlv_tree
, tvb
, offset
+ 4, hf_ospf_ri_options
, ett_ospf_ri_options
, bf_ri_options
, ENC_BIG_ENDIAN
);
3118 tlv_tree
= proto_tree_add_subtree_format(ri_tree
, tvb
, offset
, tlv_length
+4,
3119 ett_ospf_lsa_dh_tlv
, NULL
, "%s", val_to_str_const(tlv_type
, ri_tlv_type_vals
, "Unknown Opaque RI LSA TLV"));
3121 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_type_opaque
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3123 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
3125 proto_tree_add_item(tlv_tree
, hf_ospf_dyn_hostname
, tvb
, offset
+4, tlv_length
, ENC_ASCII
);
3128 case OPAQUE_TLV_SA
:{
3130 tlv_tree
= proto_tree_add_subtree_format(ri_tree
, tvb
, offset
, tlv_length
+4,
3131 ett_ospf_lsa_sa_tlv
, NULL
, "%s", val_to_str_const(tlv_type
, ri_tlv_type_vals
, "Unknown Opaque RI LSA TLV"));
3133 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_type_opaque
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3135 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
3137 for(sa_number
= 0; sa_number
< tlv_length
; sa_number
++){
3138 proto_tree_add_item(tlv_tree
, hf_ospf_lsa_sa
, tvb
, offset
+sa_number
+4, 1, ENC_ASCII
|ENC_NA
);
3143 case OPAQUE_TLV_SLR
:
3144 case OPAQUE_TLV_SRLB
:
3145 tlv_tree
= proto_tree_add_subtree_format(ri_tree
, tvb
, offset
, tlv_length
+ 4,
3146 ett_ospf_lsa_slr_tlv
, &ti_tree
, "%s", tlv_name
);
3147 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_type_opaque
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3148 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
3149 proto_tree_add_item_ret_uint(tlv_tree
, hf_ospf_ls_range_size
, tvb
, offset
+ 4, 3, ENC_BIG_ENDIAN
, &range_size
);
3150 proto_item_append_text(ti_tree
, " (Range Size: %u)", range_size
);
3151 reserved
= tvb_get_uint8(tvb
, offset
+ 7);
3152 ti
= proto_tree_add_item(tlv_tree
, hf_ospf_header_reserved
, tvb
, offset
+ 7, 1, ENC_NA
);
3153 if (reserved
!= 0) {
3154 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
3156 stlv_offset
= offset
+ 8;
3158 /* Walk down the sub-TLVs in SID/Label Range TLV */
3159 while (stlv_offset
< tlv_end_offset
) {
3161 stlv_type
= tvb_get_ntohs(tvb
, stlv_offset
);
3162 stlv_length
= tvb_get_ntohs(tvb
, stlv_offset
+ 2);
3163 stlv_name
= val_to_str_const(stlv_type
, ext_pfx_stlv_type_vals
, "Unknown");
3165 switch (stlv_type
) {
3167 case SR_STLV_SID_LABEL
:
3168 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_length
+ 4,
3169 ett_ospf_lsa_slr_stlv
, &ti_tree
,
3170 "%s Sub-TLV", stlv_name
);
3171 proto_tree_add_item(stlv_tree
, hf_ospf_ls_slr_stlv
, tvb
, stlv_offset
, 2, ENC_BIG_ENDIAN
);
3172 ti
= proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+ 2, 2, ENC_BIG_ENDIAN
);
3173 if (stlv_length
== 3) {
3174 sid_label
= tvb_get_ntoh24(tvb
, stlv_offset
+ 4);
3175 } else if (stlv_length
== 4) {
3176 sid_label
= tvb_get_ntohl(tvb
, stlv_offset
+ 4);
3178 /* Invalid sub-TLV length. */
3179 proto_item_append_text(ti
, " [Invalid length - %u]", stlv_length
);
3180 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_value
, tvb
, stlv_offset
+ 4, stlv_length
, ENC_NA
);
3183 proto_tree_add_item(stlv_tree
, hf_ospf_ls_sid_label
, tvb
, stlv_offset
+ 4, stlv_length
, ENC_BIG_ENDIAN
);
3184 proto_item_append_text(ti_tree
, " (SID/Label: %u)", sid_label
);
3188 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_length
+ 4,
3189 ett_ospf_lsa_slr_stlv
, NULL
,
3190 "%s Sub-TLV: %u", stlv_name
, stlv_type
);
3191 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+ 2, 2, ENC_BIG_ENDIAN
);
3192 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_value
, tvb
, stlv_offset
+ 4, stlv_length
, ENC_NA
);
3195 stlv_offset
+= 4 + WS_ROUNDUP_4(stlv_length
);
3199 case OPAQUE_TLV_SRMS_PREF
:
3200 tlv_tree
= proto_tree_add_subtree_format(ri_tree
, tvb
, offset
, tlv_length
+ 4,
3201 ett_ospf_lsa_srms_tlv
, NULL
, "%s", val_to_str_const(tlv_type
, ri_tlv_type_vals
, "Unknown Opaque RI LSA TLV"));
3202 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_type_opaque
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3203 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
3204 proto_tree_add_item(tlv_tree
, hf_ospf_ls_preference
, tvb
, offset
+ 4, 1, ENC_BIG_ENDIAN
);
3205 reserved
= tvb_get_ntoh24(tvb
, offset
+ 5);
3206 ti
= proto_tree_add_item(tlv_tree
, hf_ospf_header_reserved
, tvb
, offset
+ 5, 3, ENC_NA
);
3207 if (reserved
!= 0) {
3208 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
3212 case OPAQUE_TLV_NODE_MSD
:
3213 /* Node MSD (rfc8476) */
3214 tlv_offset
= offset
+ 4;
3215 tlv_tree
= proto_tree_add_subtree_format(ri_tree
, tvb
, offset
, tlv_length
+ 4,
3216 ett_ospf_lsa_node_msd_tlv
, &ti_tree
, "%s", tlv_name
);
3217 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_type_opaque
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3218 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
3219 while (tlv_offset
+ 2 <= tlv_end_offset
) {
3220 proto_tree_add_item(tlv_tree
, hf_ospf_ls_igp_msd_type
, tvb
, tlv_offset
, 1, ENC_NA
);
3221 proto_tree_add_item(tlv_tree
, hf_ospf_ls_igp_msd_value
, tvb
, tlv_offset
+1, 1, ENC_NA
);
3226 case OPAQUE_TLV_FLEX_ALGO_DEF
:
3227 /* Flex Algo Definition (FAD) (draft-ietf-lsr-flex-algo-17) */
3228 tlv_tree
= proto_tree_add_subtree_format(ri_tree
, tvb
, offset
, tlv_length
+ 4,
3229 ett_ospf_lsa_fad_tlv
, &ti_tree
, "%s", tlv_name
);
3230 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_type_opaque
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3231 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
3232 proto_item_append_text(ti_tree
, " (%u)", tvb_get_uint8(tvb
, offset
+ 4));
3233 proto_tree_add_item(tlv_tree
, hf_ospf_ls_fad_flex_algorithm
, tvb
, offset
+ 4, 1, ENC_NA
);
3234 proto_tree_add_item(tlv_tree
, hf_ospf_ls_fad_metric_type
, tvb
, offset
+ 5, 1, ENC_NA
);
3235 proto_tree_add_item(tlv_tree
, hf_ospf_ls_fad_calc_type
, tvb
, offset
+ 6, 1, ENC_NA
);
3236 proto_tree_add_item(tlv_tree
, hf_ospf_ls_fad_priority
, tvb
, offset
+ 7, 1, ENC_NA
);
3238 /* Walk down sub-TLVs in FAD TLV */
3239 stlv_offset
= offset
+ 8;
3240 while (stlv_offset
< tlv_end_offset
) {
3241 stlv_type
= tvb_get_ntohs(tvb
, stlv_offset
);
3242 stlv_length
= tvb_get_ntohs(tvb
, stlv_offset
+ 2);
3243 stlv_name
= val_to_str_const(stlv_type
, ri_lsa_fad_stlv_type_vals
, "Unknown");
3245 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_length
+ 4,
3246 ett_ospf_lsa_fad_stlv
,
3247 NULL
, "%s", stlv_name
);
3248 proto_tree_add_item(stlv_tree
, hf_ospf_ls_fad_stlv
, tvb
, stlv_offset
, 2, ENC_BIG_ENDIAN
);
3249 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+ 2, 2, ENC_BIG_ENDIAN
);
3250 switch (stlv_type
) {
3251 case FAD_EXCLUDE_AG
:
3252 case FAD_INCLUDE_ANY_AG
:
3253 case FAD_INCLUDE_ALL_AG
:
3254 dissect_ospf_subtlv_ext_admin_group(tvb
, stlv_tree
, stlv_offset
+ 4, stlv_type
, stlv_length
);
3257 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_value
, tvb
, stlv_offset
+ 4, stlv_length
, ENC_NA
);
3261 stlv_offset
+= 4 + WS_ROUNDUP_4(stlv_length
);
3266 if (tlv_length
> (unsigned)(offset_end
- offset
)) {
3267 /* Invalid length, probably not TLV. */
3270 tlv_tree
= proto_tree_add_subtree_format(ri_tree
, tvb
, offset
, tlv_length
+4,
3271 ett_ospf_lsa_unknown_tlv
, NULL
, "%s (t=%u, l=%u)",
3272 val_to_str_const(tlv_type
, ri_tlv_type_vals
, "Unknown Opaque RI LSA TLV"),
3273 tlv_type
, tlv_length
);
3275 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_type_opaque
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3277 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
3279 proto_tree_add_item(tlv_tree
, hf_ospf_unknown_tlv
, tvb
, offset
+4, tlv_length
, ENC_NA
);
3285 * RFC 7770, section 2.3: 4-octet aligned, but type, length and padding
3286 * is not included in the length.
3288 offset
+= 4 + WS_ROUNDUP_4(tlv_length
);
3293 * Dissect Extended Prefix Opaque LSA
3295 * This function dissects the Optional Extended Prefix Opaque LSA.
3296 * The below function adds the support to handle this as well. (RFC7684).
3299 dissect_ospf_lsa_ext_prefix(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
,
3302 proto_tree
*ep_tree
;
3303 proto_tree
*tlv_tree
;
3304 proto_tree
*stlv_tree
;
3305 proto_item
*ti_tree
= NULL
;
3307 int offset_end
= offset
+ length
;
3310 unsigned tlv_length
;
3313 uint16_t stlv_length
;
3315 const char *tlv_name
;
3316 const char *stlv_name
;
3318 uint32_t prefix_length
;
3320 uint32_t range_size
;
3323 ep_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, length
,
3324 ett_ospf_lsa_epfx
, NULL
, "OSPFv2 Extended Prefix Opaque LSA");
3326 while (offset
< offset_end
) {
3327 tlv_type
= tvb_get_ntohs(tvb
, offset
);
3328 tlv_length
= tvb_get_ntohs(tvb
, offset
+ 2);
3329 tlv_end_offset
= offset
+ tlv_length
+ 4;
3330 tlv_name
= val_to_str_const(tlv_type
, ext_pfx_tlv_type_vals
, "Unknown");
3334 case EXT_PREFIX_TLV_PREFIX
:
3335 tlv_tree
= proto_tree_add_subtree_format(ep_tree
, tvb
, offset
, tlv_length
+ 4,
3336 ett_ospf_lsa_epfx_tlv
, &ti_tree
, "%s TLV", tlv_name
);
3337 proto_tree_add_item(tlv_tree
, hf_ospf_ls_epfx_tlv
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3338 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
3339 route_type
= tvb_get_uint8(tvb
, offset
+ 4);
3340 proto_tree_add_item(tlv_tree
, hf_ospf_ls_epfx_route_type
, tvb
, offset
+ 4, 1, ENC_BIG_ENDIAN
);
3341 proto_tree_add_item_ret_uint(tlv_tree
, hf_ospf_prefix_length
, tvb
, offset
+ 5, 1, ENC_BIG_ENDIAN
, &prefix_length
);
3342 proto_tree_add_item(tlv_tree
, hf_ospf_ls_epfx_af
, tvb
, offset
+ 6, 1, ENC_BIG_ENDIAN
);
3343 proto_tree_add_bitmask(tlv_tree
, tvb
, offset
+ 7, hf_ospf_ls_epfx_flags
, ett_ospf_lsa_epfx_flags
, bf_ospf_epfx_flags
, ENC_BIG_ENDIAN
);
3344 if (prefix_length
!= 0) {
3345 proto_tree_add_item(tlv_tree
, hf_ospf_v3_address_prefix_ipv4
, tvb
, offset
+ 8, 4, ENC_BIG_ENDIAN
);
3347 proto_item_append_text(ti_tree
, " (Type: %-13s Prefix: %s/%u)",
3348 val_to_str_const(route_type
, ext_pfx_tlv_route_vals
, "Unknown"),
3349 prefix_length
== 0 ? "0.0.0.0" : tvb_ip_to_str(pinfo
->pool
, tvb
, offset
+ 8),
3351 stlv_offset
= offset
+ 8 + (prefix_length
!= 0 ? 4 : 0);
3354 case EXT_PREFIX_TLV_PREFIX_RANGE
:
3355 tlv_tree
= proto_tree_add_subtree_format(ep_tree
, tvb
, offset
, tlv_length
+ 4,
3356 ett_ospf_lsa_epfx_tlv
, &ti_tree
, "%s TLV", tlv_name
);
3357 proto_tree_add_item(tlv_tree
, hf_ospf_ls_epfx_tlv
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3358 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
3359 proto_tree_add_item_ret_uint(tlv_tree
, hf_ospf_prefix_length
, tvb
, offset
+ 4, 1, ENC_BIG_ENDIAN
, &prefix_length
);
3360 proto_tree_add_item(tlv_tree
, hf_ospf_ls_epfx_af
, tvb
, offset
+ 5, 1, ENC_BIG_ENDIAN
);
3361 proto_tree_add_item_ret_uint(tlv_tree
, hf_ospf_ls_range_size
, tvb
, offset
+ 6, 2, ENC_BIG_ENDIAN
, &range_size
);
3362 proto_tree_add_bitmask(tlv_tree
, tvb
, offset
+ 8, hf_ospf_ls_epfx_range_flags
, ett_ospf_lsa_epfx_range_flags
, bf_ospf_epfx_range_flags
, ENC_BIG_ENDIAN
);
3363 reserved
= tvb_get_ntoh24(tvb
, offset
+ 9);
3364 ti
= proto_tree_add_item(tlv_tree
, hf_ospf_header_reserved
, tvb
, offset
+ 9, 3, ENC_NA
);
3365 if (reserved
!= 0) {
3366 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
3368 if (prefix_length
!= 0) {
3369 proto_tree_add_item(tlv_tree
, hf_ospf_v3_address_prefix_ipv4
, tvb
, offset
+ 12, 4, ENC_BIG_ENDIAN
);
3371 proto_item_append_text(ti_tree
, " (Range Size: %u, Prefix: %s/%u)",
3373 prefix_length
== 0 ? "0.0.0.0" : tvb_ip_to_str(pinfo
->pool
, tvb
, offset
+ 12),
3375 stlv_offset
= offset
+ 12 + (prefix_length
!= 0 ? 4 : 0);
3379 if (tlv_length
> (unsigned)(offset_end
- offset
)) {
3380 /* Invalid length, probably not TLV. */
3383 tlv_tree
= proto_tree_add_subtree_format(ep_tree
, tvb
, offset
, tlv_length
+ 4,
3384 ett_ospf_lsa_epfx_tlv
, NULL
,
3385 "%s TLV: %u - Unknown", tlv_name
, tlv_type
);
3386 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_type_opaque
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3387 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
3388 proto_tree_add_item(tlv_tree
, hf_ospf_unknown_tlv
, tvb
, offset
+ 4, tlv_length
, ENC_NA
);
3389 stlv_offset
= offset
+ 4;
3393 if (tlv_type
== EXT_PREFIX_TLV_PREFIX
|| tlv_type
== EXT_PREFIX_TLV_PREFIX_RANGE
) {
3394 /* Walk down the sub-TLVs in Extended Link TLV */
3395 while (stlv_offset
< tlv_end_offset
) {
3396 stlv_type
= tvb_get_ntohs(tvb
, stlv_offset
);
3397 stlv_length
= tvb_get_ntohs(tvb
, stlv_offset
+ 2);
3398 stlv_name
= val_to_str_const(stlv_type
, ext_pfx_stlv_type_vals
, "Unknown");
3400 switch (stlv_type
) {
3402 case SR_STLV_PREFIX_SID
:
3403 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_length
+ 4,
3404 ett_ospf_lsa_epfx_stlv
, &ti_tree
,
3405 "%s Sub-TLV", stlv_name
);
3406 proto_tree_add_item(stlv_tree
, hf_ospf_ls_epfx_stlv
, tvb
, stlv_offset
, 2, ENC_BIG_ENDIAN
);
3407 ti
= proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+ 2, 2, ENC_BIG_ENDIAN
);
3408 if (stlv_length
== 7) {
3409 sid_label
= tvb_get_ntoh24(tvb
, stlv_offset
+ 8);
3410 } else if (stlv_length
== 8) {
3411 sid_label
= tvb_get_ntohl(tvb
, stlv_offset
+ 8);
3413 /* Invalid sub-TLV length. */
3414 proto_item_append_text(ti
, " [Invalid length - %u]", stlv_length
);
3415 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_value
, tvb
, stlv_offset
+ 4, stlv_length
, ENC_NA
);
3418 proto_tree_add_bitmask(stlv_tree
, tvb
, stlv_offset
+ 4, hf_ospf_ls_pfxsid_flags
, ett_ospf_lsa_pfxsid_flags
, bf_ospf_pfxsid_flags
, ENC_BIG_ENDIAN
);
3419 reserved
= tvb_get_uint8(tvb
, stlv_offset
+ 5);
3420 ti
= proto_tree_add_item(stlv_tree
, hf_ospf_header_reserved
, tvb
, stlv_offset
+ 5, 1, ENC_NA
);
3421 if (reserved
!= 0) {
3422 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
3424 proto_tree_add_item(stlv_tree
, hf_ospf_ls_elink_mt_id
, tvb
, stlv_offset
+ 6, 1, ENC_BIG_ENDIAN
);
3425 proto_tree_add_item(stlv_tree
, hf_ospf_lsa_sa
, tvb
, stlv_offset
+ 7, 1, ENC_BIG_ENDIAN
);
3426 proto_tree_add_item(stlv_tree
, hf_ospf_ls_sid_label
, tvb
, stlv_offset
+ 8, (stlv_length
- 4), ENC_BIG_ENDIAN
);
3427 proto_item_append_text(ti_tree
, " (SID/Label: %u)",sid_label
);
3431 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_length
+ 4,
3432 ett_ospf_lsa_epfx_stlv
, NULL
,
3433 "%s Sub-TLV: %u - Unknown", stlv_name
, stlv_type
);
3434 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+ 2, 2, ENC_BIG_ENDIAN
);
3435 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_value
, tvb
, stlv_offset
+ 4, stlv_length
, ENC_NA
);
3438 stlv_offset
+= 4 + WS_ROUNDUP_4(stlv_length
);
3443 * RFC 7770, section 2.3: 4-octet aligned, but type, length and padding
3444 * is not included in the length.
3446 offset
+= 4 + WS_ROUNDUP_4(tlv_length
);
3451 * Dissect Application-Specific Link Attributes Sub-Sub-TLVs
3454 dissect_ospf_lsa_app_link_attributes(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, int offset
, proto_tree
*tree
,
3457 proto_tree
*stlv_tree
= NULL
;
3458 proto_item
*ti_tree
= NULL
, *ti
= NULL
;
3459 int offset_end
= offset
+ length
;
3460 int stlv_offset
= offset
;
3461 uint16_t stlv_type
, stlv_length
;
3462 const char *stlv_name
;
3463 uint32_t delay
, delay_min
, delay_max
, reserved
;
3464 uint32_t admin_group
, te_metric
;
3466 while (stlv_offset
< offset_end
) {
3467 stlv_type
= tvb_get_ntohs(tvb
, stlv_offset
);
3468 stlv_length
= tvb_get_ntohs(tvb
, stlv_offset
+ 2);
3469 stlv_name
= val_to_str_const(stlv_type
, ext_link_stlv_type_vals
, "Unknown");
3471 stlv_tree
= proto_tree_add_subtree_format(tree
, tvb
, stlv_offset
, stlv_length
+ 4,
3472 ett_ospf_lsa_app_link_attrs_stlv
, &ti_tree
,
3473 "%s Sub-TLV", stlv_name
);
3474 proto_tree_add_item(stlv_tree
, hf_ospf_ls_app_link_attrs_stlv
, tvb
, stlv_offset
, 2, ENC_BIG_ENDIAN
);
3475 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+ 2, 2, ENC_BIG_ENDIAN
);
3478 switch (stlv_type
) {
3479 case SR_STLV_UNIDIR_LINK_DELAY
:
3480 /* 12: Unidirectional Link Delay (rfc7471) */
3481 ti
= proto_tree_add_bitmask(stlv_tree
, tvb
, stlv_offset
,
3482 hf_ospf_ls_unidir_link_flags
,
3483 ett_ospf_lsa_unidir_link_flags
,
3484 unidir_link_flags
, ENC_NA
);
3485 reserved
= tvb_get_uint8(tvb
, stlv_offset
) & 0x7f;
3486 if (reserved
!= 0) {
3487 expert_add_info_format(pinfo
, ti
, &ei_ospf_header_reserved
,
3488 "Reserved field should be 0");
3490 delay
= tvb_get_uint24(tvb
, stlv_offset
+ 1, ENC_BIG_ENDIAN
);
3491 proto_tree_add_item(stlv_tree
, hf_ospf_ls_unidir_link_delay
, tvb
, stlv_offset
+ 1, 3, ENC_BIG_ENDIAN
);
3493 proto_item_append_text(ti_tree
, " (Delay: %u usec)", delay
);
3497 case SR_STLV_UNIDIR_LINK_DELAY_MIN_MAX
:
3498 /* 13: Min/Max Unidirectional Link Delay (rfc7471) */
3499 ti
= proto_tree_add_bitmask(stlv_tree
, tvb
, stlv_offset
,
3500 hf_ospf_ls_unidir_link_flags
,
3501 ett_ospf_lsa_unidir_link_flags
,
3502 unidir_link_flags
, ENC_NA
);
3503 reserved
= tvb_get_uint8(tvb
, stlv_offset
) & 0x7f;
3504 if (reserved
!= 0) {
3505 expert_add_info_format(pinfo
, ti
, &ei_ospf_header_reserved
,
3506 "Reserved field should be 0");
3508 delay_min
= tvb_get_uint24(tvb
, stlv_offset
+ 1, ENC_BIG_ENDIAN
);
3509 proto_tree_add_item(stlv_tree
, hf_ospf_ls_unidir_link_delay_min
, tvb
, stlv_offset
+1, 3, ENC_BIG_ENDIAN
);
3510 ti
= proto_tree_add_item(stlv_tree
, hf_ospf_ls_unidir_link_reserved
, tvb
, stlv_offset
+4, 1, ENC_NA
);
3511 reserved
= tvb_get_uint8(tvb
, stlv_offset
+4);
3512 if (reserved
!= 0) {
3513 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
3515 delay_max
= tvb_get_uint24(tvb
, stlv_offset
+ 5, ENC_BIG_ENDIAN
);
3516 proto_tree_add_item(stlv_tree
, hf_ospf_ls_unidir_link_delay_max
, tvb
, stlv_offset
+5, 3, ENC_BIG_ENDIAN
);
3518 proto_item_append_text(ti_tree
, " (Min/Max Delay: %u/%u usec)", delay_min
, delay_max
);
3522 case SR_STLV_UNIDIR_DELAY_VARIATION
:
3523 /* 14: Unidirectional Delay Variation (rfc7471) */
3524 ti
= proto_tree_add_item(stlv_tree
, hf_ospf_ls_unidir_link_reserved
, tvb
, stlv_offset
, 1, ENC_NA
);
3525 reserved
= tvb_get_uint8(tvb
, stlv_offset
);
3526 if (reserved
!= 0) {
3527 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
3529 delay
= tvb_get_uint24(tvb
, stlv_offset
+ 1, ENC_BIG_ENDIAN
);
3530 proto_tree_add_item(stlv_tree
, hf_ospf_ls_unidir_delay_variation
, tvb
, stlv_offset
+ 1, 3, ENC_BIG_ENDIAN
);
3532 proto_item_append_text(ti_tree
, " (Variation: %u usec)", delay
);
3536 case SR_STLV_ADMIN_GROUP
:
3537 /* 19: Administrative Group (rfc3630) */
3538 admin_group
= tvb_get_uint32(tvb
, stlv_offset
, ENC_BIG_ENDIAN
);
3539 proto_tree_add_item(stlv_tree
, hf_ospf_ls_admin_group
, tvb
, stlv_offset
, 4, ENC_BIG_ENDIAN
);
3541 proto_item_append_text(ti_tree
, " (Admin Group: 0x%08x)", admin_group
);
3545 case SR_STLV_EXT_ADMIN_GROUP
:
3546 /* 20: Extended Administrative Group (rfc7308) */
3547 dissect_ospf_subtlv_ext_admin_group(tvb
, stlv_tree
, stlv_offset
, stlv_type
, stlv_length
);
3550 case SR_STLV_TE_METRIC
:
3551 /* 22: TE Metric (rfc3630) */
3552 te_metric
= tvb_get_uint32(tvb
, stlv_offset
, ENC_BIG_ENDIAN
);
3553 proto_tree_add_item(stlv_tree
, hf_ospf_ls_mpls_te_metric
, tvb
, stlv_offset
, 4, ENC_BIG_ENDIAN
);
3555 proto_item_append_text(ti_tree
, " (TE Metric: %u)", te_metric
);
3560 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_value
, tvb
, stlv_offset
, stlv_length
, ENC_NA
);
3564 stlv_offset
+= WS_ROUNDUP_4(stlv_length
);
3569 * Dissect Extended Link Opaque LSA
3571 * This function dissects the Optional Extended Link Opaque LSA.
3572 * The below function adds the support to handle this as well. (RFC7684).
3575 dissect_ospf_lsa_ext_link(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
,
3578 proto_tree
*el_tree
;
3579 proto_tree
*tlv_tree
;
3580 proto_tree
*stlv_tree
;
3581 proto_item
*ti_tree
= NULL
;
3583 int offset_end
= offset
+ length
;
3586 unsigned tlv_length
;
3589 uint16_t stlv_length
;
3591 const char *tlv_name
;
3592 const char *stlv_name
;
3597 uint16_t local_length
;
3598 uint32_t local_id
= 0, remote_id
= 0;
3599 uint8_t sabm_length
= 0, udabm_length
= 0;
3601 el_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, length
,
3602 ett_ospf_lsa_elink
, NULL
, "OSPFv2 Extended Link Opaque LSA");
3604 while (offset
< offset_end
) {
3605 tlv_type
= tvb_get_ntohs(tvb
, offset
);
3606 tlv_length
= tvb_get_ntohs(tvb
, offset
+ 2);
3607 tlv_end_offset
= offset
+ tlv_length
+ 4;
3608 tlv_name
= val_to_str_const(tlv_type
, ext_link_tlv_type_vals
, "Unknown");
3612 case EXT_LINK_TLV_LINK
:
3613 tlv_tree
= proto_tree_add_subtree_format(el_tree
, tvb
, offset
, tlv_length
+ 4,
3614 ett_ospf_lsa_elink_tlv
, &ti_tree
, "%s TLV", tlv_name
);
3615 proto_tree_add_item(tlv_tree
, hf_ospf_ls_elink_tlv
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3616 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
3618 link_type
= tvb_get_uint8(tvb
, offset
+ 4);
3619 ti
= proto_tree_add_item(tlv_tree
, hf_ospf_ls_router_linktype
, tvb
, offset
+ 4, 1, ENC_BIG_ENDIAN
);
3620 proto_item_append_text(ti
, " - %s",
3621 val_to_str_const(link_type
, ospf_v3_lsa_type_vals
, "Unknown link type"));
3622 proto_item_append_text(ti_tree
, " (Type: %-8s ID: %-15s Data: %s)",
3623 val_to_str_const(link_type
, ospf_v3_lsa_type_short_vals
, "Unknown"),
3624 tvb_ip_to_str(pinfo
->pool
, tvb
, offset
+ 8),
3625 tvb_ip_to_str(pinfo
->pool
, tvb
, offset
+ 12));
3626 reserved
= tvb_get_ntoh24(tvb
, offset
+ 5);
3627 ti
= proto_tree_add_item(tlv_tree
, hf_ospf_header_reserved
, tvb
, offset
+ 5, 3, ENC_NA
);
3628 if (reserved
!= 0) {
3629 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
3631 proto_tree_add_item(tlv_tree
, hf_ospf_ls_router_linkid
, tvb
, offset
+ 8, 4, ENC_BIG_ENDIAN
);
3632 proto_tree_add_item(tlv_tree
, hf_ospf_ls_router_linkdata
, tvb
, offset
+ 12, 4, ENC_BIG_ENDIAN
);
3633 stlv_offset
= offset
+ 16;
3635 /* Walk down the sub-TLVs in Extended Link TLV */
3636 while (stlv_offset
+ 4 <= tlv_end_offset
) {
3637 stlv_type
= tvb_get_ntohs(tvb
, stlv_offset
);
3638 stlv_length
= tvb_get_ntohs(tvb
, stlv_offset
+ 2);
3639 stlv_name
= val_to_str_const(stlv_type
, ext_link_stlv_type_vals
, "Unknown");
3641 stlv_tree
= proto_tree_add_subtree_format(tlv_tree
, tvb
, stlv_offset
, stlv_length
+ 4,
3642 ett_ospf_lsa_elink_stlv
, &ti_tree
,
3643 "%s Sub-TLV", stlv_name
);
3644 proto_tree_add_item(stlv_tree
, hf_ospf_ls_elink_stlv
, tvb
, stlv_offset
, 2, ENC_BIG_ENDIAN
);
3645 ti
= proto_tree_add_item(stlv_tree
, hf_ospf_tlv_length
, tvb
, stlv_offset
+ 2, 2, ENC_BIG_ENDIAN
);
3646 switch (stlv_type
) {
3647 case SR_STLV_ADJSID
:
3648 if (stlv_length
== 7) {
3649 sid_label
= tvb_get_ntoh24(tvb
, stlv_offset
+ 8);
3650 } else if (stlv_length
== 8) {
3651 sid_label
= tvb_get_ntohl(tvb
, stlv_offset
+ 8);
3653 /* Invalid sub-TLV length. */
3654 proto_item_append_text(ti
, " [Invalid length - %u]", stlv_length
);
3655 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_value
, tvb
, stlv_offset
+ 4, stlv_length
, ENC_NA
);
3658 proto_tree_add_bitmask(stlv_tree
, tvb
, stlv_offset
+ 4, hf_ospf_ls_adjsid_flags
, ett_ospf_lsa_adjsid_flags
, bf_ospf_adjsid_flags
, ENC_BIG_ENDIAN
);
3659 reserved
= tvb_get_uint8(tvb
, offset
+ 5);
3660 ti
= proto_tree_add_item(stlv_tree
, hf_ospf_header_reserved
, tvb
, stlv_offset
+ 5, 1, ENC_NA
);
3661 if (reserved
!= 0) {
3662 proto_item_append_text(ti
, " [incorrect, should be 0]");
3664 proto_tree_add_item(stlv_tree
, hf_ospf_ls_elink_mt_id
, tvb
, stlv_offset
+ 6, 1, ENC_BIG_ENDIAN
);
3665 proto_tree_add_item(stlv_tree
, hf_ospf_ls_elink_weight
, tvb
, stlv_offset
+ 7, 1, ENC_BIG_ENDIAN
);
3666 proto_tree_add_item(stlv_tree
, hf_ospf_ls_sid_label
, tvb
, stlv_offset
+ 8, (stlv_length
- 4), ENC_BIG_ENDIAN
);
3667 proto_item_append_text(ti_tree
, " (SID/Label: %u)", sid_label
);
3670 case SR_STLV_LAN_ADJSID
:
3671 if (stlv_length
== 11) {
3672 sid_label
= tvb_get_ntoh24(tvb
, stlv_offset
+ 12);
3673 } else if (stlv_length
== 12) {
3674 sid_label
= tvb_get_ntohl(tvb
, stlv_offset
+ 12);
3676 /* Invalid sub-TLV length. */
3677 proto_item_append_text(ti
, " [Invalid length - %u]", stlv_length
);
3678 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_value
, tvb
, stlv_offset
+ 4, stlv_length
, ENC_NA
);
3681 proto_tree_add_bitmask(stlv_tree
, tvb
, stlv_offset
+ 4, hf_ospf_ls_adjsid_flags
, ett_ospf_lsa_adjsid_flags
, bf_ospf_adjsid_flags
, ENC_BIG_ENDIAN
);
3682 reserved
= tvb_get_uint8(tvb
, offset
+ 5);
3683 ti
= proto_tree_add_item(stlv_tree
, hf_ospf_header_reserved
, tvb
, stlv_offset
+ 5, 1, ENC_NA
);
3684 if (reserved
!= 0) {
3685 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
3687 proto_tree_add_item(stlv_tree
, hf_ospf_ls_elink_mt_id
, tvb
, stlv_offset
+ 6, 1, ENC_BIG_ENDIAN
);
3688 proto_tree_add_item(stlv_tree
, hf_ospf_ls_elink_weight
, tvb
, stlv_offset
+ 7, 1, ENC_BIG_ENDIAN
);
3689 proto_tree_add_item(stlv_tree
, hf_ospf_ls_elink_nbr
, tvb
, stlv_offset
+ 8, 4, ENC_BIG_ENDIAN
);
3690 proto_tree_add_item(stlv_tree
, hf_ospf_ls_sid_label
, tvb
, stlv_offset
+ 12, (stlv_length
- 8), ENC_BIG_ENDIAN
);
3691 proto_item_append_text(ti_tree
, " (SID/Label: %u, Neighbor: %s)",
3692 sid_label
, tvb_ip_to_str(pinfo
->pool
, tvb
, stlv_offset
+ 8));
3695 case SR_STLV_LINK_MSD
:
3696 /* Link MSD Sub-TLV (rfc8476) */
3697 local_length
= stlv_length
;
3698 local_offset
= stlv_offset
+ 4;
3699 while (local_length
>= 2) {
3700 proto_tree_add_item(stlv_tree
, hf_ospf_ls_igp_msd_type
, tvb
, local_offset
, 1, ENC_NA
);
3701 proto_tree_add_item(stlv_tree
, hf_ospf_ls_igp_msd_value
, tvb
, local_offset
+1, 1, ENC_NA
);
3707 case SR_STLV_REMOTE_IPV4_ADDRESS
:
3708 /* Remote IPv4 Address Sub-TLV (rfc8379) */
3709 proto_tree_add_item(stlv_tree
, hf_ospf_ls_remote_ipv4_addr
, tvb
, stlv_offset
+ 4, 4, ENC_BIG_ENDIAN
);
3710 proto_item_append_text(ti_tree
, " (%s)", tvb_ip_to_str(pinfo
->pool
, tvb
, stlv_offset
+ 4));
3713 case SR_STLV_LOCAL_REMOTE_INTERFACE_ID
:
3714 /* Local/Remote Interface ID Sub-TLV (rfc8379) */
3715 proto_tree_add_item_ret_uint(stlv_tree
, hf_ospf_ls_local_interface_id
, tvb
, stlv_offset
+ 4, 4, ENC_BIG_ENDIAN
, &local_id
);
3716 proto_tree_add_item_ret_uint(stlv_tree
, hf_ospf_ls_remote_interface_id
, tvb
, stlv_offset
+ 8, 4, ENC_BIG_ENDIAN
, &remote_id
);
3717 proto_item_append_text(ti_tree
, " (Local: %u, Remote: %u)", local_id
, remote_id
);
3720 case SR_STLV_APP_SPEC_LINK_ATTR
:
3721 /* Application-Specific Link Attributes Sub-TLV (rfc8920) */
3722 local_length
= stlv_length
;
3723 local_offset
= stlv_offset
+ 4;
3724 proto_tree_add_item(stlv_tree
, hf_ospf_ls_app_sabm_length
, tvb
, local_offset
, 1, ENC_NA
);
3725 sabm_length
= tvb_get_uint8(tvb
, local_offset
);
3726 proto_tree_add_item(stlv_tree
, hf_ospf_ls_app_udabm_length
, tvb
, local_offset
+ 1, 1, ENC_NA
);
3727 udabm_length
= tvb_get_uint8(tvb
, local_offset
+ 1);
3728 reserved
= tvb_get_uint16(tvb
, local_offset
+ 2, ENC_BIG_ENDIAN
);
3729 ti
= proto_tree_add_item(stlv_tree
, hf_ospf_header_reserved
, tvb
, local_offset
+ 2, 2, ENC_NA
);
3730 if (reserved
!= 0) {
3731 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
3735 if (sabm_length
> 0 ) {
3736 proto_tree_add_bitmask(stlv_tree
, tvb
, local_offset
,
3737 hf_ospf_ls_app_sabm_bits
,
3738 ett_ospf_lsa_app_sabm_bits
,
3739 bf_ospf_app_sabm_bits
, ENC_NA
);
3740 local_offset
+= sabm_length
;
3741 local_length
-= sabm_length
;
3743 if (udabm_length
> 0) {
3744 proto_tree_add_item(stlv_tree
, hf_ospf_ls_app_udabm_bits
,
3745 tvb
, local_offset
, udabm_length
, ENC_NA
);
3746 local_offset
+= udabm_length
;
3747 local_length
-= udabm_length
;
3749 /* Link Attribute Sub-TLVs */
3750 if (local_length
> 4) {
3751 dissect_ospf_lsa_app_link_attributes(tvb
, pinfo
, local_offset
, stlv_tree
, local_length
);
3756 proto_tree_add_item(stlv_tree
, hf_ospf_tlv_value
, tvb
, stlv_offset
+ 4, stlv_length
, ENC_NA
);
3757 proto_item_append_text(ti_tree
, " (t=%u, l=%u)", stlv_type
, stlv_length
);
3760 stlv_offset
+= 4 + WS_ROUNDUP_4(stlv_length
);
3765 if (tlv_length
> (unsigned)(offset_end
- offset
)) {
3766 /* Invalid length, probably not TLV. */
3769 tlv_tree
= proto_tree_add_subtree_format(el_tree
, tvb
, offset
, tlv_length
+ 4,
3770 ett_ospf_lsa_elink_tlv
, NULL
,
3771 "%s TLV: %u - Unknown", tlv_name
, tlv_type
);
3772 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_type_opaque
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3773 proto_tree_add_item(tlv_tree
, hf_ospf_tlv_length
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
3774 proto_tree_add_item(tlv_tree
, hf_ospf_unknown_tlv
, tvb
, offset
+ 4, tlv_length
, ENC_NA
);
3780 * RFC 7770, section 2.3: 4-octet aligned, but type, length and padding
3781 * is not included in the length.
3783 offset
+= 4 + WS_ROUNDUP_4(tlv_length
);
3788 * Dissect opaque LSAs
3791 dissect_ospf_lsa_opaque(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
,
3792 uint8_t ls_id_type
, uint32_t length
)
3794 switch (ls_id_type
) {
3796 case OSPF_LSA_MPLS_TE
:
3797 dissect_ospf_lsa_mpls(tvb
, pinfo
, offset
, tree
, length
);
3799 case OSPF_LSA_OPAQUE_RI
:
3800 dissect_ospf_lsa_opaque_ri(tvb
, pinfo
, offset
, tree
, length
);
3802 case OSPF_LSA_GRACE
:
3803 dissect_ospf_lsa_grace_tlv(tvb
, pinfo
, offset
, tree
, length
);
3805 case OSPF_LSA_EXT_PREFIX
:
3806 dissect_ospf_lsa_ext_prefix(tvb
, pinfo
, offset
, tree
, length
);
3808 case OSPF_LSA_EXT_LINK
:
3809 dissect_ospf_lsa_ext_link(tvb
, pinfo
, offset
, tree
, length
);
3813 proto_tree_add_expert_format(tree
, pinfo
, &ei_ospf_lsa_unknown_type
, tvb
, offset
, length
,
3814 "Unknown LSA Type %u", ls_id_type
);
3816 } /* switch on opaque LSA id */
3820 dissect_ospf_v2_lsa(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
,
3821 bool disassemble_body
)
3823 proto_tree
*ospf_lsa_tree
;
3824 proto_item
*ti
, *lsa_ti
, *hidden_item
;
3834 uint16_t link_counter
;
3835 uint16_t metric_counter
;
3836 const char *metric_type_str
;
3838 /* AS-external LSA */
3844 uint8_t ls_length_constraints
[] = { 0, 24, 28, 28, 28, 36, 20, 36, 20, 20, 20, 20 };
3846 ls_type
= tvb_get_uint8(tvb
, offset
+ 3);
3847 ls_length
= tvb_get_ntohs(tvb
, offset
+ 18);
3848 end_offset
= offset
+ ls_length
;
3850 ospf_lsa_tree
= proto_tree_add_subtree_format(tree
, tvb
, offset
,
3851 disassemble_body
?ls_length
:OSPF_LSA_HEADER_LENGTH
,
3852 ett_ospf_lsa
, &lsa_ti
, "LSA-type %d (%s), len %d",
3853 ls_type
, val_to_str_const(ls_type
, ls_type_vals
, "Unknown"),
3855 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_age
, tvb
,
3856 offset
, 2, ENC_BIG_ENDIAN
);
3857 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_donotage
, tvb
,
3858 offset
, 2, ENC_BIG_ENDIAN
);
3859 options
= tvb_get_uint8 (tvb
, offset
+ 2);
3861 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
+ 2, hf_ospf_v2_options
, ett_ospf_v2_options
, bf_v2_options
, ENC_BIG_ENDIAN
);
3863 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
+ 2, hf_ospf_v2_options
, ett_ospf_v2_options
, bf_v2_options_lsa7
, ENC_BIG_ENDIAN
);
3864 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_type
, tvb
,
3865 offset
+ 3, 1, ENC_BIG_ENDIAN
);
3866 if (ospf_ls_type_to_filter(ls_type
) != -1) {
3867 hidden_item
= proto_tree_add_item(ospf_lsa_tree
,
3868 *hf_ospf_ls_type_array
[ospf_ls_type_to_filter(ls_type
)], tvb
,
3869 offset
+ 3, 1, ENC_BIG_ENDIAN
);
3870 proto_item_set_hidden(hidden_item
);
3873 if (options
& OSPF_V2_OPTIONS_MT
) {
3874 metric_type_str
= "MT-ID";
3876 metric_type_str
= "TOS";
3879 if (is_opaque(ls_type
)) {
3880 ls_id_type
= tvb_get_uint8(tvb
, offset
+ 4);
3881 proto_tree_add_uint(ospf_lsa_tree
, hf_ospf_ls_opaque_type
,
3882 tvb
, offset
+ 4, 1, ls_id_type
);
3884 switch (ls_id_type
) {
3886 case OSPF_LSA_MPLS_TE
:
3887 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_id_te_lsa_reserved
, tvb
, offset
+ 5, 1, ENC_BIG_ENDIAN
);
3888 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_mpls_te_instance
,
3889 tvb
, offset
+ 6, 2, ENC_BIG_ENDIAN
);
3892 case OSPF_LSA_OPAQUE_RI
:
3894 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_id_opaque_id
, tvb
, offset
+ 5, 3, ENC_BIG_ENDIAN
);
3899 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_id
, tvb
,
3900 offset
+ 4, 4, ENC_BIG_ENDIAN
);
3903 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_adv_router
,
3904 tvb
, offset
+ 8, 4, ENC_BIG_ENDIAN
);
3905 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_seqnum
, tvb
,
3906 offset
+ 12, 4, ENC_BIG_ENDIAN
);
3907 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_chksum
, tvb
,
3908 offset
+ 16, 2, ENC_BIG_ENDIAN
);
3909 ti
= proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_length
, tvb
,
3910 offset
+ 18, 2, ENC_BIG_ENDIAN
);
3912 if(ls_type
&& ls_type
<= OSPF_LSTYPE_OP_ASWIDE
) {
3913 if(ls_length
< ls_length_constraints
[ls_type
]) {
3914 expert_add_info_format(pinfo
, ti
, &ei_ospf_lsa_bad_length
, "Invalid LSA length (%u) for type %s, expected >= (%u)",
3915 ls_length
, val_to_str_const(ls_type
, ls_type_vals
, "Unknown"), ls_length_constraints
[ls_type
]);
3918 } else if(ls_length
< 20) { /* As type is unknown, we check for a minimum length of 20 */
3919 expert_add_info_format(pinfo
, ti
, &ei_ospf_lsa_bad_length
, "Invalid LSA length (%u) for unknown LSA type (%u), expected minimum of (20)", ls_length
, ls_type
);
3923 /* skip past the LSA header to the body */
3924 offset
+= OSPF_LSA_HEADER_LENGTH
;
3925 if (ls_length
<= OSPF_LSA_HEADER_LENGTH
)
3926 return offset
; /* no data, or bogus length */
3927 ls_length
-= OSPF_LSA_HEADER_LENGTH
;
3929 if (!disassemble_body
)
3934 case OSPF_LSTYPE_ROUTER
:
3935 /* flags field in an router-lsa */
3936 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
, hf_ospf_v2_router_lsa_flag
, ett_ospf_v2_router_lsa_flags
, bf_v2_router_lsa_flags
, ENC_BIG_ENDIAN
);
3937 /* TODO: flags are only 1 byte, so there is an apparently unused byte here */
3938 proto_tree_add_item_ret_uint(ospf_lsa_tree
, hf_ospf_lsa_number_of_links
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
, &nr_links
);
3942 /* nr_links links follow
3943 * maybe we should put each of the links into its own subtree ???
3945 for (link_counter
= 0; link_counter
< nr_links
; link_counter
++) {
3946 proto_tree
*ospf_lsa_router_link_tree
;
3947 proto_item
*ti_item
;
3950 /* check the Link Type and ID */
3951 link_type
= tvb_get_uint8(tvb
, offset
+ 8);
3952 nr_metric
= tvb_get_uint8(tvb
, offset
+ 9);
3954 ospf_lsa_router_link_tree
= proto_tree_add_subtree_format(ospf_lsa_tree
, tvb
, offset
, 12 + 4 * nr_metric
,
3955 ett_ospf_lsa_router_link
, NULL
, "Type: %-8s ID: %-15s Data: %-15s Metric: %d",
3956 val_to_str_const(link_type
, ospf_v3_lsa_type_short_vals
, "Unknown"),
3957 tvb_ip_to_str(pinfo
->pool
, tvb
, offset
),
3958 tvb_ip_to_str(pinfo
->pool
, tvb
, offset
+ 4),
3959 tvb_get_ntohs(tvb
, offset
+ 10));
3961 ti_item
= proto_tree_add_item(ospf_lsa_router_link_tree
, hf_ospf_ls_router_linkid
,
3962 tvb
, offset
, 4, ENC_BIG_ENDIAN
);
3963 proto_item_append_text(ti_item
, " - %s", val_to_str_const(link_type
, ospf_v3_lsa_link_id_vals
, "Unknown link ID"));
3965 /* link_data should be specified in detail (e.g. network mask) (depends on link type)*/
3966 proto_tree_add_item(ospf_lsa_router_link_tree
, hf_ospf_ls_router_linkdata
,
3967 tvb
, offset
+4, 4, ENC_BIG_ENDIAN
);
3969 ti_item
= proto_tree_add_item(ospf_lsa_router_link_tree
, hf_ospf_ls_router_linktype
,
3970 tvb
, offset
+ 8, 1, ENC_BIG_ENDIAN
);
3971 proto_item_append_text(ti_item
, " - %s", val_to_str_const(link_type
, ospf_v3_lsa_type_vals
, "Unknown link type"));
3973 ti_item
= proto_tree_add_item(ospf_lsa_router_link_tree
, hf_ospf_ls_router_nummetrics
,
3974 tvb
, offset
+ 9, 1, ENC_BIG_ENDIAN
);
3975 proto_item_append_text(ti_item
, " - %s", metric_type_str
);
3976 proto_tree_add_item(ospf_lsa_router_link_tree
, hf_ospf_ls_router_metric0
,
3977 tvb
, offset
+ 10, 2, ENC_BIG_ENDIAN
);
3981 /* nr_metric metrics may follow each link
3982 * According to RFC4915 the TOS metrics was never deployed and was subsequently deprecated,
3983 * but decoding still present because MT-ID use the same structure.
3985 for (metric_counter
= 0; metric_counter
< nr_metric
; metric_counter
++) {
3986 proto_tree_add_uint_format(ospf_lsa_router_link_tree
, hf_ospf_ls_metric
, tvb
, offset
, 4,
3987 tvb_get_ntohs(tvb
, offset
+ 2), "%s: %u, Metric: %u",
3989 tvb_get_uint8(tvb
, offset
),
3990 tvb_get_ntohs(tvb
, offset
+ 2));
3996 case OSPF_LSTYPE_NETWORK
:
3997 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_network_netmask
,
3998 tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4001 if (offset
== end_offset
)
4002 proto_tree_add_expert_format(ospf_lsa_tree
, pinfo
, &ei_ospf_lsa_constraint_missing
, tvb
, offset
- 4, 4, "1 or more router-IDs required");
4004 while (offset
< end_offset
) {
4005 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_network_attachrtr
,
4006 tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4011 case OSPF_LSTYPE_SUMMARY
:
4012 /* Type 3 and 4 LSAs have the same format */
4013 case OSPF_LSTYPE_ASBR
:
4014 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_asbr_netmask
,
4015 tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4018 if ((offset
+4) > end_offset
)
4019 expert_add_info_format(pinfo
, lsa_ti
, &ei_ospf_lsa_constraint_missing
, "1 or more TOS metrics required");
4021 while (offset
< end_offset
) {
4022 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_lsa_tos
, tvb
, offset
, 1, ENC_NA
);
4024 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_metric
, tvb
, offset
, 3,
4030 case OSPF_LSTYPE_ASEXT
:
4031 case OSPF_LSTYPE_ASEXT7
:
4032 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_asext_netmask
,
4033 tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4036 if ((offset
+12) > end_offset
)
4037 expert_add_info_format(pinfo
, lsa_ti
, &ei_ospf_lsa_constraint_missing
, "1 or more TOS forwarding blocks required");
4039 while (offset
< end_offset
) {
4040 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_lsa_external_type
, tvb
, offset
, 1, ENC_NA
);
4041 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_lsa_external_tos
, tvb
, offset
, 1, ENC_NA
);
4044 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_metric
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
4047 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_asext_fwdaddr
,
4048 tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4051 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_asext_extrtrtag
,
4052 tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4057 case OSPF_LSTYPE_OP_LINKLOCAL
:
4058 case OSPF_LSTYPE_OP_AREALOCAL
:
4059 case OSPF_LSTYPE_OP_ASWIDE
:
4061 * RFC 2370 opaque LSAs.
4063 dissect_ospf_lsa_opaque(tvb
, pinfo
, offset
, ospf_lsa_tree
, ls_id_type
,
4065 offset
+= ls_length
;
4069 /* unknown LSA type */
4070 expert_add_info(pinfo
, ti
, &ei_ospf_lsa_unknown_type
);
4071 offset
+= ls_length
;
4074 /* return the offset of the next LSA */
4078 /* dissect common elements of the Network E-LSA and LSA */
4079 static void dissect_ospf_v3_network_lsa_common(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*ospf_lsa_tree
, int *offset
, uint16_t *ls_length
)
4081 /* reserved field */
4082 uint8_t reserved
= tvb_get_uint8(tvb
, *offset
);
4083 proto_item
*ti
= proto_tree_add_item(ospf_lsa_tree
, hf_ospf_header_reserved
, tvb
, *offset
, 1, ENC_NA
);
4085 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
4087 /* options field in an network-lsa */
4088 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, *offset
+ 1, hf_ospf_v3_options
, ett_ospf_v3_options
, bf_v3_options
, ENC_BIG_ENDIAN
);
4095 dissect_ospf_v3_lsa(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
,
4096 bool disassemble_body
, uint8_t address_family
)
4098 proto_tree
*ospf_lsa_tree
, *router_tree
= NULL
, *router_entry_tree
, *lsa_type_tree
;
4099 proto_item
*ti
, *hidden_item
, *type_item
;
4107 uint32_t number_prefixes
;
4108 uint8_t prefix_length
;
4109 uint16_t reserved16
;
4111 uint16_t referenced_ls_type
;
4112 uint16_t entry_count
= 0;
4117 ls_type
= tvb_get_ntohs(tvb
, offset
+ 2) & 0x1FFF;
4118 ls_length
= tvb_get_ntohs(tvb
, offset
+ 18);
4119 end_offset
= offset
+ ls_length
;
4121 ospf_lsa_tree
= proto_tree_add_subtree_format(tree
, tvb
, offset
,
4122 disassemble_body
?ls_length
:OSPF_LSA_HEADER_LENGTH
,
4123 ett_ospf_lsa
, &type_item
, "LSA-type %d (%s), len %d",
4124 ls_type
, val_to_str_const(ls_type
, v3_ls_type_vals
, "Unknown"),
4126 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_age
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
4127 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_do_not_age
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
4129 ti
= proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_ls_type
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
4130 lsa_type_tree
= proto_item_add_subtree(ti
, ett_ospf_lsa_type
);
4131 proto_tree_add_item(lsa_type_tree
, hf_ospf_v3_ls_type_u
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
4132 proto_tree_add_item(lsa_type_tree
, hf_ospf_v3_ls_type_s12
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
4133 proto_tree_add_item(lsa_type_tree
, hf_ospf_v3_ls_type_fc
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
4135 if (ospf_v3_ls_type_to_filter(ls_type
) != -1) {
4136 hidden_item
= proto_tree_add_item(ospf_lsa_tree
,
4137 *hf_ospf_v3_ls_type_array
[ospf_v3_ls_type_to_filter(ls_type
)], tvb
,
4138 offset
+ 2, 2, ENC_BIG_ENDIAN
);
4139 proto_item_set_hidden(hidden_item
);
4142 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_link_state_id
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
4144 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_adv_router
,
4145 tvb
, offset
+ 8, 4, ENC_BIG_ENDIAN
);
4146 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_seqnum
, tvb
,
4147 offset
+ 12, 4, ENC_BIG_ENDIAN
);
4148 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_chksum
, tvb
,
4149 offset
+ 16, 2, ENC_BIG_ENDIAN
);
4150 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_ls_length
, tvb
,
4151 offset
+ 18, 2, ENC_BIG_ENDIAN
);
4153 /* skip past the LSA header to the body */
4154 offset
+= OSPF_LSA_HEADER_LENGTH
;
4155 ls_length
-= OSPF_LSA_HEADER_LENGTH
;
4157 if (!disassemble_body
)
4163 case OSPF_V3_LSTYPE_ROUTER
:
4164 /* flags field in an router-lsa */
4165 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
, hf_ospf_v3_router_lsa_flag
, ett_ospf_v3_router_lsa_flags
, bf_v3_router_lsa_flags
, ENC_BIG_ENDIAN
);
4167 /* options field in an router-lsa */
4168 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
+ 1, hf_ospf_v3_options
, ett_ospf_v3_options
, bf_v3_options
, ENC_BIG_ENDIAN
);
4170 /* skip the router-lsa flags and options */
4175 router_tree
= proto_tree_add_subtree(ospf_lsa_tree
, tvb
, offset
, ls_length
,
4176 ett_ospf_v3_router_interface
, NULL
, "Router Interfaces");
4178 /* scan all router-lsa router interfaces */
4179 while (ls_length
> 0 ) {
4181 router_entry_tree
= proto_tree_add_subtree_format(router_tree
, tvb
, offset
, 16,
4182 ett_ospf_v3_router_interface_entry
, NULL
, "Entry #%d", entry_count
);
4184 proto_tree_add_item(router_entry_tree
, hf_ospf_v3_lsa_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
4186 /* reserved field */
4187 reserved
= tvb_get_uint8(tvb
, offset
+1);
4188 ti
= proto_tree_add_item(router_entry_tree
, hf_ospf_header_reserved
, tvb
, offset
+1, 1, ENC_NA
);
4190 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
4193 proto_tree_add_item(router_entry_tree
, hf_ospf_metric
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
4196 proto_tree_add_item(router_entry_tree
, hf_ospf_v3_lsa_interface_id
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
4198 /* Neighbor Interface ID */
4199 proto_tree_add_item(router_entry_tree
, hf_ospf_v3_lsa_neighbor_interface_id
, tvb
, offset
+ 8, 4, ENC_BIG_ENDIAN
);
4201 /* Neighbor Router ID */
4202 proto_tree_add_item(router_entry_tree
, hf_ospf_v3_lsa_neighbor_router_id
, tvb
, offset
+ 12, 4, ENC_BIG_ENDIAN
);
4204 /* skip to the (possible) next entry */
4211 case OSPF_V3_LSTYPE_NETWORK
:
4213 dissect_ospf_v3_network_lsa_common(tvb
, pinfo
, ospf_lsa_tree
, &offset
, &ls_length
);
4215 while (ls_length
> 0 ) {
4216 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_attached_router
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4223 case OSPF_V3_LSTYPE_INTER_AREA_PREFIX
:
4225 /* reserved field */
4226 reserved
= tvb_get_uint8(tvb
, offset
);
4227 ti
= proto_tree_add_item(ospf_lsa_tree
, hf_ospf_header_reserved
, tvb
, offset
, 1, ENC_NA
);
4229 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
4232 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_metric
, tvb
, offset
+ 1, 3, ENC_BIG_ENDIAN
);
4235 prefix_length
=tvb_get_uint8(tvb
, offset
+4);
4236 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_prefix_length
, tvb
, offset
+4, 1, ENC_BIG_ENDIAN
);
4238 /* prefix options */
4239 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
+ 5, hf_ospf_v3_prefix_option
, ett_ospf_v3_prefix_options
, bf_v3_prefix_options
, ENC_BIG_ENDIAN
);
4241 /* 16 bits reserved */
4242 reserved16
=tvb_get_ntohs(tvb
, offset
+6);
4243 ti
= proto_tree_add_item(ospf_lsa_tree
, hf_ospf_header_reserved
, tvb
, offset
+6, 2, ENC_NA
);
4244 if (reserved16
!= 0)
4245 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
4249 /* address_prefix */
4250 dissect_ospf_v3_address_prefix(tvb
, pinfo
, offset
, prefix_length
, ospf_lsa_tree
, address_family
);
4252 offset
+=(prefix_length
+31)/32*4;
4257 case OSPF_V3_LSTYPE_INTER_AREA_ROUTER
:
4259 /* reserved field */
4260 reserved
= tvb_get_uint8(tvb
, offset
);
4261 ti
= proto_tree_add_item(ospf_lsa_tree
, hf_ospf_header_reserved
, tvb
, offset
, 1, ENC_NA
);
4263 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
4265 /* options field in an inter-area-router-lsa */
4266 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
+ 1, hf_ospf_v3_options
, ett_ospf_v3_options
, bf_v3_options
, ENC_BIG_ENDIAN
);
4268 /* reserved field */
4269 reserved
= tvb_get_uint8(tvb
, offset
+4);
4270 ti
= proto_tree_add_item(ospf_lsa_tree
, hf_ospf_header_reserved
, tvb
, offset
+4, 1, ENC_NA
);
4272 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
4275 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_metric
, tvb
, offset
+ 5, 3, ENC_BIG_ENDIAN
);
4277 /* Destination Router ID */
4278 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_destination_router_id
, tvb
, offset
+ 8, 4, ENC_BIG_ENDIAN
);
4284 case OSPF_V3_LSTYPE_NSSA
:
4285 case OSPF_V3_LSTYPE_AS_EXTERNAL
:
4288 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
, hf_ospf_v3_as_external_flag
, ett_ospf_v3_as_external_flags
, bf_v3_as_external_flags
, ENC_BIG_ENDIAN
);
4289 flags
=tvb_get_uint8(tvb
, offset
);
4291 /* 24 bits metric */
4292 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_metric
, tvb
, offset
+1, 3, ENC_BIG_ENDIAN
);
4295 prefix_length
=tvb_get_uint8(tvb
, offset
+4);
4296 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_prefix_length
, tvb
, offset
+4, 1, ENC_BIG_ENDIAN
);
4298 /* prefix options */
4299 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
+ 5, hf_ospf_v3_prefix_option
, ett_ospf_v3_prefix_options
, bf_v3_prefix_options
, ENC_BIG_ENDIAN
);
4301 /* referenced LS type */
4302 referenced_ls_type
=tvb_get_ntohs(tvb
, offset
+6);
4303 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_referenced_ls_type
, tvb
, offset
+6, 2, ENC_BIG_ENDIAN
);
4307 /* address_prefix */
4308 dissect_ospf_v3_address_prefix(tvb
, pinfo
, offset
, prefix_length
, ospf_lsa_tree
, address_family
);
4310 offset
+=(prefix_length
+31)/32*4;
4312 /* Forwarding Address (optional - only if F-flag is on) */
4313 if ( (offset
< end_offset
) && (flags
& OSPF_V3_AS_EXTERNAL_FLAG_F
) ) {
4314 if (address_family
== OSPF_AF_6
) {
4315 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_forwarding_address_ipv6
, tvb
, offset
, 16, ENC_NA
);
4317 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_forwarding_address_ipv4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4323 /* External Route Tag (optional - only if T-flag is on) */
4324 if ( (offset
< end_offset
) && (flags
& OSPF_V3_AS_EXTERNAL_FLAG_T
) ) {
4325 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_external_route_tag
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4329 /* Referenced Link State ID (optional - only if Referenced LS type is non-zero */
4330 if ( (offset
< end_offset
) && (referenced_ls_type
!= 0) ) {
4331 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_referenced_link_state_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4337 case OSPF_V3_LSTYPE_LINK
:
4339 /* router priority */
4340 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_router_priority
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
4342 /* options field in an link-lsa */
4343 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
+ 1, hf_ospf_v3_options
, ett_ospf_v3_options
, bf_v3_options
, ENC_BIG_ENDIAN
);
4345 /* Link-local Interface Address */
4346 if (address_family
== OSPF_AF_6
) {
4347 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_link_local_interface_address
, tvb
, offset
+ 4, 16, ENC_NA
);
4349 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_link_local_interface_address_ipv4
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
4351 /* Number prefixes */
4352 proto_tree_add_item_ret_uint(ospf_lsa_tree
, hf_ospf_v3_lsa_num_prefixes
, tvb
, offset
+20, 4, ENC_BIG_ENDIAN
, &number_prefixes
);
4356 while (number_prefixes
> 0) {
4359 prefix_length
=tvb_get_uint8(tvb
, offset
);
4360 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_prefix_length
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
4362 /* prefix options */
4363 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
+ 1, hf_ospf_v3_prefix_option
, ett_ospf_v3_prefix_options
, bf_v3_prefix_options
, ENC_BIG_ENDIAN
);
4365 /* 16 bits reserved */
4366 reserved16
=tvb_get_ntohs(tvb
, offset
+2);
4367 ti
= proto_tree_add_item(ospf_lsa_tree
, hf_ospf_header_reserved
, tvb
, offset
+2, 2, ENC_NA
);
4368 if (reserved16
!= 0)
4369 expert_add_info(pinfo
, ti
, &ei_ospf_header_reserved
);
4373 /* address_prefix */
4374 dissect_ospf_v3_address_prefix(tvb
, pinfo
, offset
, prefix_length
, ospf_lsa_tree
, address_family
);
4376 offset
+=(prefix_length
+31)/32*4;
4383 case OSPF_V3_LSTYPE_INTRA_AREA_PREFIX
:
4386 proto_tree_add_item_ret_uint(ospf_lsa_tree
, hf_ospf_v3_lsa_num_prefixes
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &number_prefixes
);
4388 /* referenced LS type */
4389 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_referenced_ls_type
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
4391 /* Referenced Link State ID */
4392 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_referenced_link_state_id
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
4394 /* Referenced Advertising Router */
4395 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_referenced_advertising_router
, tvb
, offset
+ 8, 4, ENC_BIG_ENDIAN
);
4399 while (number_prefixes
> 0) {
4402 prefix_length
=tvb_get_uint8(tvb
, offset
);
4403 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_prefix_length
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
4405 /* prefix options */
4406 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
+ 1, hf_ospf_v3_prefix_option
, ett_ospf_v3_prefix_options
, bf_v3_prefix_options
, ENC_BIG_ENDIAN
);
4408 /* 16 bits metric */
4409 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_metric
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
4413 /* address_prefix */
4414 dissect_ospf_v3_address_prefix(tvb
, pinfo
, offset
, prefix_length
, ospf_lsa_tree
, address_family
);
4416 offset
+=(prefix_length
+31)/32*4;
4422 case OSPF_V3_LSTYPE_OPAQUE_RI
:
4423 dissect_ospf_lsa_opaque_ri(tvb
, pinfo
, offset
, ospf_lsa_tree
, ls_length
);
4424 offset
+= ls_length
;
4427 case OSPF_V3_LSTYPE_E_INTRA_AREA_PREFIX
:
4429 /* prefixes, 0 as per RFC */
4430 proto_tree_add_item_ret_uint(ospf_lsa_tree
, hf_ospf_v3_lsa_num_prefixes
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &number_prefixes
);
4432 /* referenced LS type */
4433 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_referenced_ls_type
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
4435 /* Referenced Link State ID */
4436 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_referenced_link_state_id
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
4438 /* Referenced Advertising Router */
4439 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_referenced_advertising_router
, tvb
, offset
+ 8, 4, ENC_BIG_ENDIAN
);
4444 dissect_ospf6_e_lsa_tlv(tvb
, pinfo
, offset
, ospf_lsa_tree
, ls_length
, address_family
);
4445 offset
+= ls_length
;
4447 case OSPF_V3_LSTYPE_E_ROUTER
:
4449 /* flags field in an router-lsa */
4450 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
, hf_ospf_v3_router_lsa_flag
, ett_ospf_v3_router_lsa_flags
, bf_v3_router_lsa_flags
, ENC_BIG_ENDIAN
);
4452 /* options field in an router-lsa */
4453 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
+ 1, hf_ospf_v3_options
, ett_ospf_v3_options
, bf_v3_options
, ENC_BIG_ENDIAN
);
4455 /* skip the router-lsa flags and options */
4458 dissect_ospf6_e_lsa_tlv(tvb
, pinfo
, offset
, ospf_lsa_tree
, ls_length
, address_family
);
4459 offset
+= ls_length
;
4462 case OSPF_V3_LSTYPE_E_NETWORK
:
4464 /* reserved field & options */
4465 dissect_ospf_v3_network_lsa_common(tvb
, pinfo
, ospf_lsa_tree
, &offset
, &ls_length
);
4467 /* Attached-Routers TLV */
4468 dissect_ospf6_e_lsa_tlv(tvb
, pinfo
, offset
, ospf_lsa_tree
, ls_length
, address_family
);
4469 offset
+= ls_length
;
4472 case OSPF_V3_LSTYPE_E_AS_EXTERNAL
:
4474 /* External-Prefix TLV */
4475 dissect_ospf6_e_lsa_tlv(tvb
, pinfo
, offset
, ospf_lsa_tree
, ls_length
, address_family
);
4476 offset
+= ls_length
;
4478 case OSPF_V3_LSTYPE_E_LINK
:
4480 /* router priority */
4481 proto_tree_add_item(ospf_lsa_tree
, hf_ospf_v3_lsa_router_priority
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
4483 /* options field in an link-lsa */
4484 proto_tree_add_bitmask(ospf_lsa_tree
, tvb
, offset
+ 1, hf_ospf_v3_options
, ett_ospf_v3_options
, bf_v3_options
, ENC_BIG_ENDIAN
);
4489 dissect_ospf6_e_lsa_tlv(tvb
, pinfo
, offset
, ospf_lsa_tree
, ls_length
, address_family
);
4490 offset
+= ls_length
;
4494 /* unknown LSA type */
4495 expert_add_info_format(pinfo
, type_item
, &ei_ospf_lsa_unknown_type
,
4496 "Unknown LSA Type %u",ls_type
);
4497 offset
+= ls_length
;
4500 /* return the offset of the next LSA */
4504 static void dissect_ospf_v3_address_prefix(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, int prefix_length
, proto_tree
*tree
,
4505 uint8_t address_family
)
4508 int bytes_to_process
;
4511 bytes_to_process
=((prefix_length
+31)/32)*4;
4513 if (prefix_length
> 128) {
4514 proto_tree_add_expert_format(tree
, pinfo
, &ei_ospf_lsa_bad_length
, tvb
, offset
, bytes_to_process
,
4515 "Address Prefix: length is invalid (%d, should be <= 128)",
4520 memset(prefix
.bytes
, 0, sizeof prefix
.bytes
);
4521 if (bytes_to_process
!= 0) {
4522 tvb_memcpy(tvb
, prefix
.bytes
, offset
, bytes_to_process
);
4523 if (prefix_length
% 8) {
4524 prefix
.bytes
[bytes_to_process
- 1] &=
4525 ((0xff00 >> (prefix_length
% 8)) & 0xff);
4528 if (address_family
== OSPF_AF_6
) {
4529 proto_tree_add_ipv6(tree
, hf_ospf_v3_address_prefix_ipv6
, tvb
, offset
, bytes_to_process
,
4532 proto_tree_add_item(tree
, hf_ospf_v3_address_prefix_ipv4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4539 proto_register_ospf(void)
4541 static hf_register_info ospff_info
[] = {
4544 { "OSPF Header", "ospf.header", FT_NONE
, BASE_NONE
, NULL
, 0x0,
4546 {&hf_ospf_header_version
,
4547 { "Version", "ospf.version", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4549 /* Message type number */
4550 {&hf_ospf_header_msg_type
,
4551 { "Message Type", "ospf.msg", FT_UINT8
, BASE_DEC
, VALS(pt_vals
), 0x0,
4553 {&hf_ospf_header_packet_length
,
4554 { "Packet Length", "ospf.packet_length", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4556 {&hf_ospf_header_src_router
,
4557 { "Source OSPF Router", "ospf.srcrouter", FT_IPv4
, BASE_NONE
, NULL
, 0x0,
4559 {&hf_ospf_header_area_id
,
4560 { "Area ID", "ospf.area_id", FT_IPv4
, BASE_NONE
, NULL
, 0x0,
4562 {&hf_ospf_header_checksum
,
4563 { "Checksum", "ospf.checksum", FT_UINT16
, BASE_HEX
, NULL
, 0x0,
4566 { "TLV Type", "ospf.tlv_type", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4568 {&hf_ospf_tlv_length
,
4569 { "TLV Length", "ospf.tlv_length", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4571 /* OSPF Header v2 (Auth) */
4572 {&hf_ospf_header_auth_type
,
4573 { "Auth Type", "ospf.auth.type", FT_UINT16
, BASE_DEC
, VALS(auth_vals
), 0x0,
4575 {&hf_ospf_header_auth_data_none
,
4576 { "Auth Data (none)", "ospf.auth.none", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4578 {&hf_ospf_header_auth_data_simple
,
4579 { "Auth Data (Simple)", "ospf.auth.simple", FT_STRING
, BASE_NONE
, NULL
, 0x0,
4581 {&hf_ospf_header_auth_crypt_key_id
,
4582 { "Auth Crypt Key id", "ospf.auth.crypt.key_id", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4584 {&hf_ospf_header_auth_crypt_data_length
,
4585 { "Auth Crypt Data Length", "ospf.auth.crypt.data_length", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4587 {&hf_ospf_header_auth_crypt_seq_nbr
,
4588 { "Auth Crypt Sequence Number", "ospf.auth.crypt.seq_nbr", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
4590 {&hf_ospf_header_auth_crypt_data
,
4591 { "Auth Crypt Data", "ospf.auth.crypt.data", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4593 {&hf_ospf_header_auth_data_unknown
,
4594 { "Auth Unknown", "ospf.auth.unknown", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4597 /* OSPF Header v3 */
4598 {&hf_ospf_header_instance_id
,
4599 { "Instance ID", "ospf.instance_id", FT_UINT8
, BASE_RANGE_STRING
| BASE_DEC
, RVALS(ospf_instance_id_rvals
), 0x0,
4601 {&hf_ospf_header_reserved
,
4602 { "Reserved", "ospf.reserved", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4603 "Must be zero", HFILL
}},
4606 {&hf_ospf_msg_hello
,
4607 { "Hello", "ospf.msg.hello", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4609 {&hf_ospf_msg_db_desc
,
4610 { "Database Description", "ospf.msg.dbdesc", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4612 {&hf_ospf_msg_ls_req
,
4613 { "Link State Adv Request", "ospf.msg.lsreq", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4615 {&hf_ospf_msg_ls_upd
,
4616 { "Link State Adv Update", "ospf.msg.lsupdate", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4618 {&hf_ospf_msg_ls_ack
,
4619 { "Link State Adv Acknowledgement", "ospf.msg.lsack", FT_BOOLEAN
,
4620 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4624 { "OSPF Hello Packet", "ospf.hello", FT_NONE
,
4625 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4626 {&hf_ospf_hello_network_mask
,
4627 { "Network Mask", "ospf.hello.network_mask", FT_IPv4
,
4628 BASE_NETMASK
, NULL
, 0x0, NULL
, HFILL
}},
4629 {&hf_ospf_hello_interface_id
,
4630 { "Interface ID", "ospf.hello.interface_id", FT_UINT32
,
4631 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
4632 {&hf_ospf_hello_hello_interval
,
4633 { "Hello Interval [sec]", "ospf.hello.hello_interval", FT_UINT32
,
4634 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
4635 {&hf_ospf_hello_router_priority
,
4636 { "Router Priority", "ospf.hello.router_priority", FT_UINT8
,
4637 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
4638 {&hf_ospf_hello_router_dead_interval
,
4639 { "Router Dead Interval [sec]", "ospf.hello.router_dead_interval", FT_UINT32
,
4640 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
4641 {&hf_ospf_hello_designated_router
,
4642 { "Designated Router", "ospf.hello.designated_router", FT_IPv4
,
4643 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4644 {&hf_ospf_hello_backup_designated_router
,
4645 { "Backup Designated Router", "ospf.hello.backup_designated_router", FT_IPv4
,
4646 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4647 {&hf_ospf_hello_active_neighbor
,
4648 { "Active Neighbor", "ospf.hello.active_neighbor", FT_IPv4
,
4649 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4652 /* Authentication trailer */
4654 { "OSPF Authentication Trailer", "ospf.at", FT_NONE
,
4655 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4656 {&hf_ospf_at_auth_type
,
4657 { "Authentication Type", "ospf.at.auth_type", FT_UINT16
,
4658 BASE_DEC
, VALS(ospf_at_authentication_type_vals
), 0x0, "Identifying the type of authentication", HFILL
}},
4659 {&hf_ospf_at_auth_data_len
,
4660 { "Authentication Data Length", "ospf.at.auth_data_len", FT_UINT16
,
4661 BASE_DEC
, NULL
, 0x0, "The length in octets of the Authentication Trailer (AT) including both the 16-octet fixed header and the variable length message digest", HFILL
}},
4662 {&hf_ospf_at_reserved
,
4663 { "Reserved", "ospf.at.reserved", FT_UINT16
,
4664 BASE_HEX
, NULL
, 0x0, "It SHOULD be set to 0", HFILL
}},
4666 { "Security Association Identifier (SA ID)", "ospf.at.sa_id", FT_UINT16
,
4667 BASE_HEX
, NULL
, 0x0, "That maps to the authentication algorithm and the secret key used to create the message digest", HFILL
}},
4668 {&hf_ospf_at_crypto_seq_nbr
,
4669 { "Cryptographic Sequence Number", "ospf.at.crypto_seq_nbr", FT_UINT64
,
4670 BASE_DEC
, NULL
, 0x0, "Increasing sequence number that is used to guard against replay attacks", HFILL
}},
4671 {&hf_ospf_at_auth_data
,
4672 { "Authentication Data", "ospf.at.auth_data", FT_BYTES
,
4673 BASE_NONE
, NULL
, 0x0, "Variable data that is carrying the digest for the protocol packet and optional LLS data block", HFILL
}},
4677 { "LS Type", "ospf.lsa", FT_UINT32
, BASE_DEC
,
4678 VALS(ls_type_vals
), 0x0, NULL
, HFILL
}},
4680 {"LS Age (seconds)", "ospf.lsa.age", FT_UINT16
,
4681 BASE_DEC
, NULL
, ~OSPF_DNA_LSA
, NULL
, HFILL
}},
4682 {&hf_ospf_ls_donotage
,
4683 {"Do Not Age Flag", "ospf.lsa.donotage", FT_UINT16
,
4684 BASE_DEC
, NULL
, OSPF_DNA_LSA
, NULL
, HFILL
}},
4686 {"Link State ID", "ospf.lsa.id", FT_IPv4
,
4687 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4688 {&hf_ospf_ls_seqnum
,
4689 {"Sequence Number", "ospf.lsa.seqnum", FT_UINT32
,
4690 BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
4691 {&hf_ospf_ls_chksum
,
4692 {"Checksum", "ospf.lsa.chksum", FT_UINT16
,
4693 BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
4694 {&hf_ospf_ls_length
,
4695 {"Length", "ospf.lsa.length", FT_UINT16
,
4696 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
4698 {&hf_ospf_ls_opaque_type
,
4699 { "Link State ID Opaque Type", "ospf.lsid_opaque_type", FT_UINT8
, BASE_DEC
,
4700 VALS(ls_opaque_type_vals
), 0x0, NULL
, HFILL
}},
4702 {&hf_ospf_ls_mpls_te_instance
,
4703 { "Link State ID TE-LSA Instance", "ospf.lsid_te_lsa.instance", FT_UINT16
, BASE_DEC
,
4704 NULL
, 0x0, NULL
, HFILL
}},
4706 {&hf_ospf_ls_router
,
4707 { "Router LSA", "ospf.lsa.router", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4709 {&hf_ospf_ls_router_linktype
,
4710 { "Link Type", "ospf.lsa.router.linktype", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4712 {&hf_ospf_ls_router_linkid
,
4713 { "Link ID", "ospf.lsa.router.linkid", FT_IPv4
, BASE_NONE
, NULL
, 0x0,
4715 {&hf_ospf_ls_router_linkdata
,
4716 { "Link Data", "ospf.lsa.router.linkdata", FT_IPv4
, BASE_NONE
, NULL
, 0x0,
4718 {&hf_ospf_ls_router_nummetrics
,
4719 { "Number of Metrics", "ospf.lsa.router.nummetrics", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4721 {&hf_ospf_ls_router_metric0
,
4722 { "0 Metric", "ospf.lsa.router.metric0", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4725 {&hf_ospf_ls_network
,
4726 { "Network LSA", "ospf.lsa.network", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4728 {&hf_ospf_ls_network_netmask
,
4729 { "Netmask", "ospf.lsa.network.netmask", FT_IPv4
, BASE_NETMASK
, NULL
, 0x0,
4731 {&hf_ospf_ls_network_attachrtr
,
4732 { "Attached Router", "ospf.lsa.network.attchrtr", FT_IPv4
, BASE_NONE
, NULL
, 0x0,
4735 {&hf_ospf_ls_summary
,
4736 { "Summary LSA (IP Network)", "ospf.lsa.summary", FT_BOOLEAN
, BASE_NONE
,
4737 NULL
, 0x0, NULL
, HFILL
}},
4739 { "Summary LSA (ASBR)", "ospf.lsa.asbr", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4741 {&hf_ospf_ls_asbr_netmask
,
4742 { "Netmask", "ospf.lsa.asbr.netmask", FT_IPv4
, BASE_NETMASK
, NULL
, 0x0,
4746 { "AS-External LSA (ASBR)", "ospf.lsa.asext", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4748 {&hf_ospf_ls_asext_netmask
,
4749 { "Netmask", "ospf.lsa.asext.netmask", FT_IPv4
, BASE_NETMASK
, NULL
, 0x0,
4751 {&hf_ospf_ls_asext_fwdaddr
,
4752 { "Forwarding Address", "ospf.lsa.asext.fwdaddr", FT_IPv4
, BASE_NONE
, NULL
, 0x0,
4754 {&hf_ospf_ls_asext_extrtrtag
,
4755 { "External Route Tag", "ospf.lsa.asext.extrttag", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
4758 {&hf_ospf_ls_grpmember
,
4759 { "Group Membership LSA", "ospf.lsa.member", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4761 {&hf_ospf_ls_asext7
,
4762 { "NSSA AS-External LSA", "ospf.lsa.nssa", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4764 {&hf_ospf_ls_extattr
,
4765 { "External Attributes LSA", "ospf.lsa.attr", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4767 {&hf_ospf_ls_opaque
,
4768 { "Opaque LSA", "ospf.lsa.opaque", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4771 /* OSPFv3 E-LSA TLV */
4772 {&hf_ospf_v3_e_lsa_tlv_type
,
4773 { "TLV Type", "ospf.v3.elsa.tlv_type", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4775 {&hf_ospf_v3_e_lsa_tlv_length
,
4776 { "TLV Length", "ospf.v3.elsa.tlv_length", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4779 /* OSPFv3 LS Types */
4780 {&hf_ospf_v3_ls_type
,
4781 { "LS Type", "ospf.v3.lsa", FT_UINT16
, BASE_HEX
, NULL
, 0x0,
4783 {&hf_ospf_v3_ls_type_u
,
4784 { "LSA Handling", "ospf.v3.lsa.u", FT_BOOLEAN
, 16, TFS(&tfs_v3_ls_type_u
), 0x8000,
4786 {&hf_ospf_v3_ls_type_s12
,
4787 { "Flooding Scope", "ospf.v3.lsa.s12", FT_UINT16
, BASE_HEX
, VALS(v3_ls_type_s12_vals
), 0x6000,
4789 {&hf_ospf_v3_ls_type_fc
,
4790 { "Function Code", "ospf.v3.lsa.fc", FT_UINT16
, BASE_DEC
, VALS(v3_ls_type_vals
), 0x1FFF,
4793 {&hf_ospf_v3_ls_router
,
4794 { "Router-LSA", "ospf.v3.lsa.router", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4796 {&hf_ospf_v3_ls_network
,
4797 { "Network-LSA", "ospf.v3.lsa.network", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4799 {&hf_ospf_v3_ls_inter_area_prefix
,
4800 { "Inter-Area-Prefix-LSA", "ospf.v3.lsa.interprefix", FT_BOOLEAN
, BASE_NONE
,
4801 NULL
, 0x0, NULL
, HFILL
}},
4802 {&hf_ospf_v3_ls_inter_area_router
,
4803 { "Inter-Area-Router-LSA", "ospf.v3.lsa.interrouter", FT_BOOLEAN
, BASE_NONE
,
4804 NULL
, 0x0, NULL
, HFILL
}},
4805 {&hf_ospf_v3_ls_as_external
,
4806 { "AS-External-LSA", "ospf.v3.lsa.asext", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4808 {&hf_ospf_v3_ls_group_membership
,
4809 { "Group-Membership-LSA", "ospf.v3.lsa.member", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4811 {&hf_ospf_v3_ls_nssa
,
4812 { "NSSA-LSA", "ospf.v3.lsa.nssa", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4814 {&hf_ospf_v3_ls_link
,
4815 { "Link-LSA", "ospf.v3.lsa.link", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4817 {&hf_ospf_v3_ls_intra_area_prefix
,
4818 { "Intra-Area-Prefix-LSA", "ospf.v3.lsa.intraprefix", FT_BOOLEAN
, BASE_NONE
,
4819 NULL
, 0x0, NULL
, HFILL
}},
4820 {&hf_ospf_v3_elsa_intra_area_prefix
,
4821 { "E-Intra-Area-Prefix-LSA", "ospf.v3.elsa.intraprefix", FT_BOOLEAN
, BASE_NONE
,
4822 NULL
, 0x0, NULL
, HFILL
}},
4823 {&hf_ospf_v3_ls_opaque_ri
,
4824 { "Router Information Opaque-LSA", "ospf.v3.lsa.opaque", FT_BOOLEAN
, BASE_NONE
,
4825 NULL
, 0x0, NULL
, HFILL
}},
4827 /* Other interesting OSPF values */
4829 {&hf_ospf_adv_router
,
4830 { "Advertising Router", "ospf.advrouter", FT_IPv4
, BASE_NONE
, NULL
, 0x0,
4834 { "MPLS Traffic Engineering LSA", "ospf.lsa.mpls", FT_BOOLEAN
,
4835 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4837 {&hf_ospf_ls_mpls_routerid
,
4838 { "MPLS/TE Router ID", "ospf.mpls.routerid", FT_IPv4
, BASE_NONE
, NULL
, 0x0,
4841 {&hf_ospf_ls_mpls_linktype
,
4842 { "MPLS/TE Link Type", "ospf.mpls.linktype", FT_UINT8
, BASE_DEC
,
4843 VALS(mpls_link_stlv_ltype_str
), 0x0, NULL
, HFILL
}},
4844 {&hf_ospf_ls_mpls_linkid
,
4845 { "MPLS/TE Link ID", "ospf.mpls.linkid", FT_IPv4
, BASE_NONE
, NULL
, 0x0,
4847 {&hf_ospf_ls_mpls_local_addr
,
4848 { "MPLS/TE Local Interface Address", "ospf.mpls.local_addr", FT_IPv4
,
4849 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4850 {&hf_ospf_ls_mpls_remote_addr
,
4851 { "MPLS/TE Remote Interface Address", "ospf.mpls.remote_addr", FT_IPv4
,
4852 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4853 {&hf_ospf_ls_mpls_te_metric
,
4854 { "MPLS/TE Metric", "ospf.mpls.te_metric", FT_UINT32
,
4855 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
4857 {&hf_ospf_ls_mpls_local_ifid
,
4858 { "MPLS/TE Local Interface Index", "ospf.mpls.local_id", FT_UINT32
,
4859 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
4860 {&hf_ospf_ls_mpls_remote_ifid
,
4861 { "MPLS/TE Remote Interface Index", "ospf.mpls.remote_id", FT_UINT32
,
4862 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
4863 {&hf_ospf_ls_mpls_linkcolor
,
4864 { "MPLS/TE Link Resource Class/Color", "ospf.mpls.linkcolor", FT_UINT32
,
4865 BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
4866 {&hf_ospf_ls_mpls_group
,
4867 { "MPLS/TE Group", "ospf.mpls.group", FT_UINT32
,
4868 BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
4869 {&hf_ospf_ls_mpls_link_max_bw
,
4870 { "Link Max BW", "ospf.mpls.link_max_bw", FT_FLOAT
,
4871 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4872 {&hf_ospf_ls_mpls_bc_model_id
,
4873 { "MPLS/DSTE Bandwidth Constraints Model Id", "ospf.mpls.bc.model_id", FT_UINT8
,
4874 BASE_RANGE_STRING
| BASE_DEC
, RVALS(mpls_link_stlv_bcmodel_rvals
), 0x0,
4877 {&hf_ospf_ls_oif_local_node_id
,
4878 { "Local Node ID", "ospf.oif.local_node_id", FT_IPv4
,
4879 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4880 {&hf_ospf_ls_oif_remote_node_id
,
4881 { "Remote Node ID", "ospf.oif.remote_node_id", FT_IPv4
,
4882 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
4884 {&hf_ospf_v2_options
,
4885 { "Options", "ospf.v2.options", FT_UINT8
, BASE_HEX
,
4886 NULL
, 0x0, NULL
, HFILL
}},
4887 {&hf_ospf_v2_options_mt
,
4888 { "(MT) Multi-Topology Routing", "ospf.v2.options.mt", FT_BOOLEAN
, 8,
4889 TFS(&tfs_yes_no
), OSPF_V2_OPTIONS_MT
, NULL
, HFILL
}},
4890 {&hf_ospf_v2_options_e
,
4891 { "(E) External Routing", "ospf.v2.options.e", FT_BOOLEAN
, 8,
4892 TFS(&tfs_capable_not_capable
), OSPF_V2_OPTIONS_E
, NULL
, HFILL
}},
4893 {&hf_ospf_v2_options_mc
,
4894 { "(MC) Multicast", "ospf.v2.options.mc", FT_BOOLEAN
, 8,
4895 TFS(&tfs_capable_not_capable
), OSPF_V2_OPTIONS_MC
, NULL
, HFILL
}},
4896 {&hf_ospf_v2_options_n
,
4897 { "(N) NSSA", "ospf.v2.options.n", FT_BOOLEAN
, 8,
4898 TFS(&tfs_supported_not_supported
), OSPF_V2_OPTIONS_NP
, NULL
, HFILL
}},
4899 {&hf_ospf_v2_options_p
,
4900 { "(P) Propagate", "ospf.v2.options.p", FT_BOOLEAN
, 8,
4901 TFS(&tfs_set_notset
), OSPF_V2_OPTIONS_NP
, NULL
, HFILL
}},
4902 {&hf_ospf_v2_options_l
,
4903 { "(L) LLS Data block", "ospf.v2.options.l", FT_BOOLEAN
, 8,
4904 TFS(&tfs_present_not_present
), OSPF_V2_OPTIONS_L
, NULL
, HFILL
}},
4905 {&hf_ospf_v2_options_dc
,
4906 { "(DC) Demand Circuits", "ospf.v2.options.dc", FT_BOOLEAN
, 8,
4907 TFS(&tfs_supported_not_supported
), OSPF_V2_OPTIONS_DC
, NULL
, HFILL
}},
4908 {&hf_ospf_v2_options_o
,
4909 { "(O) Opaque", "ospf.v2.options.o", FT_BOOLEAN
, 8,
4910 TFS(&tfs_set_notset
), OSPF_V2_OPTIONS_O
, NULL
, HFILL
}},
4911 {&hf_ospf_v2_options_dn
,
4912 { "DN", "ospf.v2.options.dn", FT_BOOLEAN
, 8,
4913 TFS(&tfs_set_notset
), OSPF_V2_OPTIONS_DN
, NULL
, HFILL
}},
4915 {&hf_ospf_ri_options
,
4916 { "RI Options", "ospf.ri.options", FT_UINT8
, BASE_HEX
,
4917 NULL
, 0x0, NULL
, HFILL
}},
4918 {&hf_ospf_ri_options_grc
,
4919 { "(GRC) Graceful Restart", "ospf.ri.options.grc", FT_BOOLEAN
, 8,
4920 TFS(&tfs_capable_not_capable
), OSPF_RI_OPTIONS_GRC
, NULL
, HFILL
}},
4921 {&hf_ospf_ri_options_grh
,
4922 { "(GRH) Graceful Restart Helper", "ospf.ri.options.grh", FT_BOOLEAN
, 8,
4923 TFS(&tfs_enabled_disabled
), OSPF_RI_OPTIONS_GRH
, NULL
, HFILL
}},
4924 {&hf_ospf_ri_options_srs
,
4925 { "Stub Router Support", "ospf.ri.options.srs", FT_BOOLEAN
, 8,
4926 TFS(&tfs_yes_no
), OSPF_RI_OPTIONS_SRS
, NULL
, HFILL
}},
4927 {&hf_ospf_ri_options_tes
,
4928 { "(TES) Traffic Engineering", "ospf.ri.options.tes", FT_BOOLEAN
, 8,
4929 TFS(&tfs_supported_not_supported
), OSPF_RI_OPTIONS_TES
, NULL
, HFILL
}},
4930 {&hf_ospf_ri_options_p2plan
,
4931 { "(P2PLAN) Point-to-point over LAN", "ospf.ri.options.p2plan", FT_BOOLEAN
, 8,
4932 TFS(&tfs_capable_not_capable
), OSPF_RI_OPTIONS_P2PLAN
, NULL
, HFILL
}},
4933 {&hf_ospf_ri_options_ete
,
4934 { "(ETE) Experimental TE", "ospf.ri.options.ete", FT_BOOLEAN
, 8,
4935 TFS(&tfs_capable_not_capable
), OSPF_RI_OPTIONS_ETE
, NULL
, HFILL
}},
4936 {&hf_ospf_ri_options_host
,
4937 { "Host Router", "ospf.ri.options.host", FT_BOOLEAN
, 8,
4938 TFS(&tfs_capable_not_capable
), OSPF_RI_OPTIONS_HOST
, NULL
, HFILL
}},
4940 {&hf_ospf_tlv_type_opaque
,
4941 { "TLV Type", "ospf.tlv_type.opaque", FT_UINT16
, BASE_DEC
, VALS(ri_tlv_type_vals
), 0x0,
4944 {&hf_ospf_v3_options
,
4945 { "Options", "ospf.v3.options", FT_UINT24
, BASE_HEX
,
4946 NULL
, 0x0, NULL
, HFILL
}},
4947 {&hf_ospf_v3_options_v6
,
4948 { "V6", "ospf.v3.options.v6", FT_BOOLEAN
, 24,
4949 TFS(&tfs_set_notset
), OSPF_V3_OPTIONS_V6
, NULL
, HFILL
}},
4950 {&hf_ospf_v3_options_e
,
4951 { "E", "ospf.v3.options.e", FT_BOOLEAN
, 24,
4952 TFS(&tfs_set_notset
), OSPF_V3_OPTIONS_E
, NULL
, HFILL
}},
4953 {&hf_ospf_v3_options_mc
,
4954 { "MC", "ospf.v3.options.mc", FT_BOOLEAN
, 24,
4955 TFS(&tfs_set_notset
), OSPF_V3_OPTIONS_MC
, NULL
, HFILL
}},
4956 {&hf_ospf_v3_options_n
,
4957 { "N", "ospf.v3.options.n", FT_BOOLEAN
, 24,
4958 TFS(&tfs_set_notset
), OSPF_V3_OPTIONS_N
, NULL
, HFILL
}},
4959 {&hf_ospf_v3_options_r
,
4960 { "R", "ospf.v3.options.r", FT_BOOLEAN
, 24,
4961 TFS(&tfs_set_notset
), OSPF_V3_OPTIONS_R
, NULL
, HFILL
}},
4962 {&hf_ospf_v3_options_dc
,
4963 { "DC", "ospf.v3.options.dc", FT_BOOLEAN
, 24,
4964 TFS(&tfs_set_notset
), OSPF_V3_OPTIONS_DC
, NULL
, HFILL
}},
4965 {&hf_ospf_v3_options_af
,
4966 { "AF", "ospf.v3.options.af", FT_BOOLEAN
, 24,
4967 TFS(&tfs_set_notset
), OSPF_V3_OPTIONS_AF
, NULL
, HFILL
}},
4968 {&hf_ospf_v3_options_l
,
4969 { "L", "ospf.v3.options.l", FT_BOOLEAN
, 24,
4970 TFS(&tfs_set_notset
), OSPF_V3_OPTIONS_L
, NULL
, HFILL
}},
4971 {&hf_ospf_v3_options_at
,
4972 { "AT", "ospf.v3.options.at", FT_BOOLEAN
, 24,
4973 TFS(&tfs_set_notset
), OSPF_V3_OPTIONS_AT
, NULL
, HFILL
}},
4975 { "DB Description", "ospf.dbd", FT_UINT8
, BASE_HEX
,
4976 NULL
, 0x0, NULL
, HFILL
}},
4978 { "(R) OOBResync", "ospf.dbd.r", FT_BOOLEAN
, 8,
4979 TFS(&tfs_set_notset
), OSPF_DBD_FLAG_R
, NULL
, HFILL
}},
4981 { "(I) Init", "ospf.dbd.i", FT_BOOLEAN
, 8,
4982 TFS(&tfs_set_notset
), OSPF_DBD_FLAG_I
, NULL
, HFILL
}},
4984 { "(M) More", "ospf.dbd.m", FT_BOOLEAN
, 8,
4985 TFS(&tfs_set_notset
), OSPF_DBD_FLAG_M
, NULL
, HFILL
}},
4987 { "(MS) Master", "ospf.dbd.ms", FT_BOOLEAN
, 8,
4988 TFS(&tfs_yes_no
), OSPF_DBD_FLAG_MS
, NULL
, HFILL
}},
4989 {&hf_ospf_lls_ext_options
,
4990 { "Options", "ospf.lls.ext.options", FT_UINT32
, BASE_HEX
,
4991 NULL
, 0x0, NULL
, HFILL
}},
4992 {&hf_ospf_lls_ext_options_lr
,
4993 { "(LR) LSDB Resynchronization", "ospf.lls.ext.options.lr", FT_BOOLEAN
, 32,
4994 TFS(&tfs_set_notset
), OSPF_LLS_EXT_OPTIONS_LR
, NULL
, HFILL
}},
4995 {&hf_ospf_lls_ext_options_rs
,
4996 { "(RS) Restart Signal", "ospf.lls.ext.options.rs", FT_BOOLEAN
, 32,
4997 TFS(&tfs_set_notset
), OSPF_LLS_EXT_OPTIONS_RS
, NULL
, HFILL
}},
4998 {&hf_ospf_v2_router_lsa_flag
,
4999 { "Flags", "ospf.v2.router.lsa.flags", FT_UINT8
, BASE_HEX
,
5000 NULL
, 0x0, NULL
, HFILL
}},
5001 {&hf_ospf_v2_router_lsa_flag_b
,
5002 { "(B) Area border router", "ospf.v2.router.lsa.flags.b", FT_BOOLEAN
, 8,
5003 TFS(&tfs_yes_no
), OSPF_V2_ROUTER_LSA_FLAG_B
, NULL
, HFILL
}},
5004 {&hf_ospf_v2_router_lsa_flag_e
,
5005 { "(E) AS boundary router", "ospf.v2.router.lsa.flags.e", FT_BOOLEAN
, 8,
5006 TFS(&tfs_yes_no
), OSPF_V2_ROUTER_LSA_FLAG_E
, NULL
, HFILL
}},
5007 {&hf_ospf_v2_router_lsa_flag_v
,
5008 { "(V) Virtual link endpoint", "ospf.v2.router.lsa.flags.v", FT_BOOLEAN
, 8,
5009 TFS(&tfs_yes_no
), OSPF_V2_ROUTER_LSA_FLAG_V
, NULL
, HFILL
}},
5010 {&hf_ospf_v2_router_lsa_flag_w
,
5011 { "(W) Wild-card multicast receiver", "ospf.v2.router.lsa.flags.w", FT_BOOLEAN
, 8,
5012 TFS(&tfs_yes_no
), OSPF_V2_ROUTER_LSA_FLAG_W
, NULL
, HFILL
}},
5013 {&hf_ospf_v2_router_lsa_flag_n
,
5014 { "(N) NSSA translation", "ospf.v2.router.lsa.flags.n", FT_BOOLEAN
, 8,
5015 TFS(&tfs_yes_no
), OSPF_V2_ROUTER_LSA_FLAG_N
, NULL
, HFILL
}},
5016 {&hf_ospf_v2_router_lsa_flag_s
,
5017 { "(S) Shortcut-capable ABR", "ospf.v2.router.lsa.flags.s", FT_BOOLEAN
, 8,
5018 TFS(&tfs_yes_no
), OSPF_V2_ROUTER_LSA_FLAG_S
, NULL
, HFILL
}},
5019 {&hf_ospf_v2_router_lsa_flag_h
,
5020 { "(H) Host", "ospf.v2.router.lsa.flags.h", FT_BOOLEAN
, 8,
5021 TFS(&tfs_yes_no
), OSPF_V2_ROUTER_LSA_FLAG_H
, NULL
, HFILL
}},
5022 {&hf_ospf_v3_router_lsa_flag
,
5023 { "Flags", "ospf.v3.router.lsa.flags", FT_UINT8
, BASE_HEX
,
5024 NULL
, 0x0, NULL
, HFILL
}},
5025 {&hf_ospf_v3_router_lsa_flag_b
,
5026 { "(B) Area border router", "ospf.v3.router.lsa.flags.b", FT_BOOLEAN
, 8,
5027 TFS(&tfs_yes_no
), OSPF_V3_ROUTER_LSA_FLAG_B
, NULL
, HFILL
}},
5028 {&hf_ospf_v3_router_lsa_flag_e
,
5029 { "(E) AS boundary router", "ospf.v3.router.lsa.flags.e", FT_BOOLEAN
, 8,
5030 TFS(&tfs_yes_no
), OSPF_V3_ROUTER_LSA_FLAG_E
, NULL
, HFILL
}},
5031 {&hf_ospf_v3_router_lsa_flag_v
,
5032 { "(V) Virtual link endpoint", "ospf.v3.router.lsa.flags.v", FT_BOOLEAN
, 8,
5033 TFS(&tfs_yes_no
), OSPF_V3_ROUTER_LSA_FLAG_V
, NULL
, HFILL
}},
5034 {&hf_ospf_v3_router_lsa_flag_w
,
5035 { "(W) Wild-card multicast receiver", "ospf.v3.router.lsa.flags.w", FT_BOOLEAN
, 8,
5036 TFS(&tfs_yes_no
), OSPF_V3_ROUTER_LSA_FLAG_W
, NULL
, HFILL
}},
5037 {&hf_ospf_v3_as_external_flag
,
5038 { "Flags", "ospf.v3.as.external.flags", FT_UINT8
, BASE_HEX
,
5039 NULL
, 0x0, NULL
, HFILL
}},
5040 {&hf_ospf_v3_as_external_flag_t
,
5041 { "(T) External Route Tag", "ospf.v3.as.external.flags.t", FT_BOOLEAN
, 8,
5042 TFS(&tfs_present_not_present
), OSPF_V3_AS_EXTERNAL_FLAG_T
, NULL
, HFILL
}},
5043 {&hf_ospf_v3_as_external_flag_f
,
5044 { "(F) Forwarding Address", "ospf.v3.as.external.flags.f", FT_BOOLEAN
, 8,
5045 TFS(&tfs_present_absent
), OSPF_V3_AS_EXTERNAL_FLAG_F
, NULL
, HFILL
}},
5046 {&hf_ospf_v3_as_external_flag_e
,
5047 { "(E) External Metric", "ospf.v3.as.external.flags.e", FT_BOOLEAN
, 8,
5048 TFS(&tfs_v3_as_external_flags_e
), OSPF_V3_AS_EXTERNAL_FLAG_E
, NULL
, HFILL
}},
5049 {&hf_ospf_v3_prefix_option
,
5050 { "PrefixOptions", "ospf.v3.prefix.options", FT_UINT8
, BASE_HEX
,
5051 NULL
, 0x0, NULL
, HFILL
}},
5052 {&hf_ospf_v3_prefix_option_nu
,
5053 { "(NU) NoUnicast", "ospf.v3.prefix.options.nu", FT_BOOLEAN
, 8,
5054 TFS(&tfs_set_notset
), OSPF_V3_PREFIX_OPTION_NU
, NULL
, HFILL
}},
5055 {&hf_ospf_v3_prefix_option_la
,
5056 { "(LA) Local Address", "ospf.v3.prefix.options.la", FT_BOOLEAN
, 8,
5057 TFS(&tfs_set_notset
), OSPF_V3_PREFIX_OPTION_LA
, NULL
, HFILL
}},
5058 {&hf_ospf_v3_prefix_option_mc
,
5059 { "(MC) Multicast", "ospf.v3.prefix.options.mc", FT_BOOLEAN
, 8,
5060 TFS(&tfs_set_notset
), OSPF_V3_PREFIX_OPTION_MC
, NULL
, HFILL
}},
5061 {&hf_ospf_v3_prefix_option_p
,
5062 { "(P) Propagate", "ospf.v3.prefix.options.p", FT_BOOLEAN
, 8,
5063 TFS(&tfs_set_notset
), OSPF_V3_PREFIX_OPTION_P
, NULL
, HFILL
}},
5065 /* Dynamic Hostname contained in the Opaque RI LSA - dynamic hostname TLV*/
5066 {&hf_ospf_dyn_hostname
,
5067 { "Dynamic Hostname", "ospf.dynhostname", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5070 { "SR-Algorithm", "ospf.lsa_sa", FT_UINT8
, BASE_DEC
, VALS(ri_lsa_sa_tlv_type_vals
), 0x0, NULL
, HFILL
}},
5072 {&hf_ospf_ls_slr_stlv
,
5073 { "TLV Type", "ospf.tlv.sidlabel_range.type", FT_UINT16
, BASE_DEC
, VALS(ext_pfx_stlv_type_vals
), 0x0, NULL
, HFILL
}},
5074 {&hf_ospf_ls_range_size
,
5075 { "Range Size", "ospf.tlv.range_size", FT_UINT24
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5076 {&hf_ospf_ls_sid_label
,
5077 { "SID/Label", "ospf.tlv.sid_label", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5078 {&hf_ospf_ls_preference
,
5079 { "Preference", "ospf.tlv.preference", FT_UINT24
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5080 {&hf_ospf_ls_igp_msd_type
,
5081 { "MSD Type", "ospf.tlv.igp_msd_type", FT_UINT8
, BASE_DEC
, VALS(ospf_igp_msd_types
), 0x0, NULL
, HFILL
}},
5082 {&hf_ospf_ls_igp_msd_value
,
5083 { "MSD Value", "ospf.tlv.igp_msd_value", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5084 {&hf_ospf_ls_remote_ipv4_addr
,
5085 { "Remote IPv4 Address", "ospf.tlv.remote_ipv4_address", FT_IPv4
, BASE_NONE
,
5086 NULL
, 0x0, NULL
, HFILL
}},
5087 {&hf_ospf_ls_local_interface_id
,
5088 { "Local Interface ID", "ospf.tlv.local_interface_id", FT_UINT32
, BASE_DEC
,
5089 NULL
, 0x0, NULL
, HFILL
}},
5090 {&hf_ospf_ls_remote_interface_id
,
5091 { "Remote Interface ID", "ospf.tlv.remote_interface_id", FT_UINT32
, BASE_DEC
,
5092 NULL
, 0x0, NULL
, HFILL
}},
5094 /* Flex Algo Definition TLV (draft-ietf-lsr-flex-algo-17) */
5095 {&hf_ospf_ls_fad_flex_algorithm
,
5096 { "Flex-Algorithm", "ospf.tlv.fad.flex_algorithm", FT_UINT8
, BASE_DEC
,
5097 NULL
, 0x0, NULL
, HFILL
}},
5098 {&hf_ospf_ls_fad_metric_type
,
5099 { "Metric-Type", "ospf.tlv.fad.metric_type", FT_UINT8
, BASE_DEC
,
5100 VALS(ri_lsa_fad_metric_type_vals
), 0x0, NULL
, HFILL
}},
5101 {&hf_ospf_ls_fad_calc_type
,
5102 { "Calc-Type", "ospf.tlv.fad.calc_type", FT_UINT8
, BASE_DEC
,
5103 VALS(ri_lsa_sa_tlv_type_vals
), 0x0, NULL
, HFILL
}},
5104 {&hf_ospf_ls_fad_priority
,
5105 { "Priority", "ospf.tlv.fad.priority", FT_UINT8
, BASE_DEC
,
5106 NULL
, 0x0, NULL
, HFILL
}},
5107 {&hf_ospf_ls_fad_stlv
,
5108 { "TLV Type", "ospf.tlv.fad.subtlv_type", FT_UINT16
, BASE_DEC
, VALS(ri_lsa_fad_stlv_type_vals
), 0x0,
5111 /* the Unknown TLV of the Opaque RI LSA */
5112 {&hf_ospf_unknown_tlv
,
5113 { "Unknown TLV", "ospf.tlv.unknown", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5115 /* OSPF Extended Prefix TLV */
5116 {&hf_ospf_ls_epfx_tlv
,
5117 { "TLV Type", "ospf.tlv.extpfx.tlv_type", FT_UINT16
, BASE_DEC
, VALS(ext_pfx_tlv_type_vals
), 0x0, NULL
, HFILL
}},
5118 {&hf_ospf_ls_epfx_stlv
,
5119 { "TLV Type", "ospf.tlv.extpfx.subtlv_type", FT_UINT16
, BASE_DEC
, VALS(ext_pfx_stlv_type_vals
), 0x0, NULL
, HFILL
}},
5120 {&hf_ospf_ls_epfx_route_type
,
5121 { "Route Type", "ospf.tlv.extpfx.routetype", FT_UINT16
, BASE_DEC
, VALS(ext_pfx_tlv_route_vals
), 0x0, NULL
, HFILL
}},
5122 {&hf_ospf_ls_epfx_af
,
5123 { "Address Family", "ospf.tlv.extpfx.af", FT_UINT8
, BASE_DEC
, VALS(ext_pfx_tlv_af_vals
), 0x0, NULL
, HFILL
}},
5125 {&hf_ospf_ls_epfx_flags
,
5126 { "Flags", "ospf.tlv.extpfx.flags", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
5127 {&hf_ospf_ls_epfx_flag_a
,
5128 { "(A) Attach Flag", "ospf.tlv.extpfx.flags.a", FT_BOOLEAN
, 8,
5129 TFS(&tfs_set_notset
), EXT_PREFIX_TLV_FLAG_A
, NULL
, HFILL
}},
5130 {&hf_ospf_ls_epfx_flag_n
,
5131 { "(N) Node Flag", "ospf.tlv.extpfx.flags.n", FT_BOOLEAN
, 8,
5132 TFS(&tfs_set_notset
), EXT_PREFIX_TLV_FLAG_N
, NULL
, HFILL
}},
5133 {&hf_ospf_ls_epfx_flag_unknown
,
5134 { "(*) Unknown Flag", "ospf.tlv.extpfx.flags.unknown", FT_UINT8
, BASE_HEX
,
5135 NULL
, EXT_PREFIX_TLV_FLAG_UNKNOWN
, NULL
, HFILL
}},
5137 {&hf_ospf_ls_epfx_range_flags
,
5138 { "Flags", "ospf.tlv.extpfx_range.flags", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
5139 {&hf_ospf_ls_epfx_range_flag_ia
,
5140 { "(IA) Inter-Area Flag", "ospf.tlv.extpfx_range.flags.ia", FT_BOOLEAN
, 8,
5141 TFS(&tfs_set_notset
), EXT_PREFIX_RANGE_TLV_FLAG_IA
, NULL
, HFILL
}},
5142 {&hf_ospf_ls_epfx_range_flag_unknown
,
5143 { "(*) Unknown Flag", "ospf.tlv.extpfx_range.flags.unknown", FT_UINT8
, BASE_HEX
,
5144 NULL
, EXT_PREFIX_RANGE_TLV_FLAG_UNKNOWN
, NULL
, HFILL
}},
5146 {&hf_ospf_ls_pfxsid_flags
,
5147 { "Flags", "ospf.tlv.pfxsid.flags", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
5148 {&hf_ospf_ls_pfxsid_flag_np
,
5149 { "(NP) No-PHP Flag", "ospf.tlv.pfxsid.flags.np", FT_BOOLEAN
, 8,
5150 TFS(&tfs_set_notset
), SR_STLV_PFXSID_FLAG_NP
, NULL
, HFILL
}},
5151 {&hf_ospf_ls_pfxsid_flag_m
,
5152 { "(M) Mapping Server Flag", "ospf.tlv.pfxsid.flags.m", FT_BOOLEAN
, 8,
5153 TFS(&tfs_set_notset
), SR_STLV_PFXSID_FLAG_M
, NULL
, HFILL
}},
5154 {&hf_ospf_ls_pfxsid_flag_e
,
5155 { "(E) Explicit-Null Flag", "ospf.tlv.pfxsid.flags.e", FT_BOOLEAN
, 8,
5156 TFS(&tfs_set_notset
), SR_STLV_PFXSID_FLAG_E
, NULL
, HFILL
}},
5157 {&hf_ospf_ls_pfxsid_flag_v
,
5158 { "(V) Value/Index Flag", "ospf.tlv.pfxsid.flags.v", FT_BOOLEAN
, 8,
5159 TFS(&tfs_set_notset
), SR_STLV_PFXSID_FLAG_V
, NULL
, HFILL
}},
5160 {&hf_ospf_ls_pfxsid_flag_l
,
5161 { "(L) Local/Global Flag", "ospf.tlv.pfxsid.flags.l", FT_BOOLEAN
, 8,
5162 TFS(&tfs_set_notset
), SR_STLV_PFXSID_FLAG_L
, NULL
, HFILL
}},
5163 {&hf_ospf_ls_pfxsid_flag_unknown
,
5164 { "(*) Unknown Flag", "ospf.tlv.pfxsid.flags.unknown", FT_UINT8
, BASE_HEX
,
5165 NULL
, SR_STLV_PFXSID_FLAG_UNKNOWN
, NULL
, HFILL
}},
5167 /* OSPF Extended Link TLV */
5168 {&hf_ospf_ls_elink_tlv
,
5169 { "TLV Type", "ospf.tlv.extlink.tlv_type", FT_UINT16
, BASE_DEC
, VALS(ext_link_tlv_type_vals
), 0x0, NULL
, HFILL
}},
5170 {&hf_ospf_ls_elink_stlv
,
5171 { "TLV Type", "ospf.tlv.extlink.subtlv_type", FT_UINT16
, BASE_DEC
, VALS(ext_link_stlv_type_vals
), 0x0, NULL
, HFILL
}},
5172 {&hf_ospf_ls_elink_mt_id
,
5173 { "Multi-Topology ID", "ospf.tlv.extlink.mt_id", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5174 {&hf_ospf_ls_elink_weight
,
5175 { "Weight", "ospf.tlv.extlink.weight", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5176 {&hf_ospf_ls_elink_nbr
,
5177 { "Neighbor ID", "ospf.tlv.extlink.nbr", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5179 {&hf_ospf_ls_adjsid_flags
,
5180 { "Flags", "ospf.tlv.adjsid.flags", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
5181 {&hf_ospf_ls_adjsid_flag_b
,
5182 { "(B) Backup Flag", "ospf.tlv.adjsid.flags.b", FT_BOOLEAN
, 8,
5183 TFS(&tfs_set_notset
), SR_STLV_ADJSID_FLAG_B
, NULL
, HFILL
}},
5184 {&hf_ospf_ls_adjsid_flag_v
,
5185 { "(V) Value/Index Flag", "ospf.tlv.adjsid.flags.v", FT_BOOLEAN
, 8,
5186 TFS(&tfs_set_notset
), SR_STLV_ADJSID_FLAG_V
, NULL
, HFILL
}},
5187 {&hf_ospf_ls_adjsid_flag_l
,
5188 { "(L) Local/Global Flag", "ospf.tlv.adjsid.flags.l", FT_BOOLEAN
, 8,
5189 TFS(&tfs_set_notset
), SR_STLV_ADJSID_FLAG_L
, NULL
, HFILL
}},
5190 {&hf_ospf_ls_adjsid_flag_g
,
5191 { "(G) Group Flag", "ospf.tlv.adjsid.flags.g", FT_BOOLEAN
, 8,
5192 TFS(&tfs_set_notset
), SR_STLV_ADJSID_FLAG_G
, NULL
, HFILL
}},
5193 {&hf_ospf_ls_adjsid_flag_p
,
5194 { "(P) Persistent Flag", "ospf.tlv.adjsid.flags.p", FT_BOOLEAN
, 8,
5195 TFS(&tfs_set_notset
), SR_STLV_ADJSID_FLAG_P
, NULL
, HFILL
}},
5196 {&hf_ospf_ls_adjsid_flag_unknown
,
5197 { "(*) Unknown Flag", "ospf.tlv.adjsid.flags.unknown", FT_UINT8
, BASE_HEX
,
5198 NULL
, SR_STLV_ADJSID_FLAG_UNKNOWN
, NULL
, HFILL
}},
5199 /* Application-Specific Link Attributes Sub-TLV (rfc8920) */
5200 {&hf_ospf_ls_app_sabm_length
,
5201 { "SABM Length", "ospf.tlv.application.sabm.length",
5202 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5203 {&hf_ospf_ls_app_udabm_length
,
5204 { "UDABM Length", "ospf.tlv.application.udabm.length",
5205 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5206 {&hf_ospf_ls_app_sabm_bits
,
5207 { "Standard Application Identifier Bit Mask", "ospf.tlv.application.sabm.bits",
5208 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
5209 {&hf_ospf_ls_app_sabm_bits_r
,
5210 { "(R) RSVP-TE", "ospf.tlv.application.sabm.bits.r",
5211 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x80, NULL
, HFILL
}},
5212 {&hf_ospf_ls_app_sabm_bits_s
,
5213 { "(S) Segment Routing Policy", "ospf.tlv.application.sabm.bits.s",
5214 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x40, NULL
, HFILL
}},
5215 {&hf_ospf_ls_app_sabm_bits_f
,
5216 { "(F) Loop-Free Alternate (LFA)", "ospf.tlv.application.sabm.bits.f",
5217 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x20, NULL
, HFILL
}},
5218 {&hf_ospf_ls_app_sabm_bits_x
,
5219 { "(X) Flexible Algorithm", "ospf.tlv.application.sabm.bits.x",
5220 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x10, NULL
, HFILL
}},
5221 {&hf_ospf_ls_app_udabm_bits
,
5222 { "User-Defined Application Identifier Bit Mask", "ospf.tlv.application.udabm.bits",
5223 FT_BYTES
, SEP_SPACE
, NULL
, 0x0, NULL
, HFILL
}},
5224 {&hf_ospf_ls_app_link_attrs_stlv
,
5225 { "TLV Type", "ospf.tlv.application.subtlv_type",
5226 FT_UINT16
, BASE_DEC
, VALS(ext_link_stlv_type_vals
), 0x0, NULL
, HFILL
}},
5227 /* OSPF Traffic Engineering (TE) Metric Extensions (rfc7471) */
5228 {&hf_ospf_ls_unidir_link_flags
,
5229 { "Flags", "ospf.tlv.unidirectional_link_flags",
5230 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
5232 {&hf_ospf_ls_unidir_link_flags_a
,
5233 { "(A) Anomalous", "ospf.tlv.unidirectional_link_flags.a",
5234 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x80, NULL
, HFILL
}
5236 {&hf_ospf_ls_unidir_link_flags_reserved
,
5237 { "Reserved", "ospf.tlv.unidirectional_link_flags.reserved",
5238 FT_UINT8
, BASE_HEX
, NULL
, 0x7f, NULL
, HFILL
}
5240 {&hf_ospf_ls_unidir_link_reserved
,
5241 { "Reserved", "ospf.tlv.unidirectional_link_reserved",
5242 FT_UINT8
, BASE_HEX
, NULL
, 0,NULL
, HFILL
}
5244 {&hf_ospf_ls_unidir_link_delay
,
5245 { "Delay", "ospf.tlv.unidirectional_link_delay",
5246 FT_UINT24
, BASE_DEC
, NULL
, 0,NULL
, HFILL
}
5248 {&hf_ospf_ls_unidir_link_delay_min
,
5249 { "Min Delay", "ospf.tlv.unidirectional_link_delay_min",
5250 FT_UINT24
, BASE_DEC
, NULL
, 0, NULL
, HFILL
}
5252 {&hf_ospf_ls_unidir_link_delay_max
,
5253 { "Max Delay", "ospf.tlv.unidirectional_link_delay_max",
5254 FT_UINT24
, BASE_DEC
, NULL
, 0, NULL
, HFILL
}
5256 {&hf_ospf_ls_unidir_delay_variation
,
5257 { "Delay Variation", "ospf.tlv.unidirectional_delay_variation",
5258 FT_UINT24
, BASE_DEC
, NULL
, 0, NULL
, HFILL
}
5260 /* Administrative Group (rfc3630) */
5261 {&hf_ospf_ls_admin_group
,
5262 { "Admin Group", "ospf.tlv.admin_group", FT_UINT32
, BASE_HEX
,
5263 NULL
, 0x0, NULL
, HFILL
}},
5264 /* Extended Administrative Group (rfc7308) */
5265 {&hf_ospf_ls_ext_admin_group
,
5266 { "Extended Admin Group", "ospf.tlv.extended_admin_group", FT_UINT32
, BASE_HEX
,
5267 NULL
, 0x0, NULL
, HFILL
}},
5269 /* OSPF Restart TLVs */
5270 {&hf_ospf_v2_grace_tlv
,
5271 { "Grace TLV", "ospf.v2.grace", FT_NONE
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5272 {&hf_ospf_v2_grace_period
,
5273 { "Grace Period", "ospf.v2.grace.period", FT_UINT32
, BASE_DEC
,
5275 "The number of seconds neighbors should advertise the router as fully adjacent",
5277 {&hf_ospf_v2_grace_reason
,
5278 { "Restart Reason", "ospf.v2.grace.reason", FT_UINT8
, BASE_DEC
,
5279 VALS(restart_reason_vals
), 0x0, "The reason the router is restarting", HFILL
}},
5280 {&hf_ospf_v2_grace_ip
,
5281 { "Restart IP", "ospf.v2.grace.ip", FT_IPv4
, BASE_NONE
,
5282 NULL
, 0x0, "The IP address of the interface originating this LSA", HFILL
}},
5284 /* OSPFv3 LLS TLVs */
5285 {&hf_ospf_v3_lls_ext_options_tlv
,
5286 { "Extended Options TLV", "ospf.v3.lls.ext.options.tlv", FT_NONE
, BASE_NONE
,
5287 NULL
, 0x0, NULL
, HFILL
}},
5288 {&hf_ospf_v3_lls_ext_options
,
5289 { "Options", "ospf.v3.lls.ext.options", FT_UINT32
, BASE_HEX
,
5290 NULL
, 0x0, NULL
, HFILL
}},
5291 {&hf_ospf_v3_lls_ext_options_lr
,
5292 { "(LR) LSDB Resynchronization", "ospf.v3.lls.ext.options.lr", FT_BOOLEAN
, 32,
5293 TFS(&tfs_set_notset
), OSPF_V3_LLS_EXT_OPTIONS_LR
, NULL
, HFILL
}},
5294 {&hf_ospf_v3_lls_ext_options_rs
,
5295 { "(RS) Restart Signal", "ospf.v3.lls.ext.options.rs", FT_BOOLEAN
, 32,
5296 TFS(&tfs_set_notset
), OSPF_V3_LLS_EXT_OPTIONS_RS
, NULL
, HFILL
}},
5297 {&hf_ospf_v3_lls_state_tlv
,
5298 { "State Check Sequence TLV", "ospf.v3.lls.state.tlv", FT_NONE
, BASE_NONE
,
5299 NULL
, 0x0, NULL
, HFILL
}},
5300 {&hf_ospf_v3_lls_state_scs
,
5301 { "SCS Number", "ospf.v3.lls.state.scs", FT_UINT16
, BASE_DEC
,
5302 NULL
, 0x0, NULL
, HFILL
}},
5303 {&hf_ospf_v3_lls_state_options
,
5304 { "Options", "ospf.v3.lls.state.options", FT_UINT8
, BASE_HEX
,
5305 NULL
, 0x0, NULL
, HFILL
}},
5306 {&hf_ospf_v3_lls_state_options_r
,
5307 { "(R) Request", "ospf.v3.lls.state.options.r", FT_BOOLEAN
, 8,
5308 TFS(&tfs_set_notset
), OSPF_V3_LLS_STATE_OPTIONS_R
, NULL
, HFILL
}},
5309 {&hf_ospf_v3_lls_state_options_a
,
5310 { "(A) Answer", "ospf.v3.lls.state.options.a", FT_BOOLEAN
, 8,
5311 TFS(&tfs_set_notset
), OSPF_V3_LLS_STATE_OPTIONS_A
, NULL
, HFILL
}},
5312 {&hf_ospf_v3_lls_state_options_n
,
5313 { "(N) Incomplete", "ospf.v3.lls.state.options.n", FT_BOOLEAN
, 8,
5314 TFS(&tfs_set_notset
), OSPF_V3_LLS_STATE_OPTIONS_N
,NULL
, HFILL
}},
5315 {&hf_ospf_v3_lls_drop_tlv
,
5316 { "Neighbor Drop TLV", "ospf.v3.lls.drop.tlv", FT_NONE
, BASE_NONE
,
5317 NULL
, 0x0, NULL
, HFILL
}},
5318 {&hf_ospf_v3_lls_relay_tlv
,
5319 { "Active Overlapping Relays TLV", "ospf.v3.lls.relay.tlv", FT_NONE
, BASE_NONE
,
5320 NULL
, 0x0, NULL
, HFILL
}},
5321 {&hf_ospf_v3_lls_relay_added
,
5322 { "Relays Added", "ospf.v3.lls.relay.added", FT_UINT8
, BASE_DEC
,
5323 NULL
, 0x0, NULL
, HFILL
}},
5324 {&hf_ospf_v3_lls_relay_options
,
5325 { "Options", "ospf.v3.lls.relay.options", FT_UINT8
, BASE_HEX
,
5326 NULL
, 0x0, NULL
, HFILL
}},
5327 {&hf_ospf_v3_lls_relay_options_a
,
5328 { "(A) Always", "ospf.v3.lls.relay.options.a", FT_BOOLEAN
, 8,
5329 TFS(&tfs_set_notset
), OSPF_V3_LLS_RELAY_OPTIONS_A
, NULL
, HFILL
}},
5330 {&hf_ospf_v3_lls_relay_options_n
,
5331 { "(N) Never", "ospf.v3.lls.relay.options.n", FT_BOOLEAN
, 8,
5332 TFS(&tfs_set_notset
), OSPF_V3_LLS_RELAY_OPTIONS_N
, NULL
, HFILL
}},
5333 {&hf_ospf_v3_lls_willingness_tlv
,
5334 { "Willingness TLV", "ospf.v3.lls.willingness.tlv", FT_NONE
, BASE_NONE
,
5335 NULL
, 0x0, NULL
, HFILL
}},
5336 {&hf_ospf_v3_lls_willingness
,
5337 { "Willingness", "ospf.v3.lls.willingness", FT_UINT8
, BASE_DEC
,
5338 NULL
, 0x0, NULL
, HFILL
}},
5339 {&hf_ospf_v3_lls_rf_tlv
,
5340 { "Request From TLV", "ospf.v3.lls.rf.tlv", FT_NONE
, BASE_NONE
,
5341 NULL
, 0x0, NULL
, HFILL
}},
5342 {&hf_ospf_v3_lls_fsf_tlv
,
5343 { "Full State For TLV", "ospf.v3.lls.fsf.tlv", FT_NONE
, BASE_NONE
,
5344 NULL
, 0x0, NULL
, HFILL
}},
5345 {&hf_ospf_v2_lls_li_id
,
5346 { "Local Interface ID", "ospf.v3.lls.ll_id", FT_BYTES
, BASE_NONE
,
5347 NULL
, 0x0, NULL
, HFILL
}},
5348 /* Generated from convert_proto_tree_add_text.pl */
5349 { &hf_ospf_v2_lls_sequence_number
, { "Sequence number", "ospf.v2.lls.sequence_number", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
5350 { &hf_ospf_v2_lls_auth_data
, { "Auth Data", "ospf.v2.lls.auth_data", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5351 { &hf_ospf_v3_lls_dropped_neighbor
, { "Dropped Neighbor", "ospf.v3.lls.dropped_neighbor", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5352 { &hf_ospf_v3_lls_neighbor
, { "Neighbor", "ospf.v3.lls.neighbor", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5353 { &hf_ospf_v3_lls_request_from
, { "Request From", "ospf.v3.lls.request_from", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5354 { &hf_ospf_v3_lls_full_state_for
, { "Full State For", "ospf.v3.lls.full_state_for", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5355 { &hf_ospf_lls_checksum
, { "Checksum", "ospf.lls.checksum", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
5356 { &hf_ospf_lls_data_length
, { "LLS Data Length", "ospf.lls.data_length", FT_UINT16
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_byte_bytes
), 0x0, NULL
, HFILL
}},
5357 { &hf_ospf_db_interface_mtu
, { "Interface MTU", "ospf.db.interface_mtu", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5358 { &hf_ospf_db_dd_sequence
, { "DD Sequence", "ospf.db.dd_sequence", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5359 { &hf_ospf_link_state_id
, { "Link State ID", "ospf.link_state_id", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5360 { &hf_ospf_ls_number_of_lsas
, { "Number of LSAs", "ospf.ls.number_of_lsas", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5361 { &hf_ospf_mpls_action
, { "Action", "ospf.mpls.action", FT_UINT8
, BASE_DEC
, NULL
, 0xF0, NULL
, HFILL
}},
5362 { &hf_ospf_mpls_bandwidth_type
, { "Bandwidth Type", "ospf.mpls.bandwidth.type", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5363 { &hf_ospf_mpls_cs
, { "Channel Spacing", "ospf.mpls.cs", FT_UINT8
, BASE_DEC
, NULL
, 0xF0, NULL
, HFILL
}},
5364 { &hf_ospf_mpls_switching_type
, { "Switching Type", "ospf.mpls.switching_type", FT_UINT8
, BASE_DEC
|BASE_RANGE_STRING
, RVALS(gmpls_switching_type_rvals
), 0x0, NULL
, HFILL
}},
5365 { &hf_ospf_mpls_encoding
, { "Encoding", "ospf.mpls.encoding", FT_UINT8
, BASE_DEC
|BASE_RANGE_STRING
, RVALS(gmpls_lsp_enc_rvals
), 0x0, NULL
, HFILL
}},
5366 { &hf_ospf_mpls_num_labels
, { "Num Labels", "ospf.mpls.num.labels", FT_UINT16
, BASE_DEC
, NULL
, 0x0FFF, NULL
, HFILL
}},
5367 { &hf_ospf_mpls_interface_mtu
, { "Interface MTU", "ospf.mpls.interface_mtu", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5368 { &hf_ospf_mpls_length
, { "Length", "ospf.mpls.length", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5369 { &hf_ospf_mpls_pri
, { "Priority", "ospf.mpls.priority", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5370 { &hf_ospf_mpls_protection_capability
, { "Protection Capability", "ospf.mpls.protection_capability", FT_UINT8
, BASE_HEX
, VALS(gmpls_protection_cap_str
), 0x0, NULL
, HFILL
}},
5371 { &hf_ospf_mpls_shared_risk_link_group
, { "Shared Risk Link Group", "ospf.mpls.shared_risk_link_group", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5372 { &hf_ospf_mpls_starting
, { "Starting n", "ospf.mpls.starting", FT_UINT32
, BASE_DEC
, NULL
, 0x0FFFF000, NULL
, HFILL
}},
5373 { &hf_ospf_mpls_no_effective_bits
, { "No. of effective. Bits", "ospf.mpls.effective", FT_UINT16
, BASE_DEC
, NULL
, 0x0FFF, NULL
, HFILL
}},
5374 { &hf_ospf_mpls_bitmap
, { "Bitmap", "ospf.mpls.bitmap", FT_UINT32
, BASE_HEX
, NULL
, 0xFFFFFFFF, NULL
, HFILL
}},
5375 { &hf_ospf_mpls_grid
, { "Grid", "ospf.mpls.grid", FT_UINT8
, BASE_DEC
, NULL
, 0xE0, NULL
, HFILL
}},
5376 { &hf_ospf_mpls_cs2
, { "Channel Spacing", "ospf.mpls.cs", FT_UINT8
, BASE_DEC
, NULL
, 0x1E, NULL
, HFILL
}},
5377 { &hf_ospf_mpls_n
, { "Starting n", "ospf.mpls.n", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5378 { &hf_ospf_mpls_type
, { "Type", "ospf.mpls.type", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5379 { &hf_ospf_oif_switching_cap
, { "Switching Cap", "ospf.oif.switching_cap", FT_UINT8
, BASE_DEC
|BASE_RANGE_STRING
, RVALS(gmpls_switching_type_rvals
), 0x0, NULL
, HFILL
}},
5380 { &hf_ospf_oif_encoding
, { "Encoding", "ospf.oif.encoding", FT_UINT8
, BASE_DEC
|BASE_RANGE_STRING
, RVALS(gmpls_lsp_enc_rvals
), 0x0, NULL
, HFILL
}},
5381 { &hf_ospf_oif_tna_addr_length
, { "Addr Length", "ospf.oif.tna_addr_length", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5382 { &hf_ospf_oif_tna_addr_ipv4
, { "TNA Addr", "ospf.oif.tna_addr.ipv4", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5383 { &hf_ospf_tna_addr_ipv6
, { "TNA Addr", "ospf.oif.tna_addr.ipv6", FT_IPv6
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5384 { &hf_ospf_tna_addr
, { "TNA Addr", "ospf.oif.tna_addr", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5385 { &hf_ospf_ls_id_te_lsa_reserved
, { "Link State ID TE-LSA Reserved", "ospf.lsid_te_lsa.reserved", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5386 { &hf_ospf_ls_id_opaque_id
, { "Link State ID Opaque ID", "ospf.lsid.opaque_id", FT_UINT24
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5387 { &hf_ospf_lsa_number_of_links
, { "Number of Links", "ospf.lsa.number_of_links", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5388 { &hf_ospf_v3_lsa_do_not_age
, { "Do Not Age", "ospf.v3.lsa.do_not_age", FT_BOOLEAN
, 16, NULL
, OSPF_DNA_LSA
, NULL
, HFILL
}},
5389 { &hf_ospf_v3_lsa_interface_id
, { "Interface ID", "ospf.v3.lsa.interface_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5390 { &hf_ospf_v3_lsa_neighbor_interface_id
, { "Neighbor Interface ID", "ospf.v3.lsa.neighbor_interface_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5391 { &hf_ospf_v3_lsa_neighbor_router_id
, { "Neighbor Router ID", "ospf.v3.lsa.neighbor_router_id", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5392 { &hf_ospf_v3_lsa_attached_router
, { "Attached Router", "ospf.v3.lsa.attached_router", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5393 { &hf_ospf_v3_lsa_destination_router_id
, { "Destination Router ID", "ospf.v3.lsa.destination_router_id", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5394 { &hf_ospf_v3_lsa_referenced_ls_type
, { "Referenced LS type", "ospf.v3.lsa.referenced_ls_type", FT_UINT16
, BASE_HEX
, VALS(v3_ls_type_vals
), 0x0, NULL
, HFILL
}},
5395 { &hf_ospf_v3_lsa_forwarding_address_ipv6
, { "Forwarding Address", "ospf.v3.lsa.forwarding_address.ipv6", FT_IPv6
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5396 { &hf_ospf_v3_lsa_external_route_tag
, { "External Route Tag", "ospf.v3.lsa.external_route_tag", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5397 { &hf_ospf_v3_lsa_referenced_link_state_id
, { "Referenced Link State ID", "ospf.v3.lsa.referenced_link_state_id", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5398 { &hf_ospf_v3_lsa_router_priority
, { "Router Priority", "ospf.v3.lsa.router_priority", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5399 { &hf_ospf_v3_lsa_link_local_interface_address
, { "Link-local Interface Address", "ospf.v3.lsa.link_local_interface_address.ipv6", FT_IPv6
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5400 { &hf_ospf_referenced_advertising_router
, { "Referenced Advertising Router", "ospf.v3.lsa.referenced_advertising_router", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5401 { &hf_ospf_lsa_external_type
, { "External Type", "ospf.lsa.asext.type", FT_BOOLEAN
, 8, TFS(&tfs_lsa_external_type
), 0x80, NULL
, HFILL
}},
5402 { &hf_ospf_lsa_tos
, { "TOS", "ospf.lsa.tos", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5403 { &hf_ospf_lsa_external_tos
, { "TOS", "ospf.lsa.tos", FT_UINT8
, BASE_DEC
, NULL
, 0x7f, NULL
, HFILL
}},
5404 { &hf_ospf_v3_lsa_type
, { "Type", "ospf.v3.lsa.type", FT_UINT8
, BASE_DEC
, VALS(ospf_v3_lsa_type_vals
), 0, NULL
, HFILL
}},
5405 { &hf_ospf_metric
, { "Metric", "ospf.metric", FT_UINT32
, BASE_DEC
, NULL
, 0, NULL
, HFILL
}},
5406 { &hf_ospf_prefix_length
, { "PrefixLength", "ospf.prefix_length", FT_UINT8
, BASE_DEC
, NULL
, 0, NULL
, HFILL
}},
5407 { &hf_ospf_ls_mpls_pri
, { "Pri (or TE-Class)", "ospf.mpls.pri", FT_FLOAT
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5408 { &hf_ospf_ls_mpls_bc
, { "BC", "ospf.mpls.bc", FT_FLOAT
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5409 { &hf_ospf_mpls_minimum_lsp_bandwidth
, { "Minimum LSP bandwidth", "ospf.mpls.minimum_lsp_bandwidth", FT_FLOAT
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5410 { &hf_ospf_mpls_sonet_sdh
, { "SONET/SDH", "ospf.mpls.sonet.sdh", FT_BOOLEAN
, BASE_NONE
, TFS(&tfs_arbitrary_standard
), 0x0, NULL
, HFILL
}},
5411 { &hf_ospf_oif_signal_type
, { "Signal Type", "ospf.oif.signal_type", FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, VALS_EXT_PTR(&gmpls_sonet_signal_type_str_ext
), 0x0, NULL
, HFILL
}},
5412 { &hf_ospf_tlv_value
, { "TLV Value", "ospf.tlv_value", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5413 { &hf_ospf_oif_node_id
, { "Node ID", "ospf.oif.node_id", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5414 { &hf_ospf_pad_bytes
, { "Pad Bytes", "ospf.pad_bytes", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5415 { &hf_ospf_ls_metric
, { "Metric", "ospf.ls.metric", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5416 { &hf_ospf_v3_lsa_forwarding_address_ipv4
, { "Forwarding Address", "ospf.v3.lsa.forwarding_address.ipv4", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5417 { &hf_ospf_link_local_interface_address_ipv4
, { "Link-local Interface Address", "ospf.v3.lsa.link_local_interface_address.ipv4", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5418 { &hf_ospf_v3_lsa_num_prefixes
, { "# prefixes", "ospf.v3.lsa.num_prefixes", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
5419 { &hf_ospf_v3_address_prefix_ipv6
, { "Address Prefix", "ospf.v3.address_prefix.ipv6", FT_IPv6
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5420 { &hf_ospf_v3_address_prefix_ipv4
, { "Address Prefix", "ospf.v3.address_prefix.ipv4", FT_IPv4
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
5423 static int *ett
[] = {
5431 &ett_ospf_lsa_router_link
,
5434 &ett_ospf_lsa_mpls_bandwidth_sstlv
,
5435 &ett_ospf_lsa_mpls_base_label
,
5436 &ett_ospf_lsa_mpls_router
,
5437 &ett_ospf_lsa_mpls_link
,
5438 &ett_ospf_lsa_mpls_link_stlv
,
5439 &ett_ospf_lsa_mpls_link_stlv_admingrp
,
5440 &ett_ospf_lsa_opaque_ri
,
5442 &ett_ospf_elsa_pfx_tlv
,
5443 &ett_ospf_lsa_ri_tlv
,
5444 &ett_ospf_lsa_dh_tlv
,
5445 &ett_ospf_lsa_sa_tlv
,
5446 &ett_ospf_lsa_slr_tlv
,
5447 &ett_ospf_lsa_slr_stlv
,
5448 &ett_ospf_lsa_srms_tlv
,
5449 &ett_ospf_lsa_node_msd_tlv
,
5450 &ett_ospf_lsa_fad_tlv
,
5451 &ett_ospf_lsa_fad_stlv
,
5452 &ett_ospf_lsa_unknown_tlv
,
5454 &ett_ospf_lsa_elink
,
5455 &ett_ospf_lsa_elink_tlv
,
5456 &ett_ospf_lsa_elink_stlv
,
5457 &ett_ospf_lsa_epfx_tlv
,
5458 &ett_ospf_lsa_epfx_flags
,
5459 &ett_ospf_lsa_epfx_range_flags
,
5460 &ett_ospf_lsa_epfx_stlv
,
5461 &ett_ospf_lsa_pfxsid_flags
,
5462 &ett_ospf_lsa_adjsid_flags
,
5463 &ett_ospf_lsa_app_sabm_bits
,
5464 &ett_ospf_lsa_app_link_attrs_stlv
,
5465 &ett_ospf_lsa_unidir_link_flags
,
5466 &ett_ospf_lsa_oif_tna
,
5467 &ett_ospf_lsa_oif_tna_stlv
,
5468 &ett_ospf_lsa_grace_tlv
,
5470 &ett_ospf_v2_options
,
5471 &ett_ospf_ri_options
,
5472 &ett_ospf_v3_options
,
5474 &ett_ospf_lls_data_block
,
5476 &ett_ospf_lls_ext_options
,
5477 &ett_ospf_v3_router_interface
,
5478 &ett_ospf_v3_router_interface_entry
,
5479 &ett_ospf_v3_lls_ext_options_tlv
,
5480 &ett_ospf_v3_lls_ext_options
,
5481 &ett_ospf_v3_lls_state_tlv
,
5482 &ett_ospf_v3_lls_state_scs
,
5483 &ett_ospf_v3_lls_state_options
,
5484 &ett_ospf_v3_lls_drop_tlv
,
5485 &ett_ospf_v3_lls_relay_tlv
,
5486 &ett_ospf_v3_lls_relay_added
,
5487 &ett_ospf_v3_lls_relay_options
,
5488 &ett_ospf_v3_lls_willingness_tlv
,
5489 &ett_ospf_v3_lls_willingness
,
5490 &ett_ospf_v3_lls_rf_tlv
,
5491 &ett_ospf_v3_lls_fsf_tlv
,
5492 &ett_ospf_v2_router_lsa_flags
,
5493 &ett_ospf_v3_router_lsa_flags
,
5494 &ett_ospf_v3_as_external_flags
,
5495 &ett_ospf_v3_prefix_options
,
5497 &ett_ospf_mpls_bitmap
5500 static ei_register_info ei
[] = {
5501 { &ei_ospf_header_reserved
, { "ospf.reserved.not_zero", PI_PROTOCOL
, PI_WARN
, "incorrect, should be 0", EXPFILL
}},
5502 { &ei_ospf_lsa_bad_length
, { "ospf.lsa.invalid_length", PI_MALFORMED
, PI_ERROR
, "Invalid length", EXPFILL
}},
5503 { &ei_ospf_lsa_constraint_missing
, { "ospf.lsa.tos_missing", PI_MALFORMED
, PI_WARN
, "Blocks missing", EXPFILL
}},
5504 { &ei_ospf_lsa_bc_error
, { "ospf.lsa.bc_error", PI_PROTOCOL
, PI_WARN
, "BC error", EXPFILL
}},
5505 { &ei_ospf_lsa_unknown_type
, { "ospf.lsa.unknown_type", PI_PROTOCOL
, PI_WARN
, "Unknown LSA Type", EXPFILL
}},
5506 { &ei_ospf_unknown_link_subtype
, { "ospf.unknown_link_subtype", PI_PROTOCOL
, PI_WARN
, "Unknown Link sub-TLV", EXPFILL
}},
5507 { &ei_ospf_stlv_length_invalid
, { "ospf.stlv.invalid_length", PI_PROTOCOL
, PI_WARN
, "Invalid sub-TLV length", EXPFILL
}},
5510 expert_module_t
* expert_ospf
;
5512 proto_ospf
= proto_register_protocol("Open Shortest Path First",
5514 ospf_handle
= register_dissector("ospf", dissect_ospf
, proto_ospf
);
5515 ospf_cap_handle
= register_capture_dissector("ospf", capture_ospf
, proto_ospf
);
5516 proto_register_field_array(proto_ospf
, ospff_info
, array_length(ospff_info
));
5517 proto_register_subtree_array(ett
, array_length(ett
));
5518 expert_ospf
= expert_register_protocol(proto_ospf
);
5519 expert_register_field_array(expert_ospf
, ei
, array_length(ei
));
5523 proto_reg_handoff_ospf(void)
5525 dissector_add_uint("ip.proto", IP_PROTO_OSPF
, ospf_handle
);
5526 capture_dissector_add_uint("ip.proto", IP_PROTO_OSPF
, ospf_cap_handle
);
5535 * indent-tabs-mode: nil
5538 * ex: set shiftwidth=4 tabstop=8 expandtab:
5539 * :indentSize=4:tabSize=8:noTabs=true: