2 * Routines for OSPF packet disassembly
3 * (c) Copyright Hannes R. Boehm <hannes@boehm.org>
5 * $Id: packet-ospf.c,v 1.59 2002/04/14 23:04:03 guy Exp $
7 * At this time, this module is able to analyze OSPF
8 * packets as specified in RFC2328. MOSPF (RFC1584) and other
9 * OSPF Extensions which introduce new Packet types
10 * (e.g the External Atributes LSA) are not supported.
11 * Furthermore RFC2740 (OSPFv3 - OSPF for IPv6) is now supported
12 * - (c) 2001 Palle Lyckegaard <palle[AT]lyckegaard.dk>
14 * TOS - support is not fully implemented
16 * Ethereal - Network traffic analyzer
17 * By Gerald Combs <gerald@ethereal.com>
18 * Copyright 1998 Gerald Combs
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License
22 * as published by the Free Software Foundation; either version 2
23 * of the License, or (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
39 #ifdef HAVE_SYS_TYPES_H
40 # include <sys/types.h>
43 #ifdef HAVE_NETINET_IN_H
44 # include <netinet/in.h>
51 #include <epan/packet.h>
54 #include "ieee-float.h"
55 #include "packet-rsvp.h"
57 #define OSPF_VERSION_2 2
58 #define OSPF_VERSION_3 3
59 #define OSPF_VERSION_2_HEADER_LENGTH 24
60 #define OSPF_VERSION_3_HEADER_LENGTH 16
64 #define OSPF_DB_DESC 2
69 static const value_string pt_vals[] = {
70 {OSPF_HELLO, "Hello Packet" },
71 {OSPF_DB_DESC, "DB Descr." },
72 {OSPF_LS_REQ, "LS Request" },
73 {OSPF_LS_UPD, "LS Update" },
74 {OSPF_LS_ACK, "LS Acknowledge" },
78 #define OSPF_AUTH_NONE 0
79 #define OSPF_AUTH_SIMPLE 1
80 #define OSPF_AUTH_CRYPT 2
82 static const value_string auth_vals[] = {
83 {OSPF_AUTH_NONE, "Null" },
84 {OSPF_AUTH_SIMPLE, "Simple password" },
85 {OSPF_AUTH_CRYPT, "Cryptographic" },
89 #define OSPF_V2_OPTIONS_E 0x02
90 #define OSPF_V2_OPTIONS_MC 0x04
91 #define OSPF_V2_OPTIONS_NP 0x08
92 #define OSPF_V2_OPTIONS_EA 0x10
93 #define OSPF_V2_OPTIONS_DC 0x20
94 #define OSPF_V2_OPTIONS_O 0x40
95 #define OSPF_V2_OPTIONS_DN 0x01
96 #define OSPF_V3_OPTIONS_V6 0x01
97 #define OSPF_V3_OPTIONS_E 0x02
98 #define OSPF_V3_OPTIONS_MC 0x04
99 #define OSPF_V3_OPTIONS_N 0x08
100 #define OSPF_V3_OPTIONS_R 0x10
101 #define OSPF_V3_OPTIONS_DC 0x20
104 #define OSPF_DBD_FLAG_MS 1
105 #define OSPF_DBD_FLAG_M 2
106 #define OSPF_DBD_FLAG_I 4
108 #define OSPF_LS_REQ_LENGTH 12
110 #define OSPF_LSTYPE_ROUTER 1
111 #define OSPF_LSTYPE_NETWORK 2
112 #define OSPF_LSTYPE_SUMMERY 3
113 #define OSPF_LSTYPE_ASBR 4
114 #define OSPF_LSTYPE_ASEXT 5
115 #define OSPF_LSTYPE_GRPMEMBER 6
116 #define OSPF_LSTYPE_ASEXT7 7
117 #define OSPF_LSTYPE_EXTATTR 8
118 #define OSPF_V3_LSTYPE_ROUTER 0x2001
119 #define OSPF_V3_LSTYPE_NETWORK 0x2002
120 #define OSPF_V3_LSTYPE_INTER_AREA_PREFIX 0x2003
121 #define OSPF_V3_LSTYPE_INTER_AREA_ROUTER 0x2004
122 #define OSPF_V3_LSTYPE_AS_EXTERNAL 0x4005
123 #define OSPF_V3_LSTYPE_GROUP_MEMBERSHIP 0x2006
124 #define OSPF_V3_LSTYPE_TYPE_7 0x2007
125 #define OSPF_V3_LSTYPE_LINK 0x0008
126 #define OSPF_V3_LSTYPE_INTRA_AREA_PREFIX 0x2009
128 /* Opaque LSA types */
129 #define OSPF_LSTYPE_OP_LINKLOCAL 9
130 #define OSPF_LSTYPE_OP_AREALOCAL 10
131 #define OSPF_LSTYPE_OP_ASWIDE 11
133 #define OSPF_LINK_PTP 1
134 #define OSPF_LINK_TRANSIT 2
135 #define OSPF_LINK_STUB 3
136 #define OSPF_LINK_VIRTUAL 4
138 #define OSPF_V3_LINK_PTP 1
139 #define OSPF_V3_LINK_TRANSIT 2
140 #define OSPF_V3_LINK_RESERVED 3
141 #define OSPF_V3_LINK_VIRTUAL 4
143 #define OSPF_LSA_HEADER_LENGTH 20
145 /* Known opaque LSAs */
146 #define OSPF_LSA_MPLS_TE 1
149 static const value_string ls_type_vals[] = {
150 {OSPF_LSTYPE_ROUTER, "Router-LSA" },
151 {OSPF_LSTYPE_NETWORK, "Network-LSA" },
152 {OSPF_LSTYPE_SUMMERY, "Summary-LSA (IP network)" },
153 {OSPF_LSTYPE_ASBR, "Summary-LSA (ASBR)" },
154 {OSPF_LSTYPE_ASEXT, "AS-External-LSA (ASBR)" },
155 {OSPF_LSTYPE_GRPMEMBER, "Group Membership LSA" },
156 {OSPF_LSTYPE_ASEXT7, "NSSA AS-External-LSA" },
157 {OSPF_LSTYPE_EXTATTR, "External Attributes LSA" },
158 {OSPF_LSTYPE_OP_LINKLOCAL, "Opaque LSA, Link-local scope" },
159 {OSPF_LSTYPE_OP_AREALOCAL, "Opaque LSA, Area-local scope" },
164 static const value_string v3_ls_type_vals[] = {
165 {OSPF_V3_LSTYPE_ROUTER, "Router-LSA" },
166 {OSPF_V3_LSTYPE_NETWORK, "Network-LSA" },
167 {OSPF_V3_LSTYPE_INTER_AREA_PREFIX, "Inter-Area-Prefix-LSA" },
168 {OSPF_V3_LSTYPE_INTER_AREA_ROUTER, "Inter-Area-Router-LSA" },
169 {OSPF_V3_LSTYPE_AS_EXTERNAL, "AS-External-LSA" },
170 {OSPF_V3_LSTYPE_GROUP_MEMBERSHIP, "Group-Membership-LSA" },
171 {OSPF_V3_LSTYPE_TYPE_7, "Type-LSA" },
172 {OSPF_V3_LSTYPE_LINK, "Link-LSA" },
173 {OSPF_V3_LSTYPE_INTRA_AREA_PREFIX, "Intra-Area-Prefix-LSA" },
179 #define OSPF_V3_ROUTER_LSA_FLAG_B 0x01
180 #define OSPF_V3_ROUTER_LSA_FLAG_E 0x02
181 #define OSPF_V3_ROUTER_LSA_FLAG_V 0x04
182 #define OSPF_V3_ROUTER_LSA_FLAG_W 0x08
184 #define OSPF_V3_PREFIX_OPTION_NU 0x01
185 #define OSPF_V3_PREFIX_OPTION_LA 0x02
186 #define OSPF_V3_PREFIX_OPTION_MC 0x04
187 #define OSPF_V3_PREFIX_OPTION_P 0x08
189 #define OSPF_V3_AS_EXTERNAL_FLAG_T 0x01
190 #define OSPF_V3_AS_EXTERNAL_FLAG_F 0x02
191 #define OSPF_V3_AS_EXTERNAL_FLAG_E 0x04
194 static int proto_ospf = -1;
196 static gint ett_ospf = -1;
197 static gint ett_ospf_hdr = -1;
198 static gint ett_ospf_hello = -1;
199 static gint ett_ospf_desc = -1;
200 static gint ett_ospf_lsr = -1;
201 static gint ett_ospf_lsa = -1;
202 static gint ett_ospf_lsa_upd = -1;
204 /* Trees for opaque LSAs */
205 static gint ett_ospf_lsa_mpls = -1;
206 static gint ett_ospf_lsa_mpls_router = -1;
207 static gint ett_ospf_lsa_mpls_link = -1;
208 static gint ett_ospf_lsa_mpls_link_stlv = -1;
210 static dissector_handle_t data_handle;
212 static void dissect_ospf_hello(tvbuff_t*, int, proto_tree*, guint8);
213 static void dissect_ospf_db_desc(tvbuff_t*, int, proto_tree*, guint8);
214 static void dissect_ospf_ls_req(tvbuff_t*, int, proto_tree*, guint8);
215 static void dissect_ospf_ls_upd(tvbuff_t*, int, proto_tree*, guint8);
216 static void dissect_ospf_ls_ack(tvbuff_t*, int, proto_tree*, guint8);
218 /* dissect_ospf_v[23]lsa returns the offset of the next LSA
219 * if disassemble_body is set to FALSE (e.g. in LSA ACK
220 * packets), the offset is set to the offset of the next
223 static int dissect_ospf_v2_lsa(tvbuff_t*, int, proto_tree*, gboolean disassemble_body);
224 static int dissect_ospf_v3_lsa(tvbuff_t*, int, proto_tree*, gboolean disassemble_body);
226 static void dissect_ospf_options(tvbuff_t *, int, proto_tree *, guint8);
228 static void dissect_ospf_v3_prefix_options(tvbuff_t *, int, proto_tree *);
230 static void dissect_ospf_v3_address_prefix(tvbuff_t *, int, int, proto_tree *);
233 dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
235 proto_tree *ospf_tree = NULL;
237 proto_tree *ospf_header_tree;
244 guint16 cksum, computed_cksum;
245 guint length, reported_length;
249 unsigned int ospf_header_length;
255 if (check_col(pinfo->cinfo, COL_PROTOCOL))
256 col_set_str(pinfo->cinfo, COL_PROTOCOL, "OSPF");
257 if (check_col(pinfo->cinfo, COL_INFO))
258 col_clear(pinfo->cinfo, COL_INFO);
260 version = tvb_get_guint8(tvb, 0);
263 ospf_header_length = OSPF_VERSION_2_HEADER_LENGTH;
266 ospf_header_length = OSPF_VERSION_3_HEADER_LENGTH;
269 ospf_header_length = 0;
273 packet_type = tvb_get_guint8(tvb, 1);
274 if (check_col(pinfo->cinfo, COL_INFO)) {
275 col_add_str(pinfo->cinfo, COL_INFO,
276 val_to_str(packet_type, pt_vals, "Unknown (%u)"));
280 ospflen = tvb_get_ntohs(tvb, 2);
282 ti = proto_tree_add_item(tree, proto_ospf, tvb, 0, ospflen, FALSE);
283 ospf_tree = proto_item_add_subtree(ti, ett_ospf);
285 ti = proto_tree_add_text(ospf_tree, tvb, 0, ospf_header_length,
287 ospf_header_tree = proto_item_add_subtree(ti, ett_ospf_hdr);
289 proto_tree_add_text(ospf_header_tree, tvb, 0, 1, "OSPF Version: %u",
291 proto_tree_add_text(ospf_header_tree, tvb, 1, 1, "OSPF Packet Type: %u (%s)",
293 val_to_str(packet_type, pt_vals, "Unknown"));
294 proto_tree_add_text(ospf_header_tree, tvb, 2, 2, "Packet Length: %u",
296 proto_tree_add_text(ospf_header_tree, tvb, 4, 4, "Source OSPF Router ID: %s",
297 ip_to_str(tvb_get_ptr(tvb, 4, 4)));
298 areaid=tvb_get_ntohl(tvb,8);
299 proto_tree_add_text(ospf_header_tree, tvb, 8, 4, "Area ID: %s%s",
300 ip_to_str(tvb_get_ptr(tvb, 8, 4)), areaid == 0 ? " (Backbone)" : "");
301 cksum = tvb_get_ntohs(tvb, 12);
302 length = tvb_length(tvb);
303 /* XXX - include only the length from the OSPF header? */
304 reported_length = tvb_reported_length(tvb);
306 /* No checksum supplied in the packet. */
307 proto_tree_add_text(ospf_header_tree, tvb, 12, 2,
308 "Packet Checksum: 0x%04x (none)", cksum);
309 } else if (!pinfo->fragmented && length >= reported_length
310 && length >= ospf_header_length
311 && (version == OSPF_VERSION_2 || version == OSPF_VERSION_3)) {
312 /* The packet isn't part of a fragmented datagram and isn't
313 truncated, and we know how to checksum this version of
314 OSPF, so we can checksum it. */
319 /* Header, not including the authentication data (the OSPFv2
320 checksum excludes the 64-bit authentication field). */
321 cksum_vec[0].ptr = tvb_get_ptr(tvb, 0, 16);
322 cksum_vec[0].len = 16;
323 if (length > ospf_header_length) {
324 /* Rest of the packet, again not including the
325 authentication data. */
326 reported_length -= ospf_header_length;
327 cksum_vec[1].ptr = tvb_get_ptr(tvb, ospf_header_length, reported_length);
328 cksum_vec[1].len = reported_length;
331 /* There's nothing but a header. */
337 /* IPv6-style checksum, covering the entire OSPF packet
338 and a prepended IPv6 pseudo-header. */
340 /* Set up the fields of the pseudo-header. */
341 cksum_vec[0].ptr = pinfo->src.data;
342 cksum_vec[0].len = pinfo->src.len;
343 cksum_vec[1].ptr = pinfo->dst.data;
344 cksum_vec[1].len = pinfo->dst.len;
345 cksum_vec[2].ptr = (const guint8 *)&phdr;
346 phdr[0] = htonl(ospflen);
347 phdr[1] = htonl(IP_PROTO_OSPF);
348 cksum_vec[2].len = 8;
350 cksum_vec[3].ptr = tvb_get_ptr(tvb, 0, reported_length);
351 cksum_vec[3].len = reported_length;
356 g_assert_not_reached();
359 computed_cksum = in_cksum(cksum_vec, cksum_vec_len);
360 if (computed_cksum == 0) {
361 proto_tree_add_text(ospf_header_tree, tvb, 12, 2,
362 "Packet Checksum: 0x%04x (correct)", cksum);
364 proto_tree_add_text(ospf_header_tree, tvb, 12, 2,
365 "Packet Checksum: 0x%04x (incorrect, should be 0x%04x)",
366 cksum, in_cksum_shouldbe(cksum, computed_cksum));
369 proto_tree_add_text(ospf_header_tree, tvb, 12, 2,
370 "Packet Checksum: 0x%04x", cksum);
374 /* Authentication is only valid for OSPFv2 */
375 if ( version == OSPF_VERSION_2 ) {
376 auth_type = tvb_get_ntohs(tvb, 14);
377 proto_tree_add_text(ospf_header_tree, tvb, 14, 2, "Auth Type: %s",
378 val_to_str(auth_type, auth_vals, "Unknown (%u)"));
382 proto_tree_add_text(ospf_header_tree, tvb, 16, 8, "Auth Data (none)");
385 case OSPF_AUTH_SIMPLE:
386 tvb_get_nstringz0(tvb, 16, 8, auth_data);
387 proto_tree_add_text(ospf_header_tree, tvb, 16, 8, "Auth Data: %s", auth_data);
390 case OSPF_AUTH_CRYPT:
391 proto_tree_add_text(ospf_header_tree, tvb, 18, 1, "Auth Key ID: %u",
392 tvb_get_guint8(tvb, 18));
393 crypto_len = tvb_get_guint8(tvb, 19);
394 proto_tree_add_text(ospf_header_tree, tvb, 19, 1, "Auth Data Length: %u",
396 proto_tree_add_text(ospf_header_tree, tvb, 20, 4, "Auth Crypto Sequence Number: 0x%x",
397 tvb_get_ntohl(tvb, 20));
399 /* Show the message digest that was appended to the end of the
400 OSPF message - but only if it's present (we don't want
401 to get an exception before we've tried dissecting OSPF
403 if (tvb_bytes_exist(tvb, ospflen, crypto_len)) {
404 proto_tree_add_text(ospf_header_tree, tvb, ospflen, crypto_len,
406 tvb_bytes_to_str(tvb, ospflen, crypto_len));
411 proto_tree_add_text(ospf_header_tree, tvb, 16, 8, "Auth Data (unknown)");
417 /* Instance ID and "reserved" is OSPFv3-only */
418 if ( version == OSPF_VERSION_3 ) {
419 instance_ID = tvb_get_guint8(tvb, 14);
420 proto_tree_add_text(ospf_header_tree, tvb, 14, 1, "Instance ID: %u",
422 reserved = tvb_get_guint8(tvb, 15);
423 proto_tree_add_text(ospf_header_tree, tvb, 15, 1, (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),
428 /* Adjust the length of the tvbuff to match the size of the OSPF
429 * packet (since the dissect routines use it to work out where the
430 * end of the OSPF packet is).
432 tvb_set_reported_length(tvb, ospflen);
434 switch (packet_type){
437 dissect_ospf_hello(tvb, ospf_header_length, ospf_tree, version);
441 dissect_ospf_db_desc(tvb, ospf_header_length, ospf_tree, version);
445 dissect_ospf_ls_req(tvb, ospf_header_length, ospf_tree, version);
449 dissect_ospf_ls_upd(tvb, ospf_header_length, ospf_tree, version);
453 dissect_ospf_ls_ack(tvb, ospf_header_length, ospf_tree, version);
457 call_dissector(data_handle,tvb_new_subset(tvb, ospf_header_length,-1,tvb_reported_length_remaining(tvb,ospf_header_length)), pinfo, tree);
464 dissect_ospf_hello(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
466 proto_tree *ospf_hello_tree;
469 ti = proto_tree_add_text(tree, tvb, offset, -1, "OSPF Hello Packet");
470 ospf_hello_tree = proto_item_add_subtree(ti, ett_ospf_hello);
474 proto_tree_add_text(ospf_hello_tree, tvb, offset, 4, "Network Mask: %s",
475 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
476 proto_tree_add_text(ospf_hello_tree, tvb, offset + 4, 2,
477 "Hello Interval: %u seconds",
478 tvb_get_ntohs(tvb, offset + 4));
480 dissect_ospf_options(tvb, offset + 6, ospf_hello_tree, version);
481 proto_tree_add_text(ospf_hello_tree, tvb, offset + 7, 1, "Router Priority: %u",
482 tvb_get_guint8(tvb, offset + 7));
483 proto_tree_add_text(ospf_hello_tree, tvb, offset + 8, 4, "Router Dead Interval: %u seconds",
484 tvb_get_ntohl(tvb, offset + 8));
485 proto_tree_add_text(ospf_hello_tree, tvb, offset + 12, 4, "Designated Router: %s",
486 ip_to_str(tvb_get_ptr(tvb, offset + 12, 4)));
487 proto_tree_add_text(ospf_hello_tree, tvb, offset + 16, 4, "Backup Designated Router: %s",
488 ip_to_str(tvb_get_ptr(tvb, offset + 16, 4)));
491 while (tvb_reported_length_remaining(tvb, offset) != 0) {
492 proto_tree_add_text(ospf_hello_tree, tvb, offset, 4,
493 "Active Neighbor: %s",
494 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
499 proto_tree_add_text(ospf_hello_tree, tvb, offset + 0, 4, "Interface ID: %u",
500 tvb_get_ntohl(tvb, offset + 0));
501 proto_tree_add_text(ospf_hello_tree, tvb, offset + 4, 1, "Router Priority: %u",
502 tvb_get_guint8(tvb, offset + 4));
503 dissect_ospf_options(tvb, offset + 5, ospf_hello_tree, version);
504 proto_tree_add_text(ospf_hello_tree, tvb, offset + 8, 2,
505 "Hello Interval: %u seconds",
506 tvb_get_ntohs(tvb, offset + 8));
507 proto_tree_add_text(ospf_hello_tree, tvb, offset + 10, 2, "Router Dead Interval: %u seconds",
508 tvb_get_ntohs(tvb, offset + 10));
509 proto_tree_add_text(ospf_hello_tree, tvb, offset + 12, 4, "Designated Router: %s",
510 ip_to_str(tvb_get_ptr(tvb, offset + 12, 4)));
511 proto_tree_add_text(ospf_hello_tree, tvb, offset + 16, 4, "Backup Designated Router: %s",
512 ip_to_str(tvb_get_ptr(tvb, offset + 16, 4)));
514 while (tvb_reported_length_remaining(tvb, offset) != 0) {
515 proto_tree_add_text(ospf_hello_tree, tvb, offset, 4,
516 "Active Neighbor: %s",
517 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
529 dissect_ospf_db_desc(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
531 proto_tree *ospf_db_desc_tree=NULL;
535 char flags_string[20] = "";
538 ti = proto_tree_add_text(tree, tvb, offset, -1, "OSPF DB Description");
539 ospf_db_desc_tree = proto_item_add_subtree(ti, ett_ospf_desc);
545 proto_tree_add_text(ospf_db_desc_tree, tvb, offset, 2, "Interface MTU: %u",
546 tvb_get_ntohs(tvb, offset));
548 dissect_ospf_options(tvb, offset + 2, ospf_db_desc_tree, version);
550 flags = tvb_get_guint8(tvb, offset + 3);
551 if (flags & OSPF_DBD_FLAG_MS)
552 strcat(flags_string, "MS");
553 if (flags & OSPF_DBD_FLAG_M) {
554 if (flags_string[0] != '\0')
555 strcat(flags_string, "/");
556 strcat(flags_string, "M");
558 if (flags & OSPF_DBD_FLAG_I) {
559 if (flags_string[0] != '\0')
560 strcat(flags_string, "/");
561 strcat(flags_string, "I");
563 proto_tree_add_text(ospf_db_desc_tree, tvb, offset + 3, 1, "Flags: 0x%x (%s)",
564 flags, flags_string);
565 proto_tree_add_text(ospf_db_desc_tree, tvb, offset + 4, 4, "DD Sequence: %u",
566 tvb_get_ntohl(tvb, offset + 4));
573 reserved = tvb_get_guint8(tvb, offset);
574 proto_tree_add_text(ospf_db_desc_tree, tvb, offset, 1, (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),
577 dissect_ospf_options(tvb, offset + 1, ospf_db_desc_tree, version);
579 proto_tree_add_text(ospf_db_desc_tree, tvb, offset + 4, 2, "Interface MTU: %u",
580 tvb_get_ntohs(tvb, offset+4));
582 reserved = tvb_get_guint8(tvb, offset + 6);
583 proto_tree_add_text(ospf_db_desc_tree, tvb, offset + 6, 1, (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),
586 flags = tvb_get_guint8(tvb, offset + 7);
587 if (flags & OSPF_DBD_FLAG_MS)
588 strcat(flags_string, "MS");
589 if (flags & OSPF_DBD_FLAG_M) {
590 if (flags_string[0] != '\0')
591 strcat(flags_string, "/");
592 strcat(flags_string, "M");
594 if (flags & OSPF_DBD_FLAG_I) {
595 if (flags_string[0] != '\0')
596 strcat(flags_string, "/");
597 strcat(flags_string, "I");
599 proto_tree_add_text(ospf_db_desc_tree, tvb, offset + 7, 1, "Flags: 0x%x (%s)",
600 flags, flags_string);
602 proto_tree_add_text(ospf_db_desc_tree, tvb, offset + 8, 4, "DD Sequence: %u",
603 tvb_get_ntohl(tvb, offset + 8));
613 /* LS Headers will be processed here */
614 /* skip to the end of DB-Desc header */
615 while (tvb_reported_length_remaining(tvb, offset) != 0) {
616 if ( version == OSPF_VERSION_2)
617 offset = dissect_ospf_v2_lsa(tvb, offset, tree, FALSE);
619 if ( version == OSPF_VERSION_3)
620 offset = dissect_ospf_v3_lsa(tvb, offset, tree, FALSE);
626 dissect_ospf_ls_req(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
628 proto_tree *ospf_lsr_tree;
633 /* zero or more LS requests may be within a LS Request */
634 /* we place every request for a LSA in a single subtree */
635 while (tvb_reported_length_remaining(tvb, offset) != 0) {
636 ti = proto_tree_add_text(tree, tvb, offset, OSPF_LS_REQ_LENGTH,
637 "Link State Request");
638 ospf_lsr_tree = proto_item_add_subtree(ti, ett_ospf_lsr);
640 reserved = tvb_get_guint8(tvb, offset);
641 proto_tree_add_text(ospf_lsr_tree, tvb, offset, 1,
642 (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),
648 ls_type = tvb_get_ntohl(tvb, offset);
649 proto_tree_add_text(ospf_lsr_tree, tvb, offset, 4, "LS Type: %s (%u)",
650 val_to_str(ls_type, ls_type_vals, "Unknown"),
654 ls_type = tvb_get_ntohs(tvb, offset+2);
655 proto_tree_add_text(ospf_lsr_tree, tvb, offset+2, 2, "LS Type: %s (0x%04x)",
656 val_to_str(ls_type, v3_ls_type_vals, "Unknown"),
665 proto_tree_add_text(ospf_lsr_tree, tvb, offset + 4, 4, "Link State ID: %s",
666 ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
667 proto_tree_add_text(ospf_lsr_tree, tvb, offset + 8, 4, "Advertising Router: %s",
668 ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
675 dissect_ospf_ls_upd(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
677 proto_tree *ospf_lsa_upd_tree=NULL;
682 ti = proto_tree_add_text(tree, tvb, offset, -1, "LS Update Packet");
683 ospf_lsa_upd_tree = proto_item_add_subtree(ti, ett_ospf_lsa_upd);
685 lsa_nr = tvb_get_ntohl(tvb, offset);
686 proto_tree_add_text(ospf_lsa_upd_tree, tvb, offset, 4, "Number of LSAs: %u",
688 /* skip to the beginning of the first LSA */
689 offset += 4; /* the LS Upd Packet contains only a 32 bit #LSAs field */
692 while (lsa_counter < lsa_nr) {
693 if ( version == OSPF_VERSION_2)
694 offset = dissect_ospf_v2_lsa(tvb, offset, ospf_lsa_upd_tree, TRUE);
696 if ( version == OSPF_VERSION_3)
697 offset = dissect_ospf_v3_lsa(tvb, offset, ospf_lsa_upd_tree, TRUE);
703 dissect_ospf_ls_ack(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
705 /* the body of a LS Ack packet simply contains zero or more LSA Headers */
706 while (tvb_reported_length_remaining(tvb, offset) != 0) {
707 if ( version == OSPF_VERSION_2)
708 offset = dissect_ospf_v2_lsa(tvb, offset, tree, FALSE);
710 if ( version == OSPF_VERSION_3)
711 offset = dissect_ospf_v3_lsa(tvb, offset, tree, FALSE);
716 * Returns if an LSA is opaque, i.e. requires special treatment
719 is_opaque(int lsa_type)
721 return (lsa_type >= OSPF_LSTYPE_OP_LINKLOCAL &&
722 lsa_type <= OSPF_LSTYPE_OP_ASWIDE);
725 /* MPLS/TE TLV types */
726 #define MPLS_TLV_ROUTER 1
727 #define MPLS_TLV_LINK 2
729 /* MPLS/TE Link STLV types */
737 MPLS_LINK_MAX_RES_BW,
740 MPLS_LINK_LOCAL_ID = 11,
742 MPLS_LINK_PROTECTION = 14,
743 MPLS_LINK_IF_SWITCHING_DESC,
744 MPLS_LINK_SHARED_RISK_GROUP,
747 static const value_string mpls_link_stlv_str[] = {
748 {MPLS_LINK_TYPE, "Link Type"},
749 {MPLS_LINK_ID, "Link ID"},
750 {MPLS_LINK_LOCAL_IF, "Local Interface IP Address"},
751 {MPLS_LINK_REMOTE_IF, "Remote Interface IP Address"},
752 {MPLS_LINK_TE_METRIC, "Traffic Engineering Metric"},
753 {MPLS_LINK_MAX_BW, "Maximum Bandwidth"},
754 {MPLS_LINK_MAX_RES_BW, "Maximum Reservable Bandwidth"},
755 {MPLS_LINK_UNRES_BW, "Unreserved Bandwidth"},
756 {MPLS_LINK_COLOR, "Resource Class/Color"},
757 {MPLS_LINK_LOCAL_ID, "Link Local Identifier"},
758 {MPLS_LINK_REMOTE_ID, "Link Remote Identifier"},
759 {MPLS_LINK_PROTECTION, "Link Protection Type"},
760 {MPLS_LINK_IF_SWITCHING_DESC, "Interface Switching Capability Descriptor"},
761 {MPLS_LINK_SHARED_RISK_GROUP, "Shared Risk Link Group"},
766 * Dissect MPLS/TE opaque LSA
769 dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
773 proto_tree *mpls_tree;
774 proto_tree *tlv_tree;
775 proto_tree *stlv_tree;
781 int stlv_type, stlv_len, stlv_offset;
785 ti = proto_tree_add_text(tree, tvb, offset, length,
786 "MPLS Traffic Engineering LSA");
787 mpls_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls);
789 while (length != 0) {
790 tlv_type = tvb_get_ntohs(tvb, offset);
791 tlv_length = tvb_get_ntohs(tvb, offset + 2);
792 tlv_end_offset = offset + tlv_length + 4;
796 case MPLS_TLV_ROUTER:
797 ti = proto_tree_add_text(mpls_tree, tvb, offset, tlv_length+4,
798 "Router Address: %s",
799 ip_to_str(tvb_get_ptr(tvb, offset+4, 4)));
800 tlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_router);
801 proto_tree_add_text(tlv_tree, tvb, offset, 2, "TLV Type: 1 - Router Address");
802 proto_tree_add_text(tlv_tree, tvb, offset+2, 2, "TLV Length: %u",
804 proto_tree_add_text(tlv_tree, tvb, offset+4, 4, "Router Address: %s",
805 ip_to_str(tvb_get_ptr(tvb, offset+4, 4)));
809 ti = proto_tree_add_text(mpls_tree, tvb, offset, tlv_length+4,
811 tlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link);
812 proto_tree_add_text(tlv_tree, tvb, offset, 2, "TLV Type: 2 - Link Information");
813 proto_tree_add_text(tlv_tree, tvb, offset+2, 2, "TLV Length: %u",
815 stlv_offset = offset + 4;
817 /* Walk down the sub-TLVs for link information */
818 while (stlv_offset < tlv_end_offset) {
819 stlv_type = tvb_get_ntohs(tvb, stlv_offset);
820 stlv_len = tvb_get_ntohs(tvb, stlv_offset + 2);
821 stlv_name = val_to_str(stlv_type, mpls_link_stlv_str, "Unknown sub-TLV");
825 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
827 tvb_get_guint8(tvb, stlv_offset + 4));
828 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
829 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
830 "TLV Type: %u: %s", stlv_type, stlv_name);
831 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
833 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 1, "%s: %u", stlv_name,
834 tvb_get_guint8(tvb, stlv_offset + 4));
838 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
839 "%s: %s (%x)", stlv_name,
840 ip_to_str(tvb_get_ptr(tvb, stlv_offset + 4, 4)),
841 tvb_get_ntohl(tvb, stlv_offset + 4));
842 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
843 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
844 "TLV Type: %u: %s", stlv_type, stlv_name);
845 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
847 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 4, "%s: %s (%x)", stlv_name,
848 ip_to_str(tvb_get_ptr(tvb, stlv_offset + 4, 4)),
849 tvb_get_ntohl(tvb, stlv_offset + 4));
852 case MPLS_LINK_LOCAL_IF:
853 case MPLS_LINK_REMOTE_IF:
854 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
856 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
857 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
858 "TLV Type: %u: %s", stlv_type, stlv_name);
859 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
861 /* The Local/Remote Interface IP Address sub-TLV is TLV type 3/4, and is 4N
862 octets in length, where N is the number of neighbor addresses. */
863 for (i=0; i < stlv_len; i+=4)
864 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4+i, 4, "%s: %s", stlv_name,
865 ip_to_str(tvb_get_ptr(tvb, stlv_offset+4+i, 4)));
868 case MPLS_LINK_TE_METRIC:
869 case MPLS_LINK_COLOR:
870 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
872 tvb_get_ntohl(tvb, stlv_offset + 4));
873 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
874 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
875 "TLV Type: %u: %s", stlv_type, stlv_name);
876 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
878 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 4, "%s: %u", stlv_name,
879 tvb_get_ntohl(tvb, stlv_offset + 4));
882 case MPLS_LINK_MAX_BW:
883 case MPLS_LINK_MAX_RES_BW:
884 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
885 "%s: %ld", stlv_name,
886 tvb_ieee_to_long(tvb, stlv_offset + 4));
887 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
888 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
889 "TLV Type: %u: %s", stlv_type, stlv_name);
890 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
892 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 4, "%s: %ld", stlv_name,
893 tvb_ieee_to_long(tvb, stlv_offset + 4));
896 case MPLS_LINK_UNRES_BW:
897 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
899 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
900 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
901 "TLV Type: %u: %s", stlv_type, stlv_name);
902 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
904 for (i = 0; i < 8; i++) {
905 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4+(i*4), 4,
906 "Pri %d: %ld bytes/s (%.0f bits/s)", i,
907 tvb_ieee_to_long(tvb, stlv_offset + 4 + i*4),
908 tvb_ieee_to_long(tvb, stlv_offset + 4 + i*4) * 8.0);
912 case MPLS_LINK_LOCAL_ID:
913 case MPLS_LINK_REMOTE_ID:
914 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
915 "%s: %d (0x%x)", stlv_name,
916 tvb_get_ntohl(tvb, stlv_offset + 4),
917 tvb_get_ntohl(tvb, stlv_offset + 4));
918 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
919 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
920 "TLV Type: %u: %s", stlv_type, stlv_name);
921 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
923 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 4, "%s: %d (0x%x)", stlv_name,
924 tvb_get_ntohl(tvb, stlv_offset + 4),
925 tvb_get_ntohl(tvb, stlv_offset + 4));
928 case MPLS_LINK_IF_SWITCHING_DESC:
929 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
931 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
932 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
933 "TLV Type: %u: %s", stlv_type, stlv_name);
934 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
936 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 1, "Switching Type: %s",
937 val_to_str(tvb_get_guint8(tvb,stlv_offset+4),
938 gmpls_switching_type_str, "Unknown (%d)"));
939 proto_tree_add_text(stlv_tree, tvb, stlv_offset+5, 1, "Encoding: %s",
940 val_to_str(tvb_get_guint8(tvb,stlv_offset+5),
941 gmpls_lsp_enc_str, "Unknown (%d)"));
942 for (i = 0; i < 8; i++) {
943 proto_tree_add_text(stlv_tree, tvb, stlv_offset+8+(i*4), 4,
944 "Pri %d: %ld bytes/s (%.0f bits/s)", i,
945 tvb_ieee_to_long(tvb, stlv_offset + 8 + i*4),
946 tvb_ieee_to_long(tvb, stlv_offset + 8 + i*4) * 8.0);
951 proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
952 "Unknown Link sub-TLV: %u", stlv_type);
955 stlv_offset += ((stlv_len+4+3)/4)*4;
960 ti = proto_tree_add_text(mpls_tree, tvb, offset, tlv_length+4,
961 "Unknown LSA: %u", tlv_type);
962 tlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link);
963 proto_tree_add_text(tlv_tree, tvb, offset, 2, "TLV Type: %u - Unknown",
965 proto_tree_add_text(tlv_tree, tvb, offset+2, 2, "TLV Length: %u",
967 proto_tree_add_text(tlv_tree, tvb, offset+4, tlv_length, "TLV Data");
971 offset += tlv_length + 4;
972 length -= tlv_length + 4;
977 * Dissect opaque LSAs
980 dissect_ospf_lsa_opaque(tvbuff_t *tvb, int offset, proto_tree *tree,
981 guint8 ls_id_type, guint32 length)
983 switch (ls_id_type) {
985 case OSPF_LSA_MPLS_TE:
986 dissect_ospf_lsa_mpls(tvb, offset, tree, length);
990 proto_tree_add_text(tree, tvb, offset, length,
991 "Unknown LSA Type %u", ls_id_type);
993 } /* switch on opaque LSA id */
997 dissect_ospf_v2_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
998 gboolean disassemble_body)
1000 proto_tree *ospf_lsa_tree;
1011 guint16 link_counter;
1013 char *link_type_str;
1016 /* AS-external LSA */
1022 ls_type = tvb_get_guint8(tvb, offset + 3);
1023 ls_length = tvb_get_ntohs(tvb, offset + 18);
1024 end_offset = offset + ls_length;
1026 if (disassemble_body) {
1027 ti = proto_tree_add_text(tree, tvb, offset, ls_length,
1028 "%s (Type: %u)", val_to_str(ls_type, ls_type_vals,"Unkown"), ls_type);
1030 ti = proto_tree_add_text(tree, tvb, offset, OSPF_LSA_HEADER_LENGTH,
1033 ospf_lsa_tree = proto_item_add_subtree(ti, ett_ospf_lsa);
1035 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 2, "LS Age: %u seconds",
1036 tvb_get_ntohs(tvb, offset));
1037 dissect_ospf_options(tvb, offset + 2, ospf_lsa_tree, OSPF_VERSION_2);
1038 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 3, 1, "LSA Type: %u (%s)",
1039 ls_type, val_to_str(ls_type,ls_type_vals,"Unknown"));
1041 if (is_opaque(ls_type)) {
1042 ls_id_type = tvb_get_guint8(tvb, offset + 4);
1043 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 1, "Link State ID Opaque Type: %u",
1045 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 5, 3, "Link State ID Opaque ID: %u",
1046 tvb_get_ntoh24(tvb, offset + 5));
1049 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Link State ID: %s",
1050 ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
1053 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Advertising Router: %s",
1054 ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
1055 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 12, 4, "LS Sequence Number: 0x%04x",
1056 tvb_get_ntohl(tvb, offset + 12));
1057 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 16, 2, "LS Checksum: %04x",
1058 tvb_get_ntohs(tvb, offset + 16));
1060 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 18, 2, "Length: %u",
1063 /* skip past the LSA header to the body */
1064 offset += OSPF_LSA_HEADER_LENGTH;
1065 ls_length -= OSPF_LSA_HEADER_LENGTH;
1067 if (!disassemble_body)
1072 case OSPF_LSTYPE_ROUTER:
1073 /* again: flags should be secified in detail */
1074 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "Flags: 0x%02x",
1075 tvb_get_guint8(tvb, offset));
1076 nr_links = tvb_get_ntohs(tvb, offset + 2);
1077 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 2, 2, "Number of Links: %u",
1080 /* nr_links links follow
1081 * maybe we should put each of the links into its own subtree ???
1083 for (link_counter = 1; link_counter <= nr_links; link_counter++) {
1084 /* check the Link Type and ID */
1085 link_type = tvb_get_guint8(tvb, offset + 8);
1086 switch (link_type) {
1089 link_type_str="Point-to-point connection to another router";
1090 link_id="Neighboring router's Router ID";
1093 case OSPF_LINK_TRANSIT:
1094 link_type_str="Connection to a transit network";
1095 link_id="IP address of Designated Router";
1098 case OSPF_LINK_STUB:
1099 link_type_str="Connection to a stub network";
1100 link_id="IP network/subnet number";
1103 case OSPF_LINK_VIRTUAL:
1104 link_type_str="Virtual link";
1105 link_id="Neighboring router's Router ID";
1109 link_type_str="Unknown link type";
1110 link_id="Unknown link ID";
1114 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "%s: %s", link_id,
1115 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1117 /* link_data should be specified in detail (e.g. network mask) (depends on link type)*/
1118 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Link Data: %s",
1119 ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
1121 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 1, "Link Type: %u - %s",
1122 link_type, link_type_str);
1123 nr_tos = tvb_get_guint8(tvb, offset + 9);
1124 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 9, 1, "Number of TOS metrics: %u",
1126 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 10, 2, "TOS 0 metric: %u",
1127 tvb_get_ntohs(tvb, offset + 10));
1131 /* nr_tos metrics may follow each link
1132 * ATTENTION: TOS metrics are not tested (I don't have TOS
1134 * please send me a mail if it is/isn't working
1136 for (tos_counter = 1; tos_counter <= nr_tos; tos_counter++) {
1137 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "TOS: %u, Metric: %u",
1138 tvb_get_guint8(tvb, offset),
1139 tvb_get_ntohs(tvb, offset + 2));
1145 case OSPF_LSTYPE_NETWORK:
1146 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Netmask: %s",
1147 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1150 while (offset < end_offset) {
1151 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Attached Router: %s",
1152 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1157 case OSPF_LSTYPE_SUMMERY:
1158 /* Type 3 and 4 LSAs have the same format */
1159 case OSPF_LSTYPE_ASBR:
1160 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Netmask: %s",
1161 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1164 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Metric: %u",
1165 tvb_get_ntoh24(tvb, offset + 1));
1168 /* TOS-specific information, if any */
1169 while (offset < end_offset) {
1170 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "TOS: %u, Metric: %u",
1171 tvb_get_guint8(tvb, offset),
1172 tvb_get_ntoh24(tvb, offset + 1));
1177 case OSPF_LSTYPE_ASEXT:
1178 case OSPF_LSTYPE_ASEXT7:
1179 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Netmask: %s",
1180 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1183 options = tvb_get_guint8(tvb, offset);
1184 if (options & 0x80) { /* check wether or not E bit is set */
1185 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1186 "External Type: Type 2 (metric is larger than any other link state path)");
1188 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1189 "External Type: Type 1 (metric is specified in the same units as interface cost)");
1191 /* the metric field of a AS-external LAS is specified in 3 bytes */
1192 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 1, 3, "Metric: %u",
1193 tvb_get_ntoh24(tvb, offset + 1));
1196 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Forwarding Address: %s",
1197 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1200 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "External Route Tag: %u",
1201 tvb_get_ntohl(tvb, offset));
1204 /* TOS-specific information, if any */
1205 while (offset < end_offset) {
1206 options = tvb_get_guint8(tvb, offset);
1207 if (options & 0x80) { /* check wether or not E bit is set */
1208 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1209 "External Type: Type 2 (metric is larger than any other link state path)");
1211 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1212 "External Type: Type 1 (metric is specified in the same units as interface cost)");
1214 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "TOS: %u, Metric: %u",
1216 tvb_get_ntoh24(tvb, offset + 1));
1219 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Forwarding Address: %s",
1220 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1223 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "External Route Tag: %u",
1224 tvb_get_ntohl(tvb, offset));
1229 case OSPF_LSTYPE_OP_LINKLOCAL:
1230 case OSPF_LSTYPE_OP_AREALOCAL:
1231 case OSPF_LSTYPE_OP_ASWIDE:
1232 dissect_ospf_lsa_opaque(tvb, offset, ospf_lsa_tree, ls_id_type,
1234 offset += ls_length;
1238 /* unknown LSA type */
1239 proto_tree_add_text(ospf_lsa_tree, tvb, offset, ls_length,
1240 "Unknown LSA Type");
1241 offset += ls_length;
1244 /* return the offset of the next LSA */
1249 dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
1250 gboolean disassemble_body)
1252 proto_tree *ospf_lsa_tree;
1262 char *link_type_str;
1265 guint8 router_lsa_flags;
1266 char router_lsa_flags_string[5];
1268 guint8 router_priority;
1269 guint32 number_prefixes;
1270 guint8 prefix_length;
1273 guint16 referenced_ls_type;
1276 guint8 flags_string[4];
1277 guint32 external_route_tag;
1280 ls_type = tvb_get_ntohs(tvb, offset + 2);
1281 ls_length = tvb_get_ntohs(tvb, offset + 18);
1282 end_offset = offset + ls_length;
1284 if (disassemble_body) {
1285 ti = proto_tree_add_text(tree, tvb, offset, ls_length,
1286 "%s (Type: 0x%04x)", val_to_str(ls_type, v3_ls_type_vals,"Unknown"), ls_type);
1288 ti = proto_tree_add_text(tree, tvb, offset, OSPF_LSA_HEADER_LENGTH,
1291 ospf_lsa_tree = proto_item_add_subtree(ti, ett_ospf_lsa);
1293 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 2, "LS Age: %u seconds",
1294 tvb_get_ntohs(tvb, offset));
1296 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 2, 2, "LSA Type: 0x%04x (%s)",
1297 ls_type, val_to_str(ls_type, v3_ls_type_vals,"Unkown"));
1299 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Link State ID: %s",
1300 ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
1302 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Advertising Router: %s",
1303 ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
1304 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 12, 4, "LS Sequence Number: %d",
1305 tvb_get_ntohl(tvb, offset + 12));
1306 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 16, 2, "LS Checksum: %04x",
1307 tvb_get_ntohs(tvb, offset + 16));
1309 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 18, 2, "Length: %u",
1312 /* skip past the LSA header to the body */
1313 offset += OSPF_LSA_HEADER_LENGTH;
1314 ls_length -= OSPF_LSA_HEADER_LENGTH;
1316 if (!disassemble_body)
1322 case OSPF_V3_LSTYPE_ROUTER:
1324 /* flags field in an router-lsa */
1325 router_lsa_flags=tvb_get_guint8(tvb,offset);
1326 if (router_lsa_flags & OSPF_V3_ROUTER_LSA_FLAG_B)
1327 router_lsa_flags_string[3] = 'B';
1329 router_lsa_flags_string[3] = '.';
1330 if (router_lsa_flags & OSPF_V3_ROUTER_LSA_FLAG_E)
1331 router_lsa_flags_string[2] = 'E';
1333 router_lsa_flags_string[2] = '.';
1334 if (router_lsa_flags & OSPF_V3_ROUTER_LSA_FLAG_V)
1335 router_lsa_flags_string[1] = 'V';
1337 router_lsa_flags_string[1] = '.';
1338 if (router_lsa_flags & OSPF_V3_ROUTER_LSA_FLAG_W)
1339 router_lsa_flags_string[0] = 'W';
1341 router_lsa_flags_string[0] = '.';
1343 router_lsa_flags_string[4]=0;
1345 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "Flags: 0x%02x (%s)",
1346 router_lsa_flags, router_lsa_flags_string);
1348 /* options field in an router-lsa */
1349 dissect_ospf_options(tvb, offset + 1, ospf_lsa_tree, OSPF_VERSION_3);
1351 /* skip the router-lsa flags and options */
1356 proto_tree_add_text(ospf_lsa_tree, tvb, offset, ls_length,
1357 "Router Interfaces:");
1359 /* scan all router-lsa router interfaces */
1360 /* maybe we should put each of the links into its own subtree ??? */
1361 while (ls_length > 0 ) {
1363 /* check the type */
1364 link_type = tvb_get_guint8(tvb, offset);
1365 switch (link_type) {
1367 case OSPF_V3_LINK_PTP:
1368 link_type_str="Point-to-point connection to another router";
1371 case OSPF_V3_LINK_TRANSIT:
1372 link_type_str="Connection to a transit network";
1375 case OSPF_V3_LINK_RESERVED:
1376 link_type_str="Connection to a stub network";
1379 case OSPF_V3_LINK_VIRTUAL:
1380 link_type_str="Virtual link";
1384 link_type_str="Unknown link type";
1388 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "Type: %u (%s)", link_type,link_type_str);
1390 /* reserved field */
1391 reserved = tvb_get_guint8(tvb, offset+1);
1392 proto_tree_add_text(ospf_lsa_tree, tvb, offset+1, 1,
1393 (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved);
1396 metric=tvb_get_ntohs(tvb, offset+2);
1397 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 2, 2,"Metric: %u",metric);
1400 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Interface ID: %u",
1401 tvb_get_ntohl(tvb, offset + 4));
1403 /* Neighbor Interface ID */
1404 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Neighbor Interface ID: %u",
1405 tvb_get_ntohl(tvb, offset + 8));
1407 /* Neighbor Router ID */
1408 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 12, 4, "Neighbor Router ID: %s",
1409 ip_to_str(tvb_get_ptr(tvb, offset + 12, 4)));
1411 /* skip to the (possible) next entry */
1418 case OSPF_V3_LSTYPE_NETWORK:
1420 /* reserved field */
1421 reserved = tvb_get_guint8(tvb, offset);
1422 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1423 (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved);
1425 /* options field in an network-lsa */
1426 dissect_ospf_options(tvb, offset + 1, ospf_lsa_tree, OSPF_VERSION_3);
1431 while (ls_length > 0 ) {
1432 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Attached Router: %s",
1433 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1440 case OSPF_V3_LSTYPE_INTER_AREA_PREFIX:
1442 /* reserved field */
1443 reserved = tvb_get_guint8(tvb, offset);
1444 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1445 (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved);
1448 metric=tvb_get_ntoh24(tvb, offset+11);
1449 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 1, 3,"Metric: %u",metric);
1452 prefix_length=tvb_get_guint8(tvb, offset+4);
1453 proto_tree_add_text(ospf_lsa_tree, tvb, offset+4, 1, "PrefixLength: %u",prefix_length);
1455 /* prefix options */
1456 dissect_ospf_v3_prefix_options(tvb, offset+5, ospf_lsa_tree);
1458 /* 16 bits reserved */
1459 reserved16=tvb_get_ntohs(tvb, offset+6);
1460 proto_tree_add_text(ospf_lsa_tree, tvb, offset+6, 2,
1461 (reserved16 == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved16);
1465 /* address_prefix */
1466 dissect_ospf_v3_address_prefix(tvb, offset, prefix_length, ospf_lsa_tree);
1468 offset+=(prefix_length+31)/32*4;
1473 case OSPF_V3_LSTYPE_INTER_AREA_ROUTER:
1475 /* reserved field */
1476 reserved = tvb_get_guint8(tvb, offset);
1477 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1478 (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved);
1480 /* options field in an inter-area-router-lsa */
1481 dissect_ospf_options(tvb, offset + 1, ospf_lsa_tree, OSPF_VERSION_3);
1483 /* reserved field */
1484 reserved = tvb_get_guint8(tvb, offset+4);
1485 proto_tree_add_text(ospf_lsa_tree, tvb, offset+4, 1,
1486 (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved);
1489 metric=tvb_get_ntoh24(tvb, offset+6);
1490 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 6, 3,"Metric: %u",metric);
1492 /* Destination Router ID */
1493 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Destination Router ID: %s",
1494 ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
1500 case OSPF_V3_LSTYPE_AS_EXTERNAL:
1503 flags=tvb_get_guint8(tvb, offset);
1504 if (flags & OSPF_V3_AS_EXTERNAL_FLAG_E)
1505 flags_string[0] = 'E';
1507 flags_string[0] = '.';
1508 if (flags & OSPF_V3_AS_EXTERNAL_FLAG_F)
1509 flags_string[1] = 'F';
1511 flags_string[1] = '.';
1512 if (flags & OSPF_V3_AS_EXTERNAL_FLAG_T)
1513 flags_string[2] = 'T';
1515 flags_string[2] = '.';
1519 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "Flags: 0x%02x (%s)",
1520 flags, flags_string);
1522 /* 24 bits metric */
1523 metric=tvb_get_ntoh24(tvb, offset+1);
1524 proto_tree_add_text(ospf_lsa_tree, tvb, offset+1, 3,
1525 "Metric: %u", metric);
1528 prefix_length=tvb_get_guint8(tvb, offset+4);
1529 proto_tree_add_text(ospf_lsa_tree, tvb, offset+4, 1, "PrefixLength: %u",prefix_length);
1531 /* prefix options */
1532 dissect_ospf_v3_prefix_options(tvb, offset+5, ospf_lsa_tree);
1534 /* referenced LS type */
1535 referenced_ls_type=tvb_get_ntohs(tvb, offset+6);
1536 proto_tree_add_text(ospf_lsa_tree, tvb, offset+6, 2,"Referenced LS type 0x%04x (%s)",
1537 referenced_ls_type, val_to_str(referenced_ls_type, v3_ls_type_vals, "Unknown"));
1541 /* address_prefix */
1542 dissect_ospf_v3_address_prefix(tvb, offset, prefix_length, ospf_lsa_tree);
1544 offset+=(prefix_length+31)/32*4;
1546 /* Forwarding Address (optional - only if F-flag is on) */
1547 if ( (offset < end_offset) && (flags & OSPF_V3_AS_EXTERNAL_FLAG_F) ) {
1548 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 16,"Forwarding Address: %s",
1549 ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset, 16)));
1554 /* External Route Tag (optional - only if T-flag is on) */
1555 if ( (offset < end_offset) && (flags & OSPF_V3_AS_EXTERNAL_FLAG_T) ) {
1556 external_route_tag=tvb_get_ntohl(tvb, offset);
1557 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4,"External Route Tag: 0x%04x",
1558 external_route_tag);
1563 /* Referenced Link State ID (optional - only if Referenced LS type is non-zero */
1564 if ( (offset < end_offset) && (referenced_ls_type != 0) ) {
1565 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Referenced Link State ID: %s",
1566 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1572 case OSPF_V3_LSTYPE_LINK:
1574 /* router priority */
1575 router_priority=tvb_get_guint8(tvb, offset);
1576 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "Router Priority: %u", router_priority);
1578 /* options field in an link-lsa */
1579 dissect_ospf_options(tvb, offset + 1, ospf_lsa_tree, OSPF_VERSION_3);
1581 /* Link-local Interface Address */
1582 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 16, "Link-local Interface Address: %s",
1583 ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, 16)));
1585 /* Number prefixes */
1586 number_prefixes=tvb_get_ntohl(tvb, offset + 20);
1587 proto_tree_add_text(ospf_lsa_tree, tvb, offset+20, 4, "# prefixes: %d",number_prefixes);
1591 while (number_prefixes > 0) {
1594 prefix_length=tvb_get_guint8(tvb, offset);
1595 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "PrefixLength: %u",prefix_length);
1597 /* prefix options */
1598 dissect_ospf_v3_prefix_options(tvb, offset+1, ospf_lsa_tree);
1600 /* 16 bits reserved */
1601 reserved16=tvb_get_ntohs(tvb, offset+2);
1602 proto_tree_add_text(ospf_lsa_tree, tvb, offset+2, 2,
1603 (reserved16 == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved16);
1607 /* address_prefix */
1608 dissect_ospf_v3_address_prefix(tvb, offset, prefix_length, ospf_lsa_tree);
1610 offset+=(prefix_length+31)/32*4;
1617 case OSPF_V3_LSTYPE_INTRA_AREA_PREFIX:
1620 number_prefixes=tvb_get_ntohs(tvb, offset);
1621 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 2,"# prefixes: %u",number_prefixes);
1623 /* referenced LS type */
1624 referenced_ls_type=tvb_get_ntohs(tvb, offset+2);
1625 proto_tree_add_text(ospf_lsa_tree, tvb, offset+2, 2,"Referenced LS type 0x%04x (%s)",
1626 referenced_ls_type, val_to_str(referenced_ls_type, v3_ls_type_vals, "Unknown"));
1628 /* Referenced Link State ID */
1629 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Referenced Link State ID: %s",
1630 ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
1632 /* Referenced Advertising Router */
1633 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Referenced Advertising Router: %s",
1634 ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
1638 while (number_prefixes > 0) {
1641 prefix_length=tvb_get_guint8(tvb, offset);
1642 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "PrefixLength: %u",prefix_length);
1644 /* prefix options */
1645 dissect_ospf_v3_prefix_options(tvb, offset+1, ospf_lsa_tree);
1647 /* 16 bits metric */
1648 metric=tvb_get_ntohs(tvb, offset+2);
1649 proto_tree_add_text(ospf_lsa_tree, tvb, offset+2, 2,
1650 "Metric: %u", metric);
1654 /* address_prefix */
1655 dissect_ospf_v3_address_prefix(tvb, offset, prefix_length, ospf_lsa_tree);
1657 offset+=(prefix_length+31)/32*4;
1664 /* unknown LSA type */
1665 proto_tree_add_text(ospf_lsa_tree, tvb, offset, ls_length,
1666 "Unknown LSA Type 0x%04x",ls_type);
1667 offset += ls_length;
1670 /* return the offset of the next LSA */
1676 dissect_ospf_options(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
1678 guint8 options_ospfv2;
1679 guint32 options_ospfv3;
1680 char options_string[20] = "";
1682 /* ATTENTION !!! no check for length of options string - with OSPFv3 maximum length is 14 characters */
1684 switch ( version ) {
1686 case OSPF_VERSION_2:
1688 options_ospfv2 = tvb_get_guint8(tvb, offset);
1690 if (options_ospfv2 & OSPF_V2_OPTIONS_E)
1691 strcat(options_string, "E");
1693 if (options_ospfv2 & OSPF_V2_OPTIONS_MC) {
1694 if (options_string[0] != '\0')
1695 strcat(options_string, "/");
1696 strcat(options_string, "MC");
1699 if (options_ospfv2 & OSPF_V2_OPTIONS_NP) {
1700 if (options_string[0] != '\0')
1701 strcat(options_string, "/");
1702 strcat(options_string, "NP");
1705 if (options_ospfv2 & OSPF_V2_OPTIONS_EA) {
1706 if (options_string[0] != '\0')
1707 strcat(options_string, "/");
1708 strcat(options_string, "EA");
1711 if (options_ospfv2 & OSPF_V2_OPTIONS_DC) {
1712 if (options_string[0] != '\0')
1713 strcat(options_string, "/");
1714 strcat(options_string, "DC");
1717 if (options_ospfv2 & OSPF_V2_OPTIONS_O) {
1718 if (options_string[0] != '\0')
1719 strcat(options_string, "/");
1720 strcat(options_string, "O");
1723 if (options_ospfv2 & OSPF_V2_OPTIONS_DN) {
1724 if (options_string[0] != '\0')
1725 strcat(options_string, "/");
1726 strcat(options_string, "DN");
1729 proto_tree_add_text(tree, tvb, offset, 1, "Options: 0x%x (%s)",
1730 options_ospfv2, options_string);
1734 case OSPF_VERSION_3:
1736 options_ospfv3 = tvb_get_ntoh24(tvb, offset);
1738 if (options_ospfv3 & OSPF_V3_OPTIONS_V6)
1739 strcat(options_string, "V6");
1741 if (options_ospfv3 & OSPF_V3_OPTIONS_E)
1742 if (options_string[0] != '\0')
1743 strcat(options_string, "/");
1744 strcat(options_string, "E");
1746 if (options_ospfv3 & OSPF_V3_OPTIONS_MC) {
1747 if (options_string[0] != '\0')
1748 strcat(options_string, "/");
1749 strcat(options_string, "MC");
1752 if (options_ospfv3 & OSPF_V3_OPTIONS_N) {
1753 if (options_string[0] != '\0')
1754 strcat(options_string, "/");
1755 strcat(options_string, "N");
1758 if (options_ospfv3 & OSPF_V3_OPTIONS_R) {
1759 if (options_string[0] != '\0')
1760 strcat(options_string, "/");
1761 strcat(options_string, "R");
1764 if (options_ospfv3 & OSPF_V3_OPTIONS_DC) {
1765 if (options_string[0] != '\0')
1766 strcat(options_string, "/");
1767 strcat(options_string, "DC");
1770 proto_tree_add_text(tree, tvb, offset, 3, "Options: 0x%x (%s)",
1771 options_ospfv3, options_string);
1781 static void dissect_ospf_v3_prefix_options(tvbuff_t *tvb, int offset, proto_tree *tree)
1784 guint8 prefix_options;
1785 char prefix_options_string[11];
1790 prefix_options=tvb_get_guint8(tvb, offset);
1792 strcpy(prefix_options_string,"");
1794 if (prefix_options & OSPF_V3_PREFIX_OPTION_P) {
1795 strcat(prefix_options_string, "P");
1799 if (prefix_options & OSPF_V3_PREFIX_OPTION_MC) {
1800 if ( (position > 0) && (prefix_options_string[position-1] != '/') ) {
1801 strcat(prefix_options_string, "/");
1804 strcat(prefix_options_string, "MC");
1808 if (prefix_options & OSPF_V3_PREFIX_OPTION_LA) {
1809 if ( (position > 0) && (prefix_options_string[position-1] != '/') ) {
1810 strcat(prefix_options_string, "/");
1813 strcat(prefix_options_string, "LA");
1817 if (prefix_options & OSPF_V3_PREFIX_OPTION_NU) {
1818 if ( (position > 0) && (prefix_options_string[position-1] != '/') ) {
1819 strcat(prefix_options_string, "/");
1822 strcat(prefix_options_string, "NU");
1825 prefix_options_string[10]=0;
1827 proto_tree_add_text(tree, tvb, offset, 1, "PrefixOptions: 0x%02x (%s)",prefix_options, prefix_options_string);
1832 static void dissect_ospf_v3_address_prefix(tvbuff_t *tvb, int offset, int prefix_length, proto_tree *tree)
1840 guint8 bytes_to_process;
1843 start_offset=offset;
1846 bytes_to_process=((prefix_length+31)/32)*4;
1848 while (bytes_to_process > 0 ) {
1850 value=tvb_get_guint8(tvb, offset);
1852 if ( (position > 0) && ( (position%2) == 0 ) )
1853 buffer[bufpos++]=':';
1855 sprintf(bytebuf,"%02x",value);
1856 buffer[bufpos++]=bytebuf[0];
1857 buffer[bufpos++]=bytebuf[1];
1865 proto_tree_add_text(tree, tvb, start_offset, ((prefix_length+31)/32)*4, "Address Prefix: %s",buffer);
1871 proto_register_ospf(void)
1873 /* static hf_register_info hf[] = {
1875 { "Name", "ospf.abbreviation", TYPE, VALS_POINTER }},
1877 static gint *ett[] = {
1886 &ett_ospf_lsa_mpls_router,
1887 &ett_ospf_lsa_mpls_link,
1888 &ett_ospf_lsa_mpls_link_stlv
1891 proto_ospf = proto_register_protocol("Open Shortest Path First",
1893 /* proto_register_field_array(proto_ospf, hf, array_length(hf));*/
1894 proto_register_subtree_array(ett, array_length(ett));
1898 proto_reg_handoff_ospf(void)
1900 dissector_handle_t ospf_handle;
1902 ospf_handle = create_dissector_handle(dissect_ospf, proto_ospf);
1903 dissector_add("ip.proto", IP_PROTO_OSPF, ospf_handle);
1904 data_handle = find_dissector("data");