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 >
*
2018-02-12 11:23:27 +00:00
* SPDX - License - Identifier : GPL - 2.0 - or - later
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>
2018-02-09 01:20:26 +00:00
# include <epan/maxmind_db.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>
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>
2017-08-31 17:49:15 +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"
2016-07-19 07:41:33 +00:00
# include "packet-vxlan.h"
2016-10-31 07:27:14 +00:00
# include "packet-mpls.h"
2017-04-17 12:52:57 +00:00
# include "packet-nsh.h"
1999-03-28 18:32:03 +00:00
2013-12-14 10:29:26 +00:00
void proto_register_ipv6 ( void ) ;
void proto_reg_handoff_ipv6 ( void ) ;
2016-07-29 20:35:03 +00:00
/* Offsets of fields within an IPv6 header. */
2016-07-31 15:56:01 +00:00
# define IP6H_CTL_VFC 0
2016-07-29 20:35:03 +00:00
# define IP6H_CTL_FLOW 0
# define IP6H_CTL_PLEN 4
# define IP6H_CTL_NXT 6
# define IP6H_CTL_HLIM 7
# define IP6H_SRC 8
# define IP6H_DST 24
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 */
2017-07-30 11:18:10 +00:00
# define IP6OPT_PDM 0x0F /* 00 0 01111 = 15 */
2015-12-28 22:42:23 +00:00
# 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 */
2016-07-20 02:40:28 +00:00
# define IP6OPT_ENDI 0x8A /* 10 0 01010 = 138 */ /* DEPRECATED */
2015-12-28 22:42:23 +00:00
# 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
2014-04-28 23:42:42 +00:00
/* Protocol specific data indices */
2014-11-16 01:35:51 +00:00
# define IPV6_PROTO_VALUE 1
2016-07-15 23:48:24 +00:00
# define IPV6_PROTO_PINFO 2
2014-04-28 23:42:42 +00:00
2017-08-31 17:49:15 +00:00
static int ipv6_tap = - 1 ;
2009-12-10 23:15:12 +00:00
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_dstopts = - 1 ;
2015-09-10 15:15:46 +00:00
2017-09-01 14:02:37 +00:00
static int proto_ipv6_routing_rt0 = - 1 ;
static int proto_ipv6_routing_mipv6 = - 1 ;
static int proto_ipv6_routing_rpl = - 1 ;
static int proto_ipv6_routing_srh = - 1 ;
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 ;
2016-07-30 04:44:21 +00:00
static int hf_ipv6_src_embed_ipv4 = - 1 ;
2011-12-21 14:18:28 +00:00
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 ;
2016-07-30 04:44:21 +00:00
static int hf_ipv6_dst_embed_ipv4 = - 1 ;
2011-12-21 14:18:28 +00:00
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 ;
2016-07-30 04:44:21 +00:00
static int hf_ipv6_embed_ipv4 = - 1 ;
2012-03-12 23:13:03 +00:00
static int hf_ipv6_opt = - 1 ;
static int hf_ipv6_opt_type = - 1 ;
2016-07-20 03:11:07 +00:00
static int hf_ipv6_opt_type_action = - 1 ;
static int hf_ipv6_opt_type_change = - 1 ;
static int hf_ipv6_opt_type_rest = - 1 ;
2012-03-12 23:13:03 +00:00
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 ;
2016-07-27 00:51:54 +00:00
static int hf_ipv6_opt_smf_dpd_hash_bit = - 1 ;
static int hf_ipv6_opt_smf_dpd_tid_type = - 1 ;
static int hf_ipv6_opt_smf_dpd_tid_len = - 1 ;
static int hf_ipv6_opt_smf_dpd_tagger_id = - 1 ;
static int hf_ipv6_opt_smf_dpd_ident = - 1 ;
static int hf_ipv6_opt_smf_dpd_hav = - 1 ;
2017-07-30 11:18:10 +00:00
static int hf_ipv6_opt_pdm_scale_dtlr = - 1 ;
static int hf_ipv6_opt_pdm_scale_dtls = - 1 ;
static int hf_ipv6_opt_pdm_psn_this_pkt = - 1 ;
static int hf_ipv6_opt_pdm_psn_last_recv = - 1 ;
static int hf_ipv6_opt_pdm_delta_last_recv = - 1 ;
static int hf_ipv6_opt_pdm_delta_last_sent = - 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-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 ;
2016-07-29 13:54:06 +00:00
static int hf_ipv6_routing_unknown_data = - 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 ;
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 ;
2017-02-02 11:23:24 +00:00
static int hf_ipv6_routing_srh_flag_unused1 = - 1 ;
2016-06-11 17:09:05 +00:00
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 ;
2017-02-02 11:23:24 +00:00
static int hf_ipv6_routing_srh_flag_unused2 = - 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_geoip_country = - 1 ;
2018-03-10 17:18:03 +00:00
static int hf_geoip_country_iso = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_geoip_city = - 1 ;
2018-02-09 01:20:26 +00:00
static int hf_geoip_as_number = - 1 ;
static int hf_geoip_as_org = - 1 ;
static int hf_geoip_latitude = - 1 ;
static int hf_geoip_longitude = - 1 ;
static int hf_geoip_src_summary = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_geoip_src_country = - 1 ;
2018-03-10 17:18:03 +00:00
static int hf_geoip_src_country_iso = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_geoip_src_city = - 1 ;
2018-02-09 01:20:26 +00:00
static int hf_geoip_src_as_number = - 1 ;
static int hf_geoip_src_as_org = - 1 ;
static int hf_geoip_src_latitude = - 1 ;
static int hf_geoip_src_longitude = - 1 ;
static int hf_geoip_dst_summary = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_geoip_dst_country = - 1 ;
2018-03-10 17:18:03 +00:00
static int hf_geoip_dst_country_iso = - 1 ;
2011-12-21 14:18:28 +00:00
static int hf_geoip_dst_city = - 1 ;
2018-02-09 01:20:26 +00:00
static int hf_geoip_dst_as_number = - 1 ;
static int hf_geoip_dst_as_org = - 1 ;
static int hf_geoip_dst_latitude = - 1 ;
static int hf_geoip_dst_longitude = - 1 ;
2011-10-05 22:27:51 +00:00
2016-07-14 18:44:51 +00:00
static gint ett_ipv6_proto = - 1 ;
static gint ett_ipv6_traffic_class = - 1 ;
2012-03-12 23:13:03 +00:00
static gint ett_ipv6_opt = - 1 ;
2016-07-20 03:11:07 +00:00
static gint ett_ipv6_opt_type = - 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 ;
2016-07-14 18:44:51 +00:00
static gint ett_ipv6_hopopts_proto = - 1 ;
static gint ett_ipv6_fraghdr_proto = - 1 ;
static gint ett_ipv6_routing_proto = - 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_fragments = - 1 ;
static gint ett_ipv6_fragment = - 1 ;
2016-07-14 18:44:51 +00:00
static gint ett_ipv6_dstopts_proto = - 1 ;
2001-06-08 08:30:42 +00:00
2011-12-21 14:18:28 +00:00
static gint ett_geoip_info = - 1 ;
2011-10-05 22:27:51 +00:00
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-07-29 13:54:06 +00:00
static expert_field ei_ipv6_routing_undecoded = 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 ;
2016-07-29 14:12:01 +00:00
static expert_field ei_ipv6_routing_deprecated = 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-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 ;
2016-07-29 14:12:01 +00:00
static expert_field ei_ipv6_opt_deprecated = EI_INIT ;
2019-03-26 20:41:04 +00:00
static expert_field ei_ipv6_opt_mpl_ipv6_src_seed_id = EI_INIT ;
2015-08-09 22:13:06 +00:00
static expert_field ei_ipv6_hopopts_not_first = EI_INIT ;
2016-07-16 13:07:40 +00:00
static expert_field ei_ipv6_plen_exceeds_framing = EI_INIT ;
2017-12-17 17:40:17 +00:00
static expert_field ei_ipv6_plen_zero = 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 ;
2016-07-26 23:04:58 +00:00
static expert_field ei_ipv6_opt_header_mismatch = EI_INIT ;
2011-10-05 22:27:51 +00:00
2016-12-17 01:06:11 +00:00
static dissector_handle_t ipv6_handle ;
2016-07-09 01:22:03 +00:00
2016-07-29 01:38:13 +00:00
# define set_address_ipv6(dst, src_ip6) \
set_address ( ( dst ) , AT_IPv6 , IPv6_ADDR_SIZE , ( src_ip6 ) )
2016-10-23 08:51:16 +00:00
# define set_address_ipv6_tvb(dst, tvb, offset) \
set_address_tvb ( ( dst ) , AT_IPv6 , IPv6_ADDR_SIZE , ( tvb ) , ( offset ) )
2016-07-29 01:38:13 +00:00
# define alloc_address_wmem_ipv6(scope, dst, src_ip6) \
alloc_address_wmem ( ( scope ) , ( dst ) , AT_IPv6 , IPv6_ADDR_SIZE , ( src_ip6 ) )
# define alloc_address_tvb_ipv6(scope, dst, tvb, offset) \
alloc_address_tvb ( ( scope ) , ( dst ) , AT_IPv6 , IPv6_ADDR_SIZE , ( tvb ) , ( offset ) )
2017-10-26 08:50:00 +00:00
extern const ws_in6_addr * tvb_get_ptr_ipv6 ( tvbuff_t tvb , int offset ) ;
2016-07-09 01:22:03 +00:00
# define tvb_get_ptr_ipv6(tvb, offset) \
2017-10-26 08:50:00 +00:00
( ( const ws_in6_addr * ) tvb_get_ptr ( tvb , offset , IPv6_ADDR_SIZE ) )
2016-07-09 01:22:03 +00:00
2016-07-15 23:48:24 +00:00
ipv6_pinfo_t * p_get_ipv6_pinfo ( packet_info * pinfo )
2016-07-13 02:21:17 +00:00
{
2016-07-15 23:48:24 +00:00
return ( ipv6_pinfo_t * ) p_get_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , IPV6_PROTO_PINFO ) ;
2016-07-13 02:21:17 +00:00
}
2017-09-02 13:48:41 +00:00
/* Return tree pointer (for tree root preference) */
proto_tree * p_ipv6_pinfo_select_root ( packet_info * pinfo , proto_tree * tree )
{
ipv6_pinfo_t * p ;
if ( ( p = p_get_ipv6_pinfo ( pinfo ) ) ! = NULL & & p - > ipv6_tree ! = NULL )
return p - > ipv6_tree ;
return tree ;
}
ipv6_pinfo_t * p_ipv6_pinfo_add_len ( packet_info * pinfo , int exthdr_len )
2017-08-30 14:14:29 +00:00
{
ipv6_pinfo_t * p ;
if ( ( p = p_get_ipv6_pinfo ( pinfo ) ) = = NULL )
return NULL ;
2017-09-02 13:48:41 +00:00
p - > frag_plen - = exthdr_len ;
p - > ipv6_item_len + = exthdr_len ;
2017-08-30 14:14:29 +00:00
return p ;
}
2016-07-25 23:18:38 +00:00
static void p_add_ipv6_nxt ( packet_info * pinfo , guint8 nxt )
2013-11-20 19:17:08 +00:00
{
2016-07-28 10:38:45 +00:00
guint8 * ptr ;
ptr = ( guint8 * ) wmem_memdup ( pinfo - > pool , & nxt , sizeof ( guint8 ) ) ;
2016-07-25 23:18:38 +00:00
p_add_proto_data ( pinfo - > pool , pinfo , proto_ipv6 ,
( pinfo - > curr_layer_num < < 8 ) | IPV6_PROTO_VALUE , ptr ) ;
2013-11-20 19:17:08 +00:00
}
2016-07-25 23:18:38 +00:00
static guint8 * p_get_ipv6_nxt ( packet_info * pinfo )
2013-11-20 19:17:08 +00:00
{
2016-07-25 23:18:38 +00:00
return ( guint8 * ) 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
}
2016-07-25 23:18:38 +00:00
static gpointer ipv6_value ( packet_info * pinfo )
2014-04-28 23:42:42 +00:00
{
2016-07-25 23:18:38 +00:00
guint8 * nxt = p_get_ipv6_nxt ( pinfo ) ;
2016-07-28 10:38:45 +00:00
if ( nxt = = NULL ) {
return GUINT_TO_POINTER ( 255 ) ; /* Reserved IP Protocol */
}
2016-08-31 09:31:54 +00:00
return GUINT_TO_POINTER ( ( guint ) * nxt ) ;
2016-07-28 10:38:45 +00:00
}
static void ipv6_prompt ( packet_info * pinfo , gchar * result )
{
2016-07-25 23:18:38 +00:00
gpointer value = ipv6_value ( pinfo ) ;
2016-07-28 10:38:45 +00:00
2016-07-25 23:18:38 +00:00
g_snprintf ( result , MAX_DECODE_AS_PROMPT_LEN , " IP protocol %u as " , GPOINTER_TO_UINT ( value ) ) ;
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 } ;
2019-01-01 03:36:12 +00:00
static tap_packet_status
2018-08-22 18:08:34 +00:00
ipv6_conversation_packet ( void * pct , packet_info * pinfo , epan_dissect_t * edt _U_ , const void * vip )
2014-07-23 17:38:55 +00:00
{
conv_hash_t * hash = ( conv_hash_t * ) pct ;
2018-08-22 18:08:34 +00:00
const ipv6_tap_info_t * ip6 = ( const ipv6_tap_info_t * ) vip ;
2014-07-23 17:38:55 +00:00
2018-08-22 18:08:34 +00:00
add_conversation_table_data ( hash , & ip6 - > ip6_src , & ip6 - > ip6_dst , 0 , 0 , 1 ,
2016-07-29 01:38:13 +00:00
pinfo - > fd - > pkt_len , & pinfo - > rel_ts , & pinfo - > abs_ts ,
2017-10-29 18:29:27 +00:00
& ipv6_ct_dissector_info , ENDPOINT_NONE ) ;
2014-07-23 17:38:55 +00:00
2019-01-01 03:36:12 +00:00
return TAP_PACKET_REDRAW ;
2014-07-23 17:38:55 +00:00
}
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 } ;
2019-01-01 03:36:12 +00:00
static tap_packet_status
2018-08-22 18:08:34 +00:00
ipv6_hostlist_packet ( void * pit , packet_info * pinfo , epan_dissect_t * edt _U_ , const void * vip )
2014-07-25 15:34:51 +00:00
{
conv_hash_t * hash = ( conv_hash_t * ) pit ;
2018-08-22 18:08:34 +00:00
const ipv6_tap_info_t * ip6 = ( const ipv6_tap_info_t * ) vip ;
2014-07-25 15:34:51 +00:00
2018-08-22 18:08:34 +00:00
add_hostlist_table_data ( hash , & ip6 - > ip6_src , 0 , TRUE , 1 ,
2017-10-29 18:29:27 +00:00
pinfo - > fd - > pkt_len , & ipv6_host_dissector_info , ENDPOINT_NONE ) ;
2018-08-22 18:08:34 +00:00
add_hostlist_table_data ( hash , & ip6 - > ip6_dst , 0 , FALSE , 1 ,
2017-10-29 18:29:27 +00:00
pinfo - > fd - > pkt_len , & ipv6_host_dissector_info , ENDPOINT_NONE ) ;
2014-07-25 15:34:51 +00:00
2019-01-01 03:36:12 +00:00
return TAP_PACKET_REDRAW ;
2014-07-25 15:34:51 +00:00
}
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
}
2016-07-14 16:42:34 +00:00
static gint
ipv6_previous_layer_id ( packet_info * pinfo )
{
wmem_list_frame_t * layer ;
layer = wmem_list_tail ( pinfo - > layers ) ;
DISSECTOR_ASSERT ( layer ) ;
layer = wmem_list_frame_prev ( layer ) ;
if ( layer ! = NULL ) {
return GPOINTER_TO_INT ( wmem_list_frame_data ( layer ) ) ;
}
return - 1 ;
}
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 ;
2017-09-01 14:02:37 +00:00
static dissector_table_t ipv6_routing_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 ;
2018-02-09 01:20:26 +00:00
/* Look up addresses via mmdbresolve */
2011-10-11 17:57:09 +00:00
static gboolean ipv6_use_geoip = TRUE ;
2011-10-05 22:27:51 +00:00
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 ;
2017-12-17 17:40:17 +00:00
/* Assume TSO and correct zero-length IP packets */
static gboolean ipv6_tso_supported = 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) */
2016-07-20 03:11:07 +00:00
static const value_string ipv6_opt_type_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 " } ,
2017-07-30 11:18:10 +00:00
{ IP6OPT_PDM , " Performance and Diagnostic Metrics " } ,
2015-12-28 22:42:23 +00:00
{ 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) " } ,
2016-07-29 14:12:01 +00:00
{ IP6OPT_ENDI , " Endpoint Identification " } ,
2015-12-28 22:42:23 +00:00
{ 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 }
} ;
2016-07-20 03:11:07 +00:00
value_string_ext ipv6_opt_type_vals_ext = VALUE_STRING_EXT_INIT ( ipv6_opt_type_vals ) ;
2016-07-30 16:19:48 +00:00
static const value_string ipv6_opt_rtalert_vals [ ] = {
{ IP6OPT_RTALERT_MLD , " MLD " } ,
{ IP6OPT_RTALERT_RSVP , " RSVP " } ,
{ IP6OPT_RTALERT_ACTNET , " Active Network " } ,
{ 0 , NULL }
} ;
2016-07-27 00:51:54 +00:00
enum {
IP6OPT_SMF_DPD_NULL = 0 ,
IP6OPT_SMF_DPD_DFLT ,
IP6OPT_SMF_DPD_IPv4 ,
IP6OPT_SMF_DPD_IPv6
} ;
static const value_string ipv6_opt_smf_dpd_tidty_vals [ ] = {
{ IP6OPT_SMF_DPD_NULL , " NULL " } ,
{ IP6OPT_SMF_DPD_DFLT , " DEFAULT " } ,
{ IP6OPT_SMF_DPD_IPv4 , " IPv4 " } ,
{ IP6OPT_SMF_DPD_IPv6 , " IPv6 " } ,
{ 0 , NULL }
} ;
2016-07-20 03:11:07 +00:00
enum {
IPv6_OPT_ACTION_SKIP = 0 ,
IPv6_OPT_ACTION_DISC ,
IPv6_OPT_ACTION_ICMP ,
IPv6_OPT_ACTION_MCST ,
} ;
static const value_string ipv6_opt_type_action_vals [ ] = {
{ IPv6_OPT_ACTION_SKIP , " Skip and continue " } ,
{ IPv6_OPT_ACTION_DISC , " Discard " } ,
{ IPv6_OPT_ACTION_ICMP , " Discard and send ICMP Parameter Problem " } ,
{ IPv6_OPT_ACTION_MCST , " Discard and send ICMP if not multicast " } ,
{ 0 , NULL }
} ;
2012-03-12 23:13:03 +00:00
2016-07-26 23:04:58 +00:00
enum {
IPv6_OPT_HDR_HBH = 0 ,
IPv6_OPT_HDR_DST ,
IPv6_OPT_HDR_ANY
} ;
static const gint _ipv6_opt_type_hdr [ ] [ 2 ] = {
{ IP6OPT_TEL , IPv6_OPT_HDR_DST } ,
{ IP6OPT_RTALERT , IPv6_OPT_HDR_HBH } ,
{ IP6OPT_CALIPSO , IPv6_OPT_HDR_HBH } ,
{ IP6OPT_SMF_DPD , IPv6_OPT_HDR_HBH } ,
2017-07-30 11:18:10 +00:00
{ IP6OPT_PDM , IPv6_OPT_HDR_DST } ,
2016-07-26 23:04:58 +00:00
{ IP6OPT_QUICKSTART , IPv6_OPT_HDR_HBH } ,
{ IP6OPT_RPL , IPv6_OPT_HDR_HBH } ,
{ IP6OPT_MPL , IPv6_OPT_HDR_HBH } ,
{ IP6OPT_ILNP_NONCE , IPv6_OPT_HDR_DST } ,
{ IP6OPT_LIO , IPv6_OPT_HDR_DST } ,
{ IP6OPT_JUMBO , IPv6_OPT_HDR_HBH } ,
{ IP6OPT_HOME_ADDRESS , IPv6_OPT_HDR_DST } ,
{ IP6OPT_IP_DFF , IPv6_OPT_HDR_HBH } ,
{ 0 , IPv6_OPT_HDR_ANY }
} ;
static inline gint
ipv6_opt_type_hdr ( gint type )
{
const gint ( * p ) [ 2 ] = _ipv6_opt_type_hdr ;
for ( ; ( * p ) [ 1 ] ! = IPv6_OPT_HDR_ANY ; p + + ) {
if ( ( * p ) [ 0 ] = = type ) {
return ( * p ) [ 1 ] ;
}
}
return IPv6_OPT_HDR_ANY ;
}
2016-07-30 04:08:45 +00:00
enum {
2016-07-29 14:12:01 +00:00
IPv6_RT_HEADER_SOURCE_ROUTING = 0 , /* DEPRECATED */
IPv6_RT_HEADER_NIMROD = 1 , /* DEPRECATED */
2017-09-01 14:02:37 +00:00
IPv6_RT_HEADER_MOBILE_IP = 2 ,
2016-07-30 04:08:45 +00:00
IPv6_RT_HEADER_RPL = 3 ,
IPv6_RT_HEADER_SEGMENT_ROUTING = 4 ,
IPv6_RT_HEADER_EXP1 = 253 ,
IPv6_RT_HEADER_EXP2 = 254
} ;
/* Routing Header Types */
static const value_string routing_header_type [ ] = {
{ IPv6_RT_HEADER_SOURCE_ROUTING , " Source Route " } ,
{ IPv6_RT_HEADER_NIMROD , " Nimrod " } ,
2017-09-01 14:02:37 +00:00
{ IPv6_RT_HEADER_MOBILE_IP , " Type 2 Routing " } ,
2016-07-30 04:08:45 +00:00
{ IPv6_RT_HEADER_RPL , " RPL Source Route " } ,
{ IPv6_RT_HEADER_SEGMENT_ROUTING , " Segment Routing " } ,
{ IPv6_RT_HEADER_EXP1 , " Experiment 1 " } ,
{ IPv6_RT_HEADER_EXP2 , " Experiment 2 " } ,
{ 0 , NULL }
} ;
2019-03-26 20:41:04 +00:00
static const value_string mpl_seed_id_len_vals [ ] = {
{ 0 , " 0 " } ,
{ 1 , " 16-bit unsigned integer " } ,
{ 2 , " 64-bit unsigned integer " } ,
{ 3 , " 128-bit unsigned integer " } ,
{ 0 , NULL }
} ;
2016-11-12 14:46:43 +00:00
static gboolean
2016-07-25 23:18:38 +00:00
capture_ipv6 ( const guchar * pd , int offset , int len , capture_packet_info_t * cpinfo , const union wtap_pseudo_header * pseudo_header )
2002-10-22 22:04:23 +00:00
{
2013-12-12 20:39:11 +00:00
guint8 nxt ;
2002-10-25 23:23:28 +00:00
2016-07-25 23:18:38 +00:00
if ( ! BYTES_ARE_IN_FRAME ( offset , len , IPv6_HDR_SIZE ) )
2015-12-13 21:54:16 +00:00
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 */
2016-07-25 23:18:38 +00:00
offset + = IPv6_HDR_SIZE ; /* skip past the IPv6 header */
return try_capture_dissector ( " ip.proto " , nxt , pd , offset , len , cpinfo , pseudo_header ) ;
}
2002-10-25 23:23:28 +00:00
2016-11-12 14:46:43 +00:00
static gboolean
2016-07-25 23:18:38 +00:00
capture_ipv6_exthdr ( const guchar * pd , int offset , int len , capture_packet_info_t * cpinfo , const union wtap_pseudo_header * pseudo_header )
{
guint8 nxt ;
int advance ;
if ( ! BYTES_ARE_IN_FRAME ( offset , len , 2 ) )
return FALSE ;
nxt = pd [ offset ] ;
2013-12-12 20:39:11 +00:00
switch ( nxt ) {
2016-07-25 23:18:38 +00:00
case IP_PROTO_FRAGMENT :
advance = IPv6_FRAGMENT_HDR_SIZE ;
break ;
default :
advance = ( pd [ offset + 1 ] + 1 ) < < 3 ;
break ;
}
if ( ! BYTES_ARE_IN_FRAME ( offset , len , advance ) )
return FALSE ;
offset + = advance ;
return try_capture_dissector ( " ip.proto " , nxt , pd , offset , len , cpinfo , pseudo_header ) ;
2002-10-22 22:04:23 +00:00
}
2011-10-05 22:27:51 +00:00
static void
2018-02-09 01:20:26 +00:00
add_geoip_info_entry ( proto_tree * tree , tvbuff_t * tvb , gint offset , const ws_in6_addr * ip6 , int isdst )
2011-10-05 22:27:51 +00:00
{
2018-02-09 01:20:26 +00:00
const mmdb_lookup_t * lookup = maxmind_db_lookup_ipv6 ( ip6 ) ;
if ( ! lookup - > found ) return ;
2011-10-05 22:27:51 +00:00
2018-02-09 01:20:26 +00:00
wmem_strbuf_t * summary = wmem_strbuf_new ( wmem_packet_scope ( ) , " " ) ;
if ( lookup - > city ) {
wmem_strbuf_append ( summary , lookup - > city ) ;
}
2018-03-10 17:18:03 +00:00
if ( lookup - > country_iso ) {
if ( wmem_strbuf_get_len ( summary ) > 0 ) wmem_strbuf_append ( summary , " , " ) ;
wmem_strbuf_append ( summary , lookup - > country_iso ) ;
} else if ( lookup - > country ) {
2018-02-09 01:20:26 +00:00
if ( wmem_strbuf_get_len ( summary ) > 0 ) wmem_strbuf_append ( summary , " , " ) ;
wmem_strbuf_append ( summary , lookup - > country ) ;
}
if ( lookup - > as_number > 0 ) {
if ( wmem_strbuf_get_len ( summary ) > 0 ) wmem_strbuf_append ( summary , " , " ) ;
wmem_strbuf_append_printf ( summary , " ASN %u " , lookup - > as_number ) ;
}
if ( lookup - > as_org ) {
if ( wmem_strbuf_get_len ( summary ) > 0 ) wmem_strbuf_append ( summary , " , " ) ;
wmem_strbuf_append ( summary , lookup - > as_org ) ;
}
2012-05-30 05:33:37 +00:00
2018-02-09 01:20:26 +00:00
int addr_offset = offset + isdst ? IP6H_DST : IP6H_SRC ;
int dir_hf = isdst ? hf_geoip_dst_summary : hf_geoip_src_summary ;
proto_item * geoip_info_item = proto_tree_add_string ( tree , dir_hf , tvb , addr_offset , 16 , wmem_strbuf_finalize ( summary ) ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( geoip_info_item ) ;
2018-02-09 01:20:26 +00:00
proto_tree * geoip_info_tree = proto_item_add_subtree ( geoip_info_item , ett_geoip_info ) ;
2011-10-05 22:27:51 +00:00
2018-02-09 01:20:26 +00:00
proto_item * item ;
2011-10-05 22:27:51 +00:00
2018-02-09 01:20:26 +00:00
if ( lookup - > city ) {
dir_hf = isdst ? hf_geoip_dst_city : hf_geoip_src_city ;
item = proto_tree_add_string ( geoip_info_tree , dir_hf , tvb , addr_offset , 16 , lookup - > city ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-02-09 01:20:26 +00:00
item = proto_tree_add_string ( geoip_info_tree , hf_geoip_city , tvb , addr_offset , 16 , lookup - > city ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-02-09 01:20:26 +00:00
}
2013-12-12 20:39:11 +00:00
2018-02-09 01:20:26 +00:00
if ( lookup - > country ) {
dir_hf = isdst ? hf_geoip_dst_country : hf_geoip_src_country ;
item = proto_tree_add_string ( geoip_info_tree , dir_hf , tvb , addr_offset , 16 , lookup - > country ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-02-09 01:20:26 +00:00
item = proto_tree_add_string ( geoip_info_tree , hf_geoip_country , tvb , addr_offset , 16 , lookup - > country ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-02-09 01:20:26 +00:00
}
2018-03-10 17:18:03 +00:00
if ( lookup - > country_iso ) {
dir_hf = isdst ? hf_geoip_dst_country_iso : hf_geoip_src_country_iso ;
item = proto_tree_add_string ( geoip_info_tree , dir_hf , tvb , addr_offset , 16 , lookup - > country_iso ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-03-10 17:18:03 +00:00
item = proto_tree_add_string ( geoip_info_tree , hf_geoip_country_iso , tvb , addr_offset , 16 , lookup - > country_iso ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-03-10 17:18:03 +00:00
}
2018-02-09 01:20:26 +00:00
if ( lookup - > as_number > 0 ) {
dir_hf = isdst ? hf_geoip_dst_as_number : hf_geoip_src_as_number ;
item = proto_tree_add_uint ( geoip_info_tree , dir_hf , tvb , addr_offset , 16 , lookup - > as_number ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-02-09 01:20:26 +00:00
item = proto_tree_add_uint ( geoip_info_tree , hf_geoip_as_number , tvb , addr_offset , 16 , lookup - > as_number ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-02-09 01:20:26 +00:00
}
if ( lookup - > as_org ) {
dir_hf = isdst ? hf_geoip_dst_as_org : hf_geoip_src_as_org ;
item = proto_tree_add_string ( geoip_info_tree , dir_hf , tvb , addr_offset , 16 , lookup - > as_org ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-02-09 01:20:26 +00:00
item = proto_tree_add_string ( geoip_info_tree , hf_geoip_as_org , tvb , addr_offset , 16 , lookup - > as_org ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2011-10-05 22:27:51 +00:00
}
2018-02-09 01:20:26 +00:00
if ( lookup - > latitude > = - 90.0 & & lookup - > latitude < = 90.0 ) {
dir_hf = isdst ? hf_geoip_dst_latitude : hf_geoip_src_latitude ;
item = proto_tree_add_double ( geoip_info_tree , dir_hf , tvb , addr_offset , 16 , lookup - > latitude ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-02-09 01:20:26 +00:00
item = proto_tree_add_double ( geoip_info_tree , hf_geoip_latitude , tvb , addr_offset , 16 , lookup - > latitude ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-02-09 01:20:26 +00:00
}
if ( lookup - > longitude > = - 180.0 & & lookup - > longitude < = 180.0 ) {
dir_hf = isdst ? hf_geoip_dst_longitude : hf_geoip_src_longitude ;
item = proto_tree_add_double ( geoip_info_tree , dir_hf , tvb , addr_offset , 16 , lookup - > longitude ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-02-09 01:20:26 +00:00
item = proto_tree_add_double ( geoip_info_tree , hf_geoip_longitude , tvb , addr_offset , 16 , lookup - > longitude ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( item ) ;
2018-02-09 01:20:26 +00:00
}
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
2017-10-26 08:50:00 +00:00
add_geoip_info ( proto_tree * tree , tvbuff_t * tvb , gint offset , const ws_in6_addr * src , const ws_in6_addr * dst )
2012-05-30 05:33:37 +00:00
{
2018-02-09 01:20:26 +00:00
add_geoip_info_entry ( tree , tvb , offset , src , FALSE ) ;
add_geoip_info_entry ( tree , tvb , offset , dst , TRUE ) ;
2011-10-05 22:27:51 +00:00
}
2016-07-17 04:02:29 +00:00
/* Returns TRUE if reassembled */
2016-07-14 18:50:09 +00:00
static gboolean
2016-07-17 04:02:29 +00:00
ipv6_reassemble_do ( tvbuff_t * * tvb_ptr , gint * offset_ptr , packet_info * pinfo , proto_tree * ipv6_tree ,
guint32 plen , guint16 frag_off , gboolean frag_flg , guint32 frag_ident ,
gboolean * show_data_ptr )
2016-07-14 18:50:09 +00:00
{
fragment_head * ipfd_head ;
tvbuff_t * next_tvb ;
gboolean update_col_info = TRUE ;
pinfo - > fragmented = TRUE ;
2016-07-17 04:02:29 +00:00
* show_data_ptr = TRUE ;
2016-07-14 18:50:09 +00:00
if ( ! ipv6_reassemble ) {
/* not reassembling */
2016-07-17 04:02:29 +00:00
if ( frag_off = = 0 ) {
/* first fragment */
* show_data_ptr = FALSE ;
2016-07-14 18:50:09 +00:00
}
return FALSE ;
}
/* reassembling */
if ( tvb_bytes_exist ( * tvb_ptr , * offset_ptr , plen ) ) {
ipfd_head = fragment_add_check ( & ipv6_reassembly_table ,
2016-07-17 04:02:29 +00:00
* tvb_ptr , * offset_ptr , pinfo , frag_ident , NULL ,
frag_off , plen , frag_flg ) ;
2016-07-14 18:50:09 +00:00
next_tvb = process_reassembled_data ( * tvb_ptr , * offset_ptr , pinfo , " Reassembled IPv6 " ,
ipfd_head , & ipv6_frag_items , & update_col_info , ipv6_tree ) ;
if ( next_tvb ) {
/* Process post-fragment headers after reassembly */
* offset_ptr = 0 ;
* tvb_ptr = next_tvb ;
pinfo - > fragmented = FALSE ;
2016-07-17 04:02:29 +00:00
* show_data_ptr = FALSE ;
return TRUE ;
2016-07-14 18:50:09 +00:00
}
}
2016-07-17 04:02:29 +00:00
return FALSE ;
2016-07-14 18:50:09 +00:00
}
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 ,
2017-10-26 08:50:00 +00:00
gint length , const ws_in6_addr * value_ptr , int idx )
2016-06-01 16:26:54 +00:00
{
address addr ;
gchar * str ;
2016-07-29 01:38:13 +00:00
set_address_ipv6 ( & addr , value_ptr ) ;
2016-06-01 16:26:54 +00:00
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) */
2017-09-01 14:02:37 +00:00
static int
dissect_routing6_rt0 ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data )
2016-07-09 01:22:03 +00:00
{
2017-09-01 14:02:37 +00:00
struct ws_rthdr * rt = ( struct ws_rthdr * ) data ;
2016-07-09 01:22:03 +00:00
proto_item * ti ;
2017-09-01 14:02:37 +00:00
int offset = 0 ;
2016-07-09 01:22:03 +00:00
gint idx ;
gint rt0_addr_count ;
2017-10-26 08:50:00 +00:00
const ws_in6_addr * addr = NULL ;
2011-12-21 14:18:28 +00:00
2017-09-01 14:02:37 +00:00
proto_tree_add_item ( tree , hf_ipv6_routing_src_reserved , tvb , offset , 4 , ENC_NA ) ;
2016-07-09 01:22:03 +00:00
offset + = 4 ;
2011-12-21 14:18:28 +00:00
2017-09-01 14:02:37 +00:00
if ( rt - > hdr . ip6r_len % 2 ! = 0 ) {
expert_add_info_format ( pinfo , rt - > ti_len , & ei_ipv6_routing_invalid_length ,
2016-07-09 01:22:03 +00:00
" IPv6 Routing Header extension header length must not be odd " ) ;
}
2017-09-01 14:02:37 +00:00
rt0_addr_count = rt - > hdr . ip6r_len / 2 ;
if ( rt - > hdr . ip6r_segleft > rt0_addr_count ) {
expert_add_info_format ( pinfo , rt - > ti_segleft , & ei_ipv6_routing_invalid_segleft ,
2016-07-09 01:22:03 +00:00
" 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 ) ;
2017-09-01 14:02:37 +00:00
ti = _proto_tree_add_ipv6_vector_address ( tree , hf_ipv6_routing_src_addr , tvb ,
2016-07-09 01:22:03 +00:00
offset , IPv6_ADDR_SIZE , addr , idx ) ;
offset + = IPv6_ADDR_SIZE ;
2017-10-26 09:23:37 +00:00
if ( in6_addr_is_multicast ( addr ) ) {
2016-07-09 01:22:03 +00:00
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
2017-09-01 14:02:37 +00:00
if ( addr ! = NULL & & pinfo - > dst . type = = AT_IPv6 & & rt - > hdr . ip6r_segleft > 0 ) {
2016-07-29 01:38:13 +00:00
alloc_address_wmem_ipv6 ( pinfo - > pool , & pinfo - > dst , addr ) ;
2016-07-09 01:22:03 +00:00
}
2017-09-01 14:02:37 +00:00
expert_add_info ( pinfo , rt - > ti_type , & ei_ipv6_routing_deprecated ) ;
return tvb_captured_length ( tvb ) ;
2016-07-09 01:22:03 +00:00
}
2011-12-21 14:18:28 +00:00
2016-07-09 01:22:03 +00:00
/* Mobile IPv6 Routing Header (Type 2) */
2017-09-01 14:02:37 +00:00
static int
dissect_routing6_mipv6 ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data )
2016-07-09 01:22:03 +00:00
{
2017-09-01 14:02:37 +00:00
struct ws_rthdr * rt = ( struct ws_rthdr * ) data ;
2016-07-09 01:22:03 +00:00
proto_item * ti ;
2017-09-01 14:02:37 +00:00
int offset = 0 ;
2017-10-26 08:50:00 +00:00
const ws_in6_addr * addr ;
2015-09-06 12:08:08 +00:00
2017-09-01 14:02:37 +00:00
proto_tree_add_item ( tree , hf_ipv6_routing_mipv6_reserved , tvb , offset , 4 , ENC_NA ) ;
2016-07-09 01:22:03 +00:00
offset + = 4 ;
2011-12-21 14:18:28 +00:00
2017-09-01 14:02:37 +00:00
if ( rt - > hdr . ip6r_len ! = 2 ) {
expert_add_info_format ( pinfo , rt - > ti_len , & ei_ipv6_routing_invalid_length ,
2016-07-09 01:22:03 +00:00
" IPv6 Type 2 Routing Header extension header length must equal 2 " ) ;
}
2017-09-01 14:02:37 +00:00
if ( rt - > hdr . ip6r_segleft ! = 1 ) {
expert_add_info_format ( pinfo , rt - > ti_segleft , & ei_ipv6_routing_invalid_segleft ,
2016-07-09 01:22:03 +00:00
" 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 ) ;
2017-09-01 14:02:37 +00:00
ti = _proto_tree_add_ipv6_vector_address ( tree , hf_ipv6_routing_mipv6_home_address , tvb ,
2016-07-09 01:22:03 +00:00
offset , IPv6_ADDR_SIZE , addr , 1 ) ;
2017-10-26 09:23:37 +00:00
if ( in6_addr_is_multicast ( addr ) ) {
2016-07-09 01:22:03 +00:00
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
2017-09-01 14:02:37 +00:00
if ( pinfo - > dst . type = = AT_IPv6 & & rt - > hdr . ip6r_segleft > 0 ) {
2016-07-29 01:38:13 +00:00
alloc_address_wmem_ipv6 ( pinfo - > pool , & pinfo - > dst , addr ) ;
2016-07-09 01:22:03 +00:00
}
2017-09-01 14:02:37 +00:00
return tvb_captured_length ( tvb ) ;
2016-07-09 01:22:03 +00:00
}
2015-10-03 13:24:04 +00:00
2016-07-09 01:22:03 +00:00
/* RPL Source Routing Header (Type 3) */
2017-09-01 14:02:37 +00:00
static int
dissect_routing6_rpl ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data )
2016-07-09 01:22:03 +00:00
{
2017-09-01 14:02:37 +00:00
struct ws_rthdr * rt = ( struct ws_rthdr * ) data ;
2016-07-09 01:22:03 +00:00
proto_item * ti ;
2017-09-01 14:02:37 +00:00
int offset = 0 ;
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 ;
2017-10-26 08:50:00 +00:00
ws_in6_addr rpl_fulladdr ;
const ws_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
2017-05-05 20:37:35 +00:00
/* Must be IPv6 addresses */
if ( ( pinfo - > dst . type ! = AT_IPv6 ) | | ( pinfo - > src . type ! = AT_IPv6 ) )
2017-09-01 14:02:37 +00:00
return 0 ;
2017-05-05 20:37:35 +00:00
2016-07-09 01:22:03 +00:00
/* IPv6 destination address used for elided bytes */
2017-10-26 08:50:00 +00:00
ip6_dst_addr = ( const ws_in6_addr * ) pinfo - > dst . data ;
2016-07-09 01:22:03 +00:00
/* IPv6 source address used for strict checking */
2017-10-26 08:50:00 +00:00
ip6_src_addr = ( const ws_in6_addr * ) pinfo - > src . data ;
2016-07-09 01:22:03 +00:00
/* from RFC6554: Multicast addresses MUST NOT appear in the IPv6 Destination Address field */
2017-10-26 09:23:37 +00:00
if ( in6_addr_is_multicast ( ip6_dst_addr ) ) {
2017-09-01 14:02:37 +00:00
expert_add_info ( pinfo , proto_tree_get_parent ( tree ) , & ei_ipv6_dst_addr_not_multicast ) ;
2015-10-03 13:24:04 +00:00
}
2011-06-09 18:02:13 +00:00
2017-09-01 14:02:37 +00:00
proto_tree_add_item ( tree , hf_ipv6_routing_rpl_cmprI , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tree , hf_ipv6_routing_rpl_cmprE , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
ti = proto_tree_add_item ( 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
2017-09-01 14:02:37 +00:00
ti = proto_tree_add_item ( tree , hf_ipv6_routing_rpl_reserved , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
2016-07-09 01:22:03 +00:00
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 ;
2017-09-01 14:02:37 +00:00
if ( rt - > hdr . ip6r_len > 0 ) {
rpl_addr_count = ( ( ( rt - > hdr . ip6r_len * 8 ) - pad - ( 16 - cmprE ) ) / ( 16 - cmprI ) ) + 1 ;
2016-07-09 01:22:03 +00:00
}
2017-09-01 14:02:37 +00:00
ti = proto_tree_add_int ( tree , hf_ipv6_routing_rpl_addr_count , tvb , offset , 2 , rpl_addr_count ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( ti ) ;
2016-07-09 01:22:03 +00:00
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 ) ;
}
2017-09-01 14:02:37 +00:00
else if ( rt - > hdr . ip6r_segleft > ( guint ) rpl_addr_count ) {
expert_add_info_format ( pinfo , rt - > ti_segleft , & ei_ipv6_routing_invalid_segleft ,
2016-07-09 01:22:03 +00:00
" 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 ;
2017-09-01 14:02:37 +00:00
proto_tree_add_item ( 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 ) ;
2017-09-01 14:02:37 +00:00
ti = _proto_tree_add_ipv6_vector_address ( tree , hf_ipv6_routing_rpl_fulladdr , tvb ,
2016-06-13 03:56:57 +00:00
offset , cmprX , & rpl_fulladdr , idx ) ;
2019-04-03 21:32:30 +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 */
2017-10-26 09:23:37 +00:00
if ( in6_addr_is_multicast ( & rpl_fulladdr ) ) {
2016-07-09 01:22:03 +00:00
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
}
2017-09-01 14:02:37 +00:00
if ( pinfo - > dst . type = = AT_IPv6 & & rt - > hdr . ip6r_segleft > 0 ) {
2016-07-29 01:38:13 +00:00
alloc_address_wmem_ipv6 ( pinfo - > pool , & pinfo - > dst , & rpl_fulladdr ) ;
2012-05-15 19:11:08 +00:00
}
}
1999-10-12 23:12:06 +00:00
}
2017-09-01 14:02:37 +00:00
return tvb_captured_length ( tvb ) ;
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) */
2017-02-02 11:23:24 +00:00
/* draft-ietf-6man-segment-routing-header-05 */
2017-09-01 14:02:37 +00:00
static int
dissect_routing6_srh ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data )
2016-07-09 01:22:03 +00:00
{
2017-09-01 14:02:37 +00:00
struct ws_rthdr * rt = ( struct ws_rthdr * ) data ;
2016-07-09 01:22:03 +00:00
proto_item * ti ;
2017-09-01 14:02:37 +00:00
int offset = 0 ;
2016-07-09 01:22:03 +00:00
gint offlim , offstart ;
gint idx ;
gint srh_first_seg , srh_addr_count ;
2017-10-26 08:50:00 +00:00
const ws_in6_addr * addr ;
2016-07-09 01:22:03 +00:00
proto_tree * rthdr_srh_addr_tree ;
static const int * srh_flags [ ] = {
2017-02-02 11:23:24 +00:00
& hf_ipv6_routing_srh_flag_unused1 ,
2016-07-09 01:22:03 +00:00
& hf_ipv6_routing_srh_flag_p ,
& hf_ipv6_routing_srh_flag_o ,
& hf_ipv6_routing_srh_flag_a ,
& hf_ipv6_routing_srh_flag_h ,
2017-02-02 11:23:24 +00:00
& hf_ipv6_routing_srh_flag_unused2 ,
2016-07-09 01:22:03 +00:00
NULL
} ;
srh_first_seg = tvb_get_guint8 ( tvb , offset ) ;
2017-09-01 14:02:37 +00:00
proto_tree_add_item ( tree , hf_ipv6_routing_srh_first_seg , tvb , offset , 1 , ENC_NA ) ;
2016-07-09 01:22:03 +00:00
offset + = 1 ;
srh_addr_count = srh_first_seg + 1 ;
/* TODO: dissect TLVs */
2017-09-01 14:02:37 +00:00
ti = proto_tree_add_bitmask ( tree , tvb , offset , hf_ipv6_routing_srh_flags ,
2016-07-09 01:22:03 +00:00
ett_ipv6_routing_srh_flags , srh_flags , ENC_BIG_ENDIAN ) ;
2016-07-29 13:54:06 +00:00
expert_add_info_format ( pinfo , ti , & ei_ipv6_routing_undecoded ,
2016-07-09 01:22:03 +00:00
" Dissection for SRH TLVs not yet implemented " ) ;
offset + = 1 ;
2017-09-01 14:02:37 +00:00
proto_tree_add_item ( tree , hf_ipv6_routing_srh_reserved , tvb , offset , 2 , ENC_NA ) ;
2017-02-02 11:23:24 +00:00
offset + = 2 ;
2017-09-01 14:02:37 +00:00
if ( rt - > hdr . ip6r_segleft > srh_first_seg ) {
expert_add_info_format ( pinfo , rt - > ti_segleft , & ei_ipv6_routing_invalid_segleft ,
2016-07-09 01:22:03 +00:00
" 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 ) ;
2017-10-26 09:23:37 +00:00
if ( in6_addr_is_multicast ( addr ) ) {
2016-07-09 01:22:03 +00:00
expert_add_info ( pinfo , ti , & ei_ipv6_src_route_list_multicast_addr ) ;
}
2017-09-01 14:02:37 +00:00
ti = _proto_tree_add_ipv6_vector_address ( tree , hf_ipv6_routing_srh_addr , tvb ,
2016-07-09 01:22:03 +00:00
offset , IPv6_ADDR_SIZE , addr , 0 ) ;
2017-09-01 14:02:37 +00:00
if ( rt - > hdr . ip6r_segleft = = 1 ) {
2016-07-09 01:22:03 +00:00
proto_item_append_text ( ti , " [next segment] " ) ;
}
2017-09-01 14:02:37 +00:00
if ( pinfo - > dst . type = = AT_IPv6 & & rt - > hdr . ip6r_segleft > 0 ) {
2016-07-29 01:38:13 +00:00
alloc_address_wmem_ipv6 ( pinfo - > pool , & pinfo - > dst , addr ) ;
2016-07-09 01:22:03 +00:00
}
offset + = IPv6_ADDR_SIZE ;
for ( idx = 1 ; offset < offlim ; offset + = IPv6_ADDR_SIZE , idx + + ) {
addr = tvb_get_ptr_ipv6 ( tvb , offset ) ;
2017-10-26 09:23:37 +00:00
if ( in6_addr_is_multicast ( addr ) ) {
2016-05-28 00:55:04 +00:00
expert_add_info ( pinfo , ti , & ei_ipv6_src_route_list_multicast_addr ) ;
}
2017-09-01 14:02:37 +00:00
ti = _proto_tree_add_ipv6_vector_address ( tree , hf_ipv6_routing_srh_addr , tvb ,
2016-07-09 01:22:03 +00:00
offset , IPv6_ADDR_SIZE , addr , idx ) ;
2017-09-01 14:02:37 +00:00
if ( idx = = rt - > hdr . 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
2017-09-01 14:02:37 +00:00
rthdr_srh_addr_tree = proto_tree_add_subtree_format ( tree , tvb , offstart , srh_addr_count * IPv6_ADDR_SIZE ,
2016-07-09 01:22:03 +00:00
ett_ipv6_routing_srh_vect , & ti , " Segments in Traversal Order " ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( ti ) ;
2016-07-09 01:22:03 +00:00
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 ) ;
2017-09-01 14:02:37 +00:00
if ( idx = = rt - > hdr . ip6r_segleft - 1 ) {
2016-07-09 01:22:03 +00:00
proto_item_append_text ( ti , " [next segment] " ) ;
2016-05-28 00:55:04 +00:00
}
}
2016-07-09 01:22:03 +00:00
2017-09-01 14:02:37 +00:00
return tvb_captured_length ( tvb ) ;
2016-07-29 13:54:06 +00:00
}
2017-09-01 14:02:37 +00:00
/*
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| Next Header | Hdr Ext Len | Routing Type | Segments Left |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| |
. .
. type - specific data .
. .
| |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
2016-07-09 01:22:03 +00:00
static int
2018-11-11 21:25:21 +00:00
dissect_routing6 ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) {
2017-09-01 14:02:37 +00:00
struct ws_rthdr rt ;
guint nxt , hdr_len , total_len ;
2018-11-11 21:25:21 +00:00
proto_tree * rt_tree , * root_tree ;
2017-09-01 14:02:37 +00:00
proto_item * pi , * ti , * ti_hdr_len , * ti_type , * ti_segs ;
2016-07-09 01:22:03 +00:00
int offset = 0 ;
2016-07-17 04:02:29 +00:00
tvbuff_t * next_tvb ;
2017-09-01 14:02:37 +00:00
int type , type_len ;
dissector_handle_t type_dissector ;
2016-07-09 01:22:03 +00:00
col_append_sep_str ( pinfo - > cinfo , COL_INFO , " , " , " IPv6 routing " ) ;
2018-11-11 21:25:21 +00:00
root_tree = p_ipv6_pinfo_select_root ( pinfo , tree ) ;
2016-07-09 01:22:03 +00:00
2018-11-11 21:25:21 +00:00
pi = proto_tree_add_item ( root_tree , proto_ipv6_routing , tvb , offset , - 1 , ENC_NA ) ;
2017-09-01 14:02:37 +00:00
rt_tree = proto_item_add_subtree ( pi , ett_ipv6_routing_proto ) ;
2016-07-17 04:02:29 +00:00
2017-09-01 14:02:37 +00:00
proto_tree_add_item ( rt_tree , hf_ipv6_routing_nxt , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
nxt = tvb_get_guint8 ( tvb , offset ) ;
2016-07-09 01:22:03 +00:00
offset + = 1 ;
2017-09-01 14:02:37 +00:00
ti_hdr_len = proto_tree_add_item ( rt_tree , hf_ipv6_routing_len , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
hdr_len = tvb_get_guint8 ( tvb , offset ) ;
/*
Hdr Ext Len 8 - bit unsigned integer . Length of the Routing
header in 8 - octet units , not including the
first 8 octets .
*/
total_len = ( hdr_len + 1 ) * 8 ;
type_len = total_len - 4 ;
proto_item_set_len ( pi , total_len ) ;
ti = proto_tree_add_uint ( rt_tree , hf_ipv6_routing_len_oct , tvb , offset , 1 , total_len ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( ti ) ;
2016-07-09 01:22:03 +00:00
if ( ipv6_exthdr_hide_len_oct_field ) {
2019-04-03 21:32:30 +00:00
proto_item_set_hidden ( ti ) ;
2017-09-01 14:02:37 +00:00
proto_item_append_text ( ti_hdr_len , " (%d bytes) " , total_len ) ;
2016-07-09 01:22:03 +00:00
}
2017-09-01 14:02:37 +00:00
p_ipv6_pinfo_add_len ( pinfo , total_len ) ;
2016-07-09 01:22:03 +00:00
offset + = 1 ;
2017-09-01 14:02:37 +00:00
ti_type = proto_tree_add_item ( rt_tree , hf_ipv6_routing_type , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
type = tvb_get_guint8 ( tvb , offset ) ;
proto_item_append_text ( pi , " (%s) " , val_to_str ( type , routing_header_type , " Unknown type %u " ) ) ;
2016-07-09 01:22:03 +00:00
offset + = 1 ;
2017-09-01 14:02:37 +00:00
ti_segs = proto_tree_add_item ( rt_tree , hf_ipv6_routing_segleft , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2016-07-09 01:22:03 +00:00
offset + = 1 ;
2016-05-28 00:55:04 +00:00
2017-09-01 14:02:37 +00:00
type_dissector = dissector_get_uint_handle ( ipv6_routing_dissector_table , type ) ;
if ( type_dissector ! = NULL ) {
tvb_memcpy ( tvb , & ( rt . hdr ) , 0 , 4 ) ;
rt . ti_len = ti_hdr_len ;
rt . ti_type = ti_type ;
rt . ti_segleft = ti_segs ;
call_dissector_with_data ( type_dissector , tvb_new_subset_length ( tvb , offset , type_len ) , pinfo , rt_tree , & rt ) ;
}
else {
/* Unknown Routing Header Type */
ti = proto_tree_add_item ( rt_tree , hf_ipv6_routing_unknown_data , tvb , offset , type_len , ENC_NA ) ;
expert_add_info ( pinfo , ti , & ei_ipv6_routing_undecoded ) ;
2015-10-09 09:10:31 +00:00
}
2017-09-01 14:02:37 +00:00
p_add_ipv6_nxt ( pinfo , nxt ) ;
2016-07-25 23:18:38 +00:00
2017-09-01 14:02:37 +00:00
next_tvb = tvb_new_subset_remaining ( tvb , total_len ) ;
ipv6_dissect_next ( nxt , next_tvb , pinfo , tree , ( ws_ip6 * ) data ) ;
2016-07-17 04:02:29 +00:00
return tvb_captured_length ( tvb ) ;
1999-03-28 18:32:03 +00:00
}
static int
2016-07-17 04:02:29 +00:00
dissect_fraghdr ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) {
2016-12-16 19:57:54 +00:00
proto_item * pi , * ti ;
2016-07-17 04:02:29 +00:00
proto_tree * frag_tree , * root_tree ;
2015-09-18 01:08:34 +00:00
guint8 nxt ;
guint16 offlg ;
2016-07-17 04:02:29 +00:00
guint16 frag_off ;
gboolean frag_flg ;
guint32 frag_ident ;
2016-07-14 18:50:09 +00:00
gint offset = 0 ;
2017-08-30 14:14:29 +00:00
ipv6_pinfo_t * ipv6_pinfo ;
2016-07-17 04:02:29 +00:00
gboolean show_data = FALSE ;
gboolean reassembled ;
tvbuff_t * next_tvb ;
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 ) ;
2016-07-17 04:02:29 +00:00
frag_off = offlg & IP6F_OFF_MASK ; /* offset in bytes */
frag_flg = offlg & IP6F_MORE_FRAG ;
frag_ident = tvb_get_ntohl ( tvb , offset + 4 ) ;
2015-09-18 01:08:34 +00:00
col_add_fstr ( pinfo - > cinfo , COL_INFO , " IPv6 fragment (off=%u more=%s ident=0x%08x nxt=%u) " ,
2016-07-17 04:02:29 +00:00
frag_off , frag_flg ? " y " : " n " , frag_ident , nxt ) ;
2017-09-02 13:48:41 +00:00
root_tree = p_ipv6_pinfo_select_root ( pinfo , tree ) ;
ipv6_pinfo = p_ipv6_pinfo_add_len ( pinfo , IPv6_FRAGMENT_HDR_SIZE ) ;
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 */
2016-07-25 23:18:09 +00:00
pi = proto_tree_add_item ( root_tree , proto_ipv6_fraghdr , tvb , offset , IPv6_FRAGMENT_HDR_SIZE , ENC_NA ) ;
2016-07-25 23:18:38 +00:00
if ( ipv6_pinfo ! = NULL & & ipv6_pinfo - > jumbo_plen ! = 0 ) {
2015-10-03 13:24:04 +00:00
expert_add_info ( pinfo , pi , & ei_ipv6_opt_jumbo_fragment ) ;
}
2015-09-18 01:08:34 +00:00
2016-07-14 18:44:51 +00:00
frag_tree = proto_item_add_subtree ( pi , ett_ipv6_fraghdr_proto ) ;
2015-09-18 01:08:34 +00:00
2016-07-17 04:02:29 +00:00
proto_tree_add_item ( frag_tree , hf_ipv6_fraghdr_nxt , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
2015-09-18 01:08:34 +00:00
2016-07-17 04:02:29 +00:00
proto_tree_add_item ( frag_tree , hf_ipv6_fraghdr_reserved_octet , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
2016-12-16 19:57:54 +00:00
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 ) ;
2015-09-18 01:08:34 +00:00
2016-07-17 04:02:29 +00:00
proto_tree_add_item ( frag_tree , hf_ipv6_fraghdr_reserved_bits , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2015-09-18 01:08:34 +00:00
2016-07-17 04:02:29 +00:00
proto_tree_add_item ( frag_tree , hf_ipv6_fraghdr_more , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
2015-09-18 01:08:34 +00:00
2016-07-17 04:02:29 +00:00
proto_tree_add_item ( frag_tree , hf_ipv6_fraghdr_ident , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
offset + = 4 ;
2015-09-18 01:08:34 +00:00
2016-07-25 23:18:38 +00:00
if ( ipv6_pinfo ! = NULL & & ipv6_pinfo - > frag_plen > 0 ) {
2016-07-24 08:47:15 +00:00
if ( ( frag_off ! = 0 ) | | frag_flg ) {
2016-08-01 09:12:59 +00:00
reassembled = ipv6_reassemble_do ( & tvb , & offset , pinfo , root_tree , ipv6_pinfo - > frag_plen ,
2016-07-24 08:44:58 +00:00
frag_off , frag_flg , frag_ident , & show_data ) ;
if ( show_data ) {
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
call_data_dissector ( next_tvb , pinfo , tree ) ;
return tvb_captured_length ( tvb ) ;
}
if ( reassembled ) {
2016-07-24 18:11:01 +00:00
ipv6_pinfo - > frag_plen = 0 ;
2016-07-24 08:44:58 +00:00
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
2017-08-31 17:49:15 +00:00
ipv6_dissect_next ( nxt , next_tvb , pinfo , tree , ( ws_ip6 * ) data ) ;
2016-07-24 08:44:58 +00:00
return tvb_captured_length ( tvb ) ;
}
2016-07-17 04:02:29 +00:00
}
2016-07-24 08:44:58 +00:00
}
2016-07-24 18:11:01 +00:00
2016-07-25 23:18:38 +00:00
p_add_ipv6_nxt ( pinfo , nxt ) ;
2016-07-17 04:02:29 +00:00
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
2017-08-31 17:49:15 +00:00
ipv6_dissect_next ( nxt , next_tvb , pinfo , tree , ( ws_ip6 * ) data ) ;
2016-07-17 04:02:29 +00:00
return tvb_captured_length ( tvb ) ;
1999-03-28 18:32:03 +00:00
}
2012-06-19 20:20:18 +00:00
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 |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
2016-07-15 00:56:44 +00:00
static gint
2015-12-29 12:15:44 +00:00
dissect_opt_jumbo ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * opt_tree ,
2016-07-25 23:18:38 +00:00
struct opt_proto_item * opt_ti , guint8 opt_len )
2015-12-29 12:15:44 +00:00
{
proto_item * pi = proto_tree_get_parent ( opt_tree ) ;
proto_item * ti ;
2016-07-16 13:07:40 +00:00
guint32 jumbo_plen = 0 ;
2016-07-25 23:18:38 +00:00
ipv6_pinfo_t * ipv6_pinfo = p_get_ipv6_pinfo ( pinfo ) ;
2015-12-29 12:15:44 +00:00
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 ) ;
}
2016-07-16 13:07:40 +00:00
ti = proto_tree_add_item_ret_uint ( opt_tree , hf_ipv6_opt_jumbo , tvb , offset , 4 , ENC_BIG_ENDIAN , & jumbo_plen ) ;
2016-07-15 00:56:44 +00:00
offset + = 4 ;
2015-12-29 12:15:44 +00:00
2016-07-25 23:18:38 +00:00
if ( ipv6_pinfo ! = NULL & & ipv6_pinfo - > ip6_plen ! = 0 ) {
2015-12-29 12:15:44 +00:00
expert_add_info ( pinfo , pi , & ei_ipv6_opt_jumbo_prohibited ) ;
}
2016-07-16 17:23:23 +00:00
if ( jumbo_plen < 65536 ) {
2015-12-29 12:15:44 +00:00
expert_add_info ( pinfo , ti , & ei_ipv6_opt_jumbo_truncated ) ;
}
2016-07-16 17:23:23 +00:00
2016-07-15 00:56:44 +00:00
return offset ;
2015-12-29 12:15:44 +00:00
}
/*
* 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 ) |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
2016-07-15 00:56:44 +00:00
static gint
2015-12-29 12:15:44 +00:00
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
} ;
if ( opt_len < 4 ) {
expert_add_info_format ( pinfo , opt_ti - > len , & ei_ipv6_opt_invalid_len ,
2016-07-15 00:56:44 +00:00
" RPL Option: Invalid length (%u bytes) " , opt_len ) ;
2015-12-29 12:15:44 +00:00
}
2016-07-15 00:56:44 +00:00
proto_tree_add_bitmask ( opt_tree , tvb , offset , hf_ipv6_opt_rpl_flag , ett_ipv6_opt_rpl , rpl_flags , ENC_NA ) ;
offset + = 1 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_rpl_instance_id , tvb , offset , 1 , ENC_NA ) ;
offset + = 1 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_rpl_senderrank , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
2015-12-29 12:15:44 +00:00
/* TODO: Add dissection of sub-TLVs */
2016-07-15 00:56:44 +00:00
return offset ;
2015-12-29 12:15:44 +00:00
}
/*
* 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 |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
2016-07-15 00:56:44 +00:00
static gint
2015-12-29 12:15:44 +00:00
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 ,
2016-07-15 00:56:44 +00:00
" Tunnel Encapsulation Limit: Invalid length (%u bytes) " , opt_len ) ;
2015-12-29 12:15:44 +00:00
}
2016-07-15 00:56:44 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_opt_tel , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
return offset ;
2015-12-29 12:15:44 +00:00
}
/*
* 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
*/
2016-07-15 00:56:44 +00:00
static gint
2015-12-29 12:15:44 +00:00
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 ,
2016-07-15 00:56:44 +00:00
" Router alert: Invalid Length (%u bytes) " , opt_len ) ;
2015-12-29 12:15:44 +00:00
}
2016-07-15 00:56:44 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_opt_rtalert , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
return offset ;
2015-12-29 12:15:44 +00:00
}
2016-07-15 00:56:44 +00:00
/*
* Quick - Start Option for IPv6
*
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 | Length = 6 | Func . | Rate | Not Used |
| | | 1000 | Report | |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| QS Nonce | R |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
static gint
2015-12-29 12:15:44 +00:00
dissect_opt_quickstart ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * opt_tree ,
2017-08-31 17:49:15 +00:00
struct opt_proto_item * opt_ti , guint8 opt_len , ws_ip6 * iph )
2015-12-29 12:15:44 +00:00
{
proto_item * pi = proto_tree_get_parent ( opt_tree ) ;
proto_item * ti ;
guint8 command , function , rate ;
guint32 qs_ttl = 0 ;
if ( opt_len ! = 6 ) {
expert_add_info_format ( pinfo , opt_ti - > len , & ei_ipv6_opt_invalid_len ,
2016-07-15 00:56:44 +00:00
" Quick-Start: Invalid Length (%u bytes) " , opt_len ) ;
2015-12-29 12:15:44 +00:00
}
2016-07-15 00:56:44 +00:00
command = tvb_get_guint8 ( tvb , offset ) ;
2015-12-29 12:15:44 +00:00
function = command > > 4 ;
rate = command & QS_RATE_MASK ;
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 ) ;
2016-07-24 08:44:58 +00:00
proto_item_append_text ( pi , " , %s, QS TTL %u " ,
2015-12-29 12:15:44 +00:00
val_to_str_ext ( rate , & qs_rate_vals_ext , " Unknown (%u) " ) ,
2016-07-24 08:44:58 +00:00
qs_ttl ) ;
if ( iph ! = NULL ) {
guint8 ttl_diff ;
2017-08-31 17:49:15 +00:00
ttl_diff = ( iph - > ip6_hop - qs_ttl ) % 256 ;
2016-07-24 08:44:58 +00:00
ti = proto_tree_add_uint ( opt_tree , hf_ipv6_opt_qs_ttl_diff , tvb , offset , 1 , ttl_diff ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( ti ) ;
2016-07-24 08:44:58 +00:00
proto_item_append_text ( pi , " , QS TTL diff %u " , ttl_diff ) ;
}
2015-12-29 12:15:44 +00:00
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 ) ;
2016-07-15 00:56:44 +00:00
offset + = 4 ;
2015-12-29 12:15:44 +00:00
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 ) ;
2016-07-15 00:56:44 +00:00
offset + = 4 ;
2015-12-29 12:15:44 +00:00
break ;
default :
break ;
}
2016-07-15 00:56:44 +00:00
return offset ;
2015-12-29 12:15:44 +00:00
}
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 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 ) |
+ - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - - - - - - - - - - - +
*/
2016-07-15 00:56:44 +00:00
static gint
2015-12-29 12:15:44 +00:00
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 ,
2016-07-15 00:56:44 +00:00
" CALIPSO: Invalid Length (%u bytes) " , opt_len ) ;
2015-12-29 12:15:44 +00:00
}
proto_tree_add_item ( opt_tree , hf_ipv6_opt_calipso_doi , tvb ,
2016-07-15 00:56:44 +00:00
offset , 4 , ENC_BIG_ENDIAN ) ;
offset + = 4 ;
2015-12-29 12:15:44 +00:00
proto_tree_add_item_ret_uint ( opt_tree , hf_ipv6_opt_calipso_cmpt_length , tvb ,
2016-07-15 00:56:44 +00:00
offset , 1 , ENC_BIG_ENDIAN , & cmpt_length ) ;
offset + = 1 ;
2015-12-29 12:15:44 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_opt_calipso_sens_level , tvb ,
2016-07-15 00:56:44 +00:00
offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
2015-12-29 12:15:44 +00:00
2016-07-11 03:47:28 +00:00
proto_tree_add_checksum ( opt_tree , tvb , offset , hf_ipv6_opt_calipso_checksum , - 1 ,
NULL , pinfo , 0 , ENC_BIG_ENDIAN , PROTO_CHECKSUM_NO_FLAGS ) ;
2016-07-15 00:56:44 +00:00
offset + = 2 ;
2015-12-29 12:15:44 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_opt_calipso_cmpt_bitmap , tvb ,
2016-07-15 00:56:44 +00:00
offset , cmpt_length * 4 , ENC_NA ) ;
offset + = cmpt_length * 4 ;
return offset ;
2015-12-29 12:15:44 +00:00
}
2016-07-27 00:51:54 +00:00
/*
* IPv6 SMF_DPD Option Header
*
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
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
. . . | 0 | 0 | 0 | 01000 | Opt . Data Len |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| 0 | TidTy | TidLen | TaggerId ( optional ) . . . |
+ - + - + - + - + - + - + - + - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| | Identifier . . .
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
Figure 3 : IPv6 SMF_DPD Option Header in I - DPD mode
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
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
. . . | 0 | 0 | 0 | OptType | Opt . Data Len |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| 1 | Hash Assist Value ( HAV ) . . .
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
Figure 4 : IPv6 SMF_DPD Option Header in H - DPD Mode
*/
static gint
dissect_opt_smf_dpd ( tvbuff_t * tvb , gint offset , packet_info * pinfo _U_ , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti _U_ , guint8 opt_len )
{
guint8 hash_tid ;
guint8 tid_len ;
gint ident_len ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_smf_dpd_hash_bit , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
hash_tid = tvb_get_guint8 ( tvb , offset ) ;
if ( hash_tid & 0x80 ) {
/* H-DPD Mode */
proto_tree_add_item ( opt_tree , hf_ipv6_opt_smf_dpd_hav , tvb , offset , opt_len , ENC_NA ) ;
return offset + opt_len ;
}
/* I-DPD Mode */
proto_tree_add_item ( opt_tree , hf_ipv6_opt_smf_dpd_tid_type , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_smf_dpd_tid_len , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
ident_len = opt_len - 1 ;
if ( hash_tid & 0x70 ) {
2016-07-28 11:54:40 +00:00
tid_len = ( hash_tid & 0x0f ) + 1 ;
2016-07-27 00:51:54 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_opt_smf_dpd_tagger_id , tvb , offset , tid_len , ENC_NA ) ;
offset + = tid_len ;
ident_len - = tid_len ;
}
if ( ident_len > 0 ) {
proto_tree_add_item ( opt_tree , hf_ipv6_opt_smf_dpd_ident , tvb , offset , ident_len , ENC_NA ) ;
offset + = ident_len ;
}
return offset ;
}
2017-07-30 11:18:10 +00:00
/*
* Performance and Diagnostic Metrics Destination Option ( ietf - ippm - 6 man - pdm - option - 13 )
*
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 | ScaleDTLR | ScaleDTLS |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| PSN This Packet | PSN Last Received |
| - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
| Delta Time Last Received | Delta Time Last Sent |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
static gint
dissect_opt_pdm ( tvbuff_t * tvb , gint offset , packet_info * pinfo _U_ , proto_tree * opt_tree ,
struct opt_proto_item * opt_ti _U_ , guint8 opt_len )
{
if ( opt_len ! = 10 ) {
expert_add_info_format ( pinfo , opt_ti - > len , & ei_ipv6_opt_invalid_len ,
" PDM: Invalid length (%u bytes) " , opt_len ) ;
}
proto_tree_add_item ( opt_tree , hf_ipv6_opt_pdm_scale_dtlr , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_pdm_scale_dtls , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_pdm_psn_this_pkt , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_pdm_psn_last_recv , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_pdm_delta_last_recv , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_pdm_delta_last_sent , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
return offset ;
}
2015-12-29 12:15:44 +00:00
/*
* 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 +
| |
+ +
| |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
2016-07-15 00:56:44 +00:00
static gint
2015-12-29 12:15:44 +00:00
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 ,
2016-07-15 00:56:44 +00:00
" Home Address: Invalid length (%u bytes) " , opt_len ) ;
2015-12-29 12:15:44 +00:00
}
2016-07-29 01:38:13 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_opt_mipv6_home_address , tvb , offset , IPv6_ADDR_SIZE , ENC_NA ) ;
alloc_address_tvb_ipv6 ( pinfo - > pool , & pinfo - > src , tvb , offset ) ;
offset + = IPv6_ADDR_SIZE ;
2016-07-15 00:56:44 +00:00
return offset ;
2015-12-29 12:15:44 +00:00
}
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 /
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
2016-07-15 00:56:44 +00:00
static gint
2015-12-29 19:30:58 +00:00
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 )
{
2016-07-15 00:56:44 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_opt_ilnp_nonce , tvb , offset , opt_len , ENC_NA ) ;
offset + = opt_len ;
return offset ;
2015-12-29 19:30:58 +00:00
}
/*
* 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 . . .
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
2016-07-15 00:56:44 +00:00
static gint
dissect_opt_lio ( tvbuff_t * tvb , gint offset , packet_info * pinfo _U_ , proto_tree * opt_tree ,
2015-12-29 19:30:58 +00:00
struct opt_proto_item * opt_ti _U_ , guint8 opt_len )
{
2016-07-20 02:06:09 +00:00
guint32 lid_len = 0 ;
2015-12-29 19:30:58 +00:00
2016-07-20 02:06:09 +00:00
proto_tree_add_item_ret_uint ( opt_tree , hf_ipv6_opt_lio_len , tvb , offset , 1 , ENC_BIG_ENDIAN , & lid_len ) ;
2016-07-15 00:56:44 +00:00
offset + = 1 ;
2015-12-29 19:30:58 +00:00
2016-07-20 02:06:09 +00:00
if ( lid_len + 1 > opt_len ) {
/* XXX Add expert info */
lid_len = opt_len - 1 ;
}
proto_tree_add_item ( opt_tree , hf_ipv6_opt_lio_id , tvb , offset , lid_len , ENC_BIG_ENDIAN | ENC_ASCII ) ;
offset + = lid_len ;
2016-07-15 00:56:44 +00:00
return offset ;
2015-12-29 19:30:58 +00:00
}
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 ) |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
2016-07-15 00:56:44 +00:00
static gint
2015-12-29 12:15:44 +00:00
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 ;
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 ) ;
2016-07-15 00:56:44 +00:00
offset + = seed_id_len ;
2015-12-29 12:15:44 +00:00
}
2019-03-26 20:41:04 +00:00
else {
expert_add_info ( pinfo , opt_ti - > type , & ei_ipv6_opt_mpl_ipv6_src_seed_id ) ;
}
2016-07-15 00:56:44 +00:00
return offset ;
2015-12-29 12:15:44 +00:00
}
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 |
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
*/
2016-07-15 00:56:44 +00:00
static gint
2015-12-29 19:30:58 +00:00
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
} ;
2016-07-15 15:33:14 +00:00
/* Option length is 3 octets */
2015-12-29 19:30:58 +00:00
/* 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 ,
2016-07-15 00:56:44 +00:00
" IPv6 DFF: Invalid length (%u bytes) " , opt_len ) ;
2015-12-29 19:30:58 +00:00
}
2016-07-15 00:56:44 +00:00
proto_tree_add_bitmask ( opt_tree , tvb , offset , hf_ipv6_opt_dff_flags ,
2015-12-29 19:30:58 +00:00
ett_ipv6_opt_dff_flags , dff_flags , ENC_NA ) ;
2016-07-15 00:56:44 +00:00
offset + = 1 ;
proto_tree_add_item ( opt_tree , hf_ipv6_opt_dff_seqnum , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset + = 2 ;
return offset ;
2015-12-29 19:30:58 +00:00
}
2016-07-15 00:56:44 +00:00
static gint
2015-12-29 19:30:58 +00:00
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 ,
2016-07-15 00:56:44 +00:00
offset , opt_len , ENC_NA ) ;
2015-12-29 19:30:58 +00:00
expert_add_info ( pinfo , ti , & ei_ipv6_opt_unknown_data ) ;
2016-07-15 00:56:44 +00:00
return offset + opt_len ;
2015-12-29 19:30:58 +00:00
}
2001-06-26 17:31:36 +00:00
static int
2017-08-31 17:49:15 +00:00
dissect_opts ( tvbuff_t * tvb , int offset , proto_tree * tree , packet_info * pinfo , ws_ip6 * iph , const int exthdr_proto )
2001-06-26 17:31:36 +00:00
{
2015-12-29 12:15:44 +00:00
gint len , offset_end ;
2016-07-17 04:02:29 +00:00
guint8 nxt ;
proto_tree * exthdr_tree , * opt_tree , * opt_type_tree , * root_tree ;
2015-12-29 12:15:44 +00:00
proto_item * pi , * ti , * ti_len ;
int hf_exthdr_item_nxt , hf_exthdr_item_len , hf_exthdr_item_len_oct ;
2016-07-14 18:44:51 +00:00
int ett_exthdr_proto ;
2016-07-15 00:56:44 +00:00
guint8 opt_type , opt_len , opt_start ;
2016-07-26 23:04:58 +00:00
gint opt_hdr_type ;
const gchar * opt_name ;
2015-12-29 12:15:44 +00:00
gboolean hopopts ;
struct opt_proto_item opt_ti ;
2016-07-17 04:02:29 +00:00
tvbuff_t * next_tvb ;
2015-08-09 22:13:06 +00:00
2015-09-30 14:30:33 +00:00
hopopts = ( exthdr_proto = = proto_ipv6_hopopts ) ;
1999-03-28 18:32:03 +00:00
2016-07-17 04:02:29 +00:00
nxt = tvb_get_guint8 ( tvb , offset ) ;
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
2017-09-02 13:48:41 +00:00
root_tree = p_ipv6_pinfo_select_root ( pinfo , tree ) ;
p_ipv6_pinfo_add_len ( pinfo , len ) ;
2016-07-17 04:02:29 +00:00
2015-10-09 07:22:29 +00:00
/* !!! specify length */
2016-07-17 04:02:29 +00:00
ti = proto_tree_add_item ( root_tree , exthdr_proto , tvb , offset , len , ENC_NA ) ;
2011-12-21 14:18:28 +00:00
2016-07-14 16:42:34 +00:00
if ( hopopts & & ipv6_previous_layer_id ( pinfo ) ! = proto_ipv6 ) {
2015-10-09 07:22:29 +00:00
/* 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-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 ;
2016-07-14 18:44:51 +00:00
ett_exthdr_proto = ett_ipv6_hopopts_proto ;
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 ;
2016-07-14 18:44:51 +00:00
ett_exthdr_proto = ett_ipv6_dstopts_proto ;
2015-10-09 07:22:29 +00:00
} else {
DISSECTOR_ASSERT_NOT_REACHED ( ) ;
}
2015-09-11 08:06:49 +00:00
2016-07-14 18:44:51 +00:00
exthdr_tree = proto_item_add_subtree ( ti , ett_exthdr_proto ) ;
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 ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( ti ) ;
2016-06-01 16:40:33 +00:00
if ( ipv6_exthdr_hide_len_oct_field ) {
2019-04-03 21:32:30 +00:00
proto_item_set_hidden ( ti ) ;
2016-06-01 16:40:33 +00:00
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 ) ;
2016-07-26 23:04:58 +00:00
opt_name = val_to_str_ext ( opt_type , & ipv6_opt_type_vals_ext , " Unknown IPv6 Option (%u) " ) ;
2016-07-20 03:11:07 +00:00
2015-12-29 12:15:44 +00:00
pi = proto_tree_add_none_format ( exthdr_tree , hf_ipv6_opt , tvb , offset , 2 + opt_len ,
2016-07-26 23:04:58 +00:00
" %s " , opt_name ) ;
2015-12-29 12:15:44 +00:00
opt_tree = proto_item_add_subtree ( pi , ett_ipv6_opt ) ;
2016-07-20 03:11:07 +00:00
2015-12-29 12:15:44 +00:00
opt_ti . type = proto_tree_add_item ( opt_tree , hf_ipv6_opt_type , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
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 ;
}
2016-07-20 03:11:07 +00:00
2016-07-26 23:04:58 +00:00
if ( ( opt_hdr_type = ipv6_opt_type_hdr ( opt_type ) ) ! = IPv6_OPT_HDR_ANY ) {
if ( hopopts & & ( opt_hdr_type = = IPv6_OPT_HDR_DST ) ) {
expert_add_info_format ( pinfo , opt_ti . type , & ei_ipv6_opt_header_mismatch ,
" %s must use a destination options header " , opt_name ) ;
}
else if ( ! hopopts & & ( opt_hdr_type = = IPv6_OPT_HDR_HBH ) ) {
expert_add_info_format ( pinfo , opt_ti . type , & ei_ipv6_opt_header_mismatch ,
" %s must use a hop-by-hop options header " , opt_name ) ;
}
}
2016-07-20 03:11:07 +00:00
opt_type_tree = proto_item_add_subtree ( opt_ti . type , ett_ipv6_opt_type ) ;
proto_tree_add_item ( opt_type_tree , hf_ipv6_opt_type_action , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( opt_type_tree , hf_ipv6_opt_type_change , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( opt_type_tree , hf_ipv6_opt_type_rest , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
2016-07-15 00:56:44 +00:00
offset + = 1 ;
2012-03-12 23:13:03 +00:00
2016-07-15 00:56:44 +00:00
opt_ti . len = proto_tree_add_item ( opt_tree , hf_ipv6_opt_length , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset + = 1 ;
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 . "
*/
2016-07-15 00:56:44 +00:00
proto_tree_add_item ( opt_tree , hf_ipv6_opt_padn , tvb , offset , opt_len , ENC_NA ) ;
offset + = opt_len ;
2015-12-29 12:15:44 +00:00
continue ;
}
2016-07-15 00:56:44 +00:00
opt_start = offset ;
2015-12-29 12:15:44 +00:00
switch ( opt_type ) {
case IP6OPT_JUMBO :
2016-07-25 23:18:38 +00:00
offset = dissect_opt_jumbo ( 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_RPL :
2016-07-15 00:56:44 +00:00
offset = 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 :
2016-07-15 00:56:44 +00:00
offset = dissect_opt_tel ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-10-09 07:22:29 +00:00
break ;
case IP6OPT_RTALERT :
2016-07-15 00:56:44 +00:00
offset = 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 :
2016-07-24 08:44:58 +00:00
offset = dissect_opt_quickstart ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len , iph ) ;
2015-10-09 07:22:29 +00:00
break ;
case IP6OPT_CALIPSO :
2016-07-15 00:56:44 +00:00
offset = dissect_opt_calipso ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-12-29 12:15:44 +00:00
break ;
2015-12-29 19:30:58 +00:00
case IP6OPT_SMF_DPD :
2016-07-27 00:51:54 +00:00
offset = dissect_opt_smf_dpd ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-12-29 19:30:58 +00:00
break ;
2017-07-30 11:18:10 +00:00
case IP6OPT_PDM :
offset = dissect_opt_pdm ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
break ;
2015-12-29 12:15:44 +00:00
case IP6OPT_HOME_ADDRESS :
2016-07-15 00:56:44 +00:00
offset = 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 :
2016-07-15 00:56:44 +00:00
offset = dissect_opt_ilnp_nonce ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-12-29 19:30:58 +00:00
break ;
case IP6OPT_LIO :
2016-07-15 00:56:44 +00:00
offset = dissect_opt_lio ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-12-29 19:30:58 +00:00
break ;
2015-10-09 07:22:29 +00:00
case IP6OPT_MPL :
2016-07-15 00:56:44 +00:00
offset = dissect_opt_mpl ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-12-29 12:15:44 +00:00
break ;
2015-12-29 19:30:58 +00:00
case IP6OPT_IP_DFF :
2016-07-15 00:56:44 +00:00
offset = dissect_opt_dff ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
2015-12-29 19:30:58 +00:00
break ;
2016-07-29 14:12:01 +00:00
case IP6OPT_ENDI :
offset = dissect_opt_unknown ( tvb , offset , pinfo , opt_tree , & opt_ti , opt_len ) ;
expert_add_info ( pinfo , opt_ti . type , & ei_ipv6_opt_deprecated ) ;
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 ,
2016-07-15 00:56:44 +00:00
offset , opt_len , ENC_NA ) ;
offset + = opt_len ;
2013-12-12 20:39:11 +00:00
break ;
2015-10-09 07:22:29 +00:00
default :
2016-07-15 00:56:44 +00:00
offset = 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
}
2016-07-15 00:56:44 +00:00
if ( offset < opt_start + opt_len ) {
ti = proto_tree_add_item ( opt_tree , hf_ipv6_opt_unknown_data , tvb ,
offset , opt_start + opt_len - offset , ENC_NA ) ;
expert_add_info ( pinfo , ti , & ei_ipv6_opt_unknown_data ) ;
offset = opt_start + opt_len ;
}
2001-06-26 17:31:36 +00:00
}
2015-10-09 07:22:29 +00:00
2016-07-25 23:18:38 +00:00
p_add_ipv6_nxt ( pinfo , nxt ) ;
2016-07-17 04:02:29 +00:00
next_tvb = tvb_new_subset_remaining ( tvb , len ) ;
2016-07-24 07:59:06 +00:00
ipv6_dissect_next ( nxt , next_tvb , pinfo , tree , iph ) ;
2016-07-17 04:02:29 +00:00
return tvb_captured_length ( tvb ) ;
1999-03-28 18:32:03 +00:00
}
1999-10-12 23:12:06 +00:00
static int
2016-07-16 17:23:23 +00:00
dissect_hopopts ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data )
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 " ) ;
2017-08-31 17:49:15 +00:00
return dissect_opts ( tvb , 0 , tree , pinfo , ( ws_ip6 * ) data , proto_ipv6_hopopts ) ;
1999-10-12 23:12:06 +00:00
}
static int
2016-07-17 04:02:29 +00:00
dissect_dstopts ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data )
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 " ) ;
2017-08-31 17:49:15 +00:00
return dissect_opts ( tvb , 0 , tree , pinfo , ( ws_ip6 * ) data , proto_ipv6_dstopts ) ;
1999-10-12 23:12:06 +00:00
}
1998-09-16 02:39:15 +00:00
2016-07-22 22:24:13 +00:00
/* return value is > G_MAXUINT16, else zero */
/* tvb + offset contains the Hbh header */
static guint32
ipv6_get_jumbo_plen ( tvbuff_t * tvb , gint offset )
2016-07-16 13:07:40 +00:00
{
2016-07-22 22:24:13 +00:00
gint offset_end , hdr_len ;
gint opt_type , opt_len ;
2016-07-16 13:07:40 +00:00
guint32 jumbo_plen ;
2016-07-22 22:24:13 +00:00
if ( ! tvb_bytes_exist ( tvb , offset , 2 ) ) {
return 0 ;
}
hdr_len = ( tvb_get_guint8 ( tvb , offset + 1 ) + 1 ) * 8 ;
offset_end = offset + hdr_len ;
2016-07-16 13:07:40 +00:00
offset + = 2 ;
while ( offset < offset_end & & tvb_bytes_exist ( tvb , offset , 6 ) ) {
opt_type = tvb_get_guint8 ( tvb , offset ) ;
offset + = 1 ;
if ( opt_type = = IP6OPT_PAD1 ) {
continue ;
}
opt_len = tvb_get_guint8 ( tvb , offset ) ;
offset + = 1 ;
if ( opt_type = = IP6OPT_JUMBO & & opt_len = = 4 ) {
jumbo_plen = tvb_get_guint32 ( tvb , offset , ENC_BIG_ENDIAN ) ;
if ( jumbo_plen > G_MAXUINT16 ) {
2016-07-22 22:24:13 +00:00
return jumbo_plen ;
2016-07-16 13:07:40 +00:00
}
2016-07-22 22:24:13 +00:00
return 0 ;
2016-07-16 13:07:40 +00:00
}
offset + = opt_len ;
}
2016-07-22 22:24:13 +00:00
return 0 ;
2016-07-16 13:07:40 +00:00
}
2016-10-23 08:51:16 +00:00
static void
add_ipv6_address ( proto_tree * tree , tvbuff_t * tvb , int offset ,
gint hf_addr , gint hf_host )
{
address addr ;
const char * name ;
proto_item * ti ;
proto_tree_add_item ( tree , hf_addr , tvb , offset , IPv6_ADDR_SIZE , ENC_NA ) ;
ti = proto_tree_add_item ( tree , hf_ipv6_addr , tvb , offset , IPv6_ADDR_SIZE , ENC_NA ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_hidden ( ti ) ;
2016-10-23 08:51:16 +00:00
set_address_ipv6_tvb ( & addr , tvb , offset ) ;
name = address_to_display ( wmem_packet_scope ( ) , & addr ) ;
ti = proto_tree_add_string ( tree , hf_host , tvb , offset , IPv6_ADDR_SIZE , name ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( ti ) ;
proto_item_set_hidden ( ti ) ;
2016-10-23 08:51:16 +00:00
ti = proto_tree_add_string ( tree , hf_ipv6_host , tvb , offset , IPv6_ADDR_SIZE , name ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( ti ) ;
proto_item_set_hidden ( ti ) ;
2016-10-23 08:51:16 +00:00
}
# define ADDRESS_SET_GENERATED_HIDDEN(ti) \
G_STMT_START { \
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( ti ) ; \
if ( i > 0 ) proto_item_set_hidden ( ti ) ; \
2016-10-23 08:51:16 +00:00
} G_STMT_END
/* RFC 3056 section 2 */
static void
add_ipv6_address_6to4 ( proto_tree * tree , tvbuff_t * tvb , int offset ,
gint hf_gateway , gint hf_sla_id )
{
if ( tvb_get_ntohs ( tvb , offset ) ! = 0x2002 )
return ;
struct { gint gateway , sla_id ; } hf [ 2 ] = {
{ hf_gateway , hf_sla_id } ,
{ hf_ipv6_6to4_gateway_ipv4 , hf_ipv6_6to4_sla_id }
} ;
proto_item * ti ;
for ( int i = 0 ; i < 2 ; i + + ) {
ti = proto_tree_add_item ( tree , hf [ i ] . gateway , tvb , offset + 2 , 4 , ENC_BIG_ENDIAN ) ;
ADDRESS_SET_GENERATED_HIDDEN ( ti ) ;
ti = proto_tree_add_item ( tree , hf [ i ] . sla_id , tvb , offset + 6 , 2 , ENC_BIG_ENDIAN ) ;
ADDRESS_SET_GENERATED_HIDDEN ( ti ) ;
}
}
/* RFC 4380 section 4 */
static void
add_ipv6_address_teredo ( proto_tree * tree , tvbuff_t * tvb , int offset ,
gint hf_server , gint hf_port , gint hf_client )
{
if ( tvb_get_ntohl ( tvb , offset ) ! = 0x20010000 )
return ;
guint16 mapped_port = tvb_get_ntohs ( tvb , offset + 10 ) ^ 0xffff ;
guint32 client_v4 = tvb_get_ipv4 ( tvb , offset + 12 ) ^ 0xffffffff ;
struct { gint server , port , client ; } hf [ 2 ] = {
{ hf_server , hf_port , hf_client } ,
{ hf_ipv6_teredo_server_ipv4 , hf_ipv6_teredo_port , hf_ipv6_teredo_client_ipv4 }
} ;
proto_item * ti ;
for ( int i = 0 ; i < 2 ; i + + ) {
ti = proto_tree_add_item ( tree , hf [ i ] . server , tvb , offset + 4 , 4 , ENC_BIG_ENDIAN ) ;
ADDRESS_SET_GENERATED_HIDDEN ( ti ) ;
ti = proto_tree_add_uint ( tree , hf [ i ] . port , tvb , offset + 10 , 2 , mapped_port ) ;
ADDRESS_SET_GENERATED_HIDDEN ( ti ) ;
ti = proto_tree_add_ipv4 ( tree , hf [ i ] . client , tvb , offset + 12 , 4 , client_v4 ) ;
ADDRESS_SET_GENERATED_HIDDEN ( ti ) ;
}
}
/* RFC 4291 appendix A */
static void
add_ipv6_address_slaac ( proto_tree * tree , tvbuff_t * tvb , int offset , gint hf_slaac )
{
if ( ! ( tvb_get_guint8 ( tvb , offset + 8 ) & 0x02 ) | |
! ( tvb_get_ntohs ( tvb , offset + 11 ) = = 0xfffe ) ) {
return ;
}
guint8 * mac_addr = ( guint8 * ) wmem_alloc ( wmem_packet_scope ( ) , 6 ) ;
tvb_memcpy ( tvb , mac_addr , offset + 8 , 3 ) ;
tvb_memcpy ( tvb , mac_addr + 3 , offset + 13 , 3 ) ;
mac_addr [ 0 ] & = ~ 0x02 ;
struct { gint mac ; } hf [ 2 ] = {
{ hf_slaac } ,
{ hf_ipv6_sa_mac }
} ;
proto_item * ti ;
for ( int i = 0 ; i < 2 ; i + + ) {
2018-02-12 20:00:12 +00:00
ti = proto_tree_add_ether ( tree , hf [ i ] . mac , tvb , offset + 8 , 8 , mac_addr ) ;
2016-10-23 08:51:16 +00:00
ADDRESS_SET_GENERATED_HIDDEN ( ti ) ;
}
}
/* RFC 5214 section 6.1 */
static void
add_ipv6_address_isatap ( proto_tree * tree , tvbuff_t * tvb , int offset , gint hf_isatap )
{
if ( ( tvb_get_ntohl ( tvb , offset + 8 ) & 0xfcffffff ) ! = 0x00005efe )
return ;
struct { gint ipv4 ; } hf [ 2 ] = {
{ hf_isatap } ,
{ hf_ipv6_isatap_ipv4 }
} ;
proto_item * ti ;
for ( int i = 0 ; i < 2 ; i + + ) {
ti = proto_tree_add_item ( tree , hf [ i ] . ipv4 , tvb , offset + 12 , 4 , ENC_BIG_ENDIAN ) ;
ADDRESS_SET_GENERATED_HIDDEN ( ti ) ;
}
}
/* RFC 6052 */
static void
add_ipv6_address_embed_ipv4 ( proto_tree * tree , tvbuff_t * tvb , int offset , gint hf_embed )
{
/* Well-Known Prefix for IPv4-Embedded IPv6 Address: 64:FF9B::/96 */
static const guint8 ipv6_embedded_ipv4_well_known_prefix [ ] = {
0x00 , 0x64 , 0xFF , 0x9B ,
0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00
} ;
/* Check for well-known prefix */
if ( tvb_memeql ( tvb , offset , ipv6_embedded_ipv4_well_known_prefix , 12 ) ! = 0 )
return ;
struct { gint embed ; } hf [ 2 ] = {
{ hf_embed } ,
{ hf_ipv6_embed_ipv4 }
} ;
proto_item * ti ;
for ( int i = 0 ; i < 2 ; i + + ) {
ti = proto_tree_add_item ( tree , hf [ i ] . embed , tvb , offset + 12 , 4 , ENC_NA ) ;
ADDRESS_SET_GENERATED_HIDDEN ( ti ) ;
}
}
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
{
2016-07-17 04:02:29 +00:00
proto_tree * ipv6_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 ;
2016-07-25 03:25:05 +00:00
guint8 ip6_tcls , ip6_nxt , ip6_hlim ;
guint32 ip6_flow ;
2017-10-26 08:50:00 +00:00
const ws_in6_addr * ip6_src , * ip6_dst ;
2018-08-29 02:55:02 +00:00
guint32 ip6_plen = 0 , jumbo_plen = 0 ;
2016-07-25 03:25:05 +00:00
guint32 plen ;
2013-12-12 20:39:11 +00:00
int offset ;
2016-07-16 13:07:40 +00:00
guint reported_plen ;
2016-07-17 04:02:29 +00:00
tvbuff_t * next_tvb ;
2015-09-18 01:08:34 +00:00
gboolean save_fragmented ;
2016-07-23 00:10:33 +00:00
int version ;
2017-08-31 17:49:15 +00:00
ws_ip6 * iph ;
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 ) ;
2016-07-16 17:23:23 +00:00
2016-07-17 04:02:29 +00:00
ipv6_item = proto_tree_add_item ( tree , proto_ipv6 , tvb , offset , IPv6_HDR_SIZE , ENC_NA ) ;
2016-07-14 18:44:51 +00:00
ipv6_tree = proto_item_add_subtree ( ipv6_item , ett_ipv6_proto ) ;
2013-12-12 20:39:11 +00:00
2016-07-16 17:23:23 +00:00
/* Validate IP version (6) */
2016-07-31 15:56:01 +00:00
version = tvb_get_bits8 ( tvb , ( offset + IP6H_CTL_VFC ) * 8 , 4 ) ;
2015-09-10 17:55:57 +00:00
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] " ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_hidden ( pi ) ;
2015-09-10 17:55:57 +00:00
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
}
2016-07-16 17:23:23 +00:00
/* Validate header size (40 bytes) */
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_format ( pinfo , ipv6_item , & ei_ipv6_invalid_header ,
" IPv6 header must be exactly 40 bytes " ) ;
}
2013-12-12 20:39:11 +00:00
2016-07-16 17:23:23 +00:00
/* !!! warning: (4-bit) version, (6-bit) DSCP, (2-bit) ECN and (20-bit) Flow */
ti = proto_tree_add_item ( ipv6_tree , hf_ipv6_tclass , tvb ,
2016-07-25 03:25:05 +00:00
offset + IP6H_CTL_VFC , 4 , ENC_BIG_ENDIAN ) ;
2016-07-31 15:56:01 +00:00
ip6_tcls = tvb_get_bits8 ( tvb , ( offset + IP6H_CTL_VFC ) * 8 + 4 , 8 ) ;
2016-07-16 17:23:23 +00:00
proto_item_append_text ( ti , " (DSCP: %s, ECN: %s) " ,
2016-07-25 03:25:05 +00:00
val_to_str_ext_const ( IPDSFIELD_DSCP ( ip6_tcls ) , & dscp_short_vals_ext , " Unknown " ) ,
val_to_str_ext_const ( IPDSFIELD_ECN ( ip6_tcls ) , & ecn_short_vals_ext , " Unknown " ) ) ;
2013-12-12 20:39:11 +00:00
2016-07-16 17:23:23 +00:00
pt = proto_item_add_subtree ( ti , ett_ipv6_traffic_class ) ;
proto_tree_add_item ( pt , hf_ipv6_tclass_dscp , tvb ,
2016-07-25 03:25:05 +00:00
offset + IP6H_CTL_VFC , 4 , ENC_BIG_ENDIAN ) ;
2016-07-16 17:23:23 +00:00
proto_tree_add_item ( pt , hf_ipv6_tclass_ecn , tvb ,
2016-07-25 03:25:05 +00:00
offset + IP6H_CTL_VFC , 4 , ENC_BIG_ENDIAN ) ;
2015-08-09 22:13:06 +00:00
2016-07-16 17:23:23 +00:00
/* Set DSCP column */
col_add_str ( pinfo - > cinfo , COL_DSCP_VALUE ,
2016-07-25 03:25:05 +00:00
val_to_str_ext ( IPDSFIELD_DSCP ( ip6_tcls ) , & dscp_short_vals_ext , " %u " ) ) ;
2013-12-12 20:39:11 +00:00
2016-07-25 03:25:05 +00:00
proto_tree_add_item_ret_uint ( ipv6_tree , hf_ipv6_flow , tvb ,
offset + IP6H_CTL_FLOW , 4 , ENC_BIG_ENDIAN , & ip6_flow ) ;
2013-12-12 20:39:11 +00:00
2018-08-29 02:55:02 +00:00
ip6_plen = tvb_get_guint16 ( tvb , offset + IP6H_CTL_PLEN , ENC_BIG_ENDIAN ) ;
2017-12-17 17:40:17 +00:00
ip6_nxt = tvb_get_guint8 ( tvb , offset + IP6H_CTL_NXT ) ;
2018-08-29 02:55:02 +00:00
if ( ipv6_tso_supported & & ip6_plen = = 0 & &
2018-08-29 21:00:44 +00:00
ip6_nxt ! = IP_PROTO_HOPOPTS & & ip6_nxt ! = IP_PROTO_NONE ) {
2018-08-29 02:55:02 +00:00
ip6_plen = tvb_reported_length ( tvb ) - IPv6_HDR_SIZE ;
2018-08-29 21:00:44 +00:00
pi = proto_tree_add_uint_format_value ( ipv6_tree , hf_ipv6_plen , tvb ,
2018-08-29 02:55:02 +00:00
offset + IP6H_CTL_PLEN , 2 , ip6_plen ,
2018-08-29 21:00:44 +00:00
" %u bytes (reported as 0, presumed to be because "
" of \" TCP segmentation offload \" (TSO)) " ,
2018-08-29 02:55:02 +00:00
ip6_plen ) ;
2019-04-03 21:32:30 +00:00
proto_item_set_generated ( pi ) ;
2017-12-17 17:40:17 +00:00
} else {
2018-08-29 21:00:44 +00:00
ti_ipv6_plen = proto_tree_add_item ( ipv6_tree , hf_ipv6_plen , tvb ,
2017-12-17 17:40:17 +00:00
offset + IP6H_CTL_PLEN , 2 , ENC_BIG_ENDIAN ) ;
2018-08-29 02:55:02 +00:00
if ( ip6_plen = = 0 & & ip6_nxt ! = IP_PROTO_HOPOPTS & & ip6_nxt ! = IP_PROTO_NONE ) {
2018-08-29 21:00:44 +00:00
expert_add_info ( pinfo , ti_ipv6_plen , & ei_ipv6_plen_zero ) ;
}
2017-12-17 17:40:17 +00:00
}
2016-07-16 17:23:23 +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
2016-07-16 17:23:23 +00:00
proto_tree_add_item ( ipv6_tree , hf_ipv6_hlim , tvb ,
offset + IP6H_CTL_HLIM , 1 , ENC_BIG_ENDIAN ) ;
2016-07-25 03:25:05 +00:00
ip6_hlim = tvb_get_guint8 ( tvb , offset + IP6H_CTL_HLIM ) ;
2013-12-12 20:39:11 +00:00
2016-10-23 08:51:16 +00:00
/* Source address */
add_ipv6_address ( ipv6_tree , tvb , offset + IP6H_SRC , hf_ipv6_src , hf_ipv6_src_host ) ;
2016-07-25 03:25:05 +00:00
ip6_src = tvb_get_ptr_ipv6 ( tvb , offset + IP6H_SRC ) ;
2016-07-29 01:38:13 +00:00
alloc_address_wmem_ipv6 ( pinfo - > pool , & pinfo - > net_src , ip6_src ) ;
2016-07-25 03:25:05 +00:00
copy_address_shallow ( & pinfo - > src , & pinfo - > net_src ) ;
2016-10-23 08:51:16 +00:00
/* Destination address */
add_ipv6_address ( ipv6_tree , tvb , offset + IP6H_DST , hf_ipv6_dst , hf_ipv6_dst_host ) ;
ip6_dst = tvb_get_ptr_ipv6 ( tvb , offset + IP6H_DST ) ;
2016-07-29 01:38:13 +00:00
alloc_address_wmem_ipv6 ( pinfo - > pool , & pinfo - > net_dst , ip6_dst ) ;
2016-07-25 03:25:05 +00:00
copy_address_shallow ( & pinfo - > dst , & pinfo - > net_dst ) ;
if ( tree ) {
2013-12-12 20:39:11 +00:00
if ( ipv6_summary_in_tree ) {
2016-07-25 03:25:05 +00:00
proto_item_append_text ( ipv6_item , " , Src: %s, Dst: %s " ,
address_with_resolution_to_str ( wmem_packet_scope ( ) , & pinfo - > src ) ,
address_with_resolution_to_str ( wmem_packet_scope ( ) , & pinfo - > dst ) ) ;
2013-12-12 20:39:11 +00:00
}
2016-07-16 17:23:23 +00:00
2016-10-23 08:51:16 +00:00
/* Add the different items for the address */
add_ipv6_address_6to4 ( ipv6_tree , tvb , offset + IP6H_SRC ,
hf_ipv6_src_6to4_gateway_ipv4 , hf_ipv6_src_6to4_sla_id ) ;
add_ipv6_address_6to4 ( ipv6_tree , tvb , offset + IP6H_DST ,
hf_ipv6_dst_6to4_gateway_ipv4 , hf_ipv6_dst_6to4_sla_id ) ;
2007-03-30 14:43:55 +00:00
2016-10-23 08:51:16 +00:00
add_ipv6_address_teredo ( ipv6_tree , tvb , offset + IP6H_SRC ,
hf_ipv6_src_teredo_server_ipv4 , hf_ipv6_src_teredo_port , hf_ipv6_src_teredo_client_ipv4 ) ;
add_ipv6_address_teredo ( ipv6_tree , tvb , offset + IP6H_DST ,
hf_ipv6_dst_teredo_server_ipv4 , hf_ipv6_dst_teredo_port , hf_ipv6_dst_teredo_client_ipv4 ) ;
2013-12-12 20:39:11 +00:00
2016-10-23 08:51:16 +00:00
add_ipv6_address_slaac ( ipv6_tree , tvb , offset + IP6H_SRC , hf_ipv6_src_sa_mac ) ;
add_ipv6_address_slaac ( ipv6_tree , tvb , offset + IP6H_DST , hf_ipv6_dst_sa_mac ) ;
2013-12-12 20:39:11 +00:00
2016-10-23 08:51:16 +00:00
add_ipv6_address_isatap ( ipv6_tree , tvb , offset + IP6H_SRC , hf_ipv6_src_isatap_ipv4 ) ;
add_ipv6_address_isatap ( ipv6_tree , tvb , offset + IP6H_DST , hf_ipv6_dst_isatap_ipv4 ) ;
2013-12-12 20:39:11 +00:00
2016-10-23 08:51:16 +00:00
add_ipv6_address_embed_ipv4 ( ipv6_tree , tvb , offset + IP6H_SRC , hf_ipv6_src_embed_ipv4 ) ;
add_ipv6_address_embed_ipv4 ( ipv6_tree , tvb , offset + IP6H_DST , hf_ipv6_dst_embed_ipv4 ) ;
1998-09-16 02:39:15 +00:00
2018-02-09 01:20:26 +00:00
if ( ipv6_use_geoip ) {
add_geoip_info ( ipv6_tree , tvb , offset , ip6_src , ip6_dst ) ;
}
2013-12-12 20:39:11 +00:00
}
2015-12-29 12:15:44 +00:00
2016-07-25 03:25:05 +00:00
/* Increment offset to point to next header (may be an extension header) */
2016-07-17 14:04:52 +00:00
offset + = IPv6_HDR_SIZE ;
2015-08-09 22:13:06 +00:00
2016-07-16 13:07:40 +00:00
/* Check for Jumbo option */
2018-08-29 02:55:02 +00:00
plen = ip6_plen ;
2016-07-25 03:25:05 +00:00
if ( plen = = 0 & & ip6_nxt = = IP_PROTO_HOPOPTS ) {
2018-08-29 02:55:02 +00:00
jumbo_plen = ipv6_get_jumbo_plen ( tvb , offset ) ;
if ( jumbo_plen ! = 0 ) {
2016-07-16 13:07:40 +00:00
proto_item_append_text ( ti_ipv6_plen , " (Jumbogram) " ) ;
2018-08-29 02:55:02 +00:00
plen = jumbo_plen ;
2016-07-16 13:07:40 +00:00
} else {
/* IPv6 length zero is invalid if there is a hop-by-hop header without jumbo option */
col_add_fstr ( pinfo - > cinfo , COL_INFO , " Invalid IPv6 payload length " ) ;
expert_add_info ( pinfo , ti_ipv6_plen , & ei_ipv6_opt_jumbo_missing ) ;
2015-08-09 22:13:06 +00:00
}
}
2016-07-16 17:23:23 +00:00
2016-07-16 13:07:40 +00:00
reported_plen = tvb_reported_length ( tvb ) - IPv6_HDR_SIZE ;
2016-07-25 03:25:05 +00:00
if ( ! pinfo - > flags . in_error_pkt & & plen > reported_plen ) {
2016-07-16 13:07:40 +00:00
expert_add_info_format ( pinfo , ti_ipv6_plen , & ei_ipv6_plen_exceeds_framing ,
" IPv6 payload length exceeds framing length (%d bytes) " , reported_plen ) ;
2015-08-21 08:33:17 +00:00
}
2016-07-16 13:07:40 +00:00
2016-07-25 03:25:05 +00:00
/* Fill in IP header fields for subdissectors */
2017-08-31 17:49:15 +00:00
iph = wmem_new0 ( wmem_packet_scope ( ) , ws_ip6 ) ;
iph - > ip6_ver = 6 ;
iph - > ip6_tc = ip6_tcls ;
iph - > ip6_flw = ip6_flow ;
iph - > ip6_len = plen ;
iph - > ip6_nxt = ip6_nxt ;
iph - > ip6_hop = ip6_hlim ;
alloc_address_wmem_ipv6 ( wmem_packet_scope ( ) , & iph - > ip6_src , ip6_src ) ;
alloc_address_wmem_ipv6 ( wmem_packet_scope ( ) , & iph - > ip6_dst , ip6_dst ) ;
2016-07-25 03:25:05 +00:00
2018-08-29 02:55:02 +00:00
/* Shared state between IPv6 header and extensions. */
ipv6_pinfo_t * ipv6_pinfo = wmem_new0 ( pinfo - > pool , ipv6_pinfo_t ) ;
ipv6_pinfo - > ip6_plen = ip6_plen ;
ipv6_pinfo - > jumbo_plen = jumbo_plen ;
ipv6_pinfo - > frag_plen = ip6_plen ; /* updated by extension header dissectors, if any */
if ( ! ipv6_exthdr_under_root ) {
ipv6_pinfo - > ipv6_tree = ipv6_tree ;
ipv6_pinfo - > ipv6_item_len = IPv6_HDR_SIZE ;
}
p_add_proto_data ( pinfo - > pool , pinfo , proto_ipv6 , IPV6_PROTO_PINFO , ipv6_pinfo ) ;
2015-08-09 22:13:06 +00:00
/* Adjust the length of this tvbuff to include only the IPv6 datagram. */
2016-07-25 03:25:05 +00:00
set_actual_length ( tvb , IPv6_HDR_SIZE + plen ) ;
2015-09-18 01:08:34 +00:00
save_fragmented = pinfo - > fragmented ;
1999-03-28 18:32:03 +00:00
2016-07-25 23:18:38 +00:00
p_add_ipv6_nxt ( pinfo , ip6_nxt ) ;
2016-07-17 04:02:29 +00:00
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
2016-07-25 03:25:05 +00:00
ipv6_dissect_next ( ip6_nxt , next_tvb , pinfo , tree , iph ) ;
2008-11-07 01:54:08 +00:00
2016-07-17 04:02:29 +00:00
pinfo - > fragmented = save_fragmented ;
return tvb_captured_length ( tvb ) ;
}
2000-04-20 07:05:58 +00:00
2016-07-17 04:02:29 +00:00
void
2017-08-31 17:49:15 +00:00
ipv6_dissect_next ( guint nxt , tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , ws_ip6 * iph )
2016-07-17 04:02:29 +00:00
{
dissector_handle_t nxt_handle ;
2017-08-30 14:14:29 +00:00
ipv6_pinfo_t * ipv6_pinfo = p_get_ipv6_pinfo ( pinfo ) ;
2009-12-10 23:15:12 +00:00
2016-07-25 23:18:38 +00:00
switch ( nxt ) {
case IP_PROTO_HOPOPTS :
case IP_PROTO_ROUTING :
case IP_PROTO_FRAGMENT :
case IP_PROTO_DSTOPTS :
case IP_PROTO_AH :
case IP_PROTO_MIPV6 :
case IP_PROTO_SHIM6 :
nxt_handle = dissector_get_uint_handle ( ip_dissector_table , nxt ) ;
break ;
default :
nxt_handle = NULL ;
break ;
}
2016-07-17 04:02:29 +00:00
if ( nxt_handle ! = NULL ) {
call_dissector_with_data ( nxt_handle , tvb , pinfo , tree , iph ) ;
return ;
}
2013-12-12 20:39:11 +00:00
2017-08-30 16:21:12 +00:00
/*
* Done with extension header chain
*/
2016-07-27 05:14:35 +00:00
2017-08-30 16:21:12 +00:00
if ( ipv6_pinfo ! = NULL & & ipv6_pinfo - > ipv6_tree ! = NULL ) {
/* Set IPv6 Header length */
proto_item_set_len ( proto_tree_get_parent ( ipv6_pinfo - > ipv6_tree ) , ipv6_pinfo - > ipv6_item_len ) ;
ipv6_pinfo - > ipv6_tree = NULL ;
}
2017-08-31 17:49:15 +00:00
if ( iph ! = NULL & & iph - > ip6_ver = = 6 ) {
iph - > ip6_nxt = nxt ; /* upper-layer protocol more useful */
tap_queue_packet ( ipv6_tap , pinfo , iph ) ;
2016-07-25 03:25:05 +00:00
}
2016-07-27 05:14:35 +00:00
if ( nxt = = IP_PROTO_NONE ) {
col_set_str ( pinfo - > cinfo , COL_INFO , " IPv6 no next header " ) ;
call_data_dissector ( tvb , pinfo , tree ) ;
return ;
2015-09-18 01:08:34 +00:00
}
2016-07-17 04:02:29 +00:00
2016-07-24 08:05:23 +00:00
if ( ip_try_dissect ( try_heuristic_first , nxt , tvb , pinfo , tree , iph ) ) {
2016-07-17 04:02:29 +00:00
return ;
2001-06-26 17:31:36 +00:00
}
2016-07-17 04:02:29 +00:00
/* Unknown protocol. */
2016-07-25 03:07:31 +00:00
col_add_fstr ( pinfo - > cinfo , COL_INFO , " Unknown IP Protocol: %s (%u) " , ipprotostr ( nxt ) , nxt ) ;
2016-07-17 04:02:29 +00:00
call_data_dissector ( tvb , pinfo , tree ) ;
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 ,
2016-07-30 16:45:37 +00:00
{ " Traffic Class " , " ipv6.tclass " ,
2015-09-25 12:53:18 +00:00
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-07-30 16:45:37 +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 ,
2016-07-30 16:45:37 +00:00
{ " Payload Length " , " ipv6.plen " ,
2015-09-25 12:53:18 +00:00
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_nxt ,
2016-07-30 16:45:37 +00:00
{ " Next Header " , " ipv6.nxt " ,
2015-09-25 12:53:18 +00:00
FT_UINT8 , BASE_DEC | BASE_EXT_STRING , & ipproto_val_ext , 0x0 ,
NULL , HFILL }
} ,
2013-12-12 20:39:11 +00:00
{ & hf_ipv6_hlim ,
2016-07-30 16:45:37 +00:00
{ " Hop Limit " , " ipv6.hlim " ,
2015-09-25 12:53:18 +00:00
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 }
} ,
2016-07-30 04:44:21 +00:00
{ & hf_ipv6_src_embed_ipv4 ,
{ " Source Embedded IPv4 " , " ipv6.src_embed_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
2016-07-31 18:30:10 +00:00
" Source IPv4-Embedded IPv6 Address with Well-Known Prefix " , HFILL }
2016-07-30 04:44:21 +00:00
} ,
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 }
} ,
2016-07-30 04:44:21 +00:00
{ & hf_ipv6_dst_embed_ipv4 ,
{ " Destination Embedded IPv4 " , " ipv6.dst_embed_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
2016-07-31 18:30:10 +00:00
" Destination IPv4-Embedded IPv6 Address with Well-Known Prefix " , HFILL }
2016-07-30 04:44:21 +00:00
} ,
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 }
} ,
2016-07-30 04:44:21 +00:00
{ & hf_ipv6_embed_ipv4 ,
{ " Embedded IPv4 " , " ipv6.embed_ipv4 " ,
FT_IPv4 , BASE_NONE , NULL , 0x0 ,
2016-07-31 18:30:10 +00:00
" IPv4-Embedded IPv6 Address with Well-Known Prefix " , HFILL }
2016-07-30 04:44:21 +00:00
} ,
2015-09-25 12:53:18 +00:00
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 }
} ,
2018-03-10 17:18:03 +00:00
{ & hf_geoip_country_iso ,
{ " Source or Destination GeoIP ISO Two Letter Country Code " , " ipv6.geoip.country_iso " ,
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 }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_as_number ,
{ " Source or Destination GeoIP AS Number " , " ipv6.geoip.asnum " ,
FT_UINT32 , BASE_DEC , NULL , 0x0 ,
2015-09-25 12:53:18 +00:00
NULL , HFILL }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_as_org ,
{ " Source or Destination GeoIP AS Organization " , " ipv6.geoip.org " ,
2015-09-25 12:53:18 +00:00
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_latitude ,
2015-09-25 12:53:18 +00:00
{ " Source or Destination GeoIP Latitude " , " ipv6.geoip.lat " ,
FT_DOUBLE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_longitude ,
2015-09-25 12:53:18 +00:00
{ " Source or Destination GeoIP Longitude " , " ipv6.geoip.lon " ,
FT_DOUBLE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_src_summary ,
{ " Source GeoIP " , " ipv6.geoip.src_summary " ,
FT_STRING , STR_UNICODE , 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 }
} ,
2018-03-10 17:18:03 +00:00
{ & hf_geoip_src_country_iso ,
{ " Source GeoIP ISO Two Letter Country Code " , " ipv6.geoip.src_country_iso " ,
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 }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_src_as_number ,
{ " Source GeoIP AS Number " , " ipv6.geoip.src_asnum " ,
FT_UINT32 , BASE_DEC , NULL , 0x0 ,
2015-09-25 12:53:18 +00:00
NULL , HFILL }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_src_as_org ,
{ " Source GeoIP AS Organization " , " ipv6.geoip.src_org " ,
2015-09-25 12:53:18 +00:00
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_src_latitude ,
2015-09-25 12:53:18 +00:00
{ " Source GeoIP Latitude " , " ipv6.geoip.src_lat " ,
FT_DOUBLE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_src_longitude ,
2015-09-25 12:53:18 +00:00
{ " Source GeoIP Longitude " , " ipv6.geoip.src_lon " ,
FT_DOUBLE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_dst_summary ,
{ " Destination GeoIP " , " ipv6.geoip.dst_summary " ,
FT_STRING , STR_UNICODE , 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 }
} ,
2018-03-10 17:18:03 +00:00
{ & hf_geoip_dst_country_iso ,
{ " Destination GeoIP ISO Two Letter Country Code " , " ipv6.geoip.dst_country_iso " ,
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 }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_dst_as_number ,
{ " Destination GeoIP AS Number " , " ipv6.geoip.dst_asnum " ,
FT_UINT32 , BASE_DEC , NULL , 0x0 ,
2015-09-25 12:53:18 +00:00
NULL , HFILL }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_dst_as_org ,
{ " Destination GeoIP AS Organization " , " ipv6.geoip.dst_org " ,
2015-09-25 12:53:18 +00:00
FT_STRING , STR_UNICODE , NULL , 0x0 ,
NULL , HFILL }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_dst_latitude ,
2015-09-25 12:53:18 +00:00
{ " Destination GeoIP Latitude " , " ipv6.geoip.dst_lat " ,
FT_DOUBLE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2018-02-09 01:20:26 +00:00
{ & hf_geoip_dst_longitude ,
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
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 " ,
2016-07-20 03:11:07 +00:00
FT_UINT8 , BASE_HEX | BASE_EXT_STRING , & ipv6_opt_type_vals_ext , 0x0 ,
2015-09-25 12:53:18 +00:00
" Option type " , HFILL }
} ,
2016-07-20 03:11:07 +00:00
{ & hf_ipv6_opt_type_action ,
{ " Action " , " ipv6.opt.type.action " ,
FT_UINT8 , BASE_DEC , VALS ( ipv6_opt_type_action_vals ) , 0xC0 ,
" Action for unrecognized option type " , HFILL }
} ,
{ & hf_ipv6_opt_type_change ,
2016-07-30 16:45:37 +00:00
{ " May Change " , " ipv6.opt.type.change " ,
2016-07-20 03:11:07 +00:00
FT_BOOLEAN , 8 , TFS ( & tfs_yes_no ) , 0x20 ,
" Whether the option data may change en-route " , HFILL }
} ,
{ & hf_ipv6_opt_type_rest ,
2016-07-30 16:45:37 +00:00
{ " Low-Order Bits " , " ipv6.opt.type.rest " ,
2016-07-20 03:11:07 +00:00
FT_UINT8 , BASE_HEX , NULL , 0x1F ,
" Remaining low-order bits " , 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 " ,
2016-07-30 16:19:48 +00:00
FT_UINT16 , BASE_DEC , VALS ( ipv6_opt_rtalert_vals ) , 0x0 ,
2015-09-25 12:53:18 +00:00
" 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 }
} ,
2016-07-27 00:51:54 +00:00
{ & hf_ipv6_opt_smf_dpd_hash_bit ,
{ " H-bit " , " ipv6.opt.smf_dpd.hash_bit " ,
FT_BOOLEAN , 8 , NULL , 0x80 ,
" Hash indicator " , HFILL }
} ,
{ & hf_ipv6_opt_smf_dpd_tid_type ,
{ " TaggerID Type " , " ipv6.opt.smf_dpd.tid_type " ,
FT_UINT8 , BASE_DEC , VALS ( ipv6_opt_smf_dpd_tidty_vals ) , 0x70 ,
NULL , HFILL }
} ,
{ & hf_ipv6_opt_smf_dpd_tid_len ,
{ " TaggerID Length " , " ipv6.opt.smf_dpd.tid_len " ,
FT_UINT8 , BASE_DEC , NULL , 0x0F ,
NULL , HFILL }
} ,
{ & hf_ipv6_opt_smf_dpd_tagger_id ,
{ " TaggerID " , " ipv6.opt.smf_dpd.tagger_id " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
{ & hf_ipv6_opt_smf_dpd_ident ,
{ " Identifier " , " ipv6.opt.smf_dpd.ident " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
{ & hf_ipv6_opt_smf_dpd_hav ,
{ " Hash Assist Value " , " ipv6.opt.smf_dpd.hav " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2017-07-30 11:18:10 +00:00
{ & hf_ipv6_opt_pdm_scale_dtlr ,
{ " Scale DTLR " , " ipv6.opt.pdm.scale_dtlr " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
" Scale for Delta Time Last Received " , HFILL }
} ,
{ & hf_ipv6_opt_pdm_scale_dtls ,
{ " Scale DTLS " , " ipv6.opt.pdm.scale_dtls " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
" Scale for Delta Time Last Sent " , HFILL }
} ,
{ & hf_ipv6_opt_pdm_psn_this_pkt ,
{ " PSN This Packet " , " ipv6.opt.pdm.psn_this_pkt " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Packet Sequence Number This Packet " , HFILL }
} ,
{ & hf_ipv6_opt_pdm_psn_last_recv ,
{ " PSN Last Received " , " ipv6.opt.pdm.psn_last_recv " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
" Packet Sequence Number Last Received " , HFILL }
} ,
{ & hf_ipv6_opt_pdm_delta_last_recv ,
{ " Delta Time Last Received " , " ipv6.opt.pdm.delta_last_recv " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
{ & hf_ipv6_opt_pdm_delta_last_sent ,
{ " Delta Time Last Sent " , " ipv6.opt.pdm.delta_last_sent " ,
FT_UINT16 , BASE_DEC , 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 " ,
2016-07-20 02:06:09 +00:00
FT_STRING , BASE_NONE , NULL , 0x0 ,
2015-12-29 19:30:58 +00:00
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 " ,
2019-03-26 20:41:04 +00:00
FT_UINT8 , BASE_DEC , VALS ( mpl_seed_id_len_vals ) , 0xC0 ,
2015-09-25 12:53:18 +00:00
" 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 }
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 " ,
2016-12-15 18:01:27 +00:00
FT_UINT16 , BASE_DEC | BASE_UNIT_STRING , & units_byte_bytes , 0x0 ,
2016-06-01 16:40:33 +00:00
" 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 " ,
2016-12-15 18:01:27 +00:00
FT_UINT16 , BASE_DEC | BASE_UNIT_STRING , & units_byte_bytes , 0x0 ,
2016-06-01 16:40:33 +00:00
" 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 " ,
2016-12-15 18:01:27 +00:00
FT_UINT16 , BASE_DEC | BASE_UNIT_STRING , & units_byte_bytes , 0x0 ,
2016-06-01 16:40:33 +00:00
" 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 }
} ,
2016-07-29 13:54:06 +00:00
{ & hf_ipv6_routing_unknown_data ,
{ " Type-Specific Data " , " ipv6.routing.unknown_data " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
" Unknown routing header type-specific data " , 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 " ,
2017-02-02 11:23:24 +00:00
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
2016-05-28 00:55:04 +00:00
NULL , HFILL }
} ,
2017-02-02 11:23:24 +00:00
{ & hf_ipv6_routing_srh_flag_unused1 ,
{ " Unused " , " ipv6.routing.srh.flag_unused1 " ,
FT_UINT8 , BASE_HEX , NULL , 0x80 ,
" Unset on transmission and ignored on receipt " , HFILL }
2016-06-11 17:09:05 +00:00
} ,
{ & hf_ipv6_routing_srh_flag_p ,
{ " Protected " , " ipv6.routing.srh.flag_p " ,
2017-02-02 11:23:24 +00:00
FT_BOOLEAN , 8 , TFS ( & tfs_true_false ) , 0x40 ,
2016-06-11 17:09:05 +00:00
NULL , HFILL }
} ,
{ & hf_ipv6_routing_srh_flag_o ,
{ " OAM " , " ipv6.routing.srh.flag_o " ,
2017-02-02 11:23:24 +00:00
FT_BOOLEAN , 8 , TFS ( & tfs_true_false ) , 0x20 ,
2016-06-11 17:09:05 +00:00
NULL , HFILL }
} ,
{ & hf_ipv6_routing_srh_flag_a ,
{ " Alert " , " ipv6.routing.srh.flag_a " ,
2017-02-02 11:23:24 +00:00
FT_BOOLEAN , 8 , TFS ( & tfs_present_not_present ) , 0x10 ,
2016-06-11 17:09:05 +00:00
NULL , HFILL }
} ,
{ & hf_ipv6_routing_srh_flag_h ,
{ " HMAC " , " ipv6.routing.srh.flag_h " ,
2017-02-02 11:23:24 +00:00
FT_BOOLEAN , 8 , TFS ( & tfs_present_not_present ) , 0x08 ,
2016-06-11 17:09:05 +00:00
NULL , HFILL }
} ,
2017-02-02 11:23:24 +00:00
{ & hf_ipv6_routing_srh_flag_unused2 ,
{ " Unused " , " ipv6.routing.srh.flag_unused2 " ,
FT_UINT8 , BASE_HEX , NULL , 0x07 ,
2016-06-11 17:09:05 +00:00
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 " ,
2016-12-16 19:57:54 +00:00
FT_UINT16 , BASE_DEC , NULL , IP6F_OFF_MASK ,
2015-10-31 21:11:39 +00:00
" 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 }
}
} ;
2016-07-14 18:44:51 +00:00
static gint * ett_ipv6 [ ] = {
& ett_ipv6_proto ,
& ett_ipv6_traffic_class ,
& ett_geoip_info ,
2013-12-12 20:39:11 +00:00
& ett_ipv6_opt ,
2016-07-20 03:11:07 +00:00
& ett_ipv6_opt_type ,
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 ,
2013-12-12 20:39:11 +00:00
& ett_ipv6_fragment ,
2016-07-17 00:54:42 +00:00
& ett_ipv6_fragments
2013-12-12 20:39:11 +00:00
} ;
2015-09-25 12:53:18 +00:00
2016-07-14 18:44:51 +00:00
static gint * ett_ipv6_hopopts [ ] = {
& ett_ipv6_hopopts_proto
} ;
static gint * ett_ipv6_routing [ ] = {
& ett_ipv6_routing_proto ,
& ett_ipv6_routing_srh_flags ,
& ett_ipv6_routing_srh_vect
} ;
static gint * ett_ipv6_fraghdr [ ] = {
& ett_ipv6_fraghdr_proto
} ;
static gint * ett_ipv6_dstopts [ ] = {
& ett_ipv6_dstopts_proto
} ;
static ei_register_info ei_ipv6 [ ] = {
2015-09-25 12:53:18 +00:00
{ & ei_ipv6_opt_jumbo_missing ,
2016-07-28 05:12:31 +00:00
{ " ipv6.opt.jumbo.missing " , PI_MALFORMED , PI_ERROR ,
2015-09-25 12:53:18 +00:00
" IPv6 payload length equals 0 and Hop-By-Hop present and Jumbo Payload option missing " , EXPFILL }
} ,
{ & ei_ipv6_opt_jumbo_prohibited ,
2016-07-28 05:12:31 +00:00
{ " ipv6.opt.jumbo.prohibited " , PI_PROTOCOL , PI_WARN ,
2015-09-25 12:53:18 +00:00
" When IPv6 payload length does not equal 0 a Jumbo Payload option must not be present " , EXPFILL }
} ,
{ & ei_ipv6_opt_jumbo_truncated ,
2016-07-28 05:12:31 +00:00
{ " ipv6.opt.jumbo.truncated " , PI_PROTOCOL , PI_WARN ,
2015-09-25 12:53:18 +00:00
" Jumbo Payload option present and jumbo length < 65536 " , EXPFILL }
} ,
{ & ei_ipv6_opt_jumbo_fragment ,
2016-07-28 05:12:31 +00:00
{ " ipv6.opt.jumbo.fragment " , PI_PROTOCOL , PI_WARN ,
2015-09-25 12:53:18 +00:00
" Jumbo Payload option cannot be used with a fragment header " , 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 }
} ,
2016-07-16 13:07:40 +00:00
{ & ei_ipv6_plen_exceeds_framing ,
{ " ipv6.plen_exceeds_framing " , PI_PROTOCOL , PI_WARN ,
2015-09-25 12:53:18 +00:00
" IPv6 payload length does not match expected framing length " , EXPFILL }
} ,
2017-12-17 17:40:17 +00:00
{ & ei_ipv6_plen_zero ,
{ " ipv6.plen_zero " , PI_PROTOCOL , PI_CHAT ,
" IPv6 payload length equals 0 (maybe because of \" TCP segmentation offload \" (TSO)) " , EXPFILL }
} ,
2015-09-25 12:53:18 +00:00
{ & ei_ipv6_bogus_ipv6_version ,
2016-07-28 05:12:31 +00:00
{ " ipv6.bogus_ipv6_version " , PI_MALFORMED , PI_ERROR ,
2015-09-25 12:53:18 +00:00
" Bogus IP version " , EXPFILL }
} ,
{ & ei_ipv6_invalid_header ,
{ " ipv6.invalid_header " , PI_MALFORMED , PI_ERROR ,
2016-07-16 17:23:23 +00:00
" Invalid IPv6 header " , EXPFILL }
2016-07-26 23:04:58 +00:00
} ,
{ & ei_ipv6_opt_header_mismatch ,
{ " ipv6.opt.header_mismatch " , PI_PROTOCOL , PI_WARN ,
" Wrong options extension header for type " , EXPFILL }
2016-07-29 14:12:01 +00:00
} ,
{ & ei_ipv6_opt_deprecated ,
2016-07-29 14:00:56 +00:00
{ " ipv6.opt.deprecated " , PI_DEPRECATED , PI_NOTE ,
2016-07-29 14:12:01 +00:00
" Option type is deprecated " , EXPFILL }
2019-03-26 20:41:04 +00:00
} ,
{ & ei_ipv6_opt_mpl_ipv6_src_seed_id ,
{ " ipv6.opt.mpl.ipv6_src_seed_id " , PI_PROTOCOL , PI_COMMENT ,
" Seed ID is the IPv6 Source Address " , EXPFILL }
2016-07-14 18:44:51 +00:00
}
} ;
static ei_register_info ei_ipv6_hopopts [ ] = {
{ & 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 }
}
} ;
static ei_register_info ei_ipv6_routing [ ] = {
{ & 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 ,
2016-07-28 05:12:31 +00:00
{ " ipv6.src_route_list.mult_inst_same_addr " , PI_PROTOCOL , PI_WARN ,
2016-07-14 18:44:51 +00:00
" Multiple instances of the same address must not appear in the source route list " , EXPFILL }
} ,
{ & ei_ipv6_src_route_list_src_addr ,
2016-07-28 05:12:31 +00:00
{ " ipv6.src_route_list.src_addr " , PI_PROTOCOL , PI_WARN ,
2016-07-14 18:44:51 +00:00
" Source address must not appear in the source route list " , EXPFILL }
} ,
{ & ei_ipv6_src_route_list_dst_addr ,
2016-07-28 05:12:31 +00:00
{ " ipv6.src_route_list.dst_addr " , PI_PROTOCOL , PI_WARN ,
2016-07-14 18:44:51 +00:00
" Destination address must not appear in the source route list " , EXPFILL }
} ,
{ & ei_ipv6_src_route_list_multicast_addr ,
2016-07-28 05:12:31 +00:00
{ " ipv6.src_route_list.multicast_addr " , PI_PROTOCOL , PI_WARN ,
2016-07-14 18:44:51 +00:00
" 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 }
} ,
{ & ei_ipv6_routing_rpl_addr_count_ge0 ,
{ " ipv6.routing.rpl.addr_count_ge0 " , PI_MALFORMED , PI_ERROR ,
" Calculated total address count must be greater than or equal to 0, instead was X " , EXPFILL }
} ,
{ & ei_ipv6_routing_rpl_reserved ,
2016-07-28 05:12:31 +00:00
{ " ipv6.routing.rpl.reserved_not0 " , PI_PROTOCOL , PI_NOTE ,
2016-07-14 18:44:51 +00:00
" Reserved field must equal 0 but instead was X " , EXPFILL }
2015-09-25 12:53:18 +00:00
} ,
{ & ei_ipv6_routing_invalid_length ,
{ " ipv6.routing.invalid_length " , PI_MALFORMED , PI_ERROR ,
" Invalid IPv6 Routing header length " , EXPFILL }
} ,
{ & ei_ipv6_routing_invalid_segleft ,
2016-07-28 05:12:31 +00:00
{ " ipv6.routing.invalid_segleft " , PI_PROTOCOL , PI_WARN ,
2015-09-25 12:53:18 +00:00
" IPv6 Routing Header segments left field must not exceed address count " , EXPFILL }
} ,
2016-07-29 13:54:06 +00:00
{ & ei_ipv6_routing_undecoded ,
{ " ipv6.routing.undecoded " , PI_UNDECODED , PI_NOTE ,
2016-05-28 00:55:04 +00:00
" Undecoded IPv6 routing header field " , EXPFILL }
2016-07-29 14:12:01 +00:00
} ,
{ & ei_ipv6_routing_deprecated ,
2016-07-29 14:00:56 +00:00
{ " ipv6.routing.deprecated " , PI_DEPRECATED , PI_NOTE ,
2016-07-29 14:12:01 +00:00
" Routing header type is deprecated " , EXPFILL }
2016-05-28 00:55:04 +00:00
}
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 } ;
2016-07-25 23:18:38 +00:00
2019-06-11 17:18:34 +00:00
static decode_as_t ipv6_da = { " ipv6 " , " ip.proto " , 1 , 0 , & ipv6_da_values , NULL , NULL ,
2013-12-12 20:39:11 +00:00
decode_as_default_populate_list , decode_as_default_reset , decode_as_default_change , NULL } ;
2019-06-11 17:18:34 +00:00
static decode_as_t ipv6_hopopts_da = { " ipv6.hopopts " , " ip.proto " , 1 , 0 , & ipv6_da_values , NULL , NULL ,
2016-07-25 23:18:38 +00:00
decode_as_default_populate_list , decode_as_default_reset , decode_as_default_change , NULL } ;
2019-06-11 17:18:34 +00:00
static decode_as_t ipv6_routing_da = { " ipv6.routing " , " ip.proto " , 1 , 0 , & ipv6_da_values , NULL , NULL ,
2016-07-25 23:18:38 +00:00
decode_as_default_populate_list , decode_as_default_reset , decode_as_default_change , NULL } ;
2019-06-11 17:18:34 +00:00
static decode_as_t ipv6_fraghdr_da = { " ipv6.fraghdr " , " ip.proto " , 1 , 0 , & ipv6_da_values , NULL , NULL ,
2016-07-25 23:18:38 +00:00
decode_as_default_populate_list , decode_as_default_reset , decode_as_default_change , NULL } ;
2019-06-11 17:18:34 +00:00
static decode_as_t ipv6_dstopts_da = { " ipv6.dstopts " , " ip.proto " , 1 , 0 , & ipv6_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 ;
2016-07-14 18:44:51 +00:00
expert_module_t * expert_ipv6_hopopts ;
expert_module_t * expert_ipv6_routing ;
2013-12-12 20:39:11 +00:00
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 ) ) ;
2016-07-14 18:44:51 +00:00
proto_register_subtree_array ( ett_ipv6 , array_length ( ett_ipv6 ) ) ;
2013-12-12 20:39:11 +00:00
expert_ipv6 = expert_register_protocol ( proto_ipv6 ) ;
2016-07-14 18:44:51 +00:00
expert_register_field_array ( expert_ipv6 , ei_ipv6 , array_length ( ei_ipv6 ) ) ;
2013-12-12 20:39:11 +00:00
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 " ) ;
2015-10-31 21:11:39 +00:00
proto_register_field_array ( proto_ipv6_hopopts , hf_ipv6_hopopts , array_length ( hf_ipv6_hopopts ) ) ;
2016-07-14 18:44:51 +00:00
proto_register_subtree_array ( ett_ipv6_hopopts , array_length ( ett_ipv6_hopopts ) ) ;
expert_ipv6_hopopts = expert_register_protocol ( proto_ipv6_hopopts ) ;
expert_register_field_array ( expert_ipv6_hopopts , ei_ipv6_hopopts , array_length ( ei_ipv6_hopopts ) ) ;
proto_ipv6_routing = proto_register_protocol ( " Routing Header for IPv6 " , " IPv6 Routing " , " ipv6.routing " ) ;
2015-10-31 21:11:39 +00:00
proto_register_field_array ( proto_ipv6_routing , hf_ipv6_routing , array_length ( hf_ipv6_routing ) ) ;
2016-07-14 18:44:51 +00:00
proto_register_subtree_array ( ett_ipv6_routing , array_length ( ett_ipv6_routing ) ) ;
expert_ipv6_routing = expert_register_protocol ( proto_ipv6_routing ) ;
expert_register_field_array ( expert_ipv6_routing , ei_ipv6_routing , array_length ( ei_ipv6_routing ) ) ;
2017-09-01 14:02:37 +00:00
ipv6_routing_dissector_table = register_dissector_table ( " ipv6.routing.type " , " IPv6 Routing Type " ,
proto_ipv6_routing , FT_UINT8 , BASE_DEC ) ;
proto_ipv6_routing_rt0 = proto_register_protocol_in_name_only ( " IPv6 Routing Type - Source Route " , " Source Route " , " ipv6.routing.type.rt0 " , proto_ipv6 , FT_BYTES ) ;
proto_ipv6_routing_mipv6 = proto_register_protocol_in_name_only ( " IPv6 Routing Type - Type 2 " , " Type 2 " , " ipv6.routing.type.mipv6 " , proto_ipv6 , FT_BYTES ) ;
proto_ipv6_routing_rpl = proto_register_protocol_in_name_only ( " IPv6 Routing Type - RPL Source Route " , " RPL Source Route " , " ipv6.routing.type.mipv6 " , proto_ipv6 , FT_BYTES ) ;
proto_ipv6_routing_srh = proto_register_protocol_in_name_only ( " IPv6 Routing Types - Segment Routing " , " Segment Routing " , " ipv6.routing.type.srh " , proto_ipv6 , FT_BYTES ) ;
2016-07-14 18:44:51 +00:00
proto_ipv6_fraghdr = proto_register_protocol ( " Fragment Header for IPv6 " , " IPv6 Fragment " , " ipv6.fraghdr " ) ;
2015-10-31 21:11:39 +00:00
proto_register_field_array ( proto_ipv6_fraghdr , hf_ipv6_fraghdr , array_length ( hf_ipv6_fraghdr ) ) ;
2016-07-14 18:44:51 +00:00
proto_register_subtree_array ( ett_ipv6_fraghdr , array_length ( ett_ipv6_fraghdr ) ) ;
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_dstopts , hf_ipv6_dstopts , array_length ( hf_ipv6_dstopts ) ) ;
2016-07-14 18:44:51 +00:00
proto_register_subtree_array ( ett_ipv6_dstopts , array_length ( ett_ipv6_dstopts ) ) ;
2015-10-31 21:11:39 +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 ) ;
prefs_register_bool_preference ( ipv6_module , " use_geoip " ,
2018-02-09 01:20:26 +00:00
" Enable IPv6 geolocation " ,
" Whether to look up IPv6 addresses in each MaxMind database we have loaded " ,
2013-12-12 20:39:11 +00:00
& ipv6_use_geoip ) ;
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 " ,
2016-09-20 21:11:29 +00:00
" Perform strict checking for RPL Source Routing Headers (RFC 6554) " ,
" Check that all RPL Source Routed packets conform to RFC 6554 and 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 ) ;
2017-12-17 17:40:17 +00:00
prefs_register_bool_preference ( ipv6_module , " tso_support " ,
" Support packet-capture from IPv6 TSO-enabled hardware " ,
" Whether to correct for TSO-enabled (TCP segmentation offload) hardware "
" captures, such as spoofing the IPv6 packet length " , & ipv6_tso_supported ) ;
2016-12-17 01:06:11 +00:00
ipv6_handle = register_dissector ( " ipv6 " , dissect_ipv6 , proto_ipv6 ) ;
2017-01-29 00:53:36 +00:00
reassembly_table_register ( & ipv6_reassembly_table ,
& addresses_reassembly_table_functions ) ;
2017-08-31 17:49:15 +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 ) ;
2016-07-25 23:18:38 +00:00
register_decode_as ( & ipv6_hopopts_da ) ;
register_decode_as ( & ipv6_routing_da ) ;
register_decode_as ( & ipv6_fraghdr_da ) ;
register_decode_as ( & ipv6_dstopts_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 ) ;
2016-10-26 16:07:47 +00:00
register_capture_dissector ( " ipv6 " , capture_ipv6 , proto_ipv6 ) ;
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 )
{
2016-07-13 02:21:17 +00:00
dissector_handle_t ipv6_hopopts_handle ;
dissector_handle_t ipv6_routing_handle ;
2016-07-14 18:50:09 +00:00
dissector_handle_t ipv6_fraghdr_handle ;
2016-07-13 02:21:17 +00:00
dissector_handle_t ipv6_dstopts_handle ;
2016-10-26 16:07:47 +00:00
capture_dissector_handle_t ipv6_cap_handle ;
capture_dissector_handle_t ipv6_ext_cap_handle ;
2017-09-01 14:02:37 +00:00
dissector_handle_t h ;
2013-12-12 20:39:11 +00:00
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 ) ;
2016-10-31 07:27:14 +00:00
dissector_add_uint ( " pwach.channel_type " , PW_ACH_TYPE_IPV6 , ipv6_handle ) ;
2018-09-29 14:23:46 +00:00
dissector_add_uint ( " mcc.proto " , PW_ACH_TYPE_IPV6 , ipv6_handle ) ;
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 ) ;
2016-07-19 07:41:33 +00:00
dissector_add_uint ( " vxlan.next_proto " , VXLAN_IPV6 , ipv6_handle ) ;
2017-04-17 12:52:57 +00:00
dissector_add_uint ( " nsh.next_proto " , NSH_IPV6 , ipv6_handle ) ;
2013-12-12 20:39:11 +00:00
2016-10-05 20:33:54 +00:00
dissector_add_for_decode_as_with_preference ( " udp.port " , ipv6_handle ) ;
2015-08-30 22:18:34 +00:00
2016-07-14 18:50:09 +00:00
ipv6_hopopts_handle = create_dissector_handle ( dissect_hopopts , proto_ipv6_hopopts ) ;
2016-07-25 23:18:38 +00:00
dissector_add_uint ( " ip.proto " , IP_PROTO_HOPOPTS , ipv6_hopopts_handle ) ;
2016-07-14 18:50:09 +00:00
ipv6_routing_handle = create_dissector_handle ( dissect_routing6 , proto_ipv6_routing ) ;
2016-07-25 23:18:38 +00:00
dissector_add_uint ( " ip.proto " , IP_PROTO_ROUTING , ipv6_routing_handle ) ;
2016-07-14 18:50:09 +00:00
ipv6_fraghdr_handle = create_dissector_handle ( dissect_fraghdr , proto_ipv6_fraghdr ) ;
2016-07-25 23:18:38 +00:00
dissector_add_uint ( " ip.proto " , IP_PROTO_FRAGMENT , ipv6_fraghdr_handle ) ;
2016-07-14 18:50:09 +00:00
ipv6_dstopts_handle = create_dissector_handle ( dissect_dstopts , proto_ipv6_dstopts ) ;
2016-07-25 23:18:38 +00:00
dissector_add_uint ( " ip.proto " , IP_PROTO_DSTOPTS , ipv6_dstopts_handle ) ;
2014-04-28 23:42:42 +00:00
2013-12-12 20:39:11 +00:00
ip_dissector_table = find_dissector_table ( " ip.proto " ) ;
2016-10-26 16:07:47 +00:00
ipv6_cap_handle = find_capture_dissector ( " ipv6 " ) ;
capture_dissector_add_uint ( " ethertype " , ETHERTYPE_IPv6 , ipv6_cap_handle ) ;
capture_dissector_add_uint ( " enc " , BSD_AF_INET6_BSD , ipv6_cap_handle ) ;
capture_dissector_add_uint ( " null.bsd " , BSD_AF_INET6_BSD , ipv6_cap_handle ) ;
capture_dissector_add_uint ( " null.bsd " , BSD_AF_INET6_FREEBSD , ipv6_cap_handle ) ;
capture_dissector_add_uint ( " null.bsd " , BSD_AF_INET6_DARWIN , ipv6_cap_handle ) ;
capture_dissector_add_uint ( " fr.nlpid " , NLPID_IP6 , ipv6_cap_handle ) ;
ipv6_ext_cap_handle = create_capture_dissector_handle ( capture_ipv6_exthdr , proto_ipv6_hopopts ) ;
capture_dissector_add_uint ( " ip.proto " , IP_PROTO_HOPOPTS , ipv6_ext_cap_handle ) ;
ipv6_ext_cap_handle = create_capture_dissector_handle ( capture_ipv6_exthdr , proto_ipv6_routing ) ;
capture_dissector_add_uint ( " ip.proto " , IP_PROTO_ROUTING , ipv6_ext_cap_handle ) ;
ipv6_ext_cap_handle = create_capture_dissector_handle ( capture_ipv6_exthdr , proto_ipv6_fraghdr ) ;
capture_dissector_add_uint ( " ip.proto " , IP_PROTO_FRAGMENT , ipv6_ext_cap_handle ) ;
ipv6_ext_cap_handle = create_capture_dissector_handle ( capture_ipv6_exthdr , proto_ipv6_dstopts ) ;
capture_dissector_add_uint ( " ip.proto " , IP_PROTO_DSTOPTS , ipv6_ext_cap_handle ) ;
2017-09-01 14:02:37 +00:00
h = create_dissector_handle ( dissect_routing6_rt0 , proto_ipv6_routing_rt0 ) ;
dissector_add_uint ( " ipv6.routing.type " , IPv6_RT_HEADER_SOURCE_ROUTING , h ) ;
h = create_dissector_handle ( dissect_routing6_mipv6 , proto_ipv6_routing_mipv6 ) ;
dissector_add_uint ( " ipv6.routing.type " , IPv6_RT_HEADER_MOBILE_IP , h ) ;
h = create_dissector_handle ( dissect_routing6_rpl , proto_ipv6_routing_rpl ) ;
dissector_add_uint ( " ipv6.routing.type " , IPv6_RT_HEADER_RPL , h ) ;
h = create_dissector_handle ( dissect_routing6_srh , proto_ipv6_routing_srh ) ;
dissector_add_uint ( " ipv6.routing.type " , IPv6_RT_HEADER_SEGMENT_ROUTING , h ) ;
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
*/