1998-09-16 02:39:15 +00:00
/* packet-ospf.c
* Routines for OSPF packet disassembly
* ( c ) Copyright Hannes R . Boehm < hannes @ boehm . org >
*
2008-08-14 06:00:09 +00:00
* Wireshark - Network traffic analyzer
* By Gerald Combs < gerald @ wireshark . 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
2012-06-28 22:56:06 +00:00
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA .
2008-08-14 06:00:09 +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 .
2001-09-05 19:53:42 +00:00
* Furthermore RFC2740 ( OSPFv3 - OSPF for IPv6 ) is now supported
* - ( c ) 2001 Palle Lyckegaard < palle [ AT ] lyckegaard . dk >
1998-09-29 21:34:44 +00:00
*
2004-07-21 05:57:30 +00:00
* Added support to E - NNI routing ( OIF2003 .259 .02 )
* - ( c ) 2004 Roberto Morro < roberto . morro [ AT ] tilab . com >
2006-07-13 05:57:20 +00:00
*
2009-09-09 15:06:38 +00:00
* Added support for OSPF restart signaling :
* draft - nguyen - ospf - lls - 05. txt
* draft - nguyen - ospf - oob - resync - 05. txt
* draft - nguyen - ospf - restart - 05. txt
* - ( c ) 2005 Michael Rozhavsky < mrozhavsky @ fortinet . com >
*
2006-07-13 05:57:20 +00:00
* Added support of MPLS Diffserv - aware TE ( RFC 4124 ) ; new BC sub - TLV
* - ( c ) 2006 ( FF ) < francesco . fondelli [ AT ] gmail . com >
*
2007-08-26 13:43:47 +00:00
* Added support for decoding the TLVs in a grace - LSA
* - ( c ) 2007 Todd J Martin < todd . martin @ acm . org >
2006-07-13 05:57:20 +00:00
*
2009-06-09 21:41:53 +00:00
* Added support for draft - ietf - ospf - manet - or - 02
2008-08-14 06:00:09 +00:00
* Added support for draft - ietf - ospf - af - alt - 06
* - ( c ) 2008 Cisco Systems
2002-08-28 21:04:11 +00:00
*
2009-09-09 15:06:38 +00:00
* Added support for Multi - Topology ( MT ) Routing ( RFC4915 )
* - ( c ) 2009 Stig Bjorlykke < stig @ bjorlykke . org > , Thales Norway AS
*
2011-12-02 23:42:52 +00:00
* Added support for OSPFv2 & OSPFv3 Router Information ( RI ) Opaque LSA ( RFC4970 ) ; RI Capabilities TLV
* Added support for OSPFv2 & OSPFv3 Dynamic Hostname TLV in RI Opaque LSA ( RFC5642 )
* - ( c ) 2011 Salil Kanitkar < sskanitk @ ncsu . edu > , North Carolina State University
2013-01-18 22:04:15 +00:00
*
* Added support for Type Classification of Experimental and Reserved sub - TLVs ( RFC3630 )
2013-10-13 19:56:52 +00:00
* - ( c ) 2013 Kaushal Shah < kshah3 @ ncsu . edu > , North Carolina State University
2014-04-28 06:59:17 +00:00
*
* Added support for Authentication Trailer for OSPFv3 ( RFC6506 )
* - ( c ) 2014 Alexis La Goutte ( See AUTHORS )
1998-09-16 02:39:15 +00:00
*/
2002-08-28 21:04:11 +00:00
2012-09-20 02:03:38 +00:00
# include "config.h"
1998-09-16 02:39:15 +00:00
1999-03-23 03:14:46 +00:00
# include <string.h>
# include <glib.h>
2002-01-21 07:37:49 +00:00
# include <epan/packet.h>
2004-09-29 00:52:45 +00:00
# include <epan/ipproto.h>
2004-09-28 00:06:32 +00:00
# include <epan/in_cksum.h>
2014-06-15 12:27:57 +00:00
# include <epan/expert.h>
2013-09-13 10:13:19 +00:00
# include <epan/wmem/wmem.h>
2007-08-26 13:43:47 +00:00
# include <epan/addr_resolv.h>
2002-04-14 23:04:04 +00:00
# include "packet-rsvp.h"
1998-09-16 02:39:15 +00:00
2013-12-14 16:09:57 +00:00
void proto_register_ospf ( void ) ;
void proto_reg_handoff_ospf ( void ) ;
2001-09-05 19:53:42 +00:00
# define OSPF_VERSION_2 2
# define OSPF_VERSION_3 3
2008-08-14 06:00:09 +00:00
# define OSPF_AF_4 4
# define OSPF_AF_6 6
2011-03-22 00:38:55 +00:00
# define OSPF_VERSION_2_HEADER_LENGTH 24
2001-09-05 19:53:42 +00:00
# define OSPF_VERSION_3_HEADER_LENGTH 16
2000-12-27 12:48:27 +00:00
2011-03-22 00:38:55 +00:00
# define OSPF_HELLO 1
# define OSPF_DB_DESC 2
# define OSPF_LS_REQ 3
# define OSPF_LS_UPD 4
# define OSPF_LS_ACK 5
2000-12-27 12:48:27 +00:00
static const value_string pt_vals [ ] = {
2011-03-22 00:38:55 +00:00
{ OSPF_HELLO , " Hello Packet " } ,
{ OSPF_DB_DESC , " DB Description " } ,
{ OSPF_LS_REQ , " LS Request " } ,
{ OSPF_LS_UPD , " LS Update " } ,
{ OSPF_LS_ACK , " LS Acknowledge " } ,
{ 0 , NULL }
2000-12-27 12:48:27 +00:00
} ;
2014-04-28 06:59:17 +00:00
static const value_string ospf_at_authentication_type_vals [ ] = {
{ 0 , " Reserved " } ,
{ 1 , " HMAC Cryptographic Authentication " } ,
{ 0 , NULL }
} ;
2011-03-22 00:38:55 +00:00
# define OSPF_AUTH_NONE 0
# define OSPF_AUTH_SIMPLE 1
# define OSPF_AUTH_CRYPT 2
2000-12-27 12:48:27 +00:00
static const value_string auth_vals [ ] = {
2011-03-22 00:38:55 +00:00
{ OSPF_AUTH_NONE , " Null " } ,
{ OSPF_AUTH_SIMPLE , " Simple password " } ,
{ OSPF_AUTH_CRYPT , " Cryptographic " } ,
{ 0 , NULL }
} ;
# define OSPF_V2_OPTIONS_MT 0x01
# define OSPF_V2_OPTIONS_E 0x02
# define OSPF_V2_OPTIONS_MC 0x04
# define OSPF_V2_OPTIONS_NP 0x08
# define OSPF_V2_OPTIONS_L 0x10
# define OSPF_V2_OPTIONS_DC 0x20
# define OSPF_V2_OPTIONS_O 0x40
# define OSPF_V2_OPTIONS_DN 0x80
2002-08-28 21:04:11 +00:00
# define OSPF_V3_OPTIONS_V6 0x01
2011-03-22 00:38:55 +00:00
# define OSPF_V3_OPTIONS_E 0x02
# define OSPF_V3_OPTIONS_MC 0x04
# define OSPF_V3_OPTIONS_N 0x08
# define OSPF_V3_OPTIONS_R 0x10
# define OSPF_V3_OPTIONS_DC 0x20
# define OSPF_V3_OPTIONS_AF 0x0100
# define OSPF_V3_OPTIONS_L 0x0200
2014-04-07 05:38:30 +00:00
# define OSPF_V3_OPTIONS_AT 0x0400
2011-03-22 00:38:55 +00:00
2011-12-02 23:42:52 +00:00
/* Bitmask definitions for the informational capabilities bits. */
# define OSPF_RI_OPTIONS_GRC 0x80
# define OSPF_RI_OPTIONS_GRH 0x40
# define OSPF_RI_OPTIONS_SRS 0x20
# define OSPF_RI_OPTIONS_TES 0x10
# define OSPF_RI_OPTIONS_P2PLAN 0x08
# define OSPF_RI_OPTIONS_ETE 0x04
2011-03-22 00:38:55 +00:00
# define OSPF_LLS_EXT_OPTIONS_LR 0x00000001
# define OSPF_LLS_EXT_OPTIONS_RS 0x00000002
# define OSPF_V3_LLS_EXT_OPTIONS_LR 0x00000001
# define OSPF_V3_LLS_EXT_OPTIONS_RS 0x00000002
2008-08-14 16:31:07 +00:00
2008-08-14 06:00:09 +00:00
# define OSPF_V3_LLS_STATE_OPTIONS_R 0x80
# define OSPF_V3_LLS_STATE_OPTIONS_A 0x40
# define OSPF_V3_LLS_STATE_OPTIONS_N 0x20
# define OSPF_V3_LLS_RELAY_OPTIONS_A 0x80
# define OSPF_V3_LLS_RELAY_OPTIONS_N 0x40
2011-03-22 00:38:55 +00:00
# define OSPF_DBD_FLAG_MS 1
# define OSPF_DBD_FLAG_M 2
# define OSPF_DBD_FLAG_I 4
# define OSPF_DBD_FLAG_R 8
# define OSPF_LS_REQ_LENGTH 12
# define OSPF_LSTYPE_ROUTER 1
# define OSPF_LSTYPE_NETWORK 2
2014-06-17 05:57:31 +00:00
# define OSPF_LSTYPE_SUMMARY 3
2011-03-22 00:38:55 +00:00
# define OSPF_LSTYPE_ASBR 4
# define OSPF_LSTYPE_ASEXT 5
# define OSPF_LSTYPE_GRPMEMBER 6
# define OSPF_LSTYPE_ASEXT7 7
# define OSPF_LSTYPE_EXTATTR 8
2001-09-05 19:53:42 +00:00
# define OSPF_V3_LSTYPE_ROUTER 0x2001
2011-03-22 00:38:55 +00:00
# define OSPF_V3_LSTYPE_NETWORK 0x2002
2001-09-05 19:53:42 +00:00
# define OSPF_V3_LSTYPE_INTER_AREA_PREFIX 0x2003
# define OSPF_V3_LSTYPE_INTER_AREA_ROUTER 0x2004
# define OSPF_V3_LSTYPE_AS_EXTERNAL 0x4005
2002-08-28 21:04:11 +00:00
# define OSPF_V3_LSTYPE_GROUP_MEMBERSHIP 0x2006
2012-09-01 07:42:07 +00:00
# define OSPF_V3_LSTYPE_NSSA 0x2007
2001-09-05 19:53:42 +00:00
# define OSPF_V3_LSTYPE_LINK 0x0008
# define OSPF_V3_LSTYPE_INTRA_AREA_PREFIX 0x2009
2011-12-02 23:42:52 +00:00
# define OSPF_V3_LSTYPE_OPAQUE_RI 0x800c
2000-12-27 12:48:27 +00:00
/* Opaque LSA types */
# define OSPF_LSTYPE_OP_LINKLOCAL 9
# define OSPF_LSTYPE_OP_AREALOCAL 10
# define OSPF_LSTYPE_OP_ASWIDE 11
2012-09-01 07:42:07 +00:00
# define OSPF_V3_LSA_FUNCTION_CODE_ROUTER 1
# define OSPF_V3_LSA_FUNCTION_CODE_NETWORK 2
# define OSPF_V3_LSA_FUNCTION_CODE_INTER_AREA_PREFIX 3
# define OSPF_V3_LSA_FUNCTION_CODE_INTER_AREA_ROUTER 4
# define OSPF_V3_LSA_FUNCTION_CODE_AS_EXTERNAL 5
# define OSPF_V3_LSA_FUNCTION_CODE_GROUP_MEMBERSHIP 6
# define OSPF_V3_LSA_FUNCTION_CODE_NSSA 7
# define OSPF_V3_LSA_FUNCTION_CODE_LINK 8
# define OSPF_V3_LSA_FUNCTION_CODE_INTRA_AREA_PREFIX 9
# define OSPF_V3_LSA_FUNCTION_CODE_OPAQUE_RI 12
2011-03-22 00:38:55 +00:00
# define OSPF_LINK_PTP 1
# define OSPF_LINK_TRANSIT 2
# define OSPF_LINK_STUB 3
# define OSPF_LINK_VIRTUAL 4
2000-12-27 12:48:27 +00:00
2011-03-22 00:38:55 +00:00
# define OSPF_V3_LINK_PTP 1
# define OSPF_V3_LINK_TRANSIT 2
# define OSPF_V3_LINK_RESERVED 3
# define OSPF_V3_LINK_VIRTUAL 4
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
# define OSPF_LSA_HEADER_LENGTH 20
2000-12-27 12:48:27 +00:00
2007-06-26 07:02:48 +00:00
# define OSPF_DNA_LSA 0x8000
2000-12-27 12:48:27 +00:00
/* Known opaque LSAs */
# define OSPF_LSA_MPLS_TE 1
2011-12-02 23:42:52 +00:00
# define OSPF_LSA_GRACE 3
2013-10-13 19:56:52 +00:00
/* The type field "4" indicates the Opaque RI LSA with Optional Router Capabilites
2011-12-02 23:42:52 +00:00
advertized in the first TLV . ( RFC4970 ) */
# define OSPF_LSA_OPAQUE_RI 4
# define OSPF_LSA_UNKNOWN 11
2007-08-26 13:43:47 +00:00
# define OSPF_RESTART_REASON_UNKNOWN 0
# define OSPF_RESTART_REASON_SWRESTART 1
# define OSPF_RESTART_REASON_SWRELOAD 2
# define OSPF_RESTART_REASON_SWITCH 3
static const value_string restart_reason_vals [ ] = {
{ OSPF_RESTART_REASON_UNKNOWN , " Unknown " } ,
{ OSPF_RESTART_REASON_SWRESTART , " Software Restart " } ,
{ OSPF_RESTART_REASON_SWRELOAD , " Software Reload/Upgrade " } ,
{ OSPF_RESTART_REASON_SWITCH , " Processor Switchover " } ,
{ 0 , NULL }
} ;
2000-12-27 12:48:27 +00:00
2007-08-26 13:43:47 +00:00
/* grace-LSA TLV Types */
# define GRACE_TLV_PERIOD 1
# define GRACE_TLV_REASON 2
# define GRACE_TLV_IP 3
static const value_string grace_tlv_type_vals [ ] = {
{ GRACE_TLV_PERIOD , " grace-LSA Grace Period " } ,
{ GRACE_TLV_REASON , " grace-LSA Restart Reason " } ,
{ GRACE_TLV_IP , " grace-LSA Restart IP " } ,
{ 0 , NULL }
} ;
2001-09-05 19:53:42 +00:00
2011-12-02 23:42:52 +00:00
/* Opaque-LSA - Router Informational Capabilities: TLV Types*/
# define OPT_RI_TLV 1
# define DYN_HOSTNAME_TLV 7
2013-10-23 06:29:11 +00:00
#if 0
2011-12-02 23:42:52 +00:00
/* The Opaque RI LSA TLV types definitions. */
static const value_string ri_tlv_type_vals [ ] = {
{ OPT_RI_TLV , " Optional Router Informational Capabilities TLV " } ,
{ DYN_HOSTNAME_TLV , " Dynamic Hostname TLV " } ,
{ 0 , NULL }
} ;
2013-10-23 06:29:11 +00:00
# endif
2011-12-02 23:42:52 +00:00
2000-12-27 12:48:27 +00:00
static const value_string ls_type_vals [ ] = {
2011-03-22 00:38:55 +00:00
{ OSPF_LSTYPE_ROUTER , " Router-LSA " } ,
{ OSPF_LSTYPE_NETWORK , " Network-LSA " } ,
2014-06-17 05:57:31 +00:00
{ OSPF_LSTYPE_SUMMARY , " Summary-LSA (IP network) " } ,
2011-03-22 00:38:55 +00:00
{ OSPF_LSTYPE_ASBR , " Summary-LSA (ASBR) " } ,
{ OSPF_LSTYPE_ASEXT , " AS-External-LSA (ASBR) " } ,
{ OSPF_LSTYPE_GRPMEMBER , " Group Membership LSA " } ,
{ OSPF_LSTYPE_ASEXT7 , " NSSA AS-External-LSA " } ,
{ OSPF_LSTYPE_EXTATTR , " External Attributes LSA " } ,
{ OSPF_LSTYPE_OP_LINKLOCAL , " Opaque LSA, Link-local scope " } ,
{ OSPF_LSTYPE_OP_AREALOCAL , " Opaque LSA, Area-local scope " } ,
{ 0 , NULL }
2001-09-05 19:53:42 +00:00
2000-12-27 12:48:27 +00:00
} ;
2002-05-14 09:46:38 +00:00
static const value_string ls_opaque_type_vals [ ] = {
2011-03-22 00:38:55 +00:00
{ OSPF_LSA_MPLS_TE , " Traffic Engineering LSA " } ,
{ 2 , " Sycamore Optical Topology Descriptions " } ,
{ OSPF_LSA_GRACE , " grace-LSA " } ,
2011-12-02 23:42:52 +00:00
{ OSPF_LSA_OPAQUE_RI , " Optional Router Capabilities Opaque RI LSA " } ,
2011-03-22 00:38:55 +00:00
{ 0 , NULL }
2002-05-14 09:46:38 +00:00
} ;
2001-09-05 19:53:42 +00:00
static const value_string v3_ls_type_vals [ ] = {
2011-03-22 00:38:55 +00:00
{ OSPF_V3_LSTYPE_ROUTER , " Router-LSA " } ,
{ OSPF_V3_LSTYPE_NETWORK , " Network-LSA " } ,
{ OSPF_V3_LSTYPE_INTER_AREA_PREFIX , " Inter-Area-Prefix-LSA " } ,
{ OSPF_V3_LSTYPE_INTER_AREA_ROUTER , " Inter-Area-Router-LSA " } ,
{ OSPF_V3_LSTYPE_AS_EXTERNAL , " AS-External-LSA " } ,
{ OSPF_V3_LSTYPE_GROUP_MEMBERSHIP , " Group-Membership-LSA " } ,
2012-09-01 07:42:07 +00:00
{ OSPF_V3_LSTYPE_NSSA , " NSSA-LSA " } ,
2011-03-22 00:38:55 +00:00
{ OSPF_V3_LSTYPE_LINK , " Link-LSA " } ,
{ OSPF_V3_LSTYPE_INTRA_AREA_PREFIX , " Intra-Area-Prefix-LSA " } ,
2011-12-02 23:42:52 +00:00
{ OSPF_V3_LSTYPE_OPAQUE_RI , " Router Information Opaque-LSA " } ,
2011-03-22 00:38:55 +00:00
{ 0 , NULL }
2001-09-05 19:53:42 +00:00
} ;
2005-12-16 07:37:28 +00:00
static const value_string lls_tlv_type_vals [ ] = {
2011-03-22 00:38:55 +00:00
{ 1 , " Extended options TLV " } ,
{ 2 , " Crypto Authentication TLV " } ,
{ 0 , NULL }
2005-12-16 07:37:28 +00:00
} ;
2008-08-14 06:00:09 +00:00
/* OSPFv3 LLS TLV Types */
# define LLS_V3_EXT_OPT 1
2009-06-09 21:41:53 +00:00
# define LLS_V3_STATE_CHECK 3
# define LLS_V3_NBR_DROP 4
# define LLS_V3_RELAYS 7
# define LLS_V3_WILLING 8
# define LLS_V3_RQST_FROM 5
# define LLS_V3_FULL_STATE 6
2008-08-14 06:00:09 +00:00
static const value_string lls_v3_tlv_type_vals [ ] = {
{ LLS_V3_EXT_OPT , " Extended Options TLV " } ,
{ LLS_V3_STATE_CHECK , " State Check Sequence TLV " } ,
{ LLS_V3_NBR_DROP , " Neighbor Drop TLV " } ,
{ LLS_V3_RELAYS , " Active Overlapping Relays TLV " } ,
{ LLS_V3_WILLING , " Willingness TLV " } ,
{ LLS_V3_RQST_FROM , " Request From LTV " } ,
{ LLS_V3_FULL_STATE , " Full State For TLV " } ,
{ 0 , NULL }
} ;
2004-09-28 17:57:56 +00:00
static const value_string mpls_link_stlv_ltype_str [ ] = {
{ 1 , " Point-to-point " } ,
{ 2 , " Multi-access " } ,
2007-06-26 07:02:48 +00:00
{ 0 , NULL }
2004-09-28 17:57:56 +00:00
} ;
2001-09-05 19:53:42 +00:00
2006-12-07 20:34:21 +00:00
/* FF: from www.iana.org/assignments/bandwidth-constraints-model-ids */
static const range_string mpls_link_stlv_bcmodel_rvals [ ] = {
{ 0 , 0 , " (Russian Dolls Model - RDM) " } ,
{ 1 , 1 , " (Maximum Allocation Model - MAM) " } ,
{ 2 , 2 , " (Maximum Allocation with Reservation Model - MAR) " } ,
{ 3 , 239 , " (Unassigned, Specification Required) " } ,
{ 240 , 255 , " (Reserved, Private Use) " } ,
{ 0 , 0 , NULL }
} ;
2005-12-16 20:37:45 +00:00
# define OSPF_V2_ROUTER_LSA_FLAG_B 0x01
# define OSPF_V2_ROUTER_LSA_FLAG_E 0x02
# define OSPF_V2_ROUTER_LSA_FLAG_V 0x04
2009-09-09 15:06:38 +00:00
# define OSPF_V2_ROUTER_LSA_FLAG_W 0x08
# define OSPF_V2_ROUTER_LSA_FLAG_N 0x10
2001-09-05 19:53:42 +00:00
# define OSPF_V3_ROUTER_LSA_FLAG_B 0x01
# define OSPF_V3_ROUTER_LSA_FLAG_E 0x02
# define OSPF_V3_ROUTER_LSA_FLAG_V 0x04
# define OSPF_V3_ROUTER_LSA_FLAG_W 0x08
# define OSPF_V3_PREFIX_OPTION_NU 0x01
# define OSPF_V3_PREFIX_OPTION_LA 0x02
# define OSPF_V3_PREFIX_OPTION_MC 0x04
# define OSPF_V3_PREFIX_OPTION_P 0x08
# define OSPF_V3_AS_EXTERNAL_FLAG_T 0x01
# define OSPF_V3_AS_EXTERNAL_FLAG_F 0x02
# define OSPF_V3_AS_EXTERNAL_FLAG_E 0x04
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 ;
2014-04-28 06:59:17 +00:00
static gint ett_ospf_at = - 1 ;
1999-11-16 11:44:20 +00:00
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 ;
2002-11-27 19:10:51 +00:00
static gint ett_ospf_lsa_router_link = - 1 ;
1999-11-16 11:44:20 +00:00
static gint ett_ospf_lsa_upd = - 1 ;
2005-12-16 20:37:45 +00:00
static gint ett_ospf_v2_options = - 1 ;
2011-12-02 23:42:52 +00:00
static gint ett_ospf_ri_options = - 1 ;
2005-12-16 20:37:45 +00:00
static gint ett_ospf_v3_options = - 1 ;
2005-11-04 23:03:26 +00:00
static gint ett_ospf_dbd = - 1 ;
2005-12-16 07:37:28 +00:00
static gint ett_ospf_lls_data_block = - 1 ;
static gint ett_ospf_lls_tlv = - 1 ;
static gint ett_ospf_lls_ext_options = - 1 ;
2008-08-14 06:00:09 +00:00
static gint ett_ospf_v3_lls_ext_options_tlv = - 1 ;
static gint ett_ospf_v3_lls_ext_options = - 1 ;
static gint ett_ospf_v3_lls_state_tlv = - 1 ;
static gint ett_ospf_v3_lls_state_scs = - 1 ;
static gint ett_ospf_v3_lls_state_options = - 1 ;
static gint ett_ospf_v3_lls_drop_tlv = - 1 ;
static gint ett_ospf_v3_lls_relay_tlv = - 1 ;
static gint ett_ospf_v3_lls_relay_added = - 1 ;
static gint ett_ospf_v3_lls_relay_options = - 1 ;
static gint ett_ospf_v3_lls_willingness_tlv = - 1 ;
static gint ett_ospf_v3_lls_willingness = - 1 ;
static gint ett_ospf_v3_lls_rf_tlv = - 1 ;
static gint ett_ospf_v3_lls_fsf_tlv = - 1 ;
2005-12-16 20:37:45 +00:00
static gint ett_ospf_v2_router_lsa_flags = - 1 ;
static gint ett_ospf_v3_router_lsa_flags = - 1 ;
static gint ett_ospf_v3_as_external_flags = - 1 ;
static gint ett_ospf_v3_prefix_options = - 1 ;
1999-11-16 11:44:20 +00:00
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 ;
2004-09-28 17:57:56 +00:00
static gint ett_ospf_lsa_mpls_link_stlv_admingrp = - 1 ;
2004-07-21 05:57:30 +00:00
static gint ett_ospf_lsa_oif_tna = - 1 ;
static gint ett_ospf_lsa_oif_tna_stlv = - 1 ;
2007-08-26 13:43:47 +00:00
static gint ett_ospf_lsa_grace_tlv = - 1 ;
2011-12-02 23:42:52 +00:00
static gint ett_ospf_lsa_opaque_ri = - 1 ;
static gint ett_ospf_lsa_ri_tlv = - 1 ;
static gint ett_ospf_lsa_dyn_hostname_tlv = - 1 ;
static gint ett_ospf_lsa_unknown_tlv = - 1 ;
2005-10-29 22:47:20 +00:00
2011-12-02 23:42:52 +00:00
/* The Options field in the first TLV of the Opaque RI LSA with type field set to "4" for OSPFv2
2013-10-13 19:56:52 +00:00
and type field set to " 12 " in OSPFv3 , is interpreted as advertizing optional router capabilties .
2011-12-02 23:42:52 +00:00
( RFC4970 ) */
2005-12-16 20:37:45 +00:00
static const true_false_string tfs_v3_as_external_flags_e = {
2014-06-20 08:48:47 +00:00
" Type 2 " ,
" Type 1 "
2005-12-16 20:37:45 +00:00
} ;
2005-11-04 21:55:23 +00:00
2002-05-10 18:37:38 +00:00
/*-----------------------------------------------------------------------
* OSPF Filtering
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* The OSPF filtering keys */
enum {
OSPFF_MSG_MIN ,
OSPFF_MSG_HELLO ,
OSPFF_MSG_DB_DESC ,
OSPFF_MSG_LS_REQ ,
OSPFF_MSG_LS_UPD ,
OSPFF_MSG_LS_ACK ,
2002-08-28 21:04:11 +00:00
2002-05-10 18:37:38 +00:00
OSPFF_LS_TYPE ,
2014-04-29 02:31:57 +00:00
OSPFF_LS_AGE ,
OSPFF_LS_DONOTAGE ,
OSPFF_LS_ID ,
OSPFF_LS_SEQNUM ,
OSPFF_LS_CHKSUM ,
OSPFF_LS_LENGTH ,
2002-05-14 09:46:38 +00:00
OSPFF_LS_OPAQUE_TYPE ,
OSPFF_LS_MPLS_TE_INSTANCE ,
2002-05-10 18:37:38 +00:00
OSPFF_LS_MIN ,
2014-04-28 02:02:54 +00:00
2002-05-10 18:37:38 +00:00
OSPFF_LS_ROUTER ,
2014-04-28 02:02:54 +00:00
OSPFF_LS_ROUTER_LINKTYPE ,
OSPFF_LS_ROUTER_LINKID ,
OSPFF_LS_ROUTER_LINKDATA ,
2014-04-29 02:31:57 +00:00
OSPFF_LS_ROUTER_NUMMETRICS ,
OSPFF_LS_ROUTER_METRIC0 ,
2002-05-10 18:37:38 +00:00
OSPFF_LS_NETWORK ,
2014-04-29 02:31:57 +00:00
OSPFF_LS_NETWORK_NETMASK ,
OSPFF_LS_NETWORK_ATTACHRTR ,
2002-05-10 18:37:38 +00:00
OSPFF_LS_SUMMARY ,
2014-04-29 02:31:57 +00:00
2002-05-10 18:37:38 +00:00
OSPFF_LS_ASBR ,
2014-04-29 02:31:57 +00:00
OSPFF_LS_ASBR_NETMASK ,
2002-05-10 18:37:38 +00:00
OSPFF_LS_ASEXT ,
2014-04-29 02:31:57 +00:00
OSPFF_LS_ASEXT_NETMASK ,
OSPFF_LS_ASEXT_FWDADDR ,
OSPFF_LS_ASEXT_EXTRTRTAG ,
2002-05-10 18:37:38 +00:00
OSPFF_LS_GRPMEMBER ,
OSPFF_LS_ASEXT7 ,
OSPFF_LS_EXTATTR ,
OSPFF_LS_OPAQUE ,
2012-09-01 07:42:07 +00:00
OSPFF_V3_LS_TYPE ,
OSPFF_V3_LS_MIN ,
OSPFF_V3_LS_ROUTER ,
OSPFF_V3_LS_NETWORK ,
OSPFF_V3_LS_INTER_AREA_PREFIX ,
OSPFF_V3_LS_INTER_AREA_ROUTER ,
OSPFF_V3_LS_AS_EXTERNAL ,
OSPFF_V3_LS_GROUP_MEMBERSHIP ,
OSPFF_V3_LS_NSSA ,
OSPFF_V3_LS_LINK ,
OSPFF_V3_LS_INTRA_AREA_PREFIX ,
OSPFF_V3_LS_OPAQUE_RI ,
2002-05-10 18:37:38 +00:00
OSPFF_ADV_ROUTER ,
OSPFF_LS_MPLS ,
OSPFF_LS_MPLS_ROUTERID ,
2004-09-28 17:57:56 +00:00
OSPFF_LS_MPLS_LINKTYPE ,
2002-05-10 18:37:38 +00:00
OSPFF_LS_MPLS_LINKID ,
OSPFF_LS_MPLS_LOCAL_ADDR ,
OSPFF_LS_MPLS_REMOTE_ADDR ,
OSPFF_LS_MPLS_LOCAL_IFID ,
OSPFF_LS_MPLS_REMOTE_IFID ,
2004-09-28 17:57:56 +00:00
OSPFF_LS_MPLS_LINKCOLOR ,
2006-07-13 05:57:20 +00:00
OSPFF_LS_MPLS_BC_MODEL_ID ,
2008-04-10 21:42:19 +00:00
OSPFF_LS_OIF_LOCAL_NODE_ID ,
OSPFF_LS_OIF_REMOTE_NODE_ID ,
2002-05-10 18:37:38 +00:00
2005-12-16 20:37:45 +00:00
OSPFF_V2_OPTIONS ,
2009-09-09 15:06:38 +00:00
OSPFF_V2_OPTIONS_MT ,
2005-12-16 20:37:45 +00:00
OSPFF_V2_OPTIONS_E ,
OSPFF_V2_OPTIONS_MC ,
OSPFF_V2_OPTIONS_NP ,
OSPFF_V2_OPTIONS_L ,
OSPFF_V2_OPTIONS_DC ,
OSPFF_V2_OPTIONS_O ,
OSPFF_V2_OPTIONS_DN ,
2011-12-02 23:42:52 +00:00
/* OSPF Filtering keys for Router Informational Capabilities Options field. */
OSPFF_RI_OPTIONS ,
OSPFF_RI_OPTIONS_GRC ,
OSPFF_RI_OPTIONS_GRH ,
OSPFF_RI_OPTIONS_SRS ,
OSPFF_RI_OPTIONS_TES ,
OSPFF_RI_OPTIONS_P2PLAN ,
OSPFF_RI_OPTIONS_ETE ,
/* OSPF Filtering keys for Dynamic Hostname support (RFC5642) */
OSPFF_DYN_HOSTNAME ,
OSPFF_OPAQUE_LSA_MBZ ,
OSPFF_UNKNOWN_TLV_TXT ,
2005-12-16 20:37:45 +00:00
OSPFF_V3_OPTIONS ,
OSPFF_V3_OPTIONS_V6 ,
OSPFF_V3_OPTIONS_E ,
OSPFF_V3_OPTIONS_MC ,
OSPFF_V3_OPTIONS_N ,
OSPFF_V3_OPTIONS_R ,
OSPFF_V3_OPTIONS_DC ,
2008-08-14 06:00:09 +00:00
OSPFF_V3_OPTIONS_AF ,
OSPFF_V3_OPTIONS_L ,
2014-04-07 05:38:30 +00:00
OSPFF_V3_OPTIONS_AT ,
2005-12-16 20:37:45 +00:00
OSPFF_DBD ,
2005-12-18 19:01:46 +00:00
OSPFF_DBD_R ,
2005-12-16 20:37:45 +00:00
OSPFF_DBD_I ,
OSPFF_DBD_M ,
OSPFF_DBD_MS ,
2008-08-14 06:00:09 +00:00
OSPFF_LLS_EXT_OPTIONS_TLV ,
2005-12-16 20:37:45 +00:00
OSPFF_LLS_EXT_OPTIONS ,
OSPFF_LLS_EXT_OPTIONS_LR ,
OSPFF_LLS_EXT_OPTIONS_RS ,
2008-08-14 06:00:09 +00:00
OSPFF_V3_LLS_EXT_OPTIONS_TLV ,
OSPFF_V3_LLS_EXT_OPTIONS ,
2008-08-14 16:31:07 +00:00
OSPFF_V3_LLS_EXT_OPTIONS_LR ,
OSPFF_V3_LLS_EXT_OPTIONS_RS ,
2008-08-14 06:00:09 +00:00
OSPFF_V3_LLS_STATE_TLV ,
OSPFF_V3_LLS_STATE_SCS ,
OSPFF_V3_LLS_STATE_OPTIONS ,
OSPFF_V3_LLS_STATE_OPTIONS_R ,
OSPFF_V3_LLS_STATE_OPTIONS_A ,
OSPFF_V3_LLS_STATE_OPTIONS_N ,
OSPFF_V3_LLS_DROP_TLV ,
OSPFF_V3_LLS_RELAY_TLV ,
OSPFF_V3_LLS_RELAY_ADDED ,
OSPFF_V3_LLS_RELAY_OPTIONS ,
OSPFF_V3_LLS_RELAY_OPTIONS_A ,
OSPFF_V3_LLS_RELAY_OPTIONS_N ,
OSPFF_V3_LLS_WILLINGNESS_TLV ,
OSPFF_V3_LLS_WILLINGNESS ,
OSPFF_V3_LLS_RF_TLV ,
OSPFF_V3_LLS_FSF_TLV ,
2005-12-16 20:37:45 +00:00
OSPFF_V2_ROUTER_LSA_FLAG ,
OSPFF_V2_ROUTER_LSA_FLAG_B ,
OSPFF_V2_ROUTER_LSA_FLAG_E ,
OSPFF_V2_ROUTER_LSA_FLAG_V ,
2009-09-09 15:06:38 +00:00
OSPFF_V2_ROUTER_LSA_FLAG_W ,
OSPFF_V2_ROUTER_LSA_FLAG_N ,
2005-12-16 20:37:45 +00:00
OSPFF_V3_ROUTER_LSA_FLAG ,
OSPFF_V3_ROUTER_LSA_FLAG_B ,
OSPFF_V3_ROUTER_LSA_FLAG_E ,
OSPFF_V3_ROUTER_LSA_FLAG_V ,
OSPFF_V3_ROUTER_LSA_FLAG_W ,
OSPFF_V3_AS_EXTERNAL_FLAG ,
OSPFF_V3_AS_EXTERNAL_FLAG_T ,
OSPFF_V3_AS_EXTERNAL_FLAG_F ,
OSPFF_V3_AS_EXTERNAL_FLAG_E ,
OSPFF_V3_PREFIX_OPTION ,
OSPFF_V3_PREFIX_OPTION_NU ,
OSPFF_V3_PREFIX_OPTION_LA ,
OSPFF_V3_PREFIX_OPTION_MC ,
OSPFF_V3_PREFIX_OPTION_P ,
2007-08-26 13:43:47 +00:00
OSPFF_V2_GRACE_TLV ,
OSPFF_V2_GRACE_PERIOD ,
OSPFF_V2_GRACE_REASON ,
OSPFF_V2_GRACE_IP ,
2002-05-10 18:37:38 +00:00
OSPFF_MAX
} ;
2009-10-27 06:05:02 +00:00
static int hf_ospf_filter [ OSPFF_MAX ] ;
2014-04-09 07:52:03 +00:00
static int hf_ospf_header = - 1 ;
static int hf_ospf_header_version = - 1 ;
static int hf_ospf_header_msg_type = - 1 ;
static int hf_ospf_header_packet_length = - 1 ;
static int hf_ospf_header_src_router = - 1 ;
static int hf_ospf_header_area_id = - 1 ;
static int hf_ospf_header_checksum = - 1 ;
2014-06-15 12:27:57 +00:00
static int hf_ospf_tlv_type = - 1 ;
static int hf_ospf_tlv_length = - 1 ;
2014-04-09 07:52:03 +00:00
/* Header OSPF v2 auth */
static int hf_ospf_header_auth_type = - 1 ;
static int hf_ospf_header_auth_data_none = - 1 ;
static int hf_ospf_header_auth_data_simple = - 1 ;
static int hf_ospf_header_auth_crypt_key_id = - 1 ;
static int hf_ospf_header_auth_crypt_data_length = - 1 ;
static int hf_ospf_header_auth_crypt_seq_nbr = - 1 ;
static int hf_ospf_header_auth_crypt_data = - 1 ;
static int hf_ospf_header_auth_data_unknown = - 1 ;
/* Header OSPF v3 */
static int hf_ospf_header_instance_id = - 1 ;
static int hf_ospf_header_reserved = - 1 ;
/* Hello */
2014-04-07 06:48:14 +00:00
static int hf_ospf_hello = - 1 ;
static int hf_ospf_hello_network_mask = - 1 ;
static int hf_ospf_hello_interface_id = - 1 ;
static int hf_ospf_hello_hello_interval = - 1 ;
static int hf_ospf_hello_router_priority = - 1 ;
static int hf_ospf_hello_router_dead_interval = - 1 ;
static int hf_ospf_hello_designated_router = - 1 ;
static int hf_ospf_hello_backup_designated_router = - 1 ;
static int hf_ospf_hello_active_neighbor = - 1 ;
2002-05-10 18:37:38 +00:00
2014-04-28 06:59:17 +00:00
/* Authentication Trailer RFC6506 */
static int hf_ospf_at = - 1 ;
static int hf_ospf_at_auth_type = - 1 ;
static int hf_ospf_at_auth_data_len = - 1 ;
static int hf_ospf_at_reserved = - 1 ;
static int hf_ospf_at_sa_id = - 1 ;
static int hf_ospf_at_crypto_seq_nbr = - 1 ;
static int hf_ospf_at_auth_data = - 1 ;
2014-06-15 12:27:57 +00:00
/* Generated from convert_proto_tree_add_text.pl */
static int hf_ospf_referenced_advertising_router = - 1 ;
static int hf_ospf_v3_lsa_referenced_link_state_id = - 1 ;
static int hf_ospf_mpls_protection_capability = - 1 ;
static int hf_ospf_oif_encoding = - 1 ;
static int hf_ospf_ls_id_te_lsa_reserved = - 1 ;
static int hf_ospf_db_interface_mtu = - 1 ;
static int hf_ospf_mpls_router_address = - 1 ;
static int hf_ospf_v3_lls_full_state_for = - 1 ;
static int hf_ospf_v3_lsa_interface_id = - 1 ;
static int hf_ospf_v3_lsa_router_priority = - 1 ;
static int hf_ospf_v3_lsa_forwarding_address_ipv6 = - 1 ;
static int hf_ospf_v3_lls_dropped_neighbor = - 1 ;
static int hf_ospf_v3_lsa_external_route_tag = - 1 ;
static int hf_ospf_tna_addr = - 1 ;
static int hf_ospf_v3_lsa_neighbor_router_id = - 1 ;
static int hf_ospf_mpls_switching_type = - 1 ;
static int hf_ospf_oif_tna_addr_length = - 1 ;
static int hf_ospf_oif_tna_addr_ipv4 = - 1 ;
static int hf_ospf_link_state_id = - 1 ;
static int hf_ospf_ls_id_opaque_id = - 1 ;
static int hf_ospf_v2_lls_sequence_number = - 1 ;
static int hf_ospf_v3_lsa_do_not_age = - 1 ;
static int hf_ospf_lls_data_length = - 1 ;
static int hf_ospf_mpls_shared_risk_link_group = - 1 ;
static int hf_ospf_v3_lls_extended_options = - 1 ;
static int hf_ospf_db_dd_sequence = - 1 ;
static int hf_ospf_v3_lsa_destination_router_id = - 1 ;
static int hf_ospf_tna_addr_ipv6 = - 1 ;
static int hf_ospf_v3_lsa_link_local_interface_address = - 1 ;
static int hf_ospf_mpls_interface_mtu = - 1 ;
static int hf_ospf_v3_lsa_neighbor_interface_id = - 1 ;
static int hf_ospf_lsa_number_of_links = - 1 ;
static int hf_ospf_v2_lls_auth_data = - 1 ;
static int hf_ospf_oif_switching_cap = - 1 ;
static int hf_ospf_ls_number_of_lsas = - 1 ;
static int hf_ospf_v3_lls_neighbor = - 1 ;
static int hf_ospf_v3_lls_request_from = - 1 ;
static int hf_ospf_lls_checksum = - 1 ;
static int hf_ospf_v3_lsa_attached_router = - 1 ;
static int hf_ospf_v3_lsa_referenced_ls_type = - 1 ;
static int hf_ospf_mpls_encoding = - 1 ;
static int hf_ospf_lsa_external_type = - 1 ;
static int hf_ospf_v3_lsa_type = - 1 ;
static int hf_ospf_metric = - 1 ;
static int hf_ospf_prefix_length = - 1 ;
static expert_field ei_ospf_header_reserved = EI_INIT ;
2014-06-17 05:57:31 +00:00
static expert_field ei_ospf_lsa_bad_length = EI_INIT ;
static expert_field ei_ospf_lsa_constraint_missing = EI_INIT ;
2014-06-15 12:27:57 +00:00
2009-05-05 08:48:18 +00:00
static gint ospf_msg_type_to_filter ( guint8 msg_type )
2002-05-10 18:37:38 +00:00
{
2002-08-28 21:04:11 +00:00
if ( msg_type > = OSPF_HELLO & &
2011-03-22 00:38:55 +00:00
msg_type < = OSPF_LS_ACK )
return msg_type + OSPFF_MSG_MIN ;
2002-05-10 18:37:38 +00:00
return - 1 ;
}
2009-05-05 08:48:18 +00:00
static gint ospf_ls_type_to_filter ( guint8 ls_type )
2002-05-10 18:37:38 +00:00
{
2002-08-28 21:04:11 +00:00
if ( ls_type > = OSPF_LSTYPE_ROUTER & &
2011-03-22 00:38:55 +00:00
ls_type < = OSPF_LSTYPE_EXTATTR )
return OSPFF_LS_MIN + ls_type ;
2002-08-28 21:04:11 +00:00
else if ( ls_type > = OSPF_LSTYPE_OP_LINKLOCAL & &
2011-03-22 00:38:55 +00:00
ls_type < = OSPF_LSTYPE_OP_ASWIDE )
return OSPFF_LS_OPAQUE ;
2002-05-10 18:37:38 +00:00
else
2011-03-22 00:38:55 +00:00
return - 1 ;
2002-05-10 18:37:38 +00:00
}
2012-09-01 07:42:07 +00:00
static gint ospf_v3_ls_type_to_filter ( guint16 ls_type )
{
guint16 function_code ;
function_code = ls_type & 0x1fff ;
if ( function_code > = OSPF_V3_LSA_FUNCTION_CODE_ROUTER & &
function_code < = OSPF_V3_LSA_FUNCTION_CODE_INTRA_AREA_PREFIX )
return OSPFF_V3_LS_MIN + function_code ;
else if ( function_code = = OSPF_V3_LSA_FUNCTION_CODE_OPAQUE_RI )
return OSPFF_V3_LS_OPAQUE_RI ;
else
return - 1 ;
}
2005-12-16 20:37:45 +00:00
typedef struct _bitfield_info {
int hfindex ;
gint * ett ;
2010-01-19 00:37:39 +00:00
int * idx ;
2005-12-16 20:37:45 +00:00
int num ;
} bitfield_info ;
static int bf_dbd [ ] = {
2005-12-18 19:01:46 +00:00
OSPFF_DBD_R ,
2005-12-16 20:37:45 +00:00
OSPFF_DBD_I ,
OSPFF_DBD_M ,
OSPFF_DBD_MS
} ;
static int bf_lls_ext_options [ ] = {
OSPFF_LLS_EXT_OPTIONS_RS ,
OSPFF_LLS_EXT_OPTIONS_LR
} ;
2008-08-14 06:00:09 +00:00
static int bf_v3_lls_ext_options [ ] = {
2008-08-14 16:31:07 +00:00
OSPFF_V3_LLS_EXT_OPTIONS_LR ,
OSPFF_V3_LLS_EXT_OPTIONS_RS
2008-08-14 06:00:09 +00:00
} ;
static int bf_v3_lls_state_options [ ] = {
OSPFF_V3_LLS_STATE_OPTIONS_R ,
OSPFF_V3_LLS_STATE_OPTIONS_A ,
OSPFF_V3_LLS_STATE_OPTIONS_N
} ;
static int bf_v3_lls_relay_options [ ] = {
OSPFF_V3_LLS_RELAY_OPTIONS_A ,
OSPFF_V3_LLS_RELAY_OPTIONS_N
} ;
2005-12-16 20:37:45 +00:00
static int bf_v2_router_lsa_flags [ ] = {
OSPFF_V2_ROUTER_LSA_FLAG_V ,
OSPFF_V2_ROUTER_LSA_FLAG_E ,
OSPFF_V2_ROUTER_LSA_FLAG_B
} ;
2009-09-09 15:06:38 +00:00
static int bf_v2_router_lsa_mt_flags [ ] = {
OSPFF_V2_ROUTER_LSA_FLAG_N ,
OSPFF_V2_ROUTER_LSA_FLAG_W ,
OSPFF_V2_ROUTER_LSA_FLAG_V ,
OSPFF_V2_ROUTER_LSA_FLAG_E ,
OSPFF_V2_ROUTER_LSA_FLAG_B
} ;
2005-12-16 20:37:45 +00:00
static int bf_v3_router_lsa_flags [ ] = {
OSPFF_V3_ROUTER_LSA_FLAG_W ,
OSPFF_V3_ROUTER_LSA_FLAG_V ,
OSPFF_V3_ROUTER_LSA_FLAG_E ,
OSPFF_V3_ROUTER_LSA_FLAG_B
} ;
static int bf_v3_as_external_flags [ ] = {
OSPFF_V3_AS_EXTERNAL_FLAG_E ,
OSPFF_V3_AS_EXTERNAL_FLAG_F ,
OSPFF_V3_AS_EXTERNAL_FLAG_T
} ;
static int bf_v2_options [ ] = {
OSPFF_V2_OPTIONS_DN ,
OSPFF_V2_OPTIONS_O ,
OSPFF_V2_OPTIONS_DC ,
OSPFF_V2_OPTIONS_L ,
OSPFF_V2_OPTIONS_NP ,
OSPFF_V2_OPTIONS_MC ,
2009-09-09 15:06:38 +00:00
OSPFF_V2_OPTIONS_E ,
OSPFF_V2_OPTIONS_MT
2005-12-16 20:37:45 +00:00
} ;
2011-12-02 23:42:52 +00:00
/* Structures for handling the bitfield of the Options field of Optional Router Capabilites LSA (RFC4970). */
static int bf_ri_options [ ] = {
OSPFF_RI_OPTIONS_GRC ,
OSPFF_RI_OPTIONS_GRH ,
OSPFF_RI_OPTIONS_SRS ,
OSPFF_RI_OPTIONS_TES ,
OSPFF_RI_OPTIONS_P2PLAN ,
OSPFF_RI_OPTIONS_ETE
} ;
2005-12-16 20:37:45 +00:00
static int bf_v3_options [ ] = {
2014-04-07 05:38:30 +00:00
OSPFF_V3_OPTIONS_AT ,
2008-08-14 06:00:09 +00:00
OSPFF_V3_OPTIONS_L ,
OSPFF_V3_OPTIONS_AF ,
2005-12-16 20:37:45 +00:00
OSPFF_V3_OPTIONS_DC ,
OSPFF_V3_OPTIONS_R ,
OSPFF_V3_OPTIONS_N ,
OSPFF_V3_OPTIONS_MC ,
OSPFF_V3_OPTIONS_E ,
OSPFF_V3_OPTIONS_V6
} ;
static int bf_v3_prefix_options [ ] = {
OSPFF_V3_PREFIX_OPTION_P ,
OSPFF_V3_PREFIX_OPTION_MC ,
OSPFF_V3_PREFIX_OPTION_LA ,
OSPFF_V3_PREFIX_OPTION_NU
} ;
static bitfield_info bfinfo_dbd = {
OSPFF_DBD , & ett_ospf_dbd ,
bf_dbd , array_length ( bf_dbd )
} ;
static bitfield_info bfinfo_lls_ext_options = {
OSPFF_LLS_EXT_OPTIONS , & ett_ospf_lls_ext_options ,
bf_lls_ext_options , array_length ( bf_lls_ext_options )
} ;
2008-08-14 06:00:09 +00:00
static bitfield_info bfinfo_v3_lls_ext_options = {
OSPFF_V3_LLS_EXT_OPTIONS , & ett_ospf_v3_lls_ext_options ,
bf_v3_lls_ext_options , array_length ( bf_v3_lls_ext_options )
} ;
static bitfield_info bfinfo_v3_lls_state_options = {
OSPFF_V3_LLS_STATE_OPTIONS , & ett_ospf_v3_lls_state_options ,
bf_v3_lls_state_options , array_length ( bf_v3_lls_state_options )
} ;
static bitfield_info bfinfo_v3_lls_relay_options = {
OSPFF_V3_LLS_RELAY_OPTIONS , & ett_ospf_v3_lls_relay_options ,
bf_v3_lls_relay_options , array_length ( bf_v3_lls_relay_options )
} ;
2005-12-16 20:37:45 +00:00
static bitfield_info bfinfo_v2_router_lsa_flags = {
OSPFF_V2_ROUTER_LSA_FLAG , & ett_ospf_v2_router_lsa_flags ,
bf_v2_router_lsa_flags , array_length ( bf_v2_router_lsa_flags )
} ;
2009-09-09 15:06:38 +00:00
static bitfield_info bfinfo_v2_router_lsa_mt_flags = {
OSPFF_V2_ROUTER_LSA_FLAG , & ett_ospf_v2_router_lsa_flags ,
bf_v2_router_lsa_mt_flags , array_length ( bf_v2_router_lsa_mt_flags )
} ;
2005-12-16 20:37:45 +00:00
static bitfield_info bfinfo_v3_router_lsa_flags = {
OSPFF_V3_ROUTER_LSA_FLAG , & ett_ospf_v3_router_lsa_flags ,
bf_v3_router_lsa_flags , array_length ( bf_v3_router_lsa_flags )
} ;
static bitfield_info bfinfo_v3_as_external_flags = {
OSPFF_V3_AS_EXTERNAL_FLAG , & ett_ospf_v3_as_external_flags ,
bf_v3_as_external_flags , array_length ( bf_v3_as_external_flags )
} ;
static bitfield_info bfinfo_v2_options = {
OSPFF_V2_OPTIONS , & ett_ospf_v2_options ,
bf_v2_options , array_length ( bf_v2_options )
} ;
static bitfield_info bfinfo_v3_options = {
OSPFF_V3_OPTIONS , & ett_ospf_v3_options ,
bf_v3_options , array_length ( bf_v3_options )
} ;
static bitfield_info bfinfo_v3_prefix_options = {
OSPFF_V3_PREFIX_OPTION , & ett_ospf_v3_prefix_options ,
bf_v3_prefix_options , array_length ( bf_v3_prefix_options )
} ;
2011-12-02 23:42:52 +00:00
/* Structure used for dissecing the Options bitfield of the Optional Router Informational
Capabilities RI LSA . */
static bitfield_info bfinfo_ri_options = {
OSPFF_RI_OPTIONS , & ett_ospf_ri_options ,
bf_ri_options , array_length ( bf_ri_options )
} ;
2005-12-16 20:37:45 +00:00
# define MAX_OPTIONS_LEN 128
static void
dissect_ospf_bitfield ( proto_tree * parent_tree , tvbuff_t * tvb , int offset ,
bitfield_info * bfinfo )
{
proto_item * item = NULL ;
proto_tree * tree = NULL ;
guint32 flags ;
char * str ;
2009-03-22 20:55:31 +00:00
gint length , pos ;
2006-01-16 07:59:44 +00:00
gint i ;
2005-12-16 20:37:45 +00:00
header_field_info * hfinfo ;
2010-01-19 00:37:39 +00:00
int hfindex , idx ;
2009-03-22 20:55:31 +00:00
gint returned_length ;
2005-12-16 20:37:45 +00:00
2009-10-27 06:05:02 +00:00
hfindex = hf_ospf_filter [ bfinfo - > hfindex ] ;
2005-12-16 20:37:45 +00:00
hfinfo = proto_registrar_get_nth ( hfindex ) ;
switch ( hfinfo - > type ) {
2011-03-22 00:38:55 +00:00
case FT_UINT8 :
flags = tvb_get_guint8 ( tvb , offset ) ;
length = 1 ;
break ;
case FT_UINT16 :
flags = tvb_get_ntohs ( tvb , offset ) ;
length = 2 ;
break ;
case FT_UINT24 :
flags = tvb_get_ntoh24 ( tvb , offset ) ;
length = 3 ;
break ;
case FT_UINT32 :
flags = tvb_get_ntohl ( tvb , offset ) ;
length = 4 ;
break ;
default :
return ;
2005-12-16 20:37:45 +00:00
}
if ( parent_tree ) {
2011-03-22 00:38:55 +00:00
item = proto_tree_add_uint ( parent_tree , hfindex , tvb , offset , length , flags ) ;
tree = proto_item_add_subtree ( item , * bfinfo - > ett ) ;
2005-12-16 20:37:45 +00:00
2013-09-13 10:13:19 +00:00
str = ( char * ) wmem_alloc ( wmem_packet_scope ( ) , MAX_OPTIONS_LEN ) ;
2011-03-22 00:38:55 +00:00
str [ 0 ] = 0 ;
for ( i = 0 , pos = 0 ; i < bfinfo - > num ; i + + ) {
2010-01-19 00:37:39 +00:00
idx = hf_ospf_filter [ bfinfo - > idx [ i ] ] ;
2011-03-22 00:38:55 +00:00
hfinfo = proto_registrar_get_nth ( idx ) ;
if ( flags & hfinfo - > bitmask ) {
returned_length = g_snprintf ( & str [ pos ] , MAX_OPTIONS_LEN - pos , " %s%s " ,
pos ? " , " : " " ,
hfinfo - > name ) ;
pos + = MIN ( returned_length , MAX_OPTIONS_LEN - pos ) ;
}
proto_tree_add_boolean ( tree , idx , tvb , offset , length , flags ) ;
}
if ( str [ 0 ] ) {
proto_item_append_text ( item , " (%s) " , str ) ;
}
2005-12-16 20:37:45 +00:00
}
}
2001-11-26 04:52:51 +00:00
static dissector_handle_t data_handle ;
2005-12-16 07:37:28 +00:00
static void dissect_ospf_hello ( tvbuff_t * , int , proto_tree * , guint8 , guint16 ) ;
2014-06-15 12:27:57 +00:00
static void dissect_ospf_db_desc ( tvbuff_t * , packet_info * , int , proto_tree * , guint8 , guint16 , guint8 ) ;
static void dissect_ospf_ls_req ( tvbuff_t * , packet_info * , int , proto_tree * , guint8 , guint16 ) ;
static void dissect_ospf_ls_upd ( tvbuff_t * , packet_info * , int , proto_tree * , guint8 , guint16 , guint8 ) ;
static void dissect_ospf_ls_ack ( tvbuff_t * , packet_info * , int , proto_tree * , guint8 , guint16 , guint8 ) ;
2014-04-28 06:59:17 +00:00
static int dissect_ospf_authentication_trailer ( tvbuff_t * , int , proto_tree * ) ;
2005-12-16 07:37:28 +00:00
static void dissect_ospf_lls_data_block ( tvbuff_t * , int , proto_tree * , guint8 ) ;
2000-04-16 22:46:25 +00:00
2001-09-05 19:53:42 +00:00
/* dissect_ospf_v[23]lsa returns the offset of the next LSA
2002-08-28 21:04:11 +00:00
* if disassemble_body is set to FALSE ( e . g . in LSA ACK
2000-12-27 12:48:27 +00:00
* packets ) , the offset is set to the offset of the next
* LSA header
2000-04-16 22:46:25 +00:00
*/
2014-06-15 12:27:57 +00:00
static int dissect_ospf_v2_lsa ( tvbuff_t * , packet_info * , int , proto_tree * , gboolean disassemble_body ) ;
static int dissect_ospf_v3_lsa ( tvbuff_t * , packet_info * , int , proto_tree * , gboolean disassemble_body ,
2008-08-14 06:00:09 +00:00
guint8 ) ;
2001-09-05 19:53:42 +00:00
2008-08-14 06:00:09 +00:00
static void dissect_ospf_v3_address_prefix ( tvbuff_t * , int , int , proto_tree * , guint8 ) ;
2000-04-16 22:46:25 +00:00
2006-07-07 22:39:23 +00:00
static int
2008-08-14 06:00:09 +00:00
ospf_has_lls_block ( tvbuff_t * tvb , int offset , guint8 packet_type , guint8 version )
2005-12-16 07:37:28 +00:00
{
guint8 flags ;
2008-08-14 06:00:09 +00:00
guint32 v3flags ;
2005-12-16 07:37:28 +00:00
/* LLS block can be found only in HELLO and DBDESC packets */
switch ( packet_type ) {
case OSPF_HELLO :
2008-08-14 06:00:09 +00:00
switch ( version ) {
case OSPF_VERSION_2 :
flags = tvb_get_guint8 ( tvb , offset + 6 ) ;
return flags & OSPF_V2_OPTIONS_L ;
case OSPF_VERSION_3 :
v3flags = tvb_get_ntohl ( tvb , offset + 5 ) ;
v3flags = v3flags > > 8 ;
return v3flags & OSPF_V3_OPTIONS_L ;
}
2011-03-27 13:30:39 +00:00
break ;
2005-12-16 07:37:28 +00:00
case OSPF_DB_DESC :
2008-08-14 06:00:09 +00:00
switch ( version ) {
case OSPF_VERSION_2 :
flags = tvb_get_guint8 ( tvb , offset + 2 ) ;
return flags & OSPF_V2_OPTIONS_L ;
case OSPF_VERSION_3 :
v3flags = tvb_get_ntohl ( tvb , offset + 1 ) ;
v3flags = v3flags > > 8 ;
return v3flags & OSPF_V3_OPTIONS_L ;
}
2011-03-27 13:30:39 +00:00
break ;
2005-12-16 07:37:28 +00:00
}
return 0 ;
}
2014-04-28 06:59:17 +00:00
static int
ospf_has_at_block ( tvbuff_t * tvb , int offset , guint8 packet_type , guint8 version )
{
guint32 v3flags ;
/* AT (Authentication Trailer) block can be found only in OSPFv3 HELLO packets */
switch ( packet_type ) {
case OSPF_HELLO :
switch ( version ) {
case OSPF_VERSION_3 :
v3flags = tvb_get_ntohl ( tvb , offset + 5 ) ;
v3flags = v3flags > > 8 ;
return v3flags & OSPF_V3_OPTIONS_AT ;
}
}
return 0 ;
}
2002-08-28 21:04:11 +00:00
static void
2000-12-27 12:48:27 +00:00
dissect_ospf ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree )
{
proto_tree * ospf_tree = NULL ;
2014-04-09 07:52:03 +00:00
proto_item * ti , * ti_sum , * hidden_item ;
2000-12-27 12:48:27 +00:00
proto_tree * ospf_header_tree ;
guint8 version ;
guint8 packet_type ;
guint16 ospflen ;
2001-11-28 06:44:44 +00:00
vec_t cksum_vec [ 4 ] ;
2000-12-14 22:23:15 +00:00
int cksum_vec_len ;
2001-11-28 06:44:44 +00:00
guint32 phdr [ 2 ] ;
2000-12-14 22:23:15 +00:00
guint16 cksum , computed_cksum ;
2000-12-27 12:48:27 +00:00
guint length , reported_length ;
guint16 auth_type ;
2005-12-16 07:37:28 +00:00
int crypto_len = 0 ;
2001-09-05 19:53:42 +00:00
unsigned int ospf_header_length ;
2014-04-09 07:52:03 +00:00
guint8 instance_id ;
2001-09-13 20:27:24 +00:00
guint32 areaid ;
2008-08-14 06:00:09 +00:00
guint8 address_family = OSPF_AF_6 ;
2001-09-05 19:53:42 +00:00
2009-08-09 06:26:46 +00:00
col_set_str ( pinfo - > cinfo , COL_PROTOCOL , " OSPF " ) ;
2009-08-09 07:36:13 +00:00
col_clear ( pinfo - > cinfo , COL_INFO ) ;
2000-12-27 12:48:27 +00:00
version = tvb_get_guint8 ( tvb , 0 ) ;
2001-09-05 19:53:42 +00:00
switch ( version ) {
2011-03-22 00:38:55 +00:00
case OSPF_VERSION_2 :
ospf_header_length = OSPF_VERSION_2_HEADER_LENGTH ;
break ;
case OSPF_VERSION_3 :
ospf_header_length = OSPF_VERSION_3_HEADER_LENGTH ;
break ;
default :
ospf_header_length = 14 ;
break ;
}
packet_type = tvb_get_guint8 ( tvb , 1 ) ;
col_add_str ( pinfo - > cinfo , COL_INFO ,
val_to_str ( packet_type , pt_vals , " Unknown (%u) " ) ) ;
2014-04-09 07:52:03 +00:00
ospflen = tvb_get_ntohs ( tvb , 2 ) ;
2011-03-22 00:38:55 +00:00
2014-04-09 07:52:03 +00:00
ti = proto_tree_add_item ( tree , proto_ospf , tvb , 0 , - 1 , ENC_NA ) ;
ospf_tree = proto_item_add_subtree ( ti , ett_ospf ) ;
2011-03-22 00:38:55 +00:00
2011-12-02 23:42:52 +00:00
2014-04-09 07:52:03 +00:00
ti = proto_tree_add_item ( ospf_tree , hf_ospf_header , tvb , 0 , ospf_header_length , ENC_NA ) ;
ospf_header_tree = proto_item_add_subtree ( ti , ett_ospf_hdr ) ;
2011-03-22 00:38:55 +00:00
2014-04-09 07:52:03 +00:00
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_version , tvb , 0 , 1 , ENC_NA ) ;
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_msg_type , tvb , 1 , 1 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
2014-04-09 07:52:03 +00:00
if ( ospf_msg_type_to_filter ( packet_type ) ! = - 1 ) {
hidden_item = proto_tree_add_item ( ospf_header_tree ,
hf_ospf_filter [ ospf_msg_type_to_filter ( packet_type ) ] ,
tvb , 1 , 1 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_HIDDEN ( hidden_item ) ;
}
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_packet_length , tvb , 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_src_router , tvb , 4 , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
2001-09-05 19:53:42 +00:00
2014-04-09 07:52:03 +00:00
ti = proto_tree_add_item ( ospf_header_tree , hf_ospf_header_area_id , tvb , 8 , 4 , ENC_BIG_ENDIAN ) ;
areaid = tvb_get_ntohl ( tvb , 8 ) ;
if ( areaid = = 0 ) {
proto_item_append_text ( ti , " (Backbone) " ) ;
}
1998-09-16 02:39:15 +00:00
2014-04-09 07:52:03 +00:00
ti_sum = proto_tree_add_item ( ospf_header_tree , hf_ospf_header_checksum , tvb , 12 , 2 , ENC_BIG_ENDIAN ) ;
cksum = tvb_get_ntohs ( tvb , 12 ) ;
if ( cksum = = 0 ) {
proto_item_append_text ( ti_sum , " (None) " ) ;
}
2011-03-22 00:38:55 +00:00
2014-04-09 07:52:03 +00:00
/* Quit at this point if it's an unknown OSPF version. */
if ( version ! = OSPF_VERSION_2 & & version ! = OSPF_VERSION_3 ) {
return ;
}
2011-03-22 00:38:55 +00:00
2014-06-20 08:48:47 +00:00
length = tvb_captured_length ( tvb ) ;
2014-04-09 07:52:03 +00:00
/* XXX - include only the length from the OSPF header? */
reported_length = tvb_reported_length ( tvb ) ;
if ( cksum ! = 0 & & ! pinfo - > fragmented & & length > = reported_length
& & length > = ospf_header_length ) {
/* The packet isn't part of a fragmented datagram and isn't
truncated , so we can checksum it . */
2011-03-22 00:38:55 +00:00
switch ( version ) {
case OSPF_VERSION_2 :
2014-04-09 07:52:03 +00:00
/* Header, not including the authentication data (the OSPFv2
checksum excludes the 64 - bit authentication field ) . */
cksum_vec [ 0 ] . ptr = tvb_get_ptr ( tvb , 0 , 16 ) ;
cksum_vec [ 0 ] . len = 16 ;
if ( length > ospf_header_length ) {
/* Rest of the packet, again not including the
authentication data . */
reported_length - = ospf_header_length ;
cksum_vec [ 1 ] . ptr = tvb_get_ptr ( tvb , ospf_header_length , reported_length ) ;
cksum_vec [ 1 ] . len = reported_length ;
cksum_vec_len = 2 ;
} else {
/* There's nothing but a header. */
cksum_vec_len = 1 ;
2011-03-22 00:38:55 +00:00
}
break ;
case OSPF_VERSION_3 :
2014-04-09 07:52:03 +00:00
/* IPv6-style checksum, covering the entire OSPF packet
and a prepended IPv6 pseudo - header . */
/* Set up the fields of the pseudo-header. */
cksum_vec [ 0 ] . ptr = ( const guint8 * ) pinfo - > src . data ;
cksum_vec [ 0 ] . len = pinfo - > src . len ;
cksum_vec [ 1 ] . ptr = ( const guint8 * ) pinfo - > dst . data ;
cksum_vec [ 1 ] . len = pinfo - > dst . len ;
cksum_vec [ 2 ] . ptr = ( const guint8 * ) & phdr ;
phdr [ 0 ] = g_htonl ( ospflen ) ;
phdr [ 1 ] = g_htonl ( IP_PROTO_OSPF ) ;
cksum_vec [ 2 ] . len = 8 ;
cksum_vec [ 3 ] . ptr = tvb_get_ptr ( tvb , 0 , reported_length ) ;
cksum_vec [ 3 ] . len = reported_length ;
cksum_vec_len = 4 ;
2011-03-22 00:38:55 +00:00
break ;
default :
DISSECTOR_ASSERT_NOT_REACHED ( ) ;
break ;
}
2014-04-09 07:52:03 +00:00
computed_cksum = in_cksum ( cksum_vec , cksum_vec_len ) ;
if ( computed_cksum = = 0 ) {
proto_item_append_text ( ti_sum , " [correct] " ) ;
} else {
proto_item_append_text ( ti_sum , " [incorrect, should be 0x%04x] " , in_cksum_shouldbe ( cksum , computed_cksum ) ) ;
}
}
2011-03-22 00:38:55 +00:00
2014-04-09 07:52:03 +00:00
switch ( version ) {
2011-03-22 00:38:55 +00:00
2014-04-09 07:52:03 +00:00
case OSPF_VERSION_2 :
/* Authentication is only valid for OSPFv2 */
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_auth_type , tvb , 14 , 2 , ENC_NA ) ;
auth_type = tvb_get_ntohs ( tvb , 14 ) ;
switch ( auth_type ) {
case OSPF_AUTH_NONE :
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_auth_data_none , tvb , 16 , 8 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
break ;
2014-04-09 07:52:03 +00:00
case OSPF_AUTH_SIMPLE :
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_auth_data_simple , tvb , 16 , 8 , ENC_ASCII | ENC_NA ) ;
2011-03-22 00:38:55 +00:00
break ;
2000-12-27 12:48:27 +00:00
2014-04-09 07:52:03 +00:00
case OSPF_AUTH_CRYPT :
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_auth_crypt_key_id , tvb , 18 , 1 , ENC_NA ) ;
2000-12-27 12:48:27 +00:00
2014-04-09 07:52:03 +00:00
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_auth_crypt_data_length , tvb , 19 , 1 , ENC_NA ) ;
crypto_len = tvb_get_guint8 ( tvb , 19 ) ;
2000-12-27 12:48:27 +00:00
2014-04-09 07:52:03 +00:00
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_auth_crypt_seq_nbr , tvb , 20 , 4 , ENC_BIG_ENDIAN ) ;
/* Show the message digest that was appended to the end of the
OSPF message - but only if it ' s present ( we don ' t want
to get an exception before we ' ve tried dissecting OSPF
message ) . */
if ( tvb_bytes_exist ( tvb , ospflen , crypto_len ) ) {
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_auth_crypt_data , tvb , ospflen , crypto_len , ENC_NA ) ;
proto_tree_set_appendix ( ospf_header_tree , tvb , ospflen , crypto_len ) ;
}
2011-03-22 00:38:55 +00:00
break ;
default :
2014-04-09 07:52:03 +00:00
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_auth_data_unknown , tvb , 16 , 8 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
break ;
}
2014-04-09 07:52:03 +00:00
break ;
case OSPF_VERSION_3 :
/* Instance ID and "reserved" is OSPFv3-only */
2014-05-01 12:14:35 +00:00
proto_tree_add_item ( ospf_header_tree , hf_ospf_header_instance_id , tvb , 14 , 1 , ENC_NA ) ;
2014-04-09 07:52:03 +00:00
instance_id = tvb_get_guint8 ( tvb , 14 ) ;
/* By default set address_family to OSPF_AF_6 */
address_family = OSPF_AF_6 ;
if ( instance_id > 65 & & instance_id < 128 ) {
address_family = OSPF_AF_4 ;
}
2011-03-22 00:38:55 +00:00
2014-04-09 07:52:03 +00:00
ti = proto_tree_add_item ( ospf_header_tree , hf_ospf_header_reserved , tvb , 15 , 1 , ENC_NA ) ;
if ( tvb_get_guint8 ( tvb , 15 ) ) {
2014-06-15 12:27:57 +00:00
expert_add_info ( pinfo , ti , & ei_ospf_header_reserved ) ;
2011-03-22 00:38:55 +00:00
}
2014-04-09 07:52:03 +00:00
break ;
default :
DISSECTOR_ASSERT_NOT_REACHED ( ) ;
break ;
2005-12-16 07:37:28 +00:00
}
2014-04-09 07:52:03 +00:00
switch ( packet_type ) {
case OSPF_HELLO :
dissect_ospf_hello ( tvb , ospf_header_length , ospf_tree , version ,
( guint16 ) ( ospflen - ospf_header_length ) ) ;
break ;
case OSPF_DB_DESC :
2014-06-15 12:27:57 +00:00
dissect_ospf_db_desc ( tvb , pinfo , ( int ) ospf_header_length , ospf_tree , version ,
2014-04-09 07:52:03 +00:00
( guint16 ) ( ospflen - ospf_header_length ) ,
address_family ) ;
break ;
case OSPF_LS_REQ :
2014-06-15 12:27:57 +00:00
dissect_ospf_ls_req ( tvb , pinfo , ( int ) ospf_header_length , ospf_tree , version ,
2014-04-09 07:52:03 +00:00
( guint16 ) ( ospflen - ospf_header_length ) ) ;
break ;
case OSPF_LS_UPD :
2014-06-15 12:27:57 +00:00
dissect_ospf_ls_upd ( tvb , pinfo , ( int ) ospf_header_length , ospf_tree , version ,
2014-04-09 07:52:03 +00:00
( guint16 ) ( ospflen - ospf_header_length ) ,
address_family ) ;
break ;
case OSPF_LS_ACK :
2014-06-15 12:27:57 +00:00
dissect_ospf_ls_ack ( tvb , pinfo , ( int ) ospf_header_length , ospf_tree , version ,
2014-04-09 07:52:03 +00:00
( guint16 ) ( ospflen - ospf_header_length ) ,
address_family ) ;
break ;
default :
call_dissector ( data_handle ,
tvb_new_subset_remaining ( tvb , ospf_header_length ) , pinfo , tree ) ;
break ;
}
/* take care of the LLS data block */
if ( ospf_has_lls_block ( tvb , ospf_header_length , packet_type , version ) ) {
dissect_ospf_lls_data_block ( tvb , ospflen + crypto_len , ospf_tree ,
version ) ;
}
2014-04-28 06:59:17 +00:00
/* take care of the AT (Authentication Trailer) data block */
if ( ospf_has_at_block ( tvb , ospf_header_length , packet_type , version ) ) {
dissect_ospf_authentication_trailer ( tvb , ospflen + crypto_len , ospf_tree ) ;
}
2005-12-16 07:37:28 +00:00
}
static int
2008-08-14 06:00:09 +00:00
dissect_ospfv2_lls_tlv ( tvbuff_t * tvb , int offset , proto_tree * tree )
2005-12-16 07:37:28 +00:00
{
proto_item * ti ;
proto_tree * ospf_lls_tlv_tree ;
guint16 type ;
guint16 length ;
type = tvb_get_ntohs ( tvb , offset ) ;
length = tvb_get_ntohs ( tvb , offset + 2 ) ;
2008-10-31 15:34:00 +00:00
ti = proto_tree_add_text ( tree , tvb , offset , length + 4 , " %s " ,
2012-08-10 22:55:02 +00:00
val_to_str_const ( type , lls_tlv_type_vals , " Unknown TLV " ) ) ;
2005-12-16 07:37:28 +00:00
ospf_lls_tlv_tree = proto_item_add_subtree ( ti , ett_ospf_lls_tlv ) ;
2006-07-07 22:39:23 +00:00
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_tlv_type , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_tlv_length , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2006-07-07 22:39:23 +00:00
2005-12-16 07:37:28 +00:00
switch ( type ) {
2011-03-22 00:38:55 +00:00
case 1 :
dissect_ospf_bitfield ( ospf_lls_tlv_tree , tvb , offset + 4 , & bfinfo_lls_ext_options ) ;
break ;
case 2 :
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_v2_lls_sequence_number , tvb , offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_v2_lls_auth_data , tvb , offset + 8 , length - 4 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
break ;
1998-09-16 02:39:15 +00:00
}
2005-12-16 07:37:28 +00:00
return offset + length + 4 ;
}
2008-08-14 06:00:09 +00:00
static int
dissect_ospfv3_lls_tlv ( tvbuff_t * tvb , int offset , proto_tree * tree )
{
proto_item * ti ;
proto_tree * ospf_lls_tlv_tree ;
guint16 type ;
guint16 length ;
guint8 relays_added ;
int orig_offset ;
type = tvb_get_ntohs ( tvb , offset ) ;
length = tvb_get_ntohs ( tvb , offset + 2 ) ;
switch ( type ) {
case LLS_V3_EXT_OPT :
2009-10-27 06:05:02 +00:00
ti = proto_tree_add_item ( tree , hf_ospf_filter [ OSPFF_V3_LLS_EXT_OPTIONS_TLV ] , tvb ,
2011-10-19 15:04:44 +00:00
offset , length + 4 , ENC_NA ) ;
2008-08-14 06:00:09 +00:00
break ;
case LLS_V3_STATE_CHECK :
2009-10-27 06:05:02 +00:00
ti = proto_tree_add_item ( tree , hf_ospf_filter [ OSPFF_V3_LLS_STATE_TLV ] , tvb ,
2011-10-19 15:04:44 +00:00
offset , length + 4 , ENC_NA ) ;
2008-08-14 06:00:09 +00:00
break ;
case LLS_V3_NBR_DROP :
2009-10-27 06:05:02 +00:00
ti = proto_tree_add_item ( tree , hf_ospf_filter [ OSPFF_V3_LLS_DROP_TLV ] , tvb ,
2011-10-19 15:04:44 +00:00
offset , length + 4 , ENC_NA ) ;
2008-08-14 06:00:09 +00:00
break ;
case LLS_V3_RELAYS :
2009-10-27 06:05:02 +00:00
ti = proto_tree_add_item ( tree , hf_ospf_filter [ OSPFF_V3_LLS_RELAY_TLV ] , tvb ,
2011-10-19 15:04:44 +00:00
offset , length + 4 , ENC_NA ) ;
2008-08-14 06:00:09 +00:00
break ;
case LLS_V3_WILLING :
2009-10-27 06:05:02 +00:00
ti = proto_tree_add_item ( tree , hf_ospf_filter [ OSPFF_V3_LLS_WILLINGNESS_TLV ] , tvb ,
2011-10-19 15:04:44 +00:00
offset , length + 4 , ENC_NA ) ;
2008-08-14 06:00:09 +00:00
break ;
case LLS_V3_RQST_FROM :
2009-10-27 06:05:02 +00:00
ti = proto_tree_add_item ( tree , hf_ospf_filter [ OSPFF_V3_LLS_RF_TLV ] , tvb ,
2011-10-19 15:04:44 +00:00
offset , length + 4 , ENC_NA ) ;
2008-08-14 06:00:09 +00:00
break ;
case LLS_V3_FULL_STATE :
2009-10-27 06:05:02 +00:00
ti = proto_tree_add_item ( tree , hf_ospf_filter [ OSPFF_V3_LLS_FSF_TLV ] , tvb ,
2011-10-19 15:04:44 +00:00
offset , length + 4 , ENC_NA ) ;
2008-08-14 06:00:09 +00:00
break ;
default :
2008-10-31 15:34:00 +00:00
ti = proto_tree_add_text ( tree , tvb , offset , length + 4 , " %s " ,
2012-08-10 22:55:02 +00:00
val_to_str_const ( type , lls_v3_tlv_type_vals , " Unknown TLV " ) ) ;
2008-08-14 06:00:09 +00:00
}
ospf_lls_tlv_tree = proto_item_add_subtree ( ti , ett_ospf_lls_tlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_tlv_type , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_tlv_length , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2008-08-14 06:00:09 +00:00
orig_offset = offset ;
switch ( type ) {
case LLS_V3_EXT_OPT :
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_v3_lls_extended_options , tvb , offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2008-08-14 06:00:09 +00:00
dissect_ospf_bitfield ( ospf_lls_tlv_tree , tvb , offset + 4 , & bfinfo_v3_lls_ext_options ) ;
break ;
case LLS_V3_STATE_CHECK :
2009-10-27 06:05:02 +00:00
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_filter [ OSPFF_V3_LLS_STATE_SCS ] ,
2011-10-19 15:04:44 +00:00
tvb , offset + 4 , 2 , ENC_BIG_ENDIAN ) ;
2008-08-14 06:00:09 +00:00
dissect_ospf_bitfield ( ospf_lls_tlv_tree , tvb , offset + 6 ,
& bfinfo_v3_lls_state_options ) ;
break ;
case LLS_V3_NBR_DROP :
offset + = 4 ;
while ( orig_offset + length > = offset ) {
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_v3_lls_dropped_neighbor , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2008-08-14 06:00:09 +00:00
offset + = 4 ;
}
offset = orig_offset ;
break ;
case LLS_V3_RELAYS :
relays_added = tvb_get_guint8 ( tvb , offset + 4 ) ;
2009-10-27 06:05:02 +00:00
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_filter [ OSPFF_V3_LLS_RELAY_ADDED ] ,
2011-10-19 15:04:44 +00:00
tvb , offset + 4 , 1 , ENC_BIG_ENDIAN ) ;
2008-08-14 06:00:09 +00:00
dissect_ospf_bitfield ( ospf_lls_tlv_tree , tvb , offset + 5 ,
& bfinfo_v3_lls_relay_options ) ;
offset + = 8 ;
while ( orig_offset + length > = offset ) {
2014-06-15 12:27:57 +00:00
ti = proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_v3_lls_neighbor , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2008-08-14 06:00:09 +00:00
if ( relays_added > 0 ) {
proto_item_append_text ( ti , " Added " ) ;
} else {
proto_item_append_text ( ti , " Deleted " ) ;
}
relays_added - - ;
offset + = 4 ;
}
break ;
case LLS_V3_WILLING :
2009-10-27 06:05:02 +00:00
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_filter [ OSPFF_V3_LLS_WILLINGNESS ] ,
2011-10-19 15:04:44 +00:00
tvb , offset + 4 , 1 , ENC_BIG_ENDIAN ) ;
2008-08-14 06:00:09 +00:00
break ;
case LLS_V3_RQST_FROM :
offset + = 4 ;
while ( orig_offset + length > = offset ) {
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_v3_lls_request_from , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2008-08-14 06:00:09 +00:00
offset + = 4 ;
}
offset = orig_offset ;
break ;
case LLS_V3_FULL_STATE :
offset + = 4 ;
while ( orig_offset + length > = offset ) {
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lls_tlv_tree , hf_ospf_v3_lls_full_state_for , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2008-08-14 06:00:09 +00:00
offset + = 4 ;
}
offset = orig_offset ;
break ;
}
return offset + length + 4 ;
}
2005-12-16 07:37:28 +00:00
static void
2006-07-07 22:39:23 +00:00
dissect_ospf_lls_data_block ( tvbuff_t * tvb , int offset , proto_tree * tree ,
2011-03-22 00:38:55 +00:00
guint8 version )
2005-12-16 07:37:28 +00:00
{
proto_tree * ospf_lls_data_block_tree ;
proto_item * ti ;
2014-06-15 12:27:57 +00:00
int ospf_lls_len ;
2005-12-16 07:37:28 +00:00
int orig_offset = offset ;
2014-06-15 12:27:57 +00:00
ospf_lls_len = tvb_get_ntohs ( tvb , offset + 2 ) * 4 ;
2005-12-16 07:37:28 +00:00
ti = proto_tree_add_text ( tree , tvb , offset , - 1 , " OSPF LLS Data Block " ) ;
2006-07-07 22:39:23 +00:00
ospf_lls_data_block_tree = proto_item_add_subtree ( ti ,
2011-03-22 00:38:55 +00:00
ett_ospf_lls_data_block ) ;
2005-12-16 07:37:28 +00:00
/* TODO: verify checksum */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lls_data_block_tree , hf_ospf_lls_checksum , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_uint_format_value ( ospf_lls_data_block_tree , hf_ospf_lls_data_length , tvb , offset + 2 , 2 ,
ospf_lls_len , " %d bytes " , ospf_lls_len ) ;
2006-07-07 22:39:23 +00:00
2005-12-16 07:37:28 +00:00
offset + = 4 ;
2011-03-22 00:38:55 +00:00
DISSECTOR_ASSERT ( ( version = = OSPF_VERSION_2 ) | | ( version = = OSPF_VERSION_3 ) ) ;
2014-06-15 12:27:57 +00:00
while ( orig_offset + ospf_lls_len > offset ) {
2011-03-22 00:38:55 +00:00
if ( version = = OSPF_VERSION_2 )
2008-08-14 06:00:09 +00:00
offset = dissect_ospfv2_lls_tlv ( tvb , offset , ospf_lls_data_block_tree ) ;
2011-03-22 00:38:55 +00:00
else
2008-08-14 06:00:09 +00:00
offset = dissect_ospfv3_lls_tlv ( tvb , offset , ospf_lls_data_block_tree ) ;
}
1998-09-16 02:39:15 +00:00
}
2014-04-28 06:59:17 +00:00
static int
dissect_ospf_authentication_trailer ( tvbuff_t * tvb , int offset , proto_tree * tree )
{
proto_tree * ospf_at_tree ;
proto_item * ti ;
guint16 auth_data_len ;
ti = proto_tree_add_item ( tree , hf_ospf_at , tvb , offset , - 1 , ENC_NA ) ;
ospf_at_tree = proto_item_add_subtree ( ti , ett_ospf_at ) ;
proto_tree_add_item ( ospf_at_tree , hf_ospf_at_auth_type , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
proto_tree_add_item ( ospf_at_tree , hf_ospf_at_auth_data_len , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
auth_data_len = tvb_get_ntohs ( tvb , offset ) ;
proto_item_set_len ( ti , auth_data_len ) ;
offset + = 2 ;
proto_tree_add_item ( ospf_at_tree , hf_ospf_at_reserved , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
proto_tree_add_item ( ospf_at_tree , hf_ospf_at_sa_id , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
proto_tree_add_item ( ospf_at_tree , hf_ospf_at_crypto_seq_nbr , tvb , offset , 8 , ENC_BIG_ENDIAN ) ;
offset + = 8 ;
/* Add Check of Data ? */
proto_tree_add_item ( ospf_at_tree , hf_ospf_at_auth_data , tvb , offset , auth_data_len - ( 2 + 2 + 2 + 2 + 8 ) , ENC_NA ) ;
offset = auth_data_len ;
return offset ;
}
2000-04-16 22:46:25 +00:00
static void
2006-07-07 22:39:23 +00:00
dissect_ospf_hello ( tvbuff_t * tvb , int offset , proto_tree * tree , guint8 version ,
2011-03-22 00:38:55 +00:00
guint16 length )
2000-12-27 12:48:27 +00:00
{
1999-03-23 03:14:46 +00:00
proto_tree * ospf_hello_tree ;
2002-08-28 21:04:11 +00:00
proto_item * ti ;
2005-12-16 07:37:28 +00:00
int orig_offset = offset ;
1998-09-16 02:39:15 +00:00
2014-04-07 06:48:14 +00:00
ti = proto_tree_add_item ( tree , hf_ospf_hello , tvb , offset , length , ENC_NA ) ;
2000-12-27 12:48:27 +00:00
ospf_hello_tree = proto_item_add_subtree ( ti , ett_ospf_hello ) ;
2002-08-28 21:04:11 +00:00
2014-04-07 06:48:14 +00:00
switch ( version ) {
2011-03-22 00:38:55 +00:00
case OSPF_VERSION_2 :
2014-04-07 06:48:14 +00:00
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_network_mask , tvb , offset , 4 , ENC_NA ) ;
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_hello_interval , tvb , offset + 4 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
dissect_ospf_bitfield ( ospf_hello_tree , tvb , offset + 6 , & bfinfo_v2_options ) ;
2014-04-07 06:48:14 +00:00
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_router_priority , tvb , offset + 7 , 1 , ENC_NA ) ;
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_router_dead_interval , tvb , offset + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_designated_router , tvb , offset + 12 , 4 , ENC_NA ) ;
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_backup_designated_router , tvb , offset + 16 , 4 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
offset + = 20 ;
2014-04-07 06:48:14 +00:00
2011-03-22 00:38:55 +00:00
while ( orig_offset + length > offset ) {
2014-04-07 06:48:14 +00:00
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_active_neighbor , tvb , offset , 4 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
}
break ;
case OSPF_VERSION_3 :
2014-04-07 06:48:14 +00:00
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_interface_id , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_router_priority , tvb , offset + 4 , 1 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
dissect_ospf_bitfield ( ospf_hello_tree , tvb , offset + 5 , & bfinfo_v3_options ) ;
2014-04-07 06:48:14 +00:00
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_hello_interval , tvb , offset + 8 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_router_dead_interval , tvb , offset + 10 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_designated_router , tvb , offset + 12 , 4 , ENC_NA ) ;
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_backup_designated_router , tvb , offset + 16 , 4 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
offset + = 20 ;
2014-04-07 06:48:14 +00:00
2011-03-22 00:38:55 +00:00
while ( orig_offset + length > offset ) {
2014-04-07 06:48:14 +00:00
proto_tree_add_item ( ospf_hello_tree , hf_ospf_hello_active_neighbor , tvb , offset , 4 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
}
break ;
1998-09-16 02:39:15 +00:00
}
}
2000-04-16 22:46:25 +00:00
static void
2014-06-15 12:27:57 +00:00
dissect_ospf_db_desc ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * tree ,
2008-08-14 06:00:09 +00:00
guint8 version , guint16 length , guint8 address_family )
2000-12-27 12:48:27 +00:00
{
1999-03-23 03:14:46 +00:00
proto_tree * ospf_db_desc_tree = NULL ;
2002-08-28 21:04:11 +00:00
proto_item * ti ;
2001-09-05 19:53:42 +00:00
guint8 reserved ;
2005-12-16 07:37:28 +00:00
int orig_offset = offset ;
1998-09-16 02:39:15 +00:00
if ( tree ) {
2011-03-22 00:38:55 +00:00
ti = proto_tree_add_text ( tree , tvb , offset , length , " OSPF DB Description " ) ;
ospf_db_desc_tree = proto_item_add_subtree ( ti , ett_ospf_desc ) ;
1998-09-16 02:39:15 +00:00
2001-09-05 19:53:42 +00:00
switch ( version ) {
2002-08-28 21:04:11 +00:00
2011-03-22 00:38:55 +00:00
case OSPF_VERSION_2 :
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_db_desc_tree , hf_ospf_db_interface_mtu , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
1998-09-16 02:39:15 +00:00
2011-03-22 00:38:55 +00:00
dissect_ospf_bitfield ( ospf_db_desc_tree , tvb , offset + 2 , & bfinfo_v2_options ) ;
dissect_ospf_bitfield ( ospf_db_desc_tree , tvb , offset + 3 , & bfinfo_dbd ) ;
2005-11-04 23:03:26 +00:00
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_db_desc_tree , hf_ospf_db_dd_sequence , tvb , offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
offset + = 8 ;
break ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
case OSPF_VERSION_3 :
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
reserved = tvb_get_guint8 ( tvb , offset ) ;
2014-06-15 12:27:57 +00:00
ti = proto_tree_add_item ( ospf_db_desc_tree , hf_ospf_header_reserved , tvb , offset , 1 , ENC_NA ) ;
if ( reserved ! = 0 )
expert_add_info ( pinfo , ti , & ei_ospf_header_reserved ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
dissect_ospf_bitfield ( ospf_db_desc_tree , tvb , offset + 1 , & bfinfo_v3_options ) ;
2001-09-05 19:53:42 +00:00
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_db_desc_tree , hf_ospf_db_interface_mtu , tvb , offset + 4 , 2 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
reserved = tvb_get_guint8 ( tvb , offset + 6 ) ;
2014-06-15 12:27:57 +00:00
ti = proto_tree_add_item ( ospf_db_desc_tree , hf_ospf_header_reserved , tvb , offset + 6 , 1 , ENC_NA ) ;
if ( reserved ! = 0 )
expert_add_info ( pinfo , ti , & ei_ospf_header_reserved ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
dissect_ospf_bitfield ( ospf_db_desc_tree , tvb , offset + 7 , & bfinfo_dbd ) ;
2001-09-05 19:53:42 +00:00
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_db_desc_tree , hf_ospf_db_dd_sequence , tvb , offset + 8 , 4 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
offset + = 12 ;
break ;
}
1998-09-16 02:39:15 +00:00
}
2000-12-27 12:48:27 +00:00
1998-09-16 02:39:15 +00:00
/* LS Headers will be processed here */
/* skip to the end of DB-Desc header */
2011-03-22 00:38:55 +00:00
DISSECTOR_ASSERT ( ( version = = OSPF_VERSION_2 ) | | ( version = = OSPF_VERSION_3 ) ) ;
2005-12-16 07:37:28 +00:00
while ( orig_offset + length > offset ) {
2011-03-22 00:38:55 +00:00
if ( version = = OSPF_VERSION_2 )
2014-06-15 12:27:57 +00:00
offset = dissect_ospf_v2_lsa ( tvb , pinfo , offset , tree , FALSE ) ;
2011-03-22 00:38:55 +00:00
else
2014-06-15 12:27:57 +00:00
offset = dissect_ospf_v3_lsa ( tvb , pinfo , offset , tree , FALSE , address_family ) ;
2001-09-05 19:53:42 +00:00
}
1998-09-16 02:39:15 +00:00
}
2000-04-16 22:46:25 +00:00
static void
2014-06-15 12:27:57 +00:00
dissect_ospf_ls_req ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * tree , guint8 version ,
2008-08-14 06:00:09 +00:00
guint16 length )
2000-12-27 12:48:27 +00:00
{
1999-03-23 03:14:46 +00:00
proto_tree * ospf_lsr_tree ;
2000-12-27 12:48:27 +00:00
proto_item * ti ;
2004-01-06 02:47:40 +00:00
guint16 reserved ;
2005-12-16 07:37:28 +00:00
int orig_offset = offset ;
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 */
2005-12-16 07:37:28 +00:00
while ( orig_offset + length > offset ) {
2011-03-22 00:38:55 +00:00
ti = proto_tree_add_text ( tree , tvb , offset , OSPF_LS_REQ_LENGTH ,
" Link State Request " ) ;
ospf_lsr_tree = proto_item_add_subtree ( ti , ett_ospf_lsr ) ;
2002-08-28 21:04:11 +00:00
2001-09-05 19:53:42 +00:00
switch ( version ) {
2011-03-22 00:38:55 +00:00
case OSPF_VERSION_2 :
proto_tree_add_item ( ospf_lsr_tree , hf_ospf_filter [ OSPFF_LS_TYPE ] ,
2011-10-19 15:04:44 +00:00
tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
case OSPF_VERSION_3 :
reserved = tvb_get_ntohs ( tvb , offset ) ;
2014-06-15 12:27:57 +00:00
ti = proto_tree_add_item ( ospf_lsr_tree , hf_ospf_header_reserved , tvb , offset , 2 , ENC_NA ) ;
if ( reserved ! = 0 )
expert_add_info ( pinfo , ti , & ei_ospf_header_reserved ) ;
2012-09-01 07:42:07 +00:00
proto_tree_add_item ( ospf_lsr_tree , hf_ospf_filter [ OSPFF_V3_LS_TYPE ] ,
tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
2001-09-05 19:53:42 +00:00
}
2000-12-27 12:48:27 +00:00
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsr_tree , hf_ospf_link_state_id , tvb , offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_item ( ospf_lsr_tree , hf_ospf_filter [ OSPFF_ADV_ROUTER ] ,
2011-10-19 15:04:44 +00:00
tvb , offset + 8 , 4 , ENC_BIG_ENDIAN ) ;
2000-12-27 12:48:27 +00:00
2011-03-22 00:38:55 +00:00
offset + = 12 ;
1998-09-16 02:39:15 +00:00
}
}
2000-04-16 22:46:25 +00:00
static void
2014-06-15 12:27:57 +00:00
dissect_ospf_ls_upd ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * tree , guint8 version ,
2008-08-14 06:00:09 +00:00
guint16 length , guint8 address_family )
2000-12-27 12:48:27 +00:00
{
1999-03-23 03:14:46 +00:00
proto_tree * ospf_lsa_upd_tree = NULL ;
2000-12-27 12:48:27 +00:00
proto_item * ti ;
guint32 lsa_nr ;
2002-08-28 21:04:11 +00:00
guint32 lsa_counter ;
1998-09-16 02:39:15 +00:00
2005-12-16 07:37:28 +00:00
ti = proto_tree_add_text ( tree , tvb , offset , length , " LS Update Packet " ) ;
2000-12-27 12:48:27 +00:00
ospf_lsa_upd_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_upd ) ;
1998-09-16 02:39:15 +00:00
2000-12-27 12:48:27 +00:00
lsa_nr = tvb_get_ntohl ( tvb , offset ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_upd_tree , hf_ospf_ls_number_of_lsas , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
1998-09-16 02:39:15 +00:00
/* skip to the beginning of the first LSA */
2000-12-27 12:48:27 +00:00
offset + = 4 ; /* the LS Upd Packet contains only a 32 bit #LSAs field */
2002-08-28 21:04:11 +00:00
2011-03-22 00:38:55 +00:00
DISSECTOR_ASSERT ( ( version = = OSPF_VERSION_2 ) | | ( version = = OSPF_VERSION_3 ) ) ;
1998-09-16 02:39:15 +00:00
lsa_counter = 0 ;
2000-12-27 12:48:27 +00:00
while ( lsa_counter < lsa_nr ) {
2011-03-22 00:38:55 +00:00
if ( version = = OSPF_VERSION_2 )
2014-06-15 12:27:57 +00:00
offset = dissect_ospf_v2_lsa ( tvb , pinfo , offset , ospf_lsa_upd_tree , TRUE ) ;
2011-03-22 00:38:55 +00:00
else
2014-06-15 12:27:57 +00:00
offset = dissect_ospf_v3_lsa ( tvb , pinfo , offset , ospf_lsa_upd_tree , TRUE ,
2008-08-14 06:00:09 +00:00
address_family ) ;
1998-09-16 02:39:15 +00:00
lsa_counter + = 1 ;
}
}
2000-04-16 22:46:25 +00:00
static void
2014-06-15 12:27:57 +00:00
dissect_ospf_ls_ack ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * tree , guint8 version ,
2008-08-14 06:00:09 +00:00
guint16 length , guint8 address_family )
2000-12-27 12:48:27 +00:00
{
2005-12-16 07:37:28 +00:00
int orig_offset = offset ;
2011-03-22 00:38:55 +00:00
DISSECTOR_ASSERT ( ( version = = OSPF_VERSION_2 ) | | ( version = = OSPF_VERSION_3 ) ) ;
1998-09-16 02:39:15 +00:00
/* the body of a LS Ack packet simply contains zero or more LSA Headers */
2005-12-16 07:37:28 +00:00
while ( orig_offset + length > offset ) {
2011-03-22 00:38:55 +00:00
if ( version = = OSPF_VERSION_2 )
2014-06-15 12:27:57 +00:00
offset = dissect_ospf_v2_lsa ( tvb , pinfo , offset , tree , FALSE ) ;
2001-09-05 19:53:42 +00:00
else
2014-06-15 12:27:57 +00:00
offset = dissect_ospf_v3_lsa ( tvb , pinfo , offset , tree , FALSE , address_family ) ;
2001-09-05 19:53:42 +00:00
}
1998-09-16 02:39:15 +00:00
}
2000-03-09 18:31:51 +00:00
/*
2002-08-28 21:04:11 +00:00
* Returns if an LSA is opaque , i . e . requires special treatment
2000-03-09 18:31:51 +00:00
*/
2000-12-27 12:48:27 +00:00
static int
is_opaque ( int lsa_type )
2000-03-09 18:31:51 +00:00
{
2000-12-27 12:48:27 +00:00
return ( lsa_type > = OSPF_LSTYPE_OP_LINKLOCAL & &
lsa_type < = OSPF_LSTYPE_OP_ASWIDE ) ;
2000-03-09 18:31:51 +00:00
}
/* MPLS/TE TLV types */
# define MPLS_TLV_ROUTER 1
# define MPLS_TLV_LINK 2
2004-07-21 05:57:30 +00:00
# define OIF_TLV_TNA 32768
2000-03-09 18:31:51 +00:00
/* MPLS/TE Link STLV types */
enum {
2006-07-13 05:57:20 +00:00
MPLS_LINK_TYPE = 1 , /* RFC 3630, OSPF-TE */
2000-03-09 18:31:51 +00:00
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 ,
2006-07-13 05:57:20 +00:00
MPLS_LINK_LOCAL_REMOTE_ID = 11 , /* RFC 4203, GMPLS */
2002-02-14 02:32:14 +00:00
MPLS_LINK_PROTECTION = 14 ,
MPLS_LINK_IF_SWITCHING_DESC ,
2006-07-13 05:57:20 +00:00
MPLS_LINK_SHARED_RISK_GROUP ,
MPLS_LINK_BANDWIDTH_CONSTRAINT = 17 /* RFC 4124, OSPF-DSTE */
2000-03-09 18:31:51 +00:00
} ;
2007-08-26 13:43:47 +00:00
2004-07-21 05:57:30 +00:00
/* OIF TLV types */
enum {
OIF_LOCAL_NODE_ID = 32773 ,
OIF_REMOTE_NODE_ID ,
OIF_SONET_SDH_SWITCHING_CAPABILITY ,
OIF_TNA_IPv4_ADDRESS ,
OIF_NODE_ID ,
OIF_TNA_IPv6_ADDRESS ,
OIF_TNA_NSAP_ADDRESS
} ;
2000-12-27 12:48:27 +00:00
static const value_string mpls_link_stlv_str [ ] = {
2000-03-09 18:31:51 +00:00
{ 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 " } ,
2004-07-21 05:57:30 +00:00
{ MPLS_LINK_LOCAL_REMOTE_ID , " Link Local/Remote Identifier " } ,
2002-02-14 02:32:14 +00:00
{ MPLS_LINK_PROTECTION , " Link Protection Type " } ,
{ MPLS_LINK_IF_SWITCHING_DESC , " Interface Switching Capability Descriptor " } ,
{ MPLS_LINK_SHARED_RISK_GROUP , " Shared Risk Link Group " } ,
2006-07-13 05:57:20 +00:00
{ MPLS_LINK_BANDWIDTH_CONSTRAINT , " Bandwidth Constraints " } ,
2004-07-21 05:57:30 +00:00
{ OIF_LOCAL_NODE_ID , " Local Node ID " } ,
{ OIF_REMOTE_NODE_ID , " Remote Node ID " } ,
{ OIF_SONET_SDH_SWITCHING_CAPABILITY , " Sonet/SDH Interface Switching Capability " } ,
{ 0 , NULL } ,
} ;
2013-01-18 22:04:15 +00:00
static const range_string mpls_te_tlv_rvals [ ] = {
{ 3 , 32767 , " (Assigned via Standards Action) " } ,
{ 32768 , 32777 , " (For Experimental Use) " } ,
{ 32778 , 65535 , " (Not to be Assigned) " } ,
{ 0 , 0 , NULL }
} ;
static const range_string mpls_te_sub_tlv_rvals [ ] = {
{ 10 , 32767 , " (Assigned via Standards Action) " } ,
{ 32768 , 32777 , " (For Experimental Use) " } ,
{ 32778 , 65535 , " (Not to be Assigned) " } ,
{ 0 , 0 , NULL }
} ;
2004-07-21 05:57:30 +00:00
static const value_string oif_stlv_str [ ] = {
{ OIF_TNA_IPv4_ADDRESS , " TNA address " } ,
{ OIF_NODE_ID , " Node ID " } ,
{ OIF_TNA_IPv6_ADDRESS , " TNA address " } ,
{ OIF_TNA_NSAP_ADDRESS , " TNA address " } ,
2001-01-03 16:41:08 +00:00
{ 0 , NULL } ,
2000-03-09 18:31:51 +00:00
} ;
2014-04-09 07:52:03 +00:00
static const range_string ospf_instance_id_rvals [ ] = {
{ 0 , 32 , " IPv6 unicast AF " } ,
{ 33 , 64 , " IPv6 multicast AF " } ,
{ 65 , 96 , " IPv4 unicast AF " } ,
{ 97 , 128 , " IPv4 multicast AF " } ,
{ 129 , 255 , " Reserved " } ,
{ 0 , 0 , NULL } ,
} ;
2002-08-28 21:04:11 +00:00
/*
* Dissect MPLS / TE opaque LSA
2000-03-09 18:31:51 +00:00
*/
2000-12-27 12:48:27 +00:00
static void
2014-06-15 12:27:57 +00:00
dissect_ospf_lsa_mpls ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * tree ,
2011-03-22 00:38:55 +00:00
guint32 length )
2000-12-27 12:48:27 +00:00
{
2008-05-15 12:54:27 +00:00
proto_item * ti , * hidden_item ;
2000-03-09 18:31:51 +00:00
proto_tree * mpls_tree ;
proto_tree * tlv_tree ;
proto_tree * stlv_tree ;
2004-09-28 17:57:56 +00:00
proto_tree * stlv_admingrp_tree = NULL ;
2000-03-09 18:31:51 +00:00
int tlv_type ;
int tlv_length ;
2000-12-27 12:48:27 +00:00
int tlv_end_offset ;
2000-03-09 18:31:51 +00:00
2000-12-27 12:48:27 +00:00
int stlv_type , stlv_len , stlv_offset ;
2005-06-26 19:56:52 +00:00
const char * stlv_name ;
2004-09-28 17:57:56 +00:00
guint32 stlv_admingrp , mask ;
2000-03-09 18:31:51 +00:00
int i ;
2004-07-21 05:57:30 +00:00
guint8 switch_cap ;
2000-03-09 18:31:51 +00:00
2006-07-13 05:57:20 +00:00
const guint8 allzero [ ] = { 0x00 , 0x00 , 0x00 } ;
guint num_bcs = 0 ;
2009-09-10 02:15:55 +00:00
2000-12-27 12:48:27 +00:00
ti = proto_tree_add_text ( tree , tvb , offset , length ,
2011-03-22 00:38:55 +00:00
" MPLS Traffic Engineering LSA " ) ;
2009-10-27 06:05:02 +00:00
hidden_item = proto_tree_add_item ( tree , hf_ospf_filter [ OSPFF_LS_MPLS ] ,
2011-10-19 15:04:44 +00:00
tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2008-05-15 12:54:27 +00:00
PROTO_ITEM_SET_HIDDEN ( hidden_item ) ;
2000-03-09 18:31:51 +00:00
mpls_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls ) ;
2000-12-27 12:48:27 +00:00
while ( length ! = 0 ) {
2011-03-22 00:38:55 +00:00
tlv_type = tvb_get_ntohs ( tvb , offset ) ;
tlv_length = tvb_get_ntohs ( tvb , offset + 2 ) ;
tlv_end_offset = offset + tlv_length + 4 ;
switch ( tlv_type ) {
case MPLS_TLV_ROUTER :
2014-06-15 12:27:57 +00:00
ti = proto_tree_add_item ( mpls_tree , hf_ospf_mpls_router_address , tvb , offset , tlv_length + 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
tlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_router ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( tlv_tree , hf_ospf_tlv_type , tvb , offset , 2 , tlv_type , " 1 - Router Address " ) ;
proto_tree_add_item ( tlv_tree , hf_ospf_tlv_length , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_item ( tlv_tree , hf_ospf_filter [ OSPFF_LS_MPLS_ROUTERID ] ,
2011-10-19 15:04:44 +00:00
tvb , offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
case MPLS_TLV_LINK :
ti = proto_tree_add_text ( mpls_tree , tvb , offset , tlv_length + 4 ,
" Link Information " ) ;
tlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( tlv_tree , hf_ospf_tlv_type , tvb , offset , 2 , tlv_type , " 2 - Link Information " ) ;
proto_tree_add_item ( tlv_tree , hf_ospf_tlv_length , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
stlv_offset = offset + 4 ;
/* Walk down the sub-TLVs for link information */
while ( stlv_offset < tlv_end_offset ) {
stlv_type = tvb_get_ntohs ( tvb , stlv_offset ) ;
stlv_len = tvb_get_ntohs ( tvb , stlv_offset + 2 ) ;
2012-08-10 22:55:02 +00:00
stlv_name = val_to_str_const ( stlv_type , mpls_link_stlv_str , " Unknown sub-TLV " ) ;
2011-03-22 00:38:55 +00:00
switch ( stlv_type ) {
case MPLS_LINK_TYPE :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s: %u - %s " , stlv_name ,
tvb_get_guint8 ( tvb , stlv_offset + 4 ) ,
2012-08-10 22:55:02 +00:00
val_to_str_const ( tvb_get_guint8 ( tvb , stlv_offset + 4 ) ,
mpls_link_stlv_ltype_str , " Unknown Link Type " ) ) ;
2011-03-22 00:38:55 +00:00
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_item ( stlv_tree , hf_ospf_filter [ OSPFF_LS_MPLS_LINKTYPE ] ,
2011-10-19 15:04:44 +00:00
tvb , stlv_offset + 4 , 1 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
case MPLS_LINK_ID :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s: %s " , stlv_name ,
tvb_ip_to_str ( tvb , stlv_offset + 4 ) ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_item ( stlv_tree , hf_ospf_filter [ OSPFF_LS_MPLS_LINKID ] ,
2011-10-19 15:04:44 +00:00
tvb , stlv_offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
case MPLS_LINK_LOCAL_IF :
case MPLS_LINK_REMOTE_IF :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
2013-01-18 22:04:15 +00:00
" %s: %s " , stlv_name , tvb_ip_to_str ( tvb , stlv_offset + 4 ) ) ;
2011-03-22 00:38:55 +00:00
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
/* The Local/Remote Interface IP Address sub-TLV is TLV type 3/4, and is 4N
octets in length , where N is the number of neighbor addresses . */
for ( i = 0 ; i < stlv_len ; i + = 4 )
proto_tree_add_item ( stlv_tree ,
stlv_type = = MPLS_LINK_LOCAL_IF ?
hf_ospf_filter [ OSPFF_LS_MPLS_LOCAL_ADDR ] :
hf_ospf_filter [ OSPFF_LS_MPLS_REMOTE_ADDR ] ,
2011-10-27 15:59:12 +00:00
tvb , stlv_offset + 4 + i , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
case MPLS_LINK_TE_METRIC :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s: %u " , stlv_name ,
tvb_get_ntohl ( tvb , stlv_offset + 4 ) ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 4 , 4 , " %s: %u " , stlv_name ,
tvb_get_ntohl ( tvb , stlv_offset + 4 ) ) ;
break ;
case MPLS_LINK_COLOR :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s: 0x%08x " , stlv_name ,
tvb_get_ntohl ( tvb , stlv_offset + 4 ) ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
stlv_admingrp = tvb_get_ntohl ( tvb , stlv_offset + 4 ) ;
mask = 1 ;
ti = proto_tree_add_item ( stlv_tree , hf_ospf_filter [ OSPFF_LS_MPLS_LINKCOLOR ] ,
2011-10-19 15:04:44 +00:00
tvb , stlv_offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
stlv_admingrp_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv_admingrp ) ;
if ( stlv_admingrp_tree = = NULL )
return ;
for ( i = 0 ; i < 32 ; i + + ) {
if ( ( stlv_admingrp & mask ) ! = 0 ) {
proto_tree_add_text ( stlv_admingrp_tree , tvb , stlv_offset + 4 ,
4 , " Group %d " , i ) ;
}
mask < < = 1 ;
}
break ;
case MPLS_LINK_MAX_BW :
case MPLS_LINK_MAX_RES_BW :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s: %.10g bytes/s (%.0f bits/s) " , stlv_name ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 4 ) ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 4 ) * 8.0 ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 4 , 4 , " %s: %.10g bytes/s (%.0f bits/s) " , stlv_name ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 4 ) ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 4 ) * 8.0 ) ;
break ;
case MPLS_LINK_UNRES_BW :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s " , stlv_name ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
for ( i = 0 ; i < 8 ; i + + ) {
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 4 + ( i * 4 ) , 4 ,
" Pri (or TE-Class) %d: %.10g bytes/s (%.0f bits/s) " , i ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 4 + i * 4 ) ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 4 + i * 4 ) * 8.0 ) ;
}
break ;
case MPLS_LINK_BANDWIDTH_CONSTRAINT :
/*
The " Bandwidth Constraints " sub - TLV format is illustrated below :
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| BC Model Id | Reserved |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| BC0 value |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
// . . . //
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| BCh value |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s " , stlv_name ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
2011-03-22 00:38:55 +00:00
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_item ( stlv_tree , hf_ospf_filter [ OSPFF_LS_MPLS_BC_MODEL_ID ] ,
2011-10-19 15:04:44 +00:00
tvb , stlv_offset + 4 , 1 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
/* 3 octets reserved +5, +6 and +7 (all 0x00) */
if ( tvb_memeql ( tvb , stlv_offset + 5 , allzero , 3 ) = = - 1 ) {
2014-06-15 12:27:57 +00:00
proto_tree_add_expert_format ( stlv_tree , pinfo , & ei_ospf_header_reserved ,
tvb , stlv_offset + 5 , 3 ,
" These bytes are reserved and must be 0x00 " ) ;
2011-03-22 00:38:55 +00:00
}
if ( ( ( stlv_len % 4 ) ! = 0 ) ) {
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 4 , stlv_len ,
" Malformed Packet: Length must be N x 4 octets " ) ;
break ;
}
/* stlv_len shound range from 4 to 36 bytes */
num_bcs = ( stlv_len - 4 ) / 4 ;
if ( num_bcs > 8 ) {
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 4 , stlv_len ,
" Malformed Packet: too many BC (%u) " , num_bcs ) ;
break ;
}
if ( num_bcs = = 0 ) {
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 4 , stlv_len ,
" Malformed Packet: Bandwidth Constraints sub-TLV with no BC? " ) ;
break ;
}
for ( i = 0 ; i < ( int ) num_bcs ; i + + ) {
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 8 + ( i * 4 ) , 4 ,
" BC %d: %.10g bytes/s (%.0f bits/s) " , i ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 8 + i * 4 ) ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 8 + i * 4 ) * 8.0 ) ;
}
break ;
case MPLS_LINK_LOCAL_REMOTE_ID :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s: %d (0x%x) - %d (0x%x) " , stlv_name ,
2004-07-21 05:57:30 +00:00
tvb_get_ntohl ( tvb , stlv_offset + 4 ) ,
tvb_get_ntohl ( tvb , stlv_offset + 4 ) ,
tvb_get_ntohl ( tvb , stlv_offset + 8 ) ,
tvb_get_ntohl ( tvb , stlv_offset + 8 ) ) ;
2011-03-22 00:38:55 +00:00
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2006-07-07 22:39:23 +00:00
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2004-07-21 05:57:30 +00:00
proto_tree_add_item ( stlv_tree ,
2009-10-27 06:05:02 +00:00
hf_ospf_filter [ OSPFF_LS_MPLS_LOCAL_IFID ] ,
2011-10-19 15:04:44 +00:00
tvb , stlv_offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2004-07-21 05:57:30 +00:00
proto_tree_add_item ( stlv_tree ,
2009-10-27 06:05:02 +00:00
hf_ospf_filter [ OSPFF_LS_MPLS_REMOTE_IFID ] ,
2011-10-19 15:04:44 +00:00
tvb , stlv_offset + 8 , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
case MPLS_LINK_IF_SWITCHING_DESC :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s " , stlv_name ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2004-07-21 05:57:30 +00:00
switch_cap = tvb_get_guint8 ( tvb , stlv_offset + 4 ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( stlv_tree , hf_ospf_mpls_switching_type , tvb , stlv_offset + 4 , 1 , ENC_NA ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_mpls_encoding , tvb , stlv_offset + 5 , 1 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
for ( i = 0 ; i < 8 ; i + + ) {
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 8 + ( i * 4 ) , 4 ,
" Pri %d: %.10g bytes/s (%.0f bits/s) " , i ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 8 + i * 4 ) ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 8 + i * 4 ) * 8.0 ) ;
}
2004-07-23 23:28:08 +00:00
if ( switch_cap > = 1 & & switch_cap < = 4 ) { /* PSC-1 .. PSC-4 */
2004-07-21 05:57:30 +00:00
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 40 , 4 ,
" Minimum LSP bandwidth: %.10g bytes/s (%.0f bits/s) " ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 40 ) ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 40 ) * 8.0 ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( stlv_tree , hf_ospf_mpls_interface_mtu , tvb , stlv_offset + 44 , 2 , ENC_BIG_ENDIAN ) ;
2004-07-21 05:57:30 +00:00
}
2004-07-23 23:28:08 +00:00
if ( switch_cap = = 100 ) { /* TDM */
2004-07-21 05:57:30 +00:00
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 40 , 4 ,
" Minimum LSP bandwidth: %.10g bytes/s (%.0f bits/s) " ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 40 ) ,
tvb_get_ntohieee_float ( tvb , stlv_offset + 40 ) * 8.0 ) ;
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 44 , 2 ,
" SONET/SDH: %s " ,
tvb_get_guint8 ( tvb , stlv_offset + 44 ) ?
" Arbitrary " : " Standard " ) ;
}
2011-03-22 00:38:55 +00:00
break ;
case MPLS_LINK_PROTECTION :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s " , stlv_name ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_mpls_protection_capability , tvb , stlv_offset + 4 , 1 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
break ;
case MPLS_LINK_SHARED_RISK_GROUP :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s " , stlv_name ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
for ( i = 0 ; i < stlv_len ; i + = 4 )
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( stlv_tree , hf_ospf_mpls_shared_risk_link_group , tvb , stlv_offset + 4 + i , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
case OIF_LOCAL_NODE_ID :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s: %s " , stlv_name ,
tvb_ip_to_str ( tvb , stlv_offset + 4 ) ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_item ( stlv_tree ,
hf_ospf_filter [ OSPFF_LS_OIF_LOCAL_NODE_ID ] ,
2011-10-19 15:04:44 +00:00
tvb , stlv_offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
case OIF_REMOTE_NODE_ID :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s: %s " , stlv_name ,
tvb_ip_to_str ( tvb , stlv_offset + 4 ) ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_item ( stlv_tree ,
hf_ospf_filter [ OSPFF_LS_OIF_REMOTE_NODE_ID ] ,
2011-10-19 15:04:44 +00:00
tvb , stlv_offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
case OIF_SONET_SDH_SWITCHING_CAPABILITY :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 , " %s " , stlv_name ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_oif_switching_cap , tvb , stlv_offset + 4 , 1 , ENC_NA ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_oif_encoding , tvb , stlv_offset + 5 , 1 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
for ( i = 0 ; i < ( stlv_len - 4 ) / 4 ; i + + ) {
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 8 + ( i * 4 ) , 4 ,
" %s: %d free timeslots " ,
2012-08-25 01:20:32 +00:00
val_to_str_ext ( tvb_get_guint8 ( tvb , stlv_offset + 8 + ( i * 4 ) ) ,
& gmpls_sonet_signal_type_str_ext ,
" Unknown Signal Type (%d) " ) ,
2011-03-22 00:38:55 +00:00
tvb_get_ntoh24 ( tvb , stlv_offset + 9 + i * 4 ) ) ;
}
break ;
default :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
2013-01-18 22:04:15 +00:00
" Unknown Link sub-TLV: %u %s " , stlv_type ,
rval_to_str ( stlv_type , mpls_te_sub_tlv_rvals , " Unknown " ) ) ;
2011-03-22 00:38:55 +00:00
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s %s " , stlv_type , stlv_name ,
2013-01-18 22:04:15 +00:00
rval_to_str ( stlv_type , mpls_te_sub_tlv_rvals , " Unknown " ) ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 4 , stlv_len ,
" TLV Value " ) ;
break ;
}
stlv_offset + = ( ( stlv_len + 4 + 3 ) / 4 ) * 4 ;
}
break ;
case OIF_TLV_TNA :
ti = proto_tree_add_text ( mpls_tree , tvb , offset , tlv_length + 4 ,
" TNA Information " ) ;
tlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_oif_tna ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( tlv_tree , hf_ospf_tlv_type , tvb , offset , 2 , 32768 , " 32768 - TNA Information " ) ;
proto_tree_add_item ( tlv_tree , hf_ospf_tlv_length , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
stlv_offset = offset + 4 ;
/* Walk down the sub-TLVs for TNA information */
while ( stlv_offset < tlv_end_offset ) {
stlv_type = tvb_get_ntohs ( tvb , stlv_offset ) ;
stlv_len = tvb_get_ntohs ( tvb , stlv_offset + 2 ) ;
2012-08-10 22:55:02 +00:00
stlv_name = val_to_str_const ( stlv_type , oif_stlv_str , " Unknown sub-TLV " ) ;
2011-03-22 00:38:55 +00:00
switch ( stlv_type ) {
case OIF_NODE_ID :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s: %s " , stlv_name ,
tvb_ip_to_str ( tvb , stlv_offset + 4 ) ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_oif_tna_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_text ( stlv_tree , tvb , stlv_offset + 4 , 4 , " %s: %s " , stlv_name ,
tvb_ip_to_str ( tvb , stlv_offset + 4 ) ) ;
break ;
case OIF_TNA_IPv4_ADDRESS :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s (IPv4): %s " , stlv_name ,
tvb_ip_to_str ( tvb , stlv_offset + 8 ) ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_oif_tna_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s (IPv4) " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_oif_tna_addr_length , tvb , stlv_offset + 4 , 1 , ENC_NA ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_oif_tna_addr_ipv4 , tvb , stlv_offset + 8 , stlv_len - 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
case OIF_TNA_IPv6_ADDRESS :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s (IPv6): %s " , stlv_name ,
tvb_ip6_to_str ( tvb , stlv_offset + 8 ) ) ;
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_oif_tna_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s (IPv6) " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_oif_tna_addr_length , tvb , stlv_offset + 4 , 1 , ENC_NA ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tna_addr_ipv6 , tvb , stlv_offset + 8 , stlv_len - 4 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
break ;
case OIF_TNA_NSAP_ADDRESS :
ti = proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" %s (NSAP): %s " , stlv_name ,
2013-12-19 15:49:09 +00:00
tvb_bytes_to_ep_str ( tvb , stlv_offset + 8 , stlv_len - 4 ) ) ;
2011-03-22 00:38:55 +00:00
stlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_oif_tna_stlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( stlv_tree , hf_ospf_tlv_type , tvb , stlv_offset , 2 ,
stlv_type , " %u: %s (NSAP) " , stlv_type , stlv_name ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tlv_length , tvb , stlv_offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_oif_tna_addr_length , tvb , stlv_offset + 4 , 1 , ENC_NA ) ;
proto_tree_add_item ( stlv_tree , hf_ospf_tna_addr , tvb , stlv_offset + 8 , stlv_len - 4 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
break ;
default :
proto_tree_add_text ( tlv_tree , tvb , stlv_offset , stlv_len + 4 ,
" Unknown Link sub-TLV: %u " , stlv_type ) ;
break ;
}
stlv_offset + = ( ( stlv_len + 4 + 3 ) / 4 ) * 4 ;
}
break ;
default :
ti = proto_tree_add_text ( mpls_tree , tvb , offset , tlv_length + 4 ,
2013-01-18 22:04:15 +00:00
" Unknown LSA: %u %s " , tlv_type ,
rval_to_str ( tlv_type , mpls_te_tlv_rvals , " Unknown " ) ) ;
2011-03-22 00:38:55 +00:00
tlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_mpls_link ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( tlv_tree , hf_ospf_tlv_type , tvb , offset , 2 , tlv_type , " %u - Unknown %s " ,
2013-01-18 22:04:15 +00:00
tlv_type , rval_to_str ( tlv_type , mpls_te_tlv_rvals , " Unknown " ) ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( tlv_tree , hf_ospf_tlv_length , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_text ( tlv_tree , tvb , offset + 4 , tlv_length , " TLV Data " ) ;
break ;
}
offset + = tlv_length + 4 ;
length - = tlv_length + 4 ;
2000-03-09 18:31:51 +00:00
}
}
2009-09-10 02:15:55 +00:00
/*
2007-08-26 13:43:47 +00:00
* Dissect the TLVs within a Grace - LSA as defined by RFC 3623
*/
2009-09-10 02:15:55 +00:00
static void dissect_ospf_lsa_grace_tlv ( tvbuff_t * tvb , int offset ,
2011-03-22 00:38:55 +00:00
proto_tree * tree , guint32 length )
2007-08-26 13:43:47 +00:00
{
guint16 tlv_type ;
guint16 tlv_length ;
int tlv_length_with_pad ; /* The total length of the TLV including the type
2011-03-22 00:38:55 +00:00
and length fields and any padding */
2007-08-26 13:43:47 +00:00
guint32 grace_period ;
guint8 restart_reason ;
guint32 restart_ip ;
proto_tree * tlv_tree ;
proto_item * tree_item ;
proto_item * grace_tree_item ;
if ( ! tree ) { return ; }
while ( length > 0 )
{
2011-03-22 00:38:55 +00:00
tlv_type = tvb_get_ntohs ( tvb , offset ) ;
tlv_length = tvb_get_ntohs ( tvb , offset + 2 ) ;
/* The total length of the TLV including the type, length, value and
* pad bytes ( TLVs are padded to 4 octet alignment ) .
*/
tlv_length_with_pad = tlv_length + 4 + ( ( 4 - ( tlv_length % 4 ) ) % 4 ) ;
tree_item = proto_tree_add_item ( tree , hf_ospf_filter [ OSPFF_V2_GRACE_TLV ] , tvb , offset ,
2011-10-19 15:04:44 +00:00
tlv_length_with_pad , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
tlv_tree = proto_item_add_subtree ( tree_item , ett_ospf_lsa_grace_tlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( tlv_tree , hf_ospf_tlv_type , tvb , offset , 2 , tlv_type , " %s (%u) " ,
2012-08-10 22:55:02 +00:00
val_to_str_const ( tlv_type , grace_tlv_type_vals , " Unknown grace-LSA TLV " ) , tlv_type ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( tlv_tree , hf_ospf_tlv_length , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
switch ( tlv_type ) {
case GRACE_TLV_PERIOD :
grace_period = tvb_get_ntohl ( tvb , offset + 4 ) ;
grace_tree_item = proto_tree_add_item ( tlv_tree , hf_ospf_filter [ OSPFF_V2_GRACE_PERIOD ] , tvb ,
2011-10-19 15:04:44 +00:00
offset + 4 , tlv_length , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_item_append_text ( grace_tree_item , " seconds " ) ;
proto_item_set_text ( tree_item , " Grace Period: %u seconds " , grace_period ) ;
break ;
case GRACE_TLV_REASON :
restart_reason = tvb_get_guint8 ( tvb , offset + 4 ) ;
proto_tree_add_item ( tlv_tree , hf_ospf_filter [ OSPFF_V2_GRACE_REASON ] , tvb , offset + 4 ,
2011-10-19 15:04:44 +00:00
tlv_length , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_item_set_text ( tree_item , " Restart Reason: %s (%u) " ,
2012-08-10 22:55:02 +00:00
val_to_str_const ( restart_reason , restart_reason_vals , " Unknown Restart Reason " ) ,
2011-03-22 00:38:55 +00:00
restart_reason ) ;
break ;
case GRACE_TLV_IP :
restart_ip = tvb_get_ipv4 ( tvb , offset + 4 ) ;
proto_tree_add_item ( tlv_tree , hf_ospf_filter [ OSPFF_V2_GRACE_IP ] , tvb , offset + 4 ,
2011-10-19 15:04:44 +00:00
tlv_length , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
proto_item_set_text ( tree_item , " Restart IP: %s (%s) " ,
get_hostname ( restart_ip ) , ip_to_str ( ( guint8 * ) & restart_ip ) ) ;
break ;
default :
proto_item_set_text ( tree_item , " Unknown grace-LSA TLV " ) ;
break ;
}
if ( 4 + tlv_length < tlv_length_with_pad ) {
proto_tree_add_text ( tlv_tree , tvb , offset + 4 + tlv_length ,
tlv_length_with_pad - ( 4 + tlv_length ) , " Pad Bytes (%u) " ,
tlv_length_with_pad - ( 4 + tlv_length ) ) ;
}
offset + = tlv_length_with_pad ;
length - = tlv_length_with_pad ;
2007-08-26 13:43:47 +00:00
}
}
2011-12-02 23:42:52 +00:00
/*
* This function dissects the Optional Router capabilities LSA .
* In case of OSPFv2 , the Router Capabilities would be advertized via the first TLV
* of an RI LSA and in the case of OSPFv3 , the router capabilities would be advertized
* using a special purpose type field value . ( RFC 4970 )
* Also , the Dynamic Hostname or FQDN is advertized via a special purpose TLV type .
* The below function adds the support to handle this as well . ( RFC5642 ) .
*/
static void
dissect_ospf_lsa_opaque_ri ( tvbuff_t * tvb , int offset , proto_tree * tree ,
guint32 length )
{
proto_item * ti ;
proto_tree * ri_tree ;
proto_tree * tlv_tree ;
int tlv_type ;
int tlv_length ;
ti = proto_tree_add_text ( tree , tvb , offset , length ,
" Opaque Router Information LSA " ) ;
ri_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_opaque_ri ) ;
while ( length > 0 ) {
tlv_type = tvb_get_ntohs ( tvb , offset ) ;
tlv_length = tvb_get_ntohs ( tvb , offset + 2 ) ;
switch ( tlv_type ) {
case OPT_RI_TLV :
2013-10-13 19:56:52 +00:00
ti = proto_tree_add_text ( ri_tree , tvb , offset , tlv_length + 4 ,
2011-12-02 23:42:52 +00:00
" RI TLV " ) ;
tlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_ri_tlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( tlv_tree , hf_ospf_tlv_type , tvb , offset , 2 ,
tlv_type , " Router Informational Capabilities TLV (%u) " , tlv_type ) ;
2011-12-02 23:42:52 +00:00
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( tlv_tree , hf_ospf_tlv_length , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-12-02 23:42:52 +00:00
2013-10-13 19:56:52 +00:00
dissect_ospf_bitfield ( tlv_tree , tvb , offset + 4 , & bfinfo_ri_options ) ;
2011-12-02 23:42:52 +00:00
break ;
case DYN_HOSTNAME_TLV :
ti = proto_tree_add_text ( ri_tree , tvb , offset , tlv_length + 4 ,
" Dynamic Hostname TLV " ) ;
tlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_dyn_hostname_tlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( tlv_tree , hf_ospf_tlv_type , tvb , offset , 2 ,
tlv_type , " Dynamic Hostname TLV (%u) " , tlv_type ) ;
2011-12-02 23:42:52 +00:00
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( tlv_tree , hf_ospf_tlv_length , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-12-02 23:42:52 +00:00
2012-08-10 02:05:19 +00:00
proto_tree_add_item ( tlv_tree , hf_ospf_filter [ OSPFF_DYN_HOSTNAME ] , tvb , offset + 4 , tlv_length , ENC_ASCII | ENC_NA ) ;
2011-12-02 23:42:52 +00:00
break ;
default :
2013-10-13 19:56:52 +00:00
ti = proto_tree_add_text ( ri_tree , tvb , offset , tlv_length + 4 ,
2011-12-02 23:42:52 +00:00
" Unknown Opaque RI LSA TLV " ) ;
tlv_tree = proto_item_add_subtree ( ti , ett_ospf_lsa_unknown_tlv ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_uint_format_value ( tlv_tree , hf_ospf_tlv_length , tvb , offset , 2 ,
tlv_type , " Unknown TLV (%u) " , tlv_type ) ;
2011-12-02 23:42:52 +00:00
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( tlv_tree , hf_ospf_tlv_length , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-12-02 23:42:52 +00:00
2012-08-10 02:05:19 +00:00
proto_tree_add_item ( tlv_tree , hf_ospf_filter [ OSPFF_UNKNOWN_TLV_TXT ] , tvb , offset + 4 , tlv_length , ENC_ASCII | ENC_NA ) ;
2011-12-02 23:42:52 +00:00
break ;
}
offset + = tlv_length + 4 ;
length - = tlv_length + 4 ;
}
}
2000-03-09 18:31:51 +00:00
/*
* Dissect opaque LSAs
*/
2002-04-14 23:04:04 +00:00
static void
2014-06-15 12:27:57 +00:00
dissect_ospf_lsa_opaque ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * tree ,
2011-03-22 00:38:55 +00:00
guint8 ls_id_type , guint32 length )
2000-12-27 12:48:27 +00:00
{
switch ( ls_id_type ) {
2000-03-09 18:31:51 +00:00
case OSPF_LSA_MPLS_TE :
2014-06-15 12:27:57 +00:00
dissect_ospf_lsa_mpls ( tvb , pinfo , offset , tree , length ) ;
2011-03-22 00:38:55 +00:00
break ;
2011-12-02 23:42:52 +00:00
case OSPF_LSA_OPAQUE_RI :
dissect_ospf_lsa_opaque_ri ( tvb , offset , tree , length ) ;
break ;
2007-08-26 13:43:47 +00:00
case OSPF_LSA_GRACE :
2011-03-22 00:38:55 +00:00
dissect_ospf_lsa_grace_tlv ( tvb , offset , tree , length ) ;
break ;
2000-03-09 18:31:51 +00:00
default :
2011-03-22 00:38:55 +00:00
proto_tree_add_text ( tree , tvb , offset , length ,
" Unknown LSA Type %u " , ls_id_type ) ;
break ;
2000-03-09 18:31:51 +00:00
} /* switch on opaque LSA id */
}
2014-06-15 12:27:57 +00:00
static const true_false_string tfs_lsa_external_type = { " Type 2 (metric is larger than any other link state path) " ,
" Type 1 (metric is specified in the same units as interface cost) " } ;
static const value_string ospf_v3_lsa_type_vals [ ] = {
{ OSPF_V3_LINK_PTP , " Point-to-point connection to another router " } ,
{ OSPF_V3_LINK_TRANSIT , " Connection to a transit network " } ,
{ OSPF_LINK_STUB , " Connection to a stub network " } ,
{ OSPF_V3_LINK_VIRTUAL , " Virtual link " } ,
{ 0 , NULL } ,
} ;
static const value_string ospf_v3_lsa_type_short_vals [ ] = {
{ OSPF_V3_LINK_PTP , " PTP " } ,
{ OSPF_V3_LINK_TRANSIT , " Transit " } ,
{ OSPF_LINK_STUB , " Stub " } ,
{ OSPF_V3_LINK_VIRTUAL , " Virtual " } ,
{ 0 , NULL } ,
} ;
static const value_string ospf_v3_lsa_link_id_vals [ ] = {
{ OSPF_V3_LINK_PTP , " Neighboring router's Router ID " } ,
{ OSPF_V3_LINK_TRANSIT , " IP address of Designated Router " } ,
{ OSPF_LINK_STUB , " IP network/subnet number " } ,
{ OSPF_V3_LINK_VIRTUAL , " Neighboring router's Router ID " } ,
{ 0 , NULL } ,
} ;
2000-04-16 22:46:25 +00:00
static int
2014-06-15 12:27:57 +00:00
dissect_ospf_v2_lsa ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * tree ,
2011-03-22 00:38:55 +00:00
gboolean disassemble_body )
2000-12-27 12:48:27 +00:00
{
proto_tree * ospf_lsa_tree ;
2008-05-15 12:54:27 +00:00
proto_item * ti , * hidden_item ;
2000-12-27 12:48:27 +00:00
2011-03-22 00:38:55 +00:00
guint8 ls_type ;
guint16 ls_length ;
int end_offset ;
guint16 nr_links ;
guint16 nr_metric ;
1998-09-16 02:39:15 +00:00
2000-12-27 12:48:27 +00:00
/* router LSA */
2011-03-22 00:38:55 +00:00
guint8 link_type ;
guint16 link_counter ;
guint16 metric_counter ;
const char * metric_type_str ;
1998-09-16 02:39:15 +00:00
2000-12-27 12:48:27 +00:00
/* AS-external LSA */
2011-03-22 00:38:55 +00:00
guint8 options ;
1998-09-16 02:39:15 +00:00
2000-12-27 12:48:27 +00:00
/* opaque LSA */
2011-03-22 00:38:55 +00:00
guint8 ls_id_type ;
2011-12-02 23:42:52 +00:00
guint8 ls_ri_opaque_field ;
1998-09-16 02:39:15 +00:00
2014-06-17 05:57:31 +00:00
guint8 ls_length_constraints [ ] = { 0 , 24 , 28 , 28 , 28 , 36 , 20 , 36 , 20 , 20 , 20 , 20 } ;
2000-12-27 12:48:27 +00:00
ls_type = tvb_get_guint8 ( tvb , offset + 3 ) ;
ls_length = tvb_get_ntohs ( tvb , offset + 18 ) ;
end_offset = offset + ls_length ;
1998-09-16 02:39:15 +00:00
2000-12-27 12:48:27 +00:00
if ( disassemble_body ) {
2011-03-22 00:38:55 +00:00
ti = proto_tree_add_text ( tree , tvb , offset , ls_length ,
" LS Type: %s " ,
val_to_str ( ls_type , ls_type_vals , " Unknown (%d) " ) ) ;
2000-12-27 12:48:27 +00:00
} else {
2011-03-22 00:38:55 +00:00
ti = proto_tree_add_text ( tree , tvb , offset , OSPF_LSA_HEADER_LENGTH ,
" LSA Header " ) ;
2000-12-27 12:48:27 +00:00
}
ospf_lsa_tree = proto_item_add_subtree ( ti , ett_ospf_lsa ) ;
2014-04-29 02:31:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_AGE ] , tvb ,
offset , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_DONOTAGE ] , tvb ,
offset , 2 , ENC_BIG_ENDIAN ) ;
2009-09-09 15:06:38 +00:00
options = tvb_get_guint8 ( tvb , offset + 2 ) ;
2005-12-16 20:37:45 +00:00
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset + 2 , & bfinfo_v2_options ) ;
2009-10-27 06:05:02 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_TYPE ] , tvb ,
2011-10-19 15:04:44 +00:00
offset + 3 , 1 , ENC_BIG_ENDIAN ) ;
2009-05-05 08:48:18 +00:00
if ( ospf_ls_type_to_filter ( ls_type ) ! = - 1 ) {
hidden_item = proto_tree_add_item ( ospf_lsa_tree ,
2011-03-22 00:38:55 +00:00
hf_ospf_filter [ ospf_ls_type_to_filter ( ls_type ) ] , tvb ,
2012-05-08 02:41:15 +00:00
offset + 3 , 1 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
PROTO_ITEM_SET_HIDDEN ( hidden_item ) ;
2009-05-05 08:48:18 +00:00
}
2000-12-27 12:48:27 +00:00
2009-09-09 15:06:38 +00:00
if ( options & OSPF_V2_OPTIONS_MT ) {
metric_type_str = " MT-ID " ;
} else {
metric_type_str = " TOS " ;
}
2000-12-27 12:48:27 +00:00
if ( is_opaque ( ls_type ) ) {
2011-03-22 00:38:55 +00:00
ls_id_type = tvb_get_guint8 ( tvb , offset + 4 ) ;
proto_tree_add_uint ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_OPAQUE_TYPE ] ,
tvb , offset + 4 , 1 , ls_id_type ) ;
switch ( ls_id_type ) {
case OSPF_LSA_MPLS_TE :
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_ls_id_te_lsa_reserved , tvb , offset + 5 , 1 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_MPLS_TE_INSTANCE ] ,
2011-10-19 15:04:44 +00:00
tvb , offset + 6 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
2011-12-02 23:42:52 +00:00
case OSPF_LSA_OPAQUE_RI :
2013-10-13 19:56:52 +00:00
ls_ri_opaque_field = tvb_get_guint8 ( tvb , offset + 5 ) ;
if ( ls_ri_opaque_field ! = 0 )
2011-12-02 23:42:52 +00:00
ls_id_type = OSPF_LSA_UNKNOWN ;
else
2013-10-13 19:56:52 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_OPAQUE_LSA_MBZ ] ,
2011-12-02 23:42:52 +00:00
tvb , offset + 5 , 3 , ENC_BIG_ENDIAN ) ;
break ;
2011-03-22 00:38:55 +00:00
default :
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_ls_id_opaque_id , tvb , offset + 5 , 3 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
break ;
}
2000-12-27 12:48:27 +00:00
} else {
2011-03-22 00:38:55 +00:00
ls_id_type = 0 ;
2014-04-29 02:31:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_ID ] , tvb ,
offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2000-12-27 12:48:27 +00:00
}
2009-10-27 06:05:02 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_ADV_ROUTER ] ,
2011-10-19 15:04:44 +00:00
tvb , offset + 8 , 4 , ENC_BIG_ENDIAN ) ;
2014-04-29 02:31:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_SEQNUM ] , tvb ,
offset + 12 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_CHKSUM ] , tvb ,
offset + 16 , 2 , ENC_BIG_ENDIAN ) ;
2014-06-17 05:57:31 +00:00
ti = proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_LENGTH ] , tvb ,
2014-04-29 02:31:57 +00:00
offset + 18 , 2 , ENC_BIG_ENDIAN ) ;
2000-12-27 12:48:27 +00:00
2014-06-17 05:57:31 +00:00
if ( ls_type & & ls_type < = OSPF_LSTYPE_OP_ASWIDE ) {
if ( ls_length < ls_length_constraints [ ls_type ] ) {
expert_add_info_format ( pinfo , ti , & ei_ospf_lsa_bad_length , " Invalid LSA length (%u) for type %s, expected >= (%u) " ,
ls_length , val_to_str_const ( ls_type , ls_type_vals , " Unknown " ) , ls_length_constraints [ ls_type ] ) ;
return - 1 ;
}
} else if ( ls_length < 20 ) { /* As type is unknown, we check for a minimum length of 20 */
expert_add_info_format ( pinfo , ti , & ei_ospf_lsa_bad_length , " Invalid LSA length (%u) for unknown LSA type (%u), expected minimum of (20) " , ls_length , ls_type ) ;
return - 1 ;
}
2000-12-27 12:48:27 +00:00
/* skip past the LSA header to the body */
offset + = OSPF_LSA_HEADER_LENGTH ;
2002-05-11 22:22:11 +00:00
if ( ls_length < = OSPF_LSA_HEADER_LENGTH )
2011-03-22 00:38:55 +00:00
return offset ; /* no data, or bogus length */
2000-12-27 12:48:27 +00:00
ls_length - = OSPF_LSA_HEADER_LENGTH ;
if ( ! disassemble_body )
2011-03-22 00:38:55 +00:00
return offset ;
2000-12-27 12:48:27 +00:00
switch ( ls_type ) {
case OSPF_LSTYPE_ROUTER :
2011-03-22 00:38:55 +00:00
/* flags field in an router-lsa */
if ( options & OSPF_V2_OPTIONS_MT ) {
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset , & bfinfo_v2_router_lsa_mt_flags ) ;
} else {
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset , & bfinfo_v2_router_lsa_flags ) ;
}
nr_links = tvb_get_ntohs ( tvb , offset + 2 ) ;
2014-06-25 19:27:55 +00:00
/* ti =*/ proto_tree_add_item ( ospf_lsa_tree , hf_ospf_lsa_number_of_links , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
2014-06-17 05:57:31 +00:00
/* This constraint (>=0) makes no sense
* if ( nr_links < 0 ) {
* expert_add_info_format ( pinfo , ti , & ei_ospf_lsa_constraint_missing , " (>= 0 link descriptors required " ) ;
* break ;
* }
*/
2011-03-22 00:38:55 +00:00
/* nr_links links follow
* maybe we should put each of the links into its own subtree ? ? ?
*/
2012-10-11 19:39:32 +00:00
for ( link_counter = 0 ; link_counter < nr_links ; link_counter + + ) {
2002-11-27 19:10:51 +00:00
proto_tree * ospf_lsa_router_link_tree ;
proto_item * ti_local ;
2014-04-28 02:02:54 +00:00
proto_item * ti_item ;
2002-11-27 19:10:51 +00:00
2011-03-22 00:38:55 +00:00
/* check the Link Type and ID */
link_type = tvb_get_guint8 ( tvb , offset + 8 ) ;
nr_metric = tvb_get_guint8 ( tvb , offset + 9 ) ;
2002-11-27 19:10:51 +00:00
2009-09-09 15:06:38 +00:00
ti_local = proto_tree_add_text ( ospf_lsa_tree , tvb , offset , 12 + 4 * nr_metric ,
2011-03-22 00:38:55 +00:00
" Type: %-8s ID: %-15s Data: %-15s Metric: %d " ,
2014-06-15 12:27:57 +00:00
val_to_str_const ( link_type , ospf_v3_lsa_type_short_vals , " Unknown " ) ,
2011-03-22 00:38:55 +00:00
tvb_ip_to_str ( tvb , offset ) ,
tvb_ip_to_str ( tvb , offset + 4 ) ,
tvb_get_ntohs ( tvb , offset + 10 ) ) ;
2002-11-27 19:10:51 +00:00
ospf_lsa_router_link_tree = proto_item_add_subtree ( ti_local , ett_ospf_lsa_router_link ) ;
2014-04-28 02:02:54 +00:00
ti_item = proto_tree_add_item ( ospf_lsa_router_link_tree , hf_ospf_filter [ OSPFF_LS_ROUTER_LINKID ] ,
tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2014-06-15 12:27:57 +00:00
proto_item_append_text ( ti_item , " - %s " , val_to_str_const ( link_type , ospf_v3_lsa_link_id_vals , " Unknown link ID " ) ) ;
2011-03-22 00:38:55 +00:00
/* link_data should be specified in detail (e.g. network mask) (depends on link type)*/
2014-04-29 02:31:57 +00:00
proto_tree_add_item ( ospf_lsa_router_link_tree , hf_ospf_filter [ OSPFF_LS_ROUTER_LINKDATA ] ,
2014-04-28 02:02:54 +00:00
tvb , offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
ti_item = proto_tree_add_item ( ospf_lsa_router_link_tree , hf_ospf_filter [ OSPFF_LS_ROUTER_LINKTYPE ] ,
tvb , offset + 8 , 1 , ENC_BIG_ENDIAN ) ;
2014-06-15 12:27:57 +00:00
proto_item_append_text ( ti_item , " - %s " , val_to_str_const ( link_type , ospf_v3_lsa_type_vals , " Unknown link type " ) ) ;
2011-03-22 00:38:55 +00:00
2014-04-29 02:31:57 +00:00
ti_item = proto_tree_add_item ( ospf_lsa_router_link_tree , hf_ospf_filter [ OSPFF_LS_ROUTER_NUMMETRICS ] ,
tvb , offset + 9 , 1 , ENC_BIG_ENDIAN ) ;
proto_item_append_text ( ti_item , " - %s " , metric_type_str ) ;
proto_tree_add_item ( ospf_lsa_router_link_tree , hf_ospf_filter [ OSPFF_LS_ROUTER_METRIC0 ] ,
tvb , offset + 10 , 2 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 12 ;
/* nr_metric metrics may follow each link
* According to RFC4915 the TOS metrics was never deployed and was subsequently deprecated ,
* but decoding still present because MT - ID use the same structure .
*/
2012-10-11 19:39:32 +00:00
for ( metric_counter = 0 ; metric_counter < nr_metric ; metric_counter + + ) {
2011-03-22 00:38:55 +00:00
proto_tree_add_text ( ospf_lsa_router_link_tree , tvb , offset , 4 , " %s: %u, Metric: %u " ,
metric_type_str ,
tvb_get_guint8 ( tvb , offset ) ,
tvb_get_ntohs ( tvb , offset + 2 ) ) ;
offset + = 4 ;
}
}
break ;
1998-09-16 02:39:15 +00:00
2000-12-27 12:48:27 +00:00
case OSPF_LSTYPE_NETWORK :
2014-04-29 02:31:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_NETWORK_NETMASK ] ,
tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
2000-03-09 18:31:51 +00:00
2014-06-17 05:57:31 +00:00
if ( offset = = end_offset )
proto_tree_add_expert_format ( ospf_lsa_tree , pinfo , & ei_ospf_lsa_constraint_missing , tvb , offset - 4 , 4 , " (>= 1 router-IDs required " ) ;
2011-03-22 00:38:55 +00:00
while ( offset < end_offset ) {
2014-04-29 02:31:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_NETWORK_ATTACHRTR ] ,
tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
}
break ;
2000-12-27 12:48:27 +00:00
2014-06-17 05:57:31 +00:00
case OSPF_LSTYPE_SUMMARY :
2011-03-22 00:38:55 +00:00
/* Type 3 and 4 LSAs have the same format */
2000-12-27 12:48:27 +00:00
case OSPF_LSTYPE_ASBR :
2014-04-29 02:31:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_ASBR_NETMASK ] ,
tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
2014-06-17 05:57:31 +00:00
ti = proto_tree_add_uint ( ospf_lsa_tree , hf_ospf_metric , tvb , offset , 4 ,
2011-03-22 00:38:55 +00:00
tvb_get_ntoh24 ( tvb , offset + 1 ) ) ;
offset + = 4 ;
2014-06-17 05:57:31 +00:00
if ( offset = = end_offset )
expert_add_info_format ( pinfo , ti , & ei_ospf_lsa_constraint_missing , " (>= 1 TOS metric blocks required " ) ;
2011-03-22 00:38:55 +00:00
/* Metric specific information, if any */
while ( offset < end_offset ) {
proto_tree_add_text ( ospf_lsa_tree , tvb , offset , 4 , " %s: %u, Metric: %u " ,
metric_type_str ,
tvb_get_guint8 ( tvb , offset ) ,
tvb_get_ntoh24 ( tvb , offset + 1 ) ) ;
offset + = 4 ;
}
break ;
2000-12-27 12:48:27 +00:00
case OSPF_LSTYPE_ASEXT :
case OSPF_LSTYPE_ASEXT7 :
2014-04-29 02:31:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_ASEXT_NETMASK ] ,
tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_lsa_external_type , tvb , offset , 1 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
/* the metric field of a AS-external LAS is specified in 3 bytes */
2014-06-17 05:57:31 +00:00
ti = proto_tree_add_item ( ospf_lsa_tree , hf_ospf_metric , tvb , offset + 1 , 3 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
2014-04-29 02:31:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_ASEXT_FWDADDR ] ,
tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
2014-04-29 02:31:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_ASEXT_EXTRTRTAG ] ,
tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
2014-06-17 05:57:31 +00:00
if ( offset = = end_offset )
expert_add_info_format ( pinfo , ti , & ei_ospf_lsa_constraint_missing , " (>= 1 TOS forwarding blocks required " ) ;
2011-03-22 00:38:55 +00:00
/* Metric specific information, if any */
while ( offset < end_offset ) {
options = tvb_get_guint8 ( tvb , offset ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_lsa_external_type , tvb , offset , 1 , ENC_NA ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_text ( ospf_lsa_tree , tvb , offset , 4 , " %s: %u, Metric: %u " ,
metric_type_str , options & 0x7F ,
tvb_get_ntoh24 ( tvb , offset + 1 ) ) ;
offset + = 4 ;
2014-04-29 02:31:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_ASEXT_FWDADDR ] ,
tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
2014-04-29 02:31:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_ASEXT_EXTRTRTAG ] ,
tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
}
break ;
2000-12-27 12:48:27 +00:00
case OSPF_LSTYPE_OP_LINKLOCAL :
case OSPF_LSTYPE_OP_AREALOCAL :
case OSPF_LSTYPE_OP_ASWIDE :
2011-03-22 00:38:55 +00:00
/*
* RFC 2370 opaque LSAs .
*/
2014-06-15 12:27:57 +00:00
dissect_ospf_lsa_opaque ( tvb , pinfo , offset , ospf_lsa_tree , ls_id_type ,
2011-03-22 00:38:55 +00:00
ls_length ) ;
offset + = ls_length ;
break ;
2000-12-27 12:48:27 +00:00
default :
2011-03-22 00:38:55 +00:00
/* unknown LSA type */
proto_tree_add_text ( ospf_lsa_tree , tvb , offset , ls_length ,
" Unknown LSA Type " ) ;
offset + = ls_length ;
break ;
2000-12-27 12:48:27 +00:00
}
/* return the offset of the next LSA */
return offset ;
}
2001-09-05 19:53:42 +00:00
static int
2014-06-15 12:27:57 +00:00
dissect_ospf_v3_lsa ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * tree ,
2008-08-14 06:00:09 +00:00
gboolean disassemble_body , guint8 address_family )
2001-09-05 19:53:42 +00:00
{
proto_tree * ospf_lsa_tree ;
2012-09-01 07:42:07 +00:00
proto_item * ti , * hidden_item ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
guint16 ls_type ;
guint16 ls_length ;
int end_offset ;
2001-09-05 19:53:42 +00:00
guint8 reserved ;
/* router LSA */
guint32 number_prefixes ;
guint8 prefix_length ;
guint16 reserved16 ;
guint16 referenced_ls_type ;
guint8 flags ;
ls_type = tvb_get_ntohs ( tvb , offset + 2 ) ;
ls_length = tvb_get_ntohs ( tvb , offset + 18 ) ;
end_offset = offset + ls_length ;
if ( disassemble_body ) {
2011-03-22 00:38:55 +00:00
ti = proto_tree_add_text ( tree , tvb , offset , ls_length ,
2012-08-10 22:55:02 +00:00
" %s (Type: 0x%04x) " , val_to_str_const ( ls_type , v3_ls_type_vals , " Unknown " ) , ls_type ) ;
2001-09-05 19:53:42 +00:00
} else {
2011-03-22 00:38:55 +00:00
ti = proto_tree_add_text ( tree , tvb , offset , OSPF_LSA_HEADER_LENGTH ,
" LSA Header " ) ;
2001-09-05 19:53:42 +00:00
}
ospf_lsa_tree = proto_item_add_subtree ( ti , ett_ospf_lsa ) ;
proto_tree_add_text ( ospf_lsa_tree , tvb , offset , 2 , " LS Age: %u seconds " ,
2011-03-22 00:38:55 +00:00
tvb_get_ntohs ( tvb , offset ) & ~ OSPF_DNA_LSA ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_do_not_age , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
2012-09-01 07:42:07 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_V3_LS_TYPE ] , tvb ,
offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
if ( ospf_v3_ls_type_to_filter ( ls_type ) ! = - 1 ) {
hidden_item = proto_tree_add_item ( ospf_lsa_tree ,
hf_ospf_filter [ ospf_v3_ls_type_to_filter ( ls_type ) ] , tvb ,
offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_HIDDEN ( hidden_item ) ;
}
2001-09-05 19:53:42 +00:00
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_link_state_id , tvb , offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
2009-10-27 06:05:02 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_ADV_ROUTER ] ,
2011-10-19 15:04:44 +00:00
tvb , offset + 8 , 4 , ENC_BIG_ENDIAN ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_SEQNUM ] , tvb ,
offset + 12 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_CHKSUM ] , tvb ,
offset + 16 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_filter [ OSPFF_LS_LENGTH ] , tvb ,
offset + 18 , 2 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
/* skip past the LSA header to the body */
offset + = OSPF_LSA_HEADER_LENGTH ;
ls_length - = OSPF_LSA_HEADER_LENGTH ;
if ( ! disassemble_body )
2011-03-22 00:38:55 +00:00
return offset ;
2001-09-05 19:53:42 +00:00
switch ( ls_type ) {
case OSPF_V3_LSTYPE_ROUTER :
2011-03-22 00:38:55 +00:00
/* flags field in an router-lsa */
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset , & bfinfo_v3_router_lsa_flags ) ;
2001-09-05 19:53:42 +00:00
/* options field in an router-lsa */
2005-12-16 20:37:45 +00:00
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset + 1 , & bfinfo_v3_options ) ;
2001-09-05 19:53:42 +00:00
/* skip the router-lsa flags and options */
offset + = 4 ;
ls_length - = 4 ;
if ( ls_length > 0 )
2011-03-22 00:38:55 +00:00
proto_tree_add_text ( ospf_lsa_tree , tvb , offset , ls_length ,
" Router Interfaces: " ) ;
2001-09-05 19:53:42 +00:00
/* scan all router-lsa router interfaces */
2011-03-22 00:38:55 +00:00
/* maybe we should put each of the links into its own subtree ??? */
2001-09-05 19:53:42 +00:00
while ( ls_length > 0 ) {
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_type , tvb , offset , 1 , ENC_NA ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* reserved field */
reserved = tvb_get_guint8 ( tvb , offset + 1 ) ;
2014-06-15 12:27:57 +00:00
ti = proto_tree_add_item ( ospf_lsa_tree , hf_ospf_header_reserved , tvb , offset + 1 , 1 , ENC_NA ) ;
if ( reserved ! = 0 )
expert_add_info ( pinfo , ti , & ei_ospf_header_reserved ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* metric */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_metric , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* Interface ID */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_interface_id , tvb , offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* Neighbor Interface ID */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_neighbor_interface_id , tvb , offset + 8 , 4 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* Neighbor Router ID */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_neighbor_router_id , tvb , offset + 12 , 4 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
/* skip to the (possible) next entry */
offset + = 16 ;
ls_length - = 16 ;
}
2011-03-22 00:38:55 +00:00
break ;
2001-09-05 19:53:42 +00:00
case OSPF_V3_LSTYPE_NETWORK :
2011-03-22 00:38:55 +00:00
/* reserved field */
reserved = tvb_get_guint8 ( tvb , offset ) ;
2014-06-15 12:27:57 +00:00
ti = proto_tree_add_item ( ospf_lsa_tree , hf_ospf_header_reserved , tvb , offset , 1 , ENC_NA ) ;
if ( reserved ! = 0 )
expert_add_info ( pinfo , ti , & ei_ospf_header_reserved ) ;
2001-09-05 19:53:42 +00:00
/* options field in an network-lsa */
2011-03-22 00:38:55 +00:00
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset + 1 , & bfinfo_v3_options ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
offset + = 4 ;
2001-09-05 19:53:42 +00:00
ls_length - = 4 ;
2011-03-22 00:38:55 +00:00
while ( ls_length > 0 ) {
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_attached_router , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
ls_length - = 4 ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
}
break ;
2001-09-05 19:53:42 +00:00
case OSPF_V3_LSTYPE_INTER_AREA_PREFIX :
2011-03-22 00:38:55 +00:00
/* reserved field */
reserved = tvb_get_guint8 ( tvb , offset ) ;
2014-06-15 12:27:57 +00:00
ti = proto_tree_add_item ( ospf_lsa_tree , hf_ospf_header_reserved , tvb , offset , 1 , ENC_NA ) ;
if ( reserved ! = 0 )
expert_add_info ( pinfo , ti , & ei_ospf_header_reserved ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* metric */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_metric , tvb , offset + 1 , 3 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* prefix length */
prefix_length = tvb_get_guint8 ( tvb , offset + 4 ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_prefix_length , tvb , offset + 4 , 1 , ENC_NA ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* prefix options */
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset + 5 , & bfinfo_v3_prefix_options ) ;
2001-09-05 19:53:42 +00:00
/* 16 bits reserved */
2011-03-22 00:38:55 +00:00
reserved16 = tvb_get_ntohs ( tvb , offset + 6 ) ;
2014-06-15 12:27:57 +00:00
ti = proto_tree_add_item ( ospf_lsa_tree , hf_ospf_header_reserved , tvb , offset + 6 , 2 , ENC_NA ) ;
if ( reserved16 ! = 0 )
expert_add_info ( pinfo , ti , & ei_ospf_header_reserved ) ;
2001-09-05 19:53:42 +00:00
offset + = 8 ;
/* address_prefix */
2008-08-14 06:00:09 +00:00
dissect_ospf_v3_address_prefix ( tvb , offset , prefix_length , ospf_lsa_tree , address_family ) ;
2001-09-05 19:53:42 +00:00
offset + = ( prefix_length + 31 ) / 32 * 4 ;
break ;
case OSPF_V3_LSTYPE_INTER_AREA_ROUTER :
2011-03-22 00:38:55 +00:00
/* reserved field */
reserved = tvb_get_guint8 ( tvb , offset ) ;
2014-06-15 12:27:57 +00:00
ti = proto_tree_add_item ( ospf_lsa_tree , hf_ospf_header_reserved , tvb , offset , 1 , ENC_NA ) ;
if ( reserved ! = 0 )
expert_add_info ( pinfo , ti , & ei_ospf_header_reserved ) ;
2001-09-05 19:53:42 +00:00
/* options field in an inter-area-router-lsa */
2011-03-22 00:38:55 +00:00
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset + 1 , & bfinfo_v3_options ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* reserved field */
reserved = tvb_get_guint8 ( tvb , offset + 4 ) ;
2014-06-15 12:27:57 +00:00
ti = proto_tree_add_item ( ospf_lsa_tree , hf_ospf_header_reserved , tvb , offset + 4 , 1 , ENC_NA ) ;
if ( reserved ! = 0 )
expert_add_info ( pinfo , ti , & ei_ospf_header_reserved ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* metric */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_metric , tvb , offset + 5 , 3 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* Destination Router ID */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_destination_router_id , tvb , offset + 8 , 4 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
offset + = 12 ;
break ;
2001-09-05 19:53:42 +00:00
2012-09-01 07:42:07 +00:00
case OSPF_V3_LSTYPE_NSSA :
2001-09-05 19:53:42 +00:00
case OSPF_V3_LSTYPE_AS_EXTERNAL :
/* flags */
2005-12-16 20:37:45 +00:00
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset , & bfinfo_v3_as_external_flags ) ;
2001-09-05 19:53:42 +00:00
flags = tvb_get_guint8 ( tvb , offset ) ;
2002-08-28 21:04:11 +00:00
2011-03-22 00:38:55 +00:00
/* 24 bits metric */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_metric , tvb , offset + 1 , 3 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* prefix length */
prefix_length = tvb_get_guint8 ( tvb , offset + 4 ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_prefix_length , tvb , offset + 4 , 1 , ENC_NA ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* prefix options */
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset + 5 , & bfinfo_v3_prefix_options ) ;
2001-09-05 19:53:42 +00:00
/* referenced LS type */
referenced_ls_type = tvb_get_ntohs ( tvb , offset + 6 ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_referenced_ls_type , tvb , offset + 6 , 2 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
offset + = 8 ;
/* address_prefix */
2008-08-14 06:00:09 +00:00
dissect_ospf_v3_address_prefix ( tvb , offset , prefix_length , ospf_lsa_tree , address_family ) ;
2002-08-28 21:04:11 +00:00
2001-09-05 19:53:42 +00:00
offset + = ( prefix_length + 31 ) / 32 * 4 ;
/* Forwarding Address (optional - only if F-flag is on) */
2001-09-13 20:27:24 +00:00
if ( ( offset < end_offset ) & & ( flags & OSPF_V3_AS_EXTERNAL_FLAG_F ) ) {
2008-08-14 06:00:09 +00:00
if ( address_family = = OSPF_AF_6 ) {
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_forwarding_address_ipv6 , tvb , offset , 16 , ENC_NA ) ;
2008-08-14 06:00:09 +00:00
} else {
proto_tree_add_text ( ospf_lsa_tree , tvb , offset , 16 , " Forwarding Address: %s " ,
2011-01-14 03:44:58 +00:00
tvb_ip_to_str ( tvb , offset ) ) ;
2008-08-14 06:00:09 +00:00
}
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
offset + = 16 ;
2001-09-05 19:53:42 +00:00
}
/* External Route Tag (optional - only if T-flag is on) */
2001-09-13 20:27:24 +00:00
if ( ( offset < end_offset ) & & ( flags & OSPF_V3_AS_EXTERNAL_FLAG_T ) ) {
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_external_route_tag , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
2001-09-05 19:53:42 +00:00
}
/* Referenced Link State ID (optional - only if Referenced LS type is non-zero */
if ( ( offset < end_offset ) & & ( referenced_ls_type ! = 0 ) ) {
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_referenced_link_state_id , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2011-03-22 00:38:55 +00:00
offset + = 4 ;
2001-09-05 19:53:42 +00:00
}
break ;
case OSPF_V3_LSTYPE_LINK :
/* router priority */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_router_priority , tvb , offset , 1 , ENC_NA ) ;
2001-09-05 19:53:42 +00:00
/* options field in an link-lsa */
2011-03-22 00:38:55 +00:00
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset + 1 , & bfinfo_v3_options ) ;
2001-09-05 19:53:42 +00:00
/* Link-local Interface Address */
2008-08-14 06:00:09 +00:00
if ( address_family = = OSPF_AF_6 ) {
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_link_local_interface_address , tvb , offset + 4 , 16 , ENC_NA ) ;
2008-08-14 06:00:09 +00:00
} else {
proto_tree_add_text ( ospf_lsa_tree , tvb , offset + 4 , 16 , " Link-local Interface Address: %s " ,
2011-01-14 03:44:58 +00:00
tvb_ip_to_str ( tvb , offset + 4 ) ) ;
2008-08-14 06:00:09 +00:00
}
2001-09-05 19:53:42 +00:00
/* Number prefixes */
number_prefixes = tvb_get_ntohl ( tvb , offset + 20 ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_text ( ospf_lsa_tree , tvb , offset + 20 , 4 , " # prefixes: %d " , number_prefixes ) ;
2001-09-05 19:53:42 +00:00
offset + = 24 ;
while ( number_prefixes > 0 ) {
2011-03-22 00:38:55 +00:00
/* prefix length */
prefix_length = tvb_get_guint8 ( tvb , offset ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_prefix_length , tvb , offset , 1 , ENC_NA ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* prefix options */
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset + 1 , & bfinfo_v3_prefix_options ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* 16 bits reserved */
reserved16 = tvb_get_ntohs ( tvb , offset + 2 ) ;
2014-06-15 12:27:57 +00:00
ti = proto_tree_add_item ( ospf_lsa_tree , hf_ospf_header_reserved , tvb , offset + 2 , 2 , ENC_NA ) ;
if ( reserved16 ! = 0 )
expert_add_info ( pinfo , ti , & ei_ospf_header_reserved ) ;
2001-09-05 19:53:42 +00:00
offset + = 4 ;
/* address_prefix */
2008-08-14 06:00:09 +00:00
dissect_ospf_v3_address_prefix ( tvb , offset , prefix_length , ospf_lsa_tree , address_family ) ;
2002-08-28 21:04:11 +00:00
2001-09-05 19:53:42 +00:00
offset + = ( prefix_length + 31 ) / 32 * 4 ;
number_prefixes - - ;
2002-08-28 21:04:11 +00:00
}
2001-09-05 19:53:42 +00:00
break ;
case OSPF_V3_LSTYPE_INTRA_AREA_PREFIX :
/* # prefixes */
number_prefixes = tvb_get_ntohs ( tvb , offset ) ;
2011-03-22 00:38:55 +00:00
proto_tree_add_text ( ospf_lsa_tree , tvb , offset , 2 , " # prefixes: %u " , number_prefixes ) ;
2001-09-05 19:53:42 +00:00
/* referenced LS type */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_referenced_ls_type , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
/* Referenced Link State ID */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_v3_lsa_referenced_link_state_id , tvb , offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
/* Referenced Advertising Router */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_referenced_advertising_router , tvb , offset + 8 , 4 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
offset + = 12 ;
while ( number_prefixes > 0 ) {
2011-03-22 00:38:55 +00:00
/* prefix length */
prefix_length = tvb_get_guint8 ( tvb , offset ) ;
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_prefix_length , tvb , offset , 1 , ENC_NA ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* prefix options */
dissect_ospf_bitfield ( ospf_lsa_tree , tvb , offset + 1 , & bfinfo_v3_prefix_options ) ;
2001-09-05 19:53:42 +00:00
2011-03-22 00:38:55 +00:00
/* 16 bits metric */
2014-06-15 12:27:57 +00:00
proto_tree_add_item ( ospf_lsa_tree , hf_ospf_metric , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2001-09-05 19:53:42 +00:00
offset + = 4 ;
/* address_prefix */
2008-08-14 06:00:09 +00:00
dissect_ospf_v3_address_prefix ( tvb , offset , prefix_length , ospf_lsa_tree , address_family ) ;
2002-08-28 21:04:11 +00:00
2001-09-05 19:53:42 +00:00
offset + = ( prefix_length + 31 ) / 32 * 4 ;
number_prefixes - - ;
}
break ;
2011-12-02 23:42:52 +00:00
case OSPF_V3_LSTYPE_OPAQUE_RI :
dissect_ospf_lsa_opaque_ri ( tvb , offset , ospf_lsa_tree , ls_length ) ;
break ;
2001-09-05 19:53:42 +00:00
default :
2011-03-22 00:38:55 +00:00
/* unknown LSA type */
proto_tree_add_text ( ospf_lsa_tree , tvb , offset , ls_length ,
" Unknown LSA Type 0x%04x " , ls_type ) ;
offset + = ls_length ;
break ;
2001-09-05 19:53:42 +00:00
}
/* return the offset of the next LSA */
return offset ;
}
2008-08-14 06:00:09 +00:00
static void dissect_ospf_v3_address_prefix ( tvbuff_t * tvb , int offset , int prefix_length , proto_tree * tree ,
guint8 address_family )
2001-09-05 19:53:42 +00:00
{
2005-11-15 10:56:18 +00:00
int bytes_to_process ;
struct e_in6_addr prefix ;
2001-09-05 19:53:42 +00:00
bytes_to_process = ( ( prefix_length + 31 ) / 32 ) * 4 ;
2005-11-15 10:56:18 +00:00
if ( prefix_length > 128 ) {
proto_tree_add_text ( tree , tvb , offset , bytes_to_process ,
" Address Prefix: length is invalid (%d, should be <= 128) " ,
prefix_length ) ;
return ;
2001-07-08 22:59:51 +00:00
}
2000-12-27 12:48:27 +00:00
2005-11-15 10:56:18 +00:00
memset ( prefix . bytes , 0 , sizeof prefix . bytes ) ;
if ( bytes_to_process ! = 0 ) {
tvb_memcpy ( tvb , prefix . bytes , offset , bytes_to_process ) ;
if ( prefix_length % 8 ) {
prefix . bytes [ bytes_to_process - 1 ] & =
( ( 0xff00 > > ( prefix_length % 8 ) ) & 0xff ) ;
}
}
2008-08-14 06:00:09 +00:00
if ( address_family = = OSPF_AF_6 ) {
proto_tree_add_text ( tree , tvb , offset , bytes_to_process ,
2009-09-10 02:15:55 +00:00
" Address Prefix: %s " , ip6_to_str ( & prefix ) ) ;
2008-08-14 06:00:09 +00:00
} else {
proto_tree_add_text ( tree , tvb , offset , bytes_to_process ,
2011-01-14 03:44:58 +00:00
" Address Prefix: %s " , tvb_ip_to_str ( tvb , offset ) ) ;
2008-08-14 06:00:09 +00:00
}
2001-09-05 19:53:42 +00:00
1998-09-16 02:39:15 +00:00
}
1999-07-29 05:47:07 +00:00
2001-09-05 19:53:42 +00:00
1999-07-29 05:47:07 +00:00
void
proto_register_ospf ( void )
{
2011-03-22 00:38:55 +00:00
static hf_register_info ospff_info [ ] = {
2014-04-09 07:52:03 +00:00
{ & hf_ospf_header ,
{ " OSPF Header " , " ospf.header " , FT_NONE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_header_version ,
{ " Version " , " ospf.version " , FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
/* Message type number */
2014-04-09 07:52:03 +00:00
{ & hf_ospf_header_msg_type ,
2011-03-22 00:38:55 +00:00
{ " Message Type " , " ospf.msg " , FT_UINT8 , BASE_DEC , VALS ( pt_vals ) , 0x0 ,
NULL , HFILL } } ,
2014-04-09 07:52:03 +00:00
{ & hf_ospf_header_packet_length ,
{ " Packet Length " , " ospf.packet_length " , FT_UINT16 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_header_src_router ,
{ " Source OSPF Router " , " ospf.srcrouter " , FT_IPv4 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_header_area_id ,
{ " Area ID " , " ospf.area_id " , FT_IPv4 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_header_checksum ,
{ " Checksum " , " ospf.checksum " , FT_UINT16 , BASE_HEX , NULL , 0x0 ,
NULL , HFILL } } ,
2014-06-15 12:27:57 +00:00
{ & hf_ospf_tlv_type ,
{ " TLV Type " , " ospf.tlv_type " , FT_UINT16 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_tlv_length ,
{ " TLV Length " , " ospf.tlv_length " , FT_UINT16 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL } } ,
2014-04-09 07:52:03 +00:00
/* OSPF Header v2 (Auth) */
{ & hf_ospf_header_auth_type ,
{ " Auth Type " , " ospf.auth.type " , FT_UINT16 , BASE_DEC , VALS ( auth_vals ) , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_header_auth_data_none ,
{ " Auth Data (none) " , " ospf.auth.none " , FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_header_auth_data_simple ,
{ " Auth Data (Simple) " , " ospf.auth.simple " , FT_STRING , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_header_auth_crypt_key_id ,
{ " Auth Crypt Key id " , " ospf.auth.crypt.key_id " , FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_header_auth_crypt_data_length ,
{ " Auth Crypt Data Length " , " ospf.auth.crypt.data_length " , FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_header_auth_crypt_seq_nbr ,
{ " Auth Crypt Sequence Number " , " ospf.auth.crypt.seq_nbr " , FT_UINT32 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_header_auth_crypt_data ,
{ " Auth Crypt Data " , " ospf.auth.crypt.data " , FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_header_auth_data_unknown ,
{ " Auth Unknown " , " ospf.auth.unknown " , FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
/* OSPF Header v3 */
{ & hf_ospf_header_instance_id ,
{ " Instance ID " , " ospf.instance_id " , FT_UINT8 , BASE_RANGE_STRING | BASE_DEC , RVALS ( ospf_instance_id_rvals ) , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_header_reserved ,
{ " Reserved " , " ospf.reserved " , FT_BYTES , BASE_NONE , NULL , 0x0 ,
" Must be zero " , HFILL } } ,
2011-03-22 00:38:55 +00:00
/* Message types */
{ & hf_ospf_filter [ OSPFF_MSG_HELLO ] ,
{ " Hello " , " ospf.msg.hello " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_MSG_DB_DESC ] ,
{ " Database Description " , " ospf.msg.dbdesc " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_MSG_LS_REQ ] ,
{ " Link State Adv Request " , " ospf.msg.lsreq " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_MSG_LS_UPD ] ,
{ " Link State Adv Update " , " ospf.msg.lsupdate " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_MSG_LS_ACK ] ,
{ " Link State Adv Acknowledgement " , " ospf.msg.lsack " , FT_BOOLEAN ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
2014-04-07 06:48:14 +00:00
/* Hello Packet */
{ & hf_ospf_hello ,
{ " OSPF Hello Packet " , " ospf.hello " , FT_NONE ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_hello_network_mask ,
{ " Network Mask " , " ospf.hello.network_mask " , FT_IPv4 ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_hello_interface_id ,
{ " Interface ID " , " ospf.hello.interface_id " , FT_UINT32 ,
BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_hello_hello_interval ,
{ " Hello Interval [sec] " , " ospf.hello.hello_interval " , FT_UINT32 ,
BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_hello_router_priority ,
{ " Router Priority " , " ospf.hello.router_priority " , FT_UINT8 ,
BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_hello_router_dead_interval ,
{ " Router Dead Interval [sec] " , " ospf.hello.router_dead_interval " , FT_UINT32 ,
BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_hello_designated_router ,
{ " Designated Router " , " ospf.hello.designated_router " , FT_IPv4 ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_hello_backup_designated_router ,
{ " Backup Designated Router " , " ospf.hello.backup_designated_router " , FT_IPv4 ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_hello_active_neighbor ,
{ " Active Neighbor " , " ospf.hello.active_neighbor " , FT_IPv4 ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
2014-04-28 06:59:17 +00:00
/* Authentication trailer */
{ & hf_ospf_at ,
{ " OSPF Authentication Trailer " , " ospf.at " , FT_NONE ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_at_auth_type ,
{ " Authentication Type " , " ospf.at.auth_type " , FT_UINT16 ,
BASE_DEC , VALS ( ospf_at_authentication_type_vals ) , 0x0 , " Identifying the type of authentication " , HFILL } } ,
{ & hf_ospf_at_auth_data_len ,
{ " Authentication Data Length " , " ospf.at.auth_data_len " , FT_UINT16 ,
BASE_DEC , NULL , 0x0 , " The length in octets of the Authentication Trailer (AT) including both the 16-octet fixed header and the variable length message digest " , HFILL } } ,
{ & hf_ospf_at_reserved ,
{ " Reserved " , " ospf.at.reserved " , FT_UINT16 ,
BASE_HEX , NULL , 0x0 , " It SHOULD be set to 0 " , HFILL } } ,
{ & hf_ospf_at_sa_id ,
{ " Security Association Identifier (SA ID) " , " ospf.at.sa_id " , FT_UINT16 ,
BASE_HEX , NULL , 0x0 , " That maps to the authentication algorithm and the secret key used to create the message digest " , HFILL } } ,
{ & hf_ospf_at_crypto_seq_nbr ,
{ " Cryptographic Sequence Number " , " ospf.at.cryto_seq_nbr " , FT_UINT64 ,
BASE_DEC , NULL , 0x0 , " Increasing sequence number that is used to guard against replay attacks " , HFILL } } ,
{ & hf_ospf_at_auth_data ,
{ " Authentication Data " , " ospf.at.auth_data " , FT_BYTES ,
BASE_NONE , NULL , 0x0 , " Variable data that is carrying the digest for the protocol packet and optional LLS data block " , HFILL } } ,
2011-03-22 00:38:55 +00:00
/* LS Types */
{ & hf_ospf_filter [ OSPFF_LS_TYPE ] ,
2012-09-01 07:42:07 +00:00
{ " LS Type " , " ospf.lsa " , FT_UINT8 , BASE_DEC ,
2011-03-22 00:38:55 +00:00
VALS ( ls_type_vals ) , 0x0 , NULL , HFILL } } ,
2014-04-29 02:31:57 +00:00
{ & hf_ospf_filter [ OSPFF_LS_AGE ] ,
{ " LS Age (seconds) " , " ospf.lsa.age " , FT_UINT16 ,
BASE_DEC , NULL , ~ OSPF_DNA_LSA , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_DONOTAGE ] ,
{ " Do Not Age Flag " , " ospf.lsa.donotage " , FT_UINT16 ,
BASE_DEC , NULL , OSPF_DNA_LSA , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_ID ] ,
{ " Link State ID " , " ospf.lsa.id " , FT_IPv4 ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_SEQNUM ] ,
{ " Sequence Number " , " ospf.lsa.seqnum " , FT_UINT32 ,
BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_CHKSUM ] ,
{ " Checksum " , " ospf.lsa.chksum " , FT_UINT16 ,
BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_LENGTH ] ,
{ " Length " , " ospf.lsa.length " , FT_UINT16 ,
BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_LS_OPAQUE_TYPE ] ,
{ " Link State ID Opaque Type " , " ospf.lsid_opaque_type " , FT_UINT8 , BASE_DEC ,
VALS ( ls_opaque_type_vals ) , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_MPLS_TE_INSTANCE ] ,
{ " Link State ID TE-LSA Instance " , " ospf.lsid_te_lsa.instance " , FT_UINT16 , BASE_DEC ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_ROUTER ] ,
{ " Router LSA " , " ospf.lsa.router " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
2014-04-28 02:02:54 +00:00
{ & hf_ospf_filter [ OSPFF_LS_ROUTER_LINKTYPE ] ,
{ " Link Type " , " ospf.lsa.router.linktype " , FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_ROUTER_LINKID ] ,
{ " Link ID " , " ospf.lsa.router.linkid " , FT_IPv4 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_ROUTER_LINKDATA ] ,
{ " Link Data " , " ospf.lsa.router.linkdata " , FT_IPv4 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
2014-04-29 02:31:57 +00:00
{ & hf_ospf_filter [ OSPFF_LS_ROUTER_NUMMETRICS ] ,
{ " Number of Metrics " , " ospf.lsa.router.nummetrics " , FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_ROUTER_METRIC0 ] ,
{ " 0 Metric " , " ospf.lsa.router.metric0 " , FT_UINT16 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL } } ,
2014-04-28 02:02:54 +00:00
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_LS_NETWORK ] ,
{ " Network LSA " , " ospf.lsa.network " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
2014-04-29 02:31:57 +00:00
{ & hf_ospf_filter [ OSPFF_LS_NETWORK_NETMASK ] ,
{ " Netmask " , " ospf.lsa.network.netmask " , FT_IPv4 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_NETWORK_ATTACHRTR ] ,
{ " Attached Router " , " ospf.lsa.network.attchrtr " , FT_IPv4 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_LS_SUMMARY ] ,
{ " Summary LSA (IP Network) " , " ospf.lsa.summary " , FT_BOOLEAN , BASE_NONE ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_ASBR ] ,
{ " Summary LSA (ASBR) " , " ospf.lsa.asbr " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
2014-04-29 02:31:57 +00:00
{ & hf_ospf_filter [ OSPFF_LS_ASBR_NETMASK ] ,
{ " Netmask " , " ospf.lsa.asbr.netmask " , FT_IPv4 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_LS_ASEXT ] ,
{ " AS-External LSA (ASBR) " , " ospf.lsa.asext " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
2014-04-29 02:31:57 +00:00
{ & hf_ospf_filter [ OSPFF_LS_ASEXT_NETMASK ] ,
{ " Netmask " , " ospf.lsa.asext.netmask " , FT_IPv4 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_ASEXT_FWDADDR ] ,
{ " Forwarding Address " , " ospf.lsa.asext.fwdaddr " , FT_IPv4 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_ASEXT_EXTRTRTAG ] ,
{ " External Route Tag " , " ospf.lsa.asext.extrttag " , FT_UINT32 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_LS_GRPMEMBER ] ,
{ " Group Membership LSA " , " ospf.lsa.member " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_ASEXT7 ] ,
{ " NSSA AS-External LSA " , " ospf.lsa.nssa " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_EXTATTR ] ,
{ " External Attributes LSA " , " ospf.lsa.attr " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_OPAQUE ] ,
{ " Opaque LSA " , " ospf.lsa.opaque " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
2012-09-01 07:42:07 +00:00
/* OSPFv3 LS Types */
{ & hf_ospf_filter [ OSPFF_V3_LS_TYPE ] ,
{ " LS Type " , " ospf.v3.lsa " , FT_UINT16 , BASE_HEX ,
VALS ( v3_ls_type_vals ) , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LS_ROUTER ] ,
{ " Router-LSA " , " ospf.v3.lsa.router " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LS_NETWORK ] ,
{ " Network-LSA " , " ospf.v3.lsa.network " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LS_INTER_AREA_PREFIX ] ,
{ " Inter-Area-Prefix-LSA " , " ospf.v3.lsa.interprefix " , FT_BOOLEAN , BASE_NONE ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LS_INTER_AREA_ROUTER ] ,
{ " Inter-Area-Router-LSA " , " ospf.v3.lsa.interrouter " , FT_BOOLEAN , BASE_NONE ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LS_AS_EXTERNAL ] ,
{ " AS-External-LSA " , " ospf.v3.lsa.asext " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LS_GROUP_MEMBERSHIP ] ,
{ " Group-Membership-LSA " , " ospf.v3.lsa.member " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LS_NSSA ] ,
{ " NSSA-LSA " , " ospf.v3.lsa.nssa " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LS_LINK ] ,
{ " Link-LSA " , " ospf.v3.lsa.link " , FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LS_INTRA_AREA_PREFIX ] ,
{ " Intra-Area-Prefix-LSA " , " ospf.v3.lsa.intraprefix " , FT_BOOLEAN , BASE_NONE ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LS_OPAQUE_RI ] ,
{ " Router Information Opaque-LSA " , " ospf.v3.lsa.opaque " , FT_BOOLEAN , BASE_NONE ,
NULL , 0x0 , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
/* Other interesting OSPF values */
{ & hf_ospf_filter [ OSPFF_ADV_ROUTER ] ,
{ " Advertising Router " , " ospf.advrouter " , FT_IPv4 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_MPLS ] ,
{ " MPLS Traffic Engineering LSA " , " ospf.lsa.mpls " , FT_BOOLEAN ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_MPLS_ROUTERID ] ,
{ " MPLS/TE Router ID " , " ospf.mpls.routerid " , FT_IPv4 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_MPLS_LINKTYPE ] ,
{ " MPLS/TE Link Type " , " ospf.mpls.linktype " , FT_UINT8 , BASE_DEC ,
VALS ( mpls_link_stlv_ltype_str ) , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_MPLS_LINKID ] ,
{ " MPLS/TE Link ID " , " ospf.mpls.linkid " , FT_IPv4 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_MPLS_LOCAL_ADDR ] ,
{ " MPLS/TE Local Interface Address " , " ospf.mpls.local_addr " , FT_IPv4 ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_MPLS_REMOTE_ADDR ] ,
{ " MPLS/TE Remote Interface Address " , " ospf.mpls.remote_addr " , FT_IPv4 ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_MPLS_LOCAL_IFID ] ,
{ " MPLS/TE Local Interface Index " , " ospf.mpls.local_id " , FT_UINT32 ,
BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_MPLS_REMOTE_IFID ] ,
{ " MPLS/TE Remote Interface Index " , " ospf.mpls.remote_id " , FT_UINT32 ,
BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_MPLS_LINKCOLOR ] ,
{ " MPLS/TE Link Resource Class/Color " , " ospf.mpls.linkcolor " , FT_UINT32 ,
BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_MPLS_BC_MODEL_ID ] ,
{ " MPLS/DSTE Bandwidth Constraints Model Id " , " ospf.mpls.bc " , FT_UINT8 ,
2012-05-19 19:05:36 +00:00
BASE_RANGE_STRING | BASE_DEC , RVALS ( mpls_link_stlv_bcmodel_rvals ) , 0x0 ,
2011-03-22 00:38:55 +00:00
NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_OIF_LOCAL_NODE_ID ] ,
{ " Local Node ID " , " ospf.oif.local_node_id " , FT_IPv4 ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LS_OIF_REMOTE_NODE_ID ] ,
{ " Remote Node ID " , " ospf.oif.remote_node_id " , FT_IPv4 ,
BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V2_OPTIONS ] ,
{ " Options " , " ospf.v2.options " , FT_UINT8 , BASE_HEX ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V2_OPTIONS_MT ] ,
2014-06-20 08:48:47 +00:00
{ " (MT) Multi-Topology Routing " , " ospf.v2.options.mt " , FT_BOOLEAN , 8 ,
TFS ( & tfs_yes_no ) , OSPF_V2_OPTIONS_MT , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V2_OPTIONS_E ] ,
2014-06-20 08:48:47 +00:00
{ " (E) External Routing " , " ospf.v2.options.e " , FT_BOOLEAN , 8 ,
TFS ( & tfs_capable_not_capable ) , OSPF_V2_OPTIONS_E , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V2_OPTIONS_MC ] ,
2014-06-20 08:48:47 +00:00
{ " (MC) Multicast " , " ospf.v2.options.mc " , FT_BOOLEAN , 8 ,
TFS ( & tfs_capable_not_capable ) , OSPF_V2_OPTIONS_MC , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V2_OPTIONS_NP ] ,
2014-06-20 08:48:47 +00:00
{ " (N) NSSA " , " ospf.v2.options.np " , FT_BOOLEAN , 8 ,
TFS ( & tfs_supported_not_supported ) , OSPF_V2_OPTIONS_NP , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V2_OPTIONS_L ] ,
2014-06-20 08:48:47 +00:00
{ " (L) LLS Data block " , " ospf.v2.options.l " , FT_BOOLEAN , 8 ,
TFS ( & tfs_present_not_present ) , OSPF_V2_OPTIONS_L , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V2_OPTIONS_DC ] ,
2014-06-20 08:48:47 +00:00
{ " (DC) Demand Circuits " , " ospf.v2.options.dc " , FT_BOOLEAN , 8 ,
TFS ( & tfs_supported_not_supported ) , OSPF_V2_OPTIONS_DC , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V2_OPTIONS_O ] ,
{ " O " , " ospf.v2.options.o " , FT_BOOLEAN , 8 ,
2014-04-07 05:49:38 +00:00
TFS ( & tfs_set_notset ) , OSPF_V2_OPTIONS_O , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V2_OPTIONS_DN ] ,
{ " DN " , " ospf.v2.options.dn " , FT_BOOLEAN , 8 ,
2014-04-07 05:49:38 +00:00
TFS ( & tfs_set_notset ) , OSPF_V2_OPTIONS_DN , NULL , HFILL } } ,
2011-12-02 23:42:52 +00:00
{ & hf_ospf_filter [ OSPFF_RI_OPTIONS ] ,
{ " RI Options " , " ospf.ri.options " , FT_UINT8 , BASE_HEX ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_RI_OPTIONS_GRC ] ,
2014-06-20 08:48:47 +00:00
{ " (GRC) Graceful Restart " , " ospf.ri.options.grc " , FT_BOOLEAN , 8 ,
TFS ( & tfs_capable_not_capable ) , OSPF_RI_OPTIONS_GRC , NULL , HFILL } } ,
2011-12-02 23:42:52 +00:00
{ & hf_ospf_filter [ OSPFF_RI_OPTIONS_GRH ] ,
2014-06-20 08:48:47 +00:00
{ " (GRH) Graceful Restart Helper " , " ospf.ri.options.grh " , FT_BOOLEAN , 8 ,
TFS ( & tfs_enabled_disabled ) , OSPF_RI_OPTIONS_GRH , NULL , HFILL } } ,
2011-12-02 23:42:52 +00:00
{ & hf_ospf_filter [ OSPFF_RI_OPTIONS_SRS ] ,
2014-06-20 08:48:47 +00:00
{ " Stub Router Support " , " ospf.ri.options.srs " , FT_BOOLEAN , 8 ,
TFS ( & tfs_yes_no ) , OSPF_RI_OPTIONS_SRS , NULL , HFILL } } ,
2011-12-02 23:42:52 +00:00
{ & hf_ospf_filter [ OSPFF_RI_OPTIONS_TES ] ,
2014-06-20 08:48:47 +00:00
{ " (TES) Traffic Engineering " , " ospf.ri.options.tes " , FT_BOOLEAN , 8 ,
TFS ( & tfs_supported_not_supported ) , OSPF_RI_OPTIONS_TES , NULL , HFILL } } ,
2011-12-02 23:42:52 +00:00
{ & hf_ospf_filter [ OSPFF_RI_OPTIONS_P2PLAN ] ,
2014-06-20 08:48:47 +00:00
{ " (P2PLAN) Point-to-point over LAN " , " ospf.ri.options.p2plan " , FT_BOOLEAN , 8 ,
TFS ( & tfs_capable_not_capable ) , OSPF_RI_OPTIONS_P2PLAN , NULL , HFILL } } ,
2011-12-02 23:42:52 +00:00
{ & hf_ospf_filter [ OSPFF_RI_OPTIONS_ETE ] ,
2014-06-20 08:48:47 +00:00
{ " (ETE) Experimental TE " , " ospf.ri.options.ete " , FT_BOOLEAN , 8 ,
TFS ( & tfs_capable_not_capable ) , OSPF_RI_OPTIONS_ETE , NULL , HFILL } } ,
2011-12-02 23:42:52 +00:00
/* An MBZ field for the 24-bits of type field of Opaque RI LSA */
{ & hf_ospf_filter [ OSPFF_OPAQUE_LSA_MBZ ] ,
2013-10-13 19:56:52 +00:00
{ " MBZ " , " ospf.ri.mbz " , FT_UINT16 , BASE_HEX ,
2011-12-02 23:42:52 +00:00
NULL , 0x0 , " OSPF Opaque RI LSA - 24 bits of Type Field Must be Zero " , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_OPTIONS ] ,
{ " Options " , " ospf.v3.options " , FT_UINT24 , BASE_HEX ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_OPTIONS_V6 ] ,
{ " V6 " , " ospf.v3.options.v6 " , FT_BOOLEAN , 24 ,
2014-04-07 05:49:38 +00:00
TFS ( & tfs_set_notset ) , OSPF_V3_OPTIONS_V6 , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_OPTIONS_E ] ,
{ " E " , " ospf.v3.options.e " , FT_BOOLEAN , 24 ,
2014-04-07 05:49:38 +00:00
TFS ( & tfs_set_notset ) , OSPF_V3_OPTIONS_E , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_OPTIONS_MC ] ,
{ " MC " , " ospf.v3.options.mc " , FT_BOOLEAN , 24 ,
2014-04-07 05:49:38 +00:00
TFS ( & tfs_set_notset ) , OSPF_V3_OPTIONS_MC , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_OPTIONS_N ] ,
{ " N " , " ospf.v3.options.n " , FT_BOOLEAN , 24 ,
2014-04-07 05:49:38 +00:00
TFS ( & tfs_set_notset ) , OSPF_V3_OPTIONS_N , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_OPTIONS_R ] ,
{ " R " , " ospf.v3.options.r " , FT_BOOLEAN , 24 ,
2014-04-07 05:49:38 +00:00
TFS ( & tfs_set_notset ) , OSPF_V3_OPTIONS_R , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_OPTIONS_DC ] ,
{ " DC " , " ospf.v3.options.dc " , FT_BOOLEAN , 24 ,
2014-04-07 05:49:38 +00:00
TFS ( & tfs_set_notset ) , OSPF_V3_OPTIONS_DC , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_OPTIONS_AF ] ,
{ " AF " , " ospf.v3.options.af " , FT_BOOLEAN , 24 ,
2014-04-07 05:49:38 +00:00
TFS ( & tfs_set_notset ) , OSPF_V3_OPTIONS_AF , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_OPTIONS_L ] ,
{ " L " , " ospf.v3.options.l " , FT_BOOLEAN , 24 ,
2014-04-07 05:49:38 +00:00
TFS ( & tfs_set_notset ) , OSPF_V3_OPTIONS_L , NULL , HFILL } } ,
2014-04-07 05:38:30 +00:00
{ & hf_ospf_filter [ OSPFF_V3_OPTIONS_AT ] ,
{ " AT " , " ospf.v3.options.at " , FT_BOOLEAN , 24 ,
2014-04-07 05:49:38 +00:00
TFS ( & tfs_set_notset ) , OSPF_V3_OPTIONS_AT , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_DBD ] ,
{ " DB Description " , " ospf.dbd " , FT_UINT8 , BASE_HEX ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_DBD_R ] ,
2014-06-20 08:48:47 +00:00
{ " (R) OOBResync " , " ospf.dbd.r " , FT_BOOLEAN , 8 ,
TFS ( & tfs_set_notset ) , OSPF_DBD_FLAG_R , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_DBD_I ] ,
2014-06-20 08:48:47 +00:00
{ " (I) Init " , " ospf.dbd.i " , FT_BOOLEAN , 8 ,
TFS ( & tfs_set_notset ) , OSPF_DBD_FLAG_I , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_DBD_M ] ,
2014-06-20 08:48:47 +00:00
{ " (M) More " , " ospf.dbd.m " , FT_BOOLEAN , 8 ,
TFS ( & tfs_set_notset ) , OSPF_DBD_FLAG_M , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_DBD_MS ] ,
2014-06-20 08:48:47 +00:00
{ " (MS) Master " , " ospf.dbd.ms " , FT_BOOLEAN , 8 ,
TFS ( & tfs_yes_no ) , OSPF_DBD_FLAG_MS , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_LLS_EXT_OPTIONS ] ,
{ " Options " , " ospf.lls.ext.options " , FT_UINT32 , BASE_HEX ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_LLS_EXT_OPTIONS_LR ] ,
2014-06-20 08:48:47 +00:00
{ " (LR) LSDB Resynchronization " , " ospf.lls.ext.options.lr " , FT_BOOLEAN , 32 ,
TFS ( & tfs_set_notset ) , OSPF_LLS_EXT_OPTIONS_LR , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_LLS_EXT_OPTIONS_RS ] ,
2014-06-20 08:48:47 +00:00
{ " (RS) Restart Signal " , " ospf.lls.ext.options.rs " , FT_BOOLEAN , 32 ,
TFS ( & tfs_set_notset ) , OSPF_LLS_EXT_OPTIONS_RS , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V2_ROUTER_LSA_FLAG ] ,
{ " Flags " , " ospf.v2.router.lsa.flags " , FT_UINT8 , BASE_HEX ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V2_ROUTER_LSA_FLAG_B ] ,
2014-06-20 08:48:47 +00:00
{ " (B) Area border router " , " ospf.v2.router.lsa.flags.b " , FT_BOOLEAN , 8 ,
TFS ( & tfs_yes_no ) , OSPF_V2_ROUTER_LSA_FLAG_B , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V2_ROUTER_LSA_FLAG_E ] ,
2014-06-20 08:48:47 +00:00
{ " (E) AS boundary router " , " ospf.v2.router.lsa.flags.e " , FT_BOOLEAN , 8 ,
TFS ( & tfs_yes_no ) , OSPF_V2_ROUTER_LSA_FLAG_E , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V2_ROUTER_LSA_FLAG_V ] ,
2014-06-20 08:48:47 +00:00
{ " (V) Virtual link endpoint " , " ospf.v2.router.lsa.flags.v " , FT_BOOLEAN , 8 ,
TFS ( & tfs_yes_no ) , OSPF_V2_ROUTER_LSA_FLAG_V , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V2_ROUTER_LSA_FLAG_W ] ,
2014-06-20 08:48:47 +00:00
{ " (W) Wild-card multicast receiver " , " ospf.v2.router.lsa.flags.w " , FT_BOOLEAN , 8 ,
TFS ( & tfs_yes_no ) , OSPF_V2_ROUTER_LSA_FLAG_W , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V2_ROUTER_LSA_FLAG_N ] ,
2014-06-20 08:48:47 +00:00
{ " (N) flag " , " ospf.v2.router.lsa.flags.n " , FT_BOOLEAN , 8 ,
TFS ( & tfs_yes_no ) , OSPF_V2_ROUTER_LSA_FLAG_N , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_ROUTER_LSA_FLAG ] ,
{ " Flags " , " ospf.v3.router.lsa.flags " , FT_UINT8 , BASE_HEX ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_ROUTER_LSA_FLAG_B ] ,
2014-06-20 08:48:47 +00:00
{ " (B) Area border router " , " ospf.v3.router.lsa.flags.b " , FT_BOOLEAN , 8 ,
TFS ( & tfs_yes_no ) , OSPF_V3_ROUTER_LSA_FLAG_B , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_ROUTER_LSA_FLAG_E ] ,
2014-06-20 08:48:47 +00:00
{ " (E) AS boundary router " , " ospf.v3.router.lsa.flags.e " , FT_BOOLEAN , 8 ,
TFS ( & tfs_yes_no ) , OSPF_V3_ROUTER_LSA_FLAG_E , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_ROUTER_LSA_FLAG_V ] ,
2014-06-20 08:48:47 +00:00
{ " (V) Virtual link endpoint " , " ospf.v3.router.lsa.flags.v " , FT_BOOLEAN , 8 ,
TFS ( & tfs_yes_no ) , OSPF_V3_ROUTER_LSA_FLAG_V , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_ROUTER_LSA_FLAG_W ] ,
2014-06-20 08:48:47 +00:00
{ " (W) Wild-card multicast receiver " , " ospf.v3.router.lsa.flags.w " , FT_BOOLEAN , 8 ,
TFS ( & tfs_yes_no ) , OSPF_V3_ROUTER_LSA_FLAG_W , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_AS_EXTERNAL_FLAG ] ,
{ " Flags " , " ospf.v3.as.external.flags " , FT_UINT8 , BASE_HEX ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_AS_EXTERNAL_FLAG_T ] ,
2014-06-20 08:48:47 +00:00
{ " (T) External Route Tag " , " ospf.v3.as.external.flags.t " , FT_BOOLEAN , 8 ,
TFS ( & tfs_present_not_present ) , OSPF_V3_AS_EXTERNAL_FLAG_T , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_AS_EXTERNAL_FLAG_F ] ,
2014-06-20 08:48:47 +00:00
{ " (F) Forwarding Address " , " ospf.v3.as.external.flags.f " , FT_BOOLEAN , 8 ,
TFS ( & tfs_present_absent ) , OSPF_V3_AS_EXTERNAL_FLAG_F , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_AS_EXTERNAL_FLAG_E ] ,
2014-06-20 08:48:47 +00:00
{ " (E) External Metric " , " ospf.v3.as.external.flags.e " , FT_BOOLEAN , 8 ,
2011-03-22 00:38:55 +00:00
TFS ( & tfs_v3_as_external_flags_e ) , OSPF_V3_AS_EXTERNAL_FLAG_E , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_PREFIX_OPTION ] ,
{ " PrefixOptions " , " ospf.v3.prefix.options " , FT_UINT8 , BASE_HEX ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_PREFIX_OPTION_NU ] ,
2014-06-20 08:48:47 +00:00
{ " (NU) NoUnicast " , " ospf.v3.prefix.options.nu " , FT_BOOLEAN , 8 ,
TFS ( & tfs_set_notset ) , OSPF_V3_PREFIX_OPTION_NU , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_PREFIX_OPTION_LA ] ,
2014-06-20 08:48:47 +00:00
{ " (LA) Local Address " , " ospf.v3.prefix.options.la " , FT_BOOLEAN , 8 ,
TFS ( & tfs_set_notset ) , OSPF_V3_PREFIX_OPTION_LA , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_PREFIX_OPTION_MC ] ,
2014-06-20 08:48:47 +00:00
{ " (MC) Multicast " , " ospf.v3.prefix.options.mc " , FT_BOOLEAN , 8 ,
TFS ( & tfs_set_notset ) , OSPF_V3_PREFIX_OPTION_MC , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_PREFIX_OPTION_P ] ,
2014-06-20 08:48:47 +00:00
{ " (P) Propogate " , " ospf.v3.prefix.options.p " , FT_BOOLEAN , 8 ,
TFS ( & tfs_set_notset ) , OSPF_V3_PREFIX_OPTION_P , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
2011-12-02 23:42:52 +00:00
/* Dynamic Hostname contained in the Opaque RI LSA - dynamic hostname TLV*/
{ & hf_ospf_filter [ OSPFF_DYN_HOSTNAME ] ,
{ " Dynamic Hostname " , " ospf.dynhostname " , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
/* text contained in the Unknown TLV of the Opaque RI LSA */
{ & hf_ospf_filter [ OSPFF_UNKNOWN_TLV_TXT ] ,
{ " Text in the Unknown TLV " , " ospf.unknown_text " , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
/* OSPF Restart TLVs */
{ & hf_ospf_filter [ OSPFF_V2_GRACE_TLV ] ,
{ " Grace TLV " , " ospf.v2.grace " , FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V2_GRACE_PERIOD ] ,
{ " Grace Period " , " ospf.v2.grace.period " , FT_UINT32 , BASE_DEC ,
NULL , 0x0 ,
" The number of seconds neighbors should advertise the router as fully adjacent " ,
HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V2_GRACE_REASON ] ,
{ " Restart Reason " , " ospf.v2.grace.reason " , FT_UINT8 , BASE_DEC ,
VALS ( restart_reason_vals ) , 0x0 , " The reason the router is restarting " , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V2_GRACE_IP ] ,
{ " Restart IP " , " ospf.v2.grace.ip " , FT_IPv4 , BASE_NONE ,
NULL , 0x0 , " The IP address of the interface originating this LSA " , HFILL } } ,
/* OSPFv3 LLS TLVs */
{ & hf_ospf_filter [ OSPFF_V3_LLS_EXT_OPTIONS_TLV ] ,
{ " Extended Options TLV " , " ospf.v3.lls.ext.options.tlv " , FT_NONE , BASE_NONE ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LLS_EXT_OPTIONS ] ,
{ " Options " , " ospf.v3.lls.ext.options " , FT_UINT32 , BASE_HEX ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LLS_EXT_OPTIONS_LR ] ,
2014-06-20 08:48:47 +00:00
{ " (LR) LSDB Resynchronization " , " ospf.v3.lls.ext.options.lr " , FT_BOOLEAN , 32 ,
TFS ( & tfs_set_notset ) , OSPF_V3_LLS_EXT_OPTIONS_LR , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_LLS_EXT_OPTIONS_RS ] ,
2014-06-20 08:48:47 +00:00
{ " (RS) Restart Signal " , " ospf.v3.lls.ext.options.rs " , FT_BOOLEAN , 32 ,
TFS ( & tfs_set_notset ) , OSPF_V3_LLS_EXT_OPTIONS_RS , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_LLS_STATE_TLV ] ,
{ " State Check Sequence TLV " , " ospf.v3.lls.state.tlv " , FT_NONE , BASE_NONE ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LLS_STATE_SCS ] ,
{ " SCS Number " , " ospf.v3.lls.state.scs " , FT_UINT16 , BASE_DEC ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LLS_STATE_OPTIONS ] ,
{ " Options " , " ospf.v3.lls.state.options " , FT_UINT8 , BASE_HEX ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LLS_STATE_OPTIONS_R ] ,
2014-06-20 08:48:47 +00:00
{ " (R) Resuest " , " ospf.v3.lls.state.options.r " , FT_BOOLEAN , 8 ,
TFS ( & tfs_set_notset ) , OSPF_V3_LLS_STATE_OPTIONS_R , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_LLS_STATE_OPTIONS_A ] ,
2014-06-20 08:48:47 +00:00
{ " (A) Answer " , " ospf.v3.lls.state.options.a " , FT_BOOLEAN , 8 ,
TFS ( & tfs_set_notset ) , OSPF_V3_LLS_STATE_OPTIONS_A , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_LLS_STATE_OPTIONS_N ] ,
2014-06-20 08:48:47 +00:00
{ " (N) Incomplete " , " ospf.v3.lls.state.options.n " , FT_BOOLEAN , 8 ,
TFS ( & tfs_set_notset ) , OSPF_V3_LLS_STATE_OPTIONS_N , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_LLS_DROP_TLV ] ,
{ " Neighbor Drop TLV " , " ospf.v3.lls.drop.tlv " , FT_NONE , BASE_NONE ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LLS_RELAY_TLV ] ,
{ " Active Overlapping Relays TLV " , " ospf.v3.lls.relay.tlv " , FT_NONE , BASE_NONE ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LLS_RELAY_ADDED ] ,
{ " Relays Added " , " ospf.v3.lls.relay.added " , FT_UINT8 , BASE_DEC ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LLS_RELAY_OPTIONS ] ,
{ " Options " , " ospf.v3.lls.relay.options " , FT_UINT8 , BASE_HEX ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LLS_RELAY_OPTIONS_A ] ,
2014-06-20 08:48:47 +00:00
{ " (A) Always " , " ospf.v3.lls.relay.options.a " , FT_BOOLEAN , 8 ,
TFS ( & tfs_set_notset ) , OSPF_V3_LLS_RELAY_OPTIONS_A , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_LLS_RELAY_OPTIONS_N ] ,
2014-06-20 08:48:47 +00:00
{ " (N) Never " , " ospf.v3.lls.relay.options.n " , FT_BOOLEAN , 8 ,
TFS ( & tfs_set_notset ) , OSPF_V3_LLS_RELAY_OPTIONS_N , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
{ & hf_ospf_filter [ OSPFF_V3_LLS_WILLINGNESS_TLV ] ,
{ " Willingness TLV " , " ospf.v3.lls.willingness.tlv " , FT_NONE , BASE_NONE ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LLS_WILLINGNESS ] ,
{ " Willingness " , " ospf.v3.lls.willingness " , FT_UINT8 , BASE_DEC ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LLS_RF_TLV ] ,
{ " Request From TLV " , " ospf.v3.lls.rf.tlv " , FT_NONE , BASE_NONE ,
NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_filter [ OSPFF_V3_LLS_FSF_TLV ] ,
{ " Full State For TLV " , " ospf.v3.lls.fsf.tlv " , FT_NONE , BASE_NONE ,
2014-06-15 12:27:57 +00:00
NULL , 0x0 , NULL , HFILL } } ,
/* Generated from convert_proto_tree_add_text.pl */
{ & hf_ospf_v2_lls_sequence_number , { " Sequence number " , " ospf.v2.lls.sequence_number " , FT_UINT32 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v2_lls_auth_data , { " Auth Data " , " ospf.v2.lls.auth_data " , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lls_extended_options , { " Extended Options " , " ospf.v3.lls.extended_options " , FT_UINT32 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lls_dropped_neighbor , { " Dropped Neighbor " , " ospf.v3.lls.dropped_neighbor " , FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lls_neighbor , { " Neighbor " , " ospf.v3.lls.neighbor " , FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lls_request_from , { " Request From " , " ospf.v3.lls.request_from " , FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lls_full_state_for , { " Full State For " , " ospf.v3.lls.full_state_for " , FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_lls_checksum , { " Checksum " , " ospf.lls.checksum " , FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_lls_data_length , { " LLS Data Length " , " ospf.lls.data_length " , FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_db_interface_mtu , { " Interface MTU " , " ospf.db.interface_mtu " , FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_db_dd_sequence , { " DD Sequence " , " ospf.db.dd_sequence " , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_link_state_id , { " Link State ID " , " ospf.link_state_id " , FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_ls_number_of_lsas , { " Number of LSAs " , " ospf.ls.number_of_lsas " , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_mpls_router_address , { " Router Address " , " ospf.mpls.router_address " , FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_mpls_switching_type , { " Switching Type " , " ospf.mpls.switching_type " , FT_UINT8 , BASE_DEC | BASE_RANGE_STRING , RVALS ( gmpls_switching_type_rvals ) , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_mpls_encoding , { " Encoding " , " ospf.mpls.encoding " , FT_UINT8 , BASE_DEC | BASE_RANGE_STRING , RVALS ( gmpls_lsp_enc_rvals ) , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_mpls_interface_mtu , { " Interface MTU " , " ospf.mpls.interface_mtu " , FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_mpls_protection_capability , { " Protection Capability " , " ospf.mpls.protection_capability " , FT_UINT8 , BASE_HEX , VALS ( gmpls_protection_cap_str ) , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_mpls_shared_risk_link_group , { " Shared Risk Link Group " , " ospf.mpls.shared_risk_link_group " , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_oif_switching_cap , { " Switching Cap " , " ospf.oif.switching_cap " , FT_UINT8 , BASE_DEC | BASE_RANGE_STRING , RVALS ( gmpls_switching_type_rvals ) , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_oif_encoding , { " Encoding " , " ospf.oif.encoding " , FT_UINT8 , BASE_DEC | BASE_RANGE_STRING , RVALS ( gmpls_lsp_enc_rvals ) , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_oif_tna_addr_length , { " Addr Length " , " ospf.oif.tna_addr_length " , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_oif_tna_addr_ipv4 , { " TNA Addr " , " ospf.oif.tna_addr.ipv4 " , FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_tna_addr_ipv6 , { " TNA Addr " , " ospf.oif.tna_addr.ipv6 " , FT_IPv6 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_tna_addr , { " TNA Addr " , " ospf.oif.tna_addr " , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_ls_id_te_lsa_reserved , { " Link State ID TE-LSA Reserved " , " ospf.lsid_te_lsa.reserved " , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_ls_id_opaque_id , { " Link State ID Opaque ID " , " ospf.lsid.opaque_id " , FT_UINT24 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_lsa_number_of_links , { " Number of Links " , " ospf.lsa.number_of_links " , FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_do_not_age , { " Do Not Age " , " ospf.v3.lsa.do_not_age " , FT_BOOLEAN , 16 , TFS ( & tfs_true_false ) , OSPF_DNA_LSA , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_interface_id , { " Interface ID " , " ospf.v3.lsa.interface_id " , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_neighbor_interface_id , { " Neighbor Interface ID " , " ospf.v3.lsa.neighbor_interface_id " , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_neighbor_router_id , { " Neighbor Router ID " , " ospf.v3.lsa.neighbor_router_id " , FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_attached_router , { " Attached Router " , " ospf.v3.lsa.attached_router " , FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_destination_router_id , { " Destination Router ID " , " ospf.v3.lsa.destination_router_id " , FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_referenced_ls_type , { " Referenced LS type " , " ospf.v3.lsa.referenced_ls_type " , FT_UINT16 , BASE_HEX , VALS ( v3_ls_type_vals ) , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_forwarding_address_ipv6 , { " Forwarding Address " , " ospf.v3.lsa.forwarding_address " , FT_IPv6 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_external_route_tag , { " External Route Tag " , " ospf.v3.lsa.external_route_tag " , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_referenced_link_state_id , { " Referenced Link State ID " , " ospf.v3.lsa.referenced_link_state_id " , FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_router_priority , { " Router Priority " , " ospf.v3.lsa.router_priority " , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_link_local_interface_address , { " Link-local Interface Address " , " ospf.v3.lsa.link_local_interface_address " , FT_IPv6 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_referenced_advertising_router , { " Referenced Advertising Router " , " ospf.v3.lsa.referenced_advertising_router " , FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL } } ,
{ & hf_ospf_lsa_external_type , { " External Type " , " ospf.lsa.asext.type " , FT_BOOLEAN , 8 , TFS ( & tfs_lsa_external_type ) , 0x80 , NULL , HFILL } } ,
{ & hf_ospf_v3_lsa_type , { " Type " , " ospf.v3.lsa.type " , FT_UINT8 , BASE_DEC , VALS ( ospf_v3_lsa_type_vals ) , 0 , NULL , HFILL } } ,
{ & hf_ospf_metric , { " Metric " , " ospf.metric " , FT_UINT32 , BASE_DEC , NULL , 0 , NULL , HFILL } } ,
{ & hf_ospf_prefix_length , { " PrefixLength " , " ospf.prefix_length " , FT_UINT8 , BASE_DEC , NULL , 0 , NULL , HFILL } } ,
2011-03-22 00:38:55 +00:00
} ;
2009-06-22 04:58:08 +00:00
2000-12-27 12:48:27 +00:00
static gint * ett [ ] = {
2011-03-22 00:38:55 +00:00
& ett_ospf ,
2014-04-28 06:59:17 +00:00
& ett_ospf_at ,
2011-03-22 00:38:55 +00:00
& ett_ospf_hdr ,
& ett_ospf_hello ,
& ett_ospf_desc ,
& ett_ospf_lsr ,
& ett_ospf_lsa ,
& ett_ospf_lsa_router_link ,
& ett_ospf_lsa_upd ,
& ett_ospf_lsa_mpls ,
& ett_ospf_lsa_mpls_router ,
& ett_ospf_lsa_mpls_link ,
& ett_ospf_lsa_mpls_link_stlv ,
& ett_ospf_lsa_mpls_link_stlv_admingrp ,
2011-12-02 23:42:52 +00:00
& ett_ospf_lsa_opaque_ri ,
& ett_ospf_lsa_ri_tlv ,
& ett_ospf_lsa_dyn_hostname_tlv ,
& ett_ospf_lsa_unknown_tlv ,
2011-03-22 00:38:55 +00:00
& ett_ospf_lsa_oif_tna ,
& ett_ospf_lsa_oif_tna_stlv ,
& ett_ospf_lsa_grace_tlv ,
& ett_ospf_v2_options ,
2011-12-02 23:42:52 +00:00
& ett_ospf_ri_options ,
2011-03-22 00:38:55 +00:00
& ett_ospf_v3_options ,
& ett_ospf_dbd ,
& ett_ospf_lls_data_block ,
& ett_ospf_lls_tlv ,
& ett_ospf_lls_ext_options ,
& ett_ospf_v3_lls_ext_options_tlv ,
& ett_ospf_v3_lls_ext_options ,
& ett_ospf_v3_lls_state_tlv ,
& ett_ospf_v3_lls_state_scs ,
& ett_ospf_v3_lls_state_options ,
& ett_ospf_v3_lls_drop_tlv ,
& ett_ospf_v3_lls_relay_tlv ,
& ett_ospf_v3_lls_relay_added ,
& ett_ospf_v3_lls_relay_options ,
& ett_ospf_v3_lls_willingness_tlv ,
& ett_ospf_v3_lls_willingness ,
& ett_ospf_v3_lls_rf_tlv ,
& ett_ospf_v3_lls_fsf_tlv ,
& ett_ospf_v2_router_lsa_flags ,
& ett_ospf_v3_router_lsa_flags ,
& ett_ospf_v3_as_external_flags ,
& ett_ospf_v3_prefix_options
2000-12-27 12:48:27 +00:00
} ;
2014-06-15 12:27:57 +00:00
static ei_register_info ei [ ] = {
{ & ei_ospf_header_reserved , { " ospf.reserved.not_zero " , PI_PROTOCOL , PI_WARN , " incorrect, should be 0 " , EXPFILL } } ,
2014-06-17 05:57:31 +00:00
{ & ei_ospf_lsa_bad_length , { " ospf.lsa.invalid_length " , PI_MALFORMED , PI_WARN , " Invalid length " , EXPFILL } } ,
{ & ei_ospf_lsa_constraint_missing , { " ospf.lsa.tos_missing " , PI_MALFORMED , PI_WARN , " Blocks missing " , EXPFILL } } ,
2014-06-15 12:27:57 +00:00
} ;
expert_module_t * expert_ospf ;
2001-01-03 06:56:03 +00:00
proto_ospf = proto_register_protocol ( " Open Shortest Path First " ,
2011-03-22 00:38:55 +00:00
" OSPF " , " ospf " ) ;
2002-05-10 18:37:38 +00:00
proto_register_field_array ( proto_ospf , ospff_info , array_length ( ospff_info ) ) ;
2000-12-27 12:48:27 +00:00
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
2014-06-15 12:27:57 +00:00
expert_ospf = expert_register_protocol ( proto_ospf ) ;
expert_register_field_array ( expert_ospf , ei , array_length ( ei ) ) ;
1999-07-29 05:47:07 +00:00
}
2000-04-16 22:46:25 +00:00
void
proto_reg_handoff_ospf ( void )
{
2001-12-03 04:00:26 +00:00
dissector_handle_t ospf_handle ;
ospf_handle = create_dissector_handle ( dissect_ospf , proto_ospf ) ;
2010-12-20 05:35:29 +00:00
dissector_add_uint ( " ip.proto " , IP_PROTO_OSPF , ospf_handle ) ;
2001-11-26 04:52:51 +00:00
data_handle = find_dissector ( " data " ) ;
2000-04-16 22:46:25 +00:00
}
2014-04-27 19:53:32 +00:00
/*
* Editor modelines
*
* Local Variables :
* c - basic - offset : 4
* tab - width : 8
* indent - tabs - mode : nil
* End :
*
* ex : set shiftwidth = 4 tabstop = 8 expandtab :
* : indentSize = 4 : tabSize = 8 : noTabs = true :
*/