1998-09-16 02:39:15 +00:00
/* packet-ipv6.c
2001-06-26 17:31:36 +00:00
* Routines for IPv6 packet disassembly
1998-09-16 02:39:15 +00:00
*
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
*
2007-04-12 17:34:30 +00:00
* SHIM6 support added by Matthijs Mekking < matthijs @ NLnetLabs . nl >
*
2001-01-23 02:49:55 +00:00
* MobileIPv6 support added by Tomislav Borosa < tomislav . borosa @ siemens . hr >
*
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 .
2001-06-26 17:31:36 +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 .
2001-06-26 17:31:36 +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
*/
2012-09-20 02:03:38 +00:00
# include "config.h"
1998-09-16 02:39:15 +00:00
2007-04-12 17:34:30 +00:00
# include <math.h>
2002-01-21 07:37:49 +00:00
# include <epan/packet.h>
2015-12-13 21:54:16 +00:00
# include <epan/capture_dissectors.h>
2013-06-30 11:06:32 +00:00
# include <epan/expert.h>
2005-09-17 00:02:31 +00:00
# include <epan/ip_opts.h>
2004-08-06 19:57:49 +00:00
# include <epan/addr_resolv.h>
2014-12-23 15:15:15 +00:00
# include <epan/prefs.h>
2014-07-23 17:38:55 +00:00
# include <epan/conversation_table.h>
2015-10-29 03:30:55 +00:00
# include <epan/dissector_filters.h>
2005-02-09 23:38:00 +00:00
# include <epan/reassemble.h>
2004-09-29 00:52:45 +00:00
# include <epan/ipproto.h>
2005-09-17 00:02:31 +00:00
# include <epan/etypes.h>
# include <epan/ppptypes.h>
# include <epan/aftypes.h>
# include <epan/nlpid.h>
# include <epan/arcnet_pids.h>
2007-04-12 17:34:30 +00:00
# include <epan/in_cksum.h>
2013-11-20 19:17:08 +00:00
# include <epan/decode_as.h>
2016-01-25 01:10:20 +00:00
# include <epan/proto_data.h>
2016-06-01 16:26:54 +00:00
# include <epan/to_str.h>
2016-01-25 01:10:20 +00:00
2014-08-17 12:24:14 +00:00
# include <wiretap/erf.h>
2015-11-04 08:45:54 +00:00
# include <wsutil/str_util.h>
2011-08-08 17:59:32 +00:00
# include "packet-ipv6.h"
2012-04-05 08:02:32 +00:00
# include "packet-ip.h"
2014-11-09 02:08:52 +00:00
# include "packet-juniper.h"
2014-11-10 02:13:38 +00:00
# include "packet-sflow.h"
1999-03-28 18:32:03 +00:00
2011-10-05 22:27:51 +00:00
# ifdef HAVE_GEOIP_V6
2012-07-18 02:47:56 +00:00
# include <GeoIP.h>
2011-10-05 22:27:51 +00:00
# include <epan/geoip_db.h>
# endif /* HAVE_GEOIP_V6 */
2013-12-14 10:29:26 +00:00
void proto_register_ipv6 ( void ) ;
void proto_reg_handoff_ipv6 ( void ) ;
2015-08-23 20:34:21 +00:00
# define IPv6_HDR_SIZE 40
2015-09-06 12:08:08 +00:00
# define IPv6_ADDR_SIZE 16
2015-08-23 20:34:21 +00:00
2015-09-07 03:12:48 +00:00
# define IPv6_HDR_TCLS(ipv6) ((guint8)(g_ntohl((ipv6)->ip6_flow) >> 20))
2013-09-11 17:39:49 +00:00
/* Option types and related macros */
2015-12-28 22:42:23 +00:00
# define IP6OPT_PAD1 0x00 /* 00 0 00000 = 0 */
# define IP6OPT_PADN 0x01 /* 00 0 00001 = 1 */
# define IP6OPT_TEL 0x04 /* 00 0 00100 = 4 */
# define IP6OPT_RTALERT 0x05 /* 00 0 00101 = 5 */
# define IP6OPT_CALIPSO 0x07 /* 00 0 00111 = 7 */
# define IP6OPT_SMF_DPD 0x08 /* 00 0 01000 = 8 */
# define IP6OPT_EXP_1E 0x1E /* 00 0 11110 = 30 */
# define IP6OPT_QUICKSTART 0x26 /* 00 1 00110 = 38 */
# define IP6OPT_EXP_3E 0x3E /* 00 1 11110 = 62 */
# define IP6OPT_EXP_5E 0x5E /* 01 0 11110 = 94 */
# define IP6OPT_RPL 0x63 /* 01 1 00011 = 99 */
# define IP6OPT_MPL 0x6D /* 01 1 01101 = 109 */
# define IP6OPT_EXP_7E 0x7E /* 01 1 11110 = 126 */
# define IP6OPT_ENDI 0x8A /* 10 0 01010 = 138 */
# define IP6OPT_ILNP_NONCE 0x8B /* 10 0 01011 = 139 */
# define IP6OPT_LIO 0x8C /* 10 0 01100 = 140 */
# define IP6OPT_EXP_9E 0x9E /* 10 0 11110 = 158 */
# define IP6OPT_EXP_BE 0xBE /* 10 1 11110 = 190 */
2013-12-12 20:39:11 +00:00
# define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */
2015-12-28 22:42:23 +00:00
# define IP6OPT_HOME_ADDRESS 0xC9 /* 11 0 01001 = 201 */
# define IP6OPT_EXP_DE 0xDE /* 11 0 11110 = 222 */
# define IP6OPT_IP_DFF 0xEE /* 11 1 01110 = 238 */
# define IP6OPT_EXP_FE 0xFE /* 11 1 11110 = 254 */
2013-12-12 20:39:11 +00:00
# define IP6OPT_RTALERT_MLD 0 /* Datagram contains MLD msg */
# define IP6OPT_RTALERT_RSVP 1 /* Datagram contains RSVP msg */
# define IP6OPT_RTALERT_ACTNET 2 /* Datagram contains ACTNET msg */
2013-09-11 17:39:49 +00:00
2011-06-09 18:02:13 +00:00
/* RPL Routing header */
# define IP6RRPL_BITMASK_CMPRI 0xF0000000
# define IP6RRPL_BITMASK_CMPRE 0x0F000000
# define IP6RRPL_BITMASK_PAD 0x00F00000
# define IP6RRPL_BITMASK_RESERVED 0x000FFFFF
2009-11-13 22:19:31 +00:00
2016-01-03 13:33:36 +00:00
/* SHIM6 control message types */
# define SHIM6_TYPE_I1 0x01 /* 0 000 0001 */
# define SHIM6_TYPE_R1 0x02 /* 0 000 0010 */
# define SHIM6_TYPE_I2 0x03 /* 0 000 0011 */
# define SHIM6_TYPE_R2 0x04 /* 0 000 0100 */
# define SHIM6_TYPE_R1BIS 0x05 /* 0 000 0101 */
# define SHIM6_TYPE_I2BIS 0x06 /* 0 000 0110 */
# define SHIM6_TYPE_UPD_REQ 0x40 /* 0 100 0000 = 64 */
# define SHIM6_TYPE_UPD_ACK 0x41 /* 0 100 0001 = 65 */
# define SHIM6_TYPE_KEEPALIVE 0x42 /* 0 100 0010 = 66 */
# define SHIM6_TYPE_PROBE 0x43 /* 0 100 0011 = 67 */
/* SHIM6 Options */
# define SHIM6_OPT_RESPVAL 0x01 /* 0 000 0001 */
# define SHIM6_OPT_LOCLIST 0x02 /* 0 000 0010 */
# define SHIM6_OPT_LOCPREF 0x03 /* 0 000 0011 */
# define SHIM6_OPT_CGAPDM 0x04 /* 0 000 0100 */
# define SHIM6_OPT_CGASIG 0x05 /* 0 000 0101 */
# define SHIM6_OPT_ULIDPAIR 0x06 /* 0 000 0110 */
# define SHIM6_OPT_FII 0x07 /* 0 000 0111 */
/* SHIM6 Bitmasks */
# define SHIM6_BITMASK_P 0x80 /* 1 000 0000 */
# define SHIM6_BITMASK_TYPE 0x7F /* 0 111 1111 */
# define SHIM6_BITMASK_PROTOCOL 0x01 /* 0 000 0001 */
# define SHIM6_BITMASK_SPECIFIC 0xFE /* 1 111 1110 */
# define SHIM6_BITMASK_R 0x80 /* 1 000 0000 */
# define SHIM6_BITMASK_CT 0x7F /* 0 111 1111 */
# define SHIM6_BITMASK_OPT_TYPE 0xFFFE /* 1 111 1111 1 111 1110 */
# define SHIM6_BITMASK_CRITICAL 0x01 /* 0 000 0001 */
# define SHIM6_BITMASK_PRECVD 0xF0 /* 1 111 0000 */
# define SHIM6_BITMASK_PSENT 0x0F /* 0 000 1111 */
# define SHIM6_BITMASK_STA 0xC0 /* 1 100 0000 */
/* SHIM6 Verification Methods */
# define SHIM6_VERIF_HBA 0x01 /* 0 000 0001 */
# define SHIM6_VERIF_CGA 0x02 /* 0 000 0010 */
/* SHIM6 Flags */
# define SHIM6_FLAG_BROKEN 0x01 /* 0 000 0001 */
# define SHIM6_FLAG_TEMPORARY 0x02 /* 0 000 0010 */
/* SHIM6 REAP States */
# define SHIM6_REAP_OPERATIONAL 0x00 /* 0 000 0000 */
# define SHIM6_REAP_EXPLORING 0x01 /* 0 000 0001 */
# define SHIM6_REAP_INBOUNDOK 0x02 /* 0 000 0010 */
2014-04-28 23:42:42 +00:00
/* Protocol specific data indices */
# define IPV6_PROTO_NXT_HDR 0
2014-11-16 01:35:51 +00:00
# define IPV6_PROTO_VALUE 1
2015-08-09 22:13:06 +00:00
# define IPV6_PROTO_META 2
/* Metadata collected on IPv6 header and extensions */
typedef struct {
gint exthdr_count ;
gboolean jumbogram ;
guint32 jumbo_length ;
2015-12-29 12:15:44 +00:00
guint32 payload_length ;
gint hop_limit ;
2015-08-09 22:13:06 +00:00
} ipv6_meta_t ;
2014-04-28 23:42:42 +00:00
2009-12-10 23:15:12 +00:00
static int ipv6_tap = - 1 ;
2011-12-21 14:18:28 +00:00
static int proto_ipv6 = - 1 ;
2014-04-28 23:42:42 +00:00
static int proto_ipv6_hopopts = - 1 ;
static int proto_ipv6_routing = - 1 ;
2015-09-30 14:30:33 +00:00
static int proto_ipv6_fraghdr = - 1 ;
2014-04-28 23:42:42 +00:00
static int proto_ipv6_shim6 = - 1 ;
static int proto_ipv6_dstopts = - 1 ;
2015-09-10 15:15:46 +00:00
2012-06-12 10:44:57 +00:00
static int hf_ipv6_version = - 1 ;
static int hf_ip_version = - 1 ;
2015-09-02 00:28:18 +00:00
static int hf_ipv6_tclass = - 1 ;
static int hf_ipv6_tclass_dscp = - 1 ;
static int hf_ipv6_tclass_ecn = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_ipv6_flow = - 1 ;
static int hf_ipv6_plen = - 1 ;
static int hf_ipv6_nxt = - 1 ;
static int hf_ipv6_hlim = - 1 ;
static int hf_ipv6_src = - 1 ;
static int hf_ipv6_src_host = - 1 ;
static int hf_ipv6_src_sa_mac = - 1 ;
static int hf_ipv6_src_isatap_ipv4 = - 1 ;
static int hf_ipv6_src_6to4_gateway_ipv4 = - 1 ;
static int hf_ipv6_src_6to4_sla_id = - 1 ;
static int hf_ipv6_src_teredo_server_ipv4 = - 1 ;
static int hf_ipv6_src_teredo_port = - 1 ;
static int hf_ipv6_src_teredo_client_ipv4 = - 1 ;
static int hf_ipv6_dst = - 1 ;
static int hf_ipv6_dst_host = - 1 ;
static int hf_ipv6_dst_sa_mac = - 1 ;
static int hf_ipv6_dst_isatap_ipv4 = - 1 ;
static int hf_ipv6_dst_6to4_gateway_ipv4 = - 1 ;
static int hf_ipv6_dst_6to4_sla_id = - 1 ;
static int hf_ipv6_dst_teredo_server_ipv4 = - 1 ;
static int hf_ipv6_dst_teredo_port = - 1 ;
static int hf_ipv6_dst_teredo_client_ipv4 = - 1 ;
static int hf_ipv6_addr = - 1 ;
static int hf_ipv6_host = - 1 ;
static int hf_ipv6_sa_mac = - 1 ;
static int hf_ipv6_isatap_ipv4 = - 1 ;
static int hf_ipv6_6to4_gateway_ipv4 = - 1 ;
static int hf_ipv6_6to4_sla_id = - 1 ;
static int hf_ipv6_teredo_server_ipv4 = - 1 ;
static int hf_ipv6_teredo_port = - 1 ;
static int hf_ipv6_teredo_client_ipv4 = - 1 ;
2012-03-12 23:13:03 +00:00
static int hf_ipv6_opt = - 1 ;
static int hf_ipv6_opt_type = - 1 ;
static int hf_ipv6_opt_length = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_ipv6_opt_pad1 = - 1 ;
static int hf_ipv6_opt_padn = - 1 ;
2012-03-27 13:42:54 +00:00
static int hf_ipv6_opt_tel = - 1 ;
2012-03-12 23:13:03 +00:00
static int hf_ipv6_opt_rtalert = - 1 ;
static int hf_ipv6_opt_jumbo = - 1 ;
2012-03-27 13:42:54 +00:00
static int hf_ipv6_opt_calipso_doi = - 1 ;
static int hf_ipv6_opt_calipso_cmpt_length = - 1 ;
static int hf_ipv6_opt_calipso_sens_level = - 1 ;
static int hf_ipv6_opt_calipso_checksum = - 1 ;
static int hf_ipv6_opt_calipso_cmpt_bitmap = - 1 ;
2012-03-20 08:51:05 +00:00
static int hf_ipv6_opt_qs_func = - 1 ;
static int hf_ipv6_opt_qs_rate = - 1 ;
static int hf_ipv6_opt_qs_ttl = - 1 ;
static int hf_ipv6_opt_qs_ttl_diff = - 1 ;
static int hf_ipv6_opt_qs_unused = - 1 ;
static int hf_ipv6_opt_qs_nonce = - 1 ;
static int hf_ipv6_opt_qs_reserved = - 1 ;
2015-09-06 12:08:08 +00:00
static int hf_ipv6_opt_mipv6_home_address = - 1 ;
2012-03-27 13:50:50 +00:00
static int hf_ipv6_opt_rpl_flag = - 1 ;
static int hf_ipv6_opt_rpl_flag_o = - 1 ;
static int hf_ipv6_opt_rpl_flag_r = - 1 ;
static int hf_ipv6_opt_rpl_flag_f = - 1 ;
static int hf_ipv6_opt_rpl_flag_rsv = - 1 ;
static int hf_ipv6_opt_rpl_instance_id = - 1 ;
static int hf_ipv6_opt_rpl_senderrank = - 1 ;
2015-12-29 19:30:58 +00:00
static int hf_ipv6_opt_ilnp_nonce = - 1 ;
static int hf_ipv6_opt_lio_len = - 1 ;
static int hf_ipv6_opt_lio_id = - 1 ;
2015-06-11 15:16:34 +00:00
static int hf_ipv6_opt_mpl_flag = - 1 ;
static int hf_ipv6_opt_mpl_flag_s = - 1 ;
static int hf_ipv6_opt_mpl_flag_m = - 1 ;
static int hf_ipv6_opt_mpl_flag_v = - 1 ;
static int hf_ipv6_opt_mpl_flag_rsv = - 1 ;
static int hf_ipv6_opt_mpl_sequence = - 1 ;
static int hf_ipv6_opt_mpl_seed_id = - 1 ;
2015-12-29 19:30:58 +00:00
static int hf_ipv6_opt_dff_flags = - 1 ;
static int hf_ipv6_opt_dff_flag_ver = - 1 ;
static int hf_ipv6_opt_dff_flag_dup = - 1 ;
static int hf_ipv6_opt_dff_flag_ret = - 1 ;
static int hf_ipv6_opt_dff_flag_rsv = - 1 ;
static int hf_ipv6_opt_dff_seqnum = - 1 ;
2012-03-27 13:42:54 +00:00
static int hf_ipv6_opt_experimental = - 1 ;
2014-10-12 18:56:17 +00:00
static int hf_ipv6_opt_unknown_data = - 1 ;
2012-03-12 23:13:03 +00:00
static int hf_ipv6_opt_unknown = - 1 ;
2015-09-11 08:06:49 +00:00
static int hf_ipv6_dstopts_nxt = - 1 ;
2016-06-01 16:40:33 +00:00
static int hf_ipv6_dstopts_len = - 1 ;
static int hf_ipv6_dstopts_len_oct = - 1 ;
2015-09-11 08:06:49 +00:00
static int hf_ipv6_hopopts_nxt = - 1 ;
2016-06-01 16:40:33 +00:00
static int hf_ipv6_hopopts_len = - 1 ;
static int hf_ipv6_hopopts_len_oct = - 1 ;
2015-09-11 08:06:49 +00:00
static int hf_ipv6_unknown_hdr = - 1 ;
static int hf_ipv6_unknown_hdr_nxt = - 1 ;
2016-06-01 16:40:33 +00:00
static int hf_ipv6_unknown_hdr_len = - 1 ;
static int hf_ipv6_unknown_hdr_len_oct = - 1 ;
2015-09-06 12:08:08 +00:00
static int hf_ipv6_routing_nxt = - 1 ;
2016-06-01 16:40:33 +00:00
static int hf_ipv6_routing_len = - 1 ;
static int hf_ipv6_routing_len_oct = - 1 ;
2015-09-06 12:08:08 +00:00
static int hf_ipv6_routing_type = - 1 ;
static int hf_ipv6_routing_segleft = - 1 ;
2015-09-18 01:08:34 +00:00
static int hf_ipv6_fraghdr_nxt = - 1 ;
static int hf_ipv6_fraghdr_reserved_octet = - 1 ;
static int hf_ipv6_fraghdr_offset = - 1 ;
static int hf_ipv6_fraghdr_reserved_bits = - 1 ;
static int hf_ipv6_fraghdr_more = - 1 ;
static int hf_ipv6_fraghdr_ident = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_ipv6_fragment = - 1 ;
static int hf_ipv6_fragment_overlap = - 1 ;
static int hf_ipv6_fragment_overlap_conflict = - 1 ;
static int hf_ipv6_fragment_multiple_tails = - 1 ;
static int hf_ipv6_fragment_too_long_fragment = - 1 ;
static int hf_ipv6_fragment_error = - 1 ;
static int hf_ipv6_fragment_count = - 1 ;
2015-09-18 01:08:34 +00:00
static int hf_ipv6_fragments = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_ipv6_reassembled_in = - 1 ;
static int hf_ipv6_reassembled_length = - 1 ;
2012-09-07 02:09:59 +00:00
static int hf_ipv6_reassembled_data = - 1 ;
2014-09-10 23:58:33 +00:00
static int hf_ipv6_padding = - 1 ;
2011-12-21 14:18:28 +00:00
2015-09-06 12:08:08 +00:00
static int hf_ipv6_routing_src_reserved = - 1 ;
static int hf_ipv6_routing_src_addr = - 1 ;
2001-01-23 02:49:55 +00:00
2015-09-06 12:08:08 +00:00
static int hf_ipv6_routing_mipv6_reserved = - 1 ;
static int hf_ipv6_routing_mipv6_home_address = - 1 ;
static int hf_ipv6_routing_rpl_cmprI = - 1 ;
static int hf_ipv6_routing_rpl_cmprE = - 1 ;
static int hf_ipv6_routing_rpl_pad = - 1 ;
static int hf_ipv6_routing_rpl_reserved = - 1 ;
2015-11-28 22:53:51 +00:00
static int hf_ipv6_routing_rpl_addr_count = - 1 ;
2015-09-06 12:08:08 +00:00
static int hf_ipv6_routing_rpl_addr = - 1 ;
static int hf_ipv6_routing_rpl_fulladdr = - 1 ;
2011-06-09 18:02:13 +00:00
2016-05-28 00:55:04 +00:00
static int hf_ipv6_routing_srh_first_seg = - 1 ;
static int hf_ipv6_routing_srh_flags = - 1 ;
2016-06-11 17:09:05 +00:00
static int hf_ipv6_routing_srh_flag_c = - 1 ;
static int hf_ipv6_routing_srh_flag_p = - 1 ;
static int hf_ipv6_routing_srh_flag_o = - 1 ;
static int hf_ipv6_routing_srh_flag_a = - 1 ;
static int hf_ipv6_routing_srh_flag_h = - 1 ;
static int hf_ipv6_routing_srh_flag_unused = - 1 ;
2016-05-28 00:55:04 +00:00
static int hf_ipv6_routing_srh_reserved = - 1 ;
static int hf_ipv6_routing_srh_addr = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_ipv6_shim6_nxt = - 1 ;
static int hf_ipv6_shim6_len = - 1 ;
2016-06-01 16:40:33 +00:00
static int hf_ipv6_shim6_len_oct = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_ipv6_shim6_p = - 1 ;
2007-04-12 17:34:30 +00:00
/* context tag is 49 bits, cannot be used for filter yet */
2011-12-21 14:18:28 +00:00
static int hf_ipv6_shim6_ct = - 1 ;
static int hf_ipv6_shim6_type = - 1 ;
static int hf_ipv6_shim6_proto = - 1 ;
static int hf_ipv6_shim6_checksum = - 1 ;
static int hf_ipv6_shim6_checksum_bad = - 1 ;
static int hf_ipv6_shim6_checksum_good = - 1 ;
static int hf_ipv6_shim6_inonce = - 1 ; /* also for request nonce */
static int hf_ipv6_shim6_rnonce = - 1 ;
2014-10-13 02:09:35 +00:00
static int hf_ipv6_shim6_reserved = - 1 ;
static int hf_ipv6_shim6_reserved2 = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_ipv6_shim6_precvd = - 1 ;
static int hf_ipv6_shim6_psent = - 1 ;
static int hf_ipv6_shim6_psrc = - 1 ;
static int hf_ipv6_shim6_pdst = - 1 ;
static int hf_ipv6_shim6_pnonce = - 1 ;
static int hf_ipv6_shim6_pdata = - 1 ;
static int hf_ipv6_shim6_sulid = - 1 ;
static int hf_ipv6_shim6_rulid = - 1 ;
static int hf_ipv6_shim6_reap = - 1 ;
static int hf_ipv6_shim6_opt_type = - 1 ;
static int hf_ipv6_shim6_opt_len = - 1 ;
static int hf_ipv6_shim6_opt_total_len = - 1 ;
2007-04-12 17:34:30 +00:00
static int hf_ipv6_shim6_opt_loc_verif_methods = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_ipv6_shim6_opt_critical = - 1 ;
static int hf_ipv6_shim6_opt_loclist = - 1 ;
static int hf_ipv6_shim6_locator = - 1 ;
static int hf_ipv6_shim6_loc_flag = - 1 ;
static int hf_ipv6_shim6_loc_prio = - 1 ;
static int hf_ipv6_shim6_loc_weight = - 1 ;
static int hf_ipv6_shim6_opt_locnum = - 1 ;
static int hf_ipv6_shim6_opt_elemlen = - 1 ;
static int hf_ipv6_shim6_opt_fii = - 1 ;
2014-10-13 02:09:35 +00:00
static int hf_ipv6_shim6_validator = - 1 ;
static int hf_ipv6_shim6_cga_parameter_data_structure = - 1 ;
static int hf_ipv6_shim6_cga_signature = - 1 ;
2007-04-12 17:34:30 +00:00
2011-10-05 22:27:51 +00:00
# ifdef HAVE_GEOIP_V6
2011-12-21 14:18:28 +00:00
static int hf_geoip_country = - 1 ;
static int hf_geoip_city = - 1 ;
static int hf_geoip_org = - 1 ;
static int hf_geoip_isp = - 1 ;
static int hf_geoip_asnum = - 1 ;
static int hf_geoip_lat = - 1 ;
static int hf_geoip_lon = - 1 ;
static int hf_geoip_src_country = - 1 ;
static int hf_geoip_src_city = - 1 ;
static int hf_geoip_src_org = - 1 ;
static int hf_geoip_src_isp = - 1 ;
static int hf_geoip_src_asnum = - 1 ;
static int hf_geoip_src_lat = - 1 ;
static int hf_geoip_src_lon = - 1 ;
static int hf_geoip_dst_country = - 1 ;
static int hf_geoip_dst_city = - 1 ;
static int hf_geoip_dst_org = - 1 ;
static int hf_geoip_dst_isp = - 1 ;
static int hf_geoip_dst_asnum = - 1 ;
static int hf_geoip_dst_lat = - 1 ;
static int hf_geoip_dst_lon = - 1 ;
2011-10-05 22:27:51 +00:00
# endif /* HAVE_GEOIP_V6 */
2011-12-21 14:18:28 +00:00
static gint ett_ipv6 = - 1 ;
2012-03-12 23:13:03 +00:00
static gint ett_ipv6_opt = - 1 ;
2015-06-11 15:16:34 +00:00
static gint ett_ipv6_opt_rpl = - 1 ;
static gint ett_ipv6_opt_mpl = - 1 ;
2015-12-29 19:30:58 +00:00
static gint ett_ipv6_opt_dff_flags = - 1 ;
2015-09-18 01:08:34 +00:00
static gint ett_ipv6_fraghdr = - 1 ;
2015-09-06 12:08:08 +00:00
static gint ett_ipv6_routing = - 1 ;
2016-06-11 17:09:05 +00:00
static gint ett_ipv6_routing_srh_flags = - 1 ;
2016-05-28 00:55:04 +00:00
static gint ett_ipv6_routing_srh_vect = - 1 ;
2011-12-21 14:18:28 +00:00
static gint ett_ipv6_shim6 = - 1 ;
static gint ett_ipv6_shim6_option = - 1 ;
static gint ett_ipv6_shim6_locators = - 1 ;
static gint ett_ipv6_shim6_verif_methods = - 1 ;
static gint ett_ipv6_shim6_loc_pref = - 1 ;
static gint ett_ipv6_shim6_probes_sent = - 1 ;
static gint ett_ipv6_shim6_probe_sent = - 1 ;
static gint ett_ipv6_shim6_probes_rcvd = - 1 ;
static gint ett_ipv6_shim6_probe_rcvd = - 1 ;
static gint ett_ipv6_shim6_cksum = - 1 ;
static gint ett_ipv6_fragments = - 1 ;
static gint ett_ipv6_fragment = - 1 ;
static gint ett_ipv6_traffic_class = - 1 ;
2001-06-08 08:30:42 +00:00
2011-10-05 22:27:51 +00:00
# ifdef HAVE_GEOIP_V6
2011-12-21 14:18:28 +00:00
static gint ett_geoip_info = - 1 ;
2011-10-05 22:27:51 +00:00
# endif /* HAVE_GEOIP_V6 */
2015-09-06 12:08:08 +00:00
static expert_field ei_ipv6_routing_invalid_length = EI_INIT ;
static expert_field ei_ipv6_routing_invalid_segleft = EI_INIT ;
2016-05-28 00:55:04 +00:00
static expert_field ei_ipv6_routing_not_implemented = EI_INIT ;
2013-06-08 02:06:24 +00:00
static expert_field ei_ipv6_dst_addr_not_multicast = EI_INIT ;
static expert_field ei_ipv6_src_route_list_mult_inst_same_addr = EI_INIT ;
static expert_field ei_ipv6_src_route_list_src_addr = EI_INIT ;
static expert_field ei_ipv6_src_route_list_dst_addr = EI_INIT ;
static expert_field ei_ipv6_src_route_list_multicast_addr = EI_INIT ;
2015-09-06 12:08:08 +00:00
static expert_field ei_ipv6_routing_rpl_cmpri_cmpre_pad = EI_INIT ;
2015-11-28 22:53:51 +00:00
static expert_field ei_ipv6_routing_rpl_addr_count_ge0 = EI_INIT ;
2015-09-06 12:08:08 +00:00
static expert_field ei_ipv6_routing_rpl_reserved = EI_INIT ;
2015-08-09 22:13:06 +00:00
static expert_field ei_ipv6_opt_jumbo_missing = EI_INIT ;
static expert_field ei_ipv6_opt_jumbo_prohibited = EI_INIT ;
static expert_field ei_ipv6_opt_jumbo_truncated = EI_INIT ;
static expert_field ei_ipv6_opt_jumbo_fragment = EI_INIT ;
2015-08-19 06:11:23 +00:00
static expert_field ei_ipv6_opt_jumbo_not_hopbyhop = EI_INIT ;
2015-12-29 12:15:44 +00:00
static expert_field ei_ipv6_opt_invalid_len = EI_INIT ;
2014-10-12 18:56:17 +00:00
static expert_field ei_ipv6_opt_unknown_data = EI_INIT ;
2013-06-08 02:06:24 +00:00
static expert_field ei_ipv6_shim6_opt_elemlen_invalid = EI_INIT ;
static expert_field ei_ipv6_shim6_checksum_bad = EI_INIT ;
2015-08-09 22:13:06 +00:00
static expert_field ei_ipv6_hopopts_not_first = EI_INIT ;
static expert_field ei_ipv6_bogus_ipv6_length = EI_INIT ;
2015-08-21 08:33:17 +00:00
static expert_field ei_ipv6_bogus_payload_length = EI_INIT ;
2015-08-23 20:34:21 +00:00
static expert_field ei_ipv6_bogus_ipv6_version = EI_INIT ;
static expert_field ei_ipv6_invalid_header = EI_INIT ;
2011-10-05 22:27:51 +00:00
2016-07-09 01:22:03 +00:00
extern const struct e_in6_addr * tvb_get_ptr_ipv6 ( tvbuff_t tvb , int offset ) ;
# define tvb_get_ptr_ipv6(tvb, offset) \
( ( const struct e_in6_addr * ) tvb_get_ptr ( tvb , offset , IPv6_ADDR_SIZE ) )
2013-11-20 19:17:08 +00:00
static void ipv6_prompt ( packet_info * pinfo , gchar * result )
{
2014-11-16 01:35:51 +00:00
g_snprintf ( result , MAX_DECODE_AS_PROMPT_LEN , " IP protocol %u as " ,
2015-09-16 21:58:49 +00:00
GPOINTER_TO_UINT ( p_get_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , ( pinfo - > curr_layer_num < < 8 ) | IPV6_PROTO_VALUE ) ) ) ;
2013-11-20 19:17:08 +00:00
}
static gpointer ipv6_value ( packet_info * pinfo )
{
2015-09-16 21:58:49 +00:00
return p_get_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , ( pinfo - > curr_layer_num < < 8 ) | IPV6_PROTO_VALUE ) ;
2013-11-20 19:17:08 +00:00
}
2014-04-28 23:42:42 +00:00
static void ipv6_next_header_prompt ( packet_info * pinfo , gchar * result )
{
g_snprintf ( result , MAX_DECODE_AS_PROMPT_LEN , " IP Next Header %u as " ,
2015-09-16 21:58:49 +00:00
GPOINTER_TO_UINT ( p_get_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , ( pinfo - > curr_layer_num < < 8 ) | IPV6_PROTO_NXT_HDR ) ) ) ;
2014-04-28 23:42:42 +00:00
}
static gpointer ipv6_next_header_value ( packet_info * pinfo )
{
2015-09-16 21:58:49 +00:00
return p_get_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , ( pinfo - > curr_layer_num < < 8 ) | IPV6_PROTO_NXT_HDR ) ;
2014-04-28 23:42:42 +00:00
}
2014-07-23 17:38:55 +00:00
static const char * ipv6_conv_get_filter_type ( conv_item_t * conv , conv_filter_type_e filter )
{
if ( ( filter = = CONV_FT_SRC_ADDRESS ) & & ( conv - > src_address . type = = AT_IPv6 ) )
return " ipv6.src " ;
if ( ( filter = = CONV_FT_DST_ADDRESS ) & & ( conv - > dst_address . type = = AT_IPv6 ) )
return " ipv6.dst " ;
if ( ( filter = = CONV_FT_ANY_ADDRESS ) & & ( conv - > src_address . type = = AT_IPv6 ) )
return " ipv6.addr " ;
return CONV_FILTER_INVALID ;
}
static ct_dissector_info_t ipv6_ct_dissector_info = { & ipv6_conv_get_filter_type } ;
static int
ipv6_conversation_packet ( void * pct , packet_info * pinfo , epan_dissect_t * edt _U_ , const void * vip )
{
conv_hash_t * hash = ( conv_hash_t * ) pct ;
const struct ip6_hdr * ip6h = ( const struct ip6_hdr * ) vip ;
address src ;
address dst ;
/* Addresses aren't implemented as 'address' type in struct ip6_hdr */
src . type = dst . type = AT_IPv6 ;
src . len = dst . len = sizeof ( struct e_in6_addr ) ;
src . data = & ip6h - > ip6_src ;
dst . data = & ip6h - > ip6_dst ;
2016-01-23 03:50:21 +00:00
add_conversation_table_data ( hash , & src , & dst , 0 , 0 , 1 , pinfo - > fd - > pkt_len , & pinfo - > rel_ts , & pinfo - > abs_ts , & ipv6_ct_dissector_info , PT_NONE ) ;
2014-07-23 17:38:55 +00:00
return 1 ;
}
2014-07-25 15:34:51 +00:00
static const char * ipv6_host_get_filter_type ( hostlist_talker_t * host , conv_filter_type_e filter )
{
if ( ( filter = = CONV_FT_ANY_ADDRESS ) & & ( host - > myaddress . type = = AT_IPv6 ) )
return " ipv6.addr " ;
return CONV_FILTER_INVALID ;
}
static hostlist_dissector_info_t ipv6_host_dissector_info = { & ipv6_host_get_filter_type } ;
static int
ipv6_hostlist_packet ( void * pit , packet_info * pinfo , epan_dissect_t * edt _U_ , const void * vip )
{
conv_hash_t * hash = ( conv_hash_t * ) pit ;
const struct ip6_hdr * ip6h = ( const struct ip6_hdr * ) vip ;
address src ;
address dst ;
/* Addresses aren't implemented as 'address' type in struct ip6_hdr */
2015-10-21 19:04:16 +00:00
set_address ( & src , AT_IPv6 , sizeof ( struct e_in6_addr ) , & ip6h - > ip6_src ) ;
set_address ( & dst , AT_IPv6 , sizeof ( struct e_in6_addr ) , & ip6h - > ip6_dst ) ;
2014-07-25 15:34:51 +00:00
add_hostlist_table_data ( hash , & src , 0 , TRUE , 1 , pinfo - > fd - > pkt_len , & ipv6_host_dissector_info , PT_NONE ) ;
add_hostlist_table_data ( hash , & dst , 0 , FALSE , 1 , pinfo - > fd - > pkt_len , & ipv6_host_dissector_info , PT_NONE ) ;
return 1 ;
}
2014-12-09 02:40:24 +00:00
static gboolean
2015-10-29 03:30:55 +00:00
ipv6_filter_valid ( packet_info * pinfo )
2014-12-09 02:40:24 +00:00
{
return proto_is_frame_protocol ( pinfo - > layers , " ipv6 " ) ;
}
static gchar *
2015-10-29 03:30:55 +00:00
ipv6_build_filter ( packet_info * pinfo )
2014-12-09 02:40:24 +00:00
{
return g_strdup_printf ( " ipv6.addr eq %s and ipv6.addr eq %s " ,
2014-12-21 17:38:13 +00:00
address_to_str ( pinfo - > pool , & pinfo - > net_src ) ,
address_to_str ( pinfo - > pool , & pinfo - > net_dst ) ) ;
2014-12-09 02:40:24 +00:00
}
2002-10-24 06:17:36 +00:00
static const fragment_items ipv6_frag_items = {
2013-12-12 20:39:11 +00:00
& ett_ipv6_fragment ,
& ett_ipv6_fragments ,
& hf_ipv6_fragments ,
& hf_ipv6_fragment ,
& hf_ipv6_fragment_overlap ,
& hf_ipv6_fragment_overlap_conflict ,
& hf_ipv6_fragment_multiple_tails ,
& hf_ipv6_fragment_too_long_fragment ,
& hf_ipv6_fragment_error ,
& hf_ipv6_fragment_count ,
& hf_ipv6_reassembled_in ,
& hf_ipv6_reassembled_length ,
& hf_ipv6_reassembled_data ,
" IPv6 fragments "
2002-06-07 10:11:41 +00:00
} ;
2003-04-29 17:24:35 +00:00
static dissector_table_t ip_dissector_table ;
2015-08-21 02:54:36 +00:00
static dissector_table_t ipv6_next_header_dissector_table ;
2003-04-29 17:24:35 +00:00
2001-06-08 08:30:42 +00:00
/* Reassemble fragmented datagrams */
2005-09-28 22:15:38 +00:00
static gboolean ipv6_reassemble = TRUE ;
1999-11-16 11:44:20 +00:00
2010-08-21 17:45:03 +00:00
/* Place IPv6 summary in proto tree */
static gboolean ipv6_summary_in_tree = TRUE ;
2011-10-05 22:27:51 +00:00
# ifdef HAVE_GEOIP_V6
/* Look up addresses in GeoIP */
2011-10-11 17:57:09 +00:00
static gboolean ipv6_use_geoip = TRUE ;
2011-10-05 22:27:51 +00:00
# endif /* HAVE_GEOIP_V6 */
2012-05-31 07:25:11 +00:00
/* Perform strict RFC adherence checking */
static gboolean g_ipv6_rpl_srh_strict_rfc_checking = FALSE ;
2015-04-26 03:29:30 +00:00
/* Use heuristics to determine subdissector */
static gboolean try_heuristic_first = FALSE ;
2015-11-05 03:43:55 +00:00
/* Display IPv6 extension headers under the root tree */
static gboolean ipv6_exthdr_under_root = FALSE ;
2016-06-01 16:40:33 +00:00
/* Hide extension header generated field for length */
static gboolean ipv6_exthdr_hide_len_oct_field = FALSE ;
2001-06-08 08:30:42 +00:00
/*
* defragmentation of IPv6
*/
2013-03-22 23:59:54 +00:00
static reassembly_table ipv6_reassembly_table ;
2001-06-08 08:30:42 +00:00
2015-12-28 22:42:23 +00:00
/* http://www.iana.org/assignments/ipv6-parameters (last updated 2015-07-07) */
2012-03-12 23:13:03 +00:00
static const value_string ipv6_opt_vals [ ] = {
2015-12-28 22:42:23 +00:00
{ IP6OPT_PAD1 , " Pad1 " } ,
{ IP6OPT_PADN , " PadN " } ,
{ IP6OPT_TEL , " Tunnel Encapsulation Limit " } ,
{ IP6OPT_RTALERT , " Router Alert " } ,
{ IP6OPT_CALIPSO , " CALIPSO " } ,
{ IP6OPT_SMF_DPD , " SMF_DPD " } ,
{ IP6OPT_EXP_1E , " Experimental (0x1E) " } ,
{ IP6OPT_QUICKSTART , " Quick-Start " } ,
{ IP6OPT_EXP_3E , " Experimental (0x3E) " } ,
{ IP6OPT_EXP_5E , " Experimental (0x5E) " } ,
{ IP6OPT_RPL , " RPL Option " } ,
{ IP6OPT_MPL , " MPL Option " } ,
{ IP6OPT_EXP_7E , " Experimental (0x7E) " } ,
{ IP6OPT_ENDI , " Endpoint Identification " } ,
{ IP6OPT_ILNP_NONCE , " ILNP Nonce " } ,
{ IP6OPT_LIO , " Line-Identification Option " } ,
{ IP6OPT_EXP_9E , " Experimental (0x9E) " } ,
{ IP6OPT_EXP_BE , " Experimental (0xBE) " } ,
{ IP6OPT_JUMBO , " Jumbo Payload " } ,
{ IP6OPT_HOME_ADDRESS , " Home Address " } ,
{ IP6OPT_EXP_DE , " Experimental (0xDE) " } ,
{ IP6OPT_IP_DFF , " IP_DFF " } ,
{ IP6OPT_EXP_FE , " Experimental (0xFE) " } ,
2012-03-12 23:13:03 +00:00
{ 0 , NULL }
} ;
2015-12-28 22:42:23 +00:00
value_string_ext ipv6_opt_vals_ext = VALUE_STRING_EXT_INIT ( ipv6_opt_vals ) ;
2012-03-12 23:13:03 +00:00
2015-12-13 21:54:16 +00:00
gboolean
2015-12-15 00:25:31 +00:00
capture_ipv6 ( const guchar * pd , int offset , int len , capture_packet_info_t * cpinfo , const union wtap_pseudo_header * pseudo_header _U_ )
2002-10-22 22:04:23 +00:00
{
2013-12-12 20:39:11 +00:00
guint8 nxt ;
int advance ;
2002-10-25 23:23:28 +00:00
2015-12-13 21:54:16 +00:00
if ( ! BYTES_ARE_IN_FRAME ( offset , len , 4 + 4 + 16 + 16 ) )
return FALSE ;
2015-12-19 15:11:40 +00:00
capture_dissector_increment_count ( cpinfo , proto_ipv6 ) ;
2013-12-12 20:39:11 +00:00
nxt = pd [ offset + 6 ] ; /* get the "next header" value */
offset + = 4 + 4 + 16 + 16 ; /* skip past the IPv6 header */
2002-10-25 23:23:28 +00:00
again :
2013-12-12 20:39:11 +00:00
switch ( nxt ) {
case IP_PROTO_HOPOPTS :
case IP_PROTO_ROUTING :
case IP_PROTO_DSTOPTS :
2015-12-13 21:54:16 +00:00
if ( ! BYTES_ARE_IN_FRAME ( offset , len , 2 ) )
return FALSE ;
2013-12-12 20:39:11 +00:00
nxt = pd [ offset ] ;
advance = ( pd [ offset + 1 ] + 1 ) < < 3 ;
2015-12-13 21:54:16 +00:00
if ( ! BYTES_ARE_IN_FRAME ( offset , len , advance ) )
return FALSE ;
2013-12-12 20:39:11 +00:00
offset + = advance ;
goto again ;
case IP_PROTO_FRAGMENT :
2015-12-13 21:54:16 +00:00
if ( ! BYTES_ARE_IN_FRAME ( offset , len , 2 ) )
return FALSE ;
2013-12-12 20:39:11 +00:00
nxt = pd [ offset ] ;
advance = 8 ;
2015-12-13 21:54:16 +00:00
if ( ! BYTES_ARE_IN_FRAME ( offset , len , advance ) )
return FALSE ;
2013-12-12 20:39:11 +00:00
offset + = advance ;
goto again ;
case IP_PROTO_AH :
2015-12-13 21:54:16 +00:00
if ( ! BYTES_ARE_IN_FRAME ( offset , len , 2 ) )
return FALSE ;
2013-12-12 20:39:11 +00:00
nxt = pd [ offset ] ;
advance = 8 + ( ( pd [ offset + 1 ] - 1 ) < < 2 ) ;
2015-12-13 21:54:16 +00:00
if ( ! BYTES_ARE_IN_FRAME ( offset , len , advance ) )
return FALSE ;
2013-12-12 20:39:11 +00:00
offset + = advance ;
goto again ;
case IP_PROTO_SHIM6 :
2015-12-13 21:54:16 +00:00
if ( ! BYTES_ARE_IN_FRAME ( offset , len , 2 ) )
return FALSE ;
2013-12-12 20:39:11 +00:00
nxt = pd [ offset ] ;
advance = ( pd [ offset + 1 ] + 1 ) < < 3 ;
2015-12-13 21:54:16 +00:00
if ( ! BYTES_ARE_IN_FRAME ( offset , len , advance ) )
return FALSE ;
2013-12-12 20:39:11 +00:00
offset + = advance ;
goto again ;
}
2015-12-15 00:25:31 +00:00
return try_capture_dissector ( " ipv6.nxt " , nxt , pd , offset , len , cpinfo , pseudo_header ) ;
2002-10-22 22:04:23 +00:00
}
2011-10-05 22:27:51 +00:00
# ifdef HAVE_GEOIP_V6
static void
2014-10-13 02:09:35 +00:00
add_geoip_info_entry ( proto_tree * geoip_info_tree , proto_item * geoip_info_item , tvbuff_t * tvb , gint offset , const struct e_in6_addr * ip , int isdst )
2011-10-05 22:27:51 +00:00
{
2013-12-12 20:39:11 +00:00
guint num_dbs = geoip_db_num_dbs ( ) ;
guint item_cnt = 0 ;
guint dbnum ;
2011-10-05 22:27:51 +00:00
2013-12-12 20:39:11 +00:00
for ( dbnum = 0 ; dbnum < num_dbs ; dbnum + + ) {
2015-01-18 01:34:35 +00:00
char * geoip_str = geoip_db_lookup_ipv6 ( dbnum , * ip , NULL ) ;
2013-12-12 20:39:11 +00:00
int db_type = geoip_db_type ( dbnum ) ;
2012-05-30 05:33:37 +00:00
2013-12-12 20:39:11 +00:00
int geoip_hf , geoip_local_hf ;
2011-10-05 22:27:51 +00:00
2013-12-12 20:39:11 +00:00
switch ( db_type ) {
case GEOIP_COUNTRY_EDITION_V6 :
geoip_hf = hf_geoip_country ;
geoip_local_hf = ( isdst ) ? hf_geoip_dst_country : hf_geoip_src_country ;
break ;
2011-10-05 22:27:51 +00:00
# if NUM_DB_TYPES > 31
2013-12-12 20:39:11 +00:00
case GEOIP_CITY_EDITION_REV0_V6 :
case GEOIP_CITY_EDITION_REV1_V6 :
geoip_hf = hf_geoip_city ;
geoip_local_hf = ( isdst ) ? hf_geoip_dst_city : hf_geoip_src_city ;
break ;
case GEOIP_ORG_EDITION_V6 :
geoip_hf = hf_geoip_org ;
geoip_local_hf = ( isdst ) ? hf_geoip_dst_org : hf_geoip_src_org ;
break ;
case GEOIP_ISP_EDITION_V6 :
geoip_hf = hf_geoip_isp ;
geoip_local_hf = ( isdst ) ? hf_geoip_dst_isp : hf_geoip_src_isp ;
break ;
case GEOIP_ASNUM_EDITION_V6 :
geoip_hf = hf_geoip_asnum ;
geoip_local_hf = ( isdst ) ? hf_geoip_dst_asnum : hf_geoip_src_asnum ;
break ;
2011-10-05 22:27:51 +00:00
# endif /* DB_NUM_TYPES */
2013-12-12 20:39:11 +00:00
case WS_LAT_FAKE_EDITION :
geoip_hf = hf_geoip_lat ;
geoip_local_hf = ( isdst ) ? hf_geoip_dst_lat : hf_geoip_src_lat ;
break ;
case WS_LON_FAKE_EDITION :
geoip_hf = hf_geoip_lon ;
geoip_local_hf = ( isdst ) ? hf_geoip_dst_lon : hf_geoip_src_lon ;
break ;
default :
continue ;
}
2011-10-05 22:27:51 +00:00
2013-12-12 20:39:11 +00:00
if ( geoip_str ) {
proto_item * item ;
if ( db_type = = WS_LAT_FAKE_EDITION | | db_type = = WS_LON_FAKE_EDITION ) {
/* Convert latitude, longitude to double. Fix bug #5077 */
item = proto_tree_add_double_format_value ( geoip_info_tree , geoip_local_hf , tvb ,
offset , 16 , g_ascii_strtod ( geoip_str , NULL ) , " %s " , geoip_str ) ;
PROTO_ITEM_SET_GENERATED ( item ) ;
item = proto_tree_add_double_format_value ( geoip_info_tree , geoip_hf , tvb ,
offset , 16 , g_ascii_strtod ( geoip_str , NULL ) , " %s " , geoip_str ) ;
PROTO_ITEM_SET_GENERATED ( item ) ;
PROTO_ITEM_SET_HIDDEN ( item ) ;
} else {
item = proto_tree_add_string ( geoip_info_tree , geoip_local_hf , tvb ,
offset , 16 , geoip_str ) ;
PROTO_ITEM_SET_GENERATED ( item ) ;
item = proto_tree_add_string ( geoip_info_tree , geoip_hf , tvb ,
offset , 16 , geoip_str ) ;
PROTO_ITEM_SET_GENERATED ( item ) ;
PROTO_ITEM_SET_HIDDEN ( item ) ;
}
item_cnt + + ;
proto_item_append_text ( geoip_info_item , " %s%s " , plurality ( item_cnt , " " , " , " ) , geoip_str ) ;
2015-01-18 01:34:35 +00:00
wmem_free ( NULL , geoip_str ) ;
2013-12-12 20:39:11 +00:00
}
2011-10-05 22:27:51 +00:00
}
2013-12-12 20:39:11 +00:00
if ( item_cnt = = 0 )
proto_item_append_text ( geoip_info_item , " Unknown " ) ;
2012-05-30 05:33:37 +00:00
}
2011-10-05 22:27:51 +00:00
2012-05-30 05:33:37 +00:00
static void
add_geoip_info ( proto_tree * tree , tvbuff_t * tvb , gint offset , const struct e_in6_addr * src , const struct e_in6_addr * dst )
{
2013-12-12 20:39:11 +00:00
guint num_dbs ;
proto_item * geoip_info_item ;
2014-10-13 02:09:35 +00:00
proto_tree * geoip_info_tree ;
2011-10-05 22:27:51 +00:00
2013-12-12 20:39:11 +00:00
num_dbs = geoip_db_num_dbs ( ) ;
if ( num_dbs < 1 )
2012-05-30 05:33:37 +00:00
return ;
2011-10-05 22:27:51 +00:00
2014-10-13 02:09:35 +00:00
geoip_info_tree = proto_tree_add_subtree ( tree , tvb , offset + IP6H_SRC , 16 , ett_geoip_info , & geoip_info_item , " Source GeoIP: " ) ;
2013-12-12 20:39:11 +00:00
PROTO_ITEM_SET_GENERATED ( geoip_info_item ) ;
2014-10-13 02:09:35 +00:00
add_geoip_info_entry ( geoip_info_tree , geoip_info_item , tvb , offset + IP6H_SRC , src , 0 ) ;
2011-10-05 22:27:51 +00:00
2014-10-13 02:09:35 +00:00
geoip_info_tree = proto_tree_add_subtree ( tree , tvb , offset + IP6H_DST , 16 , ett_geoip_info , & geoip_info_item , " Destination GeoIP: " ) ;
2013-12-12 20:39:11 +00:00
PROTO_ITEM_SET_GENERATED ( geoip_info_item ) ;
2014-10-13 02:09:35 +00:00
add_geoip_info_entry ( geoip_info_tree , geoip_info_item , tvb , offset + IP6H_DST , dst , 1 ) ;
2011-10-05 22:27:51 +00:00
}
# endif /* HAVE_GEOIP_V6 */
2001-06-08 08:30:42 +00:00
static void
ipv6_reassemble_init ( void )
{
2013-12-12 20:39:11 +00:00
reassembly_table_init ( & ipv6_reassembly_table ,
& addresses_reassembly_table_functions ) ;
2001-06-08 08:30:42 +00:00
}
2015-06-28 11:06:31 +00:00
static void
ipv6_reassemble_cleanup ( void )
{
reassembly_table_destroy ( & ipv6_reassembly_table ) ;
}
2007-03-30 14:43:55 +00:00
enum {
2013-12-12 20:39:11 +00:00
IPv6_RT_HEADER_SOURCE_ROUTING = 0 ,
IPv6_RT_HEADER_NIMROD ,
IPv6_RT_HEADER_MobileIP ,
2016-05-28 00:55:04 +00:00
IPv6_RT_HEADER_RPL ,
IPv6_RT_HEADER_SEGMENT_ROUTING
2007-03-30 14:43:55 +00:00
} ;
2012-02-01 02:05:19 +00:00
/* Routing Header Types */
2007-03-30 14:43:55 +00:00
static const value_string routing_header_type [ ] = {
2013-12-12 20:39:11 +00:00
{ IPv6_RT_HEADER_SOURCE_ROUTING , " IPv6 Source Routing " } ,
{ IPv6_RT_HEADER_NIMROD , " Nimrod " } ,
{ IPv6_RT_HEADER_MobileIP , " Mobile IP " } ,
{ IPv6_RT_HEADER_RPL , " RPL " } ,
2016-05-28 00:55:04 +00:00
{ IPv6_RT_HEADER_SEGMENT_ROUTING , " Segment Routing " } ,
2013-12-12 20:39:11 +00:00
{ 0 , NULL }
2007-03-30 14:43:55 +00:00
} ;
2016-07-09 01:22:03 +00:00
struct rthdr_proto_item {
proto_item * len ;
proto_item * type ;
proto_item * segs ;
} ;
2016-06-01 16:26:54 +00:00
static proto_item *
_proto_tree_add_ipv6_vector_address ( proto_tree * tree , int hfindex , tvbuff_t * tvb , gint start ,
gint length , const struct e_in6_addr * value_ptr , int idx )
{
address addr ;
gchar * str ;
set_address ( & addr , AT_IPv6 , IPv6_ADDR_SIZE , value_ptr ) ;
str = address_with_resolution_to_str ( wmem_packet_scope ( ) , & addr ) ;
return proto_tree_add_ipv6_format ( tree , hfindex , tvb , start , length ,
value_ptr , " Address[%d]: %s " , idx , str ) ;
}
2016-07-09 01:22:03 +00:00
/* IPv6 Source Routing Header (Type 0) */
static void
dissect_routing6_rt0 ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * rthdr_tree ,
struct rthdr_proto_item * rthdr_ti , struct ip6_rthdr rt )
{
proto_item * ti ;
gint idx ;
gint rt0_addr_count ;
const struct e_in6_addr * addr = NULL ;
2011-12-21 14:18:28 +00:00
2016-07-09 01:22:03 +00:00
proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_src_reserved , tvb , offset , 4 , ENC_NA ) ;
offset + = 4 ;
2011-12-21 14:18:28 +00:00
2016-07-09 01:22:03 +00:00
if ( rt . ip6r_len % 2 ! = 0 ) {
expert_add_info_format ( pinfo , rthdr_ti - > len , & ei_ipv6_routing_invalid_length ,
" IPv6 Routing Header extension header length must not be odd " ) ;
}
rt0_addr_count = rt . ip6r_len / 2 ;
if ( rt . ip6r_segleft > rt0_addr_count ) {
expert_add_info_format ( pinfo , rthdr_ti - > segs , & ei_ipv6_routing_invalid_segleft ,
" IPv6 Type 0 Routing Header segments left field must not exceed address count (%u) " , rt0_addr_count ) ;
}
2011-12-21 14:18:28 +00:00
2016-07-09 01:22:03 +00:00
for ( idx = 1 ; idx < = rt0_addr_count ; idx + + ) {
addr = tvb_get_ptr_ipv6 ( tvb , offset ) ;
ti = _proto_tree_add_ipv6_vector_address ( rthdr_tree , hf_ipv6_routing_src_addr , tvb ,
offset , IPv6_ADDR_SIZE , addr , idx ) ;
offset + = IPv6_ADDR_SIZE ;
if ( in6_is_addr_multicast ( addr ) ) {
expert_add_info ( pinfo , ti , & ei_ipv6_src_route_list_multicast_addr ) ;
}
2016-06-01 16:40:33 +00:00
}
2011-12-21 14:18:28 +00:00
2016-07-09 01:22:03 +00:00
if ( addr ! = NULL & & rt . ip6r_segleft > 0 ) {
alloc_address_wmem ( pinfo - > pool , & pinfo - > dst , AT_IPv6 , IPv6_ADDR_SIZE , addr ) ;
}
}
2011-12-21 14:18:28 +00:00
2016-07-09 01:22:03 +00:00
/* Mobile IPv6 Routing Header (Type 2) */
static void
dissect_routing6_mipv6 ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * rthdr_tree ,
struct rthdr_proto_item * rthdr_ti , struct ip6_rthdr rt )
{
proto_item * ti ;
const struct e_in6_addr * addr ;
2015-09-06 12:08:08 +00:00
2016-07-09 01:22:03 +00:00
proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_mipv6_reserved , tvb , offset , 4 , ENC_NA ) ;
offset + = 4 ;
2011-12-21 14:18:28 +00:00
2016-07-09 01:22:03 +00:00
if ( rt . ip6r_len ! = 2 ) {
expert_add_info_format ( pinfo , rthdr_ti - > len , & ei_ipv6_routing_invalid_length ,
" IPv6 Type 2 Routing Header extension header length must equal 2 " ) ;
}
if ( rt . ip6r_segleft ! = 1 ) {
expert_add_info_format ( pinfo , rthdr_ti - > segs , & ei_ipv6_routing_invalid_segleft ,
" IPv6 Type 2 Routing Header segments left field must equal 1 " ) ;
}
2013-12-12 20:39:11 +00:00
2016-07-09 01:22:03 +00:00
addr = tvb_get_ptr_ipv6 ( tvb , offset ) ;
ti = _proto_tree_add_ipv6_vector_address ( rthdr_tree , hf_ipv6_routing_mipv6_home_address , tvb ,
offset , IPv6_ADDR_SIZE , addr , 1 ) ;
if ( in6_is_addr_multicast ( addr ) ) {
expert_add_info ( pinfo , ti , & ei_ipv6_src_route_list_multicast_addr ) ;
2015-10-03 13:24:04 +00:00
}
2015-09-06 12:08:08 +00:00
2016-07-09 01:22:03 +00:00
if ( addr ! = NULL & & rt . ip6r_segleft > 0 ) {
alloc_address_wmem ( pinfo - > pool , & pinfo - > dst , AT_IPv6 , IPv6_ADDR_SIZE , addr ) ;
}
}
2015-10-03 13:24:04 +00:00
2016-07-09 01:22:03 +00:00
/* RPL Source Routing Header (Type 3) */
static void
dissect_routing6_rpl ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * rthdr_tree ,
struct rthdr_proto_item * rthdr_ti , struct ip6_rthdr rt )
{
proto_item * pi = proto_tree_get_parent ( rthdr_tree ) ;
proto_item * ti ;
2016-06-13 03:56:57 +00:00
guint8 cmprI , cmprE , cmprX , pad ;
2016-07-09 01:22:03 +00:00
guint32 reserved ;
gint idx ;
gint rpl_addr_count ;
struct e_in6_addr rpl_fulladdr ;
const struct e_in6_addr * ip6_dst_addr , * ip6_src_addr ;
2016-06-13 03:56:57 +00:00
wmem_array_t * rpl_addr_vector = NULL ;
guint i ;
2016-07-09 01:22:03 +00:00
/* IPv6 destination address used for elided bytes */
ip6_dst_addr = ( const struct e_in6_addr * ) pinfo - > dst . data ;
/* IPv6 source address used for strict checking */
ip6_src_addr = ( const struct e_in6_addr * ) pinfo - > src . data ;
/* from RFC6554: Multicast addresses MUST NOT appear in the IPv6 Destination Address field */
if ( in6_is_addr_multicast ( ip6_dst_addr ) ) {
expert_add_info ( pinfo , pi , & ei_ipv6_dst_addr_not_multicast ) ;
2015-10-03 13:24:04 +00:00
}
2011-06-09 18:02:13 +00:00
2016-07-09 01:22:03 +00:00
proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_rpl_cmprI , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_rpl_cmprE , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
ti = proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_rpl_pad , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2011-06-09 18:02:13 +00:00
2016-07-09 01:22:03 +00:00
cmprI = tvb_get_guint8 ( tvb , offset ) & 0xF0 ;
cmprE = tvb_get_guint8 ( tvb , offset ) & 0x0F ;
pad = tvb_get_guint8 ( tvb , offset + 1 ) & 0xF0 ;
2011-06-09 18:02:13 +00:00
2016-07-09 01:22:03 +00:00
/* Shift bytes over */
cmprI > > = 4 ;
pad > > = 4 ;
2011-10-05 22:27:51 +00:00
2016-07-09 01:22:03 +00:00
/* from RFC6554: when CmprI and CmprE are both 0, Pad MUST carry a value of 0 */
if ( cmprI = = 0 & & cmprE = = 0 & & pad ! = 0 ) {
expert_add_info_format ( pinfo , ti , & ei_ipv6_routing_rpl_cmpri_cmpre_pad , " When cmprI equals 0 and cmprE equals 0, pad MUST equal 0 but instead was %d " , pad ) ;
}
2012-05-31 07:25:11 +00:00
2016-07-09 01:22:03 +00:00
ti = proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_rpl_reserved , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
reserved = tvb_get_bits32 ( tvb , ( ( offset + 1 ) * 8 ) + 4 , 20 , ENC_BIG_ENDIAN ) ;
2012-05-31 07:25:11 +00:00
2016-07-09 01:22:03 +00:00
if ( reserved ! = 0 ) {
expert_add_info_format ( pinfo , ti , & ei_ipv6_routing_rpl_reserved , " Reserved field must equal 0 but instead was %d " , reserved ) ;
}
2012-05-31 07:25:11 +00:00
2016-07-09 01:22:03 +00:00
/* From RFC6554:
* n = ( ( ( Hdr Ext Len * 8 ) - Pad - ( 16 - CmprE ) ) / ( 16 - CmprI ) ) + 1
*/
rpl_addr_count = 0 ;
if ( rt . ip6r_len > 0 ) {
rpl_addr_count = ( ( ( rt . ip6r_len * 8 ) - pad - ( 16 - cmprE ) ) / ( 16 - cmprI ) ) + 1 ;
}
ti = proto_tree_add_int ( rthdr_tree , hf_ipv6_routing_rpl_addr_count , tvb , offset , 2 , rpl_addr_count ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
if ( rpl_addr_count < 0 ) {
/* This error should always be reported */
expert_add_info_format ( pinfo , ti , & ei_ipv6_routing_rpl_addr_count_ge0 , " Calculated total address count must be greater than or equal to 0, instead was %d " , rpl_addr_count ) ;
}
else if ( rt . ip6r_segleft > ( guint ) rpl_addr_count ) {
expert_add_info_format ( pinfo , rthdr_ti - > segs , & ei_ipv6_routing_invalid_segleft ,
" IPv6 RPL Routing Header segments left field must not exceed address count (%d) " , rpl_addr_count ) ;
}
2011-10-05 22:27:51 +00:00
2016-07-09 01:22:03 +00:00
if ( rpl_addr_count > 0 ) {
offset + = 4 ;
2012-05-15 19:11:08 +00:00
2016-06-13 03:56:57 +00:00
if ( g_ipv6_rpl_srh_strict_rfc_checking )
rpl_addr_vector = wmem_array_sized_new ( wmem_packet_scope ( ) , IPv6_ADDR_SIZE , rpl_addr_count ) ;
2016-07-09 01:22:03 +00:00
/* We use cmprI for internal (e.g.: not last) address for how many bytes to elide, so actual bytes present = 16-CmprI */
2016-06-13 03:56:57 +00:00
for ( idx = 1 ; idx < = rpl_addr_count ; idx + + ) {
if ( idx = = rpl_addr_count )
cmprX = 16 - cmprE ;
else
cmprX = 16 - cmprI ;
proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_rpl_addr , tvb , offset , cmprX , ENC_NA ) ;
2016-07-09 01:22:03 +00:00
/* Display Full Address */
memcpy ( & rpl_fulladdr , ip6_dst_addr , IPv6_ADDR_SIZE ) ;
2016-06-13 03:56:57 +00:00
tvb_memcpy ( tvb , & rpl_fulladdr . bytes [ 16 - cmprX ] , offset , cmprX ) ;
2016-07-09 01:22:03 +00:00
ti = _proto_tree_add_ipv6_vector_address ( rthdr_tree , hf_ipv6_routing_rpl_fulladdr , tvb ,
2016-06-13 03:56:57 +00:00
offset , cmprX , & rpl_fulladdr , idx ) ;
2016-07-09 01:22:03 +00:00
PROTO_ITEM_SET_GENERATED ( ti ) ;
2016-06-13 03:56:57 +00:00
offset + = cmprX ;
2016-07-09 01:22:03 +00:00
/* IPv6 Source and Destination addresses of the encapsulating datagram (MUST) not appear in the SRH*/
if ( memcmp ( & rpl_fulladdr , ip6_src_addr , IPv6_ADDR_SIZE ) = = 0 ) {
expert_add_info ( pinfo , ti , & ei_ipv6_src_route_list_src_addr ) ;
}
if ( memcmp ( & rpl_fulladdr , ip6_dst_addr , IPv6_ADDR_SIZE ) = = 0 ) {
expert_add_info ( pinfo , ti , & ei_ipv6_src_route_list_dst_addr ) ;
}
2016-06-02 03:15:11 +00:00
2016-07-09 01:22:03 +00:00
/* Multicast addresses MUST NOT appear in the in SRH */
if ( in6_is_addr_multicast ( & rpl_fulladdr ) ) {
expert_add_info ( pinfo , ti , & ei_ipv6_src_route_list_multicast_addr ) ;
}
2016-06-02 03:15:11 +00:00
2016-07-09 01:22:03 +00:00
if ( g_ipv6_rpl_srh_strict_rfc_checking ) {
/* from RFC6554: */
/* The SRH MUST NOT specify a path that visits a node more than once. */
2016-06-13 03:56:57 +00:00
/* To do this, we will just check the current 'addr' against the previous addresses */
for ( i = 0 ; i < wmem_array_get_count ( rpl_addr_vector ) ; i + + ) {
2016-07-09 01:22:03 +00:00
/* Compare the addresses */
2016-06-13 03:56:57 +00:00
if ( memcmp ( & rpl_fulladdr , wmem_array_index ( rpl_addr_vector , i ) , IPv6_ADDR_SIZE ) = = 0 ) {
/* Found a previous that is the same */
2016-07-09 01:22:03 +00:00
expert_add_info ( pinfo , ti , & ei_ipv6_src_route_list_mult_inst_same_addr ) ;
break ;
2015-10-03 13:24:04 +00:00
}
2016-07-09 01:22:03 +00:00
}
2016-06-13 03:56:57 +00:00
wmem_array_append ( rpl_addr_vector , & rpl_fulladdr , 1 ) ;
2016-07-09 01:22:03 +00:00
}
if ( rt . ip6r_segleft > 0 ) {
alloc_address_wmem ( pinfo - > pool , & pinfo - > dst , AT_IPv6 , IPv6_ADDR_SIZE , & rpl_fulladdr ) ;
2012-05-15 19:11:08 +00:00
}
}
1999-10-12 23:12:06 +00:00
}
2016-07-09 01:22:03 +00:00
}
1999-10-12 23:12:06 +00:00
2016-07-09 01:22:03 +00:00
/* Segment Routing Header (Type 4) */
/* draft-ietf-6man-segment-routing-header-01 */
static void
dissect_routing6_srh ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * rthdr_tree ,
struct rthdr_proto_item * rthdr_ti , struct ip6_rthdr rt )
{
proto_item * ti ;
gint offlim , offstart ;
gint idx ;
gint srh_first_seg , srh_addr_count ;
const struct e_in6_addr * addr ;
proto_tree * rthdr_srh_addr_tree ;
static const int * srh_flags [ ] = {
& hf_ipv6_routing_srh_flag_c ,
& hf_ipv6_routing_srh_flag_p ,
& hf_ipv6_routing_srh_flag_o ,
& hf_ipv6_routing_srh_flag_a ,
& hf_ipv6_routing_srh_flag_h ,
& hf_ipv6_routing_srh_flag_unused ,
NULL
} ;
srh_first_seg = tvb_get_guint8 ( tvb , offset ) ;
proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_srh_first_seg , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
srh_addr_count = srh_first_seg + 1 ;
/* TODO: dissect TLVs */
ti = proto_tree_add_bitmask ( rthdr_tree , tvb , offset , hf_ipv6_routing_srh_flags ,
ett_ipv6_routing_srh_flags , srh_flags , ENC_BIG_ENDIAN ) ;
expert_add_info_format ( pinfo , ti , & ei_ipv6_routing_not_implemented ,
" Dissection for SRH TLVs not yet implemented " ) ;
offset + = 2 ;
proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_srh_reserved , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
if ( rt . ip6r_segleft > srh_first_seg ) {
expert_add_info_format ( pinfo , rthdr_ti - > segs , & ei_ipv6_routing_invalid_segleft ,
" IPv6 Type 4 Routing Header segments left field must not exceed first segment (%u) " , srh_first_seg ) ;
}
2016-05-28 00:55:04 +00:00
2016-07-09 01:22:03 +00:00
offstart = offset ;
offlim = offset + srh_addr_count * IPv6_ADDR_SIZE ;
2016-05-28 00:55:04 +00:00
2016-07-09 01:22:03 +00:00
/* Destination address is the first vector address */
addr = tvb_get_ptr_ipv6 ( tvb , offset ) ;
if ( in6_is_addr_multicast ( addr ) ) {
expert_add_info ( pinfo , ti , & ei_ipv6_src_route_list_multicast_addr ) ;
}
ti = _proto_tree_add_ipv6_vector_address ( rthdr_tree , hf_ipv6_routing_srh_addr , tvb ,
offset , IPv6_ADDR_SIZE , addr , 0 ) ;
if ( rt . ip6r_segleft = = 1 ) {
proto_item_append_text ( ti , " [next segment] " ) ;
}
if ( rt . ip6r_segleft > 0 ) {
alloc_address_wmem ( pinfo - > pool , & pinfo - > dst , AT_IPv6 , IPv6_ADDR_SIZE , addr ) ;
}
offset + = IPv6_ADDR_SIZE ;
for ( idx = 1 ; offset < offlim ; offset + = IPv6_ADDR_SIZE , idx + + ) {
addr = tvb_get_ptr_ipv6 ( tvb , offset ) ;
2016-05-28 00:55:04 +00:00
if ( in6_is_addr_multicast ( addr ) ) {
expert_add_info ( pinfo , ti , & ei_ipv6_src_route_list_multicast_addr ) ;
}
ti = _proto_tree_add_ipv6_vector_address ( rthdr_tree , hf_ipv6_routing_srh_addr , tvb ,
2016-07-09 01:22:03 +00:00
offset , IPv6_ADDR_SIZE , addr , idx ) ;
if ( idx = = rt . ip6r_segleft - 1 ) {
2016-06-11 22:15:01 +00:00
proto_item_append_text ( ti , " [next segment] " ) ;
}
2016-07-09 01:22:03 +00:00
}
2016-05-28 00:55:04 +00:00
2016-07-09 01:22:03 +00:00
rthdr_srh_addr_tree = proto_tree_add_subtree_format ( rthdr_tree , tvb , offstart , srh_addr_count * IPv6_ADDR_SIZE ,
ett_ipv6_routing_srh_vect , & ti , " Segments in Traversal Order " ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
offset - = IPv6_ADDR_SIZE ;
for ( idx = srh_first_seg ; offset > = offstart ; offset - = IPv6_ADDR_SIZE , idx - - ) {
addr = tvb_get_ptr_ipv6 ( tvb , offset ) ;
ti = _proto_tree_add_ipv6_vector_address ( rthdr_srh_addr_tree , hf_ipv6_routing_srh_addr , tvb ,
offset , IPv6_ADDR_SIZE , addr , idx ) ;
if ( idx = = rt . ip6r_segleft - 1 ) {
proto_item_append_text ( ti , " [next segment] " ) ;
2016-05-28 00:55:04 +00:00
}
}
2016-07-09 01:22:03 +00:00
}
static int
dissect_routing6 ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ ) {
struct ip6_rthdr rt ;
guint len ;
proto_tree * rthdr_tree ;
proto_item * pi , * ti ;
struct rthdr_proto_item rthdr_ti ;
int offset = 0 ;
ipv6_meta_t * ipv6_info ;
ipv6_info = ( ipv6_meta_t * ) p_get_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , IPV6_PROTO_META ) ;
col_append_sep_str ( pinfo - > cinfo , COL_INFO , " , " , " IPv6 routing " ) ;
tvb_memcpy ( tvb , ( guint8 * ) & rt , offset , sizeof ( rt ) ) ;
len = ( rt . ip6r_len + 1 ) < < 3 ;
/* !!! specify length */
pi = proto_tree_add_item ( tree , proto_ipv6_routing , tvb , offset , len , ENC_NA ) ;
proto_item_append_text ( pi , " (%s) " , val_to_str ( rt . ip6r_type , routing_header_type , " Unknown type %u " ) ) ;
rthdr_tree = proto_item_add_subtree ( pi , ett_ipv6_routing ) ;
proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_nxt , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
rthdr_ti . len = proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_len , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
ti = proto_tree_add_uint ( rthdr_tree , hf_ipv6_routing_len_oct , tvb , offset , 1 , len ) ;
proto_item_append_text ( ti , " bytes " ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
if ( ipv6_exthdr_hide_len_oct_field ) {
PROTO_ITEM_SET_HIDDEN ( ti ) ;
proto_item_append_text ( rthdr_ti . len , " (%d bytes) " , len ) ;
}
offset + = 1 ;
rthdr_ti . type = proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_type , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
rthdr_ti . segs = proto_tree_add_item ( rthdr_tree , hf_ipv6_routing_segleft , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
2016-05-28 00:55:04 +00:00
2016-07-09 01:22:03 +00:00
switch ( rt . ip6r_type ) {
case IPv6_RT_HEADER_SOURCE_ROUTING :
dissect_routing6_rt0 ( tvb , offset , pinfo , rthdr_tree , & rthdr_ti , rt ) ;
break ;
case IPv6_RT_HEADER_MobileIP :
dissect_routing6_mipv6 ( tvb , offset , pinfo , rthdr_tree , & rthdr_ti , rt ) ;
break ;
case IPv6_RT_HEADER_RPL :
dissect_routing6_rpl ( tvb , offset , pinfo , rthdr_tree , & rthdr_ti , rt ) ;
break ;
case IPv6_RT_HEADER_SEGMENT_ROUTING :
dissect_routing6_srh ( tvb , offset , pinfo , rthdr_tree , & rthdr_ti , rt ) ;
break ;
default :
break ;
2015-10-09 09:10:31 +00:00
}
2015-10-03 13:24:04 +00:00
ipv6_info - > exthdr_count + + ;
1999-10-12 23:12:06 +00:00
return len ;
1999-03-28 18:32:03 +00:00
}
static int
2001-06-26 17:31:36 +00:00
dissect_frag6 ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree ,
2015-09-18 01:08:34 +00:00
guint16 * frag_off , gboolean * frag_flg , guint32 * frag_ident ) {
proto_item * pi , * ti ;
2015-08-06 21:35:23 +00:00
proto_tree * frag_tree ;
2015-09-18 01:08:34 +00:00
guint8 nxt ;
guint16 offlg ;
2015-08-09 22:13:06 +00:00
ipv6_meta_t * ipv6_info ;
ipv6_info = ( ipv6_meta_t * ) p_get_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , IPV6_PROTO_META ) ;
1999-10-12 23:12:06 +00:00
2015-09-18 01:08:34 +00:00
nxt = tvb_get_guint8 ( tvb , offset ) ;
offlg = tvb_get_ntohs ( tvb , offset + 2 ) ;
* frag_off = offlg & IP6F_OFF_MASK ; /* offset in bytes */
* frag_flg = offlg & IP6F_MORE_FRAG ;
* frag_ident = tvb_get_ntohl ( tvb , offset + 4 ) ;
col_add_fstr ( pinfo - > cinfo , COL_INFO , " IPv6 fragment (off=%u more=%s ident=0x%08x nxt=%u) " ,
* frag_off , * frag_flg ? " y " : " n " , * frag_ident , nxt ) ;
2013-06-14 01:02:11 +00:00
2015-10-03 13:24:04 +00:00
/* IPv6 Fragmentation Header has fixed length of 8 bytes */
2015-09-30 14:30:33 +00:00
pi = proto_tree_add_item ( tree , proto_ipv6_fraghdr , tvb , offset , 8 , ENC_NA ) ;
2015-10-03 13:24:04 +00:00
if ( ipv6_info - > jumbo_length ) {
expert_add_info ( pinfo , pi , & ei_ipv6_opt_jumbo_fragment ) ;
}
2015-09-18 01:08:34 +00:00
2015-10-03 13:24:04 +00:00
frag_tree = proto_item_add_subtree ( pi , ett_ipv6_fraghdr ) ;
2015-09-18 01:08:34 +00:00
2015-10-03 13:24:04 +00:00
if ( frag_tree ) {
2015-09-18 01:08:34 +00:00
proto_tree_add_item ( frag_tree , hf_ipv6_fraghdr_nxt , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
proto_tree_add_item ( frag_tree , hf_ipv6_fraghdr_reserved_octet , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
ti = proto_tree_add_item ( frag_tree , hf_ipv6_fraghdr_offset , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
proto_item_append_text ( ti , " (%d bytes) " , * frag_off ) ;
proto_tree_add_item ( frag_tree , hf_ipv6_fraghdr_reserved_bits , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( frag_tree , hf_ipv6_fraghdr_more , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
proto_tree_add_item ( frag_tree , hf_ipv6_fraghdr_ident , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2015-09-28 13:46:10 +00:00
/*offset += 4;*/
2000-08-08 21:49:13 +00:00
}
2015-09-18 01:08:34 +00:00
2015-08-09 22:13:06 +00:00
ipv6_info - > exthdr_count + + ;
2015-09-18 01:08:34 +00:00
return 8 ;
1999-03-28 18:32:03 +00:00
}
2012-06-19 20:20:18 +00:00
2001-06-26 17:31:36 +00:00
static const value_string rtalertvals [ ] = {
{ IP6OPT_RTALERT_MLD , " MLD " } ,
{ IP6OPT_RTALERT_RSVP , " RSVP " } ,
2012-03-12 23:13:03 +00:00
{ IP6OPT_RTALERT_ACTNET , " Active Network " } ,
2007-05-08 22:25:03 +00:00
{ 0 , NULL }
2001-06-26 17:31:36 +00:00
} ;
2001-01-23 02:49:55 +00:00
2008-11-07 00:45:22 +00:00
static int
2015-09-11 08:06:49 +00:00
dissect_unknown_exthdr ( tvbuff_t * tvb , int offset , proto_tree * tree )
2008-11-07 00:45:22 +00:00
{
2013-12-12 20:39:11 +00:00
int len ;
2015-09-11 08:06:49 +00:00
proto_tree * unkhdr_tree ;
2012-05-08 17:34:46 +00:00
proto_item * ti , * ti_len ;
2008-11-07 00:45:22 +00:00
2012-05-08 17:34:46 +00:00
len = ( tvb_get_guint8 ( tvb , offset + 1 ) + 1 ) < < 3 ;
2008-11-07 00:45:22 +00:00
if ( tree ) {
2011-12-21 14:18:28 +00:00
/* !!! specify length */
2015-09-11 08:06:49 +00:00
ti = proto_tree_add_item ( tree , hf_ipv6_unknown_hdr , tvb , offset , len , ENC_NA ) ;
2008-11-07 00:45:22 +00:00
2015-09-11 08:06:49 +00:00
unkhdr_tree = proto_item_add_subtree ( ti , ett_ipv6 ) ;
2008-11-07 00:45:22 +00:00
2015-09-11 08:06:49 +00:00
proto_tree_add_item ( unkhdr_tree , hf_ipv6_unknown_hdr_nxt , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2012-05-08 17:34:46 +00:00
offset + = 1 ;
2008-11-07 00:45:22 +00:00
2016-06-01 16:40:33 +00:00
ti_len = proto_tree_add_item ( unkhdr_tree , hf_ipv6_unknown_hdr_len , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
ti = proto_tree_add_uint ( unkhdr_tree , hf_ipv6_unknown_hdr_len_oct , tvb , offset , 1 , len ) ;
proto_item_append_text ( ti , " bytes " ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
if ( ipv6_exthdr_hide_len_oct_field ) {
PROTO_ITEM_SET_HIDDEN ( ti ) ;
proto_item_append_text ( ti_len , " (%d bytes) " , len ) ;
}
2012-05-08 17:34:46 +00:00
/* offset += 1; */
2008-11-07 00:45:22 +00:00
}
return len ;
}
2015-12-29 12:15:44 +00:00
struct opt_proto_item {
proto_item * type , * len ;
} ;
/*
* Jumbo Payload Option
*
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| Option Type | Opt Data Len |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| Jumbo Payload Length |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
static void
dissect_opt_jumbo ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti , guint8 opt_len , gboolean hopopts )
{
ipv6_meta_t * ipv6_info = ( ipv6_meta_t * ) p_get_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , IPV6_PROTO_META ) ;
proto_item * pi = proto_tree_get_parent ( opt_tree ) ;
proto_item * ti ;
guint32 plen_jumbo ;
if ( opt_len ! = 4 ) {
expert_add_info_format ( pinfo , opt_ti - > len , & ei_ipv6_opt_invalid_len ,
" Jumbo Payload: Invalid length (%u bytes) " , opt_len ) ;
return ;
}
ti = proto_tree_add_item ( opt_tree , hf_ipv6_opt_jumbo , tvb , offset + 2 , 4 , ENC_BIG_ENDIAN ) ;
2016-07-14 16:55:31 +00:00
if ( ! hopopts ) {
2015-12-29 12:15:44 +00:00
expert_add_info ( pinfo , pi , & ei_ipv6_opt_jumbo_not_hopbyhop ) ;
return ;
}
if ( ipv6_info - > jumbogram ) {
/* XXX - Repeated jumbo TLV */
return ;
}
if ( ipv6_info - > payload_length ) {
expert_add_info ( pinfo , pi , & ei_ipv6_opt_jumbo_prohibited ) ;
proto_item_append_text ( ti , " [Ignored] " ) ;
return ;
}
2016-07-14 17:12:16 +00:00
plen_jumbo = tvb_get_ntohl ( tvb , offset + 2 ) ;
2015-12-29 12:15:44 +00:00
if ( plen_jumbo < 65536 ) {
expert_add_info ( pinfo , ti , & ei_ipv6_opt_jumbo_truncated ) ;
return ;
}
ipv6_info - > jumbogram = TRUE ;
ipv6_info - > jumbo_length = plen_jumbo ;
}
/*
* RPL Option
*
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
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| Option Type | Opt Data Len |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| O | R | F | 0 | 0 | 0 | 0 | 0 | RPLInstanceID | SenderRank |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| ( sub - TLVs ) |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
static void
dissect_opt_rpl ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti , guint8 opt_len )
{
static const int * rpl_flags [ ] = {
& hf_ipv6_opt_rpl_flag_o ,
& hf_ipv6_opt_rpl_flag_r ,
& hf_ipv6_opt_rpl_flag_f ,
& hf_ipv6_opt_rpl_flag_rsv ,
NULL
} ;
proto_item * ti ;
if ( opt_len < 4 ) {
expert_add_info_format ( pinfo , opt_ti - > len , & ei_ipv6_opt_invalid_len ,
" RPL Option: Invalid length (%u bytes) " , opt_len ) ;
return ;
}
proto_tree_add_bitmask ( opt_tree , tvb , offset + 2 , hf_ipv6_opt_rpl_flag , ett_ipv6_opt_rpl , rpl_flags , ENC_NA ) ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_rpl_instance_id , tvb , offset + 3 , 1 , ENC_NA ) ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_rpl_senderrank , tvb , offset + 4 , 2 , ENC_BIG_ENDIAN ) ;
/* TODO: Add dissection of sub-TLVs */
if ( opt_len > 4 ) {
ti = proto_tree_add_item ( opt_tree , hf_ipv6_opt_unknown_data , tvb , offset + 6 , opt_len - 4 , ENC_NA ) ;
expert_add_info ( pinfo , ti , & ei_ipv6_opt_unknown_data ) ;
}
}
/*
* Tunnel Encapsulation Limit Option
*
Option Type Opt Data Len Opt Data Len
0 1 2 3 4 5 6 7
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| 0 0 0 0 0 1 0 0 | 1 | Tun Encap Lim |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
static void
dissect_opt_tel ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti , guint8 opt_len )
{
if ( opt_len ! = 1 ) {
expert_add_info_format ( pinfo , opt_ti - > len , & ei_ipv6_opt_invalid_len ,
" Tunnel Encapsulation Limit: Invalid length (%u bytes) " , opt_len ) ;
return ;
}
proto_tree_add_item ( opt_tree , hf_ipv6_opt_tel , tvb , offset + 2 , 1 , ENC_BIG_ENDIAN ) ;
}
/*
* IPv6 Router Alert Option
*
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| 0 0 0 | 0 0 1 0 1 | 0 0 0 0 0 0 1 0 | Value ( 2 octets ) |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
length = 2
*/
static void
dissect_opt_rtalert ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti , guint8 opt_len )
{
if ( opt_len ! = 2 ) {
expert_add_info_format ( pinfo , opt_ti - > len , & ei_ipv6_opt_invalid_len ,
" Router alert: Invalid Length (%u bytes) " , opt_len ) ;
return ;
}
proto_tree_add_item ( opt_tree , hf_ipv6_opt_rtalert , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
}
static void
dissect_opt_quickstart ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti , guint8 opt_len )
{
ipv6_meta_t * ipv6_info = ( ipv6_meta_t * ) p_get_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , IPV6_PROTO_META ) ;
proto_item * pi = proto_tree_get_parent ( opt_tree ) ;
proto_item * ti ;
guint8 command , function , rate ;
guint8 ttl_diff = 0 ;
guint32 qs_ttl = 0 ;
if ( opt_len ! = 6 ) {
expert_add_info_format ( pinfo , opt_ti - > len , & ei_ipv6_opt_invalid_len ,
" Quick-Start: Invalid Length (%u bytes) " , opt_len ) ;
return ;
}
command = tvb_get_guint8 ( tvb , offset + 2 ) ;
function = command > > 4 ;
rate = command & QS_RATE_MASK ;
offset + = 2 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_qs_func , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
switch ( function ) {
case QS_RATE_REQUEST :
proto_tree_add_item ( opt_tree , hf_ipv6_opt_qs_rate , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
proto_tree_add_item_ret_uint ( opt_tree , hf_ipv6_opt_qs_ttl , tvb , offset , 1 , ENC_BIG_ENDIAN , & qs_ttl ) ;
ttl_diff = ( ipv6_info - > hop_limit - qs_ttl ) % 256 ;
ti = proto_tree_add_uint ( opt_tree , hf_ipv6_opt_qs_ttl_diff , tvb , offset , 1 , ttl_diff ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
proto_item_append_text ( pi , " , %s, QS TTL %u, QS TTL diff %u " ,
val_to_str_ext ( rate , & qs_rate_vals_ext , " Unknown (%u) " ) ,
qs_ttl , ttl_diff ) ;
offset + = 1 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_qs_nonce , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_qs_reserved , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
/* offset += 4; */
break ;
case QS_RATE_REPORT :
proto_tree_add_item ( opt_tree , hf_ipv6_opt_qs_rate , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_item_append_text ( pi , " , %s " , val_to_str_ext ( rate , & qs_rate_vals_ext , " Unknown (%u) " ) ) ;
offset + = 1 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_qs_unused , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_qs_nonce , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_qs_reserved , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
/* offset += 4; */
break ;
default :
break ;
}
}
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| Next Header | Hdr Ext Len | Option Type | Option Length |
+ - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - - - - - - - - - - - +
| CALIPSO Domain of Interpretation |
+ - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - - - - - - - - - - - +
| Cmpt Length | Sens Level | Checksum ( CRC - 16 ) |
+ - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - - - - - - - - - - - +
| Compartment Bitmap ( Optional ; variable length ) |
+ - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - - - - - - - - - - - +
*/
static void
dissect_opt_calipso ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti , guint8 opt_len )
{
guint32 cmpt_length = 0 ;
if ( opt_len < 8 ) {
expert_add_info_format ( pinfo , opt_ti - > len , & ei_ipv6_opt_invalid_len ,
" CALIPSO: Invalid Length (%u bytes) " , opt_len ) ;
return ;
}
proto_tree_add_item ( opt_tree , hf_ipv6_opt_calipso_doi , tvb ,
offset + 2 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item_ret_uint ( opt_tree , hf_ipv6_opt_calipso_cmpt_length , tvb ,
offset + 6 , 1 , ENC_BIG_ENDIAN , & cmpt_length ) ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_calipso_sens_level , tvb ,
offset + 7 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_calipso_checksum , tvb ,
offset + 8 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_calipso_cmpt_bitmap , tvb ,
offset + 10 , cmpt_length * 4 , ENC_NA ) ;
}
/*
* Home Address Option
*
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
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| Option Type | Option Length |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| |
+ +
| |
+ Home Address +
| |
+ +
| |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
static void
dissect_opt_home_address ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti , guint8 opt_len )
{
if ( opt_len ! = 16 ) {
expert_add_info_format ( pinfo , opt_ti - > len , & ei_ipv6_opt_invalid_len ,
" Home Address: Invalid length (%u bytes) " , opt_len ) ;
}
proto_tree_add_item ( opt_tree , hf_ipv6_opt_mipv6_home_address , tvb , offset + 2 , 16 , ENC_NA ) ;
alloc_address_tvb ( pinfo - > pool , & pinfo - > src , AT_IPv6 , 16 , tvb , offset + 2 ) ;
}
2015-12-29 19:30:58 +00:00
/*
* ILNP Nonce Option
*
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
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| Next Header | Hdr Ext Len | Option Type | Option Length |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
/ Nonce Value /
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
static void
dissect_opt_ilnp_nonce ( tvbuff_t * tvb , gint offset , packet_info * pinfo _U_ , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti _U_ , guint8 opt_len )
{
proto_tree_add_item ( opt_tree , hf_ipv6_opt_ilnp_nonce , tvb , offset + 2 , opt_len , ENC_NA ) ;
}
/*
* Line - Identification Option
*
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
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| Option Type | Option Length |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| LineIDLen | Line ID . . .
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
static void
dissect_opt_lio ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti _U_ , guint8 opt_len )
{
proto_item * ti ;
guint8 line_id_len ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_lio_len , tvb , offset + 2 , 1 , ENC_BIG_ENDIAN ) ;
line_id_len = tvb_get_guint8 ( tvb , offset + 2 ) ;
if ( line_id_len = = 0 ) {
return ;
}
proto_tree_add_item ( opt_tree , hf_ipv6_opt_lio_id , tvb , offset + 2 , 1 , ENC_BIG_ENDIAN | ENC_ASCII ) ;
if ( line_id_len > 1 & & opt_len > line_id_len - 1 ) {
ti = proto_tree_add_item ( opt_tree , hf_ipv6_opt_unknown_data ,
tvb , offset + 3 + line_id_len , opt_len - line_id_len - 1 , ENC_NA ) ;
expert_add_info ( pinfo , ti , & ei_ipv6_opt_unknown_data ) ;
}
}
2015-12-29 12:15:44 +00:00
/*
* MPL Option
*
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
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| Option Type | Opt Data Len |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| S | M | V | rsv | sequence | seed - id ( optional ) |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
static void
dissect_opt_mpl ( tvbuff_t * tvb , gint offset , packet_info * pinfo _U_ , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti _U_ , guint8 opt_len _U_ )
{
static const int * mpl_flags [ ] = {
& hf_ipv6_opt_mpl_flag_s ,
& hf_ipv6_opt_mpl_flag_m ,
& hf_ipv6_opt_mpl_flag_v ,
& hf_ipv6_opt_mpl_flag_rsv ,
NULL
} ;
static const guint8 seed_id_len_arr [ 4 ] = { 0 , 2 , 8 , 16 } ;
guint8 seed_id_len ;
offset + = 2 ;
proto_tree_add_bitmask ( opt_tree , tvb , offset , hf_ipv6_opt_mpl_flag , ett_ipv6_opt_mpl , mpl_flags , ENC_NA ) ;
seed_id_len = seed_id_len_arr [ tvb_get_guint8 ( tvb , offset ) > > 6 ] ;
offset + = 1 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_mpl_sequence , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
if ( seed_id_len > 0 ) {
proto_tree_add_item ( opt_tree , hf_ipv6_opt_mpl_seed_id , tvb , offset , seed_id_len , ENC_NA ) ;
}
}
2015-12-29 19:30:58 +00:00
/*
* IPv6 DFF Header
*
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
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| Next Header | Hdr Ext Len | OptTypeDFF | OptDataLenDFF |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| VER | D | R | 0 | 0 | 0 | 0 | Sequence Number | Pad1 |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
static void
dissect_opt_dff ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti , guint8 opt_len )
{
static const int * dff_flags [ ] = {
& hf_ipv6_opt_dff_flag_ver ,
& hf_ipv6_opt_dff_flag_dup ,
& hf_ipv6_opt_dff_flag_ret ,
& hf_ipv6_opt_dff_flag_rsv ,
NULL
} ;
/* Header length is 3 octets */
/* http://www.rfc-editor.org/errata_search.php?eid=3937 */
if ( opt_len ! = 3 ) {
expert_add_info_format ( pinfo , opt_ti - > len , & ei_ipv6_opt_invalid_len ,
" IPv6 DFF: Invalid length (%u bytes) " , opt_len ) ;
}
proto_tree_add_bitmask ( opt_tree , tvb , offset + 2 , hf_ipv6_opt_dff_flags ,
ett_ipv6_opt_dff_flags , dff_flags , ENC_NA ) ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_dff_seqnum , tvb , offset + 3 , 2 , ENC_BIG_ENDIAN ) ;
}
static void
dissect_opt_unknown ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti _U_ , guint8 opt_len )
{
proto_item * ti ;
ti = proto_tree_add_item ( opt_tree , hf_ipv6_opt_unknown , tvb ,
offset + 2 , opt_len , ENC_NA ) ;
expert_add_info ( pinfo , ti , & ei_ipv6_opt_unknown_data ) ;
}
2001-06-26 17:31:36 +00:00
static int
2015-12-29 12:15:44 +00:00
dissect_opts ( tvbuff_t * tvb , int offset , proto_tree * tree , packet_info * pinfo , const int exthdr_proto )
2001-06-26 17:31:36 +00:00
{
2015-12-29 12:15:44 +00:00
gint len , offset_end ;
proto_tree * exthdr_tree , * opt_tree ;
proto_item * pi , * ti , * ti_len ;
int hf_exthdr_item_nxt , hf_exthdr_item_len , hf_exthdr_item_len_oct ;
guint8 opt_type , opt_len ;
ipv6_meta_t * ipv6_info ;
gboolean hopopts ;
struct opt_proto_item opt_ti ;
2015-08-09 22:13:06 +00:00
ipv6_info = ( ipv6_meta_t * ) p_get_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , IPV6_PROTO_META ) ;
2015-09-30 14:30:33 +00:00
hopopts = ( exthdr_proto = = proto_ipv6_hopopts ) ;
1999-03-28 18:32:03 +00:00
2012-03-12 23:13:03 +00:00
len = ( tvb_get_guint8 ( tvb , offset + 1 ) + 1 ) < < 3 ;
offset_end = offset + len ;
2001-01-23 02:49:55 +00:00
2015-10-09 07:22:29 +00:00
/* !!! specify length */
2015-09-30 14:30:33 +00:00
ti = proto_tree_add_item ( tree , exthdr_proto , tvb , offset , len , ENC_NA ) ;
2011-12-21 14:18:28 +00:00
2015-10-09 07:22:29 +00:00
if ( hopopts & & ipv6_info - > exthdr_count > 0 ) {
/* IPv6 Hop-by-Hop must appear immediately after IPv6 header (RFC 2460) */
expert_add_info ( pinfo , ti , & ei_ipv6_hopopts_not_first ) ;
}
2015-08-09 22:13:06 +00:00
2015-10-09 07:22:29 +00:00
exthdr_tree = proto_item_add_subtree ( ti , ett_ipv6 ) ;
2011-12-21 14:18:28 +00:00
2015-09-30 14:30:33 +00:00
if ( exthdr_proto = = proto_ipv6_hopopts ) {
2015-10-09 07:22:29 +00:00
hf_exthdr_item_nxt = hf_ipv6_hopopts_nxt ;
2016-06-01 16:40:33 +00:00
hf_exthdr_item_len = hf_ipv6_hopopts_len ;
hf_exthdr_item_len_oct = hf_ipv6_hopopts_len_oct ;
2015-09-30 14:30:33 +00:00
} else if ( exthdr_proto = = proto_ipv6_dstopts ) {
2015-10-09 07:22:29 +00:00
hf_exthdr_item_nxt = hf_ipv6_dstopts_nxt ;
2016-06-01 16:40:33 +00:00
hf_exthdr_item_len = hf_ipv6_dstopts_len ;
hf_exthdr_item_len_oct = hf_ipv6_dstopts_len_oct ;
2015-10-09 07:22:29 +00:00
} else {
DISSECTOR_ASSERT_NOT_REACHED ( ) ;
}
2015-09-11 08:06:49 +00:00
2015-10-09 07:22:29 +00:00
proto_tree_add_item ( exthdr_tree , hf_exthdr_item_nxt , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
2011-12-21 14:18:28 +00:00
2016-06-01 16:40:33 +00:00
ti_len = proto_tree_add_item ( exthdr_tree , hf_exthdr_item_len , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
ti = proto_tree_add_uint ( exthdr_tree , hf_exthdr_item_len_oct , tvb , offset , 1 , len ) ;
proto_item_append_text ( ti , " bytes " ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
if ( ipv6_exthdr_hide_len_oct_field ) {
PROTO_ITEM_SET_HIDDEN ( ti ) ;
proto_item_append_text ( ti_len , " (%d bytes) " , len ) ;
}
2015-10-09 07:22:29 +00:00
offset + = 1 ;
2011-12-21 14:18:28 +00:00
2015-12-29 12:15:44 +00:00
while ( offset < offset_end ) {
2015-10-09 07:22:29 +00:00
/* there are more options */
2011-12-21 14:18:28 +00:00
2015-10-09 07:22:29 +00:00
opt_type = tvb_get_guint8 ( tvb , offset ) ;
2015-12-29 12:15:44 +00:00
opt_len = tvb_get_guint8 ( tvb , offset + 1 ) ;
pi = proto_tree_add_none_format ( exthdr_tree , hf_ipv6_opt , tvb , offset , 2 + opt_len ,
" %s " , val_to_str_ext ( opt_type , & ipv6_opt_vals_ext , " Unknown IPv6 Option (%u) " ) ) ;
opt_tree = proto_item_add_subtree ( pi , ett_ipv6_opt ) ;
opt_ti . type = proto_tree_add_item ( opt_tree , hf_ipv6_opt_type , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_item_append_text ( opt_ti . type ,
" (%s) " , val_to_str_ext_const ( opt_type , & ipv6_opt_vals_ext , " Unknown " ) ) ;
2012-03-12 23:13:03 +00:00
2015-10-09 07:22:29 +00:00
if ( opt_type = = IP6OPT_PAD1 ) {
2015-12-29 12:15:44 +00:00
/* The Pad1 option is a special case, and contains no data. */
2015-10-09 07:22:29 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_opt_pad1 , tvb , offset , 1 , ENC_NA ) ;
2012-10-31 08:35:20 +00:00
offset + = 1 ;
2015-10-09 07:22:29 +00:00
continue ;
}
2012-03-12 23:13:03 +00:00
2015-12-29 12:15:44 +00:00
opt_ti . len = proto_tree_add_item ( opt_tree , hf_ipv6_opt_length , tvb , offset + 1 , 1 , ENC_BIG_ENDIAN ) ;
2015-10-09 07:22:29 +00:00
2015-12-29 12:15:44 +00:00
if ( opt_type = = IP6OPT_PADN ) {
2015-10-09 07:22:29 +00:00
/* RFC 2460 states :
* " The PadN option is used to insert two or more octets of
* padding into the Options area of a header . For N octets of
* padding , the Opt Data Len field contains the value N - 2 , and
* the Option Data consists of N - 2 zero - valued octets . "
*/
2015-12-29 12:15:44 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_opt_padn , tvb , offset + 2 , opt_len , ENC_NA ) ;
offset + = 2 + opt_len ;
continue ;
}
switch ( opt_type ) {
case IP6OPT_JUMBO :
dissect_opt_jumbo ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len , hopopts ) ;
2015-10-09 07:22:29 +00:00
break ;
2015-12-29 12:15:44 +00:00
case IP6OPT_RPL :
dissect_opt_rpl ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-10-09 07:22:29 +00:00
break ;
2015-12-29 12:15:44 +00:00
case IP6OPT_TEL :
dissect_opt_tel ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-10-09 07:22:29 +00:00
break ;
case IP6OPT_RTALERT :
2015-12-29 12:15:44 +00:00
dissect_opt_rtalert ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-10-09 07:22:29 +00:00
break ;
2015-12-29 12:15:44 +00:00
case IP6OPT_QUICKSTART :
dissect_opt_quickstart ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-10-09 07:22:29 +00:00
break ;
case IP6OPT_CALIPSO :
2015-12-29 12:15:44 +00:00
dissect_opt_calipso ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
break ;
2015-12-29 19:30:58 +00:00
case IP6OPT_SMF_DPD :
/* TODO: Dissect SMF_DPD */
dissect_opt_unknown ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
break ;
2015-12-29 12:15:44 +00:00
case IP6OPT_HOME_ADDRESS :
dissect_opt_home_address ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-10-09 07:22:29 +00:00
break ;
2015-12-29 19:30:58 +00:00
case IP6OPT_ILNP_NONCE :
dissect_opt_ilnp_nonce ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
break ;
case IP6OPT_LIO :
dissect_opt_lio ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
break ;
2015-10-09 07:22:29 +00:00
case IP6OPT_MPL :
2015-12-29 12:15:44 +00:00
dissect_opt_mpl ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
break ;
2015-12-29 19:30:58 +00:00
case IP6OPT_IP_DFF :
dissect_opt_dff ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
break ;
2015-10-09 07:22:29 +00:00
case IP6OPT_EXP_1E :
case IP6OPT_EXP_3E :
case IP6OPT_EXP_5E :
case IP6OPT_EXP_7E :
case IP6OPT_EXP_9E :
case IP6OPT_EXP_BE :
case IP6OPT_EXP_DE :
case IP6OPT_EXP_FE :
proto_tree_add_item ( opt_tree , hf_ipv6_opt_experimental , tvb ,
2015-12-29 12:15:44 +00:00
offset + 2 , opt_len , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
break ;
2015-10-09 07:22:29 +00:00
default :
2015-12-29 19:30:58 +00:00
dissect_opt_unknown ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-12-29 12:15:44 +00:00
break ;
2015-10-09 07:22:29 +00:00
}
2015-12-29 12:15:44 +00:00
offset + = 2 + opt_len ;
2001-06-26 17:31:36 +00:00
}
2015-10-09 07:22:29 +00:00
2015-08-09 22:13:06 +00:00
ipv6_info - > exthdr_count + + ;
1999-03-28 18:32:03 +00:00
return len ;
}
1999-10-12 23:12:06 +00:00
static int
2015-12-29 12:15:44 +00:00
dissect_hopopts ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ )
2001-06-26 17:31:36 +00:00
{
2014-04-28 23:42:42 +00:00
col_append_sep_str ( pinfo - > cinfo , COL_INFO , " , " , " IPv6 hop-by-hop options " ) ;
2015-12-29 12:15:44 +00:00
return dissect_opts ( tvb , 0 , tree , pinfo , proto_ipv6_hopopts ) ;
1999-10-12 23:12:06 +00:00
}
static int
2015-12-29 12:15:44 +00:00
dissect_dstopts ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ )
2001-06-26 17:31:36 +00:00
{
2014-04-28 23:42:42 +00:00
col_append_sep_str ( pinfo - > cinfo , COL_INFO , " , " , " IPv6 destination options " ) ;
2015-12-29 12:15:44 +00:00
return dissect_opts ( tvb , 0 , tree , pinfo , proto_ipv6_dstopts ) ;
1999-10-12 23:12:06 +00:00
}
1998-09-16 02:39:15 +00:00
2007-04-12 17:34:30 +00:00
/* START SHIM6 PART */
2016-01-02 12:18:18 +00:00
static guint16
shim6_checksum ( tvbuff_t * tvb , int offset , int len )
2007-04-12 17:34:30 +00:00
{
2013-12-12 20:39:11 +00:00
vec_t cksum_vec [ 1 ] ;
2007-04-12 17:34:30 +00:00
Clean up Internet checksum handling.
Add macros to set entries of a vec_t, one for use when you have a
pointer to private data, and one for use when you have data in a tvbuff.
The latter wraps the use of tvb_get_ptr(), so that you're not directly
calling it in a dissector.
Move ip_checksum() to epan/in_cksum.c, and add an ip_checksum_tvb() that
wraps the use of tvb_get_ptr().
In the CARP dissector, give the length variable an unsigned type -
there's no benefit to it being signed, and that requires some casts to
be thrown around.
In the DCCP dissector, check only against the coverage length to see if
we have enough data, combine the "should we check the checksum?" check
with the "*can* we check the checksum?" check in a single if, and throw
a dissector assertion if the source network address type isn't IPv4 or
IPv6.
Get rid of inclues of <epan/in_cksum.h> in dissectors that don't use any
of the Internet checksum routines.
In the HIP dissector, make sure we have the data to calculate the
checksum before doing so.
Change-Id: I2f9674775dbb54c533d33082632809f7d32ec8ae
Reviewed-on: https://code.wireshark.org/review/3517
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-09 01:09:00 +00:00
SET_CKSUM_VEC_TVB ( cksum_vec [ 0 ] , tvb , offset , len ) ;
2013-12-12 20:39:11 +00:00
return in_cksum ( & cksum_vec [ 0 ] , 1 ) ;
2007-04-12 17:34:30 +00:00
}
static const value_string shimoptvals [ ] = {
{ SHIM6_OPT_RESPVAL , " Responder Validator Option " } ,
{ SHIM6_OPT_LOCLIST , " Locator List Option " } ,
{ SHIM6_OPT_LOCPREF , " Locator Preferences Option " } ,
2011-12-21 14:18:28 +00:00
{ SHIM6_OPT_CGAPDM , " CGA Parameter Data Structure Option " } ,
{ SHIM6_OPT_CGASIG , " CGA Signature Option " } ,
2007-04-12 17:34:30 +00:00
{ SHIM6_OPT_ULIDPAIR , " ULID Pair Option " } ,
2011-12-21 14:18:28 +00:00
{ SHIM6_OPT_FII , " Forked Instance Identifier Option " } ,
2007-05-08 22:25:03 +00:00
{ 0 , NULL }
2007-04-12 17:34:30 +00:00
} ;
static const value_string shimverifmethods [ ] = {
{ SHIM6_VERIF_HBA , " HBA " } ,
{ SHIM6_VERIF_CGA , " CGA " } ,
2007-05-08 22:25:03 +00:00
{ 0 , NULL }
2007-04-12 17:34:30 +00:00
} ;
2007-04-14 14:01:53 +00:00
static const value_string shimflags [ ] _U_ = {
2007-04-12 17:34:30 +00:00
{ SHIM6_FLAG_BROKEN , " BROKEN " } ,
{ SHIM6_FLAG_TEMPORARY , " TEMPORARY " } ,
2007-05-08 22:25:03 +00:00
{ 0 , NULL }
2007-04-12 17:34:30 +00:00
} ;
static const value_string shimreapstates [ ] = {
{ SHIM6_REAP_OPERATIONAL , " Operational " } ,
{ SHIM6_REAP_EXPLORING , " Exploring " } ,
{ SHIM6_REAP_INBOUNDOK , " InboundOK " } ,
2007-05-08 22:25:03 +00:00
{ 0 , NULL }
2007-04-12 17:34:30 +00:00
} ;
static const value_string shim6_protocol [ ] = {
2013-12-12 20:39:11 +00:00
{ 0 , " SHIM6 " } ,
{ 1 , " HIP " } ,
{ 0 , NULL }
2007-04-12 17:34:30 +00:00
} ;
2009-11-13 22:19:31 +00:00
2007-04-12 17:34:30 +00:00
static void
dissect_shim6_opt_loclist ( proto_tree * opt_tree , tvbuff_t * tvb , gint * offset )
{
2013-12-12 20:39:11 +00:00
proto_tree * subtree ;
guint count ;
guint optlen ;
int p = * offset ;
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_opt_loclist , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
optlen = tvb_get_guint8 ( tvb , p ) ;
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_opt_locnum , tvb , p , 1 , ENC_BIG_ENDIAN ) ;
p + + ;
/* Verification Methods */
2014-06-29 13:13:51 +00:00
subtree = proto_tree_add_subtree ( opt_tree , tvb , p , optlen ,
ett_ipv6_shim6_verif_methods , NULL , " Locator Verification Methods " ) ;
2013-12-12 20:39:11 +00:00
for ( count = 0 ; count < optlen ; count + + )
proto_tree_add_item ( subtree , hf_ipv6_shim6_opt_loc_verif_methods , tvb ,
2011-12-21 14:18:28 +00:00
p + count , 1 , ENC_BIG_ENDIAN ) ;
2013-12-12 20:39:11 +00:00
p + = optlen ;
/* Padding, included in length field */
if ( ( 7 - optlen % 8 ) > 0 ) {
2014-09-10 23:58:33 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_padding , tvb , p , ( 7 - optlen % 8 ) , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
p + = ( 7 - optlen % 8 ) ;
}
/* Locators */
2014-06-29 13:13:51 +00:00
subtree = proto_tree_add_subtree ( opt_tree , tvb , p , 16 * optlen , ett_ipv6_shim6_locators , NULL , " Locators " ) ;
2013-12-12 20:39:11 +00:00
for ( count = 0 ; count < optlen ; count + + ) {
proto_tree_add_item ( subtree , hf_ipv6_shim6_locator , tvb , p , 16 , ENC_NA ) ;
p + = 16 ;
}
* offset = p ;
2007-04-12 17:34:30 +00:00
}
static void
2007-11-23 20:15:28 +00:00
dissect_shim6_opt_loc_pref ( proto_tree * opt_tree , tvbuff_t * tvb , gint * offset , gint len , packet_info * pinfo )
2007-04-12 17:34:30 +00:00
{
2013-12-12 20:39:11 +00:00
proto_tree * subtree ;
gint p ;
gint optlen ;
gint count ;
p = * offset ;
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_opt_loclist , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
optlen = tvb_get_guint8 ( tvb , p ) ;
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_opt_elemlen , tvb , p , 1 , ENC_BIG_ENDIAN ) ;
if ( optlen < 1 | | optlen > 3 ) {
proto_tree_add_expert_format ( opt_tree , pinfo , & ei_ipv6_shim6_opt_elemlen_invalid , tvb , p , 1 ,
" Invalid element length: %u " , optlen ) ;
return ;
}
p + + ;
/* Locator Preferences */
count = 1 ;
while ( p < len ) {
2014-06-29 13:13:51 +00:00
subtree = proto_tree_add_subtree_format ( opt_tree , tvb , p , optlen , ett_ipv6_shim6_loc_pref , NULL ,
" Locator Preferences %u " , count ) ;
2013-12-12 20:39:11 +00:00
/* Flags */
if ( optlen > = 1 )
proto_tree_add_item ( subtree , hf_ipv6_shim6_loc_flag , tvb , p , 1 , ENC_BIG_ENDIAN ) ;
/* Priority */
if ( optlen > = 2 )
proto_tree_add_item ( subtree , hf_ipv6_shim6_loc_prio , tvb , p + 1 , 1 , ENC_BIG_ENDIAN ) ;
/* Weight */
if ( optlen > = 3 )
proto_tree_add_item ( subtree , hf_ipv6_shim6_loc_weight , tvb , p + 2 , 1 , ENC_BIG_ENDIAN ) ;
/*
* Shim6 Draft 08 doesn ' t specify the format when the Element length is
* more than three , except that any such formats MUST be defined so that
* the first three octets are the same as in the above case , that is , a
* of a 1 octet flags field followed by a 1 octet priority field , and a
* 1 octet weight field .
*/
p + = optlen ;
count + + ;
}
* offset = p ;
2007-04-12 17:34:30 +00:00
}
static int
2007-11-23 20:15:28 +00:00
dissect_shimopts ( tvbuff_t * tvb , int offset , proto_tree * tree , packet_info * pinfo )
2007-04-12 17:34:30 +00:00
{
2013-12-12 20:39:11 +00:00
int len , total_len ;
gint p ;
gint padding ;
proto_tree * opt_tree ;
proto_item * ti ;
2007-04-12 17:34:30 +00:00
p = offset ;
2011-06-19 18:47:35 +00:00
p + = 4 ;
2007-04-12 17:34:30 +00:00
len = tvb_get_ntohs ( tvb , offset + 2 ) ;
padding = 7 - ( ( len + 3 ) % 8 ) ;
total_len = 4 + len + padding ;
2007-11-23 20:15:28 +00:00
if ( tree )
2007-04-12 17:34:30 +00:00
{
2011-12-21 14:18:28 +00:00
/* Option Type */
2014-06-29 13:13:51 +00:00
opt_tree = proto_tree_add_subtree ( tree , tvb , offset , total_len , ett_ipv6_shim6_option , NULL ,
val_to_str_const ( ( tvb_get_ntohs ( tvb , offset ) & SHIM6_BITMASK_OPT_TYPE ) > > 1 , shimoptvals , " Unknown Option Type " ) ) ;
2011-12-21 14:18:28 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_opt_type , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
/* Critical */
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_opt_critical , tvb , offset + 1 , 1 , ENC_BIG_ENDIAN ) ;
/* Content Length */
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_opt_len , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
2013-09-15 01:48:30 +00:00
ti = proto_tree_add_uint ( opt_tree , hf_ipv6_shim6_opt_total_len , tvb , offset + 2 , 2 , total_len ) ;
2011-12-21 14:18:28 +00:00
PROTO_ITEM_SET_GENERATED ( ti ) ;
/* Option Type Specific */
switch ( tvb_get_ntohs ( tvb , offset ) > > 1 )
{
2013-12-12 20:39:11 +00:00
case SHIM6_OPT_RESPVAL :
2014-10-13 02:09:35 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_validator , tvb , p , len , ENC_NA ) ;
p + = len ;
2013-12-12 20:39:11 +00:00
if ( total_len - ( len + 4 ) > 0 )
2014-09-10 23:58:33 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_padding , tvb , p , total_len - ( len + 4 ) , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
break ;
case SHIM6_OPT_LOCLIST :
dissect_shim6_opt_loclist ( opt_tree , tvb , & p ) ;
break ;
case SHIM6_OPT_LOCPREF :
dissect_shim6_opt_loc_pref ( opt_tree , tvb , & p , offset + len + 4 , pinfo ) ;
if ( total_len - ( len + 4 ) > 0 )
2014-09-10 23:58:33 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_padding , tvb , p , total_len - ( len + 4 ) , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
break ;
case SHIM6_OPT_CGAPDM :
2014-10-13 02:09:35 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_cga_parameter_data_structure , tvb , p , len , ENC_NA ) ;
p + = len ;
2013-12-12 20:39:11 +00:00
if ( total_len - ( len + 4 ) > 0 )
2014-09-10 23:58:33 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_padding , tvb , p , total_len - ( len + 4 ) , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
break ;
case SHIM6_OPT_CGASIG :
2014-10-13 02:09:35 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_cga_signature , tvb , p , len , ENC_NA ) ;
p + = len ;
2013-12-12 20:39:11 +00:00
if ( total_len - ( len + 4 ) > 0 )
2014-09-10 23:58:33 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_padding , tvb , p , total_len - ( len + 4 ) , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
break ;
case SHIM6_OPT_ULIDPAIR :
2014-10-13 02:09:35 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_reserved , tvb , p , 4 , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
p + = 4 ;
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_sulid , tvb , p , 16 , ENC_NA ) ;
p + = 16 ;
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_rulid , tvb , p , 16 , ENC_NA ) ;
p + = 16 ;
break ;
case SHIM6_OPT_FII :
proto_tree_add_item ( opt_tree , hf_ipv6_shim6_opt_fii , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
break ;
default :
break ;
2011-12-21 14:18:28 +00:00
}
2007-04-12 17:34:30 +00:00
}
return total_len ;
}
static void
2008-06-25 09:12:35 +00:00
dissect_shim6_ct ( proto_tree * shim_tree , gint hf_item , tvbuff_t * tvb , gint offset , const guchar * label )
2007-04-12 17:34:30 +00:00
{
2013-12-12 20:39:11 +00:00
guint8 tmp [ 6 ] ;
guchar * ct_str ;
tmp [ 0 ] = tvb_get_guint8 ( tvb , offset + + ) ;
tmp [ 1 ] = tvb_get_guint8 ( tvb , offset + + ) ;
tmp [ 2 ] = tvb_get_guint8 ( tvb , offset + + ) ;
tmp [ 3 ] = tvb_get_guint8 ( tvb , offset + + ) ;
tmp [ 4 ] = tvb_get_guint8 ( tvb , offset + + ) ;
tmp [ 5 ] = tvb_get_guint8 ( tvb , offset + + ) ;
ct_str = wmem_strdup_printf ( wmem_packet_scope ( ) ,
" %s: %02X %02X %02X %02X %02X %02X " , label ,
tmp [ 0 ] & SHIM6_BITMASK_CT , tmp [ 1 ] , tmp [ 2 ] ,
tmp [ 3 ] , tmp [ 4 ] , tmp [ 5 ]
) ;
proto_tree_add_none_format ( shim_tree , hf_item , tvb , offset - 6 , 6 , " %s " , ct_str ) ;
2007-04-12 17:34:30 +00:00
}
static void
2007-11-23 20:15:28 +00:00
dissect_shim6_probes ( proto_tree * shim_tree , tvbuff_t * tvb , gint offset ,
2008-06-25 09:12:35 +00:00
const guchar * label , guint nbr_probe ,
2011-12-21 14:18:28 +00:00
gboolean probes_rcvd )
2007-04-12 17:34:30 +00:00
{
2013-12-12 20:39:11 +00:00
proto_tree * probes_tree ;
proto_tree * probe_tree ;
gint ett_probes ;
gint ett_probe ;
guint count ;
if ( probes_rcvd ) {
ett_probes = ett_ipv6_shim6_probes_rcvd ;
ett_probe = ett_ipv6_shim6_probe_rcvd ;
} else {
ett_probes = ett_ipv6_shim6_probes_sent ;
ett_probe = ett_ipv6_shim6_probe_sent ;
}
2014-06-29 13:13:51 +00:00
probes_tree = proto_tree_add_subtree ( shim_tree , tvb , offset , 40 * nbr_probe , ett_probes , NULL , label ) ;
2013-12-12 20:39:11 +00:00
for ( count = 0 ; count < nbr_probe ; count + + ) {
2014-06-29 13:13:51 +00:00
probe_tree = proto_tree_add_subtree_format ( probes_tree , tvb , offset , 40 ,
ett_probe , NULL , " Probe %u " , count + 1 ) ;
2013-12-12 20:39:11 +00:00
proto_tree_add_item ( probe_tree , hf_ipv6_shim6_psrc , tvb , offset , 16 , ENC_NA ) ;
offset + = 16 ;
proto_tree_add_item ( probe_tree , hf_ipv6_shim6_pdst , tvb , offset , 16 , ENC_NA ) ;
offset + = 16 ;
proto_tree_add_item ( probe_tree , hf_ipv6_shim6_pnonce , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
offset + = 4 ;
proto_tree_add_item ( probe_tree , hf_ipv6_shim6_pdata , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
offset + = 4 ;
}
2007-04-12 17:34:30 +00:00
}
/* Dissect SHIM6 data: control messages */
static int
dissect_shimctrl ( tvbuff_t * tvb , gint offset , guint type , proto_tree * shim_tree )
{
2013-12-12 20:39:11 +00:00
gint p ;
guint8 tmp ;
const gchar * sta ;
guint probes_sent ;
guint probes_rcvd ;
2007-04-12 17:34:30 +00:00
2007-11-23 20:15:28 +00:00
p = offset ;
2007-04-12 17:34:30 +00:00
2007-11-23 20:15:28 +00:00
switch ( type )
2007-04-12 17:34:30 +00:00
{
2013-12-12 20:39:11 +00:00
case SHIM6_TYPE_I1 :
dissect_shim6_ct ( shim_tree , hf_ipv6_shim6_ct , tvb , p , " Initiator Context Tag " ) ;
p + = 6 ;
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_inonce , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
break ;
case SHIM6_TYPE_R1 :
2014-10-13 02:09:35 +00:00
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_reserved2 , tvb , p , 2 , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
p + = 2 ;
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_inonce , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_rnonce , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
break ;
case SHIM6_TYPE_I2 :
dissect_shim6_ct ( shim_tree , hf_ipv6_shim6_ct , tvb , p , " Initiator Context Tag " ) ;
p + = 6 ;
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_inonce , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_rnonce , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
2014-10-13 02:09:35 +00:00
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_reserved2 , tvb , p , 4 , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
p + = 4 ;
break ;
case SHIM6_TYPE_R2 :
dissect_shim6_ct ( shim_tree , hf_ipv6_shim6_ct , tvb , p , " Responder Context Tag " ) ;
p + = 6 ;
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_inonce , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
break ;
case SHIM6_TYPE_R1BIS :
dissect_shim6_ct ( shim_tree , hf_ipv6_shim6_ct , tvb , p , " Packet Context Tag " ) ;
p + = 6 ;
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_rnonce , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
break ;
case SHIM6_TYPE_I2BIS :
dissect_shim6_ct ( shim_tree , hf_ipv6_shim6_ct , tvb , p , " Initiator Context Tag " ) ;
p + = 6 ;
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_inonce , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_rnonce , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
2014-10-13 02:09:35 +00:00
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_reserved2 , tvb , p , 6 , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
p + = 6 ;
dissect_shim6_ct ( shim_tree , hf_ipv6_shim6_ct , tvb , p , " Initiator Context Tag " ) ;
p + = 6 ;
break ;
case SHIM6_TYPE_UPD_REQ :
case SHIM6_TYPE_UPD_ACK :
dissect_shim6_ct ( shim_tree , hf_ipv6_shim6_ct , tvb , p , " Receiver Context Tag " ) ;
p + = 6 ;
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_rnonce , tvb , p , 4 , ENC_BIG_ENDIAN ) ;
p + = 4 ;
break ;
case SHIM6_TYPE_KEEPALIVE :
dissect_shim6_ct ( shim_tree , hf_ipv6_shim6_ct , tvb , p , " Receiver Context Tag " ) ;
p + = 6 ;
2014-10-13 02:09:35 +00:00
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_reserved2 , tvb , p , 4 , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
p + = 4 ;
break ;
case SHIM6_TYPE_PROBE :
dissect_shim6_ct ( shim_tree , hf_ipv6_shim6_ct , tvb , p , " Receiver Context Tag " ) ;
p + = 6 ;
tmp = tvb_get_guint8 ( tvb , p ) ;
probes_sent = tmp & SHIM6_BITMASK_PSENT ;
probes_rcvd = ( tmp & SHIM6_BITMASK_PRECVD ) > > 4 ;
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_psent , tvb ,
p , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_precvd , tvb ,
p , 1 , ENC_BIG_ENDIAN ) ;
p + + ;
sta = val_to_str_const ( ( tvb_get_guint8 ( tvb , p ) & SHIM6_BITMASK_STA ) > > 6 ,
shimreapstates , " Unknown REAP State " ) ;
proto_tree_add_uint_format_value ( shim_tree , hf_ipv6_shim6_reap , tvb ,
p , 1 , ( tvb_get_guint8 ( tvb , p ) & SHIM6_BITMASK_STA ) > > 6 ,
" %s " , sta ) ;
2014-10-13 02:09:35 +00:00
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_reserved2 , tvb , p , 3 , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
p + = 3 ;
/* Probes Sent */
if ( probes_sent ) {
dissect_shim6_probes ( shim_tree , tvb , p , " Probes Sent " ,
probes_sent , FALSE ) ;
p + = 40 * probes_sent ;
}
2011-12-21 14:18:28 +00:00
2013-12-12 20:39:11 +00:00
/* Probes Received */
if ( probes_rcvd ) {
dissect_shim6_probes ( shim_tree , tvb , p , " Probes Received " ,
probes_rcvd , TRUE ) ;
p + = 40 * probes_rcvd ;
}
break ;
default :
break ;
2007-04-12 17:34:30 +00:00
}
return p - offset ;
}
/* Dissect SHIM6 data: payload, common part, options */
static const value_string shimctrlvals [ ] = {
2011-12-21 14:18:28 +00:00
{ SHIM6_TYPE_I1 , " I1 " } ,
{ SHIM6_TYPE_R1 , " R1 " } ,
{ SHIM6_TYPE_I2 , " I2 " } ,
{ SHIM6_TYPE_R2 , " R2 " } ,
{ SHIM6_TYPE_R1BIS , " R1bis " } ,
{ SHIM6_TYPE_I2BIS , " I2bis " } ,
2007-04-12 17:34:30 +00:00
{ SHIM6_TYPE_UPD_REQ , " Update Request " } ,
2012-02-01 02:05:19 +00:00
{ SHIM6_TYPE_UPD_ACK , " Update Acknowledgment " } ,
2007-04-12 17:34:30 +00:00
{ SHIM6_TYPE_KEEPALIVE , " Keepalive " } ,
2011-12-21 14:18:28 +00:00
{ SHIM6_TYPE_PROBE , " Probe " } ,
2007-05-08 22:25:03 +00:00
{ 0 , NULL }
2007-04-12 17:34:30 +00:00
} ;
2016-01-02 12:18:18 +00:00
static void
add_shim6_checksum_additional_info ( tvbuff_t * tvb , packet_info * pinfo ,
proto_item * it_cksum , int offset , gboolean is_cksum_correct )
2007-04-12 17:34:30 +00:00
{
2013-12-12 20:39:11 +00:00
proto_tree * checksum_tree ;
proto_item * item ;
checksum_tree = proto_item_add_subtree ( it_cksum , ett_ipv6_shim6_cksum ) ;
item = proto_tree_add_boolean ( checksum_tree , hf_ipv6_shim6_checksum_good , tvb ,
offset , 2 , is_cksum_correct ) ;
PROTO_ITEM_SET_GENERATED ( item ) ;
item = proto_tree_add_boolean ( checksum_tree , hf_ipv6_shim6_checksum_bad , tvb ,
offset , 2 , ! is_cksum_correct ) ;
PROTO_ITEM_SET_GENERATED ( item ) ;
if ( ! is_cksum_correct ) {
expert_add_info ( pinfo , item , & ei_ipv6_shim6_checksum_bad ) ;
col_append_str ( pinfo - > cinfo , COL_INFO , " [Shim6 CHECKSUM INCORRECT] " ) ;
}
2007-04-12 17:34:30 +00:00
}
static int
2014-04-28 23:42:42 +00:00
dissect_shim6 ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ )
2007-04-12 17:34:30 +00:00
{
2013-12-12 20:39:11 +00:00
struct ip6_shim shim ;
2014-04-28 23:42:42 +00:00
int offset = 0 , len ;
2013-12-12 20:39:11 +00:00
gint p ;
proto_tree * shim_tree ;
2016-06-01 16:40:33 +00:00
proto_item * ti , * ti_len ;
2013-12-12 20:39:11 +00:00
guint8 tmp [ 5 ] ;
2015-08-09 22:13:06 +00:00
ipv6_meta_t * ipv6_info ;
ipv6_info = ( ipv6_meta_t * ) p_get_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , IPV6_PROTO_META ) ;
2007-04-12 17:34:30 +00:00
tvb_memcpy ( tvb , ( guint8 * ) & shim , offset , sizeof ( shim ) ) ;
len = ( shim . ip6s_len + 1 ) < < 3 ;
2014-04-28 23:42:42 +00:00
if ( shim . ip6s_p & SHIM6_BITMASK_P ) {
col_append_sep_str ( pinfo - > cinfo , COL_INFO , " , " , " Shim6 (Payload) " ) ;
}
else {
col_append_sep_fstr ( pinfo - > cinfo , COL_INFO , " , " , " Shim6 (%s) " ,
val_to_str_const ( shim . ip6s_p & SHIM6_BITMASK_TYPE , shimctrlvals , " Unknown " ) ) ;
}
2015-09-30 14:30:33 +00:00
ti = proto_tree_add_item ( tree , proto_ipv6_shim6 , tvb , offset , len , ENC_NA ) ;
2015-10-03 13:24:04 +00:00
shim_tree = proto_item_add_subtree ( ti , ett_ipv6_shim6 ) ;
2011-12-21 14:18:28 +00:00
2015-10-03 13:24:04 +00:00
/* Next Header */
proto_tree_add_uint_format_value ( shim_tree , hf_ipv6_shim6_nxt , tvb ,
offset + ( int ) offsetof ( struct ip6_shim , ip6s_nxt ) , 1 , shim . ip6s_nxt ,
" %s (%u) " , ipprotostr ( shim . ip6s_nxt ) , shim . ip6s_nxt ) ;
2011-12-21 14:18:28 +00:00
2015-10-03 13:24:04 +00:00
/* Header Extension Length */
2016-06-01 16:40:33 +00:00
ti_len = proto_tree_add_item ( shim_tree , hf_ipv6_shim6_len , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
ti = proto_tree_add_uint ( shim_tree , hf_ipv6_shim6_len_oct , tvb , offset , 1 , len ) ;
proto_item_append_text ( ti , " bytes " ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
if ( ipv6_exthdr_hide_len_oct_field ) {
PROTO_ITEM_SET_HIDDEN ( ti ) ;
proto_item_append_text ( ti_len , " (%d bytes) " , len ) ;
}
2011-12-21 14:18:28 +00:00
2015-10-03 13:24:04 +00:00
/* P Field */
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_p , tvb ,
offset + ( int ) offsetof ( struct ip6_shim , ip6s_p ) , 1 , ENC_BIG_ENDIAN ) ;
2011-12-21 14:18:28 +00:00
2015-10-03 13:24:04 +00:00
/* skip the first 2 bytes (nxt hdr, hdr ext len, p+7bits) */
p = offset + 3 ;
2011-12-21 14:18:28 +00:00
2015-10-03 13:24:04 +00:00
if ( shim . ip6s_p & SHIM6_BITMASK_P ) {
tmp [ 0 ] = tvb_get_guint8 ( tvb , p + + ) ;
tmp [ 1 ] = tvb_get_guint8 ( tvb , p + + ) ;
tmp [ 2 ] = tvb_get_guint8 ( tvb , p + + ) ;
tmp [ 3 ] = tvb_get_guint8 ( tvb , p + + ) ;
tmp [ 4 ] = tvb_get_guint8 ( tvb , p + + ) ;
/* Payload Extension Header */
proto_tree_add_none_format ( shim_tree , hf_ipv6_shim6_ct , tvb ,
offset + ( int ) offsetof ( struct ip6_shim , ip6s_p ) , 6 ,
" Receiver Context Tag: %02x %02x %02x %02x %02x %02x " ,
shim . ip6s_p & SHIM6_BITMASK_CT , tmp [ 0 ] , tmp [ 1 ] , tmp [ 2 ] , tmp [ 3 ] , tmp [ 4 ] ) ;
} else {
/* Control Message */
guint16 csum ;
int advance ;
/* Message Type */
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_type , tvb ,
offset + ( int ) offsetof ( struct ip6_shim , ip6s_p ) , 1 ,
ENC_BIG_ENDIAN
) ;
/* Protocol bit (Must be zero for SHIM6) */
proto_tree_add_item ( shim_tree , hf_ipv6_shim6_proto , tvb , p , 1 , ENC_BIG_ENDIAN ) ;
p + + ;
/* Checksum */
2016-01-02 12:18:18 +00:00
csum = shim6_checksum ( tvb , offset , len ) ;
2015-10-03 13:24:04 +00:00
if ( csum = = 0 ) {
ti = proto_tree_add_uint_format_value ( shim_tree , hf_ipv6_shim6_checksum , tvb , p , 2 ,
tvb_get_ntohs ( tvb , p ) , " 0x%04x [correct] " , tvb_get_ntohs ( tvb , p ) ) ;
2016-01-02 12:18:18 +00:00
add_shim6_checksum_additional_info ( tvb , pinfo , ti , p , TRUE ) ;
2015-10-03 13:24:04 +00:00
} else {
ti = proto_tree_add_uint_format_value ( shim_tree , hf_ipv6_shim6_checksum , tvb , p , 2 ,
tvb_get_ntohs ( tvb , p ) , " 0x%04x [incorrect: should be 0x%04x] " ,
tvb_get_ntohs ( tvb , p ) , in_cksum_shouldbe ( tvb_get_ntohs ( tvb , p ) , csum ) ) ;
2016-01-02 12:18:18 +00:00
add_shim6_checksum_additional_info ( tvb , pinfo , ti , p , FALSE ) ;
2011-12-21 14:18:28 +00:00
}
2015-10-03 13:24:04 +00:00
p + = 2 ;
2011-12-21 14:18:28 +00:00
2015-10-03 13:24:04 +00:00
/* Type specific data */
advance = dissect_shimctrl ( tvb , p , shim . ip6s_p & SHIM6_BITMASK_TYPE , shim_tree ) ;
p + = advance ;
2011-12-21 14:18:28 +00:00
2015-10-03 13:24:04 +00:00
/* Options */
while ( p < offset + len ) {
p + = dissect_shimopts ( tvb , p , shim_tree , pinfo ) ;
2011-12-21 14:18:28 +00:00
}
2007-04-12 17:34:30 +00:00
}
2015-10-03 13:24:04 +00:00
2015-08-09 22:13:06 +00:00
ipv6_info - > exthdr_count + + ;
2007-04-12 17:34:30 +00:00
return len ;
}
/* END SHIM6 PART */
2015-11-23 03:59:08 +00:00
static int
dissect_ipv6 ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ )
2001-06-26 17:31:36 +00:00
{
2015-11-05 03:43:55 +00:00
proto_tree * ipv6_tree , * ipv6_exthdr_tree , * pt ;
2015-09-02 00:28:18 +00:00
proto_item * ipv6_item , * ti , * pi ;
2015-09-10 17:55:57 +00:00
proto_item * ti_ipv6_plen = NULL , * ti_ipv6_version ;
2015-09-02 00:28:18 +00:00
guint8 nxt , tfc ;
2013-12-12 20:39:11 +00:00
int advance ;
2015-08-09 22:13:06 +00:00
guint32 plen ;
2015-09-18 01:08:34 +00:00
guint16 frag_off ;
gboolean frag_flg ;
guint32 frag_ident ;
2013-12-12 20:39:11 +00:00
int offset ;
fragment_head * ipfd_head ;
2014-04-28 23:42:42 +00:00
tvbuff_t * next_tvb , * options_tvb ;
2013-12-12 20:39:11 +00:00
gboolean update_col_info = TRUE ;
2015-09-18 01:08:34 +00:00
gboolean save_fragmented ;
gboolean show_data = FALSE ;
2013-12-12 20:39:11 +00:00
guint8 * mac_addr ;
const char * name ;
2014-04-28 23:42:42 +00:00
dissector_handle_t nxt_handle ;
2014-12-21 17:38:13 +00:00
address addr ;
2015-08-09 22:13:06 +00:00
ipv6_meta_t * ipv6_info ;
2015-08-23 20:34:21 +00:00
int version ;
2013-12-12 20:39:11 +00:00
/* Provide as much IPv4 header information as possible as some dissectors
in the ip . proto dissector table may need it */
ws_ip iph ;
2015-01-03 19:40:16 +00:00
struct ip6_hdr * ipv6 ;
2013-12-12 20:39:11 +00:00
2015-08-23 20:34:21 +00:00
offset = 0 ;
2013-12-12 20:39:11 +00:00
col_set_str ( pinfo - > cinfo , COL_PROTOCOL , " IPv6 " ) ;
col_clear ( pinfo - > cinfo , COL_INFO ) ;
2015-11-05 03:43:55 +00:00
ipv6_item = proto_tree_add_item ( tree , proto_ipv6 , tvb , offset ,
ipv6_exthdr_under_root ? IPv6_HDR_SIZE : - 1 , ENC_NA ) ;
2015-08-23 20:34:21 +00:00
if ( tvb_reported_length ( tvb ) < IPv6_HDR_SIZE ) {
col_add_fstr ( pinfo - > cinfo , COL_INFO ,
" Invalid IPv6 header (%u bytes, need exactly 40) " ,
tvb_reported_length ( tvb ) ) ;
expert_add_info ( pinfo , ipv6_item , & ei_ipv6_invalid_header ) ;
2015-11-23 03:59:08 +00:00
return tvb_captured_length ( tvb ) ;
2015-08-23 20:34:21 +00:00
}
ipv6_tree = proto_item_add_subtree ( ipv6_item , ett_ipv6 ) ;
2013-12-12 20:39:11 +00:00
memset ( & iph , 0 , sizeof ( iph ) ) ;
2015-01-03 19:40:16 +00:00
ipv6 = ( struct ip6_hdr * ) tvb_memdup ( wmem_packet_scope ( ) , tvb , offset , sizeof ( struct ip6_hdr ) ) ;
2015-09-10 17:55:57 +00:00
version = hi_nibble ( ipv6 - > ip6_vfc ) ;
ti_ipv6_version = proto_tree_add_item ( ipv6_tree , hf_ipv6_version , tvb ,
offset + IP6H_CTL_VFC , 1 , ENC_BIG_ENDIAN ) ;
pi = proto_tree_add_item ( ipv6_tree , hf_ip_version , tvb ,
offset + IP6H_CTL_VFC , 1 , ENC_BIG_ENDIAN ) ;
proto_item_append_text ( pi , " [This field makes the filter match on \" ip.version == 6 \" possible] " ) ;
PROTO_ITEM_SET_HIDDEN ( pi ) ;
if ( version ! = 6 ) {
col_add_fstr ( pinfo - > cinfo , COL_INFO ,
" Bogus IPv6 version (%u, must be 6) " , version ) ;
expert_add_info_format ( pinfo , ti_ipv6_version , & ei_ipv6_bogus_ipv6_version , " Bogus IPv6 version " ) ;
2015-11-23 03:59:08 +00:00
return offset + IP6H_CTL_VFC ;
2015-09-10 17:55:57 +00:00
}
2015-09-02 00:28:18 +00:00
tfc = IPv6_HDR_TCLS ( ipv6 ) ;
2015-09-30 13:34:39 +00:00
col_add_str ( pinfo - > cinfo , COL_DSCP_VALUE ,
val_to_str_ext ( IPDSFIELD_DSCP ( tfc ) , & dscp_short_vals_ext , " %u " ) ) ;
2013-12-12 20:39:11 +00:00
/* Get extension header and payload length */
2015-01-03 19:40:16 +00:00
plen = g_ntohs ( ipv6 - > ip6_plen ) ;
2013-12-12 20:39:11 +00:00
2015-10-29 03:12:53 +00:00
set_address_tvb ( & pinfo - > net_src , AT_IPv6 , 16 , tvb , offset + IP6H_SRC ) ;
2015-10-21 19:04:16 +00:00
copy_address_shallow ( & pinfo - > src , & pinfo - > net_src ) ;
2015-10-29 03:12:53 +00:00
set_address_tvb ( & pinfo - > net_dst , AT_IPv6 , 16 , tvb , offset + IP6H_DST ) ;
2015-10-21 19:04:16 +00:00
copy_address_shallow ( & pinfo - > dst , & pinfo - > net_dst ) ;
2013-12-12 20:39:11 +00:00
2015-08-09 22:13:06 +00:00
ipv6_info = wmem_new0 ( wmem_packet_scope ( ) , ipv6_meta_t ) ;
p_add_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , IPV6_PROTO_META , ipv6_info ) ;
2013-12-12 20:39:11 +00:00
if ( tree ) {
2015-09-02 00:28:18 +00:00
/* !!! warning: (4-bit) version, (6-bit) DSCP, (2-bit) ECN and (20-bit) Flow */
2016-01-12 11:20:46 +00:00
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_tclass , tvb ,
offset + IP6H_CTL_FLOW , 4 , ENC_BIG_ENDIAN ) ;
2015-09-02 00:28:18 +00:00
proto_item_append_text ( ti , " (DSCP: %s, ECN: %s) " ,
val_to_str_ext_const ( IPDSFIELD_DSCP ( tfc ) , & dscp_short_vals_ext , " Unknown " ) ,
val_to_str_ext_const ( IPDSFIELD_ECN ( tfc ) , & ecn_short_vals_ext , " Unknown " ) ) ;
pt = proto_item_add_subtree ( ti , ett_ipv6_traffic_class ) ;
proto_tree_add_item ( pt , hf_ipv6_tclass_dscp , tvb ,
2015-03-21 13:53:41 +00:00
offset + IP6H_CTL_FLOW , 4 , ENC_BIG_ENDIAN ) ;
2015-09-02 00:28:18 +00:00
proto_tree_add_item ( pt , hf_ipv6_tclass_ecn , tvb ,
2015-03-21 13:53:41 +00:00
offset + IP6H_CTL_FLOW , 4 , ENC_BIG_ENDIAN ) ;
2013-12-12 20:39:11 +00:00
proto_tree_add_item ( ipv6_tree , hf_ipv6_flow , tvb ,
2015-03-21 13:53:41 +00:00
offset + IP6H_CTL_FLOW , 4 , ENC_BIG_ENDIAN ) ;
2013-12-12 20:39:11 +00:00
2015-08-09 22:13:06 +00:00
ti_ipv6_plen = proto_tree_add_item ( ipv6_tree , hf_ipv6_plen , tvb ,
2015-03-21 13:53:41 +00:00
offset + IP6H_CTL_PLEN , 2 , ENC_BIG_ENDIAN ) ;
2013-12-12 20:39:11 +00:00
2015-03-21 13:53:41 +00:00
proto_tree_add_item ( ipv6_tree , hf_ipv6_nxt , tvb , offset + IP6H_CTL_NXT , 1 , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
proto_tree_add_item ( ipv6_tree , hf_ipv6_hlim , tvb ,
2015-03-21 13:53:41 +00:00
offset + IP6H_CTL_HLIM , 1 , ENC_BIG_ENDIAN ) ;
2013-12-12 20:39:11 +00:00
/* Add the different items for the source address */
proto_tree_add_item ( ipv6_tree , hf_ipv6_src , tvb ,
2015-03-21 13:53:41 +00:00
offset + IP6H_SRC , 16 , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
ti = proto_tree_add_ipv6 ( ipv6_tree , hf_ipv6_addr , tvb ,
2015-03-21 13:53:41 +00:00
offset + IP6H_SRC ,
2015-10-05 21:43:46 +00:00
16 , & ipv6 - > ip6_src ) ;
2013-12-12 20:39:11 +00:00
PROTO_ITEM_SET_HIDDEN ( ti ) ;
2015-01-05 02:40:05 +00:00
name = address_to_display ( wmem_packet_scope ( ) , & pinfo - > src ) ;
2013-12-12 20:39:11 +00:00
if ( ipv6_summary_in_tree ) {
2015-10-21 19:04:16 +00:00
set_address ( & addr , AT_IPv6 , 16 , ipv6 - > ip6_src . bytes ) ;
2015-02-13 00:51:11 +00:00
proto_item_append_text ( ipv6_item , " , Src: %s " , address_with_resolution_to_str ( wmem_packet_scope ( ) , & addr ) ) ;
2013-12-12 20:39:11 +00:00
}
ti = proto_tree_add_string ( ipv6_tree , hf_ipv6_src_host , tvb ,
2015-03-21 13:53:41 +00:00
offset + IP6H_SRC ,
2013-12-12 20:39:11 +00:00
16 , name ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
ti = proto_tree_add_string ( ipv6_tree , hf_ipv6_host , tvb ,
2015-03-21 13:53:41 +00:00
offset + IP6H_SRC ,
2013-12-12 20:39:11 +00:00
16 , name ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
2007-03-30 14:43:55 +00:00
2013-12-12 20:39:11 +00:00
/* Extract embedded (IPv6 and MAC) address information */
if ( tvb_get_ntohs ( tvb , offset + IP6H_SRC ) = = 0x2002 ) { /* RFC 3056 section 2 */
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_src_6to4_gateway_ipv4 , tvb ,
offset + IP6H_SRC + 2 , 4 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_src_6to4_sla_id , tvb ,
offset + IP6H_SRC + 6 , 2 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_6to4_gateway_ipv4 , tvb ,
offset + IP6H_SRC + 2 , 4 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_6to4_sla_id , tvb ,
offset + IP6H_SRC + 6 , 2 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
} else if ( tvb_get_ntohl ( tvb , offset + IP6H_SRC ) = = 0x20010000 ) { /* RFC 4380 section 4 */
guint16 mapped_port = tvb_get_ntohs ( tvb , offset + IP6H_SRC + 10 ) ^ 0xffff ;
guint32 client_v4 = tvb_get_ipv4 ( tvb , offset + IP6H_SRC + 12 ) ^ 0xffffffff ;
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_src_teredo_server_ipv4 , tvb ,
offset + IP6H_SRC + 4 , 4 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_uint ( ipv6_tree , hf_ipv6_src_teredo_port , tvb ,
offset + IP6H_SRC + 10 , 2 , mapped_port ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_ipv4 ( ipv6_tree , hf_ipv6_src_teredo_client_ipv4 , tvb ,
offset + IP6H_SRC + 12 , 4 , client_v4 ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_teredo_server_ipv4 , tvb ,
offset + IP6H_SRC + 4 , 4 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
ti = proto_tree_add_uint ( ipv6_tree , hf_ipv6_teredo_port , tvb ,
offset + IP6H_SRC + 10 , 2 , mapped_port ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
ti = proto_tree_add_ipv4 ( ipv6_tree , hf_ipv6_teredo_client_ipv4 , tvb ,
offset + IP6H_SRC + 12 , 4 , client_v4 ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
}
if ( tvb_get_guint8 ( tvb , offset + IP6H_SRC + 8 ) & 0x02 & & tvb_get_ntohs ( tvb , offset + IP6H_SRC + 11 ) = = 0xfffe ) { /* RFC 4291 appendix A */
mac_addr = ( guint8 * ) wmem_alloc ( wmem_packet_scope ( ) , 6 ) ;
tvb_memcpy ( tvb , mac_addr , offset + IP6H_SRC + 8 , 3 ) ;
tvb_memcpy ( tvb , mac_addr + 3 , offset + IP6H_SRC + 13 , 3 ) ;
mac_addr [ 0 ] & = ~ 0x02 ;
ti = proto_tree_add_ether ( ipv6_tree , hf_ipv6_src_sa_mac , tvb ,
offset + IP6H_SRC + 8 , 6 , mac_addr ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_ether ( ipv6_tree , hf_ipv6_sa_mac , tvb ,
offset + IP6H_SRC + 8 , 6 , mac_addr ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
} else if ( ( tvb_get_ntohl ( tvb , offset + IP6H_SRC + 8 ) & 0xfcffffff ) = = 0x00005efe ) { /* RFC 5214 section 6.1 */
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_src_isatap_ipv4 , tvb ,
offset + IP6H_SRC + 12 , 4 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_isatap_ipv4 , tvb ,
offset + IP6H_SRC + 12 , 4 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
}
/* Add different items for the destination address */
proto_tree_add_item ( ipv6_tree , hf_ipv6_dst , tvb ,
2015-10-01 15:31:04 +00:00
offset + IP6H_DST , 16 , ENC_NA ) ;
2013-12-12 20:39:11 +00:00
ti = proto_tree_add_ipv6 ( ipv6_tree , hf_ipv6_addr , tvb ,
2015-10-01 15:31:04 +00:00
offset + IP6H_DST ,
2015-10-05 21:43:46 +00:00
16 , & ipv6 - > ip6_dst ) ;
2013-12-12 20:39:11 +00:00
PROTO_ITEM_SET_HIDDEN ( ti ) ;
2015-01-05 02:40:05 +00:00
name = address_to_display ( wmem_packet_scope ( ) , & pinfo - > dst ) ;
2013-12-12 20:39:11 +00:00
if ( ipv6_summary_in_tree ) {
2015-10-21 19:04:16 +00:00
set_address ( & addr , AT_IPv6 , 16 , ipv6 - > ip6_dst . bytes ) ;
2015-02-13 00:51:11 +00:00
proto_item_append_text ( ipv6_item , " , Dst: %s " , address_with_resolution_to_str ( wmem_packet_scope ( ) , & addr ) ) ;
2013-12-12 20:39:11 +00:00
}
ti = proto_tree_add_string ( ipv6_tree , hf_ipv6_dst_host , tvb ,
2015-03-21 13:53:41 +00:00
offset + IP6H_DST ,
2013-12-12 20:39:11 +00:00
16 , name ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
ti = proto_tree_add_string ( ipv6_tree , hf_ipv6_host , tvb ,
2015-03-21 13:53:41 +00:00
offset + IP6H_DST ,
2013-12-12 20:39:11 +00:00
16 , name ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
/* Extract embedded (IPv6 and MAC) address information */
if ( tvb_get_ntohs ( tvb , offset + IP6H_DST ) = = 0x2002 ) { /* RFC 3056 section 2 */
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_dst_6to4_gateway_ipv4 , tvb ,
offset + IP6H_DST + 2 , 4 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_dst_6to4_sla_id , tvb ,
offset + IP6H_DST + 6 , 2 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_6to4_gateway_ipv4 , tvb ,
offset + IP6H_DST + 2 , 4 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_6to4_sla_id , tvb ,
offset + IP6H_DST + 6 , 2 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
} else if ( tvb_get_ntohl ( tvb , offset + IP6H_DST ) = = 0x20010000 ) { /* RFC 4380 section 4 */
guint16 mapped_port = tvb_get_ntohs ( tvb , offset + IP6H_DST + 10 ) ^ 0xffff ;
guint32 client_v4 = tvb_get_ipv4 ( tvb , offset + IP6H_DST + 12 ) ^ 0xffffffff ;
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_dst_teredo_server_ipv4 , tvb ,
offset + IP6H_DST + 4 , 4 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_uint ( ipv6_tree , hf_ipv6_dst_teredo_port , tvb ,
offset + IP6H_DST + 10 , 2 , mapped_port ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_ipv4 ( ipv6_tree , hf_ipv6_dst_teredo_client_ipv4 , tvb ,
offset + IP6H_DST + 12 , 4 , client_v4 ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_teredo_server_ipv4 , tvb ,
offset + IP6H_DST + 4 , 4 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
ti = proto_tree_add_uint ( ipv6_tree , hf_ipv6_teredo_port , tvb ,
offset + IP6H_DST + 10 , 2 , mapped_port ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
ti = proto_tree_add_ipv4 ( ipv6_tree , hf_ipv6_teredo_client_ipv4 , tvb ,
offset + IP6H_DST + 12 , 4 , client_v4 ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
}
2010-08-28 20:55:32 +00:00
2013-12-12 20:39:11 +00:00
if ( tvb_get_guint8 ( tvb , offset + IP6H_DST + 8 ) & 0x02 & & tvb_get_ntohs ( tvb , offset + IP6H_DST + 11 ) = = 0xfffe ) { /* RFC 4291 appendix A */
mac_addr = ( guint8 * ) wmem_alloc ( wmem_packet_scope ( ) , 6 ) ;
tvb_memcpy ( tvb , mac_addr , offset + IP6H_DST + 8 , 3 ) ;
tvb_memcpy ( tvb , mac_addr + 3 , offset + IP6H_DST + 13 , 3 ) ;
mac_addr [ 0 ] & = ~ 0x02 ;
ti = proto_tree_add_ether ( ipv6_tree , hf_ipv6_dst_sa_mac , tvb ,
offset + IP6H_DST + 8 , 6 , mac_addr ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_ether ( ipv6_tree , hf_ipv6_sa_mac , tvb ,
offset + IP6H_DST + 8 , 6 , mac_addr ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
} else if ( ( tvb_get_ntohl ( tvb , offset + IP6H_DST + 8 ) & 0xfcffffff ) = = 0x00005efe ) { /* RFC 5214 section 6.1 */
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_dst_isatap_ipv4 , tvb ,
offset + IP6H_DST + 12 , 4 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_isatap_ipv4 , tvb ,
offset + IP6H_DST + 12 , 4 , ENC_BIG_ENDIAN ) ;
PROTO_ITEM_SET_GENERATED ( ti ) ;
PROTO_ITEM_SET_HIDDEN ( ti ) ;
}
2010-08-21 00:19:32 +00:00
}
1998-09-16 02:39:15 +00:00
2011-10-05 22:37:00 +00:00
# ifdef HAVE_GEOIP_V6
2013-12-12 20:39:11 +00:00
if ( tree & & ipv6_use_geoip ) {
2015-01-03 19:40:16 +00:00
add_geoip_info ( ipv6_tree , tvb , offset , & ipv6 - > ip6_src , & ipv6 - > ip6_dst ) ;
2013-12-12 20:39:11 +00:00
}
2011-10-05 22:27:51 +00:00
# endif
2015-12-29 12:15:44 +00:00
2013-12-12 20:39:11 +00:00
/* Fill in IPv4 fields for potential subdissectors */
2015-03-21 13:53:41 +00:00
iph . ip_v_hl = ( tvb_get_guint8 ( tvb , offset + IP6H_CTL_VFC ) > > 4 ) & 0x0F ;
iph . ip_tos = ( guint8 ) ( ( tvb_get_ntohl ( tvb , offset + IP6H_CTL_FLOW ) > > 20 ) & 0xFF ) ;
iph . ip_len = tvb_get_ntohs ( tvb , offset + IP6H_CTL_PLEN ) ;
2013-12-12 20:39:11 +00:00
/* Yes, there is not TTL in IPv6 Header... but it is the same of Hop Limit...*/
2015-03-21 13:53:41 +00:00
iph . ip_ttl = tvb_get_guint8 ( tvb , offset + IP6H_CTL_HLIM ) ;
2015-12-29 12:15:44 +00:00
ipv6_info - > hop_limit = iph . ip_ttl ;
ipv6_info - > payload_length = iph . ip_len ;
2013-12-12 20:39:11 +00:00
2015-11-05 03:43:55 +00:00
if ( ipv6_exthdr_under_root ) {
ipv6_exthdr_tree = tree ;
} else {
ipv6_exthdr_tree = ipv6_tree ;
}
2013-12-12 20:39:11 +00:00
/* start of the new header (could be a extension header) */
nxt = tvb_get_guint8 ( tvb , offset + 6 ) ;
2014-04-28 23:42:42 +00:00
/* Save next header value for Decode As dialog */
2015-09-16 21:58:49 +00:00
p_add_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , ( pinfo - > curr_layer_num < < 8 ) | IPV6_PROTO_NXT_HDR , GUINT_TO_POINTER ( ( guint ) nxt ) ) ;
2013-12-12 20:39:11 +00:00
offset + = ( int ) sizeof ( struct ip6_hdr ) ;
2015-08-09 22:13:06 +00:00
advance = 0 ;
if ( nxt = = IP_PROTO_HOPOPTS ) {
options_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
2015-11-05 03:43:55 +00:00
advance = dissect_hopopts ( options_tvb , pinfo , ipv6_exthdr_tree , & iph ) ;
2015-08-09 22:13:06 +00:00
if ( advance > 0 ) {
nxt = tvb_get_guint8 ( tvb , offset ) ;
offset + = advance ;
if ( ipv6_info - > jumbogram ) {
if ( ti_ipv6_plen ) {
proto_item_append_text ( ti_ipv6_plen , " (Jumbogram) " ) ;
}
plen = ipv6_info - > jumbo_length ;
if ( plen = = 0 ) {
col_add_fstr ( pinfo - > cinfo , COL_INFO , " Bogus IPv6 jumbo length " ) ;
2015-11-23 03:59:08 +00:00
return tvb_captured_length ( tvb ) ;
2015-08-09 22:13:06 +00:00
}
} else if ( plen = = 0 ) {
/* IPv6 length zero is invalid if there is a hop-by-hop header without jumbo option */
2015-08-23 02:46:36 +00:00
col_add_fstr ( pinfo - > cinfo , COL_INFO , " Invalid IPv6 payload length " ) ;
2015-08-09 22:13:06 +00:00
if ( ti_ipv6_plen ) {
expert_add_info ( pinfo , ti_ipv6_plen , & ei_ipv6_opt_jumbo_missing ) ;
}
2015-11-23 03:59:08 +00:00
return tvb_captured_length ( tvb ) ;
2015-08-09 22:13:06 +00:00
} else if ( plen < ( guint32 ) advance ) {
2015-08-23 02:46:36 +00:00
col_add_fstr ( pinfo - > cinfo , COL_INFO , " Bogus IPv6 payload length " ) ;
2015-08-09 22:13:06 +00:00
if ( ti_ipv6_plen ) {
proto_item_append_text ( ti_ipv6_plen , " (Bogus, less than hop-by-hop extension header length) " ) ;
expert_add_info ( pinfo , ti_ipv6_plen , & ei_ipv6_bogus_ipv6_length ) ;
}
2015-11-23 03:59:08 +00:00
return tvb_captured_length ( tvb ) ;
2015-08-09 22:13:06 +00:00
}
}
}
if ( plen = = ( guint32 ) advance & & nxt ! = IP_PROTO_NONE ) {
2015-08-23 02:46:36 +00:00
col_add_fstr ( pinfo - > cinfo , COL_INFO , " Bogus IPv6 payload length " ) ;
2015-08-09 22:13:06 +00:00
if ( ti_ipv6_plen ) {
proto_item_append_text ( ti_ipv6_plen , " (Bogus, next header is %s) " , ipprotostr ( nxt ) ) ;
expert_add_info ( pinfo , ti_ipv6_plen , & ei_ipv6_bogus_ipv6_length ) ;
}
2015-11-23 03:59:08 +00:00
return tvb_captured_length ( tvb ) ;
2015-08-09 22:13:06 +00:00
}
2016-06-22 20:10:50 +00:00
if ( ! pinfo - > flags . in_error_pkt & & plen > ( tvb_reported_length ( tvb ) - 40 ) ) {
2015-08-21 08:33:17 +00:00
expert_add_info_format ( pinfo , ti_ipv6_plen , & ei_ipv6_bogus_payload_length ,
" IPv6 payload length exceeds framing length (%d bytes) " ,
tvb_reported_length ( tvb ) - 40 ) ;
}
2015-08-09 22:13:06 +00:00
/* Adjust the length of this tvbuff to include only the IPv6 datagram. */
set_actual_length ( tvb , plen + ( guint ) sizeof ( struct ip6_hdr ) ) ;
plen - = advance ;
2015-09-18 01:08:34 +00:00
save_fragmented = pinfo - > fragmented ;
1999-03-28 18:32:03 +00:00
again :
2008-11-07 01:54:08 +00:00
2014-04-28 23:42:42 +00:00
/* Get a tvbuff for the options. */
options_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
2015-08-21 02:54:36 +00:00
nxt_handle = dissector_get_uint_handle ( ipv6_next_header_dissector_table , nxt ) ;
2008-11-07 01:54:08 +00:00
2014-04-28 23:42:42 +00:00
if ( ( nxt_handle ) & &
2015-11-05 03:43:55 +00:00
( ( advance = call_dissector_with_data ( nxt_handle , options_tvb , pinfo , ipv6_exthdr_tree , & iph ) ) > 0 ) ) {
2008-11-07 01:54:08 +00:00
nxt = tvb_get_guint8 ( tvb , offset ) ;
offset + = advance ;
plen - = advance ;
goto again ;
2014-04-28 23:42:42 +00:00
} else {
switch ( nxt ) {
case IP_PROTO_FRAGMENT :
2015-11-05 03:43:55 +00:00
advance = dissect_frag6 ( tvb , offset , pinfo , ipv6_exthdr_tree ,
2015-09-18 01:08:34 +00:00
& frag_off , & frag_flg , & frag_ident ) ;
2013-12-12 20:39:11 +00:00
nxt = tvb_get_guint8 ( tvb , offset ) ;
offset + = advance ;
plen - = advance ;
2015-09-18 01:08:34 +00:00
if ( ( frag_off = = 0 ) & & ! frag_flg ) {
goto again ;
}
pinfo - > fragmented = TRUE ;
if ( ipv6_reassemble ) {
/* reassembling */
if ( tvb_bytes_exist ( tvb , offset , plen ) ) {
ipfd_head = fragment_add_check ( & ipv6_reassembly_table ,
tvb , offset , pinfo , frag_ident , NULL ,
frag_off , plen , frag_flg ) ;
next_tvb = process_reassembled_data ( tvb , offset , pinfo , " Reassembled IPv6 " ,
ipfd_head , & ipv6_frag_items , & update_col_info , ipv6_tree ) ;
if ( next_tvb ) { /* Process post-fragment headers after reassembly... */
offset = 0 ;
tvb = next_tvb ;
pinfo - > fragmented = FALSE ;
goto again ;
}
2014-04-28 23:42:42 +00:00
}
}
2015-09-18 01:08:34 +00:00
else {
/* not reassembling */
if ( frag_off = = 0 ) /* ... or in the first fragment */
goto again ;
}
show_data = TRUE ;
2014-04-28 23:42:42 +00:00
break ;
case IP_PROTO_NONE :
col_set_str ( pinfo - > cinfo , COL_INFO , " IPv6 no next header " ) ;
2015-09-18 01:08:34 +00:00
show_data = TRUE ;
2014-04-28 23:42:42 +00:00
break ;
default :
2015-11-29 15:22:36 +00:00
if ( ( ipv6extprotostr ( nxt ) ! = NULL ) & &
! dissector_get_uint_handle ( ip_dissector_table , nxt ) ) {
2015-11-05 03:43:55 +00:00
advance = dissect_unknown_exthdr ( tvb , offset , ipv6_exthdr_tree ) ;
2014-04-28 23:42:42 +00:00
nxt = tvb_get_guint8 ( tvb , offset ) ;
offset + = advance ;
plen - = advance ;
2015-08-09 22:13:06 +00:00
ipv6_info - > exthdr_count + + ;
2014-04-28 23:42:42 +00:00
goto again ;
}
2013-12-12 20:39:11 +00:00
}
2000-04-20 07:05:58 +00:00
}
2015-11-05 03:43:55 +00:00
if ( ! ipv6_exthdr_under_root ) {
proto_item_set_len ( ipv6_item , offset ) ;
}
2015-09-18 01:08:34 +00:00
iph . ip_p = nxt ;
2009-12-10 23:15:12 +00:00
2013-12-12 20:39:11 +00:00
/* collect packet info */
2015-09-16 21:58:49 +00:00
p_add_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , ( pinfo - > curr_layer_num < < 8 ) | IPV6_PROTO_VALUE , GUINT_TO_POINTER ( ( guint ) nxt ) ) ;
2015-01-03 19:40:16 +00:00
tap_queue_packet ( ipv6_tap , pinfo , ipv6 ) ;
2006-06-25 12:15:35 +00:00
2013-12-12 20:39:11 +00:00
/* Get a tvbuff for the payload. */
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
2015-09-18 01:08:34 +00:00
if ( show_data ) {
/* COL_INFO already set */
2016-03-20 00:33:14 +00:00
call_data_dissector ( next_tvb , pinfo , tree ) ;
2015-09-18 01:08:34 +00:00
}
else {
/* First fragment and not reassembling, not fragmented, or already reassembled. */
/* Dissect what we have here. */
if ( ! ip_try_dissect ( try_heuristic_first , next_tvb , pinfo , tree , & iph ) ) {
/* Unknown protocol. */
2013-12-12 20:39:11 +00:00
col_add_fstr ( pinfo - > cinfo , COL_INFO , " %s (%u) " , ipprotostr ( nxt ) , nxt ) ;
2016-03-20 00:33:14 +00:00
call_data_dissector ( next_tvb , pinfo , tree ) ;
2011-12-21 14:18:28 +00:00
}
2001-06-26 17:31:36 +00:00
}
2013-12-12 20:39:11 +00:00
pinfo - > fragmented = save_fragmented ;
2015-11-23 03:59:08 +00:00
return tvb_captured_length ( tvb ) ;
1999-03-28 18:32:03 +00:00
}
1999-07-29 05:47:07 +00:00
void
proto_register_ipv6 ( void )
{
2015-10-31 21:11:39 +00:00
static hf_register_info hf_ipv6 [ ] = {
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_version ,
2015-09-25 12:53:18 +00:00
{ " Version " , " ipv6.version " ,
FT_UINT8 , BASE_DEC , NULL , 0xF0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ip_version ,
2015-09-25 12:53:18 +00:00
{ " Version " , " ip.version " ,
FT_UINT8 , BASE_DEC , NULL , 0xF0 ,
NULL , HFILL }
} ,
2015-09-02 00:28:18 +00:00
{ & hf_ipv6_tclass ,
2015-09-25 12:53:18 +00:00
{ " Traffic class " , " ipv6.tclass " ,
FT_UINT32 , BASE_HEX , NULL , 0x0FF00000 ,
NULL , HFILL }
} ,
2015-09-02 00:28:18 +00:00
{ & hf_ipv6_tclass_dscp ,
2015-09-25 12:53:18 +00:00
{ " Differentiated Services Codepoint " , " ipv6.tclass.dscp " ,
FT_UINT32 , BASE_DEC | BASE_EXT_STRING , & dscp_vals_ext , 0x0FC00000 ,
NULL , HFILL }
} ,
2015-09-02 00:28:18 +00:00
{ & hf_ipv6_tclass_ecn ,
2015-09-25 12:53:18 +00:00
{ " Explicit Congestion Notification " , " ipv6.tclass.ecn " ,
FT_UINT32 , BASE_DEC | BASE_EXT_STRING , & ecn_vals_ext , 0x00300000 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_flow ,
2016-01-12 16:39:51 +00:00
{ " Flow label " , " ipv6.flow " ,
2015-09-25 12:53:18 +00:00
FT_UINT32 , BASE_HEX , NULL , 0x000FFFFF ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_plen ,
2015-09-25 12:53:18 +00:00
{ " Payload length " , " ipv6.plen " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_nxt ,
2015-09-25 12:53:18 +00:00
{ " Next header " , " ipv6.nxt " ,
FT_UINT8 , BASE_DEC | BASE_EXT_STRING , & ipproto_val_ext , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_hlim ,
2015-09-25 12:53:18 +00:00
{ " Hop limit " , " ipv6.hlim " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_src ,
2015-09-25 12:53:18 +00:00
{ " Source " , " ipv6.src " ,
FT_IPv6 , BASE_NONE , NULL , 0x0 ,
" Source IPv6 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_src_host ,
2015-09-25 12:53:18 +00:00
{ " Source Host " , " ipv6.src_host " ,
FT_STRING , BASE_NONE , NULL , 0x0 ,
" Source IPv6 Host " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_src_sa_mac ,
2015-09-25 12:53:18 +00:00
{ " Source SA MAC " , " ipv6.src_sa_mac " ,
FT_ETHER , BASE_NONE , NULL , 0x0 ,
" Source IPv6 Stateless Autoconfiguration MAC Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_src_isatap_ipv4 ,
2015-09-25 12:53:18 +00:00
{ " Source ISATAP IPv4 " , " ipv6.src_isatap_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
" Source IPv6 ISATAP Encapsulated IPv4 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_src_6to4_gateway_ipv4 ,
2015-09-25 12:53:18 +00:00
{ " Source 6to4 Gateway IPv4 " , " ipv6.src_6to4_gw_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
" Source IPv6 6to4 Gateway IPv4 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_src_6to4_sla_id ,
2015-09-25 12:53:18 +00:00
{ " Source 6to4 SLA ID " , " ipv6.src_6to4_sla_id " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Source IPv6 6to4 SLA ID " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_src_teredo_server_ipv4 ,
2015-09-25 12:53:18 +00:00
{ " Source Teredo Server IPv4 " , " ipv6.src_ts_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
" Source IPv6 Teredo Server Encapsulated IPv4 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_src_teredo_port ,
2015-09-25 12:53:18 +00:00
{ " Source Teredo Port " , " ipv6.src_tc_port " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Source IPv6 Teredo Client Mapped Port " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_src_teredo_client_ipv4 ,
2015-09-25 12:53:18 +00:00
{ " Source Teredo Client IPv4 " , " ipv6.src_tc_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
" Source IPv6 Teredo Client Encapsulated IPv4 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_dst ,
2015-09-25 12:53:18 +00:00
{ " Destination " , " ipv6.dst " ,
FT_IPv6 , BASE_NONE , NULL , 0x0 ,
" Destination IPv6 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_dst_host ,
2015-09-25 12:53:18 +00:00
{ " Destination Host " , " ipv6.dst_host " ,
FT_STRING , BASE_NONE , NULL , 0x0 ,
" Destination IPv6 Host " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_dst_sa_mac ,
2015-09-25 12:53:18 +00:00
{ " Destination SA MAC " , " ipv6.dst_sa_mac " ,
FT_ETHER , BASE_NONE , NULL , 0x0 ,
" Destination IPv6 Stateless Autoconfiguration MAC Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_dst_isatap_ipv4 ,
2015-09-25 12:53:18 +00:00
{ " Destination ISATAP IPv4 " , " ipv6.dst_isatap_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
" Destination IPv6 ISATAP Encapsulated IPv4 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_dst_6to4_gateway_ipv4 ,
2015-09-25 12:53:18 +00:00
{ " Destination 6to4 Gateway IPv4 " , " ipv6.dst_6to4_gw_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
" Destination IPv6 6to4 Gateway IPv4 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_dst_6to4_sla_id ,
2015-09-25 12:53:18 +00:00
{ " Destination 6to4 SLA ID " , " ipv6.dst_6to4_sla_id " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Destination IPv6 6to4 SLA ID " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_dst_teredo_server_ipv4 ,
2015-09-25 12:53:18 +00:00
{ " Destination Teredo Server IPv4 " , " ipv6.dst_ts_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
" Destination IPv6 Teredo Server Encapsulated IPv4 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_dst_teredo_port ,
2015-09-25 12:53:18 +00:00
{ " Destination Teredo Port " , " ipv6.dst_tc_port " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Destination IPv6 Teredo Client Mapped Port " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_dst_teredo_client_ipv4 ,
2015-09-25 12:53:18 +00:00
{ " Destination Teredo Client IPv4 " , " ipv6.dst_tc_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
" Destination IPv6 Teredo Client Encapsulated IPv4 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_addr ,
2015-09-25 12:53:18 +00:00
{ " Source or Destination Address " , " ipv6.addr " ,
FT_IPv6 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_host ,
2015-09-25 12:53:18 +00:00
{ " Source or Destination Host " , " ipv6.host " ,
FT_STRING , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_sa_mac ,
2015-09-25 12:53:18 +00:00
{ " SA MAC " , " ipv6.sa_mac " ,
FT_ETHER , BASE_NONE , NULL , 0x0 ,
" IPv6 Stateless Autoconfiguration MAC Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_isatap_ipv4 ,
2015-09-25 12:53:18 +00:00
{ " ISATAP IPv4 " , " ipv6.isatap_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
" IPv6 ISATAP Encapsulated IPv4 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_6to4_gateway_ipv4 ,
2015-09-25 12:53:18 +00:00
{ " 6to4 Gateway IPv4 " , " ipv6.6to4_gw_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
" IPv6 6to4 Gateway IPv4 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_6to4_sla_id ,
2015-09-25 12:53:18 +00:00
{ " 6to4 SLA ID " , " ipv6.6to4_sla_id " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" IPv6 6to4 SLA ID " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_teredo_server_ipv4 ,
2015-09-25 12:53:18 +00:00
{ " Teredo Server IPv4 " , " ipv6.ts_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
" IPv6 Teredo Server Encapsulated IPv4 Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_teredo_port ,
2015-09-25 12:53:18 +00:00
{ " Teredo Port " , " ipv6.tc_port " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" IPv6 Teredo Client Mapped Port " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_teredo_client_ipv4 ,
2015-09-25 12:53:18 +00:00
{ " Teredo Client IPv4 " , " ipv6.tc_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
" IPv6 Teredo Client Encapsulated IPv4 Address " , HFILL }
} ,
2011-10-05 22:27:51 +00:00
# ifdef HAVE_GEOIP_V6
2013-12-12 20:39:11 +00:00
{ & hf_geoip_country ,
2015-09-25 12:53:18 +00:00
{ " Source or Destination GeoIP Country " , " ipv6.geoip.country " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_city ,
2015-09-25 12:53:18 +00:00
{ " Source or Destination GeoIP City " , " ipv6.geoip.city " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_org ,
2015-09-25 12:53:18 +00:00
{ " Source or Destination GeoIP Organization " , " ipv6.geoip.org " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_isp ,
2015-09-25 12:53:18 +00:00
{ " Source or Destination GeoIP ISP " , " ipv6.geoip.isp " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_asnum ,
2015-09-25 12:53:18 +00:00
{ " Source or Destination GeoIP AS Number " , " ipv6.geoip.asnum " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_lat ,
2015-09-25 12:53:18 +00:00
{ " Source or Destination GeoIP Latitude " , " ipv6.geoip.lat " ,
FT_DOUBLE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_lon ,
2015-09-25 12:53:18 +00:00
{ " Source or Destination GeoIP Longitude " , " ipv6.geoip.lon " ,
FT_DOUBLE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_src_country ,
2015-09-25 12:53:18 +00:00
{ " Source GeoIP Country " , " ipv6.geoip.src_country " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_src_city ,
2015-09-25 12:53:18 +00:00
{ " Source GeoIP City " , " ipv6.geoip.src_city " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_src_org ,
2015-09-25 12:53:18 +00:00
{ " Source GeoIP Organization " , " ipv6.geoip.src_org " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_src_isp ,
2015-09-25 12:53:18 +00:00
{ " Source GeoIP ISP " , " ipv6.geoip.src_isp " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_src_asnum ,
2015-09-25 12:53:18 +00:00
{ " Source GeoIP AS Number " , " ipv6.geoip.src_asnum " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_src_lat ,
2015-09-25 12:53:18 +00:00
{ " Source GeoIP Latitude " , " ipv6.geoip.src_lat " ,
FT_DOUBLE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_src_lon ,
2015-09-25 12:53:18 +00:00
{ " Source GeoIP Longitude " , " ipv6.geoip.src_lon " ,
FT_DOUBLE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_dst_country ,
2015-09-25 12:53:18 +00:00
{ " Destination GeoIP Country " , " ipv6.geoip.dst_country " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_dst_city ,
2015-09-25 12:53:18 +00:00
{ " Destination GeoIP City " , " ipv6.geoip.dst_city " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_dst_org ,
2015-09-25 12:53:18 +00:00
{ " Destination GeoIP Organization " , " ipv6.geoip.dst_org " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_dst_isp ,
2015-09-25 12:53:18 +00:00
{ " Destination GeoIP ISP " , " ipv6.geoip.dst_isp " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_dst_asnum ,
2015-09-25 12:53:18 +00:00
{ " Destination GeoIP AS Number " , " ipv6.geoip.dst_asnum " ,
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_dst_lat ,
2015-09-25 12:53:18 +00:00
{ " Destination GeoIP Latitude " , " ipv6.geoip.dst_lat " ,
FT_DOUBLE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_geoip_dst_lon ,
2015-09-25 12:53:18 +00:00
{ " Destination GeoIP Longitude " , " ipv6.geoip.dst_lon " ,
FT_DOUBLE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2011-10-05 22:27:51 +00:00
# endif /* HAVE_GEOIP_V6 */
2015-09-11 08:06:49 +00:00
{ & hf_ipv6_unknown_hdr ,
2015-09-25 12:53:18 +00:00
{ " Unknown Extension Header " , " ipv6.unknown_hdr " ,
FT_NONE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2015-09-11 08:06:49 +00:00
{ & hf_ipv6_unknown_hdr_nxt ,
2015-09-25 12:53:18 +00:00
{ " Next Header " , " ipv6.unknown_hdr.nxt " ,
FT_UINT8 , BASE_DEC | BASE_EXT_STRING , & ipproto_val_ext , 0x0 ,
NULL , HFILL }
} ,
2016-06-01 16:40:33 +00:00
{ & hf_ipv6_unknown_hdr_len ,
{ " Length " , " ipv6.unknown_hdr.len " ,
2015-09-25 12:53:18 +00:00
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
2016-06-01 16:40:33 +00:00
" Extension header length in 8-octet words (minus 1) " , HFILL }
} ,
{ & hf_ipv6_unknown_hdr_len_oct ,
{ " Length " , " ipv6.unknown_hdr.len_oct " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Extension header length in octets " , HFILL }
2015-09-25 12:53:18 +00:00
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt ,
2015-09-25 12:53:18 +00:00
{ " IPv6 Option " , " ipv6.opt " ,
FT_NONE , BASE_NONE , NULL , 0x0 ,
" Option " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_type ,
2015-09-25 12:53:18 +00:00
{ " Type " , " ipv6.opt.type " ,
2015-12-29 12:15:44 +00:00
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
2015-09-25 12:53:18 +00:00
" Option type " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_length ,
2015-09-25 12:53:18 +00:00
{ " Length " , " ipv6.opt.length " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
" Option length in octets " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_pad1 ,
2015-09-25 12:53:18 +00:00
{ " Pad1 " , " ipv6.opt.pad1 " ,
FT_NONE , BASE_NONE , NULL , 0x0 ,
" Pad1 Option " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_padn ,
2015-09-25 12:53:18 +00:00
{ " PadN " , " ipv6.opt.padn " ,
2015-11-29 00:13:59 +00:00
FT_BYTES , BASE_NONE | BASE_ALLOW_ZERO , NULL , 0x0 ,
2015-09-25 12:53:18 +00:00
" PadN Option " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_rtalert ,
2015-09-25 12:53:18 +00:00
{ " Router Alert " , " ipv6.opt.router_alert " ,
FT_UINT16 , BASE_DEC , VALS ( rtalertvals ) , 0x0 ,
" Router Alert Option " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_tel ,
2015-09-25 12:53:18 +00:00
{ " Tunnel Encapsulation Limit " , " ipv6.opt.tel " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
" How many further levels of encapsulation are permitted " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_jumbo ,
2015-09-25 12:53:18 +00:00
{ " Payload Length " , " ipv6.opt.jumbo " ,
FT_UINT32 , BASE_DEC , NULL , 0x0 ,
" IPv6 (Jumbo) Payload Length " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_calipso_doi ,
2015-09-25 12:53:18 +00:00
{ " CALIPSO Domain of Interpretation " , " ipv6.opt.calipso.doi " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_calipso_cmpt_length ,
2015-09-25 12:53:18 +00:00
{ " Compartment Length " , " ipv6.opt.calipso.cmpt.length " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_calipso_sens_level ,
2015-09-25 12:53:18 +00:00
{ " Sensitivity Level " , " ipv6.opt.calipso.sens_level " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_calipso_checksum ,
2015-09-25 12:53:18 +00:00
{ " Checksum " , " ipv6.opt.calipso.checksum " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_calipso_cmpt_bitmap ,
2015-09-25 12:53:18 +00:00
{ " Compartment Bitmap " , " ipv6.opt.calipso.cmpt_bitmap " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_qs_func ,
2015-09-25 12:53:18 +00:00
{ " Function " , " ipv6.opt.qs_func " ,
FT_UINT8 , BASE_DEC , VALS ( qs_func_vals ) , QS_FUNC_MASK ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_qs_rate ,
2015-09-25 12:53:18 +00:00
{ " Rate " , " ipv6.opt.qs_rate " ,
FT_UINT8 , BASE_DEC | BASE_EXT_STRING , & qs_rate_vals_ext , QS_RATE_MASK ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_qs_ttl ,
2015-09-25 12:53:18 +00:00
{ " QS TTL " , " ipv6.opt.qs_ttl " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_qs_ttl_diff ,
2015-09-25 12:53:18 +00:00
{ " TTL Diff " , " ipv6.opt.qs_ttl_diff " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_qs_unused ,
2015-09-25 12:53:18 +00:00
{ " Not Used " , " ipv6.opt.qs_unused " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_qs_nonce ,
2015-09-25 12:53:18 +00:00
{ " QS Nonce " , " ipv6.opt.qs_nonce " ,
FT_UINT32 , BASE_HEX , NULL , 0xFFFFFFFC ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_qs_reserved ,
2015-09-25 12:53:18 +00:00
{ " Reserved " , " ipv6.opt.qs_reserved " ,
FT_UINT32 , BASE_HEX , NULL , 0x0003 ,
NULL , HFILL }
} ,
2015-09-06 12:08:08 +00:00
{ & hf_ipv6_opt_mipv6_home_address ,
2015-09-25 12:53:18 +00:00
{ " MIPv6 Home Address " , " ipv6.opt.mipv6.home_address " ,
FT_IPv6 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_rpl_flag ,
2015-09-25 12:53:18 +00:00
{ " Flag " , " ipv6.opt.rpl.flag " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_rpl_flag_o ,
2015-09-25 12:53:18 +00:00
{ " Down " , " ipv6.opt.rpl.flag.o " ,
FT_BOOLEAN , 8 , NULL , 0x80 ,
" The packet is expected to progress Up or Down " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_rpl_flag_r ,
2015-09-25 12:53:18 +00:00
{ " Rank Error " , " ipv6.opt.rpl.flag.r " ,
FT_BOOLEAN , 8 , NULL , 0x40 ,
" Whether a rank error was detected " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_rpl_flag_f ,
2015-09-25 12:53:18 +00:00
{ " Forwarding Error " , " ipv6.opt.rpl.flag.f " ,
FT_BOOLEAN , 8 , NULL , 0x20 ,
" Set if the node cannot forward the packet further towards the destination " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_rpl_flag_rsv ,
2015-09-25 12:53:18 +00:00
{ " Reserved " , " ipv6.opt.rpl.flag.rsv " ,
FT_UINT8 , BASE_HEX , NULL , 0x1F ,
" Reserved (must be zero) " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_rpl_instance_id ,
2015-09-25 12:53:18 +00:00
{ " RPLInstanceID " , " ipv6.opt.rpl.instance_id " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
" The DODAG instance along which the packet is sent " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_rpl_senderrank ,
2015-09-25 12:53:18 +00:00
{ " Sender Rank " , " ipv6.opt.rpl.sender_rank " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 ,
" Set to zero by the source and to DAGRank(rank) by a router that forwards inside the RPL network " , HFILL }
} ,
2015-12-29 19:30:58 +00:00
{ & hf_ipv6_opt_ilnp_nonce ,
{ " ILNP Nonce " , " ipv6.opt.ilnp_nonce " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
{ & hf_ipv6_opt_lio_len ,
{ " LineIDLen " , " ipv6.opt.lio.length " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
{ & hf_ipv6_opt_lio_id ,
{ " Line ID " , " ipv6.opt.lio.line_id " ,
FT_UINT_STRING , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2015-06-11 15:16:34 +00:00
{ & hf_ipv6_opt_mpl_flag ,
2015-09-25 12:53:18 +00:00
{ " Flag " , " ipv6.opt.mpl.flag " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
NULL , HFILL }
} ,
2015-06-11 15:16:34 +00:00
{ & hf_ipv6_opt_mpl_flag_s ,
2015-09-25 12:53:18 +00:00
{ " Seed ID Length " , " ipv6.opt.mpl.flag.s " ,
FT_UINT8 , BASE_DEC , NULL , 0xC0 ,
" Identifies the length of Seed ID " , HFILL }
} ,
2015-06-11 15:16:34 +00:00
{ & hf_ipv6_opt_mpl_flag_m ,
2015-09-25 12:53:18 +00:00
{ " Largest Sequence " , " ipv6.opt.mpl.flag.m " ,
FT_BOOLEAN , 8 , NULL , 0x20 ,
" Indicates Sequence is known to be the largest sequence number " , HFILL }
} ,
2015-06-11 15:16:34 +00:00
{ & hf_ipv6_opt_mpl_flag_v ,
2015-09-25 12:53:18 +00:00
{ " Version " , " ipv6.opt.mpl.flag.v " ,
FT_BOOLEAN , 8 , NULL , 0x10 ,
" 0 indicates this option conforms to RFC<TBC> " , HFILL }
} ,
2015-06-11 15:16:34 +00:00
{ & hf_ipv6_opt_mpl_flag_rsv ,
2015-09-25 12:53:18 +00:00
{ " Reserved " , " ipv6.opt.mpl.flag.rsv " ,
FT_UINT8 , BASE_HEX , NULL , 0x0F ,
" Reserved (must be zero) " , HFILL }
} ,
2015-06-11 15:16:34 +00:00
{ & hf_ipv6_opt_mpl_sequence ,
2015-09-25 12:53:18 +00:00
{ " Sequence " , " ipv6.opt.mpl.sequence " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
" Identifies relative ordering of MPL Data Messages from the MPL Seed identified by Seed ID " , HFILL }
} ,
2015-06-11 15:16:34 +00:00
{ & hf_ipv6_opt_mpl_seed_id ,
2015-09-25 12:53:18 +00:00
{ " Seed ID " , " ipv6.opt.mpl.seed_id " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
" Uniquely identifies the MPL Seed that initiated dissemination of the MPL Data Message " , HFILL }
} ,
2015-12-29 19:30:58 +00:00
{ & hf_ipv6_opt_dff_flags ,
{ " Flags " , " ipv6.opt.dff.flags " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
NULL , HFILL }
} ,
{ & hf_ipv6_opt_dff_flag_ver ,
{ " Version (VER) " , " ipv6.opt.dff.flag.ver " ,
FT_UINT8 , BASE_DEC , NULL , 0xC0 ,
" The version of DFF that is used " , HFILL }
} ,
{ & hf_ipv6_opt_dff_flag_dup ,
{ " Duplicate (DUP) " , " ipv6.opt.dff.flag.dup " ,
FT_BOOLEAN , 8 , NULL , 0x20 ,
" Indicates the packet is being retransmitted " , HFILL }
} ,
{ & hf_ipv6_opt_dff_flag_ret ,
{ " Return (RET) " , " ipv6.opt.dff.flag.ret " ,
FT_BOOLEAN , 8 , NULL , 0x10 ,
" Must be set to 1 prior to sending the packet back to the Previous Hop " , HFILL }
} ,
{ & hf_ipv6_opt_dff_flag_rsv ,
{ " Reserved " , " ipv6.opt.dff.flag.rsv " ,
FT_UINT8 , BASE_HEX , NULL , 0x0F ,
" Reserved (must be zero) " , HFILL }
} ,
{ & hf_ipv6_opt_dff_seqnum ,
{ " Sequence Number " , " ipv6.opt.dff.sequence_number " ,
FT_UINT16 , BASE_DEC_HEX , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_experimental ,
2015-09-25 12:53:18 +00:00
{ " Experimental Option " , " ipv6.opt.experimental " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2014-10-12 18:56:17 +00:00
{ & hf_ipv6_opt_unknown_data ,
2015-09-25 12:53:18 +00:00
{ " Unknown Data " , " ipv6.opt_unknown_data " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
" Not interpreted data " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_opt_unknown ,
2015-09-25 12:53:18 +00:00
{ " Unknown Option Payload " , " ipv6.opt.unknown " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2015-09-18 01:08:34 +00:00
{ & hf_ipv6_fragment ,
2015-09-25 12:53:18 +00:00
{ " IPv6 Fragment " , " ipv6.fragment " ,
FT_FRAMENUM , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_fragment_overlap ,
2015-09-25 12:53:18 +00:00
{ " Fragment overlap " , " ipv6.fragment.overlap " ,
FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
" Fragment overlaps with other fragments " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_fragment_overlap_conflict ,
2015-09-25 12:53:18 +00:00
{ " Conflicting data in fragment overlap " , " ipv6.fragment.overlap.conflict " ,
FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
" Overlapping fragments contained conflicting data " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_fragment_multiple_tails ,
2015-09-25 12:53:18 +00:00
{ " Multiple tail fragments found " , " ipv6.fragment.multipletails " ,
FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
" Several tails were found when defragmenting the packet " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_fragment_too_long_fragment ,
2015-09-25 12:53:18 +00:00
{ " Fragment too long " , " ipv6.fragment.toolongfragment " ,
FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
" Fragment contained data past end of packet " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_fragment_error ,
2015-09-25 12:53:18 +00:00
{ " Defragmentation error " , " ipv6.fragment.error " ,
FT_FRAMENUM , BASE_NONE , NULL , 0x0 ,
" Defragmentation error due to illegal fragments " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_fragment_count ,
2015-09-25 12:53:18 +00:00
{ " Fragment count " , " ipv6.fragment.count " ,
FT_UINT32 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_fragments ,
2015-09-25 12:53:18 +00:00
{ " IPv6 Fragments " , " ipv6.fragments " ,
FT_NONE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_reassembled_in ,
2015-09-25 12:53:18 +00:00
{ " Reassembled IPv6 in frame " , " ipv6.reassembled.in " ,
FT_FRAMENUM , BASE_NONE , NULL , 0x0 ,
" This IPv6 packet is reassembled in this frame " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_reassembled_length ,
2015-09-25 12:53:18 +00:00
{ " Reassembled IPv6 length " , " ipv6.reassembled.length " ,
FT_UINT32 , BASE_DEC , NULL , 0x0 ,
" The total length of the reassembled payload " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_reassembled_data ,
2015-09-25 12:53:18 +00:00
{ " Reassembled IPv6 data " , " ipv6.reassembled.data " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
" The reassembled payload " , HFILL }
} ,
2014-09-10 23:58:33 +00:00
{ & hf_ipv6_padding ,
2015-09-25 12:53:18 +00:00
{ " Padding " , " ipv6.padding " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
2015-10-31 21:11:39 +00:00
}
} ;
static hf_register_info hf_ipv6_hopopts [ ] = {
2015-12-11 13:36:49 +00:00
{ & hf_ipv6_hopopts_nxt ,
{ " Next Header " , " ipv6.hopopts.nxt " ,
2015-10-31 21:11:39 +00:00
FT_UINT8 , BASE_DEC | BASE_EXT_STRING , & ipproto_val_ext , 0x0 ,
NULL , HFILL }
2015-09-25 12:53:18 +00:00
} ,
2016-06-01 16:40:33 +00:00
{ & hf_ipv6_hopopts_len ,
{ " Length " , " ipv6.hopopts.len " ,
2015-10-31 21:11:39 +00:00
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
2016-06-01 16:40:33 +00:00
" Extension header length in 8-octet words (minus 1) " , HFILL }
} ,
{ & hf_ipv6_hopopts_len_oct ,
{ " Length " , " ipv6.hopopts.len_oct " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Extension header length in octets " , HFILL }
}
} ;
static hf_register_info hf_ipv6_dstopts [ ] = {
{ & hf_ipv6_dstopts_nxt ,
{ " Next Header " , " ipv6.dstopts.nxt " ,
FT_UINT8 , BASE_DEC | BASE_EXT_STRING , & ipproto_val_ext , 0x0 ,
NULL , HFILL }
} ,
{ & hf_ipv6_dstopts_len ,
{ " Length " , " ipv6.dstopts.len " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
" Extension header length in 8-octet words (minus 1) " , HFILL }
} ,
{ & hf_ipv6_dstopts_len_oct ,
{ " Length " , " ipv6.dstopts.len_oct " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Extension header length in octets " , HFILL }
2015-10-31 21:11:39 +00:00
}
} ;
static hf_register_info hf_ipv6_routing [ ] = {
2014-09-10 23:58:33 +00:00
2015-09-06 12:08:08 +00:00
/* IPv6 Routing Header */
{ & hf_ipv6_routing_nxt ,
2015-09-25 12:53:18 +00:00
{ " Next Header " , " ipv6.routing.nxt " ,
FT_UINT8 , BASE_DEC | BASE_EXT_STRING , & ipproto_val_ext , 0x0 ,
NULL , HFILL }
} ,
2016-06-01 16:40:33 +00:00
{ & hf_ipv6_routing_len ,
{ " Length " , " ipv6.routing.len " ,
2015-09-25 12:53:18 +00:00
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
2016-06-01 16:40:33 +00:00
" Extension header length in 8-octet words (minus 1) " , HFILL }
} ,
{ & hf_ipv6_routing_len_oct ,
{ " Length " , " ipv6.routing.len_oct " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Extension header length in octets " , HFILL }
2015-09-25 12:53:18 +00:00
} ,
2015-09-06 12:08:08 +00:00
{ & hf_ipv6_routing_type ,
2015-09-25 12:53:18 +00:00
{ " Type " , " ipv6.routing.type " ,
FT_UINT8 , BASE_DEC , VALS ( routing_header_type ) , 0x0 ,
" Routing Header Type " , HFILL }
} ,
2015-09-06 12:08:08 +00:00
{ & hf_ipv6_routing_segleft ,
2015-09-25 12:53:18 +00:00
{ " Segments Left " , " ipv6.routing.segleft " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
" Routing Header Segments Left " , HFILL }
} ,
2015-09-06 12:08:08 +00:00
/* Source Routing Header */
{ & hf_ipv6_routing_src_reserved ,
2015-09-25 12:53:18 +00:00
{ " Reserved " , " ipv6.routing.src.reserved " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
" Must be zero " , HFILL }
} ,
2015-09-06 12:08:08 +00:00
{ & hf_ipv6_routing_src_addr ,
2015-09-25 12:53:18 +00:00
{ " Address " , " ipv6.routing.src.addr " ,
FT_IPv6 , BASE_NONE , NULL , 0x0 ,
" Source Routing Header Address " , HFILL } } ,
2015-09-06 12:08:08 +00:00
/* Mobile IPv6 */
{ & hf_ipv6_routing_mipv6_reserved ,
2015-09-25 12:53:18 +00:00
{ " Reserved " , " ipv6.routing.mipv6.reserved " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
" Must be zero " , HFILL }
} ,
2015-09-06 12:08:08 +00:00
{ & hf_ipv6_routing_mipv6_home_address ,
2015-09-25 12:53:18 +00:00
{ " Home Address " , " ipv6.routing.mipv6.home_address " ,
FT_IPv6 , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2015-09-06 12:08:08 +00:00
2013-12-12 20:39:11 +00:00
/* RPL Routing Header */
2015-09-06 12:08:08 +00:00
{ & hf_ipv6_routing_rpl_cmprI ,
2015-09-25 12:53:18 +00:00
{ " Compressed Internal Octets (CmprI) " , " ipv6.routing.rpl.cmprI " ,
FT_UINT32 , BASE_DEC , NULL , IP6RRPL_BITMASK_CMPRI ,
" Elided octets from all but last segment " , HFILL }
} ,
2015-09-06 12:08:08 +00:00
{ & hf_ipv6_routing_rpl_cmprE ,
2015-09-25 12:53:18 +00:00
{ " Compressed Final Octets (CmprE) " , " ipv6.routing.rpl.cmprE " ,
FT_UINT32 , BASE_DEC , NULL , IP6RRPL_BITMASK_CMPRE ,
" Elided octets from last segment address " , HFILL }
} ,
2015-09-06 12:08:08 +00:00
{ & hf_ipv6_routing_rpl_pad ,
2015-09-25 12:53:18 +00:00
{ " Padding Bytes " , " ipv6.routing.rpl.pad " ,
FT_UINT32 , BASE_DEC , NULL , IP6RRPL_BITMASK_PAD ,
NULL , HFILL }
} ,
2015-09-06 12:08:08 +00:00
{ & hf_ipv6_routing_rpl_reserved ,
2015-09-25 12:53:18 +00:00
{ " Reserved " , " ipv6.routing.rpl.reserved " ,
FT_UINT32 , BASE_DEC , NULL , IP6RRPL_BITMASK_RESERVED ,
" Must be zero " , HFILL }
} ,
2015-11-28 22:53:51 +00:00
{ & hf_ipv6_routing_rpl_addr_count ,
{ " Total Address Count " , " ipv6.routing.rpl.addr_count " ,
2015-09-25 12:53:18 +00:00
FT_INT32 , BASE_DEC , NULL , 0 ,
NULL , HFILL }
} ,
2015-09-06 12:08:08 +00:00
{ & hf_ipv6_routing_rpl_addr ,
2015-09-25 12:53:18 +00:00
{ " Address " , " ipv6.routing.rpl.address " ,
FT_BYTES , BASE_NONE , NULL , 0 ,
NULL , HFILL }
} ,
2015-09-06 12:08:08 +00:00
{ & hf_ipv6_routing_rpl_fulladdr ,
2015-09-25 12:53:18 +00:00
{ " Full Address " , " ipv6.routing.rpl.full_address " ,
FT_IPv6 , BASE_NONE , NULL , 0 ,
" Uncompressed IPv6 Address " , HFILL }
} ,
2016-05-28 00:55:04 +00:00
/* Segment Routing Header */
{ & hf_ipv6_routing_srh_first_seg ,
{ " First segment " , " ipv6.routing.srh.first_segment " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
" Index of the first segment " , HFILL }
} ,
{ & hf_ipv6_routing_srh_flags ,
{ " Flags " , " ipv6.routing.srh.flags " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 ,
NULL , HFILL }
} ,
2016-06-11 17:09:05 +00:00
{ & hf_ipv6_routing_srh_flag_c ,
{ " Cleanup " , " ipv6.routing.srh.flag_c " ,
FT_BOOLEAN , 16 , TFS ( & tfs_true_false ) , 0x8000 ,
NULL , HFILL }
} ,
{ & hf_ipv6_routing_srh_flag_p ,
{ " Protected " , " ipv6.routing.srh.flag_p " ,
FT_BOOLEAN , 16 , TFS ( & tfs_true_false ) , 0x4000 ,
NULL , HFILL }
} ,
{ & hf_ipv6_routing_srh_flag_o ,
{ " OAM " , " ipv6.routing.srh.flag_o " ,
FT_BOOLEAN , 16 , TFS ( & tfs_true_false ) , 0x2000 ,
NULL , HFILL }
} ,
{ & hf_ipv6_routing_srh_flag_a ,
{ " Alert " , " ipv6.routing.srh.flag_a " ,
FT_BOOLEAN , 16 , TFS ( & tfs_present_not_present ) , 0x1000 ,
NULL , HFILL }
} ,
{ & hf_ipv6_routing_srh_flag_h ,
{ " HMAC " , " ipv6.routing.srh.flag_h " ,
FT_BOOLEAN , 16 , TFS ( & tfs_present_not_present ) , 0x0800 ,
NULL , HFILL }
} ,
{ & hf_ipv6_routing_srh_flag_unused ,
{ " Unused " , " ipv6.routing.srh.flag_unused " ,
FT_UINT16 , BASE_HEX , NULL , 0x07FF ,
NULL , HFILL }
} ,
2016-05-28 00:55:04 +00:00
{ & hf_ipv6_routing_srh_reserved ,
{ " Reserved " , " ipv6.routing.srh.reserved " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
" Must be zero " , HFILL }
} ,
{ & hf_ipv6_routing_srh_addr ,
{ " Address " , " ipv6.routing.srh.addr " ,
FT_IPv6 , BASE_NONE , NULL , 0x0 ,
" Segment address " , HFILL }
}
2015-10-31 21:11:39 +00:00
} ;
2013-12-12 20:39:11 +00:00
2015-10-31 21:11:39 +00:00
static hf_register_info hf_ipv6_fraghdr [ ] = {
{ & hf_ipv6_fraghdr_nxt ,
{ " Next header " , " ipv6.fraghdr.nxt " ,
FT_UINT8 , BASE_DEC | BASE_EXT_STRING , & ipproto_val_ext , 0x0 ,
NULL , HFILL }
} ,
{ & hf_ipv6_fraghdr_reserved_octet ,
{ " Reserved octet " , " ipv6.fraghdr.reserved_octet " ,
2016-01-14 11:40:23 +00:00
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
2015-10-31 21:11:39 +00:00
" Should always be 0 " , HFILL }
} ,
{ & hf_ipv6_fraghdr_offset ,
{ " Offset " , " ipv6.fraghdr.offset " ,
FT_UINT16 , BASE_DEC , NULL , IP6F_OFF_MASK ,
" Fragment Offset " , HFILL }
} ,
{ & hf_ipv6_fraghdr_reserved_bits ,
{ " Reserved bits " , " ipv6.fraghdr.reserved_bits " ,
FT_UINT16 , BASE_DEC , NULL , IP6F_RESERVED_MASK ,
NULL , HFILL }
} ,
{ & hf_ipv6_fraghdr_more ,
{ " More Fragments " , " ipv6.fraghdr.more " ,
FT_BOOLEAN , 16 , TFS ( & tfs_yes_no ) , IP6F_MORE_FRAG ,
NULL , HFILL }
} ,
{ & hf_ipv6_fraghdr_ident ,
{ " Identification " , " ipv6.fraghdr.ident " ,
FT_UINT32 , BASE_HEX , NULL , 0x0 ,
" Fragment Identification " , HFILL }
}
} ;
static hf_register_info hf_ipv6_shim6 [ ] = {
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_nxt ,
2015-09-25 12:53:18 +00:00
{ " Next Header " , " ipv6.shim6.nxt " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_len ,
2016-06-01 16:40:33 +00:00
{ " Length " , " ipv6.shim6.len " ,
2015-09-25 12:53:18 +00:00
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
2016-06-01 16:40:33 +00:00
" Extension header length in 8-octet words (minus 1) " , HFILL }
} ,
{ & hf_ipv6_shim6_len_oct ,
{ " Length " , " ipv6.shim6.len_oct " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Extension header length in octets " , HFILL }
2015-09-25 12:53:18 +00:00
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_p ,
2015-09-25 12:53:18 +00:00
{ " P Bit " , " ipv6.shim6.p " ,
FT_BOOLEAN , 8 , NULL , SHIM6_BITMASK_P ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_ct ,
2015-09-25 12:53:18 +00:00
{ " Context Tag " , " ipv6.shim6.ct " ,
FT_NONE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_type ,
2015-09-25 12:53:18 +00:00
{ " Message Type " , " ipv6.shim6.type " ,
FT_UINT8 , BASE_DEC , VALS ( shimctrlvals ) , SHIM6_BITMASK_TYPE ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_proto ,
2015-09-25 12:53:18 +00:00
{ " Protocol " , " ipv6.shim6.proto " ,
FT_UINT8 , BASE_DEC , VALS ( shim6_protocol ) , SHIM6_BITMASK_PROTOCOL ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_checksum ,
2015-09-25 12:53:18 +00:00
{ " Checksum " , " ipv6.shim6.checksum " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 ,
" Shim6 Checksum " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_checksum_bad ,
2015-09-25 12:53:18 +00:00
{ " Bad Checksum " , " ipv6.shim6.checksum_bad " ,
FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
" Shim6 Bad Checksum " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_checksum_good ,
2015-09-25 12:53:18 +00:00
{ " Good Checksum " , " ipv6.shim6.checksum_good " ,
FT_BOOLEAN , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_inonce ,
2015-09-25 12:53:18 +00:00
{ " Initiator Nonce " , " ipv6.shim6.inonce " ,
FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_rnonce ,
2015-09-25 12:53:18 +00:00
{ " Responder Nonce " , " ipv6.shim6.rnonce " ,
FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 ,
NULL , HFILL }
} ,
2014-10-13 02:09:35 +00:00
{ & hf_ipv6_shim6_reserved ,
2015-09-25 12:53:18 +00:00
{ " Reserved " , " ipv6.shim6.reserved " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2014-10-13 02:09:35 +00:00
{ & hf_ipv6_shim6_reserved2 ,
2015-09-25 12:53:18 +00:00
{ " Reserved2 " , " ipv6.shim6.reserved2 " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_precvd ,
2015-09-25 12:53:18 +00:00
{ " Probes Received " , " ipv6.shim6.precvd " ,
FT_UINT8 , BASE_DEC , NULL , SHIM6_BITMASK_PRECVD ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_psent ,
2015-09-25 12:53:18 +00:00
{ " Probes Sent " , " ipv6.shim6.psent " ,
FT_UINT8 , BASE_DEC , NULL , SHIM6_BITMASK_PSENT ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_psrc ,
2015-09-25 12:53:18 +00:00
{ " Source Address " , " ipv6.shim6.psrc " ,
FT_IPv6 , BASE_NONE , NULL , 0x0 ,
" Shim6 Probe Source Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_pdst ,
2015-09-25 12:53:18 +00:00
{ " Destination Address " , " ipv6.shim6.pdst " ,
FT_IPv6 , BASE_NONE , NULL , 0x0 ,
" Shim6 Probe Destination Address " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_pnonce ,
2015-09-25 12:53:18 +00:00
{ " Nonce " , " ipv6.shim6.pnonce " ,
FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 ,
" Shim6 Probe Nonce " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_pdata ,
2015-09-25 12:53:18 +00:00
{ " Data " , " ipv6.shim6.pdata " ,
FT_UINT32 , BASE_HEX , NULL , 0x0 ,
" Shim6 Probe Data " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_sulid ,
2015-09-25 12:53:18 +00:00
{ " Sender ULID " , " ipv6.shim6.sulid " ,
FT_IPv6 , BASE_NONE , NULL , 0x0 ,
" Shim6 Sender ULID " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_rulid ,
2015-09-25 12:53:18 +00:00
{ " Receiver ULID " , " ipv6.shim6.rulid " ,
FT_IPv6 , BASE_NONE , NULL , 0x0 ,
" Shim6 Receiver ULID " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_reap ,
2015-09-25 12:53:18 +00:00
{ " REAP State " , " ipv6.shim6.reap " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_opt_type ,
2015-09-25 12:53:18 +00:00
{ " Option Type " , " ipv6.shim6.opt.type " ,
FT_UINT16 , BASE_DEC , VALS ( shimoptvals ) , SHIM6_BITMASK_OPT_TYPE ,
" Shim6 Option Type " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_opt_critical ,
2015-09-25 12:53:18 +00:00
{ " Option Critical Bit " , " ipv6.shim6.opt.critical " ,
FT_BOOLEAN , 8 , TFS ( & tfs_yes_no ) , SHIM6_BITMASK_CRITICAL ,
" TRUE: option is critical, FALSE: option is not critical " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_opt_len ,
2015-09-25 12:53:18 +00:00
{ " Content Length " , " ipv6.shim6.opt.len " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Content Length Option " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_opt_total_len ,
2015-09-25 12:53:18 +00:00
{ " Total Length " , " ipv6.shim6.opt.total_len " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Total Option Length " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_opt_loc_verif_methods ,
2015-09-25 12:53:18 +00:00
{ " Verification Method " , " ipv6.shim6.opt.verif_method " ,
FT_UINT8 , BASE_DEC , VALS ( shimverifmethods ) , 0x0 ,
" Locator Verification Method " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_opt_loclist ,
2015-09-25 12:53:18 +00:00
{ " Locator List Generation " , " ipv6.shim6.opt.loclist " ,
FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_locator ,
2015-09-25 12:53:18 +00:00
{ " Locator " , " ipv6.shim6.locator " ,
FT_IPv6 , BASE_NONE , NULL , 0x0 ,
" Shim6 Locator " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_opt_locnum ,
2015-09-25 12:53:18 +00:00
{ " Num Locators " , " ipv6.shim6.opt.locnum " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
" Number of locators in Locator List " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_opt_elemlen ,
2015-09-25 12:53:18 +00:00
{ " Element Length " , " ipv6.shim6.opt.elemlen " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
" Length of Elements in Locator Preferences Option " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_loc_flag ,
2015-09-25 12:53:18 +00:00
{ " Flags " , " ipv6.shim6.loc.flags " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
" Locator Preferences Flags " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_loc_prio ,
2015-09-25 12:53:18 +00:00
{ " Priority " , " ipv6.shim6.loc.prio " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
" Locator Preferences Priority " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_loc_weight ,
2015-09-25 12:53:18 +00:00
{ " Weight " , " ipv6.shim6.loc.weight " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
" Locator Preferences Weight " , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_shim6_opt_fii ,
2015-09-25 12:53:18 +00:00
{ " Forked Instance Identifier " , " ipv6.shim6.opt.fii " ,
FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 ,
NULL , HFILL }
} ,
2014-10-13 02:09:35 +00:00
{ & hf_ipv6_shim6_validator ,
2015-09-25 12:53:18 +00:00
{ " Validator " , " ipv6.shim6.validator " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2014-10-13 02:09:35 +00:00
{ & hf_ipv6_shim6_cga_parameter_data_structure ,
2015-09-25 12:53:18 +00:00
{ " CGA Parameter Data Structure " , " ipv6.shim6.cga_parameter_data_structure " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2014-10-13 02:09:35 +00:00
{ & hf_ipv6_shim6_cga_signature ,
2015-09-25 12:53:18 +00:00
{ " CGA Signature " , " ipv6.shim6.cga_signature " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
2015-10-31 21:11:39 +00:00
}
} ;
2013-12-12 20:39:11 +00:00
static gint * ett [ ] = {
& ett_ipv6 ,
& ett_ipv6_opt ,
2015-06-11 15:16:34 +00:00
& ett_ipv6_opt_rpl ,
& ett_ipv6_opt_mpl ,
2015-12-29 19:30:58 +00:00
& ett_ipv6_opt_dff_flags ,
2015-09-18 01:08:34 +00:00
& ett_ipv6_fraghdr ,
2015-09-06 12:08:08 +00:00
& ett_ipv6_routing ,
2016-06-11 17:09:05 +00:00
& ett_ipv6_routing_srh_flags ,
2016-05-28 00:55:04 +00:00
& ett_ipv6_routing_srh_vect ,
2013-12-12 20:39:11 +00:00
& ett_ipv6_shim6 ,
& ett_ipv6_shim6_option ,
& ett_ipv6_shim6_locators ,
& ett_ipv6_shim6_verif_methods ,
& ett_ipv6_shim6_loc_pref ,
& ett_ipv6_shim6_probes_sent ,
& ett_ipv6_shim6_probes_rcvd ,
& ett_ipv6_shim6_probe_sent ,
& ett_ipv6_shim6_probe_rcvd ,
& ett_ipv6_shim6_cksum ,
& ett_ipv6_fragment ,
2015-09-18 01:08:34 +00:00
& ett_ipv6_fragments ,
2013-12-12 20:39:11 +00:00
& ett_ipv6_traffic_class ,
2011-10-05 22:27:51 +00:00
# ifdef HAVE_GEOIP_V6
2013-12-12 20:39:11 +00:00
& ett_geoip_info
2011-10-05 22:27:51 +00:00
# endif /* HAVE_GEOIP_V6 */
2013-12-12 20:39:11 +00:00
} ;
2015-09-25 12:53:18 +00:00
2013-12-12 20:39:11 +00:00
static ei_register_info ei [ ] = {
2015-09-25 12:53:18 +00:00
{ & ei_ipv6_dst_addr_not_multicast ,
{ " ipv6.dst_addr.not_multicast " , PI_PROTOCOL , PI_WARN ,
" Destination address must not be a multicast address " , EXPFILL }
} ,
{ & ei_ipv6_src_route_list_mult_inst_same_addr ,
{ " ipv6.src_route_list.mult_inst_same_addr " , PI_PROTOCOL , PI_ERROR ,
" Multiple instances of the same address must not appear in the source route list " , EXPFILL }
} ,
{ & ei_ipv6_src_route_list_src_addr ,
{ " ipv6.src_route_list.src_addr " , PI_PROTOCOL , PI_ERROR ,
" Source address must not appear in the source route list " , EXPFILL }
} ,
{ & ei_ipv6_src_route_list_dst_addr ,
{ " ipv6.src_route_list.dst_addr " , PI_PROTOCOL , PI_ERROR ,
" Destination address must not appear in the source route list " , EXPFILL }
} ,
{ & ei_ipv6_src_route_list_multicast_addr ,
{ " ipv6.src_route_list.multicast_addr " , PI_PROTOCOL , PI_ERROR ,
" Multicast addresses must not appear in the source route list " , EXPFILL }
} ,
{ & ei_ipv6_routing_rpl_cmpri_cmpre_pad ,
{ " ipv6.routing.rpl.cmprI_cmprE_pad " , PI_PROTOCOL , PI_WARN ,
" When cmprI equals 0 and cmprE equals 0, pad MUST equal 0 but instead was X " , EXPFILL }
} ,
2015-11-28 22:53:51 +00:00
{ & ei_ipv6_routing_rpl_addr_count_ge0 ,
{ " ipv6.routing.rpl.addr_count_ge0 " , PI_MALFORMED , PI_ERROR ,
2015-09-25 12:53:18 +00:00
" Calculated total address count must be greater than or equal to 0, instead was X " , EXPFILL }
} ,
{ & ei_ipv6_routing_rpl_reserved ,
{ " ipv6.routing.rpl.reserved_not0 " , PI_PROTOCOL , PI_WARN ,
" Reserved field must equal 0 but instead was X " , EXPFILL }
} ,
{ & ei_ipv6_opt_jumbo_missing ,
{ " ipv6.opt.jumbo.missing " , PI_PROTOCOL , PI_ERROR ,
" IPv6 payload length equals 0 and Hop-By-Hop present and Jumbo Payload option missing " , EXPFILL }
} ,
{ & ei_ipv6_opt_jumbo_prohibited ,
{ " ipv6.opt.jumbo.prohibited " , PI_PROTOCOL , PI_ERROR ,
" When IPv6 payload length does not equal 0 a Jumbo Payload option must not be present " , EXPFILL }
} ,
{ & ei_ipv6_opt_jumbo_truncated ,
{ " ipv6.opt.jumbo.truncated " , PI_PROTOCOL , PI_ERROR ,
" Jumbo Payload option present and jumbo length < 65536 " , EXPFILL }
} ,
{ & ei_ipv6_opt_jumbo_fragment ,
{ " ipv6.opt.jumbo.fragment " , PI_PROTOCOL , PI_ERROR ,
" Jumbo Payload option cannot be used with a fragment header " , EXPFILL }
} ,
{ & ei_ipv6_opt_jumbo_not_hopbyhop ,
{ " ipv6.opt.jumbo.not_hopbyhop " , PI_PROTOCOL , PI_ERROR ,
" Jumbo Payload option must be a hop-by-hop option " , EXPFILL }
} ,
2015-12-29 12:15:44 +00:00
{ & ei_ipv6_opt_invalid_len ,
{ " ipv6.opt.invalid_len " , PI_MALFORMED , PI_ERROR ,
" Invalid IPv6 option length " , EXPFILL }
2015-09-25 12:53:18 +00:00
} ,
{ & ei_ipv6_opt_unknown_data ,
{ " ipv6.opt.unknown_data.expert " , PI_UNDECODED , PI_NOTE ,
" Unknown Data (not interpreted) " , EXPFILL }
} ,
{ & ei_ipv6_shim6_opt_elemlen_invalid ,
{ " ipv6.shim6.opt.elemlen.invalid " , PI_MALFORMED , PI_ERROR ,
" Invalid element length " , EXPFILL }
} ,
{ & ei_ipv6_shim6_checksum_bad ,
{ " ipv6.shim6.checksum_bad.expert " , PI_CHECKSUM , PI_ERROR ,
" Bad checksum " , EXPFILL }
} ,
{ & ei_ipv6_hopopts_not_first ,
{ " ipv6.hopopts.not_first " , PI_PROTOCOL , PI_ERROR ,
" IPv6 Hop-by-Hop extension header must appear immediately after IPv6 header " , EXPFILL }
} ,
{ & ei_ipv6_bogus_ipv6_length ,
{ " ipv6.bogus_ipv6_length " , PI_PROTOCOL , PI_ERROR ,
" Bogus IPv6 length " , EXPFILL }
} ,
{ & ei_ipv6_bogus_payload_length ,
{ " ipv6.bogus_payload_length " , PI_PROTOCOL , PI_WARN ,
" IPv6 payload length does not match expected framing length " , EXPFILL }
} ,
{ & ei_ipv6_bogus_ipv6_version ,
{ " ipv6.bogus_ipv6_version " , PI_PROTOCOL , PI_ERROR ,
" Bogus IP version " , EXPFILL }
} ,
{ & ei_ipv6_invalid_header ,
{ " ipv6.invalid_header " , PI_MALFORMED , PI_ERROR ,
" IPv6 header must be exactly 40 bytes " , EXPFILL }
} ,
{ & ei_ipv6_routing_invalid_length ,
{ " ipv6.routing.invalid_length " , PI_MALFORMED , PI_ERROR ,
" Invalid IPv6 Routing header length " , EXPFILL }
} ,
{ & ei_ipv6_routing_invalid_segleft ,
{ " ipv6.routing.invalid_segleft " , PI_PROTOCOL , PI_ERROR ,
" IPv6 Routing Header segments left field must not exceed address count " , EXPFILL }
} ,
2016-05-28 00:55:04 +00:00
{ & ei_ipv6_routing_not_implemented ,
{ " ipv6.routing.not_implemented " , PI_UNDECODED , PI_NOTE ,
" Undecoded IPv6 routing header field " , EXPFILL }
}
2013-12-12 20:39:11 +00:00
} ;
/* Decode As handling */
static build_valid_func ipv6_da_build_value [ 1 ] = { ipv6_value } ;
static decode_as_value_t ipv6_da_values = { ipv6_prompt , 1 , ipv6_da_build_value } ;
static decode_as_t ipv6_da = { " ipv6 " , " Network " , " ip.proto " , 1 , 0 , & ipv6_da_values , NULL , NULL ,
decode_as_default_populate_list , decode_as_default_reset , decode_as_default_change , NULL } ;
2014-04-28 23:42:42 +00:00
static build_valid_func ipv6_next_header_da_build_value [ 1 ] = { ipv6_next_header_value } ;
static decode_as_value_t ipv6_next_header_da_values = { ipv6_next_header_prompt , 1 , ipv6_next_header_da_build_value } ;
2015-09-16 21:58:49 +00:00
static decode_as_t ipv6_next_header_da = { " ipv6 " , " IPv6 Next Header " , " ipv6.nxt " , 1 , 0 , & ipv6_next_header_da_values , NULL , NULL ,
2014-04-28 23:42:42 +00:00
decode_as_default_populate_list , decode_as_default_reset , decode_as_default_change , NULL } ;
2013-12-12 20:39:11 +00:00
module_t * ipv6_module ;
expert_module_t * expert_ipv6 ;
proto_ipv6 = proto_register_protocol ( " Internet Protocol Version 6 " , " IPv6 " , " ipv6 " ) ;
2015-10-31 21:11:39 +00:00
proto_register_field_array ( proto_ipv6 , hf_ipv6 , array_length ( hf_ipv6 ) ) ;
2013-12-12 20:39:11 +00:00
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
expert_ipv6 = expert_register_protocol ( proto_ipv6 ) ;
expert_register_field_array ( expert_ipv6 , ei , array_length ( ei ) ) ;
2015-11-05 03:43:55 +00:00
proto_ipv6_hopopts = proto_register_protocol ( " IPv6 Hop-by-Hop Option " , " IPv6 Hop-by-Hop " , " ipv6.hopopts " ) ;
proto_ipv6_routing = proto_register_protocol ( " Routing Header for IPv6 " , " IPv6 Routing " , " ipv6.routing " ) ;
proto_ipv6_fraghdr = proto_register_protocol ( " Fragment Header for IPv6 " , " IPv6 Fragment " , " ipv6.fraghdr " ) ;
proto_ipv6_shim6 = proto_register_protocol ( " Shim6 Protocol " , " Shim6 " , " ipv6.shim6 " ) ;
proto_ipv6_dstopts = proto_register_protocol ( " Destination Options for IPv6 " , " IPv6 Destination " , " ipv6.dstopts " ) ;
2015-10-31 21:11:39 +00:00
proto_register_field_array ( proto_ipv6_hopopts , hf_ipv6_hopopts , array_length ( hf_ipv6_hopopts ) ) ;
proto_register_field_array ( proto_ipv6_routing , hf_ipv6_routing , array_length ( hf_ipv6_routing ) ) ;
proto_register_field_array ( proto_ipv6_fraghdr , hf_ipv6_fraghdr , array_length ( hf_ipv6_fraghdr ) ) ;
proto_register_field_array ( proto_ipv6_shim6 , hf_ipv6_shim6 , array_length ( hf_ipv6_shim6 ) ) ;
proto_register_field_array ( proto_ipv6_dstopts , hf_ipv6_dstopts , array_length ( hf_ipv6_dstopts ) ) ;
2016-03-13 11:51:45 +00:00
ipv6_next_header_dissector_table = register_dissector_table ( " ipv6.nxt " , " IPv6 Next Header " , proto_ipv6 , FT_UINT32 , BASE_DEC , DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE ) ;
2015-12-14 13:48:59 +00:00
register_capture_dissector_table ( " ipv6.nxt " , " IPv6 Next Header " ) ;
2014-04-28 23:42:42 +00:00
2013-12-12 20:39:11 +00:00
/* Register configuration options */
ipv6_module = prefs_register_protocol ( proto_ipv6 , NULL ) ;
prefs_register_bool_preference ( ipv6_module , " defragment " ,
" Reassemble fragmented IPv6 datagrams " ,
" Whether fragmented IPv6 datagrams should be reassembled " ,
& ipv6_reassemble ) ;
prefs_register_bool_preference ( ipv6_module , " summary_in_tree " ,
" Show IPv6 summary in protocol tree " ,
" Whether the IPv6 summary line should be shown in the protocol tree " ,
& ipv6_summary_in_tree ) ;
2011-10-05 22:27:51 +00:00
# ifdef HAVE_GEOIP_V6
2013-12-12 20:39:11 +00:00
prefs_register_bool_preference ( ipv6_module , " use_geoip " ,
" Enable GeoIP lookups " ,
" Whether to look up IPv6 addresses in each GeoIP database we have loaded " ,
& ipv6_use_geoip ) ;
2011-10-05 22:27:51 +00:00
# endif /* HAVE_GEOIP_V6 */
2001-06-08 08:30:42 +00:00
2013-12-12 20:39:11 +00:00
/* RPL Strict Header Checking */
prefs_register_bool_preference ( ipv6_module , " perform_strict_rpl_srh_rfc_checking " ,
" Perform strict checking for adherence to the RFC for RPL Source Routing Headers (RFC 6554) " ,
2016-06-02 03:15:11 +00:00
" Whether to check that all RPL Source Routed packets do not visit a node more than once " ,
2013-12-12 20:39:11 +00:00
& g_ipv6_rpl_srh_strict_rfc_checking ) ;
2012-05-31 07:25:11 +00:00
2015-04-26 03:29:30 +00:00
prefs_register_bool_preference ( ipv6_module , " try_heuristic_first " ,
" Try heuristic sub-dissectors first " ,
" Try to decode a packet using an heuristic sub-dissector before using a sub-dissector registered to a specific port " ,
& try_heuristic_first ) ;
2015-11-05 03:43:55 +00:00
prefs_register_bool_preference ( ipv6_module , " exthdr_under_root_protocol_tree " ,
" Display IPv6 extension headers under the root protocol tree " ,
" Whether to display IPv6 extension headers as a separate protocol or a sub-protocol of the IPv6 packet " ,
& ipv6_exthdr_under_root ) ;
2016-06-01 16:40:33 +00:00
prefs_register_bool_preference ( ipv6_module , " exthdr_hide_len_oct_field " ,
" Use a single field for IPv6 extension header length " ,
" If enabled the Length field in octets will be hidden " ,
& ipv6_exthdr_hide_len_oct_field ) ;
2015-12-09 04:04:01 +00:00
register_dissector ( " ipv6 " , dissect_ipv6 , proto_ipv6 ) ;
2013-12-12 20:39:11 +00:00
register_init_routine ( ipv6_reassemble_init ) ;
2015-06-28 11:06:31 +00:00
register_cleanup_routine ( ipv6_reassemble_cleanup ) ;
2013-12-12 20:39:11 +00:00
ipv6_tap = register_tap ( " ipv6 " ) ;
2013-11-20 19:17:08 +00:00
2013-12-12 20:39:11 +00:00
register_decode_as ( & ipv6_da ) ;
2014-04-28 23:42:42 +00:00
register_decode_as ( & ipv6_next_header_da ) ;
2014-07-23 17:38:55 +00:00
2014-12-31 04:26:19 +00:00
register_conversation_table ( proto_ipv6 , TRUE , ipv6_conversation_packet , ipv6_hostlist_packet ) ;
2015-10-29 03:30:55 +00:00
register_conversation_filter ( " ipv6 " , " IPv6 " , ipv6_filter_valid , ipv6_build_filter ) ;
1999-07-29 05:47:07 +00:00
}
Change the sub-dissector handoff registration routines so that the
sub-dissector table is not stored in the header_field_info struct, but
in a separate namespace. Dissector tables are now registered by name
and not by field ID. For example:
udp_dissector_table = register_dissector_table("udp.port");
Because of this different namespace, dissector tables can have names
that are not field names. This is useful for ethertype, since multiple
fields are "ethertypes".
packet-ethertype.c replaces ethertype.c (the name was changed so that it
would be named in the same fashion as all the filenames passed to make-reg-dotc)
Although it registers no protocol or field, it registers one dissector table:
ethertype_dissector_table = register_dissector_table("ethertype");
All protocols that can be called because of an ethertype field now register
that fact with dissector_add() calls.
In this way, one dissector_table services all ethertype fields
(hf_eth_type, hf_llc_type, hf_null_etype, hf_vlan_etype)
Furthermore, the code allows for names of protocols to exist in the
etype_vals, yet a dissector for that protocol doesn't exist. The name
of the dissector is printed in COL_INFO. You're welcome, Richard. :-)
svn path=/trunk/; revision=1848
2000-04-13 18:18:56 +00:00
void
proto_reg_handoff_ipv6 ( void )
{
2013-12-12 20:39:11 +00:00
dissector_handle_t ipv6_handle ;
2014-04-28 23:42:42 +00:00
dissector_handle_t ipv6_hopopts_handle , ipv6_routing_handle ,
ipv6_shim6_handle , ipv6_dstopts_handle ;
2013-12-12 20:39:11 +00:00
ipv6_handle = find_dissector ( " ipv6 " ) ;
dissector_add_uint ( " ethertype " , ETHERTYPE_IPv6 , ipv6_handle ) ;
2014-08-17 12:24:14 +00:00
dissector_add_uint ( " erf.types.type " , ERF_TYPE_IPV6 , ipv6_handle ) ;
2013-12-12 20:39:11 +00:00
dissector_add_uint ( " ppp.protocol " , PPP_IPV6 , ipv6_handle ) ;
dissector_add_uint ( " ppp.protocol " , ETHERTYPE_IPv6 , ipv6_handle ) ;
dissector_add_uint ( " gre.proto " , ETHERTYPE_IPv6 , ipv6_handle ) ;
dissector_add_uint ( " ip.proto " , IP_PROTO_IPV6 , ipv6_handle ) ;
dissector_add_uint ( " null.type " , BSD_AF_INET6_BSD , ipv6_handle ) ;
dissector_add_uint ( " null.type " , BSD_AF_INET6_FREEBSD , ipv6_handle ) ;
dissector_add_uint ( " null.type " , BSD_AF_INET6_DARWIN , ipv6_handle ) ;
dissector_add_uint ( " chdlc.protocol " , ETHERTYPE_IPv6 , ipv6_handle ) ;
dissector_add_uint ( " fr.nlpid " , NLPID_IP6 , ipv6_handle ) ;
dissector_add_uint ( " osinl.excl " , NLPID_IP6 , ipv6_handle ) ;
dissector_add_uint ( " x.25.spi " , NLPID_IP6 , ipv6_handle ) ;
dissector_add_uint ( " arcnet.protocol_id " , ARCNET_PROTO_IPv6 , ipv6_handle ) ;
2014-11-09 02:08:52 +00:00
dissector_add_uint ( " juniper.proto " , JUNIPER_PROTO_IP6 , ipv6_handle ) ;
dissector_add_uint ( " juniper.proto " , JUNIPER_PROTO_MPLS_IP6 , ipv6_handle ) ;
2014-11-09 19:00:01 +00:00
dissector_add_uint ( " pwach.channel_type " , 0x57 , ipv6_handle ) ; /* IPv6, RFC4385 clause 6. */
2014-11-10 02:13:38 +00:00
dissector_add_uint ( " sflow_245.header_protocol " , SFLOW_245_HEADER_IPv6 , ipv6_handle ) ;
2015-05-14 07:46:26 +00:00
dissector_add_uint ( " wtap_encap " , WTAP_ENCAP_RAW_IP6 , ipv6_handle ) ;
2015-12-14 13:48:59 +00:00
dissector_add_uint ( " enc " , BSD_AF_INET6_BSD , ipv6_handle ) ;
2013-12-12 20:39:11 +00:00
2015-08-30 22:18:34 +00:00
dissector_add_for_decode_as ( " udp.port " , ipv6_handle ) ;
2015-12-09 03:49:44 +00:00
ipv6_hopopts_handle = create_dissector_handle ( dissect_hopopts , proto_ipv6_hopopts ) ;
2014-04-28 23:42:42 +00:00
dissector_add_uint ( " ipv6.nxt " , IP_PROTO_HOPOPTS , ipv6_hopopts_handle ) ;
2015-12-09 03:49:44 +00:00
ipv6_routing_handle = create_dissector_handle ( dissect_routing6 , proto_ipv6_routing ) ;
2014-04-28 23:42:42 +00:00
dissector_add_uint ( " ipv6.nxt " , IP_PROTO_ROUTING , ipv6_routing_handle ) ;
2015-12-09 03:49:44 +00:00
ipv6_shim6_handle = create_dissector_handle ( dissect_shim6 , proto_ipv6_shim6 ) ;
2014-04-28 23:42:42 +00:00
dissector_add_uint ( " ipv6.nxt " , IP_PROTO_SHIM6 , ipv6_shim6_handle ) ;
2015-12-09 03:49:44 +00:00
ipv6_dstopts_handle = create_dissector_handle ( dissect_dstopts , proto_ipv6_dstopts ) ;
2014-04-28 23:42:42 +00:00
dissector_add_uint ( " ipv6.nxt " , IP_PROTO_DSTOPTS , ipv6_dstopts_handle ) ;
2013-12-12 20:39:11 +00:00
ip_dissector_table = find_dissector_table ( " ip.proto " ) ;
2015-12-13 21:54:16 +00:00
register_capture_dissector ( " ethertype " , ETHERTYPE_IPv6 , capture_ipv6 , proto_ipv6 ) ;
2015-12-14 13:48:59 +00:00
register_capture_dissector ( " enc " , BSD_AF_INET6_BSD , capture_ipv6 , proto_ipv6 ) ;
Change the sub-dissector handoff registration routines so that the
sub-dissector table is not stored in the header_field_info struct, but
in a separate namespace. Dissector tables are now registered by name
and not by field ID. For example:
udp_dissector_table = register_dissector_table("udp.port");
Because of this different namespace, dissector tables can have names
that are not field names. This is useful for ethertype, since multiple
fields are "ethertypes".
packet-ethertype.c replaces ethertype.c (the name was changed so that it
would be named in the same fashion as all the filenames passed to make-reg-dotc)
Although it registers no protocol or field, it registers one dissector table:
ethertype_dissector_table = register_dissector_table("ethertype");
All protocols that can be called because of an ethertype field now register
that fact with dissector_add() calls.
In this way, one dissector_table services all ethertype fields
(hf_eth_type, hf_llc_type, hf_null_etype, hf_vlan_etype)
Furthermore, the code allows for names of protocols to exist in the
etype_vals, yet a dissector for that protocol doesn't exist. The name
of the dissector is printed in COL_INFO. You're welcome, Richard. :-)
svn path=/trunk/; revision=1848
2000-04-13 18:18:56 +00:00
}
2011-12-21 14:18:28 +00:00
/*
* Editor modelines
*
* Local Variables :
2013-12-12 20:39:11 +00:00
* c - basic - offset : 4
2011-12-21 14:18:28 +00:00
* tab - width : 8
* indent - tabs - mode : nil
* End :
*
2013-12-12 20:39:11 +00:00
* ex : set shiftwidth = 4 tabstop = 8 expandtab :
* : indentSize = 4 : tabSize = 8 : noTabs = true :
2011-12-21 14:18:28 +00:00
*/