aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2020-01-07 23:02:06 +0100
committerAnders Broman <a.broman58@gmail.com>2020-01-08 04:57:13 +0000
commit088266e39eb55a94720150ce234b6224e6e88325 (patch)
tree04d35dd1e606c3d6d848d0adc62f6e2a32a98b1e /epan
parent200124d4209b5539e220cd6111d86d29e54e31ce (diff)
Netlink: stop hiding packet_netlink_data pointer
The underlying netlink dissector sets up a data structure to help maintain information about this netlink packet. It gets passed through the familiy specific netlink dissectors private data structures to reappear when support funtions of the underlying netlink dissector are needed. In the mean time a copy of data (the value 'encoding' to be precise) in this structure is also maintained in these familiy specific netlink dissectors, adding to the confusion. This change is to make the underlying netlink dissector data structure a normal part of the function interfaces, so that it is present without being dependant on another private data structure. This change is a first step towards removing the unnessesary copy of the encoding value. Change-Id: I69e78a2b15e58e149e82e89c19e519ef041ee6b1 Reviewed-on: https://code.wireshark.org/review/35688 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>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-netlink-generic.c38
-rw-r--r--epan/dissectors/packet-netlink-net_dm.c26
-rw-r--r--epan/dissectors/packet-netlink-netfilter.c126
-rw-r--r--epan/dissectors/packet-netlink-nl80211.c66
-rw-r--r--epan/dissectors/packet-netlink-route.c69
-rw-r--r--epan/dissectors/packet-netlink-sock_diag.c114
-rw-r--r--epan/dissectors/packet-netlink.c14
-rw-r--r--epan/dissectors/packet-netlink.h21
8 files changed, 244 insertions, 230 deletions
diff --git a/epan/dissectors/packet-netlink-generic.c b/epan/dissectors/packet-netlink-generic.c
index 4676a80f2a..3bae9e0267 100644
--- a/epan/dissectors/packet-netlink-generic.c
+++ b/epan/dissectors/packet-netlink-generic.c
@@ -32,8 +32,8 @@ void proto_register_netlink_generic(void);
void proto_reg_handoff_netlink_generic(void);
typedef struct {
- struct packet_netlink_data *data;
- int encoding; /* copy of data->encoding */
+ 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;
@@ -182,7 +182,7 @@ static const int *genl_ctrl_op_flags_fields[] = {
};
static int
-dissect_genl_ctrl_ops_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+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)
{
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;
@@ -226,7 +226,7 @@ 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, proto_tree *tree, int nla_type, int offset, int len)
+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)
{
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;
@@ -286,7 +286,7 @@ static header_field_info hfi_genl_ctrl_groups_attr NETLINK_GENERIC_HFI_INIT =
VALS(genl_ctrl_group_attr_vals), NLA_TYPE_MASK, NULL, HFILL };
static int
-dissect_genl_ctrl_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_genl_ctrl_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_genl_ctrl_attr type = (enum ws_genl_ctrl_attr) nla_type;
genl_ctrl_info_t *info = (genl_ctrl_info_t *) data;
@@ -330,10 +330,10 @@ dissect_genl_ctrl_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_typ
}
break;
case WS_CTRL_ATTR_OPS:
- offset = dissect_netlink_attributes_array(tvb, &hfi_genl_ctrl_ops_attr, ett_genl_ctrl_ops, ett_genl_ctrl_ops_attr, info, info->data, tree, offset, len, dissect_genl_ctrl_ops_attrs);
+ offset = dissect_netlink_attributes_array(tvb, &hfi_genl_ctrl_ops_attr, ett_genl_ctrl_ops, ett_genl_ctrl_ops_attr, info, nl_data, tree, offset, len, dissect_genl_ctrl_ops_attrs);
break;
case WS_CTRL_ATTR_MCAST_GROUPS:
- offset = dissect_netlink_attributes_array(tvb, &hfi_genl_ctrl_groups_attr, ett_genl_ctrl_groups, ett_genl_ctrl_groups_attr, info, info->data, tree, offset, len, dissect_genl_ctrl_groups_attrs);
+ offset = dissect_netlink_attributes_array(tvb, &hfi_genl_ctrl_groups_attr, ett_genl_ctrl_groups, ett_genl_ctrl_groups_attr, info, nl_data, tree, offset, len, dissect_genl_ctrl_groups_attrs);
break;
}
@@ -359,18 +359,18 @@ dissect_genl_ctrl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, v
return 0;
}
- info.data = genl_info->data;
+ info.nl_data = genl_info->nl_data;
info.encoding = genl_info->encoding;
info.family_id = 0;
info.family_name = NULL;
- offset = dissect_genl_header(tvb, genl_info, &hfi_genl_ctrl_cmd);
+ offset = dissect_genl_header(tvb, genl_info, genl_info->nl_data, &hfi_genl_ctrl_cmd);
/* Return if command has no payload */
if (!tvb_reported_length_remaining(tvb, offset))
return offset;
- dissect_netlink_attributes(tvb, &hfi_genl_ctrl_attr, ett_genl_ctrl_attr, &info, info.data, genl_info->genl_tree, offset, -1, dissect_genl_ctrl_attrs);
+ dissect_netlink_attributes(tvb, &hfi_genl_ctrl_attr, ett_genl_ctrl_attr, &info, genl_info->nl_data, genl_info->genl_tree, offset, -1, dissect_genl_ctrl_attrs);
/*
* Remember association of dynamic ID with the family name such that
@@ -401,7 +401,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, header_field_info *hfi_cmd)
+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 offset = 0;
@@ -418,9 +418,9 @@ int dissect_genl_header(tvbuff_t *tvb, genl_info_t *genl_info, header_field_info
}
static int
-dissect_netlink_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *_data)
+dissect_netlink_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- struct packet_netlink_data *data = (struct packet_netlink_data *)_data;
+ struct packet_netlink_data *nl_data = (struct packet_netlink_data *) data;
genl_info_t info;
proto_tree *nlmsg_tree;
proto_item *pi, *pi_type;
@@ -428,7 +428,7 @@ dissect_netlink_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
tvbuff_t *next_tvb;
int offset = 0;
- DISSECTOR_ASSERT(data && data->magic == PACKET_NETLINK_MAGIC);
+ DISSECTOR_ASSERT(nl_data && nl_data->magic == PACKET_NETLINK_MAGIC);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Netlink generic");
col_clear(pinfo->cinfo, COL_INFO);
@@ -437,13 +437,13 @@ dissect_netlink_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
nlmsg_tree = proto_item_add_subtree(pi, ett_netlink_generic);
/* Netlink message header (nlmsghdr) */
- offset = dissect_netlink_header(tvb, nlmsg_tree, offset, data->encoding, &hfi_genl_family_id, &pi_type);
- family_name = (const char *)wmem_map_lookup(genl_family_map, GUINT_TO_POINTER(data->type));
+ offset = dissect_netlink_header(tvb, nlmsg_tree, offset, nl_data->encoding, &hfi_genl_family_id, &pi_type);
+ family_name = (const char *)wmem_map_lookup(genl_family_map, GUINT_TO_POINTER(nl_data->type));
proto_item_append_text(pi_type, " (%s)", family_name ? family_name : "Unknown");
/* Populate info from Generic Netlink message header (genlmsghdr) */
- info.data = data;
- info.encoding = data->encoding;
+ info.nl_data = nl_data;
+ info.encoding = nl_data->encoding;
info.genl_tree = nlmsg_tree;
info.cmd = tvb_get_guint8(tvb, offset);
@@ -459,7 +459,7 @@ dissect_netlink_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
}
/* No subdissector added the genl header, do it now. */
- offset = dissect_genl_header(next_tvb, &info, NULL);
+ offset = dissect_genl_header(next_tvb, &info, nl_data, NULL);
if (tvb_reported_length_remaining(tvb, offset)) {
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_data_dissector(next_tvb, pinfo, tree);
diff --git a/epan/dissectors/packet-netlink-net_dm.c b/epan/dissectors/packet-netlink-net_dm.c
index c0a4c31c54..3cf062d96e 100644
--- a/epan/dissectors/packet-netlink-net_dm.c
+++ b/epan/dissectors/packet-netlink-net_dm.c
@@ -92,8 +92,8 @@ enum ws_net_dm_origin {
struct netlink_net_dm_info {
packet_info *pinfo;
- struct packet_netlink_data *data;
- int encoding; /* copy of data->encoding */
+ struct packet_netlink_data *nl_data;
+ int encoding; /* copy of nl_data->encoding */
guint16 protocol; /* protocol for packet payload */
};
@@ -266,7 +266,7 @@ 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, proto_tree *tree, int nla_type, int offset, int len)
+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)
{
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;
@@ -287,7 +287,7 @@ dissect_net_dm_attrs_port(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_t
}
static int
-dissect_net_dm_attrs_stats(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+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)
{
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;
@@ -302,7 +302,7 @@ dissect_net_dm_attrs_stats(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_
}
static int
-dissect_net_dm_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_net_dm_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_net_dm_attrs type = (enum ws_net_dm_attrs) nla_type & NLA_TYPE_MASK;
struct netlink_net_dm_info *info = (struct netlink_net_dm_info *) data;
@@ -325,7 +325,7 @@ dissect_net_dm_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type,
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, info->data, tree, offset, len,
+ 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);
@@ -361,10 +361,10 @@ dissect_net_dm_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type,
proto_tree_add_item(tree, &hfi_net_dm_queue_len, tvb, offset, len, info->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, info->data, tree, offset, len,
+ return dissect_netlink_attributes(tvb, &hfi_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, info->data, tree, offset, len,
+ 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);
@@ -378,10 +378,10 @@ dissect_net_dm_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type,
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, info->data, tree, offset, len,
+ return dissect_netlink_attributes(tvb, &hfi_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, info->data, tree, offset, len,
+ 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));
@@ -413,7 +413,7 @@ 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, &hfi_net_dm_commands);
+ offset = dissect_genl_header(tvb, genl_info, genl_info->nl_data, &hfi_net_dm_commands);
/* Not all commands have a payload */
if (!tvb_reported_length_remaining(tvb, offset))
@@ -424,10 +424,10 @@ dissect_netlink_net_dm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
info.encoding = genl_info->encoding;
info.pinfo = pinfo;
- info.data = genl_info->data;
+ 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->data, nlmsg_tree, offset, -1, dissect_net_dm_attrs);
+ 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);
return offset;
}
diff --git a/epan/dissectors/packet-netlink-netfilter.c b/epan/dissectors/packet-netlink-netfilter.c
index 66edc57127..0658272b24 100644
--- a/epan/dissectors/packet-netlink-netfilter.c
+++ b/epan/dissectors/packet-netlink-netfilter.c
@@ -21,9 +21,9 @@ void proto_reg_handoff_netlink_netfilter(void);
typedef struct {
packet_info *pinfo;
- struct packet_netlink_data *data;
+ struct packet_netlink_data *nl_data;
- int encoding; /* copy of data->encoding */
+ int encoding; /* copy of nl_data->encoding */
guint16 hw_protocol; /* protocol for NFQUEUE packet payloads. */
} netlink_netfilter_info_t;
@@ -469,7 +469,7 @@ static header_field_info hfi_nfct_tuple_proto_attr NETLINK_NETFILTER_HFI_INIT =
VALS(nfct_tuple_l4proto_attr_vals), NLA_TYPE_MASK, NULL, HFILL };
static int
-dissect_nfct_tuple_proto_attrs(tvbuff_t *tvb, void *data _U_, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nfct_tuple_proto_attrs(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_ctattr_ip type = (enum ws_ctattr_ip) nla_type & NLA_TYPE_MASK;
@@ -504,7 +504,7 @@ static header_field_info hfi_nfct_tuple_ip_attr NETLINK_NETFILTER_HFI_INIT =
VALS(nfct_tuple_ip_attr_vals), NLA_TYPE_MASK, NULL, HFILL };
static int
-dissect_nfct_tuple_ip_attrs(tvbuff_t *tvb, void *data _U_, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nfct_tuple_ip_attrs(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_ctattr_ip type = (enum ws_ctattr_ip) nla_type & NLA_TYPE_MASK;
@@ -533,7 +533,7 @@ static header_field_info hfi_nfct_tuple_attr NETLINK_NETFILTER_HFI_INIT =
VALS(nfct_tuple_attr_vals), NLA_TYPE_MASK, NULL, HFILL };
static int
-dissect_nfct_tuple_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nfct_tuple_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_ctattr_tuple type = (enum ws_ctattr_tuple) nla_type & NLA_TYPE_MASK;
netlink_netfilter_info_t *info = (netlink_netfilter_info_t *) data;
@@ -541,13 +541,13 @@ dissect_nfct_tuple_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_ty
switch (type) {
case WS_CTA_TUPLE_IP:
if (nla_type & NLA_F_NESTED)
- return dissect_netlink_attributes(tvb, &hfi_nfct_tuple_ip_attr, ett_nfct_tuple_ip_attr, info, info->data,
+ return dissect_netlink_attributes(tvb, &hfi_nfct_tuple_ip_attr, ett_nfct_tuple_ip_attr, info, nl_data,
tree, offset, len, dissect_nfct_tuple_ip_attrs);
return 0;
case WS_CTA_TUPLE_PROTO:
if (nla_type & NLA_F_NESTED)
- return dissect_netlink_attributes(tvb, &hfi_nfct_tuple_proto_attr, ett_nfct_tuple_proto_attr, info, info->data,
+ return dissect_netlink_attributes(tvb, &hfi_nfct_tuple_proto_attr, ett_nfct_tuple_proto_attr, info, nl_data,
tree, offset, len, dissect_nfct_tuple_proto_attrs);
return 0;
@@ -720,7 +720,7 @@ static header_field_info hfi_nfct_help_attr NETLINK_NETFILTER_HFI_INIT =
VALS(nfct_help_attr_vals), NLA_TYPE_MASK, NULL, HFILL };
static int
-dissect_nfct_help_attrs(tvbuff_t *tvb, void *data _U_, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nfct_help_attrs(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_ctattr_help type = (enum ws_ctattr_help) nla_type & NLA_TYPE_MASK;
@@ -753,7 +753,7 @@ static header_field_info hfi_nfct_seqadj_attr NETLINK_NETFILTER_HFI_INIT =
VALS(nfct_seqadj_attr_vals), NLA_TYPE_MASK, NULL, HFILL };
static int
-dissect_nfct_seqadj_attrs(tvbuff_t *tvb, void *data _U_, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nfct_seqadj_attrs(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_ctattr_seqadj type = (enum ws_ctattr_seqadj) nla_type & NLA_TYPE_MASK;
@@ -778,7 +778,7 @@ dissect_nfct_seqadj_attrs(tvbuff_t *tvb, void *data _U_, proto_tree *tree, int n
}
static int
-dissect_nfct_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nfct_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_ctattr_type type = (enum ws_ctattr_type) nla_type & NLA_TYPE_MASK;
netlink_netfilter_info_t *info = (netlink_netfilter_info_t *) data;
@@ -799,14 +799,14 @@ dissect_nfct_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, in
case WS_CTA_HELP:
if (nla_type & NLA_F_NESTED)
- return dissect_netlink_attributes(tvb, &hfi_nfct_help_attr, ett_nfct_help_attr, info, info->data,
+ return dissect_netlink_attributes(tvb, &hfi_nfct_help_attr, ett_nfct_help_attr, info, nl_data,
tree, offset, len, dissect_nfct_help_attrs);
return 0;
case WS_CTA_SEQ_ADJ_ORIG:
case WS_CTA_SEQ_ADJ_REPLY:
if (nla_type & NLA_F_NESTED)
- return dissect_netlink_attributes(tvb, &hfi_nfct_seqadj_attr, ett_nfct_seqadj_attr, info, info->data,
+ return dissect_netlink_attributes(tvb, &hfi_nfct_seqadj_attr, ett_nfct_seqadj_attr, info, nl_data,
tree, offset, len, dissect_nfct_seqadj_attrs);
return 0;
@@ -814,7 +814,7 @@ dissect_nfct_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, in
case WS_CTA_TUPLE_REPLY:
case WS_CTA_TUPLE_MASTER:
if (nla_type & NLA_F_NESTED)
- return dissect_netlink_attributes(tvb, &hfi_nfct_tuple_attr, ett_nfct_tuple_attr, info, info->data,
+ return dissect_netlink_attributes(tvb, &hfi_nfct_tuple_attr, ett_nfct_tuple_attr, info, nl_data,
tree, offset, len, dissect_nfct_tuple_attrs);
return 0;
@@ -830,10 +830,10 @@ static header_field_info hfi_nfct_attr NETLINK_NETFILTER_HFI_INIT =
VALS(nfct_attr_vals), NLA_TYPE_MASK, NULL, HFILL };
static int
-dissect_netfilter_ct(tvbuff_t *tvb, netlink_netfilter_info_t *info, proto_tree *tree, int offset)
+dissect_netfilter_ct(tvbuff_t *tvb, netlink_netfilter_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
offset = dissect_netlink_netfilter_header(tvb, tree, offset);
- return dissect_netlink_attributes(tvb, &hfi_nfct_attr, ett_nfct_attr, info, info->data,
+ return dissect_netlink_attributes(tvb, &hfi_nfct_attr, ett_nfct_attr, info, nl_data,
tree, offset, -1, dissect_nfct_attrs);
}
@@ -883,7 +883,7 @@ static header_field_info hfi_nfexp_nat_attr NETLINK_NETFILTER_HFI_INIT =
VALS(nfexp_nat_attr_vals), NLA_TYPE_MASK, NULL, HFILL };
static int
-dissect_nfexp_nat_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nfexp_nat_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_ctattr_expect type = (enum ws_ctattr_expect) nla_type & NLA_TYPE_MASK;
netlink_netfilter_info_t *info = (netlink_netfilter_info_t *) data;
@@ -895,7 +895,7 @@ dissect_nfexp_nat_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_typ
case WS_CTA_EXPECT_NAT_TUPLE:
if (nla_type & NLA_F_NESTED)
- return dissect_netlink_attributes(tvb, &hfi_nfct_tuple_attr, ett_nfct_tuple_attr, info, info->data,
+ return dissect_netlink_attributes(tvb, &hfi_nfct_tuple_attr, ett_nfct_tuple_attr, info, nl_data,
tree, offset, len, dissect_nfct_tuple_attrs);
return 0;
@@ -952,7 +952,7 @@ static header_field_info hfi_nfexp_attr_flags NETLINK_NETFILTER_HFI_INIT =
NULL, 0x00, NULL, HFILL };
static int
-dissect_nfexp_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nfexp_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_ctattr_expect type = (enum ws_ctattr_expect) nla_type & NLA_TYPE_MASK;
netlink_netfilter_info_t *info = (netlink_netfilter_info_t *) data;
@@ -962,13 +962,13 @@ dissect_nfexp_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, i
case WS_CTA_EXPECT_MASK:
case WS_CTA_EXPECT_MASTER:
if (nla_type & NLA_F_NESTED)
- return dissect_netlink_attributes(tvb, &hfi_nfct_tuple_attr, ett_nfct_tuple_attr, info, info->data,
+ return dissect_netlink_attributes(tvb, &hfi_nfct_tuple_attr, ett_nfct_tuple_attr, info, nl_data,
tree, offset, len, dissect_nfct_tuple_attrs);
return 0;
case WS_CTA_EXPECT_NAT:
if (nla_type & NLA_F_NESTED)
- return dissect_netlink_attributes(tvb, &hfi_nfexp_nat_attr, ett_nfexp_nat_attr, info, info->data,
+ return dissect_netlink_attributes(tvb, &hfi_nfexp_nat_attr, ett_nfexp_nat_attr, info, nl_data,
tree, offset, len, dissect_nfexp_nat_attrs);
return 0;
@@ -1009,12 +1009,12 @@ static header_field_info hfi_nfexp_attr NETLINK_NETFILTER_HFI_INIT =
/* EXP - main */
static int
-dissect_netfilter_exp(tvbuff_t *tvb, netlink_netfilter_info_t *info, proto_tree *tree, int offset)
+dissect_netfilter_exp(tvbuff_t *tvb, netlink_netfilter_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
//enum ws_ctnl_exp_msg_types type = (enum ws_ctnl_exp_msg_types) (info->data->type & 0xff);
offset = dissect_netlink_netfilter_header(tvb, tree, offset);
- return dissect_netlink_attributes(tvb, &hfi_nfexp_attr, ett_nfexp_attr, info, info->data,
+ return dissect_netlink_attributes(tvb, &hfi_nfexp_attr, ett_nfexp_attr, info, nl_data,
tree, offset, -1, dissect_nfexp_attrs);
}
@@ -1085,7 +1085,7 @@ 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, proto_tree *tree, int nla_type, int offset, int len)
+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)
{
enum ws_nfqnl_attr_config type = (enum ws_nfqnl_attr_config) nla_type;
netlink_netfilter_info_t *info = (netlink_netfilter_info_t *) data;
@@ -1282,7 +1282,7 @@ static header_field_info hfi_nfq_gid NETLINK_NETFILTER_HFI_INIT =
static int
-dissect_nfq_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nfq_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_nfqnl_attr_type type = (enum ws_nfqnl_attr_type) nla_type & NLA_TYPE_MASK;
netlink_netfilter_info_t *info = (netlink_netfilter_info_t *) data;
@@ -1385,7 +1385,7 @@ dissect_nfq_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int
case WS_NFQA_CT:
if (nla_type & NLA_F_NESTED)
- return dissect_netlink_attributes(tvb, &hfi_nfct_attr, ett_nfct_attr, info, info->data,
+ return dissect_netlink_attributes(tvb, &hfi_nfct_attr, ett_nfct_attr, info, nl_data,
tree, offset, len, dissect_nfct_attrs);
break;
@@ -1439,19 +1439,19 @@ static header_field_info hfi_nfq_attr NETLINK_NETFILTER_HFI_INIT =
/* QUEUE - main */
static int
-dissect_netfilter_queue(tvbuff_t *tvb, netlink_netfilter_info_t *info, proto_tree *tree, int offset)
+dissect_netfilter_queue(tvbuff_t *tvb, netlink_netfilter_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
- enum ws_nfqnl_msg_types type = (enum ws_nfqnl_msg_types) (info->data->type & 0xff);
+ enum ws_nfqnl_msg_types type = (enum ws_nfqnl_msg_types) (nl_data->type & 0xff);
offset = dissect_netlink_netfilter_header(tvb, tree, offset);
switch (type) {
case WS_NFQNL_MSG_CONFIG:
- return dissect_netlink_attributes(tvb, &hfi_nfq_config_attr, ett_nfq_config_attr, info, info->data, tree, offset, -1, dissect_nfq_config_attrs);
+ return dissect_netlink_attributes(tvb, &hfi_nfq_config_attr, ett_nfq_config_attr, info, nl_data, tree, offset, -1, dissect_nfq_config_attrs);
case WS_NFQNL_MSG_PACKET:
case WS_NFQNL_MSG_VERDICT:
- return dissect_netlink_attributes(tvb, &hfi_nfq_attr, ett_nfq_attr, info, info->data, tree, offset, -1, dissect_nfq_attrs);
+ return dissect_netlink_attributes(tvb, &hfi_nfq_attr, ett_nfq_attr, info, nl_data, tree, offset, -1, dissect_nfq_attrs);
case WS_NFQNL_MSG_VERDICT_BATCH:
/* TODO */
@@ -1474,9 +1474,9 @@ 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, proto_tree *tree, int offset)
+dissect_netfilter_ulog(tvbuff_t *tvb, netlink_netfilter_info_t *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
{
- enum ws_nfulnl_msg_types type = (enum ws_nfulnl_msg_types) (info->data->type & 0xff);
+ enum ws_nfulnl_msg_types type = (enum ws_nfulnl_msg_types) (nl_data->type & 0xff);
tvbuff_t *next_tvb;
switch (type) {
@@ -1651,7 +1651,7 @@ static header_field_info hfi_ipset_ip_attr_ipv6 NETLINK_NETFILTER_HFI_INIT =
NULL, 0x00, NULL, HFILL };
static int
-dissect_ipset_ip_attrs(tvbuff_t *tvb, void *data _U_, proto_tree *tree, int nla_type, int offset, int len)
+dissect_ipset_ip_attrs(tvbuff_t *tvb, void *data _U_, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_ipset_ip_attr type = (enum ws_ipset_ip_attr) nla_type & NLA_TYPE_MASK;
@@ -1669,7 +1669,7 @@ dissect_ipset_ip_attrs(tvbuff_t *tvb, void *data _U_, proto_tree *tree, int nla_
}
static int
-dissect_ipset_cadt_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_ipset_cadt_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_ipset_cadt_attr type = (enum ws_ipset_cadt_attr) nla_type & NLA_TYPE_MASK;
netlink_netfilter_info_t *info = (netlink_netfilter_info_t *) data;
@@ -1678,7 +1678,7 @@ dissect_ipset_cadt_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_ty
case WS_IPSET_ATTR_IP_FROM:
case WS_IPSET_ATTR_IP_TO:
if (nla_type & NLA_F_NESTED)
- return dissect_netlink_attributes(tvb, &hfi_ipset_ip_attr, ett_ipset_ip_attr, info, info->data, tree, offset, len, dissect_ipset_ip_attrs);
+ return dissect_netlink_attributes(tvb, &hfi_ipset_ip_attr, ett_ipset_ip_attr, info, nl_data, tree, offset, len, dissect_ipset_ip_attrs);
return 0;
case WS_IPSET_ATTR_CIDR:
@@ -1733,12 +1733,12 @@ dissect_ipset_cadt_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_ty
}
static int
-dissect_ipset_adt_data_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_ipset_adt_data_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_ipset_adt_attr type = (enum ws_ipset_adt_attr) nla_type & NLA_TYPE_MASK;
if ((nla_type & NLA_TYPE_MASK) <= WS_IPSET_ATTR_CADT_MAX)
- return dissect_ipset_cadt_attrs(tvb, data, tree, nla_type, offset, len);
+ return dissect_ipset_cadt_attrs(tvb, data, nl_data, tree, nla_type, offset, len);
switch (type) {
case WS_IPSET_ATTR_COMMENT:
@@ -1753,17 +1753,17 @@ dissect_ipset_adt_data_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nl
}
static int
-dissect_ipset_adt_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_ipset_adt_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
netlink_netfilter_info_t *info = (netlink_netfilter_info_t *) data;
if (nla_type & NLA_F_NESTED)
- return dissect_netlink_attributes(tvb, &hfi_ipset_adt_attr, ett_ipset_adt_attr, info, info->data, tree, offset, len, dissect_ipset_adt_data_attrs);
+ return dissect_netlink_attributes(tvb, &hfi_ipset_adt_attr, ett_ipset_adt_attr, info, nl_data, tree, offset, len, dissect_ipset_adt_data_attrs);
return 0;
}
static int
-dissect_ipset_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_ipset_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_ipset_attr type = (enum ws_ipset_attr) nla_type & NLA_TYPE_MASK;
netlink_netfilter_info_t *info = (netlink_netfilter_info_t *) data;
@@ -1800,21 +1800,21 @@ dissect_ipset_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, i
case WS_IPSET_ATTR_DATA:
/* See ipset lib/PROTOCOL, CADT attributes only follow for some commands */
if (nla_type & NLA_F_NESTED) {
- guint16 command = info->data->type & 0xffff;
+ guint16 command = nl_data->type & 0xffff;
if (command == WS_IPSET_CMD_CREATE ||
command == WS_IPSET_CMD_LIST ||
command == WS_IPSET_CMD_SAVE)
- return dissect_netlink_attributes(tvb, &hfi_ipset_cadt_attr, ett_ipset_cadt_attr, info, info->data, tree, offset, len, dissect_ipset_cadt_attrs);
+ return dissect_netlink_attributes(tvb, &hfi_ipset_cadt_attr, ett_ipset_cadt_attr, info, nl_data, tree, offset, len, dissect_ipset_cadt_attrs);
else
- return dissect_netlink_attributes(tvb, &hfi_ipset_adt_attr, ett_ipset_adt_attr, info, info->data, tree, offset, len, dissect_ipset_adt_data_attrs);
+ return dissect_netlink_attributes(tvb, &hfi_ipset_adt_attr, ett_ipset_adt_attr, info, nl_data, tree, offset, len, dissect_ipset_adt_data_attrs);
}
return 0;
case WS_IPSET_ATTR_ADT:
/* Following this, there will be an IPSET_ATTR_DATA with regular ADT attributes, not CADT */
if (nla_type & NLA_F_NESTED)
- return dissect_netlink_attributes(tvb, &hfi_ipset_attr, ett_ipset_attr, info, info->data, tree, offset, len, dissect_ipset_adt_attrs);
+ return dissect_netlink_attributes(tvb, &hfi_ipset_attr, ett_ipset_attr, info, nl_data, tree, offset, len, dissect_ipset_adt_attrs);
return 0;
case WS_IPSET_ATTR_LINENO:
@@ -1828,10 +1828,10 @@ dissect_ipset_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, i
}
static int
-dissect_netfilter_ipset(tvbuff_t *tvb, netlink_netfilter_info_t *info, proto_tree *tree, int offset)
+dissect_netfilter_ipset(tvbuff_t *tvb, netlink_netfilter_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
offset = dissect_netlink_netfilter_header(tvb, tree, offset);
- return dissect_netlink_attributes(tvb, &hfi_ipset_attr, ett_ipset_attr, info, info->data, tree, offset, -1, dissect_ipset_attrs);
+ return dissect_netlink_attributes(tvb, &hfi_ipset_attr, ett_ipset_attr, info, nl_data, tree, offset, -1, dissect_ipset_attrs);
}
@@ -1869,15 +1869,15 @@ static header_field_info hfi_netlink_netfilter_subsys NETLINK_NETFILTER_HFI_INIT
VALS(netlink_netfilter_subsystem_vals), 0xFF00, NULL, HFILL };
static int
-dissect_netlink_netfilter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *_data)
+dissect_netlink_netfilter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- struct packet_netlink_data *data = (struct packet_netlink_data *)_data;
+ struct packet_netlink_data *nl_data = (struct packet_netlink_data *)data;
netlink_netfilter_info_t info;
proto_tree *nlmsg_tree;
proto_item *pi;
int offset = 0;
- DISSECTOR_ASSERT(data && data->magic == PACKET_NETLINK_MAGIC);
+ DISSECTOR_ASSERT(nl_data && nl_data->magic == PACKET_NETLINK_MAGIC);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Netlink netfilter");
col_clear(pinfo->cinfo, COL_INFO);
@@ -1886,50 +1886,50 @@ dissect_netlink_netfilter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
nlmsg_tree = proto_item_add_subtree(pi, ett_netlink_netfilter);
/* Netlink message header (nlmsghdr) */
- offset = dissect_netlink_header(tvb, nlmsg_tree, offset, data->encoding, NULL, NULL);
- proto_tree_add_item(nlmsg_tree, &hfi_netlink_netfilter_subsys, tvb, 4, 2, data->encoding);
- switch (data->type >> 8) {
+ offset = dissect_netlink_header(tvb, nlmsg_tree, offset, nl_data->encoding, NULL, NULL);
+ proto_tree_add_item(nlmsg_tree, &hfi_netlink_netfilter_subsys, tvb, 4, 2, nl_data->encoding);
+ switch (nl_data->type >> 8) {
case WS_NFNL_SUBSYS_CTNETLINK_EXP:
- proto_tree_add_item(nlmsg_tree, &hfi_nfexp_type, tvb, 4, 2, data->encoding);
+ proto_tree_add_item(nlmsg_tree, &hfi_nfexp_type, tvb, 4, 2, nl_data->encoding);
break;
case WS_NFNL_SUBSYS_QUEUE:
- proto_tree_add_item(nlmsg_tree, &hfi_nfq_type, tvb, 4, 2, data->encoding);
+ proto_tree_add_item(nlmsg_tree, &hfi_nfq_type, tvb, 4, 2, nl_data->encoding);
break;
case WS_NFNL_SUBSYS_ULOG:
- proto_tree_add_item(nlmsg_tree, &hfi_netlink_netfilter_ulog_type, tvb, 4, 2, data->encoding);
+ proto_tree_add_item(nlmsg_tree, &hfi_netlink_netfilter_ulog_type, tvb, 4, 2, nl_data->encoding);
break;
case WS_NFNL_SUBSYS_IPSET:
- proto_tree_add_item(nlmsg_tree, &hfi_ipset_command, tvb, 4, 2, data->encoding);
+ proto_tree_add_item(nlmsg_tree, &hfi_ipset_command, tvb, 4, 2, nl_data->encoding);
break;
}
- info.encoding = data->encoding;
+ info.encoding = nl_data->encoding;
info.pinfo = pinfo;
- info.data = data;
+ info.nl_data = nl_data;
info.hw_protocol = 0;
- switch (data->type >> 8) {
+ switch (nl_data->type >> 8) {
case WS_NFNL_SUBSYS_CTNETLINK:
- offset = dissect_netfilter_ct(tvb, &info, nlmsg_tree, offset);
+ offset = dissect_netfilter_ct(tvb, &info, nl_data, nlmsg_tree, offset);
break;
case WS_NFNL_SUBSYS_CTNETLINK_EXP:
- offset = dissect_netfilter_exp(tvb, &info, nlmsg_tree, offset);
+ offset = dissect_netfilter_exp(tvb, &info, nl_data, nlmsg_tree, offset);
break;
case WS_NFNL_SUBSYS_QUEUE:
- offset = dissect_netfilter_queue(tvb, &info, nlmsg_tree, offset);
+ offset = dissect_netfilter_queue(tvb, &info, nl_data, nlmsg_tree, offset);
break;
case WS_NFNL_SUBSYS_ULOG:
- offset = dissect_netfilter_ulog(tvb, &info, nlmsg_tree, offset);
+ offset = dissect_netfilter_ulog(tvb, &info, nl_data, nlmsg_tree, offset);
break;
case WS_NFNL_SUBSYS_IPSET:
- offset = dissect_netfilter_ipset(tvb, &info, nlmsg_tree, offset);
+ offset = dissect_netfilter_ipset(tvb, &info, nl_data, nlmsg_tree, offset);
break;
default:
diff --git a/epan/dissectors/packet-netlink-nl80211.c b/epan/dissectors/packet-netlink-nl80211.c
index 8ca6a93a34..9529f01345 100644
--- a/epan/dissectors/packet-netlink-nl80211.c
+++ b/epan/dissectors/packet-netlink-nl80211.c
@@ -24,9 +24,9 @@ void proto_reg_handoff_netlink_nl80211(void);
typedef struct {
packet_info *pinfo;
- struct packet_netlink_data *data;
+ struct packet_netlink_data *nl_data;
- int encoding; /* copy of data->encoding */
+ int encoding; /* copy of nl_data->encoding */
} netlink_nl80211_info_t;
static dissector_handle_t ieee80211_handle;
@@ -3737,7 +3737,7 @@ 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, proto_tree *tree, int nla_type _U_, int offset, int len)
+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)
{
netlink_nl80211_info_t *info = (netlink_nl80211_info_t *)data;
/*
@@ -3764,11 +3764,11 @@ struct attr_lookup {
unsigned int attr_type;
header_field_info* hfi;
gint* ett;
- int (*func)(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len);
+ int (*func)(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len);
};
static int
-dissect_nested_attr(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len, const struct attr_lookup *nested)
+dissect_nested_attr(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len, const struct attr_lookup *nested)
{
netlink_nl80211_info_t *info = (netlink_nl80211_info_t *)data;
for (int i = 0; nested[i].hfi; i++) {
@@ -3776,7 +3776,7 @@ dissect_nested_attr(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, i
continue;
}
offset = dissect_netlink_attributes(tvb, nested[i].hfi, *nested[i].ett, info,
- info->data, tree, offset, len,
+ nl_data, tree, offset, len,
nested[i].func ? nested[i].func : dissect_nl80211_generic);
break;
}
@@ -3784,7 +3784,7 @@ dissect_nested_attr(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, i
}
static int
-dissect_nested_attr_array(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len, const struct attr_lookup *nested_arr)
+dissect_nested_attr_array(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len, const struct attr_lookup *nested_arr)
{
netlink_nl80211_info_t *info = (netlink_nl80211_info_t *)data;
for (int i = 0; nested_arr[i].hfi; i++) {
@@ -3793,7 +3793,7 @@ dissect_nested_attr_array(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_t
}
offset = dissect_netlink_attributes_array(tvb, nested_arr[i].hfi, *nested_arr[i].ett,
*nested_arr[i].ett, info,
- info->data, tree, offset, len,
+ nl_data, tree, offset, len,
nested_arr[i].func ?
nested_arr[i].func : dissect_nl80211_generic);
break;
@@ -3802,7 +3802,7 @@ dissect_nested_attr_array(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_t
}
static int
-dissect_value(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len, const struct attr_lookup *values)
+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)
{
netlink_nl80211_info_t *info = (netlink_nl80211_info_t *)data;
for (int i = 0; values[i].hfi; i++) {
@@ -3841,7 +3841,7 @@ dissect_information_elements(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
}
static int
-dissect_nl80211_frequency_attr(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nl80211_frequency_attr(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
static const struct attr_lookup nested[] = {
{ WS_NL80211_FREQUENCY_ATTR_DFS_STATE, &hfi_nl80211_dfs_state, &ett_nl80211_dfs_state, NULL},
@@ -3852,12 +3852,12 @@ dissect_nl80211_frequency_attr(tvbuff_t *tvb, void *data, proto_tree *tree, int
int offset_end = offset + len;
if (offset < offset_end) {
- offset = dissect_nested_attr(tvb, data, tree, nla_type, offset, len, nested);
+ offset = dissect_nested_attr(tvb, data, nl_data, tree, nla_type, offset, len, nested);
}
if (offset < offset_end) {
switch (type) {
default:
- offset = dissect_nl80211_generic(tvb, data, tree, nla_type, offset, len);
+ offset = dissect_nl80211_generic(tvb, data, nl_data, tree, nla_type, offset, len);
break;
}
}
@@ -3865,7 +3865,7 @@ dissect_nl80211_frequency_attr(tvbuff_t *tvb, void *data, proto_tree *tree, int
}
static int
-dissect_nl80211_band_attr(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nl80211_band_attr(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
static const struct attr_lookup nested_arr[] = {
{ WS_NL80211_BAND_ATTR_FREQS, &hfi_nl80211_frequency_attr, &ett_nl80211_frequency_attr, dissect_nl80211_frequency_attr },
@@ -3877,13 +3877,13 @@ dissect_nl80211_band_attr(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_t
int offset_end = offset + len;
if (offset < offset_end) {
- offset = dissect_nested_attr_array(tvb, data, tree, nla_type, offset, len, nested_arr);
+ offset = dissect_nested_attr_array(tvb, data, nl_data, tree, nla_type, offset, len, nested_arr);
}
if (offset < offset_end) {
switch (type) {
/* TODO add more fields here? */
default:
- offset = dissect_nl80211_generic(tvb, data, tree, nla_type, offset, len);
+ offset = dissect_nl80211_generic(tvb, data, nl_data, tree, nla_type, offset, len);
break;
}
}
@@ -3891,7 +3891,7 @@ dissect_nl80211_band_attr(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_t
}
static int
-dissect_nl80211_bss(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nl80211_bss(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
static const struct attr_lookup values[] = {
{ WS_NL80211_BSS_STATUS, &hfi_nl80211_bss_status, NULL, NULL },
@@ -3902,7 +3902,7 @@ dissect_nl80211_bss(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, i
int offset_end = offset + len;
if (offset < offset_end) {
- offset = dissect_value(tvb, data, tree, nla_type, offset, len, values);
+ offset = dissect_value(tvb, data, nl_data, tree, nla_type, offset, len, values);
}
if (offset < offset_end) {
netlink_nl80211_info_t *info = (netlink_nl80211_info_t *)data;
@@ -3912,7 +3912,7 @@ dissect_nl80211_bss(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, i
offset = dissect_information_elements(tvb, info->pinfo, tree, offset, len);
break;
default:
- offset = dissect_nl80211_generic(tvb, data, tree, nla_type, offset, len);
+ offset = dissect_nl80211_generic(tvb, data, nl_data, tree, nla_type, offset, len);
break;
}
}
@@ -3920,7 +3920,7 @@ dissect_nl80211_bss(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, i
}
static int
-dissect_nl80211_tid_stats(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nl80211_tid_stats(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
static const struct attr_lookup nested[] = {
{ WS_NL80211_TID_STATS_TXQ_STATS, &hfi_nl80211_txq_stats, &ett_nl80211_txq_stats, NULL},
@@ -3930,12 +3930,12 @@ dissect_nl80211_tid_stats(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_t
enum ws_nl80211_tid_stats type = (enum ws_nl80211_tid_stats) nla_type & NLA_TYPE_MASK;
int offset_end = offset + len;
if (offset < offset_end) {
- offset = dissect_nested_attr(tvb, data, tree, nla_type, offset, len, nested);
+ offset = dissect_nested_attr(tvb, data, nl_data, tree, nla_type, offset, len, nested);
}
if (offset < offset_end) {
switch (type) {
default:
- offset = dissect_nl80211_generic(tvb, data, tree, nla_type, offset, len);
+ offset = dissect_nl80211_generic(tvb, data, nl_data, tree, nla_type, offset, len);
break;
}
}
@@ -3943,7 +3943,7 @@ dissect_nl80211_tid_stats(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_t
}
static int
-dissect_nl80211_sta_info(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nl80211_sta_info(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
static const struct attr_lookup nested[] = {
{ WS_NL80211_STA_INFO_TX_BITRATE, &hfi_nl80211_rate_info, &ett_nl80211_rate_info, NULL},
@@ -3959,10 +3959,10 @@ dissect_nl80211_sta_info(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_ty
enum ws_nl80211_sta_info type = (enum ws_nl80211_sta_info) nla_type & NLA_TYPE_MASK;
int offset_end = offset + len;
if (offset < offset_end) {
- offset = dissect_nested_attr(tvb, data, tree, nla_type, offset, len, nested);
+ offset = dissect_nested_attr(tvb, data, nl_data, tree, nla_type, offset, len, nested);
}
if (offset < offset_end) {
- offset = dissect_nested_attr_array(tvb, data, tree, nla_type, offset, len, nested_arr);
+ 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;
@@ -3976,7 +3976,7 @@ dissect_nl80211_sta_info(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_ty
offset += len;
break;
default:
- offset = dissect_nl80211_generic(tvb, data, tree, nla_type, offset, len);
+ offset = dissect_nl80211_generic(tvb, data, nl_data, tree, nla_type, offset, len);
break;
}
}
@@ -3985,7 +3985,7 @@ dissect_nl80211_sta_info(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_ty
static int
-dissect_nl80211_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_nl80211_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
static const struct attr_lookup nested[] = {
{ WS_NL80211_ATTR_SUPPORTED_IFTYPES, &hfi_nl80211_iftype, &ett_nl80211_iftype, NULL },
@@ -4058,13 +4058,13 @@ dissect_nl80211_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type,
enum ws_nl80211_attrs type = (enum ws_nl80211_attrs) nla_type & NLA_TYPE_MASK;
int offset_end = offset + len;
if (offset < offset_end) {
- offset = dissect_nested_attr(tvb, data, tree, nla_type, offset, len, nested);
+ offset = dissect_nested_attr(tvb, data, nl_data, tree, nla_type, offset, len, nested);
}
if (offset < offset_end) {
- offset = dissect_nested_attr_array(tvb, data, tree, nla_type, offset, len, nested_arr);
+ offset = dissect_nested_attr_array(tvb, data, nl_data, tree, nla_type, offset, len, nested_arr);
}
if (offset < offset_end) {
- offset = dissect_value(tvb, data, tree, nla_type, offset, len, values);
+ offset = dissect_value(tvb, data, nl_data, tree, nla_type, offset, len, values);
}
if (offset < offset_end) {
netlink_nl80211_info_t *info = (netlink_nl80211_info_t *)data;
@@ -4095,7 +4095,7 @@ dissect_nl80211_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type,
break;
/* TODO add more fields here? */
default:
- offset = dissect_nl80211_generic(tvb, data, tree, nla_type, offset, len);
+ offset = dissect_nl80211_generic(tvb, data, nl_data, tree, nla_type, offset, len);
break;
}
}
@@ -4116,20 +4116,20 @@ dissect_netlink_nl80211(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
col_set_str(pinfo->cinfo, COL_PROTOCOL, "nl80211");
col_clear(pinfo->cinfo, COL_INFO);
- offset = dissect_genl_header(tvb, genl_info, &hfi_nl80211_commands);
+ offset = dissect_genl_header(tvb, genl_info, genl_info->nl_data, &hfi_nl80211_commands);
/* Return if command has no payload */
if (!tvb_reported_length_remaining(tvb, offset))
return offset;
- info.data = genl_info->data;
+ 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);
nlmsg_tree = proto_item_add_subtree(pi, ett_nl80211);
- offset = dissect_netlink_attributes(tvb, &hfi_nl80211_attrs, ett_nl80211_attrs, &info, info.data, nlmsg_tree, offset, -1, dissect_nl80211_attrs);
+ offset = dissect_netlink_attributes(tvb, &hfi_nl80211_attrs, ett_nl80211_attrs, &info, genl_info->nl_data, nlmsg_tree, offset, -1, dissect_nl80211_attrs);
return offset;
}
diff --git a/epan/dissectors/packet-netlink-route.c b/epan/dissectors/packet-netlink-route.c
index c9b904df0e..ac463ac5dd 100644
--- a/epan/dissectors/packet-netlink-route.c
+++ b/epan/dissectors/packet-netlink-route.c
@@ -25,9 +25,9 @@ void proto_reg_handoff_netlink_route(void);
struct netlink_route_info {
packet_info *pinfo;
- struct packet_netlink_data *data;
+ struct packet_netlink_data *nl_data;
- int encoding; /* copy of data->encoding */
+ int encoding; /* copy of nl_data->encoding */
gboolean legacy;
};
@@ -332,8 +332,6 @@ static gint ett_netlink_route_attr_linkstats = -1;
static gint ett_netlink_route_attr_linkstats_rxerrs = -1;
static gint ett_netlink_route_attr_linkstats_txerrs = -1;
-typedef int netlink_route_attributes_cb_t(tvbuff_t *, struct netlink_route_info *, proto_tree *, int rta_type, int offset, int len);
-
static void
_fill_label_value_string_bitmask(char *label, guint32 value, const value_string *vals)
{
@@ -362,7 +360,7 @@ _fill_label_value_string_bitmask(char *label, guint32 value, const value_string
}
static int
-dissect_netlink_route_attributes(tvbuff_t *tvb, header_field_info *hfi_type, struct netlink_route_info *info, proto_tree *tree, int offset, netlink_route_attributes_cb_t cb)
+dissect_netlink_route_attributes(tvbuff_t *tvb, header_field_info *hfi_type, struct netlink_route_info *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset, netlink_attributes_cb_t cb)
{
/* XXX, it's *almost* the same:
* - rtnetlink is using struct rtattr with shorts
@@ -370,7 +368,7 @@ dissect_netlink_route_attributes(tvbuff_t *tvb, header_field_info *hfi_type, str
*/
/* XXX, nice */
- return dissect_netlink_attributes(tvb, hfi_type, ett_netlink_route_attr, info, info->data, tree, offset, -1, (netlink_attributes_cb_t *) cb);
+ return dissect_netlink_attributes(tvb, hfi_type, ett_netlink_route_attr, info, nl_data, tree, offset, -1, cb);
}
/* Interface */
@@ -440,7 +438,7 @@ 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, proto_tree *tree, int offset)
+dissect_netlink_route_ifinfomsg(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
{
proto_item *ti;
proto_tree *if_flags_tree;
@@ -770,7 +768,7 @@ static header_field_info* linkstat_txerr_hfis[] = {
};
static int
-dissect_netlink_route_ifla_linkstats(tvbuff_t *tvb, struct netlink_route_info *info, proto_tree *tree, int offset, int byte_size) {
+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) {
proto_tree* rxerr_subtree;
const gint rxerr_hfis_len = (sizeof(linkstat_rxerr_hfis) / sizeof(header_field_info*));
proto_tree* txerr_subtree;
@@ -798,8 +796,9 @@ dissect_netlink_route_ifla_linkstats(tvbuff_t *tvb, struct netlink_route_info *i
}
static int
-dissect_netlink_route_ifla_attrs(tvbuff_t *tvb, struct netlink_route_info *info, proto_tree *tree, int rta_type, int offset, int len)
+dissect_netlink_route_ifla_attrs(tvbuff_t *tvb, void *data, 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_ifla_attr_type type = (enum ws_ifla_attr_type) rta_type;
const guint8* str;
proto_tree* subtree;
@@ -861,10 +860,10 @@ dissect_netlink_route_ifla_attrs(tvbuff_t *tvb, struct netlink_route_info *info,
return 1;
case WS_IFLA_STATS:
subtree = proto_tree_add_subtree(tree, tvb, offset, len, ett_netlink_route_attr_linkstats, NULL, "Statistics");
- return dissect_netlink_route_ifla_linkstats(tvb, info, subtree, offset, 4);
+ return dissect_netlink_route_ifla_linkstats(tvb, info, nl_data, subtree, offset, 4);
case WS_IFLA_STATS64:
subtree = proto_tree_add_subtree(tree, tvb, offset, len, ett_netlink_route_attr_linkstats, NULL, "Statistics");
- return dissect_netlink_route_ifla_linkstats(tvb, info, subtree, offset, 8);
+ return dissect_netlink_route_ifla_linkstats(tvb, info, nl_data, subtree, offset, 8);
case WS_IFLA_QDISC:
proto_tree_add_item_ret_string(tree, &hfi_netlink_route_ifla_qdisc, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
proto_item_append_text(tree, ": %s", str);
@@ -949,7 +948,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, proto_tree *tree, int offset)
+dissect_netlink_route_ifaddrmsg(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
{
proto_tree_add_item(tree, &hfi_netlink_route_ifa_family, tvb, offset, 1, ENC_NA);
offset += 1;
@@ -1010,8 +1009,9 @@ 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, struct netlink_route_info *info _U_, proto_tree *tree, int rta_type, int offset, int len)
+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)
{
+ 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;
@@ -1130,7 +1130,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, proto_tree *tree, int offset)
+dissect_netlink_route_rtmsg(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
{
proto_tree_add_item(tree, &hfi_netlink_route_rt_family, tvb, offset, 1, ENC_NA);
offset += 1;
@@ -1215,8 +1215,9 @@ 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, struct netlink_route_info *info, proto_tree *tree, int rta_type, int offset, int len)
+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)
{
+ 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) {
@@ -1286,7 +1287,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, proto_tree *tree, int offset)
+dissect_netlink_route_ndmsg(tvbuff_t *tvb, struct netlink_route_info *info, struct packet_netlink_data *nl_data _U_, proto_tree *tree, int offset)
{
proto_tree_add_item(tree, &hfi_netlink_route_nd_family, tvb, offset, 1, ENC_NA);
offset += 1;
@@ -1380,15 +1381,15 @@ static header_field_info hfi_netlink_route_nltype NETLINK_ROUTE_HFI_INIT =
&netlink_route_type_vals_ext, 0x00, NULL, HFILL };
static int
-dissect_netlink_route(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *_data)
+dissect_netlink_route(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
struct netlink_route_info info;
- struct packet_netlink_data *data = (struct packet_netlink_data *)_data;
+ struct packet_netlink_data *nl_data = (struct packet_netlink_data *)data;
proto_tree *nlmsg_tree;
proto_item *pi;
int offset = 0;
- DISSECTOR_ASSERT(data && data->magic == PACKET_NETLINK_MAGIC);
+ DISSECTOR_ASSERT(nl_data && nl_data->magic == PACKET_NETLINK_MAGIC);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Netlink route");
col_clear(pinfo->cinfo, COL_INFO);
@@ -1397,49 +1398,49 @@ dissect_netlink_route(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
nlmsg_tree = proto_item_add_subtree(pi, ett_netlink_route);
/* Netlink message header (nlmsghdr) */
- offset = dissect_netlink_header(tvb, nlmsg_tree, offset, data->encoding, &hfi_netlink_route_nltype, NULL);
+ offset = dissect_netlink_header(tvb, nlmsg_tree, offset, nl_data->encoding, &hfi_netlink_route_nltype, NULL);
- info.encoding = data->encoding;
+ info.encoding = nl_data->encoding;
info.pinfo = pinfo;
- info.data = data;
+ info.nl_data = nl_data;
- switch (data->type) {
+ switch (nl_data->type) {
case WS_RTM_NEWLINK:
case WS_RTM_DELLINK:
case WS_RTM_GETLINK:
/* backward compatibility with legacy tools; 16 is sizeof(struct ifinfomsg) */
- info.legacy = (data->type == WS_RTM_GETLINK) && (tvb_reported_length_remaining(tvb, offset) < 16);
- offset = dissect_netlink_route_ifinfomsg(tvb, &info, nlmsg_tree, offset);
+ info.legacy = (nl_data->type == WS_RTM_GETLINK) && (tvb_reported_length_remaining(tvb, offset) < 16);
+ offset = dissect_netlink_route_ifinfomsg(tvb, &info, nl_data, nlmsg_tree, offset);
/* Optional attributes */
- offset = dissect_netlink_route_attributes(tvb, &hfi_netlink_route_ifla_attr_type, &info, nlmsg_tree, offset, dissect_netlink_route_ifla_attrs);
+ offset = dissect_netlink_route_attributes(tvb, &hfi_netlink_route_ifla_attr_type, &info, nl_data, nlmsg_tree, offset, dissect_netlink_route_ifla_attrs);
break;
case WS_RTM_NEWADDR:
case WS_RTM_DELADDR:
case WS_RTM_GETADDR:
/* backward compatibility with legacy tools; 8 is sizeof(struct ifaddrmsg) */
- info.legacy = (data->type == WS_RTM_GETADDR) && (tvb_reported_length_remaining(tvb, offset) < 8);
- offset = dissect_netlink_route_ifaddrmsg(tvb, &info, nlmsg_tree, offset);
+ info.legacy = (nl_data->type == WS_RTM_GETADDR) && (tvb_reported_length_remaining(tvb, offset) < 8);
+ offset = dissect_netlink_route_ifaddrmsg(tvb, &info, nl_data, nlmsg_tree, offset);
/* Optional attributes */
- offset = dissect_netlink_route_attributes(tvb, &hfi_netlink_route_ifa_attr_type, &info, nlmsg_tree, offset, dissect_netlink_route_ifa_attrs);
+ offset = dissect_netlink_route_attributes(tvb, &hfi_netlink_route_ifa_attr_type, &info, nl_data, nlmsg_tree, offset, dissect_netlink_route_ifa_attrs);
break;
case WS_RTM_NEWROUTE:
case WS_RTM_DELROUTE:
case WS_RTM_GETROUTE:
/* backward compatibility with legacy tools; 12 is sizeof(struct rtmsg) */
- info.legacy = (data->type == WS_RTM_GETROUTE) && (tvb_reported_length_remaining(tvb, offset) < 12);
- offset = dissect_netlink_route_rtmsg(tvb, &info, nlmsg_tree, offset);
+ info.legacy = (nl_data->type == WS_RTM_GETROUTE) && (tvb_reported_length_remaining(tvb, offset) < 12);
+ offset = dissect_netlink_route_rtmsg(tvb, &info, nl_data, nlmsg_tree, offset);
/* Optional attributes */
- offset = dissect_netlink_route_attributes(tvb, &hfi_netlink_route_rta_attr_type, &info, nlmsg_tree, offset, dissect_netlink_route_route_attrs);
+ offset = dissect_netlink_route_attributes(tvb, &hfi_netlink_route_rta_attr_type, &info, nl_data, nlmsg_tree, offset, dissect_netlink_route_route_attrs);
break;
case WS_RTM_NEWNEIGH:
case WS_RTM_DELNEIGH:
case WS_RTM_GETNEIGH:
/* backward compatibility with legacy tools; 12 is sizeof(struct ndmsg) */
- info.legacy = (data->type == WS_RTM_GETNEIGH) && (tvb_reported_length_remaining(tvb, offset) < 12);
- offset = dissect_netlink_route_ndmsg(tvb, &info, nlmsg_tree, offset);
+ info.legacy = (nl_data->type == WS_RTM_GETNEIGH) && (tvb_reported_length_remaining(tvb, offset) < 12);
+ offset = dissect_netlink_route_ndmsg(tvb, &info, nl_data, nlmsg_tree, offset);
break;
}
diff --git a/epan/dissectors/packet-netlink-sock_diag.c b/epan/dissectors/packet-netlink-sock_diag.c
index 6a079c841e..5ac6dfa930 100644
--- a/epan/dissectors/packet-netlink-sock_diag.c
+++ b/epan/dissectors/packet-netlink-sock_diag.c
@@ -22,9 +22,9 @@ void proto_reg_handoff_netlink_sock_diag(void);
typedef struct {
packet_info *pinfo;
- struct packet_netlink_data *data;
+ struct packet_netlink_data *nl_data;
- int encoding; /* copy of data->encoding */
+ int encoding; /* copy of nl_data->encoding */
} netlink_sock_diag_info_t;
static int proto_netlink_sock_diag;
@@ -271,7 +271,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, tvbuff_t *tvb, int offset, int len)
+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)
{
static header_field_info *hfis[] = {
&hfi_netlink_sock_diag_rmem_alloc,
@@ -308,7 +308,7 @@ static header_field_info hfi_netlink_sock_diag_cookie NETLINK_SOCK_DIAG_HFI_INIT
NULL, 0x00, NULL, HFILL };
static void
-sock_diag_proto_tree_add_cookie(proto_tree *tree, netlink_sock_diag_info_t *info _U_, tvbuff_t *tvb, int offset)
+sock_diag_proto_tree_add_cookie(proto_tree *tree, netlink_sock_diag_info_t *info _U_, struct packet_netlink_data *nl_data _U_, tvbuff_t *tvb, int offset)
{
guint64 cookie;
@@ -369,7 +369,7 @@ static header_field_info hfi_netlink_sock_diag_unix_peer_inode NETLINK_SOCK_DIAG
NULL, 0x00, NULL, HFILL };
static int
-dissect_netlink_unix_sock_diag_reply_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_netlink_unix_sock_diag_reply_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_unix_diag_attr_type type = (enum ws_unix_diag_attr_type) nla_type;
netlink_sock_diag_info_t *info = (netlink_sock_diag_info_t *) data;
@@ -411,7 +411,7 @@ dissect_netlink_unix_sock_diag_reply_attrs(tvbuff_t *tvb, void *data, proto_tree
return 0;
case WS_UNIX_DIAG_MEMINFO:
- return dissect_sock_diag_meminfo(tree, info, tvb, offset, len);
+ return dissect_sock_diag_meminfo(tree, info, nl_data, tvb, offset, len);
case WS_UNIX_DIAG_SHUTDOWN:
if (len == 1)
@@ -428,7 +428,7 @@ dissect_netlink_unix_sock_diag_reply_attrs(tvbuff_t *tvb, void *data, proto_tree
/* AF_UNIX */
static int
-dissect_sock_diag_unix_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, proto_tree *tree, int offset)
+dissect_sock_diag_unix_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
proto_tree_add_item(tree, &hfi_netlink_sock_diag_family, tvb, offset, 1, ENC_NA);
offset += 1;
@@ -447,10 +447,10 @@ dissect_sock_diag_unix_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, prot
proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
offset += 4;
- sock_diag_proto_tree_add_cookie(tree, info, tvb, offset);
+ sock_diag_proto_tree_add_cookie(tree, info, nl_data, tvb, offset);
offset += 8;
- return dissect_netlink_attributes(tvb, &hfi_netlink_sock_diag_unix_attr, ett_netlink_sock_diag_attr, info, info->data, tree, offset, -1, dissect_netlink_unix_sock_diag_reply_attrs);
+ return dissect_netlink_attributes(tvb, &hfi_netlink_sock_diag_unix_attr, ett_netlink_sock_diag_attr, info, nl_data, tree, offset, -1, dissect_netlink_unix_sock_diag_reply_attrs);
}
/* AF_UNIX request */
@@ -484,7 +484,7 @@ 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, proto_tree *tree, int offset)
+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)
{
proto_item *ti;
proto_tree *flags_tree;
@@ -506,7 +506,7 @@ dissect_sock_diag_unix_request_show(tvbuff_t *tvb, netlink_sock_diag_info_t *inf
}
static int
-dissect_sock_diag_unix_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info, proto_tree *tree, int offset)
+dissect_sock_diag_unix_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
proto_tree_add_item(tree, &hfi_netlink_sock_diag_family, tvb, offset, 1, ENC_NA);
offset += 1;
@@ -523,9 +523,9 @@ dissect_sock_diag_unix_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info, pr
proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
offset += 4;
- offset = dissect_sock_diag_unix_request_show(tvb, info, tree, offset);
+ offset = dissect_sock_diag_unix_request_show(tvb, info, nl_data, tree, offset);
- sock_diag_proto_tree_add_cookie(tree, info, tvb, offset);
+ sock_diag_proto_tree_add_cookie(tree, info, nl_data, tvb, offset);
offset += 8;
return offset;
@@ -558,7 +558,7 @@ static header_field_info hfi_netlink_sock_diag_inet_attr NETLINK_SOCK_DIAG_HFI_I
VALS(netlink_sock_diag_inet_attr_vals), NLA_TYPE_MASK, NULL, HFILL };
static int
-dissect_sock_diag_inet_attributes(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_sock_diag_inet_attributes(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_inet_diag_attr_type type = (enum ws_inet_diag_attr_type) nla_type;
netlink_sock_diag_info_t *info = (netlink_sock_diag_info_t *) data;
@@ -583,7 +583,7 @@ dissect_sock_diag_inet_attributes(tvbuff_t *tvb, void *data, proto_tree *tree, i
return 0;
case WS_INET_DIAG_SKMEMINFO:
- return dissect_sock_diag_meminfo(tree, info, tvb, offset, len);
+ return dissect_sock_diag_meminfo(tree, info, nl_data, tvb, offset, len);
case WS_INET_DIAG_SHUTDOWN:
if (len == 1)
@@ -639,7 +639,7 @@ static header_field_info hfi_netlink_sock_diag_inet_interface NETLINK_SOCK_DIAG_
NULL, 0x00, NULL, HFILL };
static int
-dissect_sock_diag_inet_sockid(tvbuff_t *tvb, netlink_sock_diag_info_t *info, proto_tree *tree, int offset, int family)
+dissect_sock_diag_inet_sockid(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset, int family)
{
proto_tree_add_item(tree, &hfi_netlink_sock_diag_inet_sport, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
@@ -678,7 +678,7 @@ dissect_sock_diag_inet_sockid(tvbuff_t *tvb, netlink_sock_diag_info_t *info, pro
proto_tree_add_item(tree, &hfi_netlink_sock_diag_inet_interface, tvb, offset, 4, info->encoding);
offset += 4;
- sock_diag_proto_tree_add_cookie(tree, info, tvb, offset);
+ sock_diag_proto_tree_add_cookie(tree, info, nl_data, tvb, offset);
offset += 8;
return offset;
@@ -703,7 +703,7 @@ static header_field_info hfi_netlink_sock_diag_inet_states NETLINK_SOCK_DIAG_HFI
NULL, 0x00, NULL, HFILL };
static int
-dissect_sock_diag_inet_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, proto_tree *tree, int offset)
+dissect_sock_diag_inet_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
guint8 af_family;
@@ -717,7 +717,7 @@ dissect_sock_diag_inet_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, prot
/* XXX timer retrans */
offset += 2;
- offset = dissect_sock_diag_inet_sockid(tvb, info, tree, offset, af_family);
+ offset = dissect_sock_diag_inet_sockid(tvb, info, nl_data, tree, offset, af_family);
/* XXX expires */
offset += 4;
@@ -734,13 +734,13 @@ dissect_sock_diag_inet_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, prot
proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
offset += 4;
- return dissect_netlink_attributes(tvb, &hfi_netlink_sock_diag_inet_attr, ett_netlink_sock_diag_attr, info, info->data, tree, offset, -1, dissect_sock_diag_inet_attributes);
+ 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);
}
/* AF_INET request */
static int
-dissect_sock_diag_inet_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info, proto_tree *tree, int offset)
+dissect_sock_diag_inet_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
guint8 af_family;
@@ -765,7 +765,7 @@ dissect_sock_diag_inet_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info, pr
proto_tree_add_item(tree, &hfi_netlink_sock_diag_inet_states, tvb, offset, 4, ENC_NA);
offset += 4;
- offset = dissect_sock_diag_inet_sockid(tvb, info, tree, offset, af_family);
+ offset = dissect_sock_diag_inet_sockid(tvb, info, nl_data, tree, offset, af_family);
return offset;
}
@@ -785,14 +785,14 @@ static header_field_info hfi_netlink_sock_diag_netlink_attr NETLINK_SOCK_DIAG_HF
VALS(netlink_sock_diag_netlink_vals), NLA_TYPE_MASK, NULL, HFILL };
static int
-dissect_sock_diag_netlink_attributes(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_sock_diag_netlink_attributes(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_netlink_diag_attr_type type = (enum ws_netlink_diag_attr_type) nla_type;
netlink_sock_diag_info_t *info = (netlink_sock_diag_info_t *) data;
switch (type) {
case WS_NETLINK_DIAG_MEMINFO:
- return dissect_sock_diag_meminfo(tree, info, tvb, offset, len);
+ return dissect_sock_diag_meminfo(tree, info, nl_data, tvb, offset, len);
case WS_NETLINK_DIAG_GROUPS:
case WS_NETLINK_DIAG_RX_RING:
@@ -817,7 +817,7 @@ static header_field_info hfi_netlink_sock_diag_netlink_dst_port_id NETLINK_SOCK_
NULL, 0x00, NULL, HFILL };
static int
-dissect_sock_diag_netlink_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, proto_tree *tree, int offset)
+dissect_sock_diag_netlink_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
proto_tree_add_item(tree, &hfi_netlink_sock_diag_family, tvb, offset, 1, ENC_NA);
offset += 1;
@@ -852,10 +852,10 @@ dissect_sock_diag_netlink_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, p
proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
offset += 4;
- sock_diag_proto_tree_add_cookie(tree, info, tvb, offset);
+ sock_diag_proto_tree_add_cookie(tree, info, nl_data, tvb, offset);
offset += 8;
- return dissect_netlink_attributes(tvb, &hfi_netlink_sock_diag_netlink_attr, ett_netlink_sock_diag_attr, info, info->data, tree, offset, -1, dissect_sock_diag_netlink_attributes);
+ return dissect_netlink_attributes(tvb, &hfi_netlink_sock_diag_netlink_attr, ett_netlink_sock_diag_attr, info, nl_data, tree, offset, -1, dissect_sock_diag_netlink_attributes);
}
/* AF_NETLINK request */
@@ -877,7 +877,7 @@ 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, proto_tree *tree, int offset)
+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)
{
proto_item *ti;
proto_tree *flags_tree;
@@ -896,7 +896,7 @@ dissect_sock_diag_netlink_request_show(tvbuff_t *tvb, netlink_sock_diag_info_t *
}
static int
-dissect_sock_diag_netlink_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info, proto_tree *tree, int offset)
+dissect_sock_diag_netlink_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
/* XXX, 255 for all */
proto_tree_add_item(tree, &hfi_netlink_sock_diag_family, tvb, offset, 1, ENC_NA);
@@ -911,9 +911,9 @@ dissect_sock_diag_netlink_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info,
proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
offset += 4;
- offset = dissect_sock_diag_netlink_request_show(tvb, info, tree, offset);
+ offset = dissect_sock_diag_netlink_request_show(tvb, info, nl_data, tree, offset);
- sock_diag_proto_tree_add_cookie(tree, info, tvb, offset);
+ sock_diag_proto_tree_add_cookie(tree, info, nl_data, tvb, offset);
offset += 8;
return offset;
@@ -922,14 +922,14 @@ dissect_sock_diag_netlink_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info,
/* AF_PACKET attributes */
static int
-dissect_netlink_packet_sock_diag_reply_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int offset, int len)
+dissect_netlink_packet_sock_diag_reply_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len)
{
enum ws_packet_diag_attr_type type = (enum ws_packet_diag_attr_type) nla_type;
netlink_sock_diag_info_t *info = (netlink_sock_diag_info_t *) data;
switch (type) {
case WS_PACKET_DIAG_MEMINFO:
- return dissect_sock_diag_meminfo(tree, info, tvb, offset, len);
+ return dissect_sock_diag_meminfo(tree, info, nl_data, tvb, offset, len);
case WS_PACKET_DIAG_INFO:
case WS_PACKET_DIAG_MCLIST:
@@ -966,7 +966,7 @@ static header_field_info hfi_netlink_sock_diag_packet_proto NETLINK_SOCK_DIAG_HF
VALS(etype_vals) /* XXX + Linux specific */, 0x00, NULL, HFILL };
static int
-dissect_sock_diag_packet_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, proto_tree *tree, int offset)
+dissect_sock_diag_packet_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
proto_tree_add_item(tree, &hfi_netlink_sock_diag_family, tvb, offset, 1, ENC_NA);
offset += 1;
@@ -980,10 +980,10 @@ dissect_sock_diag_packet_reply(tvbuff_t *tvb, netlink_sock_diag_info_t *info, pr
proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
offset += 4;
- sock_diag_proto_tree_add_cookie(tree, info, tvb, offset);
+ sock_diag_proto_tree_add_cookie(tree, info, nl_data, tvb, offset);
offset += 8;
- return dissect_netlink_attributes(tvb, &hfi_netlink_sock_diag_packet_attr, ett_netlink_sock_diag_attr, info, info->data, tree, offset, -1, dissect_netlink_packet_sock_diag_reply_attrs);
+ return dissect_netlink_attributes(tvb, &hfi_netlink_sock_diag_packet_attr, ett_netlink_sock_diag_attr, info, nl_data, tree, offset, -1, dissect_netlink_packet_sock_diag_reply_attrs);
}
/* AF_PACKET request */
@@ -1017,7 +1017,7 @@ 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, proto_tree *tree, int offset)
+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)
{
proto_item *ti;
proto_tree *flags_tree;
@@ -1039,7 +1039,7 @@ dissect_sock_diag_packet_request_show(tvbuff_t *tvb, netlink_sock_diag_info_t *i
}
static int
-dissect_sock_diag_packet_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info, proto_tree *tree, int offset)
+dissect_sock_diag_packet_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
proto_tree_add_item(tree, &hfi_netlink_sock_diag_family, tvb, offset, 1, ENC_NA);
offset += 1;
@@ -1053,9 +1053,9 @@ dissect_sock_diag_packet_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info,
proto_tree_add_item(tree, &hfi_netlink_sock_diag_inode, tvb, offset, 4, info->encoding);
offset += 4;
- offset = dissect_sock_diag_packet_request_show(tvb, info, tree, offset);
+ offset = dissect_sock_diag_packet_request_show(tvb, info, nl_data, tree, offset);
- sock_diag_proto_tree_add_cookie(tree, info, tvb, offset);
+ sock_diag_proto_tree_add_cookie(tree, info, nl_data, tvb, offset);
offset += 8;
return offset;
@@ -1064,7 +1064,7 @@ dissect_sock_diag_packet_request(tvbuff_t *tvb, netlink_sock_diag_info_t *info,
/* WS_SOCK_DIAG_BY_FAMILY dissection */
static int
-dissect_sock_diag_by_family(tvbuff_t *tvb, netlink_sock_diag_info_t *info, proto_tree *tree, int offset)
+dissect_sock_diag_by_family(tvbuff_t *tvb, netlink_sock_diag_info_t *info, struct packet_netlink_data *nl_data, proto_tree *tree, int offset)
{
const gboolean is_req = (info->pinfo->p2p_dir == P2P_DIR_SENT);
guint8 af_family;
@@ -1074,27 +1074,27 @@ dissect_sock_diag_by_family(tvbuff_t *tvb, netlink_sock_diag_info_t *info, proto
switch (af_family) {
case LINUX_AF_LOCAL:
offset = (is_req) ?
- dissect_sock_diag_unix_request(tvb, info, tree, offset) :
- dissect_sock_diag_unix_reply(tvb, info, tree, offset);
+ dissect_sock_diag_unix_request(tvb, info, nl_data, tree, offset) :
+ dissect_sock_diag_unix_reply(tvb, info, nl_data, tree, offset);
break;
case LINUX_AF_INET:
case LINUX_AF_INET6:
offset = (is_req) ?
- dissect_sock_diag_inet_request(tvb, info, tree, offset) :
- dissect_sock_diag_inet_reply(tvb, info, tree, offset);
+ dissect_sock_diag_inet_request(tvb, info, nl_data, tree, offset) :
+ dissect_sock_diag_inet_reply(tvb, info, nl_data, tree, offset);
break;
case LINUX_AF_NETLINK:
offset = (is_req) ?
- dissect_sock_diag_netlink_request(tvb, info, tree, offset) :
- dissect_sock_diag_netlink_reply(tvb, info, tree, offset);
+ dissect_sock_diag_netlink_request(tvb, info, nl_data, tree, offset) :
+ dissect_sock_diag_netlink_reply(tvb, info, nl_data, tree, offset);
break;
case LINUX_AF_PACKET:
offset = (is_req) ?
- dissect_sock_diag_packet_request(tvb, info, tree, offset) :
- dissect_sock_diag_packet_reply(tvb, info, tree, offset);
+ dissect_sock_diag_packet_request(tvb, info, nl_data, tree, offset) :
+ dissect_sock_diag_packet_reply(tvb, info, nl_data, tree, offset);
break;
}
@@ -1114,15 +1114,15 @@ static header_field_info hfi_netlink_sock_diag_nltype NETLINK_SOCK_DIAG_HFI_INIT
VALS(netlink_sock_diag_type_vals), 0x00, NULL, HFILL };
static int
-dissect_netlink_sock_diag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *_data)
+dissect_netlink_sock_diag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- struct packet_netlink_data *data = (struct packet_netlink_data *)_data;
+ struct packet_netlink_data *nl_data = (struct packet_netlink_data *)data;
netlink_sock_diag_info_t info;
proto_tree *nlmsg_tree;
proto_item *pi;
int offset = 0;
- DISSECTOR_ASSERT(data && data->magic == PACKET_NETLINK_MAGIC);
+ DISSECTOR_ASSERT(nl_data && nl_data->magic == PACKET_NETLINK_MAGIC);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Netlink sock diag");
col_clear(pinfo->cinfo, COL_INFO);
@@ -1131,20 +1131,20 @@ dissect_netlink_sock_diag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
nlmsg_tree = proto_item_add_subtree(pi, ett_netlink_sock_diag);
/* Netlink message header (nlmsghdr) */
- offset = dissect_netlink_header(tvb, nlmsg_tree, offset, data->encoding, &hfi_netlink_sock_diag_nltype, NULL);
+ offset = dissect_netlink_header(tvb, nlmsg_tree, offset, nl_data->encoding, &hfi_netlink_sock_diag_nltype, NULL);
- info.encoding = data->encoding;
+ info.encoding = nl_data->encoding;
info.pinfo = pinfo;
- info.data = data;
+ info.nl_data = nl_data;
- switch (data->type) {
+ switch (nl_data->type) {
case WS_TCPDIAG_GETSOCK:
case WS_DCCPDIAG_GETSOCK:
/* XXX, inet_diag_rcv_msg_compat */
break;
case WS_SOCK_DIAG_BY_FAMILY:
- offset = dissect_sock_diag_by_family(tvb, &info, nlmsg_tree, offset);
+ offset = dissect_sock_diag_by_family(tvb, &info, nl_data, nlmsg_tree, offset);
break;
}
diff --git a/epan/dissectors/packet-netlink.c b/epan/dissectors/packet-netlink.c
index 6c222bdb05..88cdab64dd 100644
--- a/epan/dissectors/packet-netlink.c
+++ b/epan/dissectors/packet-netlink.c
@@ -303,7 +303,7 @@ dissect_netlink_attributes_common(tvbuff_t *tvb, header_field_info *hfi_type, in
}
}
- if (!cb(tvb, data, attr_tree, rta_type, offset, rta_len - 4)) {
+ if (!cb(tvb, data, nl_data, attr_tree, rta_type, offset, rta_len - 4)) {
proto_tree_add_item(attr_tree, &hfi_netlink_attr_data, tvb, offset, rta_len - 4, encoding);
}
} else {
@@ -424,7 +424,7 @@ dissect_netlink_error(tvbuff_t *tvb, proto_tree *tree, int offset, int encoding)
}
static int
-dissect_netlink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *_data _U_)
+dissect_netlink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
guint16 protocol, hatype;
proto_item *ti;
@@ -519,15 +519,15 @@ dissect_netlink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *_data
* Try to invoke subdissectors for non-control messages.
*/
if (msg_type >= WS_NLMSG_MIN_TYPE && pkt_len > 16) {
- struct packet_netlink_data data;
+ struct packet_netlink_data nl_data;
- data.magic = PACKET_NETLINK_MAGIC;
- data.encoding = encoding;
- data.type = msg_type;
+ nl_data.magic = PACKET_NETLINK_MAGIC;
+ nl_data.encoding = encoding;
+ nl_data.type = msg_type;
next_tvb = tvb_new_subset_length(tvb, offset, pkt_len);
- if (dissector_try_uint_new(netlink_dissector_table, protocol, next_tvb, pinfo, tree, TRUE, &data)) {
+ if (dissector_try_uint_new(netlink_dissector_table, protocol, next_tvb, pinfo, tree, TRUE, &nl_data)) {
dissected = TRUE;
}
}
diff --git a/epan/dissectors/packet-netlink.h b/epan/dissectors/packet-netlink.h
index 06b9172263..abfcf8e5c5 100644
--- a/epan/dissectors/packet-netlink.h
+++ b/epan/dissectors/packet-netlink.h
@@ -107,7 +107,7 @@ struct packet_netlink_data {
*/
int dissect_netlink_header(tvbuff_t *tvb, proto_tree *tree, int offset, int encoding, header_field_info *hfi_type, proto_item **pi_type);
-typedef int netlink_attributes_cb_t(tvbuff_t *, void *data, proto_tree *, int nla_type, int offset, int len);
+typedef int netlink_attributes_cb_t(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int nla_type, int offset, int len);
int dissect_netlink_attributes(tvbuff_t *tvb, header_field_info *hfi_type, int ett, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int offset, int length, netlink_attributes_cb_t cb);
@@ -128,8 +128,8 @@ int dissect_netlink_attributes_array(tvbuff_t *tvb, header_field_info *hfi_type,
* Format of the data that is passed to "genl.family" dissectors.
*/
typedef struct {
- struct packet_netlink_data *data;
- int encoding; /* copy of data->encoding */
+ struct packet_netlink_data *nl_data;
+ int encoding; /* copy of nl_data->encoding */
/* For internal use by genl. */
proto_tree *genl_tree;
@@ -138,6 +138,19 @@ typedef struct {
guint8 cmd; /* Command number */
} genl_info_t;
-int dissect_genl_header(tvbuff_t *tvb, genl_info_t *genl_info, 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);
#endif /* __PACKET_NETLINK_H__ */
+
+/*
+ * Editor modelines - https://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */