1998-09-16 02:39:15 +00:00
|
|
|
/* packet-ospf.c
|
|
|
|
* Routines for OSPF packet disassembly
|
|
|
|
* (c) Copyright Hannes R. Boehm <hannes@boehm.org>
|
|
|
|
*
|
2000-05-31 05:09:07 +00:00
|
|
|
* $Id: packet-ospf.c,v 1.24 2000/05/31 05:07:28 guy Exp $
|
1998-09-16 03:22:19 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* At this time, this module is able to analyze OSPF
|
|
|
|
* packets as specified in RFC2328. MOSPF (RFC1584) and other
|
|
|
|
* OSPF Extensions which introduce new Packet types
|
|
|
|
* (e.g the External Atributes LSA) are not supported.
|
1998-09-29 21:34:44 +00:00
|
|
|
*
|
|
|
|
* TOS - support is not fully implemented
|
1998-09-16 02:39:15 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@zing.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
|
|
|
# include <netinet/in.h>
|
|
|
|
#endif
|
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
1998-09-16 02:39:15 +00:00
|
|
|
#include "packet.h"
|
|
|
|
#include "packet-ospf.h"
|
2000-04-16 22:46:25 +00:00
|
|
|
#include "packet-ip.h"
|
2000-03-09 18:31:51 +00:00
|
|
|
#include "ieee-float.h"
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-07-29 05:47:07 +00:00
|
|
|
static int proto_ospf = -1;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_ospf = -1;
|
|
|
|
static gint ett_ospf_hdr = -1;
|
|
|
|
static gint ett_ospf_hello = -1;
|
|
|
|
static gint ett_ospf_desc = -1;
|
|
|
|
static gint ett_ospf_lsr = -1;
|
|
|
|
static gint ett_ospf_lsa = -1;
|
|
|
|
static gint ett_ospf_lsa_upd = -1;
|
|
|
|
|
2000-03-09 18:31:51 +00:00
|
|
|
/* Trees for opaque LSAs */
|
|
|
|
static gint ett_ospf_lsa_mpls = -1;
|
|
|
|
static gint ett_ospf_lsa_mpls_router = -1;
|
|
|
|
static gint ett_ospf_lsa_mpls_link = -1;
|
|
|
|
static gint ett_ospf_lsa_mpls_link_stlv = -1;
|
|
|
|
|
2000-04-16 22:46:25 +00:00
|
|
|
static void dissect_ospf_hello(const u_char*, int, frame_data*, proto_tree*);
|
|
|
|
static void dissect_ospf_db_desc(const u_char*, int, frame_data*, proto_tree*);
|
|
|
|
static void dissect_ospf_ls_req(const u_char*, int, frame_data*, proto_tree*);
|
|
|
|
static void dissect_ospf_ls_upd(const u_char*, int, frame_data*, proto_tree*);
|
|
|
|
static void dissect_ospf_ls_ack(const u_char*, int, frame_data*, proto_tree*);
|
|
|
|
|
|
|
|
/* dissect_ospf_lsa returns the length of the LSA
|
|
|
|
* if disassemble_body is set to FALSE (e.g. in LSA ACK
|
|
|
|
* packets), the LSA-header length is returned (20)
|
|
|
|
*/
|
|
|
|
static int dissect_ospf_lsa(const u_char*, int, frame_data*, proto_tree*, int disassemble_body);
|
|
|
|
|
|
|
|
static void
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
|
1998-10-10 03:32:20 +00:00
|
|
|
e_ospfhdr ospfh;
|
1999-10-19 15:59:04 +00:00
|
|
|
e_ospf_crypto *crypto;
|
|
|
|
int i, saved_len, ospflen;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
proto_tree *ospf_tree = NULL;
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *ospf_header_tree;
|
1999-10-19 15:59:04 +00:00
|
|
|
char auth_data[(2 * 16) + 1]="";
|
1998-09-16 02:39:15 +00:00
|
|
|
char *packet_type;
|
1998-10-20 05:31:03 +00:00
|
|
|
static value_string pt_vals[] = { {OSPF_HELLO, "Hello Packet" },
|
|
|
|
{OSPF_DB_DESC, "DB Descr." },
|
|
|
|
{OSPF_LS_REQ, "LS Request" },
|
|
|
|
{OSPF_LS_UPD, "LS Update" },
|
|
|
|
{OSPF_LS_ACK, "LS Acknowledge" },
|
|
|
|
{0, NULL } };
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
memcpy(&ospfh, &pd[offset], sizeof(e_ospfhdr));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-10-20 05:31:03 +00:00
|
|
|
packet_type = match_strval(ospfh.packet_type, pt_vals);
|
1998-11-17 04:29:13 +00:00
|
|
|
if (check_col(fd, COL_PROTOCOL))
|
|
|
|
col_add_str(fd, COL_PROTOCOL, "OSPF");
|
|
|
|
if (check_col(fd, COL_INFO)) {
|
1998-10-20 05:31:03 +00:00
|
|
|
if (packet_type != NULL)
|
1998-11-17 04:29:13 +00:00
|
|
|
col_add_str(fd, COL_INFO, packet_type);
|
1998-10-20 05:31:03 +00:00
|
|
|
else
|
1998-11-17 04:29:13 +00:00
|
|
|
col_add_fstr(fd, COL_INFO, "Unknown (%d)", ospfh.packet_type);
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_ospf, NullTVB, offset, ntohs(ospfh.length), FALSE);
|
1999-11-16 11:44:20 +00:00
|
|
|
ospf_tree = proto_item_add_subtree(ti, ett_ospf);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(ospf_tree, NullTVB, offset, OSPF_HEADER_LENGTH, "OSPF Header");
|
1999-11-16 11:44:20 +00:00
|
|
|
ospf_header_tree = proto_item_add_subtree(ti, ett_ospf_hdr);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset, 1, "OSPF Version: %d", ospfh.version);
|
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 1 , 1, "OSPF Packet Type: %d (%s)",
|
1998-10-20 05:31:03 +00:00
|
|
|
ospfh.packet_type,
|
|
|
|
(packet_type != NULL ?
|
|
|
|
packet_type :
|
|
|
|
"Unknown"));
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 2 , 2, "Packet Length: %d",
|
1998-10-10 03:32:20 +00:00
|
|
|
ntohs(ospfh.length));
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 4 , 4, "Source OSPF Router ID: %s",
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
ip_to_str((guint8 *) &(ospfh.routerid)));
|
|
|
|
if (!(ospfh.area)) {
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 8 , 4, "Area ID: Backbone");
|
1998-09-16 02:39:15 +00:00
|
|
|
} else {
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 8 , 4, "Area ID: %s", ip_to_str((guint8 *) &(ospfh.area)));
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 12 , 2, "Packet Checksum: 0x%x",
|
1999-01-17 09:30:05 +00:00
|
|
|
ntohs(ospfh.checksum));
|
1998-10-10 03:32:20 +00:00
|
|
|
switch( ntohs(ospfh.auth_type) ) {
|
1998-09-16 02:39:15 +00:00
|
|
|
case OSPF_AUTH_NONE:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 14 , 2, "Auth Type: none");
|
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 16 , 8, "Auth Data (none)");
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
case OSPF_AUTH_SIMPLE:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 14 , 2, "Auth Type: simple");
|
1998-10-10 03:32:20 +00:00
|
|
|
strncpy(auth_data, (char *) &ospfh.auth_data, 8);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 16 , 8, "Auth Data: %s", auth_data);
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
case OSPF_AUTH_CRYPT:
|
1999-10-19 15:59:04 +00:00
|
|
|
crypto = (e_ospf_crypto *)ospfh.auth_data;
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 14 , 2, "Auth Type: crypt");
|
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 18 , 1, "Auth Key ID: %d",
|
1999-10-19 15:59:04 +00:00
|
|
|
crypto->key_id);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 19 , 1, "Auth Data Length: %d",
|
1999-10-19 15:59:04 +00:00
|
|
|
crypto->length);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 20 , 4, "Auth Crypto Sequence Number: 0x%lx",
|
2000-03-07 05:28:39 +00:00
|
|
|
(unsigned long)ntohl(crypto->sequence_num));
|
1999-10-19 15:59:04 +00:00
|
|
|
|
|
|
|
ospflen = ntohs(ospfh.length);
|
|
|
|
for (i = 0; i < crypto->length && i < (sizeof(auth_data)/2); i++)
|
|
|
|
sprintf(&auth_data[i*2],"%02x",pd[offset + ospflen + i]);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + ospflen , 16, "Auth Data: %s", auth_data);
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 14 , 2, "Auth Type (unknown)");
|
|
|
|
proto_tree_add_text(ospf_header_tree, NullTVB, offset + 16 , 8, "Auth Data (unknown)");
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
1999-10-19 15:59:04 +00:00
|
|
|
/* Temporarily adjust the captured length to match the size of the OSPF
|
|
|
|
* packet (since the dissect routines use it to work out where the end of
|
|
|
|
* the ospf packet is).
|
|
|
|
*/
|
|
|
|
saved_len = pi.captured_len;
|
|
|
|
if (BYTES_ARE_IN_FRAME(offset, ntohs(ospfh.length))) {
|
|
|
|
pi.captured_len = offset + ntohs(ospfh.length);
|
|
|
|
}
|
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
/* Skip over header */
|
|
|
|
offset += OSPF_HEADER_LENGTH;
|
1999-10-19 15:59:04 +00:00
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
switch(ospfh.packet_type){
|
1998-09-16 02:39:15 +00:00
|
|
|
case OSPF_HELLO:
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_hello(pd, offset, fd, ospf_tree);
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
case OSPF_DB_DESC:
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_db_desc(pd, offset, fd, ospf_tree);
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
case OSPF_LS_REQ:
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_ls_req(pd, offset, fd, ospf_tree);
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
case OSPF_LS_UPD:
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_ls_upd(pd, offset, fd, ospf_tree);
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
case OSPF_LS_ACK:
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_ls_ack(pd, offset, fd, ospf_tree);
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
1999-10-19 15:59:04 +00:00
|
|
|
pi.captured_len = saved_len;
|
1998-09-16 02:39:15 +00:00
|
|
|
dissect_data(pd, offset, fd, tree);
|
|
|
|
}
|
1999-10-19 15:59:04 +00:00
|
|
|
pi.captured_len = saved_len;
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
|
2000-04-16 22:46:25 +00:00
|
|
|
static void
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_hello(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
|
1998-10-10 03:32:20 +00:00
|
|
|
e_ospf_hello ospfhello;
|
1998-09-16 02:39:15 +00:00
|
|
|
guint32 *ospfneighbor;
|
|
|
|
char options[20]="";
|
|
|
|
int options_offset;
|
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
proto_tree *ospf_hello_tree;
|
|
|
|
proto_item *ti;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
memcpy(&ospfhello, &pd[offset], sizeof(e_ospf_hello));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tree, NullTVB, offset, END_OF_FRAME, "OSPF Hello Packet");
|
1999-11-16 11:44:20 +00:00
|
|
|
ospf_hello_tree = proto_item_add_subtree(ti, ett_ospf_hello);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_hello_tree, NullTVB, offset , 4, "Network Mask: %s", ip_to_str((guint8 *) &ospfhello.network_mask));
|
|
|
|
proto_tree_add_text(ospf_hello_tree, NullTVB, offset + 4, 2, "Hello Interval: %d seconds", ntohs(ospfhello.hellointervall));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
/* ATTENTION !!! no check for length of options string */
|
|
|
|
options_offset=0;
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospfhello.options & OSPF_OPTIONS_E ) == OSPF_OPTIONS_E){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy( (char *)(options + options_offset), "E");
|
|
|
|
options_offset+=1;
|
|
|
|
}
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospfhello.options & OSPF_OPTIONS_MC ) == OSPF_OPTIONS_MC){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy((char *) (options + options_offset), "/MC");
|
|
|
|
options_offset+=3;
|
|
|
|
}
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospfhello.options & OSPF_OPTIONS_NP ) == OSPF_OPTIONS_NP){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy((char *) (options + options_offset), "/NP");
|
|
|
|
options_offset+=3;
|
|
|
|
}
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospfhello.options & OSPF_OPTIONS_EA ) == OSPF_OPTIONS_EA){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy((char *) (options + options_offset) , "/EA");
|
|
|
|
options_offset+=3;
|
|
|
|
}
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospfhello.options & OSPF_OPTIONS_DC ) == OSPF_OPTIONS_DC){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy((char *) (options + options_offset) , "/DC");
|
|
|
|
options_offset+=3;
|
|
|
|
}
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_hello_tree, NullTVB, offset + 6, 1, "Options: %d (%s)", ospfhello.options, options);
|
|
|
|
proto_tree_add_text(ospf_hello_tree, NullTVB, offset + 7, 1, "Router Priority: %d", ospfhello.priority);
|
|
|
|
proto_tree_add_text(ospf_hello_tree, NullTVB, offset + 8, 4, "Router Dead Interval: %ld seconds", (long)ntohl(ospfhello.dead_interval));
|
|
|
|
proto_tree_add_text(ospf_hello_tree, NullTVB, offset + 12, 4, "Designated Router: %s", ip_to_str((guint8 *) &ospfhello.drouter));
|
|
|
|
proto_tree_add_text(ospf_hello_tree, NullTVB, offset + 16, 4, "Backup Designated Router: %s", ip_to_str((guint8 *) &ospfhello.bdrouter));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
offset+=20;
|
1999-08-26 07:34:43 +00:00
|
|
|
while(((int)(pi.captured_len - offset)) >= 4){
|
1998-09-16 02:39:15 +00:00
|
|
|
ospfneighbor=(guint32 *) &pd[offset];
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_hello_tree, NullTVB, offset, 4, "Active Neighbor: %s", ip_to_str((guint8 *) ospfneighbor));
|
1998-09-16 02:39:15 +00:00
|
|
|
offset+=4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-16 22:46:25 +00:00
|
|
|
static void
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_db_desc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
|
1998-10-10 03:32:20 +00:00
|
|
|
e_ospf_dbd ospf_dbd;
|
1998-09-16 02:39:15 +00:00
|
|
|
char options[20]="";
|
|
|
|
int options_offset;
|
|
|
|
char flags[20]="";
|
|
|
|
int flags_offset;
|
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
proto_tree *ospf_db_desc_tree=NULL;
|
|
|
|
proto_item *ti;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
memcpy(&ospf_dbd, &pd[offset], sizeof(e_ospf_dbd));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tree, NullTVB, offset, END_OF_FRAME, "OSPF DB Description");
|
1999-11-16 11:44:20 +00:00
|
|
|
ospf_db_desc_tree = proto_item_add_subtree(ti, ett_ospf_desc);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_db_desc_tree, NullTVB, offset, 2, "Interface MTU: %d", ntohs(ospf_dbd.interface_mtu) );
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
options_offset=0;
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospf_dbd.options & OSPF_OPTIONS_E ) == OSPF_OPTIONS_E){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy( (char *)(options + options_offset), "_E_");
|
|
|
|
options_offset+=1;
|
|
|
|
}
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospf_dbd.options & OSPF_OPTIONS_MC ) == OSPF_OPTIONS_MC){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy((char *) (options + options_offset), "_MC_");
|
|
|
|
options_offset+=3;
|
|
|
|
}
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospf_dbd.options & OSPF_OPTIONS_NP ) == OSPF_OPTIONS_NP){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy((char *) (options + options_offset), "_NP_");
|
|
|
|
options_offset+=3;
|
|
|
|
}
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospf_dbd.options & OSPF_OPTIONS_EA ) == OSPF_OPTIONS_EA){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy((char *) (options + options_offset) , "_EA_");
|
|
|
|
options_offset+=3;
|
|
|
|
}
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospf_dbd.options & OSPF_OPTIONS_DC ) == OSPF_OPTIONS_DC){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy((char *) (options + options_offset) , "_DC_");
|
|
|
|
options_offset+=3;
|
|
|
|
}
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_db_desc_tree, NullTVB, offset + 2 , 1, "Options: %d (%s)", ospf_dbd.options, options );
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
flags_offset=0;
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospf_dbd.flags & OSPF_DBD_FLAG_MS ) == OSPF_DBD_FLAG_MS){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy( (char *)(flags + flags_offset), "_I_");
|
|
|
|
flags_offset+=1;
|
|
|
|
}
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospf_dbd.flags & OSPF_DBD_FLAG_M ) == OSPF_DBD_FLAG_M){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy((char *) (flags + flags_offset), "_M_");
|
|
|
|
flags_offset+=3;
|
|
|
|
}
|
1998-10-10 03:32:20 +00:00
|
|
|
if(( ospf_dbd.flags & OSPF_DBD_FLAG_I ) == OSPF_DBD_FLAG_I){
|
1998-09-16 02:39:15 +00:00
|
|
|
strcpy((char *) (flags + flags_offset), "_I_");
|
|
|
|
flags_offset+=3;
|
|
|
|
}
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_db_desc_tree, NullTVB, offset + 3 , 1, "Flags: %d (%s)", ospf_dbd.flags, flags );
|
|
|
|
proto_tree_add_text(ospf_db_desc_tree, NullTVB, offset + 4 , 4, "DD Sequence: %ld", (long)ntohl(ospf_dbd.dd_sequence) );
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
/* LS Headers will be processed here */
|
|
|
|
/* skip to the end of DB-Desc header */
|
|
|
|
offset+=8;
|
1999-08-26 07:34:43 +00:00
|
|
|
while( ((int) (pi.captured_len - offset)) >= OSPF_LSA_HEADER_LENGTH ) {
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_lsa(pd, offset, fd, tree, FALSE);
|
1998-09-16 02:39:15 +00:00
|
|
|
offset+=OSPF_LSA_HEADER_LENGTH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-16 22:46:25 +00:00
|
|
|
static void
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_ls_req(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
|
1998-10-10 03:32:20 +00:00
|
|
|
e_ospf_ls_req ospf_lsr;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
proto_tree *ospf_lsr_tree;
|
|
|
|
proto_item *ti;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* zero or more LS requests may be within a LS Request */
|
|
|
|
/* we place every request for a LSA in a single subtree */
|
|
|
|
if (tree) {
|
1999-08-26 07:34:43 +00:00
|
|
|
while( ((int) (pi.captured_len - offset)) >= OSPF_LS_REQ_LENGTH ){
|
1998-10-10 03:32:20 +00:00
|
|
|
memcpy(&ospf_lsr, &pd[offset], sizeof(e_ospf_ls_req));
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tree, NullTVB, offset, OSPF_LS_REQ_LENGTH, "Link State Request");
|
1999-11-16 11:44:20 +00:00
|
|
|
ospf_lsr_tree = proto_item_add_subtree(ti, ett_ospf_lsr);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
switch( ntohl( ospf_lsr.ls_type ) ){
|
1998-09-16 02:39:15 +00:00
|
|
|
case OSPF_LSTYPE_ROUTER:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsr_tree, NullTVB, offset, 4, "LS Type: Router-LSA (%ld)",
|
1998-10-10 03:32:20 +00:00
|
|
|
(long)ntohl( ospf_lsr.ls_type ) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
case OSPF_LSTYPE_NETWORK:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsr_tree, NullTVB, offset, 4, "LS Type: Network-LSA (%ld)",
|
1998-10-10 03:32:20 +00:00
|
|
|
(long)ntohl( ospf_lsr.ls_type ) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
case OSPF_LSTYPE_SUMMERY:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsr_tree, NullTVB, offset, 4, "LS Type: Summary-LSA (IP network) (%ld)",
|
1998-10-10 03:32:20 +00:00
|
|
|
(long)ntohl( ospf_lsr.ls_type ) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
case OSPF_LSTYPE_ASBR:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsr_tree, NullTVB, offset, 4, "LS Type: Summary-LSA (ASBR) (%ld)",
|
1998-10-10 03:32:20 +00:00
|
|
|
(long)ntohl( ospf_lsr.ls_type ) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
case OSPF_LSTYPE_ASEXT:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsr_tree, NullTVB, offset, 4, "LS Type: AS-External-LSA (ASBR) (%ld)",
|
1998-10-10 03:32:20 +00:00
|
|
|
(long)ntohl( ospf_lsr.ls_type ) );
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsr_tree, NullTVB, offset, 4, "LS Type: %ld (unknown)",
|
1998-10-10 03:32:20 +00:00
|
|
|
(long)ntohl( ospf_lsr.ls_type ) );
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsr_tree, NullTVB, offset + 4, 4, "Link State ID : %s",
|
1998-10-10 03:32:20 +00:00
|
|
|
ip_to_str((guint8 *) &(ospf_lsr.ls_id)));
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsr_tree, NullTVB, offset + 8, 4, "Advertising Router : %s",
|
1998-10-10 03:32:20 +00:00
|
|
|
ip_to_str((guint8 *) &(ospf_lsr.adv_router)));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
offset+=12;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-04-16 22:46:25 +00:00
|
|
|
|
|
|
|
static void
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_ls_upd(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
|
1998-10-10 03:32:20 +00:00
|
|
|
e_ospf_lsa_upd_hdr upd_hdr;
|
1998-09-16 02:39:15 +00:00
|
|
|
guint32 lsa_counter;
|
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
proto_tree *ospf_lsa_upd_tree=NULL;
|
|
|
|
proto_item *ti;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
memcpy(&upd_hdr, &pd[offset], sizeof(e_ospf_lsa_upd_hdr));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tree, NullTVB, offset, END_OF_FRAME, "LS Update Packet");
|
1999-11-16 11:44:20 +00:00
|
|
|
ospf_lsa_upd_tree = proto_item_add_subtree(ti, ett_ospf_lsa_upd);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_upd_tree, NullTVB, offset, 4, "Nr oF LSAs: %ld", (long)ntohl(upd_hdr.lsa_nr) );
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
/* skip to the beginning of the first LSA */
|
|
|
|
offset+=4; /* the LS Upd PAcket contains only a 32 bit #LSAs field */
|
|
|
|
|
|
|
|
lsa_counter = 0;
|
1998-10-10 03:32:20 +00:00
|
|
|
while(lsa_counter < ntohl(upd_hdr.lsa_nr)){
|
1999-03-23 03:14:46 +00:00
|
|
|
offset+=dissect_ospf_lsa(pd, offset, fd, ospf_lsa_upd_tree, TRUE);
|
1998-09-16 02:39:15 +00:00
|
|
|
lsa_counter += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-16 22:46:25 +00:00
|
|
|
static void
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_ls_ack(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
/* the body of a LS Ack packet simply contains zero or more LSA Headers */
|
1999-08-26 07:34:43 +00:00
|
|
|
while( ((int)(pi.captured_len - offset)) >= OSPF_LSA_HEADER_LENGTH ) {
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_lsa(pd, offset, fd, tree, FALSE);
|
1998-09-16 02:39:15 +00:00
|
|
|
offset+=OSPF_LSA_HEADER_LENGTH;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-03-09 18:31:51 +00:00
|
|
|
/*
|
|
|
|
* Returns if an LSA is opaque, i.e. requires special treatment
|
|
|
|
*/
|
|
|
|
int is_opaque(int lsa_type)
|
|
|
|
{
|
|
|
|
return (lsa_type >= 9 && lsa_type <= 11);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* MPLS/TE TLV types */
|
|
|
|
#define MPLS_TLV_ROUTER 1
|
|
|
|
#define MPLS_TLV_LINK 2
|
|
|
|
|
|
|
|
/* MPLS/TE Link STLV types */
|
|
|
|
enum {
|
|
|
|
MPLS_LINK_TYPE = 1,
|
|
|
|
MPLS_LINK_ID,
|
|
|
|
MPLS_LINK_LOCAL_IF,
|
|
|
|
MPLS_LINK_REMOTE_IF,
|
|
|
|
MPLS_LINK_TE_METRIC,
|
|
|
|
MPLS_LINK_MAX_BW,
|
|
|
|
MPLS_LINK_MAX_RES_BW,
|
|
|
|
MPLS_LINK_UNRES_BW,
|
|
|
|
MPLS_LINK_COLOR,
|
|
|
|
};
|
|
|
|
|
|
|
|
static value_string mpls_link_stlv_str[] = {
|
|
|
|
{MPLS_LINK_TYPE, "Link Type"},
|
|
|
|
{MPLS_LINK_ID, "Link ID"},
|
|
|
|
{MPLS_LINK_LOCAL_IF, "Local Interface IP Address"},
|
|
|
|
{MPLS_LINK_REMOTE_IF, "Remote Interface IP Address"},
|
|
|
|
{MPLS_LINK_TE_METRIC, "Traffic Engineering Metric"},
|
|
|
|
{MPLS_LINK_MAX_BW, "Maximum Bandwidth"},
|
|
|
|
{MPLS_LINK_MAX_RES_BW, "Maximum Reservable Bandwidth"},
|
|
|
|
{MPLS_LINK_UNRES_BW, "Unreserved Bandwidth"},
|
|
|
|
{MPLS_LINK_COLOR, "Resource Class/Color"},
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Dissect MPLS/TE opaque LSA
|
|
|
|
*/
|
|
|
|
|
|
|
|
void dissect_ospf_lsa_mpls(const u_char *pd,
|
|
|
|
int offset,
|
|
|
|
frame_data *fd,
|
|
|
|
proto_tree *tree,
|
|
|
|
e_ospf_lsa_hdr *lsa_hdr) {
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *mpls_tree;
|
|
|
|
proto_tree *tlv_tree;
|
|
|
|
proto_tree *stlv_tree;
|
|
|
|
|
|
|
|
int length;
|
|
|
|
int tlv_type;
|
|
|
|
int tlv_length;
|
|
|
|
|
|
|
|
int link_len;
|
|
|
|
int stlv_type, stlv_len;
|
|
|
|
char *stlv_name;
|
|
|
|
int i;
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tree, NullTVB, offset, ntohs(lsa_hdr->length) - 20,
|
2000-03-09 18:31:51 +00:00
|
|
|
"MPLS Traffic Engineering LSA");
|
|
|
|
mpls_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls);
|
|
|
|
|
|
|
|
for (length = 0; length < ntohs(lsa_hdr->length) - 20; length += 4) {
|
|
|
|
tlv_type = pntohs(pd+offset+length);
|
|
|
|
tlv_length = pntohs(pd+offset+length + 2);
|
|
|
|
|
|
|
|
switch(tlv_type) {
|
|
|
|
case MPLS_TLV_ROUTER:
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(mpls_tree, NullTVB, offset+length, tlv_length+4,
|
2000-03-09 18:31:51 +00:00
|
|
|
"Router Address: %s",
|
|
|
|
ip_to_str((pd+offset+length+4)));
|
|
|
|
tlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_router);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(tlv_tree, NullTVB, offset+length, 2, "TLV Type: 1 - Router Address");
|
|
|
|
proto_tree_add_text(tlv_tree, NullTVB, offset+length+2, 2, "TLV Length: %d", tlv_length);
|
|
|
|
proto_tree_add_text(tlv_tree, NullTVB, offset+length+4, 4, "Router Address: %s",
|
2000-03-09 18:31:51 +00:00
|
|
|
ip_to_str((pd+offset+length+4)));
|
|
|
|
break;
|
|
|
|
case MPLS_TLV_LINK:
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(mpls_tree, NullTVB, offset+length, tlv_length+4,
|
2000-03-09 18:31:51 +00:00
|
|
|
"Link Information");
|
|
|
|
tlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(tlv_tree, NullTVB, offset+length, 2, "TLV Type: 2 - Link Information");
|
|
|
|
proto_tree_add_text(tlv_tree, NullTVB, offset+length+2, 2, "TLV Length: %d", tlv_length);
|
2000-03-09 18:31:51 +00:00
|
|
|
|
|
|
|
/* Walk down the sub-TLVs for link information */
|
|
|
|
for (link_len = length + 4; link_len < length + 4 + tlv_length; link_len += 4) {
|
|
|
|
stlv_type = pntohs(pd+offset+link_len);
|
|
|
|
stlv_len = pntohs(pd+offset+link_len + 2);
|
|
|
|
stlv_name = val_to_str(stlv_type, mpls_link_stlv_str, "Unknown sub-TLV");
|
|
|
|
switch(stlv_type) {
|
|
|
|
|
|
|
|
case MPLS_LINK_TYPE:
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tlv_tree, NullTVB, offset+link_len, stlv_len+4,
|
2000-03-09 18:31:51 +00:00
|
|
|
"%s: %d", stlv_name,
|
|
|
|
*((guint8 *)pd + offset + link_len + 4));
|
|
|
|
stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len, 2,
|
2000-03-09 18:31:51 +00:00
|
|
|
"TLV Type: %d: %s", stlv_type, stlv_name);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len+2, 2, "TLV Length: %d", stlv_len);
|
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len+4, 1, "%s: %d", stlv_name,
|
2000-03-09 18:31:51 +00:00
|
|
|
*((guint8 *)pd + offset + link_len + 4));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPLS_LINK_ID:
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tlv_tree, NullTVB, offset+link_len, stlv_len+4,
|
2000-03-09 18:31:51 +00:00
|
|
|
"%s: %s (%x)", stlv_name,
|
|
|
|
ip_to_str(pd + offset + link_len + 4),
|
|
|
|
pntohl(pd + offset + link_len + 4));
|
|
|
|
stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len, 2,
|
2000-03-09 18:31:51 +00:00
|
|
|
"TLV Type: %d: %s", stlv_type, stlv_name);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len+2, 2, "TLV Length: %d", stlv_len);
|
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len+4, 4, "%s: %s (%x)", stlv_name,
|
2000-03-09 18:31:51 +00:00
|
|
|
ip_to_str(pd + offset + link_len + 4),
|
|
|
|
pntohl(pd + offset + link_len + 4));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPLS_LINK_LOCAL_IF:
|
|
|
|
case MPLS_LINK_REMOTE_IF:
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tlv_tree, NullTVB, offset+link_len, stlv_len+4,
|
2000-03-09 18:31:51 +00:00
|
|
|
"%s: %s", stlv_name,
|
|
|
|
ip_to_str(pd+offset+link_len+4));
|
|
|
|
stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len, 2,
|
2000-03-09 18:31:51 +00:00
|
|
|
"TLV Type: %d: %s", stlv_type, stlv_name);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len+2, 2, "TLV Length: %d", stlv_len);
|
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len+4, 4, "%s: %s", stlv_name,
|
2000-03-09 18:31:51 +00:00
|
|
|
ip_to_str(pd+offset+link_len+4));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPLS_LINK_TE_METRIC:
|
|
|
|
case MPLS_LINK_COLOR:
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tlv_tree, NullTVB, offset+link_len, stlv_len+4,
|
2000-03-09 18:31:51 +00:00
|
|
|
"%s: %d", stlv_name,
|
|
|
|
pntohl(pd + offset + link_len + 4));
|
|
|
|
stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len, 2,
|
2000-03-09 18:31:51 +00:00
|
|
|
"TLV Type: %d: %s", stlv_type, stlv_name);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len+2, 2, "TLV Length: %d", stlv_len);
|
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len+4, 4, "%s: %d", stlv_name,
|
2000-03-09 18:31:51 +00:00
|
|
|
pntohl(pd + offset + link_len + 4));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPLS_LINK_MAX_BW:
|
|
|
|
case MPLS_LINK_MAX_RES_BW:
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tlv_tree, NullTVB, offset+link_len, stlv_len+4,
|
2000-03-14 06:03:26 +00:00
|
|
|
"%s: %ld", stlv_name,
|
2000-03-09 18:31:51 +00:00
|
|
|
pieee_to_long(pd + offset + link_len + 4));
|
|
|
|
stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len, 2,
|
2000-03-09 18:31:51 +00:00
|
|
|
"TLV Type: %d: %s", stlv_type, stlv_name);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len+2, 2, "TLV Length: %d", stlv_len);
|
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len+4, 4, "%s: %ld", stlv_name,
|
2000-03-09 18:31:51 +00:00
|
|
|
pieee_to_long(pd + offset + link_len + 4));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPLS_LINK_UNRES_BW:
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tlv_tree, NullTVB, offset+link_len, stlv_len+4,
|
2000-03-09 18:31:51 +00:00
|
|
|
"%s", stlv_name);
|
|
|
|
stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len, 2,
|
2000-03-09 18:31:51 +00:00
|
|
|
"TLV Type: %d: %s", stlv_type, stlv_name);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len+2, 2, "TLV Length: %d", stlv_len);
|
2000-03-09 18:31:51 +00:00
|
|
|
for (i=0; i<8; i++)
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(stlv_tree, NullTVB, offset+link_len+4+(i*4), 4,
|
2000-03-14 06:03:26 +00:00
|
|
|
"Pri %d: %ld", i,
|
2000-03-09 18:31:51 +00:00
|
|
|
pieee_to_long(pd + offset + link_len + 4 + i*4));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(tlv_tree, NullTVB, offset+link_len, stlv_len+4,
|
2000-03-09 18:31:51 +00:00
|
|
|
"Unknown Link sub-TLV: %d", stlv_type);
|
|
|
|
}
|
|
|
|
link_len += ((stlv_len+3)/4)*4;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(mpls_tree, NullTVB, offset+length, tlv_length+4,
|
2000-03-09 18:31:51 +00:00
|
|
|
"Unknown LSA: %d", tlv_type);
|
|
|
|
tlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(tlv_tree, NullTVB, offset+length, 2, "TLV Type: %d - Unknown", tlv_type);
|
|
|
|
proto_tree_add_text(tlv_tree, NullTVB, offset+length+2, 2, "TLV Length: %d", tlv_length);
|
|
|
|
proto_tree_add_text(tlv_tree, NullTVB, offset+length+4, tlv_length, "TLV Data");
|
2000-03-09 18:31:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
length += tlv_length;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Dissect opaque LSAs
|
|
|
|
*/
|
|
|
|
void dissect_ospf_lsa_opaque(const u_char *pd,
|
|
|
|
int offset,
|
|
|
|
frame_data *fd,
|
|
|
|
proto_tree *tree,
|
|
|
|
e_ospf_lsa_hdr *lsa_hdr) {
|
|
|
|
guint8 opaque_id = *((guint8 *) &(lsa_hdr->ls_id));
|
|
|
|
|
|
|
|
switch(opaque_id) {
|
|
|
|
|
|
|
|
case OSPF_LSA_MPLS_TE:
|
|
|
|
dissect_ospf_lsa_mpls(pd, offset, fd, tree, lsa_hdr);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(tree, NullTVB, offset, END_OF_FRAME, "Unknown LSA Type");
|
2000-03-09 18:31:51 +00:00
|
|
|
break;
|
|
|
|
} /* switch on opaque LSA id */
|
|
|
|
}
|
|
|
|
|
2000-04-16 22:46:25 +00:00
|
|
|
static int
|
1999-03-23 03:14:46 +00:00
|
|
|
dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int disassemble_body) {
|
1998-10-10 03:32:20 +00:00
|
|
|
e_ospf_lsa_hdr lsa_hdr;
|
1998-09-16 02:39:15 +00:00
|
|
|
char *lsa_type;
|
1999-11-17 19:07:10 +00:00
|
|
|
int lsa_end;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
/* data strutures for the router LSA */
|
1998-10-10 03:32:20 +00:00
|
|
|
e_ospf_router_lsa router_lsa;
|
|
|
|
e_ospf_router_data router_data;
|
|
|
|
e_ospf_router_metric tos_data;
|
1998-09-16 02:39:15 +00:00
|
|
|
guint16 link_counter;
|
|
|
|
guint8 tos_counter;
|
|
|
|
char *link_type;
|
|
|
|
char *link_id;
|
|
|
|
|
|
|
|
/* data structures for the network lsa */
|
1998-10-10 03:32:20 +00:00
|
|
|
e_ospf_network_lsa network_lsa;
|
1998-09-16 02:39:15 +00:00
|
|
|
guint32 *attached_router;
|
|
|
|
|
|
|
|
/* data structures for the summary and ASBR LSAs */
|
1998-10-10 03:32:20 +00:00
|
|
|
e_ospf_summary_lsa summary_lsa;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-09-29 21:34:44 +00:00
|
|
|
/* data structures for the AS-External LSA */
|
|
|
|
e_ospf_asexternal_lsa asext_lsa;
|
|
|
|
guint32 asext_metric;
|
|
|
|
|
2000-03-09 18:31:51 +00:00
|
|
|
/* data structures for opaque LSA */
|
|
|
|
guint32 ls_id;
|
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
proto_tree *ospf_lsa_tree;
|
|
|
|
proto_item *ti;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
memcpy(&lsa_hdr, &pd[offset], sizeof(e_ospf_lsa_hdr));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-09-29 21:34:44 +00:00
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
switch(lsa_hdr.ls_type) {
|
1998-09-16 02:39:15 +00:00
|
|
|
case OSPF_LSTYPE_ROUTER:
|
|
|
|
lsa_type="Router LSA";
|
|
|
|
break;
|
|
|
|
case OSPF_LSTYPE_NETWORK:
|
|
|
|
lsa_type="Network LSA";
|
|
|
|
break;
|
|
|
|
case OSPF_LSTYPE_SUMMERY:
|
1999-11-17 19:07:10 +00:00
|
|
|
lsa_type="Summary LSA";
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
case OSPF_LSTYPE_ASBR:
|
|
|
|
lsa_type="ASBR LSA";
|
|
|
|
break;
|
|
|
|
case OSPF_LSTYPE_ASEXT:
|
|
|
|
lsa_type="AS-external-LSA";
|
|
|
|
break;
|
2000-03-09 18:31:51 +00:00
|
|
|
case OSPF_LSTYPE_OP_LINKLOCAL:
|
|
|
|
lsa_type="Opaque LSA, Link-local scope";
|
|
|
|
break;
|
|
|
|
case OSPF_LSTYPE_OP_AREALOCAL:
|
|
|
|
lsa_type="Opaque LSA, Area-local scope";
|
|
|
|
break;
|
|
|
|
case OSPF_LSTYPE_OP_ASWIDE:
|
|
|
|
lsa_type="Opaque LSA, AS-wide scope";
|
|
|
|
break;
|
1998-09-16 02:39:15 +00:00
|
|
|
default:
|
|
|
|
lsa_type="unknown";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
if(disassemble_body){
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tree, NullTVB, offset, ntohs(lsa_hdr.length),
|
1998-10-10 03:32:20 +00:00
|
|
|
"%s (Type: %d)", lsa_type, lsa_hdr.ls_type);
|
1998-09-16 02:39:15 +00:00
|
|
|
} else {
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tree, NullTVB, offset, OSPF_LSA_HEADER_LENGTH, "LSA Header");
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
1999-11-16 11:44:20 +00:00
|
|
|
ospf_lsa_tree = proto_item_add_subtree(ti, ett_ospf_lsa);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset, 2, "LS Age: %d seconds", ntohs(lsa_hdr.ls_age));
|
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 2, 1, "Options: %d ", lsa_hdr.options);
|
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 3, 1, "LSA Type: %d (%s)", lsa_hdr.ls_type, lsa_type);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-03-09 18:31:51 +00:00
|
|
|
if (is_opaque(lsa_hdr.ls_type)) {
|
|
|
|
ls_id = ntohl(lsa_hdr.ls_id);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 4, 1, "Link State ID Opaque Type: %u ",
|
2000-03-09 18:31:51 +00:00
|
|
|
(ls_id >> 24) & 0xff);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 5, 3, "Link State ID Opaque ID: %u ",
|
2000-03-09 18:31:51 +00:00
|
|
|
ls_id & 0xffffff);
|
|
|
|
} else
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 4, 4, "Link State ID: %s ",
|
2000-03-09 18:31:51 +00:00
|
|
|
ip_to_str((guint8 *) &(lsa_hdr.ls_id)));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 8, 4, "Advertising Router: %s ",
|
1998-10-10 03:32:20 +00:00
|
|
|
ip_to_str((guint8 *) &(lsa_hdr.adv_router)));
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 12, 4, "LS Sequence Number: 0x%04lx ",
|
1998-10-10 03:32:20 +00:00
|
|
|
(unsigned long)ntohl(lsa_hdr.ls_seq));
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 16, 2, "LS Checksum: %d ", ntohs(lsa_hdr.ls_checksum));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 18, 2, "Length: %d ", ntohs(lsa_hdr.length));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
if(!disassemble_body){
|
|
|
|
return OSPF_LSA_HEADER_LENGTH;
|
|
|
|
}
|
|
|
|
|
1999-11-17 19:07:10 +00:00
|
|
|
lsa_end = offset + ntohs(lsa_hdr.length);
|
|
|
|
/* the LSA body starts after 20 bytes of LSA Header */
|
1998-09-16 02:39:15 +00:00
|
|
|
offset+=20;
|
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
switch(lsa_hdr.ls_type){
|
1998-09-16 02:39:15 +00:00
|
|
|
case(OSPF_LSTYPE_ROUTER):
|
1998-10-10 03:32:20 +00:00
|
|
|
memcpy(&router_lsa, &pd[offset], sizeof(e_ospf_router_lsa));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
/* again: flags should be secified in detail */
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset, 1, "Flags: 0x%02x ", router_lsa.flags);
|
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 2, 2, "Nr. of Links: %d ",
|
1998-10-10 03:32:20 +00:00
|
|
|
ntohs(router_lsa.nr_links));
|
1998-09-16 02:39:15 +00:00
|
|
|
offset += 4;
|
1998-10-10 03:32:20 +00:00
|
|
|
/* router_lsa.nr_links links follow
|
1998-09-16 02:39:15 +00:00
|
|
|
* maybe we should put each of the links into its own subtree ???
|
|
|
|
*/
|
1998-10-10 03:32:20 +00:00
|
|
|
for(link_counter = 1 ; link_counter <= ntohs(router_lsa.nr_links); link_counter++){
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
memcpy(&router_data, &pd[offset], sizeof(e_ospf_router_data));
|
1998-09-16 02:39:15 +00:00
|
|
|
/* check the Link Type and ID */
|
1998-10-10 03:32:20 +00:00
|
|
|
switch(router_data.link_type) {
|
1998-09-16 02:39:15 +00:00
|
|
|
case OSPF_LINK_PTP:
|
|
|
|
link_type="Point-to-point connection to another router";
|
|
|
|
link_id="Neighboring router's Router ID";
|
|
|
|
break;
|
|
|
|
case OSPF_LINK_TRANSIT:
|
|
|
|
link_type="Connection to a transit network";
|
|
|
|
link_id="IP address of Designated Router";
|
|
|
|
break;
|
|
|
|
case OSPF_LINK_STUB:
|
|
|
|
link_type="Connection to a stub network";
|
|
|
|
link_id="IP network/subnet number";
|
|
|
|
break;
|
|
|
|
case OSPF_LINK_VIRTUAL:
|
|
|
|
link_type="Virtual link";
|
|
|
|
link_id="Neighboring router's Router ID";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
link_type="unknown link type";
|
|
|
|
link_id="unknown link id";
|
|
|
|
}
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset, 4, "%s: %s", link_id,
|
1998-10-10 03:32:20 +00:00
|
|
|
ip_to_str((guint8 *) &(router_data.link_id)));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
/* link_data should be specified in detail (e.g. network mask) (depends on link type)*/
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 4, 4, "Link Data: %s",
|
1998-10-10 03:32:20 +00:00
|
|
|
ip_to_str((guint8 *) &(router_data.link_data)));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 8, 1, "Link Type: %d - %s",
|
1998-10-10 03:32:20 +00:00
|
|
|
router_data.link_type, link_type);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 9, 1, "Nr. of TOS metrics: %d", router_data.nr_tos);
|
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 10, 2, "TOS 0 metric: %d", ntohs( router_data.tos0_metric ));
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
offset += 12;
|
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
/* router_data.nr_tos metrics may follow each link
|
1998-09-16 02:39:15 +00:00
|
|
|
* ATTENTION: TOS metrics are not tested (I don't have TOS based routing)
|
|
|
|
* please send me a mail if it is/isn't working
|
|
|
|
*/
|
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
for(tos_counter = 1 ; link_counter <= ntohs(router_data.nr_tos); tos_counter++){
|
|
|
|
memcpy(&tos_data, &pd[offset], sizeof(e_ospf_router_metric));
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset, 1, "TOS: %d, Metric: %d",
|
1998-10-10 03:32:20 +00:00
|
|
|
tos_data.tos, ntohs(tos_data.metric));
|
1998-09-16 02:39:15 +00:00
|
|
|
offset += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case(OSPF_LSTYPE_NETWORK):
|
1998-10-10 03:32:20 +00:00
|
|
|
memcpy(&network_lsa, &pd[offset], sizeof(e_ospf_network_lsa));
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset, 4, "Netmask: %s",
|
1998-10-10 03:32:20 +00:00
|
|
|
ip_to_str((guint8 *) &(network_lsa.network_mask)));
|
1998-09-16 02:39:15 +00:00
|
|
|
offset += 4;
|
|
|
|
|
1999-11-17 19:07:10 +00:00
|
|
|
while( (lsa_end - offset) >= 4){
|
1998-09-16 02:39:15 +00:00
|
|
|
attached_router = (guint32 *) &pd[offset];
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset, 4, "Attached Router: %s",
|
1998-09-16 02:39:15 +00:00
|
|
|
ip_to_str((guint8 *) attached_router));
|
|
|
|
offset += 4;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case(OSPF_LSTYPE_SUMMERY):
|
|
|
|
/* Type 3 and 4 LSAs have the same format */
|
|
|
|
case(OSPF_LSTYPE_ASBR):
|
1998-10-10 03:32:20 +00:00
|
|
|
memcpy(&summary_lsa, &pd[offset], sizeof(e_ospf_summary_lsa));
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset, 4, "Netmask: %s",
|
1998-10-10 03:32:20 +00:00
|
|
|
ip_to_str((guint8 *) &(summary_lsa.network_mask)));
|
1998-09-29 21:34:44 +00:00
|
|
|
/* returns only the TOS 0 metric (even if there are more TOS metrics) */
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
|
|
|
case(OSPF_LSTYPE_ASEXT):
|
1998-10-10 03:32:20 +00:00
|
|
|
memcpy(&summary_lsa, &pd[offset], sizeof(e_ospf_summary_lsa));
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset, 4, "Netmask: %s",
|
1998-10-10 03:32:20 +00:00
|
|
|
ip_to_str((guint8 *) &(summary_lsa.network_mask)));
|
1998-09-29 21:34:44 +00:00
|
|
|
|
|
|
|
/* asext_lsa = (e_ospf_asexternal_lsa *) &pd[offset + 4]; */
|
|
|
|
memcpy(&asext_lsa, &pd[offset + 4], sizeof(asext_lsa));
|
|
|
|
if( (asext_lsa.options & 128) == 128 ) { /* check wether or not E bit is set */
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset, 1,
|
1998-09-29 21:34:44 +00:00
|
|
|
"External Type: Type 2 (metric is larger than any other link state path)");
|
|
|
|
} else {
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 4, 1,
|
1998-09-29 21:34:44 +00:00
|
|
|
"External Type: Type 1 (metric is specified in the same units as interface cost)");
|
|
|
|
}
|
|
|
|
/* the metric field of a AS-external LAS is specified in 3 bytes -> not well aligned */
|
|
|
|
/* this routine returns only the TOS 0 metric (even if there are more TOS metrics) */
|
|
|
|
memcpy(&asext_metric, &pd[offset+4], 4);
|
|
|
|
|
|
|
|
/* erase the leading 8 bits (the dont belong to the metric */
|
|
|
|
asext_metric = ntohl(asext_metric) & 0x00ffffff ;
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 5, 3,"Metric: %d", asext_metric);
|
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 8, 4,"Forwarding Address: %s",
|
1998-09-29 21:34:44 +00:00
|
|
|
ip_to_str((guint8 *) &(asext_lsa.gateway)));
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 12, 4,"External Route Tag: %ld", (long)ntohl(asext_lsa.external_tag));
|
1998-09-29 21:34:44 +00:00
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
break;
|
2000-03-09 18:31:51 +00:00
|
|
|
|
|
|
|
case OSPF_LSTYPE_OP_LINKLOCAL:
|
|
|
|
case OSPF_LSTYPE_OP_AREALOCAL:
|
|
|
|
case OSPF_LSTYPE_OP_ASWIDE:
|
|
|
|
dissect_ospf_lsa_opaque(pd, offset, fd, ospf_lsa_tree, &lsa_hdr);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
1998-09-16 02:39:15 +00:00
|
|
|
/* unknown LSA type */
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(ospf_lsa_tree, NullTVB, offset, END_OF_FRAME, "Unknown LSA Type");
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* return the length of this LSA */
|
1998-10-10 03:32:20 +00:00
|
|
|
return ntohs(lsa_hdr.length);
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
1999-07-29 05:47:07 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_ospf(void)
|
|
|
|
{
|
|
|
|
/* static hf_register_info hf[] = {
|
|
|
|
{ &variable,
|
|
|
|
{ "Name", "ospf.abbreviation", TYPE, VALS_POINTER }},
|
|
|
|
};*/
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_ospf,
|
|
|
|
&ett_ospf_hdr,
|
|
|
|
&ett_ospf_hello,
|
|
|
|
&ett_ospf_desc,
|
|
|
|
&ett_ospf_lsr,
|
|
|
|
&ett_ospf_lsa,
|
|
|
|
&ett_ospf_lsa_upd,
|
2000-03-09 18:31:51 +00:00
|
|
|
&ett_ospf_lsa_mpls,
|
|
|
|
&ett_ospf_lsa_mpls_router,
|
|
|
|
&ett_ospf_lsa_mpls_link,
|
|
|
|
&ett_ospf_lsa_mpls_link_stlv
|
1999-11-16 11:44:20 +00:00
|
|
|
};
|
1999-07-29 05:47:07 +00:00
|
|
|
|
|
|
|
proto_ospf = proto_register_protocol("Open Shortest Path First", "ospf");
|
|
|
|
/* proto_register_field_array(proto_ospf, hf, array_length(hf));*/
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
1999-07-29 05:47:07 +00:00
|
|
|
}
|
2000-04-16 22:46:25 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_ospf(void)
|
|
|
|
{
|
|
|
|
dissector_add("ip.proto", IP_PROTO_OSPF, dissect_ospf);
|
|
|
|
}
|