/src/wireshark/epan/dissectors/packet-ospf.c
Line | Count | Source |
1 | | /* packet-ospf.c |
2 | | * Routines for OSPF packet disassembly |
3 | | * (c) Copyright Hannes R. Boehm <hannes@boehm.org> |
4 | | * |
5 | | * Wireshark - Network traffic analyzer |
6 | | * By Gerald Combs <gerald@wireshark.org> |
7 | | * Copyright 1998 Gerald Combs |
8 | | * |
9 | | * SPDX-License-Identifier: GPL-2.0-or-later |
10 | | */ |
11 | | /* |
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> |
18 | | * |
19 | | * Added support to E-NNI routing (OIF2003.259.02) |
20 | | * - (c) 2004 Roberto Morro <roberto.morro[AT]tilab.com> |
21 | | * |
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> |
27 | | * |
28 | | * Added support of MPLS Diffserv-aware TE (RFC 4124); new BC sub-TLV |
29 | | * - (c) 2006 (FF) <francesco.fondelli[AT]gmail.com> |
30 | | * |
31 | | * Added support for decoding the TLVs in a grace-LSA |
32 | | * - (c) 2007 Todd J Martin <todd.martin@acm.org> |
33 | | * |
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 |
37 | | * |
38 | | * Added support for Multi-Topology (MT) Routing (RFC4915) |
39 | | * - (c) 2009 Stig Bjorlykke <stig@bjorlykke.org>, Thales Norway AS |
40 | | * |
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 |
44 | | * |
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 |
47 | | * |
48 | | * Added support for Authentication Trailer for OSPFv3 (RFC6506) |
49 | | * - (c) 2014 Alexis La Goutte (See AUTHORS) |
50 | | * |
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> |
55 | | * |
56 | | * Added support for OSPFv3 Link State Advertisement Extensibility (RFC 8362) |
57 | | * - (c) 2024 Jacob Lodge |
58 | | */ |
59 | | |
60 | | #include "config.h" |
61 | | |
62 | | #include <epan/packet.h> |
63 | | #include <epan/tfs.h> |
64 | | #include <epan/capture_dissectors.h> |
65 | | #include <epan/in_cksum.h> |
66 | | #include <epan/expert.h> |
67 | | #include <epan/addr_resolv.h> |
68 | | #include <epan/unit_strings.h> |
69 | | #include <epan/iana-info.h> |
70 | | |
71 | | #include <wsutil/ws_roundup.h> |
72 | | #include <wsutil/ws_padding_to.h> |
73 | | |
74 | | #include "packet-rsvp.h" |
75 | | |
76 | | void proto_register_ospf(void); |
77 | | void proto_reg_handoff_ospf(void); |
78 | | |
79 | | static dissector_handle_t ospf_handle; |
80 | | static capture_dissector_handle_t ospf_cap_handle; |
81 | | |
82 | | /* Preferences */ |
83 | | static bool ospf_v3_expect_at = false; |
84 | | |
85 | 33.9k | #define OSPF_VERSION_2 2 |
86 | 9.52k | #define OSPF_VERSION_3 3 |
87 | 187 | #define OSPF_AF_4 4 |
88 | 10.2k | #define OSPF_AF_6 6 |
89 | 2.95k | #define OSPF_VERSION_2_HEADER_LENGTH 24 |
90 | 2.02k | #define OSPF_VERSION_3_HEADER_LENGTH 16 |
91 | | |
92 | | |
93 | 29.8k | #define OSPF_HELLO 1 |
94 | 1.04k | #define OSPF_DB_DESC 2 |
95 | 83 | #define OSPF_LS_REQ 3 |
96 | 3.96k | #define OSPF_LS_UPD 4 |
97 | 10.1k | #define OSPF_LS_ACK 5 |
98 | 9.83k | #define OSPF_LS_BASE OSPF_HELLO |
99 | | |
100 | | static const value_string pt_vals[] = { |
101 | | {OSPF_HELLO, "Hello Packet" }, |
102 | | {OSPF_DB_DESC, "DB Description" }, |
103 | | {OSPF_LS_REQ, "LS Request" }, |
104 | | {OSPF_LS_UPD, "LS Update" }, |
105 | | {OSPF_LS_ACK, "LS Acknowledge" }, |
106 | | {0, NULL } |
107 | | }; |
108 | | |
109 | | static const value_string ospf_at_authentication_type_vals[] = { |
110 | | {0, "Reserved" }, |
111 | | {1, "HMAC Cryptographic Authentication" }, |
112 | | {0, NULL } |
113 | | }; |
114 | | |
115 | 742 | #define OSPF_AUTH_NONE 0 |
116 | 100 | #define OSPF_AUTH_SIMPLE 1 |
117 | 252 | #define OSPF_AUTH_CRYPT 2 |
118 | | |
119 | | static const value_string auth_vals[] = { |
120 | | {OSPF_AUTH_NONE, "Null" }, |
121 | | {OSPF_AUTH_SIMPLE, "Simple password" }, |
122 | | {OSPF_AUTH_CRYPT, "Cryptographic" }, |
123 | | {0, NULL } |
124 | | }; |
125 | | |
126 | 6.39k | #define OSPF_V2_OPTIONS_MT 0x01 |
127 | 16 | #define OSPF_V2_OPTIONS_E 0x02 |
128 | 16 | #define OSPF_V2_OPTIONS_MC 0x04 |
129 | 32 | #define OSPF_V2_OPTIONS_NP 0x08 |
130 | 89 | #define OSPF_V2_OPTIONS_L 0x10 |
131 | 16 | #define OSPF_V2_OPTIONS_DC 0x20 |
132 | 16 | #define OSPF_V2_OPTIONS_O 0x40 |
133 | 16 | #define OSPF_V2_OPTIONS_DN 0x80 |
134 | 16 | #define OSPF_V3_OPTIONS_V6 0x000001 |
135 | 16 | #define OSPF_V3_OPTIONS_E 0x000002 |
136 | 16 | #define OSPF_V3_OPTIONS_MC 0x000004 |
137 | 16 | #define OSPF_V3_OPTIONS_N 0x000008 |
138 | 16 | #define OSPF_V3_OPTIONS_R 0x000010 |
139 | 16 | #define OSPF_V3_OPTIONS_DC 0x000020 |
140 | 16 | #define OSPF_V3_OPTIONS_AF 0x000100 |
141 | 400 | #define OSPF_V3_OPTIONS_L 0x000200 |
142 | 115 | #define OSPF_V3_OPTIONS_AT 0x000400 |
143 | | |
144 | | /* Bitmask definitions for the informational capabilities bits. */ |
145 | 16 | #define OSPF_RI_OPTIONS_GRC 0x80 |
146 | 16 | #define OSPF_RI_OPTIONS_GRH 0x40 |
147 | 16 | #define OSPF_RI_OPTIONS_SRS 0x20 |
148 | 16 | #define OSPF_RI_OPTIONS_TES 0x10 |
149 | 16 | #define OSPF_RI_OPTIONS_P2PLAN 0x08 |
150 | 16 | #define OSPF_RI_OPTIONS_ETE 0x04 |
151 | 16 | #define OSPF_RI_OPTIONS_HOST 0x01 |
152 | | |
153 | 16 | #define OSPF_LLS_EXT_OPTIONS_LR 0x00000001 |
154 | 16 | #define OSPF_LLS_EXT_OPTIONS_RS 0x00000002 |
155 | | |
156 | 16 | #define OSPF_V3_LLS_EXT_OPTIONS_LR 0x00000001 |
157 | 16 | #define OSPF_V3_LLS_EXT_OPTIONS_RS 0x00000002 |
158 | | |
159 | 16 | #define OSPF_V3_LLS_STATE_OPTIONS_R 0x80 |
160 | 16 | #define OSPF_V3_LLS_STATE_OPTIONS_A 0x40 |
161 | 16 | #define OSPF_V3_LLS_STATE_OPTIONS_N 0x20 |
162 | 16 | #define OSPF_V3_LLS_RELAY_OPTIONS_A 0x80 |
163 | 16 | #define OSPF_V3_LLS_RELAY_OPTIONS_N 0x40 |
164 | | |
165 | 16 | #define OSPF_DBD_FLAG_MS 1 |
166 | 16 | #define OSPF_DBD_FLAG_M 2 |
167 | 16 | #define OSPF_DBD_FLAG_I 4 |
168 | 16 | #define OSPF_DBD_FLAG_R 8 |
169 | | |
170 | 320 | #define OSPF_LS_REQ_LENGTH 12 |
171 | | |
172 | 24.2k | #define OSPF_LSTYPE_ROUTER 1 |
173 | 131 | #define OSPF_LSTYPE_NETWORK 2 |
174 | 175 | #define OSPF_LSTYPE_SUMMARY 3 |
175 | 263 | #define OSPF_LSTYPE_ASBR 4 |
176 | 53 | #define OSPF_LSTYPE_ASEXT 5 |
177 | | #define OSPF_LSTYPE_GRPMEMBER 6 |
178 | 160 | #define OSPF_LSTYPE_ASEXT7 7 |
179 | 10.9k | #define OSPF_LSTYPE_EXTATTR 8 |
180 | 1.77k | #define OSPF_LSTYPE_BASE OSPF_LSTYPE_ROUTER |
181 | 144 | #define OSPF_V3_LSTYPE_ROUTER 1 |
182 | 264 | #define OSPF_V3_LSTYPE_NETWORK 2 |
183 | 284 | #define OSPF_V3_LSTYPE_INTER_AREA_PREFIX 3 |
184 | 162 | #define OSPF_V3_LSTYPE_INTER_AREA_ROUTER 4 |
185 | 438 | #define OSPF_V3_LSTYPE_AS_EXTERNAL 5 |
186 | | #define OSPF_V3_LSTYPE_GROUP_MEMBERSHIP 6 |
187 | 126 | #define OSPF_V3_LSTYPE_NSSA 7 |
188 | 228 | #define OSPF_V3_LSTYPE_LINK 8 |
189 | 110 | #define OSPF_V3_LSTYPE_INTRA_AREA_PREFIX 9 |
190 | | #define OSPF_V3_LSTYPE_INTRA_AREA_TE 10 |
191 | 208 | #define OSPF_V3_LSTYPE_GRACE 11 |
192 | 649 | #define OSPF_V3_LSTYPE_OPAQUE_RI 12 |
193 | | #define OSPF_V3_LSTYPE_INTER_AS_TE_V3 13 |
194 | | #define OSPF_V3_LSTYPE_OSPF_V3_L1VPN 14 |
195 | | #define OSPF_V3_LSTYPE_OSPF_V3_AC 15 |
196 | | #define OSPF_V3_LSTYPE_OSPF_V3_DF 16 |
197 | | |
198 | | /* OSPFv3 E-LSA*/ |
199 | 79 | #define OSPF_V3_LSTYPE_E_ROUTER 33 |
200 | 161 | #define OSPF_V3_LSTYPE_E_NETWORK 34 |
201 | | #define OSPF_V3_LSTYPE_E_INTER_AREA_PREFIX 35 |
202 | | #define OSPF_V3_LSTYPE_E_INTER_AREA_ROUTER 36 |
203 | 239 | #define OSPF_V3_LSTYPE_E_AS_EXTERNAL 37 |
204 | | // Not to be used per RFC 8362 38 |
205 | | #define OSPF_V3_LSTYPE_E_TYPE_7 39 |
206 | 66 | #define OSPF_V3_LSTYPE_E_LINK 40 |
207 | 35 | #define OSPF_V3_LSTYPE_E_INTRA_AREA_PREFIX 41 |
208 | | |
209 | | #define OSPF_V3_LSTYPE_SRV6_LOCATOR 42 |
210 | | |
211 | | /* Opaque LSA types */ |
212 | 8.79k | #define OSPF_LSTYPE_OP_BASE 8 |
213 | 32.2k | #define OSPF_LSTYPE_OP_LINKLOCAL 9 |
214 | 2.73k | #define OSPF_LSTYPE_OP_AREALOCAL 10 |
215 | 23.8k | #define OSPF_LSTYPE_OP_ASWIDE 11 |
216 | | |
217 | 15.4k | #define OSPF_V3_LSA_FUNCTION_CODE_ROUTER 1 |
218 | | #define OSPF_V3_LSA_FUNCTION_CODE_NETWORK 2 |
219 | | #define OSPF_V3_LSA_FUNCTION_CODE_INTER_AREA_PREFIX 3 |
220 | | #define OSPF_V3_LSA_FUNCTION_CODE_INTER_AREA_ROUTER 4 |
221 | | #define OSPF_V3_LSA_FUNCTION_CODE_AS_EXTERNAL 5 |
222 | | #define OSPF_V3_LSA_FUNCTION_CODE_GROUP_MEMBERSHIP 6 |
223 | | #define OSPF_V3_LSA_FUNCTION_CODE_NSSA 7 |
224 | | #define OSPF_V3_LSA_FUNCTION_CODE_LINK 8 |
225 | 5.88k | #define OSPF_V3_LSA_FUNCTION_CODE_INTRA_AREA_PREFIX 9 |
226 | 3.42k | #define OSPF_V3_LSA_FUNCTION_CODE_BASE OSPF_V3_LSA_FUNCTION_CODE_ROUTER |
227 | 2.60k | #define OSPF_V3_LSA_FUNCTION_CODE_OPAQUE_RI 12 |
228 | 1.33k | #define OSPF_V3_LSA_FUNCTION_CODE_OPAQUE_RI_BASE 9 |
229 | | |
230 | | #define OSPF_LINK_PTP 1 |
231 | | #define OSPF_LINK_TRANSIT 2 |
232 | | #define OSPF_LINK_STUB 3 |
233 | | #define OSPF_LINK_VIRTUAL 4 |
234 | | |
235 | | #define OSPF_V3_LINK_PTP 1 |
236 | | #define OSPF_V3_LINK_TRANSIT 2 |
237 | | #define OSPF_V3_LINK_RESERVED 3 |
238 | | #define OSPF_V3_LINK_VIRTUAL 4 |
239 | | |
240 | 28.2k | #define OSPF_LSA_HEADER_LENGTH 20 |
241 | | |
242 | 48 | #define OSPF_DNA_LSA 0x8000 |
243 | | /* Opaque Link-State Advertisements (LSA) Option Types |
244 | | * https://www.iana.org/assignments/ospf-opaque-types/ospf-opaque-types.xhtml */ |
245 | 2.61k | #define OSPF_LSA_MPLS_TE 1 |
246 | | #define OSPF_LSA_SYCAMORE 2 |
247 | 371 | #define OSPF_LSA_GRACE 3 |
248 | 266 | #define OSPF_LSA_OPAQUE_RI 4 |
249 | | #define OSPF_LSA_L1VPN 5 |
250 | | #define OSPF_LSA_IAS_TE_V2 6 |
251 | 449 | #define OSPF_LSA_EXT_PREFIX 7 |
252 | 1.31k | #define OSPF_LSA_EXT_LINK 8 |
253 | | #define OSPF_LSA_TTZ 9 |
254 | | #define OSPF_LSA_DYN_FLOODING 10 |
255 | 565 | #define OSPF_LSA_EXT_IA_ASBR 11 |
256 | | #define OSPF_RESTART_REASON_UNKNOWN 0 |
257 | | #define OSPF_RESTART_REASON_SWRESTART 1 |
258 | | #define OSPF_RESTART_REASON_SWRELOAD 2 |
259 | | #define OSPF_RESTART_REASON_SWITCH 3 |
260 | | |
261 | | static const value_string restart_reason_vals[] = { |
262 | | {OSPF_RESTART_REASON_UNKNOWN, "Unknown" }, |
263 | | {OSPF_RESTART_REASON_SWRESTART, "Software Restart" }, |
264 | | {OSPF_RESTART_REASON_SWRELOAD, "Software Reload/Upgrade" }, |
265 | | {OSPF_RESTART_REASON_SWITCH, "Processor Switchover" }, |
266 | | {0, NULL} |
267 | | }; |
268 | | |
269 | | /* grace-LSA TLV Types */ |
270 | 3.46k | #define GRACE_TLV_PERIOD 1 |
271 | 2.89k | #define GRACE_TLV_REASON 2 |
272 | 5.39k | #define GRACE_TLV_IP 3 |
273 | | |
274 | | static const value_string grace_tlv_type_vals[] = { |
275 | | {GRACE_TLV_PERIOD, "Grace-LSA Grace Period" }, |
276 | | {GRACE_TLV_REASON, "Grace-LSA Restart Reason" }, |
277 | | {GRACE_TLV_IP, "Grace-LSA Restart IP" }, |
278 | | {0, NULL } |
279 | | }; |
280 | | |
281 | | /* http://www.iana.org/assignments/ospf-parameters/ospf-parameters.xhtml#ri-tlv */ |
282 | | |
283 | | /* Opaque-LSA - Router Informational Capabilities: TLV Types*/ |
284 | 265 | #define OPAQUE_TLV_RI 1 |
285 | | #define OPAQUE_TLV_RF 2 |
286 | | #define OPAQUE_TLV_TMG_IP4 3 |
287 | | #define OPAQUE_TLV_TMG_IP6 4 |
288 | | #define OPAQUE_TLV_TNCD 5 |
289 | | #define OPAQUE_TLV_PCED 6 |
290 | 195 | #define OPAQUE_TLV_DH 7 |
291 | 304 | #define OPAQUE_TLV_SA 8 |
292 | 514 | #define OPAQUE_TLV_SLR 9 |
293 | | #define OPAQUE_TLV_NAT 10 |
294 | | #define OPAQUE_TLV_SBD 11 |
295 | 286 | #define OPAQUE_TLV_NODE_MSD 12 |
296 | | #define OPAQUE_TLV_TUNN_ENCAPS 13 |
297 | 928 | #define OPAQUE_TLV_SRLB 14 |
298 | 316 | #define OPAQUE_TLV_SRMS_PREF 15 |
299 | 445 | #define OPAQUE_TLV_FLEX_ALGO_DEF 16 |
300 | | #define OPAQUE_TLV_OSPF_AREA_LEADER 17 |
301 | | #define OPAQUE_TLV_OSPF_DYN_FLOOD 18 |
302 | | #define OPAQUE_TLV_SRV6_CAPS 20 |
303 | | #define OPAQUE_TLV_IP_ALGO 21 |
304 | | |
305 | | /* The Opaque RI LSA TLV types definitions. */ |
306 | | static const value_string ri_tlv_type_vals[] = { |
307 | | {OPAQUE_TLV_RI, "Router Informational Capabilities" }, |
308 | | {OPAQUE_TLV_RF, "Router Functional Capabilities" }, |
309 | | {OPAQUE_TLV_TMG_IP4, "TE-MESH-GROUP TLV (IPv4)" }, |
310 | | {OPAQUE_TLV_TMG_IP6, "TE-MESH-GROUP TLV (IPv6)" }, |
311 | | {OPAQUE_TLV_TNCD, "TE Node Capability Descriptor" }, |
312 | | {OPAQUE_TLV_PCED, "PCED" }, |
313 | | {OPAQUE_TLV_DH, "OSPF Dynamic Hostname" }, |
314 | | {OPAQUE_TLV_SA, "SR-Algorithm " }, |
315 | | {OPAQUE_TLV_SLR, "SID/Label Range" }, |
316 | | {OPAQUE_TLV_NAT, "Node Admin Tag " }, |
317 | | {OPAQUE_TLV_SBD, "S-BFD Discriminator" }, |
318 | | {OPAQUE_TLV_NODE_MSD, "Node MSD" }, |
319 | | {OPAQUE_TLV_TUNN_ENCAPS, "Tunnel Encapsulations" }, |
320 | | {OPAQUE_TLV_SRLB, "SR Local Block" }, |
321 | | {OPAQUE_TLV_SRMS_PREF, "SRMS Preference" }, |
322 | | {OPAQUE_TLV_FLEX_ALGO_DEF, "Flexible Algorithm Definition" }, |
323 | | {OPAQUE_TLV_OSPF_AREA_LEADER, "OSPF Area Leader" }, |
324 | | {OPAQUE_TLV_OSPF_DYN_FLOOD, "OSPF Dynamic Flooding" }, |
325 | | {OPAQUE_TLV_SRV6_CAPS, "SRv6 Capabilities" }, |
326 | | {OPAQUE_TLV_IP_ALGO, "IP Algorithm" }, |
327 | | {0, NULL} |
328 | | }; |
329 | | |
330 | | static const value_string ri_lsa_sa_tlv_type_vals[] = { |
331 | | {0, "Shortest Path First" }, |
332 | | {1, "Strict Shortest Path First" }, |
333 | | {0, NULL} |
334 | | }; |
335 | | |
336 | | /* https://www.iana.org/assignments/ospfv3-parameters/ospfv3-parameters.xhtml#extended-lsa-tlvs */ |
337 | | |
338 | | /* OSPFv3 Extended-LSA TLVS (RFC 8362)*/ |
339 | | #define OSPF6_TLV_RESERVED 0 |
340 | 205 | #define OSPF6_TLV_ROUTER_LINK 1 |
341 | 212 | #define OSPF6_TLV_ATTACHED_ROUTERS 2 |
342 | | #define OSPF6_TLV_INTER_AREA_PREFIX 3 |
343 | | #define OSPF6_TLV_INTER_AREA_ROUTER 4 |
344 | 527 | #define OSPF6_TLV_EXTERNAL_PREFIX 5 |
345 | 482 | #define OSPF6_TLV_INTRA_AREA_PREFIX 6 |
346 | 194 | #define OSPF6_TLV_IPV6_LL_ADDR 7 |
347 | | #define OSPF6_TLV_IPV4_LL_ADDR 8 |
348 | | |
349 | | static const value_string ospf6_extended_lsa_tlv_type_vals[] = { |
350 | | {OSPF6_TLV_ROUTER_LINK, "Router-Link TLV"}, |
351 | | {OSPF6_TLV_ATTACHED_ROUTERS, "Attached-Routers TLV"}, |
352 | | {OSPF6_TLV_INTER_AREA_PREFIX, "Inter-Area-Prefix TLV"}, |
353 | | {OSPF6_TLV_INTER_AREA_ROUTER, "Inter-Area-Router TLV"}, |
354 | | {OSPF6_TLV_EXTERNAL_PREFIX, "External-Prefix TLV"}, |
355 | | {OSPF6_TLV_INTRA_AREA_PREFIX, "Intra-Area-Prefix TLV"}, |
356 | | {OSPF6_TLV_IPV6_LL_ADDR, "IPv6 Link-Local Address TLV"}, |
357 | | {OSPF6_TLV_IPV4_LL_ADDR, "IPv4 Link-Local Address TLV"}, |
358 | | { 0, NULL } |
359 | | |
360 | | }; |
361 | | |
362 | | /* OSPFv3 Extended-LSA Sub-TLVs */ |
363 | | #define OSPF6_STLV_RESERVED 0 |
364 | | #define OSPF6_STLV_IPV6_FWD_ADDR 1 |
365 | | #define OSPF6_STLV_IPV4_FWD_ADDR 2 |
366 | | |
367 | | /* IGP MSD Type (rfc8491) */ |
368 | | #define IGP_MSD_TYPE_RESERVED 0 |
369 | | #define IGP_MSD_TYPE_MPLS 1 |
370 | | #define IGP_MSD_TYPE_SEGMENT_LEFT 41 |
371 | | #define IGP_MSD_TYPE_END_POP 42 |
372 | | #define IGP_MSD_TYPE_T_INSERT 43 |
373 | | #define IGP_MSD_TYPE_T_ENCAP 44 |
374 | | #define IGP_MSD_TYPE_END_D 45 |
375 | | |
376 | | static const value_string ospf_igp_msd_types[] = { |
377 | | { IGP_MSD_TYPE_RESERVED, "Reserved" }, |
378 | | { IGP_MSD_TYPE_MPLS, "Base MPLS Imposition" }, |
379 | | { IGP_MSD_TYPE_SEGMENT_LEFT, "Maximum Segments Left" }, |
380 | | { IGP_MSD_TYPE_END_POP, "Maximum End Pop" }, |
381 | | { IGP_MSD_TYPE_T_INSERT, "Maximum T.Insert" }, |
382 | | { IGP_MSD_TYPE_T_ENCAP, "Maximum T.Encaps" }, |
383 | | { IGP_MSD_TYPE_END_D, "Maximum End D" }, |
384 | | { 0, NULL } |
385 | | }; |
386 | | |
387 | | static const value_string ri_lsa_fad_metric_type_vals[] = { |
388 | | {0, "IGP Metric" }, |
389 | | {1, "Min Unidirectional Link Delay" }, |
390 | | {2, "Traffic Engineering Metric" }, |
391 | | {0, NULL} |
392 | | }; |
393 | | |
394 | | /* Flex Algo Definition Sub-TLV (rfc9350) */ |
395 | 337 | #define FAD_EXCLUDE_AG 1 |
396 | 606 | #define FAD_INCLUDE_ANY_AG 2 |
397 | 812 | #define FAD_INCLUDE_ALL_AG 3 |
398 | 309 | #define FAD_DEF_FLAGS 4 |
399 | 437 | #define FAD_EXCLUDE_SRLG 5 |
400 | | |
401 | | static const value_string ri_lsa_fad_stlv_type_vals[] = { |
402 | | { FAD_EXCLUDE_AG, "Flexible Algorithm Exclude Admin Group"}, |
403 | | { FAD_INCLUDE_ANY_AG, "Flexible Algorithm Include-Any Admin Group"}, |
404 | | { FAD_INCLUDE_ALL_AG, "Flexible Algorithm Include-All Admin Group"}, |
405 | | { FAD_DEF_FLAGS, "Flexible Algorithm Definition Flags"}, |
406 | | { FAD_EXCLUDE_SRLG, "Flexible Algorithm Exclude SRLG"}, |
407 | | { 0, NULL } |
408 | | }; |
409 | | |
410 | | /* Flex Algo Definition Flags (rfc9350) */ |
411 | 16 | #define FAD_DEF_FLAGS_M 0x80000000 |
412 | | |
413 | | /* Flex Algo Prefix Metric Flags (rfc9350) */ |
414 | 16 | #define FAPM_FLAGS_E 0x80 |
415 | | |
416 | | static const value_string ls_type_vals[] = { |
417 | | {OSPF_LSTYPE_ROUTER, "Router-LSA" }, |
418 | | {OSPF_LSTYPE_NETWORK, "Network-LSA" }, |
419 | | {OSPF_LSTYPE_SUMMARY, "Summary-LSA (IP network)" }, |
420 | | {OSPF_LSTYPE_ASBR, "Summary-LSA (ASBR)" }, |
421 | | {OSPF_LSTYPE_ASEXT, "AS-External-LSA (ASBR)" }, |
422 | | {OSPF_LSTYPE_GRPMEMBER, "Group Membership LSA" }, |
423 | | {OSPF_LSTYPE_ASEXT7, "NSSA AS-External-LSA" }, |
424 | | {OSPF_LSTYPE_EXTATTR, "External Attributes LSA" }, |
425 | | {OSPF_LSTYPE_OP_LINKLOCAL, "Opaque LSA, Link-local scope" }, |
426 | | {OSPF_LSTYPE_OP_AREALOCAL, "Opaque LSA, Area-local scope" }, |
427 | | {OSPF_LSTYPE_OP_ASWIDE, "Opaque LSA, AS-local scope" }, |
428 | | {0, NULL } |
429 | | |
430 | | }; |
431 | | |
432 | | static const value_string ls_opaque_type_vals[] = { |
433 | | {OSPF_LSA_MPLS_TE, "Traffic Engineering LSA" }, |
434 | | {OSPF_LSA_SYCAMORE, "Sycamore Optical Topology Descriptions" }, |
435 | | {OSPF_LSA_GRACE, "Grace-LSA" }, |
436 | | {OSPF_LSA_OPAQUE_RI, "Router Information (RI)" }, |
437 | | {OSPF_LSA_L1VPN, "L1VPN LSA" }, |
438 | | {OSPF_LSA_IAS_TE_V2, "Inter-AS-TE-v2 LSA" }, |
439 | | {OSPF_LSA_EXT_PREFIX, "OSPFv2 Extended Prefix Opaque LSA" }, |
440 | | {OSPF_LSA_EXT_LINK, "OSPFv2 Extended Link Opaque LSA" }, |
441 | | {OSPF_LSA_TTZ, "TTZ LSA" }, |
442 | | {OSPF_LSA_DYN_FLOODING, "OSPFv2 Dynamic Flooding Opaque LSA" }, |
443 | | {OSPF_LSA_EXT_IA_ASBR, "OSPFv2 Extended Inter-Area ASBR LSA" }, |
444 | | {0, NULL } |
445 | | }; |
446 | | |
447 | | static const value_string v3_ls_type_vals[] = { |
448 | | {OSPF_V3_LSTYPE_ROUTER, "Router-LSA" }, |
449 | | {OSPF_V3_LSTYPE_NETWORK, "Network-LSA" }, |
450 | | {OSPF_V3_LSTYPE_INTER_AREA_PREFIX, "Inter-Area-Prefix-LSA" }, |
451 | | {OSPF_V3_LSTYPE_INTER_AREA_ROUTER, "Inter-Area-Router-LSA" }, |
452 | | {OSPF_V3_LSTYPE_AS_EXTERNAL, "AS-External-LSA" }, |
453 | | {OSPF_V3_LSTYPE_GROUP_MEMBERSHIP, "Group-Membership-LSA" }, |
454 | | {OSPF_V3_LSTYPE_NSSA, "NSSA-LSA" }, |
455 | | {OSPF_V3_LSTYPE_LINK, "Link-LSA" }, |
456 | | {OSPF_V3_LSTYPE_INTRA_AREA_PREFIX, "Intra-Area-Prefix-LSA" }, |
457 | | {OSPF_V3_LSTYPE_INTRA_AREA_TE, "Intra-Area-TE-LSA" }, |
458 | | {OSPF_V3_LSTYPE_GRACE, "GRACE-LSA" }, |
459 | | {OSPF_V3_LSTYPE_OPAQUE_RI, "Router Information Opaque-LSA"}, |
460 | | {OSPF_V3_LSTYPE_INTER_AS_TE_V3, "Inter-AS-TE-V3 LSA" }, |
461 | | {OSPF_V3_LSTYPE_OSPF_V3_L1VPN, "OSPFv3 L1VPN LSA" }, |
462 | | {OSPF_V3_LSTYPE_OSPF_V3_AC, "OSPFv3 Autoconfiguration LSA" }, |
463 | | {OSPF_V3_LSTYPE_OSPF_V3_DF, "OSPFv3 Dynamic Flooding LSA" }, |
464 | | {OSPF_V3_LSTYPE_E_ROUTER, "E-Router-LSA" }, |
465 | | {OSPF_V3_LSTYPE_E_NETWORK, "E-Network-LSA" }, |
466 | | {OSPF_V3_LSTYPE_E_INTER_AREA_PREFIX, "E-Inter-Area-Prefix-LSA" }, |
467 | | {OSPF_V3_LSTYPE_E_INTER_AREA_ROUTER, "E-Inter-Area-Router-LSA" }, |
468 | | {OSPF_V3_LSTYPE_E_AS_EXTERNAL, "E-AS-External-LSA" }, |
469 | | {OSPF_V3_LSTYPE_E_TYPE_7, "E-Type-7-LSA" }, |
470 | | {OSPF_V3_LSTYPE_E_LINK, "E-Link-LSA" }, |
471 | | {OSPF_V3_LSTYPE_E_INTRA_AREA_PREFIX, "E-Intra-Area-Prefix-LSA" }, |
472 | | {OSPF_V3_LSTYPE_SRV6_LOCATOR, "SRv6 Locator LSA" }, |
473 | | {0, NULL } |
474 | | }; |
475 | | |
476 | | static const value_string v3_ls_type_s12_vals[] = { |
477 | | {0, "Link-Local Scoping - Flooded only on originating link" }, |
478 | | {1, "Area Scoping - Flooded only in originating area" }, |
479 | | {2, "AS Scoping - Flooded throughout AS" }, |
480 | | {3, "Reserved" }, |
481 | | {0, NULL } |
482 | | }; |
483 | | |
484 | | static const true_false_string tfs_v3_ls_type_u = { |
485 | | "Treat the LSA as if it had link-local flooding scope", |
486 | | "Store and flood the LSA as if the type is understood" |
487 | | }; |
488 | | |
489 | | static const true_false_string tfs_lsa_external_type = { "Type 2 (metric is larger than any other link state path)", |
490 | | "Type 1 (metric is specified in the same units as interface cost)" }; |
491 | | |
492 | | static const value_string ospf_v3_lsa_type_vals[] = { |
493 | | {OSPF_V3_LINK_PTP, "Point-to-point connection to another router"}, |
494 | | {OSPF_V3_LINK_TRANSIT, "Connection to a transit network"}, |
495 | | {OSPF_LINK_STUB, "Connection to a stub network"}, |
496 | | {OSPF_V3_LINK_VIRTUAL, "Virtual link"}, |
497 | | {0, NULL}, |
498 | | }; |
499 | | |
500 | | static const value_string ospf_v3_lsa_type_short_vals[] = { |
501 | | {OSPF_V3_LINK_PTP, "PTP"}, |
502 | | {OSPF_V3_LINK_TRANSIT, "Transit"}, |
503 | | {OSPF_LINK_STUB, "Stub"}, |
504 | | {OSPF_V3_LINK_VIRTUAL, "Virtual"}, |
505 | | {0, NULL}, |
506 | | }; |
507 | | |
508 | | static const value_string ospf_v3_lsa_link_id_vals[] = { |
509 | | {OSPF_V3_LINK_PTP, "Neighboring router's Router ID"}, |
510 | | {OSPF_V3_LINK_TRANSIT, "IP address of Designated Router"}, |
511 | | {OSPF_LINK_STUB, "IP network/subnet number"}, |
512 | | {OSPF_V3_LINK_VIRTUAL, "Neighboring router's Router ID"}, |
513 | | {0, NULL}, |
514 | | }; |
515 | | |
516 | | /* OSPFv3 LLS TLV Types */ |
517 | 195 | #define LLS_V2_EXT_OPT 1 |
518 | 620 | #define LLS_V2_CRYPTO_OPT 2 |
519 | 194 | #define LLS_V2_LI_ID_OPT 18 |
520 | | |
521 | | static const value_string lls_tlv_type_vals[] = { |
522 | | {LLS_V2_EXT_OPT, "Extended options TLV" }, |
523 | | {LLS_V2_CRYPTO_OPT, "Crypto Authentication TLV" }, |
524 | | {LLS_V2_LI_ID_OPT, "Local Interface ID" }, |
525 | | {0, NULL } |
526 | | }; |
527 | | |
528 | | /* OSPFv3 LLS TLV Types */ |
529 | 618 | #define LLS_V3_EXT_OPT 1 |
530 | 666 | #define LLS_V3_STATE_CHECK 3 |
531 | 572 | #define LLS_V3_NBR_DROP 4 |
532 | 360 | #define LLS_V3_RELAYS 7 |
533 | 424 | #define LLS_V3_WILLING 8 |
534 | 626 | #define LLS_V3_RQST_FROM 5 |
535 | 574 | #define LLS_V3_FULL_STATE 6 |
536 | | |
537 | | static const value_string lls_v3_tlv_type_vals[] = { |
538 | | {LLS_V3_EXT_OPT, "Extended Options TLV" }, |
539 | | {LLS_V3_STATE_CHECK, "State Check Sequence TLV" }, |
540 | | {LLS_V3_NBR_DROP, "Neighbor Drop TLV" }, |
541 | | {LLS_V3_RELAYS, "Active Overlapping Relays TLV" }, |
542 | | {LLS_V3_WILLING, "Willingness TLV" }, |
543 | | {LLS_V3_RQST_FROM, "Request From LTV" }, |
544 | | {LLS_V3_FULL_STATE, "Full State For TLV" }, |
545 | | {0, NULL } |
546 | | }; |
547 | | |
548 | | static const value_string mpls_link_stlv_ltype_str[] = { |
549 | | {1, "Point-to-point"}, |
550 | | {2, "Multi-access"}, |
551 | | {0, NULL} |
552 | | }; |
553 | | |
554 | | /* FF: from www.iana.org/assignments/bandwidth-constraints-model-ids */ |
555 | | static const range_string mpls_link_stlv_bcmodel_rvals[] = { |
556 | | { 0, 0, "(Russian Dolls Model - RDM)" }, |
557 | | { 1, 1, "(Maximum Allocation Model - MAM)" }, |
558 | | { 2, 2, "(Maximum Allocation with Reservation Model - MAR)" }, |
559 | | { 3, 239, "(Unassigned, Specification Required)" }, |
560 | | { 240, 255, "(Reserved, Private Use)" }, |
561 | | { 0, 0, NULL } |
562 | | }; |
563 | | |
564 | | static const true_false_string tfs_arbitrary_standard = { "Arbitrary", "Standard" }; |
565 | | |
566 | 16 | #define OSPF_V2_ROUTER_LSA_FLAG_B 0x01 |
567 | 16 | #define OSPF_V2_ROUTER_LSA_FLAG_E 0x02 |
568 | 16 | #define OSPF_V2_ROUTER_LSA_FLAG_V 0x04 |
569 | 16 | #define OSPF_V2_ROUTER_LSA_FLAG_W 0x08 |
570 | 16 | #define OSPF_V2_ROUTER_LSA_FLAG_N 0x10 |
571 | 16 | #define OSPF_V2_ROUTER_LSA_FLAG_S 0x20 |
572 | 16 | #define OSPF_V2_ROUTER_LSA_FLAG_H 0x80 |
573 | 16 | #define OSPF_V3_ROUTER_LSA_FLAG_B 0x01 |
574 | 16 | #define OSPF_V3_ROUTER_LSA_FLAG_E 0x02 |
575 | 16 | #define OSPF_V3_ROUTER_LSA_FLAG_V 0x04 |
576 | 16 | #define OSPF_V3_ROUTER_LSA_FLAG_W 0x08 |
577 | | |
578 | 16 | #define OSPF_V3_PREFIX_OPTION_NU 0x01 |
579 | 16 | #define OSPF_V3_PREFIX_OPTION_LA 0x02 |
580 | 16 | #define OSPF_V3_PREFIX_OPTION_MC 0x04 |
581 | 16 | #define OSPF_V3_PREFIX_OPTION_P 0x08 |
582 | | |
583 | 177 | #define OSPF_V3_AS_EXTERNAL_FLAG_T 0x01 |
584 | 242 | #define OSPF_V3_AS_EXTERNAL_FLAG_F 0x02 |
585 | 16 | #define OSPF_V3_AS_EXTERNAL_FLAG_E 0x04 |
586 | | |
587 | | /* OSPFv2 Extended Prefix LSA TLV types definitions. (RFC7684) */ |
588 | | /* OSPF Extended Prefix TLV Registry */ |
589 | 4.09k | #define EXT_PREFIX_TLV_PREFIX 1 |
590 | 1.46k | #define EXT_PREFIX_TLV_PREFIX_RANGE 2 |
591 | | |
592 | | #define EXT_PREFIX_TLV_ROUTE_UNSPEC 0 |
593 | | #define EXT_PREFIX_TLV_ROUTE_INTRA 1 |
594 | | #define EXT_PREFIX_TLV_ROUTE_INTER 3 |
595 | | #define EXT_PREFIX_TLV_ROUTE_ASEXT 5 |
596 | | #define EXT_PREFIX_TLV_ROUTE_NSSAEXT 7 |
597 | | |
598 | | #define EXT_PREFIX_TLV_AF_IPV4_UNI 0 |
599 | | |
600 | 32 | #define EXT_PREFIX_TLV_FLAG_A 0x80 |
601 | 32 | #define EXT_PREFIX_TLV_FLAG_N 0x40 |
602 | 16 | #define EXT_PREFIX_TLV_FLAG_UNKNOWN ~(EXT_PREFIX_TLV_FLAG_A | EXT_PREFIX_TLV_FLAG_N) |
603 | | |
604 | 32 | #define EXT_PREFIX_RANGE_TLV_FLAG_IA 0x80 |
605 | 16 | #define EXT_PREFIX_RANGE_TLV_FLAG_UNKNOWN ~(EXT_PREFIX_RANGE_TLV_FLAG_IA) |
606 | | |
607 | | static const value_string ext_pfx_tlv_type_vals[] = { |
608 | | {EXT_PREFIX_TLV_PREFIX, "OSPFv2 Extended Prefix" }, |
609 | | {EXT_PREFIX_TLV_PREFIX_RANGE, "OSPFv2 Extended Prefix Range" }, |
610 | | {0, NULL} |
611 | | }; |
612 | | static const value_string ext_pfx_tlv_route_vals[] = { |
613 | | {EXT_PREFIX_TLV_ROUTE_UNSPEC, "Unspecified" }, |
614 | | {EXT_PREFIX_TLV_ROUTE_INTRA, "Intra-Area" }, |
615 | | {EXT_PREFIX_TLV_ROUTE_INTER, "Inter-Area" }, |
616 | | {EXT_PREFIX_TLV_ROUTE_ASEXT, "AS-External" }, |
617 | | {EXT_PREFIX_TLV_ROUTE_NSSAEXT, "NSSA-External" }, |
618 | | {0, NULL} |
619 | | }; |
620 | | static const value_string ext_pfx_tlv_af_vals[] = { |
621 | | {EXT_PREFIX_TLV_AF_IPV4_UNI, "IPv4 Unicast" }, |
622 | | {0, NULL} |
623 | | }; |
624 | | |
625 | | /* OSPF Extended Prefix Sub-TLV Registry */ |
626 | 349 | #define SR_STLV_SID_LABEL 1 |
627 | 938 | #define SR_STLV_PREFIX_SID 2 |
628 | 567 | #define SR_STLV_FLEX_ALGO_PREFIX_METRIC 3 |
629 | | |
630 | 32 | #define SR_STLV_PFXSID_FLAG_NP 0x40 |
631 | 32 | #define SR_STLV_PFXSID_FLAG_M 0x20 |
632 | 32 | #define SR_STLV_PFXSID_FLAG_E 0x10 |
633 | 32 | #define SR_STLV_PFXSID_FLAG_V 0x08 |
634 | 32 | #define SR_STLV_PFXSID_FLAG_L 0x04 |
635 | 16 | #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) |
636 | | |
637 | | static const value_string ext_pfx_stlv_type_vals[] = { |
638 | | {SR_STLV_SID_LABEL, "SID/Label" }, |
639 | | {SR_STLV_PREFIX_SID, "Prefix SID" }, |
640 | | {SR_STLV_FLEX_ALGO_PREFIX_METRIC, "Flexible Algorithm Prefix Metric" }, |
641 | | {0, NULL} |
642 | | }; |
643 | | |
644 | | /* OSPFv2 Extended Link LSA TLV types definitions. (RFC7684) */ |
645 | | /* OSPF Extended Link TLV Registry */ |
646 | 1.45k | #define EXT_LINK_TLV_LINK 1 |
647 | | |
648 | | static const value_string ext_link_tlv_type_vals[] = { |
649 | | {EXT_LINK_TLV_LINK, "OSPFv2 Extended Link" }, |
650 | | {0, NULL} |
651 | | }; |
652 | | |
653 | | /* OSPF Extended Link Sub-TLV Registry */ |
654 | 875 | #define SR_STLV_ADJSID 2 |
655 | 973 | #define SR_STLV_LAN_ADJSID 3 |
656 | 460 | #define SR_STLV_LINK_MSD 6 |
657 | | #define SR_STLV_GRACEFUL_LINK_SHUTDOWN 7 |
658 | 545 | #define SR_STLV_REMOTE_IPV4_ADDRESS 8 |
659 | 290 | #define SR_STLV_LOCAL_REMOTE_INTERFACE_ID 9 |
660 | 13.8k | #define SR_STLV_APP_SPEC_LINK_ATTR 10 |
661 | 622 | #define SR_STLV_SRLG 11 |
662 | 2.91k | #define SR_STLV_UNIDIR_LINK_DELAY 12 |
663 | 261k | #define SR_STLV_UNIDIR_LINK_DELAY_MIN_MAX 13 |
664 | 18.1k | #define SR_STLV_UNIDIR_DELAY_VARIATION 14 |
665 | 435 | #define SR_STLV_ADMIN_GROUP 19 |
666 | 649 | #define SR_STLV_EXT_ADMIN_GROUP 20 |
667 | 500 | #define SR_STLV_TE_METRIC 22 |
668 | | |
669 | 32 | #define SR_STLV_ADJSID_FLAG_B 0x80 |
670 | 32 | #define SR_STLV_ADJSID_FLAG_V 0x40 |
671 | 32 | #define SR_STLV_ADJSID_FLAG_L 0x20 |
672 | 32 | #define SR_STLV_ADJSID_FLAG_G 0x10 |
673 | 32 | #define SR_STLV_ADJSID_FLAG_P 0x08 |
674 | 16 | #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) |
675 | | |
676 | | static const value_string ext_link_stlv_type_vals[] = { |
677 | | {SR_STLV_SID_LABEL, "SID/Label" }, |
678 | | {SR_STLV_ADJSID, "Adj-SID" }, |
679 | | {SR_STLV_LAN_ADJSID, "LAN Adj-SID" }, |
680 | | {SR_STLV_LINK_MSD, "Link MSD" }, |
681 | | {SR_STLV_GRACEFUL_LINK_SHUTDOWN, "Graceful Link Shutdown" }, |
682 | | {SR_STLV_REMOTE_IPV4_ADDRESS, "Remote IPv4 Address" }, |
683 | | {SR_STLV_LOCAL_REMOTE_INTERFACE_ID, "Local/Remote Interface ID" }, |
684 | | {SR_STLV_APP_SPEC_LINK_ATTR, "Application-Specific Link Attributes"}, |
685 | | {SR_STLV_SRLG, "Shared Risk Link Group" }, |
686 | | {SR_STLV_UNIDIR_LINK_DELAY, "Unidirectional Link Delay" }, |
687 | | {SR_STLV_UNIDIR_LINK_DELAY_MIN_MAX, "Min/Max Unidirectional Link Delay"}, |
688 | | {SR_STLV_UNIDIR_DELAY_VARIATION, "Unidirectional Delay Variation"}, |
689 | | {SR_STLV_ADMIN_GROUP, "Administrative Group" }, |
690 | | {SR_STLV_EXT_ADMIN_GROUP, "Extended Administrative Group"}, |
691 | | {SR_STLV_TE_METRIC, "TE Metric" }, |
692 | | {0, NULL} |
693 | | }; |
694 | | |
695 | | /* OSPFv2 Extended Inter-Area ASBR LSA TLV types definitions. (RFC9350) */ |
696 | | /* OSPFv2 Extended Inter-Area ASBR TLV Registry */ |
697 | 442 | #define EXT_IA_ASBR_TLV_EIA_ASBR 1 |
698 | | |
699 | | static const value_string ext_ia_asbr_tlv_type_vals[] = { |
700 | | {EXT_IA_ASBR_TLV_EIA_ASBR, "OSPFv2 Extended Inter-Area ASBR" }, |
701 | | {0, NULL} |
702 | | }; |
703 | | |
704 | | /* OSPFv2 Extended Inter-Area ASBR Sub-TLVs Registry */ |
705 | 363 | #define SR_STLV_FLEX_ALGO_ASBR_METRIC 1 |
706 | | |
707 | | static const value_string ext_ia_asbr_stlv_type_vals[] = { |
708 | | {SR_STLV_FLEX_ALGO_ASBR_METRIC, "Flexible Algorithm ASBR Metric" }, |
709 | | {0, NULL} |
710 | | }; |
711 | | |
712 | | static int proto_ospf; |
713 | | |
714 | | static int ett_ospf; |
715 | | static int ett_ospf_at; |
716 | | static int ett_ospf_hdr; |
717 | | static int ett_ospf_hello; |
718 | | static int ett_ospf_desc; |
719 | | static int ett_ospf_lsr; |
720 | | static int ett_ospf_lsa; |
721 | | static int ett_ospf_elsa; |
722 | | static int ett_ospf_elsa_pfx_tlv; |
723 | | static int ett_ospf_lsa_router_link; |
724 | | static int ett_ospf_lsa_upd; |
725 | | static int ett_ospf_v2_options; |
726 | | static int ett_ospf_ri_options; |
727 | | static int ett_ospf_v3_options; |
728 | | static int ett_ospf_dbd; |
729 | | static int ett_ospf_lls_data_block; |
730 | | static int ett_ospf_lls_tlv; |
731 | | static int ett_ospf_lls_ext_options; |
732 | | static int ett_ospf_v3_lls_ext_options_tlv; |
733 | | static int ett_ospf_v3_lls_ext_options; |
734 | | static int ett_ospf_v3_lls_state_tlv; |
735 | | static int ett_ospf_v3_lls_state_scs; |
736 | | static int ett_ospf_v3_lls_state_options; |
737 | | static int ett_ospf_v3_lls_drop_tlv; |
738 | | static int ett_ospf_v3_lls_relay_tlv; |
739 | | static int ett_ospf_v3_lls_relay_added; |
740 | | static int ett_ospf_v3_lls_relay_options; |
741 | | static int ett_ospf_v3_lls_willingness_tlv; |
742 | | static int ett_ospf_v3_lls_willingness; |
743 | | static int ett_ospf_v3_lls_rf_tlv; |
744 | | static int ett_ospf_v3_lls_fsf_tlv; |
745 | | static int ett_ospf_v2_router_lsa_flags; |
746 | | static int ett_ospf_v3_router_lsa_flags; |
747 | | static int ett_ospf_v3_as_external_flags; |
748 | | static int ett_ospf_v3_prefix_options; |
749 | | static int ett_ospf_v3_router_interface; |
750 | | static int ett_ospf_v3_router_interface_entry; |
751 | | static int ett_ospf_mpls_pri; |
752 | | static int ett_ospf_mpls_bitmap; |
753 | | |
754 | | /* Trees for opaque LSAs */ |
755 | | static int ett_ospf_lsa_mpls; |
756 | | static int ett_ospf_lsa_mpls_bandwidth_sstlv; |
757 | | static int ett_ospf_lsa_mpls_base_label; |
758 | | static int ett_ospf_lsa_mpls_router; |
759 | | static int ett_ospf_lsa_mpls_link; |
760 | | static int ett_ospf_lsa_mpls_link_stlv; |
761 | | static int ett_ospf_lsa_mpls_link_stlv_admingrp; |
762 | | static int ett_ospf_lsa_oif_tna; |
763 | | static int ett_ospf_lsa_oif_tna_stlv; |
764 | | static int ett_ospf_lsa_grace_tlv; |
765 | | static int ett_ospf_lsa_opaque_ri; |
766 | | static int ett_ospf_lsa_ri_tlv; |
767 | | static int ett_ospf_lsa_dh_tlv; |
768 | | static int ett_ospf_lsa_sa_tlv; |
769 | | static int ett_ospf_lsa_slr_tlv; |
770 | | static int ett_ospf_lsa_slr_stlv; |
771 | | static int ett_ospf_lsa_srms_tlv; |
772 | | static int ett_ospf_lsa_node_msd_tlv; |
773 | | static int ett_ospf_lsa_fad_tlv; |
774 | | static int ett_ospf_lsa_fad_stlv; |
775 | | static int ett_ospf_lsa_fad_def_flags; |
776 | | static int ett_ospf_lsa_fapm_flags; |
777 | | static int ett_ospf_lsa_elink; |
778 | | static int ett_ospf_lsa_epfx; |
779 | | static int ett_ospf_lsa_elink_tlv; |
780 | | static int ett_ospf_lsa_elink_stlv; |
781 | | static int ett_ospf_lsa_epfx_tlv; |
782 | | static int ett_ospf_lsa_epfx_flags; |
783 | | static int ett_ospf_lsa_epfx_stlv; |
784 | | static int ett_ospf_lsa_epfx_range_flags; |
785 | | static int ett_ospf_lsa_pfxsid_flags; |
786 | | static int ett_ospf_lsa_adjsid_flags; |
787 | | static int ett_ospf_lsa_app_sabm_bits; |
788 | | static int ett_ospf_lsa_app_link_attrs_stlv; |
789 | | static int ett_ospf_lsa_unidir_link_flags; |
790 | | static int ett_ospf_lsa_eia_asbr; |
791 | | static int ett_ospf_lsa_eia_asbr_tlv; |
792 | | static int ett_ospf_lsa_eia_asbr_stlv; |
793 | | static int ett_ospf_lsa_unknown_tlv; |
794 | | |
795 | | static int ett_ospf_lsa_type; |
796 | | |
797 | | |
798 | | /* The Options field in the first TLV of the Opaque RI LSA with type field set to "4" for OSPFv2 |
799 | | and type field set to "12" in OSPFv3, is interpreted as advertizing optional router capabilties. |
800 | | (RFC4970) */ |
801 | | static const true_false_string tfs_v3_as_external_flags_e = { |
802 | | "Type 2", |
803 | | "Type 1" |
804 | | }; |
805 | | |
806 | | /*----------------------------------------------------------------------- |
807 | | * OSPF Filtering |
808 | | *-----------------------------------------------------------------------*/ |
809 | | |
810 | | /* OSPF MSG Type */ |
811 | | static int hf_ospf_msg_hello; |
812 | | static int hf_ospf_msg_db_desc; |
813 | | static int hf_ospf_msg_ls_req; |
814 | | static int hf_ospf_msg_ls_upd; |
815 | | static int hf_ospf_msg_ls_ack; |
816 | | |
817 | | static int *hf_ospf_msg_type_array[] = { |
818 | | &hf_ospf_msg_hello, |
819 | | &hf_ospf_msg_db_desc, |
820 | | &hf_ospf_msg_ls_req, |
821 | | &hf_ospf_msg_ls_upd, |
822 | | &hf_ospf_msg_ls_ack, |
823 | | }; |
824 | | |
825 | | static int hf_ospf_ls_type; |
826 | | static int hf_ospf_ls_age; |
827 | | static int hf_ospf_ls_donotage; |
828 | | static int hf_ospf_ls_id; |
829 | | static int hf_ospf_ls_seqnum; |
830 | | static int hf_ospf_ls_chksum; |
831 | | static int hf_ospf_ls_length; |
832 | | static int hf_ospf_ls_opaque_type; |
833 | | static int hf_ospf_ls_mpls_te_instance; |
834 | | |
835 | | /* OSPF V2 LSA Type */ |
836 | | static int hf_ospf_ls_router; |
837 | | static int hf_ospf_ls_router_linktype; |
838 | | static int hf_ospf_ls_router_linkid; |
839 | | static int hf_ospf_ls_router_linkdata; |
840 | | static int hf_ospf_ls_router_nummetrics; |
841 | | static int hf_ospf_ls_router_metric0; |
842 | | static int hf_ospf_ls_network; |
843 | | static int hf_ospf_ls_network_netmask; |
844 | | static int hf_ospf_ls_network_attachrtr; |
845 | | static int hf_ospf_ls_summary; |
846 | | static int hf_ospf_ls_asbr; |
847 | | static int hf_ospf_ls_asbr_netmask; |
848 | | static int hf_ospf_ls_asext; |
849 | | static int hf_ospf_ls_asext_netmask; |
850 | | static int hf_ospf_ls_asext_fwdaddr; |
851 | | static int hf_ospf_ls_asext_extrtrtag; |
852 | | static int hf_ospf_ls_grpmember; |
853 | | static int hf_ospf_ls_asext7; |
854 | | static int hf_ospf_ls_extattr; |
855 | | static int hf_ospf_ls_opaque; |
856 | | |
857 | | static int *hf_ospf_ls_type_array[] = { |
858 | | &hf_ospf_ls_router, |
859 | | &hf_ospf_ls_network, |
860 | | &hf_ospf_ls_summary, |
861 | | &hf_ospf_ls_asbr, |
862 | | &hf_ospf_ls_asext, |
863 | | &hf_ospf_ls_grpmember, |
864 | | &hf_ospf_ls_asext7, |
865 | | &hf_ospf_ls_extattr, |
866 | | &hf_ospf_ls_opaque |
867 | | }; |
868 | | |
869 | | static int hf_ospf_v3_ls_type; |
870 | | static int hf_ospf_v3_ls_type_u; |
871 | | static int hf_ospf_v3_ls_type_s12; |
872 | | static int hf_ospf_v3_ls_type_fc; |
873 | | |
874 | | /* OSPF V3 LSA Type */ |
875 | | static int hf_ospf_v3_ls_router; |
876 | | static int hf_ospf_v3_ls_network; |
877 | | static int hf_ospf_v3_ls_inter_area_prefix; |
878 | | static int hf_ospf_v3_ls_inter_area_router; |
879 | | static int hf_ospf_v3_ls_as_external; |
880 | | static int hf_ospf_v3_ls_group_membership; |
881 | | static int hf_ospf_v3_ls_nssa; |
882 | | static int hf_ospf_v3_ls_link; |
883 | | static int hf_ospf_v3_ls_intra_area_prefix; |
884 | | static int hf_ospf_v3_ls_opaque_ri; |
885 | | |
886 | | static int hf_ospf_v3_elsa_intra_area_prefix; |
887 | | |
888 | | static int *hf_ospf_v3_ls_type_array[] = { |
889 | | &hf_ospf_v3_ls_router, |
890 | | &hf_ospf_v3_ls_network, |
891 | | &hf_ospf_v3_ls_inter_area_prefix, |
892 | | &hf_ospf_v3_ls_inter_area_router, |
893 | | &hf_ospf_v3_ls_as_external, |
894 | | &hf_ospf_v3_ls_group_membership, |
895 | | &hf_ospf_v3_ls_nssa, |
896 | | &hf_ospf_v3_ls_link, |
897 | | &hf_ospf_v3_ls_intra_area_prefix, |
898 | | &hf_ospf_v3_ls_opaque_ri, |
899 | | &hf_ospf_v3_elsa_intra_area_prefix |
900 | | }; |
901 | | |
902 | | static int hf_ospf_adv_router; |
903 | | static int hf_ospf_ls_mpls; |
904 | | static int hf_ospf_ls_mpls_routerid; |
905 | | static int hf_ospf_ls_mpls_linktype; |
906 | | static int hf_ospf_ls_mpls_linkid; |
907 | | static int hf_ospf_ls_mpls_local_addr; |
908 | | static int hf_ospf_ls_mpls_remote_addr; |
909 | | static int hf_ospf_ls_mpls_local_ifid; |
910 | | static int hf_ospf_ls_mpls_remote_ifid; |
911 | | static int hf_ospf_ls_mpls_te_metric; |
912 | | static int hf_ospf_ls_mpls_linkcolor; |
913 | | static int hf_ospf_ls_mpls_group; |
914 | | static int hf_ospf_ls_mpls_link_max_bw; |
915 | | static int hf_ospf_ls_mpls_bc_model_id; |
916 | | static int hf_ospf_ls_oif_local_node_id; |
917 | | static int hf_ospf_ls_oif_remote_node_id; |
918 | | static int hf_ospf_v2_options; |
919 | | static int hf_ospf_v2_options_mt; |
920 | | static int hf_ospf_v2_options_e; |
921 | | static int hf_ospf_v2_options_mc; |
922 | | static int hf_ospf_v2_options_n; |
923 | | static int hf_ospf_v2_options_p; |
924 | | static int hf_ospf_v2_options_l; |
925 | | static int hf_ospf_v2_options_dc; |
926 | | static int hf_ospf_v2_options_o; |
927 | | static int hf_ospf_v2_options_dn; |
928 | | |
929 | | static int hf_ospf_tlv_type_opaque; |
930 | | |
931 | | static int hf_ospf_ri_options; |
932 | | /* OSPF Router Informational Capabilities Options */ |
933 | | static int hf_ospf_ri_options_grc; |
934 | | static int hf_ospf_ri_options_grh; |
935 | | static int hf_ospf_ri_options_srs; |
936 | | static int hf_ospf_ri_options_tes; |
937 | | static int hf_ospf_ri_options_p2plan; |
938 | | static int hf_ospf_ri_options_ete; |
939 | | static int hf_ospf_ri_options_host; |
940 | | |
941 | | /* OSPF Extended Link Opaque LSA */ |
942 | | static int hf_ospf_ls_elink_tlv; |
943 | | static int hf_ospf_ls_elink_stlv; |
944 | | static int hf_ospf_ls_elink_mt_id; |
945 | | static int hf_ospf_ls_elink_weight; |
946 | | static int hf_ospf_ls_elink_nbr; |
947 | | static int hf_ospf_ls_pfxsid_flags; |
948 | | static int hf_ospf_ls_pfxsid_flag_np; |
949 | | static int hf_ospf_ls_pfxsid_flag_m; |
950 | | static int hf_ospf_ls_pfxsid_flag_e; |
951 | | static int hf_ospf_ls_pfxsid_flag_v; |
952 | | static int hf_ospf_ls_pfxsid_flag_l; |
953 | | static int hf_ospf_ls_pfxsid_flag_unknown; |
954 | | static int hf_ospf_ls_adjsid_flags; |
955 | | static int hf_ospf_ls_adjsid_flag_b; |
956 | | static int hf_ospf_ls_adjsid_flag_v; |
957 | | static int hf_ospf_ls_adjsid_flag_l; |
958 | | static int hf_ospf_ls_adjsid_flag_g; |
959 | | static int hf_ospf_ls_adjsid_flag_p; |
960 | | static int hf_ospf_ls_adjsid_flag_unknown; |
961 | | static int hf_ospf_ls_app_sabm_length; |
962 | | static int hf_ospf_ls_app_udabm_length; |
963 | | static int hf_ospf_ls_app_sabm_bits; |
964 | | static int hf_ospf_ls_app_sabm_bits_r; |
965 | | static int hf_ospf_ls_app_sabm_bits_s; |
966 | | static int hf_ospf_ls_app_sabm_bits_f; |
967 | | static int hf_ospf_ls_app_sabm_bits_x; |
968 | | static int hf_ospf_ls_app_udabm_bits; |
969 | | static int hf_ospf_ls_app_link_attrs_stlv; |
970 | | static int hf_ospf_ls_srlg; |
971 | | static int hf_ospf_ls_admin_group; |
972 | | static int hf_ospf_ls_ext_admin_group; |
973 | | static int hf_ospf_ls_unidir_link_flags; |
974 | | static int hf_ospf_ls_unidir_link_flags_a; |
975 | | static int hf_ospf_ls_unidir_link_flags_reserved; |
976 | | static int hf_ospf_ls_unidir_link_delay; |
977 | | static int hf_ospf_ls_unidir_link_reserved; |
978 | | static int hf_ospf_ls_unidir_link_delay_min; |
979 | | static int hf_ospf_ls_unidir_link_delay_max; |
980 | | static int hf_ospf_ls_unidir_delay_variation; |
981 | | |
982 | | /* OSPF Extended Prefix Opaque LSA */ |
983 | | static int hf_ospf_ls_epfx_tlv; |
984 | | static int hf_ospf_ls_epfx_stlv; |
985 | | static int hf_ospf_ls_epfx_route_type; |
986 | | static int hf_ospf_ls_epfx_af; |
987 | | static int hf_ospf_ls_epfx_flags; |
988 | | static int hf_ospf_ls_epfx_flag_a; |
989 | | static int hf_ospf_ls_epfx_flag_n; |
990 | | static int hf_ospf_ls_epfx_flag_unknown; |
991 | | static int hf_ospf_ls_epfx_range_flags; |
992 | | static int hf_ospf_ls_epfx_range_flag_ia; |
993 | | static int hf_ospf_ls_epfx_range_flag_unknown; |
994 | | |
995 | | /* OSPF Extended Inter-Area ASBR LSA */ |
996 | | static int hf_ospf_ls_eia_asbr_tlv; |
997 | | static int hf_ospf_ls_eia_asbr_stlv; |
998 | | static int hf_ospf_ls_eia_asbr_asbr_routerid; |
999 | | static int hf_ospf_ls_faam_reserved; |
1000 | | static int hf_ospf_ls_faam_metric; |
1001 | | |
1002 | | /* OSPF Dynamic Hostname support (RFC5642) */ |
1003 | | static int hf_ospf_v3_options; |
1004 | | static int hf_ospf_v3_options_v6; |
1005 | | static int hf_ospf_v3_options_e; |
1006 | | static int hf_ospf_v3_options_mc; |
1007 | | static int hf_ospf_v3_options_n; |
1008 | | static int hf_ospf_v3_options_r; |
1009 | | static int hf_ospf_v3_options_dc; |
1010 | | static int hf_ospf_v3_options_af; |
1011 | | static int hf_ospf_v3_options_l; |
1012 | | static int hf_ospf_v3_options_at; |
1013 | | static int hf_ospf_dbd; |
1014 | | static int hf_ospf_dbd_r; |
1015 | | static int hf_ospf_dbd_i; |
1016 | | static int hf_ospf_dbd_m; |
1017 | | static int hf_ospf_dbd_ms; |
1018 | | static int hf_ospf_lls_ext_options; |
1019 | | static int hf_ospf_lls_ext_options_lr; |
1020 | | static int hf_ospf_lls_ext_options_rs; |
1021 | | static int hf_ospf_v2_router_lsa_flag; |
1022 | | static int hf_ospf_v2_router_lsa_flag_b; |
1023 | | static int hf_ospf_v2_router_lsa_flag_e; |
1024 | | static int hf_ospf_v2_router_lsa_flag_v; |
1025 | | static int hf_ospf_v2_router_lsa_flag_w; |
1026 | | static int hf_ospf_v2_router_lsa_flag_n; |
1027 | | static int hf_ospf_v2_router_lsa_flag_s; |
1028 | | static int hf_ospf_v2_router_lsa_flag_h; |
1029 | | static int hf_ospf_v3_router_lsa_flag; |
1030 | | static int hf_ospf_v3_router_lsa_flag_b; |
1031 | | static int hf_ospf_v3_router_lsa_flag_e; |
1032 | | static int hf_ospf_v3_router_lsa_flag_v; |
1033 | | static int hf_ospf_v3_router_lsa_flag_w; |
1034 | | static int hf_ospf_v3_as_external_flag; |
1035 | | static int hf_ospf_v3_as_external_flag_t; |
1036 | | static int hf_ospf_v3_as_external_flag_f; |
1037 | | static int hf_ospf_v3_as_external_flag_e; |
1038 | | static int hf_ospf_v3_prefix_option; |
1039 | | static int hf_ospf_v3_prefix_option_nu; |
1040 | | static int hf_ospf_v3_prefix_option_la; |
1041 | | static int hf_ospf_v3_prefix_option_mc; |
1042 | | static int hf_ospf_v3_prefix_option_p; |
1043 | | static int hf_ospf_dyn_hostname; |
1044 | | static int hf_ospf_lsa_sa; |
1045 | | static int hf_ospf_ls_slr_stlv; |
1046 | | static int hf_ospf_ls_range_size; |
1047 | | static int hf_ospf_ls_sid_label; |
1048 | | static int hf_ospf_ls_preference; |
1049 | | static int hf_ospf_ls_igp_msd_type; |
1050 | | static int hf_ospf_ls_igp_msd_value; |
1051 | | static int hf_ospf_ls_remote_ipv4_addr; |
1052 | | static int hf_ospf_ls_local_interface_id; |
1053 | | static int hf_ospf_ls_remote_interface_id; |
1054 | | static int hf_ospf_ls_flex_algorithm; |
1055 | | static int hf_ospf_ls_fad_metric_type; |
1056 | | static int hf_ospf_ls_fad_calc_type; |
1057 | | static int hf_ospf_ls_fad_priority; |
1058 | | static int hf_ospf_ls_fad_stlv; |
1059 | | static int hf_ospf_ls_fad_def_flags; |
1060 | | static int hf_ospf_ls_fad_def_flags_m; |
1061 | | static int hf_ospf_ls_fapm_flags; |
1062 | | static int hf_ospf_ls_fapm_flags_e; |
1063 | | static int hf_ospf_ls_fapm_metric; |
1064 | | static int hf_ospf_unknown_tlv; |
1065 | | static int hf_ospf_grace_tlv; |
1066 | | static int hf_ospf_grace_period; |
1067 | | static int hf_ospf_grace_reason; |
1068 | | static int hf_ospf_grace_ip; |
1069 | | static int hf_ospf_v3_lls_ext_options_tlv; |
1070 | | static int hf_ospf_v3_lls_ext_options; |
1071 | | static int hf_ospf_v3_lls_ext_options_lr; |
1072 | | static int hf_ospf_v3_lls_ext_options_rs; |
1073 | | static int hf_ospf_v3_lls_state_tlv; |
1074 | | static int hf_ospf_v3_lls_state_scs; |
1075 | | static int hf_ospf_v3_lls_state_options; |
1076 | | static int hf_ospf_v3_lls_state_options_r; |
1077 | | static int hf_ospf_v3_lls_state_options_a; |
1078 | | static int hf_ospf_v3_lls_state_options_n; |
1079 | | static int hf_ospf_v3_lls_drop_tlv; |
1080 | | static int hf_ospf_v3_lls_relay_tlv; |
1081 | | static int hf_ospf_v3_lls_relay_added; |
1082 | | static int hf_ospf_v3_lls_relay_options; |
1083 | | static int hf_ospf_v3_lls_relay_options_a; |
1084 | | static int hf_ospf_v3_lls_relay_options_n; |
1085 | | static int hf_ospf_v3_lls_willingness_tlv; |
1086 | | static int hf_ospf_v3_lls_willingness; |
1087 | | static int hf_ospf_v3_lls_rf_tlv; |
1088 | | static int hf_ospf_v3_lls_fsf_tlv; |
1089 | | |
1090 | | static int hf_ospf_header; |
1091 | | static int hf_ospf_header_version; |
1092 | | static int hf_ospf_header_msg_type; |
1093 | | static int hf_ospf_header_packet_length; |
1094 | | static int hf_ospf_header_src_router; |
1095 | | static int hf_ospf_header_area_id; |
1096 | | static int hf_ospf_header_checksum; |
1097 | | static int hf_ospf_tlv_type; |
1098 | | static int hf_ospf_tlv_length; |
1099 | | |
1100 | | |
1101 | | /* OSPF v3 Extended LSA TLV's RFC 8362*/ |
1102 | | static int hf_ospf_v3_e_lsa_tlv_type; |
1103 | | static int hf_ospf_v3_e_lsa_tlv_length; |
1104 | | |
1105 | | /* Header OSPF v2 auth + multi-instance */ |
1106 | | static int hf_ospf_header_instance_id; |
1107 | | static int hf_ospf_header_auth_type; |
1108 | | static int hf_ospf_header_auth_data_none; |
1109 | | static int hf_ospf_header_auth_data_simple; |
1110 | | static int hf_ospf_header_auth_crypt_key_id; |
1111 | | static int hf_ospf_header_auth_crypt_data_length; |
1112 | | static int hf_ospf_header_auth_crypt_seq_nbr; |
1113 | | static int hf_ospf_header_auth_crypt_data; |
1114 | | static int hf_ospf_header_auth_data_unknown; |
1115 | | |
1116 | | /* Header OSPF v3 */ |
1117 | | static int hf_ospf_v3_header_instance_id; |
1118 | | static int hf_ospf_header_reserved; |
1119 | | |
1120 | | /* Hello */ |
1121 | | static int hf_ospf_hello; |
1122 | | static int hf_ospf_hello_network_mask; |
1123 | | static int hf_ospf_hello_interface_id; |
1124 | | static int hf_ospf_hello_hello_interval; |
1125 | | static int hf_ospf_hello_router_priority; |
1126 | | static int hf_ospf_hello_router_dead_interval; |
1127 | | static int hf_ospf_hello_designated_router; |
1128 | | static int hf_ospf_hello_backup_designated_router; |
1129 | | static int hf_ospf_hello_active_neighbor; |
1130 | | |
1131 | | /* Authentication Trailer RFC6506 */ |
1132 | | static int hf_ospf_at; |
1133 | | static int hf_ospf_at_auth_type; |
1134 | | static int hf_ospf_at_auth_data_len; |
1135 | | static int hf_ospf_at_reserved; |
1136 | | static int hf_ospf_at_sa_id; |
1137 | | static int hf_ospf_at_crypto_seq_nbr; |
1138 | | static int hf_ospf_at_auth_data; |
1139 | | |
1140 | | /* Generated from convert_proto_tree_add_text.pl */ |
1141 | | static int hf_ospf_referenced_advertising_router; |
1142 | | static int hf_ospf_v3_lsa_referenced_link_state_id; |
1143 | | static int hf_ospf_mpls_protection_capability; |
1144 | | static int hf_ospf_oif_encoding; |
1145 | | static int hf_ospf_ls_id_te_lsa_reserved; |
1146 | | static int hf_ospf_db_interface_mtu; |
1147 | | static int hf_ospf_v3_lls_full_state_for; |
1148 | | static int hf_ospf_v3_lsa_interface_id; |
1149 | | static int hf_ospf_v3_lsa_router_priority; |
1150 | | static int hf_ospf_v3_lsa_forwarding_address_ipv6; |
1151 | | static int hf_ospf_v3_lls_dropped_neighbor; |
1152 | | static int hf_ospf_v3_lsa_external_route_tag; |
1153 | | static int hf_ospf_tna_addr; |
1154 | | static int hf_ospf_v3_lsa_neighbor_router_id; |
1155 | | static int hf_ospf_mpls_switching_type; |
1156 | | static int hf_ospf_oif_tna_addr_length; |
1157 | | static int hf_ospf_oif_tna_addr_ipv4; |
1158 | | static int hf_ospf_link_state_id; |
1159 | | static int hf_ospf_ls_id_opaque_id; |
1160 | | static int hf_ospf_v2_lls_sequence_number; |
1161 | | static int hf_ospf_v3_lsa_do_not_age; |
1162 | | static int hf_ospf_lls_data_length; |
1163 | | static int hf_ospf_mpls_shared_risk_link_group; |
1164 | | static int hf_ospf_db_dd_sequence; |
1165 | | static int hf_ospf_v3_lsa_destination_router_id; |
1166 | | static int hf_ospf_tna_addr_ipv6; |
1167 | | static int hf_ospf_v3_lsa_link_local_interface_address; |
1168 | | static int hf_ospf_mpls_interface_mtu; |
1169 | | static int hf_ospf_v3_lsa_neighbor_interface_id; |
1170 | | static int hf_ospf_lsa_number_of_links; |
1171 | | static int hf_ospf_v2_lls_auth_data; |
1172 | | static int hf_ospf_v2_lls_li_id; |
1173 | | static int hf_ospf_oif_switching_cap; |
1174 | | static int hf_ospf_ls_number_of_lsas; |
1175 | | static int hf_ospf_v3_lls_neighbor; |
1176 | | static int hf_ospf_v3_lls_request_from; |
1177 | | static int hf_ospf_lls_checksum; |
1178 | | static int hf_ospf_v3_lsa_attached_router; |
1179 | | static int hf_ospf_v3_lsa_referenced_ls_type; |
1180 | | static int hf_ospf_mpls_encoding; |
1181 | | static int hf_ospf_mpls_num_labels; |
1182 | | static int hf_ospf_lsa_external_type; |
1183 | | static int hf_ospf_lsa_tos; |
1184 | | static int hf_ospf_lsa_external_tos; |
1185 | | static int hf_ospf_v3_lsa_type; |
1186 | | static int hf_ospf_metric; |
1187 | | static int hf_ospf_prefix_length; |
1188 | | static int hf_ospf_ls_mpls_pri; |
1189 | | static int hf_ospf_ls_mpls_bc; |
1190 | | static int hf_ospf_mpls_action; |
1191 | | static int hf_ospf_mpls_bandwidth_type; |
1192 | | static int hf_ospf_mpls_bitmap; |
1193 | | static int hf_ospf_mpls_grid; |
1194 | | static int hf_ospf_mpls_cs2; |
1195 | | static int hf_ospf_mpls_n; |
1196 | | static int hf_ospf_mpls_cs; |
1197 | | static int hf_ospf_mpls_length; |
1198 | | static int hf_ospf_mpls_minimum_lsp_bandwidth; |
1199 | | static int hf_ospf_mpls_pri; |
1200 | | static int hf_ospf_mpls_sonet_sdh; |
1201 | | static int hf_ospf_mpls_starting; |
1202 | | static int hf_ospf_mpls_no_effective_bits; |
1203 | | static int hf_ospf_mpls_type; |
1204 | | static int hf_ospf_oif_signal_type; |
1205 | | static int hf_ospf_tlv_value; |
1206 | | static int hf_ospf_oif_node_id; |
1207 | | static int hf_ospf_pad_bytes; |
1208 | | static int hf_ospf_ls_metric; |
1209 | | static int hf_ospf_v3_lsa_forwarding_address_ipv4; |
1210 | | static int hf_ospf_link_local_interface_address_ipv4; |
1211 | | static int hf_ospf_v3_lsa_num_prefixes; |
1212 | | static int hf_ospf_v3_address_prefix_ipv6; |
1213 | | static int hf_ospf_v3_address_prefix_ipv4; |
1214 | | |
1215 | | static expert_field ei_ospf_header_reserved; |
1216 | | static expert_field ei_ospf_lsa_bad_length; |
1217 | | static expert_field ei_ospf_lsa_constraint_missing; |
1218 | | static expert_field ei_ospf_lsa_bc_error; |
1219 | | static expert_field ei_ospf_lsa_unknown_type; |
1220 | | static expert_field ei_ospf_unknown_link_subtype; |
1221 | | static expert_field ei_ospf_stlv_length_invalid; |
1222 | | |
1223 | | static int ospf_msg_type_to_filter (uint8_t msg_type) |
1224 | 9.94k | { |
1225 | 9.94k | if (msg_type >= OSPF_HELLO && |
1226 | 9.91k | msg_type <= OSPF_LS_ACK) |
1227 | 9.83k | return msg_type - OSPF_LS_BASE; |
1228 | 114 | return -1; |
1229 | 9.94k | } |
1230 | | |
1231 | | static int ospf_ls_type_to_filter (uint8_t ls_type) |
1232 | 11.1k | { |
1233 | 11.1k | if (ls_type >= OSPF_LSTYPE_ROUTER && |
1234 | 10.9k | ls_type <= OSPF_LSTYPE_EXTATTR) |
1235 | 1.77k | return ls_type - OSPF_LSTYPE_BASE; |
1236 | 9.40k | else if (ls_type >= OSPF_LSTYPE_OP_LINKLOCAL && |
1237 | 9.18k | ls_type <= OSPF_LSTYPE_OP_ASWIDE) |
1238 | 8.79k | return OSPF_LSTYPE_OP_BASE; |
1239 | 607 | else |
1240 | 607 | return -1; |
1241 | 11.1k | } |
1242 | | |
1243 | | static int ospf_v3_ls_type_to_filter (uint16_t ls_type) |
1244 | 6.03k | { |
1245 | 6.03k | uint16_t function_code; |
1246 | | |
1247 | 6.03k | function_code = ls_type & 0x1fff; |
1248 | 6.03k | if (function_code >= OSPF_V3_LSA_FUNCTION_CODE_ROUTER && |
1249 | 5.88k | function_code <= OSPF_V3_LSA_FUNCTION_CODE_INTRA_AREA_PREFIX) |
1250 | 3.42k | return function_code - OSPF_V3_LSA_FUNCTION_CODE_BASE; |
1251 | 2.60k | else if (function_code == OSPF_V3_LSA_FUNCTION_CODE_OPAQUE_RI) |
1252 | 1.33k | return OSPF_V3_LSA_FUNCTION_CODE_OPAQUE_RI_BASE; |
1253 | 1.27k | else |
1254 | 1.27k | return -1; |
1255 | 6.03k | } |
1256 | | |
1257 | | static int * const bf_dbd[] = { |
1258 | | &hf_ospf_dbd_r, |
1259 | | &hf_ospf_dbd_i, |
1260 | | &hf_ospf_dbd_m, |
1261 | | &hf_ospf_dbd_ms, |
1262 | | NULL |
1263 | | }; |
1264 | | static int * const bf_lls_ext_options[] = { |
1265 | | &hf_ospf_lls_ext_options_rs, |
1266 | | &hf_ospf_lls_ext_options_lr, |
1267 | | NULL |
1268 | | }; |
1269 | | static int * const bf_v3_lls_ext_options[] = { |
1270 | | &hf_ospf_v3_lls_ext_options_lr, |
1271 | | &hf_ospf_v3_lls_ext_options_rs, |
1272 | | NULL |
1273 | | }; |
1274 | | |
1275 | | static int * const bf_v3_lls_state_options[] = { |
1276 | | &hf_ospf_v3_lls_state_options_r, |
1277 | | &hf_ospf_v3_lls_state_options_a, |
1278 | | &hf_ospf_v3_lls_state_options_n, |
1279 | | NULL |
1280 | | }; |
1281 | | static int * const bf_v3_lls_relay_options[] = { |
1282 | | &hf_ospf_v3_lls_relay_options_a, |
1283 | | &hf_ospf_v3_lls_relay_options_n, |
1284 | | NULL |
1285 | | }; |
1286 | | static int * const bf_v2_router_lsa_flags[] = { |
1287 | | &hf_ospf_v2_router_lsa_flag_h, |
1288 | | &hf_ospf_v2_router_lsa_flag_s, |
1289 | | &hf_ospf_v2_router_lsa_flag_n, |
1290 | | &hf_ospf_v2_router_lsa_flag_w, |
1291 | | &hf_ospf_v2_router_lsa_flag_v, |
1292 | | &hf_ospf_v2_router_lsa_flag_e, |
1293 | | &hf_ospf_v2_router_lsa_flag_b, |
1294 | | NULL |
1295 | | }; |
1296 | | static int * const bf_v3_router_lsa_flags[] = { |
1297 | | &hf_ospf_v3_router_lsa_flag_w, |
1298 | | &hf_ospf_v3_router_lsa_flag_v, |
1299 | | &hf_ospf_v3_router_lsa_flag_e, |
1300 | | &hf_ospf_v3_router_lsa_flag_b, |
1301 | | NULL |
1302 | | }; |
1303 | | static int * const bf_v3_as_external_flags[] = { |
1304 | | &hf_ospf_v3_as_external_flag_e, |
1305 | | &hf_ospf_v3_as_external_flag_f, |
1306 | | &hf_ospf_v3_as_external_flag_t, |
1307 | | NULL |
1308 | | }; |
1309 | | static int * const bf_v2_options[] = { |
1310 | | &hf_ospf_v2_options_dn, |
1311 | | &hf_ospf_v2_options_o, |
1312 | | &hf_ospf_v2_options_dc, |
1313 | | &hf_ospf_v2_options_l, |
1314 | | &hf_ospf_v2_options_n, |
1315 | | &hf_ospf_v2_options_mc, |
1316 | | &hf_ospf_v2_options_e, |
1317 | | &hf_ospf_v2_options_mt, |
1318 | | NULL |
1319 | | }; |
1320 | | static int * const bf_v2_options_lsa7[] = { |
1321 | | &hf_ospf_v2_options_dn, |
1322 | | &hf_ospf_v2_options_o, |
1323 | | &hf_ospf_v2_options_dc, |
1324 | | &hf_ospf_v2_options_l, |
1325 | | &hf_ospf_v2_options_p, |
1326 | | &hf_ospf_v2_options_mc, |
1327 | | &hf_ospf_v2_options_e, |
1328 | | &hf_ospf_v2_options_mt, |
1329 | | NULL |
1330 | | }; |
1331 | | /* Structures for handling the bitfield of the Options field of Optional Router Capabilities LSA (RFC4970). */ |
1332 | | static int * const bf_ri_options[] = { |
1333 | | &hf_ospf_ri_options_grc, |
1334 | | &hf_ospf_ri_options_grh, |
1335 | | &hf_ospf_ri_options_srs, |
1336 | | &hf_ospf_ri_options_tes, |
1337 | | &hf_ospf_ri_options_p2plan, |
1338 | | &hf_ospf_ri_options_ete, |
1339 | | &hf_ospf_ri_options_host, |
1340 | | NULL |
1341 | | }; |
1342 | | static int * const bf_v3_options[] = { |
1343 | | &hf_ospf_v3_options_at, |
1344 | | &hf_ospf_v3_options_l, |
1345 | | &hf_ospf_v3_options_af, |
1346 | | &hf_ospf_v3_options_dc, |
1347 | | &hf_ospf_v3_options_r, |
1348 | | &hf_ospf_v3_options_n, |
1349 | | &hf_ospf_v3_options_mc, |
1350 | | &hf_ospf_v3_options_e, |
1351 | | &hf_ospf_v3_options_v6, |
1352 | | NULL |
1353 | | }; |
1354 | | static int * const bf_v3_prefix_options[] = { |
1355 | | &hf_ospf_v3_prefix_option_p, |
1356 | | &hf_ospf_v3_prefix_option_mc, |
1357 | | &hf_ospf_v3_prefix_option_la, |
1358 | | &hf_ospf_v3_prefix_option_nu, |
1359 | | NULL |
1360 | | }; |
1361 | | static int * const bf_ospf_epfx_flags[] = { |
1362 | | &hf_ospf_ls_epfx_flag_a, |
1363 | | &hf_ospf_ls_epfx_flag_n, |
1364 | | &hf_ospf_ls_epfx_flag_unknown, |
1365 | | NULL |
1366 | | }; |
1367 | | static int * const bf_ospf_epfx_range_flags[] = { |
1368 | | &hf_ospf_ls_epfx_range_flag_ia, |
1369 | | &hf_ospf_ls_epfx_range_flag_unknown, |
1370 | | NULL |
1371 | | }; |
1372 | | static int * const bf_ospf_pfxsid_flags[] = { |
1373 | | &hf_ospf_ls_pfxsid_flag_np, |
1374 | | &hf_ospf_ls_pfxsid_flag_m, |
1375 | | &hf_ospf_ls_pfxsid_flag_e, |
1376 | | &hf_ospf_ls_pfxsid_flag_v, |
1377 | | &hf_ospf_ls_pfxsid_flag_l, |
1378 | | &hf_ospf_ls_pfxsid_flag_unknown, |
1379 | | NULL |
1380 | | }; |
1381 | | static int * const bf_ospf_adjsid_flags[] = { |
1382 | | &hf_ospf_ls_adjsid_flag_b, |
1383 | | &hf_ospf_ls_adjsid_flag_v, |
1384 | | &hf_ospf_ls_adjsid_flag_l, |
1385 | | &hf_ospf_ls_adjsid_flag_g, |
1386 | | &hf_ospf_ls_adjsid_flag_p, |
1387 | | &hf_ospf_ls_adjsid_flag_unknown, |
1388 | | NULL |
1389 | | }; |
1390 | | static int * const bf_ospf_app_sabm_bits[] = { |
1391 | | &hf_ospf_ls_app_sabm_bits_r, |
1392 | | &hf_ospf_ls_app_sabm_bits_s, |
1393 | | &hf_ospf_ls_app_sabm_bits_f, |
1394 | | &hf_ospf_ls_app_sabm_bits_x, |
1395 | | NULL, |
1396 | | }; |
1397 | | static int * const unidir_link_flags[] = { |
1398 | | &hf_ospf_ls_unidir_link_flags_a, |
1399 | | &hf_ospf_ls_unidir_link_flags_reserved, |
1400 | | NULL, |
1401 | | }; |
1402 | | static int * const bf_ospf_fad_def_flags[] = { |
1403 | | &hf_ospf_ls_fad_def_flags_m, |
1404 | | NULL, |
1405 | | }; |
1406 | | static int * const bf_ospf_fapm_flags[] = { |
1407 | | &hf_ospf_ls_fapm_flags_e, |
1408 | | NULL, |
1409 | | }; |
1410 | | |
1411 | | static void dissect_ospf_hello(tvbuff_t*, int, proto_tree*, uint8_t, uint16_t); |
1412 | | static void dissect_ospf_db_desc(tvbuff_t*, packet_info*, int, proto_tree*, uint8_t, uint16_t, uint8_t); |
1413 | | static void dissect_ospf_ls_req(tvbuff_t*, packet_info*, int, proto_tree*, uint8_t, uint16_t); |
1414 | | static void dissect_ospf_ls_upd(tvbuff_t*, packet_info*, int, proto_tree*, uint8_t, uint16_t, uint8_t); |
1415 | | static void dissect_ospf_ls_ack(tvbuff_t*, packet_info*, int, proto_tree*, uint8_t, uint16_t, uint8_t); |
1416 | | static int dissect_ospf_authentication_trailer(tvbuff_t*, int, proto_tree*); |
1417 | | static int dissect_ospf_lls_data_block(tvbuff_t*, packet_info*, int, proto_tree*, uint8_t); |
1418 | | |
1419 | | /* dissect_ospf_v[23]lsa returns the offset of the next LSA |
1420 | | * if disassemble_body is set to false (e.g. in LSA ACK |
1421 | | * packets), the offset is set to the offset of the next |
1422 | | * LSA header |
1423 | | */ |
1424 | | static int dissect_ospf_v2_lsa(tvbuff_t*, packet_info*, int, proto_tree*, bool disassemble_body); |
1425 | | static int dissect_ospf_v3_lsa(tvbuff_t*, packet_info*, int, proto_tree*, bool disassemble_body, |
1426 | | uint8_t); |
1427 | | |
1428 | | static void dissect_ospf_v3_address_prefix(tvbuff_t *, packet_info *, int, int, proto_tree *, uint8_t); |
1429 | | |
1430 | | static int |
1431 | | ospf_has_lls_block(tvbuff_t *tvb, int offset, uint8_t packet_type, uint8_t version) |
1432 | 541 | { |
1433 | 541 | uint8_t flags; |
1434 | 541 | uint32_t v3flags; |
1435 | | |
1436 | | /* LLS block can be found only in HELLO and DBDESC packets */ |
1437 | 541 | switch (packet_type) { |
1438 | 16 | case OSPF_HELLO: |
1439 | 16 | switch (version) { |
1440 | 4 | case OSPF_VERSION_2: |
1441 | 4 | flags = tvb_get_uint8 (tvb, offset + 6); |
1442 | 4 | return flags & OSPF_V2_OPTIONS_L; |
1443 | 12 | case OSPF_VERSION_3: |
1444 | 12 | v3flags = tvb_get_ntohl(tvb, offset + 5); |
1445 | 12 | v3flags = v3flags >> 8; |
1446 | 12 | return v3flags & OSPF_V3_OPTIONS_L; |
1447 | 16 | } |
1448 | 0 | break; |
1449 | 441 | case OSPF_DB_DESC: |
1450 | 441 | switch (version) { |
1451 | 69 | case OSPF_VERSION_2: |
1452 | 69 | flags = tvb_get_uint8 (tvb, offset + 2); |
1453 | 69 | return flags & OSPF_V2_OPTIONS_L; |
1454 | 372 | case OSPF_VERSION_3: |
1455 | 372 | v3flags = tvb_get_ntohl(tvb, offset + 1); |
1456 | 372 | v3flags = v3flags >> 8; |
1457 | 372 | return v3flags & OSPF_V3_OPTIONS_L; |
1458 | 441 | } |
1459 | 0 | break; |
1460 | 541 | } |
1461 | | |
1462 | 84 | return 0; |
1463 | 541 | } |
1464 | | |
1465 | | static int |
1466 | | ospf_has_at_block(tvbuff_t *tvb, int offset, uint8_t packet_type, uint8_t version) |
1467 | 192 | { |
1468 | 192 | uint32_t v3flags; |
1469 | | |
1470 | | /* AT (Authentication Trailer) block can be found in OSPFv3 HELLO and DD packets */ |
1471 | 192 | switch (packet_type) { |
1472 | 11 | case OSPF_HELLO: |
1473 | 11 | switch (version) { |
1474 | 10 | case OSPF_VERSION_3: |
1475 | 10 | v3flags = tvb_get_ntohl(tvb, offset + 5); |
1476 | 10 | v3flags = v3flags >> 8; |
1477 | 10 | return v3flags & OSPF_V3_OPTIONS_AT; |
1478 | 11 | } |
1479 | 1 | break; |
1480 | 97 | case OSPF_DB_DESC: |
1481 | 97 | switch (version) { |
1482 | 89 | case OSPF_VERSION_3: |
1483 | 89 | v3flags = tvb_get_ntohl(tvb, offset + 1); |
1484 | 89 | v3flags = v3flags >> 8; |
1485 | 89 | return v3flags & OSPF_V3_OPTIONS_AT; |
1486 | 97 | } |
1487 | 8 | break; |
1488 | 192 | } |
1489 | | |
1490 | 93 | return 0; |
1491 | 192 | } |
1492 | | |
1493 | | static bool |
1494 | | 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_) |
1495 | 0 | { |
1496 | 0 | capture_dissector_increment_count(cpinfo, proto_ospf); |
1497 | 0 | return true; |
1498 | 0 | } |
1499 | | |
1500 | | static int |
1501 | | dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
1502 | 5.05k | { |
1503 | 5.05k | proto_tree *ospf_tree = NULL; |
1504 | 5.05k | proto_item *ti, *ti_sum, *hidden_item; |
1505 | 5.05k | proto_tree *ospf_header_tree; |
1506 | 5.05k | uint8_t version; |
1507 | 5.05k | uint8_t packet_type; |
1508 | 5.05k | uint16_t ospflen; |
1509 | 5.05k | vec_t cksum_vec[4]; |
1510 | 5.05k | int cksum_vec_len, has_at_block; |
1511 | 5.05k | uint32_t phdr[2]; |
1512 | 5.05k | uint16_t cksum, computed_cksum; |
1513 | 5.05k | unsigned length, reported_length; |
1514 | 5.05k | uint8_t auth_type; |
1515 | 5.05k | int crypto_len = 0; |
1516 | 5.05k | unsigned int ospf_header_length; |
1517 | 5.05k | uint8_t instance_id; |
1518 | 5.05k | uint32_t areaid; |
1519 | 5.05k | uint8_t address_family = OSPF_AF_6; |
1520 | 5.05k | int offset; |
1521 | | |
1522 | 5.05k | col_set_str(pinfo->cinfo, COL_PROTOCOL, "OSPF"); |
1523 | 5.05k | col_clear(pinfo->cinfo, COL_INFO); |
1524 | | |
1525 | 5.05k | version = tvb_get_uint8(tvb, 0); |
1526 | 5.05k | switch (version) { |
1527 | 2.95k | case OSPF_VERSION_2: |
1528 | 2.95k | ospf_header_length = OSPF_VERSION_2_HEADER_LENGTH; |
1529 | 2.95k | break; |
1530 | 2.02k | case OSPF_VERSION_3: |
1531 | 2.02k | ospf_header_length = OSPF_VERSION_3_HEADER_LENGTH; |
1532 | 2.02k | break; |
1533 | 69 | default: |
1534 | 69 | ospf_header_length = 14; |
1535 | 69 | break; |
1536 | 5.05k | } |
1537 | | |
1538 | 5.05k | packet_type = tvb_get_uint8(tvb, 1); |
1539 | 5.05k | col_add_str(pinfo->cinfo, COL_INFO, |
1540 | 5.05k | val_to_str(pinfo->pool, packet_type, pt_vals, "Unknown (%u)")); |
1541 | | |
1542 | 5.05k | ospflen = tvb_get_ntohs(tvb, 2); |
1543 | | |
1544 | 5.05k | ti = proto_tree_add_item(tree, proto_ospf, tvb, 0, -1, ENC_NA); |
1545 | 5.05k | ospf_tree = proto_item_add_subtree(ti, ett_ospf); |
1546 | | |
1547 | | |
1548 | 5.05k | ti = proto_tree_add_item(ospf_tree, hf_ospf_header, tvb, 0, ospf_header_length, ENC_NA); |
1549 | 5.05k | ospf_header_tree = proto_item_add_subtree(ti, ett_ospf_hdr); |
1550 | | |
1551 | 5.05k | proto_tree_add_item(ospf_header_tree, hf_ospf_header_version, tvb, 0, 1, ENC_BIG_ENDIAN); |
1552 | 5.05k | proto_tree_add_item(ospf_header_tree, hf_ospf_header_msg_type, tvb, 1, 1, ENC_BIG_ENDIAN); |
1553 | | |
1554 | 5.05k | if (ospf_msg_type_to_filter(packet_type) != -1) { |
1555 | 4.91k | hidden_item = proto_tree_add_item(ospf_header_tree, |
1556 | 4.91k | *hf_ospf_msg_type_array[ospf_msg_type_to_filter(packet_type)], |
1557 | 4.91k | tvb, 1, 1, ENC_BIG_ENDIAN); |
1558 | 4.91k | proto_item_set_hidden(hidden_item); |
1559 | 4.91k | } |
1560 | 5.05k | proto_tree_add_item(ospf_header_tree, hf_ospf_header_packet_length, tvb, 2, 2, ENC_BIG_ENDIAN); |
1561 | 5.05k | proto_tree_add_item(ospf_header_tree, hf_ospf_header_src_router, tvb, 4, 4, ENC_BIG_ENDIAN); |
1562 | | |
1563 | | |
1564 | 5.05k | ti = proto_tree_add_item_ret_ipv4(ospf_header_tree, hf_ospf_header_area_id, tvb, 8, 4, ENC_BIG_ENDIAN, &areaid); |
1565 | 5.05k | if(areaid == 0){ |
1566 | 330 | proto_item_append_text(ti, " (Backbone)"); |
1567 | 330 | } |
1568 | | |
1569 | 5.05k | ti_sum = proto_tree_add_item_ret_uint16(ospf_header_tree, hf_ospf_header_checksum, tvb, 12, 2, ENC_BIG_ENDIAN, &cksum); |
1570 | 5.05k | if(cksum == 0){ |
1571 | 739 | proto_item_append_text(ti_sum, " (None)"); |
1572 | 739 | } |
1573 | | |
1574 | | /* Quit at this point if it's an unknown OSPF version. */ |
1575 | 5.05k | if(version != OSPF_VERSION_2 && version != OSPF_VERSION_3) { |
1576 | 19 | return 12; |
1577 | 19 | } |
1578 | | |
1579 | 5.03k | length = tvb_captured_length(tvb); |
1580 | | /* XXX - include only the length from the OSPF header? */ |
1581 | 5.03k | reported_length = tvb_reported_length(tvb); |
1582 | 5.03k | if (cksum !=0 && !pinfo->fragmented && length >= reported_length |
1583 | 4.20k | && length >= ospf_header_length) { |
1584 | | /* The packet isn't part of a fragmented datagram and isn't |
1585 | | truncated, so we can checksum it. */ |
1586 | | |
1587 | 4.16k | switch (version) { |
1588 | | |
1589 | 2.51k | case OSPF_VERSION_2: |
1590 | | /* Header, not including the authentication data (the OSPFv2 |
1591 | | checksum excludes the 64-bit authentication field). */ |
1592 | 2.51k | SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, 16); |
1593 | 2.51k | if (length > ospf_header_length) { |
1594 | | /* Rest of the packet, again not including the |
1595 | | authentication data. */ |
1596 | 2.48k | reported_length -= ospf_header_length; |
1597 | 2.48k | SET_CKSUM_VEC_TVB(cksum_vec[1], tvb, ospf_header_length, reported_length); |
1598 | 2.48k | cksum_vec_len = 2; |
1599 | 2.48k | } else { |
1600 | | /* There's nothing but a header. */ |
1601 | 29 | cksum_vec_len = 1; |
1602 | 29 | } |
1603 | 2.51k | break; |
1604 | | |
1605 | 1.64k | case OSPF_VERSION_3: |
1606 | | /* IPv6-style checksum, covering the entire OSPF packet |
1607 | | and a prepended IPv6 pseudo-header. */ |
1608 | | |
1609 | | /* Set up the fields of the pseudo-header. */ |
1610 | 1.64k | SET_CKSUM_VEC_PTR(cksum_vec[0], (const uint8_t *)pinfo->src.data, pinfo->src.len); |
1611 | 1.64k | SET_CKSUM_VEC_PTR(cksum_vec[1], (const uint8_t *)pinfo->dst.data, pinfo->dst.len); |
1612 | 1.64k | phdr[0] = g_htonl(ospflen); |
1613 | 1.64k | phdr[1] = g_htonl(IP_PROTO_OSPFIGP); |
1614 | 1.64k | SET_CKSUM_VEC_PTR(cksum_vec[2], (const uint8_t *)&phdr, 8); |
1615 | 1.64k | SET_CKSUM_VEC_TVB(cksum_vec[3], tvb, 0, reported_length); |
1616 | 1.64k | cksum_vec_len = 4; |
1617 | 1.64k | break; |
1618 | | |
1619 | 0 | default: |
1620 | 0 | DISSECTOR_ASSERT_NOT_REACHED(); |
1621 | 0 | break; |
1622 | 4.16k | } |
1623 | 4.16k | computed_cksum = in_cksum(cksum_vec, cksum_vec_len); |
1624 | | /* |
1625 | | * in_cksum() should never return 0xFFFF here, because, to quote |
1626 | | * RFC 1624 section 3 "Discussion": |
1627 | | * |
1628 | | * In one's complement, there are two representations of |
1629 | | * zero: the all zero and the all one bit values, often |
1630 | | * referred to as +0 and -0. One's complement addition |
1631 | | * of non-zero inputs can produce -0 as a result, but |
1632 | | * never +0. Since there is guaranteed to be at least |
1633 | | * one non-zero field in the IP header, and the checksum |
1634 | | * field in the protocol header is the complement of the |
1635 | | * sum, the checksum field can never contain ~(+0), which |
1636 | | * is -0 (0xFFFF). It can, however, contain ~(-0), which |
1637 | | * is +0 (0x0000). |
1638 | | * |
1639 | | * RFC 1624 is discussing the checksum of the *IPv4* header, |
1640 | | * where the "version" field is 4, ensuring that, in a valid |
1641 | | * IPv4 header, there is at least one non-zero field, but it |
1642 | | * also applies to an OSPF packet, because, for OSPFv2, the |
1643 | | * header includes a version field with the value 2 and, for |
1644 | | * OSPFv3, the pseudo-header includes the non-zero IP protocol |
1645 | | * number for OSPF, so at least one field in the checksummed |
1646 | | * data is non-zero. |
1647 | | * |
1648 | | * in_cksum() returns the negation of the one's-complement |
1649 | | * sum of all the data handed to it, and that data won't be |
1650 | | * all zero, so the sum won't be 0 (+0), and thus the negation |
1651 | | * won't be -0, i.e. won't be 0xFFFF. |
1652 | | */ |
1653 | 4.16k | if (computed_cksum == 0) { |
1654 | 4 | proto_item_append_text(ti_sum, " [correct]"); |
1655 | 4.15k | } else { |
1656 | 4.15k | proto_item_append_text(ti_sum, " [incorrect, should be 0x%04x]", in_cksum_shouldbe(cksum, computed_cksum)); |
1657 | 4.15k | } |
1658 | 4.16k | } |
1659 | | |
1660 | 5.03k | switch (version) { |
1661 | | |
1662 | 2.93k | case OSPF_VERSION_2: |
1663 | | /* Authentication and multi-instance is only valid for OSPFv2 */ |
1664 | 2.93k | proto_tree_add_item(ospf_header_tree, hf_ospf_header_instance_id, tvb, 14, 1, ENC_BIG_ENDIAN); |
1665 | 2.93k | proto_tree_add_item_ret_uint8(ospf_header_tree, hf_ospf_header_auth_type, tvb, 15, 1, ENC_BIG_ENDIAN, &auth_type); |
1666 | 2.93k | switch (auth_type) { |
1667 | 742 | case OSPF_AUTH_NONE: |
1668 | 742 | proto_tree_add_item(ospf_header_tree, hf_ospf_header_auth_data_none, tvb, 16, 8, ENC_NA); |
1669 | 742 | break; |
1670 | | |
1671 | 100 | case OSPF_AUTH_SIMPLE: |
1672 | 100 | proto_tree_add_item(ospf_header_tree, hf_ospf_header_auth_data_simple, tvb, 16, 8, ENC_ASCII); |
1673 | 100 | break; |
1674 | | |
1675 | 252 | case OSPF_AUTH_CRYPT: |
1676 | 252 | proto_tree_add_item(ospf_header_tree, hf_ospf_header_auth_crypt_key_id, tvb, 18, 1, ENC_BIG_ENDIAN); |
1677 | | |
1678 | 252 | proto_tree_add_item(ospf_header_tree, hf_ospf_header_auth_crypt_data_length, tvb, 19, 1, ENC_BIG_ENDIAN); |
1679 | 252 | crypto_len = tvb_get_uint8(tvb, 19); |
1680 | | |
1681 | 252 | proto_tree_add_item(ospf_header_tree, hf_ospf_header_auth_crypt_seq_nbr, tvb, 20, 4, ENC_BIG_ENDIAN); |
1682 | | /* Show the message digest that was appended to the end of the |
1683 | | OSPF message - but only if it's present (we don't want |
1684 | | to get an exception before we've tried dissecting OSPF |
1685 | | message). */ |
1686 | 252 | if (tvb_bytes_exist(tvb, ospflen, crypto_len)) { |
1687 | 115 | proto_tree_add_item(ospf_header_tree, hf_ospf_header_auth_crypt_data, tvb, ospflen, crypto_len, ENC_NA); |
1688 | 115 | proto_tree_set_appendix(ospf_header_tree, tvb, ospflen, crypto_len); |
1689 | 115 | } |
1690 | 252 | break; |
1691 | | |
1692 | 1.83k | default: |
1693 | 1.83k | proto_tree_add_item(ospf_header_tree, hf_ospf_header_auth_data_unknown, tvb, 16, 8, ENC_NA); |
1694 | 1.83k | break; |
1695 | 2.93k | } |
1696 | 2.92k | break; |
1697 | | |
1698 | 2.92k | case OSPF_VERSION_3: |
1699 | | /* Instance ID and "reserved" is OSPFv3-only */ |
1700 | 2.00k | proto_tree_add_item_ret_uint8(ospf_header_tree, hf_ospf_v3_header_instance_id, tvb, 14, 1, ENC_BIG_ENDIAN, &instance_id); |
1701 | | /* By default set address_family to OSPF_AF_6 */ |
1702 | 2.00k | address_family = OSPF_AF_6; |
1703 | 2.00k | if(instance_id > 65 && instance_id < 128) { |
1704 | 187 | address_family = OSPF_AF_4; |
1705 | 187 | } |
1706 | | |
1707 | 2.00k | ti = proto_tree_add_item(ospf_header_tree, hf_ospf_header_reserved, tvb, 15, 1, ENC_NA); |
1708 | 2.00k | if(tvb_get_uint8(tvb, 15)){ |
1709 | 1.33k | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
1710 | 1.33k | } |
1711 | 2.00k | break; |
1712 | | |
1713 | 0 | default: |
1714 | 0 | DISSECTOR_ASSERT_NOT_REACHED(); |
1715 | 0 | break; |
1716 | 5.03k | } |
1717 | | |
1718 | 4.89k | switch (packet_type){ |
1719 | | |
1720 | 90 | case OSPF_HELLO: |
1721 | 90 | dissect_ospf_hello(tvb, ospf_header_length, ospf_tree, version, |
1722 | 90 | (uint16_t)(ospflen - ospf_header_length)); |
1723 | 90 | break; |
1724 | | |
1725 | 507 | case OSPF_DB_DESC: |
1726 | 507 | dissect_ospf_db_desc(tvb, pinfo, (int)ospf_header_length, ospf_tree, version, |
1727 | 507 | (uint16_t)(ospflen - ospf_header_length), |
1728 | 507 | address_family); |
1729 | 507 | break; |
1730 | | |
1731 | 83 | case OSPF_LS_REQ: |
1732 | 83 | dissect_ospf_ls_req(tvb, pinfo, (int)ospf_header_length, ospf_tree, version, |
1733 | 83 | (uint16_t)(ospflen - ospf_header_length)); |
1734 | 83 | break; |
1735 | | |
1736 | 3.96k | case OSPF_LS_UPD: |
1737 | 3.96k | dissect_ospf_ls_upd(tvb, pinfo, (int)ospf_header_length, ospf_tree, version, |
1738 | 3.96k | (uint16_t)(ospflen - ospf_header_length), |
1739 | 3.96k | address_family); |
1740 | 3.96k | break; |
1741 | | |
1742 | 207 | case OSPF_LS_ACK: |
1743 | 207 | dissect_ospf_ls_ack(tvb, pinfo, (int)ospf_header_length, ospf_tree, version, |
1744 | 207 | (uint16_t)(ospflen - ospf_header_length), |
1745 | 207 | address_family); |
1746 | 207 | break; |
1747 | | |
1748 | 47 | default: |
1749 | 47 | call_data_dissector(tvb_new_subset_remaining(tvb, ospf_header_length), pinfo, tree); |
1750 | 47 | break; |
1751 | 4.89k | } |
1752 | | |
1753 | 541 | offset = ospflen + crypto_len; |
1754 | | |
1755 | | /* Take care of the LLS data block (RFC 5613) |
1756 | | * This block can only be present in Hello and DB Description packets. |
1757 | | */ |
1758 | 541 | if (ospf_has_lls_block(tvb, ospf_header_length, packet_type, version)) { |
1759 | 411 | offset = dissect_ospf_lls_data_block(tvb, pinfo, offset, ospf_tree, |
1760 | 411 | version); |
1761 | 411 | } |
1762 | | |
1763 | | /* Take care of the AT (Authentication Trailer) data block (RFC 7166) |
1764 | | * This block can be present in all OSPFv3 packets, but is is only indicated by flags |
1765 | | * in Hello and DB Description packets. Because Wireshark does not have a neighbor state DB, |
1766 | | * we expect the AT based on a protocol preference if the indicating flags are not present. |
1767 | | */ |
1768 | 541 | has_at_block = ospf_has_at_block(tvb, ospf_header_length, packet_type, version); |
1769 | 541 | if ( |
1770 | 541 | has_at_block || ( |
1771 | 103 | !has_at_block && |
1772 | 103 | ospf_v3_expect_at && |
1773 | 0 | tvb_reported_length_remaining(tvb, offset) |
1774 | 103 | ) |
1775 | 541 | ) { |
1776 | 89 | dissect_ospf_authentication_trailer(tvb, offset, ospf_tree); |
1777 | 89 | } |
1778 | | |
1779 | 541 | return tvb_captured_length(tvb); |
1780 | 4.89k | } |
1781 | | |
1782 | | static int |
1783 | | dissect_ospfv2_lls_tlv(tvbuff_t *tvb, int offset, proto_tree *tree) |
1784 | 1.24k | { |
1785 | 1.24k | proto_tree *ospf_lls_tlv_tree; |
1786 | 1.24k | uint16_t type; |
1787 | 1.24k | uint16_t length; |
1788 | | |
1789 | 1.24k | type = tvb_get_ntohs(tvb, offset); |
1790 | 1.24k | length = tvb_get_ntohs(tvb, offset + 2); |
1791 | | |
1792 | 1.24k | ospf_lls_tlv_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ospf_lls_tlv, |
1793 | 1.24k | NULL, val_to_str_const(type, lls_tlv_type_vals, "Unknown LLS TLV")); |
1794 | | |
1795 | 1.24k | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); |
1796 | 1.24k | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
1797 | | |
1798 | 1.24k | switch(type) { |
1799 | 195 | case LLS_V2_EXT_OPT: |
1800 | 195 | 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); |
1801 | 195 | break; |
1802 | 620 | case LLS_V2_CRYPTO_OPT: |
1803 | 620 | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_v2_lls_sequence_number, tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
1804 | 620 | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_v2_lls_auth_data, tvb, offset + 8, length - 4, ENC_NA); |
1805 | 620 | break; |
1806 | 194 | case LLS_V2_LI_ID_OPT: |
1807 | 194 | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_v2_lls_li_id, tvb, offset + 4, 4, ENC_NA); |
1808 | 1.24k | } |
1809 | | |
1810 | 1.19k | return offset + length + 4; |
1811 | 1.24k | } |
1812 | | |
1813 | | static int |
1814 | | dissect_ospfv3_lls_tlv(tvbuff_t *tvb, int offset, proto_tree *tree) |
1815 | 2.60k | { |
1816 | 2.60k | proto_item *ti = NULL; |
1817 | 2.60k | proto_tree *ospf_lls_tlv_tree = NULL; |
1818 | 2.60k | uint16_t type; |
1819 | 2.60k | uint16_t length; |
1820 | 2.60k | uint8_t relays_added; |
1821 | 2.60k | int orig_offset; |
1822 | | |
1823 | 2.60k | type = tvb_get_ntohs(tvb, offset); |
1824 | 2.60k | length = tvb_get_ntohs(tvb, offset + 2); |
1825 | | |
1826 | 2.60k | switch(type) { |
1827 | 309 | case LLS_V3_EXT_OPT: |
1828 | 309 | ti = proto_tree_add_item(tree, hf_ospf_v3_lls_ext_options_tlv, tvb, |
1829 | 309 | offset, length + 4, ENC_NA); |
1830 | 309 | break; |
1831 | 333 | case LLS_V3_STATE_CHECK: |
1832 | 333 | ti = proto_tree_add_item(tree, hf_ospf_v3_lls_state_tlv, tvb, |
1833 | 333 | offset, length + 4, ENC_NA); |
1834 | 333 | break; |
1835 | 286 | case LLS_V3_NBR_DROP: |
1836 | 286 | ti = proto_tree_add_item(tree, hf_ospf_v3_lls_drop_tlv, tvb, |
1837 | 286 | offset, length + 4, ENC_NA); |
1838 | 286 | break; |
1839 | 180 | case LLS_V3_RELAYS: |
1840 | 180 | ti = proto_tree_add_item(tree, hf_ospf_v3_lls_relay_tlv, tvb, |
1841 | 180 | offset, length + 4, ENC_NA); |
1842 | 180 | break; |
1843 | 212 | case LLS_V3_WILLING: |
1844 | 212 | ti = proto_tree_add_item(tree, hf_ospf_v3_lls_willingness_tlv, tvb, |
1845 | 212 | offset, length + 4, ENC_NA); |
1846 | 212 | break; |
1847 | 313 | case LLS_V3_RQST_FROM: |
1848 | 313 | ti = proto_tree_add_item(tree, hf_ospf_v3_lls_rf_tlv, tvb, |
1849 | 313 | offset, length + 4, ENC_NA); |
1850 | 313 | break; |
1851 | 287 | case LLS_V3_FULL_STATE: |
1852 | 287 | ti = proto_tree_add_item(tree, hf_ospf_v3_lls_fsf_tlv, tvb, |
1853 | 287 | offset, length + 4, ENC_NA); |
1854 | 287 | break; |
1855 | 548 | default: |
1856 | 548 | ospf_lls_tlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, length + 4, ett_ospf_lls_tlv, NULL, |
1857 | 548 | "%s", val_to_str_const(type, lls_v3_tlv_type_vals, "Unknown LLS TLV")); |
1858 | 2.60k | } |
1859 | | |
1860 | 2.46k | if (ti != NULL) |
1861 | 1.92k | ospf_lls_tlv_tree = proto_item_add_subtree(ti, ett_ospf_lls_tlv); |
1862 | 2.46k | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); |
1863 | 2.46k | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
1864 | | |
1865 | 2.46k | orig_offset = offset; |
1866 | | |
1867 | 2.46k | switch (type) { |
1868 | 309 | case LLS_V3_EXT_OPT: |
1869 | 309 | 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); |
1870 | 309 | break; |
1871 | 333 | case LLS_V3_STATE_CHECK: |
1872 | 333 | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_v3_lls_state_scs, |
1873 | 333 | tvb, offset+4, 2, ENC_BIG_ENDIAN); |
1874 | 333 | 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); |
1875 | 333 | break; |
1876 | 286 | case LLS_V3_NBR_DROP: |
1877 | 286 | offset += 4; |
1878 | 578 | while (orig_offset + length >= offset) { |
1879 | 292 | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_v3_lls_dropped_neighbor, tvb, offset, 4, ENC_BIG_ENDIAN); |
1880 | 292 | offset += 4; |
1881 | 292 | } |
1882 | 286 | offset = orig_offset; |
1883 | 286 | break; |
1884 | 180 | case LLS_V3_RELAYS: |
1885 | 180 | relays_added = tvb_get_uint8(tvb, offset+4); |
1886 | 180 | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_v3_lls_relay_added, |
1887 | 180 | tvb, offset+4, 1, ENC_BIG_ENDIAN); |
1888 | 180 | 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); |
1889 | 180 | offset += 8; |
1890 | 489 | while (orig_offset + length >= offset) { |
1891 | 309 | ti = proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_v3_lls_neighbor, tvb, offset, 4, ENC_BIG_ENDIAN); |
1892 | 309 | if (relays_added > 0) { |
1893 | 206 | proto_item_append_text(ti, " Added"); |
1894 | 206 | } else { |
1895 | 103 | proto_item_append_text(ti, " Deleted"); |
1896 | 103 | } |
1897 | | |
1898 | 309 | relays_added--; |
1899 | 309 | offset += 4; |
1900 | 309 | } |
1901 | 180 | break; |
1902 | 212 | case LLS_V3_WILLING: |
1903 | 212 | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_v3_lls_willingness, |
1904 | 212 | tvb, offset+4, 1, ENC_BIG_ENDIAN); |
1905 | | |
1906 | 212 | break; |
1907 | 313 | case LLS_V3_RQST_FROM: |
1908 | 313 | offset += 4; |
1909 | 746 | while (orig_offset + length >= offset) { |
1910 | 433 | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_v3_lls_request_from, tvb, offset, 4, ENC_BIG_ENDIAN); |
1911 | 433 | offset += 4; |
1912 | 433 | } |
1913 | 313 | offset = orig_offset; |
1914 | 313 | break; |
1915 | 287 | case LLS_V3_FULL_STATE: |
1916 | 287 | offset += 4; |
1917 | 579 | while (orig_offset + length >= offset) { |
1918 | 292 | proto_tree_add_item(ospf_lls_tlv_tree, hf_ospf_v3_lls_full_state_for, tvb, offset, 4, ENC_BIG_ENDIAN); |
1919 | 292 | offset += 4; |
1920 | 292 | } |
1921 | 287 | offset = orig_offset; |
1922 | 287 | break; |
1923 | 2.46k | } |
1924 | | |
1925 | 2.32k | return offset + length + 4; |
1926 | 2.46k | } |
1927 | | |
1928 | | |
1929 | | static int |
1930 | | dissect_ospf_lls_data_block(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, |
1931 | | uint8_t version) |
1932 | 411 | { |
1933 | 411 | proto_tree *ospf_lls_data_block_tree; |
1934 | 411 | int ospf_lls_len; |
1935 | 411 | int orig_offset = offset; |
1936 | 411 | unsigned length_remaining; |
1937 | | |
1938 | 411 | length_remaining = tvb_reported_length_remaining(tvb, offset); |
1939 | 411 | if (length_remaining < 4) { |
1940 | 27 | proto_tree_add_expert_format(tree, pinfo, &ei_ospf_lsa_bad_length, |
1941 | 27 | tvb, offset, length_remaining, "LLS option bit set but data block missing"); |
1942 | 27 | return offset; |
1943 | 27 | } |
1944 | | |
1945 | 384 | ospf_lls_len = tvb_get_ntohs(tvb, offset + 2) * 4; |
1946 | 384 | ospf_lls_data_block_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_ospf_lls_data_block, NULL, "OSPF LLS Data Block"); |
1947 | | |
1948 | | /* TODO: verify checksum */ |
1949 | 384 | 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); |
1950 | 384 | proto_tree_add_uint(ospf_lls_data_block_tree, hf_ospf_lls_data_length, tvb, offset + 2, 2, ospf_lls_len); |
1951 | | |
1952 | 384 | offset += 4; |
1953 | 384 | DISSECTOR_ASSERT((version == OSPF_VERSION_2) || (version == OSPF_VERSION_3)); |
1954 | 4.23k | while (orig_offset + ospf_lls_len > offset) { |
1955 | 3.85k | if (version == OSPF_VERSION_2) |
1956 | 1.24k | offset = dissect_ospfv2_lls_tlv (tvb, offset, ospf_lls_data_block_tree); |
1957 | 2.60k | else |
1958 | 2.60k | offset = dissect_ospfv3_lls_tlv (tvb, offset, ospf_lls_data_block_tree); |
1959 | 3.85k | } |
1960 | | |
1961 | 384 | return offset; |
1962 | 411 | } |
1963 | | |
1964 | | static int |
1965 | | dissect_ospf_authentication_trailer(tvbuff_t *tvb, int offset, proto_tree *tree) |
1966 | 89 | { |
1967 | 89 | proto_tree *ospf_at_tree; |
1968 | 89 | proto_item *ti; |
1969 | 89 | uint32_t auth_data_len; |
1970 | | |
1971 | 89 | ti = proto_tree_add_item(tree, hf_ospf_at, tvb, offset, -1, ENC_NA); |
1972 | 89 | ospf_at_tree = proto_item_add_subtree(ti, ett_ospf_at); |
1973 | | |
1974 | 89 | proto_tree_add_item(ospf_at_tree, hf_ospf_at_auth_type, tvb, offset, 2, ENC_BIG_ENDIAN); |
1975 | 89 | offset += 2; |
1976 | | |
1977 | 89 | proto_tree_add_item_ret_uint(ospf_at_tree, hf_ospf_at_auth_data_len, tvb, offset, 2, ENC_BIG_ENDIAN, &auth_data_len); |
1978 | 89 | offset += 2; |
1979 | 89 | if (auth_data_len < (2 + 2 + 2 + 8)) { |
1980 | | /* XXX - report an error here */ |
1981 | 3 | proto_item_set_len(ti, 4); |
1982 | 3 | return offset; |
1983 | 3 | } |
1984 | 86 | proto_item_set_len(ti, auth_data_len); |
1985 | | |
1986 | 86 | proto_tree_add_item(ospf_at_tree, hf_ospf_at_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); |
1987 | 86 | offset += 2; |
1988 | | |
1989 | 86 | proto_tree_add_item(ospf_at_tree, hf_ospf_at_sa_id, tvb, offset, 2, ENC_BIG_ENDIAN); |
1990 | 86 | offset += 2; |
1991 | | |
1992 | 86 | proto_tree_add_item(ospf_at_tree, hf_ospf_at_crypto_seq_nbr, tvb, offset, 8, ENC_BIG_ENDIAN); |
1993 | 86 | offset += 8; |
1994 | | |
1995 | | /* Add Check of Data ? */ |
1996 | 86 | proto_tree_add_item(ospf_at_tree, hf_ospf_at_auth_data, tvb, offset, auth_data_len - ( 2 + 2 + 2 + 2 + 8), ENC_NA); |
1997 | 86 | offset = auth_data_len; |
1998 | | |
1999 | 86 | return offset; |
2000 | 89 | } |
2001 | | |
2002 | | static void |
2003 | | dissect_ospf_hello(tvbuff_t *tvb, int offset, proto_tree *tree, uint8_t version, |
2004 | | uint16_t length) |
2005 | 90 | { |
2006 | 90 | proto_tree *ospf_hello_tree; |
2007 | 90 | proto_item *ti; |
2008 | 90 | int orig_offset = offset; |
2009 | | |
2010 | 90 | ti = proto_tree_add_item(tree, hf_ospf_hello, tvb, offset, length, ENC_NA); |
2011 | 90 | ospf_hello_tree = proto_item_add_subtree(ti, ett_ospf_hello); |
2012 | | |
2013 | 90 | switch (version) { |
2014 | 21 | case OSPF_VERSION_2: |
2015 | 21 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_network_mask, tvb, offset, 4, ENC_BIG_ENDIAN); |
2016 | 21 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_hello_interval, tvb, offset + 4, 2, ENC_BIG_ENDIAN); |
2017 | 21 | proto_tree_add_bitmask(ospf_hello_tree, tvb, offset + 6, hf_ospf_v2_options, ett_ospf_v2_options, bf_v2_options, ENC_BIG_ENDIAN); |
2018 | 21 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_router_priority, tvb, offset + 7, 1, ENC_BIG_ENDIAN); |
2019 | 21 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_router_dead_interval, tvb, offset + 8, 4, ENC_BIG_ENDIAN); |
2020 | 21 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_designated_router, tvb, offset + 12, 4, ENC_BIG_ENDIAN); |
2021 | 21 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_backup_designated_router, tvb, offset + 16, 4, ENC_BIG_ENDIAN); |
2022 | 21 | offset += 20; |
2023 | | |
2024 | 454 | while (orig_offset + length > offset) { |
2025 | 433 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_active_neighbor, tvb, offset, 4, ENC_BIG_ENDIAN); |
2026 | 433 | offset += 4; |
2027 | 433 | } |
2028 | 21 | break; |
2029 | 55 | case OSPF_VERSION_3: |
2030 | 55 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_interface_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
2031 | 55 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_router_priority, tvb, offset + 4, 1, ENC_BIG_ENDIAN); |
2032 | 55 | proto_tree_add_bitmask(ospf_hello_tree, tvb, offset + 5, hf_ospf_v3_options, ett_ospf_v3_options, bf_v3_options, ENC_BIG_ENDIAN); |
2033 | 55 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_hello_interval, tvb, offset + 8, 2, ENC_BIG_ENDIAN); |
2034 | 55 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_router_dead_interval, tvb, offset + 10, 2, ENC_BIG_ENDIAN); |
2035 | 55 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_designated_router, tvb, offset + 12, 4, ENC_BIG_ENDIAN); |
2036 | 55 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_backup_designated_router, tvb, offset + 16, 4, ENC_BIG_ENDIAN); |
2037 | 55 | offset += 20; |
2038 | | |
2039 | 772 | while (orig_offset + length > offset) { |
2040 | 717 | proto_tree_add_item(ospf_hello_tree, hf_ospf_hello_active_neighbor, tvb, offset, 4, ENC_BIG_ENDIAN); |
2041 | 717 | offset += 4; |
2042 | 717 | } |
2043 | 55 | break; |
2044 | 90 | } |
2045 | 90 | } |
2046 | | |
2047 | | static void |
2048 | | dissect_ospf_db_desc(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, |
2049 | | uint8_t version, uint16_t length, uint8_t address_family) |
2050 | 507 | { |
2051 | 507 | proto_tree *ospf_db_desc_tree; |
2052 | 507 | proto_item *ti; |
2053 | 507 | uint8_t reserved; |
2054 | 507 | int orig_offset = offset; |
2055 | | |
2056 | 507 | if (tree) { |
2057 | 507 | ospf_db_desc_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ospf_desc, NULL, "OSPF DB Description"); |
2058 | | |
2059 | 507 | switch (version ) { |
2060 | | |
2061 | 80 | case OSPF_VERSION_2: |
2062 | 80 | proto_tree_add_item(ospf_db_desc_tree, hf_ospf_db_interface_mtu, tvb, offset, 2, ENC_BIG_ENDIAN); |
2063 | | |
2064 | 80 | 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); |
2065 | 80 | proto_tree_add_bitmask(ospf_db_desc_tree, tvb, offset + 3, hf_ospf_dbd, ett_ospf_dbd, bf_dbd, ENC_BIG_ENDIAN); |
2066 | | |
2067 | 80 | proto_tree_add_item(ospf_db_desc_tree, hf_ospf_db_dd_sequence, tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
2068 | 80 | break; |
2069 | | |
2070 | 427 | case OSPF_VERSION_3: |
2071 | | |
2072 | 427 | reserved = tvb_get_uint8(tvb, offset); |
2073 | 427 | ti = proto_tree_add_item(ospf_db_desc_tree, hf_ospf_header_reserved, tvb, offset, 1, ENC_NA); |
2074 | 427 | if (reserved != 0) |
2075 | 330 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
2076 | | |
2077 | 427 | 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); |
2078 | | |
2079 | 427 | proto_tree_add_item(ospf_db_desc_tree, hf_ospf_db_interface_mtu, tvb, offset + 4, 2, ENC_BIG_ENDIAN); |
2080 | | |
2081 | 427 | reserved = tvb_get_uint8(tvb, offset + 6); |
2082 | 427 | ti = proto_tree_add_item(ospf_db_desc_tree, hf_ospf_header_reserved, tvb, offset + 6, 1, ENC_NA); |
2083 | 427 | if (reserved != 0) |
2084 | 204 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
2085 | | |
2086 | 427 | proto_tree_add_bitmask(ospf_db_desc_tree, tvb, offset + 7, hf_ospf_dbd, ett_ospf_dbd, bf_dbd, ENC_BIG_ENDIAN); |
2087 | | |
2088 | 427 | proto_tree_add_item(ospf_db_desc_tree, hf_ospf_db_dd_sequence, tvb, offset + 8, 4, ENC_BIG_ENDIAN); |
2089 | 427 | break; |
2090 | 507 | } |
2091 | 507 | } |
2092 | 467 | switch (version ) { |
2093 | 76 | case OSPF_VERSION_2: |
2094 | 76 | offset += 8; |
2095 | 76 | break; |
2096 | 391 | case OSPF_VERSION_3: |
2097 | 391 | offset += 12; |
2098 | 391 | break; |
2099 | 467 | } |
2100 | | |
2101 | | /* LS Headers will be processed here */ |
2102 | | /* skip to the end of DB-Desc header */ |
2103 | 467 | DISSECTOR_ASSERT((version == OSPF_VERSION_2) || (version == OSPF_VERSION_3)); |
2104 | 698 | while (orig_offset + length > offset) { |
2105 | 231 | if ( version == OSPF_VERSION_2) |
2106 | 80 | offset = dissect_ospf_v2_lsa(tvb, pinfo, offset, tree, false); |
2107 | 151 | else |
2108 | 151 | offset = dissect_ospf_v3_lsa(tvb, pinfo, offset, tree, false, address_family); |
2109 | 231 | } |
2110 | | |
2111 | 467 | } |
2112 | | |
2113 | | static void |
2114 | | dissect_ospf_ls_req(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, uint8_t version, |
2115 | | uint16_t length) |
2116 | 83 | { |
2117 | 83 | proto_item *ti; |
2118 | 83 | proto_tree *ospf_lsr_tree; |
2119 | 83 | proto_tree *lsa_type_tree; |
2120 | 83 | uint16_t reserved; |
2121 | 83 | int orig_offset = offset; |
2122 | | |
2123 | | /* zero or more LS requests may be within a LS Request */ |
2124 | | /* we place every request for a LSA in a single subtree */ |
2125 | 330 | while (orig_offset + length > offset) { |
2126 | 320 | ospf_lsr_tree = proto_tree_add_subtree(tree, tvb, offset, OSPF_LS_REQ_LENGTH, |
2127 | 320 | ett_ospf_lsr, NULL, "Link State Request"); |
2128 | | |
2129 | 320 | switch ( version ) { |
2130 | | |
2131 | 67 | case OSPF_VERSION_2: |
2132 | 67 | proto_tree_add_item(ospf_lsr_tree, hf_ospf_ls_type, |
2133 | 67 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2134 | 67 | break; |
2135 | 253 | case OSPF_VERSION_3: |
2136 | 253 | reserved = tvb_get_ntohs(tvb, offset); |
2137 | 253 | ti = proto_tree_add_item(ospf_lsr_tree, hf_ospf_header_reserved, tvb, offset, 2, ENC_NA); |
2138 | 253 | if (reserved != 0) |
2139 | 130 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
2140 | | |
2141 | 253 | ti = proto_tree_add_item(ospf_lsr_tree, hf_ospf_v3_ls_type, |
2142 | 253 | tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
2143 | 253 | lsa_type_tree = proto_item_add_subtree(ti, ett_ospf_lsa_type); |
2144 | 253 | proto_tree_add_item(lsa_type_tree, hf_ospf_v3_ls_type_u, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
2145 | 253 | proto_tree_add_item(lsa_type_tree, hf_ospf_v3_ls_type_s12, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
2146 | 253 | proto_tree_add_item(lsa_type_tree, hf_ospf_v3_ls_type_fc, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
2147 | 253 | break; |
2148 | 320 | } |
2149 | | |
2150 | | |
2151 | 247 | proto_tree_add_item(ospf_lsr_tree, hf_ospf_link_state_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
2152 | 247 | proto_tree_add_item(ospf_lsr_tree, hf_ospf_adv_router, |
2153 | 247 | tvb, offset + 8, 4, ENC_BIG_ENDIAN); |
2154 | | |
2155 | 247 | offset += 12; |
2156 | 247 | } |
2157 | 83 | } |
2158 | | |
2159 | | static void |
2160 | | dissect_ospf_ls_upd(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, uint8_t version, |
2161 | | uint16_t length, uint8_t address_family) |
2162 | 3.96k | { |
2163 | 3.96k | proto_tree *ospf_lsa_upd_tree; |
2164 | 3.96k | uint32_t lsa_nr; |
2165 | 3.96k | uint32_t lsa_counter; |
2166 | | |
2167 | 3.96k | ospf_lsa_upd_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ospf_lsa_upd, NULL, "LS Update Packet"); |
2168 | | |
2169 | 3.96k | lsa_nr = tvb_get_ntohl(tvb, offset); |
2170 | 3.96k | proto_tree_add_item(ospf_lsa_upd_tree, hf_ospf_ls_number_of_lsas, tvb, offset, 4, ENC_BIG_ENDIAN); |
2171 | | /* skip to the beginning of the first LSA */ |
2172 | 3.96k | offset += 4; /* the LS Upd Packet contains only a 32 bit #LSAs field */ |
2173 | | |
2174 | 3.96k | DISSECTOR_ASSERT((version == OSPF_VERSION_2) || (version == OSPF_VERSION_3)); |
2175 | 3.96k | lsa_counter = 0; |
2176 | 12.9k | while (lsa_counter < lsa_nr) { |
2177 | 8.98k | if (version == OSPF_VERSION_2) |
2178 | 5.59k | offset = dissect_ospf_v2_lsa(tvb, pinfo, offset, ospf_lsa_upd_tree, true); |
2179 | 3.38k | else |
2180 | 3.38k | offset = dissect_ospf_v3_lsa(tvb, pinfo, offset, ospf_lsa_upd_tree, true, |
2181 | 3.38k | address_family); |
2182 | 8.98k | lsa_counter += 1; |
2183 | 8.98k | } |
2184 | 3.96k | } |
2185 | | |
2186 | | static void |
2187 | | dissect_ospf_ls_ack(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, uint8_t version, |
2188 | | uint16_t length, uint8_t address_family) |
2189 | 207 | { |
2190 | 207 | int orig_offset = offset; |
2191 | 207 | DISSECTOR_ASSERT((version == OSPF_VERSION_2) || (version == OSPF_VERSION_3)); |
2192 | | /* the body of a LS Ack packet simply contains zero or more LSA Headers */ |
2193 | 1.34k | while (orig_offset + length > offset) { |
2194 | 1.14k | if (version == OSPF_VERSION_2) |
2195 | 709 | offset = dissect_ospf_v2_lsa(tvb, pinfo, offset, tree, false); |
2196 | 432 | else |
2197 | 432 | offset = dissect_ospf_v3_lsa(tvb, pinfo, offset, tree, false, address_family); |
2198 | 1.14k | } |
2199 | 207 | } |
2200 | | |
2201 | | /* |
2202 | | * Returns if an LSA is opaque, i.e. requires special treatment |
2203 | | */ |
2204 | | static int |
2205 | | is_opaque(int lsa_type) |
2206 | 5.89k | { |
2207 | 5.89k | return (lsa_type >= OSPF_LSTYPE_OP_LINKLOCAL && |
2208 | 4.78k | lsa_type <= OSPF_LSTYPE_OP_ASWIDE); |
2209 | 5.89k | } |
2210 | | |
2211 | | /* MPLS/TE TLV types */ |
2212 | 251 | #define MPLS_TLV_ROUTER 1 |
2213 | 2.88k | #define MPLS_TLV_LINK 2 |
2214 | 1.45k | #define OIF_TLV_TNA 32768 |
2215 | | |
2216 | | /* MPLS/TE Link STLV types */ |
2217 | | enum { |
2218 | | MPLS_LINK_TYPE = 1, /* RFC 3630, OSPF-TE */ |
2219 | | MPLS_LINK_ID, |
2220 | | MPLS_LINK_LOCAL_IF, |
2221 | | MPLS_LINK_REMOTE_IF, |
2222 | | MPLS_LINK_TE_METRIC, |
2223 | | MPLS_LINK_MAX_BW, |
2224 | | MPLS_LINK_MAX_RES_BW, |
2225 | | MPLS_LINK_UNRES_BW, |
2226 | | MPLS_LINK_COLOR, |
2227 | | MPLS_LINK_LOCAL_REMOTE_ID = 11, /* RFC 4203, GMPLS */ |
2228 | | MPLS_LINK_PROTECTION = 14, |
2229 | | MPLS_LINK_IF_SWITCHING_DESC, |
2230 | | MPLS_LINK_SHARED_RISK_GROUP, |
2231 | | MPLS_LINK_BANDWIDTH_CONSTRAINT = 17,/* RFC 4124, OSPF-DSTE */ |
2232 | | MPLS_LINK_EXT_ADMIN_GROUP = 26, /* RFC 7308 */ |
2233 | | MPLS_LINK_UNIDIR_LINK_DELAY, /* RFC 7471 */ |
2234 | | MPLS_LINK_UNIDIR_LINK_DELAY_MIN_MAX, |
2235 | | MPLS_LINK_UNIDIR_DELAY_VARIATION, |
2236 | | }; |
2237 | | |
2238 | | enum { |
2239 | | MPLS_BANDWIDTH_AVAILABLE = 1, /* RFC 3630, OSPF-TE */ |
2240 | | MPLS_BANDWIDTH_SHARED = 2 |
2241 | | }; |
2242 | | |
2243 | | /* OIF TLV types */ |
2244 | | enum { |
2245 | | OIF_LOCAL_NODE_ID = 32773, |
2246 | | OIF_REMOTE_NODE_ID, |
2247 | | OIF_SONET_SDH_SWITCHING_CAPABILITY, |
2248 | | OIF_TNA_IPv4_ADDRESS, |
2249 | | OIF_NODE_ID, |
2250 | | OIF_TNA_IPv6_ADDRESS, |
2251 | | OIF_TNA_NSAP_ADDRESS |
2252 | | }; |
2253 | | |
2254 | | static const value_string mpls_link_stlv_str[] = { |
2255 | | {MPLS_LINK_TYPE, "Link Type"}, |
2256 | | {MPLS_LINK_ID, "Link ID"}, |
2257 | | {MPLS_LINK_LOCAL_IF, "Local Interface IP Address"}, |
2258 | | {MPLS_LINK_REMOTE_IF, "Remote Interface IP Address"}, |
2259 | | {MPLS_LINK_TE_METRIC, "Traffic Engineering Metric"}, |
2260 | | {MPLS_LINK_MAX_BW, "Maximum Bandwidth"}, |
2261 | | {MPLS_LINK_MAX_RES_BW, "Maximum Reservable Bandwidth"}, |
2262 | | {MPLS_LINK_UNRES_BW, "Unreserved Bandwidth"}, |
2263 | | {MPLS_LINK_COLOR, "Resource Class/Color"}, |
2264 | | {MPLS_LINK_LOCAL_REMOTE_ID, "Link Local/Remote Identifier"}, |
2265 | | {MPLS_LINK_PROTECTION, "Link Protection Type"}, |
2266 | | {MPLS_LINK_IF_SWITCHING_DESC, "Interface Switching Capability Descriptor"}, |
2267 | | {MPLS_LINK_SHARED_RISK_GROUP, "Shared Risk Link Group"}, |
2268 | | {MPLS_LINK_BANDWIDTH_CONSTRAINT, "Bandwidth Constraints"}, |
2269 | | {MPLS_LINK_EXT_ADMIN_GROUP, "Extended Administrative Group"}, |
2270 | | {MPLS_LINK_UNIDIR_LINK_DELAY, "Unidirectional Link Delay"}, |
2271 | | {MPLS_LINK_UNIDIR_LINK_DELAY_MIN_MAX, "Min/Max Unidirectional Link Delay"}, |
2272 | | {MPLS_LINK_UNIDIR_DELAY_VARIATION, "Unidirectional Delay Variation"}, |
2273 | | {OIF_LOCAL_NODE_ID, "Local Node ID"}, |
2274 | | {OIF_REMOTE_NODE_ID, "Remote Node ID"}, |
2275 | | {OIF_SONET_SDH_SWITCHING_CAPABILITY, "Sonet/SDH Interface Switching Capability"}, |
2276 | | {0, NULL}, |
2277 | | }; |
2278 | | |
2279 | | static const value_string mpls_bandwidth_sstlv_str[] = { |
2280 | | {MPLS_BANDWIDTH_AVAILABLE, "Available Label"}, |
2281 | | {MPLS_BANDWIDTH_SHARED, "Shared Backup Label"}, |
2282 | | {0, NULL}, |
2283 | | }; |
2284 | | |
2285 | | static const range_string mpls_te_tlv_rvals[] = { |
2286 | | { 3, 32767, "(Assigned via Standards Action)"}, |
2287 | | { 32768, 32777, "(For Experimental Use)"}, |
2288 | | { 32778, 65535, "(Not to be Assigned)"}, |
2289 | | { 0, 0, NULL} |
2290 | | }; |
2291 | | |
2292 | | static const range_string mpls_te_sub_tlv_rvals[] = { |
2293 | | { 10, 32767, "(Assigned via Standards Action)"}, |
2294 | | { 32768, 32777, "(For Experimental Use)"}, |
2295 | | { 32778, 65535, "(Not to be Assigned)"}, |
2296 | | { 0, 0, NULL} |
2297 | | }; |
2298 | | |
2299 | | static const value_string oif_stlv_str[] = { |
2300 | | {OIF_TNA_IPv4_ADDRESS, "TNA address"}, |
2301 | | {OIF_NODE_ID, "Node ID"}, |
2302 | | {OIF_TNA_IPv6_ADDRESS, "TNA address"}, |
2303 | | {OIF_TNA_NSAP_ADDRESS, "TNA address"}, |
2304 | | {0, NULL}, |
2305 | | }; |
2306 | | |
2307 | | /* Ref. https://www.iana.org/assignments/ospfv2-parameters/ospfv2-parameters.xhtml#instance-ids */ |
2308 | | static const range_string ospf_instance_id_rvals[] = { |
2309 | | { 0, 0, "Base IPv4 Unicast Instance" }, |
2310 | | { 1, 1, "Base IPv4 Multicast Instance" }, |
2311 | | { 2, 2, "Base IPv4 In-band Management Instance" }, |
2312 | | { 3, 127, "Private Use" }, |
2313 | | { 128, 255, "Unassigned" }, |
2314 | | { 0, 0, NULL }, |
2315 | | }; |
2316 | | |
2317 | | /* Ref. https://www.iana.org/assignments/ospfv3-parameters/ospfv3-parameters.xhtml#ospfv3-parameters-9 */ |
2318 | | static const range_string ospfv3_instance_id_rvals[] = { |
2319 | | { 0, 0, "Base IPv6 Unicast AF" }, |
2320 | | { 1, 31, "Base IPv6 Unicast AF (local policy)" }, |
2321 | | { 32, 32, "Base IPv6 Multicast" }, |
2322 | | { 33, 63, "IPv6 Multicast AFs (local policy)" }, |
2323 | | { 64, 64, "Base IPv4 Unicast AF" }, |
2324 | | { 65, 95, "IPv4 Unicast AFs (local policy)" }, |
2325 | | { 96, 96, "Base IPv4 Multicast" }, |
2326 | | { 97, 127, "IPv4 Multicast AFs (local policy)" }, |
2327 | | { 128, 191, "Unassigned" }, |
2328 | | { 192, 255, "Private Use" }, |
2329 | | { 0, 0, NULL }, |
2330 | | }; |
2331 | | |
2332 | | /* |
2333 | | * Name : dissect_ospf_subtlv_ext_admin_group() |
2334 | | * |
2335 | | * Description : |
2336 | | * |
2337 | | * Dissect Extended Administrative Groups Sub-TLV |
2338 | | * |
2339 | | * Input : |
2340 | | * tvbuff_t * : tvbuffer for packet data |
2341 | | * proto_tree * : protocol display tree to fill out. |
2342 | | * int : offset into packet data where we are (beginning of the sub_clv value). |
2343 | | * int : subtlv type |
2344 | | * int : subtlv length |
2345 | | * |
2346 | | * Output: |
2347 | | * void |
2348 | | */ |
2349 | | static void |
2350 | | dissect_ospf_subtlv_ext_admin_group(tvbuff_t *tvb, proto_tree *tree, |
2351 | | int offset, int subtype _U_, int sublen) |
2352 | 1.77k | { |
2353 | 1.77k | int i; |
2354 | 1.77k | uint32_t admin_group; |
2355 | | |
2356 | | /* Number of Extended Admin Groups */ |
2357 | 3.07k | for (i = 0; i < (sublen / 4); i++) { |
2358 | 1.30k | admin_group = tvb_get_uint32(tvb, offset + (i * 4), ENC_BIG_ENDIAN); |
2359 | 1.30k | proto_tree_add_uint_format(tree, hf_ospf_ls_ext_admin_group, |
2360 | 1.30k | tvb, offset + (i * 4), 4, admin_group, |
2361 | 1.30k | "Extended Admin Group[%d]: 0x%08x", |
2362 | 1.30k | i, admin_group); |
2363 | 1.30k | } |
2364 | 1.77k | } |
2365 | | |
2366 | | /* |
2367 | | * Dissect MPLS/TE opaque LSA |
2368 | | */ |
2369 | | static void |
2370 | | dissect_ospf_lsa_mpls(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, |
2371 | | uint32_t length) |
2372 | 1.27k | { |
2373 | 1.27k | proto_item *ti, *hidden_item; |
2374 | 1.27k | proto_tree *mpls_tree, *cs_tree, *label_tree, *grid_tree; |
2375 | 1.27k | proto_tree *tlv_tree; |
2376 | 1.27k | proto_tree *stlv_tree; |
2377 | 1.27k | proto_tree *sstlv_tree; |
2378 | 1.27k | proto_tree *stlv_admingrp_tree = NULL; |
2379 | | |
2380 | 1.27k | int tlv_type; |
2381 | 1.27k | int tlv_length; |
2382 | 1.27k | int tlv_end_offset; |
2383 | | |
2384 | 1.27k | int stlv_type, stlv_len, stlv_offset; |
2385 | 1.27k | int sstlv_type, sstlv_len, sstlv_offset; |
2386 | 1.27k | int bitmap_length, no_eff_bits, nb_octets; |
2387 | 1.27k | int bitmap_offset, bitmap_end_offset; |
2388 | 1.27k | uint8_t grid; |
2389 | 1.27k | const char *stlv_name; |
2390 | 1.27k | const char *sstlv_name; |
2391 | 1.27k | uint32_t stlv_admingrp, mask, reserved; |
2392 | 1.27k | int i; |
2393 | 1.27k | uint8_t switch_cap; |
2394 | 1.27k | uint8_t action; |
2395 | 1.27k | float tmp_float; |
2396 | | |
2397 | 1.27k | static const value_string lambda_grid_vals[] = { |
2398 | 1.27k | { 1, "DWDM"}, |
2399 | 1.27k | { 2, "CWDM"}, |
2400 | 1.27k | { 3, "Flexi"}, |
2401 | 1.27k | { 0, NULL } |
2402 | 1.27k | }; |
2403 | | |
2404 | 1.27k | static const value_string grid1_cs_vals[] = { |
2405 | 1.27k | { 1, "100GHz"}, |
2406 | 1.27k | { 2, "50GHz"}, |
2407 | 1.27k | { 3, "25GHz"}, |
2408 | 1.27k | { 4, "12.5GHz"}, |
2409 | 1.27k | { 0, NULL } |
2410 | 1.27k | }; |
2411 | 1.27k | static const value_string grid2_cs_vals[] = { |
2412 | 1.27k | { 1, "20nm"}, |
2413 | 1.27k | { 0, NULL } |
2414 | 1.27k | }; |
2415 | 1.27k | static const value_string grid3_cs_vals[] = { |
2416 | 1.27k | { 5, "6.25GHz"}, |
2417 | 1.27k | { 0, NULL } |
2418 | 1.27k | }; |
2419 | | |
2420 | 1.27k | static const uint8_t allzero[] = { 0x00, 0x00, 0x00 }; |
2421 | 1.27k | unsigned num_bcs = 0; |
2422 | | |
2423 | 1.27k | mpls_tree = proto_tree_add_subtree(tree, tvb, offset, length, |
2424 | 1.27k | ett_ospf_lsa_mpls, NULL, "MPLS Traffic Engineering LSA"); |
2425 | 1.27k | hidden_item = proto_tree_add_item(tree, hf_ospf_ls_mpls, |
2426 | 1.27k | tvb, offset, 2, ENC_BIG_ENDIAN); |
2427 | 1.27k | proto_item_set_hidden(hidden_item); |
2428 | | |
2429 | 5.81k | while (length != 0) { |
2430 | 5.70k | tlv_type = tvb_get_ntohs(tvb, offset); |
2431 | 5.70k | tlv_length = tvb_get_ntohs(tvb, offset + 2); |
2432 | 5.70k | tlv_end_offset = offset + tlv_length + 4; |
2433 | | |
2434 | 5.70k | switch (tlv_type) { |
2435 | | |
2436 | 251 | case MPLS_TLV_ROUTER: |
2437 | 251 | tlv_tree = proto_tree_add_subtree_format(mpls_tree, tvb, offset, tlv_length+4, |
2438 | 251 | ett_ospf_lsa_mpls_router, NULL, "Router Address: %s", |
2439 | 251 | tvb_ip_to_str(pinfo->pool, tvb, offset+4)); |
2440 | 251 | proto_tree_add_uint_format_value(tlv_tree, hf_ospf_tlv_type, tvb, offset, 2, tlv_type, "1 - Router Address"); |
2441 | 251 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
2442 | 251 | proto_tree_add_item(tlv_tree, hf_ospf_ls_mpls_routerid, |
2443 | 251 | tvb, offset+4, 4, ENC_BIG_ENDIAN); |
2444 | 251 | break; |
2445 | | |
2446 | 2.88k | case MPLS_TLV_LINK: |
2447 | 2.88k | tlv_tree = proto_tree_add_subtree(mpls_tree, tvb, offset, tlv_length+4, |
2448 | 2.88k | ett_ospf_lsa_mpls_link, NULL, "Link Information"); |
2449 | 2.88k | proto_tree_add_uint_format_value(tlv_tree, hf_ospf_tlv_type, tvb, offset, 2, tlv_type, "2 - Link Information"); |
2450 | 2.88k | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
2451 | 2.88k | stlv_offset = offset + 4; |
2452 | | |
2453 | | /* Walk down the sub-TLVs for link information */ |
2454 | 11.7k | while (stlv_offset < tlv_end_offset) { |
2455 | 9.61k | stlv_type = tvb_get_ntohs(tvb, stlv_offset); |
2456 | 9.61k | stlv_len = tvb_get_ntohs(tvb, stlv_offset + 2); |
2457 | 9.61k | stlv_name = val_to_str_const(stlv_type, mpls_link_stlv_str, "Unknown sub-TLV"); |
2458 | 9.61k | switch (stlv_type) { |
2459 | | |
2460 | 198 | case MPLS_LINK_TYPE: |
2461 | 198 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2462 | 198 | ett_ospf_lsa_mpls_link_stlv, NULL, "%s: %u - %s", stlv_name, |
2463 | 198 | tvb_get_uint8(tvb, stlv_offset + 4), |
2464 | 198 | val_to_str_const(tvb_get_uint8(tvb, stlv_offset + 4), |
2465 | 198 | mpls_link_stlv_ltype_str, "Unknown Link Type")); |
2466 | 198 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2467 | 198 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2468 | 198 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2469 | 198 | proto_tree_add_item(stlv_tree, hf_ospf_ls_mpls_linktype, |
2470 | 198 | tvb, stlv_offset+4, 1,ENC_BIG_ENDIAN); |
2471 | 198 | break; |
2472 | | |
2473 | 198 | case MPLS_LINK_ID: |
2474 | 198 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2475 | 198 | ett_ospf_lsa_mpls_link_stlv, NULL, "%s: %s", stlv_name, |
2476 | 198 | tvb_ip_to_str(pinfo->pool, tvb, stlv_offset + 4)); |
2477 | 198 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2478 | 198 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2479 | 198 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2480 | 198 | proto_tree_add_item(stlv_tree, hf_ospf_ls_mpls_linkid, |
2481 | 198 | tvb, stlv_offset+4, 4, ENC_BIG_ENDIAN); |
2482 | 198 | break; |
2483 | | |
2484 | 360 | case MPLS_LINK_LOCAL_IF: |
2485 | 883 | case MPLS_LINK_REMOTE_IF: |
2486 | 883 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2487 | 883 | ett_ospf_lsa_mpls_link_stlv, NULL, "%s: %s", stlv_name, |
2488 | 883 | tvb_ip_to_str(pinfo->pool, tvb, stlv_offset + 4)); |
2489 | 883 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2490 | 883 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2491 | 883 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2492 | | /* The Local/Remote Interface IP Address sub-TLV is TLV type 3/4, and is 4N |
2493 | | octets in length, where N is the number of neighbor addresses. */ |
2494 | 1.69k | for (i=0; i < stlv_len; i+=4) |
2495 | 809 | proto_tree_add_item(stlv_tree, |
2496 | 809 | stlv_type==MPLS_LINK_LOCAL_IF ? |
2497 | 347 | hf_ospf_ls_mpls_local_addr : |
2498 | 809 | hf_ospf_ls_mpls_remote_addr, |
2499 | 809 | tvb, stlv_offset+4+i, 4, ENC_BIG_ENDIAN); |
2500 | 883 | break; |
2501 | | |
2502 | 196 | case MPLS_LINK_TE_METRIC: |
2503 | 196 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2504 | 196 | ett_ospf_lsa_mpls_link_stlv, NULL, "%s: %u", stlv_name, |
2505 | 196 | tvb_get_ntohl(tvb, stlv_offset + 4)); |
2506 | 196 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2507 | 196 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2508 | 196 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2509 | 196 | proto_tree_add_uint_format(stlv_tree, hf_ospf_ls_mpls_te_metric, tvb, stlv_offset+4, 4, |
2510 | 196 | tvb_get_ntohl(tvb, stlv_offset + 4), "%s: %u", stlv_name, |
2511 | 196 | tvb_get_ntohl(tvb, stlv_offset + 4)); |
2512 | 196 | break; |
2513 | | |
2514 | 864 | case MPLS_LINK_COLOR: |
2515 | 864 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2516 | 864 | ett_ospf_lsa_mpls_link_stlv, NULL, "%s: 0x%08x", stlv_name, |
2517 | 864 | tvb_get_ntohl(tvb, stlv_offset + 4)); |
2518 | 864 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2519 | 864 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2520 | 864 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2521 | 864 | stlv_admingrp = tvb_get_ntohl(tvb, stlv_offset + 4); |
2522 | 864 | mask = 1; |
2523 | 864 | ti = proto_tree_add_item(stlv_tree, hf_ospf_ls_mpls_linkcolor, |
2524 | 864 | tvb, stlv_offset+4, 4, ENC_BIG_ENDIAN); |
2525 | 864 | stlv_admingrp_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv_admingrp); |
2526 | 864 | if (stlv_admingrp_tree == NULL) |
2527 | 0 | return; |
2528 | 28.3k | for (i = 0 ; i < 32 ; i++) { |
2529 | 27.5k | if ((stlv_admingrp & mask) != 0) { |
2530 | 2.17k | proto_tree_add_uint_format(stlv_admingrp_tree, hf_ospf_ls_mpls_group, tvb, stlv_offset+4, |
2531 | 2.17k | 4, 1 << i, "Group %d", i); |
2532 | 2.17k | } |
2533 | 27.5k | mask <<= 1; |
2534 | 27.5k | } |
2535 | 864 | break; |
2536 | | |
2537 | 194 | case MPLS_LINK_MAX_BW: |
2538 | 400 | case MPLS_LINK_MAX_RES_BW: |
2539 | 400 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2540 | 400 | ett_ospf_lsa_mpls_link_stlv, NULL, "%s: %.10g bytes/s (%.0f bits/s)", stlv_name, |
2541 | 400 | tvb_get_ntohieee_float(tvb, stlv_offset + 4), |
2542 | 400 | tvb_get_ntohieee_float(tvb, stlv_offset + 4) * 8.0); |
2543 | 400 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2544 | 400 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2545 | 400 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2546 | 400 | proto_tree_add_float_format(stlv_tree, hf_ospf_ls_mpls_link_max_bw, tvb, stlv_offset+4, 4, |
2547 | 400 | tvb_get_ntohieee_float(tvb, stlv_offset + 4), "%s: %.10g bytes/s (%.0f bits/s)", stlv_name, |
2548 | 400 | tvb_get_ntohieee_float(tvb, stlv_offset + 4), |
2549 | 400 | tvb_get_ntohieee_float(tvb, stlv_offset + 4) * 8.0); |
2550 | 400 | break; |
2551 | | |
2552 | 238 | case MPLS_LINK_UNRES_BW: |
2553 | 238 | stlv_tree = proto_tree_add_subtree(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2554 | 238 | ett_ospf_lsa_mpls_link_stlv, NULL, stlv_name); |
2555 | 238 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2556 | 238 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2557 | 238 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2558 | 2.08k | for (i = 0; i < 8; i++) { |
2559 | 1.84k | tmp_float = tvb_get_ntohieee_float(tvb, stlv_offset + 4 + i*4); |
2560 | 1.84k | proto_tree_add_float_format(stlv_tree, hf_ospf_ls_mpls_pri, tvb, stlv_offset+4+(i*4), 4, |
2561 | 1.84k | tmp_float, "Pri (or TE-Class) %d: %.10g bytes/s (%.0f bits/s)", i, |
2562 | 1.84k | tmp_float, tmp_float * 8.0); |
2563 | 1.84k | } |
2564 | 238 | break; |
2565 | | |
2566 | 1.11k | case MPLS_LINK_BANDWIDTH_CONSTRAINT: |
2567 | | /* |
2568 | | The "Bandwidth Constraints" sub-TLV format is illustrated below: |
2569 | | |
2570 | | 0 1 2 3 |
2571 | | 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 |
2572 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2573 | | | BC Model Id | Reserved | |
2574 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2575 | | | BC0 value | |
2576 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2577 | | // . . . // |
2578 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2579 | | | BCh value | |
2580 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2581 | | */ |
2582 | | |
2583 | 1.11k | stlv_tree = proto_tree_add_subtree(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2584 | 1.11k | ett_ospf_lsa_mpls_link_stlv, NULL, stlv_name); |
2585 | | |
2586 | 1.11k | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2587 | 1.11k | stlv_type, "%u: %s", stlv_type, stlv_name); |
2588 | | |
2589 | 1.11k | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2590 | | |
2591 | 1.11k | proto_tree_add_item(stlv_tree, hf_ospf_ls_mpls_bc_model_id, |
2592 | 1.11k | tvb, stlv_offset+4, 1, ENC_BIG_ENDIAN); |
2593 | | |
2594 | | /* 3 octets reserved +5, +6 and +7 (all 0x00) */ |
2595 | 1.11k | if(tvb_memeql(tvb, stlv_offset+5, allzero, 3) == -1) { |
2596 | 1.02k | proto_tree_add_expert_format(stlv_tree, pinfo, &ei_ospf_header_reserved, |
2597 | 1.02k | tvb, stlv_offset+5, 3, |
2598 | 1.02k | "These bytes are reserved and must be 0x00"); |
2599 | 1.02k | } |
2600 | | |
2601 | 1.11k | if(((stlv_len % 4)!=0)) { |
2602 | 401 | proto_tree_add_expert_format(stlv_tree, pinfo, &ei_ospf_lsa_bad_length, tvb, stlv_offset+4, stlv_len, |
2603 | 401 | "Malformed Packet: Length must be N x 4 octets"); |
2604 | 401 | break; |
2605 | 401 | } |
2606 | | |
2607 | | /* stlv_len should range from 4 to 36 bytes */ |
2608 | 712 | num_bcs = (stlv_len - 4)/4; |
2609 | | |
2610 | 712 | if(num_bcs>8) { |
2611 | 501 | proto_tree_add_expert_format(stlv_tree, pinfo, &ei_ospf_lsa_bc_error, tvb, stlv_offset+4, stlv_len, |
2612 | 501 | "Malformed Packet: too many BC (%u)", num_bcs); |
2613 | 501 | break; |
2614 | 501 | } |
2615 | | |
2616 | 211 | if(num_bcs==0) { |
2617 | 73 | proto_tree_add_expert_format(stlv_tree, pinfo, &ei_ospf_lsa_bc_error, tvb, stlv_offset+4, stlv_len, |
2618 | 73 | "Malformed Packet: Bandwidth Constraints sub-TLV with no BC?"); |
2619 | 73 | break; |
2620 | 73 | } |
2621 | | |
2622 | 574 | for(i = 0; i < (int) num_bcs; i++) { |
2623 | 436 | tmp_float = tvb_get_ntohieee_float(tvb, stlv_offset + 8 + i*4); |
2624 | 436 | proto_tree_add_float_format(stlv_tree, hf_ospf_ls_mpls_bc, tvb, stlv_offset+8+(i*4), 4, |
2625 | 436 | tmp_float, "BC %d: %.10g bytes/s (%.0f bits/s)", i, |
2626 | 436 | tmp_float, tmp_float * 8.0); |
2627 | 436 | } |
2628 | 138 | break; |
2629 | | |
2630 | 198 | case MPLS_LINK_LOCAL_REMOTE_ID: |
2631 | 198 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2632 | 198 | ett_ospf_lsa_mpls_link_stlv, NULL, "%s: %d (0x%x) - %d (0x%x)", stlv_name, |
2633 | 198 | tvb_get_ntohl(tvb, stlv_offset + 4), |
2634 | 198 | tvb_get_ntohl(tvb, stlv_offset + 4), |
2635 | 198 | tvb_get_ntohl(tvb, stlv_offset + 8), |
2636 | 198 | tvb_get_ntohl(tvb, stlv_offset + 8)); |
2637 | | |
2638 | 198 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2639 | 198 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2640 | 198 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2641 | 198 | proto_tree_add_item(stlv_tree, |
2642 | 198 | hf_ospf_ls_mpls_local_ifid, |
2643 | 198 | tvb, stlv_offset+4, 4, ENC_BIG_ENDIAN); |
2644 | 198 | proto_tree_add_item(stlv_tree, |
2645 | 198 | hf_ospf_ls_mpls_remote_ifid, |
2646 | 198 | tvb, stlv_offset+8, 4, ENC_BIG_ENDIAN); |
2647 | 198 | break; |
2648 | | |
2649 | 1.81k | case MPLS_LINK_IF_SWITCHING_DESC: |
2650 | 1.81k | stlv_tree = proto_tree_add_subtree(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2651 | 1.81k | ett_ospf_lsa_mpls_link_stlv, NULL, stlv_name); |
2652 | 1.81k | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2653 | 1.81k | stlv_type, "%u: %s", stlv_type, stlv_name); |
2654 | 1.81k | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2655 | 1.81k | switch_cap = tvb_get_uint8 (tvb, stlv_offset + 4); |
2656 | 1.81k | proto_tree_add_item(stlv_tree, hf_ospf_mpls_switching_type, tvb, stlv_offset + 4, 1, ENC_BIG_ENDIAN); |
2657 | 1.81k | proto_tree_add_item(stlv_tree, hf_ospf_mpls_encoding, tvb, stlv_offset+5, 1, ENC_BIG_ENDIAN); |
2658 | 16.2k | for (i = 0; i < 8; i++) { |
2659 | 14.4k | tmp_float = tvb_get_ntohieee_float(tvb, stlv_offset + 8 + i*4); |
2660 | 14.4k | proto_tree_add_float_format(stlv_tree, hf_ospf_ls_mpls_pri, tvb, stlv_offset+8+(i*4), 4, |
2661 | 14.4k | tmp_float, "Pri %d: %.10g bytes/s (%.0f bits/s)", i, |
2662 | 14.4k | tmp_float, tmp_float * 8.0); |
2663 | 14.4k | } |
2664 | 1.81k | if (switch_cap >=1 && switch_cap <=4) { /* PSC-1 .. PSC-4 */ |
2665 | 392 | tmp_float = tvb_get_ntohieee_float(tvb, stlv_offset + 40); |
2666 | 392 | proto_tree_add_float_format_value(stlv_tree, hf_ospf_mpls_minimum_lsp_bandwidth, tvb, stlv_offset+40, 4, |
2667 | 392 | tmp_float, "%.10g bytes/s (%.0f bits/s)", |
2668 | 392 | tmp_float, tmp_float * 8.0); |
2669 | 392 | proto_tree_add_item(stlv_tree, hf_ospf_mpls_interface_mtu, tvb, stlv_offset+44, 2, ENC_BIG_ENDIAN); |
2670 | 392 | } |
2671 | | |
2672 | 1.81k | if (switch_cap == 100) { /* TDM */ |
2673 | 68 | tmp_float = tvb_get_ntohieee_float(tvb, stlv_offset + 40); |
2674 | 68 | proto_tree_add_float_format_value(stlv_tree, hf_ospf_mpls_minimum_lsp_bandwidth, tvb, stlv_offset+40, 4, |
2675 | 68 | tmp_float, "%.10g bytes/s (%.0f bits/s)", |
2676 | 68 | tmp_float, tmp_float * 8.0); |
2677 | 68 | proto_tree_add_item(stlv_tree, hf_ospf_mpls_sonet_sdh, tvb, stlv_offset+44, 1, ENC_NA); |
2678 | 68 | } |
2679 | 1.81k | if (switch_cap == 150) { |
2680 | 316 | if(tvb_get_ntohs(tvb, stlv_offset+2) > 36){ |
2681 | 242 | sstlv_offset = stlv_offset + 40; |
2682 | 242 | sstlv_type = tvb_get_ntohs(tvb, sstlv_offset); |
2683 | 242 | sstlv_len = tvb_get_ntohs(tvb, sstlv_offset + 2); |
2684 | 242 | sstlv_name = val_to_str_const(sstlv_type, mpls_bandwidth_sstlv_str, "Unknown sub-TLV"); |
2685 | | |
2686 | 242 | sstlv_tree = proto_tree_add_subtree(stlv_tree, tvb, sstlv_offset, sstlv_len,ett_ospf_lsa_mpls_bandwidth_sstlv, NULL, sstlv_name); |
2687 | 242 | proto_tree_add_item(sstlv_tree, hf_ospf_mpls_bandwidth_type, tvb, sstlv_offset, 2, ENC_BIG_ENDIAN); |
2688 | 242 | proto_tree_add_item(sstlv_tree, hf_ospf_mpls_length, tvb, sstlv_offset + 2, 2, ENC_BIG_ENDIAN); |
2689 | 242 | proto_tree_add_item(sstlv_tree, hf_ospf_mpls_pri, tvb, sstlv_offset + 4, 1, ENC_NA); |
2690 | 242 | proto_tree_add_item_ret_uint8(sstlv_tree, hf_ospf_mpls_action, tvb, sstlv_offset + 8, 1, ENC_NA, &action); |
2691 | 242 | proto_tree_add_item(sstlv_tree, hf_ospf_mpls_num_labels, tvb, sstlv_offset + 8, 2, ENC_BIG_ENDIAN); |
2692 | 242 | proto_tree_add_item(sstlv_tree, hf_ospf_mpls_length, tvb, sstlv_offset + 10, 2, ENC_BIG_ENDIAN); |
2693 | 242 | bitmap_length = tvb_get_ntohs(tvb, sstlv_offset + 10); |
2694 | 242 | if(action == 4){ |
2695 | 155 | bitmap_offset = sstlv_offset + 16; |
2696 | 155 | bitmap_end_offset = sstlv_offset + 8 + bitmap_length; |
2697 | 155 | label_tree = proto_tree_add_subtree(sstlv_tree, tvb, sstlv_offset + 12, 4,ett_ospf_lsa_mpls_bandwidth_sstlv, NULL, "Base label"); |
2698 | 155 | proto_tree_add_item(label_tree, hf_ospf_mpls_grid, tvb, sstlv_offset + 12, 1, ENC_NA); |
2699 | 155 | proto_tree_add_item(label_tree, hf_ospf_mpls_cs2, tvb, sstlv_offset + 12, 1, ENC_NA); |
2700 | 155 | proto_tree_add_item(label_tree, hf_ospf_mpls_n, tvb, sstlv_offset + 14, 2, ENC_BIG_ENDIAN); |
2701 | 544 | while(bitmap_offset < bitmap_end_offset){ |
2702 | 389 | proto_tree_add_item(sstlv_tree, hf_ospf_mpls_bitmap, tvb, bitmap_offset, 4, ENC_BIG_ENDIAN); |
2703 | 389 | bitmap_offset += 4; |
2704 | 389 | } |
2705 | 155 | } |
2706 | 242 | } |
2707 | 316 | } |
2708 | | |
2709 | | /* WSON_LSC, see RFC 7579 */ |
2710 | 1.81k | if (switch_cap == 151) { |
2711 | 432 | sstlv_offset = stlv_offset + 40; |
2712 | 432 | sstlv_type = tvb_get_ntohs(tvb, sstlv_offset); |
2713 | 432 | sstlv_len = tvb_get_ntohs(tvb, sstlv_offset + 2); |
2714 | 432 | sstlv_name = val_to_str_const(sstlv_type, mpls_bandwidth_sstlv_str, "Unknown sub-TLV"); |
2715 | 432 | sstlv_tree = proto_tree_add_subtree(stlv_tree, tvb, sstlv_offset, sstlv_len,ett_ospf_lsa_mpls_bandwidth_sstlv, NULL, sstlv_name); |
2716 | 432 | proto_tree_add_item(sstlv_tree, hf_ospf_mpls_bandwidth_type, tvb, sstlv_offset, 2, ENC_BIG_ENDIAN); |
2717 | 432 | proto_tree_add_item(sstlv_tree, hf_ospf_mpls_length, tvb, sstlv_offset + 2, 2, ENC_BIG_ENDIAN); |
2718 | 432 | proto_tree_add_item(sstlv_tree, hf_ospf_mpls_pri, tvb, sstlv_offset + 4, 1, ENC_NA); |
2719 | 432 | proto_tree_add_item_ret_uint8(sstlv_tree, hf_ospf_mpls_action, tvb, sstlv_offset + 8, 1, ENC_NA, &action); |
2720 | 432 | proto_tree_add_item(sstlv_tree, hf_ospf_mpls_num_labels, tvb, sstlv_offset+8, 2, ENC_BIG_ENDIAN); |
2721 | 432 | proto_tree_add_item(sstlv_tree, hf_ospf_mpls_length, tvb, sstlv_offset + 10, 2, ENC_BIG_ENDIAN); |
2722 | 432 | bitmap_length = tvb_get_ntohs(tvb, sstlv_offset + 10); |
2723 | 432 | if(action == 4){ |
2724 | 289 | bitmap_offset = sstlv_offset + 16; |
2725 | 289 | bitmap_end_offset = sstlv_offset + 8 + bitmap_length; |
2726 | 289 | grid =((tvb_get_uint8(tvb, sstlv_offset + 12) & 0xE0) >> 5); |
2727 | 289 | label_tree = proto_tree_add_subtree(sstlv_tree, tvb, sstlv_offset + 12, 4,ett_ospf_lsa_mpls_bandwidth_sstlv, NULL, "Base label"); |
2728 | 289 | grid_tree = proto_tree_add_item(label_tree, hf_ospf_mpls_grid, tvb, sstlv_offset + 12, 1, ENC_NA); |
2729 | 289 | proto_item_set_text(grid_tree, "Grid: %s (%u)",val_to_str_const(grid, lambda_grid_vals, "Unknown"), |
2730 | 289 | (grid )); |
2731 | 289 | switch(grid){ |
2732 | 93 | case 1: |
2733 | 93 | cs_tree = proto_tree_add_item(label_tree, hf_ospf_mpls_cs2, tvb, stlv_offset + 12, 1, ENC_NA); |
2734 | 93 | 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"), |
2735 | 93 | (tvb_get_uint8(tvb, stlv_offset + 12) & 0x1E) >> 1 ); |
2736 | 93 | break; |
2737 | 102 | case 2: |
2738 | 102 | cs_tree = proto_tree_add_item(label_tree, hf_ospf_mpls_cs2, tvb, stlv_offset + 12, 1, ENC_NA); |
2739 | 102 | 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"), |
2740 | 102 | (tvb_get_uint8(tvb, stlv_offset + 12) & 0x1E) >> 1 ); |
2741 | 102 | break; |
2742 | 93 | default: |
2743 | 93 | proto_tree_add_item(label_tree, hf_ospf_mpls_cs2, tvb, sstlv_offset + 12, 1, ENC_NA); |
2744 | 93 | break; |
2745 | 289 | } |
2746 | 288 | proto_tree_add_item(label_tree, hf_ospf_mpls_n, tvb, sstlv_offset + 14, 2, ENC_BIG_ENDIAN); |
2747 | 891 | while(bitmap_offset < bitmap_end_offset){ |
2748 | 603 | proto_tree_add_item(sstlv_tree, hf_ospf_mpls_bitmap, tvb, bitmap_offset, 4, ENC_BIG_ENDIAN); |
2749 | 603 | bitmap_offset += 4; |
2750 | 603 | } |
2751 | 288 | } |
2752 | 432 | } |
2753 | | /* flexi-grid_lsc, see RFC 8363 */ |
2754 | 1.81k | if (switch_cap == 152){ |
2755 | 223 | bitmap_offset = stlv_offset + 40 + 16; |
2756 | 223 | no_eff_bits = tvb_get_ntohs(tvb, stlv_offset + 54) & 0x0FFF; |
2757 | 223 | if(no_eff_bits % 32 == 0){ |
2758 | 74 | nb_octets = (( no_eff_bits / 32 ) * 4); |
2759 | 74 | } |
2760 | 149 | else{ |
2761 | 149 | nb_octets = ((( no_eff_bits / 32 ) + 1 ) * 4); |
2762 | 149 | } |
2763 | 223 | bitmap_end_offset = bitmap_offset + nb_octets; |
2764 | 223 | proto_tree_add_item(stlv_tree, hf_ospf_mpls_type, tvb, stlv_offset + 40, 2, ENC_BIG_ENDIAN); |
2765 | 223 | proto_tree_add_item(stlv_tree, hf_ospf_mpls_length, tvb, stlv_offset + 42, 2, ENC_BIG_ENDIAN); |
2766 | 223 | proto_tree_add_item(stlv_tree, hf_ospf_mpls_pri, tvb, stlv_offset + 44, 1, ENC_NA); |
2767 | 223 | cs_tree = proto_tree_add_item(stlv_tree, hf_ospf_mpls_cs, tvb, stlv_offset + 52, 1, ENC_NA); |
2768 | 223 | 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"), |
2769 | 223 | (tvb_get_uint8(tvb, stlv_offset + 52) & 0xF0) >> 4 ); |
2770 | 223 | proto_tree_add_item(stlv_tree, hf_ospf_mpls_starting, tvb, stlv_offset + 52, 4, ENC_BIG_ENDIAN); |
2771 | 223 | proto_tree_add_item(stlv_tree, hf_ospf_mpls_no_effective_bits, tvb, stlv_offset + 54, 2, ENC_BIG_ENDIAN); |
2772 | 613 | while(bitmap_offset < bitmap_end_offset){ |
2773 | 390 | proto_tree_add_item(stlv_tree, hf_ospf_mpls_bitmap, tvb, bitmap_offset, 4, ENC_BIG_ENDIAN); |
2774 | 390 | bitmap_offset += 4; |
2775 | 390 | } |
2776 | 223 | } |
2777 | 1.81k | break; |
2778 | 203 | case MPLS_LINK_PROTECTION: |
2779 | 203 | stlv_tree = proto_tree_add_subtree(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2780 | 203 | ett_ospf_lsa_mpls_link_stlv, NULL, stlv_name); |
2781 | 203 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2782 | 203 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2783 | 203 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2784 | 203 | proto_tree_add_item(stlv_tree, hf_ospf_mpls_protection_capability, tvb, stlv_offset+4, 1, ENC_BIG_ENDIAN); |
2785 | 203 | break; |
2786 | | |
2787 | 297 | case MPLS_LINK_SHARED_RISK_GROUP: |
2788 | 297 | stlv_tree = proto_tree_add_subtree(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2789 | 297 | ett_ospf_lsa_mpls_link_stlv, NULL, stlv_name); |
2790 | 297 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2791 | 297 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2792 | 297 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2793 | 605 | for (i=0; i < stlv_len; i+=4) |
2794 | 308 | proto_tree_add_item(stlv_tree, hf_ospf_mpls_shared_risk_link_group, tvb, stlv_offset+4+i, 4, ENC_BIG_ENDIAN); |
2795 | 297 | break; |
2796 | | |
2797 | 310 | case MPLS_LINK_EXT_ADMIN_GROUP: |
2798 | 310 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2799 | 310 | ett_ospf_lsa_mpls_link_stlv, NULL, |
2800 | 310 | "%s", stlv_name); |
2801 | 310 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2802 | 310 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2803 | 310 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2804 | 310 | dissect_ospf_subtlv_ext_admin_group(tvb, stlv_tree, stlv_offset+4, stlv_type, stlv_len); |
2805 | 310 | break; |
2806 | | |
2807 | 196 | case MPLS_LINK_UNIDIR_LINK_DELAY: |
2808 | 196 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2809 | 196 | ett_ospf_lsa_mpls_link_stlv, NULL, |
2810 | 196 | "%s: %u usec", stlv_name, |
2811 | 196 | tvb_get_uint24(tvb, stlv_offset + 5, ENC_BIG_ENDIAN)); |
2812 | 196 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2813 | 196 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2814 | 196 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2815 | 196 | ti = proto_tree_add_bitmask(stlv_tree, tvb, stlv_offset+4, |
2816 | 196 | hf_ospf_ls_unidir_link_flags, |
2817 | 196 | ett_ospf_lsa_unidir_link_flags, |
2818 | 196 | unidir_link_flags, ENC_NA); |
2819 | 196 | reserved = tvb_get_uint8(tvb, stlv_offset) & 0x7f; |
2820 | 196 | if (reserved != 0) { |
2821 | 0 | expert_add_info_format(pinfo, ti, &ei_ospf_header_reserved, |
2822 | 0 | "Reserved field should be 0"); |
2823 | 0 | } |
2824 | 196 | proto_tree_add_item(stlv_tree, hf_ospf_ls_unidir_link_delay, tvb, stlv_offset+5, 3, ENC_BIG_ENDIAN); |
2825 | 196 | break; |
2826 | | |
2827 | 294 | case MPLS_LINK_UNIDIR_LINK_DELAY_MIN_MAX: |
2828 | 294 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2829 | 294 | ett_ospf_lsa_mpls_link_stlv, NULL, |
2830 | 294 | "%s: Min/Max %u/%u usec", stlv_name, |
2831 | 294 | tvb_get_uint24(tvb, stlv_offset + 5, ENC_BIG_ENDIAN), |
2832 | 294 | tvb_get_uint24(tvb, stlv_offset + 9, ENC_BIG_ENDIAN)); |
2833 | 294 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2834 | 294 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2835 | 294 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2836 | 294 | ti = proto_tree_add_bitmask(stlv_tree, tvb, stlv_offset+4, |
2837 | 294 | hf_ospf_ls_unidir_link_flags, |
2838 | 294 | ett_ospf_lsa_unidir_link_flags, |
2839 | 294 | unidir_link_flags, ENC_NA); |
2840 | 294 | reserved = tvb_get_uint8(tvb, stlv_offset) & 0x7f; |
2841 | 294 | if (reserved != 0) { |
2842 | 0 | expert_add_info_format(pinfo, ti, &ei_ospf_header_reserved, |
2843 | 0 | "Reserved field should be 0"); |
2844 | 0 | } |
2845 | 294 | proto_tree_add_item(stlv_tree, hf_ospf_ls_unidir_link_delay_min, tvb, stlv_offset+5, 3, ENC_BIG_ENDIAN); |
2846 | 294 | ti = proto_tree_add_item_ret_uint(stlv_tree, hf_ospf_ls_unidir_link_reserved, tvb, stlv_offset+8, 1, ENC_NA, &reserved); |
2847 | 294 | if (reserved != 0) { |
2848 | 75 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
2849 | 75 | } |
2850 | 294 | proto_tree_add_item(stlv_tree, hf_ospf_ls_unidir_link_delay_max, tvb, stlv_offset+9, 3, ENC_BIG_ENDIAN); |
2851 | 294 | break; |
2852 | | |
2853 | 396 | case MPLS_LINK_UNIDIR_DELAY_VARIATION: |
2854 | 396 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2855 | 396 | ett_ospf_lsa_mpls_link_stlv, NULL, |
2856 | 396 | "%s: %u usec", stlv_name, |
2857 | 396 | tvb_get_uint24(tvb, stlv_offset + 5, ENC_BIG_ENDIAN)); |
2858 | 396 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2859 | 396 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2860 | 396 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2861 | 396 | ti = proto_tree_add_item_ret_uint(stlv_tree, hf_ospf_ls_unidir_link_reserved, tvb, stlv_offset+4, 1, ENC_NA, &reserved); |
2862 | 396 | if (reserved != 0) { |
2863 | 194 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
2864 | 194 | } |
2865 | 396 | proto_tree_add_item(stlv_tree, hf_ospf_ls_unidir_delay_variation, tvb, stlv_offset+5, 3, ENC_BIG_ENDIAN); |
2866 | 396 | break; |
2867 | | |
2868 | 194 | case OIF_LOCAL_NODE_ID: |
2869 | 194 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2870 | 194 | ett_ospf_lsa_mpls_link_stlv, NULL, "%s: %s", stlv_name, |
2871 | 194 | tvb_ip_to_str(pinfo->pool, tvb, stlv_offset + 4)); |
2872 | 194 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2873 | 194 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2874 | 194 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2875 | 194 | proto_tree_add_item(stlv_tree, |
2876 | 194 | hf_ospf_ls_oif_local_node_id, |
2877 | 194 | tvb, stlv_offset + 4, 4, ENC_BIG_ENDIAN); |
2878 | 194 | break; |
2879 | | |
2880 | 259 | case OIF_REMOTE_NODE_ID: |
2881 | 259 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2882 | 259 | ett_ospf_lsa_mpls_link_stlv, NULL, "%s: %s", stlv_name, |
2883 | 259 | tvb_ip_to_str(pinfo->pool, tvb, stlv_offset + 4)); |
2884 | 259 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2885 | 259 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2886 | 259 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2887 | 259 | proto_tree_add_item(stlv_tree, |
2888 | 259 | hf_ospf_ls_oif_remote_node_id, |
2889 | 259 | tvb, stlv_offset + 4, 4, ENC_BIG_ENDIAN); |
2890 | 259 | break; |
2891 | | |
2892 | 348 | case OIF_SONET_SDH_SWITCHING_CAPABILITY: |
2893 | 348 | stlv_tree = proto_tree_add_subtree(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2894 | 348 | ett_ospf_lsa_mpls_link_stlv, NULL, stlv_name); |
2895 | 348 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2896 | 348 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2897 | 348 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2898 | 348 | proto_tree_add_item(stlv_tree, hf_ospf_oif_switching_cap, tvb, stlv_offset+4, 1, ENC_BIG_ENDIAN); |
2899 | 348 | proto_tree_add_item(stlv_tree, hf_ospf_oif_encoding, tvb, stlv_offset+5, 1, ENC_BIG_ENDIAN); |
2900 | 1.45k | for (i = 0; i < (stlv_len - 4) / 4; i++) { |
2901 | 1.10k | proto_tree_add_uint_format(stlv_tree, hf_ospf_oif_signal_type, tvb, stlv_offset+8+(i*4), 4, |
2902 | 1.10k | tvb_get_uint8(tvb, stlv_offset+8+(i*4)), "%s: %d free timeslots", |
2903 | 1.10k | val_to_str_ext(pinfo->pool, tvb_get_uint8(tvb, stlv_offset+8+(i*4)), |
2904 | 1.10k | &gmpls_sonet_signal_type_str_ext, |
2905 | 1.10k | "Unknown Signal Type (%d)"), |
2906 | 1.10k | tvb_get_ntoh24(tvb, stlv_offset + 9 + i*4)); |
2907 | 1.10k | } |
2908 | | |
2909 | 348 | break; |
2910 | 873 | default: |
2911 | 873 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2912 | 873 | ett_ospf_lsa_mpls_link_stlv, NULL, "Unknown Link sub-TLV: %u %s", stlv_type, |
2913 | 873 | rval_to_str_const(stlv_type, mpls_te_sub_tlv_rvals, "Unknown")); |
2914 | 873 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2915 | 873 | stlv_type, "%u: %s %s", stlv_type, stlv_name, |
2916 | 873 | rval_to_str_const(stlv_type, mpls_te_sub_tlv_rvals, "Unknown")); |
2917 | 873 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2918 | 873 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_value, tvb, stlv_offset+4, stlv_len, ENC_NA); |
2919 | 873 | break; |
2920 | 9.61k | } |
2921 | 8.90k | stlv_offset += ((stlv_len+4+3)/4)*4; |
2922 | 8.90k | } |
2923 | 2.17k | break; |
2924 | | |
2925 | 2.17k | case OIF_TLV_TNA: |
2926 | 1.45k | tlv_tree = proto_tree_add_subtree(mpls_tree, tvb, offset, tlv_length+4, |
2927 | 1.45k | ett_ospf_lsa_oif_tna, NULL, "TNA Information"); |
2928 | 1.45k | proto_tree_add_uint_format_value(tlv_tree, hf_ospf_tlv_type, tvb, offset, 2, 32768, "32768 - TNA Information"); |
2929 | 1.45k | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
2930 | 1.45k | stlv_offset = offset + 4; |
2931 | | |
2932 | | /* Walk down the sub-TLVs for TNA information */ |
2933 | 2.46k | while (stlv_offset < tlv_end_offset) { |
2934 | 1.41k | stlv_type = tvb_get_ntohs(tvb, stlv_offset); |
2935 | 1.41k | stlv_len = tvb_get_ntohs(tvb, stlv_offset + 2); |
2936 | | |
2937 | 1.41k | if (stlv_len < 4) { |
2938 | 198 | proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ospf_stlv_length_invalid, tvb, stlv_offset + 2, 2, |
2939 | 198 | "Invalid sub-TLV length: %u", stlv_len); |
2940 | 198 | break; |
2941 | 198 | } |
2942 | | |
2943 | 1.21k | stlv_name = val_to_str_const(stlv_type, oif_stlv_str, "Unknown sub-TLV"); |
2944 | 1.21k | switch (stlv_type) { |
2945 | | |
2946 | 418 | case OIF_NODE_ID: |
2947 | 418 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2948 | 418 | ett_ospf_lsa_oif_tna_stlv, NULL, "%s: %s", stlv_name, |
2949 | 418 | tvb_ip_to_str(pinfo->pool, tvb, stlv_offset + 4)); |
2950 | 418 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2951 | 418 | stlv_type, "%u: %s", stlv_type, stlv_name); |
2952 | 418 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2953 | 418 | proto_tree_add_ipv4_format(stlv_tree, hf_ospf_oif_node_id, tvb, stlv_offset+4, 4, |
2954 | 418 | tvb_get_ntohl(tvb, stlv_offset + 4), "%s: %s", stlv_name, |
2955 | 418 | tvb_ip_to_str(pinfo->pool, tvb, stlv_offset + 4)); |
2956 | 418 | break; |
2957 | | |
2958 | 66 | case OIF_TNA_IPv4_ADDRESS: |
2959 | 66 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2960 | 66 | ett_ospf_lsa_oif_tna_stlv, NULL, "%s (IPv4): %s", stlv_name, |
2961 | 66 | tvb_ip_to_str(pinfo->pool, tvb, stlv_offset + 8)); |
2962 | 66 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2963 | 66 | stlv_type, "%u: %s (IPv4)", stlv_type, stlv_name); |
2964 | 66 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2965 | 66 | proto_tree_add_item(stlv_tree, hf_ospf_oif_tna_addr_length, tvb, stlv_offset+4, 1, ENC_BIG_ENDIAN); |
2966 | 66 | proto_tree_add_item(stlv_tree, hf_ospf_oif_tna_addr_ipv4, tvb, stlv_offset+8, stlv_len - 4, ENC_BIG_ENDIAN); |
2967 | 66 | break; |
2968 | | |
2969 | 107 | case OIF_TNA_IPv6_ADDRESS: |
2970 | 107 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2971 | 107 | ett_ospf_lsa_oif_tna_stlv, NULL, "%s (IPv6): %s", stlv_name, |
2972 | 107 | tvb_ip6_to_str(pinfo->pool, tvb, stlv_offset + 8)); |
2973 | 107 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2974 | 107 | stlv_type, "%u: %s (IPv6)", stlv_type, stlv_name); |
2975 | 107 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2976 | 107 | proto_tree_add_item(stlv_tree, hf_ospf_oif_tna_addr_length, tvb, stlv_offset+4, 1, ENC_BIG_ENDIAN); |
2977 | 107 | proto_tree_add_item(stlv_tree, hf_ospf_tna_addr_ipv6, tvb, stlv_offset+8, stlv_len - 4, ENC_NA); |
2978 | 107 | break; |
2979 | | |
2980 | 451 | case OIF_TNA_NSAP_ADDRESS: |
2981 | 451 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_len+4, |
2982 | 451 | ett_ospf_lsa_oif_tna_stlv, NULL, "%s (NSAP): %s", stlv_name, |
2983 | 451 | tvb_bytes_to_str(pinfo->pool, tvb, stlv_offset + 8, stlv_len - 4)); |
2984 | 451 | proto_tree_add_uint_format_value(stlv_tree, hf_ospf_tlv_type, tvb, stlv_offset, 2, |
2985 | 451 | stlv_type, "%u: %s (NSAP)", stlv_type, stlv_name); |
2986 | 451 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset+2, 2, ENC_BIG_ENDIAN); |
2987 | 451 | proto_tree_add_item(stlv_tree, hf_ospf_oif_tna_addr_length, tvb, stlv_offset+4, 1, ENC_BIG_ENDIAN); |
2988 | 451 | proto_tree_add_item(stlv_tree, hf_ospf_tna_addr, tvb, stlv_offset+8, stlv_len - 4, ENC_NA); |
2989 | 451 | break; |
2990 | | |
2991 | 127 | default: |
2992 | 127 | proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ospf_unknown_link_subtype, tvb, stlv_offset, stlv_len+4, |
2993 | 127 | "Unknown Link sub-TLV: %u", stlv_type); |
2994 | 127 | break; |
2995 | 1.21k | } |
2996 | 1.01k | stlv_offset += ((stlv_len+4+3)/4)*4; |
2997 | 1.01k | } |
2998 | 1.25k | break; |
2999 | 1.25k | default: |
3000 | 1.01k | tlv_tree = proto_tree_add_subtree_format(mpls_tree, tvb, offset, tlv_length+4, |
3001 | 1.01k | ett_ospf_lsa_mpls_link, NULL, "Unknown LSA: %u %s", tlv_type, |
3002 | 1.01k | rval_to_str_const(tlv_type, mpls_te_tlv_rvals, "Unknown")); |
3003 | 1.01k | proto_tree_add_uint_format_value(tlv_tree, hf_ospf_tlv_type, tvb, offset, 2, tlv_type, "%u - Unknown %s", |
3004 | 1.01k | tlv_type, rval_to_str_const(tlv_type, mpls_te_tlv_rvals, "Unknown")); |
3005 | 1.01k | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
3006 | 1.01k | proto_tree_add_item(tlv_tree, hf_ospf_tlv_value, tvb, offset+4, tlv_length, ENC_NA); |
3007 | 1.01k | break; |
3008 | 5.70k | } |
3009 | | |
3010 | 4.54k | offset += tlv_length + 4; |
3011 | 4.54k | length -= tlv_length + 4; |
3012 | 4.54k | } |
3013 | 1.27k | } |
3014 | | |
3015 | | /* |
3016 | | * Dissect the TLVs within a grace-LSA as defined by RFC 3623 and 5187. |
3017 | | */ |
3018 | | static void dissect_ospf_lsa_grace_tlv (tvbuff_t *tvb, packet_info *pinfo, int offset, |
3019 | | proto_tree *tree, uint32_t length, uint8_t ospf_version) |
3020 | 579 | { |
3021 | 579 | uint16_t tlv_type; |
3022 | 579 | uint16_t tlv_length; |
3023 | 579 | unsigned tlv_total_length; /* The total length of the TLV including the type |
3024 | | and length fields and any padding */ |
3025 | 579 | uint32_t grace_period; |
3026 | 579 | uint8_t restart_reason; |
3027 | 579 | proto_tree *tlv_tree; |
3028 | 579 | proto_item *tree_item; |
3029 | | |
3030 | 3.71k | while (length > 0) |
3031 | 3.46k | { |
3032 | 3.46k | tlv_type = tvb_get_ntohs(tvb, offset); |
3033 | 3.46k | tlv_length = tvb_get_ntohs(tvb, offset + 2); |
3034 | | /* The total length of the TLV including the type, length, value and |
3035 | | * pad bytes (TLVs are padded to 4 octet alignment). |
3036 | | */ |
3037 | 3.46k | tlv_total_length = tlv_length + 4 + WS_PADDING_TO_4(tlv_length); |
3038 | | |
3039 | 3.46k | tree_item = proto_tree_add_item(tree, hf_ospf_grace_tlv, tvb, offset, |
3040 | 3.46k | tlv_total_length, ENC_NA); |
3041 | 3.46k | tlv_tree = proto_item_add_subtree(tree_item, ett_ospf_lsa_grace_tlv); |
3042 | 3.46k | proto_tree_add_uint_format_value(tlv_tree, hf_ospf_tlv_type, tvb, offset, 2, tlv_type, "%s (%u)", |
3043 | 3.46k | val_to_str_const(tlv_type, grace_tlv_type_vals, "Unknown grace-LSA TLV"), tlv_type); |
3044 | 3.46k | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
3045 | | |
3046 | 3.46k | if(tlv_type == GRACE_TLV_PERIOD) |
3047 | 567 | { |
3048 | 567 | proto_tree_add_item_ret_uint(tlv_tree, hf_ospf_grace_period, tvb, offset + 4, tlv_length, ENC_BIG_ENDIAN, &grace_period); |
3049 | 567 | proto_item_set_text(tree_item, "Grace Period: %u seconds", grace_period); |
3050 | 567 | } |
3051 | 2.89k | else if(tlv_type == GRACE_TLV_REASON) |
3052 | 201 | { |
3053 | 201 | restart_reason = tvb_get_uint8(tvb, offset + 4); |
3054 | 201 | proto_tree_add_item(tlv_tree, hf_ospf_grace_reason, tvb, offset + 4, tlv_length, ENC_BIG_ENDIAN); |
3055 | 201 | proto_item_set_text(tree_item, "Restart Reason: %s (%u)", |
3056 | 201 | val_to_str_const(restart_reason, restart_reason_vals, "Unknown Restart Reason"), |
3057 | 201 | restart_reason); |
3058 | 201 | } |
3059 | 2.69k | else if(tlv_type == GRACE_TLV_IP && ospf_version == OSPF_VERSION_2) |
3060 | 325 | { |
3061 | | /* Type 3 is only applicable to OSPFv2. */ |
3062 | 325 | proto_tree_add_item(tlv_tree, hf_ospf_grace_ip, tvb, offset + 4, tlv_length, ENC_BIG_ENDIAN); |
3063 | 325 | proto_item_set_text(tree_item, "Restart IP: %s", tvb_address_with_resolution_to_str(pinfo->pool, tvb, AT_IPv4, offset + 4)); |
3064 | 325 | break; |
3065 | 325 | } |
3066 | 2.37k | else |
3067 | 2.37k | { |
3068 | 2.37k | proto_item_set_text(tree_item, "Unknown grace-LSA TLV"); |
3069 | 2.37k | } |
3070 | | |
3071 | 3.14k | if (4U + tlv_length < tlv_total_length) { |
3072 | 910 | proto_tree_add_item(tlv_tree, hf_ospf_pad_bytes, tvb, offset + 4U + tlv_length, tlv_total_length - (4U + tlv_length), ENC_NA); |
3073 | 910 | } |
3074 | 3.14k | offset += tlv_total_length; |
3075 | 3.14k | length -= tlv_total_length; |
3076 | 3.14k | } |
3077 | 579 | } |
3078 | | |
3079 | | /* |
3080 | | * Dissect the TLVs within a Extended-LSA as defined by RFC 8362 |
3081 | | */ |
3082 | | static void dissect_ospf6_e_lsa_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, |
3083 | | uint32_t length, uint8_t address_family) |
3084 | 543 | { |
3085 | 543 | int tlv_type; |
3086 | 543 | unsigned tlv_length; |
3087 | 543 | uint8_t prefix_length; |
3088 | | |
3089 | 543 | int offset_end = offset + length; |
3090 | | |
3091 | 543 | proto_tree *tlv_tree; |
3092 | | |
3093 | 2.60k | while(offset < offset_end) { |
3094 | 2.16k | tlv_type = tvb_get_ntohs(tvb, offset); |
3095 | 2.16k | tlv_length = tvb_get_ntohs(tvb, offset + 2); |
3096 | | |
3097 | 2.16k | tlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, tlv_length+4, |
3098 | 2.16k | ett_ospf_elsa_pfx_tlv, NULL, "%s", val_to_str_const(tlv_type, ospf6_extended_lsa_tlv_type_vals, "Unknown E-LSA TLV")); |
3099 | | |
3100 | 2.16k | proto_tree_add_item(tlv_tree, hf_ospf_v3_e_lsa_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); |
3101 | | |
3102 | 2.16k | proto_tree_add_item(tlv_tree, hf_ospf_v3_e_lsa_tlv_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
3103 | | |
3104 | 2.16k | switch(tlv_type) |
3105 | 2.16k | { |
3106 | 482 | case OSPF6_TLV_INTRA_AREA_PREFIX: |
3107 | | /* metric */ |
3108 | 482 | proto_tree_add_item(tlv_tree, hf_ospf_metric, tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
3109 | | |
3110 | | /* prefix length */ |
3111 | 482 | prefix_length=tvb_get_uint8(tvb, offset + 8); |
3112 | 482 | proto_tree_add_item(tlv_tree, hf_ospf_prefix_length, tvb, offset + 8, 1, ENC_BIG_ENDIAN); |
3113 | | |
3114 | | /* prefix options */ |
3115 | 482 | 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); |
3116 | | |
3117 | | /* address_prefix */ |
3118 | 482 | dissect_ospf_v3_address_prefix(tvb, pinfo, offset + 12, prefix_length, tlv_tree, address_family); |
3119 | | |
3120 | 482 | offset += 4 + WS_ROUNDUP_4(tlv_length); |
3121 | | |
3122 | 482 | break; |
3123 | 205 | case OSPF6_TLV_ROUTER_LINK: |
3124 | | /* Type */ |
3125 | 205 | proto_tree_add_item(tlv_tree, hf_ospf_v3_lsa_type, tvb, offset + 4, 1, ENC_BIG_ENDIAN); |
3126 | | /* Reserved */ |
3127 | 205 | proto_tree_add_item(tlv_tree, hf_ospf_header_reserved, tvb, offset+5, 1, ENC_NA); |
3128 | | /* Metric */ |
3129 | 205 | proto_tree_add_item(tlv_tree, hf_ospf_metric, tvb, offset + 6, 2, ENC_BIG_ENDIAN); |
3130 | | /* Interface ID */ |
3131 | 205 | proto_tree_add_item(tlv_tree, hf_ospf_v3_lsa_interface_id, tvb, offset + 8, 4, ENC_BIG_ENDIAN); |
3132 | | /* Neighbor Interface ID */ |
3133 | 205 | proto_tree_add_item(tlv_tree, hf_ospf_v3_lsa_neighbor_interface_id, tvb, offset + 12, 4, ENC_BIG_ENDIAN); |
3134 | | /* Neighbor Router ID */ |
3135 | 205 | proto_tree_add_item(tlv_tree, hf_ospf_v3_lsa_neighbor_router_id, tvb, offset + 16, 4, ENC_BIG_ENDIAN); |
3136 | | |
3137 | 205 | offset += 4 + WS_ROUNDUP_4(tlv_length); |
3138 | | |
3139 | 205 | break; |
3140 | 194 | case OSPF6_TLV_IPV6_LL_ADDR: |
3141 | | /* Ipv6 addr */ |
3142 | 194 | proto_tree_add_item(tlv_tree, hf_ospf_v3_lsa_link_local_interface_address, tvb, offset + 4, 16, ENC_NA); |
3143 | 194 | offset += 4 + WS_ROUNDUP_4(tlv_length); |
3144 | 194 | break; |
3145 | 212 | case OSPF6_TLV_ATTACHED_ROUTERS: |
3146 | 212 | proto_tree_add_item(tlv_tree, hf_ospf_v3_lsa_attached_router, tvb, offset+4, 4, ENC_BIG_ENDIAN); |
3147 | 212 | offset += 4 + WS_ROUNDUP_4(tlv_length); |
3148 | 212 | break; |
3149 | 527 | case OSPF6_TLV_EXTERNAL_PREFIX: |
3150 | | /* FIXME: first 8 bits unclear in RFC 8362. */ |
3151 | 527 | 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); |
3152 | | |
3153 | | /* metric */ |
3154 | 527 | proto_tree_add_item(tlv_tree, hf_ospf_metric, tvb, offset+5, 3, ENC_BIG_ENDIAN); |
3155 | | /* prefix length */ |
3156 | 527 | prefix_length=tvb_get_uint8(tvb, offset+8); |
3157 | 527 | proto_tree_add_item(tlv_tree, hf_ospf_prefix_length, tvb, offset+8, 1, ENC_BIG_ENDIAN); |
3158 | | |
3159 | | /* prefix options */ |
3160 | 527 | 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); |
3161 | | |
3162 | | /* address_prefix */ |
3163 | 527 | dissect_ospf_v3_address_prefix(tvb, pinfo, offset + 12, prefix_length, tlv_tree, address_family); |
3164 | 527 | offset += 4 + WS_ROUNDUP_4(tlv_length); |
3165 | | |
3166 | 527 | break; |
3167 | 515 | default: |
3168 | 515 | offset += 4 + WS_ROUNDUP_4(tlv_length); |
3169 | 515 | break; |
3170 | | |
3171 | 2.16k | } |
3172 | 2.16k | } |
3173 | 543 | } |
3174 | | |
3175 | | |
3176 | | /* |
3177 | | * This function dissects the Optional Router capabilities LSA. |
3178 | | * In case of OSPFv2, the Router Capabilities would be advertized via the first TLV |
3179 | | * of an RI LSA and in the case of OSPFv3, the router capabilities would be advertized |
3180 | | * using a special purpose type field value. (RFC 4970) |
3181 | | * Also, the Dynamic Hostname or FQDN is advertized via a special purpose TLV type. |
3182 | | * The below function adds the support to handle this as well. (RFC5642). |
3183 | | */ |
3184 | | static void |
3185 | | dissect_ospf_lsa_opaque_ri(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, |
3186 | | uint32_t length) |
3187 | 782 | { |
3188 | 782 | proto_tree *ri_tree; |
3189 | 782 | proto_tree *tlv_tree; |
3190 | 782 | proto_tree *stlv_tree; |
3191 | 782 | proto_item *ti_tree = NULL; |
3192 | 782 | proto_item *ti; |
3193 | 782 | int offset_end = offset + length; |
3194 | | |
3195 | 782 | int tlv_type; |
3196 | 782 | unsigned tlv_length; |
3197 | 782 | int tlv_offset, tlv_end_offset; |
3198 | 782 | uint16_t stlv_type; |
3199 | 782 | uint16_t stlv_length; |
3200 | 782 | int stlv_offset; |
3201 | 782 | const char *tlv_name; |
3202 | 782 | const char *stlv_name; |
3203 | 782 | uint32_t range_size; |
3204 | 782 | uint32_t reserved; |
3205 | 782 | int i; |
3206 | | |
3207 | 782 | ri_tree = proto_tree_add_subtree(tree, tvb, offset, length, |
3208 | 782 | ett_ospf_lsa_opaque_ri, NULL, "Opaque Router Information LSA"); |
3209 | | |
3210 | 3.65k | while (offset < offset_end) { |
3211 | 3.42k | tlv_type = tvb_get_ntohs(tvb, offset); |
3212 | 3.42k | tlv_length = tvb_get_ntohs(tvb, offset + 2); |
3213 | 3.42k | tlv_end_offset = offset + tlv_length + 4; |
3214 | 3.42k | tlv_name = val_to_str_const(tlv_type, ri_tlv_type_vals, "Unknown"); |
3215 | | |
3216 | 3.42k | switch(tlv_type) { |
3217 | | |
3218 | 265 | case OPAQUE_TLV_RI: |
3219 | 265 | tlv_tree = proto_tree_add_subtree_format(ri_tree, tvb, offset, tlv_length+4, |
3220 | 265 | ett_ospf_lsa_ri_tlv, NULL, "%s", val_to_str_const(tlv_type, ri_tlv_type_vals, "Unknown Opaque RI LSA TLV")); |
3221 | | |
3222 | 265 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_type_opaque, tvb, offset, 2, ENC_BIG_ENDIAN); |
3223 | | |
3224 | 265 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
3225 | | |
3226 | 265 | proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_ospf_ri_options, ett_ospf_ri_options, bf_ri_options, ENC_BIG_ENDIAN); |
3227 | 265 | break; |
3228 | | |
3229 | 195 | case OPAQUE_TLV_DH: |
3230 | 195 | tlv_tree = proto_tree_add_subtree_format(ri_tree, tvb, offset, tlv_length+4, |
3231 | 195 | ett_ospf_lsa_dh_tlv, NULL, "%s", val_to_str_const(tlv_type, ri_tlv_type_vals, "Unknown Opaque RI LSA TLV")); |
3232 | | |
3233 | 195 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_type_opaque, tvb, offset, 2, ENC_BIG_ENDIAN); |
3234 | | |
3235 | 195 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
3236 | | |
3237 | 195 | proto_tree_add_item(tlv_tree, hf_ospf_dyn_hostname, tvb, offset+4, tlv_length, ENC_ASCII); |
3238 | 195 | break; |
3239 | | |
3240 | 304 | case OPAQUE_TLV_SA:{ |
3241 | 304 | unsigned sa_number; |
3242 | 304 | tlv_tree = proto_tree_add_subtree_format(ri_tree, tvb, offset, tlv_length+4, |
3243 | 304 | ett_ospf_lsa_sa_tlv, NULL, "%s", val_to_str_const(tlv_type, ri_tlv_type_vals, "Unknown Opaque RI LSA TLV")); |
3244 | | |
3245 | 304 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_type_opaque, tvb, offset, 2, ENC_BIG_ENDIAN); |
3246 | | |
3247 | 304 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
3248 | | |
3249 | 896 | for(sa_number = 0; sa_number < tlv_length; sa_number++){ |
3250 | 592 | proto_tree_add_item(tlv_tree, hf_ospf_lsa_sa, tvb, offset+sa_number+4, 1, ENC_NA); |
3251 | 592 | } |
3252 | 304 | break; |
3253 | 0 | } |
3254 | | |
3255 | 514 | case OPAQUE_TLV_SLR: |
3256 | 928 | case OPAQUE_TLV_SRLB: |
3257 | 928 | tlv_tree = proto_tree_add_subtree_format(ri_tree, tvb, offset, tlv_length + 4, |
3258 | 928 | ett_ospf_lsa_slr_tlv, &ti_tree, "%s", tlv_name); |
3259 | 928 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_type_opaque, tvb, offset, 2, ENC_BIG_ENDIAN); |
3260 | 928 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
3261 | 928 | proto_tree_add_item_ret_uint(tlv_tree, hf_ospf_ls_range_size, tvb, offset + 4, 3, ENC_BIG_ENDIAN, &range_size); |
3262 | 928 | proto_item_append_text(ti_tree, " (Range Size: %u)", range_size); |
3263 | 928 | reserved = tvb_get_uint8(tvb, offset + 7); |
3264 | 928 | ti = proto_tree_add_item(tlv_tree, hf_ospf_header_reserved, tvb, offset + 7, 1, ENC_NA); |
3265 | 928 | if (reserved != 0) { |
3266 | 248 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
3267 | 248 | } |
3268 | 928 | stlv_offset = offset + 8; |
3269 | | |
3270 | | /* Walk down the sub-TLVs in SID/Label Range TLV */ |
3271 | 1.53k | while (stlv_offset < tlv_end_offset) { |
3272 | 676 | uint32_t sid_label; |
3273 | 676 | stlv_type = tvb_get_ntohs(tvb, stlv_offset); |
3274 | 676 | stlv_length = tvb_get_ntohs(tvb, stlv_offset + 2); |
3275 | 676 | stlv_name = val_to_str_const(stlv_type, ext_pfx_stlv_type_vals, "Unknown"); |
3276 | | |
3277 | 676 | switch (stlv_type) { |
3278 | | |
3279 | 349 | case SR_STLV_SID_LABEL: |
3280 | 349 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_length + 4, |
3281 | 349 | ett_ospf_lsa_slr_stlv, &ti_tree, |
3282 | 349 | "%s Sub-TLV", stlv_name); |
3283 | 349 | proto_tree_add_item(stlv_tree, hf_ospf_ls_slr_stlv, tvb, stlv_offset, 2, ENC_BIG_ENDIAN); |
3284 | 349 | ti = proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset + 2, 2, ENC_BIG_ENDIAN); |
3285 | 349 | if (stlv_length == 3) { |
3286 | 66 | sid_label = tvb_get_ntoh24(tvb, stlv_offset + 4); |
3287 | 283 | } else if (stlv_length == 4) { |
3288 | 66 | sid_label = tvb_get_ntohl(tvb, stlv_offset + 4); |
3289 | 217 | } else { |
3290 | | /* Invalid sub-TLV length. */ |
3291 | 217 | proto_item_append_text(ti, " [Invalid length - %u]", stlv_length); |
3292 | 217 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_value, tvb, stlv_offset + 4, stlv_length, ENC_NA); |
3293 | 217 | break; |
3294 | 217 | } |
3295 | 132 | proto_tree_add_item(stlv_tree, hf_ospf_ls_sid_label, tvb, stlv_offset + 4, stlv_length, ENC_BIG_ENDIAN); |
3296 | 132 | proto_item_append_text(ti_tree, " (SID/Label: %u)", sid_label); |
3297 | 132 | break; |
3298 | | |
3299 | 301 | default: |
3300 | 301 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_length + 4, |
3301 | 301 | ett_ospf_lsa_slr_stlv, NULL, |
3302 | 301 | "%s Sub-TLV: %u", stlv_name, stlv_type); |
3303 | 301 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset + 2, 2, ENC_BIG_ENDIAN); |
3304 | 301 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_value, tvb, stlv_offset + 4, stlv_length, ENC_NA); |
3305 | 301 | break; |
3306 | 676 | } |
3307 | 602 | stlv_offset += 4 + WS_ROUNDUP_4(stlv_length); |
3308 | 602 | } |
3309 | 854 | break; |
3310 | | |
3311 | 854 | case OPAQUE_TLV_SRMS_PREF: |
3312 | 316 | tlv_tree = proto_tree_add_subtree_format(ri_tree, tvb, offset, tlv_length + 4, |
3313 | 316 | ett_ospf_lsa_srms_tlv, NULL, "%s", val_to_str_const(tlv_type, ri_tlv_type_vals, "Unknown Opaque RI LSA TLV")); |
3314 | 316 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_type_opaque, tvb, offset, 2, ENC_BIG_ENDIAN); |
3315 | 316 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
3316 | 316 | proto_tree_add_item(tlv_tree, hf_ospf_ls_preference, tvb, offset + 4, 1, ENC_BIG_ENDIAN); |
3317 | 316 | reserved = tvb_get_ntoh24(tvb, offset + 5); |
3318 | 316 | ti = proto_tree_add_item(tlv_tree, hf_ospf_header_reserved, tvb, offset + 5, 3, ENC_NA); |
3319 | 316 | if (reserved != 0) { |
3320 | 250 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
3321 | 250 | } |
3322 | 316 | break; |
3323 | | |
3324 | 286 | case OPAQUE_TLV_NODE_MSD: |
3325 | | /* Node MSD (rfc8476) */ |
3326 | 286 | tlv_offset = offset + 4; |
3327 | 286 | tlv_tree = proto_tree_add_subtree_format(ri_tree, tvb, offset, tlv_length + 4, |
3328 | 286 | ett_ospf_lsa_node_msd_tlv, &ti_tree, "%s", tlv_name); |
3329 | 286 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_type_opaque, tvb, offset, 2, ENC_BIG_ENDIAN); |
3330 | 286 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
3331 | 616 | while (tlv_offset + 2 <= tlv_end_offset) { |
3332 | 330 | proto_tree_add_item(tlv_tree, hf_ospf_ls_igp_msd_type, tvb, tlv_offset, 1, ENC_NA); |
3333 | 330 | proto_tree_add_item(tlv_tree, hf_ospf_ls_igp_msd_value, tvb, tlv_offset+1, 1, ENC_NA); |
3334 | 330 | tlv_offset += 2; |
3335 | 330 | } |
3336 | 286 | break; |
3337 | | |
3338 | 445 | case OPAQUE_TLV_FLEX_ALGO_DEF: |
3339 | | /* Flex Algo Definition (FAD) (rfc9350) */ |
3340 | 445 | tlv_tree = proto_tree_add_subtree_format(ri_tree, tvb, offset, tlv_length + 4, |
3341 | 445 | ett_ospf_lsa_fad_tlv, &ti_tree, "%s", tlv_name); |
3342 | 445 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_type_opaque, tvb, offset, 2, ENC_BIG_ENDIAN); |
3343 | 445 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
3344 | 445 | proto_item_append_text(ti_tree, " (%u)", tvb_get_uint8(tvb, offset + 4)); |
3345 | 445 | proto_tree_add_item(tlv_tree, hf_ospf_ls_flex_algorithm, tvb, offset + 4, 1, ENC_NA); |
3346 | 445 | proto_tree_add_item(tlv_tree, hf_ospf_ls_fad_metric_type, tvb, offset + 5, 1, ENC_NA); |
3347 | 445 | proto_tree_add_item(tlv_tree, hf_ospf_ls_fad_calc_type, tvb, offset + 6, 1, ENC_NA); |
3348 | 445 | proto_tree_add_item(tlv_tree, hf_ospf_ls_fad_priority, tvb, offset + 7, 1, ENC_NA); |
3349 | | |
3350 | | /* Walk down sub-TLVs in FAD TLV */ |
3351 | 445 | stlv_offset = offset + 8; |
3352 | 2.38k | while (stlv_offset < tlv_end_offset) { |
3353 | 2.05k | stlv_type = tvb_get_ntohs(tvb, stlv_offset); |
3354 | 2.05k | stlv_length = tvb_get_ntohs(tvb, stlv_offset + 2); |
3355 | 2.05k | stlv_name = val_to_str_const(stlv_type, ri_lsa_fad_stlv_type_vals, "Unknown"); |
3356 | | |
3357 | 2.05k | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_length + 4, |
3358 | 2.05k | ett_ospf_lsa_fad_stlv, |
3359 | 2.05k | NULL, "%s", stlv_name); |
3360 | 2.05k | proto_tree_add_item(stlv_tree, hf_ospf_ls_fad_stlv, tvb, stlv_offset, 2, ENC_BIG_ENDIAN); |
3361 | 2.05k | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset + 2, 2, ENC_BIG_ENDIAN); |
3362 | 2.05k | switch (stlv_type) { |
3363 | 337 | case FAD_EXCLUDE_AG: |
3364 | 606 | case FAD_INCLUDE_ANY_AG: |
3365 | 812 | case FAD_INCLUDE_ALL_AG: |
3366 | 812 | dissect_ospf_subtlv_ext_admin_group(tvb, stlv_tree, stlv_offset + 4, stlv_type, stlv_length); |
3367 | 812 | break; |
3368 | 309 | case FAD_DEF_FLAGS: |
3369 | 309 | proto_tree_add_bitmask(stlv_tree, tvb, stlv_offset + 4, hf_ospf_ls_fad_def_flags, ett_ospf_lsa_fad_def_flags, bf_ospf_fad_def_flags, ENC_BIG_ENDIAN); |
3370 | 309 | break; |
3371 | 437 | case FAD_EXCLUDE_SRLG: |
3372 | 906 | for (i = 0; i < stlv_length; i += 4) { |
3373 | 469 | proto_tree_add_item(stlv_tree, hf_ospf_ls_srlg, tvb, stlv_offset + 4 + i, 4, ENC_BIG_ENDIAN); |
3374 | 469 | } |
3375 | 437 | break; |
3376 | 443 | default: |
3377 | 443 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_value, tvb, stlv_offset + 4, stlv_length, ENC_NA); |
3378 | 443 | break; |
3379 | 2.05k | } |
3380 | | |
3381 | 1.94k | stlv_offset += 4 + WS_ROUNDUP_4(stlv_length); |
3382 | 1.94k | } |
3383 | 330 | break; |
3384 | | |
3385 | 553 | default: |
3386 | 553 | if (tlv_length > (unsigned)(offset_end - offset)) { |
3387 | | /* Invalid length, probably not TLV. */ |
3388 | 112 | return; |
3389 | 112 | } |
3390 | 441 | tlv_tree = proto_tree_add_subtree_format(ri_tree, tvb, offset, tlv_length+4, |
3391 | 441 | ett_ospf_lsa_unknown_tlv, NULL, "%s (t=%u, l=%u)", |
3392 | 441 | val_to_str_const(tlv_type, ri_tlv_type_vals, "Unknown Opaque RI LSA TLV"), |
3393 | 441 | tlv_type, tlv_length); |
3394 | | |
3395 | 441 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_type_opaque, tvb, offset, 2, ENC_BIG_ENDIAN); |
3396 | | |
3397 | 441 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
3398 | | |
3399 | 441 | proto_tree_add_item(tlv_tree, hf_ospf_unknown_tlv, tvb, offset+4, tlv_length, ENC_NA); |
3400 | 441 | break; |
3401 | | |
3402 | 3.42k | } |
3403 | | |
3404 | | /* |
3405 | | * RFC 7770, section 2.3: 4-octet aligned, but type, length and padding |
3406 | | * is not included in the length. |
3407 | | * */ |
3408 | 2.86k | offset += 4 + WS_ROUNDUP_4(tlv_length); |
3409 | 2.86k | } |
3410 | 782 | } |
3411 | | |
3412 | | /* |
3413 | | * Dissect Extended Prefix Opaque LSA |
3414 | | * |
3415 | | * This function dissects the Optional Extended Prefix Opaque LSA. |
3416 | | * The below function adds the support to handle this as well. (RFC7684). |
3417 | | */ |
3418 | | static void |
3419 | | dissect_ospf_lsa_ext_prefix(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, |
3420 | | uint32_t length) |
3421 | 449 | { |
3422 | 449 | proto_tree *ep_tree; |
3423 | 449 | proto_tree *tlv_tree; |
3424 | 449 | proto_tree *stlv_tree; |
3425 | 449 | proto_item *ti_tree = NULL; |
3426 | 449 | proto_item *ti; |
3427 | 449 | int offset_end = offset + length; |
3428 | | |
3429 | 449 | int tlv_type; |
3430 | 449 | unsigned tlv_length; |
3431 | 449 | int tlv_end_offset; |
3432 | 449 | uint16_t stlv_type; |
3433 | 449 | uint16_t stlv_length; |
3434 | 449 | int stlv_offset; |
3435 | 449 | const char *tlv_name; |
3436 | 449 | const char *stlv_name; |
3437 | 449 | uint8_t route_type; |
3438 | 449 | uint32_t prefix_length; |
3439 | 449 | uint32_t sid_label; |
3440 | 449 | uint32_t range_size; |
3441 | 449 | uint32_t reserved; |
3442 | 449 | uint32_t metric = 0; |
3443 | | |
3444 | 449 | ep_tree = proto_tree_add_subtree(tree, tvb, offset, length, |
3445 | 449 | ett_ospf_lsa_epfx, NULL, "OSPFv2 Extended Prefix Opaque LSA"); |
3446 | | |
3447 | 1.96k | while (offset < offset_end) { |
3448 | 1.84k | tlv_type = tvb_get_ntohs(tvb, offset); |
3449 | 1.84k | tlv_length = tvb_get_ntohs(tvb, offset + 2); |
3450 | 1.84k | tlv_end_offset = offset + tlv_length + 4; |
3451 | 1.84k | tlv_name = val_to_str_const(tlv_type, ext_pfx_tlv_type_vals, "Unknown"); |
3452 | | |
3453 | 1.84k | switch(tlv_type) { |
3454 | | |
3455 | 769 | case EXT_PREFIX_TLV_PREFIX: |
3456 | 769 | tlv_tree = proto_tree_add_subtree_format(ep_tree, tvb, offset, tlv_length + 4, |
3457 | 769 | ett_ospf_lsa_epfx_tlv, &ti_tree, "%s TLV", tlv_name); |
3458 | 769 | proto_tree_add_item(tlv_tree, hf_ospf_ls_epfx_tlv, tvb, offset, 2, ENC_BIG_ENDIAN); |
3459 | 769 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
3460 | 769 | proto_tree_add_item_ret_uint8(tlv_tree, hf_ospf_ls_epfx_route_type, tvb, offset + 4, 1, ENC_BIG_ENDIAN, &route_type); |
3461 | 769 | proto_tree_add_item_ret_uint(tlv_tree, hf_ospf_prefix_length, tvb, offset + 5, 1, ENC_BIG_ENDIAN, &prefix_length); |
3462 | 769 | proto_tree_add_item(tlv_tree, hf_ospf_ls_epfx_af, tvb, offset + 6, 1, ENC_BIG_ENDIAN); |
3463 | 769 | 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); |
3464 | 769 | if (prefix_length != 0) { |
3465 | 512 | proto_tree_add_item(tlv_tree, hf_ospf_v3_address_prefix_ipv4, tvb, offset + 8, 4, ENC_BIG_ENDIAN); |
3466 | 512 | } |
3467 | 769 | proto_item_append_text(ti_tree, " (Type: %-13s Prefix: %s/%u)", |
3468 | 769 | val_to_str_const(route_type, ext_pfx_tlv_route_vals, "Unknown"), |
3469 | 769 | prefix_length == 0 ? "0.0.0.0" : tvb_ip_to_str(pinfo->pool, tvb, offset + 8), |
3470 | 769 | prefix_length); |
3471 | 769 | stlv_offset = offset + 8 + (prefix_length != 0 ? 4 : 0); |
3472 | 769 | break; |
3473 | | |
3474 | 546 | case EXT_PREFIX_TLV_PREFIX_RANGE: |
3475 | 546 | tlv_tree = proto_tree_add_subtree_format(ep_tree, tvb, offset, tlv_length + 4, |
3476 | 546 | ett_ospf_lsa_epfx_tlv, &ti_tree, "%s TLV", tlv_name); |
3477 | 546 | proto_tree_add_item(tlv_tree, hf_ospf_ls_epfx_tlv, tvb, offset, 2, ENC_BIG_ENDIAN); |
3478 | 546 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
3479 | 546 | proto_tree_add_item_ret_uint(tlv_tree, hf_ospf_prefix_length, tvb, offset + 4, 1, ENC_BIG_ENDIAN, &prefix_length); |
3480 | 546 | proto_tree_add_item(tlv_tree, hf_ospf_ls_epfx_af, tvb, offset + 5, 1, ENC_BIG_ENDIAN); |
3481 | 546 | proto_tree_add_item_ret_uint(tlv_tree, hf_ospf_ls_range_size, tvb, offset + 6, 2, ENC_BIG_ENDIAN, &range_size); |
3482 | 546 | 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); |
3483 | 546 | reserved = tvb_get_ntoh24(tvb, offset + 9); |
3484 | 546 | ti = proto_tree_add_item(tlv_tree, hf_ospf_header_reserved, tvb, offset + 9, 3, ENC_NA); |
3485 | 546 | if (reserved != 0) { |
3486 | 466 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
3487 | 466 | } |
3488 | 546 | if (prefix_length != 0) { |
3489 | 87 | proto_tree_add_item(tlv_tree, hf_ospf_v3_address_prefix_ipv4, tvb, offset + 12, 4, ENC_BIG_ENDIAN); |
3490 | 87 | } |
3491 | 546 | proto_item_append_text(ti_tree, " (Range Size: %u, Prefix: %s/%u)", |
3492 | 546 | range_size, |
3493 | 546 | prefix_length == 0 ? "0.0.0.0" : tvb_ip_to_str(pinfo->pool, tvb, offset + 12), |
3494 | 546 | prefix_length); |
3495 | 546 | stlv_offset = offset + 12 + (prefix_length != 0 ? 4 : 0); |
3496 | 546 | break; |
3497 | | |
3498 | 489 | default: |
3499 | 489 | if (tlv_length > (unsigned)(offset_end - offset)) { |
3500 | | /* Invalid length, probably not TLV. */ |
3501 | 76 | return; |
3502 | 76 | } |
3503 | 413 | tlv_tree = proto_tree_add_subtree_format(ep_tree, tvb, offset, tlv_length + 4, |
3504 | 413 | ett_ospf_lsa_epfx_tlv, NULL, |
3505 | 413 | "%s TLV: %u - Unknown", tlv_name, tlv_type); |
3506 | 413 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_type_opaque, tvb, offset, 2, ENC_BIG_ENDIAN); |
3507 | 413 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
3508 | 413 | proto_tree_add_item(tlv_tree, hf_ospf_unknown_tlv, tvb, offset + 4, tlv_length, ENC_NA); |
3509 | 413 | stlv_offset = offset + 4; |
3510 | 413 | break; |
3511 | 1.84k | } |
3512 | | |
3513 | 1.66k | if (tlv_type == EXT_PREFIX_TLV_PREFIX || tlv_type == EXT_PREFIX_TLV_PREFIX_RANGE) { |
3514 | | /* Walk down the sub-TLVs in Extended Link TLV */ |
3515 | 3.28k | while (stlv_offset < tlv_end_offset) { |
3516 | 2.15k | stlv_type = tvb_get_ntohs(tvb, stlv_offset); |
3517 | 2.15k | stlv_length = tvb_get_ntohs(tvb, stlv_offset + 2); |
3518 | 2.15k | stlv_name = val_to_str_const(stlv_type, ext_pfx_stlv_type_vals, "Unknown"); |
3519 | | |
3520 | 2.15k | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_length + 4, |
3521 | 2.15k | ett_ospf_lsa_epfx_stlv, &ti_tree, |
3522 | 2.15k | "%s Sub-TLV", stlv_name); |
3523 | 2.15k | proto_tree_add_item(stlv_tree, hf_ospf_ls_epfx_stlv, tvb, stlv_offset, 2, ENC_BIG_ENDIAN); |
3524 | 2.15k | ti = proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset + 2, 2, ENC_BIG_ENDIAN); |
3525 | | |
3526 | 2.15k | switch (stlv_type) { |
3527 | | |
3528 | 938 | case SR_STLV_PREFIX_SID: |
3529 | 938 | if (stlv_length == 7) { |
3530 | 357 | sid_label = tvb_get_ntoh24(tvb, stlv_offset + 8); |
3531 | 581 | } else if (stlv_length == 8) { |
3532 | 357 | sid_label = tvb_get_ntohl(tvb, stlv_offset + 8); |
3533 | 357 | } else { |
3534 | | /* Invalid sub-TLV length. */ |
3535 | 224 | proto_item_append_text(ti, " [Invalid length - %u]", stlv_length); |
3536 | 224 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_value, tvb, stlv_offset + 4, stlv_length, ENC_NA); |
3537 | 224 | break; |
3538 | 224 | } |
3539 | 714 | 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); |
3540 | 714 | reserved = tvb_get_uint8(tvb, stlv_offset + 5); |
3541 | 714 | ti = proto_tree_add_item(stlv_tree, hf_ospf_header_reserved, tvb, stlv_offset + 5, 1, ENC_NA); |
3542 | 714 | if (reserved != 0) { |
3543 | 296 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
3544 | 296 | } |
3545 | 714 | proto_tree_add_item(stlv_tree, hf_ospf_ls_elink_mt_id, tvb, stlv_offset + 6, 1, ENC_BIG_ENDIAN); |
3546 | 714 | proto_tree_add_item(stlv_tree, hf_ospf_lsa_sa, tvb, stlv_offset + 7, 1, ENC_BIG_ENDIAN); |
3547 | 714 | proto_tree_add_item(stlv_tree, hf_ospf_ls_sid_label, tvb, stlv_offset + 8, (stlv_length - 4), ENC_BIG_ENDIAN); |
3548 | 714 | proto_item_append_text(ti_tree, " (SID/Label: %u)",sid_label); |
3549 | 714 | break; |
3550 | | |
3551 | 567 | case SR_STLV_FLEX_ALGO_PREFIX_METRIC: |
3552 | 567 | if (stlv_length != 8) { |
3553 | 259 | proto_item_append_text(ti, " [Invalid length - %u]", stlv_length); |
3554 | 259 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_value, tvb, stlv_offset + 4, stlv_length, ENC_NA); |
3555 | 259 | break; |
3556 | 259 | } |
3557 | 308 | proto_tree_add_item(stlv_tree, hf_ospf_ls_flex_algorithm, tvb, stlv_offset + 4, 1, ENC_NA); |
3558 | 308 | proto_tree_add_bitmask(stlv_tree, tvb, stlv_offset + 5, hf_ospf_ls_fapm_flags, ett_ospf_lsa_fapm_flags, bf_ospf_fapm_flags, ENC_NA); |
3559 | 308 | reserved = tvb_get_ntoh24(tvb, stlv_offset + 6); |
3560 | 308 | ti = proto_tree_add_item(stlv_tree, hf_ospf_header_reserved, tvb, stlv_offset + 6, 3, ENC_NA); |
3561 | 308 | if (reserved != 0) { |
3562 | 242 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
3563 | 242 | } |
3564 | 308 | proto_tree_add_item_ret_uint(stlv_tree, hf_ospf_ls_fapm_metric, tvb, stlv_offset + 8, 4, ENC_BIG_ENDIAN, &metric); |
3565 | 308 | proto_item_append_text(ti_tree, " (Metric: %u)", metric); |
3566 | 308 | break; |
3567 | | |
3568 | 573 | default: |
3569 | 573 | proto_item_append_text(ti, " (t=%u, l=%u)", stlv_type, stlv_length); |
3570 | 573 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_value, tvb, stlv_offset + 4, stlv_length, ENC_NA); |
3571 | 573 | break; |
3572 | 2.15k | } |
3573 | 2.00k | stlv_offset += 4 + WS_ROUNDUP_4(stlv_length); |
3574 | 2.00k | } |
3575 | 1.27k | } |
3576 | | |
3577 | | /* |
3578 | | * RFC 7770, section 2.3: 4-octet aligned, but type, length and padding |
3579 | | * is not included in the length. |
3580 | | * */ |
3581 | 1.51k | offset += 4 + WS_ROUNDUP_4(tlv_length); |
3582 | 1.51k | } |
3583 | 449 | } |
3584 | | |
3585 | | /* |
3586 | | * Dissect Application-Specific Link Attributes Sub-Sub-TLVs |
3587 | | */ |
3588 | | static void |
3589 | | dissect_ospf_lsa_app_link_attributes(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, proto_tree *tree, |
3590 | | uint32_t length) |
3591 | 13.4k | { |
3592 | 13.4k | proto_tree *stlv_tree = NULL; |
3593 | 13.4k | proto_item *ti_tree = NULL, *ti = NULL; |
3594 | 13.4k | int offset_end = offset + length; |
3595 | 13.4k | int stlv_offset = offset; |
3596 | 13.4k | uint16_t stlv_type, stlv_length; |
3597 | 13.4k | const char *stlv_name; |
3598 | 13.4k | uint32_t delay, delay_min, delay_max, reserved; |
3599 | 13.4k | uint32_t admin_group, te_metric; |
3600 | 13.4k | int i; |
3601 | | |
3602 | 625k | while (stlv_offset < offset_end) { |
3603 | 612k | stlv_type = tvb_get_ntohs(tvb, stlv_offset); |
3604 | 612k | stlv_length = tvb_get_ntohs(tvb, stlv_offset + 2); |
3605 | 612k | stlv_name = val_to_str_const(stlv_type, ext_link_stlv_type_vals, "Unknown"); |
3606 | | |
3607 | 612k | stlv_tree = proto_tree_add_subtree_format(tree, tvb, stlv_offset, stlv_length + 4, |
3608 | 612k | ett_ospf_lsa_app_link_attrs_stlv, &ti_tree, |
3609 | 612k | "%s Sub-TLV", stlv_name); |
3610 | 612k | proto_tree_add_item(stlv_tree, hf_ospf_ls_app_link_attrs_stlv, tvb, stlv_offset, 2, ENC_BIG_ENDIAN); |
3611 | 612k | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset + 2, 2, ENC_BIG_ENDIAN); |
3612 | 612k | stlv_offset += 4; |
3613 | | |
3614 | 612k | switch (stlv_type) { |
3615 | 622 | case SR_STLV_SRLG: |
3616 | | /* 11: Shared Risk Link Group */ |
3617 | 1.36k | for (i = 0; i < stlv_length; i += 4) { |
3618 | 741 | proto_tree_add_item(stlv_tree, hf_ospf_ls_srlg, tvb, stlv_offset + i, 4, ENC_BIG_ENDIAN); |
3619 | 741 | } |
3620 | 622 | break; |
3621 | 2.91k | case SR_STLV_UNIDIR_LINK_DELAY: |
3622 | | /* 12: Unidirectional Link Delay (rfc7471) */ |
3623 | 2.91k | ti = proto_tree_add_bitmask(stlv_tree, tvb, stlv_offset, |
3624 | 2.91k | hf_ospf_ls_unidir_link_flags, |
3625 | 2.91k | ett_ospf_lsa_unidir_link_flags, |
3626 | 2.91k | unidir_link_flags, ENC_NA); |
3627 | 2.91k | reserved = tvb_get_uint8(tvb, stlv_offset) & 0x7f; |
3628 | 2.91k | if (reserved != 0) { |
3629 | 870 | expert_add_info_format(pinfo, ti, &ei_ospf_header_reserved, |
3630 | 870 | "Reserved field should be 0"); |
3631 | 870 | } |
3632 | 2.91k | delay = tvb_get_uint24(tvb, stlv_offset + 1, ENC_BIG_ENDIAN); |
3633 | 2.91k | proto_tree_add_item(stlv_tree, hf_ospf_ls_unidir_link_delay, tvb, stlv_offset + 1, 3, ENC_BIG_ENDIAN); |
3634 | 2.91k | if (ti_tree) { |
3635 | 2.91k | proto_item_append_text(ti_tree, " (Delay: %u usec)", delay); |
3636 | 2.91k | } |
3637 | 2.91k | break; |
3638 | | |
3639 | 261k | case SR_STLV_UNIDIR_LINK_DELAY_MIN_MAX: |
3640 | | /* 13: Min/Max Unidirectional Link Delay (rfc7471) */ |
3641 | 261k | ti = proto_tree_add_bitmask(stlv_tree, tvb, stlv_offset, |
3642 | 261k | hf_ospf_ls_unidir_link_flags, |
3643 | 261k | ett_ospf_lsa_unidir_link_flags, |
3644 | 261k | unidir_link_flags, ENC_NA); |
3645 | 261k | reserved = tvb_get_uint8(tvb, stlv_offset) & 0x7f; |
3646 | 261k | if (reserved != 0) { |
3647 | 111k | expert_add_info_format(pinfo, ti, &ei_ospf_header_reserved, |
3648 | 111k | "Reserved field should be 0"); |
3649 | 111k | } |
3650 | 261k | delay_min = tvb_get_uint24(tvb, stlv_offset + 1, ENC_BIG_ENDIAN); |
3651 | 261k | proto_tree_add_item(stlv_tree, hf_ospf_ls_unidir_link_delay_min, tvb, stlv_offset+1, 3, ENC_BIG_ENDIAN); |
3652 | 261k | ti = proto_tree_add_item_ret_uint(stlv_tree, hf_ospf_ls_unidir_link_reserved, tvb, stlv_offset+4, 1, ENC_NA, &reserved); |
3653 | 261k | if (reserved != 0) { |
3654 | 132k | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
3655 | 132k | } |
3656 | 261k | proto_tree_add_item_ret_uint(stlv_tree, hf_ospf_ls_unidir_link_delay_max, tvb, stlv_offset+5, 3, ENC_BIG_ENDIAN, &delay_max); |
3657 | 261k | if (ti_tree) { |
3658 | 261k | proto_item_append_text(ti_tree, " (Min/Max Delay: %u/%u usec)", delay_min, delay_max); |
3659 | 261k | } |
3660 | 261k | break; |
3661 | | |
3662 | 18.1k | case SR_STLV_UNIDIR_DELAY_VARIATION: |
3663 | | /* 14: Unidirectional Delay Variation (rfc7471) */ |
3664 | 18.1k | ti = proto_tree_add_item_ret_uint(stlv_tree, hf_ospf_ls_unidir_link_reserved, tvb, stlv_offset, 1, ENC_NA, &reserved); |
3665 | 18.1k | if (reserved != 0) { |
3666 | 17.7k | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
3667 | 17.7k | } |
3668 | 18.1k | proto_tree_add_item_ret_uint(stlv_tree, hf_ospf_ls_unidir_delay_variation, tvb, stlv_offset + 1, 3, ENC_BIG_ENDIAN, &delay); |
3669 | 18.1k | if (ti_tree) { |
3670 | 18.1k | proto_item_append_text(ti_tree, " (Variation: %u usec)", delay); |
3671 | 18.1k | } |
3672 | 18.1k | break; |
3673 | | |
3674 | 435 | case SR_STLV_ADMIN_GROUP: |
3675 | | /* 19: Administrative Group (rfc3630) */ |
3676 | 435 | proto_tree_add_item_ret_uint(stlv_tree, hf_ospf_ls_admin_group, tvb, stlv_offset, 4, ENC_BIG_ENDIAN, &admin_group); |
3677 | 435 | if (ti_tree) { |
3678 | 435 | proto_item_append_text(ti_tree, " (Admin Group: 0x%08x)", admin_group); |
3679 | 435 | } |
3680 | 435 | break; |
3681 | | |
3682 | 649 | case SR_STLV_EXT_ADMIN_GROUP: |
3683 | | /* 20: Extended Administrative Group (rfc7308) */ |
3684 | 649 | dissect_ospf_subtlv_ext_admin_group(tvb, stlv_tree, stlv_offset, stlv_type, stlv_length); |
3685 | 649 | break; |
3686 | | |
3687 | 500 | case SR_STLV_TE_METRIC: |
3688 | | /* 22: TE Metric (rfc3630) */ |
3689 | 500 | proto_tree_add_item_ret_uint(stlv_tree, hf_ospf_ls_mpls_te_metric, tvb, stlv_offset, 4, ENC_BIG_ENDIAN, &te_metric); |
3690 | 500 | if (ti_tree) { |
3691 | 500 | proto_item_append_text(ti_tree, " (TE Metric: %u)", te_metric); |
3692 | 500 | } |
3693 | 500 | break; |
3694 | | |
3695 | 327k | default: |
3696 | 327k | proto_tree_add_item(stlv_tree, hf_ospf_tlv_value, tvb, stlv_offset, stlv_length, ENC_NA); |
3697 | 327k | break; |
3698 | 612k | } |
3699 | | |
3700 | 612k | stlv_offset += WS_ROUNDUP_4(stlv_length); |
3701 | 612k | } |
3702 | 13.4k | } |
3703 | | |
3704 | | /* |
3705 | | * Dissect Extended Link Opaque LSA |
3706 | | * |
3707 | | * This function dissects the Optional Extended Link Opaque LSA. |
3708 | | * The below function adds the support to handle this as well. (RFC7684). |
3709 | | */ |
3710 | | static void |
3711 | | dissect_ospf_lsa_ext_link(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, |
3712 | | uint32_t length) |
3713 | 1.31k | { |
3714 | 1.31k | proto_tree *el_tree; |
3715 | 1.31k | proto_tree *tlv_tree; |
3716 | 1.31k | proto_tree *stlv_tree; |
3717 | 1.31k | proto_item *ti_tree = NULL; |
3718 | 1.31k | proto_item *ti; |
3719 | 1.31k | int offset_end = offset + length; |
3720 | | |
3721 | 1.31k | int tlv_type; |
3722 | 1.31k | unsigned tlv_length; |
3723 | 1.31k | int tlv_end_offset; |
3724 | 1.31k | uint16_t stlv_type; |
3725 | 1.31k | uint16_t stlv_length; |
3726 | 1.31k | int stlv_offset; |
3727 | 1.31k | const char *tlv_name; |
3728 | 1.31k | const char *stlv_name; |
3729 | 1.31k | uint8_t link_type; |
3730 | 1.31k | uint32_t sid_label; |
3731 | 1.31k | uint32_t reserved; |
3732 | 1.31k | int local_offset; |
3733 | 1.31k | uint16_t local_length; |
3734 | 1.31k | uint32_t local_id = 0, remote_id = 0; |
3735 | 1.31k | uint8_t sabm_length = 0, udabm_length = 0; |
3736 | | |
3737 | 1.31k | el_tree = proto_tree_add_subtree(tree, tvb, offset, length, |
3738 | 1.31k | ett_ospf_lsa_elink, NULL, "OSPFv2 Extended Link Opaque LSA"); |
3739 | | |
3740 | 2.71k | while (offset < offset_end) { |
3741 | 1.98k | tlv_type = tvb_get_ntohs(tvb, offset); |
3742 | 1.98k | tlv_length = tvb_get_ntohs(tvb, offset + 2); |
3743 | 1.98k | tlv_end_offset = offset + tlv_length + 4; |
3744 | 1.98k | tlv_name = val_to_str_const(tlv_type, ext_link_tlv_type_vals, "Unknown"); |
3745 | | |
3746 | 1.98k | switch(tlv_type) { |
3747 | | |
3748 | 1.45k | case EXT_LINK_TLV_LINK: |
3749 | 1.45k | tlv_tree = proto_tree_add_subtree_format(el_tree, tvb, offset, tlv_length + 4, |
3750 | 1.45k | ett_ospf_lsa_elink_tlv, &ti_tree, "%s TLV", tlv_name); |
3751 | 1.45k | proto_tree_add_item(tlv_tree, hf_ospf_ls_elink_tlv, tvb, offset, 2, ENC_BIG_ENDIAN); |
3752 | 1.45k | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
3753 | | |
3754 | 1.45k | link_type = tvb_get_uint8(tvb, offset + 4); |
3755 | 1.45k | ti = proto_tree_add_item(tlv_tree, hf_ospf_ls_router_linktype, tvb, offset + 4, 1, ENC_BIG_ENDIAN); |
3756 | 1.45k | proto_item_append_text(ti, " - %s", |
3757 | 1.45k | val_to_str_const(link_type, ospf_v3_lsa_type_vals, "Unknown link type")); |
3758 | 1.45k | proto_item_append_text(ti_tree, " (Type: %-8s ID: %-15s Data: %s)", |
3759 | 1.45k | val_to_str_const(link_type, ospf_v3_lsa_type_short_vals, "Unknown"), |
3760 | 1.45k | tvb_ip_to_str(pinfo->pool, tvb, offset + 8), |
3761 | 1.45k | tvb_ip_to_str(pinfo->pool, tvb, offset + 12)); |
3762 | 1.45k | reserved = tvb_get_ntoh24(tvb, offset + 5); |
3763 | 1.45k | ti = proto_tree_add_item(tlv_tree, hf_ospf_header_reserved, tvb, offset + 5, 3, ENC_NA); |
3764 | 1.45k | if (reserved != 0) { |
3765 | 1.31k | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
3766 | 1.31k | } |
3767 | 1.45k | proto_tree_add_item(tlv_tree, hf_ospf_ls_router_linkid, tvb, offset + 8, 4, ENC_BIG_ENDIAN); |
3768 | 1.45k | proto_tree_add_item(tlv_tree, hf_ospf_ls_router_linkdata, tvb, offset + 12, 4, ENC_BIG_ENDIAN); |
3769 | 1.45k | stlv_offset = offset + 16; |
3770 | | |
3771 | | /* Walk down the sub-TLVs in Extended Link TLV */ |
3772 | 21.5k | while (stlv_offset + 4 <= tlv_end_offset) { |
3773 | 20.4k | stlv_type = tvb_get_ntohs(tvb, stlv_offset); |
3774 | 20.4k | stlv_length = tvb_get_ntohs(tvb, stlv_offset + 2); |
3775 | 20.4k | stlv_name = val_to_str_const(stlv_type, ext_link_stlv_type_vals, "Unknown"); |
3776 | | |
3777 | 20.4k | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_length + 4, |
3778 | 20.4k | ett_ospf_lsa_elink_stlv, &ti_tree, |
3779 | 20.4k | "%s Sub-TLV", stlv_name); |
3780 | 20.4k | proto_tree_add_item(stlv_tree, hf_ospf_ls_elink_stlv, tvb, stlv_offset, 2, ENC_BIG_ENDIAN); |
3781 | 20.4k | ti = proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset + 2, 2, ENC_BIG_ENDIAN); |
3782 | 20.4k | switch (stlv_type) { |
3783 | 875 | case SR_STLV_ADJSID: |
3784 | 875 | if (stlv_length == 7) { |
3785 | 277 | sid_label = tvb_get_ntoh24(tvb, stlv_offset + 8); |
3786 | 598 | } else if (stlv_length == 8) { |
3787 | 333 | sid_label = tvb_get_ntohl(tvb, stlv_offset + 8); |
3788 | 333 | } else { |
3789 | | /* Invalid sub-TLV length. */ |
3790 | 265 | proto_item_append_text(ti, " [Invalid length - %u]", stlv_length); |
3791 | 265 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_value, tvb, stlv_offset + 4, stlv_length, ENC_NA); |
3792 | 265 | break; |
3793 | 265 | } |
3794 | 610 | 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); |
3795 | 610 | reserved = tvb_get_uint8(tvb, offset + 5); |
3796 | 610 | ti = proto_tree_add_item(stlv_tree, hf_ospf_header_reserved, tvb, stlv_offset + 5, 1, ENC_NA); |
3797 | 610 | if (reserved != 0) { |
3798 | 405 | proto_item_append_text(ti, " [incorrect, should be 0]"); |
3799 | 405 | } |
3800 | 610 | proto_tree_add_item(stlv_tree, hf_ospf_ls_elink_mt_id, tvb, stlv_offset + 6, 1, ENC_BIG_ENDIAN); |
3801 | 610 | proto_tree_add_item(stlv_tree, hf_ospf_ls_elink_weight, tvb, stlv_offset + 7, 1, ENC_BIG_ENDIAN); |
3802 | 610 | proto_tree_add_item(stlv_tree, hf_ospf_ls_sid_label, tvb, stlv_offset + 8, (stlv_length - 4), ENC_BIG_ENDIAN); |
3803 | 610 | proto_item_append_text(ti_tree, " (SID/Label: %u)", sid_label); |
3804 | 610 | break; |
3805 | | |
3806 | 973 | case SR_STLV_LAN_ADJSID: |
3807 | 973 | if (stlv_length == 11) { |
3808 | 302 | sid_label = tvb_get_ntoh24(tvb, stlv_offset + 12); |
3809 | 671 | } else if (stlv_length == 12) { |
3810 | 410 | sid_label = tvb_get_ntohl(tvb, stlv_offset + 12); |
3811 | 410 | } else { |
3812 | | /* Invalid sub-TLV length. */ |
3813 | 261 | proto_item_append_text(ti, " [Invalid length - %u]", stlv_length); |
3814 | 261 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_value, tvb, stlv_offset + 4, stlv_length, ENC_NA); |
3815 | 261 | break; |
3816 | 261 | } |
3817 | 712 | 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); |
3818 | 712 | reserved = tvb_get_uint8(tvb, offset + 5); |
3819 | 712 | ti = proto_tree_add_item(stlv_tree, hf_ospf_header_reserved, tvb, stlv_offset + 5, 1, ENC_NA); |
3820 | 712 | if (reserved != 0) { |
3821 | 489 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
3822 | 489 | } |
3823 | 712 | proto_tree_add_item(stlv_tree, hf_ospf_ls_elink_mt_id, tvb, stlv_offset + 6, 1, ENC_BIG_ENDIAN); |
3824 | 712 | proto_tree_add_item(stlv_tree, hf_ospf_ls_elink_weight, tvb, stlv_offset + 7, 1, ENC_BIG_ENDIAN); |
3825 | 712 | proto_tree_add_item(stlv_tree, hf_ospf_ls_elink_nbr, tvb, stlv_offset + 8, 4, ENC_BIG_ENDIAN); |
3826 | 712 | proto_tree_add_item(stlv_tree, hf_ospf_ls_sid_label, tvb, stlv_offset + 12, (stlv_length - 8), ENC_BIG_ENDIAN); |
3827 | 712 | proto_item_append_text(ti_tree, " (SID/Label: %u, Neighbor: %s)", |
3828 | 712 | sid_label, tvb_ip_to_str(pinfo->pool, tvb, stlv_offset + 8)); |
3829 | 712 | break; |
3830 | | |
3831 | 460 | case SR_STLV_LINK_MSD: |
3832 | | /* Link MSD Sub-TLV (rfc8476) */ |
3833 | 460 | local_length = stlv_length; |
3834 | 460 | local_offset = stlv_offset + 4; |
3835 | 1.25k | while (local_length >= 2) { |
3836 | 799 | proto_tree_add_item(stlv_tree, hf_ospf_ls_igp_msd_type, tvb, local_offset, 1, ENC_NA); |
3837 | 799 | proto_tree_add_item(stlv_tree, hf_ospf_ls_igp_msd_value, tvb, local_offset+1, 1, ENC_NA); |
3838 | 799 | local_offset += 2; |
3839 | 799 | local_length -= 2; |
3840 | 799 | } |
3841 | 460 | break; |
3842 | | |
3843 | 545 | case SR_STLV_REMOTE_IPV4_ADDRESS: |
3844 | | /* Remote IPv4 Address Sub-TLV (rfc8379) */ |
3845 | 545 | proto_tree_add_item(stlv_tree, hf_ospf_ls_remote_ipv4_addr, tvb, stlv_offset + 4, 4, ENC_BIG_ENDIAN); |
3846 | 545 | proto_item_append_text(ti_tree, " (%s)", tvb_ip_to_str(pinfo->pool, tvb, stlv_offset + 4)); |
3847 | 545 | break; |
3848 | | |
3849 | 290 | case SR_STLV_LOCAL_REMOTE_INTERFACE_ID: |
3850 | | /* Local/Remote Interface ID Sub-TLV (rfc8379) */ |
3851 | 290 | proto_tree_add_item_ret_uint(stlv_tree, hf_ospf_ls_local_interface_id, tvb, stlv_offset + 4, 4, ENC_BIG_ENDIAN, &local_id); |
3852 | 290 | proto_tree_add_item_ret_uint(stlv_tree, hf_ospf_ls_remote_interface_id, tvb, stlv_offset + 8, 4, ENC_BIG_ENDIAN, &remote_id); |
3853 | 290 | proto_item_append_text(ti_tree, " (Local: %u, Remote: %u)", local_id, remote_id); |
3854 | 290 | break; |
3855 | | |
3856 | 13.8k | case SR_STLV_APP_SPEC_LINK_ATTR: |
3857 | | /* Application-Specific Link Attributes Sub-TLV (rfc9492) */ |
3858 | 13.8k | local_length = stlv_length; |
3859 | 13.8k | local_offset = stlv_offset + 4; |
3860 | 13.8k | proto_tree_add_item_ret_uint8(stlv_tree, hf_ospf_ls_app_sabm_length, tvb, local_offset, 1, ENC_NA, &sabm_length); |
3861 | 13.8k | proto_tree_add_item_ret_uint8(stlv_tree, hf_ospf_ls_app_udabm_length, tvb, local_offset + 1, 1, ENC_NA, &udabm_length); |
3862 | 13.8k | reserved = tvb_get_uint16(tvb, local_offset + 2, ENC_BIG_ENDIAN); |
3863 | 13.8k | ti = proto_tree_add_item(stlv_tree, hf_ospf_header_reserved, tvb, local_offset + 2, 2, ENC_NA); |
3864 | 13.8k | if (reserved != 0) { |
3865 | 1.94k | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
3866 | 1.94k | } |
3867 | 13.8k | local_offset += 4; |
3868 | 13.8k | local_length -= 4; |
3869 | 13.8k | if (sabm_length > 0 ) { |
3870 | 381 | proto_tree_add_bitmask(stlv_tree, tvb, local_offset, |
3871 | 381 | hf_ospf_ls_app_sabm_bits, |
3872 | 381 | ett_ospf_lsa_app_sabm_bits, |
3873 | 381 | bf_ospf_app_sabm_bits, ENC_NA); |
3874 | 381 | local_offset += sabm_length; |
3875 | 381 | local_length -= sabm_length; |
3876 | 381 | } |
3877 | 13.8k | if (udabm_length > 0) { |
3878 | 13.2k | proto_tree_add_item(stlv_tree, hf_ospf_ls_app_udabm_bits, |
3879 | 13.2k | tvb, local_offset, udabm_length, ENC_NA); |
3880 | 13.2k | local_offset += udabm_length; |
3881 | 13.2k | local_length -= udabm_length; |
3882 | 13.2k | } |
3883 | | /* Link Attribute Sub-TLVs */ |
3884 | 13.8k | if (local_length > 4) { |
3885 | 13.4k | dissect_ospf_lsa_app_link_attributes(tvb, pinfo, local_offset, stlv_tree, local_length); |
3886 | 13.4k | } |
3887 | 13.8k | break; |
3888 | | |
3889 | 3.33k | default: |
3890 | 3.33k | proto_tree_add_item(stlv_tree, hf_ospf_tlv_value, tvb, stlv_offset + 4, stlv_length, ENC_NA); |
3891 | 3.33k | proto_item_append_text(ti_tree, " (t=%u, l=%u)", stlv_type, stlv_length); |
3892 | 3.33k | break; |
3893 | 20.4k | } |
3894 | 20.0k | stlv_offset += 4 + WS_ROUNDUP_4(stlv_length); |
3895 | 20.0k | } |
3896 | 1.07k | break; |
3897 | | |
3898 | 1.07k | default: |
3899 | 470 | if (tlv_length > (unsigned)(offset_end - offset)) { |
3900 | | /* Invalid length, probably not TLV. */ |
3901 | 105 | return; |
3902 | 105 | } |
3903 | 365 | tlv_tree = proto_tree_add_subtree_format(el_tree, tvb, offset, tlv_length + 4, |
3904 | 365 | ett_ospf_lsa_elink_tlv, NULL, |
3905 | 365 | "%s TLV: %u - Unknown", tlv_name, tlv_type); |
3906 | 365 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_type_opaque, tvb, offset, 2, ENC_BIG_ENDIAN); |
3907 | 365 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
3908 | 365 | proto_tree_add_item(tlv_tree, hf_ospf_unknown_tlv, tvb, offset + 4, tlv_length, ENC_NA); |
3909 | 365 | break; |
3910 | | |
3911 | 1.98k | } |
3912 | | |
3913 | | /* |
3914 | | * RFC 7770, section 2.3: 4-octet aligned, but type, length and padding |
3915 | | * is not included in the length. |
3916 | | * */ |
3917 | 1.40k | offset += 4 + WS_ROUNDUP_4(tlv_length); |
3918 | 1.40k | } |
3919 | 1.31k | } |
3920 | | |
3921 | | /* |
3922 | | * Dissect Extended Inter-Area ASBR LSA |
3923 | | * |
3924 | | * This function dissects the Optional Extended Inter-Area ASBR LSA. |
3925 | | * The below function adds the support to handle this as well. (RFC9350). |
3926 | | */ |
3927 | | static void |
3928 | | dissect_ospf_lsa_ext_ia_asbr(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, uint32_t length) |
3929 | 565 | { |
3930 | 565 | proto_tree *eia_tree; |
3931 | 565 | proto_tree *tlv_tree; |
3932 | 565 | proto_tree *stlv_tree; |
3933 | 565 | proto_item *ti_tree = NULL; |
3934 | 565 | proto_item *ti = NULL; |
3935 | 565 | int offset_end = offset + length; |
3936 | | |
3937 | 565 | uint16_t tlv_type; |
3938 | 565 | uint16_t tlv_length; |
3939 | 565 | int tlv_offset_end; |
3940 | 565 | uint16_t stlv_type; |
3941 | 565 | uint16_t stlv_length; |
3942 | 565 | int stlv_offset, stlv_offset_end; |
3943 | 565 | const char *tlv_name; |
3944 | 565 | const char *stlv_name; |
3945 | 565 | uint32_t reserved, metric; |
3946 | | |
3947 | 565 | eia_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ospf_lsa_eia_asbr, NULL, |
3948 | 565 | "OSPFv2 Extended Inter-Area ASBR LSA"); |
3949 | | |
3950 | 977 | while (offset + 4 <= offset_end) { |
3951 | 845 | tlv_type = tvb_get_ntohs(tvb, offset); |
3952 | 845 | tlv_length = tvb_get_ntohs(tvb, offset + 2); |
3953 | 845 | tlv_offset_end = offset + tlv_length + 4; |
3954 | 845 | tlv_name = val_to_str_const(tlv_type, ext_ia_asbr_tlv_type_vals, "Unknown"); |
3955 | | |
3956 | 845 | switch(tlv_type) { |
3957 | 442 | case EXT_IA_ASBR_TLV_EIA_ASBR: |
3958 | 442 | tlv_tree = proto_tree_add_subtree_format(eia_tree, tvb, offset, tlv_length + 4, |
3959 | 442 | ett_ospf_lsa_eia_asbr_tlv, &ti_tree, |
3960 | 442 | "%s TLV", tlv_name); |
3961 | 442 | proto_tree_add_item(tlv_tree, hf_ospf_ls_eia_asbr_tlv, tvb, offset, 2, ENC_BIG_ENDIAN); |
3962 | 442 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
3963 | 442 | if (tlv_length < 4 || tlv_offset_end > offset_end) { |
3964 | 150 | proto_tree_add_expert_format(tlv_tree, pinfo, |
3965 | 150 | &ei_ospf_stlv_length_invalid, tvb, offset + 2, 2, |
3966 | 150 | "Invalid TLV length: %u", tlv_length); |
3967 | 150 | return; |
3968 | 150 | } |
3969 | 292 | proto_tree_add_item(tlv_tree, hf_ospf_ls_eia_asbr_asbr_routerid, tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
3970 | 292 | proto_item_append_text(ti_tree, " (ASBR: %s)", |
3971 | 292 | tvb_ip_to_str(pinfo->pool, tvb, offset + 4)); |
3972 | 292 | stlv_offset = offset + 8; |
3973 | | |
3974 | | /* Walk down the sub-TLVs in Extended Inter-Area ASBR TLV */ |
3975 | 885 | while (stlv_offset + 4 <= tlv_offset_end) { |
3976 | 726 | stlv_type = tvb_get_ntohs(tvb, stlv_offset); |
3977 | 726 | stlv_length = tvb_get_ntohs(tvb, stlv_offset + 2); |
3978 | 726 | stlv_offset_end = stlv_offset + stlv_length + 4; |
3979 | 726 | stlv_name = val_to_str_const(stlv_type, ext_ia_asbr_stlv_type_vals, "Unknown"); |
3980 | | |
3981 | 726 | stlv_tree = proto_tree_add_subtree_format(tlv_tree, tvb, stlv_offset, stlv_length + 4, |
3982 | 726 | ett_ospf_lsa_eia_asbr_stlv, &ti_tree, |
3983 | 726 | "%s Sub-TLV", stlv_name); |
3984 | 726 | proto_tree_add_item(stlv_tree, hf_ospf_ls_eia_asbr_stlv, tvb, stlv_offset, 2, ENC_BIG_ENDIAN); |
3985 | 726 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_length, tvb, stlv_offset + 2, 2, ENC_BIG_ENDIAN); |
3986 | 726 | if (stlv_offset_end > offset_end) { |
3987 | 49 | proto_tree_add_expert_format(stlv_tree, pinfo, |
3988 | 49 | &ei_ospf_stlv_length_invalid, tvb, stlv_offset + 2, 2, |
3989 | 49 | "Invalid sub-TLV length: %u", stlv_length); |
3990 | 49 | return; |
3991 | 49 | } |
3992 | 677 | switch (stlv_type) { |
3993 | 363 | case SR_STLV_FLEX_ALGO_ASBR_METRIC: |
3994 | | /* Flexible Algorithm ASBR Metric (FAAM) */ |
3995 | 363 | if (stlv_length != 8) { |
3996 | 210 | proto_tree_add_expert_format(stlv_tree, pinfo, |
3997 | 210 | &ei_ospf_stlv_length_invalid, tvb, stlv_offset + 2, 2, |
3998 | 210 | "Invalid sub-TLV length: %u (should be 8)", stlv_length); |
3999 | 210 | break; |
4000 | 210 | } |
4001 | 153 | proto_tree_add_item(stlv_tree, hf_ospf_ls_flex_algorithm, tvb, stlv_offset + 4, 1, ENC_NA); |
4002 | 153 | reserved = tvb_get_uint24(tvb, stlv_offset + 5, ENC_BIG_ENDIAN); |
4003 | 153 | ti = proto_tree_add_item(stlv_tree, hf_ospf_header_reserved, tvb, stlv_offset + 5, 3, ENC_NA); |
4004 | 153 | if (reserved != 0) { |
4005 | 87 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
4006 | 87 | } |
4007 | 153 | proto_tree_add_item_ret_uint(stlv_tree, hf_ospf_ls_faam_metric, tvb, stlv_offset + 8, 4, ENC_BIG_ENDIAN, &metric); |
4008 | 153 | proto_item_append_text(ti_tree, " (Metric: %u)", metric); |
4009 | 153 | break; |
4010 | | |
4011 | 277 | default: |
4012 | 277 | proto_tree_add_item(stlv_tree, hf_ospf_tlv_value, tvb, stlv_offset + 4, stlv_length, ENC_NA); |
4013 | 277 | proto_item_append_text(ti_tree, " (t=%u, l=%u)", stlv_type, stlv_length); |
4014 | 277 | break; |
4015 | 677 | } |
4016 | 593 | stlv_offset += 4 + WS_ROUNDUP_4(stlv_length); |
4017 | 593 | } |
4018 | 159 | break; |
4019 | | |
4020 | 357 | default: |
4021 | 357 | if (tlv_length > (unsigned)(offset_end - offset)) { |
4022 | | /* Invalid length, probably not TLV. */ |
4023 | 73 | return; |
4024 | 73 | } |
4025 | 284 | tlv_tree = proto_tree_add_subtree_format(eia_tree, tvb, offset, tlv_length + 4, |
4026 | 284 | ett_ospf_lsa_eia_asbr_tlv, NULL, |
4027 | 284 | "%s TLV: %u - Unknown", tlv_name, tlv_type); |
4028 | 284 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_type_opaque, tvb, offset, 2, ENC_BIG_ENDIAN); |
4029 | 284 | proto_tree_add_item(tlv_tree, hf_ospf_tlv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
4030 | 284 | proto_tree_add_item(tlv_tree, hf_ospf_unknown_tlv, tvb, offset + 4, tlv_length, ENC_NA); |
4031 | 284 | break; |
4032 | | |
4033 | 845 | } |
4034 | | |
4035 | | /* |
4036 | | * RFC 7770, section 2.3: 4-octet aligned, but type, length and padding |
4037 | | * is not included in the length. |
4038 | | * */ |
4039 | 412 | offset += 4 + WS_ROUNDUP_4(tlv_length); |
4040 | 412 | } |
4041 | 565 | } |
4042 | | |
4043 | | /* |
4044 | | * Dissect opaque LSAs |
4045 | | */ |
4046 | | static void |
4047 | | dissect_ospf_lsa_opaque(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, |
4048 | | uint8_t ls_id_type, uint32_t length) |
4049 | 4.22k | { |
4050 | 4.22k | switch (ls_id_type) { |
4051 | | |
4052 | 1.27k | case OSPF_LSA_MPLS_TE: |
4053 | 1.27k | dissect_ospf_lsa_mpls(tvb, pinfo, offset, tree, length); |
4054 | 1.27k | break; |
4055 | 133 | case OSPF_LSA_OPAQUE_RI: |
4056 | 133 | dissect_ospf_lsa_opaque_ri(tvb, pinfo, offset, tree, length); |
4057 | 133 | break; |
4058 | 371 | case OSPF_LSA_GRACE: |
4059 | 371 | dissect_ospf_lsa_grace_tlv(tvb, pinfo, offset, tree, length, OSPF_VERSION_2); |
4060 | 371 | break; |
4061 | 449 | case OSPF_LSA_EXT_PREFIX: |
4062 | 449 | dissect_ospf_lsa_ext_prefix(tvb, pinfo, offset, tree, length); |
4063 | 449 | break; |
4064 | 1.31k | case OSPF_LSA_EXT_LINK: |
4065 | 1.31k | dissect_ospf_lsa_ext_link(tvb, pinfo, offset, tree, length); |
4066 | 1.31k | break; |
4067 | 565 | case OSPF_LSA_EXT_IA_ASBR: |
4068 | 565 | dissect_ospf_lsa_ext_ia_asbr(tvb, pinfo, offset, tree, length); |
4069 | 565 | break; |
4070 | | |
4071 | 118 | default: |
4072 | 118 | proto_tree_add_expert_format(tree, pinfo, &ei_ospf_lsa_unknown_type, tvb, offset, length, |
4073 | 118 | "Unknown LSA Type %u", ls_id_type); |
4074 | 118 | break; |
4075 | 4.22k | } /* switch on opaque LSA id */ |
4076 | 4.22k | } |
4077 | | |
4078 | | static int |
4079 | | dissect_ospf_v2_lsa(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, |
4080 | | bool disassemble_body) |
4081 | 6.38k | { |
4082 | 6.38k | proto_tree *ospf_lsa_tree; |
4083 | 6.38k | proto_item *ti, *lsa_ti, *hidden_item; |
4084 | | |
4085 | 6.38k | uint8_t ls_type; |
4086 | 6.38k | uint16_t ls_length; |
4087 | 6.38k | int end_offset; |
4088 | 6.38k | uint32_t nr_links; |
4089 | 6.38k | uint16_t nr_metric; |
4090 | | |
4091 | | /* router LSA */ |
4092 | 6.38k | uint8_t link_type; |
4093 | 6.38k | uint16_t metric_counter; |
4094 | 6.38k | const char *metric_type_str; |
4095 | | |
4096 | | /* AS-external LSA */ |
4097 | 6.38k | uint8_t options; |
4098 | | |
4099 | | /* opaque LSA */ |
4100 | 6.38k | uint8_t ls_id_type; |
4101 | | |
4102 | 6.38k | uint8_t ls_length_constraints[] = { 0, 24, 28, 28, 28, 36, 20, 36, 20, 20, 20, 20 }; |
4103 | | |
4104 | 6.38k | ls_type = tvb_get_uint8(tvb, offset + 3); |
4105 | 6.38k | ls_length = tvb_get_ntohs(tvb, offset + 18); |
4106 | 6.38k | end_offset = offset + ls_length; |
4107 | | |
4108 | 6.38k | ospf_lsa_tree = proto_tree_add_subtree_format(tree, tvb, offset, |
4109 | 6.38k | disassemble_body?ls_length:OSPF_LSA_HEADER_LENGTH, |
4110 | 6.38k | ett_ospf_lsa, &lsa_ti, "LSA-type %d (%s), len %d", |
4111 | 6.38k | ls_type, val_to_str_const(ls_type, ls_type_vals, "Unknown"), |
4112 | 6.38k | ls_length); |
4113 | 6.38k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_age, tvb, |
4114 | 6.38k | offset, 2, ENC_BIG_ENDIAN); |
4115 | 6.38k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_donotage, tvb, |
4116 | 6.38k | offset, 2, ENC_BIG_ENDIAN); |
4117 | 6.38k | options = tvb_get_uint8 (tvb, offset + 2); |
4118 | 6.38k | if (ls_type != 7) |
4119 | 5.70k | proto_tree_add_bitmask(ospf_lsa_tree, tvb, offset + 2, hf_ospf_v2_options, ett_ospf_v2_options, bf_v2_options, ENC_BIG_ENDIAN); |
4120 | 676 | else |
4121 | 676 | 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); |
4122 | 6.38k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_type, tvb, |
4123 | 6.38k | offset + 3, 1, ENC_BIG_ENDIAN); |
4124 | 6.38k | if (ospf_ls_type_to_filter(ls_type) != -1) { |
4125 | 5.28k | hidden_item = proto_tree_add_item(ospf_lsa_tree, |
4126 | 5.28k | *hf_ospf_ls_type_array[ospf_ls_type_to_filter(ls_type)], tvb, |
4127 | 5.28k | offset + 3, 1, ENC_BIG_ENDIAN); |
4128 | 5.28k | proto_item_set_hidden(hidden_item); |
4129 | 5.28k | } |
4130 | | |
4131 | 6.38k | if (options & OSPF_V2_OPTIONS_MT) { |
4132 | 2.92k | metric_type_str = "MT-ID"; |
4133 | 3.46k | } else { |
4134 | 3.46k | metric_type_str = "TOS"; |
4135 | 3.46k | } |
4136 | | |
4137 | 6.38k | if (is_opaque(ls_type)) { |
4138 | 4.39k | ls_id_type = tvb_get_uint8(tvb, offset + 4); |
4139 | 4.39k | proto_tree_add_uint(ospf_lsa_tree, hf_ospf_ls_opaque_type, |
4140 | 4.39k | tvb, offset + 4, 1, ls_id_type); |
4141 | | |
4142 | 4.39k | switch (ls_id_type) { |
4143 | | |
4144 | 1.33k | case OSPF_LSA_MPLS_TE: |
4145 | 1.33k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_id_te_lsa_reserved, tvb, offset + 5, 1, ENC_BIG_ENDIAN); |
4146 | 1.33k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_mpls_te_instance, |
4147 | 1.33k | tvb, offset + 6, 2, ENC_BIG_ENDIAN); |
4148 | 1.33k | break; |
4149 | | |
4150 | 133 | case OSPF_LSA_OPAQUE_RI: |
4151 | 3.05k | default: |
4152 | 3.05k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_id_opaque_id, tvb, offset + 5, 3, ENC_BIG_ENDIAN); |
4153 | 3.05k | break; |
4154 | 4.39k | } |
4155 | 4.39k | } else { |
4156 | 1.98k | ls_id_type = 0; |
4157 | 1.98k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_id, tvb, |
4158 | 1.98k | offset + 4, 4, ENC_BIG_ENDIAN); |
4159 | 1.98k | } |
4160 | | |
4161 | 6.38k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_adv_router, |
4162 | 6.38k | tvb, offset + 8, 4, ENC_BIG_ENDIAN); |
4163 | 6.38k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_seqnum, tvb, |
4164 | 6.38k | offset + 12, 4, ENC_BIG_ENDIAN); |
4165 | 6.38k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_chksum, tvb, |
4166 | 6.38k | offset + 16, 2, ENC_BIG_ENDIAN); |
4167 | 6.38k | ti = proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_length, tvb, |
4168 | 6.38k | offset + 18, 2, ENC_BIG_ENDIAN); |
4169 | | |
4170 | 6.38k | if(ls_type && ls_type <= OSPF_LSTYPE_OP_ASWIDE) { |
4171 | 5.28k | if(ls_length < ls_length_constraints[ls_type]) { |
4172 | 32 | expert_add_info_format(pinfo, ti, &ei_ospf_lsa_bad_length, "Invalid LSA length (%u) for type %s, expected >= (%u)", |
4173 | 32 | ls_length, val_to_str_const(ls_type, ls_type_vals, "Unknown"), ls_length_constraints[ls_type]); |
4174 | 32 | return -1; |
4175 | 32 | } |
4176 | 5.28k | } else if(ls_length < 20) { /* As type is unknown, we check for a minimum length of 20 */ |
4177 | 147 | 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); |
4178 | 147 | return -1; |
4179 | 147 | } |
4180 | | |
4181 | | /* skip past the LSA header to the body */ |
4182 | 6.20k | offset += OSPF_LSA_HEADER_LENGTH; |
4183 | 6.20k | if (ls_length <= OSPF_LSA_HEADER_LENGTH) |
4184 | 123 | return offset; /* no data, or bogus length */ |
4185 | 6.08k | ls_length -= OSPF_LSA_HEADER_LENGTH; |
4186 | | |
4187 | 6.08k | if (!disassemble_body) |
4188 | 588 | return offset; |
4189 | | |
4190 | 5.49k | switch (ls_type){ |
4191 | | |
4192 | 139 | case OSPF_LSTYPE_ROUTER: |
4193 | | /* flags field in an router-lsa */ |
4194 | 139 | 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); |
4195 | | /* TODO: flags are only 1 byte, so there is an apparently unused byte here */ |
4196 | 139 | proto_tree_add_item_ret_uint(ospf_lsa_tree, hf_ospf_lsa_number_of_links, tvb, offset + 2, 2, ENC_BIG_ENDIAN, &nr_links); |
4197 | | |
4198 | 139 | offset += 4; |
4199 | | |
4200 | | /* nr_links links follow |
4201 | | * maybe we should put each of the links into its own subtree ??? |
4202 | | */ |
4203 | 388 | for (unsigned link_counter = 0; link_counter < nr_links; link_counter++) { |
4204 | 249 | proto_tree *ospf_lsa_router_link_tree; |
4205 | 249 | proto_item *ti_item; |
4206 | | |
4207 | | |
4208 | | /* check the Link Type and ID */ |
4209 | 249 | link_type = tvb_get_uint8(tvb, offset + 8); |
4210 | 249 | nr_metric = tvb_get_uint8(tvb, offset + 9); |
4211 | | |
4212 | 249 | ospf_lsa_router_link_tree = proto_tree_add_subtree_format(ospf_lsa_tree, tvb, offset, 12 + 4 * nr_metric, |
4213 | 249 | ett_ospf_lsa_router_link, NULL, "Type: %-8s ID: %-15s Data: %-15s Metric: %d", |
4214 | 249 | val_to_str_const(link_type, ospf_v3_lsa_type_short_vals, "Unknown"), |
4215 | 249 | tvb_ip_to_str(pinfo->pool, tvb, offset), |
4216 | 249 | tvb_ip_to_str(pinfo->pool, tvb, offset + 4), |
4217 | 249 | tvb_get_ntohs(tvb, offset + 10)); |
4218 | | |
4219 | 249 | ti_item = proto_tree_add_item(ospf_lsa_router_link_tree, hf_ospf_ls_router_linkid, |
4220 | 249 | tvb, offset, 4, ENC_BIG_ENDIAN); |
4221 | 249 | proto_item_append_text(ti_item, " - %s", val_to_str_const(link_type, ospf_v3_lsa_link_id_vals, "Unknown link ID")); |
4222 | | |
4223 | | /* link_data should be specified in detail (e.g. network mask) (depends on link type)*/ |
4224 | 249 | proto_tree_add_item(ospf_lsa_router_link_tree, hf_ospf_ls_router_linkdata, |
4225 | 249 | tvb, offset +4, 4, ENC_BIG_ENDIAN); |
4226 | | |
4227 | 249 | ti_item = proto_tree_add_item(ospf_lsa_router_link_tree, hf_ospf_ls_router_linktype, |
4228 | 249 | tvb, offset + 8, 1, ENC_BIG_ENDIAN); |
4229 | 249 | proto_item_append_text(ti_item, " - %s", val_to_str_const(link_type, ospf_v3_lsa_type_vals, "Unknown link type")); |
4230 | | |
4231 | 249 | ti_item = proto_tree_add_item(ospf_lsa_router_link_tree, hf_ospf_ls_router_nummetrics, |
4232 | 249 | tvb, offset + 9, 1, ENC_BIG_ENDIAN); |
4233 | 249 | proto_item_append_text(ti_item, " - %s", metric_type_str); |
4234 | 249 | proto_tree_add_item(ospf_lsa_router_link_tree, hf_ospf_ls_router_metric0, |
4235 | 249 | tvb, offset + 10, 2, ENC_BIG_ENDIAN); |
4236 | | |
4237 | 249 | offset += 12; |
4238 | | |
4239 | | /* nr_metric metrics may follow each link |
4240 | | * According to RFC4915 the TOS metrics was never deployed and was subsequently deprecated, |
4241 | | * but decoding still present because MT-ID use the same structure. |
4242 | | */ |
4243 | 518 | for (metric_counter = 0; metric_counter < nr_metric; metric_counter++) { |
4244 | 269 | proto_tree_add_uint_format(ospf_lsa_router_link_tree, hf_ospf_ls_metric, tvb, offset, 4, |
4245 | 269 | tvb_get_ntohs(tvb, offset + 2), "%s: %u, Metric: %u", |
4246 | 269 | metric_type_str, |
4247 | 269 | tvb_get_uint8(tvb, offset), |
4248 | 269 | tvb_get_ntohs(tvb, offset + 2)); |
4249 | 269 | offset += 4; |
4250 | 269 | } |
4251 | 249 | } |
4252 | 139 | break; |
4253 | | |
4254 | 131 | case OSPF_LSTYPE_NETWORK: |
4255 | 131 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_network_netmask, |
4256 | 131 | tvb, offset, 4, ENC_BIG_ENDIAN); |
4257 | 131 | offset += 4; |
4258 | | |
4259 | 131 | if (offset == end_offset) |
4260 | 0 | proto_tree_add_expert_format(ospf_lsa_tree, pinfo, &ei_ospf_lsa_constraint_missing, tvb, offset - 4, 4, "1 or more router-IDs required"); |
4261 | | |
4262 | 456 | while (offset < end_offset) { |
4263 | 325 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_network_attachrtr, |
4264 | 325 | tvb, offset, 4, ENC_BIG_ENDIAN); |
4265 | 325 | offset += 4; |
4266 | 325 | } |
4267 | 131 | break; |
4268 | | |
4269 | 175 | case OSPF_LSTYPE_SUMMARY: |
4270 | | /* Type 3 and 4 LSAs have the same format */ |
4271 | 263 | case OSPF_LSTYPE_ASBR: |
4272 | 263 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_asbr_netmask, |
4273 | 263 | tvb, offset, 4, ENC_BIG_ENDIAN); |
4274 | 263 | offset += 4; |
4275 | | |
4276 | 263 | if ((offset+4) > end_offset) |
4277 | 0 | expert_add_info_format(pinfo, lsa_ti, &ei_ospf_lsa_constraint_missing, "1 or more TOS metrics required"); |
4278 | | |
4279 | 848 | while (offset < end_offset) { |
4280 | 585 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_lsa_tos, tvb, offset, 1, ENC_NA); |
4281 | 585 | offset += 1; |
4282 | 585 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_metric, tvb, offset, 3, |
4283 | 585 | ENC_BIG_ENDIAN); |
4284 | 585 | offset += 3; |
4285 | 585 | } |
4286 | 263 | break; |
4287 | | |
4288 | 53 | case OSPF_LSTYPE_ASEXT: |
4289 | 160 | case OSPF_LSTYPE_ASEXT7: |
4290 | 160 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_asext_netmask, |
4291 | 160 | tvb, offset, 4, ENC_BIG_ENDIAN); |
4292 | 160 | offset += 4; |
4293 | | |
4294 | 160 | if ((offset+12) > end_offset) |
4295 | 0 | expert_add_info_format(pinfo, lsa_ti, &ei_ospf_lsa_constraint_missing, "1 or more TOS forwarding blocks required"); |
4296 | | |
4297 | 390 | while (offset < end_offset) { |
4298 | 230 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_lsa_external_type, tvb, offset, 1, ENC_NA); |
4299 | 230 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_lsa_external_tos, tvb, offset, 1, ENC_NA); |
4300 | 230 | offset += 1; |
4301 | | |
4302 | 230 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_metric, tvb, offset, 3, ENC_BIG_ENDIAN); |
4303 | 230 | offset += 3; |
4304 | | |
4305 | 230 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_asext_fwdaddr, |
4306 | 230 | tvb, offset, 4, ENC_BIG_ENDIAN); |
4307 | 230 | offset += 4; |
4308 | | |
4309 | 230 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_asext_extrtrtag, |
4310 | 230 | tvb, offset, 4, ENC_BIG_ENDIAN); |
4311 | 230 | offset += 4; |
4312 | 230 | } |
4313 | 160 | break; |
4314 | | |
4315 | 1.64k | case OSPF_LSTYPE_OP_LINKLOCAL: |
4316 | 2.73k | case OSPF_LSTYPE_OP_AREALOCAL: |
4317 | 4.22k | case OSPF_LSTYPE_OP_ASWIDE: |
4318 | | /* |
4319 | | * RFC 2370 opaque LSAs. |
4320 | | */ |
4321 | 4.22k | dissect_ospf_lsa_opaque(tvb, pinfo, offset, ospf_lsa_tree, ls_id_type, |
4322 | 4.22k | ls_length); |
4323 | 4.22k | offset += ls_length; |
4324 | 4.22k | break; |
4325 | | |
4326 | 85 | default: |
4327 | | /* unknown LSA type */ |
4328 | 85 | expert_add_info(pinfo, ti, &ei_ospf_lsa_unknown_type); |
4329 | 85 | offset += ls_length; |
4330 | 85 | break; |
4331 | 5.49k | } |
4332 | | /* return the offset of the next LSA */ |
4333 | 2.72k | return offset; |
4334 | 5.49k | } |
4335 | | |
4336 | | /* dissect common elements of the Network E-LSA and LSA */ |
4337 | | 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) |
4338 | 425 | { |
4339 | | /* reserved field */ |
4340 | 425 | uint8_t reserved = tvb_get_uint8(tvb, *offset); |
4341 | 425 | proto_item *ti = proto_tree_add_item(ospf_lsa_tree, hf_ospf_header_reserved, tvb, *offset, 1, ENC_NA); |
4342 | 425 | if (reserved != 0) |
4343 | 271 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
4344 | | |
4345 | | /* options field in an network-lsa */ |
4346 | 425 | proto_tree_add_bitmask(ospf_lsa_tree, tvb, *offset + 1, hf_ospf_v3_options, ett_ospf_v3_options, bf_v3_options, ENC_BIG_ENDIAN); |
4347 | | |
4348 | 425 | *offset += 4; |
4349 | 425 | *ls_length-=4; |
4350 | 425 | } |
4351 | | |
4352 | | static int |
4353 | | dissect_ospf_v3_lsa(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, |
4354 | | bool disassemble_body, uint8_t address_family) |
4355 | 3.97k | { |
4356 | 3.97k | proto_tree *ospf_lsa_tree, *router_tree = NULL, *router_entry_tree, *lsa_type_tree; |
4357 | 3.97k | proto_item *ti, *hidden_item, *type_item; |
4358 | | |
4359 | 3.97k | uint16_t ls_type; |
4360 | 3.97k | uint16_t ls_length; |
4361 | 3.97k | int end_offset; |
4362 | 3.97k | uint8_t reserved; |
4363 | | |
4364 | | /* router LSA */ |
4365 | 3.97k | uint32_t number_prefixes; |
4366 | 3.97k | uint8_t prefix_length; |
4367 | 3.97k | uint16_t reserved16; |
4368 | | |
4369 | 3.97k | uint16_t referenced_ls_type; |
4370 | 3.97k | uint16_t entry_count = 0; |
4371 | | |
4372 | 3.97k | uint8_t flags; |
4373 | | |
4374 | | |
4375 | 3.97k | ls_type = tvb_get_ntohs(tvb, offset + 2) & 0x1FFF; |
4376 | 3.97k | ls_length = tvb_get_ntohs(tvb, offset + 18); |
4377 | 3.97k | end_offset = offset + ls_length; |
4378 | | |
4379 | 3.97k | ospf_lsa_tree = proto_tree_add_subtree_format(tree, tvb, offset, |
4380 | 3.97k | disassemble_body?ls_length:OSPF_LSA_HEADER_LENGTH, |
4381 | 3.97k | ett_ospf_lsa, &type_item, "LSA-type %d (%s), len %d", |
4382 | 3.97k | ls_type, val_to_str_const(ls_type, v3_ls_type_vals, "Unknown"), |
4383 | 3.97k | ls_length); |
4384 | 3.97k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_age, tvb, offset, 2, ENC_BIG_ENDIAN); |
4385 | 3.97k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_do_not_age, tvb, offset, 2, ENC_BIG_ENDIAN); |
4386 | | |
4387 | 3.97k | ti = proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_ls_type, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
4388 | 3.97k | lsa_type_tree = proto_item_add_subtree(ti, ett_ospf_lsa_type); |
4389 | 3.97k | proto_tree_add_item(lsa_type_tree, hf_ospf_v3_ls_type_u, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
4390 | 3.97k | proto_tree_add_item(lsa_type_tree, hf_ospf_v3_ls_type_s12, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
4391 | 3.97k | proto_tree_add_item(lsa_type_tree, hf_ospf_v3_ls_type_fc, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
4392 | | |
4393 | 3.97k | if (ospf_v3_ls_type_to_filter(ls_type) != -1) { |
4394 | 2.37k | hidden_item = proto_tree_add_item(ospf_lsa_tree, |
4395 | 2.37k | *hf_ospf_v3_ls_type_array[ospf_v3_ls_type_to_filter(ls_type)], tvb, |
4396 | 2.37k | offset + 2, 2, ENC_BIG_ENDIAN); |
4397 | 2.37k | proto_item_set_hidden(hidden_item); |
4398 | 2.37k | } |
4399 | | |
4400 | 3.97k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_link_state_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
4401 | | |
4402 | 3.97k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_adv_router, |
4403 | 3.97k | tvb, offset + 8, 4, ENC_BIG_ENDIAN); |
4404 | 3.97k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_seqnum, tvb, |
4405 | 3.97k | offset + 12, 4, ENC_BIG_ENDIAN); |
4406 | 3.97k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_chksum, tvb, |
4407 | 3.97k | offset + 16, 2, ENC_BIG_ENDIAN); |
4408 | 3.97k | proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_length, tvb, |
4409 | 3.97k | offset + 18, 2, ENC_BIG_ENDIAN); |
4410 | | |
4411 | | /* skip past the LSA header to the body */ |
4412 | 3.97k | offset += OSPF_LSA_HEADER_LENGTH; |
4413 | 3.97k | ls_length -= OSPF_LSA_HEADER_LENGTH; |
4414 | | |
4415 | 3.97k | if (!disassemble_body) |
4416 | 480 | return offset; |
4417 | | |
4418 | 3.49k | switch (ls_type) |
4419 | 3.49k | { |
4420 | 144 | case OSPF_V3_LSTYPE_ROUTER: |
4421 | | /* flags field in an router-lsa */ |
4422 | 144 | 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); |
4423 | | |
4424 | | /* options field in an router-lsa */ |
4425 | 144 | proto_tree_add_bitmask(ospf_lsa_tree, tvb, offset + 1, hf_ospf_v3_options, ett_ospf_v3_options, bf_v3_options, ENC_BIG_ENDIAN); |
4426 | | |
4427 | | /* skip the router-lsa flags and options */ |
4428 | 144 | offset+=4; |
4429 | 144 | ls_length-=4; |
4430 | | |
4431 | 144 | if (ls_length > 0) |
4432 | 78 | router_tree = proto_tree_add_subtree(ospf_lsa_tree, tvb, offset, ls_length, |
4433 | 78 | ett_ospf_v3_router_interface, NULL, "Router Interfaces"); |
4434 | | |
4435 | | /* scan all router-lsa router interfaces */ |
4436 | 406 | while (ls_length > 0 ) { |
4437 | 262 | entry_count++; |
4438 | 262 | router_entry_tree = proto_tree_add_subtree_format(router_tree, tvb, offset, 16, |
4439 | 262 | ett_ospf_v3_router_interface_entry, NULL, "Entry #%d", entry_count); |
4440 | | |
4441 | 262 | proto_tree_add_item(router_entry_tree, hf_ospf_v3_lsa_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
4442 | | |
4443 | | /* reserved field */ |
4444 | 262 | reserved = tvb_get_uint8(tvb, offset+1); |
4445 | 262 | ti = proto_tree_add_item(router_entry_tree, hf_ospf_header_reserved, tvb, offset+1, 1, ENC_NA); |
4446 | 262 | if (reserved != 0) |
4447 | 134 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
4448 | | |
4449 | | /* metric */ |
4450 | 262 | proto_tree_add_item(router_entry_tree, hf_ospf_metric, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
4451 | | |
4452 | | /* Interface ID */ |
4453 | 262 | proto_tree_add_item(router_entry_tree, hf_ospf_v3_lsa_interface_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
4454 | | |
4455 | | /* Neighbor Interface ID */ |
4456 | 262 | proto_tree_add_item(router_entry_tree, hf_ospf_v3_lsa_neighbor_interface_id, tvb, offset + 8, 4, ENC_BIG_ENDIAN); |
4457 | | |
4458 | | /* Neighbor Router ID */ |
4459 | 262 | proto_tree_add_item(router_entry_tree, hf_ospf_v3_lsa_neighbor_router_id, tvb, offset + 12, 4, ENC_BIG_ENDIAN); |
4460 | | |
4461 | | /* skip to the (possible) next entry */ |
4462 | 262 | offset+=16; |
4463 | 262 | ls_length-=16; |
4464 | | |
4465 | 262 | } |
4466 | 144 | break; |
4467 | | |
4468 | 264 | case OSPF_V3_LSTYPE_NETWORK: |
4469 | 264 | dissect_ospf_v3_network_lsa_common(tvb, pinfo, ospf_lsa_tree, &offset, &ls_length); |
4470 | | |
4471 | 548 | while (ls_length > 0 ) { |
4472 | 284 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_attached_router, tvb, offset, 4, ENC_BIG_ENDIAN); |
4473 | 284 | ls_length-=4; |
4474 | 284 | offset += 4; |
4475 | 284 | } |
4476 | 264 | break; |
4477 | | |
4478 | 284 | case OSPF_V3_LSTYPE_INTER_AREA_PREFIX: |
4479 | | /* reserved field */ |
4480 | 284 | reserved = tvb_get_uint8(tvb, offset); |
4481 | 284 | ti = proto_tree_add_item(ospf_lsa_tree, hf_ospf_header_reserved, tvb, offset, 1, ENC_NA); |
4482 | 284 | if (reserved != 0) |
4483 | 142 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
4484 | | |
4485 | | /* metric */ |
4486 | 284 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_metric, tvb, offset + 1, 3, ENC_BIG_ENDIAN); |
4487 | | |
4488 | | /* prefix length */ |
4489 | 284 | prefix_length=tvb_get_uint8(tvb, offset+4); |
4490 | 284 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_prefix_length, tvb, offset+4, 1, ENC_BIG_ENDIAN); |
4491 | | |
4492 | | /* prefix options */ |
4493 | 284 | 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); |
4494 | | |
4495 | | /* 16 bits reserved */ |
4496 | 284 | reserved16=tvb_get_ntohs(tvb, offset+6); |
4497 | 284 | ti = proto_tree_add_item(ospf_lsa_tree, hf_ospf_header_reserved, tvb, offset+6, 2, ENC_NA); |
4498 | 284 | if (reserved16 != 0) |
4499 | 139 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
4500 | | |
4501 | 284 | offset+=8; |
4502 | | |
4503 | | /* address_prefix */ |
4504 | 284 | dissect_ospf_v3_address_prefix(tvb, pinfo, offset, prefix_length, ospf_lsa_tree, address_family); |
4505 | | |
4506 | 284 | offset+=(prefix_length+31)/32*4; |
4507 | 284 | break; |
4508 | | |
4509 | 162 | case OSPF_V3_LSTYPE_INTER_AREA_ROUTER: |
4510 | | /* reserved field */ |
4511 | 162 | reserved = tvb_get_uint8(tvb, offset); |
4512 | 162 | ti = proto_tree_add_item(ospf_lsa_tree, hf_ospf_header_reserved, tvb, offset, 1, ENC_NA); |
4513 | 162 | if (reserved != 0) |
4514 | 76 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
4515 | | |
4516 | | /* options field in an inter-area-router-lsa */ |
4517 | 162 | proto_tree_add_bitmask(ospf_lsa_tree, tvb, offset + 1, hf_ospf_v3_options, ett_ospf_v3_options, bf_v3_options, ENC_BIG_ENDIAN); |
4518 | | |
4519 | | /* reserved field */ |
4520 | 162 | reserved = tvb_get_uint8(tvb, offset+4); |
4521 | 162 | ti = proto_tree_add_item(ospf_lsa_tree, hf_ospf_header_reserved, tvb, offset+4, 1, ENC_NA); |
4522 | 162 | if (reserved != 0) |
4523 | 68 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
4524 | | |
4525 | | /* metric */ |
4526 | 162 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_metric, tvb, offset + 5, 3, ENC_BIG_ENDIAN); |
4527 | | |
4528 | | /* Destination Router ID */ |
4529 | 162 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_destination_router_id, tvb, offset + 8, 4, ENC_BIG_ENDIAN); |
4530 | | |
4531 | 162 | offset+=12; |
4532 | 162 | break; |
4533 | | |
4534 | 126 | case OSPF_V3_LSTYPE_NSSA: |
4535 | 438 | case OSPF_V3_LSTYPE_AS_EXTERNAL: |
4536 | | /* flags */ |
4537 | 438 | 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); |
4538 | 438 | flags=tvb_get_uint8(tvb, offset); |
4539 | | |
4540 | | /* 24 bits metric */ |
4541 | 438 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_metric, tvb, offset+1, 3, ENC_BIG_ENDIAN); |
4542 | | |
4543 | | /* prefix length */ |
4544 | 438 | prefix_length=tvb_get_uint8(tvb, offset+4); |
4545 | 438 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_prefix_length, tvb, offset+4, 1, ENC_BIG_ENDIAN); |
4546 | | |
4547 | | /* prefix options */ |
4548 | 438 | 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); |
4549 | | |
4550 | | /* referenced LS type */ |
4551 | 438 | referenced_ls_type=tvb_get_ntohs(tvb, offset+6); |
4552 | 438 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_referenced_ls_type, tvb, offset+6, 2, ENC_BIG_ENDIAN); |
4553 | | |
4554 | 438 | offset+=8; |
4555 | | |
4556 | | /* address_prefix */ |
4557 | 438 | dissect_ospf_v3_address_prefix(tvb, pinfo, offset, prefix_length, ospf_lsa_tree, address_family); |
4558 | | |
4559 | 438 | offset+=(prefix_length+31)/32*4; |
4560 | | |
4561 | | /* Forwarding Address (optional - only if F-flag is on) */ |
4562 | 438 | if ( (offset < end_offset) && (flags & OSPF_V3_AS_EXTERNAL_FLAG_F) ) { |
4563 | 69 | if (address_family == OSPF_AF_6) { |
4564 | 35 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_forwarding_address_ipv6, tvb, offset, 16, ENC_NA); |
4565 | 35 | } else { |
4566 | 34 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_forwarding_address_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN); |
4567 | 34 | } |
4568 | | |
4569 | 69 | offset+=16; |
4570 | 69 | } |
4571 | | |
4572 | | /* External Route Tag (optional - only if T-flag is on) */ |
4573 | 438 | if ( (offset < end_offset) && (flags & OSPF_V3_AS_EXTERNAL_FLAG_T) ) { |
4574 | 36 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_external_route_tag, tvb, offset, 4, ENC_BIG_ENDIAN); |
4575 | 36 | offset+=4; |
4576 | 36 | } |
4577 | | |
4578 | | /* Referenced Link State ID (optional - only if Referenced LS type is non-zero */ |
4579 | 438 | if ( (offset < end_offset) && (referenced_ls_type != 0) ) { |
4580 | 56 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_referenced_link_state_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
4581 | 56 | offset+=4; |
4582 | 56 | } |
4583 | 438 | break; |
4584 | | |
4585 | 228 | case OSPF_V3_LSTYPE_LINK: |
4586 | | /* router priority */ |
4587 | 228 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_router_priority, tvb, offset, 1, ENC_BIG_ENDIAN); |
4588 | | |
4589 | | /* options field in an link-lsa */ |
4590 | 228 | proto_tree_add_bitmask(ospf_lsa_tree, tvb, offset + 1, hf_ospf_v3_options, ett_ospf_v3_options, bf_v3_options, ENC_BIG_ENDIAN); |
4591 | | |
4592 | | /* Link-local Interface Address */ |
4593 | 228 | if (address_family == OSPF_AF_6) { |
4594 | 157 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_link_local_interface_address, tvb, offset + 4, 16, ENC_NA); |
4595 | 157 | } else { |
4596 | 71 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_link_local_interface_address_ipv4, tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
4597 | 71 | } |
4598 | | /* Number prefixes */ |
4599 | 228 | proto_tree_add_item_ret_uint(ospf_lsa_tree, hf_ospf_v3_lsa_num_prefixes, tvb, offset+20, 4, ENC_BIG_ENDIAN, &number_prefixes); |
4600 | | |
4601 | 228 | offset+=24; |
4602 | | |
4603 | 1.17k | while (number_prefixes > 0) { |
4604 | | |
4605 | | /* prefix length */ |
4606 | 949 | prefix_length=tvb_get_uint8(tvb, offset); |
4607 | 949 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_prefix_length, tvb, offset, 1, ENC_BIG_ENDIAN); |
4608 | | |
4609 | | /* prefix options */ |
4610 | 949 | 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); |
4611 | | |
4612 | | /* 16 bits reserved */ |
4613 | 949 | reserved16=tvb_get_ntohs(tvb, offset+2); |
4614 | 949 | ti = proto_tree_add_item(ospf_lsa_tree, hf_ospf_header_reserved, tvb, offset+2, 2, ENC_NA); |
4615 | 949 | if (reserved16 != 0) |
4616 | 514 | expert_add_info(pinfo, ti, &ei_ospf_header_reserved); |
4617 | | |
4618 | 949 | offset+=4; |
4619 | | |
4620 | | /* address_prefix */ |
4621 | 949 | dissect_ospf_v3_address_prefix(tvb, pinfo, offset, prefix_length, ospf_lsa_tree, address_family); |
4622 | | |
4623 | 949 | offset+=(prefix_length+31)/32*4; |
4624 | | |
4625 | 949 | number_prefixes--; |
4626 | | |
4627 | 949 | } |
4628 | 228 | break; |
4629 | | |
4630 | 110 | case OSPF_V3_LSTYPE_INTRA_AREA_PREFIX: |
4631 | | /* # prefixes */ |
4632 | 110 | proto_tree_add_item_ret_uint(ospf_lsa_tree, hf_ospf_v3_lsa_num_prefixes, tvb, offset, 2, ENC_BIG_ENDIAN, &number_prefixes); |
4633 | | |
4634 | | /* referenced LS type */ |
4635 | 110 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_referenced_ls_type, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
4636 | | |
4637 | | /* Referenced Link State ID */ |
4638 | 110 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_referenced_link_state_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
4639 | | |
4640 | | /* Referenced Advertising Router */ |
4641 | 110 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_referenced_advertising_router, tvb, offset + 8, 4, ENC_BIG_ENDIAN); |
4642 | | |
4643 | 110 | offset+=12; |
4644 | | |
4645 | 582 | while (number_prefixes > 0) { |
4646 | | |
4647 | | /* prefix length */ |
4648 | 472 | prefix_length=tvb_get_uint8(tvb, offset); |
4649 | 472 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_prefix_length, tvb, offset, 1, ENC_BIG_ENDIAN); |
4650 | | |
4651 | | /* prefix options */ |
4652 | 472 | 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); |
4653 | | |
4654 | | /* 16 bits metric */ |
4655 | 472 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_metric, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
4656 | | |
4657 | 472 | offset+=4; |
4658 | | |
4659 | | /* address_prefix */ |
4660 | 472 | dissect_ospf_v3_address_prefix(tvb, pinfo, offset, prefix_length, ospf_lsa_tree, address_family); |
4661 | | |
4662 | 472 | offset+=(prefix_length+31)/32*4; |
4663 | | |
4664 | 472 | number_prefixes--; |
4665 | 472 | } |
4666 | 110 | break; |
4667 | | |
4668 | 649 | case OSPF_V3_LSTYPE_OPAQUE_RI: |
4669 | 649 | dissect_ospf_lsa_opaque_ri(tvb, pinfo, offset, ospf_lsa_tree, ls_length); |
4670 | 649 | offset += ls_length; |
4671 | 649 | break; |
4672 | | |
4673 | 35 | case OSPF_V3_LSTYPE_E_INTRA_AREA_PREFIX: |
4674 | | /* prefixes, 0 as per RFC */ |
4675 | 35 | proto_tree_add_item_ret_uint(ospf_lsa_tree, hf_ospf_v3_lsa_num_prefixes, tvb, offset, 2, ENC_BIG_ENDIAN, &number_prefixes); |
4676 | | |
4677 | | /* referenced LS type */ |
4678 | 35 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_referenced_ls_type, tvb, offset+2, 2, ENC_BIG_ENDIAN); |
4679 | | |
4680 | | /* Referenced Link State ID */ |
4681 | 35 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_referenced_link_state_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
4682 | | |
4683 | | /* Referenced Advertising Router */ |
4684 | 35 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_referenced_advertising_router, tvb, offset + 8, 4, ENC_BIG_ENDIAN); |
4685 | | |
4686 | 35 | offset+=12; |
4687 | 35 | ls_length-=12; |
4688 | | |
4689 | 35 | dissect_ospf6_e_lsa_tlv(tvb, pinfo, offset, ospf_lsa_tree, ls_length, address_family); |
4690 | 35 | offset += ls_length; |
4691 | 35 | break; |
4692 | | |
4693 | 79 | case OSPF_V3_LSTYPE_E_ROUTER: |
4694 | | /* flags field in an router-lsa */ |
4695 | 79 | 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); |
4696 | | |
4697 | | /* options field in an router-lsa */ |
4698 | 79 | proto_tree_add_bitmask(ospf_lsa_tree, tvb, offset + 1, hf_ospf_v3_options, ett_ospf_v3_options, bf_v3_options, ENC_BIG_ENDIAN); |
4699 | | |
4700 | | /* skip the router-lsa flags and options */ |
4701 | 79 | offset+=4; |
4702 | 79 | ls_length-=4; |
4703 | 79 | dissect_ospf6_e_lsa_tlv(tvb, pinfo, offset, ospf_lsa_tree, ls_length, address_family); |
4704 | 79 | offset += ls_length; |
4705 | 79 | break; |
4706 | | |
4707 | 161 | case OSPF_V3_LSTYPE_E_NETWORK: |
4708 | | /* reserved field & options */ |
4709 | 161 | dissect_ospf_v3_network_lsa_common(tvb, pinfo, ospf_lsa_tree, &offset, &ls_length); |
4710 | | |
4711 | | /* Attached-Routers TLV */ |
4712 | 161 | dissect_ospf6_e_lsa_tlv(tvb, pinfo, offset, ospf_lsa_tree, ls_length, address_family); |
4713 | 161 | offset += ls_length; |
4714 | 161 | break; |
4715 | | |
4716 | 239 | case OSPF_V3_LSTYPE_E_AS_EXTERNAL: |
4717 | | /* External-Prefix TLV */ |
4718 | 239 | dissect_ospf6_e_lsa_tlv(tvb, pinfo, offset, ospf_lsa_tree, ls_length, address_family); |
4719 | 239 | offset += ls_length; |
4720 | 239 | break; |
4721 | | |
4722 | 66 | case OSPF_V3_LSTYPE_E_LINK: |
4723 | | /* router priority */ |
4724 | 66 | proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_router_priority, tvb, offset, 1, ENC_BIG_ENDIAN); |
4725 | | |
4726 | | /* options field in an link-lsa */ |
4727 | 66 | proto_tree_add_bitmask(ospf_lsa_tree, tvb, offset + 1, hf_ospf_v3_options, ett_ospf_v3_options, bf_v3_options, ENC_BIG_ENDIAN); |
4728 | | |
4729 | 66 | offset+=4; |
4730 | 66 | ls_length-=4; |
4731 | | |
4732 | 66 | dissect_ospf6_e_lsa_tlv(tvb, pinfo, offset, ospf_lsa_tree, ls_length, address_family); |
4733 | 66 | offset += ls_length; |
4734 | 66 | break; |
4735 | | |
4736 | 208 | case OSPF_V3_LSTYPE_GRACE: |
4737 | | /* Grace-TLV */ |
4738 | 208 | dissect_ospf_lsa_grace_tlv(tvb, pinfo, offset, ospf_lsa_tree, ls_length, OSPF_VERSION_3); |
4739 | 208 | offset += ls_length; |
4740 | 208 | break; |
4741 | | |
4742 | 105 | default: |
4743 | | /* unknown LSA type */ |
4744 | 105 | expert_add_info_format(pinfo, type_item, &ei_ospf_lsa_unknown_type, |
4745 | 105 | "Unknown LSA Type %u",ls_type); |
4746 | 105 | offset += ls_length; |
4747 | 105 | break; |
4748 | 3.49k | } |
4749 | | /* return the offset of the next LSA */ |
4750 | 2.12k | return offset; |
4751 | 3.49k | } |
4752 | | |
4753 | | static void dissect_ospf_v3_address_prefix(tvbuff_t *tvb, packet_info *pinfo, int offset, int prefix_length, proto_tree *tree, |
4754 | | uint8_t address_family) |
4755 | 2.99k | { |
4756 | | |
4757 | 2.99k | int bytes_to_process; |
4758 | 2.99k | ws_in6_addr prefix; |
4759 | | |
4760 | 2.99k | bytes_to_process=((prefix_length+31)/32)*4; |
4761 | | |
4762 | 2.99k | if (prefix_length > 128) { |
4763 | 110 | proto_tree_add_expert_format(tree, pinfo, &ei_ospf_lsa_bad_length, tvb, offset, bytes_to_process, |
4764 | 110 | "Address Prefix: length is invalid (%d, should be <= 128)", |
4765 | 110 | prefix_length); |
4766 | 110 | return; |
4767 | 110 | } |
4768 | | |
4769 | 2.88k | memset(prefix.bytes, 0, sizeof prefix.bytes); |
4770 | 2.88k | if (bytes_to_process != 0) { |
4771 | 374 | tvb_memcpy(tvb, prefix.bytes, offset, bytes_to_process); |
4772 | 374 | if (prefix_length % 8) { |
4773 | 208 | prefix.bytes[bytes_to_process - 1] &= |
4774 | 208 | ((0xff00 >> (prefix_length % 8)) & 0xff); |
4775 | 208 | } |
4776 | 374 | } |
4777 | 2.88k | if (address_family == OSPF_AF_6) { |
4778 | 2.34k | proto_tree_add_ipv6(tree, hf_ospf_v3_address_prefix_ipv6, tvb, offset, bytes_to_process, |
4779 | 2.34k | &prefix); |
4780 | 2.34k | } else { |
4781 | 543 | proto_tree_add_item(tree, hf_ospf_v3_address_prefix_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN); |
4782 | 543 | } |
4783 | | |
4784 | 2.88k | } |
4785 | | |
4786 | | |
4787 | | void |
4788 | | proto_register_ospf(void) |
4789 | 16 | { |
4790 | 16 | static hf_register_info ospff_info[] = { |
4791 | | |
4792 | 16 | {&hf_ospf_header, |
4793 | 16 | { "OSPF Header", "ospf.header", FT_NONE, BASE_NONE, NULL, 0x0, |
4794 | 16 | NULL, HFILL }}, |
4795 | 16 | {&hf_ospf_header_version, |
4796 | 16 | { "Version", "ospf.version", FT_UINT8, BASE_DEC, NULL, 0x0, |
4797 | 16 | NULL, HFILL }}, |
4798 | | /* Message type number */ |
4799 | 16 | {&hf_ospf_header_msg_type, |
4800 | 16 | { "Message Type", "ospf.msg", FT_UINT8, BASE_DEC, VALS(pt_vals), 0x0, |
4801 | 16 | NULL, HFILL }}, |
4802 | 16 | {&hf_ospf_header_packet_length, |
4803 | 16 | { "Packet Length", "ospf.packet_length", FT_UINT16, BASE_DEC, NULL, 0x0, |
4804 | 16 | NULL, HFILL }}, |
4805 | 16 | {&hf_ospf_header_src_router, |
4806 | 16 | { "Source OSPF Router", "ospf.srcrouter", FT_IPv4, BASE_NONE, NULL, 0x0, |
4807 | 16 | NULL, HFILL }}, |
4808 | 16 | {&hf_ospf_header_area_id, |
4809 | 16 | { "Area ID", "ospf.area_id", FT_IPv4, BASE_NONE, NULL, 0x0, |
4810 | 16 | NULL, HFILL }}, |
4811 | 16 | {&hf_ospf_header_checksum, |
4812 | 16 | { "Checksum", "ospf.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, |
4813 | 16 | NULL, HFILL }}, |
4814 | 16 | {&hf_ospf_tlv_type, |
4815 | 16 | { "TLV Type", "ospf.tlv_type", FT_UINT16, BASE_DEC, NULL, 0x0, |
4816 | 16 | NULL, HFILL }}, |
4817 | 16 | {&hf_ospf_tlv_length, |
4818 | 16 | { "TLV Length", "ospf.tlv_length", FT_UINT16, BASE_DEC, NULL, 0x0, |
4819 | 16 | NULL, HFILL }}, |
4820 | 16 | {&hf_ospf_header_instance_id, |
4821 | 16 | { "Instance ID", "ospf.instance_id", FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(ospf_instance_id_rvals), 0x0, |
4822 | 16 | NULL, HFILL }}, |
4823 | | /* OSPF Header v2 (Auth) */ |
4824 | 16 | {&hf_ospf_header_auth_type, |
4825 | 16 | { "Auth Type", "ospf.auth.type", FT_UINT8, BASE_DEC, VALS(auth_vals), 0x0, |
4826 | 16 | NULL, HFILL }}, |
4827 | 16 | {&hf_ospf_header_auth_data_none, |
4828 | 16 | { "Auth Data (none)", "ospf.auth.none", FT_BYTES, BASE_NONE, NULL, 0x0, |
4829 | 16 | NULL, HFILL }}, |
4830 | 16 | {&hf_ospf_header_auth_data_simple, |
4831 | 16 | { "Auth Data (Simple)", "ospf.auth.simple", FT_STRING, BASE_NONE, NULL, 0x0, |
4832 | 16 | NULL, HFILL }}, |
4833 | 16 | {&hf_ospf_header_auth_crypt_key_id, |
4834 | 16 | { "Auth Crypt Key id", "ospf.auth.crypt.key_id", FT_UINT8, BASE_DEC, NULL, 0x0, |
4835 | 16 | NULL, HFILL }}, |
4836 | 16 | {&hf_ospf_header_auth_crypt_data_length, |
4837 | 16 | { "Auth Crypt Data Length", "ospf.auth.crypt.data_length", FT_UINT8, BASE_DEC, NULL, 0x0, |
4838 | 16 | NULL, HFILL }}, |
4839 | 16 | {&hf_ospf_header_auth_crypt_seq_nbr, |
4840 | 16 | { "Auth Crypt Sequence Number", "ospf.auth.crypt.seq_nbr", FT_UINT32, BASE_HEX, NULL, 0x0, |
4841 | 16 | NULL, HFILL }}, |
4842 | 16 | {&hf_ospf_header_auth_crypt_data, |
4843 | 16 | { "Auth Crypt Data", "ospf.auth.crypt.data", FT_BYTES, BASE_NONE, NULL, 0x0, |
4844 | 16 | NULL, HFILL }}, |
4845 | 16 | {&hf_ospf_header_auth_data_unknown, |
4846 | 16 | { "Auth Unknown", "ospf.auth.unknown", FT_BYTES, BASE_NONE, NULL, 0x0, |
4847 | 16 | NULL, HFILL }}, |
4848 | | |
4849 | | /* OSPF Header v3 */ |
4850 | 16 | {&hf_ospf_v3_header_instance_id, |
4851 | 16 | { "Instance ID", "ospf.v3.instance_id", FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(ospfv3_instance_id_rvals), 0x0, |
4852 | 16 | NULL, HFILL }}, |
4853 | | |
4854 | 16 | {&hf_ospf_header_reserved, |
4855 | 16 | { "Reserved", "ospf.reserved", FT_BYTES, BASE_NONE, NULL, 0x0, |
4856 | 16 | "Must be zero", HFILL }}, |
4857 | | |
4858 | | /* Message types */ |
4859 | 16 | {&hf_ospf_msg_hello, |
4860 | 16 | { "Hello", "ospf.msg.hello", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4861 | 16 | NULL, HFILL }}, |
4862 | 16 | {&hf_ospf_msg_db_desc, |
4863 | 16 | { "Database Description", "ospf.msg.dbdesc", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4864 | 16 | NULL, HFILL }}, |
4865 | 16 | {&hf_ospf_msg_ls_req, |
4866 | 16 | { "Link State Adv Request", "ospf.msg.lsreq", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4867 | 16 | NULL, HFILL }}, |
4868 | 16 | {&hf_ospf_msg_ls_upd, |
4869 | 16 | { "Link State Adv Update", "ospf.msg.lsupdate", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4870 | 16 | NULL, HFILL }}, |
4871 | 16 | {&hf_ospf_msg_ls_ack, |
4872 | 16 | { "Link State Adv Acknowledgement", "ospf.msg.lsack", FT_BOOLEAN, |
4873 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
4874 | | |
4875 | | /* Hello Packet */ |
4876 | 16 | {&hf_ospf_hello, |
4877 | 16 | { "OSPF Hello Packet", "ospf.hello", FT_NONE, |
4878 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
4879 | 16 | {&hf_ospf_hello_network_mask, |
4880 | 16 | { "Network Mask", "ospf.hello.network_mask", FT_IPv4, |
4881 | 16 | BASE_NETMASK, NULL, 0x0, NULL, HFILL }}, |
4882 | 16 | {&hf_ospf_hello_interface_id, |
4883 | 16 | { "Interface ID", "ospf.hello.interface_id", FT_UINT32, |
4884 | 16 | BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
4885 | 16 | {&hf_ospf_hello_hello_interval, |
4886 | 16 | { "Hello Interval [sec]", "ospf.hello.hello_interval", FT_UINT32, |
4887 | 16 | BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
4888 | 16 | {&hf_ospf_hello_router_priority, |
4889 | 16 | { "Router Priority", "ospf.hello.router_priority", FT_UINT8, |
4890 | 16 | BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
4891 | 16 | {&hf_ospf_hello_router_dead_interval, |
4892 | 16 | { "Router Dead Interval [sec]", "ospf.hello.router_dead_interval", FT_UINT32, |
4893 | 16 | BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
4894 | 16 | {&hf_ospf_hello_designated_router, |
4895 | 16 | { "Designated Router", "ospf.hello.designated_router", FT_IPv4, |
4896 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
4897 | 16 | {&hf_ospf_hello_backup_designated_router, |
4898 | 16 | { "Backup Designated Router", "ospf.hello.backup_designated_router", FT_IPv4, |
4899 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
4900 | 16 | {&hf_ospf_hello_active_neighbor, |
4901 | 16 | { "Active Neighbor", "ospf.hello.active_neighbor", FT_IPv4, |
4902 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
4903 | | |
4904 | | |
4905 | | /* Authentication trailer */ |
4906 | 16 | {&hf_ospf_at, |
4907 | 16 | { "OSPF Authentication Trailer", "ospf.at", FT_NONE, |
4908 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
4909 | 16 | {&hf_ospf_at_auth_type, |
4910 | 16 | { "Authentication Type", "ospf.at.auth_type", FT_UINT16, |
4911 | 16 | BASE_DEC, VALS(ospf_at_authentication_type_vals), 0x0, "Identifying the type of authentication", HFILL }}, |
4912 | 16 | {&hf_ospf_at_auth_data_len, |
4913 | 16 | { "Authentication Data Length", "ospf.at.auth_data_len", FT_UINT16, |
4914 | 16 | 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 }}, |
4915 | 16 | {&hf_ospf_at_reserved, |
4916 | 16 | { "Reserved", "ospf.at.reserved", FT_UINT16, |
4917 | 16 | BASE_HEX, NULL, 0x0, "It SHOULD be set to 0", HFILL }}, |
4918 | 16 | {&hf_ospf_at_sa_id, |
4919 | 16 | { "Security Association Identifier (SA ID)", "ospf.at.sa_id", FT_UINT16, |
4920 | 16 | BASE_HEX, NULL, 0x0, "That maps to the authentication algorithm and the secret key used to create the message digest", HFILL }}, |
4921 | 16 | {&hf_ospf_at_crypto_seq_nbr, |
4922 | 16 | { "Cryptographic Sequence Number", "ospf.at.crypto_seq_nbr", FT_UINT64, |
4923 | 16 | BASE_DEC, NULL, 0x0, "Increasing sequence number that is used to guard against replay attacks", HFILL }}, |
4924 | 16 | {&hf_ospf_at_auth_data, |
4925 | 16 | { "Authentication Data", "ospf.at.auth_data", FT_BYTES, |
4926 | 16 | BASE_NONE, NULL, 0x0, "Variable data that is carrying the digest for the protocol packet and optional LLS data block", HFILL }}, |
4927 | | |
4928 | | /* LS Types */ |
4929 | 16 | {&hf_ospf_ls_type, |
4930 | 16 | { "LS Type", "ospf.lsa", FT_UINT32, BASE_DEC, |
4931 | 16 | VALS(ls_type_vals), 0x0, NULL, HFILL }}, |
4932 | 16 | {&hf_ospf_ls_age, |
4933 | 16 | {"LS Age (seconds)", "ospf.lsa.age", FT_UINT16, |
4934 | 16 | BASE_DEC, NULL, ~OSPF_DNA_LSA, NULL, HFILL }}, |
4935 | 16 | {&hf_ospf_ls_donotage, |
4936 | 16 | {"Do Not Age Flag", "ospf.lsa.donotage", FT_UINT16, |
4937 | 16 | BASE_DEC, NULL, OSPF_DNA_LSA, NULL, HFILL }}, |
4938 | 16 | {&hf_ospf_ls_id, |
4939 | 16 | {"Link State ID", "ospf.lsa.id", FT_IPv4, |
4940 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
4941 | 16 | {&hf_ospf_ls_seqnum, |
4942 | 16 | {"Sequence Number", "ospf.lsa.seqnum", FT_UINT32, |
4943 | 16 | BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
4944 | 16 | {&hf_ospf_ls_chksum, |
4945 | 16 | {"Checksum", "ospf.lsa.chksum", FT_UINT16, |
4946 | 16 | BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
4947 | 16 | {&hf_ospf_ls_length, |
4948 | 16 | {"Length", "ospf.lsa.length", FT_UINT16, |
4949 | 16 | BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
4950 | | |
4951 | 16 | {&hf_ospf_ls_opaque_type, |
4952 | 16 | { "Link State ID Opaque Type", "ospf.lsid_opaque_type", FT_UINT8, BASE_DEC, |
4953 | 16 | VALS(ls_opaque_type_vals), 0x0, NULL, HFILL }}, |
4954 | | |
4955 | 16 | {&hf_ospf_ls_mpls_te_instance, |
4956 | 16 | { "Link State ID TE-LSA Instance", "ospf.lsid_te_lsa.instance", FT_UINT16, BASE_DEC, |
4957 | 16 | NULL, 0x0, NULL, HFILL }}, |
4958 | | |
4959 | 16 | {&hf_ospf_ls_router, |
4960 | 16 | { "Router LSA", "ospf.lsa.router", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4961 | 16 | NULL, HFILL }}, |
4962 | 16 | {&hf_ospf_ls_router_linktype, |
4963 | 16 | { "Link Type", "ospf.lsa.router.linktype", FT_UINT8, BASE_DEC, NULL, 0x0, |
4964 | 16 | NULL, HFILL }}, |
4965 | 16 | {&hf_ospf_ls_router_linkid, |
4966 | 16 | { "Link ID", "ospf.lsa.router.linkid", FT_IPv4, BASE_NONE, NULL, 0x0, |
4967 | 16 | NULL, HFILL }}, |
4968 | 16 | {&hf_ospf_ls_router_linkdata, |
4969 | 16 | { "Link Data", "ospf.lsa.router.linkdata", FT_IPv4, BASE_NONE, NULL, 0x0, |
4970 | 16 | NULL, HFILL }}, |
4971 | 16 | {&hf_ospf_ls_router_nummetrics, |
4972 | 16 | { "Number of Metrics", "ospf.lsa.router.nummetrics", FT_UINT8, BASE_DEC, NULL, 0x0, |
4973 | 16 | NULL, HFILL }}, |
4974 | 16 | {&hf_ospf_ls_router_metric0, |
4975 | 16 | { "0 Metric", "ospf.lsa.router.metric0", FT_UINT16, BASE_DEC, NULL, 0x0, |
4976 | 16 | NULL, HFILL }}, |
4977 | | |
4978 | 16 | {&hf_ospf_ls_network, |
4979 | 16 | { "Network LSA", "ospf.lsa.network", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4980 | 16 | NULL, HFILL }}, |
4981 | 16 | {&hf_ospf_ls_network_netmask, |
4982 | 16 | { "Netmask", "ospf.lsa.network.netmask", FT_IPv4, BASE_NETMASK, NULL, 0x0, |
4983 | 16 | NULL, HFILL }}, |
4984 | 16 | {&hf_ospf_ls_network_attachrtr, |
4985 | 16 | { "Attached Router", "ospf.lsa.network.attchrtr", FT_IPv4, BASE_NONE, NULL, 0x0, |
4986 | 16 | NULL, HFILL }}, |
4987 | | |
4988 | 16 | {&hf_ospf_ls_summary, |
4989 | 16 | { "Summary LSA (IP Network)", "ospf.lsa.summary", FT_BOOLEAN, BASE_NONE, |
4990 | 16 | NULL, 0x0, NULL, HFILL }}, |
4991 | 16 | {&hf_ospf_ls_asbr, |
4992 | 16 | { "Summary LSA (ASBR)", "ospf.lsa.asbr", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4993 | 16 | NULL, HFILL }}, |
4994 | 16 | {&hf_ospf_ls_asbr_netmask, |
4995 | 16 | { "Netmask", "ospf.lsa.asbr.netmask", FT_IPv4, BASE_NETMASK, NULL, 0x0, |
4996 | 16 | NULL, HFILL }}, |
4997 | | |
4998 | 16 | {&hf_ospf_ls_asext, |
4999 | 16 | { "AS-External LSA (ASBR)", "ospf.lsa.asext", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5000 | 16 | NULL, HFILL }}, |
5001 | 16 | {&hf_ospf_ls_asext_netmask, |
5002 | 16 | { "Netmask", "ospf.lsa.asext.netmask", FT_IPv4, BASE_NETMASK, NULL, 0x0, |
5003 | 16 | NULL, HFILL }}, |
5004 | 16 | {&hf_ospf_ls_asext_fwdaddr, |
5005 | 16 | { "Forwarding Address", "ospf.lsa.asext.fwdaddr", FT_IPv4, BASE_NONE, NULL, 0x0, |
5006 | 16 | NULL, HFILL }}, |
5007 | 16 | {&hf_ospf_ls_asext_extrtrtag, |
5008 | 16 | { "External Route Tag", "ospf.lsa.asext.extrttag", FT_UINT32, BASE_DEC, NULL, 0x0, |
5009 | 16 | NULL, HFILL }}, |
5010 | | |
5011 | 16 | {&hf_ospf_ls_grpmember, |
5012 | 16 | { "Group Membership LSA", "ospf.lsa.member", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5013 | 16 | NULL, HFILL }}, |
5014 | 16 | {&hf_ospf_ls_asext7, |
5015 | 16 | { "NSSA AS-External LSA", "ospf.lsa.nssa", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5016 | 16 | NULL, HFILL }}, |
5017 | 16 | {&hf_ospf_ls_extattr, |
5018 | 16 | { "External Attributes LSA", "ospf.lsa.attr", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5019 | 16 | NULL, HFILL }}, |
5020 | 16 | {&hf_ospf_ls_opaque, |
5021 | 16 | { "Opaque LSA", "ospf.lsa.opaque", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5022 | 16 | NULL, HFILL }}, |
5023 | | |
5024 | | /* OSPFv3 E-LSA TLV */ |
5025 | 16 | {&hf_ospf_v3_e_lsa_tlv_type, |
5026 | 16 | { "TLV Type", "ospf.v3.elsa.tlv_type", FT_UINT16, BASE_DEC, NULL, 0x0, |
5027 | 16 | NULL, HFILL }}, |
5028 | 16 | {&hf_ospf_v3_e_lsa_tlv_length, |
5029 | 16 | { "TLV Length", "ospf.v3.elsa.tlv_length", FT_UINT16, BASE_DEC, NULL, 0x0, |
5030 | 16 | NULL, HFILL }}, |
5031 | | |
5032 | | /* OSPFv3 LS Types */ |
5033 | 16 | {&hf_ospf_v3_ls_type, |
5034 | 16 | { "LS Type", "ospf.v3.lsa", FT_UINT16, BASE_HEX, NULL, 0x0, |
5035 | 16 | NULL, HFILL }}, |
5036 | 16 | {&hf_ospf_v3_ls_type_u, |
5037 | 16 | { "LSA Handling", "ospf.v3.lsa.u", FT_BOOLEAN, 16, TFS(&tfs_v3_ls_type_u), 0x8000, |
5038 | 16 | NULL, HFILL }}, |
5039 | 16 | {&hf_ospf_v3_ls_type_s12, |
5040 | 16 | { "Flooding Scope", "ospf.v3.lsa.s12", FT_UINT16, BASE_HEX, VALS(v3_ls_type_s12_vals), 0x6000, |
5041 | 16 | NULL, HFILL }}, |
5042 | 16 | {&hf_ospf_v3_ls_type_fc, |
5043 | 16 | { "Function Code", "ospf.v3.lsa.fc", FT_UINT16, BASE_DEC, VALS(v3_ls_type_vals), 0x1FFF, |
5044 | 16 | NULL, HFILL }}, |
5045 | | |
5046 | 16 | {&hf_ospf_v3_ls_router, |
5047 | 16 | { "Router-LSA", "ospf.v3.lsa.router", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5048 | 16 | NULL, HFILL }}, |
5049 | 16 | {&hf_ospf_v3_ls_network, |
5050 | 16 | { "Network-LSA", "ospf.v3.lsa.network", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5051 | 16 | NULL, HFILL }}, |
5052 | 16 | {&hf_ospf_v3_ls_inter_area_prefix, |
5053 | 16 | { "Inter-Area-Prefix-LSA", "ospf.v3.lsa.interprefix", FT_BOOLEAN, BASE_NONE, |
5054 | 16 | NULL, 0x0, NULL, HFILL }}, |
5055 | 16 | {&hf_ospf_v3_ls_inter_area_router, |
5056 | 16 | { "Inter-Area-Router-LSA", "ospf.v3.lsa.interrouter", FT_BOOLEAN, BASE_NONE, |
5057 | 16 | NULL, 0x0, NULL, HFILL }}, |
5058 | 16 | {&hf_ospf_v3_ls_as_external, |
5059 | 16 | { "AS-External-LSA", "ospf.v3.lsa.asext", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5060 | 16 | NULL, HFILL }}, |
5061 | 16 | {&hf_ospf_v3_ls_group_membership, |
5062 | 16 | { "Group-Membership-LSA", "ospf.v3.lsa.member", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5063 | 16 | NULL, HFILL }}, |
5064 | 16 | {&hf_ospf_v3_ls_nssa, |
5065 | 16 | { "NSSA-LSA", "ospf.v3.lsa.nssa", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5066 | 16 | NULL, HFILL }}, |
5067 | 16 | {&hf_ospf_v3_ls_link, |
5068 | 16 | { "Link-LSA", "ospf.v3.lsa.link", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5069 | 16 | NULL, HFILL }}, |
5070 | 16 | {&hf_ospf_v3_ls_intra_area_prefix, |
5071 | 16 | { "Intra-Area-Prefix-LSA", "ospf.v3.lsa.intraprefix", FT_BOOLEAN, BASE_NONE, |
5072 | 16 | NULL, 0x0, NULL, HFILL }}, |
5073 | 16 | {&hf_ospf_v3_elsa_intra_area_prefix, |
5074 | 16 | { "E-Intra-Area-Prefix-LSA", "ospf.v3.elsa.intraprefix", FT_BOOLEAN, BASE_NONE, |
5075 | 16 | NULL, 0x0, NULL, HFILL }}, |
5076 | 16 | {&hf_ospf_v3_ls_opaque_ri, |
5077 | 16 | { "Router Information Opaque-LSA", "ospf.v3.lsa.opaque", FT_BOOLEAN, BASE_NONE, |
5078 | 16 | NULL, 0x0, NULL, HFILL }}, |
5079 | | |
5080 | | /* Other interesting OSPF values */ |
5081 | | |
5082 | 16 | {&hf_ospf_adv_router, |
5083 | 16 | { "Advertising Router", "ospf.advrouter", FT_IPv4, BASE_NONE, NULL, 0x0, |
5084 | 16 | NULL, HFILL }}, |
5085 | | |
5086 | 16 | {&hf_ospf_ls_mpls, |
5087 | 16 | { "MPLS Traffic Engineering LSA", "ospf.lsa.mpls", FT_BOOLEAN, |
5088 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5089 | | |
5090 | 16 | {&hf_ospf_ls_mpls_routerid, |
5091 | 16 | { "MPLS/TE Router ID", "ospf.mpls.routerid", FT_IPv4, BASE_NONE, NULL, 0x0, |
5092 | 16 | NULL, HFILL }}, |
5093 | | |
5094 | 16 | {&hf_ospf_ls_mpls_linktype, |
5095 | 16 | { "MPLS/TE Link Type", "ospf.mpls.linktype", FT_UINT8, BASE_DEC, |
5096 | 16 | VALS(mpls_link_stlv_ltype_str), 0x0, NULL, HFILL }}, |
5097 | 16 | {&hf_ospf_ls_mpls_linkid, |
5098 | 16 | { "MPLS/TE Link ID", "ospf.mpls.linkid", FT_IPv4, BASE_NONE, NULL, 0x0, |
5099 | 16 | NULL, HFILL }}, |
5100 | 16 | {&hf_ospf_ls_mpls_local_addr, |
5101 | 16 | { "MPLS/TE Local Interface Address", "ospf.mpls.local_addr", FT_IPv4, |
5102 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5103 | 16 | {&hf_ospf_ls_mpls_remote_addr, |
5104 | 16 | { "MPLS/TE Remote Interface Address", "ospf.mpls.remote_addr", FT_IPv4, |
5105 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5106 | 16 | {&hf_ospf_ls_mpls_te_metric, |
5107 | 16 | { "MPLS/TE Metric", "ospf.mpls.te_metric", FT_UINT32, |
5108 | 16 | BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5109 | | |
5110 | 16 | {&hf_ospf_ls_mpls_local_ifid, |
5111 | 16 | { "MPLS/TE Local Interface Index", "ospf.mpls.local_id", FT_UINT32, |
5112 | 16 | BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5113 | 16 | {&hf_ospf_ls_mpls_remote_ifid, |
5114 | 16 | { "MPLS/TE Remote Interface Index", "ospf.mpls.remote_id", FT_UINT32, |
5115 | 16 | BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5116 | 16 | {&hf_ospf_ls_mpls_linkcolor, |
5117 | 16 | { "MPLS/TE Link Resource Class/Color", "ospf.mpls.linkcolor", FT_UINT32, |
5118 | 16 | BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
5119 | 16 | {&hf_ospf_ls_mpls_group, |
5120 | 16 | { "MPLS/TE Group", "ospf.mpls.group", FT_UINT32, |
5121 | 16 | BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
5122 | 16 | {&hf_ospf_ls_mpls_link_max_bw, |
5123 | 16 | { "Link Max BW", "ospf.mpls.link_max_bw", FT_FLOAT, |
5124 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5125 | 16 | {&hf_ospf_ls_mpls_bc_model_id, |
5126 | 16 | { "MPLS/DSTE Bandwidth Constraints Model Id", "ospf.mpls.bc.model_id", FT_UINT8, |
5127 | 16 | BASE_RANGE_STRING | BASE_DEC, RVALS(mpls_link_stlv_bcmodel_rvals), 0x0, |
5128 | 16 | NULL, HFILL }}, |
5129 | | |
5130 | 16 | {&hf_ospf_ls_oif_local_node_id, |
5131 | 16 | { "Local Node ID", "ospf.oif.local_node_id", FT_IPv4, |
5132 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5133 | 16 | {&hf_ospf_ls_oif_remote_node_id, |
5134 | 16 | { "Remote Node ID", "ospf.oif.remote_node_id", FT_IPv4, |
5135 | 16 | BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5136 | | |
5137 | 16 | {&hf_ospf_v2_options, |
5138 | 16 | { "Options", "ospf.v2.options", FT_UINT8, BASE_HEX, |
5139 | 16 | NULL, 0x0, NULL, HFILL }}, |
5140 | 16 | {&hf_ospf_v2_options_mt, |
5141 | 16 | { "(MT) Multi-Topology Routing", "ospf.v2.options.mt", FT_BOOLEAN, 8, |
5142 | 16 | TFS(&tfs_yes_no), OSPF_V2_OPTIONS_MT, NULL, HFILL }}, |
5143 | 16 | {&hf_ospf_v2_options_e, |
5144 | 16 | { "(E) External Routing", "ospf.v2.options.e", FT_BOOLEAN, 8, |
5145 | 16 | TFS(&tfs_capable_not_capable), OSPF_V2_OPTIONS_E, NULL, HFILL }}, |
5146 | 16 | {&hf_ospf_v2_options_mc, |
5147 | 16 | { "(MC) Multicast", "ospf.v2.options.mc", FT_BOOLEAN, 8, |
5148 | 16 | TFS(&tfs_capable_not_capable), OSPF_V2_OPTIONS_MC, NULL, HFILL }}, |
5149 | 16 | {&hf_ospf_v2_options_n, |
5150 | 16 | { "(N) NSSA", "ospf.v2.options.n", FT_BOOLEAN, 8, |
5151 | 16 | TFS(&tfs_supported_not_supported), OSPF_V2_OPTIONS_NP, NULL, HFILL }}, |
5152 | 16 | {&hf_ospf_v2_options_p, |
5153 | 16 | { "(P) Propagate", "ospf.v2.options.p", FT_BOOLEAN, 8, |
5154 | 16 | TFS(&tfs_set_notset), OSPF_V2_OPTIONS_NP, NULL, HFILL }}, |
5155 | 16 | {&hf_ospf_v2_options_l, |
5156 | 16 | { "(L) LLS Data block", "ospf.v2.options.l", FT_BOOLEAN, 8, |
5157 | 16 | TFS(&tfs_present_not_present), OSPF_V2_OPTIONS_L, NULL, HFILL }}, |
5158 | 16 | {&hf_ospf_v2_options_dc, |
5159 | 16 | { "(DC) Demand Circuits", "ospf.v2.options.dc", FT_BOOLEAN, 8, |
5160 | 16 | TFS(&tfs_supported_not_supported), OSPF_V2_OPTIONS_DC, NULL, HFILL }}, |
5161 | 16 | {&hf_ospf_v2_options_o, |
5162 | 16 | { "(O) Opaque", "ospf.v2.options.o", FT_BOOLEAN, 8, |
5163 | 16 | TFS(&tfs_set_notset), OSPF_V2_OPTIONS_O, NULL, HFILL }}, |
5164 | 16 | {&hf_ospf_v2_options_dn, |
5165 | 16 | { "DN", "ospf.v2.options.dn", FT_BOOLEAN, 8, |
5166 | 16 | TFS(&tfs_set_notset), OSPF_V2_OPTIONS_DN, NULL, HFILL }}, |
5167 | | |
5168 | 16 | {&hf_ospf_ri_options, |
5169 | 16 | { "RI Options", "ospf.ri.options", FT_UINT8, BASE_HEX, |
5170 | 16 | NULL, 0x0, NULL, HFILL }}, |
5171 | 16 | {&hf_ospf_ri_options_grc, |
5172 | 16 | { "(GRC) Graceful Restart", "ospf.ri.options.grc", FT_BOOLEAN, 8, |
5173 | 16 | TFS(&tfs_capable_not_capable), OSPF_RI_OPTIONS_GRC, NULL, HFILL }}, |
5174 | 16 | {&hf_ospf_ri_options_grh, |
5175 | 16 | { "(GRH) Graceful Restart Helper", "ospf.ri.options.grh", FT_BOOLEAN, 8, |
5176 | 16 | TFS(&tfs_enabled_disabled), OSPF_RI_OPTIONS_GRH, NULL, HFILL }}, |
5177 | 16 | {&hf_ospf_ri_options_srs, |
5178 | 16 | { "Stub Router Support", "ospf.ri.options.srs", FT_BOOLEAN, 8, |
5179 | 16 | TFS(&tfs_yes_no), OSPF_RI_OPTIONS_SRS, NULL, HFILL }}, |
5180 | 16 | {&hf_ospf_ri_options_tes, |
5181 | 16 | { "(TES) Traffic Engineering", "ospf.ri.options.tes", FT_BOOLEAN, 8, |
5182 | 16 | TFS(&tfs_supported_not_supported), OSPF_RI_OPTIONS_TES, NULL, HFILL }}, |
5183 | 16 | {&hf_ospf_ri_options_p2plan, |
5184 | 16 | { "(P2PLAN) Point-to-point over LAN", "ospf.ri.options.p2plan", FT_BOOLEAN, 8, |
5185 | 16 | TFS(&tfs_capable_not_capable), OSPF_RI_OPTIONS_P2PLAN, NULL, HFILL }}, |
5186 | 16 | {&hf_ospf_ri_options_ete, |
5187 | 16 | { "(ETE) Experimental TE", "ospf.ri.options.ete", FT_BOOLEAN, 8, |
5188 | 16 | TFS(&tfs_capable_not_capable), OSPF_RI_OPTIONS_ETE, NULL, HFILL }}, |
5189 | 16 | {&hf_ospf_ri_options_host, |
5190 | 16 | { "Host Router", "ospf.ri.options.host", FT_BOOLEAN, 8, |
5191 | 16 | TFS(&tfs_capable_not_capable), OSPF_RI_OPTIONS_HOST, NULL, HFILL }}, |
5192 | | |
5193 | 16 | {&hf_ospf_tlv_type_opaque, |
5194 | 16 | { "TLV Type", "ospf.tlv_type.opaque", FT_UINT16, BASE_DEC, VALS(ri_tlv_type_vals), 0x0, |
5195 | 16 | NULL, HFILL }}, |
5196 | | |
5197 | 16 | {&hf_ospf_v3_options, |
5198 | 16 | { "Options", "ospf.v3.options", FT_UINT24, BASE_HEX, |
5199 | 16 | NULL, 0x0, NULL, HFILL }}, |
5200 | 16 | {&hf_ospf_v3_options_v6, |
5201 | 16 | { "V6", "ospf.v3.options.v6", FT_BOOLEAN, 24, |
5202 | 16 | TFS(&tfs_set_notset), OSPF_V3_OPTIONS_V6, NULL, HFILL }}, |
5203 | 16 | {&hf_ospf_v3_options_e, |
5204 | 16 | { "E", "ospf.v3.options.e", FT_BOOLEAN, 24, |
5205 | 16 | TFS(&tfs_set_notset), OSPF_V3_OPTIONS_E, NULL, HFILL }}, |
5206 | 16 | {&hf_ospf_v3_options_mc, |
5207 | 16 | { "MC", "ospf.v3.options.mc", FT_BOOLEAN, 24, |
5208 | 16 | TFS(&tfs_set_notset), OSPF_V3_OPTIONS_MC, NULL, HFILL }}, |
5209 | 16 | {&hf_ospf_v3_options_n, |
5210 | 16 | { "N", "ospf.v3.options.n", FT_BOOLEAN, 24, |
5211 | 16 | TFS(&tfs_set_notset), OSPF_V3_OPTIONS_N, NULL, HFILL }}, |
5212 | 16 | {&hf_ospf_v3_options_r, |
5213 | 16 | { "R", "ospf.v3.options.r", FT_BOOLEAN, 24, |
5214 | 16 | TFS(&tfs_set_notset), OSPF_V3_OPTIONS_R, NULL, HFILL }}, |
5215 | 16 | {&hf_ospf_v3_options_dc, |
5216 | 16 | { "DC", "ospf.v3.options.dc", FT_BOOLEAN, 24, |
5217 | 16 | TFS(&tfs_set_notset), OSPF_V3_OPTIONS_DC, NULL, HFILL }}, |
5218 | 16 | {&hf_ospf_v3_options_af, |
5219 | 16 | { "AF", "ospf.v3.options.af", FT_BOOLEAN, 24, |
5220 | 16 | TFS(&tfs_set_notset), OSPF_V3_OPTIONS_AF, NULL, HFILL }}, |
5221 | 16 | {&hf_ospf_v3_options_l, |
5222 | 16 | { "L", "ospf.v3.options.l", FT_BOOLEAN, 24, |
5223 | 16 | TFS(&tfs_set_notset), OSPF_V3_OPTIONS_L, NULL, HFILL }}, |
5224 | 16 | {&hf_ospf_v3_options_at, |
5225 | 16 | { "AT", "ospf.v3.options.at", FT_BOOLEAN, 24, |
5226 | 16 | TFS(&tfs_set_notset), OSPF_V3_OPTIONS_AT, NULL, HFILL }}, |
5227 | 16 | {&hf_ospf_dbd, |
5228 | 16 | { "DB Description", "ospf.dbd", FT_UINT8, BASE_HEX, |
5229 | 16 | NULL, 0x0, NULL, HFILL }}, |
5230 | 16 | {&hf_ospf_dbd_r, |
5231 | 16 | { "(R) OOBResync", "ospf.dbd.r", FT_BOOLEAN, 8, |
5232 | 16 | TFS(&tfs_set_notset), OSPF_DBD_FLAG_R, NULL, HFILL }}, |
5233 | 16 | {&hf_ospf_dbd_i, |
5234 | 16 | { "(I) Init", "ospf.dbd.i", FT_BOOLEAN, 8, |
5235 | 16 | TFS(&tfs_set_notset), OSPF_DBD_FLAG_I, NULL, HFILL }}, |
5236 | 16 | {&hf_ospf_dbd_m, |
5237 | 16 | { "(M) More", "ospf.dbd.m", FT_BOOLEAN, 8, |
5238 | 16 | TFS(&tfs_set_notset), OSPF_DBD_FLAG_M, NULL, HFILL }}, |
5239 | 16 | {&hf_ospf_dbd_ms, |
5240 | 16 | { "(MS) Master", "ospf.dbd.ms", FT_BOOLEAN, 8, |
5241 | 16 | TFS(&tfs_yes_no), OSPF_DBD_FLAG_MS, NULL, HFILL }}, |
5242 | 16 | {&hf_ospf_lls_ext_options, |
5243 | 16 | { "Options", "ospf.lls.ext.options", FT_UINT32, BASE_HEX, |
5244 | 16 | NULL, 0x0, NULL, HFILL }}, |
5245 | 16 | {&hf_ospf_lls_ext_options_lr, |
5246 | 16 | { "(LR) LSDB Resynchronization", "ospf.lls.ext.options.lr", FT_BOOLEAN, 32, |
5247 | 16 | TFS(&tfs_set_notset), OSPF_LLS_EXT_OPTIONS_LR, NULL, HFILL }}, |
5248 | 16 | {&hf_ospf_lls_ext_options_rs, |
5249 | 16 | { "(RS) Restart Signal", "ospf.lls.ext.options.rs", FT_BOOLEAN, 32, |
5250 | 16 | TFS(&tfs_set_notset), OSPF_LLS_EXT_OPTIONS_RS, NULL, HFILL }}, |
5251 | 16 | {&hf_ospf_v2_router_lsa_flag, |
5252 | 16 | { "Flags", "ospf.v2.router.lsa.flags", FT_UINT8, BASE_HEX, |
5253 | 16 | NULL, 0x0, NULL, HFILL }}, |
5254 | 16 | {&hf_ospf_v2_router_lsa_flag_b, |
5255 | 16 | { "(B) Area border router", "ospf.v2.router.lsa.flags.b", FT_BOOLEAN, 8, |
5256 | 16 | TFS(&tfs_yes_no), OSPF_V2_ROUTER_LSA_FLAG_B, NULL, HFILL }}, |
5257 | 16 | {&hf_ospf_v2_router_lsa_flag_e, |
5258 | 16 | { "(E) AS boundary router", "ospf.v2.router.lsa.flags.e", FT_BOOLEAN, 8, |
5259 | 16 | TFS(&tfs_yes_no), OSPF_V2_ROUTER_LSA_FLAG_E, NULL, HFILL }}, |
5260 | 16 | {&hf_ospf_v2_router_lsa_flag_v, |
5261 | 16 | { "(V) Virtual link endpoint", "ospf.v2.router.lsa.flags.v", FT_BOOLEAN, 8, |
5262 | 16 | TFS(&tfs_yes_no), OSPF_V2_ROUTER_LSA_FLAG_V, NULL, HFILL }}, |
5263 | 16 | {&hf_ospf_v2_router_lsa_flag_w, |
5264 | 16 | { "(W) Wild-card multicast receiver", "ospf.v2.router.lsa.flags.w", FT_BOOLEAN, 8, |
5265 | 16 | TFS(&tfs_yes_no), OSPF_V2_ROUTER_LSA_FLAG_W, NULL, HFILL }}, |
5266 | 16 | {&hf_ospf_v2_router_lsa_flag_n, |
5267 | 16 | { "(N) NSSA translation", "ospf.v2.router.lsa.flags.n", FT_BOOLEAN, 8, |
5268 | 16 | TFS(&tfs_yes_no), OSPF_V2_ROUTER_LSA_FLAG_N, NULL, HFILL }}, |
5269 | 16 | {&hf_ospf_v2_router_lsa_flag_s, |
5270 | 16 | { "(S) Shortcut-capable ABR", "ospf.v2.router.lsa.flags.s", FT_BOOLEAN, 8, |
5271 | 16 | TFS(&tfs_yes_no), OSPF_V2_ROUTER_LSA_FLAG_S, NULL, HFILL }}, |
5272 | 16 | {&hf_ospf_v2_router_lsa_flag_h, |
5273 | 16 | { "(H) Host", "ospf.v2.router.lsa.flags.h", FT_BOOLEAN, 8, |
5274 | 16 | TFS(&tfs_yes_no), OSPF_V2_ROUTER_LSA_FLAG_H, NULL, HFILL }}, |
5275 | 16 | {&hf_ospf_v3_router_lsa_flag, |
5276 | 16 | { "Flags", "ospf.v3.router.lsa.flags", FT_UINT8, BASE_HEX, |
5277 | 16 | NULL, 0x0, NULL, HFILL }}, |
5278 | 16 | {&hf_ospf_v3_router_lsa_flag_b, |
5279 | 16 | { "(B) Area border router", "ospf.v3.router.lsa.flags.b", FT_BOOLEAN, 8, |
5280 | 16 | TFS(&tfs_yes_no), OSPF_V3_ROUTER_LSA_FLAG_B, NULL, HFILL }}, |
5281 | 16 | {&hf_ospf_v3_router_lsa_flag_e, |
5282 | 16 | { "(E) AS boundary router", "ospf.v3.router.lsa.flags.e", FT_BOOLEAN, 8, |
5283 | 16 | TFS(&tfs_yes_no), OSPF_V3_ROUTER_LSA_FLAG_E, NULL, HFILL }}, |
5284 | 16 | {&hf_ospf_v3_router_lsa_flag_v, |
5285 | 16 | { "(V) Virtual link endpoint", "ospf.v3.router.lsa.flags.v", FT_BOOLEAN, 8, |
5286 | 16 | TFS(&tfs_yes_no), OSPF_V3_ROUTER_LSA_FLAG_V, NULL, HFILL }}, |
5287 | 16 | {&hf_ospf_v3_router_lsa_flag_w, |
5288 | 16 | { "(W) Wild-card multicast receiver", "ospf.v3.router.lsa.flags.w", FT_BOOLEAN, 8, |
5289 | 16 | TFS(&tfs_yes_no), OSPF_V3_ROUTER_LSA_FLAG_W, NULL, HFILL }}, |
5290 | 16 | {&hf_ospf_v3_as_external_flag, |
5291 | 16 | { "Flags", "ospf.v3.as.external.flags", FT_UINT8, BASE_HEX, |
5292 | 16 | NULL, 0x0, NULL, HFILL }}, |
5293 | 16 | {&hf_ospf_v3_as_external_flag_t, |
5294 | 16 | { "(T) External Route Tag", "ospf.v3.as.external.flags.t", FT_BOOLEAN, 8, |
5295 | 16 | TFS(&tfs_present_not_present), OSPF_V3_AS_EXTERNAL_FLAG_T, NULL, HFILL }}, |
5296 | 16 | {&hf_ospf_v3_as_external_flag_f, |
5297 | 16 | { "(F) Forwarding Address", "ospf.v3.as.external.flags.f", FT_BOOLEAN, 8, |
5298 | 16 | TFS(&tfs_present_absent), OSPF_V3_AS_EXTERNAL_FLAG_F, NULL, HFILL }}, |
5299 | 16 | {&hf_ospf_v3_as_external_flag_e, |
5300 | 16 | { "(E) External Metric", "ospf.v3.as.external.flags.e", FT_BOOLEAN, 8, |
5301 | 16 | TFS(&tfs_v3_as_external_flags_e), OSPF_V3_AS_EXTERNAL_FLAG_E, NULL, HFILL }}, |
5302 | 16 | {&hf_ospf_v3_prefix_option, |
5303 | 16 | { "PrefixOptions", "ospf.v3.prefix.options", FT_UINT8, BASE_HEX, |
5304 | 16 | NULL, 0x0, NULL, HFILL }}, |
5305 | 16 | {&hf_ospf_v3_prefix_option_nu, |
5306 | 16 | { "(NU) NoUnicast", "ospf.v3.prefix.options.nu", FT_BOOLEAN, 8, |
5307 | 16 | TFS(&tfs_set_notset), OSPF_V3_PREFIX_OPTION_NU, NULL, HFILL }}, |
5308 | 16 | {&hf_ospf_v3_prefix_option_la, |
5309 | 16 | { "(LA) Local Address", "ospf.v3.prefix.options.la", FT_BOOLEAN, 8, |
5310 | 16 | TFS(&tfs_set_notset), OSPF_V3_PREFIX_OPTION_LA, NULL, HFILL }}, |
5311 | 16 | {&hf_ospf_v3_prefix_option_mc, |
5312 | 16 | { "(MC) Multicast", "ospf.v3.prefix.options.mc", FT_BOOLEAN, 8, |
5313 | 16 | TFS(&tfs_set_notset), OSPF_V3_PREFIX_OPTION_MC, NULL, HFILL }}, |
5314 | 16 | {&hf_ospf_v3_prefix_option_p, |
5315 | 16 | { "(P) Propagate", "ospf.v3.prefix.options.p", FT_BOOLEAN, 8, |
5316 | 16 | TFS(&tfs_set_notset), OSPF_V3_PREFIX_OPTION_P, NULL, HFILL }}, |
5317 | | |
5318 | | /* Dynamic Hostname contained in the Opaque RI LSA - dynamic hostname TLV*/ |
5319 | 16 | {&hf_ospf_dyn_hostname, |
5320 | 16 | { "Dynamic Hostname", "ospf.dynhostname", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5321 | | |
5322 | 16 | {&hf_ospf_lsa_sa, |
5323 | 16 | { "SR-Algorithm", "ospf.lsa_sa", FT_UINT8, BASE_DEC, VALS(ri_lsa_sa_tlv_type_vals), 0x0, NULL, HFILL }}, |
5324 | | |
5325 | 16 | {&hf_ospf_ls_slr_stlv, |
5326 | 16 | { "TLV Type", "ospf.tlv.sidlabel_range.type", FT_UINT16, BASE_DEC, VALS(ext_pfx_stlv_type_vals), 0x0, NULL, HFILL }}, |
5327 | 16 | {&hf_ospf_ls_range_size, |
5328 | 16 | { "Range Size", "ospf.tlv.range_size", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5329 | 16 | {&hf_ospf_ls_sid_label, |
5330 | 16 | { "SID/Label", "ospf.tlv.sid_label", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5331 | 16 | {&hf_ospf_ls_preference, |
5332 | 16 | { "Preference", "ospf.tlv.preference", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5333 | 16 | {&hf_ospf_ls_igp_msd_type, |
5334 | 16 | { "MSD Type", "ospf.tlv.igp_msd_type", FT_UINT8, BASE_DEC, VALS(ospf_igp_msd_types), 0x0, NULL, HFILL }}, |
5335 | 16 | {&hf_ospf_ls_igp_msd_value, |
5336 | 16 | { "MSD Value", "ospf.tlv.igp_msd_value", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5337 | 16 | {&hf_ospf_ls_remote_ipv4_addr, |
5338 | 16 | { "Remote IPv4 Address", "ospf.tlv.remote_ipv4_address", FT_IPv4, BASE_NONE, |
5339 | 16 | NULL, 0x0, NULL, HFILL }}, |
5340 | 16 | {&hf_ospf_ls_local_interface_id, |
5341 | 16 | { "Local Interface ID", "ospf.tlv.local_interface_id", FT_UINT32, BASE_DEC, |
5342 | 16 | NULL, 0x0, NULL, HFILL }}, |
5343 | 16 | {&hf_ospf_ls_remote_interface_id, |
5344 | 16 | { "Remote Interface ID", "ospf.tlv.remote_interface_id", FT_UINT32, BASE_DEC, |
5345 | 16 | NULL, 0x0, NULL, HFILL }}, |
5346 | | |
5347 | | /* Flex Algo Definition TLV (rfc9350) */ |
5348 | 16 | {&hf_ospf_ls_flex_algorithm, |
5349 | 16 | { "Flex-Algorithm", "ospf.tlv.flex_algorithm", FT_UINT8, BASE_DEC, |
5350 | 16 | NULL, 0x0, NULL, HFILL }}, |
5351 | 16 | {&hf_ospf_ls_fad_metric_type, |
5352 | 16 | { "Metric-Type", "ospf.tlv.fad.metric_type", FT_UINT8, BASE_DEC, |
5353 | 16 | VALS(ri_lsa_fad_metric_type_vals), 0x0, NULL, HFILL }}, |
5354 | 16 | {&hf_ospf_ls_fad_calc_type, |
5355 | 16 | { "Calc-Type", "ospf.tlv.fad.calc_type", FT_UINT8, BASE_DEC, |
5356 | 16 | VALS(ri_lsa_sa_tlv_type_vals), 0x0, NULL, HFILL }}, |
5357 | 16 | {&hf_ospf_ls_fad_priority, |
5358 | 16 | { "Priority", "ospf.tlv.fad.priority", FT_UINT8, BASE_DEC, |
5359 | 16 | NULL, 0x0, NULL, HFILL }}, |
5360 | 16 | {&hf_ospf_ls_fad_stlv, |
5361 | 16 | { "TLV Type", "ospf.tlv.fad.subtlv_type", FT_UINT16, BASE_DEC, VALS(ri_lsa_fad_stlv_type_vals), 0x0, |
5362 | 16 | NULL, HFILL }}, |
5363 | 16 | {&hf_ospf_ls_fad_def_flags, |
5364 | 16 | { "Flags", "ospf.tlv.fad.definition_flags", FT_UINT32, BASE_HEX, |
5365 | 16 | NULL, 0x0, NULL, HFILL }}, |
5366 | 16 | {&hf_ospf_ls_fad_def_flags_m, |
5367 | 16 | { "M-flag (M)", "ospf.tlv.fad.definition_flags.m", FT_BOOLEAN, 32, |
5368 | 16 | TFS(&tfs_set_notset), FAD_DEF_FLAGS_M, NULL, HFILL }}, |
5369 | 16 | {&hf_ospf_ls_fapm_flags, |
5370 | 16 | { "Flags", "ospf.tlv.fapm.flags", FT_UINT8, BASE_HEX, |
5371 | 16 | NULL, 0x0, NULL, HFILL }}, |
5372 | 16 | {&hf_ospf_ls_fapm_flags_e, |
5373 | 16 | { "E bit", "ospf.tlv.fapm.flags.e", FT_BOOLEAN, 8, |
5374 | 16 | TFS(&tfs_set_notset), FAPM_FLAGS_E, NULL, HFILL }}, |
5375 | 16 | {&hf_ospf_ls_fapm_metric, |
5376 | 16 | { "Metric", "ospf.tlv.fapm.metric", FT_UINT32, BASE_DEC, |
5377 | 16 | NULL, 0, NULL, HFILL }}, |
5378 | | |
5379 | | /* the Unknown TLV of the Opaque RI LSA */ |
5380 | 16 | {&hf_ospf_unknown_tlv, |
5381 | 16 | { "Unknown TLV", "ospf.tlv.unknown", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5382 | | |
5383 | | /* OSPF Extended Prefix TLV */ |
5384 | 16 | {&hf_ospf_ls_epfx_tlv, |
5385 | 16 | { "TLV Type", "ospf.tlv.extpfx.tlv_type", FT_UINT16, BASE_DEC, VALS(ext_pfx_tlv_type_vals), 0x0, NULL, HFILL }}, |
5386 | 16 | {&hf_ospf_ls_epfx_stlv, |
5387 | 16 | { "TLV Type", "ospf.tlv.extpfx.subtlv_type", FT_UINT16, BASE_DEC, VALS(ext_pfx_stlv_type_vals), 0x0, NULL, HFILL }}, |
5388 | 16 | {&hf_ospf_ls_epfx_route_type, |
5389 | 16 | { "Route Type", "ospf.tlv.extpfx.routetype", FT_UINT8, BASE_DEC, VALS(ext_pfx_tlv_route_vals), 0x0, NULL, HFILL }}, |
5390 | 16 | {&hf_ospf_ls_epfx_af, |
5391 | 16 | { "Address Family", "ospf.tlv.extpfx.af", FT_UINT8, BASE_DEC, VALS(ext_pfx_tlv_af_vals), 0x0, NULL, HFILL }}, |
5392 | | |
5393 | 16 | {&hf_ospf_ls_epfx_flags, |
5394 | 16 | { "Flags", "ospf.tlv.extpfx.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
5395 | 16 | {&hf_ospf_ls_epfx_flag_a, |
5396 | 16 | { "(A) Attach Flag", "ospf.tlv.extpfx.flags.a", FT_BOOLEAN, 8, |
5397 | 16 | TFS(&tfs_set_notset), EXT_PREFIX_TLV_FLAG_A, NULL, HFILL }}, |
5398 | 16 | {&hf_ospf_ls_epfx_flag_n, |
5399 | 16 | { "(N) Node Flag", "ospf.tlv.extpfx.flags.n", FT_BOOLEAN, 8, |
5400 | 16 | TFS(&tfs_set_notset), EXT_PREFIX_TLV_FLAG_N, NULL, HFILL }}, |
5401 | 16 | {&hf_ospf_ls_epfx_flag_unknown, |
5402 | 16 | { "(*) Unknown Flag", "ospf.tlv.extpfx.flags.unknown", FT_UINT8, BASE_HEX, |
5403 | 16 | NULL, EXT_PREFIX_TLV_FLAG_UNKNOWN, NULL, HFILL }}, |
5404 | | |
5405 | 16 | {&hf_ospf_ls_epfx_range_flags, |
5406 | 16 | { "Flags", "ospf.tlv.extpfx_range.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
5407 | 16 | {&hf_ospf_ls_epfx_range_flag_ia, |
5408 | 16 | { "(IA) Inter-Area Flag", "ospf.tlv.extpfx_range.flags.ia", FT_BOOLEAN, 8, |
5409 | 16 | TFS(&tfs_set_notset), EXT_PREFIX_RANGE_TLV_FLAG_IA, NULL, HFILL }}, |
5410 | 16 | {&hf_ospf_ls_epfx_range_flag_unknown, |
5411 | 16 | { "(*) Unknown Flag", "ospf.tlv.extpfx_range.flags.unknown", FT_UINT8, BASE_HEX, |
5412 | 16 | NULL, EXT_PREFIX_RANGE_TLV_FLAG_UNKNOWN, NULL, HFILL }}, |
5413 | | |
5414 | 16 | {&hf_ospf_ls_pfxsid_flags, |
5415 | 16 | { "Flags", "ospf.tlv.pfxsid.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
5416 | 16 | {&hf_ospf_ls_pfxsid_flag_np, |
5417 | 16 | { "(NP) No-PHP Flag", "ospf.tlv.pfxsid.flags.np", FT_BOOLEAN, 8, |
5418 | 16 | TFS(&tfs_set_notset), SR_STLV_PFXSID_FLAG_NP, NULL, HFILL }}, |
5419 | 16 | {&hf_ospf_ls_pfxsid_flag_m, |
5420 | 16 | { "(M) Mapping Server Flag", "ospf.tlv.pfxsid.flags.m", FT_BOOLEAN, 8, |
5421 | 16 | TFS(&tfs_set_notset), SR_STLV_PFXSID_FLAG_M, NULL, HFILL }}, |
5422 | 16 | {&hf_ospf_ls_pfxsid_flag_e, |
5423 | 16 | { "(E) Explicit-Null Flag", "ospf.tlv.pfxsid.flags.e", FT_BOOLEAN, 8, |
5424 | 16 | TFS(&tfs_set_notset), SR_STLV_PFXSID_FLAG_E, NULL, HFILL }}, |
5425 | 16 | {&hf_ospf_ls_pfxsid_flag_v, |
5426 | 16 | { "(V) Value/Index Flag", "ospf.tlv.pfxsid.flags.v", FT_BOOLEAN, 8, |
5427 | 16 | TFS(&tfs_set_notset), SR_STLV_PFXSID_FLAG_V, NULL, HFILL }}, |
5428 | 16 | {&hf_ospf_ls_pfxsid_flag_l, |
5429 | 16 | { "(L) Local/Global Flag", "ospf.tlv.pfxsid.flags.l", FT_BOOLEAN, 8, |
5430 | 16 | TFS(&tfs_set_notset), SR_STLV_PFXSID_FLAG_L, NULL, HFILL }}, |
5431 | 16 | {&hf_ospf_ls_pfxsid_flag_unknown, |
5432 | 16 | { "(*) Unknown Flag", "ospf.tlv.pfxsid.flags.unknown", FT_UINT8, BASE_HEX, |
5433 | 16 | NULL, SR_STLV_PFXSID_FLAG_UNKNOWN, NULL, HFILL }}, |
5434 | | |
5435 | | /* OSPF Extended Link TLV */ |
5436 | 16 | {&hf_ospf_ls_elink_tlv, |
5437 | 16 | { "TLV Type", "ospf.tlv.extlink.tlv_type", FT_UINT16, BASE_DEC, VALS(ext_link_tlv_type_vals), 0x0, NULL, HFILL }}, |
5438 | 16 | {&hf_ospf_ls_elink_stlv, |
5439 | 16 | { "TLV Type", "ospf.tlv.extlink.subtlv_type", FT_UINT16, BASE_DEC, VALS(ext_link_stlv_type_vals), 0x0, NULL, HFILL }}, |
5440 | 16 | {&hf_ospf_ls_elink_mt_id, |
5441 | 16 | { "Multi-Topology ID", "ospf.tlv.extlink.mt_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5442 | 16 | {&hf_ospf_ls_elink_weight, |
5443 | 16 | { "Weight", "ospf.tlv.extlink.weight", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5444 | 16 | {&hf_ospf_ls_elink_nbr, |
5445 | 16 | { "Neighbor ID", "ospf.tlv.extlink.nbr", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5446 | | |
5447 | 16 | {&hf_ospf_ls_adjsid_flags, |
5448 | 16 | { "Flags", "ospf.tlv.adjsid.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
5449 | 16 | {&hf_ospf_ls_adjsid_flag_b, |
5450 | 16 | { "(B) Backup Flag", "ospf.tlv.adjsid.flags.b", FT_BOOLEAN, 8, |
5451 | 16 | TFS(&tfs_set_notset), SR_STLV_ADJSID_FLAG_B, NULL, HFILL }}, |
5452 | 16 | {&hf_ospf_ls_adjsid_flag_v, |
5453 | 16 | { "(V) Value/Index Flag", "ospf.tlv.adjsid.flags.v", FT_BOOLEAN, 8, |
5454 | 16 | TFS(&tfs_set_notset), SR_STLV_ADJSID_FLAG_V, NULL, HFILL }}, |
5455 | 16 | {&hf_ospf_ls_adjsid_flag_l, |
5456 | 16 | { "(L) Local/Global Flag", "ospf.tlv.adjsid.flags.l", FT_BOOLEAN, 8, |
5457 | 16 | TFS(&tfs_set_notset), SR_STLV_ADJSID_FLAG_L, NULL, HFILL }}, |
5458 | 16 | {&hf_ospf_ls_adjsid_flag_g, |
5459 | 16 | { "(G) Group Flag", "ospf.tlv.adjsid.flags.g", FT_BOOLEAN, 8, |
5460 | 16 | TFS(&tfs_set_notset), SR_STLV_ADJSID_FLAG_G, NULL, HFILL }}, |
5461 | 16 | {&hf_ospf_ls_adjsid_flag_p, |
5462 | 16 | { "(P) Persistent Flag", "ospf.tlv.adjsid.flags.p", FT_BOOLEAN, 8, |
5463 | 16 | TFS(&tfs_set_notset), SR_STLV_ADJSID_FLAG_P, NULL, HFILL }}, |
5464 | 16 | {&hf_ospf_ls_adjsid_flag_unknown, |
5465 | 16 | { "(*) Unknown Flag", "ospf.tlv.adjsid.flags.unknown", FT_UINT8, BASE_HEX, |
5466 | 16 | NULL, SR_STLV_ADJSID_FLAG_UNKNOWN, NULL, HFILL }}, |
5467 | | /* Application-Specific Link Attributes Sub-TLV (rfc9492) */ |
5468 | 16 | {&hf_ospf_ls_app_sabm_length, |
5469 | 16 | { "SABM Length", "ospf.tlv.application.sabm.length", |
5470 | 16 | FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5471 | 16 | {&hf_ospf_ls_app_udabm_length, |
5472 | 16 | { "UDABM Length", "ospf.tlv.application.udabm.length", |
5473 | 16 | FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5474 | 16 | {&hf_ospf_ls_app_sabm_bits, |
5475 | 16 | { "Standard Application Identifier Bit Mask", "ospf.tlv.application.sabm.bits", |
5476 | 16 | FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
5477 | 16 | {&hf_ospf_ls_app_sabm_bits_r, |
5478 | 16 | { "(R) RSVP-TE", "ospf.tlv.application.sabm.bits.r", |
5479 | 16 | FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80, NULL, HFILL }}, |
5480 | 16 | {&hf_ospf_ls_app_sabm_bits_s, |
5481 | 16 | { "(S) Segment Routing Policy", "ospf.tlv.application.sabm.bits.s", |
5482 | 16 | FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x40, NULL, HFILL }}, |
5483 | 16 | {&hf_ospf_ls_app_sabm_bits_f, |
5484 | 16 | { "(F) Loop-Free Alternate (LFA)", "ospf.tlv.application.sabm.bits.f", |
5485 | 16 | FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x20, NULL, HFILL }}, |
5486 | 16 | {&hf_ospf_ls_app_sabm_bits_x, |
5487 | 16 | { "(X) Flexible Algorithm", "ospf.tlv.application.sabm.bits.x", |
5488 | 16 | FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x10, NULL, HFILL }}, |
5489 | 16 | {&hf_ospf_ls_app_udabm_bits, |
5490 | 16 | { "User-Defined Application Identifier Bit Mask", "ospf.tlv.application.udabm.bits", |
5491 | 16 | FT_BYTES, SEP_SPACE, NULL, 0x0, NULL, HFILL }}, |
5492 | 16 | {&hf_ospf_ls_app_link_attrs_stlv, |
5493 | 16 | { "TLV Type", "ospf.tlv.application.subtlv_type", |
5494 | 16 | FT_UINT16, BASE_DEC, VALS(ext_link_stlv_type_vals), 0x0, NULL, HFILL }}, |
5495 | 16 | {&hf_ospf_ls_srlg, |
5496 | 16 | { "Shared Risk Link Group", "ospf.tlv.srlg", |
5497 | 16 | FT_UINT32, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }}, |
5498 | | /* OSPF Traffic Engineering (TE) Metric Extensions (rfc7471) */ |
5499 | 16 | {&hf_ospf_ls_unidir_link_flags, |
5500 | 16 | { "Flags", "ospf.tlv.unidirectional_link_flags", |
5501 | 16 | FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } |
5502 | 16 | }, |
5503 | 16 | {&hf_ospf_ls_unidir_link_flags_a, |
5504 | 16 | { "(A) Anomalous", "ospf.tlv.unidirectional_link_flags.a", |
5505 | 16 | FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80, NULL, HFILL } |
5506 | 16 | }, |
5507 | 16 | {&hf_ospf_ls_unidir_link_flags_reserved, |
5508 | 16 | { "Reserved", "ospf.tlv.unidirectional_link_flags.reserved", |
5509 | 16 | FT_UINT8, BASE_HEX, NULL, 0x7f, NULL, HFILL } |
5510 | 16 | }, |
5511 | 16 | {&hf_ospf_ls_unidir_link_reserved, |
5512 | 16 | { "Reserved", "ospf.tlv.unidirectional_link_reserved", |
5513 | 16 | FT_UINT8, BASE_HEX, NULL, 0,NULL, HFILL } |
5514 | 16 | }, |
5515 | 16 | {&hf_ospf_ls_unidir_link_delay, |
5516 | 16 | { "Delay", "ospf.tlv.unidirectional_link_delay", |
5517 | 16 | FT_UINT24, BASE_DEC, NULL, 0,NULL, HFILL } |
5518 | 16 | }, |
5519 | 16 | {&hf_ospf_ls_unidir_link_delay_min, |
5520 | 16 | { "Min Delay", "ospf.tlv.unidirectional_link_delay_min", |
5521 | 16 | FT_UINT24, BASE_DEC, NULL, 0, NULL, HFILL } |
5522 | 16 | }, |
5523 | 16 | {&hf_ospf_ls_unidir_link_delay_max, |
5524 | 16 | { "Max Delay", "ospf.tlv.unidirectional_link_delay_max", |
5525 | 16 | FT_UINT24, BASE_DEC, NULL, 0, NULL, HFILL } |
5526 | 16 | }, |
5527 | 16 | {&hf_ospf_ls_unidir_delay_variation, |
5528 | 16 | { "Delay Variation", "ospf.tlv.unidirectional_delay_variation", |
5529 | 16 | FT_UINT24, BASE_DEC, NULL, 0, NULL, HFILL } |
5530 | 16 | }, |
5531 | | /* Administrative Group (rfc3630) */ |
5532 | 16 | {&hf_ospf_ls_admin_group, |
5533 | 16 | { "Admin Group", "ospf.tlv.admin_group", FT_UINT32, BASE_HEX, |
5534 | 16 | NULL, 0x0, NULL, HFILL }}, |
5535 | | /* Extended Administrative Group (rfc7308) */ |
5536 | 16 | {&hf_ospf_ls_ext_admin_group, |
5537 | 16 | { "Extended Admin Group", "ospf.tlv.extended_admin_group", FT_UINT32, BASE_HEX, |
5538 | 16 | NULL, 0x0, NULL, HFILL }}, |
5539 | | |
5540 | | /* OSPF Extended Inter-Area ASBR TLV */ |
5541 | 16 | {&hf_ospf_ls_eia_asbr_tlv, |
5542 | 16 | { "TLV Type", "ospf.tlv.extasbr.tlv_type", FT_UINT16, BASE_DEC, |
5543 | 16 | VALS(ext_ia_asbr_tlv_type_vals), 0x0, NULL, HFILL }}, |
5544 | 16 | {&hf_ospf_ls_eia_asbr_stlv, |
5545 | 16 | { "TLV Type", "ospf.tlv.extasbr.subtlv_type", FT_UINT16, BASE_DEC, |
5546 | 16 | VALS(ext_ia_asbr_stlv_type_vals), 0x0, NULL, HFILL }}, |
5547 | 16 | {&hf_ospf_ls_eia_asbr_asbr_routerid, |
5548 | 16 | { "ASBR Router ID", "ospf.tlv.extasbr.asbr_routerid", FT_IPv4, BASE_NONE, |
5549 | 16 | NULL, 0x0, NULL, HFILL }}, |
5550 | 16 | {&hf_ospf_ls_faam_reserved, |
5551 | 16 | { "Reserved", "ospf.tlv.faam.reserved", FT_UINT24, BASE_HEX, |
5552 | 16 | NULL, 0x0, NULL, HFILL }}, |
5553 | 16 | {&hf_ospf_ls_faam_metric, |
5554 | 16 | { "Metric", "ospf.tlv.faam.metric", FT_UINT32, BASE_DEC, |
5555 | 16 | NULL, 0, NULL, HFILL }}, |
5556 | | |
5557 | | /* OSPF Restart TLVs */ |
5558 | 16 | {&hf_ospf_grace_tlv, |
5559 | 16 | { "Grace TLV", "ospf.grace", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}}, |
5560 | 16 | {&hf_ospf_grace_period, |
5561 | 16 | { "Grace Period", "ospf.grace.period", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, |
5562 | 16 | UNS(&units_seconds), 0x0, |
5563 | 16 | "The number of seconds neighbors should advertise the router as fully adjacent", |
5564 | 16 | HFILL }}, |
5565 | 16 | {&hf_ospf_grace_reason, |
5566 | 16 | { "Restart Reason", "ospf.grace.reason", FT_UINT8, BASE_DEC, |
5567 | 16 | VALS(restart_reason_vals), 0x0, "The reason the router is restarting", HFILL }}, |
5568 | 16 | {&hf_ospf_grace_ip, |
5569 | 16 | { "Restart IP", "ospf.grace.ip", FT_IPv4, BASE_NONE, |
5570 | 16 | NULL, 0x0, "The IP address of the interface originating this LSA", HFILL }}, |
5571 | | |
5572 | | /* OSPFv3 LLS TLVs */ |
5573 | 16 | {&hf_ospf_v3_lls_ext_options_tlv, |
5574 | 16 | { "Extended Options TLV", "ospf.v3.lls.ext.options.tlv", FT_NONE, BASE_NONE, |
5575 | 16 | NULL, 0x0, NULL, HFILL }}, |
5576 | 16 | {&hf_ospf_v3_lls_ext_options, |
5577 | 16 | { "Options", "ospf.v3.lls.ext.options", FT_UINT32, BASE_HEX, |
5578 | 16 | NULL, 0x0, NULL, HFILL }}, |
5579 | 16 | {&hf_ospf_v3_lls_ext_options_lr, |
5580 | 16 | { "(LR) LSDB Resynchronization", "ospf.v3.lls.ext.options.lr", FT_BOOLEAN, 32, |
5581 | 16 | TFS(&tfs_set_notset), OSPF_V3_LLS_EXT_OPTIONS_LR, NULL, HFILL }}, |
5582 | 16 | {&hf_ospf_v3_lls_ext_options_rs, |
5583 | 16 | { "(RS) Restart Signal", "ospf.v3.lls.ext.options.rs", FT_BOOLEAN, 32, |
5584 | 16 | TFS(&tfs_set_notset), OSPF_V3_LLS_EXT_OPTIONS_RS, NULL, HFILL }}, |
5585 | 16 | {&hf_ospf_v3_lls_state_tlv, |
5586 | 16 | { "State Check Sequence TLV", "ospf.v3.lls.state.tlv", FT_NONE, BASE_NONE, |
5587 | 16 | NULL, 0x0, NULL, HFILL }}, |
5588 | 16 | {&hf_ospf_v3_lls_state_scs, |
5589 | 16 | { "SCS Number", "ospf.v3.lls.state.scs", FT_UINT16, BASE_DEC, |
5590 | 16 | NULL, 0x0, NULL, HFILL }}, |
5591 | 16 | {&hf_ospf_v3_lls_state_options, |
5592 | 16 | { "Options", "ospf.v3.lls.state.options", FT_UINT8, BASE_HEX, |
5593 | 16 | NULL, 0x0, NULL, HFILL }}, |
5594 | 16 | {&hf_ospf_v3_lls_state_options_r, |
5595 | 16 | { "(R) Request", "ospf.v3.lls.state.options.r", FT_BOOLEAN, 8, |
5596 | 16 | TFS(&tfs_set_notset), OSPF_V3_LLS_STATE_OPTIONS_R, NULL, HFILL }}, |
5597 | 16 | {&hf_ospf_v3_lls_state_options_a, |
5598 | 16 | { "(A) Answer", "ospf.v3.lls.state.options.a", FT_BOOLEAN, 8, |
5599 | 16 | TFS(&tfs_set_notset), OSPF_V3_LLS_STATE_OPTIONS_A , NULL, HFILL }}, |
5600 | 16 | {&hf_ospf_v3_lls_state_options_n, |
5601 | 16 | { "(N) Incomplete", "ospf.v3.lls.state.options.n", FT_BOOLEAN, 8, |
5602 | 16 | TFS(&tfs_set_notset), OSPF_V3_LLS_STATE_OPTIONS_N ,NULL, HFILL }}, |
5603 | 16 | {&hf_ospf_v3_lls_drop_tlv, |
5604 | 16 | { "Neighbor Drop TLV", "ospf.v3.lls.drop.tlv", FT_NONE, BASE_NONE, |
5605 | 16 | NULL, 0x0, NULL, HFILL }}, |
5606 | 16 | {&hf_ospf_v3_lls_relay_tlv, |
5607 | 16 | { "Active Overlapping Relays TLV", "ospf.v3.lls.relay.tlv", FT_NONE, BASE_NONE, |
5608 | 16 | NULL, 0x0, NULL, HFILL }}, |
5609 | 16 | {&hf_ospf_v3_lls_relay_added, |
5610 | 16 | { "Relays Added", "ospf.v3.lls.relay.added", FT_UINT8, BASE_DEC, |
5611 | 16 | NULL, 0x0, NULL, HFILL }}, |
5612 | 16 | {&hf_ospf_v3_lls_relay_options, |
5613 | 16 | { "Options", "ospf.v3.lls.relay.options", FT_UINT8, BASE_HEX, |
5614 | 16 | NULL, 0x0, NULL, HFILL }}, |
5615 | 16 | {&hf_ospf_v3_lls_relay_options_a, |
5616 | 16 | { "(A) Always", "ospf.v3.lls.relay.options.a", FT_BOOLEAN, 8, |
5617 | 16 | TFS(&tfs_set_notset), OSPF_V3_LLS_RELAY_OPTIONS_A, NULL, HFILL }}, |
5618 | 16 | {&hf_ospf_v3_lls_relay_options_n, |
5619 | 16 | { "(N) Never", "ospf.v3.lls.relay.options.n", FT_BOOLEAN, 8, |
5620 | 16 | TFS(&tfs_set_notset), OSPF_V3_LLS_RELAY_OPTIONS_N, NULL, HFILL }}, |
5621 | 16 | {&hf_ospf_v3_lls_willingness_tlv, |
5622 | 16 | { "Willingness TLV", "ospf.v3.lls.willingness.tlv", FT_NONE, BASE_NONE, |
5623 | 16 | NULL, 0x0, NULL, HFILL }}, |
5624 | 16 | {&hf_ospf_v3_lls_willingness, |
5625 | 16 | { "Willingness", "ospf.v3.lls.willingness", FT_UINT8, BASE_DEC, |
5626 | 16 | NULL, 0x0, NULL, HFILL }}, |
5627 | 16 | {&hf_ospf_v3_lls_rf_tlv, |
5628 | 16 | { "Request From TLV", "ospf.v3.lls.rf.tlv", FT_NONE, BASE_NONE, |
5629 | 16 | NULL, 0x0, NULL, HFILL }}, |
5630 | 16 | {&hf_ospf_v3_lls_fsf_tlv, |
5631 | 16 | { "Full State For TLV", "ospf.v3.lls.fsf.tlv", FT_NONE, BASE_NONE, |
5632 | 16 | NULL, 0x0, NULL, HFILL }}, |
5633 | 16 | {&hf_ospf_v2_lls_li_id, |
5634 | 16 | { "Local Interface ID", "ospf.v3.lls.ll_id", FT_BYTES, BASE_NONE, |
5635 | 16 | NULL, 0x0, NULL, HFILL }}, |
5636 | | /* Generated from convert_proto_tree_add_text.pl */ |
5637 | 16 | { &hf_ospf_v2_lls_sequence_number, { "Sequence number", "ospf.v2.lls.sequence_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
5638 | 16 | { &hf_ospf_v2_lls_auth_data, { "Auth Data", "ospf.v2.lls.auth_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5639 | 16 | { &hf_ospf_v3_lls_dropped_neighbor, { "Dropped Neighbor", "ospf.v3.lls.dropped_neighbor", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5640 | 16 | { &hf_ospf_v3_lls_neighbor, { "Neighbor", "ospf.v3.lls.neighbor", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5641 | 16 | { &hf_ospf_v3_lls_request_from, { "Request From", "ospf.v3.lls.request_from", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5642 | 16 | { &hf_ospf_v3_lls_full_state_for, { "Full State For", "ospf.v3.lls.full_state_for", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5643 | 16 | { &hf_ospf_lls_checksum, { "Checksum", "ospf.lls.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, |
5644 | 16 | { &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 }}, |
5645 | 16 | { &hf_ospf_db_interface_mtu, { "Interface MTU", "ospf.db.interface_mtu", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5646 | 16 | { &hf_ospf_db_dd_sequence, { "DD Sequence", "ospf.db.dd_sequence", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5647 | 16 | { &hf_ospf_link_state_id, { "Link State ID", "ospf.link_state_id", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5648 | 16 | { &hf_ospf_ls_number_of_lsas, { "Number of LSAs", "ospf.ls.number_of_lsas", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5649 | 16 | { &hf_ospf_mpls_action, { "Action", "ospf.mpls.action", FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL }}, |
5650 | 16 | { &hf_ospf_mpls_bandwidth_type, { "Bandwidth Type", "ospf.mpls.bandwidth.type", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5651 | 16 | { &hf_ospf_mpls_cs, { "Channel Spacing", "ospf.mpls.cs", FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL }}, |
5652 | 16 | { &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 }}, |
5653 | 16 | { &hf_ospf_mpls_encoding, { "Encoding", "ospf.mpls.encoding", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gmpls_lsp_enc_rvals), 0x0, NULL, HFILL }}, |
5654 | 16 | { &hf_ospf_mpls_num_labels, { "Num Labels", "ospf.mpls.num.labels", FT_UINT16, BASE_DEC, NULL, 0x0FFF, NULL, HFILL }}, |
5655 | 16 | { &hf_ospf_mpls_interface_mtu, { "Interface MTU", "ospf.mpls.interface_mtu", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5656 | 16 | { &hf_ospf_mpls_length, { "Length", "ospf.mpls.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5657 | 16 | { &hf_ospf_mpls_pri, { "Priority", "ospf.mpls.priority", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5658 | 16 | { &hf_ospf_mpls_protection_capability, { "Protection Capability", "ospf.mpls.protection_capability", FT_UINT8, BASE_HEX, VALS(gmpls_protection_cap_str), 0x0, NULL, HFILL }}, |
5659 | 16 | { &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 }}, |
5660 | 16 | { &hf_ospf_mpls_starting, { "Starting n", "ospf.mpls.starting", FT_UINT32, BASE_DEC, NULL, 0x0FFFF000, NULL, HFILL }}, |
5661 | 16 | { &hf_ospf_mpls_no_effective_bits, { "No. of effective. Bits", "ospf.mpls.effective", FT_UINT16, BASE_DEC, NULL, 0x0FFF, NULL, HFILL }}, |
5662 | 16 | { &hf_ospf_mpls_bitmap, { "Bitmap", "ospf.mpls.bitmap", FT_UINT32, BASE_HEX, NULL, 0xFFFFFFFF, NULL, HFILL }}, |
5663 | 16 | { &hf_ospf_mpls_grid, { "Grid", "ospf.mpls.grid", FT_UINT8, BASE_DEC, NULL, 0xE0, NULL, HFILL }}, |
5664 | 16 | { &hf_ospf_mpls_cs2, { "Channel Spacing", "ospf.mpls.cs", FT_UINT8, BASE_DEC, NULL, 0x1E, NULL, HFILL }}, |
5665 | 16 | { &hf_ospf_mpls_n, { "Starting n", "ospf.mpls.n", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5666 | 16 | { &hf_ospf_mpls_type, { "Type", "ospf.mpls.type", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5667 | 16 | { &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 }}, |
5668 | 16 | { &hf_ospf_oif_encoding, { "Encoding", "ospf.oif.encoding", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gmpls_lsp_enc_rvals), 0x0, NULL, HFILL }}, |
5669 | 16 | { &hf_ospf_oif_tna_addr_length, { "Addr Length", "ospf.oif.tna_addr_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5670 | 16 | { &hf_ospf_oif_tna_addr_ipv4, { "TNA Addr", "ospf.oif.tna_addr.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5671 | 16 | { &hf_ospf_tna_addr_ipv6, { "TNA Addr", "ospf.oif.tna_addr.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5672 | 16 | { &hf_ospf_tna_addr, { "TNA Addr", "ospf.oif.tna_addr", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5673 | 16 | { &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 }}, |
5674 | 16 | { &hf_ospf_ls_id_opaque_id, { "Link State ID Opaque ID", "ospf.lsid.opaque_id", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5675 | 16 | { &hf_ospf_lsa_number_of_links, { "Number of Links", "ospf.lsa.number_of_links", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5676 | 16 | { &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 }}, |
5677 | 16 | { &hf_ospf_v3_lsa_interface_id, { "Interface ID", "ospf.v3.lsa.interface_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5678 | 16 | { &hf_ospf_v3_lsa_neighbor_interface_id, { "Neighbor Interface ID", "ospf.v3.lsa.neighbor_interface_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5679 | 16 | { &hf_ospf_v3_lsa_neighbor_router_id, { "Neighbor Router ID", "ospf.v3.lsa.neighbor_router_id", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5680 | 16 | { &hf_ospf_v3_lsa_attached_router, { "Attached Router", "ospf.v3.lsa.attached_router", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5681 | 16 | { &hf_ospf_v3_lsa_destination_router_id, { "Destination Router ID", "ospf.v3.lsa.destination_router_id", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5682 | 16 | { &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 }}, |
5683 | 16 | { &hf_ospf_v3_lsa_forwarding_address_ipv6, { "Forwarding Address", "ospf.v3.lsa.forwarding_address.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5684 | 16 | { &hf_ospf_v3_lsa_external_route_tag, { "External Route Tag", "ospf.v3.lsa.external_route_tag", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5685 | 16 | { &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 }}, |
5686 | 16 | { &hf_ospf_v3_lsa_router_priority, { "Router Priority", "ospf.v3.lsa.router_priority", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5687 | 16 | { &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 }}, |
5688 | 16 | { &hf_ospf_referenced_advertising_router, { "Referenced Advertising Router", "ospf.v3.lsa.referenced_advertising_router", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5689 | 16 | { &hf_ospf_lsa_external_type, { "External Type", "ospf.lsa.asext.type", FT_BOOLEAN, 8, TFS(&tfs_lsa_external_type), 0x80, NULL, HFILL }}, |
5690 | 16 | { &hf_ospf_lsa_tos, { "TOS", "ospf.lsa.tos", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5691 | 16 | { &hf_ospf_lsa_external_tos, { "TOS", "ospf.lsa.tos", FT_UINT8, BASE_DEC, NULL, 0x7f, NULL, HFILL }}, |
5692 | 16 | { &hf_ospf_v3_lsa_type, { "Type", "ospf.v3.lsa.type", FT_UINT8, BASE_DEC, VALS(ospf_v3_lsa_type_vals), 0, NULL, HFILL }}, |
5693 | 16 | { &hf_ospf_metric, { "Metric", "ospf.metric", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, |
5694 | 16 | { &hf_ospf_prefix_length, { "PrefixLength", "ospf.prefix_length", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }}, |
5695 | 16 | { &hf_ospf_ls_mpls_pri, { "Pri (or TE-Class)", "ospf.mpls.pri", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5696 | 16 | { &hf_ospf_ls_mpls_bc, { "BC", "ospf.mpls.bc", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5697 | 16 | { &hf_ospf_mpls_minimum_lsp_bandwidth, { "Minimum LSP bandwidth", "ospf.mpls.minimum_lsp_bandwidth", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5698 | 16 | { &hf_ospf_mpls_sonet_sdh, { "SONET/SDH", "ospf.mpls.sonet.sdh", FT_BOOLEAN, BASE_NONE, TFS(&tfs_arbitrary_standard), 0x0, NULL, HFILL }}, |
5699 | 16 | { &hf_ospf_oif_signal_type, { "Signal Type", "ospf.oif.signal_type", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gmpls_sonet_signal_type_str_ext, 0x0, NULL, HFILL }}, |
5700 | 16 | { &hf_ospf_tlv_value, { "TLV Value", "ospf.tlv_value", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5701 | 16 | { &hf_ospf_oif_node_id, { "Node ID", "ospf.oif.node_id", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5702 | 16 | { &hf_ospf_pad_bytes, { "Pad Bytes", "ospf.pad_bytes", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5703 | 16 | { &hf_ospf_ls_metric, { "Metric", "ospf.ls.metric", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5704 | 16 | { &hf_ospf_v3_lsa_forwarding_address_ipv4, { "Forwarding Address", "ospf.v3.lsa.forwarding_address.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5705 | 16 | { &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 }}, |
5706 | 16 | { &hf_ospf_v3_lsa_num_prefixes, { "# prefixes", "ospf.v3.lsa.num_prefixes", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |
5707 | 16 | { &hf_ospf_v3_address_prefix_ipv6, { "Address Prefix", "ospf.v3.address_prefix.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5708 | 16 | { &hf_ospf_v3_address_prefix_ipv4, { "Address Prefix", "ospf.v3.address_prefix.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |
5709 | 16 | }; |
5710 | | |
5711 | 16 | static int *ett[] = { |
5712 | 16 | &ett_ospf, |
5713 | 16 | &ett_ospf_at, |
5714 | 16 | &ett_ospf_hdr, |
5715 | 16 | &ett_ospf_hello, |
5716 | 16 | &ett_ospf_desc, |
5717 | 16 | &ett_ospf_lsr, |
5718 | 16 | &ett_ospf_lsa, |
5719 | 16 | &ett_ospf_lsa_router_link, |
5720 | 16 | &ett_ospf_lsa_upd, |
5721 | 16 | &ett_ospf_lsa_mpls, |
5722 | 16 | &ett_ospf_lsa_mpls_bandwidth_sstlv, |
5723 | 16 | &ett_ospf_lsa_mpls_base_label, |
5724 | 16 | &ett_ospf_lsa_mpls_router, |
5725 | 16 | &ett_ospf_lsa_mpls_link, |
5726 | 16 | &ett_ospf_lsa_mpls_link_stlv, |
5727 | 16 | &ett_ospf_lsa_mpls_link_stlv_admingrp, |
5728 | 16 | &ett_ospf_lsa_opaque_ri, |
5729 | 16 | &ett_ospf_elsa, |
5730 | 16 | &ett_ospf_elsa_pfx_tlv, |
5731 | 16 | &ett_ospf_lsa_ri_tlv, |
5732 | 16 | &ett_ospf_lsa_dh_tlv, |
5733 | 16 | &ett_ospf_lsa_sa_tlv, |
5734 | 16 | &ett_ospf_lsa_slr_tlv, |
5735 | 16 | &ett_ospf_lsa_slr_stlv, |
5736 | 16 | &ett_ospf_lsa_srms_tlv, |
5737 | 16 | &ett_ospf_lsa_node_msd_tlv, |
5738 | 16 | &ett_ospf_lsa_fad_tlv, |
5739 | 16 | &ett_ospf_lsa_fad_stlv, |
5740 | 16 | &ett_ospf_lsa_fad_def_flags, |
5741 | 16 | &ett_ospf_lsa_fapm_flags, |
5742 | 16 | &ett_ospf_lsa_unknown_tlv, |
5743 | 16 | &ett_ospf_lsa_epfx, |
5744 | 16 | &ett_ospf_lsa_elink, |
5745 | 16 | &ett_ospf_lsa_elink_tlv, |
5746 | 16 | &ett_ospf_lsa_elink_stlv, |
5747 | 16 | &ett_ospf_lsa_epfx_tlv, |
5748 | 16 | &ett_ospf_lsa_epfx_flags, |
5749 | 16 | &ett_ospf_lsa_epfx_range_flags, |
5750 | 16 | &ett_ospf_lsa_epfx_stlv, |
5751 | 16 | &ett_ospf_lsa_pfxsid_flags, |
5752 | 16 | &ett_ospf_lsa_adjsid_flags, |
5753 | 16 | &ett_ospf_lsa_app_sabm_bits, |
5754 | 16 | &ett_ospf_lsa_app_link_attrs_stlv, |
5755 | 16 | &ett_ospf_lsa_unidir_link_flags, |
5756 | 16 | &ett_ospf_lsa_eia_asbr, |
5757 | 16 | &ett_ospf_lsa_eia_asbr_tlv, |
5758 | 16 | &ett_ospf_lsa_oif_tna, |
5759 | 16 | &ett_ospf_lsa_oif_tna_stlv, |
5760 | 16 | &ett_ospf_lsa_grace_tlv, |
5761 | 16 | &ett_ospf_lsa_type, |
5762 | 16 | &ett_ospf_v2_options, |
5763 | 16 | &ett_ospf_ri_options, |
5764 | 16 | &ett_ospf_v3_options, |
5765 | 16 | &ett_ospf_dbd, |
5766 | 16 | &ett_ospf_lls_data_block, |
5767 | 16 | &ett_ospf_lls_tlv, |
5768 | 16 | &ett_ospf_lls_ext_options, |
5769 | 16 | &ett_ospf_v3_router_interface, |
5770 | 16 | &ett_ospf_v3_router_interface_entry, |
5771 | 16 | &ett_ospf_v3_lls_ext_options_tlv, |
5772 | 16 | &ett_ospf_v3_lls_ext_options, |
5773 | 16 | &ett_ospf_v3_lls_state_tlv, |
5774 | 16 | &ett_ospf_v3_lls_state_scs, |
5775 | 16 | &ett_ospf_v3_lls_state_options, |
5776 | 16 | &ett_ospf_v3_lls_drop_tlv, |
5777 | 16 | &ett_ospf_v3_lls_relay_tlv, |
5778 | 16 | &ett_ospf_v3_lls_relay_added, |
5779 | 16 | &ett_ospf_v3_lls_relay_options, |
5780 | 16 | &ett_ospf_v3_lls_willingness_tlv, |
5781 | 16 | &ett_ospf_v3_lls_willingness, |
5782 | 16 | &ett_ospf_v3_lls_rf_tlv, |
5783 | 16 | &ett_ospf_v3_lls_fsf_tlv, |
5784 | 16 | &ett_ospf_v2_router_lsa_flags, |
5785 | 16 | &ett_ospf_v3_router_lsa_flags, |
5786 | 16 | &ett_ospf_v3_as_external_flags, |
5787 | 16 | &ett_ospf_v3_prefix_options, |
5788 | 16 | &ett_ospf_mpls_pri, |
5789 | 16 | &ett_ospf_mpls_bitmap, |
5790 | 16 | &ett_ospf_lsa_eia_asbr_stlv |
5791 | 16 | }; |
5792 | | |
5793 | 16 | static ei_register_info ei[] = { |
5794 | 16 | { &ei_ospf_header_reserved, { "ospf.reserved.not_zero", PI_PROTOCOL, PI_WARN, "incorrect, should be 0", EXPFILL }}, |
5795 | 16 | { &ei_ospf_lsa_bad_length, { "ospf.lsa.invalid_length", PI_MALFORMED, PI_ERROR, "Invalid length", EXPFILL }}, |
5796 | 16 | { &ei_ospf_lsa_constraint_missing, { "ospf.lsa.tos_missing", PI_MALFORMED, PI_WARN, "Blocks missing", EXPFILL }}, |
5797 | 16 | { &ei_ospf_lsa_bc_error, { "ospf.lsa.bc_error", PI_PROTOCOL, PI_WARN, "BC error", EXPFILL }}, |
5798 | 16 | { &ei_ospf_lsa_unknown_type, { "ospf.lsa.unknown_type", PI_PROTOCOL, PI_WARN, "Unknown LSA Type", EXPFILL }}, |
5799 | 16 | { &ei_ospf_unknown_link_subtype, { "ospf.unknown_link_subtype", PI_PROTOCOL, PI_WARN, "Unknown Link sub-TLV", EXPFILL }}, |
5800 | 16 | { &ei_ospf_stlv_length_invalid, { "ospf.stlv.invalid_length", PI_PROTOCOL, PI_WARN, "Invalid sub-TLV length", EXPFILL }}, |
5801 | 16 | }; |
5802 | | |
5803 | 16 | expert_module_t* expert_ospf; |
5804 | 16 | module_t *module_ospf; |
5805 | | |
5806 | 16 | proto_ospf = proto_register_protocol("Open Shortest Path First", |
5807 | 16 | "OSPF", "ospf"); |
5808 | 16 | ospf_handle = register_dissector("ospf", dissect_ospf, proto_ospf); |
5809 | 16 | ospf_cap_handle = register_capture_dissector("ospf", capture_ospf, proto_ospf); |
5810 | 16 | proto_register_field_array(proto_ospf, ospff_info, array_length(ospff_info)); |
5811 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
5812 | | |
5813 | 16 | expert_ospf = expert_register_protocol(proto_ospf); |
5814 | 16 | expert_register_field_array(expert_ospf, ei, array_length(ei)); |
5815 | | |
5816 | 16 | module_ospf = prefs_register_protocol(proto_ospf, NULL); |
5817 | 16 | prefs_register_bool_preference(module_ospf, "ospfv3_expect_at", |
5818 | 16 | "Expect OSPFv3 Authentication Trailer", |
5819 | 16 | "The Authentication Trailer is indicated by flags only in OSPFv3 Hello " |
5820 | 16 | "and DB Description packets. When this option is enabled, remaining " |
5821 | 16 | "bytes at the end of a packet are expected to be an Authentication Trailer.", |
5822 | 16 | &ospf_v3_expect_at); |
5823 | 16 | } |
5824 | | |
5825 | | void |
5826 | | proto_reg_handoff_ospf(void) |
5827 | 16 | { |
5828 | 16 | dissector_add_uint("ip.proto", IP_PROTO_OSPFIGP, ospf_handle); |
5829 | 16 | capture_dissector_add_uint("ip.proto", IP_PROTO_OSPFIGP, ospf_cap_handle); |
5830 | 16 | } |
5831 | | |
5832 | | /* |
5833 | | * Editor modelines |
5834 | | * |
5835 | | * Local Variables: |
5836 | | * c-basic-offset: 4 |
5837 | | * tab-width: 8 |
5838 | | * indent-tabs-mode: nil |
5839 | | * End: |
5840 | | * |
5841 | | * ex: set shiftwidth=4 tabstop=8 expandtab: |
5842 | | * :indentSize=4:tabSize=8:noTabs=true: |
5843 | | */ |