aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2020-01-08 22:08:15 +0100
committerAnders Broman <a.broman58@gmail.com>2020-01-08 22:21:33 +0000
commitb553066a331f7f45447962f5cc32161db44308ea (patch)
tree99133dda1abb01af17a8c4282b15ddf3cee9f103
parent3b781dbab5f29928415951db5e8f7d740a615a3d (diff)
Netlink: remove encoding copies and, by extension, nl_data copies
The underlying netlink dissector sets up a data structure to help maintain information about the netlink packet. This contains the encoding information as determined for this packet. Use this value in place of the copy that every netlink dissector makes in its private data structure. As a consequence the encoding field can be removed from these private data structures. Since the encoding field is now directly available from the data structure setup by the underlying netlink dissector, the private data structures also do not need to keep a pointer to this underlying netlink dissector data structure. This change replaces the use of the local copy of encoding with the original one. This change, by extension, also removes the encoding field and the pointer to the underlying netlink dissector data structure as these are no longer needed. The exception is the generic netlink dissector, which implements the dynamic netlink famiily subdissector table. Change-Id: Ida0065379c19ae68caf6d87860828b48766c1998 Reviewed-on: https://code.wireshark.org/review/35698 Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-netlink-generic.c30
-rw-r--r--epan/dissectors/packet-netlink-net_dm.c48
-rw-r--r--epan/dissectors/packet-netlink-netfilter.c17
-rw-r--r--epan/dissectors/packet-netlink-nl80211.c24
-rw-r--r--epan/dissectors/packet-netlink-route.c102
-rw-r--r--epan/dissectors/packet-netlink-sock_diag.c91
-rw-r--r--epan/dissectors/packet-netlink.h1
7 files changed, 136 insertions, 177 deletions
diff --git a/epan/dissectors/packet-netlink-generic.c b/epan/dissectors/packet-netlink-generic.c
index 3bae9e0267..e8412a6d4d 100644
--- a/epan/dissectors/packet-netlink-generic.c
+++ b/epan/dissectors/packet-netlink-generic.c
@@ -32,9 +32,6 @@ void proto_register_netlink_generic(void);
void proto_reg_handoff_netlink_generic(void);
typedef struct {
- struct packet_netlink_data *nl_data;
- int encoding; /* copy of nl_data->encoding */
-
/* Values parsed from the attributes (only valid in this packet). */
guint16 family_id;
const guint8 *family_name;
@@ -182,10 +179,9 @@ static const int *genl_ctrl_op_flags_fields[] = {
};
static int
-dissect_genl_ctrl_ops_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int nla_type, int offset, int len)
+dissect_genl_ctrl_ops_attrs(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_genl_ctrl_op_attr type = (enum ws_genl_ctrl_op_attr) nla_type;
- genl_ctrl_info_t *info = (genl_ctrl_info_t *) data;
proto_tree *ptree = proto_tree_get_parent_tree(tree);
guint32 value;
@@ -194,7 +190,7 @@ dissect_genl_ctrl_ops_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_dat
break;
case WS_CTRL_ATTR_OP_ID:
if (len == 4) {
- proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_op_id, tvb, offset, 4, info->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_op_id, tvb, offset, 4, nl_data->encoding, &value);
proto_item_append_text(tree, ": %u", value);
proto_item_append_text(ptree, ", id=%u", value);
offset += 4;
@@ -205,7 +201,7 @@ dissect_genl_ctrl_ops_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_dat
guint64 op_flags;
/* XXX it would be nice if the flag names are appended to the tree */
proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, &hfi_genl_ctrl_op_flags,
- ett_genl_ctrl_op_flags, genl_ctrl_op_flags_fields, info->encoding, BMT_NO_FALSE, &op_flags);
+ ett_genl_ctrl_op_flags, genl_ctrl_op_flags_fields, nl_data->encoding, BMT_NO_FALSE, &op_flags);
proto_item_append_text(tree, ": 0x%08x", (guint32)op_flags);
proto_item_append_text(ptree, ", flags=0x%08x", (guint32)op_flags);
offset += 4;
@@ -226,10 +222,9 @@ static header_field_info hfi_genl_ctrl_group_id NETLINK_GENERIC_HFI_INIT =
NULL, 0x00, NULL, HFILL };
static int
-dissect_genl_ctrl_groups_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int nla_type, int offset, int len)
+dissect_genl_ctrl_groups_attrs(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_genl_ctrl_group_attr type = (enum ws_genl_ctrl_group_attr) nla_type;
- genl_ctrl_info_t *info = (genl_ctrl_info_t *) data;
proto_tree *ptree = proto_tree_get_parent_tree(tree);
guint32 value;
const guint8 *strval;
@@ -245,7 +240,7 @@ dissect_genl_ctrl_groups_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_
break;
case WS_CTRL_ATTR_MCAST_GRP_ID:
if (len == 4) {
- proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_group_id, tvb, offset, 4, info->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_group_id, tvb, offset, 4, nl_data->encoding, &value);
proto_item_append_text(tree, ": %u", value);
proto_item_append_text(ptree, ", id=%u", value);
offset += 4;
@@ -297,7 +292,7 @@ dissect_genl_ctrl_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *n
break;
case WS_CTRL_ATTR_FAMILY_ID:
if (len == 2) {
- proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_family_id, tvb, offset, 2, info->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_family_id, tvb, offset, 2, nl_data->encoding, &value);
proto_item_append_text(tree, ": %#x", value);
info->family_id = value;
offset += 2;
@@ -310,21 +305,21 @@ dissect_genl_ctrl_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *n
break;
case WS_CTRL_ATTR_VERSION:
if (len == 4) {
- proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_version, tvb, offset, 4, info->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_version, tvb, offset, 4, nl_data->encoding, &value);
proto_item_append_text(tree, ": %u", value);
offset += 4;
}
break;
case WS_CTRL_ATTR_HDRSIZE:
if (len == 4) {
- proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_hdrsize, tvb, offset, 4, info->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_hdrsize, tvb, offset, 4, nl_data->encoding, &value);
proto_item_append_text(tree, ": %u", value);
offset += 4;
}
break;
case WS_CTRL_ATTR_MAXATTR:
if (len == 4) {
- proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_maxattr, tvb, offset, 4, info->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_maxattr, tvb, offset, 4, nl_data->encoding, &value);
proto_item_append_text(tree, ": %u", value);
offset += 4;
}
@@ -359,8 +354,6 @@ dissect_genl_ctrl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, v
return 0;
}
- info.nl_data = genl_info->nl_data;
- info.encoding = genl_info->encoding;
info.family_id = 0;
info.family_name = NULL;
@@ -401,7 +394,7 @@ static header_field_info hfi_genl_reserved NETLINK_GENERIC_HFI_INIT =
{ "Reserved", "genl.reserved", FT_NONE, BASE_NONE,
NULL, 0x00, NULL, HFILL };
-int dissect_genl_header(tvbuff_t *tvb, genl_info_t *genl_info, struct packet_netlink_data *nl_data _U_, header_field_info *hfi_cmd)
+int dissect_genl_header(tvbuff_t *tvb, genl_info_t *genl_info, struct packet_netlink_data *nl_data, header_field_info *hfi_cmd)
{
int offset = 0;
@@ -412,7 +405,7 @@ int dissect_genl_header(tvbuff_t *tvb, genl_info_t *genl_info, struct packet_net
offset++;
proto_tree_add_item(genl_info->genl_tree, &hfi_genl_version, tvb, offset, 1, ENC_NA);
offset++;
- proto_tree_add_item(genl_info->genl_tree, &hfi_genl_reserved, tvb, offset, 2, genl_info->encoding);
+ proto_tree_add_item(genl_info->genl_tree, &hfi_genl_reserved, tvb, offset, 2, nl_data->encoding);
offset += 2;
return offset;
}
@@ -443,7 +436,6 @@ dissect_netlink_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
/* Populate info from Generic Netlink message header (genlmsghdr) */
info.nl_data = nl_data;
- info.encoding = nl_data->encoding;
info.genl_tree = nlmsg_tree;
info.cmd = tvb_get_guint8(tvb, offset);
diff --git a/epan/dissectors/packet-netlink-net_dm.c b/epan/dissectors/packet-netlink-net_dm.c
index 3cf062d96e..3b463b3350 100644
--- a/epan/dissectors/packet-netlink-net_dm.c
+++ b/epan/dissectors/packet-netlink-net_dm.c
@@ -92,8 +92,6 @@ enum ws_net_dm_origin {
struct netlink_net_dm_info {
packet_info *pinfo;
- struct packet_netlink_data *nl_data;
- int encoding; /* copy of nl_data->encoding */
guint16 protocol; /* protocol for packet payload */
};
@@ -266,16 +264,15 @@ static header_field_info hfi_net_dm_stats_dropped NETLINK_NET_DM_HFI_INIT =
NULL, 0x00, NULL, HFILL };
static int
-dissect_net_dm_attrs_port(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int nla_type, int offset, int len)
+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)
{
enum ws_net_dm_attrs_port type = (enum ws_net_dm_attrs_port) nla_type & NLA_TYPE_MASK;
- struct netlink_net_dm_info *info = (struct netlink_net_dm_info *) data;
const guint8 *str;
switch (type) {
case WS_NET_DM_ATTR_PORT_NETDEV_IFINDEX:
- proto_item_append_text(tree, ": %u", tvb_get_guint32(tvb, offset, info->encoding));
- proto_tree_add_item(tree, &hfi_net_dm_port_netdev_index, tvb, offset, len, info->encoding);
+ proto_item_append_text(tree, ": %u", tvb_get_guint32(tvb, offset, nl_data->encoding));
+ proto_tree_add_item(tree, &hfi_net_dm_port_netdev_index, tvb, offset, len, nl_data->encoding);
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);
@@ -287,14 +284,13 @@ dissect_net_dm_attrs_port(tvbuff_t *tvb, void *data, struct packet_netlink_data
}
static int
-dissect_net_dm_attrs_stats(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int nla_type, int offset, int len)
+dissect_net_dm_attrs_stats(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_net_dm_attrs_port type = (enum ws_net_dm_attrs_port) nla_type & NLA_TYPE_MASK;
- struct netlink_net_dm_info *info = (struct netlink_net_dm_info *) data;
switch (type) {
case WS_NET_DM_ATTR_STATS_DROPPED:
- proto_tree_add_item(tree, &hfi_net_dm_stats_dropped, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_net_dm_stats_dropped, tvb, offset, len, nl_data->encoding);
return 1;
default:
return 0;
@@ -313,11 +309,11 @@ dissect_net_dm_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_d
switch (type) {
case WS_NET_DM_ATTR_ALERT_MODE:
- proto_tree_add_item(tree, &hfi_net_dm_alert_mode, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_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.id, tvb,
- offset, 8, info->encoding, &pc);
+ offset, 8, nl_data->encoding, &pc);
proto_item_append_text(tree, ": 0x%" G_GINT64_MODIFIER "x", pc);
return 1;
case WS_NET_DM_ATTR_SYMBOL:
@@ -328,20 +324,20 @@ dissect_net_dm_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_d
return dissect_netlink_attributes(tvb, &hfi_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, info->encoding);
+ 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);
return 1;
case WS_NET_DM_ATTR_PROTO:
- info->protocol = tvb_get_guint16(tvb, offset, info->encoding);
+ info->protocol = tvb_get_guint16(tvb, offset, nl_data->encoding);
/* 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, info->encoding);
+ proto_tree_add_item(tree, &hfi_net_dm_proto, tvb, offset, len, nl_data->encoding);
return 1;
case WS_NET_DM_ATTR_PAYLOAD:
next_tvb = tvb_new_subset_length(tvb, offset, len);
@@ -349,16 +345,16 @@ dissect_net_dm_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_d
call_data_dissector(next_tvb, info->pinfo, tree);
return 1;
case WS_NET_DM_ATTR_TRUNC_LEN:
- proto_item_append_text(tree, ": %u", tvb_get_guint32(tvb, offset, info->encoding));
- proto_tree_add_item(tree, &hfi_net_dm_trunc_len, tvb, offset, len, info->encoding);
+ proto_item_append_text(tree, ": %u", tvb_get_guint32(tvb, offset, nl_data->encoding));
+ proto_tree_add_item(tree, &hfi_net_dm_trunc_len, tvb, offset, len, nl_data->encoding);
return 1;
case WS_NET_DM_ATTR_ORIG_LEN:
- proto_item_append_text(tree, ": %u", tvb_get_guint32(tvb, offset, info->encoding));
- proto_tree_add_item(tree, &hfi_net_dm_orig_len, tvb, offset, len, info->encoding);
+ proto_item_append_text(tree, ": %u", tvb_get_guint32(tvb, offset, nl_data->encoding));
+ proto_tree_add_item(tree, &hfi_net_dm_orig_len, tvb, offset, len, nl_data->encoding);
return 1;
case WS_NET_DM_ATTR_QUEUE_LEN:
- proto_item_append_text(tree, ": %u", tvb_get_guint32(tvb, offset, info->encoding));
- proto_tree_add_item(tree, &hfi_net_dm_queue_len, tvb, offset, len, info->encoding);
+ proto_item_append_text(tree, ": %u", tvb_get_guint32(tvb, offset, nl_data->encoding));
+ proto_tree_add_item(tree, &hfi_net_dm_queue_len, tvb, offset, len, nl_data->encoding);
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,
@@ -367,7 +363,7 @@ dissect_net_dm_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_d
return dissect_netlink_attributes(tvb, &hfi_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, info->encoding);
+ proto_tree_add_item(tree, &hfi_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);
@@ -384,14 +380,14 @@ dissect_net_dm_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_d
return dissect_netlink_attributes(tvb, &hfi_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_item_append_text(tree, ": %u", tvb_get_guint32(tvb, offset, info->encoding));
- proto_tree_add_item(tree, &hfi_net_dm_hw_trap_count, tvb, offset, len, info->encoding);
+ proto_item_append_text(tree, ": %u", tvb_get_guint32(tvb, offset, nl_data->encoding));
+ proto_tree_add_item(tree, &hfi_net_dm_hw_trap_count, tvb, offset, len, nl_data->encoding);
return 1;
case WS_NET_DM_ATTR_SW_DROPS:
- proto_tree_add_item(tree, &hfi_net_dm_sw, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_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, info->encoding);
+ proto_tree_add_item(tree, &hfi_net_dm_hw, tvb, offset, len, nl_data->encoding);
return 1;
default:
return 0;
@@ -422,9 +418,7 @@ dissect_netlink_net_dm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
pi = proto_tree_add_item(tree, proto_registrar_get_nth(proto_netlink_net_dm), tvb, offset, -1, ENC_NA);
nlmsg_tree = proto_item_add_subtree(pi, ett_net_dm);
- info.encoding = genl_info->encoding;
info.pinfo = pinfo;
- info.nl_data = genl_info->nl_data;
info.protocol = 0;
offset = dissect_netlink_attributes(tvb, &hfi_net_dm_attrs, ett_net_dm_attrs, &info, genl_info->nl_data, nlmsg_tree, offset, -1, dissect_net_dm_attrs);
diff --git a/epan/dissectors/packet-netlink-netfilter.c b/epan/dissectors/packet-netlink-netfilter.c
index 0658272b24..d59b87b5eb 100644
--- a/epan/dissectors/packet-netlink-netfilter.c
+++ b/epan/dissectors/packet-netlink-netfilter.c
@@ -21,10 +21,6 @@ void proto_reg_handoff_netlink_netfilter(void);
typedef struct {
packet_info *pinfo;
- struct packet_netlink_data *nl_data;
-
- int encoding; /* copy of nl_data->encoding */
-
guint16 hw_protocol; /* protocol for NFQUEUE packet payloads. */
} netlink_netfilter_info_t;
@@ -1085,10 +1081,9 @@ static header_field_info hfi_nfq_config_flags NETLINK_NETFILTER_HFI_INIT =
NULL, 0x00, NULL, HFILL };
static int
-dissect_nfq_config_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nfq_config_attrs(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_nfqnl_attr_config type = (enum ws_nfqnl_attr_config) nla_type;
- netlink_netfilter_info_t *info = (netlink_netfilter_info_t *) data;
switch (type) {
case WS_NFQA_CFG_UNSPEC:
@@ -1116,21 +1111,21 @@ dissect_nfq_config_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *
case WS_NFQA_CFG_QUEUE_MAXLEN:
if (len == 4) {
- proto_tree_add_item(tree, &hfi_nfq_config_queue_maxlen, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_nfq_config_queue_maxlen, tvb, offset, 4, nl_data->encoding);
offset += 4;
}
break;
case WS_NFQA_CFG_MASK:
if (len == 4) {
- proto_tree_add_item(tree, &hfi_nfq_config_mask, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_nfq_config_mask, tvb, offset, 4, nl_data->encoding);
offset += 4;
}
break;
case WS_NFQA_CFG_FLAGS:
if (len == 4) {
- proto_tree_add_item(tree, &hfi_nfq_config_flags, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_nfq_config_flags, tvb, offset, 4, nl_data->encoding);
offset += 4;
}
break;
@@ -1474,7 +1469,7 @@ static header_field_info hfi_netlink_netfilter_ulog_type NETLINK_NETFILTER_HFI_I
VALS(netlink_netfilter_ulog_type_vals), 0x00FF, NULL, HFILL };
static int
-dissect_netfilter_ulog(tvbuff_t *tvb, netlink_netfilter_info_t *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
+dissect_netfilter_ulog(tvbuff_t *tvb, netlink_netfilter_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
enum ws_nfulnl_msg_types type = (enum ws_nfulnl_msg_types) (nl_data->type & 0xff);
tvbuff_t *next_tvb;
@@ -1906,9 +1901,7 @@ dissect_netlink_netfilter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
break;
}
- info.encoding = nl_data->encoding;
info.pinfo = pinfo;
- info.nl_data = nl_data;
info.hw_protocol = 0;
switch (nl_data->type >> 8) {
diff --git a/epan/dissectors/packet-netlink-nl80211.c b/epan/dissectors/packet-netlink-nl80211.c
index 9529f01345..57e5a0f09a 100644
--- a/epan/dissectors/packet-netlink-nl80211.c
+++ b/epan/dissectors/packet-netlink-nl80211.c
@@ -24,9 +24,6 @@ void proto_reg_handoff_netlink_nl80211(void);
typedef struct {
packet_info *pinfo;
- struct packet_netlink_data *nl_data;
-
- int encoding; /* copy of nl_data->encoding */
} netlink_nl80211_info_t;
static dissector_handle_t ieee80211_handle;
@@ -3737,9 +3734,8 @@ static header_field_info hfi_nl80211_dbm NETLINK_NL80211_HFI_INIT =
NULL, 0x00, NULL, HFILL };
static int
-dissect_nl80211_generic(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int nla_type _U_, int offset, int len)
+dissect_nl80211_generic(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type _U_, int offset, int len)
{
- netlink_nl80211_info_t *info = (netlink_nl80211_info_t *)data;
/*
* No specific dissection available, apply arbitrary heuristics to
* determine whether we have an u16 or u32 field and treat others as
@@ -3747,13 +3743,13 @@ dissect_nl80211_generic(tvbuff_t *tvb, void *data, struct packet_netlink_data *n
*/
if (len) {
if (len == 2) {
- proto_tree_add_item(tree, &hfi_nl80211_attr_value16, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_nl80211_attr_value16, tvb, offset, len, nl_data->encoding);
} else if (len == 4) {
- proto_tree_add_item(tree, &hfi_nl80211_attr_value32, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_nl80211_attr_value32, tvb, offset, len, nl_data->encoding);
} else if (len == 8) {
- proto_tree_add_item(tree, &hfi_nl80211_attr_value64, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_nl80211_attr_value64, tvb, offset, len, nl_data->encoding);
} else {
- proto_tree_add_item(tree, &hfi_nl80211_attr_value, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_nl80211_attr_value, tvb, offset, len, nl_data->encoding);
}
offset += len;
}
@@ -3802,14 +3798,13 @@ dissect_nested_attr_array(tvbuff_t *tvb, void *data, struct packet_netlink_data
}
static int
-dissect_value(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int nla_type, int offset, int len, const struct attr_lookup *values)
+dissect_value(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len, const struct attr_lookup *values)
{
- netlink_nl80211_info_t *info = (netlink_nl80211_info_t *)data;
for (int i = 0; values[i].hfi; i++) {
if (values[i].attr_type != (nla_type & NLA_TYPE_MASK)) {
continue;
}
- proto_tree_add_item(tree, values[i].hfi, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, values[i].hfi, tvb, offset, len, nl_data->encoding);
return offset + len;
}
return offset;
@@ -3965,14 +3960,13 @@ dissect_nl80211_sta_info(tvbuff_t *tvb, void *data, struct packet_netlink_data *
offset = dissect_nested_attr_array(tvb, data, nl_data, tree, nla_type, offset, len, nested_arr);
}
if (offset < offset_end) {
- netlink_nl80211_info_t *info = (netlink_nl80211_info_t *)data;
switch (type) {
case WS_NL80211_STA_INFO_SIGNAL:
case WS_NL80211_STA_INFO_SIGNAL_AVG:
case WS_NL80211_STA_INFO_BEACON_SIGNAL_AVG:
case WS_NL80211_STA_INFO_ACK_SIGNAL:
case WS_NL80211_STA_INFO_ACK_SIGNAL_AVG:
- proto_tree_add_item(tree, &hfi_nl80211_dbm, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_nl80211_dbm, tvb, offset, len, nl_data->encoding);
offset += len;
break;
default:
@@ -4122,8 +4116,6 @@ dissect_netlink_nl80211(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
if (!tvb_reported_length_remaining(tvb, offset))
return offset;
- info.nl_data = genl_info->nl_data;
- info.encoding = genl_info->encoding;
info.pinfo = pinfo;
pi = proto_tree_add_item(tree, proto_registrar_get_nth(proto_netlink_nl80211), tvb, offset, -1, ENC_NA);
diff --git a/epan/dissectors/packet-netlink-route.c b/epan/dissectors/packet-netlink-route.c
index ac463ac5dd..9c9d5695c7 100644
--- a/epan/dissectors/packet-netlink-route.c
+++ b/epan/dissectors/packet-netlink-route.c
@@ -25,9 +25,6 @@ void proto_reg_handoff_netlink_route(void);
struct netlink_route_info {
packet_info *pinfo;
- struct packet_netlink_data *nl_data;
-
- int encoding; /* copy of nl_data->encoding */
gboolean legacy;
};
@@ -438,12 +435,12 @@ static header_field_info hfi_netlink_route_ifi_change NETLINK_ROUTE_HFI_INIT =
static int
-dissect_netlink_route_ifinfomsg(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
+dissect_netlink_route_ifinfomsg(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
proto_item *ti;
proto_tree *if_flags_tree;
- proto_tree_add_item(tree, &hfi_netlink_route_ifi_family, tvb, offset, 1, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifi_family, tvb, offset, 1, nl_data->encoding);
offset += 1;
if (info->legacy)
@@ -452,23 +449,23 @@ dissect_netlink_route_ifinfomsg(tvbuff_t *tvb, struct netlink_route_info *info,
/* XXX padding, check if 0 */
offset += 1;
- proto_tree_add_item(tree, &hfi_netlink_route_ifi_type, tvb, offset, 2, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifi_type, tvb, offset, 2, nl_data->encoding);
offset += 2;
- proto_tree_add_item(tree, &hfi_netlink_route_ifi_index, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifi_index, tvb, offset, 4, nl_data->encoding);
offset += 4;
- ti = proto_tree_add_item(tree, &hfi_netlink_route_ifi_flags, tvb, offset, 4, info->encoding);
+ ti = proto_tree_add_item(tree, &hfi_netlink_route_ifi_flags, tvb, offset, 4, nl_data->encoding);
if_flags_tree = proto_item_add_subtree(ti, ett_netlink_route_if_flags);
if (if_flags_tree) {
- proto_tree_add_item(if_flags_tree, &hfi_netlink_route_ifi_flags_iff_up, tvb, offset, 4, info->encoding);
- proto_tree_add_item(if_flags_tree, &hfi_netlink_route_ifi_flags_iff_broadcast, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(if_flags_tree, &hfi_netlink_route_ifi_flags_iff_up, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(if_flags_tree, &hfi_netlink_route_ifi_flags_iff_broadcast, tvb, offset, 4, nl_data->encoding);
/* XXX */
}
offset += 4;
- proto_tree_add_item(tree, &hfi_netlink_route_ifi_change, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifi_change, tvb, offset, 4, nl_data->encoding);
offset += 4;
return offset;
@@ -768,26 +765,27 @@ static header_field_info* linkstat_txerr_hfis[] = {
};
static int
-dissect_netlink_route_ifla_linkstats(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset, int byte_size) {
+dissect_netlink_route_ifla_linkstats(tvbuff_t *tvb, struct netlink_route_info *info _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int offset, int byte_size)
+{
proto_tree* rxerr_subtree;
const gint rxerr_hfis_len = (sizeof(linkstat_rxerr_hfis) / sizeof(header_field_info*));
proto_tree* txerr_subtree;
const gint txerr_hfis_len = (sizeof(linkstat_txerr_hfis) / sizeof(header_field_info*));
for (size_t i = 0; i < (sizeof(linkstat_root_hfis) / sizeof(header_field_info*)); i++) {
- proto_tree_add_item(tree, linkstat_root_hfis[i], tvb, offset, byte_size, info->encoding);
+ proto_tree_add_item(tree, linkstat_root_hfis[i], tvb, offset, byte_size, nl_data->encoding);
offset += byte_size;
}
rxerr_subtree = proto_tree_add_subtree(tree, tvb, offset, byte_size * rxerr_hfis_len, ett_netlink_route_attr_linkstats_rxerrs, NULL, "Rx errors");
for (gint i = 0; i < rxerr_hfis_len; i++) {
- proto_tree_add_item(rxerr_subtree, linkstat_rxerr_hfis[i], tvb, offset, byte_size, info->encoding);
+ proto_tree_add_item(rxerr_subtree, linkstat_rxerr_hfis[i], tvb, offset, byte_size, nl_data->encoding);
offset += byte_size;
}
txerr_subtree = proto_tree_add_subtree(tree, tvb, offset, byte_size * txerr_hfis_len, ett_netlink_route_attr_linkstats_txerrs, NULL, "Tx errors");
for (gint i = 0; i < txerr_hfis_len; i++) {
- proto_tree_add_item(txerr_subtree, linkstat_txerr_hfis[i], tvb, offset, byte_size, info->encoding);
+ proto_tree_add_item(txerr_subtree, linkstat_txerr_hfis[i], tvb, offset, byte_size, nl_data->encoding);
offset += byte_size;
}
@@ -809,54 +807,54 @@ dissect_netlink_route_ifla_attrs(tvbuff_t *tvb, void *data, struct packet_netlin
return 1;
case WS_IFLA_MTU:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_mtu, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_mtu, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_TXQLEN:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_txqlen, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_txqlen, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_OPERSTATE:
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_operstate, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_operstate, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_PROMISCUITY:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_promiscuity, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_promiscuity, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_NUM_TX_QUEUES:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_txqnum, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_txqnum, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_NUM_RX_QUEUES:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_rxqnum, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_rxqnum, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_GROUP:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_group, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_group, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_GSO_MAX_SEGS:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_gso_maxsegs, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_gso_maxsegs, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_GSO_MAX_SIZE:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_gso_maxsize, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_gso_maxsize, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_CARRIER:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_carrier, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_carrier, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_CARRIER_CHANGES:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_carrier_changes, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_carrier_changes, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_ADDRESS:
proto_item_append_text(tree, ": %s", tvb_bytes_to_str_punct(wmem_packet_scope(), tvb, offset, len, ':'));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_hwaddr, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_hwaddr, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_BROADCAST:
proto_item_append_text(tree, ": %s", tvb_bytes_to_str_punct(wmem_packet_scope(), tvb, offset, len, ':'));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_broadcast, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_broadcast, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_STATS:
subtree = proto_tree_add_subtree(tree, tvb, offset, len, ett_netlink_route_attr_linkstats, NULL, "Statistics");
@@ -869,28 +867,28 @@ dissect_netlink_route_ifla_attrs(tvbuff_t *tvb, void *data, struct packet_netlin
proto_item_append_text(tree, ": %s", str);
return 1;
case WS_IFLA_MAP:
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_map_memstart, tvb, offset, 8, info->encoding);
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_map_memend, tvb, offset + 8, 8, info->encoding);
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_map_baseaddr, tvb, offset + 16, 8, info->encoding);
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_map_irq, tvb, offset + 24, 2, info->encoding);
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_map_dma, tvb, offset + 26, 1, info->encoding);
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_map_port, tvb, offset + 27, 1, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_map_memstart, tvb, offset, 8, nl_data->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_map_memend, tvb, offset + 8, 8, nl_data->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_map_baseaddr, tvb, offset + 16, 8, nl_data->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_map_irq, tvb, offset + 24, 2, nl_data->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_map_dma, tvb, offset + 26, 1, nl_data->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_map_port, tvb, offset + 27, 1, nl_data->encoding);
return 1;
case WS_IFLA_CARRIER_UP_COUNT:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_carrier_up_count, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_carrier_up_count, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_CARRIER_DOWN_COUNT:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_carrier_down_count, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_carrier_down_count, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_MIN_MTU:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_min_mtu, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_min_mtu, tvb, offset, len, nl_data->encoding);
return 1;
case WS_IFLA_MAX_MTU:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_ifla_max_mtu, tvb, offset, len, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifla_max_mtu, tvb, offset, len, nl_data->encoding);
return 1;
default:
@@ -948,7 +946,7 @@ static header_field_info hfi_netlink_route_ifa_index NETLINK_ROUTE_HFI_INIT =
NULL, 0x00, NULL, HFILL };
static int
-dissect_netlink_route_ifaddrmsg(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
+dissect_netlink_route_ifaddrmsg(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
proto_tree_add_item(tree, &hfi_netlink_route_ifa_family, tvb, offset, 1, ENC_NA);
offset += 1;
@@ -965,7 +963,7 @@ dissect_netlink_route_ifaddrmsg(tvbuff_t *tvb, struct netlink_route_info *info,
proto_tree_add_item(tree, &hfi_netlink_route_ifa_scope, tvb, offset, 1, ENC_NA);
offset += 1;
- proto_tree_add_item(tree, &hfi_netlink_route_ifa_index, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifa_index, tvb, offset, 4, nl_data->encoding);
offset += 4;
return offset;
@@ -1009,9 +1007,8 @@ static header_field_info hfi_netlink_route_ifa_addr4 NETLINK_ROUTE_HFI_INIT =
NULL, 0x00, NULL, HFILL };
static int
-dissect_netlink_route_ifa_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int rta_type, int offset, int len)
+dissect_netlink_route_ifa_attrs(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int rta_type, int offset, int len)
{
- struct netlink_route_info *info = (struct netlink_route_info *)data;
enum ws_ifa_attr_type type = (enum ws_ifa_attr_type) rta_type;
const guint8* str;
@@ -1022,7 +1019,7 @@ dissect_netlink_route_ifa_attrs(tvbuff_t *tvb, void *data, struct packet_netlink
return 1;
case WS_IFA_FLAGS:
- proto_tree_add_item(tree, &hfi_netlink_route_ifa_flags32, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_ifa_flags32, tvb, offset, 4, nl_data->encoding);
return 1;
case WS_IFA_ADDRESS:
case WS_IFA_LOCAL:
@@ -1130,7 +1127,7 @@ static header_field_info hfi_netlink_route_rt_flags NETLINK_ROUTE_HFI_INIT =
NULL, 0x00, NULL, HFILL };
static int
-dissect_netlink_route_rtmsg(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
+dissect_netlink_route_rtmsg(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
proto_tree_add_item(tree, &hfi_netlink_route_rt_family, tvb, offset, 1, ENC_NA);
offset += 1;
@@ -1159,7 +1156,7 @@ dissect_netlink_route_rtmsg(tvbuff_t *tvb, struct netlink_route_info *info, stru
proto_tree_add_item(tree, &hfi_netlink_route_rt_type, tvb, offset, 1, ENC_NA);
offset += 1;
- proto_tree_add_item(tree, &hfi_netlink_route_rt_flags, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_rt_flags, tvb, offset, 4, nl_data->encoding);
offset += 4;
return offset;
@@ -1215,16 +1212,15 @@ static header_field_info hfi_netlink_route_rta_oif NETLINK_ROUTE_HFI_INIT =
NULL, 0x00, NULL, HFILL };
static int
-dissect_netlink_route_route_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int rta_type, int offset, int len)
+dissect_netlink_route_route_attrs(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int rta_type, int offset, int len)
{
- struct netlink_route_info *info = (struct netlink_route_info *)data;
enum ws_rta_attr_type type = (enum ws_rta_attr_type) rta_type;
switch (type) {
case WS_RTA_IIF:
if (len == 4) {
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_rta_iif, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_rta_iif, tvb, offset, 4, nl_data->encoding);
return 1;
}
return 0;
@@ -1232,7 +1228,7 @@ dissect_netlink_route_route_attrs(tvbuff_t *tvb, void *data, struct packet_netli
case WS_RTA_OIF:
if (len == 4) {
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_route_rta_oif, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_rta_oif, tvb, offset, 4, nl_data->encoding);
return 1;
}
return 0;
@@ -1287,7 +1283,7 @@ static header_field_info hfi_netlink_route_nd_type NETLINK_ROUTE_HFI_INIT =
NULL, 0x00, NULL, HFILL };
static int
-dissect_netlink_route_ndmsg(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
+dissect_netlink_route_ndmsg(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
proto_tree_add_item(tree, &hfi_netlink_route_nd_family, tvb, offset, 1, ENC_NA);
offset += 1;
@@ -1298,10 +1294,10 @@ dissect_netlink_route_ndmsg(tvbuff_t *tvb, struct netlink_route_info *info, stru
/* XXX, 3B padding */
offset += 3;
- proto_tree_add_item(tree, &hfi_netlink_route_nd_index, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_nd_index, tvb, offset, 4, nl_data->encoding);
offset += 4;
- proto_tree_add_item(tree, &hfi_netlink_route_nd_state, tvb, offset, 2, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_route_nd_state, tvb, offset, 2, nl_data->encoding);
offset += 2;
proto_tree_add_item(tree, &hfi_netlink_route_nd_flags, tvb, offset, 1, ENC_NA);
@@ -1400,9 +1396,7 @@ dissect_netlink_route(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
/* Netlink message header (nlmsghdr) */
offset = dissect_netlink_header(tvb, nlmsg_tree, offset, nl_data->encoding, &hfi_netlink_route_nltype, NULL);
- info.encoding = nl_data->encoding;
info.pinfo = pinfo;
- info.nl_data = nl_data;
switch (nl_data->type) {
case WS_RTM_NEWLINK:
diff --git a/epan/dissectors/packet-netlink-sock_diag.c b/epan/dissectors/packet-netlink-sock_diag.c
index 5ac6dfa930..f895d22c63 100644
--- a/epan/dissectors/packet-netlink-sock_diag.c
+++ b/epan/dissectors/packet-netlink-sock_diag.c
@@ -22,9 +22,6 @@ void proto_reg_handoff_netlink_sock_diag(void);
typedef struct {
packet_info *pinfo;
- struct packet_netlink_data *nl_data;
-
- int encoding; /* copy of nl_data->encoding */
} netlink_sock_diag_info_t;
static int proto_netlink_sock_diag;
@@ -271,7 +268,7 @@ static header_field_info hfi_netlink_sock_diag_wmem_queued NETLINK_SOCK_DIAG_HFI
NULL, 0x00, NULL, HFILL };
static int
-dissect_sock_diag_meminfo(proto_tree *tree, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data _U_, tvbuff_t *tvb, int offset, int len)
+dissect_sock_diag_meminfo(proto_tree *tree, netlink_sock_diag_info_t *info _U_, struct packet_netlink_data *nl_data, tvbuff_t *tvb, int offset, int len)
{
static header_field_info *hfis[] = {
&hfi_netlink_sock_diag_rmem_alloc,
@@ -290,7 +287,7 @@ dissect_sock_diag_meminfo(proto_tree *tree, netlink_sock_diag_info_t *info, stru
return 0;
for (i = 0; len >= 4 && i < G_N_ELEMENTS(hfis); i++) {
- proto_tree_add_item(tree, hfis[i], tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, hfis[i], tvb, offset, 4, nl_data->encoding);
offset += 4; len -= 4;
}
@@ -396,7 +393,7 @@ dissect_netlink_unix_sock_diag_reply_attrs(tvbuff_t *tvb, void *data, struct pac
case WS_UNIX_DIAG_PEER:
if (len == 4) {
proto_item_append_text(tree, ": Peer inode %u", tvb_get_letohl(tvb, offset));
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_unix_peer_inode, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_unix_peer_inode, tvb, offset, 4, nl_data->encoding);
return 1;
}
return 0;
@@ -404,8 +401,8 @@ dissect_netlink_unix_sock_diag_reply_attrs(tvbuff_t *tvb, void *data, struct pac
case WS_UNIX_DIAG_RQLEN:
if (len == 8) {
/* XXX, if socket in WS_LISTEN it's reporting sk->sk_receive_queue.qlen, sk->sk_max_ack_backlog */
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_rqueue, tvb, offset, 4, info->encoding);
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_wqueue, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_rqueue, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_wqueue, tvb, offset, 4, nl_data->encoding);
return 1;
}
return 0;
@@ -444,7 +441,7 @@ dissect_sock_diag_unix_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, stru
_dissect_padding(tree, tvb, offset, 1);
offset += 1;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, nl_data->encoding);
offset += 4;
sock_diag_proto_tree_add_cookie(tree, info, nl_data, tvb, offset);
@@ -484,20 +481,20 @@ static header_field_info hfi_netlink_sock_diag_unix_show_meminfo NETLINK_SOCK_DI
TFS(&_tfs_show_do_not_show), WS_UDIAG_SHOW_MEMINFO, NULL, HFILL };
static int
-dissect_sock_diag_unix_request_show(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
+dissect_sock_diag_unix_request_show(tvbuff_t *tvb, netlink_sock_diag_info_t *info _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
proto_item *ti;
proto_tree *flags_tree;
- ti = proto_tree_add_item(tree, &hfi_netlink_sock_diag_unix_show, tvb, offset, 4, info->encoding);
+ ti = proto_tree_add_item(tree, &hfi_netlink_sock_diag_unix_show, tvb, offset, 4, nl_data->encoding);
flags_tree = proto_item_add_subtree(ti, ett_netlink_sock_diag_show);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_unix_show_name, tvb, offset, 4, info->encoding);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_unix_show_vfs, tvb, offset, 4, info->encoding);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_unix_show_peer, tvb, offset, 4, info->encoding);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_unix_show_icons, tvb, offset, 4, info->encoding);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_unix_show_rqlen, tvb, offset, 4, info->encoding);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_unix_show_meminfo, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_unix_show_name, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_unix_show_vfs, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_unix_show_peer, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_unix_show_icons, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_unix_show_rqlen, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_unix_show_meminfo, tvb, offset, 4, nl_data->encoding);
/* XXX, unknown */
offset += 4;
@@ -520,7 +517,7 @@ dissect_sock_diag_unix_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info, st
/* states */
offset += 4;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, nl_data->encoding);
offset += 4;
offset = dissect_sock_diag_unix_request_show(tvb, info, nl_data, tree, offset);
@@ -566,16 +563,16 @@ dissect_sock_diag_inet_attributes(tvbuff_t *tvb, void *data, struct packet_netli
switch (type) {
case WS_INET_DIAG_MEMINFO:
if (len == 16) {
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_rmem_alloc, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_rmem_alloc, tvb, offset, 4, nl_data->encoding);
offset += 4;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_wmem_queued, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_wmem_queued, tvb, offset, 4, nl_data->encoding);
offset += 4;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_fwd_alloc, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_fwd_alloc, tvb, offset, 4, nl_data->encoding);
offset += 4;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_wmem_alloc, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_wmem_alloc, tvb, offset, 4, nl_data->encoding);
/*offset += 4;*/
return 1;
@@ -675,7 +672,7 @@ dissect_sock_diag_inet_sockid(tvbuff_t *tvb, netlink_sock_diag_info_t *info, str
break;
}
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_inet_interface, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_inet_interface, tvb, offset, 4, nl_data->encoding);
offset += 4;
sock_diag_proto_tree_add_cookie(tree, info, nl_data, tvb, offset);
@@ -722,16 +719,16 @@ dissect_sock_diag_inet_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, stru
/* XXX expires */
offset += 4;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_rqueue, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_rqueue, tvb, offset, 4, nl_data->encoding);
offset += 4;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_wqueue, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_wqueue, tvb, offset, 4, nl_data->encoding);
offset += 4;
/* XXX uid */
offset += 4;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, nl_data->encoding);
offset += 4;
return dissect_netlink_attributes(tvb, &hfi_netlink_sock_diag_inet_attr, ett_netlink_sock_diag_attr, info, nl_data, tree, offset, -1, dissect_sock_diag_inet_attributes);
@@ -840,16 +837,16 @@ dissect_sock_diag_netlink_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, s
proto_tree_add_item(tree, &hfi_netlink_sock_diag_state, tvb, offset, 1, ENC_NA);
offset += 1;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_netlink_port_id, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_netlink_port_id, tvb, offset, 4, nl_data->encoding);
offset += 4;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_netlink_dst_port_id, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_netlink_dst_port_id, tvb, offset, 4, nl_data->encoding);
offset += 4;
/* XXX dst group */
offset += 4;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, nl_data->encoding);
offset += 4;
sock_diag_proto_tree_add_cookie(tree, info, nl_data, tvb, offset);
@@ -877,17 +874,17 @@ static header_field_info hfi_netlink_sock_diag_netlink_show_ring_cfg NETLINK_SOC
TFS(&_tfs_show_do_not_show), WS_NDIAG_SHOW_RING_CFG, NULL, HFILL };
static int
-dissect_sock_diag_netlink_request_show(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
+dissect_sock_diag_netlink_request_show(tvbuff_t *tvb, netlink_sock_diag_info_t *info _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
proto_item *ti;
proto_tree *flags_tree;
- ti = proto_tree_add_item(tree, &hfi_netlink_sock_diag_netlink_show, tvb, offset, 4, info->encoding);
+ ti = proto_tree_add_item(tree, &hfi_netlink_sock_diag_netlink_show, tvb, offset, 4, nl_data->encoding);
flags_tree = proto_item_add_subtree(ti, ett_netlink_sock_diag_show);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_netlink_show_meminfo, tvb, offset, 4, info->encoding);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_netlink_show_groups, tvb, offset, 4, info->encoding);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_netlink_show_ring_cfg, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_netlink_show_meminfo, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_netlink_show_groups, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_netlink_show_ring_cfg, tvb, offset, 4, nl_data->encoding);
/* XXX, unknown */
offset += 4;
@@ -908,7 +905,7 @@ dissect_sock_diag_netlink_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info,
_dissect_padding(tree, tvb, offset, 2);
offset += 2;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, nl_data->encoding);
offset += 4;
offset = dissect_sock_diag_netlink_request_show(tvb, info, nl_data, tree, offset);
@@ -974,10 +971,10 @@ dissect_sock_diag_packet_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, st
proto_tree_add_item(tree, &hfi_netlink_sock_diag_type, tvb, offset, 1, ENC_NA);
offset += 1;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_packet_proto, tvb, offset, 2, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_packet_proto, tvb, offset, 2, nl_data->encoding);
offset += 2;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, nl_data->encoding);
offset += 4;
sock_diag_proto_tree_add_cookie(tree, info, nl_data, tvb, offset);
@@ -1017,20 +1014,20 @@ static header_field_info hfi_netlink_sock_diag_packet_show_filter NETLINK_SOCK_D
TFS(&_tfs_show_do_not_show), WS_PACKET_SHOW_FILTER, NULL, HFILL };
static int
-dissect_sock_diag_packet_request_show(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
+dissect_sock_diag_packet_request_show(tvbuff_t *tvb, netlink_sock_diag_info_t *info _U_, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
proto_item *ti;
proto_tree *flags_tree;
- ti = proto_tree_add_item(tree, &hfi_netlink_sock_diag_packet_show, tvb, offset, 4, info->encoding);
+ ti = proto_tree_add_item(tree, &hfi_netlink_sock_diag_packet_show, tvb, offset, 4, nl_data->encoding);
flags_tree = proto_item_add_subtree(ti, ett_netlink_sock_diag_show);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_packet_show_info, tvb, offset, 4, info->encoding);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_packet_show_mclist, tvb, offset, 4, info->encoding);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_packet_show_ring_cfg, tvb, offset, 4, info->encoding);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_packet_show_fanout, tvb, offset, 4, info->encoding);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_packet_show_meminfo, tvb, offset, 4, info->encoding);
- proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_packet_show_filter, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_packet_show_info, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_packet_show_mclist, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_packet_show_ring_cfg, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_packet_show_fanout, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_packet_show_meminfo, tvb, offset, 4, nl_data->encoding);
+ proto_tree_add_item(flags_tree, &hfi_netlink_sock_diag_packet_show_filter, tvb, offset, 4, nl_data->encoding);
/* XXX, unknown */
offset += 4;
@@ -1050,7 +1047,7 @@ dissect_sock_diag_packet_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info,
_dissect_padding(tree, tvb, offset, 2);
offset += 2;
- proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
+ proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, nl_data->encoding);
offset += 4;
offset = dissect_sock_diag_packet_request_show(tvb, info, nl_data, tree, offset);
@@ -1133,9 +1130,7 @@ dissect_netlink_sock_diag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
/* Netlink message header (nlmsghdr) */
offset = dissect_netlink_header(tvb, nlmsg_tree, offset, nl_data->encoding, &hfi_netlink_sock_diag_nltype, NULL);
- info.encoding = nl_data->encoding;
info.pinfo = pinfo;
- info.nl_data = nl_data;
switch (nl_data->type) {
case WS_TCPDIAG_GETSOCK:
diff --git a/epan/dissectors/packet-netlink.h b/epan/dissectors/packet-netlink.h
index abfcf8e5c5..e4d82cced1 100644
--- a/epan/dissectors/packet-netlink.h
+++ b/epan/dissectors/packet-netlink.h
@@ -129,7 +129,6 @@ int dissect_netlink_attributes_array(tvbuff_t *tvb, header_field_info *hfi_type,
*/
typedef struct {
struct packet_netlink_data *nl_data;
- int encoding; /* copy of nl_data->encoding */
/* For internal use by genl. */
proto_tree *genl_tree;