aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-netlink-net_dm.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-netlink-net_dm.c')
-rw-r--r--epan/dissectors/packet-netlink-net_dm.c379
1 files changed, 214 insertions, 165 deletions
diff --git a/epan/dissectors/packet-netlink-net_dm.c b/epan/dissectors/packet-netlink-net_dm.c
index 4d2d77bf81..d206145dbb 100644
--- a/epan/dissectors/packet-netlink-net_dm.c
+++ b/epan/dissectors/packet-netlink-net_dm.c
@@ -21,8 +21,6 @@
* man 1 dropwatch
*/
-#define NEW_PROTO_TREE_API
-
#include "config.h"
#include <epan/packet.h>
@@ -70,6 +68,7 @@ enum ws_net_dm_attrs {
WS_NET_DM_ATTR_SW_DROPS,
WS_NET_DM_ATTR_HW_DROPS,
WS_NET_DM_ATTR_FLOW_ACTION_COOKIE,
+ WS_NET_DM_ATTR_REASON,
};
enum ws_net_dm_attrs_port {
@@ -96,22 +95,43 @@ struct netlink_net_dm_info {
guint16 protocol; /* protocol for packet payload */
};
-static int proto_netlink_net_dm = -1;
-
static dissector_handle_t netlink_net_dm_handle;
static dissector_table_t sll_ltype_table;
-
-static header_field_info *hfi_netlink_net_dm = NULL;
-
-#define NETLINK_NET_DM_HFI_INIT HFI_INIT(proto_netlink_net_dm)
-
-static gint ett_net_dm = -1;
-static gint ett_net_dm_attrs = -1;
-static gint ett_net_dm_attrs_in_port = -1;
-static gint ett_net_dm_attrs_stats = -1;
-static gint ett_net_dm_attrs_hw_stats = -1;
-static gint ett_net_dm_attrs_hw_entries = -1;
-static gint ett_net_dm_attrs_hw_entry = -1;
+static dissector_table_t ethertype_table;
+
+static int proto_netlink_net_dm;
+
+static int hf_net_dm_alert_mode;
+static int hf_net_dm_attrs;
+static int hf_net_dm_attrs_port;
+static int hf_net_dm_attrs_stats;
+static int hf_net_dm_commands;
+static int hf_net_dm_flow_action_cookie;
+static int hf_net_dm_hw;
+static int hf_net_dm_hw_trap_count;
+static int hf_net_dm_hw_trap_group_name;
+static int hf_net_dm_hw_trap_name;
+static int hf_net_dm_orig_len;
+static int hf_net_dm_origin;
+static int hf_net_dm_pc;
+static int hf_net_dm_port_netdev_index;
+static int hf_net_dm_port_netdev_name;
+static int hf_net_dm_proto;
+static int hf_net_dm_queue_len;
+static int hf_net_dm_stats_dropped;
+static int hf_net_dm_sw;
+static int hf_net_dm_symbol;
+static int hf_net_dm_timestamp;
+static int hf_net_dm_trunc_len;
+static int hf_net_dm_reason;
+
+static gint ett_net_dm;
+static gint ett_net_dm_attrs;
+static gint ett_net_dm_attrs_in_port;
+static gint ett_net_dm_attrs_stats;
+static gint ett_net_dm_attrs_hw_stats;
+static gint ett_net_dm_attrs_hw_entries;
+static gint ett_net_dm_attrs_hw_entry;
static const value_string ws_net_dm_commands_vals[] = {
{ WS_NET_DM_CMD_UNSPEC, "Unspecified command" },
@@ -153,6 +173,7 @@ static const value_string ws_net_dm_attrs_vals[] = {
{ WS_NET_DM_ATTR_SW_DROPS, "Software drops" },
{ WS_NET_DM_ATTR_HW_DROPS, "Hardware drops" },
{ WS_NET_DM_ATTR_FLOW_ACTION_COOKIE, "Flow action cookie" },
+ { WS_NET_DM_ATTR_REASON, "Reason" },
{ 0, NULL },
};
@@ -181,94 +202,6 @@ static const value_string ws_net_dm_origin_vals[] = {
{ 0, NULL },
};
-static header_field_info hfi_net_dm_commands NETLINK_NET_DM_HFI_INIT =
- { "Command", "net_dm.cmd", FT_UINT8, BASE_DEC | BASE_EXT_STRING,
- &ws_net_dm_commands_vals_ext, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_attrs NETLINK_NET_DM_HFI_INIT =
- { "Attribute type", "net_dm.attr_type", FT_UINT16, BASE_DEC | BASE_EXT_STRING,
- &ws_net_dm_attrs_vals_ext, NLA_TYPE_MASK, NULL, HFILL };
-
-static header_field_info hfi_net_dm_alert_mode NETLINK_NET_DM_HFI_INIT =
- { "Alert mode", "net_dm.alert_mode", FT_UINT8, BASE_DEC,
- VALS(ws_net_dm_alert_mode_vals), 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_pc NETLINK_NET_DM_HFI_INIT =
- { "Program counter", "net_dm.pc", FT_UINT64, BASE_HEX,
- NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_symbol NETLINK_NET_DM_HFI_INIT =
- { "Symbol", "net_dm.symbol", FT_STRINGZ, STR_ASCII,
- NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_attrs_port NETLINK_NET_DM_HFI_INIT =
- { "Attribute type", "net_dm.port.attr_type", FT_UINT16, BASE_DEC,
- VALS(ws_net_dm_attrs_port_vals), NLA_TYPE_MASK, NULL, HFILL };
-
-static header_field_info hfi_net_dm_timestamp NETLINK_NET_DM_HFI_INIT =
- { "Timestamp", "net_dm.timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
- NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_proto NETLINK_NET_DM_HFI_INIT =
- { "Protocol", "net_dm.proto", FT_UINT16, BASE_HEX,
- NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_trunc_len NETLINK_NET_DM_HFI_INIT =
- { "Truncation length", "net_dm.trunc_len", FT_UINT32, BASE_DEC,
- NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_orig_len NETLINK_NET_DM_HFI_INIT =
- { "Original length", "net_dm.orig_len", FT_UINT32, BASE_DEC,
- NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_queue_len NETLINK_NET_DM_HFI_INIT =
- { "Queue length", "net_dm.queue_len", FT_UINT32, BASE_DEC,
- NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_attrs_stats NETLINK_NET_DM_HFI_INIT =
- { "Attribute type", "net_dm.stats.attr_type", FT_UINT16, BASE_DEC,
- VALS(ws_net_dm_attrs_stats_vals), NLA_TYPE_MASK, NULL, HFILL };
-
-static header_field_info hfi_net_dm_origin NETLINK_NET_DM_HFI_INIT =
- { "Packet origin", "net_dm.origin", FT_UINT16, BASE_DEC,
- VALS(ws_net_dm_origin_vals), 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_hw_trap_group_name NETLINK_NET_DM_HFI_INIT =
- { "Hardware trap group name", "net_dm.hw_trap_group_name", FT_STRINGZ,
- STR_ASCII, NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_hw_trap_name NETLINK_NET_DM_HFI_INIT =
- { "Hardware trap name", "net_dm.hw_trap_name", FT_STRINGZ,
- STR_ASCII, NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_hw_trap_count NETLINK_NET_DM_HFI_INIT =
- { "Hardware trap count", "net_dm.hw_trap_count", FT_UINT32, BASE_DEC,
- NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_sw NETLINK_NET_DM_HFI_INIT =
- { "Software", "net_dm.sw", FT_NONE, BASE_NONE, NULL, 0x00, NULL,
- HFILL };
-
-static header_field_info hfi_net_dm_hw NETLINK_NET_DM_HFI_INIT =
- { "Hardware", "net_dm.hw", FT_NONE, BASE_NONE, NULL, 0x00, NULL,
- HFILL };
-
-static header_field_info hfi_net_dm_port_netdev_index NETLINK_NET_DM_HFI_INIT =
- { "Port net device index", "net_dm.port.netdev_index", FT_UINT32, BASE_DEC,
- NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_port_netdev_name NETLINK_NET_DM_HFI_INIT =
- { "Port net device name", "net_dm.port.netdev_name", FT_STRINGZ, STR_ASCII,
- NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_stats_dropped NETLINK_NET_DM_HFI_INIT =
- { "Dropped", "net_dm.stats.dropped", FT_UINT64, BASE_DEC,
- NULL, 0x00, NULL, HFILL };
-
-static header_field_info hfi_net_dm_flow_action_cookie NETLINK_NET_DM_HFI_INIT =
- { "Flow action cookie", "net_dm.cookie", FT_BYTES, BASE_NONE,
- NULL, 0x00, NULL, HFILL };
-
static int
dissect_net_dm_attrs_port(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
@@ -278,11 +211,11 @@ dissect_net_dm_attrs_port(tvbuff_t *tvb, void *data _U_, struct packet_netlink_d
switch (type) {
case WS_NET_DM_ATTR_PORT_NETDEV_IFINDEX:
- proto_tree_add_item_ret_uint(tree, &hfi_net_dm_port_netdev_index, tvb, offset, len, nl_data->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, hf_net_dm_port_netdev_index, tvb, offset, len, nl_data->encoding, &value);
proto_item_append_text(tree, ": %u", value);
return 1;
case WS_NET_DM_ATTR_PORT_NETDEV_NAME:
- proto_tree_add_item_ret_string(tree, &hfi_net_dm_port_netdev_name, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
+ proto_tree_add_item_ret_string(tree, hf_net_dm_port_netdev_name, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
proto_item_append_text(tree, ": %s", str);
return 1;
default:
@@ -297,7 +230,7 @@ dissect_net_dm_attrs_stats(tvbuff_t *tvb, void *data _U_, struct packet_netlink_
switch (type) {
case WS_NET_DM_ATTR_STATS_DROPPED:
- proto_tree_add_item(tree, &hfi_net_dm_stats_dropped, tvb, offset, len, nl_data->encoding);
+ proto_tree_add_item(tree, hf_net_dm_stats_dropped, tvb, offset, len, nl_data->encoding);
return 1;
default:
return 0;
@@ -312,93 +245,119 @@ dissect_net_dm_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_d
guint64 pc, timestamp;
nstime_t ts_nstime;
guint32 value;
+ guint16 protocol;
+ static dissector_table_t dissector_table;
tvbuff_t *next_tvb;
const guint8 *str;
switch (type) {
case WS_NET_DM_ATTR_ALERT_MODE:
- proto_tree_add_item(tree, &hfi_net_dm_alert_mode, tvb, offset, len, nl_data->encoding);
+ proto_tree_add_item(tree, hf_net_dm_alert_mode, tvb, offset, len, nl_data->encoding);
return 1;
case WS_NET_DM_ATTR_PC:
- proto_tree_add_item_ret_uint64(tree, &hfi_net_dm_pc, tvb,
+ proto_tree_add_item_ret_uint64(tree, hf_net_dm_pc, tvb,
offset, 8, nl_data->encoding, &pc);
- proto_item_append_text(tree, ": 0x%" G_GINT64_MODIFIER "x", pc);
+ proto_item_append_text(tree, ": 0x%" PRIx64, pc);
return 1;
case WS_NET_DM_ATTR_SYMBOL:
- proto_tree_add_item_ret_string(tree, &hfi_net_dm_symbol, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
+ proto_tree_add_item_ret_string(tree, hf_net_dm_symbol, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
proto_item_append_text(tree, ": %s", str);
return 1;
case WS_NET_DM_ATTR_IN_PORT:
- return dissect_netlink_attributes(tvb, &hfi_net_dm_attrs_port, ett_net_dm_attrs_in_port, info, nl_data, tree, offset, len,
+ return dissect_netlink_attributes(tvb, hf_net_dm_attrs_port, ett_net_dm_attrs_in_port, info, nl_data, tree, offset, len,
dissect_net_dm_attrs_port);
case WS_NET_DM_ATTR_TIMESTAMP:
timestamp = tvb_get_guint64(tvb, offset, nl_data->encoding);
ts_nstime.secs = timestamp / 1000000000;
ts_nstime.nsecs = timestamp % 1000000000;
- proto_tree_add_time(tree, &hfi_net_dm_timestamp, tvb, offset, 8, &ts_nstime);
+ proto_tree_add_time(tree, hf_net_dm_timestamp, tvb, offset, 8, &ts_nstime);
return 1;
case WS_NET_DM_ATTR_PROTO:
info->protocol = tvb_get_guint16(tvb, offset, nl_data->encoding);
+
+ proto_tree_add_item(tree, hf_net_dm_proto, tvb, offset, len, nl_data->encoding);
+ return 1;
+ case WS_NET_DM_ATTR_PAYLOAD:
+ /* This whole payload protocol thing is messed up:
+ * We can't know from the kernel netlink message what we get exacly
+ */
+ protocol = info->protocol;
+ dissector_table = sll_ltype_table;
/* This attribute encodes 'skb->protocol' and if it is greater
* than or equal to 1536 (0x0600), then it is an Ethertype and
* we need to treat the packet as Ethernet.
*/
- if (info->protocol >= 1536 || info->protocol == LINUX_SLL_P_802_2)
- info->protocol = LINUX_SLL_P_ETHERNET;
- proto_tree_add_item(tree, &hfi_net_dm_proto, tvb, offset, len, nl_data->encoding);
- return 1;
- case WS_NET_DM_ATTR_PAYLOAD:
+ if (info->protocol >= 1536 || info->protocol == LINUX_SLL_P_802_2) {
+ /* It might be ethernet, but we're not really sure what the packet actually is.
+ * We try a guess: if two bytes 12-14 match the Ethertype, then it's ethernet,
+ * otherwise we just assume that we have is a payload of the Ethertype itself.
+ * (this is not a perfect match, but in practice gives good enough results)
+ *
+ * If it's too short to be Ethernet, then for sure we don't have an Ethernet payload.
+ */
+ if (len >= 14 && tvb_get_guint16(tvb, offset + 12, ENC_BIG_ENDIAN) == info->protocol) {
+ protocol = LINUX_SLL_P_ETHERNET;
+ } else {
+ dissector_table = ethertype_table;
+ }
+ }
+
+
next_tvb = tvb_new_subset_length(tvb, offset, len);
- if (!dissector_try_uint(sll_ltype_table, info->protocol, next_tvb, info->pinfo, tree))
+ if (!dissector_try_uint(dissector_table, protocol, next_tvb, info->pinfo, tree))
call_data_dissector(next_tvb, info->pinfo, tree);
return 1;
case WS_NET_DM_ATTR_TRUNC_LEN:
- proto_tree_add_item_ret_uint(tree, &hfi_net_dm_trunc_len, tvb, offset, len, nl_data->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, hf_net_dm_trunc_len, tvb, offset, len, nl_data->encoding, &value);
proto_item_append_text(tree, ": %u", value);
return 1;
case WS_NET_DM_ATTR_ORIG_LEN:
- proto_tree_add_item_ret_uint(tree, &hfi_net_dm_orig_len, tvb, offset, len, nl_data->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, hf_net_dm_orig_len, tvb, offset, len, nl_data->encoding, &value);
proto_item_append_text(tree, ": %u", value);
return 1;
case WS_NET_DM_ATTR_QUEUE_LEN:
- proto_tree_add_item_ret_uint(tree, &hfi_net_dm_queue_len, tvb, offset, len, nl_data->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, hf_net_dm_queue_len, tvb, offset, len, nl_data->encoding, &value);
proto_item_append_text(tree, ": %u", value);
return 1;
case WS_NET_DM_ATTR_STATS:
- return dissect_netlink_attributes(tvb, &hfi_net_dm_attrs_stats, ett_net_dm_attrs_stats, info, nl_data, tree, offset, len,
+ return dissect_netlink_attributes(tvb, hf_net_dm_attrs_stats, ett_net_dm_attrs_stats, info, nl_data, tree, offset, len,
dissect_net_dm_attrs_stats);
case WS_NET_DM_ATTR_HW_STATS:
- return dissect_netlink_attributes(tvb, &hfi_net_dm_attrs_stats, ett_net_dm_attrs_hw_stats, info, nl_data, tree, offset, len,
+ return dissect_netlink_attributes(tvb, hf_net_dm_attrs_stats, ett_net_dm_attrs_hw_stats, info, nl_data, tree, offset, len,
dissect_net_dm_attrs_stats);
case WS_NET_DM_ATTR_ORIGIN:
- proto_tree_add_item(tree, &hfi_net_dm_origin, tvb, offset, len, nl_data->encoding);
+ proto_tree_add_item(tree, hf_net_dm_origin, tvb, offset, len, nl_data->encoding);
return 1;
case WS_NET_DM_ATTR_HW_TRAP_GROUP_NAME:
- proto_tree_add_item_ret_string(tree, &hfi_net_dm_hw_trap_group_name, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
+ proto_tree_add_item_ret_string(tree, hf_net_dm_hw_trap_group_name, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
proto_item_append_text(tree, ": %s", str);
return 1;
case WS_NET_DM_ATTR_HW_TRAP_NAME:
- proto_tree_add_item_ret_string(tree, &hfi_net_dm_hw_trap_name, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
+ proto_tree_add_item_ret_string(tree, hf_net_dm_hw_trap_name, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
proto_item_append_text(tree, ": %s", str);
return 1;
case WS_NET_DM_ATTR_HW_ENTRIES:
- return dissect_netlink_attributes(tvb, &hfi_net_dm_attrs, ett_net_dm_attrs_hw_entries, info, nl_data, tree, offset, len,
+ return dissect_netlink_attributes(tvb, hf_net_dm_attrs, ett_net_dm_attrs_hw_entries, info, nl_data, tree, offset, len,
dissect_net_dm_attrs);
case WS_NET_DM_ATTR_HW_ENTRY:
- return dissect_netlink_attributes(tvb, &hfi_net_dm_attrs, ett_net_dm_attrs_hw_entry, info, nl_data, tree, offset, len,
+ return dissect_netlink_attributes(tvb, hf_net_dm_attrs, ett_net_dm_attrs_hw_entry, info, nl_data, tree, offset, len,
dissect_net_dm_attrs);
case WS_NET_DM_ATTR_HW_TRAP_COUNT:
- proto_tree_add_item_ret_uint(tree, &hfi_net_dm_hw_trap_count, tvb, offset, len, nl_data->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, hf_net_dm_hw_trap_count, tvb, offset, len, nl_data->encoding, &value);
proto_item_append_text(tree, ": %u", value);
return 1;
case WS_NET_DM_ATTR_SW_DROPS:
- proto_tree_add_item(tree, &hfi_net_dm_sw, tvb, offset, len, nl_data->encoding);
+ proto_tree_add_item(tree, hf_net_dm_sw, tvb, offset, len, nl_data->encoding);
return 1;
case WS_NET_DM_ATTR_HW_DROPS:
- proto_tree_add_item(tree, &hfi_net_dm_hw, tvb, offset, len, nl_data->encoding);
+ proto_tree_add_item(tree, hf_net_dm_hw, tvb, offset, len, nl_data->encoding);
return 1;
case WS_NET_DM_ATTR_FLOW_ACTION_COOKIE:
- proto_tree_add_item(tree, &hfi_net_dm_flow_action_cookie, tvb, offset, len, ENC_NA);
+ proto_tree_add_item(tree, hf_net_dm_flow_action_cookie, tvb, offset, len, ENC_NA);
+ return 1;
+ case WS_NET_DM_ATTR_REASON:
+ proto_tree_add_item_ret_string(tree, hf_net_dm_reason, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
+ proto_item_append_text(tree, ": %s", str);
return 1;
default:
return 0;
@@ -420,20 +379,20 @@ dissect_netlink_net_dm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
col_clear(pinfo->cinfo, COL_INFO);
/* Generic netlink header */
- offset = dissect_genl_header(tvb, genl_info, genl_info->nl_data, &hfi_net_dm_commands);
+ offset = dissect_genl_header(tvb, genl_info, genl_info->nl_data, hf_net_dm_commands);
/* Not all commands have a payload */
if (!tvb_reported_length_remaining(tvb, offset))
/* XXX If you do not set the protocol item, you cannot filter on these messages */
return offset;
- pi = proto_tree_add_item(tree, proto_registrar_get_nth(proto_netlink_net_dm), tvb, offset, -1, ENC_NA);
+ pi = proto_tree_add_item(tree, proto_netlink_net_dm, tvb, offset, -1, ENC_NA);
nlmsg_tree = proto_item_add_subtree(pi, ett_net_dm);
info.pinfo = pinfo;
info.protocol = 0;
- offset = dissect_netlink_attributes_to_end(tvb, &hfi_net_dm_attrs, ett_net_dm_attrs, &info, genl_info->nl_data, nlmsg_tree, offset, dissect_net_dm_attrs);
+ offset = dissect_netlink_attributes_to_end(tvb, hf_net_dm_attrs, ett_net_dm_attrs, &info, genl_info->nl_data, nlmsg_tree, offset, dissect_net_dm_attrs);
return offset;
}
@@ -441,32 +400,123 @@ dissect_netlink_net_dm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
void
proto_register_netlink_net_dm(void)
{
-#ifndef HAVE_HFI_SECTION_INIT
- static header_field_info *hfi[] = {
- &hfi_net_dm_commands,
- &hfi_net_dm_attrs,
- &hfi_net_dm_alert_mode,
- &hfi_net_dm_pc,
- &hfi_net_dm_symbol,
- &hfi_net_dm_attrs_port,
- &hfi_net_dm_timestamp,
- &hfi_net_dm_proto,
- &hfi_net_dm_trunc_len,
- &hfi_net_dm_orig_len,
- &hfi_net_dm_queue_len,
- &hfi_net_dm_attrs_stats,
- &hfi_net_dm_origin,
- &hfi_net_dm_hw_trap_group_name,
- &hfi_net_dm_hw_trap_name,
- &hfi_net_dm_hw_trap_count,
- &hfi_net_dm_sw,
- &hfi_net_dm_hw,
- &hfi_net_dm_port_netdev_index,
- &hfi_net_dm_port_netdev_name,
- &hfi_net_dm_stats_dropped,
- &hfi_net_dm_flow_action_cookie,
+ static hf_register_info hf[] = {
+ { &hf_net_dm_commands,
+ { "Command", "net_dm.cmd",
+ FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ws_net_dm_commands_vals_ext, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_attrs,
+ { "Attribute type", "net_dm.attr_type",
+ FT_UINT16, BASE_DEC | BASE_EXT_STRING, &ws_net_dm_attrs_vals_ext, NLA_TYPE_MASK,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_alert_mode,
+ { "Alert mode", "net_dm.alert_mode",
+ FT_UINT8, BASE_DEC, VALS(ws_net_dm_alert_mode_vals), 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_pc,
+ { "Program counter", "net_dm.pc",
+ FT_UINT64, BASE_HEX, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_symbol,
+ { "Symbol", "net_dm.symbol",
+ FT_STRINGZ, BASE_NONE, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_attrs_port,
+ { "Attribute type", "net_dm.port.attr_type",
+ FT_UINT16, BASE_DEC, VALS(ws_net_dm_attrs_port_vals), NLA_TYPE_MASK,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_timestamp,
+ { "Timestamp", "net_dm.timestamp",
+ FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_proto,
+ { "Protocol", "net_dm.proto",
+ FT_UINT16, BASE_HEX, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_trunc_len,
+ { "Truncation length", "net_dm.trunc_len",
+ FT_UINT32, BASE_DEC, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_orig_len,
+ { "Original length", "net_dm.orig_len",
+ FT_UINT32, BASE_DEC, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_queue_len,
+ { "Queue length", "net_dm.queue_len",
+ FT_UINT32, BASE_DEC, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_attrs_stats,
+ { "Attribute type", "net_dm.stats.attr_type",
+ FT_UINT16, BASE_DEC, VALS(ws_net_dm_attrs_stats_vals), NLA_TYPE_MASK,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_origin,
+ { "Packet origin", "net_dm.origin",
+ FT_UINT16, BASE_DEC, VALS(ws_net_dm_origin_vals), 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_hw_trap_group_name,
+ { "Hardware trap group name", "net_dm.hw_trap_group_name",
+ FT_STRINGZ, BASE_NONE, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_hw_trap_name,
+ { "Hardware trap name", "net_dm.hw_trap_name",
+ FT_STRINGZ, BASE_NONE, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_hw_trap_count,
+ { "Hardware trap count", "net_dm.hw_trap_count",
+ FT_UINT32, BASE_DEC, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_sw,
+ { "Software", "net_dm.sw",
+ FT_NONE, BASE_NONE, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_hw,
+ { "Hardware", "net_dm.hw",
+ FT_NONE, BASE_NONE, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_port_netdev_index,
+ { "Port net device index", "net_dm.port.netdev_index",
+ FT_UINT32, BASE_DEC, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_port_netdev_name,
+ { "Port net device name", "net_dm.port.netdev_name",
+ FT_STRINGZ, BASE_NONE, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_stats_dropped,
+ { "Dropped", "net_dm.stats.dropped",
+ FT_UINT64, BASE_DEC, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_flow_action_cookie,
+ { "Flow action cookie", "net_dm.cookie",
+ FT_BYTES, BASE_NONE, NULL, 0x00,
+ NULL, HFILL }
+ },
+ { &hf_net_dm_reason,
+ { "Reason", "net_dm.reason",
+ FT_STRINGZ, BASE_NONE, NULL, 0x00,
+ NULL, HFILL }
+ },
};
-#endif
static gint *ett[] = {
&ett_net_dm,
@@ -479,12 +529,10 @@ proto_register_netlink_net_dm(void)
};
proto_netlink_net_dm = proto_register_protocol("Linux net_dm (network drop monitor) protocol", "net_dm", "net_dm");
- hfi_netlink_net_dm = proto_registrar_get_nth(proto_netlink_net_dm);
-
- proto_register_fields(proto_netlink_net_dm, hfi, array_length(hfi));
+ proto_register_field_array(proto_netlink_net_dm, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- netlink_net_dm_handle = create_dissector_handle(dissect_netlink_net_dm, proto_netlink_net_dm);
+ netlink_net_dm_handle = register_dissector("net_dm", dissect_netlink_net_dm, proto_netlink_net_dm);
}
void
@@ -492,6 +540,7 @@ proto_reg_handoff_netlink_net_dm(void)
{
dissector_add_string("genl.family", "NET_DM", netlink_net_dm_handle);
sll_ltype_table = find_dissector_table("sll.ltype");
+ ethertype_table = find_dissector_table("ethertype");
}
/*