cdma2k : fix no previous prototype for function 'proto_[register|reg_handoff]_cdma2k...
[metze/wireshark/wip.git] / epan / dissectors / packet-frame.c
index bed2d82dcfd3315ec8942684566ab8e56c83286f..9c24767c8ba64426263503f7dd4861e7834d529d 100644 (file)
@@ -6,19 +6,7 @@
  * By Gerald Combs <gerald@wireshark.org>
  * Copyright 2000 Gerald Combs
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include "config.h"
 #include <windows.h>
 #endif
 
-#include <glib.h>
-
-#include <wsutil/md5.h>
-
-#include <epan/epan.h>
 #include <epan/packet.h>
+#include <epan/capture_dissectors.h>
+#include <epan/epan.h>
 #include <epan/exceptions.h>
 #include <epan/show_exception.h>
 #include <epan/timestamp.h>
 #include <epan/prefs.h>
 #include <epan/to_str.h>
+#include <epan/sequence_analysis.h>
 #include <wiretap/wtap.h>
 #include <epan/tap.h>
 #include <epan/expert.h>
+#include <wsutil/wsgcrypt.h>
+#include <wsutil/str_util.h>
+#include <epan/proto_data.h>
+#include <wmem/wmem.h>
 
 #include "packet-frame.h"
+#include "packet-icmp.h"
+#include "log.h"
 
-#include "color.h"
-#include "color_filters.h"
+#include <epan/column-info.h>
+#include <epan/color_filters.h>
 
 void proto_register_frame(void);
 void proto_reg_handoff_frame(void);
 
-int proto_frame = -1;
+static int proto_frame = -1;
 static int proto_pkt_comment = -1;
-int hf_frame_arrival_time = -1;
+static int proto_syscall = -1;
+
+static int hf_frame_arrival_time = -1;
 static int hf_frame_shift_offset = -1;
 static int hf_frame_arrival_time_epoch = -1;
 static int hf_frame_time_delta = -1;
 static int hf_frame_time_delta_displayed = -1;
 static int hf_frame_time_relative = -1;
 static int hf_frame_time_reference = -1;
-int hf_frame_number = -1;
-int hf_frame_len = -1;
-int hf_frame_capture_len = -1;
+static int hf_frame_number = -1;
+static int hf_frame_len = -1;
+static int hf_frame_capture_len = -1;
 static int hf_frame_p2p_dir = -1;
 static int hf_frame_file_off = -1;
 static int hf_frame_md5_hash = -1;
@@ -72,6 +66,8 @@ static int hf_frame_protocols = -1;
 static int hf_frame_color_filter_name = -1;
 static int hf_frame_color_filter_text = -1;
 static int hf_frame_interface_id = -1;
+static int hf_frame_interface_name = -1;
+static int hf_frame_interface_description = -1;
 static int hf_frame_pack_flags = -1;
 static int hf_frame_pack_direction = -1;
 static int hf_frame_pack_reception_type = -1;
@@ -89,16 +85,18 @@ static int hf_frame_wtap_encap = -1;
 static int hf_comments_text = -1;
 
 static gint ett_frame = -1;
+static gint ett_ifname = -1;
 static gint ett_flags = -1;
 static gint ett_comments = -1;
 
 static expert_field ei_comments_text = EI_INIT;
 static expert_field ei_arrive_time_out_of_range = EI_INIT;
+static expert_field ei_incomplete = EI_INIT;
 
 static int frame_tap = -1;
 
-static dissector_handle_t data_handle;
 static dissector_handle_t docsis_handle;
+static dissector_handle_t sysdig_handle;
 
 /* Preferences */
 static gboolean show_file_off       = FALSE;
@@ -106,6 +104,7 @@ static gboolean force_docsis_encap  = FALSE;
 static gboolean generate_md5_hash   = FALSE;
 static gboolean generate_epoch_time = TRUE;
 static gboolean generate_bits_field = TRUE;
