2 * Routines for OSPF packet disassembly
3 * (c) Copyright Hannes R. Boehm <hannes@boehm.org>
5 * $Id: packet-ospf.c,v 1.61 2002/04/25 06:34:41 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 "packet-rsvp.h"
56 #define OSPF_VERSION_2 2
57 #define OSPF_VERSION_3 3
58 #define OSPF_VERSION_2_HEADER_LENGTH 24
59 #define OSPF_VERSION_3_HEADER_LENGTH 16
63 #define OSPF_DB_DESC 2
68 static const value_string pt_vals[] = {
69 {OSPF_HELLO, "Hello Packet" },
70 {OSPF_DB_DESC, "DB Descr." },
71 {OSPF_LS_REQ, "LS Request" },
72 {OSPF_LS_UPD, "LS Update" },
73 {OSPF_LS_ACK, "LS Acknowledge" },
77 #define OSPF_AUTH_NONE 0
78 #define OSPF_AUTH_SIMPLE 1
79 #define OSPF_AUTH_CRYPT 2
81 static const value_string auth_vals[] = {
82 {OSPF_AUTH_NONE, "Null" },
83 {OSPF_AUTH_SIMPLE, "Simple password" },
84 {OSPF_AUTH_CRYPT, "Cryptographic" },
88 #define OSPF_V2_OPTIONS_E 0x02
89 #define OSPF_V2_OPTIONS_MC 0x04
90 #define OSPF_V2_OPTIONS_NP 0x08
91 #define OSPF_V2_OPTIONS_EA 0x10
92 #define OSPF_V2_OPTIONS_DC 0x20
93 #define OSPF_V2_OPTIONS_O 0x40
94 #define OSPF_V2_OPTIONS_DN 0x01
95 #define OSPF_V3_OPTIONS_V6 0x01
96 #define OSPF_V3_OPTIONS_E 0x02
97 #define OSPF_V3_OPTIONS_MC 0x04
98 #define OSPF_V3_OPTIONS_N 0x08
99 #define OSPF_V3_OPTIONS_R 0x10
100 #define OSPF_V3_OPTIONS_DC 0x20
103 #define OSPF_DBD_FLAG_MS 1
104 #define OSPF_DBD_FLAG_M 2
105 #define OSPF_DBD_FLAG_I 4
107 #define OSPF_LS_REQ_LENGTH 12
109 #define OSPF_LSTYPE_ROUTER 1
110 #define OSPF_LSTYPE_NETWORK 2
111 #define OSPF_LSTYPE_SUMMERY 3
112 #define OSPF_LSTYPE_ASBR 4
113 #define OSPF_LSTYPE_ASEXT 5
114 #define OSPF_LSTYPE_GRPMEMBER 6
115 #define OSPF_LSTYPE_ASEXT7 7
116 #define OSPF_LSTYPE_EXTATTR 8
117 #define OSPF_V3_LSTYPE_ROUTER 0x2001
118 #define OSPF_V3_LSTYPE_NETWORK 0x2002
119 #define OSPF_V3_LSTYPE_INTER_AREA_PREFIX 0x2003
120 #define OSPF_V3_LSTYPE_INTER_AREA_ROUTER 0x2004
121 #define OSPF_V3_LSTYPE_AS_EXTERNAL 0x4005
122 #define OSPF_V3_LSTYPE_GROUP_MEMBERSHIP 0x2006
123 #define OSPF_V3_LSTYPE_TYPE_7 0x2007
124 #define OSPF_V3_LSTYPE_LINK 0x0008
125 #define OSPF_V3_LSTYPE_INTRA_AREA_PREFIX 0x2009
127 /* Opaque LSA types */
128 #define OSPF_LSTYPE_OP_LINKLOCAL 9
129 #define OSPF_LSTYPE_OP_AREALOCAL 10
130 #define OSPF_LSTYPE_OP_ASWIDE 11
132 #define OSPF_LINK_PTP 1
133 #define OSPF_LINK_TRANSIT 2
134 #define OSPF_LINK_STUB 3
135 #define OSPF_LINK_VIRTUAL 4
137 #define OSPF_V3_LINK_PTP 1
138 #define OSPF_V3_LINK_TRANSIT 2
139 #define OSPF_V3_LINK_RESERVED 3
140 #define OSPF_V3_LINK_VIRTUAL 4
142 #define OSPF_LSA_HEADER_LENGTH 20
144 /* Known opaque LSAs */
145 #define OSPF_LSA_MPLS_TE 1
148 static const value_string ls_type_vals[] = {
149 {OSPF_LSTYPE_ROUTER, "Router-LSA" },
150 {OSPF_LSTYPE_NETWORK, "Network-LSA" },
151 {OSPF_LSTYPE_SUMMERY, "Summary-LSA (IP network)" },
152 {OSPF_LSTYPE_ASBR, "Summary-LSA (ASBR)" },
153 {OSPF_LSTYPE_ASEXT, "AS-External-LSA (ASBR)" },
154 {OSPF_LSTYPE_GRPMEMBER, "Group Membership LSA" },
155 {OSPF_LSTYPE_ASEXT7, "NSSA AS-External-LSA" },
156 {OSPF_LSTYPE_EXTATTR, "External Attributes LSA" },
157 {OSPF_LSTYPE_OP_LINKLOCAL, "Opaque LSA, Link-local scope" },
158 {OSPF_LSTYPE_OP_AREALOCAL, "Opaque LSA, Area-local scope" },
163 static const value_string v3_ls_type_vals[] = {
164 {OSPF_V3_LSTYPE_ROUTER, "Router-LSA" },
165 {OSPF_V3_LSTYPE_NETWORK, "Network-LSA" },
166 {OSPF_V3_LSTYPE_INTER_AREA_PREFIX, "Inter-Area-Prefix-LSA" },
167 {OSPF_V3_LSTYPE_INTER_AREA_ROUTER, "Inter-Area-Router-LSA" },
168 {OSPF_V3_LSTYPE_AS_EXTERNAL, "AS-External-LSA" },
169 {OSPF_V3_LSTYPE_GROUP_MEMBERSHIP, "Group-Membership-LSA" },
170 {OSPF_V3_LSTYPE_TYPE_7, "Type-LSA" },
171 {OSPF_V3_LSTYPE_LINK, "Link-LSA" },
172 {OSPF_V3_LSTYPE_INTRA_AREA_PREFIX, "Intra-Area-Prefix-LSA" },
178 #define OSPF_V3_ROUTER_LSA_FLAG_B 0x01
179 #define OSPF_V3_ROUTER_LSA_FLAG_E 0x02
180 #define OSPF_V3_ROUTER_LSA_FLAG_V 0x04
181 #define OSPF_V3_ROUTER_LSA_FLAG_W 0x08
183 #define OSPF_V3_PREFIX_OPTION_NU 0x01
184 #define OSPF_V3_PREFIX_OPTION_LA 0x02
185 #define OSPF_V3_PREFIX_OPTION_MC 0x04
186 #define OSPF_V3_PREFIX_OPTION_P 0x08
188 #define OSPF_V3_AS_EXTERNAL_FLAG_T 0x01
189 #define OSPF_V3_AS_EXTERNAL_FLAG_F 0x02
190 #define OSPF_V3_AS_EXTERNAL_FLAG_E 0x04
193 static int proto_ospf = -1;
195 static gint ett_ospf = -1;
196 static gint ett_ospf_hdr = -1;
197 static gint ett_ospf_hello = -1;
198 static gint ett_ospf_desc = -1;
199 static gint ett_ospf_lsr = -1;
200 static gint ett_ospf_lsa = -1;
201 static gint ett_ospf_lsa_upd = -1;
203 /* Trees for opaque LSAs */
204 static gint ett_ospf_lsa_mpls = -1;
205 static gint ett_ospf_lsa_mpls_router = -1;
206 static gint ett_ospf_lsa_mpls_link = -1;
207 static gint ett_ospf_lsa_mpls_link_stlv = -1;
209 static dissector_handle_t data_handle;
211 static void dissect_ospf_hello(tvbuff_t*, int, proto_tree*, guint8);
212 static void dissect_ospf_db_desc(tvbuff_t*, int, proto_tree*, guint8);
213 static void dissect_ospf_ls_req(tvbuff_t*, int, proto_tree*, guint8);
214 static void dissect_ospf_ls_upd(tvbuff_t*, int, proto_tree*, guint8);
215 static void dissect_ospf_ls_ack(tvbuff_t*, int, proto_tree*, guint8);
217 /* dissect_ospf_v[23]lsa returns the offset of the next LSA
218 * if disassemble_body is set to FALSE (e.g. in LSA ACK
219 * packets), the offset is set to the offset of the next
222 static int dissect_ospf_v2_lsa(tvbuff_t*, int, proto_tree*, gboolean disassemble_body);
223 static int dissect_ospf_v3_lsa(tvbuff_t*, int, proto_tree*, gboolean disassemble_body);
225 static void dissect_ospf_options(tvbuff_t *, int, proto_tree *, guint8);
227 static void dissect_ospf_v3_prefix_options(tvbuff_t *, int, proto_tree *);
229 static void dissect_ospf_v3_address_prefix(tvbuff_t *, int, int, proto_tree *);
232 dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
234 proto_tree *ospf_tree = NULL;
236 proto_tree *ospf_header_tree;
243 guint16 cksum, computed_cksum;
244 guint length, reported_length;
248 unsigned int ospf_header_length;
254 if (check_col(pinfo->cinfo, COL_PROTOCOL))
255 col_set_str(pinfo->cinfo, COL_PROTOCOL, "OSPF");
256 if (check_col(pinfo->cinfo, COL_INFO))
257 col_clear(pinfo->cinfo, COL_INFO);
259 version = tvb_get_guint8(tvb, 0);
262 ospf_header_length = OSPF_VERSION_2_HEADER_LENGTH;
265 ospf_header_length = OSPF_VERSION_3_HEADER_LENGTH;
268 ospf_header_length = 0;
272 packet_type = tvb_get_guint8(tvb, 1);
273 if (check_col(pinfo->cinfo, COL_INFO)) {
274 col_add_str(pinfo->cinfo, COL_INFO,
275 val_to_str(packet_type, pt_vals, "Unknown (%u)"));
279 ospflen = tvb_get_ntohs(tvb, 2);
281 ti = proto_tree_add_item(tree, proto_ospf, tvb, 0, ospflen, FALSE);
282 ospf_tree = proto_item_add_subtree(ti, ett_ospf);
284 ti = proto_tree_add_text(ospf_tree, tvb, 0, ospf_header_length,
286 ospf_header_tree = proto_item_add_subtree(ti, ett_ospf_hdr);
288 proto_tree_add_text(ospf_header_tree, tvb, 0, 1, "OSPF Version: %u",
290 proto_tree_add_text(ospf_header_tree, tvb, 1, 1, "OSPF Packet Type: %u (%s)",
292 val_to_str(packet_type, pt_vals, "Unknown"));
293 proto_tree_add_text(ospf_header_tree, tvb, 2, 2, "Packet Length: %u",
295 proto_tree_add_text(ospf_header_tree, tvb, 4, 4, "Source OSPF Router ID: %s",
296 ip_to_str(tvb_get_ptr(tvb, 4, 4)));
297 areaid=tvb_get_ntohl(tvb,8);
298 proto_tree_add_text(ospf_header_tree, tvb, 8, 4, "Area ID: %s%s",
299 ip_to_str(tvb_get_ptr(tvb, 8, 4)), areaid == 0 ? " (Backbone)" : "");
300 cksum = tvb_get_ntohs(tvb, 12);
301 length = tvb_length(tvb);
302 /* XXX - include only the length from the OSPF header? */
303 reported_length = tvb_reported_length(tvb);
305 /* No checksum supplied in the packet. */
306 proto_tree_add_text(ospf_header_tree, tvb, 12, 2,
307 "Packet Checksum: 0x%04x (none)", cksum);
308 } else if (!pinfo->fragmented && length >= reported_length
309 && length >= ospf_header_length
310 && (version == OSPF_VERSION_2 || version == OSPF_VERSION_3)) {
311 /* The packet isn't part of a fragmented datagram and isn't
312 truncated, and we know how to checksum this version of
313 OSPF, so we can checksum it. */
318 /* Header, not including the authentication data (the OSPFv2
319 checksum excludes the 64-bit authentication field). */
320 cksum_vec[0].ptr = tvb_get_ptr(tvb, 0, 16);
321 cksum_vec[0].len = 16;
322 if (length > ospf_header_length) {
323 /* Rest of the packet, again not including the
324 authentication data. */
325 reported_length -= ospf_header_length;
326 cksum_vec[1].ptr = tvb_get_ptr(tvb, ospf_header_length, reported_length);
327 cksum_vec[1].len = reported_length;
330 /* There's nothing but a header. */
336 /* IPv6-style checksum, covering the entire OSPF packet
337 and a prepended IPv6 pseudo-header. */
339 /* Set up the fields of the pseudo-header. */
340 cksum_vec[0].ptr = pinfo->src.data;
341 cksum_vec[0].len = pinfo->src.len;
342 cksum_vec[1].ptr = pinfo->dst.data;
343 cksum_vec[1].len = pinfo->dst.len;
344 cksum_vec[2].ptr = (const guint8 *)&phdr;
345 phdr[0] = htonl(ospflen);
346 phdr[1] = htonl(IP_PROTO_OSPF);
347 cksum_vec[2].len = 8;
349 cksum_vec[3].ptr = tvb_get_ptr(tvb, 0, reported_length);
350 cksum_vec[3].len = reported_length;
355 g_assert_not_reached();
358 computed_cksum = in_cksum(cksum_vec, cksum_vec_len);
359 if (computed_cksum == 0) {
360 proto_tree_add_text(ospf_header_tree, tvb, 12, 2,
361 "Packet Checksum: 0x%04x (correct)", cksum);
363 proto_tree_add_text(ospf_header_tree, tvb, 12, 2,
364 "Packet Checksum: 0x%04x (incorrect, should be 0x%04x)",
365 cksum, in_cksum_shouldbe(cksum, computed_cksum));
368 proto_tree_add_text(ospf_header_tree, tvb, 12, 2,
369 "Packet Checksum: 0x%04x", cksum);
373 /* Authentication is only valid for OSPFv2 */
374 if ( version == OSPF_VERSION_2 ) {
375 auth_type = tvb_get_ntohs(tvb, 14);
376 proto_tree_add_text(ospf_header_tree, tvb, 14, 2, "Auth Type: %s",
377 val_to_str(auth_type, auth_vals, "Unknown (%u)"));
381 proto_tree_add_text(ospf_header_tree, tvb, 16, 8, "Auth Data (none)");
384 case OSPF_AUTH_SIMPLE:
385 tvb_get_nstringz0(tvb, 16, 8, auth_data);
386 proto_tree_add_text(ospf_header_tree, tvb, 16, 8, "Auth Data: %s", auth_data);
389 case OSPF_AUTH_CRYPT:
390 proto_tree_add_text(ospf_header_tree, tvb, 18, 1, "Auth Key ID: %u",
391 tvb_get_guint8(tvb, 18));
392 crypto_len = tvb_get_guint8(tvb, 19);
393 proto_tree_add_text(ospf_header_tree, tvb, 19, 1, "Auth Data Length: %u",
395 proto_tree_add_text(ospf_header_tree, tvb, 20, 4, "Auth Crypto Sequence Number: 0x%x",
396 tvb_get_ntohl(tvb, 20));
398 /* Show the message digest that was appended to the end of the
399 OSPF message - but only if it's present (we don't want
400 to get an exception before we've tried dissecting OSPF
402 if (tvb_bytes_exist(tvb, ospflen, crypto_len)) {
403 proto_tree_add_text(ospf_header_tree, tvb, ospflen, crypto_len,
405 tvb_bytes_to_str(tvb, ospflen, crypto_len));
410 proto_tree_add_text(ospf_header_tree, tvb, 16, 8, "Auth Data (unknown)");
416 /* Instance ID and "reserved" is OSPFv3-only */
417 if ( version == OSPF_VERSION_3 ) {
418 instance_ID = tvb_get_guint8(tvb, 14);
419 proto_tree_add_text(ospf_header_tree, tvb, 14, 1, "Instance ID: %u",
421 reserved = tvb_get_guint8(tvb, 15);
422 proto_tree_add_text(ospf_header_tree, tvb, 15, 1, (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),
427 /* Adjust the length of the tvbuff to match the size of the OSPF
428 * packet (since the dissect routines use it to work out where the
429 * end of the OSPF packet is).
431 tvb_set_reported_length(tvb, ospflen);
433 switch (packet_type){
436 dissect_ospf_hello(tvb, ospf_header_length, ospf_tree, version);
440 dissect_ospf_db_desc(tvb, ospf_header_length, ospf_tree, version);
444 dissect_ospf_ls_req(tvb, ospf_header_length, ospf_tree, version);
448 dissect_ospf_ls_upd(tvb, ospf_header_length, ospf_tree, version);
452 dissect_ospf_ls_ack(tvb, ospf_header_length, ospf_tree, version);
456 call_dissector(data_handle,tvb_new_subset(tvb, ospf_header_length,-1,tvb_reported_length_remaining(tvb,ospf_header_length)), pinfo, tree);
463 dissect_ospf_hello(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
465 proto_tree *ospf_hello_tree;
468 ti = proto_tree_add_text(tree, tvb, offset, -1, "OSPF Hello Packet");
469 ospf_hello_tree = proto_item_add_subtree(ti, ett_ospf_hello);
473 proto_tree_add_text(ospf_hello_tree, tvb, offset, 4, "Network Mask: %s",
474 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
475 proto_tree_add_text(ospf_hello_tree, tvb, offset + 4, 2,
476 "Hello Interval: %u seconds",
477 tvb_get_ntohs(tvb, offset + 4));
479 dissect_ospf_options(tvb, offset + 6, ospf_hello_tree, version);
480 proto_tree_add_text(ospf_hello_tree, tvb, offset + 7, 1, "Router Priority: %u",
481 tvb_get_guint8(tvb, offset + 7));
482 proto_tree_add_text(ospf_hello_tree, tvb, offset + 8, 4, "Router Dead Interval: %u seconds",
483 tvb_get_ntohl(tvb, offset + 8));
484 proto_tree_add_text(ospf_hello_tree, tvb, offset + 12, 4, "Designated Router: %s",
485 ip_to_str(tvb_get_ptr(tvb, offset + 12, 4)));
486 proto_tree_add_text(ospf_hello_tree, tvb, offset + 16, 4, "Backup Designated Router: %s",
487 ip_to_str(tvb_get_ptr(tvb, offset + 16, 4)));
490 while (tvb_reported_length_remaining(tvb, offset) != 0) {
491 proto_tree_add_text(ospf_hello_tree, tvb, offset, 4,
492 "Active Neighbor: %s",
493 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
498 proto_tree_add_text(ospf_hello_tree, tvb, offset + 0, 4, "Interface ID: %u",
499 tvb_get_ntohl(tvb, offset + 0));
500 proto_tree_add_text(ospf_hello_tree, tvb, offset + 4, 1, "Router Priority: %u",
501 tvb_get_guint8(tvb, offset + 4));
502 dissect_ospf_options(tvb, offset + 5, ospf_hello_tree, version);
503 proto_tree_add_text(ospf_hello_tree, tvb, offset + 8, 2,
504 "Hello Interval: %u seconds",
505 tvb_get_ntohs(tvb, offset + 8));
506 proto_tree_add_text(ospf_hello_tree, tvb, offset + 10, 2, "Router Dead Interval: %u seconds",
507 tvb_get_ntohs(tvb, offset + 10));
508 proto_tree_add_text(ospf_hello_tree, tvb, offset + 12, 4, "Designated Router: %s",
509 ip_to_str(tvb_get_ptr(tvb, offset + 12, 4)));
510 proto_tree_add_text(ospf_hello_tree, tvb, offset + 16, 4, "Backup Designated Router: %s",
511 ip_to_str(tvb_get_ptr(tvb, offset + 16, 4)));
513 while (tvb_reported_length_remaining(tvb, offset) != 0) {
514 proto_tree_add_text(ospf_hello_tree, tvb, offset, 4,
515 "Active Neighbor: %s",
516 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
528 dissect_ospf_db_desc(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
530 proto_tree *ospf_db_desc_tree=NULL;
534 char flags_string[20] = "";
537 ti = proto_tree_add_text(tree, tvb, offset, -1, "OSPF DB Description");
538 ospf_db_desc_tree = proto_item_add_subtree(ti, ett_ospf_desc);
544 proto_tree_add_text(ospf_db_desc_tree, tvb, offset, 2, "Interface MTU: %u",
545 tvb_get_ntohs(tvb, offset));
547 dissect_ospf_options(tvb, offset + 2, ospf_db_desc_tree, version);
549 flags = tvb_get_guint8(tvb, offset + 3);
550 if (flags & OSPF_DBD_FLAG_MS)
551 strcat(flags_string, "MS");
552 if (flags & OSPF_DBD_FLAG_M) {
553 if (flags_string[0] != '\0')
554 strcat(flags_string, "/");
555 strcat(flags_string, "M");
557 if (flags & OSPF_DBD_FLAG_I) {
558 if (flags_string[0] != '\0')
559 strcat(flags_string, "/");
560 strcat(flags_string, "I");
562 proto_tree_add_text(ospf_db_desc_tree, tvb, offset + 3, 1, "Flags: 0x%x (%s)",
563 flags, flags_string);
564 proto_tree_add_text(ospf_db_desc_tree, tvb, offset + 4, 4, "DD Sequence: %u",
565 tvb_get_ntohl(tvb, offset + 4));
572 reserved = tvb_get_guint8(tvb, offset);
573 proto_tree_add_text(ospf_db_desc_tree, tvb, offset, 1, (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),
576 dissect_ospf_options(tvb, offset + 1, ospf_db_desc_tree, version);
578 proto_tree_add_text(ospf_db_desc_tree, tvb, offset + 4, 2, "Interface MTU: %u",
579 tvb_get_ntohs(tvb, offset+4));
581 reserved = tvb_get_guint8(tvb, offset + 6);
582 proto_tree_add_text(ospf_db_desc_tree, tvb, offset + 6, 1, (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),
585 flags = tvb_get_guint8(tvb, offset + 7);
586 if (flags & OSPF_DBD_FLAG_MS)
587 strcat(flags_string, "MS");
588 if (flags & OSPF_DBD_FLAG_M) {
589 if (flags_string[0] != '\0')
590 strcat(flags_string, "/");
591 strcat(flags_string, "M");
593 if (flags & OSPF_DBD_FLAG_I) {
594 if (flags_string[0] != '\0')
595 strcat(flags_string, "/");
596 strcat(flags_string, "I");
598 proto_tree_add_text(ospf_db_desc_tree, tvb, offset + 7, 1, "Flags: 0x%x (%s)",
599 flags, flags_string);
601 proto_tree_add_text(ospf_db_desc_tree, tvb, offset + 8, 4, "DD Sequence: %u",
602 tvb_get_ntohl(tvb, offset + 8));
612 /* LS Headers will be processed here */
613 /* skip to the end of DB-Desc header */
614 while (tvb_reported_length_remaining(tvb, offset) != 0) {
615 if ( version == OSPF_VERSION_2)
616 offset = dissect_ospf_v2_lsa(tvb, offset, tree, FALSE);
618 if ( version == OSPF_VERSION_3)
619 offset = dissect_ospf_v3_lsa(tvb, offset, tree, FALSE);
625 dissect_ospf_ls_req(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
627 proto_tree *ospf_lsr_tree;
632 /* zero or more LS requests may be within a LS Request */
633 /* we place every request for a LSA in a single subtree */
634 while (tvb_reported_length_remaining(tvb, offset) != 0) {
635 ti = proto_tree_add_text(tree, tvb, offset, OSPF_LS_REQ_LENGTH,
636 "Link State Request");
637 ospf_lsr_tree = proto_item_add_subtree(ti, ett_ospf_lsr);
639 reserved = tvb_get_guint8(tvb, offset);
640 proto_tree_add_text(ospf_lsr_tree, tvb, offset, 1,
641 (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),
647 ls_type = tvb_get_ntohl(tvb, offset);
648 proto_tree_add_text(ospf_lsr_tree, tvb, offset, 4, "LS Type: %s (%u)",
649 val_to_str(ls_type, ls_type_vals, "Unknown"),
653 ls_type = tvb_get_ntohs(tvb, offset+2);
654 proto_tree_add_text(ospf_lsr_tree, tvb, offset+2, 2, "LS Type: %s (0x%04x)",
655 val_to_str(ls_type, v3_ls_type_vals, "Unknown"),
664 proto_tree_add_text(ospf_lsr_tree, tvb, offset + 4, 4, "Link State ID: %s",
665 ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
666 proto_tree_add_text(ospf_lsr_tree, tvb, offset + 8, 4, "Advertising Router: %s",
667 ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
674 dissect_ospf_ls_upd(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
676 proto_tree *ospf_lsa_upd_tree=NULL;
681 ti = proto_tree_add_text(tree, tvb, offset, -1, "LS Update Packet");
682 ospf_lsa_upd_tree = proto_item_add_subtree(ti, ett_ospf_lsa_upd);
684 lsa_nr = tvb_get_ntohl(tvb, offset);
685 proto_tree_add_text(ospf_lsa_upd_tree, tvb, offset, 4, "Number of LSAs: %u",
687 /* skip to the beginning of the first LSA */
688 offset += 4; /* the LS Upd Packet contains only a 32 bit #LSAs field */
691 while (lsa_counter < lsa_nr) {
692 if ( version == OSPF_VERSION_2)
693 offset = dissect_ospf_v2_lsa(tvb, offset, ospf_lsa_upd_tree, TRUE);
695 if ( version == OSPF_VERSION_3)
696 offset = dissect_ospf_v3_lsa(tvb, offset, ospf_lsa_upd_tree, TRUE);
702 dissect_ospf_ls_ack(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
704 /* the body of a LS Ack packet simply contains zero or more LSA Headers */
705 while (tvb_reported_length_remaining(tvb, offset) != 0) {
706 if ( version == OSPF_VERSION_2)
707 offset = dissect_ospf_v2_lsa(tvb, offset, tree, FALSE);
709 if ( version == OSPF_VERSION_3)
710 offset = dissect_ospf_v3_lsa(tvb, offset, tree, FALSE);
715 * Returns if an LSA is opaque, i.e. requires special treatment
718 is_opaque(int lsa_type)
720 return (lsa_type >= OSPF_LSTYPE_OP_LINKLOCAL &&
721 lsa_type <= OSPF_LSTYPE_OP_ASWIDE);
724 /* MPLS/TE TLV types */
725 #define MPLS_TLV_ROUTER 1
726 #define MPLS_TLV_LINK 2
728 /* MPLS/TE Link STLV types */
736 MPLS_LINK_MAX_RES_BW,
739 MPLS_LINK_LOCAL_ID = 11,
741 MPLS_LINK_PROTECTION = 14,
742 MPLS_LINK_IF_SWITCHING_DESC,
743 MPLS_LINK_SHARED_RISK_GROUP,
746 static const value_string mpls_link_stlv_str[] = {
747 {MPLS_LINK_TYPE, "Link Type"},
748 {MPLS_LINK_ID, "Link ID"},
749 {MPLS_LINK_LOCAL_IF, "Local Interface IP Address"},
750 {MPLS_LINK_REMOTE_IF, "Remote Interface IP Address"},
751 {MPLS_LINK_TE_METRIC, "Traffic Engineering Metric"},
752 {MPLS_LINK_MAX_BW, "Maximum Bandwidth"},
753 {MPLS_LINK_MAX_RES_BW, "Maximum Reservable Bandwidth"},
754 {MPLS_LINK_UNRES_BW, "Unreserved Bandwidth"},
755 {MPLS_LINK_COLOR, "Resource Class/Color"},
756 {MPLS_LINK_LOCAL_ID, "Link Local Identifier"},
757 {MPLS_LINK_REMOTE_ID, "Link Remote Identifier"},
758 {MPLS_LINK_PROTECTION, "Link Protection Type"},
759 {MPLS_LINK_IF_SWITCHING_DESC, "Interface Switching Capability Descriptor"},
760 {MPLS_LINK_SHARED_RISK_GROUP, "Shared Risk Link Group"},
765 * Dissect MPLS/TE opaque LSA
768 dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
772 proto_tree *mpls_tree;
773 proto_tree *tlv_tree;
774 proto_tree *stlv_tree;
780 int stlv_type, stlv_len, stlv_offset;
784 ti = proto_tree_add_text(tree, tvb, offset, length,
785 "MPLS Traffic Engineering LSA");
786 mpls_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls);
788 while (length != 0) {
789 tlv_type = tvb_get_ntohs(tvb, offset);
790 tlv_length = tvb_get_ntohs(tvb, offset + 2);
791 tlv_end_offset = offset + tlv_length + 4;
795 case MPLS_TLV_ROUTER:
796 ti = proto_tree_add_text(mpls_tree, tvb, offset, tlv_length+4,
797 "Router Address: %s",
798 ip_to_str(tvb_get_ptr(tvb, offset+4, 4)));
799 tlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_router);
800 proto_tree_add_text(tlv_tree, tvb, offset, 2, "TLV Type: 1 - Router Address");
801 proto_tree_add_text(tlv_tree, tvb, offset+2, 2, "TLV Length: %u",
803 proto_tree_add_text(tlv_tree, tvb, offset+4, 4, "Router Address: %s",
804 ip_to_str(tvb_get_ptr(tvb, offset+4, 4)));
808 ti = proto_tree_add_text(mpls_tree, tvb, offset, tlv_length+4,
810 tlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link);
811 proto_tree_add_text(tlv_tree, tvb, offset, 2, "TLV Type: 2 - Link Information");
812 proto_tree_add_text(tlv_tree, tvb, offset+2, 2, "TLV Length: %u",
814 stlv_offset = offset + 4;
816 /* Walk down the sub-TLVs for link information */
817 while (stlv_offset < tlv_end_offset) {
818 stlv_type = tvb_get_ntohs(tvb, stlv_offset);
819 stlv_len = tvb_get_ntohs(tvb, stlv_offset + 2);
820 stlv_name = val_to_str(stlv_type, mpls_link_stlv_str, "Unknown sub-TLV");
824 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
826 tvb_get_guint8(tvb, stlv_offset + 4));
827 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
828 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
829 "TLV Type: %u: %s", stlv_type, stlv_name);
830 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
832 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 1, "%s: %u", stlv_name,
833 tvb_get_guint8(tvb, stlv_offset + 4));
837 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
838 "%s: %s (%x)", stlv_name,
839 ip_to_str(tvb_get_ptr(tvb, stlv_offset + 4, 4)),
840 tvb_get_ntohl(tvb, stlv_offset + 4));
841 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
842 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
843 "TLV Type: %u: %s", stlv_type, stlv_name);
844 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
846 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 4, "%s: %s (%x)", stlv_name,
847 ip_to_str(tvb_get_ptr(tvb, stlv_offset + 4, 4)),
848 tvb_get_ntohl(tvb, stlv_offset + 4));
851 case MPLS_LINK_LOCAL_IF:
852 case MPLS_LINK_REMOTE_IF:
853 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
855 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
856 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
857 "TLV Type: %u: %s", stlv_type, stlv_name);
858 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
860 /* The Local/Remote Interface IP Address sub-TLV is TLV type 3/4, and is 4N
861 octets in length, where N is the number of neighbor addresses. */
862 for (i=0; i < stlv_len; i+=4)
863 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4+i, 4, "%s: %s", stlv_name,
864 ip_to_str(tvb_get_ptr(tvb, stlv_offset+4+i, 4)));
867 case MPLS_LINK_TE_METRIC:
868 case MPLS_LINK_COLOR:
869 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
871 tvb_get_ntohl(tvb, stlv_offset + 4));
872 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
873 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
874 "TLV Type: %u: %s", stlv_type, stlv_name);
875 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
877 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 4, "%s: %u", stlv_name,
878 tvb_get_ntohl(tvb, stlv_offset + 4));
881 case MPLS_LINK_MAX_BW:
882 case MPLS_LINK_MAX_RES_BW:
883 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
884 "%s: %.10g", stlv_name,
885 tvb_get_ntohieee_float(tvb, stlv_offset + 4));
886 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
887 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
888 "TLV Type: %u: %s", stlv_type, stlv_name);
889 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
891 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 4, "%s: %.10g", stlv_name,
892 tvb_get_ntohieee_float(tvb, stlv_offset + 4));
895 case MPLS_LINK_UNRES_BW:
896 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
898 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
899 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
900 "TLV Type: %u: %s", stlv_type, stlv_name);
901 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
903 for (i = 0; i < 8; i++) {
904 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4+(i*4), 4,
905 "Pri %d: %.10g bytes/s (%.0f bits/s)", i,
906 tvb_get_ntohieee_float(tvb, stlv_offset + 4 + i*4),
907 tvb_get_ntohieee_float(tvb, stlv_offset + 4 + i*4) * 8.0);
911 case MPLS_LINK_LOCAL_ID:
912 case MPLS_LINK_REMOTE_ID:
913 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
914 "%s: %d (0x%x)", stlv_name,
915 tvb_get_ntohl(tvb, stlv_offset + 4),
916 tvb_get_ntohl(tvb, stlv_offset + 4));
917 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
918 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
919 "TLV Type: %u: %s", stlv_type, stlv_name);
920 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
922 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 4, "%s: %d (0x%x)", stlv_name,
923 tvb_get_ntohl(tvb, stlv_offset + 4),
924 tvb_get_ntohl(tvb, stlv_offset + 4));
927 case MPLS_LINK_IF_SWITCHING_DESC:
928 ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
930 stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
931 proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
932 "TLV Type: %u: %s", stlv_type, stlv_name);
933 proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
935 proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 1, "Switching Type: %s",
936 val_to_str(tvb_get_guint8(tvb,stlv_offset+4),
937 gmpls_switching_type_str, "Unknown (%d)"));
938 proto_tree_add_text(stlv_tree, tvb, stlv_offset+5, 1, "Encoding: %s",
939 val_to_str(tvb_get_guint8(tvb,stlv_offset+5),
940 gmpls_lsp_enc_str, "Unknown (%d)"));
941 for (i = 0; i < 8; i++) {
942 proto_tree_add_text(stlv_tree, tvb, stlv_offset+8+(i*4), 4,
943 "Pri %d: %.10g bytes/s (%.0f bits/s)", i,
944 tvb_get_ntohieee_float(tvb, stlv_offset + 8 + i*4),
945 tvb_get_ntohieee_float(tvb, stlv_offset + 8 + i*4) * 8.0);
950 proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
951 "Unknown Link sub-TLV: %u", stlv_type);
954 stlv_offset += ((stlv_len+4+3)/4)*4;
959 ti = proto_tree_add_text(mpls_tree, tvb, offset, tlv_length+4,
960 "Unknown LSA: %u", tlv_type);
961 tlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link);
962 proto_tree_add_text(tlv_tree, tvb, offset, 2, "TLV Type: %u - Unknown",
964 proto_tree_add_text(tlv_tree, tvb, offset+2, 2, "TLV Length: %u",
966 proto_tree_add_text(tlv_tree, tvb, offset+4, tlv_length, "TLV Data");
970 offset += tlv_length + 4;
971 length -= tlv_length + 4;
976 * Dissect opaque LSAs
979 dissect_ospf_lsa_opaque(tvbuff_t *tvb, int offset, proto_tree *tree,
980 guint8 ls_id_type, guint32 length)
982 switch (ls_id_type) {
984 case OSPF_LSA_MPLS_TE:
985 dissect_ospf_lsa_mpls(tvb, offset, tree, length);
989 proto_tree_add_text(tree, tvb, offset, length,
990 "Unknown LSA Type %u", ls_id_type);
992 } /* switch on opaque LSA id */
996 dissect_ospf_v2_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
997 gboolean disassemble_body)
999 proto_tree *ospf_lsa_tree;
1010 guint16 link_counter;
1012 char *link_type_str;
1015 /* AS-external LSA */
1021 ls_type = tvb_get_guint8(tvb, offset + 3);
1022 ls_length = tvb_get_ntohs(tvb, offset + 18);
1023 end_offset = offset + ls_length;
1025 if (disassemble_body) {
1026 ti = proto_tree_add_text(tree, tvb, offset, ls_length,
1027 "%s (Type: %u)", val_to_str(ls_type, ls_type_vals,"Unkown"), ls_type);
1029 ti = proto_tree_add_text(tree, tvb, offset, OSPF_LSA_HEADER_LENGTH,
1032 ospf_lsa_tree = proto_item_add_subtree(ti, ett_ospf_lsa);
1034 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 2, "LS Age: %u seconds",
1035 tvb_get_ntohs(tvb, offset));
1036 dissect_ospf_options(tvb, offset + 2, ospf_lsa_tree, OSPF_VERSION_2);
1037 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 3, 1, "LSA Type: %u (%s)",
1038 ls_type, val_to_str(ls_type,ls_type_vals,"Unknown"));
1040 if (is_opaque(ls_type)) {
1041 ls_id_type = tvb_get_guint8(tvb, offset + 4);
1042 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 1, "Link State ID Opaque Type: %u",
1044 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 5, 3, "Link State ID Opaque ID: %u",
1045 tvb_get_ntoh24(tvb, offset + 5));
1048 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Link State ID: %s",
1049 ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
1052 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Advertising Router: %s",
1053 ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
1054 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 12, 4, "LS Sequence Number: 0x%04x",
1055 tvb_get_ntohl(tvb, offset + 12));
1056 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 16, 2, "LS Checksum: %04x",
1057 tvb_get_ntohs(tvb, offset + 16));
1059 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 18, 2, "Length: %u",
1062 /* skip past the LSA header to the body */
1063 offset += OSPF_LSA_HEADER_LENGTH;
1064 ls_length -= OSPF_LSA_HEADER_LENGTH;
1066 if (!disassemble_body)
1071 case OSPF_LSTYPE_ROUTER:
1072 /* again: flags should be secified in detail */
1073 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "Flags: 0x%02x",
1074 tvb_get_guint8(tvb, offset));
1075 nr_links = tvb_get_ntohs(tvb, offset + 2);
1076 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 2, 2, "Number of Links: %u",
1079 /* nr_links links follow
1080 * maybe we should put each of the links into its own subtree ???
1082 for (link_counter = 1; link_counter <= nr_links; link_counter++) {
1083 /* check the Link Type and ID */
1084 link_type = tvb_get_guint8(tvb, offset + 8);
1085 switch (link_type) {
1088 link_type_str="Point-to-point connection to another router";
1089 link_id="Neighboring router's Router ID";
1092 case OSPF_LINK_TRANSIT:
1093 link_type_str="Connection to a transit network";
1094 link_id="IP address of Designated Router";
1097 case OSPF_LINK_STUB:
1098 link_type_str="Connection to a stub network";
1099 link_id="IP network/subnet number";
1102 case OSPF_LINK_VIRTUAL:
1103 link_type_str="Virtual link";
1104 link_id="Neighboring router's Router ID";
1108 link_type_str="Unknown link type";
1109 link_id="Unknown link ID";
1113 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "%s: %s", link_id,
1114 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1116 /* link_data should be specified in detail (e.g. network mask) (depends on link type)*/
1117 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Link Data: %s",
1118 ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
1120 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 1, "Link Type: %u - %s",
1121 link_type, link_type_str);
1122 nr_tos = tvb_get_guint8(tvb, offset + 9);
1123 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 9, 1, "Number of TOS metrics: %u",
1125 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 10, 2, "TOS 0 metric: %u",
1126 tvb_get_ntohs(tvb, offset + 10));
1130 /* nr_tos metrics may follow each link
1131 * ATTENTION: TOS metrics are not tested (I don't have TOS
1133 * please send me a mail if it is/isn't working
1135 for (tos_counter = 1; tos_counter <= nr_tos; tos_counter++) {
1136 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "TOS: %u, Metric: %u",
1137 tvb_get_guint8(tvb, offset),
1138 tvb_get_ntohs(tvb, offset + 2));
1144 case OSPF_LSTYPE_NETWORK:
1145 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Netmask: %s",
1146 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1149 while (offset < end_offset) {
1150 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Attached Router: %s",
1151 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1156 case OSPF_LSTYPE_SUMMERY:
1157 /* Type 3 and 4 LSAs have the same format */
1158 case OSPF_LSTYPE_ASBR:
1159 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Netmask: %s",
1160 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1163 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Metric: %u",
1164 tvb_get_ntoh24(tvb, offset + 1));
1167 /* TOS-specific information, if any */
1168 while (offset < end_offset) {
1169 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "TOS: %u, Metric: %u",
1170 tvb_get_guint8(tvb, offset),
1171 tvb_get_ntoh24(tvb, offset + 1));
1176 case OSPF_LSTYPE_ASEXT:
1177 case OSPF_LSTYPE_ASEXT7:
1178 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Netmask: %s",
1179 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1182 options = tvb_get_guint8(tvb, offset);
1183 if (options & 0x80) { /* check wether or not E bit is set */
1184 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1185 "External Type: Type 2 (metric is larger than any other link state path)");
1187 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1188 "External Type: Type 1 (metric is specified in the same units as interface cost)");
1190 /* the metric field of a AS-external LAS is specified in 3 bytes */
1191 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 1, 3, "Metric: %u",
1192 tvb_get_ntoh24(tvb, offset + 1));
1195 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Forwarding Address: %s",
1196 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1199 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "External Route Tag: %u",
1200 tvb_get_ntohl(tvb, offset));
1203 /* TOS-specific information, if any */
1204 while (offset < end_offset) {
1205 options = tvb_get_guint8(tvb, offset);
1206 if (options & 0x80) { /* check wether or not E bit is set */
1207 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1208 "External Type: Type 2 (metric is larger than any other link state path)");
1210 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1211 "External Type: Type 1 (metric is specified in the same units as interface cost)");
1213 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "TOS: %u, Metric: %u",
1215 tvb_get_ntoh24(tvb, offset + 1));
1218 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Forwarding Address: %s",
1219 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1222 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "External Route Tag: %u",
1223 tvb_get_ntohl(tvb, offset));
1228 case OSPF_LSTYPE_OP_LINKLOCAL:
1229 case OSPF_LSTYPE_OP_AREALOCAL:
1230 case OSPF_LSTYPE_OP_ASWIDE:
1231 dissect_ospf_lsa_opaque(tvb, offset, ospf_lsa_tree, ls_id_type,
1233 offset += ls_length;
1237 /* unknown LSA type */
1238 proto_tree_add_text(ospf_lsa_tree, tvb, offset, ls_length,
1239 "Unknown LSA Type");
1240 offset += ls_length;
1243 /* return the offset of the next LSA */
1248 dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
1249 gboolean disassemble_body)
1251 proto_tree *ospf_lsa_tree;
1261 char *link_type_str;
1264 guint8 router_lsa_flags;
1265 char router_lsa_flags_string[5];
1267 guint8 router_priority;
1268 guint32 number_prefixes;
1269 guint8 prefix_length;
1272 guint16 referenced_ls_type;
1275 guint8 flags_string[4];
1276 guint32 external_route_tag;
1279 ls_type = tvb_get_ntohs(tvb, offset + 2);
1280 ls_length = tvb_get_ntohs(tvb, offset + 18);
1281 end_offset = offset + ls_length;
1283 if (disassemble_body) {
1284 ti = proto_tree_add_text(tree, tvb, offset, ls_length,
1285 "%s (Type: 0x%04x)", val_to_str(ls_type, v3_ls_type_vals,"Unknown"), ls_type);
1287 ti = proto_tree_add_text(tree, tvb, offset, OSPF_LSA_HEADER_LENGTH,
1290 ospf_lsa_tree = proto_item_add_subtree(ti, ett_ospf_lsa);
1292 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 2, "LS Age: %u seconds",
1293 tvb_get_ntohs(tvb, offset));
1295 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 2, 2, "LSA Type: 0x%04x (%s)",
1296 ls_type, val_to_str(ls_type, v3_ls_type_vals,"Unkown"));
1298 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Link State ID: %s",
1299 ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
1301 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Advertising Router: %s",
1302 ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
1303 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 12, 4, "LS Sequence Number: %d",
1304 tvb_get_ntohl(tvb, offset + 12));
1305 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 16, 2, "LS Checksum: %04x",
1306 tvb_get_ntohs(tvb, offset + 16));
1308 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 18, 2, "Length: %u",
1311 /* skip past the LSA header to the body */
1312 offset += OSPF_LSA_HEADER_LENGTH;
1313 ls_length -= OSPF_LSA_HEADER_LENGTH;
1315 if (!disassemble_body)
1321 case OSPF_V3_LSTYPE_ROUTER:
1323 /* flags field in an router-lsa */
1324 router_lsa_flags=tvb_get_guint8(tvb,offset);
1325 if (router_lsa_flags & OSPF_V3_ROUTER_LSA_FLAG_B)
1326 router_lsa_flags_string[3] = 'B';
1328 router_lsa_flags_string[3] = '.';
1329 if (router_lsa_flags & OSPF_V3_ROUTER_LSA_FLAG_E)
1330 router_lsa_flags_string[2] = 'E';
1332 router_lsa_flags_string[2] = '.';
1333 if (router_lsa_flags & OSPF_V3_ROUTER_LSA_FLAG_V)
1334 router_lsa_flags_string[1] = 'V';
1336 router_lsa_flags_string[1] = '.';
1337 if (router_lsa_flags & OSPF_V3_ROUTER_LSA_FLAG_W)
1338 router_lsa_flags_string[0] = 'W';
1340 router_lsa_flags_string[0] = '.';
1342 router_lsa_flags_string[4]=0;
1344 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "Flags: 0x%02x (%s)",
1345 router_lsa_flags, router_lsa_flags_string);
1347 /* options field in an router-lsa */
1348 dissect_ospf_options(tvb, offset + 1, ospf_lsa_tree, OSPF_VERSION_3);
1350 /* skip the router-lsa flags and options */
1355 proto_tree_add_text(ospf_lsa_tree, tvb, offset, ls_length,
1356 "Router Interfaces:");
1358 /* scan all router-lsa router interfaces */
1359 /* maybe we should put each of the links into its own subtree ??? */
1360 while (ls_length > 0 ) {
1362 /* check the type */
1363 link_type = tvb_get_guint8(tvb, offset);
1364 switch (link_type) {
1366 case OSPF_V3_LINK_PTP:
1367 link_type_str="Point-to-point connection to another router";
1370 case OSPF_V3_LINK_TRANSIT:
1371 link_type_str="Connection to a transit network";
1374 case OSPF_V3_LINK_RESERVED:
1375 link_type_str="Connection to a stub network";
1378 case OSPF_V3_LINK_VIRTUAL:
1379 link_type_str="Virtual link";
1383 link_type_str="Unknown link type";
1387 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "Type: %u (%s)", link_type,link_type_str);
1389 /* reserved field */
1390 reserved = tvb_get_guint8(tvb, offset+1);
1391 proto_tree_add_text(ospf_lsa_tree, tvb, offset+1, 1,
1392 (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved);
1395 metric=tvb_get_ntohs(tvb, offset+2);
1396 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 2, 2,"Metric: %u",metric);
1399 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Interface ID: %u",
1400 tvb_get_ntohl(tvb, offset + 4));
1402 /* Neighbor Interface ID */
1403 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Neighbor Interface ID: %u",
1404 tvb_get_ntohl(tvb, offset + 8));
1406 /* Neighbor Router ID */
1407 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 12, 4, "Neighbor Router ID: %s",
1408 ip_to_str(tvb_get_ptr(tvb, offset + 12, 4)));
1410 /* skip to the (possible) next entry */
1417 case OSPF_V3_LSTYPE_NETWORK:
1419 /* reserved field */
1420 reserved = tvb_get_guint8(tvb, offset);
1421 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1422 (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved);
1424 /* options field in an network-lsa */
1425 dissect_ospf_options(tvb, offset + 1, ospf_lsa_tree, OSPF_VERSION_3);
1430 while (ls_length > 0 ) {
1431 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Attached Router: %s",
1432 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1439 case OSPF_V3_LSTYPE_INTER_AREA_PREFIX:
1441 /* reserved field */
1442 reserved = tvb_get_guint8(tvb, offset);
1443 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1444 (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved);
1447 metric=tvb_get_ntoh24(tvb, offset+11);
1448 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 1, 3,"Metric: %u",metric);
1451 prefix_length=tvb_get_guint8(tvb, offset+4);
1452 proto_tree_add_text(ospf_lsa_tree, tvb, offset+4, 1, "PrefixLength: %u",prefix_length);
1454 /* prefix options */
1455 dissect_ospf_v3_prefix_options(tvb, offset+5, ospf_lsa_tree);
1457 /* 16 bits reserved */
1458 reserved16=tvb_get_ntohs(tvb, offset+6);
1459 proto_tree_add_text(ospf_lsa_tree, tvb, offset+6, 2,
1460 (reserved16 == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved16);
1464 /* address_prefix */
1465 dissect_ospf_v3_address_prefix(tvb, offset, prefix_length, ospf_lsa_tree);
1467 offset+=(prefix_length+31)/32*4;
1472 case OSPF_V3_LSTYPE_INTER_AREA_ROUTER:
1474 /* reserved field */
1475 reserved = tvb_get_guint8(tvb, offset);
1476 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1,
1477 (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved);
1479 /* options field in an inter-area-router-lsa */
1480 dissect_ospf_options(tvb, offset + 1, ospf_lsa_tree, OSPF_VERSION_3);
1482 /* reserved field */
1483 reserved = tvb_get_guint8(tvb, offset+4);
1484 proto_tree_add_text(ospf_lsa_tree, tvb, offset+4, 1,
1485 (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved);
1488 metric=tvb_get_ntoh24(tvb, offset+6);
1489 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 6, 3,"Metric: %u",metric);
1491 /* Destination Router ID */
1492 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Destination Router ID: %s",
1493 ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
1499 case OSPF_V3_LSTYPE_AS_EXTERNAL:
1502 flags=tvb_get_guint8(tvb, offset);
1503 if (flags & OSPF_V3_AS_EXTERNAL_FLAG_E)
1504 flags_string[0] = 'E';
1506 flags_string[0] = '.';
1507 if (flags & OSPF_V3_AS_EXTERNAL_FLAG_F)
1508 flags_string[1] = 'F';
1510 flags_string[1] = '.';
1511 if (flags & OSPF_V3_AS_EXTERNAL_FLAG_T)
1512 flags_string[2] = 'T';
1514 flags_string[2] = '.';
1518 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "Flags: 0x%02x (%s)",
1519 flags, flags_string);
1521 /* 24 bits metric */
1522 metric=tvb_get_ntoh24(tvb, offset+1);
1523 proto_tree_add_text(ospf_lsa_tree, tvb, offset+1, 3,
1524 "Metric: %u", metric);
1527 prefix_length=tvb_get_guint8(tvb, offset+4);
1528 proto_tree_add_text(ospf_lsa_tree, tvb, offset+4, 1, "PrefixLength: %u",prefix_length);
1530 /* prefix options */
1531 dissect_ospf_v3_prefix_options(tvb, offset+5, ospf_lsa_tree);
1533 /* referenced LS type */
1534 referenced_ls_type=tvb_get_ntohs(tvb, offset+6);
1535 proto_tree_add_text(ospf_lsa_tree, tvb, offset+6, 2,"Referenced LS type 0x%04x (%s)",
1536 referenced_ls_type, val_to_str(referenced_ls_type, v3_ls_type_vals, "Unknown"));
1540 /* address_prefix */
1541 dissect_ospf_v3_address_prefix(tvb, offset, prefix_length, ospf_lsa_tree);
1543 offset+=(prefix_length+31)/32*4;
1545 /* Forwarding Address (optional - only if F-flag is on) */
1546 if ( (offset < end_offset) && (flags & OSPF_V3_AS_EXTERNAL_FLAG_F) ) {
1547 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 16,"Forwarding Address: %s",
1548 ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset, 16)));
1553 /* External Route Tag (optional - only if T-flag is on) */
1554 if ( (offset < end_offset) && (flags & OSPF_V3_AS_EXTERNAL_FLAG_T) ) {
1555 external_route_tag=tvb_get_ntohl(tvb, offset);
1556 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4,"External Route Tag: 0x%04x",
1557 external_route_tag);
1562 /* Referenced Link State ID (optional - only if Referenced LS type is non-zero */
1563 if ( (offset < end_offset) && (referenced_ls_type != 0) ) {
1564 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Referenced Link State ID: %s",
1565 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1571 case OSPF_V3_LSTYPE_LINK:
1573 /* router priority */
1574 router_priority=tvb_get_guint8(tvb, offset);
1575 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "Router Priority: %u", router_priority);
1577 /* options field in an link-lsa */
1578 dissect_ospf_options(tvb, offset + 1, ospf_lsa_tree, OSPF_VERSION_3);
1580 /* Link-local Interface Address */
1581 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 16, "Link-local Interface Address: %s",
1582 ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, 16)));
1584 /* Number prefixes */
1585 number_prefixes=tvb_get_ntohl(tvb, offset + 20);
1586 proto_tree_add_text(ospf_lsa_tree, tvb, offset+20, 4, "# prefixes: %d",number_prefixes);
1590 while (number_prefixes > 0) {
1593 prefix_length=tvb_get_guint8(tvb, offset);
1594 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "PrefixLength: %u",prefix_length);
1596 /* prefix options */
1597 dissect_ospf_v3_prefix_options(tvb, offset+1, ospf_lsa_tree);
1599 /* 16 bits reserved */
1600 reserved16=tvb_get_ntohs(tvb, offset+2);
1601 proto_tree_add_text(ospf_lsa_tree, tvb, offset+2, 2,
1602 (reserved16 == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),reserved16);
1606 /* address_prefix */
1607 dissect_ospf_v3_address_prefix(tvb, offset, prefix_length, ospf_lsa_tree);
1609 offset+=(prefix_length+31)/32*4;
1616 case OSPF_V3_LSTYPE_INTRA_AREA_PREFIX:
1619 number_prefixes=tvb_get_ntohs(tvb, offset);
1620 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 2,"# prefixes: %u",number_prefixes);
1622 /* referenced LS type */
1623 referenced_ls_type=tvb_get_ntohs(tvb, offset+2);
1624 proto_tree_add_text(ospf_lsa_tree, tvb, offset+2, 2,"Referenced LS type 0x%04x (%s)",
1625 referenced_ls_type, val_to_str(referenced_ls_type, v3_ls_type_vals, "Unknown"));
1627 /* Referenced Link State ID */
1628 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Referenced Link State ID: %s",
1629 ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
1631 /* Referenced Advertising Router */
1632 proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Referenced Advertising Router: %s",
1633 ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
1637 while (number_prefixes > 0) {
1640 prefix_length=tvb_get_guint8(tvb, offset);
1641 proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "PrefixLength: %u",prefix_length);
1643 /* prefix options */
1644 dissect_ospf_v3_prefix_options(tvb, offset+1, ospf_lsa_tree);
1646 /* 16 bits metric */
1647 metric=tvb_get_ntohs(tvb, offset+2);
1648 proto_tree_add_text(ospf_lsa_tree, tvb, offset+2, 2,
1649 "Metric: %u", metric);
1653 /* address_prefix */
1654 dissect_ospf_v3_address_prefix(tvb, offset, prefix_length, ospf_lsa_tree);
1656 offset+=(prefix_length+31)/32*4;
1663 /* unknown LSA type */
1664 proto_tree_add_text(ospf_lsa_tree, tvb, offset, ls_length,
1665 "Unknown LSA Type 0x%04x",ls_type);
1666 offset += ls_length;
1669 /* return the offset of the next LSA */
1675 dissect_ospf_options(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
1677 guint8 options_ospfv2;
1678 guint32 options_ospfv3;
1679 char options_string[20] = "";
1681 /* ATTENTION !!! no check for length of options string - with OSPFv3 maximum length is 14 characters */
1683 switch ( version ) {
1685 case OSPF_VERSION_2:
1687 options_ospfv2 = tvb_get_guint8(tvb, offset);
1689 if (options_ospfv2 & OSPF_V2_OPTIONS_E)
1690 strcat(options_string, "E");
1692 if (options_ospfv2 & OSPF_V2_OPTIONS_MC) {
1693 if (options_string[0] != '\0')
1694 strcat(options_string, "/");
1695 strcat(options_string, "MC");
1698 if (options_ospfv2 & OSPF_V2_OPTIONS_NP) {
1699 if (options_string[0] != '\0')
1700 strcat(options_string, "/");
1701 strcat(options_string, "NP");
1704 if (options_ospfv2 & OSPF_V2_OPTIONS_EA) {
1705 if (options_string[0] != '\0')
1706 strcat(options_string, "/");
1707 strcat(options_string, "EA");
1710 if (options_ospfv2 & OSPF_V2_OPTIONS_DC) {
1711 if (options_string[0] != '\0')
1712 strcat(options_string, "/");
1713 strcat(options_string, "DC");
1716 if (options_ospfv2 & OSPF_V2_OPTIONS_O) {
1717 if (options_string[0] != '\0')
1718 strcat(options_string, "/");
1719 strcat(options_string, "O");
1722 if (options_ospfv2 & OSPF_V2_OPTIONS_DN) {
1723 if (options_string[0] != '\0')
1724 strcat(options_string, "/");
1725 strcat(options_string, "DN");
1728 proto_tree_add_text(tree, tvb, offset, 1, "Options: 0x%x (%s)",
1729 options_ospfv2, options_string);
1733 case OSPF_VERSION_3:
1735 options_ospfv3 = tvb_get_ntoh24(tvb, offset);
1737 if (options_ospfv3 & OSPF_V3_OPTIONS_V6)
1738 strcat(options_string, "V6");
1740 if (options_ospfv3 & OSPF_V3_OPTIONS_E)
1741 if (options_string[0] != '\0')
1742 strcat(options_string, "/");
1743 strcat(options_string, "E");
1745 if (options_ospfv3 & OSPF_V3_OPTIONS_MC) {
1746 if (options_string[0] != '\0')
1747 strcat(options_string, "/");
1748 strcat(options_string, "MC");
1751 if (options_ospfv3 & OSPF_V3_OPTIONS_N) {
1752 if (options_string[0] != '\0')
1753 strcat(options_string, "/");
1754 strcat(options_string, "N");
1757 if (options_ospfv3 & OSPF_V3_OPTIONS_R) {
1758 if (options_string[0] != '\0')
1759 strcat(options_string, "/");
1760 strcat(options_string, "R");
1763 if (options_ospfv3 & OSPF_V3_OPTIONS_DC) {
1764 if (options_string[0] != '\0')
1765 strcat(options_string, "/");
1766 strcat(options_string, "DC");
1769 proto_tree_add_text(tree, tvb, offset, 3, "Options: 0x%x (%s)",
1770 options_ospfv3, options_string);
1780 static void dissect_ospf_v3_prefix_options(tvbuff_t *tvb, int offset, proto_tree *tree)
1783 guint8 prefix_options;
1784 char prefix_options_string[11];
1789 prefix_options=tvb_get_guint8(tvb, offset);
1791 strcpy(prefix_options_string,"");
1793 if (prefix_options & OSPF_V3_PREFIX_OPTION_P) {
1794 strcat(prefix_options_string, "P");
1798 if (prefix_options & OSPF_V3_PREFIX_OPTION_MC) {
1799 if ( (position > 0) && (prefix_options_string[position-1] != '/') ) {
1800 strcat(prefix_options_string, "/");
1803 strcat(prefix_options_string, "MC");
1807 if (prefix_options & OSPF_V3_PREFIX_OPTION_LA) {
1808 if ( (position > 0) && (prefix_options_string[position-1] != '/') ) {
1809 strcat(prefix_options_string, "/");
1812 strcat(prefix_options_string, "LA");
1816 if (prefix_options & OSPF_V3_PREFIX_OPTION_NU) {
1817 if ( (position > 0) && (prefix_options_string[position-1] != '/') ) {
1818 strcat(prefix_options_string, "/");
1821 strcat(prefix_options_string, "NU");
1824 prefix_options_string[10]=0;
1826 proto_tree_add_text(tree, tvb, offset, 1, "PrefixOptions: 0x%02x (%s)",prefix_options, prefix_options_string);
1831 static void dissect_ospf_v3_address_prefix(tvbuff_t *tvb, int offset, int prefix_length, proto_tree *tree)
1839 guint8 bytes_to_process;
1842 start_offset=offset;
1845 bytes_to_process=((prefix_length+31)/32)*4;
1847 while (bytes_to_process > 0 ) {
1849 value=tvb_get_guint8(tvb, offset);
1851 if ( (position > 0) && ( (position%2) == 0 ) )
1852 buffer[bufpos++]=':';
1854 sprintf(bytebuf,"%02x",value);
1855 buffer[bufpos++]=bytebuf[0];
1856 buffer[bufpos++]=bytebuf[1];
1864 proto_tree_add_text(tree, tvb, start_offset, ((prefix_length+31)/32)*4, "Address Prefix: %s",buffer);
1870 proto_register_ospf(void)
1872 /* static hf_register_info hf[] = {
1874 { "Name", "ospf.abbreviation", TYPE, VALS_POINTER }},
1876 static gint *ett[] = {
1885 &ett_ospf_lsa_mpls_router,
1886 &ett_ospf_lsa_mpls_link,
1887 &ett_ospf_lsa_mpls_link_stlv
1890 proto_ospf = proto_register_protocol("Open Shortest Path First",
1892 /* proto_register_field_array(proto_ospf, hf, array_length(hf));*/
1893 proto_register_subtree_array(ett, array_length(ett));
1897 proto_reg_handoff_ospf(void)
1899 dissector_handle_t ospf_handle;
1901 ospf_handle = create_dissector_handle(dissect_ospf, proto_ospf);
1902 dissector_add("ip.proto", IP_PROTO_OSPF, ospf_handle);
1903 data_handle = find_dissector("data");