1999-08-04 00:33:11 +00:00
/* packet-rip.c
1998-09-16 02:39:15 +00:00
* Routines for RIPv1 and RIPv2 packet disassembly
2010-12-14 18:27:04 +00:00
* RFC1058 ( STD 34 ) , RFC1388 , RFC1723 , RFC2453 ( STD 56 )
1998-09-16 02:39:15 +00:00
* ( c ) Copyright Hannes R . Boehm < hannes @ boehm . org >
*
2003-10-18 18:46:37 +00:00
* RFC2082 ( Keyed Message Digest Algorithm )
* Emanuele Caratti < wiz @ iol . it >
*
2006-05-21 04:49:01 +00:00
* Wireshark - Network traffic analyzer
* By Gerald Combs < gerald @ wireshark . org >
1998-09-16 02:39:15 +00:00
* Copyright 1998 Gerald Combs
2002-08-28 21:04:11 +00:00
*
1998-09-16 02:39:15 +00:00
* 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 .
2002-08-28 21:04:11 +00:00
*
1998-09-16 02:39:15 +00:00
* 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 .
2002-08-28 21:04:11 +00:00
*
1998-09-16 02:39:15 +00:00
* 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 .
1998-09-16 02:39:15 +00:00
*/
2002-08-28 21:04:11 +00:00
2013-11-08 21:38:32 +00:00
# define NEW_PROTO_TREE_API
1998-09-16 02:39:15 +00:00
# include "config.h"
2002-01-21 07:37:49 +00:00
# include <epan/packet.h>
2014-11-06 04:07:35 +00:00
# include <epan/expert.h>
2010-12-14 18:27:04 +00:00
# include <epan/prefs.h>
2013-12-21 17:23:17 +00:00
# include <epan/to_str.h>
1998-09-16 02:39:15 +00:00
2000-04-14 06:17:23 +00:00
# define UDP_PORT_RIP 520
2014-10-04 15:28:35 +00:00
# define RIPv1 1
# define RIPv2 2
2000-12-27 12:48:27 +00:00
2013-12-12 17:45:22 +00:00
void proto_register_rip ( void ) ;
2000-12-27 12:48:27 +00:00
static const value_string version_vals [ ] = {
2014-10-04 15:28:35 +00:00
{ RIPv1 , " RIPv1 " } ,
{ RIPv2 , " RIPv2 " } ,
{ 0 , NULL }
2000-12-27 12:48:27 +00:00
} ;
static const value_string command_vals [ ] = {
2014-10-04 15:28:35 +00:00
{ 1 , " Request " } ,
{ 2 , " Response " } ,
{ 3 , " Traceon " } ,
{ 4 , " Traceoff " } ,
{ 5 , " Vendor specific (Sun) " } ,
{ 0 , NULL }
2000-12-27 12:48:27 +00:00
} ;
2014-10-04 15:28:35 +00:00
# define AFVAL_UNSPEC 0
# define AFVAL_IP 2
2002-04-04 23:20:33 +00:00
2001-09-13 08:10:53 +00:00
static const value_string family_vals [ ] = {
2014-10-04 15:28:35 +00:00
{ AFVAL_UNSPEC , " Unspecified " } ,
{ AFVAL_IP , " IP " } ,
{ 0 , NULL }
2001-09-13 08:10:53 +00:00
} ;
2014-10-04 15:28:35 +00:00
# define AUTH_IP_ROUTE 1
# define AUTH_PASSWORD 2
# define AUTH_KEYED_MSG_DIGEST 3
2003-10-18 18:46:37 +00:00
static const value_string rip_auth_type [ ] = {
2014-10-04 15:28:35 +00:00
{ AUTH_IP_ROUTE , " IP Route " } ,
{ AUTH_PASSWORD , " Simple Password " } ,
{ AUTH_KEYED_MSG_DIGEST , " Keyed Message Digest " } ,
{ 0 , NULL }
2003-10-18 18:46:37 +00:00
} ;
2000-12-27 12:48:27 +00:00
# define RIP_HEADER_LENGTH 4
# define RIP_ENTRY_LENGTH 20
2004-07-05 10:15:30 +00:00
# define MD5_AUTH_DATA_LEN 16
2000-12-27 12:48:27 +00:00
2010-12-14 18:27:04 +00:00
static gboolean pref_display_routing_domain = FALSE ;
void proto_reg_handoff_rip ( void ) ;
2013-11-08 21:38:32 +00:00
static dissector_handle_t rip_handle ;
static header_field_info * hfi_rip = NULL ;
# define RIP_HFI_INIT HFI_INIT(proto_rip)
2014-10-04 15:28:35 +00:00
static header_field_info hfi_rip_command RIP_HFI_INIT = {
" Command " , " rip.command " , FT_UINT8 , BASE_DEC ,
VALS ( command_vals ) , 0 , " What type of RIP Command is this " , HFILL } ;
2013-11-08 21:38:32 +00:00
2014-10-04 15:28:35 +00:00
static header_field_info hfi_rip_version RIP_HFI_INIT = {
" Version " , " rip.version " , FT_UINT8 , BASE_DEC ,
VALS ( version_vals ) , 0 , " Version of the RIP protocol " , HFILL } ;
2013-11-08 21:38:32 +00:00
2014-10-04 15:28:35 +00:00
static header_field_info hfi_rip_routing_domain RIP_HFI_INIT = {
" Routing Domain " , " rip.routing_domain " , FT_UINT16 , BASE_DEC ,
NULL , 0 , " RIPv2 Routing Domain " , HFILL } ;
2013-11-08 21:38:32 +00:00
2014-10-04 15:28:35 +00:00
static header_field_info hfi_rip_ip RIP_HFI_INIT = {
" IP Address " , " rip.ip " , FT_IPv4 , BASE_NONE ,
NULL , 0 , NULL , HFILL } ;
2013-11-08 21:38:32 +00:00
2014-10-04 15:28:35 +00:00
static header_field_info hfi_rip_netmask RIP_HFI_INIT = {
2015-09-07 01:56:30 +00:00
" Netmask " , " rip.netmask " , FT_IPv4 , BASE_NETMASK ,
2014-10-04 15:28:35 +00:00
NULL , 0 , NULL , HFILL } ;
2013-11-08 21:38:32 +00:00
2014-10-04 15:28:35 +00:00
static header_field_info hfi_rip_next_hop RIP_HFI_INIT = {
" Next Hop " , " rip.next_hop " , FT_IPv4 , BASE_NONE ,
NULL , 0 , " Next Hop router for this route " , HFILL } ;
2013-11-08 21:38:32 +00:00
2014-10-04 15:28:35 +00:00
static header_field_info hfi_rip_metric RIP_HFI_INIT = {
" Metric " , " rip.metric " , FT_UINT16 , BASE_DEC ,
NULL , 0 , " Metric for this route " , HFILL } ;
2013-11-08 21:38:32 +00:00
2014-10-04 15:28:35 +00:00
static header_field_info hfi_rip_auth RIP_HFI_INIT = {
" Authentication type " , " rip.auth.type " , FT_UINT16 , BASE_DEC ,
VALS ( rip_auth_type ) , 0 , " Type of authentication " , HFILL } ;
2013-11-08 21:38:32 +00:00
2014-10-04 15:28:35 +00:00
static header_field_info hfi_rip_auth_passwd RIP_HFI_INIT = {
" Password " , " rip.auth.passwd " , FT_STRING , BASE_NONE ,
NULL , 0 , " Authentication password " , HFILL } ;
2013-11-08 21:38:32 +00:00
2014-10-04 15:28:35 +00:00
static header_field_info hfi_rip_family RIP_HFI_INIT = {
" Address Family " , " rip.family " , FT_UINT16 , BASE_DEC ,
VALS ( family_vals ) , 0 , NULL , HFILL } ;
2013-11-08 21:38:32 +00:00
2014-10-04 15:28:35 +00:00
static header_field_info hfi_rip_route_tag RIP_HFI_INIT = {
" Route Tag " , " rip.route_tag " , FT_UINT16 , BASE_DEC ,
NULL , 0 , NULL , HFILL } ;
1999-07-29 05:47:07 +00:00
2014-10-04 15:28:35 +00:00
static header_field_info hfi_rip_zero_padding RIP_HFI_INIT = {
" Zero adding " , " rip.zero_padding " , FT_STRING , BASE_NONE ,
NULL , 0 , " Authentication password " , HFILL } ;
2014-09-12 08:01:00 +00:00
2014-11-06 04:07:35 +00:00
static header_field_info hfi_rip_digest_offset RIP_HFI_INIT = {
" Digest Offset " , " rip.digest_offset " , FT_UINT16 , BASE_DEC ,
NULL , 0 , NULL , HFILL } ;
static header_field_info hfi_rip_key_id RIP_HFI_INIT = {
" Key ID " , " rip.key_id " , FT_UINT8 , BASE_DEC ,
NULL , 0 , NULL , HFILL } ;
static header_field_info hfi_rip_auth_data_len RIP_HFI_INIT = {
" Auth Data Len " , " rip.auth_data_len " , FT_UINT8 , BASE_DEC ,
NULL , 0 , NULL , HFILL } ;
static header_field_info hfi_rip_auth_seq_num RIP_HFI_INIT = {
" Seq num " , " rip.seq_num " , FT_UINT32 , BASE_DEC ,
NULL , 0 , NULL , HFILL } ;
static header_field_info hfi_rip_authentication_data RIP_HFI_INIT = {
" Authentication Data " , " rip.authentication_data " , FT_BYTES , BASE_NONE ,
NULL , 0 , NULL , HFILL } ;
1999-11-16 11:44:20 +00:00
static gint ett_rip = - 1 ;
static gint ett_rip_vec = - 1 ;
2003-10-18 18:46:37 +00:00
static gint ett_auth_vec = - 1 ;
1999-11-16 11:44:20 +00:00
2014-11-06 04:07:35 +00:00
static expert_field ei_rip_unknown_address_family = EI_INIT ;
2002-04-04 23:20:33 +00:00
static void dissect_unspec_rip_vektor ( tvbuff_t * tvb , int offset , guint8 version ,
proto_tree * tree ) ;
2000-12-27 12:48:27 +00:00
static void dissect_ip_rip_vektor ( tvbuff_t * tvb , int offset , guint8 version ,
proto_tree * tree ) ;
2003-10-18 18:46:37 +00:00
static gint dissect_rip_authentication ( tvbuff_t * tvb , int offset ,
2000-12-27 12:48:27 +00:00
proto_tree * tree ) ;
1998-09-16 02:39:15 +00:00
2002-08-28 21:04:11 +00:00
static void
2000-12-27 12:48:27 +00:00
dissect_rip ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree )
{
2014-10-04 15:28:35 +00:00
int offset = 0 ;
proto_tree * rip_tree = NULL ;
2000-12-27 12:48:27 +00:00
proto_item * ti ;
2014-10-04 15:28:35 +00:00
guint8 command ;
guint8 version ;
guint16 family ;
gint trailer_len = 0 ;
gboolean is_md5_auth = FALSE ;
1998-09-16 02:39:15 +00:00
2009-08-09 06:26:46 +00:00
col_set_str ( pinfo - > cinfo , COL_PROTOCOL , " RIP " ) ;
2009-08-09 07:36:13 +00:00
col_clear ( pinfo - > cinfo , COL_INFO ) ;
Add the "Edit:Protocols..." feature which currently only implements
the following:
It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.
Disabling a protocol could be interesting:
- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)
Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)
I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).
Two functions are added in proto.c :
gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);
and two MACROs which can be used in dissectors:
OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)
See also the XXX in proto_dlg.c and proto.c around the new functions.
svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
2000-12-27 12:48:27 +00:00
command = tvb_get_guint8 ( tvb , 0 ) ;
version = tvb_get_guint8 ( tvb , 1 ) ;
2002-08-28 21:04:11 +00:00
2013-10-29 14:09:20 +00:00
col_set_str ( pinfo - > cinfo , COL_PROTOCOL ,
2014-10-04 15:28:35 +00:00
val_to_str_const ( version , version_vals , " RIP " ) ) ;
2013-06-14 01:56:28 +00:00
col_add_str ( pinfo - > cinfo , COL_INFO ,
2014-10-04 15:28:35 +00:00
val_to_str ( command , command_vals , " Unknown command (%u) " ) ) ;
1998-09-16 02:39:15 +00:00
if ( tree ) {
2014-10-04 15:28:35 +00:00
ti = proto_tree_add_item ( tree , hfi_rip , tvb , 0 , - 1 , ENC_NA ) ;
rip_tree = proto_item_add_subtree ( ti , ett_rip ) ;
1998-09-16 02:39:15 +00:00
2014-10-04 15:28:35 +00:00
proto_tree_add_uint ( rip_tree , & hfi_rip_command , tvb , 0 , 1 , command ) ;
proto_tree_add_uint ( rip_tree , & hfi_rip_version , tvb , 1 , 1 , version ) ;
if ( version = = RIPv2 & & pref_display_routing_domain = = TRUE )
proto_tree_add_uint ( rip_tree , & hfi_rip_routing_domain , tvb , 2 , 2 ,
tvb_get_ntohs ( tvb , 2 ) ) ;
1998-11-20 09:24:42 +00:00
2014-10-04 15:28:35 +00:00
/* skip header */
offset = RIP_HEADER_LENGTH ;
1998-11-20 09:24:42 +00:00
/* zero or more entries */
2014-10-04 15:28:35 +00:00
while ( tvb_reported_length_remaining ( tvb , offset ) > trailer_len ) {
family = tvb_get_ntohs ( tvb , offset ) ;
switch ( family ) {
case AFVAL_UNSPEC : /* Unspecified */
/*
* There should be one entry in the request , and a metric
* of infinity , meaning " show the entire routing table " .
*/
dissect_unspec_rip_vektor ( tvb , offset , version , rip_tree ) ;
break ;
case AFVAL_IP : /* IP */
dissect_ip_rip_vektor ( tvb , offset , version , rip_tree ) ;
break ;
case 0xFFFF :
if ( offset = = RIP_HEADER_LENGTH ) {
trailer_len = dissect_rip_authentication ( tvb , offset , rip_tree ) ;
is_md5_auth = TRUE ;
break ;
}
if ( is_md5_auth & & tvb_reported_length_remaining ( tvb , offset ) = = 20 )
break ;
/* Intentional fall through: auth Entry MUST be the first! */
default :
2014-11-06 04:07:35 +00:00
proto_tree_add_expert_format ( rip_tree , pinfo , & ei_rip_unknown_address_family , tvb , offset ,
RIP_ENTRY_LENGTH , " Unknown address family %u " , family ) ;
2014-10-04 15:28:35 +00:00
break ;
}
1998-09-16 02:39:15 +00:00
1998-11-20 09:24:42 +00:00
offset + = RIP_ENTRY_LENGTH ;
}
}
}
1998-09-16 02:39:15 +00:00
2002-04-04 23:20:33 +00:00
static void
dissect_unspec_rip_vektor ( tvbuff_t * tvb , int offset , guint8 version ,
2014-10-04 15:28:35 +00:00
proto_tree * tree )
2002-04-04 23:20:33 +00:00
{
proto_tree * rip_vektor_tree ;
2014-10-04 15:28:35 +00:00
guint32 metric ;
2002-04-04 23:20:33 +00:00
metric = tvb_get_ntohl ( tvb , offset + 16 ) ;
2014-07-06 13:49:27 +00:00
rip_vektor_tree = proto_tree_add_subtree_format ( tree , tvb , offset ,
2014-10-04 15:28:35 +00:00
RIP_ENTRY_LENGTH , ett_rip_vec , NULL , " Address not specified, Metric: %u " ,
metric ) ;
2002-04-04 23:20:33 +00:00
2013-11-08 21:38:32 +00:00
proto_tree_add_item ( rip_vektor_tree , & hfi_rip_family , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2002-04-04 23:20:33 +00:00
if ( version = = RIPv2 ) {
2014-10-04 15:28:35 +00:00
proto_tree_add_item ( rip_vektor_tree , & hfi_rip_route_tag , tvb , offset + 2 , 2 ,
ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rip_vektor_tree , & hfi_rip_netmask , tvb , offset + 8 , 4 ,
ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rip_vektor_tree , & hfi_rip_next_hop , tvb , offset + 12 , 4 ,
ENC_BIG_ENDIAN ) ;
2002-04-04 23:20:33 +00:00
}
2013-11-08 21:38:32 +00:00
proto_tree_add_uint ( rip_vektor_tree , & hfi_rip_metric , tvb ,
2014-10-04 15:28:35 +00:00
offset + 16 , 4 , metric ) ;
2002-04-04 23:20:33 +00:00
}
1998-11-20 09:24:42 +00:00
static void
2000-12-27 12:48:27 +00:00
dissect_ip_rip_vektor ( tvbuff_t * tvb , int offset , guint8 version ,
2014-10-04 15:28:35 +00:00
proto_tree * tree )
1998-11-20 09:24:42 +00:00
{
1999-03-23 03:14:46 +00:00
proto_tree * rip_vektor_tree ;
2014-10-04 15:28:35 +00:00
guint32 metric ;
2000-12-27 12:48:27 +00:00
metric = tvb_get_ntohl ( tvb , offset + 16 ) ;
2014-07-06 13:49:27 +00:00
rip_vektor_tree = proto_tree_add_subtree_format ( tree , tvb , offset ,
2014-10-04 15:28:35 +00:00
RIP_ENTRY_LENGTH , ett_rip_vec , NULL , " IP Address: %s, Metric: %u " ,
tvb_ip_to_str ( tvb , offset + 4 ) , metric ) ;
2001-09-13 08:10:53 +00:00
2013-11-08 21:38:32 +00:00
proto_tree_add_item ( rip_vektor_tree , & hfi_rip_family , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2001-09-13 08:10:53 +00:00
if ( version = = RIPv2 ) {
2014-10-04 15:28:35 +00:00
proto_tree_add_item ( rip_vektor_tree , & hfi_rip_route_tag , tvb , offset + 2 , 2 ,
ENC_BIG_ENDIAN ) ;
2001-09-13 08:10:53 +00:00
}
2013-11-08 21:38:32 +00:00
proto_tree_add_item ( rip_vektor_tree , & hfi_rip_ip , tvb , offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
2001-09-13 08:10:53 +00:00
2000-12-27 12:48:27 +00:00
if ( version = = RIPv2 ) {
2014-10-04 15:28:35 +00:00
proto_tree_add_item ( rip_vektor_tree , & hfi_rip_netmask , tvb , offset + 8 , 4 ,
ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rip_vektor_tree , & hfi_rip_next_hop , tvb , offset + 12 , 4 ,
ENC_BIG_ENDIAN ) ;
1998-09-16 02:39:15 +00:00
}
2013-11-08 21:38:32 +00:00
proto_tree_add_uint ( rip_vektor_tree , & hfi_rip_metric , tvb ,
2014-10-04 15:28:35 +00:00
offset + 16 , 4 , metric ) ;
1998-09-16 02:39:15 +00:00
}
1998-11-20 09:24:42 +00:00
2003-10-18 18:46:37 +00:00
static gint
2000-12-27 12:48:27 +00:00
dissect_rip_authentication ( tvbuff_t * tvb , int offset , proto_tree * tree )
1998-11-20 09:24:42 +00:00
{
1999-03-23 03:14:46 +00:00
proto_tree * rip_authentication_tree ;
2014-10-04 15:28:35 +00:00
guint16 authtype ;
2014-11-06 04:07:35 +00:00
guint32 digest_off , auth_data_len ;
2003-10-18 18:46:37 +00:00
auth_data_len = 0 ;
authtype = tvb_get_ntohs ( tvb , offset + 2 ) ;
2000-12-27 12:48:27 +00:00
2014-07-06 13:49:27 +00:00
rip_authentication_tree = proto_tree_add_subtree_format ( tree , tvb , offset , RIP_ENTRY_LENGTH ,
2014-10-04 15:28:35 +00:00
ett_rip_vec , NULL , " Authentication: %s " , val_to_str ( authtype , rip_auth_type , " Unknown (%u) " ) ) ;
2000-12-27 12:48:27 +00:00
2013-11-08 21:38:32 +00:00
proto_tree_add_uint ( rip_authentication_tree , & hfi_rip_auth , tvb , offset + 2 , 2 ,
2014-10-04 15:28:35 +00:00
authtype ) ;
2003-10-18 18:46:37 +00:00
switch ( authtype ) {
case AUTH_PASSWORD : /* Plain text password */
2014-10-04 15:28:35 +00:00
proto_tree_add_item ( rip_authentication_tree , & hfi_rip_auth_passwd ,
tvb , offset + 4 , 16 , ENC_ASCII | ENC_NA ) ;
break ;
2003-10-18 18:46:37 +00:00
case AUTH_KEYED_MSG_DIGEST : /* Keyed MD5 rfc 2082 */
2014-10-04 15:28:35 +00:00
digest_off = tvb_get_ntohs ( tvb , offset + 4 ) ;
2014-11-06 04:07:35 +00:00
proto_tree_add_item ( rip_authentication_tree , & hfi_rip_digest_offset , tvb , offset + 4 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rip_authentication_tree , & hfi_rip_key_id , tvb , offset + 6 , 1 , ENC_NA ) ;
2014-10-04 15:28:35 +00:00
auth_data_len = tvb_get_guint8 ( tvb , offset + 7 ) ;
2014-11-06 04:07:35 +00:00
proto_tree_add_item ( rip_authentication_tree , & hfi_rip_auth_data_len , tvb , offset + 7 , 1 , ENC_NA ) ;
proto_tree_add_item ( rip_authentication_tree , & hfi_rip_auth_seq_num , tvb , offset + 8 , 4 , ENC_BIG_ENDIAN ) ;
2014-10-04 15:28:35 +00:00
proto_tree_add_item ( rip_authentication_tree , & hfi_rip_zero_padding , tvb , offset + 12 , 8 , ENC_NA ) ;
rip_authentication_tree = proto_tree_add_subtree ( rip_authentication_tree , tvb , offset - 4 + digest_off ,
MD5_AUTH_DATA_LEN + 4 , ett_auth_vec , NULL , " Authentication Data Trailer " ) ;
2014-11-06 04:07:35 +00:00
proto_tree_add_item ( rip_authentication_tree , & hfi_rip_authentication_data , tvb , offset - 4 + digest_off + 4 ,
MD5_AUTH_DATA_LEN , ENC_NA ) ;
2014-10-04 15:28:35 +00:00
break ;
2000-12-27 12:48:27 +00:00
}
2003-10-18 18:46:37 +00:00
return auth_data_len ;
1998-11-20 09:24:42 +00:00
}
1999-07-29 05:47:07 +00:00
void
proto_register_rip ( void )
{
2013-11-08 21:38:32 +00:00
# ifndef HAVE_HFI_SECTION_INIT
2014-10-04 15:28:35 +00:00
static header_field_info * hfi [ ] = {
& hfi_rip_command ,
& hfi_rip_version ,
& hfi_rip_routing_domain ,
& hfi_rip_ip ,
& hfi_rip_netmask ,
& hfi_rip_next_hop ,
& hfi_rip_metric ,
& hfi_rip_auth ,
& hfi_rip_auth_passwd ,
& hfi_rip_family ,
& hfi_rip_route_tag ,
& hfi_rip_zero_padding ,
2015-02-01 17:32:08 +00:00
& hfi_rip_digest_offset ,
& hfi_rip_key_id ,
& hfi_rip_auth_data_len ,
& hfi_rip_auth_seq_num ,
& hfi_rip_authentication_data ,
2014-10-04 15:28:35 +00:00
} ;
2013-11-08 21:38:32 +00:00
# endif /* HAVE_HFI_SECTION_INIT */
2014-10-04 15:28:35 +00:00
static gint * ett [ ] = {
& ett_rip ,
& ett_rip_vec ,
& ett_auth_vec ,
} ;
2001-09-13 08:10:53 +00:00
2014-11-06 04:07:35 +00:00
static ei_register_info ei [ ] = {
{ & ei_rip_unknown_address_family , { " rip.unknown_address_family " , PI_PROTOCOL , PI_WARN , " Unknown address family " , EXPFILL } } ,
} ;
expert_module_t * expert_rip ;
2014-10-04 15:28:35 +00:00
module_t * rip_module ;
int proto_rip ;
2010-12-14 18:27:04 +00:00
2014-11-06 04:07:35 +00:00
proto_rip = proto_register_protocol ( " Routing Information Protocol " , " RIP " , " rip " ) ;
2014-10-04 15:28:35 +00:00
hfi_rip = proto_registrar_get_nth ( proto_rip ) ;
2013-11-08 21:38:32 +00:00
2014-10-04 15:28:35 +00:00
proto_register_fields ( proto_rip , hfi , array_length ( hfi ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
2014-11-06 04:07:35 +00:00
expert_rip = expert_register_protocol ( proto_rip ) ;
expert_register_field_array ( expert_rip , ei , array_length ( ei ) ) ;
2010-12-14 18:27:04 +00:00
2014-10-04 15:28:35 +00:00
rip_module = prefs_register_protocol ( proto_rip , proto_reg_handoff_rip ) ;
2010-12-14 18:27:04 +00:00
2014-10-04 15:28:35 +00:00
prefs_register_bool_preference ( rip_module , " display_routing_domain " , " Display Routing Domain field " , " Display the third and forth bytes of the RIPv2 header as the Routing Domain field (introduced in RFC 1388 [January 1993] and obsolete as of RFC 1723 [November 1994]) " , & pref_display_routing_domain ) ;
2013-11-08 21:38:32 +00:00
2014-10-04 15:28:35 +00:00
rip_handle = create_dissector_handle ( dissect_rip , proto_rip ) ;
1999-07-29 05:47:07 +00:00
}
2000-04-14 06:17:23 +00:00
void
proto_reg_handoff_rip ( void )
{
2014-10-04 15:28:35 +00:00
dissector_add_uint ( " udp.port " , UDP_PORT_RIP , rip_handle ) ;
2000-04-14 06:17:23 +00:00
}
2014-10-04 15:28:35 +00:00
/*
* Editor modelines - http : //www.wireshark.org/tools/modelines.html
*
* Local variables :
* c - basic - offset : 4
* tab - width : 8
* indent - tabs - mode : nil
* End :
*
* vi : set shiftwidth = 4 tabstop = 8 expandtab :
* : indentSize = 4 : tabSize = 8 : noTabs = true :
*/