+static gboolean disable_packet_size_limited_in_summary = FALSE;
 
 static const value_string p2p_dirs[] = {
        { P2P_DIR_UNKNOWN, "Unknown" },
@@ -147,9 +146,39 @@ static const value_string packet_word_reception_types[] = {
        { 0, NULL }
 };
 
-dissector_table_t wtap_encap_dissector_table;
+static dissector_table_t wtap_encap_dissector_table;
 static dissector_table_t wtap_fts_rec_dissector_table;
 
+/****************************************************************************/
+/* whenever a frame packet is seen by the tap listener */
+/* Add a new frame into the graph */
+static gboolean
+frame_seq_analysis_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U_, const void *dummy _U_)
+{
+       seq_analysis_info_t *sainfo = (seq_analysis_info_t *) ptr;
+       seq_analysis_item_t *sai = sequence_analysis_create_sai_with_addresses(pinfo, sainfo);
+
+       if (!sai)
+               return FALSE;
+
+       sai->frame_number = pinfo->num;
+
+       sequence_analysis_use_color_filter(pinfo, sai);
+
+       sai->port_src=pinfo->srcport;
+       sai->port_dst=pinfo->destport;
+
+       sequence_analysis_use_col_info_as_label_comment(pinfo, sai);
+
+       sai->line_style = 1;
+       sai->conv_num = 0;
+       sai->display = TRUE;
+
+       g_queue_push_tail(sainfo->items, sai);
+
+       return TRUE;
+}
+
 /*
  * Routine used to register frame end routine.  The routine should only
  * be registered when the dissector is used in the frame, not in the
@@ -164,7 +193,7 @@ register_frame_end_routine(packet_info *pinfo, void (*func)(void))
 typedef void (*void_func_t)(void);
 
 static void
-call_frame_end_routine(gpointer routine, gpointer dummy _U_)
+call_frame_end_routine(gpointer routine)
 {
        void_func_t func = (void_func_t)routine;
        (*func)();
@@ -177,21 +206,34 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
        guint        cap_len = 0, frame_len = 0;
        proto_tree  *volatile tree;
        proto_tree  *comments_tree;
+       proto_tree  *volatile fh_tree = NULL;
        proto_item  *item;
        const gchar *cap_plurality, *frame_plurality;
-       int file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_UNKNOWN;
+       frame_data_t *fr_data = (frame_data_t*)data;
+       const color_filter_t *color_filter;
 
        tree=parent_tree;
-       if (data != NULL) {
-               file_type_subtype = GPOINTER_TO_INT(data);
-       }
 
-       switch (pinfo->phdr->rec_type) {
+       DISSECTOR_ASSERT(fr_data);
+
+       switch (pinfo->rec->rec_type) {
 
        case REC_TYPE_PACKET:
                pinfo->current_proto = "Frame";
+               if (pinfo->rec->presence_flags & WTAP_HAS_PACK_FLAGS) {
+                       if (pinfo->rec->rec_header.packet_header.pack_flags & 0x00000001)
+                               pinfo->p2p_dir = P2P_DIR_RECV;
+                       if (pinfo->rec->rec_header.packet_header.pack_flags & 0x00000002)
+                               pinfo->p2p_dir = P2P_DIR_SENT;
+               }
+
+               /*
+                * If the pseudo-header *and* the packet record both
+                * have direction information, the pseudo-header
+                * overrides the packet record.
+                */
                if (pinfo->pseudo_header != NULL) {
-                       switch (pinfo->fd->lnk_t) {
+                       switch (pinfo->rec->rec_header.packet_header.pkt_encap) {
 
                        case WTAP_ENCAP_WFLEET_HDLC:
                        case WTAP_ENCAP_CHDLC_WITH_PHDR:
@@ -203,13 +245,14 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
                                break;
 
                        case WTAP_ENCAP_BLUETOOTH_HCI:
-                               pinfo->p2p_dir = pinfo->pseudo_header->bthci.sent;
+                               pinfo->p2p_dir = pinfo->pseudo_header->bthci.sent ?
+                                       P2P_DIR_SENT : P2P_DIR_RECV;
                                break;
 
                        case WTAP_ENCAP_LAPB:
                        case WTAP_ENCAP_FRELAY_WITH_PHDR:
                                pinfo->p2p_dir =
-                                   (pinfo->pseudo_header->x25.flags & FROM_DCE) ?
+                                   (pinfo->pseudo_header->dte_dce.flags & FROM_DCE) ?
                                    P2P_DIR_RECV : P2P_DIR_SENT;
                                break;
 
@@ -249,19 +292,23 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
                pinfo->current_proto = "Report";
                break;
 
+       case REC_TYPE_SYSCALL:
+               pinfo->current_proto = "System Call";
+               break;
+
        default:
                g_assert_not_reached();
                break;
        }
 
-       if (pinfo->pkt_comment) {
+       if (fr_data->pkt_comment) {
                item = proto_tree_add_item(tree, proto_pkt_comment, tvb, 0, 0, ENC_NA);
                comments_tree = proto_item_add_subtree(item, ett_comments);
                comment_item = proto_tree_add_string_format(comments_tree, hf_comments_text, tvb, 0, 0,
-                                                                          pinfo->pkt_comment, "%s",
-                                                                          pinfo->pkt_comment);
+                                                                          fr_data->pkt_comment, "%s",
+                                                                          fr_data->pkt_comment);
                expert_add_info_format(pinfo, comment_item, &ei_comments_text,
-                                                              "%s",  pinfo->pkt_comment);
+                                                              "%s",  fr_data->pkt_comment);
 
 
        }
@@ -270,89 +317,145 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
           generating any tree items.  */
        if (!proto_field_is_referenced(tree, proto_frame)) {
                tree=NULL;
-               if (pinfo->fd->flags.has_ts) {
-                       if (pinfo->fd->abs_ts.nsecs < 0 || pinfo->fd->abs_ts.nsecs >= 1000000000)
+               if (pinfo->presence_flags & PINFO_HAS_TS) {
+                       if (pinfo->abs_ts.nsecs < 0 || pinfo->abs_ts.nsecs >= 1000000000)
                                expert_add_info(pinfo, NULL, &ei_arrive_time_out_of_range);
                }
        } else {
-               proto_tree *fh_tree;
-               gboolean old_visible;
-
                /* Put in frame header information. */
-               cap_len = tvb_length(tvb);
+               cap_len = tvb_captured_length(tvb);
                frame_len = tvb_reported_length(tvb);
 
                cap_plurality = plurality(cap_len, "", "s");
                frame_plurality = plurality(frame_len, "", "s");
 
-               ti = proto_tree_add_protocol_format(tree, proto_frame, tvb, 0, tvb_captured_length(tvb),
-                   "Frame %u: %u byte%s on wire",
-                   pinfo->fd->num, frame_len, frame_plurality);
-               if (generate_bits_field)
-                       proto_item_append_text(ti, " (%u bits)", frame_len * 8);
-               proto_item_append_text(ti, ", %u byte%s captured",
-                   cap_len, cap_plurality);
-               if (generate_bits_field) {
-                       proto_item_append_text(ti, " (%u bits)",
-                           cap_len * 8);
-               }
-               if (pinfo->phdr->presence_flags & WTAP_HAS_INTERFACE_ID) {
-                       proto_item_append_text(ti, " on interface %u",
-                           pinfo->phdr->interface_id);
-               }
-               if (pinfo->phdr->presence_flags & WTAP_HAS_PACK_FLAGS) {
-                       if (pinfo->phdr->pack_flags & 0x00000001) {
-                               proto_item_append_text(ti, " (inbound)");
-                               pinfo->p2p_dir = P2P_DIR_RECV;
+               switch (pinfo->rec->rec_type) {
+               case REC_TYPE_PACKET:
+                       ti = proto_tree_add_protocol_format(tree, proto_frame, tvb, 0, tvb_captured_length(tvb),
+                           "Frame %u: %u byte%s on wire",
+                           pinfo->num, frame_len, frame_plurality);
+                       if (generate_bits_field)
+                               proto_item_append_text(ti, " (%u bits)", frame_len * 8);
+                       proto_item_append_text(ti, ", %u byte%s captured",
+                           cap_len, cap_plurality);
+                       if (generate_bits_field) {
+                               proto_item_append_text(ti, " (%u bits)",
+                                   cap_len * 8);
                        }
-                       if (pinfo->phdr->pack_flags & 0x00000002) {
-                               proto_item_append_text(ti, " (outbound)");
-                               pinfo->p2p_dir = P2P_DIR_SENT;
+                       if (pinfo->rec->presence_flags & WTAP_HAS_INTERFACE_ID) {
+                               proto_item_append_text(ti, " on interface %u",
+                                   pinfo->rec->rec_header.packet_header.interface_id);
+                       }
+                       if (pinfo->rec->presence_flags & WTAP_HAS_PACK_FLAGS) {
+                               if (pinfo->rec->rec_header.packet_header.pack_flags & 0x00000001)
+                                       proto_item_append_text(ti, " (inbound)");
+                               if (pinfo->rec->rec_header.packet_header.pack_flags & 0x00000002)
+                                       proto_item_append_text(ti, " (outbound)");
+                       }
+                       break;
+
+               case REC_TYPE_FT_SPECIFIC_EVENT:
+                       ti = proto_tree_add_protocol_format(tree, proto_frame, tvb, 0, tvb_captured_length(tvb),
+                           "Event %u: %u byte%s on wire",
+                           pinfo->num, frame_len, frame_plurality);
+                       if (generate_bits_field)
+                               proto_item_append_text(ti, " (%u bits)", frame_len * 8);
+                       proto_item_append_text(ti, ", %u byte%s captured",
+                       cap_len, cap_plurality);
+                       if (generate_bits_field) {
+                               proto_item_append_text(ti, " (%u bits)",
+                               cap_len * 8);
+                       }
+                       break;
+
+               case REC_TYPE_FT_SPECIFIC_REPORT:
+                       ti = proto_tree_add_protocol_format(tree, proto_frame, tvb, 0, tvb_captured_length(tvb),
+                           "Report %u: %u byte%s on wire",
+                           pinfo->num, frame_len, frame_plurality);
+                       if (generate_bits_field)
+                               proto_item_append_text(ti, " (%u bits)", frame_len * 8);
+                       proto_item_append_text(ti, ", %u byte%s captured",
+                       cap_len, cap_plurality);
+                       if (generate_bits_field) {
+                               proto_item_append_text(ti, " (%u bits)",
+                               cap_len * 8);
                        }
+                       break;
+
+               case REC_TYPE_SYSCALL:
+                       /*
+                        * This gives us a top-of-tree "syscall" protocol
+                        * with "frame" fields underneath. Should we create
+                        * corresponding syscall.time, .time_epoch, etc
+                        * fields and use them instead or would frame.*
+                        * be preferred?
+                        */
+                       ti = proto_tree_add_protocol_format(tree, proto_syscall, tvb, 0, tvb_captured_length(tvb),
+                           "System Call %u: %u byte%s",
+                           pinfo->num, frame_len, frame_plurality);
+                       break;
                }
 
                fh_tree = proto_item_add_subtree(ti, ett_frame);
 
-               if (pinfo->phdr->presence_flags & WTAP_HAS_INTERFACE_ID && proto_field_is_referenced(tree, hf_frame_interface_id)) {
-                       const char *interface_name = epan_get_interface_name(pinfo->epan, pinfo->phdr->interface_id);
+               if (pinfo->rec->presence_flags & WTAP_HAS_INTERFACE_ID &&
+                  (proto_field_is_referenced(tree, hf_frame_interface_id) || proto_field_is_referenced(tree, hf_frame_interface_name) || proto_field_is_referenced(tree, hf_frame_interface_description))) {
+                       const char *interface_name = epan_get_interface_name(pinfo->epan, pinfo->rec->rec_header.packet_header.interface_id);
+                       const char *interface_description = epan_get_interface_description(pinfo->epan, pinfo->rec->rec_header.packet_header.interface_id);
+                       proto_tree *if_tree;
+                       proto_item *if_item;
+
+                       if (interface_name) {
+                               if_item = proto_tree_add_uint_format_value(fh_tree, hf_frame_interface_id, tvb, 0, 0,
+                                                                          pinfo->rec->rec_header.packet_header.interface_id, "%u (%s)",
+                                                                          pinfo->rec->rec_header.packet_header.interface_id, interface_name);
+                               if_tree = proto_item_add_subtree(if_item, ett_ifname);
+                               proto_tree_add_string(if_tree, hf_frame_interface_name, tvb, 0, 0, interface_name);
+                       } else {
+                               if_item = proto_tree_add_uint(fh_tree, hf_frame_interface_id, tvb, 0, 0, pinfo->rec->rec_header.packet_header.interface_id);
+                       }
 
-                       if (interface_name)
-                               proto_tree_add_uint_format_value(fh_tree, hf_frame_interface_id, tvb, 0, 0, pinfo->phdr->interface_id, "%u (%s)", pinfo->phdr->interface_id, interface_name);
-                       else
-                               proto_tree_add_uint(fh_tree, hf_frame_interface_id, tvb, 0, 0, pinfo->phdr->interface_id);
+                       if (interface_description) {
+                               if_tree = proto_item_add_subtree(if_item, ett_ifname);
+                               proto_tree_add_string(if_tree, hf_frame_interface_description, tvb, 0, 0, interface_description);
+                       }
                }
 
-               if (pinfo->phdr->presence_flags & WTAP_HAS_PACK_FLAGS) {
+               if (pinfo->rec->presence_flags & WTAP_HAS_PACK_FLAGS) {
                        proto_tree *flags_tree;
                        proto_item *flags_item;
-
-                       flags_item = proto_tree_add_uint(fh_tree, hf_frame_pack_flags, tvb, 0, 0, pinfo->phdr->pack_flags);
+                       static const int * flags[] = {
+                               &hf_frame_pack_direction,
+                               &hf_frame_pack_reception_type,
+                               &hf_frame_pack_fcs_length,
+                               &hf_frame_pack_reserved,
+                               &hf_frame_pack_crc_error,
+                               &hf_frame_pack_wrong_packet_too_long_error,
+                               &hf_frame_pack_wrong_packet_too_short_error,
+                               &hf_frame_pack_wrong_inter_frame_gap_error,
+                               &hf_frame_pack_unaligned_frame_error,
+                               &hf_frame_pack_start_frame_delimiter_error,
+                               &hf_frame_pack_preamble_error,
+                               &hf_frame_pack_symbol_error,
+                               NULL
+                       };
+
+                       flags_item = proto_tree_add_uint(fh_tree, hf_frame_pack_flags, tvb, 0, 0, pinfo->rec->rec_header.packet_header.pack_flags);
                        flags_tree = proto_item_add_subtree(flags_item, ett_flags);
-                       proto_tree_add_uint(flags_tree, hf_frame_pack_direction, tvb, 0, 0, pinfo->phdr->pack_flags);
-                       proto_tree_add_uint(flags_tree, hf_frame_pack_reception_type, tvb, 0, 0, pinfo->phdr->pack_flags);
-                       proto_tree_add_uint(flags_tree, hf_frame_pack_fcs_length, tvb, 0, 0, pinfo->phdr->pack_flags);
-                       proto_tree_add_uint(flags_tree, hf_frame_pack_reserved, tvb, 0, 0, pinfo->phdr->pack_flags);
-                       proto_tree_add_boolean(flags_tree, hf_frame_pack_crc_error, tvb, 0, 0, pinfo->phdr->pack_flags);
-                       proto_tree_add_boolean(flags_tree, hf_frame_pack_wrong_packet_too_long_error, tvb, 0, 0, pinfo->phdr->pack_flags);
-                       proto_tree_add_boolean(flags_tree, hf_frame_pack_wrong_packet_too_short_error, tvb, 0, 0, pinfo->phdr->pack_flags);
-                       proto_tree_add_boolean(flags_tree, hf_frame_pack_wrong_inter_frame_gap_error, tvb, 0, 0, pinfo->phdr->pack_flags);
-                       proto_tree_add_boolean(flags_tree, hf_frame_pack_unaligned_frame_error, tvb, 0, 0, pinfo->phdr->pack_flags);
-                       proto_tree_add_boolean(flags_tree, hf_frame_pack_start_frame_delimiter_error, tvb, 0, 0, pinfo->phdr->pack_flags);
-                       proto_tree_add_boolean(flags_tree, hf_frame_pack_preamble_error, tvb, 0, 0, pinfo->phdr->pack_flags);
-                       proto_tree_add_boolean(flags_tree, hf_frame_pack_symbol_error, tvb, 0, 0, pinfo->phdr->pack_flags);
+                       proto_tree_add_bitmask_list_value(flags_tree, tvb, 0, 0, flags, pinfo->rec->rec_header.packet_header.pack_flags);
                }
 
-               if (pinfo->phdr->rec_type == REC_TYPE_PACKET)
-                       proto_tree_add_int(fh_tree, hf_frame_wtap_encap, tvb, 0, 0, pinfo->fd->lnk_t);
+               if (pinfo->rec->rec_type == REC_TYPE_PACKET)
+                       proto_tree_add_int(fh_tree, hf_frame_wtap_encap, tvb, 0, 0, pinfo->rec->rec_header.packet_header.pkt_encap);
 
-               if (pinfo->fd->flags.has_ts) {
+               if (pinfo->presence_flags & PINFO_HAS_TS) {
                        proto_tree_add_time(fh_tree, hf_frame_arrival_time, tvb,
-                                           0, 0, &(pinfo->fd->abs_ts));
-                       if (pinfo->fd->abs_ts.nsecs < 0 || pinfo->fd->abs_ts.nsecs >= 1000000000) {
+                                           0, 0, &(pinfo->abs_ts));
+                       if (pinfo->abs_ts.nsecs < 0 || pinfo->abs_ts.nsecs >= 1000000000) {
                                expert_add_info_format(pinfo, ti, &ei_arrive_time_out_of_range,
                                                                  "Arrival Time: Fractional second %09ld is invalid,"
                                                                  " the valid range is 0-1000000000",
-                                                                 (long) pinfo->fd->abs_ts.nsecs);
+                                                                 (long) pinfo->abs_ts.nsecs);
                        }
                        item = proto_tree_add_time(fh_tree, hf_frame_shift_offset, tvb,
                                            0, 0, &(pinfo->fd->shift_offset));
@@ -360,13 +463,13 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
 
                        if (generate_epoch_time) {
                                proto_tree_add_time(fh_tree, hf_frame_arrival_time_epoch, tvb,
-                                                   0, 0, &(pinfo->fd->abs_ts));
+                                                   0, 0, &(pinfo->abs_ts));
                        }
 
                        if (proto_field_is_referenced(tree, hf_frame_time_delta)) {
                                nstime_t     del_cap_ts;
 
-                               frame_delta_abs_time(pinfo->epan, pinfo->fd, pinfo->fd->num - 1, &del_cap_ts);
+                               frame_delta_abs_time(pinfo->epan, pinfo->fd, pinfo->num - 1, &del_cap_ts);
 
                                item = proto_tree_add_time(fh_tree, hf_frame_time_delta, tvb,
                                                           0, 0, &(del_cap_ts));
@@ -394,7 +497,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
                }
 
                proto_tree_add_uint(fh_tree, hf_frame_number, tvb,
-                                   0, 0, pinfo->fd->num);
+                                   0, 0, pinfo->num);
 
                proto_tree_add_uint_format(fh_tree, hf_frame_len, tvb,
                                           0, 0, frame_len, "Frame Length: %u byte%s (%u bits)",
@@ -406,17 +509,13 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
 
                if (generate_md5_hash) {
                        const guint8 *cp;
-                       md5_state_t   md_ctx;
-                       md5_byte_t    digest[16];
+                       guint8        digest[HASH_MD5_LENGTH];
                        const gchar  *digest_string;
 
                        cp = tvb_get_ptr(tvb, 0, cap_len);
 
-                       md5_init(&md_ctx);
-                       md5_append(&md_ctx, cp, cap_len);
-                       md5_finish(&md_ctx, digest);
-
-                       digest_string = bytestring_to_str(wmem_packet_scope(), digest, 16, '\0');
+                       gcry_md_hash_buffer(GCRY_MD_MD5, digest, cp, cap_len);
+                       digest_string = bytestring_to_str(wmem_packet_scope(), digest, HASH_MD5_LENGTH, '\0');
                        ti = proto_tree_add_string(fh_tree, hf_frame_md5_hash, tvb, 0, 0, digest_string);
                        PROTO_ITEM_SET_GENERATED(ti);
                }
@@ -427,30 +526,19 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
                ti = proto_tree_add_boolean(fh_tree, hf_frame_ignored, tvb, 0, 0,pinfo->fd->flags.ignored);
                PROTO_ITEM_SET_GENERATED(ti);
 
-               if (proto_field_is_referenced(tree, hf_frame_protocols)) {
-                       /* we are going to be using proto_item_append_string() on
-                        * hf_frame_protocols, and we must therefore disable the
-                        * TRY_TO_FAKE_THIS_ITEM() optimisation for the tree by
-                        * setting it as visible.
-                        *
-                        * See proto.h for details.
-                        */
-                       old_visible = proto_tree_set_visible(fh_tree, TRUE);
-                       ti = proto_tree_add_string(fh_tree, hf_frame_protocols, tvb, 0, 0, "");
-                       PROTO_ITEM_SET_GENERATED(ti);
-                       proto_tree_set_visible(fh_tree, old_visible);
-               }
-
-               /* Check for existences of P2P pseudo header */
-               if (pinfo->p2p_dir != P2P_DIR_UNKNOWN) {
-                       proto_tree_add_int(fh_tree, hf_frame_p2p_dir, tvb,
-                                          0, 0, pinfo->p2p_dir);
-               }
+               if (pinfo->rec->rec_type == REC_TYPE_PACKET) {
+                       /* Check for existences of P2P pseudo header */
+                       if (pinfo->p2p_dir != P2P_DIR_UNKNOWN) {
+                               proto_tree_add_int(fh_tree, hf_frame_p2p_dir, tvb,
+                                                  0, 0, pinfo->p2p_dir);
+                       }
 
-               /* Check for existences of MTP2 link number */
-               if ((pinfo->pseudo_header != NULL ) && (pinfo->fd->lnk_t == WTAP_ENCAP_MTP2_WITH_PHDR)) {
-                       proto_tree_add_uint(fh_tree, hf_link_number, tvb,
-                                           0, 0, pinfo->link_number);
+                       /* Check for existences of MTP2 link number */
+                       if ((pinfo->pseudo_header != NULL) &&
+                           (pinfo->rec->rec_header.packet_header.pkt_encap == WTAP_ENCAP_MTP2_WITH_PHDR)) {
+                               proto_tree_add_uint(fh_tree, hf_link_number, tvb,
+                                                   0, 0, pinfo->link_number);
+                       }
                }
 
                if (show_file_off) {
@@ -459,22 +547,12 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
                                                    "%" G_GINT64_MODIFIER "d (0x%" G_GINT64_MODIFIER "x)",
                                                    pinfo->fd->file_off, pinfo->fd->file_off);
                }
-
-               if (pinfo->fd->color_filter != NULL) {
-                       const color_filter_t *color_filter = (const color_filter_t *)pinfo->fd->color_filter;
-                       item = proto_tree_add_string(fh_tree, hf_frame_color_filter_name, tvb,
-                                                    0, 0, color_filter->filter_name);
-                       PROTO_ITEM_SET_GENERATED(item);
-                       item = proto_tree_add_string(fh_tree, hf_frame_color_filter_text, tvb,
-                                                    0, 0, color_filter->filter_text);
-                       PROTO_ITEM_SET_GENERATED(item);
-               }
        }
 
        if (pinfo->fd->flags.ignored) {
                /* Ignored package, stop handling here */
                col_set_str(pinfo->cinfo, COL_INFO, "<Ignored>");
-               proto_tree_add_text (tree, tvb, 0, 0, "This frame is marked as ignored");
+               proto_tree_add_boolean_format(tree, hf_frame_ignored, tvb, 0, 0, TRUE, "This frame is marked as ignored");
                return tvb_captured_length(tvb);
        }
 
@@ -491,32 +569,49 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
                */
                __try {
 #endif
-                       switch (pinfo->phdr->rec_type) {
+                       switch (pinfo->rec->rec_type) {
 
                        case REC_TYPE_PACKET:
                                if ((force_docsis_encap) && (docsis_handle)) {
-                                       call_dissector(docsis_handle, tvb, pinfo, parent_tree);
+                                       call_dissector_with_data(docsis_handle,
+                                           tvb, pinfo, parent_tree,
+                                           (void *)pinfo->pseudo_header);
                                } else {
-                                       if (!dissector_try_uint(wtap_encap_dissector_table, pinfo->fd->lnk_t,
-                                                               tvb, pinfo, parent_tree)) {
-
+                                       if (!dissector_try_uint_new(wtap_encap_dissector_table,
+                                           pinfo->rec->rec_header.packet_header.pkt_encap, tvb, pinfo,
+                                           parent_tree, TRUE,
+                                           (void *)pinfo->pseudo_header)) {
                                                col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN");
                                                col_add_fstr(pinfo->cinfo, COL_INFO, "WTAP_ENCAP = %d",
-                                                            pinfo->fd->lnk_t);
-                                               call_dissector(data_handle,tvb, pinfo, parent_tree);
+                                                            pinfo->rec->rec_header.packet_header.pkt_encap);
+                                               call_data_dissector(tvb, pinfo, parent_tree);
                                        }
                                }
                                break;
 
                        case REC_TYPE_FT_SPECIFIC_EVENT:
                        case REC_TYPE_FT_SPECIFIC_REPORT:
-                               if (!dissector_try_uint(wtap_fts_rec_dissector_table, file_type_subtype,
-                                                       tvb, pinfo, parent_tree)) {
+                               {
+                                       int file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_UNKNOWN;
+
+                                       file_type_subtype = fr_data->file_type_subtype;
+
+                                       if (!dissector_try_uint(wtap_fts_rec_dissector_table, file_type_subtype,
+                                           tvb, pinfo, parent_tree)) {
+                                               col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN");
+                                               col_add_fstr(pinfo->cinfo, COL_INFO, "WTAP FT ST = %d",
+                                                            file_type_subtype);
+                                               call_data_dissector(tvb, pinfo, parent_tree);
+                                       }
+                               }
+                               break;
 
-                                       col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN");
-                                       col_add_fstr(pinfo->cinfo, COL_INFO, "WTAP_ENCAP = %d",
-                                                    file_type_subtype);
-                                       call_dissector(data_handle,tvb, pinfo, parent_tree);
+                       case REC_TYPE_SYSCALL:
+                               /* Sysdig is the only type we currently handle. */
+                               if (sysdig_handle) {
+                                       call_dissector_with_data(sysdig_handle,
+                                           tvb, pinfo, parent_tree,
+                                           (void *)pinfo->pseudo_header);
                                }
                                break;
                        }
@@ -564,7 +659,8 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
                        wmem_strbuf_append(val, proto_get_protocol_filter_name(GPOINTER_TO_UINT(wmem_list_frame_data(frame))));
                        frame = wmem_list_frame_next(frame);
                }
-               proto_item_append_string(ti, wmem_strbuf_get_str(val));
+               ti = proto_tree_add_string(fh_tree, hf_frame_protocols, tvb, 0, 0, wmem_strbuf_get_str(val));
+               PROTO_ITEM_SET_GENERATED(ti);
        }
 
        /*  Call postdissectors if we have any (while trying to avoid another
@@ -615,15 +711,59 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
                ENDTRY;
        }
 
+       /* Attempt to (re-)calculate color filters (if any). */
+       if (pinfo->fd->flags.need_colorize) {
+               color_filter = color_filters_colorize_packet(fr_data->color_edt);
+               pinfo->fd->color_filter = color_filter;
+               pinfo->fd->flags.need_colorize = 0;
+       } else {
+               color_filter = pinfo->fd->color_filter;
+       }
+       if (color_filter) {
+               item = proto_tree_add_string(fh_tree, hf_frame_color_filter_name, tvb,
+                                            0, 0, color_filter->filter_name);
+               PROTO_ITEM_SET_GENERATED(item);
+               item = proto_tree_add_string(fh_tree, hf_frame_color_filter_text, tvb,
+                                            0, 0, color_filter->filter_text);
+               PROTO_ITEM_SET_GENERATED(item);
+       }
+
        tap_queue_packet(frame_tap, pinfo, NULL);
 
 
        if (pinfo->frame_end_routines) {
-               g_slist_foreach(pinfo->frame_end_routines, &call_frame_end_routine, NULL);
-               g_slist_free(pinfo->frame_end_routines);
+               g_slist_free_full(pinfo->frame_end_routines, &call_frame_end_routine);
                pinfo->frame_end_routines = NULL;
        }
 
+       if (prefs.enable_incomplete_dissectors_check && tree && tree->tree_data->visible) {
+               gchar* decoded;
+               guint length;
+               guint i;
+               guint byte;
+               guint bit;
+
+               length = tvb_captured_length(tvb);
+               decoded = proto_find_undecoded_data(tree, length);
+
+               for (i = 0; i < length; i++) {
+                       byte = i / 8;
+                       bit = i % 8;
+                       if (!(decoded[byte] & (1 << bit))) {
+                               field_info* fi = proto_find_field_from_offset(tree, i, tvb);
+                               if (fi && fi->hfinfo->id != proto_frame) {
+                                       if (prefs.incomplete_dissectors_check_debug)
+                                               g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_WARNING,
+                                                       "Dissector %s incomplete in frame %u: undecoded byte number %u "
+                                                       "(0x%.4X+%u)",
+                                                       (fi ? fi->hfinfo->abbrev : "[unknown]"),
+                                                       pinfo->num, i, i - i % 16, i % 16);
+                                       proto_tree_add_expert_format(tree, pinfo, &ei_incomplete, tvb, i, 1, "Undecoded byte number: %u (0x%.4X+%u)", i, i - i % 16, i % 16);
+                               }
+                       }
+               }
+       }
+
        return tvb_captured_length(tvb);
 }
 
@@ -731,6 +871,16 @@ proto_register_frame(void)
                    FT_UINT32, BASE_DEC, NULL, 0x0,
                    NULL, HFILL }},
 
+               { &hf_frame_interface_name,
+                 { "Interface name", "frame.interface_name",
+                   FT_STRING, BASE_NONE, NULL, 0x0,
+                   "The friendly name for this interface", HFILL }},
+
+               { &hf_frame_interface_description,
+                 { "Interface description", "frame.interface_description",
+                   FT_STRING, BASE_NONE, NULL, 0x0,
+                   "The descriptionfor this interface", HFILL }},
+
                { &hf_frame_pack_flags,
                  { "Packet flags", "frame.packet_flags",
                    FT_UINT32, BASE_HEX, NULL, 0x0,
@@ -810,6 +960,7 @@ proto_register_frame(void)
 
        static gint *ett[] = {
                &ett_frame,
+               &ett_ifname,
                &ett_flags,
                &ett_comments
        };
@@ -817,6 +968,7 @@ proto_register_frame(void)
        static ei_register_info ei[] = {
                { &ei_comments_text, { "frame.comment.expert", PI_COMMENTS_GROUP, PI_COMMENT, "Formatted comment", EXPFILL }},
                { &ei_arrive_time_out_of_range, { "frame.time_invalid", PI_SEQUENCE, PI_NOTE, "Arrival Time: Fractional second out of range (0-1000000000)", EXPFILL }},
+               { &ei_incomplete, { "frame.incomplete", PI_UNDECODED, PI_NOTE, "Incomplete dissector", EXPFILL }}
        };
 
        module_t *frame_module;
@@ -827,7 +979,7 @@ proto_register_frame(void)
                value_string *arr;
                int i;
 
-               hf_encap.hfinfo.strings = arr = g_new(value_string, encap_count+1);
+               hf_encap.hfinfo.strings = arr = wmem_alloc_array(wmem_epan_scope(), value_string, encap_count+1);
 
                for (i = 0; i < encap_count; i++) {
                        arr[i].value = i;
@@ -837,24 +989,29 @@ proto_register_frame(void)
                arr[encap_count].strptr = NULL;
        }
 
-       wtap_encap_dissector_table = register_dissector_table("wtap_encap",
-           "Wiretap encapsulation type", FT_UINT32, BASE_DEC);
-       wtap_fts_rec_dissector_table = register_dissector_table("wtap_fts_rec",
-           "Wiretap file type for file-type-specific records", FT_UINT32, BASE_DEC);
-
        proto_frame = proto_register_protocol("Frame", "Frame", "frame");
-       proto_pkt_comment = proto_register_protocol("Packet comments", "Pkt_Comment", "pkt_comment");
+       proto_pkt_comment = proto_register_protocol_in_name_only("Packet comments", "Pkt_Comment", "pkt_comment", proto_frame, FT_PROTOCOL);
+       proto_syscall = proto_register_protocol("System Call", "Syscall", "syscall");
+
        proto_register_field_array(proto_frame, hf, array_length(hf));
        proto_register_field_array(proto_frame, &hf_encap, 1);
        proto_register_subtree_array(ett, array_length(ett));
        expert_frame = expert_register_protocol(proto_frame);
        expert_register_field_array(expert_frame, ei, array_length(ei));
-       new_register_dissector("frame",dissect_frame,proto_frame);
+       register_dissector("frame",dissect_frame,proto_frame);
+
+       wtap_encap_dissector_table = register_dissector_table("wtap_encap",
+           "Wiretap encapsulation type", proto_frame, FT_UINT32, BASE_DEC);
+       wtap_fts_rec_dissector_table = register_dissector_table("wtap_fts_rec",
+           "Wiretap file type for file-type-specific records", proto_frame, FT_UINT32, BASE_DEC);
+       register_capture_dissector_table("wtap_encap", "Wiretap encapsulation type");
 
        /* You can't disable dissection of "Frame", as that would be
           tantamount to not doing any dissection whatsoever. */
        proto_set_cant_toggle(proto_frame);
 
+       register_seq_analysis("any", "All Flows", proto_frame, NULL, TL_REQUIRES_COLUMNS, frame_seq_analysis_packet);
+
        /* Our preferences */
        frame_module = prefs_register_protocol(proto_frame, NULL);
        prefs_register_bool_preference(frame_module, "show_file_off",
@@ -873,6 +1030,10 @@ proto_register_frame(void)
            "Show the number of bits in the frame",
            "Whether or not the number of bits in the frame should be shown.",
            &generate_bits_field);
+       prefs_register_bool_preference(frame_module, "disable_packet_size_limited_in_summary",
+           "Disable 'packet size limited during capture' message in summary",
+           "Whether or not 'packet size limited during capture' message in shown in Info column.",
+           &disable_packet_size_limited_in_summary);
 
        frame_tap=register_tap("frame");
 }
@@ -880,8 +1041,8 @@ proto_register_frame(void)
 void
 proto_reg_handoff_frame(void)
 {
-       data_handle = find_dissector("data");
-       docsis_handle = find_dissector("docsis");
+       docsis_handle = find_dissector_add_dependency("docsis", proto_frame);
+       sysdig_handle = find_dissector_add_dependency("sysdig", proto_frame);
 }
 
 /*